From 2499c2829f30ace1569cb1517586b3c8b176f330 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Wed, 2 Sep 2026 11:46:29 +0200 Subject: [PATCH 01/36] feat(llc): add the OpenAPI generated client and its generation tooling (#2931) Co-authored-by: Claude Opus 5 (1M context) --- .claude/skills/openapi-codegen/SKILL.md | 163 + .claude/skills/openapi-migration/SKILL.md | 287 + .github/workflows/pana.yml | 18 + docs/docs_screenshots/pubspec.yaml | 9 + melos.yaml | 13 +- migrations/v11-migration.md | 230 + openapi-migration/01-foundation.md | 104 + .../02-devices-and-push-preferences.md | 48 + openapi-migration/03-user-groups.md | 55 + openapi-migration/04-roles-guest-and-app.md | 48 + openapi-migration/05-polls.md | 68 + openapi-migration/06-reminders.md | 47 + openapi-migration/07-threads-and-drafts.md | 54 + .../08-moderation-and-blocklists.md | 85 + openapi-migration/09-users.md | 59 + openapi-migration/10-messages.md | 68 + openapi-migration/11-channels-and-members.md | 93 + openapi-migration/12-uploads-cdn.md | 60 + openapi-migration/README.md | 106 + openapi-migration/tool/generate_plan.py | 368 ++ packages/stream_chat/CHANGELOG.md | 4 + packages/stream_chat/build.yaml | 14 +- packages/stream_chat/lib/open_api/api.dart | 11 + .../lib/open_api/api/default_api.dart | 784 +++ .../lib/open_api/api/default_api.g.dart | 5347 +++++++++++++++++ .../lib/open_api/model/action.dart | 51 + .../lib/open_api/model/action.freezed.dart | 105 + .../lib/open_api/model/action.g.dart | 23 + .../open_api/model/action_log_response.dart | 87 + .../model/action_log_response.freezed.dart | 184 + .../open_api/model/action_log_response.g.dart | 43 + .../lib/open_api/model/action_sequence.dart | 61 + .../model/action_sequence.freezed.dart | 136 + .../lib/open_api/model/action_sequence.g.dart | 27 + .../model/add_user_group_members_request.dart | 41 + ...dd_user_group_members_request.freezed.dart | 97 + .../add_user_group_members_request.g.dart | 23 + .../add_user_group_members_response.dart | 36 + ...d_user_group_members_response.freezed.dart | 82 + .../add_user_group_members_response.g.dart | 21 + .../model/ai_audio_config_request.dart | 36 + .../ai_audio_config_request.freezed.dart | 86 + .../model/ai_audio_config_request.g.dart | 21 + .../model/ai_audio_config_response.dart | 41 + .../ai_audio_config_response.freezed.dart | 97 + .../model/ai_audio_config_response.g.dart | 23 + .../lib/open_api/model/ai_image_config.dart | 46 + .../model/ai_image_config.freezed.dart | 109 + .../lib/open_api/model/ai_image_config.g.dart | 21 + .../model/ai_image_label_definition.dart | 46 + .../ai_image_label_definition.freezed.dart | 99 + .../model/ai_image_label_definition.g.dart | 25 + .../model/ai_indicator_clear_event.dart | 63 + .../ai_indicator_clear_event.freezed.dart | 137 + .../model/ai_indicator_clear_event.g.dart | 49 + .../model/ai_indicator_stop_event.dart | 63 + .../ai_indicator_stop_event.freezed.dart | 137 + .../model/ai_indicator_stop_event.g.dart | 49 + .../model/ai_indicator_update_event.dart | 78 + .../ai_indicator_update_event.freezed.dart | 164 + .../model/ai_indicator_update_event.g.dart | 55 + .../lib/open_api/model/ai_text_config.dart | 51 + .../model/ai_text_config.freezed.dart | 121 + .../lib/open_api/model/ai_text_config.g.dart | 25 + .../lib/open_api/model/ai_video_config.dart | 41 + .../model/ai_video_config.freezed.dart | 96 + .../lib/open_api/model/ai_video_config.g.dart | 19 + .../open_api/model/app_event_response.dart | 51 + .../model/app_event_response.freezed.dart | 120 + .../open_api/model/app_event_response.g.dart | 31 + .../open_api/model/app_response_fields.dart | 61 + .../model/app_response_fields.freezed.dart | 138 + .../open_api/model/app_response_fields.g.dart | 31 + .../lib/open_api/model/app_updated_event.dart | 53 + .../model/app_updated_event.freezed.dart | 118 + .../open_api/model/app_updated_event.g.dart | 41 + .../open_api/model/appeal_item_response.dart | 143 + .../model/appeal_item_response.freezed.dart | 290 + .../model/appeal_item_response.g.dart | 81 + .../lib/open_api/model/appeal_request.dart | 51 + .../model/appeal_request.freezed.dart | 121 + .../lib/open_api/model/appeal_request.g.dart | 23 + .../lib/open_api/model/appeal_response.dart | 36 + .../model/appeal_response.freezed.dart | 81 + .../lib/open_api/model/appeal_response.g.dart | 17 + .../lib/open_api/model/attachment.dart | 136 + .../open_api/model/attachment.freezed.dart | 268 + .../lib/open_api/model/attachment.g.dart | 57 + .../model/automod_details_response.dart | 51 + .../automod_details_response.freezed.dart | 123 + .../model/automod_details_response.g.dart | 35 + ...automod_platform_circumvention_config.dart | 42 + ...platform_circumvention_config.freezed.dart | 98 + ...tomod_platform_circumvention_config.g.dart | 23 + .../lib/open_api/model/automod_rule.dart | 54 + .../open_api/model/automod_rule.freezed.dart | 89 + .../lib/open_api/model/automod_rule.g.dart | 19 + .../automod_semantic_filters_config.dart | 42 + ...tomod_semantic_filters_config.freezed.dart | 101 + .../automod_semantic_filters_config.g.dart | 27 + .../model/automod_semantic_filters_rule.dart | 54 + ...automod_semantic_filters_rule.freezed.dart | 96 + .../automod_semantic_filters_rule.g.dart | 23 + .../model/automod_toxicity_config.dart | 41 + .../automod_toxicity_config.freezed.dart | 97 + .../model/automod_toxicity_config.g.dart | 23 + .../open_api/model/aws_rekognition_rule.dart | 59 + .../model/aws_rekognition_rule.freezed.dart | 112 + .../model/aws_rekognition_rule.g.dart | 21 + .../model/ban_action_request_payload.dart | 81 + .../ban_action_request_payload.freezed.dart | 156 + .../model/ban_action_request_payload.g.dart | 39 + .../lib/open_api/model/ban_info_response.dart | 68 + .../model/ban_info_response.freezed.dart | 145 + .../open_api/model/ban_info_response.g.dart | 47 + .../lib/open_api/model/ban_options.dart | 61 + .../open_api/model/ban_options.freezed.dart | 115 + .../lib/open_api/model/ban_options.g.dart | 25 + .../lib/open_api/model/ban_request.dart | 81 + .../open_api/model/ban_request.freezed.dart | 151 + .../lib/open_api/model/ban_request.g.dart | 33 + .../lib/open_api/model/ban_response.dart | 63 + .../open_api/model/ban_response.freezed.dart | 134 + .../lib/open_api/model/ban_response.g.dart | 45 + .../model/block_action_request_payload.dart | 31 + .../block_action_request_payload.freezed.dart | 76 + .../model/block_action_request_payload.g.dart | 15 + .../lib/open_api/model/block_list_config.dart | 46 + .../model/block_list_config.freezed.dart | 109 + .../open_api/model/block_list_config.g.dart | 21 + .../open_api/model/block_list_options.dart | 46 + .../model/block_list_options.freezed.dart | 81 + .../open_api/model/block_list_options.g.dart | 17 + .../open_api/model/block_list_response.dart | 88 + .../model/block_list_response.freezed.dart | 191 + .../open_api/model/block_list_response.g.dart | 59 + .../lib/open_api/model/block_list_rule.dart | 56 + .../model/block_list_rule.freezed.dart | 87 + .../lib/open_api/model/block_list_rule.g.dart | 19 + .../open_api/model/block_users_request.dart | 31 + .../model/block_users_request.freezed.dart | 75 + .../open_api/model/block_users_request.g.dart | 14 + .../open_api/model/block_users_response.dart | 47 + .../model/block_users_response.freezed.dart | 109 + .../model/block_users_response.g.dart | 23 + .../open_api/model/blocked_user_response.dart | 52 + .../model/blocked_user_response.freezed.dart | 119 + .../model/blocked_user_response.g.dart | 29 + .../model/bodyguard_profile_summary.dart | 41 + .../bodyguard_profile_summary.freezed.dart | 92 + .../model/bodyguard_profile_summary.g.dart | 23 + .../lib/open_api/model/bodyguard_rule.dart | 57 + .../model/bodyguard_rule.freezed.dart | 103 + .../lib/open_api/model/bodyguard_rule.g.dart | 21 + .../model/bodyguard_severity_rule.dart | 62 + .../bodyguard_severity_rule.freezed.dart | 85 + .../model/bodyguard_severity_rule.g.dart | 21 + .../model/bulk_action_appeals_request.dart | 73 + .../bulk_action_appeals_request.freezed.dart | 137 + .../model/bulk_action_appeals_request.g.dart | 53 + .../model/bulk_action_appeals_response.dart | 41 + .../bulk_action_appeals_response.freezed.dart | 101 + .../model/bulk_action_appeals_response.g.dart | 23 + .../lib/open_api/model/bulk_appeal_error.dart | 36 + .../model/bulk_appeal_error.freezed.dart | 81 + .../open_api/model/bulk_appeal_error.g.dart | 17 + .../open_api/model/bulk_appeal_result.dart | 36 + .../model/bulk_appeal_result.freezed.dart | 81 + .../open_api/model/bulk_appeal_result.g.dart | 21 + .../bulk_delete_action_config_request.dart | 32 + ..._delete_action_config_request.freezed.dart | 76 + .../bulk_delete_action_config_request.g.dart | 17 + .../bulk_delete_action_config_response.dart | 37 + ...delete_action_config_response.freezed.dart | 82 + .../bulk_delete_action_config_response.g.dart | 21 + .../bulk_upsert_action_config_request.dart | 32 + ..._upsert_action_config_request.freezed.dart | 82 + .../bulk_upsert_action_config_request.g.dart | 21 + .../bulk_upsert_action_config_response.dart | 37 + ...upsert_action_config_response.freezed.dart | 92 + .../bulk_upsert_action_config_response.g.dart | 25 + .../open_api/model/bypass_action_request.dart | 31 + .../model/bypass_action_request.freezed.dart | 76 + .../model/bypass_action_request.g.dart | 14 + .../open_api/model/call_action_options.dart | 61 + .../model/call_action_options.freezed.dart | 136 + .../open_api/model/call_action_options.g.dart | 27 + .../call_custom_property_parameters.dart | 37 + ...ll_custom_property_parameters.freezed.dart | 82 + .../call_custom_property_parameters.g.dart | 21 + .../model/call_rule_action_sequence.dart | 41 + .../call_rule_action_sequence.freezed.dart | 101 + .../model/call_rule_action_sequence.g.dart | 27 + .../model/call_type_rule_parameters.dart | 31 + .../call_type_rule_parameters.freezed.dart | 76 + .../model/call_type_rule_parameters.g.dart | 15 + .../call_violation_count_parameters.dart | 37 + ...ll_violation_count_parameters.freezed.dart | 82 + .../call_violation_count_parameters.g.dart | 21 + .../model/cast_poll_vote_request.dart | 31 + .../model/cast_poll_vote_request.freezed.dart | 76 + .../model/cast_poll_vote_request.g.dart | 15 + .../model/channel_config_overrides.dart | 128 + .../channel_config_overrides.freezed.dart | 219 + .../model/channel_config_overrides.g.dart | 59 + .../model/channel_config_with_info.dart | 261 + .../channel_config_with_info.freezed.dart | 428 ++ .../model/channel_config_with_info.g.dart | 113 + .../model/channel_context_response.dart | 46 + .../channel_context_response.freezed.dart | 99 + .../model/channel_context_response.g.dart | 25 + .../open_api/model/channel_created_event.dart | 93 + .../model/channel_created_event.freezed.dart | 196 + .../model/channel_created_event.g.dart | 61 + .../open_api/model/channel_deleted_event.dart | 93 + .../model/channel_deleted_event.freezed.dart | 196 + .../model/channel_deleted_event.g.dart | 61 + .../open_api/model/channel_frozen_event.dart | 63 + .../model/channel_frozen_event.freezed.dart | 136 + .../model/channel_frozen_event.g.dart | 45 + .../model/channel_get_or_create_request.dart | 76 + ...channel_get_or_create_request.freezed.dart | 168 + .../channel_get_or_create_request.g.dart | 41 + .../open_api/model/channel_hidden_event.dart | 98 + .../model/channel_hidden_event.freezed.dart | 204 + .../model/channel_hidden_event.g.dart | 61 + .../lib/open_api/model/channel_input.dart | 91 + .../open_api/model/channel_input.freezed.dart | 198 + .../lib/open_api/model/channel_input.g.dart | 47 + .../open_api/model/channel_input_request.dart | 76 + .../model/channel_input_request.freezed.dart | 169 + .../model/channel_input_request.g.dart | 43 + .../open_api/model/channel_kicked_event.dart | 83 + .../model/channel_kicked_event.freezed.dart | 177 + .../model/channel_kicked_event.g.dart | 53 + .../channel_member_partial_response.dart | 42 + ...annel_member_partial_response.freezed.dart | 102 + .../channel_member_partial_response.g.dart | 23 + .../model/channel_member_request.dart | 46 + .../model/channel_member_request.freezed.dart | 110 + .../model/channel_member_request.g.dart | 25 + .../model/channel_member_response.dart | 145 + .../channel_member_response.freezed.dart | 281 + .../model/channel_member_response.g.dart | 117 + ...channel_message_count_rule_parameters.dart | 37 + ...message_count_rule_parameters.freezed.dart | 83 + ...annel_message_count_rule_parameters.g.dart | 21 + .../lib/open_api/model/channel_metadata.dart | 72 + .../model/channel_metadata.freezed.dart | 154 + .../open_api/model/channel_metadata.g.dart | 47 + .../lib/open_api/model/channel_mute.dart | 54 + .../open_api/model/channel_mute.freezed.dart | 109 + .../lib/open_api/model/channel_mute.g.dart | 43 + .../model/channel_own_capability.dart | 55 + .../channel_push_preferences_response.dart | 43 + ...nel_push_preferences_response.freezed.dart | 96 + .../channel_push_preferences_response.g.dart | 43 + .../lib/open_api/model/channel_response.dart | 173 + .../model/channel_response.freezed.dart | 337 ++ .../open_api/model/channel_response.g.dart | 123 + .../model/channel_state_response.dart | 107 + .../model/channel_state_response.freezed.dart | 228 + .../model/channel_state_response.g.dart | 87 + .../model/channel_state_response_fields.dart | 102 + ...channel_state_response_fields.freezed.dart | 219 + .../channel_state_response_fields.g.dart | 85 + .../model/channel_truncated_event.dart | 103 + .../channel_truncated_event.freezed.dart | 214 + .../model/channel_truncated_event.g.dart | 65 + .../model/channel_un_frozen_event.dart | 63 + .../channel_un_frozen_event.freezed.dart | 137 + .../model/channel_un_frozen_event.g.dart | 49 + .../open_api/model/channel_updated_event.dart | 103 + .../model/channel_updated_event.freezed.dart | 214 + .../model/channel_updated_event.g.dart | 65 + .../open_api/model/channel_visible_event.dart | 93 + .../model/channel_visible_event.freezed.dart | 196 + .../model/channel_visible_event.g.dart | 61 + .../model/chat_draft_payload_response.dart | 91 + .../chat_draft_payload_response.freezed.dart | 197 + .../model/chat_draft_payload_response.g.dart | 47 + .../open_api/model/chat_draft_response.dart | 57 + .../model/chat_draft_response.freezed.dart | 127 + .../open_api/model/chat_draft_response.g.dart | 37 + .../open_api/model/chat_message_response.dart | 277 + .../model/chat_message_response.freezed.dart | 555 ++ .../model/chat_message_response.g.dart | 194 + .../model/chat_moderation_v2_response.dart | 66 + .../chat_moderation_v2_response.freezed.dart | 154 + .../model/chat_moderation_v2_response.g.dart | 33 + .../lib/open_api/model/chat_preferences.dart | 66 + .../model/chat_preferences.freezed.dart | 149 + .../open_api/model/chat_preferences.g.dart | 29 + .../model/chat_preferences_input.dart | 124 + .../model/chat_preferences_input.freezed.dart | 137 + .../model/chat_preferences_input.g.dart | 59 + .../model/chat_preferences_response.dart | 61 + .../chat_preferences_response.freezed.dart | 137 + .../model/chat_preferences_response.g.dart | 31 + .../model/chat_reaction_group_response.dart | 53 + .../chat_reaction_group_response.freezed.dart | 122 + .../model/chat_reaction_group_response.g.dart | 39 + .../chat_reaction_group_user_response.dart | 43 + ..._reaction_group_user_response.freezed.dart | 92 + .../chat_reaction_group_user_response.g.dart | 25 + .../model/chat_reaction_response.dart | 68 + .../model/chat_reaction_response.freezed.dart | 146 + .../model/chat_reaction_response.g.dart | 37 + .../model/chat_reminder_response_data.dart | 69 + .../chat_reminder_response_data.freezed.dart | 146 + .../model/chat_reminder_response_data.g.dart | 53 + .../chat_shared_location_response_data.dart | 80 + ...shared_location_response_data.freezed.dart | 164 + .../chat_shared_location_response_data.g.dart | 57 + .../model/closed_caption_rule_parameters.dart | 51 + ...losed_caption_rule_parameters.freezed.dart | 125 + .../closed_caption_rule_parameters.g.dart | 29 + .../lib/open_api/model/command.dart | 58 + .../lib/open_api/model/command.freezed.dart | 121 + .../lib/open_api/model/command.g.dart | 47 + .../model/config_overrides_request.dart | 128 + .../config_overrides_request.freezed.dart | 219 + .../model/config_overrides_request.g.dart | 59 + .../lib/open_api/model/config_response.dart | 133 + .../model/config_response.freezed.dart | 285 + .../lib/open_api/model/config_response.g.dart | 107 + .../model/content_count_rule_parameters.dart | 36 + ...content_count_rule_parameters.freezed.dart | 82 + .../content_count_rule_parameters.g.dart | 21 + ...tent_custom_property_count_parameters.dart | 47 + ...tom_property_count_parameters.freezed.dart | 105 + ...nt_custom_property_count_parameters.g.dart | 24 + .../content_custom_property_parameters.dart | 37 + ...nt_custom_property_parameters.freezed.dart | 82 + .../content_custom_property_parameters.g.dart | 21 + .../model/create_block_list_request.dart | 79 + .../create_block_list_request.freezed.dart | 156 + .../model/create_block_list_request.g.dart | 33 + .../model/create_block_list_response.dart | 36 + .../create_block_list_response.freezed.dart | 82 + .../model/create_block_list_response.g.dart | 21 + .../open_api/model/create_device_request.dart | 62 + .../model/create_device_request.freezed.dart | 119 + .../model/create_device_request.g.dart | 27 + .../open_api/model/create_draft_request.dart | 31 + .../model/create_draft_request.freezed.dart | 75 + .../model/create_draft_request.g.dart | 15 + .../open_api/model/create_draft_response.dart | 36 + .../model/create_draft_response.freezed.dart | 82 + .../model/create_draft_response.g.dart | 19 + .../open_api/model/create_guest_request.dart | 31 + .../model/create_guest_request.freezed.dart | 75 + .../model/create_guest_request.g.dart | 15 + .../open_api/model/create_guest_response.dart | 41 + .../model/create_guest_response.freezed.dart | 92 + .../model/create_guest_response.g.dart | 21 + .../model/create_poll_option_request.dart | 36 + .../create_poll_option_request.freezed.dart | 86 + .../model/create_poll_option_request.g.dart | 18 + .../open_api/model/create_poll_request.dart | 90 + .../model/create_poll_request.freezed.dart | 176 + .../open_api/model/create_poll_request.g.dart | 41 + .../open_api/model/create_queue_request.dart | 60 + .../model/create_queue_request.freezed.dart | 118 + .../model/create_queue_request.g.dart | 23 + .../model/create_reminder_request.dart | 32 + .../create_reminder_request.freezed.dart | 76 + .../model/create_reminder_request.g.dart | 35 + .../model/create_user_group_request.dart | 51 + .../create_user_group_request.freezed.dart | 119 + .../model/create_user_group_request.g.dart | 27 + .../model/create_user_group_response.dart | 36 + .../create_user_group_response.freezed.dart | 82 + .../model/create_user_group_response.g.dart | 21 + .../model/custom_action_request_payload.dart | 36 + ...custom_action_request_payload.freezed.dart | 86 + .../custom_action_request_payload.g.dart | 18 + .../lib/open_api/model/custom_event.dart | 48 + .../open_api/model/custom_event.freezed.dart | 107 + .../lib/open_api/model/custom_event.g.dart | 39 + .../stream_chat/lib/open_api/model/data.dart | 31 + .../lib/open_api/model/data.freezed.dart | 67 + .../lib/open_api/model/data.g.dart | 13 + .../model/delete_action_config_response.dart | 36 + ...delete_action_config_response.freezed.dart | 82 + .../delete_action_config_response.g.dart | 21 + .../delete_activity_request_payload.dart | 47 + ...lete_activity_request_payload.freezed.dart | 104 + .../delete_activity_request_payload.g.dart | 25 + .../model/delete_channel_response.dart | 36 + .../delete_channel_response.freezed.dart | 82 + .../model/delete_channel_response.g.dart | 21 + .../model/delete_channels_request.dart | 36 + .../delete_channels_request.freezed.dart | 86 + .../model/delete_channels_request.g.dart | 21 + .../model/delete_channels_response.dart | 41 + .../delete_channels_response.freezed.dart | 101 + .../model/delete_channels_response.g.dart | 28 + .../delete_channels_result_response.dart | 37 + ...lete_channels_result_response.freezed.dart | 82 + .../delete_channels_result_response.g.dart | 18 + .../model/delete_comment_request_payload.dart | 46 + ...elete_comment_request_payload.freezed.dart | 104 + .../delete_comment_request_payload.g.dart | 25 + .../model/delete_message_request_payload.dart | 46 + ...elete_message_request_payload.freezed.dart | 104 + .../delete_message_request_payload.g.dart | 25 + .../model/delete_message_response.dart | 36 + .../delete_message_response.freezed.dart | 82 + .../model/delete_message_response.g.dart | 21 + .../delete_moderation_config_response.dart | 32 + ...te_moderation_config_response.freezed.dart | 76 + .../delete_moderation_config_response.g.dart | 15 + .../delete_reaction_request_payload.dart | 47 + ...lete_reaction_request_payload.freezed.dart | 104 + .../delete_reaction_request_payload.g.dart | 25 + .../model/delete_reaction_response.dart | 41 + .../delete_reaction_response.freezed.dart | 96 + .../model/delete_reaction_response.g.dart | 23 + .../model/delete_reminder_response.dart | 31 + .../delete_reminder_response.freezed.dart | 76 + .../model/delete_reminder_response.g.dart | 15 + .../delete_user_messages_request_payload.dart | 68 + ...user_messages_request_payload.freezed.dart | 128 + ...elete_user_messages_request_payload.g.dart | 31 + .../model/delete_user_request_payload.dart | 61 + .../delete_user_request_payload.freezed.dart | 143 + .../model/delete_user_request_payload.g.dart | 31 + .../model/delivered_message_payload.dart | 36 + .../delivered_message_payload.freezed.dart | 82 + .../model/delivered_message_payload.g.dart | 18 + .../model/delivery_receipts_response.dart | 31 + .../delivery_receipts_response.freezed.dart | 76 + .../model/delivery_receipts_response.g.dart | 15 + .../lib/open_api/model/device_response.dart | 72 + .../model/device_response.freezed.dart | 154 + .../lib/open_api/model/device_response.g.dart | 33 + .../open_api/model/draft_deleted_event.dart | 63 + .../model/draft_deleted_event.freezed.dart | 136 + .../open_api/model/draft_deleted_event.g.dart | 45 + .../model/draft_payload_response.dart | 91 + .../model/draft_payload_response.freezed.dart | 197 + .../model/draft_payload_response.g.dart | 47 + .../lib/open_api/model/draft_response.dart | 62 + .../model/draft_response.freezed.dart | 136 + .../lib/open_api/model/draft_response.g.dart | 39 + .../open_api/model/draft_updated_event.dart | 63 + .../model/draft_updated_event.freezed.dart | 136 + .../open_api/model/draft_updated_event.g.dart | 45 + .../lib/open_api/model/duration_response.dart | 31 + .../model/duration_response.freezed.dart | 75 + .../open_api/model/duration_response.g.dart | 14 + .../lib/open_api/model/enriched_activity.dart | 86 + .../model/enriched_activity.freezed.dart | 190 + .../open_api/model/enriched_activity.g.dart | 53 + .../lib/open_api/model/enriched_reaction.dart | 81 + .../model/enriched_reaction.freezed.dart | 184 + .../open_api/model/enriched_reaction.g.dart | 51 + .../model/entity_creator_response.dart | 137 + .../entity_creator_response.freezed.dart | 271 + .../model/entity_creator_response.g.dart | 99 + .../lib/open_api/model/escalate_payload.dart | 41 + .../model/escalate_payload.freezed.dart | 91 + .../open_api/model/escalate_payload.g.dart | 19 + .../open_api/model/escalation_metadata.dart | 41 + .../model/escalation_metadata.freezed.dart | 91 + .../open_api/model/escalation_metadata.g.dart | 19 + .../lib/open_api/model/event_request.dart | 41 + .../open_api/model/event_request.freezed.dart | 96 + .../lib/open_api/model/event_request.g.dart | 19 + .../lib/open_api/model/event_response.dart | 36 + .../model/event_response.freezed.dart | 81 + .../lib/open_api/model/event_response.g.dart | 17 + .../model/feeds_activity_location.dart | 36 + .../feeds_activity_location.freezed.dart | 82 + .../model/feeds_activity_location.g.dart | 18 + .../model/feeds_bookmark_response.dart | 63 + .../feeds_bookmark_response.freezed.dart | 137 + .../model/feeds_bookmark_response.g.dart | 35 + .../feeds_enriched_collection_response.dart | 64 + ..._enriched_collection_response.freezed.dart | 137 + .../feeds_enriched_collection_response.g.dart | 35 + .../open_api/model/feeds_feed_response.dart | 119 + .../model/feeds_feed_response.freezed.dart | 238 + .../open_api/model/feeds_feed_response.g.dart | 75 + .../model/feeds_notification_comment.dart | 46 + .../feeds_notification_comment.freezed.dart | 113 + .../model/feeds_notification_comment.g.dart | 27 + .../model/feeds_notification_context.dart | 36 + .../feeds_notification_context.freezed.dart | 85 + .../model/feeds_notification_context.g.dart | 29 + .../feeds_notification_parent_activity.dart | 52 + ..._notification_parent_activity.freezed.dart | 122 + .../feeds_notification_parent_activity.g.dart | 29 + .../model/feeds_notification_target.dart | 71 + .../feeds_notification_target.freezed.dart | 158 + .../model/feeds_notification_target.g.dart | 45 + .../model/feeds_notification_trigger.dart | 46 + .../feeds_notification_trigger.freezed.dart | 110 + .../model/feeds_notification_trigger.g.dart | 29 + .../lib/open_api/model/feeds_preferences.dart | 129 + .../model/feeds_preferences.freezed.dart | 148 + .../open_api/model/feeds_preferences.g.dart | 43 + .../model/feeds_preferences_response.dart | 66 + .../feeds_preferences_response.freezed.dart | 149 + .../model/feeds_preferences_response.g.dart | 35 + .../model/feeds_reaction_group_response.dart | 43 + ...feeds_reaction_group_response.freezed.dart | 92 + .../feeds_reaction_group_response.g.dart | 31 + .../model/feeds_reaction_response.dart | 63 + .../feeds_reaction_response.freezed.dart | 137 + .../model/feeds_reaction_response.g.dart | 35 + .../open_api/model/feeds_share_response.dart | 42 + .../model/feeds_share_response.freezed.dart | 91 + .../model/feeds_share_response.g.dart | 21 + .../model/feeds_v3_activity_response.dart | 281 + .../feeds_v3_activity_response.freezed.dart | 562 ++ .../model/feeds_v3_activity_response.g.dart | 201 + .../model/feeds_v3_comment_response.dart | 165 + .../feeds_v3_comment_response.freezed.dart | 332 + .../model/feeds_v3_comment_response.g.dart | 118 + .../stream_chat/lib/open_api/model/field.dart | 41 + .../lib/open_api/model/field.freezed.dart | 85 + .../lib/open_api/model/field.g.dart | 19 + .../open_api/model/file_upload_config.dart | 51 + .../model/file_upload_config.freezed.dart | 130 + .../open_api/model/file_upload_config.g.dart | 23 + .../open_api/model/file_upload_request.dart | 36 + .../model/file_upload_request.freezed.dart | 81 + .../open_api/model/file_upload_request.g.dart | 17 + .../open_api/model/file_upload_response.dart | 41 + .../model/file_upload_response.freezed.dart | 91 + .../model/file_upload_response.g.dart | 19 + .../model/filter_config_response.dart | 56 + .../model/filter_config_response.freezed.dart | 143 + .../model/filter_config_response.g.dart | 31 + .../model/flag_count_rule_parameters.dart | 31 + .../flag_count_rule_parameters.freezed.dart | 76 + .../model/flag_count_rule_parameters.g.dart | 15 + .../open_api/model/flag_details_response.dart | 41 + .../model/flag_details_response.freezed.dart | 101 + .../model/flag_details_response.g.dart | 25 + .../model/flag_feedback_response.dart | 42 + .../model/flag_feedback_response.freezed.dart | 97 + .../model/flag_feedback_response.g.dart | 25 + .../open_api/model/flag_item_response.dart | 36 + .../model/flag_item_response.freezed.dart | 81 + .../open_api/model/flag_item_response.g.dart | 17 + .../model/flag_message_details_response.dart | 46 + ...flag_message_details_response.freezed.dart | 104 + .../flag_message_details_response.g.dart | 25 + .../lib/open_api/model/flag_request.dart | 56 + .../open_api/model/flag_request.freezed.dart | 125 + .../lib/open_api/model/flag_request.g.dart | 29 + .../lib/open_api/model/flag_user_options.dart | 31 + .../model/flag_user_options.freezed.dart | 75 + .../open_api/model/flag_user_options.g.dart | 12 + .../lib/open_api/model/flood_config.dart | 41 + .../open_api/model/flood_config.freezed.dart | 98 + .../lib/open_api/model/flood_config.g.dart | 23 + .../model/flood_identical_config.dart | 46 + .../model/flood_identical_config.freezed.dart | 99 + .../model/flood_identical_config.g.dart | 25 + .../flood_identical_rule_parameters.dart | 42 + ...ood_identical_rule_parameters.freezed.dart | 97 + .../flood_identical_rule_parameters.g.dart | 23 + .../open_api/model/flood_similar_config.dart | 51 + .../model/flood_similar_config.freezed.dart | 119 + .../model/flood_similar_config.g.dart | 23 + .../model/flood_similar_rule_parameters.dart | 46 + ...flood_similar_rule_parameters.freezed.dart | 111 + .../flood_similar_rule_parameters.g.dart | 25 + .../open_api/model/full_user_response.dart | 183 + .../model/full_user_response.freezed.dart | 356 ++ .../open_api/model/full_user_response.g.dart | 125 + .../model/future_channel_ban_response.dart | 58 + .../future_channel_ban_response.freezed.dart | 128 + .../model/future_channel_ban_response.g.dart | 47 + .../model/get_action_config_response.dart | 36 + .../get_action_config_response.freezed.dart | 92 + .../model/get_action_config_response.g.dart | 34 + .../open_api/model/get_appeal_response.dart | 36 + .../model/get_appeal_response.freezed.dart | 81 + .../open_api/model/get_appeal_response.g.dart | 17 + .../model/get_application_response.dart | 36 + .../get_application_response.freezed.dart | 82 + .../model/get_application_response.g.dart | 21 + .../model/get_blocked_users_response.dart | 36 + .../get_blocked_users_response.freezed.dart | 86 + .../model/get_blocked_users_response.g.dart | 23 + .../open_api/model/get_config_response.dart | 36 + .../model/get_config_response.freezed.dart | 81 + .../open_api/model/get_config_response.g.dart | 17 + .../open_api/model/get_draft_response.dart | 36 + .../model/get_draft_response.freezed.dart | 81 + .../open_api/model/get_draft_response.g.dart | 17 + .../model/get_many_messages_response.dart | 36 + .../get_many_messages_response.freezed.dart | 86 + .../model/get_many_messages_response.g.dart | 23 + .../open_api/model/get_message_response.dart | 36 + .../model/get_message_response.freezed.dart | 81 + .../model/get_message_response.g.dart | 19 + .../lib/open_api/model/get_og_response.dart | 141 + .../model/get_og_response.freezed.dart | 280 + .../lib/open_api/model/get_og_response.g.dart | 59 + .../model/get_pinned_messages_response.dart | 36 + .../get_pinned_messages_response.freezed.dart | 86 + .../model/get_pinned_messages_response.g.dart | 23 + .../model/get_reactions_response.dart | 36 + .../model/get_reactions_response.freezed.dart | 86 + .../model/get_reactions_response.g.dart | 23 + .../open_api/model/get_replies_response.dart | 36 + .../model/get_replies_response.freezed.dart | 85 + .../model/get_replies_response.g.dart | 19 + .../open_api/model/get_thread_response.dart | 36 + .../model/get_thread_response.freezed.dart | 81 + .../open_api/model/get_thread_response.g.dart | 19 + .../model/get_user_group_response.dart | 36 + .../get_user_group_response.freezed.dart | 82 + .../model/get_user_group_response.g.dart | 21 + .../open_api/model/google_vision_config.dart | 31 + .../model/google_vision_config.freezed.dart | 75 + .../model/google_vision_config.g.dart | 14 + .../model/grouped_channels_bucket.dart | 46 + .../grouped_channels_bucket.freezed.dart | 110 + .../model/grouped_channels_bucket.g.dart | 29 + .../model/grouped_channels_group_request.dart | 41 + ...rouped_channels_group_request.freezed.dart | 92 + .../grouped_channels_group_request.g.dart | 23 + .../model/grouped_query_channels_request.dart | 46 + ...rouped_query_channels_request.freezed.dart | 110 + .../grouped_query_channels_request.g.dart | 30 + .../grouped_query_channels_response.dart | 37 + ...ouped_query_channels_response.freezed.dart | 86 + .../grouped_query_channels_response.g.dart | 23 + .../lib/open_api/model/harm_config.dart | 51 + .../open_api/model/harm_config.freezed.dart | 118 + .../lib/open_api/model/harm_config.g.dart | 27 + .../open_api/model/hide_channel_request.dart | 31 + .../model/hide_channel_request.freezed.dart | 75 + .../model/hide_channel_request.g.dart | 14 + .../open_api/model/hide_channel_response.dart | 31 + .../model/hide_channel_response.freezed.dart | 76 + .../model/hide_channel_response.g.dart | 14 + .../model/image_content_parameters.dart | 41 + .../image_content_parameters.freezed.dart | 104 + .../model/image_content_parameters.g.dart | 23 + .../lib/open_api/model/image_data.dart | 51 + .../open_api/model/image_data.freezed.dart | 105 + .../lib/open_api/model/image_data.g.dart | 23 + .../open_api/model/image_rule_parameters.dart | 46 + .../model/image_rule_parameters.freezed.dart | 113 + .../model/image_rule_parameters.g.dart | 23 + .../lib/open_api/model/image_size.dart | 46 + .../open_api/model/image_size.freezed.dart | 92 + .../lib/open_api/model/image_size.g.dart | 21 + .../open_api/model/image_upload_request.dart | 41 + .../model/image_upload_request.freezed.dart | 99 + .../model/image_upload_request.g.dart | 21 + .../open_api/model/image_upload_response.dart | 46 + .../model/image_upload_response.freezed.dart | 113 + .../model/image_upload_response.g.dart | 25 + .../lib/open_api/model/images.dart | 61 + .../lib/open_api/model/images.freezed.dart | 132 + .../lib/open_api/model/images.g.dart | 35 + .../model/import_block_list_request.dart | 36 + .../import_block_list_request.freezed.dart | 86 + .../model/import_block_list_request.g.dart | 21 + .../model/import_block_list_response.dart | 36 + .../import_block_list_response.freezed.dart | 82 + .../model/import_block_list_response.g.dart | 21 + .../ip_content_count_rule_parameters.dart | 37 + ...content_count_rule_parameters.freezed.dart | 82 + .../ip_content_count_rule_parameters.g.dart | 21 + .../model/ip_flag_count_rule_parameters.dart | 46 + ...ip_flag_count_rule_parameters.freezed.dart | 113 + .../ip_flag_count_rule_parameters.g.dart | 25 + .../model/keyframe_ocr_rule_parameters.dart | 41 + .../keyframe_ocr_rule_parameters.freezed.dart | 100 + .../model/keyframe_ocr_rule_parameters.g.dart | 23 + .../model/keyframe_rule_parameters.dart | 46 + .../keyframe_rule_parameters.freezed.dart | 113 + .../model/keyframe_rule_parameters.g.dart | 25 + .../lib/open_api/model/label_response.dart | 41 + .../model/label_response.freezed.dart | 102 + .../lib/open_api/model/label_response.g.dart | 19 + .../lib/open_api/model/label_thresholds.dart | 36 + .../model/label_thresholds.freezed.dart | 81 + .../open_api/model/label_thresholds.g.dart | 17 + .../model/list_block_list_response.dart | 41 + .../list_block_list_response.freezed.dart | 104 + .../model/list_block_list_response.g.dart | 25 + .../open_api/model/list_devices_response.dart | 36 + .../model/list_devices_response.freezed.dart | 86 + .../model/list_devices_response.g.dart | 19 + .../open_api/model/list_queues_response.dart | 36 + .../model/list_queues_response.freezed.dart | 85 + .../model/list_queues_response.g.dart | 21 + .../model/list_user_groups_response.dart | 36 + .../list_user_groups_response.freezed.dart | 89 + .../model/list_user_groups_response.g.dart | 23 + .../lib/open_api/model/llm_config.dart | 51 + .../open_api/model/llm_config.freezed.dart | 115 + .../lib/open_api/model/llm_config.g.dart | 25 + .../lib/open_api/model/llm_rule.dart | 60 + .../lib/open_api/model/llm_rule.freezed.dart | 106 + .../lib/open_api/model/llm_rule.g.dart | 23 + .../model/mark_channels_read_request.dart | 31 + .../mark_channels_read_request.freezed.dart | 82 + .../model/mark_channels_read_request.g.dart | 19 + .../model/mark_delivered_request.dart | 31 + .../model/mark_delivered_request.freezed.dart | 82 + .../model/mark_delivered_request.g.dart | 21 + .../model/mark_delivered_response.dart | 31 + .../mark_delivered_response.freezed.dart | 76 + .../model/mark_delivered_response.g.dart | 15 + .../lib/open_api/model/mark_read_request.dart | 36 + .../model/mark_read_request.freezed.dart | 81 + .../open_api/model/mark_read_request.g.dart | 17 + .../open_api/model/mark_read_response.dart | 36 + .../model/mark_read_response.freezed.dart | 81 + .../open_api/model/mark_read_response.g.dart | 21 + .../model/mark_read_response_event.dart | 83 + .../mark_read_response_event.freezed.dart | 174 + .../model/mark_read_response_event.g.dart | 57 + .../model/mark_reviewed_request_payload.dart | 41 + ...mark_reviewed_request_payload.freezed.dart | 109 + .../mark_reviewed_request_payload.g.dart | 23 + .../open_api/model/mark_unread_request.dart | 42 + .../model/mark_unread_request.freezed.dart | 91 + .../open_api/model/mark_unread_request.g.dart | 35 + .../model/max_streak_changed_event.dart | 48 + .../max_streak_changed_event.freezed.dart | 110 + .../model/max_streak_changed_event.g.dart | 43 + .../open_api/model/member_added_event.dart | 98 + .../model/member_added_event.freezed.dart | 204 + .../open_api/model/member_added_event.g.dart | 63 + .../open_api/model/member_removed_event.dart | 98 + .../model/member_removed_event.freezed.dart | 204 + .../model/member_removed_event.g.dart | 63 + .../open_api/model/member_updated_event.dart | 98 + .../model/member_updated_event.freezed.dart | 204 + .../model/member_updated_event.g.dart | 63 + .../open_api/model/member_user_request.dart | 61 + .../model/member_user_request.freezed.dart | 136 + .../open_api/model/member_user_request.g.dart | 31 + .../lib/open_api/model/members_response.dart | 36 + .../model/members_response.freezed.dart | 85 + .../open_api/model/members_response.g.dart | 19 + .../model/message_action_request.dart | 31 + .../model/message_action_request.freezed.dart | 76 + .../model/message_action_request.g.dart | 17 + .../model/message_action_response.dart | 36 + .../message_action_response.freezed.dart | 82 + .../model/message_action_response.g.dart | 21 + .../open_api/model/message_change_set.dart | 71 + .../model/message_change_set.freezed.dart | 154 + .../open_api/model/message_change_set.g.dart | 31 + .../open_api/model/message_deleted_event.dart | 108 + .../model/message_deleted_event.freezed.dart | 223 + .../model/message_deleted_event.g.dart | 67 + .../model/message_delivered_event.dart | 103 + .../message_delivered_event.freezed.dart | 215 + .../model/message_delivered_event.g.dart | 65 + .../open_api/model/message_flag_response.dart | 101 + .../model/message_flag_response.freezed.dart | 201 + .../model/message_flag_response.g.dart | 87 + .../model/message_moderation_result.dart | 83 + .../message_moderation_result.freezed.dart | 175 + .../model/message_moderation_result.g.dart | 51 + .../lib/open_api/model/message_new_event.dart | 138 + .../model/message_new_event.freezed.dart | 282 + .../open_api/model/message_new_event.g.dart | 81 + .../lib/open_api/model/message_options.dart | 36 + .../model/message_options.freezed.dart | 98 + .../lib/open_api/model/message_options.g.dart | 17 + .../model/message_pagination_params.dart | 86 + .../message_pagination_params.freezed.dart | 175 + .../model/message_pagination_params.g.dart | 79 + .../open_api/model/message_read_event.dart | 103 + .../model/message_read_event.freezed.dart | 213 + .../open_api/model/message_read_event.g.dart | 65 + .../lib/open_api/model/message_request.dart | 142 + .../model/message_request.freezed.dart | 277 + .../lib/open_api/model/message_request.g.dart | 83 + .../lib/open_api/model/message_response.dart | 282 + .../model/message_response.freezed.dart | 566 ++ .../open_api/model/message_response.g.dart | 198 + .../model/message_undeleted_event.dart | 93 + .../message_undeleted_event.freezed.dart | 196 + .../model/message_undeleted_event.g.dart | 61 + .../lib/open_api/model/message_update.dart | 36 + .../model/message_update.freezed.dart | 81 + .../lib/open_api/model/message_update.g.dart | 21 + .../open_api/model/message_updated_event.dart | 103 + .../model/message_updated_event.freezed.dart | 214 + .../model/message_updated_event.g.dart | 67 + .../model/message_with_channel_response.dart | 287 + ...message_with_channel_response.freezed.dart | 576 ++ .../message_with_channel_response.g.dart | 200 + .../moderation_action_config_response.dart | 67 + ...ration_action_config_response.freezed.dart | 146 + .../moderation_action_config_response.g.dart | 33 + .../model/moderation_ban_response.dart | 31 + .../moderation_ban_response.freezed.dart | 76 + .../model/moderation_ban_response.g.dart | 15 + .../model/moderation_call_response.dart | 130 + .../moderation_call_response.freezed.dart | 258 + .../model/moderation_call_response.g.dart | 83 + .../model/moderation_custom_action_event.dart | 68 + ...oderation_custom_action_event.freezed.dart | 149 + .../moderation_custom_action_event.g.dart | 53 + .../model/moderation_flag_response.dart | 103 + .../moderation_flag_response.freezed.dart | 209 + .../model/moderation_flag_response.g.dart | 59 + .../model/moderation_flagged_event.dart | 58 + .../moderation_flagged_event.freezed.dart | 128 + .../model/moderation_flagged_event.g.dart | 47 + .../model/moderation_mark_reviewed_event.dart | 58 + ...oderation_mark_reviewed_event.freezed.dart | 128 + .../moderation_mark_reviewed_event.g.dart | 47 + .../open_api/model/moderation_payload.dart | 76 + .../model/moderation_payload.freezed.dart | 172 + .../open_api/model/moderation_payload.g.dart | 39 + .../model/moderation_payload_response.dart | 76 + .../moderation_payload_response.freezed.dart | 173 + .../model/moderation_payload_response.g.dart | 41 + .../model/moderation_queue_response.dart | 78 + .../moderation_queue_response.freezed.dart | 164 + .../model/moderation_queue_response.g.dart | 41 + .../open_api/model/moderation_response.dart | 46 + .../model/moderation_response.freezed.dart | 98 + .../open_api/model/moderation_response.g.dart | 21 + .../model/moderation_v2_response.dart | 66 + .../model/moderation_v2_response.freezed.dart | 154 + .../model/moderation_v2_response.g.dart | 33 + .../open_api/model/mute_channel_request.dart | 36 + .../model/mute_channel_request.freezed.dart | 88 + .../model/mute_channel_request.g.dart | 17 + .../open_api/model/mute_channel_response.dart | 46 + .../model/mute_channel_response.freezed.dart | 113 + .../model/mute_channel_response.g.dart | 25 + .../lib/open_api/model/mute_request.dart | 36 + .../open_api/model/mute_request.freezed.dart | 83 + .../lib/open_api/model/mute_request.g.dart | 17 + .../lib/open_api/model/mute_response.dart | 46 + .../open_api/model/mute_response.freezed.dart | 112 + .../lib/open_api/model/mute_response.g.dart | 21 + .../notification_added_to_channel_event.dart | 94 + ...cation_added_to_channel_event.freezed.dart | 196 + ...notification_added_to_channel_event.g.dart | 63 + .../notification_channel_deleted_event.dart | 109 + ...ication_channel_deleted_event.freezed.dart | 226 + .../notification_channel_deleted_event.g.dart | 69 + ...ification_channel_mutes_updated_event.dart | 54 + ...n_channel_mutes_updated_event.freezed.dart | 120 + ...ication_channel_mutes_updated_event.g.dart | 44 + .../notification_channel_truncated_event.dart | 119 + ...ation_channel_truncated_event.freezed.dart | 245 + ...otification_channel_truncated_event.g.dart | 73 + .../notification_invite_accepted_event.dart | 99 + ...ication_invite_accepted_event.freezed.dart | 205 + .../notification_invite_accepted_event.g.dart | 65 + .../notification_invite_rejected_event.dart | 99 + ...ication_invite_rejected_event.freezed.dart | 205 + .../notification_invite_rejected_event.g.dart | 65 + .../model/notification_invited_event.dart | 98 + .../notification_invited_event.freezed.dart | 205 + .../model/notification_invited_event.g.dart | 65 + .../model/notification_mark_read_event.dart | 138 + .../notification_mark_read_event.freezed.dart | 281 + .../model/notification_mark_read_event.g.dart | 81 + .../model/notification_mark_unread_event.dart | 149 + ...otification_mark_unread_event.freezed.dart | 300 + .../notification_mark_unread_event.g.dart | 91 + .../notification_mutes_updated_event.dart | 54 + ...ification_mutes_updated_event.freezed.dart | 119 + .../notification_mutes_updated_event.g.dart | 45 + .../model/notification_new_message_event.dart | 133 + ...otification_new_message_event.freezed.dart | 274 + .../notification_new_message_event.g.dart | 81 + ...tification_removed_from_channel_event.dart | 99 + ...on_removed_from_channel_event.freezed.dart | 206 + ...fication_removed_from_channel_event.g.dart | 65 + ...notification_thread_message_new_event.dart | 129 + ...tion_thread_message_new_event.freezed.dart | 264 + ...tification_thread_message_new_event.g.dart | 77 + .../model/ocr_content_parameters.dart | 41 + .../model/ocr_content_parameters.freezed.dart | 104 + .../model/ocr_content_parameters.g.dart | 23 + .../lib/open_api/model/ocr_rule.dart | 49 + .../lib/open_api/model/ocr_rule.freezed.dart | 75 + .../lib/open_api/model/ocr_rule.g.dart | 17 + .../lib/open_api/model/only_user_id.dart | 31 + .../open_api/model/only_user_id.freezed.dart | 70 + .../lib/open_api/model/only_user_id.g.dart | 11 + .../lib/open_api/model/own_user_response.dart | 182 + .../model/own_user_response.freezed.dart | 359 ++ .../open_api/model/own_user_response.g.dart | 125 + .../lib/open_api/model/pagination_params.dart | 36 + .../model/pagination_params.freezed.dart | 81 + .../open_api/model/pagination_params.g.dart | 17 + .../parsed_predefined_filter_response.dart | 42 + ...ed_predefined_filter_response.freezed.dart | 101 + .../parsed_predefined_filter_response.g.dart | 23 + .../open_api/model/pending_message_event.dart | 73 + .../model/pending_message_event.freezed.dart | 155 + .../model/pending_message_event.g.dart | 53 + .../model/pending_message_response.dart | 41 + .../pending_message_response.freezed.dart | 96 + .../model/pending_message_response.g.dart | 23 + .../lib/open_api/model/poll_closed_event.dart | 68 + .../model/poll_closed_event.freezed.dart | 145 + .../open_api/model/poll_closed_event.g.dart | 47 + .../open_api/model/poll_deleted_event.dart | 68 + .../model/poll_deleted_event.freezed.dart | 145 + .../open_api/model/poll_deleted_event.g.dart | 47 + .../lib/open_api/model/poll_option_input.dart | 36 + .../model/poll_option_input.freezed.dart | 85 + .../open_api/model/poll_option_input.g.dart | 17 + .../open_api/model/poll_option_request.dart | 41 + .../model/poll_option_request.freezed.dart | 96 + .../open_api/model/poll_option_request.g.dart | 19 + .../open_api/model/poll_option_response.dart | 36 + .../model/poll_option_response.freezed.dart | 81 + .../model/poll_option_response.g.dart | 19 + .../model/poll_option_response_data.dart | 41 + .../poll_option_response_data.freezed.dart | 93 + .../model/poll_option_response_data.g.dart | 23 + .../lib/open_api/model/poll_response.dart | 36 + .../open_api/model/poll_response.freezed.dart | 81 + .../lib/open_api/model/poll_response.g.dart | 17 + .../open_api/model/poll_response_data.dart | 142 + .../model/poll_response_data.freezed.dart | 275 + .../open_api/model/poll_response_data.g.dart | 82 + .../open_api/model/poll_updated_event.dart | 68 + .../model/poll_updated_event.freezed.dart | 145 + .../open_api/model/poll_updated_event.g.dart | 47 + .../model/poll_vote_casted_event.dart | 73 + .../model/poll_vote_casted_event.freezed.dart | 155 + .../model/poll_vote_casted_event.g.dart | 53 + .../model/poll_vote_changed_event.dart | 73 + .../poll_vote_changed_event.freezed.dart | 155 + .../model/poll_vote_changed_event.g.dart | 55 + .../model/poll_vote_removed_event.dart | 73 + .../poll_vote_removed_event.freezed.dart | 155 + .../model/poll_vote_removed_event.g.dart | 55 + .../open_api/model/poll_vote_response.dart | 41 + .../model/poll_vote_response.freezed.dart | 95 + .../open_api/model/poll_vote_response.g.dart | 19 + .../model/poll_vote_response_data.dart | 73 + .../poll_vote_response_data.freezed.dart | 155 + .../model/poll_vote_response_data.g.dart | 39 + .../open_api/model/poll_votes_response.dart | 46 + .../model/poll_votes_response.freezed.dart | 109 + .../open_api/model/poll_votes_response.g.dart | 21 + .../model/privacy_settings_response.dart | 41 + .../privacy_settings_response.freezed.dart | 101 + .../model/privacy_settings_response.g.dart | 35 + .../open_api/model/push_preference_input.dart | 105 + .../model/push_preference_input.freezed.dart | 155 + .../model/push_preference_input.g.dart | 61 + .../model/push_preferences_response.dart | 57 + .../push_preferences_response.freezed.dart | 128 + .../model/push_preferences_response.g.dart | 53 + .../open_api/model/query_appeals_request.dart | 51 + .../model/query_appeals_request.freezed.dart | 119 + .../model/query_appeals_request.g.dart | 25 + .../model/query_appeals_response.dart | 46 + .../model/query_appeals_response.freezed.dart | 110 + .../model/query_appeals_response.g.dart | 25 + .../model/query_banned_users_payload.dart | 51 + .../query_banned_users_payload.freezed.dart | 123 + .../model/query_banned_users_payload.g.dart | 27 + .../model/query_banned_users_response.dart | 36 + .../query_banned_users_response.freezed.dart | 86 + .../model/query_banned_users_response.g.dart | 21 + .../model/query_channels_request.dart | 91 + .../model/query_channels_request.freezed.dart | 203 + .../model/query_channels_request.g.dart | 43 + .../model/query_channels_response.dart | 41 + .../query_channels_response.freezed.dart | 101 + .../model/query_channels_response.g.dart | 31 + .../open_api/model/query_drafts_request.dart | 51 + .../model/query_drafts_request.freezed.dart | 118 + .../model/query_drafts_request.g.dart | 23 + .../open_api/model/query_drafts_response.dart | 46 + .../model/query_drafts_response.freezed.dart | 110 + .../model/query_drafts_response.g.dart | 23 + .../query_future_channel_bans_payload.dart | 52 + ...y_future_channel_bans_payload.freezed.dart | 120 + .../query_future_channel_bans_payload.g.dart | 27 + .../query_future_channel_bans_response.dart | 42 + ..._future_channel_bans_response.freezed.dart | 97 + .../query_future_channel_bans_response.g.dart | 25 + .../open_api/model/query_members_payload.dart | 61 + .../model/query_members_payload.freezed.dart | 140 + .../model/query_members_payload.g.dart | 31 + .../model/query_message_flags_payload.dart | 51 + .../query_message_flags_payload.freezed.dart | 123 + .../model/query_message_flags_payload.g.dart | 27 + .../model/query_message_flags_response.dart | 36 + .../query_message_flags_response.freezed.dart | 86 + .../model/query_message_flags_response.g.dart | 21 + .../query_moderation_configs_request.dart | 52 + ...ry_moderation_configs_request.freezed.dart | 119 + .../query_moderation_configs_request.g.dart | 27 + .../query_moderation_configs_response.dart | 47 + ...y_moderation_configs_response.freezed.dart | 110 + .../query_moderation_configs_response.g.dart | 25 + .../model/query_poll_votes_request.dart | 51 + .../query_poll_votes_request.freezed.dart | 119 + .../model/query_poll_votes_request.g.dart | 27 + .../open_api/model/query_polls_request.dart | 51 + .../model/query_polls_request.freezed.dart | 118 + .../open_api/model/query_polls_request.g.dart | 23 + .../open_api/model/query_polls_response.dart | 46 + .../model/query_polls_response.freezed.dart | 109 + .../model/query_polls_response.g.dart | 21 + .../model/query_reactions_request.dart | 51 + .../query_reactions_request.freezed.dart | 119 + .../model/query_reactions_request.g.dart | 27 + .../model/query_reactions_response.dart | 46 + .../query_reactions_response.freezed.dart | 110 + .../model/query_reactions_response.g.dart | 27 + .../model/query_reminders_request.dart | 51 + .../query_reminders_request.freezed.dart | 119 + .../model/query_reminders_request.g.dart | 27 + .../model/query_reminders_response.dart | 46 + .../query_reminders_response.freezed.dart | 110 + .../model/query_reminders_response.g.dart | 27 + .../model/query_review_queue_request.dart | 76 + .../query_review_queue_request.freezed.dart | 168 + .../model/query_review_queue_request.g.dart | 37 + .../model/query_review_queue_response.dart | 66 + .../query_review_queue_response.freezed.dart | 152 + .../model/query_review_queue_response.g.dart | 65 + .../open_api/model/query_threads_request.dart | 71 + .../model/query_threads_request.freezed.dart | 155 + .../model/query_threads_request.g.dart | 33 + .../model/query_threads_response.dart | 46 + .../model/query_threads_response.freezed.dart | 110 + .../model/query_threads_response.g.dart | 27 + .../open_api/model/query_users_payload.dart | 56 + .../model/query_users_payload.freezed.dart | 134 + .../open_api/model/query_users_payload.g.dart | 25 + .../open_api/model/query_users_response.dart | 36 + .../model/query_users_response.freezed.dart | 85 + .../model/query_users_response.g.dart | 17 + .../lib/open_api/model/queue_response.dart | 36 + .../model/queue_response.freezed.dart | 81 + .../lib/open_api/model/queue_response.g.dart | 21 + .../lib/open_api/model/reaction.dart | 114 + .../lib/open_api/model/reaction.freezed.dart | 238 + .../lib/open_api/model/reaction.g.dart | 81 + .../model/reaction_deleted_event.dart | 113 + .../model/reaction_deleted_event.freezed.dart | 235 + .../model/reaction_deleted_event.g.dart | 71 + .../model/reaction_group_response.dart | 53 + .../reaction_group_response.freezed.dart | 122 + .../model/reaction_group_response.g.dart | 37 + .../model/reaction_group_user_response.dart | 42 + .../reaction_group_user_response.freezed.dart | 92 + .../model/reaction_group_user_response.g.dart | 25 + .../open_api/model/reaction_new_event.dart | 113 + .../model/reaction_new_event.freezed.dart | 234 + .../open_api/model/reaction_new_event.g.dart | 69 + .../lib/open_api/model/reaction_request.dart | 53 + .../model/reaction_request.freezed.dart | 118 + .../open_api/model/reaction_request.g.dart | 45 + .../lib/open_api/model/reaction_response.dart | 68 + .../model/reaction_response.freezed.dart | 145 + .../open_api/model/reaction_response.g.dart | 33 + .../model/reaction_updated_event.dart | 108 + .../model/reaction_updated_event.freezed.dart | 223 + .../model/reaction_updated_event.g.dart | 67 + .../model/read_receipts_response.dart | 31 + .../model/read_receipts_response.freezed.dart | 76 + .../model/read_receipts_response.g.dart | 15 + .../open_api/model/read_state_response.dart | 58 + .../model/read_state_response.freezed.dart | 128 + .../open_api/model/read_state_response.g.dart | 43 + .../model/reject_appeal_request_payload.dart | 31 + ...reject_appeal_request_payload.freezed.dart | 76 + .../reject_appeal_request_payload.g.dart | 17 + .../model/reminder_created_event.dart | 73 + .../model/reminder_created_event.freezed.dart | 155 + .../model/reminder_created_event.g.dart | 55 + .../model/reminder_deleted_event.dart | 73 + .../model/reminder_deleted_event.freezed.dart | 155 + .../model/reminder_deleted_event.g.dart | 55 + .../model/reminder_notification_event.dart | 73 + .../reminder_notification_event.freezed.dart | 155 + .../model/reminder_notification_event.g.dart | 55 + .../model/reminder_response_data.dart | 74 + .../model/reminder_response_data.freezed.dart | 155 + .../model/reminder_response_data.g.dart | 55 + .../model/reminder_updated_event.dart | 73 + .../model/reminder_updated_event.freezed.dart | 155 + .../model/reminder_updated_event.g.dart | 55 + .../remove_user_group_members_request.dart | 37 + ...ve_user_group_members_request.freezed.dart | 86 + .../remove_user_group_members_request.g.dart | 21 + .../remove_user_group_members_response.dart | 37 + ...e_user_group_members_response.freezed.dart | 82 + .../remove_user_group_members_response.g.dart | 21 + .../model/restore_action_request_payload.dart | 31 + ...estore_action_request_payload.freezed.dart | 76 + .../restore_action_request_payload.g.dart | 17 + .../model/review_queue_item_response.dart | 216 + .../review_queue_item_response.freezed.dart | 409 ++ .../model/review_queue_item_response.g.dart | 153 + .../stream_chat/lib/open_api/model/role.dart | 53 + .../lib/open_api/model/role.freezed.dart | 112 + .../lib/open_api/model/role.g.dart | 27 + .../open_api/model/rule_builder_action.dart | 80 + .../model/rule_builder_action.freezed.dart | 127 + .../open_api/model/rule_builder_action.g.dart | 33 + .../model/rule_builder_condition.dart | 176 + .../model/rule_builder_condition.freezed.dart | 401 ++ .../model/rule_builder_condition.g.dart | 189 + .../model/rule_builder_condition_group.dart | 36 + .../rule_builder_condition_group.freezed.dart | 89 + .../model/rule_builder_condition_group.g.dart | 23 + .../open_api/model/rule_builder_config.dart | 36 + .../model/rule_builder_config.freezed.dart | 85 + .../open_api/model/rule_builder_config.g.dart | 17 + .../lib/open_api/model/rule_builder_rule.dart | 66 + .../model/rule_builder_rule.freezed.dart | 151 + .../open_api/model/rule_builder_rule.g.dart | 41 + .../lib/open_api/model/search_payload.dart | 76 + .../model/search_payload.freezed.dart | 170 + .../lib/open_api/model/search_payload.g.dart | 37 + .../lib/open_api/model/search_response.dart | 51 + .../model/search_response.freezed.dart | 118 + .../lib/open_api/model/search_response.g.dart | 27 + .../lib/open_api/model/search_result.dart | 31 + .../open_api/model/search_result.freezed.dart | 75 + .../lib/open_api/model/search_result.g.dart | 15 + .../open_api/model/search_result_message.dart | 287 + .../model/search_result_message.freezed.dart | 576 ++ .../model/search_result_message.g.dart | 200 + .../open_api/model/search_roles_response.dart | 36 + .../model/search_roles_response.freezed.dart | 86 + .../model/search_roles_response.g.dart | 19 + .../model/search_user_groups_response.dart | 36 + .../search_user_groups_response.freezed.dart | 89 + .../model/search_user_groups_response.g.dart | 23 + .../lib/open_api/model/search_warning.dart | 46 + .../model/search_warning.freezed.dart | 114 + .../lib/open_api/model/search_warning.g.dart | 21 + .../open_api/model/send_event_request.dart | 31 + .../model/send_event_request.freezed.dart | 75 + .../open_api/model/send_event_request.g.dart | 15 + .../open_api/model/send_message_request.dart | 56 + .../model/send_message_request.freezed.dart | 132 + .../model/send_message_request.g.dart | 25 + .../open_api/model/send_message_response.dart | 46 + .../model/send_message_response.freezed.dart | 113 + .../model/send_message_response.g.dart | 29 + .../open_api/model/send_reaction_request.dart | 41 + .../model/send_reaction_request.freezed.dart | 92 + .../model/send_reaction_request.g.dart | 23 + .../model/send_reaction_response.dart | 41 + .../model/send_reaction_response.freezed.dart | 96 + .../model/send_reaction_response.g.dart | 23 + .../shadow_block_action_request_payload.dart | 32 + ..._block_action_request_payload.freezed.dart | 76 + ...shadow_block_action_request_payload.g.dart | 15 + .../lib/open_api/model/shared_location.dart | 47 + .../model/shared_location.freezed.dart | 103 + .../lib/open_api/model/shared_location.g.dart | 37 + .../model/shared_location_response.dart | 89 + .../shared_location_response.freezed.dart | 182 + .../model/shared_location_response.g.dart | 61 + .../model/shared_location_response_data.dart | 84 + ...shared_location_response_data.freezed.dart | 173 + .../shared_location_response_data.g.dart | 59 + .../model/shared_locations_response.dart | 36 + .../shared_locations_response.freezed.dart | 92 + .../model/shared_locations_response.g.dart | 25 + .../open_api/model/show_channel_response.dart | 31 + .../model/show_channel_response.freezed.dart | 76 + .../model/show_channel_response.g.dart | 14 + .../open_api/model/sort_param_request.dart | 41 + .../model/sort_param_request.freezed.dart | 91 + .../open_api/model/sort_param_request.g.dart | 19 + .../open_api/model/submit_action_request.dart | 160 + .../model/submit_action_request.freezed.dart | 264 + .../model/submit_action_request.g.dart | 117 + .../model/submit_action_response.dart | 46 + .../model/submit_action_response.freezed.dart | 105 + .../model/submit_action_response.g.dart | 29 + .../lib/open_api/model/sync_request.dart | 37 + .../open_api/model/sync_request.freezed.dart | 86 + .../lib/open_api/model/sync_request.g.dart | 21 + .../lib/open_api/model/sync_response.dart | 41 + .../open_api/model/sync_response.freezed.dart | 103 + .../lib/open_api/model/sync_response.g.dart | 19 + .../model/text_content_parameters.dart | 66 + .../text_content_parameters.freezed.dart | 156 + .../model/text_content_parameters.g.dart | 35 + .../open_api/model/text_rule_parameters.dart | 71 + .../model/text_rule_parameters.freezed.dart | 170 + .../model/text_rule_parameters.g.dart | 33 + .../open_api/model/thread_participant.dart | 75 + .../model/thread_participant.freezed.dart | 155 + .../open_api/model/thread_participant.g.dart | 59 + .../lib/open_api/model/thread_response.dart | 110 + .../model/thread_response.freezed.dart | 221 + .../lib/open_api/model/thread_response.g.dart | 77 + .../open_api/model/thread_state_response.dart | 125 + .../model/thread_state_response.freezed.dart | 252 + .../model/thread_state_response.g.dart | 87 + .../open_api/model/thread_updated_event.dart | 68 + .../model/thread_updated_event.freezed.dart | 145 + .../model/thread_updated_event.g.dart | 47 + .../lib/open_api/model/thresholds.dart | 41 + .../open_api/model/thresholds.freezed.dart | 92 + .../lib/open_api/model/thresholds.g.dart | 19 + .../model/translate_message_request.dart | 95 + .../translate_message_request.freezed.dart | 76 + .../model/translate_message_request.g.dart | 19 + .../model/truncate_channel_request.dart | 52 + .../truncate_channel_request.freezed.dart | 119 + .../model/truncate_channel_request.g.dart | 43 + .../model/truncate_channel_response.dart | 41 + .../truncate_channel_response.freezed.dart | 96 + .../model/truncate_channel_response.g.dart | 23 + .../model/typing_indicators_response.dart | 31 + .../typing_indicators_response.freezed.dart | 76 + .../model/typing_indicators_response.g.dart | 15 + .../open_api/model/typing_start_event.dart | 73 + .../model/typing_start_event.freezed.dart | 154 + .../open_api/model/typing_start_event.g.dart | 53 + .../lib/open_api/model/typing_stop_event.dart | 73 + .../model/typing_stop_event.freezed.dart | 154 + .../open_api/model/typing_stop_event.g.dart | 53 + .../model/unban_action_request_payload.dart | 46 + .../unban_action_request_payload.freezed.dart | 114 + .../model/unban_action_request_payload.g.dart | 25 + .../model/unblock_action_request_payload.dart | 31 + ...nblock_action_request_payload.freezed.dart | 76 + .../unblock_action_request_payload.g.dart | 17 + .../open_api/model/unblock_users_request.dart | 31 + .../model/unblock_users_request.freezed.dart | 76 + .../model/unblock_users_request.g.dart | 14 + .../model/unblock_users_response.dart | 31 + .../model/unblock_users_response.freezed.dart | 76 + .../model/unblock_users_response.g.dart | 15 + .../model/unmute_channel_request.dart | 36 + .../model/unmute_channel_request.freezed.dart | 89 + .../model/unmute_channel_request.g.dart | 21 + .../lib/open_api/model/unmute_request.dart | 31 + .../model/unmute_request.freezed.dart | 75 + .../lib/open_api/model/unmute_request.g.dart | 15 + .../lib/open_api/model/unmute_response.dart | 36 + .../model/unmute_response.freezed.dart | 88 + .../lib/open_api/model/unmute_response.g.dart | 17 + .../open_api/model/unread_counts_channel.dart | 42 + .../model/unread_counts_channel.freezed.dart | 92 + .../model/unread_counts_channel.g.dart | 23 + .../model/unread_counts_channel_type.dart | 41 + .../unread_counts_channel_type.freezed.dart | 92 + .../model/unread_counts_channel_type.g.dart | 23 + .../open_api/model/unread_counts_thread.dart | 47 + .../model/unread_counts_thread.freezed.dart | 109 + .../model/unread_counts_thread.g.dart | 23 + .../model/update_block_list_request.dart | 56 + .../update_block_list_request.freezed.dart | 138 + .../model/update_block_list_request.g.dart | 29 + .../model/update_block_list_response.dart | 36 + .../update_block_list_response.freezed.dart | 82 + .../model/update_block_list_response.g.dart | 21 + .../model/update_channel_partial_request.dart | 36 + ...pdate_channel_partial_request.freezed.dart | 86 + .../update_channel_partial_request.g.dart | 18 + .../update_channel_partial_response.dart | 42 + ...date_channel_partial_response.freezed.dart | 101 + .../update_channel_partial_response.g.dart | 25 + .../model/update_channel_request.dart | 92 + .../model/update_channel_request.freezed.dart | 203 + .../model/update_channel_request.g.dart | 63 + .../model/update_channel_response.dart | 46 + .../update_channel_response.freezed.dart | 110 + .../model/update_channel_response.g.dart | 27 + .../model/update_live_location_request.dart | 47 + .../update_live_location_request.freezed.dart | 104 + .../model/update_live_location_request.g.dart | 41 + .../model/update_member_partial_request.dart | 36 + ...update_member_partial_request.freezed.dart | 86 + .../update_member_partial_request.g.dart | 18 + .../model/update_member_partial_response.dart | 36 + ...pdate_member_partial_response.freezed.dart | 82 + .../update_member_partial_response.g.dart | 25 + .../model/update_message_partial_request.dart | 46 + ...pdate_message_partial_request.freezed.dart | 110 + .../update_message_partial_request.g.dart | 25 + .../update_message_partial_response.dart | 37 + ...date_message_partial_response.freezed.dart | 82 + .../update_message_partial_response.g.dart | 21 + .../model/update_message_request.dart | 41 + .../model/update_message_request.freezed.dart | 92 + .../model/update_message_request.g.dart | 23 + .../model/update_message_response.dart | 36 + .../update_message_response.freezed.dart | 82 + .../model/update_message_response.g.dart | 21 + .../model/update_poll_option_request.dart | 41 + .../update_poll_option_request.freezed.dart | 97 + .../model/update_poll_option_request.g.dart | 23 + .../model/update_poll_partial_request.dart | 36 + .../update_poll_partial_request.freezed.dart | 86 + .../model/update_poll_partial_request.g.dart | 18 + .../open_api/model/update_poll_request.dart | 90 + .../model/update_poll_request.freezed.dart | 176 + .../open_api/model/update_poll_request.g.dart | 41 + .../open_api/model/update_queue_request.dart | 46 + .../model/update_queue_request.freezed.dart | 109 + .../model/update_queue_request.g.dart | 21 + .../model/update_reminder_request.dart | 32 + .../update_reminder_request.freezed.dart | 76 + .../model/update_reminder_request.g.dart | 35 + .../model/update_reminder_response.dart | 36 + .../update_reminder_response.freezed.dart | 82 + .../model/update_reminder_response.g.dart | 23 + .../model/update_thread_partial_request.dart | 36 + ...update_thread_partial_request.freezed.dart | 86 + .../update_thread_partial_request.g.dart | 18 + .../model/update_thread_partial_response.dart | 36 + ...pdate_thread_partial_response.freezed.dart | 82 + .../update_thread_partial_response.g.dart | 21 + .../model/update_user_group_request.dart | 41 + .../update_user_group_request.freezed.dart | 92 + .../model/update_user_group_request.g.dart | 23 + .../model/update_user_group_response.dart | 36 + .../update_user_group_response.freezed.dart | 82 + .../model/update_user_group_response.g.dart | 21 + .../model/update_user_partial_request.dart | 41 + .../update_user_partial_request.freezed.dart | 97 + .../model/update_user_partial_request.g.dart | 23 + .../model/update_users_partial_request.dart | 31 + .../update_users_partial_request.freezed.dart | 76 + .../model/update_users_partial_request.g.dart | 19 + .../open_api/model/update_users_request.dart | 31 + .../model/update_users_request.freezed.dart | 75 + .../model/update_users_request.g.dart | 17 + .../open_api/model/update_users_response.dart | 41 + .../model/update_users_response.freezed.dart | 105 + .../model/update_users_response.g.dart | 23 + .../model/upload_channel_file_request.dart | 36 + .../upload_channel_file_request.freezed.dart | 82 + .../model/upload_channel_file_request.g.dart | 18 + .../model/upload_channel_file_response.dart | 46 + .../upload_channel_file_response.freezed.dart | 104 + .../model/upload_channel_file_response.g.dart | 25 + .../model/upload_channel_request.dart | 41 + .../model/upload_channel_request.freezed.dart | 100 + .../model/upload_channel_request.g.dart | 25 + .../model/upload_channel_response.dart | 51 + .../upload_channel_response.freezed.dart | 122 + .../model/upload_channel_response.g.dart | 29 + .../model/upsert_action_config_item.dart | 66 + .../upsert_action_config_item.freezed.dart | 146 + .../model/upsert_action_config_item.g.dart | 33 + .../model/upsert_action_config_request.dart | 66 + .../upsert_action_config_request.freezed.dart | 146 + .../model/upsert_action_config_request.g.dart | 33 + .../model/upsert_action_config_response.dart | 36 + ...upsert_action_config_response.freezed.dart | 82 + .../upsert_action_config_response.g.dart | 25 + .../open_api/model/upsert_config_request.dart | 121 + .../model/upsert_config_request.freezed.dart | 258 + .../model/upsert_config_request.g.dart | 103 + .../model/upsert_config_response.dart | 36 + .../model/upsert_config_response.freezed.dart | 82 + .../model/upsert_config_response.g.dart | 21 + .../upsert_push_preferences_request.dart | 32 + ...sert_push_preferences_request.freezed.dart | 82 + .../upsert_push_preferences_request.g.dart | 21 + .../upsert_push_preferences_response.dart | 42 + ...ert_push_preferences_response.freezed.dart | 107 + .../upsert_push_preferences_response.g.dart | 44 + .../stream_chat/lib/open_api/model/user.dart | 36 + .../lib/open_api/model/user.freezed.dart | 75 + .../lib/open_api/model/user.g.dart | 15 + .../lib/open_api/model/user_banned_event.dart | 119 + .../model/user_banned_event.freezed.dart | 240 + .../open_api/model/user_banned_event.g.dart | 79 + .../model/user_created_within_parameters.dart | 31 + ...ser_created_within_parameters.freezed.dart | 76 + .../user_created_within_parameters.g.dart | 15 + .../user_custom_property_parameters.dart | 37 + ...er_custom_property_parameters.freezed.dart | 82 + .../user_custom_property_parameters.g.dart | 21 + .../model/user_deactivated_event.dart | 58 + .../model/user_deactivated_event.freezed.dart | 128 + .../model/user_deactivated_event.g.dart | 51 + .../open_api/model/user_deleted_event.dart | 83 + .../model/user_deleted_event.freezed.dart | 178 + .../open_api/model/user_deleted_event.g.dart | 55 + .../lib/open_api/model/user_group.dart | 73 + .../open_api/model/user_group.freezed.dart | 148 + .../lib/open_api/model/user_group.g.dart | 37 + .../model/user_group_created_event.dart | 58 + .../user_group_created_event.freezed.dart | 128 + .../model/user_group_created_event.g.dart | 47 + .../model/user_group_deleted_event.dart | 58 + .../user_group_deleted_event.freezed.dart | 128 + .../model/user_group_deleted_event.g.dart | 47 + .../lib/open_api/model/user_group_member.dart | 52 + .../model/user_group_member.freezed.dart | 111 + .../open_api/model/user_group_member.g.dart | 25 + .../model/user_group_member_added_event.dart | 63 + ...user_group_member_added_event.freezed.dart | 137 + .../user_group_member_added_event.g.dart | 49 + .../user_group_member_removed_event.dart | 63 + ...er_group_member_removed_event.freezed.dart | 137 + .../user_group_member_removed_event.g.dart | 49 + .../open_api/model/user_group_response.dart | 68 + .../model/user_group_response.freezed.dart | 145 + .../open_api/model/user_group_response.g.dart | 35 + .../model/user_group_updated_event.dart | 58 + .../user_group_updated_event.freezed.dart | 128 + .../model/user_group_updated_event.g.dart | 47 + ...er_identical_content_count_parameters.dart | 37 + ...ical_content_count_parameters.freezed.dart | 83 + ..._identical_content_count_parameters.g.dart | 20 + .../model/user_messages_deleted_event.dart | 93 + .../user_messages_deleted_event.freezed.dart | 196 + .../model/user_messages_deleted_event.g.dart | 61 + .../open_api/model/user_mute_response.dart | 54 + .../model/user_mute_response.freezed.dart | 111 + .../open_api/model/user_mute_response.g.dart | 43 + .../lib/open_api/model/user_muted_event.dart | 63 + .../model/user_muted_event.freezed.dart | 139 + .../open_api/model/user_muted_event.g.dart | 53 + .../model/user_presence_changed_event.dart | 53 + .../user_presence_changed_event.freezed.dart | 119 + .../model/user_presence_changed_event.g.dart | 45 + .../model/user_reactivated_event.dart | 58 + .../model/user_reactivated_event.freezed.dart | 128 + .../model/user_reactivated_event.g.dart | 51 + .../lib/open_api/model/user_request.dart | 61 + .../open_api/model/user_request.freezed.dart | 134 + .../lib/open_api/model/user_request.g.dart | 31 + .../lib/open_api/model/user_response.dart | 122 + .../open_api/model/user_response.freezed.dart | 242 + .../lib/open_api/model/user_response.g.dart | 89 + .../model/user_response_common_fields.dart | 122 + .../user_response_common_fields.freezed.dart | 243 + .../model/user_response_common_fields.g.dart | 93 + .../model/user_response_privacy_fields.dart | 132 + .../user_response_privacy_fields.freezed.dart | 261 + .../model/user_response_privacy_fields.g.dart | 101 + .../open_api/model/user_role_parameters.dart | 36 + .../model/user_role_parameters.freezed.dart | 81 + .../model/user_role_parameters.g.dart | 17 + .../open_api/model/user_rule_parameters.dart | 31 + .../model/user_rule_parameters.freezed.dart | 75 + .../model/user_rule_parameters.g.dart | 14 + .../open_api/model/user_unbanned_event.dart | 98 + .../model/user_unbanned_event.freezed.dart | 204 + .../open_api/model/user_unbanned_event.g.dart | 65 + .../open_api/model/user_updated_event.dart | 53 + .../model/user_updated_event.freezed.dart | 118 + .../open_api/model/user_updated_event.g.dart | 43 + .../model/user_watching_start_event.dart | 73 + .../user_watching_start_event.freezed.dart | 155 + .../model/user_watching_start_event.g.dart | 53 + .../model/user_watching_stop_event.dart | 73 + .../user_watching_stop_event.freezed.dart | 155 + .../model/user_watching_stop_event.g.dart | 53 + .../model/velocity_filter_config.dart | 61 + .../model/velocity_filter_config.freezed.dart | 137 + .../model/velocity_filter_config.g.dart | 33 + .../model/velocity_filter_config_rule.dart | 119 + .../velocity_filter_config_rule.freezed.dart | 203 + .../model/velocity_filter_config_rule.g.dart | 47 + .../model/video_call_rule_config.dart | 41 + .../model/video_call_rule_config.freezed.dart | 104 + .../model/video_call_rule_config.g.dart | 21 + .../model/video_content_parameters.dart | 36 + .../video_content_parameters.freezed.dart | 89 + .../model/video_content_parameters.g.dart | 21 + .../open_api/model/video_rule_parameters.dart | 41 + .../model/video_rule_parameters.freezed.dart | 100 + .../model/video_rule_parameters.g.dart | 21 + .../lib/open_api/model/vote_data.dart | 36 + .../lib/open_api/model/vote_data.freezed.dart | 75 + .../lib/open_api/model/vote_data.g.dart | 17 + .../model/wrapped_unread_counts_response.dart | 61 + ...rapped_unread_counts_response.freezed.dart | 147 + .../wrapped_unread_counts_response.g.dart | 39 + .../lib/open_api/model/ws_auth_message.dart | 51 + .../model/ws_auth_message.freezed.dart | 103 + .../lib/open_api/model/ws_auth_message.g.dart | 19 + .../lib/open_api/model/ws_client_event.dart | 657 ++ .../lib/open_api/model/ws_event.dart | 666 ++ packages/stream_chat/lib/open_api/models.dart | 497 ++ .../core/models/attachment_file.freezed.dart | 410 +- .../models/message_delete_scope.freezed.dart | 224 +- .../core/models/message_state.freezed.dart | 1718 +++--- .../core/models/poll_voting_mode.freezed.dart | 230 +- packages/stream_chat/pubspec.yaml | 17 +- .../stream_chat_flutter/example/pubspec.yaml | 5 + packages/stream_chat_flutter/pubspec.yaml | 11 +- .../example/pubspec.yaml | 5 + .../stream_chat_localizations/pubspec.yaml | 9 + sample_app/pubspec.yaml | 9 + scripts/generate.sh | 404 ++ scripts/renamed-models.json | 3 + tools/rename_openapi_models.dart | 80 + 1512 files changed, 125714 insertions(+), 1306 deletions(-) create mode 100644 .claude/skills/openapi-codegen/SKILL.md create mode 100644 .claude/skills/openapi-migration/SKILL.md create mode 100644 migrations/v11-migration.md create mode 100644 openapi-migration/01-foundation.md create mode 100644 openapi-migration/02-devices-and-push-preferences.md create mode 100644 openapi-migration/03-user-groups.md create mode 100644 openapi-migration/04-roles-guest-and-app.md create mode 100644 openapi-migration/05-polls.md create mode 100644 openapi-migration/06-reminders.md create mode 100644 openapi-migration/07-threads-and-drafts.md create mode 100644 openapi-migration/08-moderation-and-blocklists.md create mode 100644 openapi-migration/09-users.md create mode 100644 openapi-migration/10-messages.md create mode 100644 openapi-migration/11-channels-and-members.md create mode 100644 openapi-migration/12-uploads-cdn.md create mode 100644 openapi-migration/README.md create mode 100644 openapi-migration/tool/generate_plan.py create mode 100644 packages/stream_chat/lib/open_api/api.dart create mode 100644 packages/stream_chat/lib/open_api/api/default_api.dart create mode 100644 packages/stream_chat/lib/open_api/api/default_api.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/action.dart create mode 100644 packages/stream_chat/lib/open_api/model/action.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/action.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/action_log_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/action_log_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/action_log_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/action_sequence.dart create mode 100644 packages/stream_chat/lib/open_api/model/action_sequence.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/action_sequence.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/add_user_group_members_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/add_user_group_members_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/add_user_group_members_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/add_user_group_members_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/add_user_group_members_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/add_user_group_members_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/ai_audio_config_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/ai_audio_config_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/ai_audio_config_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/ai_audio_config_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/ai_audio_config_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/ai_audio_config_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/ai_image_config.dart create mode 100644 packages/stream_chat/lib/open_api/model/ai_image_config.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/ai_image_config.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/ai_image_label_definition.dart create mode 100644 packages/stream_chat/lib/open_api/model/ai_image_label_definition.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/ai_image_label_definition.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/ai_indicator_clear_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/ai_indicator_clear_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/ai_indicator_clear_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/ai_indicator_stop_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/ai_indicator_stop_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/ai_indicator_stop_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/ai_indicator_update_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/ai_indicator_update_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/ai_indicator_update_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/ai_text_config.dart create mode 100644 packages/stream_chat/lib/open_api/model/ai_text_config.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/ai_text_config.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/ai_video_config.dart create mode 100644 packages/stream_chat/lib/open_api/model/ai_video_config.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/ai_video_config.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/app_event_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/app_event_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/app_event_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/app_response_fields.dart create mode 100644 packages/stream_chat/lib/open_api/model/app_response_fields.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/app_response_fields.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/app_updated_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/app_updated_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/app_updated_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/appeal_item_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/appeal_item_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/appeal_item_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/appeal_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/appeal_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/appeal_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/appeal_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/appeal_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/appeal_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/attachment.dart create mode 100644 packages/stream_chat/lib/open_api/model/attachment.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/attachment.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/automod_details_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/automod_details_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/automod_details_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/automod_platform_circumvention_config.dart create mode 100644 packages/stream_chat/lib/open_api/model/automod_platform_circumvention_config.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/automod_platform_circumvention_config.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/automod_rule.dart create mode 100644 packages/stream_chat/lib/open_api/model/automod_rule.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/automod_rule.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/automod_semantic_filters_config.dart create mode 100644 packages/stream_chat/lib/open_api/model/automod_semantic_filters_config.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/automod_semantic_filters_config.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/automod_semantic_filters_rule.dart create mode 100644 packages/stream_chat/lib/open_api/model/automod_semantic_filters_rule.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/automod_semantic_filters_rule.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/automod_toxicity_config.dart create mode 100644 packages/stream_chat/lib/open_api/model/automod_toxicity_config.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/automod_toxicity_config.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/aws_rekognition_rule.dart create mode 100644 packages/stream_chat/lib/open_api/model/aws_rekognition_rule.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/aws_rekognition_rule.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/ban_action_request_payload.dart create mode 100644 packages/stream_chat/lib/open_api/model/ban_action_request_payload.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/ban_action_request_payload.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/ban_info_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/ban_info_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/ban_info_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/ban_options.dart create mode 100644 packages/stream_chat/lib/open_api/model/ban_options.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/ban_options.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/ban_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/ban_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/ban_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/ban_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/ban_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/ban_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/block_action_request_payload.dart create mode 100644 packages/stream_chat/lib/open_api/model/block_action_request_payload.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/block_action_request_payload.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/block_list_config.dart create mode 100644 packages/stream_chat/lib/open_api/model/block_list_config.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/block_list_config.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/block_list_options.dart create mode 100644 packages/stream_chat/lib/open_api/model/block_list_options.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/block_list_options.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/block_list_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/block_list_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/block_list_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/block_list_rule.dart create mode 100644 packages/stream_chat/lib/open_api/model/block_list_rule.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/block_list_rule.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/block_users_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/block_users_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/block_users_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/block_users_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/block_users_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/block_users_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/blocked_user_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/blocked_user_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/blocked_user_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/bodyguard_profile_summary.dart create mode 100644 packages/stream_chat/lib/open_api/model/bodyguard_profile_summary.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/bodyguard_profile_summary.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/bodyguard_rule.dart create mode 100644 packages/stream_chat/lib/open_api/model/bodyguard_rule.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/bodyguard_rule.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/bodyguard_severity_rule.dart create mode 100644 packages/stream_chat/lib/open_api/model/bodyguard_severity_rule.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/bodyguard_severity_rule.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/bulk_action_appeals_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/bulk_action_appeals_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/bulk_action_appeals_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/bulk_action_appeals_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/bulk_action_appeals_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/bulk_action_appeals_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/bulk_appeal_error.dart create mode 100644 packages/stream_chat/lib/open_api/model/bulk_appeal_error.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/bulk_appeal_error.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/bulk_appeal_result.dart create mode 100644 packages/stream_chat/lib/open_api/model/bulk_appeal_result.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/bulk_appeal_result.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/bulk_delete_action_config_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/bulk_delete_action_config_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/bulk_delete_action_config_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/bulk_delete_action_config_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/bulk_delete_action_config_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/bulk_delete_action_config_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/bulk_upsert_action_config_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/bulk_upsert_action_config_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/bulk_upsert_action_config_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/bulk_upsert_action_config_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/bulk_upsert_action_config_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/bulk_upsert_action_config_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/bypass_action_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/bypass_action_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/bypass_action_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/call_action_options.dart create mode 100644 packages/stream_chat/lib/open_api/model/call_action_options.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/call_action_options.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/call_custom_property_parameters.dart create mode 100644 packages/stream_chat/lib/open_api/model/call_custom_property_parameters.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/call_custom_property_parameters.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/call_rule_action_sequence.dart create mode 100644 packages/stream_chat/lib/open_api/model/call_rule_action_sequence.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/call_rule_action_sequence.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/call_type_rule_parameters.dart create mode 100644 packages/stream_chat/lib/open_api/model/call_type_rule_parameters.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/call_type_rule_parameters.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/call_violation_count_parameters.dart create mode 100644 packages/stream_chat/lib/open_api/model/call_violation_count_parameters.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/call_violation_count_parameters.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/cast_poll_vote_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/cast_poll_vote_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/cast_poll_vote_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_config_overrides.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_config_overrides.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_config_overrides.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_config_with_info.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_config_with_info.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_config_with_info.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_context_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_context_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_context_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_created_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_created_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_created_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_deleted_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_deleted_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_deleted_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_frozen_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_frozen_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_frozen_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_get_or_create_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_get_or_create_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_get_or_create_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_hidden_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_hidden_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_hidden_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_input.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_input.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_input.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_input_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_input_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_input_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_kicked_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_kicked_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_kicked_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_member_partial_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_member_partial_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_member_partial_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_member_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_member_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_member_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_member_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_member_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_member_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_message_count_rule_parameters.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_message_count_rule_parameters.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_message_count_rule_parameters.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_metadata.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_metadata.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_metadata.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_mute.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_mute.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_mute.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_own_capability.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_push_preferences_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_push_preferences_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_push_preferences_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_state_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_state_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_state_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_state_response_fields.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_state_response_fields.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_state_response_fields.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_truncated_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_truncated_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_truncated_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_un_frozen_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_un_frozen_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_un_frozen_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_updated_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_updated_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_updated_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_visible_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_visible_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/channel_visible_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/chat_draft_payload_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/chat_draft_payload_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/chat_draft_payload_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/chat_draft_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/chat_draft_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/chat_draft_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/chat_message_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/chat_message_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/chat_message_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/chat_moderation_v2_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/chat_moderation_v2_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/chat_moderation_v2_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/chat_preferences.dart create mode 100644 packages/stream_chat/lib/open_api/model/chat_preferences.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/chat_preferences.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/chat_preferences_input.dart create mode 100644 packages/stream_chat/lib/open_api/model/chat_preferences_input.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/chat_preferences_input.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/chat_preferences_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/chat_preferences_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/chat_preferences_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/chat_reaction_group_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/chat_reaction_group_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/chat_reaction_group_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/chat_reaction_group_user_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/chat_reaction_group_user_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/chat_reaction_group_user_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/chat_reaction_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/chat_reaction_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/chat_reaction_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/chat_reminder_response_data.dart create mode 100644 packages/stream_chat/lib/open_api/model/chat_reminder_response_data.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/chat_reminder_response_data.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/chat_shared_location_response_data.dart create mode 100644 packages/stream_chat/lib/open_api/model/chat_shared_location_response_data.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/chat_shared_location_response_data.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/closed_caption_rule_parameters.dart create mode 100644 packages/stream_chat/lib/open_api/model/closed_caption_rule_parameters.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/closed_caption_rule_parameters.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/command.dart create mode 100644 packages/stream_chat/lib/open_api/model/command.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/command.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/config_overrides_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/config_overrides_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/config_overrides_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/config_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/config_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/config_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/content_count_rule_parameters.dart create mode 100644 packages/stream_chat/lib/open_api/model/content_count_rule_parameters.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/content_count_rule_parameters.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/content_custom_property_count_parameters.dart create mode 100644 packages/stream_chat/lib/open_api/model/content_custom_property_count_parameters.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/content_custom_property_count_parameters.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/content_custom_property_parameters.dart create mode 100644 packages/stream_chat/lib/open_api/model/content_custom_property_parameters.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/content_custom_property_parameters.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/create_block_list_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/create_block_list_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/create_block_list_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/create_block_list_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/create_block_list_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/create_block_list_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/create_device_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/create_device_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/create_device_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/create_draft_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/create_draft_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/create_draft_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/create_draft_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/create_draft_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/create_draft_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/create_guest_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/create_guest_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/create_guest_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/create_guest_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/create_guest_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/create_guest_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/create_poll_option_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/create_poll_option_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/create_poll_option_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/create_poll_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/create_poll_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/create_poll_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/create_queue_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/create_queue_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/create_queue_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/create_reminder_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/create_reminder_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/create_reminder_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/create_user_group_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/create_user_group_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/create_user_group_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/create_user_group_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/create_user_group_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/create_user_group_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/custom_action_request_payload.dart create mode 100644 packages/stream_chat/lib/open_api/model/custom_action_request_payload.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/custom_action_request_payload.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/custom_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/custom_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/custom_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/data.dart create mode 100644 packages/stream_chat/lib/open_api/model/data.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/data.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/delete_action_config_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/delete_action_config_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/delete_action_config_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/delete_activity_request_payload.dart create mode 100644 packages/stream_chat/lib/open_api/model/delete_activity_request_payload.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/delete_activity_request_payload.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/delete_channel_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/delete_channel_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/delete_channel_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/delete_channels_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/delete_channels_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/delete_channels_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/delete_channels_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/delete_channels_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/delete_channels_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/delete_channels_result_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/delete_channels_result_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/delete_channels_result_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/delete_comment_request_payload.dart create mode 100644 packages/stream_chat/lib/open_api/model/delete_comment_request_payload.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/delete_comment_request_payload.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/delete_message_request_payload.dart create mode 100644 packages/stream_chat/lib/open_api/model/delete_message_request_payload.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/delete_message_request_payload.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/delete_message_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/delete_message_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/delete_message_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/delete_moderation_config_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/delete_moderation_config_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/delete_moderation_config_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/delete_reaction_request_payload.dart create mode 100644 packages/stream_chat/lib/open_api/model/delete_reaction_request_payload.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/delete_reaction_request_payload.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/delete_reaction_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/delete_reaction_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/delete_reaction_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/delete_reminder_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/delete_reminder_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/delete_reminder_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/delete_user_messages_request_payload.dart create mode 100644 packages/stream_chat/lib/open_api/model/delete_user_messages_request_payload.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/delete_user_messages_request_payload.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/delete_user_request_payload.dart create mode 100644 packages/stream_chat/lib/open_api/model/delete_user_request_payload.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/delete_user_request_payload.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/delivered_message_payload.dart create mode 100644 packages/stream_chat/lib/open_api/model/delivered_message_payload.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/delivered_message_payload.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/delivery_receipts_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/delivery_receipts_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/delivery_receipts_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/device_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/device_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/device_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/draft_deleted_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/draft_deleted_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/draft_deleted_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/draft_payload_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/draft_payload_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/draft_payload_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/draft_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/draft_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/draft_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/draft_updated_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/draft_updated_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/draft_updated_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/duration_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/duration_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/duration_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/enriched_activity.dart create mode 100644 packages/stream_chat/lib/open_api/model/enriched_activity.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/enriched_activity.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/enriched_reaction.dart create mode 100644 packages/stream_chat/lib/open_api/model/enriched_reaction.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/enriched_reaction.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/entity_creator_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/entity_creator_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/entity_creator_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/escalate_payload.dart create mode 100644 packages/stream_chat/lib/open_api/model/escalate_payload.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/escalate_payload.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/escalation_metadata.dart create mode 100644 packages/stream_chat/lib/open_api/model/escalation_metadata.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/escalation_metadata.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/event_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/event_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/event_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/event_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/event_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/event_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/feeds_activity_location.dart create mode 100644 packages/stream_chat/lib/open_api/model/feeds_activity_location.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/feeds_activity_location.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/feeds_bookmark_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/feeds_bookmark_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/feeds_bookmark_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/feeds_enriched_collection_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/feeds_enriched_collection_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/feeds_enriched_collection_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/feeds_feed_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/feeds_feed_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/feeds_feed_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/feeds_notification_comment.dart create mode 100644 packages/stream_chat/lib/open_api/model/feeds_notification_comment.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/feeds_notification_comment.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/feeds_notification_context.dart create mode 100644 packages/stream_chat/lib/open_api/model/feeds_notification_context.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/feeds_notification_context.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/feeds_notification_parent_activity.dart create mode 100644 packages/stream_chat/lib/open_api/model/feeds_notification_parent_activity.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/feeds_notification_parent_activity.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/feeds_notification_target.dart create mode 100644 packages/stream_chat/lib/open_api/model/feeds_notification_target.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/feeds_notification_target.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/feeds_notification_trigger.dart create mode 100644 packages/stream_chat/lib/open_api/model/feeds_notification_trigger.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/feeds_notification_trigger.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/feeds_preferences.dart create mode 100644 packages/stream_chat/lib/open_api/model/feeds_preferences.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/feeds_preferences.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/feeds_preferences_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/feeds_preferences_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/feeds_preferences_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/feeds_reaction_group_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/feeds_reaction_group_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/feeds_reaction_group_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/feeds_reaction_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/feeds_reaction_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/feeds_reaction_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/feeds_share_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/feeds_share_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/feeds_share_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/feeds_v3_activity_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/feeds_v3_activity_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/feeds_v3_activity_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/feeds_v3_comment_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/feeds_v3_comment_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/feeds_v3_comment_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/field.dart create mode 100644 packages/stream_chat/lib/open_api/model/field.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/field.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/file_upload_config.dart create mode 100644 packages/stream_chat/lib/open_api/model/file_upload_config.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/file_upload_config.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/file_upload_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/file_upload_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/file_upload_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/file_upload_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/file_upload_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/file_upload_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/filter_config_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/filter_config_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/filter_config_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/flag_count_rule_parameters.dart create mode 100644 packages/stream_chat/lib/open_api/model/flag_count_rule_parameters.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/flag_count_rule_parameters.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/flag_details_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/flag_details_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/flag_details_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/flag_feedback_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/flag_feedback_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/flag_feedback_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/flag_item_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/flag_item_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/flag_item_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/flag_message_details_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/flag_message_details_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/flag_message_details_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/flag_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/flag_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/flag_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/flag_user_options.dart create mode 100644 packages/stream_chat/lib/open_api/model/flag_user_options.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/flag_user_options.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/flood_config.dart create mode 100644 packages/stream_chat/lib/open_api/model/flood_config.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/flood_config.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/flood_identical_config.dart create mode 100644 packages/stream_chat/lib/open_api/model/flood_identical_config.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/flood_identical_config.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/flood_identical_rule_parameters.dart create mode 100644 packages/stream_chat/lib/open_api/model/flood_identical_rule_parameters.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/flood_identical_rule_parameters.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/flood_similar_config.dart create mode 100644 packages/stream_chat/lib/open_api/model/flood_similar_config.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/flood_similar_config.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/flood_similar_rule_parameters.dart create mode 100644 packages/stream_chat/lib/open_api/model/flood_similar_rule_parameters.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/flood_similar_rule_parameters.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/full_user_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/full_user_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/full_user_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/future_channel_ban_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/future_channel_ban_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/future_channel_ban_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/get_action_config_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/get_action_config_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/get_action_config_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/get_appeal_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/get_appeal_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/get_appeal_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/get_application_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/get_application_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/get_application_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/get_blocked_users_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/get_blocked_users_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/get_blocked_users_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/get_config_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/get_config_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/get_config_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/get_draft_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/get_draft_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/get_draft_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/get_many_messages_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/get_many_messages_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/get_many_messages_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/get_message_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/get_message_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/get_message_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/get_og_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/get_og_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/get_og_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/get_pinned_messages_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/get_pinned_messages_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/get_pinned_messages_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/get_reactions_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/get_reactions_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/get_reactions_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/get_replies_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/get_replies_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/get_replies_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/get_thread_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/get_thread_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/get_thread_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/get_user_group_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/get_user_group_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/get_user_group_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/google_vision_config.dart create mode 100644 packages/stream_chat/lib/open_api/model/google_vision_config.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/google_vision_config.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/grouped_channels_bucket.dart create mode 100644 packages/stream_chat/lib/open_api/model/grouped_channels_bucket.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/grouped_channels_bucket.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/grouped_channels_group_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/grouped_channels_group_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/grouped_channels_group_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/grouped_query_channels_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/grouped_query_channels_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/grouped_query_channels_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/grouped_query_channels_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/grouped_query_channels_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/grouped_query_channels_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/harm_config.dart create mode 100644 packages/stream_chat/lib/open_api/model/harm_config.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/harm_config.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/hide_channel_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/hide_channel_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/hide_channel_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/hide_channel_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/hide_channel_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/hide_channel_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/image_content_parameters.dart create mode 100644 packages/stream_chat/lib/open_api/model/image_content_parameters.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/image_content_parameters.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/image_data.dart create mode 100644 packages/stream_chat/lib/open_api/model/image_data.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/image_data.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/image_rule_parameters.dart create mode 100644 packages/stream_chat/lib/open_api/model/image_rule_parameters.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/image_rule_parameters.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/image_size.dart create mode 100644 packages/stream_chat/lib/open_api/model/image_size.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/image_size.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/image_upload_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/image_upload_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/image_upload_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/image_upload_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/image_upload_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/image_upload_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/images.dart create mode 100644 packages/stream_chat/lib/open_api/model/images.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/images.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/import_block_list_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/import_block_list_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/import_block_list_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/import_block_list_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/import_block_list_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/import_block_list_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/ip_content_count_rule_parameters.dart create mode 100644 packages/stream_chat/lib/open_api/model/ip_content_count_rule_parameters.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/ip_content_count_rule_parameters.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/ip_flag_count_rule_parameters.dart create mode 100644 packages/stream_chat/lib/open_api/model/ip_flag_count_rule_parameters.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/ip_flag_count_rule_parameters.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/keyframe_ocr_rule_parameters.dart create mode 100644 packages/stream_chat/lib/open_api/model/keyframe_ocr_rule_parameters.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/keyframe_ocr_rule_parameters.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/keyframe_rule_parameters.dart create mode 100644 packages/stream_chat/lib/open_api/model/keyframe_rule_parameters.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/keyframe_rule_parameters.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/label_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/label_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/label_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/label_thresholds.dart create mode 100644 packages/stream_chat/lib/open_api/model/label_thresholds.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/label_thresholds.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/list_block_list_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/list_block_list_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/list_block_list_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/list_devices_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/list_devices_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/list_devices_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/list_queues_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/list_queues_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/list_queues_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/list_user_groups_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/list_user_groups_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/list_user_groups_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/llm_config.dart create mode 100644 packages/stream_chat/lib/open_api/model/llm_config.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/llm_config.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/llm_rule.dart create mode 100644 packages/stream_chat/lib/open_api/model/llm_rule.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/llm_rule.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/mark_channels_read_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/mark_channels_read_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/mark_channels_read_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/mark_delivered_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/mark_delivered_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/mark_delivered_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/mark_delivered_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/mark_delivered_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/mark_delivered_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/mark_read_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/mark_read_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/mark_read_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/mark_read_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/mark_read_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/mark_read_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/mark_read_response_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/mark_read_response_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/mark_read_response_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/mark_reviewed_request_payload.dart create mode 100644 packages/stream_chat/lib/open_api/model/mark_reviewed_request_payload.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/mark_reviewed_request_payload.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/mark_unread_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/mark_unread_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/mark_unread_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/max_streak_changed_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/max_streak_changed_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/max_streak_changed_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/member_added_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/member_added_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/member_added_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/member_removed_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/member_removed_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/member_removed_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/member_updated_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/member_updated_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/member_updated_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/member_user_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/member_user_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/member_user_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/members_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/members_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/members_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_action_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_action_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_action_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_action_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_action_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_action_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_change_set.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_change_set.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_change_set.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_deleted_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_deleted_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_deleted_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_delivered_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_delivered_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_delivered_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_flag_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_flag_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_flag_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_moderation_result.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_moderation_result.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_moderation_result.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_new_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_new_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_new_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_options.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_options.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_options.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_pagination_params.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_pagination_params.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_pagination_params.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_read_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_read_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_read_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_undeleted_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_undeleted_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_undeleted_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_update.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_update.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_update.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_updated_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_updated_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_updated_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_with_channel_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_with_channel_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/message_with_channel_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/moderation_action_config_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/moderation_action_config_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/moderation_action_config_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/moderation_ban_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/moderation_ban_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/moderation_ban_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/moderation_call_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/moderation_call_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/moderation_call_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/moderation_custom_action_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/moderation_custom_action_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/moderation_custom_action_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/moderation_flag_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/moderation_flag_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/moderation_flag_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/moderation_flagged_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/moderation_flagged_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/moderation_flagged_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/moderation_mark_reviewed_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/moderation_mark_reviewed_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/moderation_mark_reviewed_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/moderation_payload.dart create mode 100644 packages/stream_chat/lib/open_api/model/moderation_payload.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/moderation_payload.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/moderation_payload_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/moderation_payload_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/moderation_payload_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/moderation_queue_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/moderation_queue_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/moderation_queue_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/moderation_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/moderation_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/moderation_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/moderation_v2_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/moderation_v2_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/moderation_v2_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/mute_channel_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/mute_channel_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/mute_channel_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/mute_channel_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/mute_channel_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/mute_channel_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/mute_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/mute_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/mute_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/mute_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/mute_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/mute_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/notification_added_to_channel_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/notification_added_to_channel_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/notification_added_to_channel_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/notification_channel_deleted_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/notification_channel_deleted_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/notification_channel_deleted_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/notification_channel_mutes_updated_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/notification_channel_mutes_updated_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/notification_channel_mutes_updated_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/notification_channel_truncated_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/notification_channel_truncated_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/notification_channel_truncated_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/notification_invite_accepted_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/notification_invite_accepted_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/notification_invite_accepted_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/notification_invite_rejected_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/notification_invite_rejected_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/notification_invite_rejected_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/notification_invited_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/notification_invited_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/notification_invited_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/notification_mark_read_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/notification_mark_read_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/notification_mark_read_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/notification_mark_unread_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/notification_mark_unread_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/notification_mark_unread_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/notification_mutes_updated_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/notification_mutes_updated_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/notification_mutes_updated_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/notification_new_message_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/notification_new_message_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/notification_new_message_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/notification_removed_from_channel_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/notification_removed_from_channel_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/notification_removed_from_channel_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/notification_thread_message_new_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/notification_thread_message_new_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/notification_thread_message_new_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/ocr_content_parameters.dart create mode 100644 packages/stream_chat/lib/open_api/model/ocr_content_parameters.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/ocr_content_parameters.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/ocr_rule.dart create mode 100644 packages/stream_chat/lib/open_api/model/ocr_rule.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/ocr_rule.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/only_user_id.dart create mode 100644 packages/stream_chat/lib/open_api/model/only_user_id.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/only_user_id.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/own_user_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/own_user_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/own_user_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/pagination_params.dart create mode 100644 packages/stream_chat/lib/open_api/model/pagination_params.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/pagination_params.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/parsed_predefined_filter_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/parsed_predefined_filter_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/parsed_predefined_filter_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/pending_message_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/pending_message_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/pending_message_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/pending_message_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/pending_message_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/pending_message_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/poll_closed_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/poll_closed_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/poll_closed_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/poll_deleted_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/poll_deleted_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/poll_deleted_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/poll_option_input.dart create mode 100644 packages/stream_chat/lib/open_api/model/poll_option_input.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/poll_option_input.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/poll_option_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/poll_option_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/poll_option_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/poll_option_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/poll_option_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/poll_option_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/poll_option_response_data.dart create mode 100644 packages/stream_chat/lib/open_api/model/poll_option_response_data.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/poll_option_response_data.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/poll_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/poll_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/poll_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/poll_response_data.dart create mode 100644 packages/stream_chat/lib/open_api/model/poll_response_data.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/poll_response_data.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/poll_updated_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/poll_updated_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/poll_updated_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/poll_vote_casted_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/poll_vote_casted_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/poll_vote_casted_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/poll_vote_changed_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/poll_vote_changed_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/poll_vote_changed_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/poll_vote_removed_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/poll_vote_removed_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/poll_vote_removed_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/poll_vote_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/poll_vote_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/poll_vote_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/poll_vote_response_data.dart create mode 100644 packages/stream_chat/lib/open_api/model/poll_vote_response_data.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/poll_vote_response_data.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/poll_votes_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/poll_votes_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/poll_votes_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/privacy_settings_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/privacy_settings_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/privacy_settings_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/push_preference_input.dart create mode 100644 packages/stream_chat/lib/open_api/model/push_preference_input.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/push_preference_input.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/push_preferences_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/push_preferences_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/push_preferences_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_appeals_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_appeals_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_appeals_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_appeals_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_appeals_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_appeals_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_banned_users_payload.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_banned_users_payload.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_banned_users_payload.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_banned_users_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_banned_users_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_banned_users_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_channels_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_channels_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_channels_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_channels_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_channels_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_channels_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_drafts_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_drafts_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_drafts_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_drafts_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_drafts_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_drafts_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_future_channel_bans_payload.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_future_channel_bans_payload.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_future_channel_bans_payload.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_future_channel_bans_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_future_channel_bans_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_future_channel_bans_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_members_payload.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_members_payload.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_members_payload.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_message_flags_payload.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_message_flags_payload.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_message_flags_payload.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_message_flags_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_message_flags_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_message_flags_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_moderation_configs_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_moderation_configs_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_moderation_configs_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_moderation_configs_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_moderation_configs_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_moderation_configs_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_poll_votes_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_poll_votes_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_poll_votes_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_polls_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_polls_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_polls_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_polls_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_polls_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_polls_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_reactions_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_reactions_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_reactions_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_reactions_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_reactions_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_reactions_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_reminders_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_reminders_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_reminders_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_reminders_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_reminders_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_reminders_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_review_queue_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_review_queue_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_review_queue_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_review_queue_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_review_queue_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_review_queue_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_threads_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_threads_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_threads_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_threads_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_threads_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_threads_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_users_payload.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_users_payload.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_users_payload.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_users_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_users_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/query_users_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/queue_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/queue_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/queue_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/reaction.dart create mode 100644 packages/stream_chat/lib/open_api/model/reaction.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/reaction.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/reaction_deleted_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/reaction_deleted_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/reaction_deleted_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/reaction_group_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/reaction_group_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/reaction_group_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/reaction_group_user_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/reaction_group_user_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/reaction_group_user_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/reaction_new_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/reaction_new_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/reaction_new_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/reaction_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/reaction_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/reaction_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/reaction_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/reaction_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/reaction_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/reaction_updated_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/reaction_updated_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/reaction_updated_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/read_receipts_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/read_receipts_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/read_receipts_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/read_state_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/read_state_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/read_state_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/reject_appeal_request_payload.dart create mode 100644 packages/stream_chat/lib/open_api/model/reject_appeal_request_payload.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/reject_appeal_request_payload.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/reminder_created_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/reminder_created_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/reminder_created_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/reminder_deleted_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/reminder_deleted_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/reminder_deleted_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/reminder_notification_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/reminder_notification_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/reminder_notification_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/reminder_response_data.dart create mode 100644 packages/stream_chat/lib/open_api/model/reminder_response_data.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/reminder_response_data.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/reminder_updated_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/reminder_updated_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/reminder_updated_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/remove_user_group_members_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/remove_user_group_members_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/remove_user_group_members_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/remove_user_group_members_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/remove_user_group_members_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/remove_user_group_members_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/restore_action_request_payload.dart create mode 100644 packages/stream_chat/lib/open_api/model/restore_action_request_payload.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/restore_action_request_payload.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/review_queue_item_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/review_queue_item_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/review_queue_item_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/role.dart create mode 100644 packages/stream_chat/lib/open_api/model/role.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/role.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/rule_builder_action.dart create mode 100644 packages/stream_chat/lib/open_api/model/rule_builder_action.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/rule_builder_action.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/rule_builder_condition.dart create mode 100644 packages/stream_chat/lib/open_api/model/rule_builder_condition.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/rule_builder_condition.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/rule_builder_condition_group.dart create mode 100644 packages/stream_chat/lib/open_api/model/rule_builder_condition_group.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/rule_builder_condition_group.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/rule_builder_config.dart create mode 100644 packages/stream_chat/lib/open_api/model/rule_builder_config.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/rule_builder_config.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/rule_builder_rule.dart create mode 100644 packages/stream_chat/lib/open_api/model/rule_builder_rule.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/rule_builder_rule.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/search_payload.dart create mode 100644 packages/stream_chat/lib/open_api/model/search_payload.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/search_payload.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/search_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/search_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/search_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/search_result.dart create mode 100644 packages/stream_chat/lib/open_api/model/search_result.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/search_result.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/search_result_message.dart create mode 100644 packages/stream_chat/lib/open_api/model/search_result_message.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/search_result_message.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/search_roles_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/search_roles_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/search_roles_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/search_user_groups_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/search_user_groups_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/search_user_groups_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/search_warning.dart create mode 100644 packages/stream_chat/lib/open_api/model/search_warning.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/search_warning.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/send_event_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/send_event_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/send_event_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/send_message_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/send_message_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/send_message_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/send_message_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/send_message_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/send_message_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/send_reaction_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/send_reaction_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/send_reaction_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/send_reaction_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/send_reaction_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/send_reaction_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/shadow_block_action_request_payload.dart create mode 100644 packages/stream_chat/lib/open_api/model/shadow_block_action_request_payload.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/shadow_block_action_request_payload.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/shared_location.dart create mode 100644 packages/stream_chat/lib/open_api/model/shared_location.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/shared_location.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/shared_location_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/shared_location_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/shared_location_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/shared_location_response_data.dart create mode 100644 packages/stream_chat/lib/open_api/model/shared_location_response_data.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/shared_location_response_data.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/shared_locations_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/shared_locations_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/shared_locations_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/show_channel_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/show_channel_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/show_channel_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/sort_param_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/sort_param_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/sort_param_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/submit_action_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/submit_action_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/submit_action_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/submit_action_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/submit_action_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/submit_action_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/sync_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/sync_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/sync_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/sync_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/sync_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/sync_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/text_content_parameters.dart create mode 100644 packages/stream_chat/lib/open_api/model/text_content_parameters.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/text_content_parameters.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/text_rule_parameters.dart create mode 100644 packages/stream_chat/lib/open_api/model/text_rule_parameters.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/text_rule_parameters.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/thread_participant.dart create mode 100644 packages/stream_chat/lib/open_api/model/thread_participant.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/thread_participant.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/thread_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/thread_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/thread_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/thread_state_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/thread_state_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/thread_state_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/thread_updated_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/thread_updated_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/thread_updated_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/thresholds.dart create mode 100644 packages/stream_chat/lib/open_api/model/thresholds.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/thresholds.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/translate_message_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/translate_message_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/translate_message_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/truncate_channel_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/truncate_channel_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/truncate_channel_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/truncate_channel_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/truncate_channel_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/truncate_channel_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/typing_indicators_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/typing_indicators_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/typing_indicators_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/typing_start_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/typing_start_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/typing_start_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/typing_stop_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/typing_stop_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/typing_stop_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/unban_action_request_payload.dart create mode 100644 packages/stream_chat/lib/open_api/model/unban_action_request_payload.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/unban_action_request_payload.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/unblock_action_request_payload.dart create mode 100644 packages/stream_chat/lib/open_api/model/unblock_action_request_payload.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/unblock_action_request_payload.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/unblock_users_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/unblock_users_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/unblock_users_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/unblock_users_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/unblock_users_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/unblock_users_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/unmute_channel_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/unmute_channel_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/unmute_channel_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/unmute_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/unmute_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/unmute_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/unmute_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/unmute_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/unmute_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/unread_counts_channel.dart create mode 100644 packages/stream_chat/lib/open_api/model/unread_counts_channel.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/unread_counts_channel.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/unread_counts_channel_type.dart create mode 100644 packages/stream_chat/lib/open_api/model/unread_counts_channel_type.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/unread_counts_channel_type.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/unread_counts_thread.dart create mode 100644 packages/stream_chat/lib/open_api/model/unread_counts_thread.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/unread_counts_thread.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_block_list_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_block_list_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_block_list_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_block_list_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_block_list_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_block_list_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_channel_partial_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_channel_partial_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_channel_partial_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_channel_partial_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_channel_partial_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_channel_partial_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_channel_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_channel_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_channel_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_channel_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_channel_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_channel_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_live_location_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_live_location_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_live_location_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_member_partial_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_member_partial_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_member_partial_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_member_partial_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_member_partial_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_member_partial_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_message_partial_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_message_partial_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_message_partial_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_message_partial_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_message_partial_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_message_partial_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_message_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_message_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_message_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_message_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_message_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_message_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_poll_option_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_poll_option_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_poll_option_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_poll_partial_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_poll_partial_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_poll_partial_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_poll_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_poll_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_poll_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_queue_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_queue_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_queue_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_reminder_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_reminder_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_reminder_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_reminder_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_reminder_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_reminder_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_thread_partial_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_thread_partial_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_thread_partial_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_thread_partial_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_thread_partial_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_thread_partial_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_user_group_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_user_group_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_user_group_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_user_group_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_user_group_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_user_group_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_user_partial_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_user_partial_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_user_partial_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_users_partial_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_users_partial_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_users_partial_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_users_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_users_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_users_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_users_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_users_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/update_users_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/upload_channel_file_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/upload_channel_file_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/upload_channel_file_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/upload_channel_file_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/upload_channel_file_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/upload_channel_file_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/upload_channel_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/upload_channel_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/upload_channel_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/upload_channel_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/upload_channel_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/upload_channel_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/upsert_action_config_item.dart create mode 100644 packages/stream_chat/lib/open_api/model/upsert_action_config_item.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/upsert_action_config_item.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/upsert_action_config_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/upsert_action_config_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/upsert_action_config_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/upsert_action_config_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/upsert_action_config_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/upsert_action_config_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/upsert_config_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/upsert_config_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/upsert_config_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/upsert_config_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/upsert_config_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/upsert_config_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/upsert_push_preferences_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/upsert_push_preferences_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/upsert_push_preferences_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/upsert_push_preferences_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/upsert_push_preferences_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/upsert_push_preferences_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/user.dart create mode 100644 packages/stream_chat/lib/open_api/model/user.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/user.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_banned_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_banned_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_banned_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_created_within_parameters.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_created_within_parameters.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_created_within_parameters.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_custom_property_parameters.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_custom_property_parameters.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_custom_property_parameters.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_deactivated_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_deactivated_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_deactivated_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_deleted_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_deleted_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_deleted_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_group.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_group.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_group.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_group_created_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_group_created_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_group_created_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_group_deleted_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_group_deleted_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_group_deleted_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_group_member.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_group_member.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_group_member.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_group_member_added_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_group_member_added_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_group_member_added_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_group_member_removed_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_group_member_removed_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_group_member_removed_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_group_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_group_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_group_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_group_updated_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_group_updated_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_group_updated_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_identical_content_count_parameters.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_identical_content_count_parameters.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_identical_content_count_parameters.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_messages_deleted_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_messages_deleted_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_messages_deleted_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_mute_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_mute_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_mute_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_muted_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_muted_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_muted_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_presence_changed_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_presence_changed_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_presence_changed_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_reactivated_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_reactivated_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_reactivated_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_response_common_fields.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_response_common_fields.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_response_common_fields.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_response_privacy_fields.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_response_privacy_fields.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_response_privacy_fields.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_role_parameters.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_role_parameters.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_role_parameters.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_rule_parameters.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_rule_parameters.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_rule_parameters.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_unbanned_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_unbanned_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_unbanned_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_updated_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_updated_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_updated_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_watching_start_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_watching_start_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_watching_start_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_watching_stop_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_watching_stop_event.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_watching_stop_event.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/velocity_filter_config.dart create mode 100644 packages/stream_chat/lib/open_api/model/velocity_filter_config.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/velocity_filter_config.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/velocity_filter_config_rule.dart create mode 100644 packages/stream_chat/lib/open_api/model/velocity_filter_config_rule.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/velocity_filter_config_rule.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/video_call_rule_config.dart create mode 100644 packages/stream_chat/lib/open_api/model/video_call_rule_config.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/video_call_rule_config.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/video_content_parameters.dart create mode 100644 packages/stream_chat/lib/open_api/model/video_content_parameters.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/video_content_parameters.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/video_rule_parameters.dart create mode 100644 packages/stream_chat/lib/open_api/model/video_rule_parameters.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/video_rule_parameters.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/vote_data.dart create mode 100644 packages/stream_chat/lib/open_api/model/vote_data.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/vote_data.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/wrapped_unread_counts_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/wrapped_unread_counts_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/wrapped_unread_counts_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/ws_auth_message.dart create mode 100644 packages/stream_chat/lib/open_api/model/ws_auth_message.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/ws_auth_message.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/ws_client_event.dart create mode 100644 packages/stream_chat/lib/open_api/model/ws_event.dart create mode 100644 packages/stream_chat/lib/open_api/models.dart create mode 100755 scripts/generate.sh create mode 100644 scripts/renamed-models.json create mode 100644 tools/rename_openapi_models.dart diff --git a/.claude/skills/openapi-codegen/SKILL.md b/.claude/skills/openapi-codegen/SKILL.md new file mode 100644 index 0000000000..8af3dfd575 --- /dev/null +++ b/.claude/skills/openapi-codegen/SKILL.md @@ -0,0 +1,163 @@ +--- +name: openapi-codegen +description: > + Regenerate `stream_chat`'s OpenAPI client into `lib/open_api/`, and fix the generator when its output is wrong. + Use when the spec or the generator changed and you need new endpoints or fields, when `melos run gen:openapi` + fails, when generated code does not compile, or when handling the `stream_core` git pin and the release blocker + it creates. For migrating call sites onto the generated client, use the `openapi-migration` skill instead. +allowed-tools: + - Bash + - Read + - Edit + - Write + - Grep + - Glob +--- + +# openapi-codegen + +The generated client is committed to the repo, so migration work never runs this. Regenerate only when the spec +or the generator changed — a new endpoint, a new field, or a generator fix you need. Land it as its own PR; never +fold a regeneration into a migration slice. + +```bash +# the newest released spec, resolved for you — nothing to look up +PROTOCOL_REF=latest CHAT_BACKEND_DIR=/path/to/chat melos run gen:openapi + +# a specific release +PROTOCOL_REF=openapi-v237.2.0 CHAT_BACKEND_DIR=/path/to/chat melos run gen:openapi + +# same spec from a local protocol checkout — for iterating on an unreleased one +PROTOCOL_DIR=/path/to/protocol CHAT_BACKEND_DIR=/path/to/chat melos run gen:openapi + +# the monolith's current API, spec and all — no protocol involvement +CHAT_BACKEND_DIR=/path/to/chat melos run gen:openapi +``` + +`CHAT_BACKEND_DIR` is required in every mode: the generator lives in the monolith, and protocol ships specs only. +Setting `PROTOCOL_DIR` and `PROTOCOL_REF` together is an error rather than a precedence rule — they name two +different specs. Requires `go`, `dart` and `python3`, plus `curl` for `PROTOCOL_REF`; checksum verification uses +`shasum` or `sha256sum` and warns rather than fails if neither exists. + +`PROTOCOL_REF` has **no default** on purpose: a default of `main` would reintroduce the drift the stamp exists to +catch. Naming the ref — or asking for `latest`, which stamps the tag it resolved rather than the word — is what +makes a run reproducible after the fact, more so than a checkout that silently uses whatever it sits at. Both +protocol modes produce byte-identical output and the same stamp for the same release. + +Backend mode is the odd one out: its spec is built from the monolith's current routes, so it can carry unreleased +endpoints and stamps `(API dev)` with a commit rather than a version. Right for "does this new endpoint generate +cleanly?", wrong for a tree you intend to commit — nobody without your exact monolith commit can reproduce it. + +`scripts/generate.sh` resolves a spec, generates into `packages/stream_chat/lib/open_api`, patches it, runs +`build_runner`, then formats the package. `CHAT_BACKEND_DIR` is required either way — `generate-client` lives in +the monolith, and the protocol repo ships specs only. + +After regenerating, refresh the migration plan: + +```bash +python3 openapi-migration/tool/generate_plan.py +``` + +It rebuilds the scope tables in `openapi-migration/*.md` from the new client and reports any operation no group +claims — that is how a newly added endpoint gets noticed instead of sitting unowned. + +If a regeneration renames or retypes a generated symbol that migrated code already exposes publicly, that is a +consumer-visible break: add the Symbol Map row to `migrations/v11-migration.md` in the same PR, exactly as a +feature migration would. + +| Knob | Meaning | +|---|---| +| `CHAT_BACKEND_DIR` | **Always required.** Checkout of the backend monolith | +| `PROTOCOL_DIR` | Optional. Uses `openapi/v2/chat-clientside-api.json` from a checkout, skipping spec generation | +| `PROTOCOL_REF` | Optional. Downloads that spec at a tag/branch/sha. `latest` resolves protocol's newest openapi release. Mutually exclusive with `PROTOCOL_DIR`; needs `curl` | +| `scripts/renamed-models.json` | Model renames. Currently `Response → DurationResponse` | +| `tools/rename_openapi_models.dart` | Applies those renames to a spec generated without them | +| `packages/stream_chat/build.yaml` | Builder order: freezed → json_serializable → retrofit_generator | + +## Things that will bite you + +- **Read the provenance line, and the stamp it writes.** The run prints + `• Using spec …json (API v237.2.0, protocol @ openapi-v237.2.0)`, and `stamp_provenance` records the same facts + at the top of `lib/open_api/api.dart`: + + ```dart + // Spec: chat-clientside-api (API v237.2.0) + // Source: protocol @ openapi-v237.2.0 + // Checksum: 0750cb0e… // protocol's sha256 sidecar, verified before generating + // Generator: GetStream/chat @ v237.3.0-135-g59094108e1 + ``` + + `stream_feeds` stamps the same idea as a single `// Source: GetStream/protocol @ ` line; ours is + the aligned form, and adds the checksum and generator, which feeds records neither of. + + So a checked-in client says which spec and which templates produced it. Two readings to get right: + `Generator:` is a `git describe` of the backend checkout, not a release — `v237.3.0-135-g59094108e1` means 135 + commits past that tag — and a `-dirty` suffix on either line means the client came from uncommitted local edits + and should not be committed. The checksum is verified against protocol's sidecar before generating, so a locally + edited spec fails the run rather than reaching 1,477 files. The stamp carries no timestamp on + purpose: regenerating from unchanged inputs must produce no diff, which is also how you tell a real template + change from noise. Watch for drift between the two versions — a generator far ahead of the spec is worth + knowing before you debug output. +- **`Response → DurationResponse` is load-bearing.** `stream_core` re-exports `package:dio/dio.dart` wholesale, so + a generated `Response` collides with dio's inside retrofit's `.g.dart`. Protocol specs ship without the rename, + which is why `tools/rename_openapi_models.dart` applies it to a temp copy of the JSON spec. +- **`--opt` does not work for Dart.** The Dart language in the monolith's generator does not implement + `Configurable`, so anything you want configurable has to be added there first. +- **The format step covers the whole package on purpose.** `build_runner` rewrites every output it touches — + including pre-existing `.g.dart` under `lib/src/` — at the dart_style default width. Narrowing that step to + `lib/open_api` makes `melos run format` fail in CI. +- **`build_runner`'s output is the real correctness signal.** `analysis_options.yaml` excludes `**/*.g.dart` and + `**/*.freezed.dart` repo-wide, so the retrofit `.g.dart` and every generated `.freezed.dart` are invisible to + `melos run analyze`. Read the build log; don't infer success from a green analyze. + +## Known generator gap: the call adapter + +`client.tpl` emits `_ResultCallAdapter` over `runSafely`, but core's error layer expects `runApiSafely` — the +wrapper that turns a `DioException` into a `StreamException` and catches an undecodable body instead of letting a +`TypeError` escape. Until the template is changed upstream, a regenerated client keeps the old behaviour and every +`Failure` carries a raw `DioException`. + +``` +monolith/openapi/generator/templates/templates/dart/client.tpl +- Future> adapt(Future Function() call) => runSafely(call); ++ Future> adapt(Future Function() call) => runApiSafely(call); +``` + +## When the generated code is wrong + +Fix the templates in the monolith (`monolith/openapi/generator/templates/templates/dart/`) and link that PR from +ours. A post-generation patch in `scripts/generate.sh` is acceptable only against a reproducible failure, and only +while the upstream fix is in flight. + +There is exactly one such patch today. `EventResponse.event` and `SyncResponse.events` are typed as the WSEvent +union, and the generator emits them broken twice over: a static `fromJson` with no `toJson` and no `@JsonKey` +converters, so json_serializable can't serialize the field; plus a `.freezed.dart` that writes the `WsEvent` type +argument without its `core.` prefix. `patch_ws_event_models()` fixes both in four edits — add `WsEvent` to the +barrel's `show` list, append converter functions to `ws_event.dart`, and point each field's `@JsonKey` at them. + +The patch exits with an error if the `@JsonKey(name: 'event')` line it expects is gone. That is the signal upstream +landed the fix and the patch should be deleted, not repaired. + +Don't propose "make `fromJson` a factory" — `WSEvent` is generic, so a factory cannot return +`_CustomEvent extends WSEvent` where `WSEvent` is expected. The upstream shape is converters +emitted by `model.tpl` / `discriminator.tpl` plus a `WsEvent` re-export from `models-barrel.tpl`. + +## Dependencies and the release blocker + +`stream_chat` depends on `retrofit`, `retrofit_generator`, `json_annotation ^4.12.0` and `stream_core`. + +**`stream_core` is pinned to a git ref in 8 places** — `melos.yaml`, `packages/stream_chat/pubspec.yaml`, and 6 +`dependency_overrides` blocks (`sample_app`, `docs/docs_screenshots`, `packages/stream_chat_flutter` and its +example, `packages/stream_chat_localizations` and its example). `stream_core_flutter` declares a *published* +`stream_core` and pub refuses git-vs-hosted for one package, so every consumer of both needs the override. + +Bump all 8 together. Pub honors the override's ref over the declared one, so a partial bump silently compiles +against a different core commit than the pubspec claims. To find them all: + +```bash +grep -rn "stream_core:" --include=pubspec.yaml packages docs sample_app melos.yaml +``` + +**`stream_chat` cannot be published while that git dep exists**, and the generator's output needs +`StreamDateTimeConverter`, which is not in the last published `stream_core`. So a `stream_core` release is a +prerequisite for any `stream_chat` release — and it collapses all 8 pins to one hosted constraint. diff --git a/.claude/skills/openapi-migration/SKILL.md b/.claude/skills/openapi-migration/SKILL.md new file mode 100644 index 0000000000..e44427fe49 --- /dev/null +++ b/.claude/skills/openapi-migration/SKILL.md @@ -0,0 +1,287 @@ +--- +name: openapi-migration +description: > + Plan and land the migration of one feature onto the OpenAPI-generated client that ships in `lib/open_api/` — + scope the feature, inventory it, decide which shape each symbol keeps, sequence the work, then implement and + verify. Use when planning or executing a feature's migration, or when deciding whether a difference between our + API and the generated one justifies a breaking change. For regenerating the client or fixing the generator, use + the `openapi-codegen` skill instead. +allowed-tools: + - Bash + - Read + - Edit + - Write + - Grep + - Glob +--- + +# openapi-migration + +The migration onto the generated client runs **feature by feature**: `stream_chat` talks to the API through both +the hand-written layer and the generated one, and each PR moves one feature across completely. This skill is the +process for planning and landing one of them. + +Two documents bracket this work, and you should read both before starting: + +- **`openapi-migration/`** — the plan. Its `README.md` has the group order, sizes and status; each numbered file + is one feature group with its scope tables (hand-written methods ↔ generated operations), decisions, risks and + definition of done. `01-foundation.md` holds the cross-cutting decisions every group inherits. **Start from your + group's file** rather than re-deriving the inventory — phase 1 below is largely done there already. +- **`migrations/v11-migration.md`** — the consumer upgrade guide, written *as* features land rather than + reconstructed at release. Read its Symbol Map and Error Handling sections before designing a change: they define + the shape consumers have already been promised. + +Work the phases in order. Most of the cost is in phases 1–2 — the code is mechanical once the inventory and the +shape decisions exist. + +## Phase 1 — scope the feature and inventory it + +The groups are already scoped in `openapi-migration/`, with the method-to-operation tables generated from the +code. Open your group's file first; this phase confirms it still matches reality rather than rebuilding it. + +If the client has been regenerated since the plan was last refreshed, run +`python3 openapi-migration/tool/generate_plan.py` to update the tables. An operation no group claims is reported +as a problem, and it means the plan needs a home for it. + +```bash +cd packages/stream_chat + +# what already consumes the generated client — patterns you can copy +grep -rln "open_api" lib/src + +# our surface for the feature +ls lib/src/core/api/ # the *_api.dart that owns it +grep -rn "Poll" lib/stream_chat.dart # what of it is publicly exported + +# the generated operations, with paths and response types +grep -n -B1 "Future_api_test.dart`, the feature's cases in + `test/src/client/client_test.dart`, and its round-trips in `test/src/core/api/responses_test.dart`. + +Close the phase by checking for a **blocking mismatch**: if the generated payload omits a field our current request +sends, that endpoint stays hand-written and the inventory says why. Migrating it would silently drop behaviour. + +### When the type or operation isn't in the generated client + +Work the ladder in order — the answer changes depending on *where* it's missing. + +1. **Confirm it is really absent.** Names rarely match ours: responses are `*Response`, empty responses are + `DurationResponse`, and inline enums become per-operation extension types. Search on a fragment, not the full + name: + + ```bash + ls packages/stream_chat/lib/open_api/model/ | grep -i device + grep -in "device" packages/stream_chat/lib/open_api/api/default_api.dart | head + ``` +2. **Present in the spec, but the generated form is unusable.** Multipart uploads are the known case: the spec says + `multipart/form-data`, the generated method takes a JSON `@Body()`. Hand-write that one call with retrofit over + the generated *response* models, and open a generator fix upstream — see the `openapi-codegen` skill. Don't + contort the call site around a broken signature. +3. **In a newer spec than the one our tree was generated from.** Regenerate — its own PR, never folded into a + feature slice. Also `openapi-codegen`. +4. **Absent from the clientside spec entirely.** It is server-side only, deprecated (spec generation skips + deprecated operations), or not yet exposed on v2. Confirm against the spec before concluding: + + ```bash + python3 -c "import json,sys; s=json.load(open(sys.argv[1])); \ + print('\n'.join(p for p in s['paths'] if 'device' in p))" \ + /path/to/protocol/openapi/v2/chat-clientside-api.json + ``` + + Then leave the endpoint hand-written, record it in the inventory with the reason, and raise it with the backend + team so the spec grows. Never invent a generated model to fill the hole. + +**Never hand-edit anything under `lib/open_api/`.** Regeneration deletes the directory, so an edit there is lost +silently — which is exactly why fixes belong in the generator or in your own code. + +## Phase 2 — decide the shape of each symbol + +For every type in the inventory, one decision: keep our shape and map at the boundary, or adopt the generated one. + +**Default to keeping our shape.** Generated types are wire shapes — nullable wherever the spec is loose, with +`_unknown` enum sentinels and per-operation extension types instead of shared enums (`CreateDeviceRequestPushProvider` +rather than one `PushProvider`). That is usually a worse public API than what we hand-wrote. + +**Breaking changes are allowed, but a break needs a reason beyond convenience.** Take it when it buys one of: + +- **Long-term maintainability** — the alternative is maintaining two shapes of the same thing indefinitely, or a + mapping layer that needs editing on every spec change. +- **Consistency with our other products** — the generated name or shape is what our other SDKs expose, so matching + it makes Stream's API coherent for people working across them. + +Not sufficient on their own: avoiding a small mapping function, cosmetic naming, or "the generated one is newer". + +When you do break, four things ship in the same PR: a `refactor(scope)!:` commit/PR title, a `🛑️ Breaking` +CHANGELOG entry naming the old and new symbol, a Symbol Map row plus feature section in +`migrations/v11-migration.md` (that guide is written as we go, not reconstructed at release), and the decision +*with its reason* in the PR body. + +**The error contract is decided: a migrated API returns `Future>` and does not throw.** This matches +`stream_feeds`, which exports `stream_core` from its barrel and returns `Future>` from its +client methods — so it clears both halves of the bar above: one error convention across our SDKs, and no +hand-written error-translation layer to keep in step with the spec. + +Two details that are settled, so don't re-decide them per feature: + +- **What rides inside `Failure`: always a `StreamException`.** `stream_core`'s error layer is a sealed family — + `StreamApiException`, `StreamNetworkException`, `StreamAuthenticationException`, `StreamClientException` — so a + migrated method needs no error handling of its own. Do not translate to `StreamChatNetworkError`; that is the + hand-written layer this migration deletes. +- **What guarantees it: `runApiSafely`.** Core's call wrapper maps a `DioException` through + `toStreamException()`, keeps a `StreamException` as raised, and wraps anything else — *including a `TypeError` + from a response body that would not decode* — in a `StreamClientException` with the original as its `cause`. + That last branch matters: with the older `runSafely`, a payload mismatch surfaced as a bare `TypeError` after a + successful HTTP call, and no `is StreamException` check would have caught it. + +```text +Failure.error → StreamException (sealed) + ├── StreamApiException statusCode, code (StreamErrorCode), moreInfo, unrecoverable, + │ retryAfter, apiError + isTokenExpired / isRateLimited / … + ├── StreamNetworkException isCancelled, isTimeout, closeCode + ├── StreamAuthenticationException + └── StreamClientException our own bug, or an undecodable body (cause preserved) +``` + +`StreamException.tryFrom(Object?)` normalizes anything already in hand, and `StreamErrorCode` is an +`extension type const StreamErrorCode(int) implements int` with named constants (`apiKeyInvalid`, `inputError`, +`rateLimited`, `internalError`, …). The root is `sealed`, so a `switch` over it is exhaustive and no new direct +subtype can appear outside core; the four subtypes are `base`, so chat can extend one if a case ever needs it but +cannot implement it. + +**This supersedes our `ChatErrorCode`.** Core now owns the code vocabulary, so the plan is to drop ours rather +than re-express it as an extension. Check `StreamErrorCode` for a constant before adding one here. + +## Phase 3 — sequence the work + +Inside the feature: request bodies first (no public surface, no persistence), then responses, then models. Three +things can block a feature and are cheaper to resolve before starting: + +- **`ApiErrorInterceptor` on the Dio behind `DefaultApi`, and `runApiSafely` in the call adapter.** One-time + setup, and together they are what make every `Failure` carry a `StreamException`. Without them you get raw + `DioException`s and every method is tempted to re-derive error details. There is no error-translation helper to + write. +- **`Result` has to reach consumers.** Re-export it from `lib/stream_chat.dart` with a `show` allowlist — + `show Result, Success, Failure, StreamException, StreamApiException, StreamNetworkException, + StreamAuthenticationException, StreamClientException, StreamApiError, StreamErrorCode` — not feeds' wholesale + `export 'package:stream_core/stream_core.dart';`. + `stream_core` re-exports all of dio plus its own `AttachmentFile`, which collides by name with the + `AttachmentFile` our barrel already exports, so a blanket export fails to compile. An allowlist is also the + pattern `stream_chat_flutter` already uses for core re-exports. +- **Where `DefaultApi` is constructed.** It needs a `Dio`, and `StreamHttpClient.httpClient` is + `@visibleForTesting` while `StreamHttpClient` itself is publicly exported — so `DefaultApi(client.httpClient)` + fails `melos run analyze` (`dart analyze --fatal-infos`) with `invalid_use_of_visible_for_testing_member`. Add an + `@internal` accessor, or build `DefaultApi` once in `StreamChatApi` and inject it. Decide once, apply everywhere. +- **Multipart uploads cannot come from the generated client.** The spec declares uploads as `multipart/form-data`, + but the generated `uploadFile` / `uploadChannelFile` take a JSON `@Body()` with no progress or cancellation. That + feature needs hand-written retrofit multipart calls over the generated response models — don't route + `AttachmentFileUploader` through `DefaultApi`. + +`EmptyResponse` has ~250 references and is shared by every feature, so it is retired last, after the features are. +Moving the WebSocket to v2 is its own project — v2 sends different event shapes; never fold it into a feature PR. + +## Phase 4 — implement + +```dart +import '../../open_api/models.dart' as api; // prefix while both shapes exist + +Future> getDevices() async { + final result = await _api.listDevices(); // Future> + return result.map(_toListDevicesResponse); // transforms Success, passes Failure through untouched +} +``` + +`Result.map` is the whole pattern: the error side needs no code, because `ApiErrorInterceptor` already shaped it. +Reach for `fold` only when a method genuinely has to inspect the failure. `Result.success(value)` and +`Result.failure(error, [stackTrace])` exist as public factories for the cases that build a `Result` directly — +`Success` and `Failure` have private constructors. + +`Result.fold` is `({required R Function(T) onSuccess, required R Function(Object, StackTrace?) onFailure})`; +`getOrThrow`, `getOrElse`, `map` and `flatMap` also exist (`stream_core`, `lib/src/utils/result.dart`). + +**Don't unwrap inside the SDK.** `getOrThrow()` on a migrated path re-throws the `StreamException`, and +`Failure.error` is a plain `Object` — in practice the raw `DioException`, because `StreamChatNetworkError` +conversion lives in `StreamHttpClient._parseError`, which only its own `get`/`post`/`delete` wrappers call. +`DefaultApi` goes straight to `_dio.fetch` and bypasses it. Hand the `Result` to the caller instead; `getOrThrow()` +is a tool for *consumers* migrating incrementally, not for us. + +Two data-shape traps while mapping: + +- **`custom` vs `extraData`** (channel / message / user features). The wire puts extra fields in `custom`; + hand-written models flatten them into `extraData`. Write that promotion explicitly, including which keys are + excluded. +- **`DateTime` on anything that also arrives over the WebSocket.** Generated models decode through + `StreamDateTimeConverter` (epoch nanoseconds *or* RFC3339); hand-written models use `DateTime.parse`. A model fed + by both REST v2 and WS events must tolerate both. + +Where a generated type shadows one of ours the prefix is temporary: if phase 2 chose the generated type, delete +ours in the same PR. Current overlaps with types exported from `lib/stream_chat.dart` include `Action`, +`Attachment`, `ChannelMute`, `ChatPreferences`, `Command`, `Reaction`, `Role`, `ThreadParticipant`, `User`, +`UserGroup`, `UserGroupMember`, plus same-name response DTOs (`ListDevicesResponse`, +`UpsertPushPreferencesResponse`) and `PushPreferenceInput`. Regenerate rather than trusting that list — it prints +file names, so `channel_mute` means the generated `ChannelMute` shadows ours: + +```bash +comm -12 \ + <(ls packages/stream_chat/lib/open_api/model/ | grep -v '\.\(g\|freezed\)\.dart$' | sed 's/\.dart$//' | sort) \ + <(grep -oE "^export 'src/core/(models|api)/[a-z_]+\.dart';" packages/stream_chat/lib/stream_chat.dart \ + | sed "s|.*/\([a-z_]*\)\.dart';|\1|" | sort) +``` + +## Phase 5 — rewrite the tests + +Budget for this: on a typical feature it is most of the diff, and none of it is mechanical. + +- `test/src/core/api/_api_test.dart` asserts on `client.post('/devices', data: …)` against a + `MockHttpClient`. Routing through `DefaultApi` moves the mock seam to `Dio`/`DefaultApi`; the old assertions + cannot survive. +- `test/src/client/client_test.dart` builds fixtures in the `late`-mutable style the hand-written DTOs allow + (`ListDevicesResponse()..devices = …`). Generated freezed classes have final fields and required named + arguments, so any fixture switching to a generated type must be rewritten. +- `test/src/core/api/responses_test.dart` round-trips the DTO from JSON — keep it passing while the DTO exists, + delete it with the DTO. + +## Phase 6 — verify and land + +`melos run analyze`, `melos run test:dart`, plus `stream_chat_persistence`'s tests if the feature's responses feed +persistence. + +**`melos run analyze` does not cover the generated client's own output.** `analysis_options.yaml` excludes +`**/*.g.dart` and `**/*.freezed.dart` repo-wide, so the retrofit `default_api.g.dart` and ~490 generated +`.freezed.dart` files are never analyzed. Exercising the code in a test is what actually compiles it. + +The PR body carries the group's scope, the phase 2 decisions with their reasons, and any endpoint left +hand-written and why. Then close the loop in the plan: tick the definition-of-done boxes in the group's file and +its status box in `openapi-migration/README.md`, so the next person sees where the migration actually stands. + +Landing a break means four artifacts in the same PR: the `refactor(scope)!:` title, the `🛑️ Breaking` CHANGELOG +entry, the `migrations/v11-migration.md` Symbol Map row plus feature section (template lives at the bottom of that +guide), and the reason in the PR body. A break with no guide entry is unfinished — the guide is what consumers +actually upgrade against, and it cannot be reconstructed later. + +## Layout reference + +``` +packages/stream_chat/lib/open_api/ +├── api.dart # barrel +├── models.dart # barrel (also re-exports StreamApiError, StreamDateTimeConverter, WsEvent) +├── api/default_api.dart # ONE retrofit interface — every operation lives here +└── model/ # 493 models +``` + +Don't reach for the generator to get a type — that tree holds every model and operation the spec defines. The repo +lints `prefer_relative_imports`, which is what makes the generator's `import '../models.dart'` style compliant. diff --git a/.github/workflows/pana.yml b/.github/workflows/pana.yml index 5b614782f3..1d5c5eb1fe 100644 --- a/.github/workflows/pana.yml +++ b/.github/workflows/pana.yml @@ -50,7 +50,16 @@ jobs: working_directory: packages/stream_chat_flutter_core min_score: 100 + # Disabled while `stream_core` is a git dependency. pana resolves each package + # standalone, without the dependency_overrides melos generates, so any package + # pulling both `stream_chat` (git stream_core) and `stream_core_flutter` + # (hosted stream_core) fails version solving before pana can score it. The + # other packages still run — `stream_chat` alone resolves fine. + # + # Re-enable both jobs once stream_core is published; see + # openapi-migration/01-foundation.md. stream_chat_flutter: + if: false runs-on: ubuntu-latest steps: - name: 📚 Git Checkout @@ -61,7 +70,16 @@ jobs: working_directory: packages/stream_chat_flutter min_score: 100 + # Disabled while `stream_core` is a git dependency. pana resolves each package + # standalone, without the dependency_overrides melos generates, so any package + # pulling both `stream_chat` (git stream_core) and `stream_core_flutter` + # (hosted stream_core) fails version solving before pana can score it. The + # other packages still run — `stream_chat` alone resolves fine. + # + # Re-enable both jobs once stream_core is published; see + # openapi-migration/01-foundation.md. stream_chat_localizations: + if: false runs-on: ubuntu-latest steps: - name: 📚 Git Checkout diff --git a/docs/docs_screenshots/pubspec.yaml b/docs/docs_screenshots/pubspec.yaml index 1766a3b40b..7b81fafdf8 100644 --- a/docs/docs_screenshots/pubspec.yaml +++ b/docs/docs_screenshots/pubspec.yaml @@ -39,3 +39,12 @@ dev_dependencies: flutter: uses-material-design: true + +# `stream_core_flutter` depends on a published `stream_core`, which clashes with +# the git pin in `stream_chat`. Override it here until `stream_core` is released. +dependency_overrides: + stream_core: + git: + url: https://github.com/GetStream/stream-core-flutter.git + ref: 505432f213af8911d54ab3c855d6ad6fbe492fc9 + path: packages/stream_core diff --git a/melos.yaml b/melos.yaml index 4172629cd9..c94ed81982 100644 --- a/melos.yaml +++ b/melos.yaml @@ -73,7 +73,7 @@ command: intl: ^0.20.2 jiffy: ^6.4.5 jose: ^0.3.5+1 - json_annotation: ^4.11.0 + json_annotation: ^4.12.0 just_audio: ^0.10.5 latlong2: ^0.9.1 logging: ^1.3.0 @@ -93,6 +93,7 @@ command: rate_limiter: ^1.1.0 record: ^6.2.0 responsive_builder: ^0.7.0 + retrofit: ^4.9.2 rxdart: ^0.28.0 share_plus: ">=12.0.2 <14.0.0" shimmer: ^3.0.0 @@ -104,6 +105,11 @@ command: stream_chat_persistence: ^10.3.0 streaming_shared_preferences: ^2.0.0 svg_icon_widget: ^0.0.1 + stream_core: + git: + url: https://github.com/GetStream/stream-core-flutter.git + ref: 505432f213af8911d54ab3c855d6ad6fbe492fc9 + path: packages/stream_core stream_core_flutter: git: url: https://github.com/GetStream/stream-core-flutter.git @@ -134,6 +140,7 @@ command: path: ^1.9.1 path_provider_platform_interface: ^2.1.2 plugin_platform_interface: ^2.1.8 + retrofit_generator: ^10.2.6 test: ^1.31.1 theme_extensions_builder: ^7.3.0 url_launcher_platform_interface: ^2.3.2 @@ -192,6 +199,10 @@ scripts: run: melos exec -c 1 --depends-on="build_runner" --flutter -- "flutter pub run build_runner build --delete-conflicting-outputs" description: Build all generated files for Flutter packages in this project. + gen:openapi: + run: $MELOS_ROOT_PATH/scripts/generate.sh + description: Generate the Chat Dart client from the Chat OpenAPI spec. + version:update: run: dart tools/generate_version.dart description: Updates the version.dart file in stream_chat package based on pubspec.yaml version. diff --git a/migrations/v11-migration.md b/migrations/v11-migration.md new file mode 100644 index 0000000000..9fc606b020 --- /dev/null +++ b/migrations/v11-migration.md @@ -0,0 +1,230 @@ +# Stream Chat Flutter SDK v11.0.0 Migration Guide + +This guide covers the breaking changes in **Stream Chat Flutter SDK v11.0.0**, where the low-level client moves +onto Stream's OpenAPI-generated API client. + +> **Status: in progress.** The version number is provisional until release. This guide is written *as the +> migration happens* — every PR that lands a breaking change appends its entry here, so the guide is complete on +> release day rather than reconstructed from a changelog afterwards. If you are landing such a PR, see +> [Contributing to this guide](#contributing-to-this-guide). + +--- + +## Table of Contents + +- [Who Should Read This](#who-should-read-this) +- [What Changed and Why](#what-changed-and-why) +- [Quick Reference](#quick-reference) +- [Symbol Map](#symbol-map) +- [Error Handling](#error-handling) + - [The error type changed too](#the-error-type-changed-too) +- [Feature Areas](#feature-areas) +- [Migration Checklist](#migration-checklist) +- [For AI Agents](#for-ai-agents) +- [Contributing to this guide](#contributing-to-this-guide) + +--- + +## Who Should Read This + +| Upgrading From | Sections to Review | +| --- | --- | +| v10.x, using `StreamChatClient` / `Channel` directly | All of it — the API-facing types are what changed | +| v10.x, UI widgets only (`stream_chat_flutter`) | [Error Handling](#error-handling) and any [Feature Area](#feature-areas) whose models you read from `Message`, `Channel`, or `User` | +| v10.x, with a custom `AttachmentFileUploader` | [Feature Areas](#feature-areas) → File Upload | +| A v11 beta | [Symbol Map](#symbol-map) only — entries are additive across betas | + +--- + +## What Changed and Why + +The `stream_chat` package now talks to Stream's API through a client generated from the same OpenAPI spec that +backs our other SDKs, instead of a hand-written HTTP layer. For you this means: + +- **Consistent shapes across Stream products.** A response type in Flutter now matches its counterpart in our + other SDKs, because both come from one spec. +- **New API surface arrives faster.** Endpoints and fields land by regenerating, not by hand-writing a DTO. +- **Some types were replaced rather than kept.** Where a hand-written type existed only to mirror the wire, the + generated type takes over. Where our type was the better public API, we kept ours — so this is not a blanket + rename. + +Types under `package:stream_chat/open_api/...` are generated. Treat them as data holders: they are regenerated +from the spec, so don't subclass them or depend on their private constructors. + +--- + +## Quick Reference + +| Feature Area | Key Changes | +| --- | --- | +| [**Error Handling**](#error-handling) | API calls return `Result` instead of throwing; failures carry `stream_core`'s sealed `StreamException` family instead of `StreamChatNetworkError`; `ChatErrorCode` → `StreamErrorCode` | +| _(filled in per feature as PRs land)_ | | + +--- + +## Symbol Map + +The mechanical part of the upgrade: every renamed, removed, or retyped public symbol. Each row is a +search-and-replace you can apply directly. `Kind` is one of `renamed`, `removed`, `retyped`, `moved`. + +| Old symbol | New symbol | Kind | Notes | +| --- | --- | --- | --- | +| `StreamChatNetworkError` | `StreamApiException` (`stream_core`) | `retyped` | Thrown-then-caught becomes `Failure.error`; a sealed family, so `switch` is exhaustive | +| `StreamChatNetworkError.code` / `.message` / `.statusCode` | `StreamApiException.code` / `.message` / `.statusCode` | `moved` | `code` is now a `StreamErrorCode` | +| `StreamChatNetworkError.isRequestCancelledError` | `StreamNetworkException.isCancelled` | `moved` | | +| `ChatErrorCode` | `StreamErrorCode` (`stream_core`) | `removed` | Extension type over `int` with named constants | +| _(more added per feature as PRs land)_ | | | | + +--- + +## Error Handling + +**This is the one change that touches every call site.** API methods no longer throw on failure — they return a +`Result`, matching the `stream_feeds` SDK. + +**Before:** +```dart +try { + final response = await client.getDevices(); + print(response.devices); +} on StreamChatNetworkError catch (error) { + print(error.message); +} +``` + +**After:** +```dart +final result = await client.getDevices(); + +result.fold( + onSuccess: (response) => print(response.devices), + onFailure: (error, stackTrace) => print(error), +); +``` + +`Result` is a sealed type with `Success` and `Failure`, exported from `package:stream_chat/stream_chat.dart`. +Besides `fold` it offers `getOrThrow()`, `getOrNull()`, `getOrElse(...)`, `exceptionOrNull()`, `map(...)` and +`flatMap(...)`. + +If you want the old behaviour at a call site while you migrate incrementally, `getOrThrow()` rethrows the +underlying error: + +```dart +final response = (await client.getDevices()).getOrThrow(); +``` + +### The error type changed too + +`Failure.error` is statically typed `Object`, and at runtime it is always a `StreamException` from `stream_core` — +**not** a `StreamChatNetworkError`. Chat now uses the same error types as our other SDKs: + +| Type | When | Carries | +| --- | --- | --- | +| `StreamApiException` | the API answered with an error | `statusCode`, `code`, `moreInfo`, `unrecoverable`, `retryAfter`, `apiError` | +| `StreamNetworkException` | transport failed | `isCancelled`, `isTimeout`, `closeCode` | +| `StreamAuthenticationException` | the token was refused | — | +| `StreamClientException` | an SDK bug, or a response body that would not decode | the original error as `cause` | + +```dart +result.fold( + onSuccess: (response) => print(response.devices), + onFailure: (error, stackTrace) => switch (error) { + StreamApiException(:final code, :final message, :final statusCode) => + print('$code: $message ($statusCode)'), + StreamNetworkException(isCancelled: true) => null, // user cancelled + final StreamException e => print(e.message), + _ => print('unexpected: $error'), + }, +); +``` + +It is a sealed family, so a `switch` over it is exhaustive. Everything you read off `StreamChatNetworkError` has a +counterpart: `code` is now a `StreamErrorCode` (an extension type over `int`, with named constants like +`rateLimited` and `inputError`), `statusCode` and `message` are unchanged in spirit, and +`isRequestCancelledError` becomes `StreamNetworkException.isCancelled`. + +`StreamApiException` exposes `isTokenExpired`, `isTokenNotYetValid`, `isTokenSignatureInvalid`, +`isApiKeyInvalid` and `isRateLimited` directly, so the common checks need no code of your own. + +`ChatErrorCode` is removed — use `StreamErrorCode`. + +`Result` and the `StreamException` family are exported from `package:stream_chat/stream_chat.dart`. + +--- + +## Feature Areas + +_Each migrated feature gets a section here. Sections are added by the PR that migrates the feature, using the +template in [Contributing to this guide](#contributing-to-this-guide)._ + +--- + +## Migration Checklist + +Work top to bottom; each item is independently verifiable. + +- [ ] Update `stream_chat` (and any of `stream_chat_flutter`, `stream_chat_flutter_core`, + `stream_chat_persistence`, `stream_chat_localizations` you depend on) to `^11.0.0` +- [ ] Wrap or fold every API call that previously used `try`/`catch` — see [Error Handling](#error-handling) +- [ ] Replace `on StreamChatNetworkError catch` with a `switch` over the sealed `StreamException` family — see + [The error type changed too](#the-error-type-changed-too) +- [ ] Replace `ChatErrorCode` comparisons with `StreamErrorCode` constants +- [ ] Apply every row of the [Symbol Map](#symbol-map) +- [ ] Re-check custom data access: fields that used to arrive in `extraData` may now be typed properties +- [ ] If you implement `AttachmentFileUploader`, review its section under [Feature Areas](#feature-areas) +- [ ] If you persist models yourself, re-check nullability — generated types are nullable wherever the API allows it +- [ ] Run `dart analyze` and your test suite; the analyzer finds most of the mechanical work for you + +--- + +## For AI Agents + +If you are an agent performing this upgrade in a consumer codebase, work in this order: + +1. **Bump the dependency** and run `dart pub get`, then `dart analyze`. The error list is your work queue — do not + try to find call sites by reading code first. +2. **Apply the [Symbol Map](#symbol-map) top to bottom.** Every row is a whole-symbol rename; prefer an + identifier-aware rewrite over plain text replacement so you don't hit substrings or comments. +3. **Fix error handling per call site**, not globally. `getOrThrow()` preserves existing behaviour and is the + correct minimal change when the caller already has a `try`/`catch`; use `fold` when the caller should handle + both branches. Never swallow a `Failure` by defaulting to `null`. +4. **Re-run `dart analyze` after each group** and stop when it is clean. Then run the consumer's tests — type + changes that compile can still change runtime behaviour, especially around nullability. +5. **Do not edit anything under `package:stream_chat/open_api/`.** It is generated and regenerated from the spec. +6. **Report what you could not resolve** rather than guessing: a removed symbol with no replacement in the Symbol + Map means the capability moved or was dropped, and that needs a human decision. + +--- + +## Contributing to this guide + +If your PR lands a breaking change, add to this guide **in the same PR**. Three edits, in this order: + +1. A row per changed symbol in the [Symbol Map](#symbol-map). +2. A row in [Quick Reference](#quick-reference) if the feature area is not listed yet. +3. A section under [Feature Areas](#feature-areas) using this template: + +```markdown +### + +#### Key Changes: + +- + +#### Migration Steps: + +**Before:** +```dart +// v10 call site +``` + +**After:** +```dart +// v11 call site +``` + +> **Why:** +``` + +Keep the `Why` line. It is what tells a reader whether the change is worth arguing with, and it is the same +justification the PR needed in order to break API at all. diff --git a/openapi-migration/01-foundation.md b/openapi-migration/01-foundation.md new file mode 100644 index 0000000000..c3dab42fd2 --- /dev/null +++ b/openapi-migration/01-foundation.md @@ -0,0 +1,104 @@ +# 01 — Foundation + +**Goal:** land everything that every feature group depends on, so no group has to invent it. Nothing user-visible +migrates in this phase. + +Feature groups can run in parallel once this is done. Until it is, they will each reinvent the same four things +differently. + +## Scope + +### 1. The `Result` surface + +Public API methods return `Future>` instead of throwing, matching `stream_feeds`. + +- Re-export from `lib/stream_chat.dart` with a `show` allowlist: + `show Result, Success, Failure, StreamException, StreamApiException, StreamNetworkException, + StreamAuthenticationException, StreamClientException, StreamApiError, StreamErrorCode`. +- **Not** a wholesale `export 'package:stream_core/stream_core.dart';` — core re-exports all of dio plus its own + `AttachmentFile`, which collides by name with the `AttachmentFile` our barrel already exports. + +### 2. Errors come from `stream_core` + +`stream_core`'s error layer is a sealed `StreamException` family, so `Failure.error` is always one of four things +and never a transport type: + +```text +StreamApiException statusCode, code (StreamErrorCode), moreInfo, unrecoverable, retryAfter, apiError +StreamNetworkException isCancelled, isTimeout, closeCode +StreamAuthenticationException +StreamClientException our own bug, or a body that would not decode (original kept as `cause`) +``` + +Two pieces make that guarantee, and both are prerequisites rather than things this repo writes: + +- **`runApiSafely`** (core) is what the generated client's call adapter must use. It maps a `DioException` through + `toStreamException()`, keeps a `StreamException` as raised, and wraps everything else — including the `TypeError` + from an undecodable response body — in a `StreamClientException`. The older `runSafely` did none of this. +- **`ApiErrorInterceptor`** on the Dio behind `DefaultApi`, as before. + +There is no error-translation layer. Do not map to `StreamChatNetworkError` — that is the hand-written layer this +migration exists to delete. + +**`ChatErrorCode` is superseded.** Core ships `StreamErrorCode`, an `extension type const StreamErrorCode(int) +implements int` with named constants. Drop our 25-entry enum rather than re-expressing it; check `StreamErrorCode` +before adding a constant anywhere. + +Core carried `isRetriable` and a `RetryPolicy` at one point and no longer does, so retry classification stays +ours for now. Check `stream_core` before writing one — this is the kind of thing that lands there. + +This resolves what was previously an open question here (`StreamDioException` versus `HttpClientException`): both +are gone. `client_exception.dart` was deleted in core's error-layer rework, and the answer is the sealed +`StreamException` — flat, dio-free, and the direct analogue of iOS's `ClientError` and Android's +`Error.NetworkError`. + +**Sequencing.** The error layer lives on core's `feat/error-layer` branch and is not on `main` yet, so our pinned +ref (`f83b5d4`) does not have it. Order: core's branch merges → core releases → we move the pin (and the pin +collapses to a hosted constraint) → the generator's `client.tpl` switches `runSafely` → `runApiSafely` → we +regenerate. Until the template changes, a regenerated client still hands back raw `DioException`s. + +### 3. Where `DefaultApi` is constructed + +`DefaultApi(Dio)` needs a Dio. `StreamHttpClient.httpClient` is `@visibleForTesting` and `StreamHttpClient` is +publicly exported, so `DefaultApi(client.httpClient)` fails `melos run analyze` with +`invalid_use_of_visible_for_testing_member`. Pick one and apply it everywhere: + +- an `@internal` accessor on `StreamHttpClient`, or +- build `DefaultApi` once in `StreamChatApi` and inject it into each `*_api.dart`. + +### 4. Freeze the `User` shape decision + +`User` and `OwnUser` are embedded in nearly every response in the SDK, so the keep-vs-adopt decision cannot wait +for group 09 — a poll vote, a channel member and a message all carry a user. Decide it here, write it down, and +let group 09 merely execute it. + +The same applies, in a smaller way, to the channel shape embedded in threads (group 07) versus the channels group +(group 11). + +## Decisions to make + +- Which of the four items above are one PR and which are separate. The `Result` surface is mechanical but touches + every public signature; the interceptor and `DefaultApi` wiring are small and internal. +- Whether `StreamChatNetworkError` is deprecated or deleted in v11. It must survive the transition because every + unmigrated endpoint still throws it, but it becomes dead code once the last group lands. + +## Risks + +- The `Result` surface is the single largest breaking change in v11 and cannot be done per-feature without leaving + the public API in two styles at once. Sequence it deliberately. +- `stream_chat` cannot be published while `stream_core` is a git dependency, and the generated client needs + `StreamDateTimeConverter`, which is not in the last published `stream_core`. **A `stream_core` release is a + prerequisite for shipping any of this** — see the `openapi-codegen` skill. + +## Definition of done + +- [ ] Re-enable the `stream_chat_flutter` and `stream_chat_localizations` jobs in `.github/workflows/pana.yml`, + disabled because pana resolves each package standalone and cannot solve git-vs-hosted `stream_core`. +- [ ] `Result` and the core error types are exported from `lib/stream_chat.dart` via a `show` allowlist. +- [ ] `ApiErrorInterceptor` is installed on the Dio backing `DefaultApi`, and the call adapter uses + `runApiSafely`; a test asserts a failed call yields a `Failure` carrying a `StreamApiException` with a + parsed `.apiError`, and a malformed body yields a `StreamClientException`. +- [ ] `DefaultApi` construction is settled in one place, with no `invalid_use_of_visible_for_testing_member`. +- [ ] The `User` / `OwnUser` decision is written into `09-users.md`. +- [ ] `migrations/v11-migration.md` Error Handling section matches what actually shipped. +- [ ] `melos run analyze` clean, `melos run test:dart` green. diff --git a/openapi-migration/02-devices-and-push-preferences.md b/openapi-migration/02-devices-and-push-preferences.md new file mode 100644 index 0000000000..19533827ef --- /dev/null +++ b/openapi-migration/02-devices-and-push-preferences.md @@ -0,0 +1,48 @@ +# 02 — Devices & Push Preferences + +**Goal:** Prove the whole pattern end to end on the smallest real surface: four methods, no persistence, no channel scope. + +**Size:** 4 hand-written method(s) across 1 file(s) → 4 generated operation(s). + +> Tables are generated by `openapi-migration/tool/generate_plan.py`. Edit the prose, not the tables. + +## Scope + +### Hand-written today + +| File | Method | Returns | +| --- | --- | --- | +| `device_api.dart` | `addDevice` | `EmptyResponse` | +| `device_api.dart` | `getDevices` | `ListDevicesResponse` | +| `device_api.dart` | `removeDevice` | `EmptyResponse` | +| `device_api.dart` | `setPushPreferences` | `UpsertPushPreferencesResponse` | + +### Generated operations that cover it + +| Verb | Path | Operation | Response | +| --- | --- | --- | --- | +| `POST` | `/api/v2/devices` | `createDevice` | `DurationResponse` | +| `DELETE` | `/api/v2/devices` | `deleteDevice` | `DurationResponse` | +| `GET` | `/api/v2/devices` | `listDevices` | `ListDevicesResponse` | +| `POST` | `/api/v2/push_preferences` | `updatePushNotificationPreferences` | `UpsertPushPreferencesResponse` | + +## Decisions to make + +- `PushProvider` (our public enum) against the generated per-operation extension type — write the adapter here, it sets the precedent for every enum that follows. +- `setPushPreferences` reads its response into client state and emits `EventType.pushPreferenceUpdated`; decide whether that stays in the api layer or moves up. + +## Risks + +- Generated `DeviceResponse` has 9 fields against our `Device`'s 2 — drop or widen, and record which. + +## Definition of done + +- [ ] Every method above either routes through `DefaultApi` or is listed here as deliberately left + hand-written, with the reason. +- [ ] Public methods return `Future>`; no `getOrThrow()` inside the SDK. +- [ ] Hand-written request/response DTOs for this group are deleted, or their retention is justified. +- [ ] `melos run analyze` clean, `melos run test:dart` green, persistence tests green if this group + persists anything. +- [ ] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. +- [ ] CHANGELOG entry under `🛑️ Breaking` for each break; PR title `refactor(llc)!:`. +- [ ] Decisions recorded in this file, and the status box ticked in `README.md`. diff --git a/openapi-migration/03-user-groups.md b/openapi-migration/03-user-groups.md new file mode 100644 index 0000000000..f494f22f80 --- /dev/null +++ b/openapi-migration/03-user-groups.md @@ -0,0 +1,55 @@ +# 03 — User Groups + +**Goal:** A clean 1:1 group — eight methods against eight generated operations, no client state, no persistence. + +**Size:** 8 hand-written method(s) across 1 file(s) → 8 generated operation(s). + +> Tables are generated by `openapi-migration/tool/generate_plan.py`. Edit the prose, not the tables. + +## Scope + +### Hand-written today + +| File | Method | Returns | +| --- | --- | --- | +| `user_groups_api.dart` | `listUserGroups` | `ListUserGroupsResponse` | +| `user_groups_api.dart` | `searchUserGroups` | `SearchUserGroupsResponse` | +| `user_groups_api.dart` | `getUserGroup` | `GetUserGroupResponse` | +| `user_groups_api.dart` | `createUserGroup` | `CreateUserGroupResponse` | +| `user_groups_api.dart` | `updateUserGroup` | `UpdateUserGroupResponse` | +| `user_groups_api.dart` | `deleteUserGroup` | `EmptyResponse` | +| `user_groups_api.dart` | `addUserGroupMembers` | `AddUserGroupMembersResponse` | +| `user_groups_api.dart` | `removeUserGroupMembers` | `RemoveUserGroupMembersResponse` | + +### Generated operations that cover it + +| Verb | Path | Operation | Response | +| --- | --- | --- | --- | +| `POST` | `/api/v2/usergroups/{id}/members` | `addUserGroupMembers` | `AddUserGroupMembersResponse` | +| `POST` | `/api/v2/usergroups` | `createUserGroup` | `CreateUserGroupResponse` | +| `DELETE` | `/api/v2/usergroups/{id}` | `deleteUserGroup` | `DurationResponse` | +| `GET` | `/api/v2/usergroups/{id}` | `getUserGroup` | `GetUserGroupResponse` | +| `GET` | `/api/v2/usergroups` | `listUserGroups` | `ListUserGroupsResponse` | +| `POST` | `/api/v2/usergroups/{id}/members/delete` | `removeUserGroupMembers` | `RemoveUserGroupMembersResponse` | +| `GET` | `/api/v2/usergroups/search` | `searchUserGroups` | `SearchUserGroupsResponse` | +| `PUT` | `/api/v2/usergroups/{id}` | `updateUserGroup` | `UpdateUserGroupResponse` | + +## Decisions to make + +- Several generated responses (`AddUserGroupMembersResponse`, `CreateUserGroupResponse`, …) wrap the same `UserGroupResponse`; decide whether our public API keeps distinct types or collapses them. + +## Risks + +- `UserGroup` and `UserGroupMember` collide by name with generated types — the export decision lands here first. + +## Definition of done + +- [ ] Every method above either routes through `DefaultApi` or is listed here as deliberately left + hand-written, with the reason. +- [ ] Public methods return `Future>`; no `getOrThrow()` inside the SDK. +- [ ] Hand-written request/response DTOs for this group are deleted, or their retention is justified. +- [ ] `melos run analyze` clean, `melos run test:dart` green, persistence tests green if this group + persists anything. +- [ ] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. +- [ ] CHANGELOG entry under `🛑️ Breaking` for each break; PR title `refactor(llc)!:`. +- [ ] Decisions recorded in this file, and the status box ticked in `README.md`. diff --git a/openapi-migration/04-roles-guest-and-app.md b/openapi-migration/04-roles-guest-and-app.md new file mode 100644 index 0000000000..2f9caa2861 --- /dev/null +++ b/openapi-migration/04-roles-guest-and-app.md @@ -0,0 +1,48 @@ +# 04 — Roles, Guest & App Settings + +**Goal:** Sweep up the singletons — one-method families that share no state and can land in one PR. + +**Size:** 4 hand-written method(s) across 3 file(s) → 5 generated operation(s). + +> Tables are generated by `openapi-migration/tool/generate_plan.py`. Edit the prose, not the tables. + +## Scope + +### Hand-written today + +| File | Method | Returns | +| --- | --- | --- | +| `roles_api.dart` | `searchRoles` | `SearchRolesResponse` | +| `guest_api.dart` | `getGuestUser` | `ConnectGuestUserResponse` | +| `general_api.dart` | `enrichUrl` | `OGAttachmentResponse` | +| `general_api.dart` | `getAppSettings` | `GetAppSettingsResponse` | + +### Generated operations that cover it + +| Verb | Path | Operation | Response | +| --- | --- | --- | --- | +| `POST` | `/api/v2/guest` | `createGuest` | `CreateGuestResponse` | +| `GET` | `/api/v2/app` | `getApp` | `GetApplicationResponse` | +| `GET` | `/api/v2/og` | `getOG` | `GetOGResponse` | +| `GET` | `/api/v2/longpoll` | `longPoll` | `void` | +| `GET` | `/api/v2/roles/search` | `searchRoles` | `SearchRolesResponse` | + +## Decisions to make + +- `AppSettings` is public and hand-shaped; the generated `AppResponseFields` is the wire shape. Keep ours unless the generated one is genuinely better. + +## Risks + +- `general_api.dart` is split across four groups — only `enrichUrl` and `getAppSettings` belong here. `sync` and `queryMembers` go to group 11, `searchMessages` to group 10. Do not migrate the file as a unit. + +## Definition of done + +- [ ] Every method above either routes through `DefaultApi` or is listed here as deliberately left + hand-written, with the reason. +- [ ] Public methods return `Future>`; no `getOrThrow()` inside the SDK. +- [ ] Hand-written request/response DTOs for this group are deleted, or their retention is justified. +- [ ] `melos run analyze` clean, `melos run test:dart` green, persistence tests green if this group + persists anything. +- [ ] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. +- [ ] CHANGELOG entry under `🛑️ Breaking` for each break; PR title `refactor(llc)!:`. +- [ ] Decisions recorded in this file, and the status box ticked in `README.md`. diff --git a/openapi-migration/05-polls.md b/openapi-migration/05-polls.md new file mode 100644 index 0000000000..790100b299 --- /dev/null +++ b/openapi-migration/05-polls.md @@ -0,0 +1,68 @@ +# 05 — Polls + +**Goal:** First group with real domain models and persistence behind it. + +**Size:** 13 hand-written method(s) across 1 file(s) → 13 generated operation(s). + +> Tables are generated by `openapi-migration/tool/generate_plan.py`. Edit the prose, not the tables. + +## Scope + +### Hand-written today + +| File | Method | Returns | +| --- | --- | --- | +| `polls_api.dart` | `createPoll` | `CreatePollResponse` | +| `polls_api.dart` | `getPoll` | `GetPollResponse` | +| `polls_api.dart` | `updatePoll` | `UpdatePollResponse` | +| `polls_api.dart` | `partialUpdatePoll` | `UpdatePollResponse` | +| `polls_api.dart` | `deletePoll` | `EmptyResponse` | +| `polls_api.dart` | `createPollOption` | `CreatePollOptionResponse` | +| `polls_api.dart` | `getPollOption` | `GetPollOptionResponse` | +| `polls_api.dart` | `updatePollOption` | `UpdatePollOptionResponse` | +| `polls_api.dart` | `deletePollOption` | `EmptyResponse` | +| `polls_api.dart` | `castPollVote` | `CastPollVoteResponse` | +| `polls_api.dart` | `removePollVote` | `RemovePollVoteResponse` | +| `polls_api.dart` | `queryPolls` | `QueryPollsResponse` | +| `polls_api.dart` | `queryPollVotes` | `QueryPollVotesResponse` | + +### Generated operations that cover it + +| Verb | Path | Operation | Response | +| --- | --- | --- | --- | +| `POST` | `/api/v2/chat/messages/{message_id}/polls/{poll_id}/vote` | `castPollVote` | `PollVoteResponse` | +| `POST` | `/api/v2/polls` | `createPoll` | `PollResponse` | +| `POST` | `/api/v2/polls/{poll_id}/options` | `createPollOption` | `PollOptionResponse` | +| `DELETE` | `/api/v2/polls/{poll_id}` | `deletePoll` | `DurationResponse` | +| `DELETE` | `/api/v2/polls/{poll_id}/options/{option_id}` | `deletePollOption` | `DurationResponse` | +| `DELETE` | `/api/v2/chat/messages/{message_id}/polls/{poll_id}/vote/{vote_id}` | `deletePollVote` | `PollVoteResponse` | +| `GET` | `/api/v2/polls/{poll_id}` | `getPoll` | `PollResponse` | +| `GET` | `/api/v2/polls/{poll_id}/options/{option_id}` | `getPollOption` | `PollOptionResponse` | +| `POST` | `/api/v2/polls/{poll_id}/votes` | `queryPollVotes` | `PollVotesResponse` | +| `POST` | `/api/v2/polls/query` | `queryPolls` | `QueryPollsResponse` | +| `PUT` | `/api/v2/polls` | `updatePoll` | `PollResponse` | +| `PUT` | `/api/v2/polls/{poll_id}/options` | `updatePollOption` | `PollOptionResponse` | +| `PATCH` | `/api/v2/polls/{poll_id}` | `updatePollPartial` | `PollResponse` | + +## Decisions to make + +- `Poll`, `PollOption` and `PollVote` are public and persisted; adopting generated shapes means touching `stream_chat_persistence` in the same PR. +- `VotingVisibility` is ours; the generated equivalent is an inline per-operation enum. + +## Risks + +- Vote operations live under `/chat/messages/{message_id}/polls/...`, not `/polls` — easy to miss when grepping by path. +- Poll updates also arrive over the WebSocket, so `DateTime` and `custom` handling must tolerate both encodings. +- Touching a file under `lib/src/entity/` trips `check_db_entities`, which demands a `schemaVersion` bump for any change there — including an import-only one. Do not bump it for a no-op; the guard is coarse, the schema is what matters. + +## Definition of done + +- [ ] Every method above either routes through `DefaultApi` or is listed here as deliberately left + hand-written, with the reason. +- [ ] Public methods return `Future>`; no `getOrThrow()` inside the SDK. +- [ ] Hand-written request/response DTOs for this group are deleted, or their retention is justified. +- [ ] `melos run analyze` clean, `melos run test:dart` green, persistence tests green if this group + persists anything. +- [ ] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. +- [ ] CHANGELOG entry under `🛑️ Breaking` for each break; PR title `refactor(llc)!:`. +- [ ] Decisions recorded in this file, and the status box ticked in `README.md`. diff --git a/openapi-migration/06-reminders.md b/openapi-migration/06-reminders.md new file mode 100644 index 0000000000..2d7ce4ca7d --- /dev/null +++ b/openapi-migration/06-reminders.md @@ -0,0 +1,47 @@ +# 06 — Message Reminders + +**Goal:** Small and self-contained, and it exercises the `PATCH` shape our hand-written layer expresses differently. + +**Size:** 4 hand-written method(s) across 1 file(s) → 4 generated operation(s). + +> Tables are generated by `openapi-migration/tool/generate_plan.py`. Edit the prose, not the tables. + +## Scope + +### Hand-written today + +| File | Method | Returns | +| --- | --- | --- | +| `reminders_api.dart` | `queryReminders` | `QueryRemindersResponse` | +| `reminders_api.dart` | `createReminder` | `CreateReminderResponse` | +| `reminders_api.dart` | `updateReminder` | `UpdateReminderResponse` | +| `reminders_api.dart` | `deleteReminder` | `EmptyResponse` | + +### Generated operations that cover it + +| Verb | Path | Operation | Response | +| --- | --- | --- | --- | +| `POST` | `/api/v2/chat/messages/{message_id}/reminders` | `createReminder` | `ReminderResponseData` | +| `DELETE` | `/api/v2/chat/messages/{message_id}/reminders` | `deleteReminder` | `DeleteReminderResponse` | +| `POST` | `/api/v2/chat/reminders/query` | `queryReminders` | `QueryRemindersResponse` | +| `PATCH` | `/api/v2/chat/messages/{message_id}/reminders` | `updateReminder` | `UpdateReminderResponse` | + +## Decisions to make + +- `MessageReminder` is public and persisted; decide keep-vs-adopt with persistence in the same PR. + +## Risks + +- Reminder events also arrive over the WebSocket. + +## Definition of done + +- [ ] Every method above either routes through `DefaultApi` or is listed here as deliberately left + hand-written, with the reason. +- [ ] Public methods return `Future>`; no `getOrThrow()` inside the SDK. +- [ ] Hand-written request/response DTOs for this group are deleted, or their retention is justified. +- [ ] `melos run analyze` clean, `melos run test:dart` green, persistence tests green if this group + persists anything. +- [ ] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. +- [ ] CHANGELOG entry under `🛑️ Breaking` for each break; PR title `refactor(llc)!:`. +- [ ] Decisions recorded in this file, and the status box ticked in `README.md`. diff --git a/openapi-migration/07-threads-and-drafts.md b/openapi-migration/07-threads-and-drafts.md new file mode 100644 index 0000000000..0d2ccc934e --- /dev/null +++ b/openapi-migration/07-threads-and-drafts.md @@ -0,0 +1,54 @@ +# 07 — Threads & Drafts + +**Goal:** Two related families that share the `Draft` model and the list controllers above them. + +**Size:** 7 hand-written method(s) across 2 file(s) → 7 generated operation(s). + +> Tables are generated by `openapi-migration/tool/generate_plan.py`. Edit the prose, not the tables. + +## Scope + +### Hand-written today + +| File | Method | Returns | +| --- | --- | --- | +| `threads_api.dart` | `queryThreads` | `QueryThreadsResponse` | +| `threads_api.dart` | `getThread` | `GetThreadResponse` | +| `threads_api.dart` | `partialUpdateThread` | `UpdateThreadResponse` | +| `message_api.dart` | `createDraft` | `CreateDraftResponse` | +| `message_api.dart` | `deleteDraft` | `EmptyResponse` | +| `message_api.dart` | `getDraft` | `GetDraftResponse` | +| `message_api.dart` | `queryDrafts` | `QueryDraftsResponse` | + +### Generated operations that cover it + +| Verb | Path | Operation | Response | +| --- | --- | --- | --- | +| `POST` | `/api/v2/chat/channels/{type}/{id}/draft` | `createDraft` | `CreateDraftResponse` | +| `DELETE` | `/api/v2/chat/channels/{type}/{id}/draft` | `deleteDraft` | `DurationResponse` | +| `GET` | `/api/v2/chat/channels/{type}/{id}/draft` | `getDraft` | `GetDraftResponse` | +| `GET` | `/api/v2/chat/threads/{message_id}` | `getThread` | `GetThreadResponse` | +| `POST` | `/api/v2/chat/drafts/query` | `queryDrafts` | `QueryDraftsResponse` | +| `POST` | `/api/v2/chat/threads` | `queryThreads` | `QueryThreadsResponse` | +| `PATCH` | `/api/v2/chat/threads/{message_id}` | `updateThreadPartial` | `UpdateThreadPartialResponse` | + +## Decisions to make + +- The generated thread response embeds a full `ChannelResponse`. Decide whether the channel inside a thread adopts the generated shape now, or waits for the channels group — and write the answer down, because the two groups can otherwise disagree. + +## Risks + +- The four draft methods live in `message_api.dart`, not `threads_api.dart` — this group reaches into that file, and group 10 must leave those four alone. +- `Draft` and `DraftMessage` are public, persisted, and read by `StreamDraftListController` in `stream_chat_flutter_core`. + +## Definition of done + +- [ ] Every method above either routes through `DefaultApi` or is listed here as deliberately left + hand-written, with the reason. +- [ ] Public methods return `Future>`; no `getOrThrow()` inside the SDK. +- [ ] Hand-written request/response DTOs for this group are deleted, or their retention is justified. +- [ ] `melos run analyze` clean, `melos run test:dart` green, persistence tests green if this group + persists anything. +- [ ] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. +- [ ] CHANGELOG entry under `🛑️ Breaking` for each break; PR title `refactor(llc)!:`. +- [ ] Decisions recorded in this file, and the status box ticked in `README.md`. diff --git a/openapi-migration/08-moderation-and-blocklists.md b/openapi-migration/08-moderation-and-blocklists.md new file mode 100644 index 0000000000..1f5982d1f9 --- /dev/null +++ b/openapi-migration/08-moderation-and-blocklists.md @@ -0,0 +1,85 @@ +# 08 — Moderation & Blocklists + +**Goal:** The largest generated surface relative to ours — decide what stays unexposed. + +**Size:** 11 hand-written method(s) across 1 file(s) → 34 generated operation(s). + +> Tables are generated by `openapi-migration/tool/generate_plan.py`. Edit the prose, not the tables. + +## Scope + +### Hand-written today + +| File | Method | Returns | +| --- | --- | --- | +| `moderation_api.dart` | `muteUser` | `EmptyResponse` | +| `moderation_api.dart` | `unmuteUser` | `EmptyResponse` | +| `moderation_api.dart` | `muteChannel` | `EmptyResponse` | +| `moderation_api.dart` | `unmuteChannel` | `EmptyResponse` | +| `moderation_api.dart` | `flagMessage` | `EmptyResponse` | +| `moderation_api.dart` | `unflagMessage` | `EmptyResponse` | +| `moderation_api.dart` | `flagUser` | `EmptyResponse` | +| `moderation_api.dart` | `unflagUser` | `EmptyResponse` | +| `moderation_api.dart` | `banUser` | `EmptyResponse` | +| `moderation_api.dart` | `unbanUser` | `EmptyResponse` | +| `moderation_api.dart` | `queryBannedUsers` | `QueryBannedUsersResponse` | + +### Generated operations that cover it + +| Verb | Path | Operation | Response | +| --- | --- | --- | --- | +| `POST` | `/api/v2/moderation/appeal` | `appeal` | `AppealResponse` | +| `POST` | `/api/v2/moderation/ban` | `ban` | `ModerationBanResponse` | +| `POST` | `/api/v2/moderation/appeals/bulk_action` | `bulkActionAppeals` | `BulkActionAppealsResponse` | +| `POST` | `/api/v2/moderation/action_config/bulk_delete` | `bulkDeleteActionConfig` | `BulkDeleteActionConfigResponse` | +| `POST` | `/api/v2/moderation/action_config/bulk` | `bulkUpsertActionConfig` | `BulkUpsertActionConfigResponse` | +| `POST` | `/api/v2/blocklists` | `createBlockList` | `CreateBlockListResponse` | +| `POST` | `/api/v2/moderation/queues` | `createQueue` | `QueueResponse` | +| `DELETE` | `/api/v2/moderation/action_config/{id}` | `deleteActionConfig` | `DeleteActionConfigResponse` | +| `DELETE` | `/api/v2/blocklists/{name}` | `deleteBlockList` | `DurationResponse` | +| `DELETE` | `/api/v2/moderation/config/{key}` | `deleteConfig` | `DeleteModerationConfigResponse` | +| `POST` | `/api/v2/moderation/queues/{id}/delete` | `deleteQueue` | `QueueResponse` | +| `POST` | `/api/v2/moderation/flag` | `flag` | `FlagItemResponse` | +| `GET` | `/api/v2/moderation/action_config` | `getActionConfig` | `GetActionConfigResponse` | +| `GET` | `/api/v2/moderation/appeal/{id}` | `getAppeal` | `GetAppealResponse` | +| `GET` | `/api/v2/moderation/config/{key}` | `getConfig` | `GetConfigResponse` | +| `GET` | `/api/v2/moderation/queues/{id}` | `getQueue` | `QueueResponse` | +| `POST` | `/api/v2/blocklists/{id}/import` | `importBlockList` | `ImportBlockListResponse` | +| `GET` | `/api/v2/blocklists` | `listBlockLists` | `ListBlockListResponse` | +| `GET` | `/api/v2/moderation/queues` | `listQueues` | `ListQueuesResponse` | +| `POST` | `/api/v2/moderation/mute` | `mute` | `MuteResponse` | +| `POST` | `/api/v2/chat/moderation/mute/channel` | `muteChannel` | `MuteChannelResponse` | +| `POST` | `/api/v2/moderation/appeals` | `queryAppeals` | `QueryAppealsResponse` | +| `GET` | `/api/v2/chat/query_banned_users` | `queryBannedUsers` | `QueryBannedUsersResponse` | +| `GET` | `/api/v2/chat/query_future_channel_bans` | `queryFutureChannelBans` | `QueryFutureChannelBansResponse` | +| `GET` | `/api/v2/chat/moderation/flags/message` | `queryMessageFlags` | `QueryMessageFlagsResponse` | +| `POST` | `/api/v2/moderation/configs` | `queryModerationConfigs` | `QueryModerationConfigsResponse` | +| `POST` | `/api/v2/moderation/review_queue` | `queryReviewQueue` | `QueryReviewQueueResponse` | +| `POST` | `/api/v2/moderation/submit_action` | `submitAction` | `SubmitActionResponse` | +| `POST` | `/api/v2/moderation/unmute` | `unmute` | `UnmuteResponse` | +| `POST` | `/api/v2/chat/moderation/unmute/channel` | `unmuteChannel` | `UnmuteResponse` | +| `PUT` | `/api/v2/blocklists/{name}` | `updateBlockList` | `UpdateBlockListResponse` | +| `PATCH` | `/api/v2/moderation/queues/{id}` | `updateQueue` | `QueueResponse` | +| `POST` | `/api/v2/moderation/action_config` | `upsertActionConfig` | `UpsertActionConfigResponse` | +| `POST` | `/api/v2/moderation/config` | `upsertConfig` | `UpsertConfigResponse` | + +## Decisions to make + +- Most generated moderation operations have no hand-written counterpart. Decide explicitly which we expose now and which stay internal; do not surface ~20 new public methods as a side effect of migrating 11. +- Flag/unflag was deprecated recently on our side — check its current state before mapping it. + +## Risks + +- `query_banned_users` may omit the `created_at_after` / `created_at_before` filters our request sends; verify before migrating or those filters silently disappear. + +## Definition of done + +- [ ] Every method above either routes through `DefaultApi` or is listed here as deliberately left + hand-written, with the reason. +- [ ] Public methods return `Future>`; no `getOrThrow()` inside the SDK. +- [ ] Hand-written request/response DTOs for this group are deleted, or their retention is justified. +- [ ] `melos run analyze` clean, `melos run test:dart` green, persistence tests green if this group + persists anything. +- [ ] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. +- [ ] CHANGELOG entry under `🛑️ Breaking` for each break; PR title `refactor(llc)!:`. +- [ ] Decisions recorded in this file, and the status box ticked in `README.md`. diff --git a/openapi-migration/09-users.md b/openapi-migration/09-users.md new file mode 100644 index 0000000000..4d2082a873 --- /dev/null +++ b/openapi-migration/09-users.md @@ -0,0 +1,59 @@ +# 09 — Users + +**Goal:** `User` is the most widely referenced public model in the SDK; this is where keep-vs-adopt costs the most. + +**Size:** 9 hand-written method(s) across 1 file(s) → 9 generated operation(s). + +> Tables are generated by `openapi-migration/tool/generate_plan.py`. Edit the prose, not the tables. + +## Scope + +### Hand-written today + +| File | Method | Returns | +| --- | --- | --- | +| `user_api.dart` | `queryUsers` | `QueryUsersResponse` | +| `user_api.dart` | `updateUsers` | `UpdateUsersResponse` | +| `user_api.dart` | `partialUpdateUsers` | `UpdateUsersResponse` | +| `user_api.dart` | `blockUser` | `UserBlockResponse` | +| `user_api.dart` | `unblockUser` | `EmptyResponse` | +| `user_api.dart` | `queryBlockedUsers` | `BlockedUsersResponse` | +| `user_api.dart` | `getUnreadCount` | `GetUnreadCountResponse` | +| `user_api.dart` | `getActiveLiveLocations` | `GetActiveLiveLocationsResponse` | +| `user_api.dart` | `updateLiveLocation` | `Location` | + +### Generated operations that cover it + +| Verb | Path | Operation | Response | +| --- | --- | --- | --- | +| `POST` | `/api/v2/users/block` | `blockUsers` | `BlockUsersResponse` | +| `GET` | `/api/v2/users/block` | `getBlockedUsers` | `GetBlockedUsersResponse` | +| `GET` | `/api/v2/users/live_locations` | `getUserLiveLocations` | `SharedLocationsResponse` | +| `GET` | `/api/v2/users` | `queryUsers` | `QueryUsersResponse` | +| `POST` | `/api/v2/users/unblock` | `unblockUsers` | `UnblockUsersResponse` | +| `GET` | `/api/v2/chat/unread` | `unreadCounts` | `WrappedUnreadCountsResponse` | +| `PUT` | `/api/v2/users/live_locations` | `updateLiveLocation` | `SharedLocationResponse` | +| `POST` | `/api/v2/users` | `updateUsers` | `UpdateUsersResponse` | +| `PATCH` | `/api/v2/users` | `updateUsersPartial` | `UpdateUsersResponse` | + +## Decisions to make + +- `User` and `OwnUser` are public, persisted, and embedded in nearly every other response. The decision is made in 01-foundation and frozen there; this group executes it. +- `PrivacySettings` and the push-preference sub-shapes — decide per type. + +## Risks + +- Every other group depends on the `User` decision. +- User data arrives over the WebSocket on nearly every event. + +## Definition of done + +- [ ] Every method above either routes through `DefaultApi` or is listed here as deliberately left + hand-written, with the reason. +- [ ] Public methods return `Future>`; no `getOrThrow()` inside the SDK. +- [ ] Hand-written request/response DTOs for this group are deleted, or their retention is justified. +- [ ] `melos run analyze` clean, `melos run test:dart` green, persistence tests green if this group + persists anything. +- [ ] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. +- [ ] CHANGELOG entry under `🛑️ Breaking` for each break; PR title `refactor(llc)!:`. +- [ ] Decisions recorded in this file, and the status box ticked in `README.md`. diff --git a/openapi-migration/10-messages.md b/openapi-migration/10-messages.md new file mode 100644 index 0000000000..b68406caf8 --- /dev/null +++ b/openapi-migration/10-messages.md @@ -0,0 +1,68 @@ +# 10 — Messages & Search + +**Goal:** The core of the SDK, and the group with the most customisation pressure on its models. + +**Size:** 14 hand-written method(s) across 2 file(s) → 12 generated operation(s). + +> Tables are generated by `openapi-migration/tool/generate_plan.py`. Edit the prose, not the tables. + +## Scope + +### Hand-written today + +| File | Method | Returns | +| --- | --- | --- | +| `message_api.dart` | `sendMessage` | `SendMessageResponse` | +| `message_api.dart` | `getMessagesById` | `GetMessagesByIdResponse` | +| `message_api.dart` | `getMessage` | `GetMessageResponse` | +| `message_api.dart` | `updateMessage` | `UpdateMessageResponse` | +| `message_api.dart` | `partialUpdateMessage` | `UpdateMessageResponse` | +| `message_api.dart` | `deleteMessage` | `EmptyResponse` | +| `message_api.dart` | `sendAction` | `SendActionResponse` | +| `message_api.dart` | `sendReaction` | `SendReactionResponse` | +| `message_api.dart` | `deleteReaction` | `EmptyResponse` | +| `message_api.dart` | `getReactions` | `QueryReactionsResponse` | +| `message_api.dart` | `queryReactions` | `QueryReactionsResponse` | +| `message_api.dart` | `translateMessage` | `TranslateMessageResponse` | +| `message_api.dart` | `getReplies` | `QueryRepliesResponse` | +| `general_api.dart` | `searchMessages` | `SearchMessagesResponse` | + +### Generated operations that cover it + +| Verb | Path | Operation | Response | +| --- | --- | --- | --- | +| `DELETE` | `/api/v2/chat/messages/{id}` | `deleteMessage` | `DeleteMessageResponse` | +| `DELETE` | `/api/v2/chat/messages/{id}/reaction/{type}` | `deleteReaction` | `DeleteReactionResponse` | +| `GET` | `/api/v2/chat/messages/{id}` | `getMessage` | `GetMessageResponse` | +| `GET` | `/api/v2/chat/messages/{id}/reactions` | `getReactions` | `GetReactionsResponse` | +| `GET` | `/api/v2/chat/messages/{parent_id}/replies` | `getReplies` | `GetRepliesResponse` | +| `POST` | `/api/v2/chat/messages/{id}/reactions` | `queryReactions` | `QueryReactionsResponse` | +| `POST` | `/api/v2/chat/messages/{id}/action` | `runMessageAction` | `MessageActionResponse` | +| `GET` | `/api/v2/chat/search` | `search` | `SearchResponse` | +| `POST` | `/api/v2/chat/messages/{id}/reaction` | `sendReaction` | `SendReactionResponse` | +| `POST` | `/api/v2/chat/messages/{id}/translate` | `translateMessage` | `MessageActionResponse` | +| `POST` | `/api/v2/chat/messages/{id}` | `updateMessage` | `UpdateMessageResponse` | +| `PUT` | `/api/v2/chat/messages/{id}` | `updateMessagePartial` | `UpdateMessagePartialResponse` | + +## Decisions to make + +- `Message` is public, persisted, WebSocket-delivered and the most customised type in the SDK. Keep ours; treat the generated `MessageResponse` as a mapping source only. +- `Attachment`: the generated model defines fields our `extraData` currently absorbs. Decide the promotion rules before writing the mapper. + +## Risks + +- `message_api.dart` also holds the four draft methods, which belong to group 07 — leave them alone here. +- Attachment `custom`/`extraData` promotion is the known hard part of the whole migration. +- Message send has offline and retry paths through `stream_chat_persistence` that must keep working. + +## Definition of done + +- [ ] Every method above either routes through `DefaultApi` or is listed here as deliberately left + hand-written, with the reason. +- [ ] Public methods return `Future>`; no `getOrThrow()` inside the SDK. +- [ ] Hand-written request/response DTOs for this group are deleted, or their retention is justified. +- [ ] `melos run analyze` clean, `melos run test:dart` green, persistence tests green if this group + persists anything. +- [ ] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. +- [ ] CHANGELOG entry under `🛑️ Breaking` for each break; PR title `refactor(llc)!:`. +- [ ] Decisions recorded in this file, and the status box ticked in `README.md`. diff --git a/openapi-migration/11-channels-and-members.md b/openapi-migration/11-channels-and-members.md new file mode 100644 index 0000000000..21eb4700c2 --- /dev/null +++ b/openapi-migration/11-channels-and-members.md @@ -0,0 +1,93 @@ +# 11 — Channels, Members & Sync + +**Goal:** The biggest group, and the one every controller above it reads through `ChannelState`. + +**Size:** 27 hand-written method(s) across 2 file(s) → 24 generated operation(s). + +> Tables are generated by `openapi-migration/tool/generate_plan.py`. Edit the prose, not the tables. + +## Scope + +### Hand-written today + +| File | Method | Returns | +| --- | --- | --- | +| `channel_api.dart` | `queryChannel` | `ChannelState` | +| `channel_api.dart` | `queryChannels` | `QueryChannelsResponse` | +| `channel_api.dart` | `markAllRead` | `EmptyResponse` | +| `channel_api.dart` | `updateChannel` | `UpdateChannelResponse` | +| `channel_api.dart` | `updateChannelPartial` | `PartialUpdateChannelResponse` | +| `channel_api.dart` | `enableSlowdown` | `PartialUpdateChannelResponse` | +| `channel_api.dart` | `disableSlowdown` | `PartialUpdateChannelResponse` | +| `channel_api.dart` | `acceptChannelInvite` | `AcceptInviteResponse` | +| `channel_api.dart` | `rejectChannelInvite` | `RejectInviteResponse` | +| `channel_api.dart` | `inviteChannelMembers` | `InviteMembersResponse` | +| `channel_api.dart` | `addMembers` | `AddMembersResponse` | +| `channel_api.dart` | `removeMembers` | `RemoveMembersResponse` | +| `channel_api.dart` | `sendEvent` | `EmptyResponse` | +| `channel_api.dart` | `deleteChannel` | `EmptyResponse` | +| `channel_api.dart` | `truncateChannel` | `EmptyResponse` | +| `channel_api.dart` | `hideChannel` | `EmptyResponse` | +| `channel_api.dart` | `showChannel` | `EmptyResponse` | +| `channel_api.dart` | `markRead` | `EmptyResponse` | +| `channel_api.dart` | `markUnread` | `EmptyResponse` | +| `channel_api.dart` | `markUnreadByTimestamp` | `EmptyResponse` | +| `channel_api.dart` | `markThreadRead` | `EmptyResponse` | +| `channel_api.dart` | `markThreadUnread` | `EmptyResponse` | +| `channel_api.dart` | `stopWatching` | `EmptyResponse` | +| `channel_api.dart` | `updateMemberPartial` | `PartialUpdateMemberResponse` | +| `channel_api.dart` | `markChannelsDelivered` | `EmptyResponse` | +| `general_api.dart` | `sync` | `SyncResponse` | +| `general_api.dart` | `queryMembers` | `QueryMembersResponse` | + +### Generated operations that cover it + +| Verb | Path | Operation | Response | +| --- | --- | --- | --- | +| `DELETE` | `/api/v2/chat/channels/{type}/{id}` | `deleteChannel` | `DeleteChannelResponse` | +| `POST` | `/api/v2/chat/channels/delete` | `deleteChannels` | `DeleteChannelsResponse` | +| `GET` | `/api/v2/chat/channels/{type}/{id}` | `getChannel` | `ChannelStateResponse` | +| `GET` | `/api/v2/chat/channels/{type}/{id}/messages` | `getManyMessages` | `GetManyMessagesResponse` | +| `POST` | `/api/v2/chat/channels/{type}/{id}/query` | `getOrCreateChannel` | `ChannelStateResponse` | +| `POST` | `/api/v2/chat/channels/{type}/query` | `getOrCreateDistinctChannel` | `ChannelStateResponse` | +| `GET` | `/api/v2/chat/channels/{type}/{id}/pinned_messages` | `getPinnedMessages` | `GetPinnedMessagesResponse` | +| `POST` | `/api/v2/chat/channels/grouped` | `groupedQueryChannels` | `GroupedQueryChannelsResponse` | +| `POST` | `/api/v2/chat/channels/{type}/{id}/hide` | `hideChannel` | `HideChannelResponse` | +| `POST` | `/api/v2/chat/channels/read` | `markChannelsRead` | `MarkReadResponse` | +| `POST` | `/api/v2/chat/channels/delivered` | `markDelivered` | `MarkDeliveredResponse` | +| `POST` | `/api/v2/chat/channels/{type}/{id}/read` | `markRead` | `MarkReadResponse` | +| `POST` | `/api/v2/chat/channels/{type}/{id}/unread` | `markUnread` | `DurationResponse` | +| `POST` | `/api/v2/chat/channels` | `queryChannels` | `QueryChannelsResponse` | +| `GET` | `/api/v2/chat/members` | `queryMembers` | `MembersResponse` | +| `POST` | `/api/v2/chat/channels/{type}/{id}/event` | `sendEvent` | `EventResponse` | +| `POST` | `/api/v2/chat/channels/{type}/{id}/message` | `sendMessage` | `SendMessageResponse` | +| `POST` | `/api/v2/chat/channels/{type}/{id}/show` | `showChannel` | `ShowChannelResponse` | +| `POST` | `/api/v2/chat/channels/{type}/{id}/stop-watching` | `stopWatchingChannel` | `DurationResponse` | +| `POST` | `/api/v2/chat/sync` | `sync` | `SyncResponse` | +| `POST` | `/api/v2/chat/channels/{type}/{id}/truncate` | `truncateChannel` | `TruncateChannelResponse` | +| `POST` | `/api/v2/chat/channels/{type}/{id}` | `updateChannel` | `UpdateChannelResponse` | +| `PATCH` | `/api/v2/chat/channels/{type}/{id}` | `updateChannelPartial` | `UpdateChannelPartialResponse` | +| `PATCH` | `/api/v2/chat/channels/{type}/{id}/member` | `updateMemberPartial` | `UpdateMemberPartialResponse` | + +## Decisions to make + +- `ChannelState`, `ChannelModel` and `Member` are public, persisted, and rebuilt from WebSocket events. Keep ours and map. +- `sync` returns `SyncResponse` — one of the two models that needed the WSEvent generator patch. Verify it decodes before relying on it. + +## Risks + +- `sync` and `queryMembers` live in `general_api.dart`, not `channel_api.dart` — this group reaches into that file. +- `queryChannels` drives the channel list controllers and the offline cache; a shape change here is felt everywhere. +- Channel `custom`/`extraData` promotion, same class of problem as messages. + +## Definition of done + +- [ ] Every method above either routes through `DefaultApi` or is listed here as deliberately left + hand-written, with the reason. +- [ ] Public methods return `Future>`; no `getOrThrow()` inside the SDK. +- [ ] Hand-written request/response DTOs for this group are deleted, or their retention is justified. +- [ ] `melos run analyze` clean, `melos run test:dart` green, persistence tests green if this group + persists anything. +- [ ] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. +- [ ] CHANGELOG entry under `🛑️ Breaking` for each break; PR title `refactor(llc)!:`. +- [ ] Decisions recorded in this file, and the status box ticked in `README.md`. diff --git a/openapi-migration/12-uploads-cdn.md b/openapi-migration/12-uploads-cdn.md new file mode 100644 index 0000000000..619bfe11f5 --- /dev/null +++ b/openapi-migration/12-uploads-cdn.md @@ -0,0 +1,60 @@ +# 12 — Uploads (CDN) + +**Goal:** Move file and image uploads to v2 behind a hand-written retrofit multipart client. + +**Size:** 8 hand-written method(s) across 1 file(s) → 8 generated operation(s). + +> Tables are generated by `openapi-migration/tool/generate_plan.py`. Edit the prose, not the tables. + +## Scope + +### Hand-written today + +| File | Method | Returns | +| --- | --- | --- | +| `attachment_file_uploader.dart` | `sendImage` | `SendImageResponse` | +| `attachment_file_uploader.dart` | `sendFile` | `SendFileResponse` | +| `attachment_file_uploader.dart` | `deleteImage` | `EmptyResponse` | +| `attachment_file_uploader.dart` | `deleteFile` | `EmptyResponse` | +| `attachment_file_uploader.dart` | `uploadImage` | `UploadImageResponse` | +| `attachment_file_uploader.dart` | `uploadFile` | `UploadFileResponse` | +| `attachment_file_uploader.dart` | `removeImage` | `EmptyResponse` | +| `attachment_file_uploader.dart` | `removeFile` | `EmptyResponse` | + +### Generated operations that cover it + +| Verb | Path | Operation | Response | +| --- | --- | --- | --- | +| `DELETE` | `/api/v2/chat/channels/{type}/{id}/file` | `deleteChannelFile` | `DurationResponse` | +| `DELETE` | `/api/v2/chat/channels/{type}/{id}/image` | `deleteChannelImage` | `DurationResponse` | +| `DELETE` | `/api/v2/uploads/file` | `deleteFile` | `DurationResponse` | +| `DELETE` | `/api/v2/uploads/image` | `deleteImage` | `DurationResponse` | +| `POST` | `/api/v2/chat/channels/{type}/{id}/file` | `uploadChannelFile` | `UploadChannelFileResponse` | +| `POST` | `/api/v2/chat/channels/{type}/{id}/image` | `uploadChannelImage` | `UploadChannelResponse` | +| `POST` | `/api/v2/uploads/file` | `uploadFile` | `FileUploadResponse` | +| `POST` | `/api/v2/uploads/image` | `uploadImage` | `ImageUploadResponse` | + +## Decisions to make + +- **Adopt core's uploader, or keep ours?** `stream_core` is reworking uploads around `StreamAttachmentUploader`, which takes a `CdnClient` and returns an `AttachmentUploadTask` — a lifecycle `state` stream, a `cancel()`, and a `result` that never throws ([core#170](https://github.com/GetStream/stream-core-flutter/pull/170)). Our `AttachmentFileUploader` spreads the same three things across a `Future`, a `ProgressCallback` and a `CancelToken`. Adopting it is a bigger break than migrating the endpoints, and the strongest cross-product-consistency case in the whole plan. +- Whichever shape wins, the hand-written `CdnApi` should implement core's `CdnClient` (`uploadFile` / `uploadImage` -> `Future>`, `deleteFile` / `deleteImage` -> `Future>`) so it plugs into `StreamAttachmentUploader` — that is exactly how `stream_feeds` wires `FeedsCdnClient`. +- `AttachmentFileUploader` is public and pluggable through `attachmentFileUploaderProvider`; changing its signature is a break that needs the usual justification. +- The v2 multipart schema defines only `file`, `upload_sizes` and `user`, but our public `sendImage` / `sendFile` accept `extraData`. Decide: drop the parameter, or keep those two calls on v1. + +## Risks + +- Core's `CdnClient` has no channel-scoped operations — it is `uploadFile` / `uploadImage` only — while half of chat's uploads are `/chat/channels/{type}/{id}/file`. Either our implementation closes over the channel, or core's interface needs a variant. Settle this before writing the client. +- Attachment upload is the highest-traffic path in the SDK; a regression is immediately visible to end users. +- The generated `uploadFile` / `uploadChannelFile` take a JSON body with no progress or cancellation, so this group cannot use them — it needs its own `CdnApi`. + +## Definition of done + +- [ ] Every method above either routes through `DefaultApi` or is listed here as deliberately left + hand-written, with the reason. +- [ ] Public methods return `Future>`; no `getOrThrow()` inside the SDK. +- [ ] Hand-written request/response DTOs for this group are deleted, or their retention is justified. +- [ ] `melos run analyze` clean, `melos run test:dart` green, persistence tests green if this group + persists anything. +- [ ] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. +- [ ] CHANGELOG entry under `🛑️ Breaking` for each break; PR title `refactor(llc)!:`. +- [ ] Decisions recorded in this file, and the status box ticked in `README.md`. diff --git a/openapi-migration/README.md b/openapi-migration/README.md new file mode 100644 index 0000000000..cd78452dba --- /dev/null +++ b/openapi-migration/README.md @@ -0,0 +1,106 @@ +# Migrating `stream_chat` to the OpenAPI-generated client + +The plan for moving the low-level client off its hand-written HTTP layer and onto the OpenAPI-generated client in +`packages/stream_chat/lib/open_api/`. + +One file per feature group, in the order they should land. Each carries a goal, the exact hand-written methods and +generated operations in scope, the decisions that group has to make, its risks, and a definition of done. + +| | Group | Hand-written | Generated ops | Status | +| --- | --- | --- | --- | --- | +| [01](01-foundation.md) | Foundation — `Result`, errors, wiring | — | — | ☐ | +| [02](02-devices-and-push-preferences.md) | Devices & Push Preferences | 4 | 4 | ☐ | +| [03](03-user-groups.md) | User Groups | 8 | 8 | ☐ | +| [04](04-roles-guest-and-app.md) | Roles, Guest & App Settings | 4 | 5 | ☐ | +| [05](05-polls.md) | Polls | 13 | 13 | ☐ | +| [06](06-reminders.md) | Message Reminders | 4 | 4 | ☐ | +| [07](07-threads-and-drafts.md) | Threads & Drafts | 7 | 7 | ☐ | +| [08](08-moderation-and-blocklists.md) | Moderation & Blocklists | 11 | 34 | ☐ | +| [09](09-users.md) | Users | 9 | 9 | ☐ | +| [10](10-messages.md) | Messages & Search | 14 | 12 | ☐ | +| [11](11-channels-and-members.md) | Channels, Members & Sync | 27 | 24 | ☐ | +| [12](12-uploads-cdn.md) | Uploads (CDN) | 8 | 8 | ☐ | + +**Coverage:** 109 hand-written methods across 13 files, and all 128 generated operations, each claimed by exactly +one group. Verified mechanically — see [Keeping this plan honest](#keeping-this-plan-honest). + +## Goals + +1. **One API layer, not two.** Every endpoint the SDK calls goes through the generated client, so new API surface + arrives by regenerating rather than by hand-writing a DTO. +2. **Shapes consistent with our other SDKs**, because they come from the same spec. +3. **Errors from `stream_core`**, so a Flutter integrator handling a Stream error handles it the same way they + would in another Stream SDK. +4. **`Result`-returning public APIs**, matching `stream_feeds`. +5. **An upgrade path that is boring**, because `migrations/v11-migration.md` is written as each group lands rather + than reconstructed at release. + +## Non-goals + +- **Moving the WebSocket to v2.** It sends different event shapes and is its own project. Never fold it into a + feature group. +- **Rewriting our public models wholesale.** Generated types are wire shapes; ours are often the better public + API. The default is to keep ours and map at the boundary. +- **Regenerating the client.** That is `openapi-codegen`, and it lands as its own PR. + +## Principles + +- **One feature group per PR.** A group is a set of endpoints a caller thinks of together, and it moves across + completely — half-migrated features are worse than unmigrated ones. +- **Default to keeping our shape.** Break only when it buys long-term maintainability (the alternative is + maintaining two shapes forever) or consistency with our other products. Not for cosmetics. +- **Every break ships four artifacts**: `refactor(llc)!:` title, `🛑️ Breaking` CHANGELOG entry, a Symbol Map row + plus feature section in `migrations/v11-migration.md`, and the reason in the PR body. +- **Decide once, at the right level.** Cross-cutting shapes — `User`, errors, `Result` — are decided in + [01-foundation](01-foundation.md), not re-argued per group. + +## Order, and why + +**[01-foundation](01-foundation.md) first, and it blocks everything.** After it, groups 02–07 can run in parallel; +08–12 are best run in sequence because they share models. + +The order runs from smallest and most isolated to largest and most entangled, so the pattern is proven on cheap +surfaces before it reaches `Message` and `ChannelState`: + +- **02–04** have no persistence and almost no public model surface. Group 02 is the pattern-proving slice. +- **05–07** introduce persisted models and WebSocket-delivered updates, one at a time. +- **08** is where we decide what *not* to expose: 34 generated operations against 11 hand-written methods. +- **09** freezes the `User` mapping that everything else already depends on (the *decision* is made in 01; this + group executes it). +- **10–11** are the core of the SDK, and carry the `custom` / `extraData` promotion problem. +- **12** is last because it needs its own hand-written multipart client and is the highest-traffic path in the SDK. + +## Prerequisites + +- **A `stream_core` release.** `stream_chat` cannot be published while `stream_core` is a git dependency, and the + generated client needs `StreamDateTimeConverter`, which is not in the last published version. +- **The generated client committed and building** — it is, in `lib/open_api/`. + +## How to execute a group + +Use the **`openapi-migration`** skill: it is the per-group process (scope → decide shapes → sequence → implement → +tests → verify). Use **`openapi-codegen`** when a type or operation is missing, or the generated code is wrong. + +Consumer-facing changes go in `migrations/v11-migration.md` in the same PR that makes them. + +## Keeping this plan honest + +The scope tables are generated from the SDK, not typed by hand: + +```bash +python3 openapi-migration/tool/generate_plan.py # regenerate the tables + report +python3 openapi-migration/tool/generate_plan.py --check # report only, non-zero exit on a gap +``` + +It re-derives: + +- every public method in `lib/src/core/api/*_api.dart` and `attachment_file_uploader.dart`, and +- every operation in `lib/open_api/api/default_api.dart`, with its verb, path and response type, + +then asserts that each hand-written file belongs to exactly one group and each generated operation is claimed +exactly once. Nested paths are owned by the specific feature, not the broad one — poll votes belong to Polls even +though they sit under `/chat/messages/...`, and draft operations belong to Threads & Drafts even though they sit +under `/chat/channels/...`. + +Re-run it after a regeneration adds or renames operations, and treat a reported problem as a plan bug rather +than a script bug. Prose sections are hand-written and survive regeneration. diff --git a/openapi-migration/tool/generate_plan.py b/openapi-migration/tool/generate_plan.py new file mode 100644 index 0000000000..4494452f28 --- /dev/null +++ b/openapi-migration/tool/generate_plan.py @@ -0,0 +1,368 @@ +#!/usr/bin/env python3 +"""Regenerates the scope tables in openapi-migration/*.md from the SDK itself. + + python3 openapi-migration/tool/generate_plan.py # regenerate + report + python3 openapi-migration/tool/generate_plan.py --check # report only, non-zero on a gap + +Run from the repo root. Prose sections (goal, decisions, risks) live in GROUPS +below; the tables are always derived from the code, so they cannot drift. + +The report asserts two invariants: + * every public method in the hand-written api layer belongs to exactly one group + * every operation in the generated client is claimed by exactly one group + +A non-zero unclaimed count after a regeneration means the plan needs a new group +or a wider path prefix — treat it as a plan bug, not a script bug. +""" + +import pathlib +import re +import sys +import textwrap + +PKG = pathlib.Path('packages/stream_chat') +API_DIR = PKG / 'lib/src/core/api' +GENERATED_API = PKG / 'lib/open_api/api/default_api.dart' +OUT = pathlib.Path('openapi-migration') + + +def read_handwritten(): + """{file: [(method, returnType)]} for the hand-written api layer.""" + out = {} + sources = sorted(API_DIR.glob('*_api.dart')) + [API_DIR / 'attachment_file_uploader.dart'] + for f in sources: + methods = [ + (m.group(2), m.group(1)) + for m in re.finditer(r'\n Future<([^>]+)>\s+(\w+)\(', f.read_text()) + ] + if f.name == 'attachment_file_uploader.dart': + # the abstract interface declares each method, the impl repeats it + methods = methods[:8] + if methods: + out[f.name] = methods + return out + + +def read_generated(): + """[(verb, path, operation, responseType)] for the generated client.""" + return re.findall( + r"@(GET|POST|PATCH|PUT|DELETE)\('([^']+)'\)\s*\n\s*Future>\s+(\w+)\(", + GENERATED_API.read_text(), + ) + + +def owns(*prefixes, unless=()): + def match(path): + if any(path.startswith(x) for x in unless): + return False + return any(path.startswith(x) for x in prefixes) + return match + + +GROUPS = [ + dict( + num='02', slug='devices-and-push-preferences', title='Devices & Push Preferences', + hand=['device_api.dart'], + match=owns('/api/v2/devices', '/api/v2/push_preferences'), + goal='Prove the whole pattern end to end on the smallest real surface: four methods, no persistence, ' + 'no channel scope.', + decisions=[ + '`PushProvider` (our public enum) against the generated per-operation extension type — write the ' + 'adapter here, it sets the precedent for every enum that follows.', + '`setPushPreferences` reads its response into client state and emits `EventType.pushPreferenceUpdated`; ' + 'decide whether that stays in the api layer or moves up.', + ], + risks=[ + "Generated `DeviceResponse` has 9 fields against our `Device`'s 2 — drop or widen, and record which.", + ], + ), + dict( + num='03', slug='user-groups', title='User Groups', + hand=['user_groups_api.dart'], + match=owns('/api/v2/usergroups'), + goal='A clean 1:1 group — eight methods against eight generated operations, no client state, ' + 'no persistence.', + decisions=[ + 'Several generated responses (`AddUserGroupMembersResponse`, `CreateUserGroupResponse`, …) wrap the ' + 'same `UserGroupResponse`; decide whether our public API keeps distinct types or collapses them.', + ], + risks=[ + '`UserGroup` and `UserGroupMember` collide by name with generated types — the export decision lands ' + 'here first.', + ], + ), + dict( + num='04', slug='roles-guest-and-app', title='Roles, Guest & App Settings', + hand=['roles_api.dart', 'guest_api.dart', + 'general_api.dart::enrichUrl', 'general_api.dart::getAppSettings'], + match=owns('/api/v2/roles', '/api/v2/guest', '/api/v2/app', '/api/v2/og', '/api/v2/longpoll'), + goal='Sweep up the singletons — one-method families that share no state and can land in one PR.', + decisions=[ + '`AppSettings` is public and hand-shaped; the generated `AppResponseFields` is the wire shape. Keep ' + 'ours unless the generated one is genuinely better.', + ], + risks=[ + '`general_api.dart` is split across four groups — only `enrichUrl` and `getAppSettings` belong here. ' + '`sync` and `queryMembers` go to group 11, `searchMessages` to group 10. Do not migrate the file as a ' + 'unit.', + ], + ), + dict( + num='05', slug='polls', title='Polls', + hand=['polls_api.dart'], + match=owns('/api/v2/polls', '/api/v2/chat/messages/{message_id}/polls'), + goal='First group with real domain models and persistence behind it.', + decisions=[ + '`Poll`, `PollOption` and `PollVote` are public and persisted; adopting generated shapes means ' + 'touching `stream_chat_persistence` in the same PR.', + '`VotingVisibility` is ours; the generated equivalent is an inline per-operation enum.', + ], + risks=[ + 'Vote operations live under `/chat/messages/{message_id}/polls/...`, not `/polls` — easy to miss when ' + 'grepping by path.', + 'Poll updates also arrive over the WebSocket, so `DateTime` and `custom` handling must tolerate both ' + 'encodings.', + 'Touching a file under `lib/src/entity/` trips `check_db_entities`, which demands a `schemaVersion` ' + 'bump for any change there — including an import-only one. Do not bump it for a no-op; the guard is ' + 'coarse, the schema is what matters.', + ], + ), + dict( + num='06', slug='reminders', title='Message Reminders', + hand=['reminders_api.dart'], + match=owns('/api/v2/chat/messages/{message_id}/reminders', '/api/v2/chat/reminders'), + goal='Small and self-contained, and it exercises the `PATCH` shape our hand-written layer expresses ' + 'differently.', + decisions=[ + '`MessageReminder` is public and persisted; decide keep-vs-adopt with persistence in the same PR.', + ], + risks=['Reminder events also arrive over the WebSocket.'], + ), + dict( + num='07', slug='threads-and-drafts', title='Threads & Drafts', + hand=['threads_api.dart', + 'message_api.dart::createDraft', 'message_api.dart::deleteDraft', + 'message_api.dart::getDraft', 'message_api.dart::queryDrafts'], + match=owns('/api/v2/chat/threads', '/api/v2/chat/drafts', '/api/v2/chat/channels/{type}/{id}/draft'), + goal='Two related families that share the `Draft` model and the list controllers above them.', + decisions=[ + 'The generated thread response embeds a full `ChannelResponse`. Decide whether the channel inside a ' + 'thread adopts the generated shape now, or waits for the channels group — and write the answer down, ' + 'because the two groups can otherwise disagree.', + ], + risks=[ + 'The four draft methods live in `message_api.dart`, not `threads_api.dart` — this group reaches into ' + 'that file, and group 10 must leave those four alone.', + '`Draft` and `DraftMessage` are public, persisted, and read by `StreamDraftListController` in ' + '`stream_chat_flutter_core`.', + ], + ), + dict( + num='08', slug='moderation-and-blocklists', title='Moderation & Blocklists', + hand=['moderation_api.dart'], + match=owns('/api/v2/moderation', '/api/v2/chat/moderation', '/api/v2/blocklists', + '/api/v2/chat/query_banned_users', '/api/v2/chat/query_future_channel_bans'), + goal='The largest generated surface relative to ours — decide what stays unexposed.', + decisions=[ + 'Most generated moderation operations have no hand-written counterpart. Decide explicitly which we ' + 'expose now and which stay internal; do not surface ~20 new public methods as a side effect of ' + 'migrating 11.', + 'Flag/unflag was deprecated recently on our side — check its current state before mapping it.', + ], + risks=[ + '`query_banned_users` may omit the `created_at_after` / `created_at_before` filters our request sends; ' + 'verify before migrating or those filters silently disappear.', + ], + ), + dict( + num='09', slug='users', title='Users', + hand=['user_api.dart'], + match=owns('/api/v2/users', '/api/v2/chat/unread'), + goal='`User` is the most widely referenced public model in the SDK; this is where keep-vs-adopt costs the ' + 'most.', + decisions=[ + '`User` and `OwnUser` are public, persisted, and embedded in nearly every other response. The ' + 'decision is made in 01-foundation and frozen there; this group executes it.', + '`PrivacySettings` and the push-preference sub-shapes — decide per type.', + ], + risks=[ + 'Every other group depends on the `User` decision.', + 'User data arrives over the WebSocket on nearly every event.', + ], + ), + dict( + num='10', slug='messages', title='Messages & Search', + hand=['message_api.dart', 'general_api.dart::searchMessages'], + match=owns('/api/v2/chat/messages', '/api/v2/chat/search', + unless=('/api/v2/chat/messages/{message_id}/polls', + '/api/v2/chat/messages/{message_id}/reminders')), + goal='The core of the SDK, and the group with the most customisation pressure on its models.', + decisions=[ + '`Message` is public, persisted, WebSocket-delivered and the most customised type in the SDK. Keep ' + 'ours; treat the generated `MessageResponse` as a mapping source only.', + '`Attachment`: the generated model defines fields our `extraData` currently absorbs. Decide the ' + 'promotion rules before writing the mapper.', + ], + risks=[ + '`message_api.dart` also holds the four draft methods, which belong to group 07 — leave them alone ' + 'here.', + 'Attachment `custom`/`extraData` promotion is the known hard part of the whole migration.', + 'Message send has offline and retry paths through `stream_chat_persistence` that must keep working.', + ], + ), + dict( + num='11', slug='channels-and-members', title='Channels, Members & Sync', + hand=['channel_api.dart', 'general_api.dart::sync', 'general_api.dart::queryMembers'], + match=owns('/api/v2/chat/channels', '/api/v2/chat/members', '/api/v2/chat/sync', + unless=('/api/v2/chat/channels/{type}/{id}/draft', + '/api/v2/chat/channels/{type}/{id}/file', + '/api/v2/chat/channels/{type}/{id}/image')), + goal='The biggest group, and the one every controller above it reads through `ChannelState`.', + decisions=[ + '`ChannelState`, `ChannelModel` and `Member` are public, persisted, and rebuilt from WebSocket ' + 'events. Keep ours and map.', + '`sync` returns `SyncResponse` — one of the two models that needed the WSEvent generator patch. ' + 'Verify it decodes before relying on it.', + ], + risks=[ + '`sync` and `queryMembers` live in `general_api.dart`, not `channel_api.dart` — this group reaches ' + 'into that file.', + '`queryChannels` drives the channel list controllers and the offline cache; a shape change here is ' + 'felt everywhere.', + 'Channel `custom`/`extraData` promotion, same class of problem as messages.', + ], + ), + dict( + num='12', slug='uploads-cdn', title='Uploads (CDN)', + hand=['attachment_file_uploader.dart'], + match=owns('/api/v2/uploads', '/api/v2/chat/channels/{type}/{id}/file', + '/api/v2/chat/channels/{type}/{id}/image'), + goal='Move file and image uploads to v2 behind a hand-written retrofit multipart client.', + decisions=[ + '**Adopt core\'s uploader, or keep ours?** `stream_core` is reworking uploads around ' + '`StreamAttachmentUploader`, which takes a `CdnClient` and returns an `AttachmentUploadTask` — a ' + 'lifecycle `state` stream, a `cancel()`, and a `result` that never throws ' + '([core#170](https://github.com/GetStream/stream-core-flutter/pull/170)). Our ' + '`AttachmentFileUploader` spreads the same three things across a `Future`, a `ProgressCallback` and a ' + '`CancelToken`. Adopting it is a bigger break than migrating the endpoints, and the strongest ' + 'cross-product-consistency case in the whole plan.', + 'Whichever shape wins, the hand-written `CdnApi` should implement core\'s `CdnClient` ' + '(`uploadFile` / `uploadImage` -> `Future>`, `deleteFile` / `deleteImage` -> ' + '`Future>`) so it plugs into `StreamAttachmentUploader` — that is exactly how ' + '`stream_feeds` wires `FeedsCdnClient`.', + '`AttachmentFileUploader` is public and pluggable through `attachmentFileUploaderProvider`; changing ' + 'its signature is a break that needs the usual justification.', + 'The v2 multipart schema defines only `file`, `upload_sizes` and `user`, but our public `sendImage` / ' + '`sendFile` accept `extraData`. Decide: drop the parameter, or keep those two calls on v1.', + ], + risks=[ + "Core's `CdnClient` has no channel-scoped operations — it is `uploadFile` / `uploadImage` only — while " + 'half of chat\'s uploads are `/chat/channels/{type}/{id}/file`. Either our implementation closes over ' + 'the channel, or core\'s interface needs a variant. Settle this before writing the client.', + 'Attachment upload is the highest-traffic path in the SDK; a regression is immediately visible to end ' + 'users.', + 'The generated `uploadFile` / `uploadChannelFile` take a JSON body with no progress or cancellation, ' + 'so this group cannot use them — it needs its own `CdnApi`.', + ], + ), +] + +DONE = textwrap.dedent("""\ + - [ ] Every method above either routes through `DefaultApi` or is listed here as deliberately left + hand-written, with the reason. + - [ ] Public methods return `Future>`; no `getOrThrow()` inside the SDK. + - [ ] Hand-written request/response DTOs for this group are deleted, or their retention is justified. + - [ ] `melos run analyze` clean, `melos run test:dart` green, persistence tests green if this group + persists anything. + - [ ] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. + - [ ] CHANGELOG entry under `🛑️ Breaking` for each break; PR title `refactor(llc)!:`. + - [ ] Decisions recorded in this file, and the status box ticked in `README.md`. + """) + + +def hand_for(group, hand): + """Methods this group owns. 'file.dart::method' claims one; 'file.dart' claims the + remainder of that file after every explicit claim elsewhere.""" + explicit = {e.split('::')[1] for g in GROUPS for e in g['hand'] if '::' in e} + out = [] + for entry in group['hand']: + if '::' in entry: + f, name = entry.split('::') + out += [(f, n, r) for n, r in hand.get(f, []) if n == name] + else: + out += [(entry, n, r) for n, r in hand.get(entry, []) if n not in explicit] + return out + + +def render(g, hand, ops): + hand_methods = hand_for(g, hand) + gops = [o for o in ops if g['match'](o[1])] + L = [ + f"# {g['num']} — {g['title']}\n", + f"**Goal:** {g['goal']}\n", + f"**Size:** {len(hand_methods)} hand-written method(s) across " + f"{len({f for f, _, _ in hand_methods})} file(s) → {len(gops)} generated operation(s).\n", + '> Tables are generated by `openapi-migration/tool/generate_plan.py`. Edit the prose, not the tables.\n', + '## Scope\n', + '### Hand-written today\n', + '| File | Method | Returns |', + '| --- | --- | --- |', + ] + L += [f'| `{f}` | `{n}` | `{r}` |' for f, n, r in hand_methods] + L += ['\n### Generated operations that cover it\n', + '| Verb | Path | Operation | Response |', '| --- | --- | --- | --- |'] + L += [f'| `{verb}` | `{path}` | `{name}` | `{ret}` |' for verb, path, ret, name in + [(v, p, r, n) for v, p, r, n in gops]] + L.append('\n## Decisions to make\n') + L += [f'- {d}' for d in g['decisions']] + L.append('\n## Risks\n') + L += [f'- {r}' for r in g['risks']] + L.append('\n## Definition of done\n') + L.append(DONE) + return '\n'.join(L) + + +def main(): + check_only = '--check' in sys.argv + if not GENERATED_API.exists(): + sys.exit(f'{GENERATED_API} not found — run from the repo root.') + + hand, ops = read_handwritten(), read_generated() + + if not check_only: + for g in GROUPS: + (OUT / f"{g['num']}-{g['slug']}.md").write_text(render(g, hand, ops)) + + claimed_ops = {} + claimed_methods = {} + for g in GROUPS: + for o in [o for o in ops if g['match'](o[1])]: + claimed_ops.setdefault((o[0], o[1]), []).append(g['num']) + for f, n, _ in hand_for(g, hand): + claimed_methods.setdefault((f, n), []).append(g['num']) + + all_methods = {(f, n) for f, ms in hand.items() for n, _ in ms} + problems = [] + for k, v in claimed_ops.items(): + if len(v) > 1: + problems.append(f'operation claimed by {v}: {k[0]} {k[1]}') + for o in ops: + if (o[0], o[1]) not in claimed_ops: + problems.append(f'operation unclaimed: {o[0]} {o[1]}') + for k, v in claimed_methods.items(): + if len(v) > 1: + problems.append(f'method claimed by {v}: {k[0]}::{k[1]}') + for k in sorted(all_methods - set(claimed_methods)): + problems.append(f'method unclaimed: {k[0]}::{k[1]}') + + print(f'groups: {len(GROUPS)}') + print(f'hand-written methods: {len(all_methods)} across {len(hand)} files') + print(f'generated operations: {len(ops)}') + print(f'problems: {len(problems)}') + for p_ in problems: + print(f' {p_}') + return 1 if problems else 0 + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/packages/stream_chat/CHANGELOG.md b/packages/stream_chat/CHANGELOG.md index 0205063c4f..f1c95ff7a9 100644 --- a/packages/stream_chat/CHANGELOG.md +++ b/packages/stream_chat/CHANGELOG.md @@ -1,5 +1,9 @@ ## Upcoming +🔄 Internal / Non-breaking + +- Added the OpenAPI-generated v2 client under `lib/open_api/`, along with the `melos run gen:openapi` tooling that produces it. No API uses it yet. + 🔄 Changed - `Channel.translateMessage` now merges the translated message into the channel state, so the translation reaches anything watching the channel without the caller applying the response itself. diff --git a/packages/stream_chat/build.yaml b/packages/stream_chat/build.yaml index 270b312098..ac3786a432 100644 --- a/packages/stream_chat/build.yaml +++ b/packages/stream_chat/build.yaml @@ -7,5 +7,17 @@ targets: field_rename: snake freezed: options: + format: true map: false - when: false \ No newline at end of file + when: false + equal: true + copy_with: true + to_string_override: true + +global_options: + freezed: + runs_before: + - json_serializable + json_serializable: + runs_before: + - retrofit_generator \ No newline at end of file diff --git a/packages/stream_chat/lib/open_api/api.dart b/packages/stream_chat/lib/open_api/api.dart new file mode 100644 index 0000000000..c0f4db327b --- /dev/null +++ b/packages/stream_chat/lib/open_api/api.dart @@ -0,0 +1,11 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. +// +// Spec: chat-clientside-api (API v237.2.0) +// Source: protocol @ openapi-v237.2.0 +// Checksum: 0750cb0e4653bc5cac3371936e5bea1f7afb9c576c1d62d534d09e1f6bf11714 +// Generator: GetStream/chat @ v237.14.0-1-g90e424ef56 + +// ignore_for_file: directives_ordering + +export 'api/default_api.dart'; +export 'models.dart'; diff --git a/packages/stream_chat/lib/open_api/api/default_api.dart b/packages/stream_chat/lib/open_api/api/default_api.dart new file mode 100644 index 0000000000..a7747ba166 --- /dev/null +++ b/packages/stream_chat/lib/open_api/api/default_api.dart @@ -0,0 +1,784 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs + +import 'package:retrofit/retrofit.dart'; +import 'package:stream_core/stream_core.dart'; + +import '../models.dart'; + +part 'default_api.g.dart'; + +@RestApi(callAdapter: _ResultCallAdapter) +abstract interface class DefaultApi { + factory DefaultApi( + Dio dio, { + String? baseUrl, + }) = _DefaultApi; + + @POST('/api/v2/usergroups/{id}/members') + Future> addUserGroupMembers({ + @Path('id') required String id, + @Body() required AddUserGroupMembersRequest addUserGroupMembersRequest, + }); + + @POST('/api/v2/moderation/appeal') + Future> appeal({ + @Body() required AppealRequest appealRequest, + }); + + @POST('/api/v2/moderation/ban') + Future> ban({ + @Body() required BanRequest banRequest, + }); + + @POST('/api/v2/users/block') + Future> blockUsers({ + @Body() required BlockUsersRequest blockUsersRequest, + }); + + @POST('/api/v2/moderation/appeals/bulk_action') + Future> bulkActionAppeals({ + @Body() required BulkActionAppealsRequest bulkActionAppealsRequest, + }); + + @POST('/api/v2/moderation/action_config/bulk_delete') + Future> bulkDeleteActionConfig({ + @Body() required BulkDeleteActionConfigRequest bulkDeleteActionConfigRequest, + }); + + @POST('/api/v2/moderation/action_config/bulk') + Future> bulkUpsertActionConfig({ + @Body() required BulkUpsertActionConfigRequest bulkUpsertActionConfigRequest, + }); + + @POST('/api/v2/chat/messages/{message_id}/polls/{poll_id}/vote') + Future> castPollVote({ + @Path('message_id') required String messageId, + @Path('poll_id') required String pollId, + @Body() CastPollVoteRequest? castPollVoteRequest, + }); + + @POST('/api/v2/blocklists') + Future> createBlockList({ + @Body() required CreateBlockListRequest createBlockListRequest, + }); + + @POST('/api/v2/devices') + Future> createDevice({ + @Body() required CreateDeviceRequest createDeviceRequest, + }); + + @POST('/api/v2/chat/channels/{type}/{id}/draft') + Future> createDraft({ + @Path('type') required String type, + @Path('id') required String id, + @Body() required CreateDraftRequest createDraftRequest, + }); + + @POST('/api/v2/guest') + Future> createGuest({ + @Body() required CreateGuestRequest createGuestRequest, + }); + + @POST('/api/v2/polls') + Future> createPoll({ + @Body() required CreatePollRequest createPollRequest, + }); + + @POST('/api/v2/polls/{poll_id}/options') + Future> createPollOption({ + @Path('poll_id') required String pollId, + @Body() required CreatePollOptionRequest createPollOptionRequest, + }); + + @POST('/api/v2/moderation/queues') + Future> createQueue({ + @Body() required CreateQueueRequest createQueueRequest, + }); + + @POST('/api/v2/chat/messages/{message_id}/reminders') + Future> createReminder({ + @Path('message_id') required String messageId, + @Body() CreateReminderRequest? createReminderRequest, + }); + + @POST('/api/v2/usergroups') + Future> createUserGroup({ + @Body() required CreateUserGroupRequest createUserGroupRequest, + }); + + @DELETE('/api/v2/moderation/action_config/{id}') + Future> deleteActionConfig({ + @Path('id') required String id, + }); + + @DELETE('/api/v2/blocklists/{name}') + Future> deleteBlockList({ + @Path('name') required String name, + @Query('team') String? team, + }); + + @DELETE('/api/v2/chat/channels/{type}/{id}') + Future> deleteChannel({ + @Path('type') required String type, + @Path('id') required String id, + @Query('hard_delete') bool? hardDelete, + }); + + @DELETE('/api/v2/chat/channels/{type}/{id}/file') + Future> deleteChannelFile({ + @Path('type') required String type, + @Path('id') required String id, + @Query('url') String? url, + }); + + @DELETE('/api/v2/chat/channels/{type}/{id}/image') + Future> deleteChannelImage({ + @Path('type') required String type, + @Path('id') required String id, + @Query('url') String? url, + }); + + @POST('/api/v2/chat/channels/delete') + Future> deleteChannels({ + @Body() required DeleteChannelsRequest deleteChannelsRequest, + }); + + @DELETE('/api/v2/moderation/config/{key}') + Future> deleteConfig({ + @Path('key') required String key, + @Query('team') String? team, + }); + + @DELETE('/api/v2/devices') + Future> deleteDevice({ + @Query('id') required String id, + }); + + @DELETE('/api/v2/chat/channels/{type}/{id}/draft') + Future> deleteDraft({ + @Path('type') required String type, + @Path('id') required String id, + @Query('parent_id') String? parentId, + }); + + @DELETE('/api/v2/uploads/file') + Future> deleteFile({ + @Query('url') String? url, + }); + + @DELETE('/api/v2/uploads/image') + Future> deleteImage({ + @Query('url') String? url, + }); + + @DELETE('/api/v2/chat/messages/{id}') + Future> deleteMessage({ + @Path('id') required String id, + @Query('hard') bool? hard, + @Query('delete_for_me') bool? deleteForMe, + }); + + @DELETE('/api/v2/polls/{poll_id}') + Future> deletePoll({ + @Path('poll_id') required String pollId, + }); + + @DELETE('/api/v2/polls/{poll_id}/options/{option_id}') + Future> deletePollOption({ + @Path('poll_id') required String pollId, + @Path('option_id') required String optionId, + }); + + @DELETE('/api/v2/chat/messages/{message_id}/polls/{poll_id}/vote/{vote_id}') + Future> deletePollVote({ + @Path('message_id') required String messageId, + @Path('poll_id') required String pollId, + @Path('vote_id') required String voteId, + }); + + @POST('/api/v2/moderation/queues/{id}/delete') + Future> deleteQueue({ + @Path('id') required String id, + }); + + @DELETE('/api/v2/chat/messages/{id}/reaction/{type}') + Future> deleteReaction({ + @Path('id') required String id, + @Path('type') required String type, + }); + + @DELETE('/api/v2/chat/messages/{message_id}/reminders') + Future> deleteReminder({ + @Path('message_id') required String messageId, + }); + + @DELETE('/api/v2/usergroups/{id}') + Future> deleteUserGroup({ + @Path('id') required String id, + @Query('team_id') String? teamId, + }); + + @POST('/api/v2/moderation/flag') + Future> flag({ + @Body() required FlagRequest flagRequest, + }); + + @GET('/api/v2/moderation/action_config') + Future> getActionConfig({ + @Query('queue_type') String? queueType, + @Query('entity_type') String? entityType, + @Query('exclude_defaults') bool? excludeDefaults, + @Query('only_defaults') bool? onlyDefaults, + }); + + @GET('/api/v2/app') + Future> getApp(); + + @GET('/api/v2/moderation/appeal/{id}') + Future> getAppeal({ + @Path('id') required String id, + }); + + @GET('/api/v2/users/block') + Future> getBlockedUsers(); + + @GET('/api/v2/chat/channels/{type}/{id}') + Future> getChannel({ + @Path('type') required String type, + @Path('id') required String id, + @Query('state') bool? state, + @Query('messages_limit') int? messagesLimit, + @Query('members_limit') int? membersLimit, + @Query('watchers_limit') int? watchersLimit, + @Query('messages_id_lt') String? messagesIdLt, + @Query('messages_id_lte') String? messagesIdLte, + @Query('messages_id_gt') String? messagesIdGt, + @Query('messages_id_gte') String? messagesIdGte, + @Query('messages_id_around') String? messagesIdAround, + }); + + @GET('/api/v2/moderation/config/{key}') + Future> getConfig({ + @Path('key') required String key, + @Query('team') String? team, + }); + + @GET('/api/v2/chat/channels/{type}/{id}/draft') + Future> getDraft({ + @Path('type') required String type, + @Path('id') required String id, + @Query('parent_id') String? parentId, + }); + + @GET('/api/v2/chat/channels/{type}/{id}/messages') + Future> getManyMessages({ + @Path('type') required String type, + @Path('id') required String id, + @Query('ids') required List ids, + @Query('member_custom_include') List? memberCustomInclude, + }); + + @GET('/api/v2/chat/messages/{id}') + Future> getMessage({ + @Path('id') required String id, + }); + + @GET('/api/v2/og') + Future> getOG({ + @Query('url') required String url, + }); + + @POST('/api/v2/chat/channels/{type}/{id}/query') + Future> getOrCreateChannel({ + @Path('type') required String type, + @Path('id') required String id, + @Body() ChannelGetOrCreateRequest? channelGetOrCreateRequest, + }); + + @POST('/api/v2/chat/channels/{type}/query') + Future> getOrCreateDistinctChannel({ + @Path('type') required String type, + @Body() ChannelGetOrCreateRequest? channelGetOrCreateRequest, + }); + + @GET('/api/v2/chat/channels/{type}/{id}/pinned_messages') + Future> getPinnedMessages({ + @Path('type') required String type, + @Path('id') required String id, + @Query('limit') int? limit, + @Query('offset') int? offset, + @Query('id_gte') String? idGte, + @Query('id_gt') String? idGt, + @Query('id_lte') String? idLte, + @Query('id_lt') String? idLt, + @Query('pinned_at_after_or_equal') DateTime? pinnedAtAfterOrEqual, + @Query('pinned_at_after') DateTime? pinnedAtAfter, + @Query('pinned_at_before_or_equal') DateTime? pinnedAtBeforeOrEqual, + @Query('pinned_at_before') DateTime? pinnedAtBefore, + @Query('id_around') String? idAround, + @Query('pinned_at_around') DateTime? pinnedAtAround, + @Query('sort') List? sort, + @Query('member_custom_include') List? memberCustomInclude, + }); + + @GET('/api/v2/polls/{poll_id}') + Future> getPoll({ + @Path('poll_id') required String pollId, + }); + + @GET('/api/v2/polls/{poll_id}/options/{option_id}') + Future> getPollOption({ + @Path('poll_id') required String pollId, + @Path('option_id') required String optionId, + }); + + @GET('/api/v2/moderation/queues/{id}') + Future> getQueue({ + @Path('id') required String id, + }); + + @GET('/api/v2/chat/messages/{id}/reactions') + Future> getReactions({ + @Path('id') required String id, + @Query('limit') int? limit, + @Query('offset') int? offset, + }); + + @GET('/api/v2/chat/messages/{parent_id}/replies') + Future> getReplies({ + @Path('parent_id') required String parentId, + @Query('limit') int? limit, + @Query('id_gte') String? idGte, + @Query('id_gt') String? idGt, + @Query('id_lte') String? idLte, + @Query('id_lt') String? idLt, + @Query('id_around') String? idAround, + @Query('sort') List? sort, + @Query('member_custom_include') List? memberCustomInclude, + }); + + @GET('/api/v2/chat/threads/{message_id}') + Future> getThread({ + @Path('message_id') required String messageId, + @Query('watch') bool? watch, + @Query('reply_limit') int? replyLimit, + @Query('participant_limit') int? participantLimit, + @Query('member_limit') int? memberLimit, + }); + + @GET('/api/v2/usergroups/{id}') + Future> getUserGroup({ + @Path('id') required String id, + @Query('team_id') String? teamId, + }); + + @GET('/api/v2/users/live_locations') + Future> getUserLiveLocations(); + + @POST('/api/v2/chat/channels/grouped') + Future> groupedQueryChannels({ + @Body() GroupedQueryChannelsRequest? groupedQueryChannelsRequest, + }); + + @POST('/api/v2/chat/channels/{type}/{id}/hide') + Future> hideChannel({ + @Path('type') required String type, + @Path('id') required String id, + @Body() HideChannelRequest? hideChannelRequest, + }); + + @POST('/api/v2/blocklists/{id}/import') + Future> importBlockList({ + @Path('id') required String id, + @Body() required ImportBlockListRequest importBlockListRequest, + }); + + @GET('/api/v2/blocklists') + Future> listBlockLists({ + @Query('team') String? team, + @Query('cursor') String? cursor, + @Query('limit') int? limit, + }); + + @GET('/api/v2/devices') + Future> listDevices(); + + @GET('/api/v2/moderation/queues') + Future> listQueues(); + + @GET('/api/v2/usergroups') + Future> listUserGroups({ + @Query('limit') int? limit, + @Query('id_gt') String? idGt, + @Query('created_at_gt') String? createdAtGt, + @Query('team_id') String? teamId, + }); + + @GET('/api/v2/longpoll') + Future> longPoll({ + @Query('json') WSAuthMessage? json, + }); + + @POST('/api/v2/chat/channels/read') + Future> markChannelsRead({ + @Body() MarkChannelsReadRequest? markChannelsReadRequest, + }); + + @POST('/api/v2/chat/channels/delivered') + Future> markDelivered({ + @Body() MarkDeliveredRequest? markDeliveredRequest, + }); + + @POST('/api/v2/chat/channels/{type}/{id}/read') + Future> markRead({ + @Path('type') required String type, + @Path('id') required String id, + @Body() MarkReadRequest? markReadRequest, + }); + + @POST('/api/v2/chat/channels/{type}/{id}/unread') + Future> markUnread({ + @Path('type') required String type, + @Path('id') required String id, + @Body() MarkUnreadRequest? markUnreadRequest, + }); + + @POST('/api/v2/moderation/mute') + Future> mute({ + @Body() required MuteRequest muteRequest, + }); + + @POST('/api/v2/chat/moderation/mute/channel') + Future> muteChannel({ + @Body() MuteChannelRequest? muteChannelRequest, + }); + + @POST('/api/v2/moderation/appeals') + Future> queryAppeals({ + @Body() QueryAppealsRequest? queryAppealsRequest, + }); + + @GET('/api/v2/chat/query_banned_users') + Future> queryBannedUsers({ + @Query('payload') QueryBannedUsersPayload? payload, + }); + + @POST('/api/v2/chat/channels') + Future> queryChannels({ + @Body() QueryChannelsRequest? queryChannelsRequest, + }); + + @POST('/api/v2/chat/drafts/query') + Future> queryDrafts({ + @Body() QueryDraftsRequest? queryDraftsRequest, + }); + + @GET('/api/v2/chat/query_future_channel_bans') + Future> queryFutureChannelBans({ + @Query('payload') QueryFutureChannelBansPayload? payload, + }); + + @GET('/api/v2/chat/members') + Future> queryMembers({ + @Query('payload') QueryMembersPayload? payload, + }); + + @GET('/api/v2/chat/moderation/flags/message') + Future> queryMessageFlags({ + @Query('payload') QueryMessageFlagsPayload? payload, + }); + + @POST('/api/v2/moderation/configs') + Future> queryModerationConfigs({ + @Body() QueryModerationConfigsRequest? queryModerationConfigsRequest, + }); + + @POST('/api/v2/polls/{poll_id}/votes') + Future> queryPollVotes({ + @Path('poll_id') required String pollId, + @Body() QueryPollVotesRequest? queryPollVotesRequest, + }); + + @POST('/api/v2/polls/query') + Future> queryPolls({ + @Body() QueryPollsRequest? queryPollsRequest, + }); + + @POST('/api/v2/chat/messages/{id}/reactions') + Future> queryReactions({ + @Path('id') required String id, + @Body() QueryReactionsRequest? queryReactionsRequest, + }); + + @POST('/api/v2/chat/reminders/query') + Future> queryReminders({ + @Body() QueryRemindersRequest? queryRemindersRequest, + }); + + @POST('/api/v2/moderation/review_queue') + Future> queryReviewQueue({ + @Body() QueryReviewQueueRequest? queryReviewQueueRequest, + }); + + @POST('/api/v2/chat/threads') + Future> queryThreads({ + @Body() QueryThreadsRequest? queryThreadsRequest, + }); + + @GET('/api/v2/users') + Future> queryUsers({ + @Query('payload') QueryUsersPayload? payload, + }); + + @POST('/api/v2/usergroups/{id}/members/delete') + Future> removeUserGroupMembers({ + @Path('id') required String id, + @Body() required RemoveUserGroupMembersRequest removeUserGroupMembersRequest, + }); + + @POST('/api/v2/chat/messages/{id}/action') + Future> runMessageAction({ + @Path('id') required String id, + @Body() required MessageActionRequest messageActionRequest, + }); + + @GET('/api/v2/chat/search') + Future> search({ + @Query('payload') SearchPayload? payload, + }); + + @GET('/api/v2/roles/search') + Future> searchRoles({ + @Query('query') required String query, + @Query('limit') int? limit, + @Query('name_gt') String? nameGt, + @Query('role_type') String? roleType, + @Query('include_global_roles') bool? includeGlobalRoles, + }); + + @GET('/api/v2/usergroups/search') + Future> searchUserGroups({ + @Query('query') required String query, + @Query('limit') int? limit, + @Query('name_gt') String? nameGt, + @Query('id_gt') String? idGt, + @Query('team_id') String? teamId, + }); + + @POST('/api/v2/chat/channels/{type}/{id}/event') + Future> sendEvent({ + @Path('type') required String type, + @Path('id') required String id, + @Body() required SendEventRequest sendEventRequest, + }); + + @POST('/api/v2/chat/channels/{type}/{id}/message') + Future> sendMessage({ + @Path('type') required String type, + @Path('id') required String id, + @Body() required SendMessageRequest sendMessageRequest, + }); + + @POST('/api/v2/chat/messages/{id}/reaction') + Future> sendReaction({ + @Path('id') required String id, + @Body() required SendReactionRequest sendReactionRequest, + }); + + @POST('/api/v2/chat/channels/{type}/{id}/show') + Future> showChannel({ + @Path('type') required String type, + @Path('id') required String id, + }); + + @POST('/api/v2/chat/channels/{type}/{id}/stop-watching') + Future> stopWatchingChannel({ + @Path('type') required String type, + @Path('id') required String id, + }); + + @POST('/api/v2/moderation/submit_action') + Future> submitAction({ + @Body() required SubmitActionRequest submitActionRequest, + }); + + @POST('/api/v2/chat/sync') + Future> sync({ + @Query('with_inaccessible_cids') bool? withInaccessibleCids, + @Query('watch') bool? watch, + @Body() required SyncRequest syncRequest, + }); + + @POST('/api/v2/chat/messages/{id}/translate') + Future> translateMessage({ + @Path('id') required String id, + @Body() required TranslateMessageRequest translateMessageRequest, + }); + + @POST('/api/v2/chat/channels/{type}/{id}/truncate') + Future> truncateChannel({ + @Path('type') required String type, + @Path('id') required String id, + @Body() TruncateChannelRequest? truncateChannelRequest, + }); + + @POST('/api/v2/users/unblock') + Future> unblockUsers({ + @Body() required UnblockUsersRequest unblockUsersRequest, + }); + + @POST('/api/v2/moderation/unmute') + Future> unmute({ + @Body() required UnmuteRequest unmuteRequest, + }); + + @POST('/api/v2/chat/moderation/unmute/channel') + Future> unmuteChannel({ + @Body() UnmuteChannelRequest? unmuteChannelRequest, + }); + + @GET('/api/v2/chat/unread') + Future> unreadCounts(); + + @PUT('/api/v2/blocklists/{name}') + Future> updateBlockList({ + @Path('name') required String name, + @Body() UpdateBlockListRequest? updateBlockListRequest, + }); + + @POST('/api/v2/chat/channels/{type}/{id}') + Future> updateChannel({ + @Path('type') required String type, + @Path('id') required String id, + @Body() UpdateChannelRequest? updateChannelRequest, + }); + + @PATCH('/api/v2/chat/channels/{type}/{id}') + Future> updateChannelPartial({ + @Path('type') required String type, + @Path('id') required String id, + @Body() UpdateChannelPartialRequest? updateChannelPartialRequest, + }); + + @PUT('/api/v2/users/live_locations') + Future> updateLiveLocation({ + @Body() required UpdateLiveLocationRequest updateLiveLocationRequest, + }); + + @PATCH('/api/v2/chat/channels/{type}/{id}/member') + Future> updateMemberPartial({ + @Path('type') required String type, + @Path('id') required String id, + @Body() UpdateMemberPartialRequest? updateMemberPartialRequest, + }); + + @POST('/api/v2/chat/messages/{id}') + Future> updateMessage({ + @Path('id') required String id, + @Body() required UpdateMessageRequest updateMessageRequest, + }); + + @PUT('/api/v2/chat/messages/{id}') + Future> updateMessagePartial({ + @Path('id') required String id, + @Body() UpdateMessagePartialRequest? updateMessagePartialRequest, + }); + + @PUT('/api/v2/polls') + Future> updatePoll({ + @Body() required UpdatePollRequest updatePollRequest, + }); + + @PUT('/api/v2/polls/{poll_id}/options') + Future> updatePollOption({ + @Path('poll_id') required String pollId, + @Body() required UpdatePollOptionRequest updatePollOptionRequest, + }); + + @PATCH('/api/v2/polls/{poll_id}') + Future> updatePollPartial({ + @Path('poll_id') required String pollId, + @Body() UpdatePollPartialRequest? updatePollPartialRequest, + }); + + @POST('/api/v2/push_preferences') + Future> updatePushNotificationPreferences({ + @Body() required UpsertPushPreferencesRequest upsertPushPreferencesRequest, + }); + + @PATCH('/api/v2/moderation/queues/{id}') + Future> updateQueue({ + @Path('id') required String id, + @Body() UpdateQueueRequest? updateQueueRequest, + }); + + @PATCH('/api/v2/chat/messages/{message_id}/reminders') + Future> updateReminder({ + @Path('message_id') required String messageId, + @Body() UpdateReminderRequest? updateReminderRequest, + }); + + @PATCH('/api/v2/chat/threads/{message_id}') + Future> updateThreadPartial({ + @Path('message_id') required String messageId, + @Body() UpdateThreadPartialRequest? updateThreadPartialRequest, + }); + + @PUT('/api/v2/usergroups/{id}') + Future> updateUserGroup({ + @Path('id') required String id, + @Body() UpdateUserGroupRequest? updateUserGroupRequest, + }); + + @POST('/api/v2/users') + Future> updateUsers({ + @Body() required UpdateUsersRequest updateUsersRequest, + }); + + @PATCH('/api/v2/users') + Future> updateUsersPartial({ + @Body() required UpdateUsersPartialRequest updateUsersPartialRequest, + }); + + @POST('/api/v2/chat/channels/{type}/{id}/file') + Future> uploadChannelFile({ + @Path('type') required String type, + @Path('id') required String id, + @Body() UploadChannelFileRequest? uploadChannelFileRequest, + }); + + @POST('/api/v2/chat/channels/{type}/{id}/image') + Future> uploadChannelImage({ + @Path('type') required String type, + @Path('id') required String id, + @Body() UploadChannelRequest? uploadChannelRequest, + }); + + @POST('/api/v2/uploads/file') + Future> uploadFile({ + @Body() FileUploadRequest? fileUploadRequest, + }); + + @POST('/api/v2/uploads/image') + Future> uploadImage({ + @Body() ImageUploadRequest? imageUploadRequest, + }); + + @POST('/api/v2/moderation/action_config') + Future> upsertActionConfig({ + @Body() required UpsertActionConfigRequest upsertActionConfigRequest, + }); + + @POST('/api/v2/moderation/config') + Future> upsertConfig({ + @Body() required UpsertConfigRequest upsertConfigRequest, + }); +} + +class _ResultCallAdapter extends CallAdapter, Future>> { + @override + Future> adapt(Future Function() call) => runApiSafely(call); +} diff --git a/packages/stream_chat/lib/open_api/api/default_api.g.dart b/packages/stream_chat/lib/open_api/api/default_api.g.dart new file mode 100644 index 0000000000..c29e476589 --- /dev/null +++ b/packages/stream_chat/lib/open_api/api/default_api.g.dart @@ -0,0 +1,5347 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'default_api.dart'; + +// dart format off + +// ************************************************************************** +// RetrofitGenerator +// ************************************************************************** + +// ignore_for_file: unnecessary_brace_in_string_interps,no_leading_underscores_for_local_identifiers,unused_element,unnecessary_string_interpolations,unused_element_parameter,avoid_unused_constructor_parameters,unreachable_from_main,avoid_redundant_argument_values + +class _DefaultApi implements DefaultApi { + _DefaultApi(this._dio, {this.baseUrl, this.errorLogger}); + + final Dio _dio; + + String? baseUrl; + + final ParseErrorLogger? errorLogger; + + Future _addUserGroupMembers({ + required String id, + required AddUserGroupMembersRequest addUserGroupMembersRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + final _data = {}; + _data.addAll(addUserGroupMembersRequest.toJson()); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/usergroups/${id}/members', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late AddUserGroupMembersResponse _value; + try { + _value = AddUserGroupMembersResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> addUserGroupMembers({ + required String id, + required AddUserGroupMembersRequest addUserGroupMembersRequest, + }) { + return _ResultCallAdapter().adapt( + () => _addUserGroupMembers( + id: id, + addUserGroupMembersRequest: addUserGroupMembersRequest, + ), + ); + } + + Future _appeal({required AppealRequest appealRequest}) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + final _data = {}; + _data.addAll(appealRequest.toJson()); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/moderation/appeal', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late AppealResponse _value; + try { + _value = AppealResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> appeal({ + required AppealRequest appealRequest, + }) { + return _ResultCallAdapter().adapt( + () => _appeal(appealRequest: appealRequest), + ); + } + + Future _ban({required BanRequest banRequest}) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + final _data = {}; + _data.addAll(banRequest.toJson()); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/moderation/ban', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late ModerationBanResponse _value; + try { + _value = ModerationBanResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> ban({required BanRequest banRequest}) { + return _ResultCallAdapter().adapt( + () => _ban(banRequest: banRequest), + ); + } + + Future _blockUsers({ + required BlockUsersRequest blockUsersRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + final _data = {}; + _data.addAll(blockUsersRequest.toJson()); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/users/block', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late BlockUsersResponse _value; + try { + _value = BlockUsersResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> blockUsers({ + required BlockUsersRequest blockUsersRequest, + }) { + return _ResultCallAdapter().adapt( + () => _blockUsers(blockUsersRequest: blockUsersRequest), + ); + } + + Future _bulkActionAppeals({ + required BulkActionAppealsRequest bulkActionAppealsRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + final _data = {}; + _data.addAll(bulkActionAppealsRequest.toJson()); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/moderation/appeals/bulk_action', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late BulkActionAppealsResponse _value; + try { + _value = BulkActionAppealsResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> bulkActionAppeals({ + required BulkActionAppealsRequest bulkActionAppealsRequest, + }) { + return _ResultCallAdapter().adapt( + () => _bulkActionAppeals( + bulkActionAppealsRequest: bulkActionAppealsRequest, + ), + ); + } + + Future _bulkDeleteActionConfig({ + required BulkDeleteActionConfigRequest bulkDeleteActionConfigRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + final _data = {}; + _data.addAll(bulkDeleteActionConfigRequest.toJson()); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/moderation/action_config/bulk_delete', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late BulkDeleteActionConfigResponse _value; + try { + _value = BulkDeleteActionConfigResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> bulkDeleteActionConfig({ + required BulkDeleteActionConfigRequest bulkDeleteActionConfigRequest, + }) { + return _ResultCallAdapter().adapt( + () => _bulkDeleteActionConfig( + bulkDeleteActionConfigRequest: bulkDeleteActionConfigRequest, + ), + ); + } + + Future _bulkUpsertActionConfig({ + required BulkUpsertActionConfigRequest bulkUpsertActionConfigRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + final _data = {}; + _data.addAll(bulkUpsertActionConfigRequest.toJson()); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/moderation/action_config/bulk', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late BulkUpsertActionConfigResponse _value; + try { + _value = BulkUpsertActionConfigResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> bulkUpsertActionConfig({ + required BulkUpsertActionConfigRequest bulkUpsertActionConfigRequest, + }) { + return _ResultCallAdapter().adapt( + () => _bulkUpsertActionConfig( + bulkUpsertActionConfigRequest: bulkUpsertActionConfigRequest, + ), + ); + } + + Future _castPollVote({ + required String messageId, + required String pollId, + CastPollVoteRequest? castPollVoteRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(castPollVoteRequest?.toJson() ?? {}); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/messages/${messageId}/polls/${pollId}/vote', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late PollVoteResponse _value; + try { + _value = PollVoteResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> castPollVote({ + required String messageId, + required String pollId, + CastPollVoteRequest? castPollVoteRequest, + }) { + return _ResultCallAdapter().adapt( + () => _castPollVote( + messageId: messageId, + pollId: pollId, + castPollVoteRequest: castPollVoteRequest, + ), + ); + } + + Future _createBlockList({ + required CreateBlockListRequest createBlockListRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + final _data = {}; + _data.addAll(createBlockListRequest.toJson()); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/blocklists', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late CreateBlockListResponse _value; + try { + _value = CreateBlockListResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> createBlockList({ + required CreateBlockListRequest createBlockListRequest, + }) { + return _ResultCallAdapter().adapt( + () => _createBlockList(createBlockListRequest: createBlockListRequest), + ); + } + + Future _createDevice({ + required CreateDeviceRequest createDeviceRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + final _data = {}; + _data.addAll(createDeviceRequest.toJson()); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/devices', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late DurationResponse _value; + try { + _value = DurationResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> createDevice({ + required CreateDeviceRequest createDeviceRequest, + }) { + return _ResultCallAdapter().adapt( + () => _createDevice(createDeviceRequest: createDeviceRequest), + ); + } + + Future _createDraft({ + required String type, + required String id, + required CreateDraftRequest createDraftRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + final _data = {}; + _data.addAll(createDraftRequest.toJson()); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/channels/${type}/${id}/draft', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late CreateDraftResponse _value; + try { + _value = CreateDraftResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> createDraft({ + required String type, + required String id, + required CreateDraftRequest createDraftRequest, + }) { + return _ResultCallAdapter().adapt( + () => _createDraft( + type: type, + id: id, + createDraftRequest: createDraftRequest, + ), + ); + } + + Future _createGuest({ + required CreateGuestRequest createGuestRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + final _data = {}; + _data.addAll(createGuestRequest.toJson()); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/guest', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late CreateGuestResponse _value; + try { + _value = CreateGuestResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> createGuest({ + required CreateGuestRequest createGuestRequest, + }) { + return _ResultCallAdapter().adapt( + () => _createGuest(createGuestRequest: createGuestRequest), + ); + } + + Future _createPoll({ + required CreatePollRequest createPollRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + final _data = {}; + _data.addAll(createPollRequest.toJson()); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/polls', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late PollResponse _value; + try { + _value = PollResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> createPoll({ + required CreatePollRequest createPollRequest, + }) { + return _ResultCallAdapter().adapt( + () => _createPoll(createPollRequest: createPollRequest), + ); + } + + Future _createPollOption({ + required String pollId, + required CreatePollOptionRequest createPollOptionRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + final _data = {}; + _data.addAll(createPollOptionRequest.toJson()); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/polls/${pollId}/options', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late PollOptionResponse _value; + try { + _value = PollOptionResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> createPollOption({ + required String pollId, + required CreatePollOptionRequest createPollOptionRequest, + }) { + return _ResultCallAdapter().adapt( + () => _createPollOption( + pollId: pollId, + createPollOptionRequest: createPollOptionRequest, + ), + ); + } + + Future _createQueue({ + required CreateQueueRequest createQueueRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + final _data = {}; + _data.addAll(createQueueRequest.toJson()); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/moderation/queues', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late QueueResponse _value; + try { + _value = QueueResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> createQueue({ + required CreateQueueRequest createQueueRequest, + }) { + return _ResultCallAdapter().adapt( + () => _createQueue(createQueueRequest: createQueueRequest), + ); + } + + Future _createReminder({ + required String messageId, + CreateReminderRequest? createReminderRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(createReminderRequest?.toJson() ?? {}); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/messages/${messageId}/reminders', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late ReminderResponseData _value; + try { + _value = ReminderResponseData.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> createReminder({ + required String messageId, + CreateReminderRequest? createReminderRequest, + }) { + return _ResultCallAdapter().adapt( + () => _createReminder( + messageId: messageId, + createReminderRequest: createReminderRequest, + ), + ); + } + + Future _createUserGroup({ + required CreateUserGroupRequest createUserGroupRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + final _data = {}; + _data.addAll(createUserGroupRequest.toJson()); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/usergroups', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late CreateUserGroupResponse _value; + try { + _value = CreateUserGroupResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> createUserGroup({ + required CreateUserGroupRequest createUserGroupRequest, + }) { + return _ResultCallAdapter().adapt( + () => _createUserGroup(createUserGroupRequest: createUserGroupRequest), + ); + } + + Future _deleteActionConfig({ + required String id, + }) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'DELETE', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/moderation/action_config/${id}', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late DeleteActionConfigResponse _value; + try { + _value = DeleteActionConfigResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> deleteActionConfig({ + required String id, + }) { + return _ResultCallAdapter().adapt( + () => _deleteActionConfig(id: id), + ); + } + + Future _deleteBlockList({ + required String name, + String? team, + }) async { + final _extra = {}; + final queryParameters = {r'team': team}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'DELETE', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/blocklists/${name}', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late DurationResponse _value; + try { + _value = DurationResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> deleteBlockList({ + required String name, + String? team, + }) { + return _ResultCallAdapter().adapt( + () => _deleteBlockList(name: name, team: team), + ); + } + + Future _deleteChannel({ + required String type, + required String id, + bool? hardDelete, + }) async { + final _extra = {}; + final queryParameters = {r'hard_delete': hardDelete}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'DELETE', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/channels/${type}/${id}', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late DeleteChannelResponse _value; + try { + _value = DeleteChannelResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> deleteChannel({ + required String type, + required String id, + bool? hardDelete, + }) { + return _ResultCallAdapter().adapt( + () => _deleteChannel(type: type, id: id, hardDelete: hardDelete), + ); + } + + Future _deleteChannelFile({ + required String type, + required String id, + String? url, + }) async { + final _extra = {}; + final queryParameters = {r'url': url}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'DELETE', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/channels/${type}/${id}/file', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late DurationResponse _value; + try { + _value = DurationResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> deleteChannelFile({ + required String type, + required String id, + String? url, + }) { + return _ResultCallAdapter().adapt( + () => _deleteChannelFile(type: type, id: id, url: url), + ); + } + + Future _deleteChannelImage({ + required String type, + required String id, + String? url, + }) async { + final _extra = {}; + final queryParameters = {r'url': url}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'DELETE', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/channels/${type}/${id}/image', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late DurationResponse _value; + try { + _value = DurationResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> deleteChannelImage({ + required String type, + required String id, + String? url, + }) { + return _ResultCallAdapter().adapt( + () => _deleteChannelImage(type: type, id: id, url: url), + ); + } + + Future _deleteChannels({ + required DeleteChannelsRequest deleteChannelsRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + final _data = {}; + _data.addAll(deleteChannelsRequest.toJson()); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/channels/delete', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late DeleteChannelsResponse _value; + try { + _value = DeleteChannelsResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> deleteChannels({ + required DeleteChannelsRequest deleteChannelsRequest, + }) { + return _ResultCallAdapter().adapt( + () => _deleteChannels(deleteChannelsRequest: deleteChannelsRequest), + ); + } + + Future _deleteConfig({ + required String key, + String? team, + }) async { + final _extra = {}; + final queryParameters = {r'team': team}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'DELETE', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/moderation/config/${key}', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late DeleteModerationConfigResponse _value; + try { + _value = DeleteModerationConfigResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> deleteConfig({ + required String key, + String? team, + }) { + return _ResultCallAdapter().adapt( + () => _deleteConfig(key: key, team: team), + ); + } + + Future _deleteDevice({required String id}) async { + final _extra = {}; + final queryParameters = {r'id': id}; + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'DELETE', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/devices', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late DurationResponse _value; + try { + _value = DurationResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> deleteDevice({required String id}) { + return _ResultCallAdapter().adapt( + () => _deleteDevice(id: id), + ); + } + + Future _deleteDraft({ + required String type, + required String id, + String? parentId, + }) async { + final _extra = {}; + final queryParameters = {r'parent_id': parentId}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'DELETE', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/channels/${type}/${id}/draft', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late DurationResponse _value; + try { + _value = DurationResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> deleteDraft({ + required String type, + required String id, + String? parentId, + }) { + return _ResultCallAdapter().adapt( + () => _deleteDraft(type: type, id: id, parentId: parentId), + ); + } + + Future _deleteFile({String? url}) async { + final _extra = {}; + final queryParameters = {r'url': url}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'DELETE', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/uploads/file', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late DurationResponse _value; + try { + _value = DurationResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> deleteFile({String? url}) { + return _ResultCallAdapter().adapt( + () => _deleteFile(url: url), + ); + } + + Future _deleteImage({String? url}) async { + final _extra = {}; + final queryParameters = {r'url': url}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'DELETE', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/uploads/image', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late DurationResponse _value; + try { + _value = DurationResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> deleteImage({String? url}) { + return _ResultCallAdapter().adapt( + () => _deleteImage(url: url), + ); + } + + Future _deleteMessage({ + required String id, + bool? hard, + bool? deleteForMe, + }) async { + final _extra = {}; + final queryParameters = { + r'hard': hard, + r'delete_for_me': deleteForMe, + }; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'DELETE', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/messages/${id}', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late DeleteMessageResponse _value; + try { + _value = DeleteMessageResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> deleteMessage({ + required String id, + bool? hard, + bool? deleteForMe, + }) { + return _ResultCallAdapter().adapt( + () => _deleteMessage(id: id, hard: hard, deleteForMe: deleteForMe), + ); + } + + Future _deletePoll({required String pollId}) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'DELETE', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/polls/${pollId}', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late DurationResponse _value; + try { + _value = DurationResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> deletePoll({required String pollId}) { + return _ResultCallAdapter().adapt( + () => _deletePoll(pollId: pollId), + ); + } + + Future _deletePollOption({ + required String pollId, + required String optionId, + }) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'DELETE', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/polls/${pollId}/options/${optionId}', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late DurationResponse _value; + try { + _value = DurationResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> deletePollOption({ + required String pollId, + required String optionId, + }) { + return _ResultCallAdapter().adapt( + () => _deletePollOption(pollId: pollId, optionId: optionId), + ); + } + + Future _deletePollVote({ + required String messageId, + required String pollId, + required String voteId, + }) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'DELETE', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/messages/${messageId}/polls/${pollId}/vote/${voteId}', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late PollVoteResponse _value; + try { + _value = PollVoteResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> deletePollVote({ + required String messageId, + required String pollId, + required String voteId, + }) { + return _ResultCallAdapter().adapt( + () => + _deletePollVote(messageId: messageId, pollId: pollId, voteId: voteId), + ); + } + + Future _deleteQueue({required String id}) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/moderation/queues/${id}/delete', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late QueueResponse _value; + try { + _value = QueueResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> deleteQueue({required String id}) { + return _ResultCallAdapter().adapt( + () => _deleteQueue(id: id), + ); + } + + Future _deleteReaction({ + required String id, + required String type, + }) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'DELETE', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/messages/${id}/reaction/${type}', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late DeleteReactionResponse _value; + try { + _value = DeleteReactionResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> deleteReaction({ + required String id, + required String type, + }) { + return _ResultCallAdapter().adapt( + () => _deleteReaction(id: id, type: type), + ); + } + + Future _deleteReminder({ + required String messageId, + }) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'DELETE', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/messages/${messageId}/reminders', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late DeleteReminderResponse _value; + try { + _value = DeleteReminderResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> deleteReminder({ + required String messageId, + }) { + return _ResultCallAdapter().adapt( + () => _deleteReminder(messageId: messageId), + ); + } + + Future _deleteUserGroup({ + required String id, + String? teamId, + }) async { + final _extra = {}; + final queryParameters = {r'team_id': teamId}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'DELETE', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/usergroups/${id}', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late DurationResponse _value; + try { + _value = DurationResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> deleteUserGroup({ + required String id, + String? teamId, + }) { + return _ResultCallAdapter().adapt( + () => _deleteUserGroup(id: id, teamId: teamId), + ); + } + + Future _flag({required FlagRequest flagRequest}) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + final _data = {}; + _data.addAll(flagRequest.toJson()); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/moderation/flag', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late FlagItemResponse _value; + try { + _value = FlagItemResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> flag({required FlagRequest flagRequest}) { + return _ResultCallAdapter().adapt( + () => _flag(flagRequest: flagRequest), + ); + } + + Future _getActionConfig({ + String? queueType, + String? entityType, + bool? excludeDefaults, + bool? onlyDefaults, + }) async { + final _extra = {}; + final queryParameters = { + r'queue_type': queueType, + r'entity_type': entityType, + r'exclude_defaults': excludeDefaults, + r'only_defaults': onlyDefaults, + }; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/moderation/action_config', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late GetActionConfigResponse _value; + try { + _value = GetActionConfigResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> getActionConfig({ + String? queueType, + String? entityType, + bool? excludeDefaults, + bool? onlyDefaults, + }) { + return _ResultCallAdapter().adapt( + () => _getActionConfig( + queueType: queueType, + entityType: entityType, + excludeDefaults: excludeDefaults, + onlyDefaults: onlyDefaults, + ), + ); + } + + Future _getApp() async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/app', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late GetApplicationResponse _value; + try { + _value = GetApplicationResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> getApp() { + return _ResultCallAdapter().adapt(() => _getApp()); + } + + Future _getAppeal({required String id}) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/moderation/appeal/${id}', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late GetAppealResponse _value; + try { + _value = GetAppealResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> getAppeal({required String id}) { + return _ResultCallAdapter().adapt( + () => _getAppeal(id: id), + ); + } + + Future _getBlockedUsers() async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/users/block', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late GetBlockedUsersResponse _value; + try { + _value = GetBlockedUsersResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> getBlockedUsers() { + return _ResultCallAdapter().adapt( + () => _getBlockedUsers(), + ); + } + + Future _getChannel({ + required String type, + required String id, + bool? state, + int? messagesLimit, + int? membersLimit, + int? watchersLimit, + String? messagesIdLt, + String? messagesIdLte, + String? messagesIdGt, + String? messagesIdGte, + String? messagesIdAround, + }) async { + final _extra = {}; + final queryParameters = { + r'state': state, + r'messages_limit': messagesLimit, + r'members_limit': membersLimit, + r'watchers_limit': watchersLimit, + r'messages_id_lt': messagesIdLt, + r'messages_id_lte': messagesIdLte, + r'messages_id_gt': messagesIdGt, + r'messages_id_gte': messagesIdGte, + r'messages_id_around': messagesIdAround, + }; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/channels/${type}/${id}', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late ChannelStateResponse _value; + try { + _value = ChannelStateResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> getChannel({ + required String type, + required String id, + bool? state, + int? messagesLimit, + int? membersLimit, + int? watchersLimit, + String? messagesIdLt, + String? messagesIdLte, + String? messagesIdGt, + String? messagesIdGte, + String? messagesIdAround, + }) { + return _ResultCallAdapter().adapt( + () => _getChannel( + type: type, + id: id, + state: state, + messagesLimit: messagesLimit, + membersLimit: membersLimit, + watchersLimit: watchersLimit, + messagesIdLt: messagesIdLt, + messagesIdLte: messagesIdLte, + messagesIdGt: messagesIdGt, + messagesIdGte: messagesIdGte, + messagesIdAround: messagesIdAround, + ), + ); + } + + Future _getConfig({ + required String key, + String? team, + }) async { + final _extra = {}; + final queryParameters = {r'team': team}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/moderation/config/${key}', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late GetConfigResponse _value; + try { + _value = GetConfigResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> getConfig({ + required String key, + String? team, + }) { + return _ResultCallAdapter().adapt( + () => _getConfig(key: key, team: team), + ); + } + + Future _getDraft({ + required String type, + required String id, + String? parentId, + }) async { + final _extra = {}; + final queryParameters = {r'parent_id': parentId}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/channels/${type}/${id}/draft', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late GetDraftResponse _value; + try { + _value = GetDraftResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> getDraft({ + required String type, + required String id, + String? parentId, + }) { + return _ResultCallAdapter().adapt( + () => _getDraft(type: type, id: id, parentId: parentId), + ); + } + + Future _getManyMessages({ + required String type, + required String id, + required List ids, + List? memberCustomInclude, + }) async { + final _extra = {}; + final queryParameters = { + r'ids': ids, + r'member_custom_include': memberCustomInclude, + }; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/channels/${type}/${id}/messages', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late GetManyMessagesResponse _value; + try { + _value = GetManyMessagesResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> getManyMessages({ + required String type, + required String id, + required List ids, + List? memberCustomInclude, + }) { + return _ResultCallAdapter().adapt( + () => _getManyMessages( + type: type, + id: id, + ids: ids, + memberCustomInclude: memberCustomInclude, + ), + ); + } + + Future _getMessage({required String id}) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/messages/${id}', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late GetMessageResponse _value; + try { + _value = GetMessageResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> getMessage({required String id}) { + return _ResultCallAdapter().adapt( + () => _getMessage(id: id), + ); + } + + Future _getOG({required String url}) async { + final _extra = {}; + final queryParameters = {r'url': url}; + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/og', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late GetOGResponse _value; + try { + _value = GetOGResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> getOG({required String url}) { + return _ResultCallAdapter().adapt(() => _getOG(url: url)); + } + + Future _getOrCreateChannel({ + required String type, + required String id, + ChannelGetOrCreateRequest? channelGetOrCreateRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(channelGetOrCreateRequest?.toJson() ?? {}); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/channels/${type}/${id}/query', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late ChannelStateResponse _value; + try { + _value = ChannelStateResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> getOrCreateChannel({ + required String type, + required String id, + ChannelGetOrCreateRequest? channelGetOrCreateRequest, + }) { + return _ResultCallAdapter().adapt( + () => _getOrCreateChannel( + type: type, + id: id, + channelGetOrCreateRequest: channelGetOrCreateRequest, + ), + ); + } + + Future _getOrCreateDistinctChannel({ + required String type, + ChannelGetOrCreateRequest? channelGetOrCreateRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(channelGetOrCreateRequest?.toJson() ?? {}); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/channels/${type}/query', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late ChannelStateResponse _value; + try { + _value = ChannelStateResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> getOrCreateDistinctChannel({ + required String type, + ChannelGetOrCreateRequest? channelGetOrCreateRequest, + }) { + return _ResultCallAdapter().adapt( + () => _getOrCreateDistinctChannel( + type: type, + channelGetOrCreateRequest: channelGetOrCreateRequest, + ), + ); + } + + Future _getPinnedMessages({ + required String type, + required String id, + int? limit, + int? offset, + String? idGte, + String? idGt, + String? idLte, + String? idLt, + DateTime? pinnedAtAfterOrEqual, + DateTime? pinnedAtAfter, + DateTime? pinnedAtBeforeOrEqual, + DateTime? pinnedAtBefore, + String? idAround, + DateTime? pinnedAtAround, + List? sort, + List? memberCustomInclude, + }) async { + final _extra = {}; + final queryParameters = { + r'limit': limit, + r'offset': offset, + r'id_gte': idGte, + r'id_gt': idGt, + r'id_lte': idLte, + r'id_lt': idLt, + r'pinned_at_after_or_equal': pinnedAtAfterOrEqual?.toIso8601String(), + r'pinned_at_after': pinnedAtAfter?.toIso8601String(), + r'pinned_at_before_or_equal': pinnedAtBeforeOrEqual?.toIso8601String(), + r'pinned_at_before': pinnedAtBefore?.toIso8601String(), + r'id_around': idAround, + r'pinned_at_around': pinnedAtAround?.toIso8601String(), + r'sort': sort, + r'member_custom_include': memberCustomInclude, + }; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/channels/${type}/${id}/pinned_messages', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late GetPinnedMessagesResponse _value; + try { + _value = GetPinnedMessagesResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> getPinnedMessages({ + required String type, + required String id, + int? limit, + int? offset, + String? idGte, + String? idGt, + String? idLte, + String? idLt, + DateTime? pinnedAtAfterOrEqual, + DateTime? pinnedAtAfter, + DateTime? pinnedAtBeforeOrEqual, + DateTime? pinnedAtBefore, + String? idAround, + DateTime? pinnedAtAround, + List? sort, + List? memberCustomInclude, + }) { + return _ResultCallAdapter().adapt( + () => _getPinnedMessages( + type: type, + id: id, + limit: limit, + offset: offset, + idGte: idGte, + idGt: idGt, + idLte: idLte, + idLt: idLt, + pinnedAtAfterOrEqual: pinnedAtAfterOrEqual, + pinnedAtAfter: pinnedAtAfter, + pinnedAtBeforeOrEqual: pinnedAtBeforeOrEqual, + pinnedAtBefore: pinnedAtBefore, + idAround: idAround, + pinnedAtAround: pinnedAtAround, + sort: sort, + memberCustomInclude: memberCustomInclude, + ), + ); + } + + Future _getPoll({required String pollId}) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/polls/${pollId}', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late PollResponse _value; + try { + _value = PollResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> getPoll({required String pollId}) { + return _ResultCallAdapter().adapt( + () => _getPoll(pollId: pollId), + ); + } + + Future _getPollOption({ + required String pollId, + required String optionId, + }) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/polls/${pollId}/options/${optionId}', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late PollOptionResponse _value; + try { + _value = PollOptionResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> getPollOption({ + required String pollId, + required String optionId, + }) { + return _ResultCallAdapter().adapt( + () => _getPollOption(pollId: pollId, optionId: optionId), + ); + } + + Future _getQueue({required String id}) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/moderation/queues/${id}', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late QueueResponse _value; + try { + _value = QueueResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> getQueue({required String id}) { + return _ResultCallAdapter().adapt(() => _getQueue(id: id)); + } + + Future _getReactions({ + required String id, + int? limit, + int? offset, + }) async { + final _extra = {}; + final queryParameters = { + r'limit': limit, + r'offset': offset, + }; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/messages/${id}/reactions', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late GetReactionsResponse _value; + try { + _value = GetReactionsResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> getReactions({ + required String id, + int? limit, + int? offset, + }) { + return _ResultCallAdapter().adapt( + () => _getReactions(id: id, limit: limit, offset: offset), + ); + } + + Future _getReplies({ + required String parentId, + int? limit, + String? idGte, + String? idGt, + String? idLte, + String? idLt, + String? idAround, + List? sort, + List? memberCustomInclude, + }) async { + final _extra = {}; + final queryParameters = { + r'limit': limit, + r'id_gte': idGte, + r'id_gt': idGt, + r'id_lte': idLte, + r'id_lt': idLt, + r'id_around': idAround, + r'sort': sort, + r'member_custom_include': memberCustomInclude, + }; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/messages/${parentId}/replies', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late GetRepliesResponse _value; + try { + _value = GetRepliesResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> getReplies({ + required String parentId, + int? limit, + String? idGte, + String? idGt, + String? idLte, + String? idLt, + String? idAround, + List? sort, + List? memberCustomInclude, + }) { + return _ResultCallAdapter().adapt( + () => _getReplies( + parentId: parentId, + limit: limit, + idGte: idGte, + idGt: idGt, + idLte: idLte, + idLt: idLt, + idAround: idAround, + sort: sort, + memberCustomInclude: memberCustomInclude, + ), + ); + } + + Future _getThread({ + required String messageId, + bool? watch, + int? replyLimit, + int? participantLimit, + int? memberLimit, + }) async { + final _extra = {}; + final queryParameters = { + r'watch': watch, + r'reply_limit': replyLimit, + r'participant_limit': participantLimit, + r'member_limit': memberLimit, + }; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/threads/${messageId}', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late GetThreadResponse _value; + try { + _value = GetThreadResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> getThread({ + required String messageId, + bool? watch, + int? replyLimit, + int? participantLimit, + int? memberLimit, + }) { + return _ResultCallAdapter().adapt( + () => _getThread( + messageId: messageId, + watch: watch, + replyLimit: replyLimit, + participantLimit: participantLimit, + memberLimit: memberLimit, + ), + ); + } + + Future _getUserGroup({ + required String id, + String? teamId, + }) async { + final _extra = {}; + final queryParameters = {r'team_id': teamId}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/usergroups/${id}', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late GetUserGroupResponse _value; + try { + _value = GetUserGroupResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> getUserGroup({ + required String id, + String? teamId, + }) { + return _ResultCallAdapter().adapt( + () => _getUserGroup(id: id, teamId: teamId), + ); + } + + Future _getUserLiveLocations() async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/users/live_locations', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late SharedLocationsResponse _value; + try { + _value = SharedLocationsResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> getUserLiveLocations() { + return _ResultCallAdapter().adapt( + () => _getUserLiveLocations(), + ); + } + + Future _groupedQueryChannels({ + GroupedQueryChannelsRequest? groupedQueryChannelsRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(groupedQueryChannelsRequest?.toJson() ?? {}); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/channels/grouped', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late GroupedQueryChannelsResponse _value; + try { + _value = GroupedQueryChannelsResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> groupedQueryChannels({ + GroupedQueryChannelsRequest? groupedQueryChannelsRequest, + }) { + return _ResultCallAdapter().adapt( + () => _groupedQueryChannels( + groupedQueryChannelsRequest: groupedQueryChannelsRequest, + ), + ); + } + + Future _hideChannel({ + required String type, + required String id, + HideChannelRequest? hideChannelRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(hideChannelRequest?.toJson() ?? {}); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/channels/${type}/${id}/hide', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late HideChannelResponse _value; + try { + _value = HideChannelResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> hideChannel({ + required String type, + required String id, + HideChannelRequest? hideChannelRequest, + }) { + return _ResultCallAdapter().adapt( + () => _hideChannel( + type: type, + id: id, + hideChannelRequest: hideChannelRequest, + ), + ); + } + + Future _importBlockList({ + required String id, + required ImportBlockListRequest importBlockListRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + final _data = {}; + _data.addAll(importBlockListRequest.toJson()); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/blocklists/${id}/import', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late ImportBlockListResponse _value; + try { + _value = ImportBlockListResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> importBlockList({ + required String id, + required ImportBlockListRequest importBlockListRequest, + }) { + return _ResultCallAdapter().adapt( + () => _importBlockList( + id: id, + importBlockListRequest: importBlockListRequest, + ), + ); + } + + Future _listBlockLists({ + String? team, + String? cursor, + int? limit, + }) async { + final _extra = {}; + final queryParameters = { + r'team': team, + r'cursor': cursor, + r'limit': limit, + }; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/blocklists', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late ListBlockListResponse _value; + try { + _value = ListBlockListResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> listBlockLists({ + String? team, + String? cursor, + int? limit, + }) { + return _ResultCallAdapter().adapt( + () => _listBlockLists(team: team, cursor: cursor, limit: limit), + ); + } + + Future _listDevices() async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/devices', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late ListDevicesResponse _value; + try { + _value = ListDevicesResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> listDevices() { + return _ResultCallAdapter().adapt( + () => _listDevices(), + ); + } + + Future _listQueues() async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/moderation/queues', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late ListQueuesResponse _value; + try { + _value = ListQueuesResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> listQueues() { + return _ResultCallAdapter().adapt(() => _listQueues()); + } + + Future _listUserGroups({ + int? limit, + String? idGt, + String? createdAtGt, + String? teamId, + }) async { + final _extra = {}; + final queryParameters = { + r'limit': limit, + r'id_gt': idGt, + r'created_at_gt': createdAtGt, + r'team_id': teamId, + }; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/usergroups', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late ListUserGroupsResponse _value; + try { + _value = ListUserGroupsResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> listUserGroups({ + int? limit, + String? idGt, + String? createdAtGt, + String? teamId, + }) { + return _ResultCallAdapter().adapt( + () => _listUserGroups( + limit: limit, + idGt: idGt, + createdAtGt: createdAtGt, + teamId: teamId, + ), + ); + } + + Future _longPoll({WSAuthMessage? json}) async { + final _extra = {}; + final queryParameters = {r'json': json?.toJson()}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/longpoll', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + await _dio.fetch(_options); + } + + @override + Future> longPoll({WSAuthMessage? json}) { + return _ResultCallAdapter().adapt(() => _longPoll(json: json)); + } + + Future _markChannelsRead({ + MarkChannelsReadRequest? markChannelsReadRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(markChannelsReadRequest?.toJson() ?? {}); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/channels/read', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late MarkReadResponse _value; + try { + _value = MarkReadResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> markChannelsRead({ + MarkChannelsReadRequest? markChannelsReadRequest, + }) { + return _ResultCallAdapter().adapt( + () => _markChannelsRead(markChannelsReadRequest: markChannelsReadRequest), + ); + } + + Future _markDelivered({ + MarkDeliveredRequest? markDeliveredRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(markDeliveredRequest?.toJson() ?? {}); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/channels/delivered', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late MarkDeliveredResponse _value; + try { + _value = MarkDeliveredResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> markDelivered({ + MarkDeliveredRequest? markDeliveredRequest, + }) { + return _ResultCallAdapter().adapt( + () => _markDelivered(markDeliveredRequest: markDeliveredRequest), + ); + } + + Future _markRead({ + required String type, + required String id, + MarkReadRequest? markReadRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(markReadRequest?.toJson() ?? {}); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/channels/${type}/${id}/read', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late MarkReadResponse _value; + try { + _value = MarkReadResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> markRead({ + required String type, + required String id, + MarkReadRequest? markReadRequest, + }) { + return _ResultCallAdapter().adapt( + () => _markRead(type: type, id: id, markReadRequest: markReadRequest), + ); + } + + Future _markUnread({ + required String type, + required String id, + MarkUnreadRequest? markUnreadRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(markUnreadRequest?.toJson() ?? {}); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/channels/${type}/${id}/unread', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late DurationResponse _value; + try { + _value = DurationResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> markUnread({ + required String type, + required String id, + MarkUnreadRequest? markUnreadRequest, + }) { + return _ResultCallAdapter().adapt( + () => + _markUnread(type: type, id: id, markUnreadRequest: markUnreadRequest), + ); + } + + Future _mute({required MuteRequest muteRequest}) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + final _data = {}; + _data.addAll(muteRequest.toJson()); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/moderation/mute', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late MuteResponse _value; + try { + _value = MuteResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> mute({required MuteRequest muteRequest}) { + return _ResultCallAdapter().adapt( + () => _mute(muteRequest: muteRequest), + ); + } + + Future _muteChannel({ + MuteChannelRequest? muteChannelRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(muteChannelRequest?.toJson() ?? {}); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/moderation/mute/channel', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late MuteChannelResponse _value; + try { + _value = MuteChannelResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> muteChannel({ + MuteChannelRequest? muteChannelRequest, + }) { + return _ResultCallAdapter().adapt( + () => _muteChannel(muteChannelRequest: muteChannelRequest), + ); + } + + Future _queryAppeals({ + QueryAppealsRequest? queryAppealsRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(queryAppealsRequest?.toJson() ?? {}); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/moderation/appeals', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late QueryAppealsResponse _value; + try { + _value = QueryAppealsResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> queryAppeals({ + QueryAppealsRequest? queryAppealsRequest, + }) { + return _ResultCallAdapter().adapt( + () => _queryAppeals(queryAppealsRequest: queryAppealsRequest), + ); + } + + Future _queryBannedUsers({ + QueryBannedUsersPayload? payload, + }) async { + final _extra = {}; + final queryParameters = {r'payload': payload?.toJson()}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/query_banned_users', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late QueryBannedUsersResponse _value; + try { + _value = QueryBannedUsersResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> queryBannedUsers({ + QueryBannedUsersPayload? payload, + }) { + return _ResultCallAdapter().adapt( + () => _queryBannedUsers(payload: payload), + ); + } + + Future _queryChannels({ + QueryChannelsRequest? queryChannelsRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(queryChannelsRequest?.toJson() ?? {}); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/channels', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late QueryChannelsResponse _value; + try { + _value = QueryChannelsResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> queryChannels({ + QueryChannelsRequest? queryChannelsRequest, + }) { + return _ResultCallAdapter().adapt( + () => _queryChannels(queryChannelsRequest: queryChannelsRequest), + ); + } + + Future _queryDrafts({ + QueryDraftsRequest? queryDraftsRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(queryDraftsRequest?.toJson() ?? {}); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/drafts/query', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late QueryDraftsResponse _value; + try { + _value = QueryDraftsResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> queryDrafts({ + QueryDraftsRequest? queryDraftsRequest, + }) { + return _ResultCallAdapter().adapt( + () => _queryDrafts(queryDraftsRequest: queryDraftsRequest), + ); + } + + Future _queryFutureChannelBans({ + QueryFutureChannelBansPayload? payload, + }) async { + final _extra = {}; + final queryParameters = {r'payload': payload?.toJson()}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/query_future_channel_bans', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late QueryFutureChannelBansResponse _value; + try { + _value = QueryFutureChannelBansResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> queryFutureChannelBans({ + QueryFutureChannelBansPayload? payload, + }) { + return _ResultCallAdapter().adapt( + () => _queryFutureChannelBans(payload: payload), + ); + } + + Future _queryMembers({QueryMembersPayload? payload}) async { + final _extra = {}; + final queryParameters = {r'payload': payload?.toJson()}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/members', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late MembersResponse _value; + try { + _value = MembersResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> queryMembers({QueryMembersPayload? payload}) { + return _ResultCallAdapter().adapt( + () => _queryMembers(payload: payload), + ); + } + + Future _queryMessageFlags({ + QueryMessageFlagsPayload? payload, + }) async { + final _extra = {}; + final queryParameters = {r'payload': payload?.toJson()}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/moderation/flags/message', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late QueryMessageFlagsResponse _value; + try { + _value = QueryMessageFlagsResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> queryMessageFlags({ + QueryMessageFlagsPayload? payload, + }) { + return _ResultCallAdapter().adapt( + () => _queryMessageFlags(payload: payload), + ); + } + + Future _queryModerationConfigs({ + QueryModerationConfigsRequest? queryModerationConfigsRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll( + queryModerationConfigsRequest?.toJson() ?? {}, + ); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/moderation/configs', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late QueryModerationConfigsResponse _value; + try { + _value = QueryModerationConfigsResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> queryModerationConfigs({ + QueryModerationConfigsRequest? queryModerationConfigsRequest, + }) { + return _ResultCallAdapter().adapt( + () => _queryModerationConfigs( + queryModerationConfigsRequest: queryModerationConfigsRequest, + ), + ); + } + + Future _queryPollVotes({ + required String pollId, + QueryPollVotesRequest? queryPollVotesRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(queryPollVotesRequest?.toJson() ?? {}); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/polls/${pollId}/votes', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late PollVotesResponse _value; + try { + _value = PollVotesResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> queryPollVotes({ + required String pollId, + QueryPollVotesRequest? queryPollVotesRequest, + }) { + return _ResultCallAdapter().adapt( + () => _queryPollVotes( + pollId: pollId, + queryPollVotesRequest: queryPollVotesRequest, + ), + ); + } + + Future _queryPolls({ + QueryPollsRequest? queryPollsRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(queryPollsRequest?.toJson() ?? {}); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/polls/query', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late QueryPollsResponse _value; + try { + _value = QueryPollsResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> queryPolls({ + QueryPollsRequest? queryPollsRequest, + }) { + return _ResultCallAdapter().adapt( + () => _queryPolls(queryPollsRequest: queryPollsRequest), + ); + } + + Future _queryReactions({ + required String id, + QueryReactionsRequest? queryReactionsRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(queryReactionsRequest?.toJson() ?? {}); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/messages/${id}/reactions', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late QueryReactionsResponse _value; + try { + _value = QueryReactionsResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> queryReactions({ + required String id, + QueryReactionsRequest? queryReactionsRequest, + }) { + return _ResultCallAdapter().adapt( + () => + _queryReactions(id: id, queryReactionsRequest: queryReactionsRequest), + ); + } + + Future _queryReminders({ + QueryRemindersRequest? queryRemindersRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(queryRemindersRequest?.toJson() ?? {}); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/reminders/query', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late QueryRemindersResponse _value; + try { + _value = QueryRemindersResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> queryReminders({ + QueryRemindersRequest? queryRemindersRequest, + }) { + return _ResultCallAdapter().adapt( + () => _queryReminders(queryRemindersRequest: queryRemindersRequest), + ); + } + + Future _queryReviewQueue({ + QueryReviewQueueRequest? queryReviewQueueRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(queryReviewQueueRequest?.toJson() ?? {}); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/moderation/review_queue', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late QueryReviewQueueResponse _value; + try { + _value = QueryReviewQueueResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> queryReviewQueue({ + QueryReviewQueueRequest? queryReviewQueueRequest, + }) { + return _ResultCallAdapter().adapt( + () => _queryReviewQueue(queryReviewQueueRequest: queryReviewQueueRequest), + ); + } + + Future _queryThreads({ + QueryThreadsRequest? queryThreadsRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(queryThreadsRequest?.toJson() ?? {}); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/threads', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late QueryThreadsResponse _value; + try { + _value = QueryThreadsResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> queryThreads({ + QueryThreadsRequest? queryThreadsRequest, + }) { + return _ResultCallAdapter().adapt( + () => _queryThreads(queryThreadsRequest: queryThreadsRequest), + ); + } + + Future _queryUsers({QueryUsersPayload? payload}) async { + final _extra = {}; + final queryParameters = {r'payload': payload?.toJson()}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/users', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late QueryUsersResponse _value; + try { + _value = QueryUsersResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> queryUsers({QueryUsersPayload? payload}) { + return _ResultCallAdapter().adapt( + () => _queryUsers(payload: payload), + ); + } + + Future _removeUserGroupMembers({ + required String id, + required RemoveUserGroupMembersRequest removeUserGroupMembersRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + final _data = {}; + _data.addAll(removeUserGroupMembersRequest.toJson()); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/usergroups/${id}/members/delete', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late RemoveUserGroupMembersResponse _value; + try { + _value = RemoveUserGroupMembersResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> removeUserGroupMembers({ + required String id, + required RemoveUserGroupMembersRequest removeUserGroupMembersRequest, + }) { + return _ResultCallAdapter().adapt( + () => _removeUserGroupMembers( + id: id, + removeUserGroupMembersRequest: removeUserGroupMembersRequest, + ), + ); + } + + Future _runMessageAction({ + required String id, + required MessageActionRequest messageActionRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + final _data = {}; + _data.addAll(messageActionRequest.toJson()); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/messages/${id}/action', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late MessageActionResponse _value; + try { + _value = MessageActionResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> runMessageAction({ + required String id, + required MessageActionRequest messageActionRequest, + }) { + return _ResultCallAdapter().adapt( + () => + _runMessageAction(id: id, messageActionRequest: messageActionRequest), + ); + } + + Future _search({SearchPayload? payload}) async { + final _extra = {}; + final queryParameters = {r'payload': payload?.toJson()}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/search', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late SearchResponse _value; + try { + _value = SearchResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> search({SearchPayload? payload}) { + return _ResultCallAdapter().adapt( + () => _search(payload: payload), + ); + } + + Future _searchRoles({ + required String query, + int? limit, + String? nameGt, + String? roleType, + bool? includeGlobalRoles, + }) async { + final _extra = {}; + final queryParameters = { + r'query': query, + r'limit': limit, + r'name_gt': nameGt, + r'role_type': roleType, + r'include_global_roles': includeGlobalRoles, + }; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/roles/search', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late SearchRolesResponse _value; + try { + _value = SearchRolesResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> searchRoles({ + required String query, + int? limit, + String? nameGt, + String? roleType, + bool? includeGlobalRoles, + }) { + return _ResultCallAdapter().adapt( + () => _searchRoles( + query: query, + limit: limit, + nameGt: nameGt, + roleType: roleType, + includeGlobalRoles: includeGlobalRoles, + ), + ); + } + + Future _searchUserGroups({ + required String query, + int? limit, + String? nameGt, + String? idGt, + String? teamId, + }) async { + final _extra = {}; + final queryParameters = { + r'query': query, + r'limit': limit, + r'name_gt': nameGt, + r'id_gt': idGt, + r'team_id': teamId, + }; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/usergroups/search', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late SearchUserGroupsResponse _value; + try { + _value = SearchUserGroupsResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> searchUserGroups({ + required String query, + int? limit, + String? nameGt, + String? idGt, + String? teamId, + }) { + return _ResultCallAdapter().adapt( + () => _searchUserGroups( + query: query, + limit: limit, + nameGt: nameGt, + idGt: idGt, + teamId: teamId, + ), + ); + } + + Future _sendEvent({ + required String type, + required String id, + required SendEventRequest sendEventRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + final _data = {}; + _data.addAll(sendEventRequest.toJson()); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/channels/${type}/${id}/event', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late EventResponse _value; + try { + _value = EventResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> sendEvent({ + required String type, + required String id, + required SendEventRequest sendEventRequest, + }) { + return _ResultCallAdapter().adapt( + () => _sendEvent(type: type, id: id, sendEventRequest: sendEventRequest), + ); + } + + Future _sendMessage({ + required String type, + required String id, + required SendMessageRequest sendMessageRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + final _data = {}; + _data.addAll(sendMessageRequest.toJson()); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/channels/${type}/${id}/message', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late SendMessageResponse _value; + try { + _value = SendMessageResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> sendMessage({ + required String type, + required String id, + required SendMessageRequest sendMessageRequest, + }) { + return _ResultCallAdapter().adapt( + () => _sendMessage( + type: type, + id: id, + sendMessageRequest: sendMessageRequest, + ), + ); + } + + Future _sendReaction({ + required String id, + required SendReactionRequest sendReactionRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + final _data = {}; + _data.addAll(sendReactionRequest.toJson()); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/messages/${id}/reaction', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late SendReactionResponse _value; + try { + _value = SendReactionResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> sendReaction({ + required String id, + required SendReactionRequest sendReactionRequest, + }) { + return _ResultCallAdapter().adapt( + () => _sendReaction(id: id, sendReactionRequest: sendReactionRequest), + ); + } + + Future _showChannel({ + required String type, + required String id, + }) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/channels/${type}/${id}/show', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late ShowChannelResponse _value; + try { + _value = ShowChannelResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> showChannel({ + required String type, + required String id, + }) { + return _ResultCallAdapter().adapt( + () => _showChannel(type: type, id: id), + ); + } + + Future _stopWatchingChannel({ + required String type, + required String id, + }) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/channels/${type}/${id}/stop-watching', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late DurationResponse _value; + try { + _value = DurationResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> stopWatchingChannel({ + required String type, + required String id, + }) { + return _ResultCallAdapter().adapt( + () => _stopWatchingChannel(type: type, id: id), + ); + } + + Future _submitAction({ + required SubmitActionRequest submitActionRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + final _data = {}; + _data.addAll(submitActionRequest.toJson()); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/moderation/submit_action', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late SubmitActionResponse _value; + try { + _value = SubmitActionResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> submitAction({ + required SubmitActionRequest submitActionRequest, + }) { + return _ResultCallAdapter().adapt( + () => _submitAction(submitActionRequest: submitActionRequest), + ); + } + + Future _sync({ + bool? withInaccessibleCids, + bool? watch, + required SyncRequest syncRequest, + }) async { + final _extra = {}; + final queryParameters = { + r'with_inaccessible_cids': withInaccessibleCids, + r'watch': watch, + }; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(syncRequest.toJson()); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/sync', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late SyncResponse _value; + try { + _value = SyncResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> sync({ + bool? withInaccessibleCids, + bool? watch, + required SyncRequest syncRequest, + }) { + return _ResultCallAdapter().adapt( + () => _sync( + withInaccessibleCids: withInaccessibleCids, + watch: watch, + syncRequest: syncRequest, + ), + ); + } + + Future _translateMessage({ + required String id, + required TranslateMessageRequest translateMessageRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + final _data = {}; + _data.addAll(translateMessageRequest.toJson()); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/messages/${id}/translate', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late MessageActionResponse _value; + try { + _value = MessageActionResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> translateMessage({ + required String id, + required TranslateMessageRequest translateMessageRequest, + }) { + return _ResultCallAdapter().adapt( + () => _translateMessage( + id: id, + translateMessageRequest: translateMessageRequest, + ), + ); + } + + Future _truncateChannel({ + required String type, + required String id, + TruncateChannelRequest? truncateChannelRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(truncateChannelRequest?.toJson() ?? {}); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/channels/${type}/${id}/truncate', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late TruncateChannelResponse _value; + try { + _value = TruncateChannelResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> truncateChannel({ + required String type, + required String id, + TruncateChannelRequest? truncateChannelRequest, + }) { + return _ResultCallAdapter().adapt( + () => _truncateChannel( + type: type, + id: id, + truncateChannelRequest: truncateChannelRequest, + ), + ); + } + + Future _unblockUsers({ + required UnblockUsersRequest unblockUsersRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + final _data = {}; + _data.addAll(unblockUsersRequest.toJson()); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/users/unblock', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late UnblockUsersResponse _value; + try { + _value = UnblockUsersResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> unblockUsers({ + required UnblockUsersRequest unblockUsersRequest, + }) { + return _ResultCallAdapter().adapt( + () => _unblockUsers(unblockUsersRequest: unblockUsersRequest), + ); + } + + Future _unmute({required UnmuteRequest unmuteRequest}) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + final _data = {}; + _data.addAll(unmuteRequest.toJson()); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/moderation/unmute', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late UnmuteResponse _value; + try { + _value = UnmuteResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> unmute({ + required UnmuteRequest unmuteRequest, + }) { + return _ResultCallAdapter().adapt( + () => _unmute(unmuteRequest: unmuteRequest), + ); + } + + Future _unmuteChannel({ + UnmuteChannelRequest? unmuteChannelRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(unmuteChannelRequest?.toJson() ?? {}); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/moderation/unmute/channel', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late UnmuteResponse _value; + try { + _value = UnmuteResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> unmuteChannel({ + UnmuteChannelRequest? unmuteChannelRequest, + }) { + return _ResultCallAdapter().adapt( + () => _unmuteChannel(unmuteChannelRequest: unmuteChannelRequest), + ); + } + + Future _unreadCounts() async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/unread', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late WrappedUnreadCountsResponse _value; + try { + _value = WrappedUnreadCountsResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> unreadCounts() { + return _ResultCallAdapter().adapt( + () => _unreadCounts(), + ); + } + + Future _updateBlockList({ + required String name, + UpdateBlockListRequest? updateBlockListRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(updateBlockListRequest?.toJson() ?? {}); + final _options = _setStreamType>( + Options(method: 'PUT', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/blocklists/${name}', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late UpdateBlockListResponse _value; + try { + _value = UpdateBlockListResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> updateBlockList({ + required String name, + UpdateBlockListRequest? updateBlockListRequest, + }) { + return _ResultCallAdapter().adapt( + () => _updateBlockList( + name: name, + updateBlockListRequest: updateBlockListRequest, + ), + ); + } + + Future _updateChannel({ + required String type, + required String id, + UpdateChannelRequest? updateChannelRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(updateChannelRequest?.toJson() ?? {}); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/channels/${type}/${id}', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late UpdateChannelResponse _value; + try { + _value = UpdateChannelResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> updateChannel({ + required String type, + required String id, + UpdateChannelRequest? updateChannelRequest, + }) { + return _ResultCallAdapter().adapt( + () => _updateChannel( + type: type, + id: id, + updateChannelRequest: updateChannelRequest, + ), + ); + } + + Future _updateChannelPartial({ + required String type, + required String id, + UpdateChannelPartialRequest? updateChannelPartialRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(updateChannelPartialRequest?.toJson() ?? {}); + final _options = _setStreamType>( + Options(method: 'PATCH', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/channels/${type}/${id}', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late UpdateChannelPartialResponse _value; + try { + _value = UpdateChannelPartialResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> updateChannelPartial({ + required String type, + required String id, + UpdateChannelPartialRequest? updateChannelPartialRequest, + }) { + return _ResultCallAdapter().adapt( + () => _updateChannelPartial( + type: type, + id: id, + updateChannelPartialRequest: updateChannelPartialRequest, + ), + ); + } + + Future _updateLiveLocation({ + required UpdateLiveLocationRequest updateLiveLocationRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + final _data = {}; + _data.addAll(updateLiveLocationRequest.toJson()); + final _options = _setStreamType>( + Options(method: 'PUT', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/users/live_locations', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late SharedLocationResponse _value; + try { + _value = SharedLocationResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> updateLiveLocation({ + required UpdateLiveLocationRequest updateLiveLocationRequest, + }) { + return _ResultCallAdapter().adapt( + () => _updateLiveLocation( + updateLiveLocationRequest: updateLiveLocationRequest, + ), + ); + } + + Future _updateMemberPartial({ + required String type, + required String id, + UpdateMemberPartialRequest? updateMemberPartialRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(updateMemberPartialRequest?.toJson() ?? {}); + final _options = _setStreamType>( + Options(method: 'PATCH', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/channels/${type}/${id}/member', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late UpdateMemberPartialResponse _value; + try { + _value = UpdateMemberPartialResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> updateMemberPartial({ + required String type, + required String id, + UpdateMemberPartialRequest? updateMemberPartialRequest, + }) { + return _ResultCallAdapter().adapt( + () => _updateMemberPartial( + type: type, + id: id, + updateMemberPartialRequest: updateMemberPartialRequest, + ), + ); + } + + Future _updateMessage({ + required String id, + required UpdateMessageRequest updateMessageRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + final _data = {}; + _data.addAll(updateMessageRequest.toJson()); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/messages/${id}', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late UpdateMessageResponse _value; + try { + _value = UpdateMessageResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> updateMessage({ + required String id, + required UpdateMessageRequest updateMessageRequest, + }) { + return _ResultCallAdapter().adapt( + () => _updateMessage(id: id, updateMessageRequest: updateMessageRequest), + ); + } + + Future _updateMessagePartial({ + required String id, + UpdateMessagePartialRequest? updateMessagePartialRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(updateMessagePartialRequest?.toJson() ?? {}); + final _options = _setStreamType>( + Options(method: 'PUT', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/messages/${id}', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late UpdateMessagePartialResponse _value; + try { + _value = UpdateMessagePartialResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> updateMessagePartial({ + required String id, + UpdateMessagePartialRequest? updateMessagePartialRequest, + }) { + return _ResultCallAdapter().adapt( + () => _updateMessagePartial( + id: id, + updateMessagePartialRequest: updateMessagePartialRequest, + ), + ); + } + + Future _updatePoll({ + required UpdatePollRequest updatePollRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + final _data = {}; + _data.addAll(updatePollRequest.toJson()); + final _options = _setStreamType>( + Options(method: 'PUT', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/polls', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late PollResponse _value; + try { + _value = PollResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> updatePoll({ + required UpdatePollRequest updatePollRequest, + }) { + return _ResultCallAdapter().adapt( + () => _updatePoll(updatePollRequest: updatePollRequest), + ); + } + + Future _updatePollOption({ + required String pollId, + required UpdatePollOptionRequest updatePollOptionRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + final _data = {}; + _data.addAll(updatePollOptionRequest.toJson()); + final _options = _setStreamType>( + Options(method: 'PUT', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/polls/${pollId}/options', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late PollOptionResponse _value; + try { + _value = PollOptionResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> updatePollOption({ + required String pollId, + required UpdatePollOptionRequest updatePollOptionRequest, + }) { + return _ResultCallAdapter().adapt( + () => _updatePollOption( + pollId: pollId, + updatePollOptionRequest: updatePollOptionRequest, + ), + ); + } + + Future _updatePollPartial({ + required String pollId, + UpdatePollPartialRequest? updatePollPartialRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(updatePollPartialRequest?.toJson() ?? {}); + final _options = _setStreamType>( + Options(method: 'PATCH', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/polls/${pollId}', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late PollResponse _value; + try { + _value = PollResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> updatePollPartial({ + required String pollId, + UpdatePollPartialRequest? updatePollPartialRequest, + }) { + return _ResultCallAdapter().adapt( + () => _updatePollPartial( + pollId: pollId, + updatePollPartialRequest: updatePollPartialRequest, + ), + ); + } + + Future _updatePushNotificationPreferences({ + required UpsertPushPreferencesRequest upsertPushPreferencesRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + final _data = {}; + _data.addAll(upsertPushPreferencesRequest.toJson()); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/push_preferences', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late UpsertPushPreferencesResponse _value; + try { + _value = UpsertPushPreferencesResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> + updatePushNotificationPreferences({ + required UpsertPushPreferencesRequest upsertPushPreferencesRequest, + }) { + return _ResultCallAdapter().adapt( + () => _updatePushNotificationPreferences( + upsertPushPreferencesRequest: upsertPushPreferencesRequest, + ), + ); + } + + Future _updateQueue({ + required String id, + UpdateQueueRequest? updateQueueRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(updateQueueRequest?.toJson() ?? {}); + final _options = _setStreamType>( + Options(method: 'PATCH', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/moderation/queues/${id}', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late QueueResponse _value; + try { + _value = QueueResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> updateQueue({ + required String id, + UpdateQueueRequest? updateQueueRequest, + }) { + return _ResultCallAdapter().adapt( + () => _updateQueue(id: id, updateQueueRequest: updateQueueRequest), + ); + } + + Future _updateReminder({ + required String messageId, + UpdateReminderRequest? updateReminderRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(updateReminderRequest?.toJson() ?? {}); + final _options = _setStreamType>( + Options(method: 'PATCH', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/messages/${messageId}/reminders', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late UpdateReminderResponse _value; + try { + _value = UpdateReminderResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> updateReminder({ + required String messageId, + UpdateReminderRequest? updateReminderRequest, + }) { + return _ResultCallAdapter().adapt( + () => _updateReminder( + messageId: messageId, + updateReminderRequest: updateReminderRequest, + ), + ); + } + + Future _updateThreadPartial({ + required String messageId, + UpdateThreadPartialRequest? updateThreadPartialRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(updateThreadPartialRequest?.toJson() ?? {}); + final _options = _setStreamType>( + Options(method: 'PATCH', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/threads/${messageId}', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late UpdateThreadPartialResponse _value; + try { + _value = UpdateThreadPartialResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> updateThreadPartial({ + required String messageId, + UpdateThreadPartialRequest? updateThreadPartialRequest, + }) { + return _ResultCallAdapter().adapt( + () => _updateThreadPartial( + messageId: messageId, + updateThreadPartialRequest: updateThreadPartialRequest, + ), + ); + } + + Future _updateUserGroup({ + required String id, + UpdateUserGroupRequest? updateUserGroupRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(updateUserGroupRequest?.toJson() ?? {}); + final _options = _setStreamType>( + Options(method: 'PUT', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/usergroups/${id}', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late UpdateUserGroupResponse _value; + try { + _value = UpdateUserGroupResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> updateUserGroup({ + required String id, + UpdateUserGroupRequest? updateUserGroupRequest, + }) { + return _ResultCallAdapter().adapt( + () => _updateUserGroup( + id: id, + updateUserGroupRequest: updateUserGroupRequest, + ), + ); + } + + Future _updateUsers({ + required UpdateUsersRequest updateUsersRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + final _data = {}; + _data.addAll(updateUsersRequest.toJson()); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/users', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late UpdateUsersResponse _value; + try { + _value = UpdateUsersResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> updateUsers({ + required UpdateUsersRequest updateUsersRequest, + }) { + return _ResultCallAdapter().adapt( + () => _updateUsers(updateUsersRequest: updateUsersRequest), + ); + } + + Future _updateUsersPartial({ + required UpdateUsersPartialRequest updateUsersPartialRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + final _data = {}; + _data.addAll(updateUsersPartialRequest.toJson()); + final _options = _setStreamType>( + Options(method: 'PATCH', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/users', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late UpdateUsersResponse _value; + try { + _value = UpdateUsersResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> updateUsersPartial({ + required UpdateUsersPartialRequest updateUsersPartialRequest, + }) { + return _ResultCallAdapter().adapt( + () => _updateUsersPartial( + updateUsersPartialRequest: updateUsersPartialRequest, + ), + ); + } + + Future _uploadChannelFile({ + required String type, + required String id, + UploadChannelFileRequest? uploadChannelFileRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(uploadChannelFileRequest?.toJson() ?? {}); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/channels/${type}/${id}/file', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late UploadChannelFileResponse _value; + try { + _value = UploadChannelFileResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> uploadChannelFile({ + required String type, + required String id, + UploadChannelFileRequest? uploadChannelFileRequest, + }) { + return _ResultCallAdapter().adapt( + () => _uploadChannelFile( + type: type, + id: id, + uploadChannelFileRequest: uploadChannelFileRequest, + ), + ); + } + + Future _uploadChannelImage({ + required String type, + required String id, + UploadChannelRequest? uploadChannelRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(uploadChannelRequest?.toJson() ?? {}); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/channels/${type}/${id}/image', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late UploadChannelResponse _value; + try { + _value = UploadChannelResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> uploadChannelImage({ + required String type, + required String id, + UploadChannelRequest? uploadChannelRequest, + }) { + return _ResultCallAdapter().adapt( + () => _uploadChannelImage( + type: type, + id: id, + uploadChannelRequest: uploadChannelRequest, + ), + ); + } + + Future _uploadFile({ + FileUploadRequest? fileUploadRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(fileUploadRequest?.toJson() ?? {}); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/uploads/file', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late FileUploadResponse _value; + try { + _value = FileUploadResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> uploadFile({ + FileUploadRequest? fileUploadRequest, + }) { + return _ResultCallAdapter().adapt( + () => _uploadFile(fileUploadRequest: fileUploadRequest), + ); + } + + Future _uploadImage({ + ImageUploadRequest? imageUploadRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(imageUploadRequest?.toJson() ?? {}); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/uploads/image', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late ImageUploadResponse _value; + try { + _value = ImageUploadResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> uploadImage({ + ImageUploadRequest? imageUploadRequest, + }) { + return _ResultCallAdapter().adapt( + () => _uploadImage(imageUploadRequest: imageUploadRequest), + ); + } + + Future _upsertActionConfig({ + required UpsertActionConfigRequest upsertActionConfigRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + final _data = {}; + _data.addAll(upsertActionConfigRequest.toJson()); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/moderation/action_config', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late UpsertActionConfigResponse _value; + try { + _value = UpsertActionConfigResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> upsertActionConfig({ + required UpsertActionConfigRequest upsertActionConfigRequest, + }) { + return _ResultCallAdapter().adapt( + () => _upsertActionConfig( + upsertActionConfigRequest: upsertActionConfigRequest, + ), + ); + } + + Future _upsertConfig({ + required UpsertConfigRequest upsertConfigRequest, + }) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + final _data = {}; + _data.addAll(upsertConfigRequest.toJson()); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/moderation/config', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late UpsertConfigResponse _value; + try { + _value = UpsertConfigResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> upsertConfig({ + required UpsertConfigRequest upsertConfigRequest, + }) { + return _ResultCallAdapter().adapt( + () => _upsertConfig(upsertConfigRequest: upsertConfigRequest), + ); + } + + RequestOptions _setStreamType(RequestOptions requestOptions) { + if (T != dynamic && + !(requestOptions.responseType == ResponseType.bytes || + requestOptions.responseType == ResponseType.stream)) { + if (T == String) { + requestOptions.responseType = ResponseType.plain; + } else { + requestOptions.responseType = ResponseType.json; + } + } + return requestOptions; + } + + String _combineBaseUrls(String dioBaseUrl, String? baseUrl) { + if (baseUrl == null || baseUrl.trim().isEmpty) { + return dioBaseUrl; + } + + final url = Uri.parse(baseUrl); + + if (url.isAbsolute) { + return url.toString(); + } + + return Uri.parse(dioBaseUrl).resolveUri(url).toString(); + } +} + +// dart format on diff --git a/packages/stream_chat/lib/open_api/model/action.dart b/packages/stream_chat/lib/open_api/model/action.dart new file mode 100644 index 0000000000..316b6458e0 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/action.dart @@ -0,0 +1,51 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'action.g.dart'; +part 'action.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class Action with _$Action { + const Action({ + required this.name, + this.style, + required this.text, + required this.type, + this.value, + }); + + @override + @JsonKey(name: 'name') + final String name; + + @override + @JsonKey(name: 'style') + final String? style; + + @override + @JsonKey(name: 'text') + final String text; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'value') + final String? value; + + Map toJson() => _$ActionToJson(this); + + static Action fromJson(Map json) => _$ActionFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/action.freezed.dart b/packages/stream_chat/lib/open_api/model/action.freezed.dart new file mode 100644 index 0000000000..65a7e3738e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/action.freezed.dart @@ -0,0 +1,105 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'action.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$Action { + String get name; + String? get style; + String get text; + String get type; + String? get value; + + /// Create a copy of Action + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ActionCopyWith get copyWith => _$ActionCopyWithImpl(this as Action, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is Action && + (identical(other.name, name) || other.name == name) && + (identical(other.style, style) || other.style == style) && + (identical(other.text, text) || other.text == text) && + (identical(other.type, type) || other.type == type) && + (identical(other.value, value) || other.value == value)); + } + + @override + int get hashCode => Object.hash(runtimeType, name, style, text, type, value); + + @override + String toString() { + return 'Action(name: $name, style: $style, text: $text, type: $type, value: $value)'; + } +} + +/// @nodoc +abstract mixin class $ActionCopyWith<$Res> { + factory $ActionCopyWith(Action value, $Res Function(Action) _then) = _$ActionCopyWithImpl; + @useResult + $Res call({ + String name, + String? style, + String text, + String type, + String? value, + }); +} + +/// @nodoc +class _$ActionCopyWithImpl<$Res> implements $ActionCopyWith<$Res> { + _$ActionCopyWithImpl(this._self, this._then); + + final Action _self; + final $Res Function(Action) _then; + + /// Create a copy of Action + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? name = null, + Object? style = freezed, + Object? text = null, + Object? type = null, + Object? value = freezed, + }) { + return _then( + Action( + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + style: freezed == style + ? _self.style + : style // ignore: cast_nullable_to_non_nullable + as String?, + text: null == text + ? _self.text + : text // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + value: freezed == value + ? _self.value + : value // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/action.g.dart b/packages/stream_chat/lib/open_api/model/action.g.dart new file mode 100644 index 0000000000..690ad47f2a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/action.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'action.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +Action _$ActionFromJson(Map json) => Action( + name: json['name'] as String, + style: json['style'] as String?, + text: json['text'] as String, + type: json['type'] as String, + value: json['value'] as String?, +); + +Map _$ActionToJson(Action instance) => { + 'name': instance.name, + 'style': instance.style, + 'text': instance.text, + 'type': instance.type, + 'value': instance.value, +}; diff --git a/packages/stream_chat/lib/open_api/model/action_log_response.dart b/packages/stream_chat/lib/open_api/model/action_log_response.dart new file mode 100644 index 0000000000..01c80c1a37 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/action_log_response.dart @@ -0,0 +1,87 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'action_log_response.g.dart'; +part 'action_log_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ActionLogResponse with _$ActionLogResponse { + const ActionLogResponse({ + required this.aiProviders, + required this.createdAt, + required this.custom, + required this.id, + required this.reason, + required this.reporterType, + this.reviewQueueItem, + this.targetUser, + required this.targetUserId, + required this.type, + this.user, + required this.userId, + }); + + @override + @JsonKey(name: 'ai_providers') + final List aiProviders; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'id') + final String id; + + @override + @JsonKey(name: 'reason') + final String reason; + + @override + @JsonKey(name: 'reporter_type') + final String reporterType; + + @override + @JsonKey(name: 'review_queue_item') + final ReviewQueueItemResponse? reviewQueueItem; + + @override + @JsonKey(name: 'target_user') + final UserResponse? targetUser; + + @override + @JsonKey(name: 'target_user_id') + final String targetUserId; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'user') + final UserResponse? user; + + @override + @JsonKey(name: 'user_id') + final String userId; + + Map toJson() => _$ActionLogResponseToJson(this); + + static ActionLogResponse fromJson(Map json) => _$ActionLogResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/action_log_response.freezed.dart b/packages/stream_chat/lib/open_api/model/action_log_response.freezed.dart new file mode 100644 index 0000000000..797c578618 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/action_log_response.freezed.dart @@ -0,0 +1,184 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'action_log_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ActionLogResponse { + List get aiProviders; + DateTime get createdAt; + Map get custom; + String get id; + String get reason; + String get reporterType; + ReviewQueueItemResponse? get reviewQueueItem; + UserResponse? get targetUser; + String get targetUserId; + String get type; + UserResponse? get user; + String get userId; + + /// Create a copy of ActionLogResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ActionLogResponseCopyWith get copyWith => _$ActionLogResponseCopyWithImpl( + this as ActionLogResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ActionLogResponse && + const DeepCollectionEquality().equals( + other.aiProviders, + aiProviders, + ) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.id, id) || other.id == id) && + (identical(other.reason, reason) || other.reason == reason) && + (identical(other.reporterType, reporterType) || other.reporterType == reporterType) && + (identical(other.reviewQueueItem, reviewQueueItem) || other.reviewQueueItem == reviewQueueItem) && + (identical(other.targetUser, targetUser) || other.targetUser == targetUser) && + (identical(other.targetUserId, targetUserId) || other.targetUserId == targetUserId) && + (identical(other.type, type) || other.type == type) && + (identical(other.user, user) || other.user == user) && + (identical(other.userId, userId) || other.userId == userId)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(aiProviders), + createdAt, + const DeepCollectionEquality().hash(custom), + id, + reason, + reporterType, + reviewQueueItem, + targetUser, + targetUserId, + type, + user, + userId, + ); + + @override + String toString() { + return 'ActionLogResponse(aiProviders: $aiProviders, createdAt: $createdAt, custom: $custom, id: $id, reason: $reason, reporterType: $reporterType, reviewQueueItem: $reviewQueueItem, targetUser: $targetUser, targetUserId: $targetUserId, type: $type, user: $user, userId: $userId)'; + } +} + +/// @nodoc +abstract mixin class $ActionLogResponseCopyWith<$Res> { + factory $ActionLogResponseCopyWith( + ActionLogResponse value, + $Res Function(ActionLogResponse) _then, + ) = _$ActionLogResponseCopyWithImpl; + @useResult + $Res call({ + List aiProviders, + DateTime createdAt, + Map custom, + String id, + String reason, + String reporterType, + ReviewQueueItemResponse? reviewQueueItem, + UserResponse? targetUser, + String targetUserId, + String type, + UserResponse? user, + String userId, + }); +} + +/// @nodoc +class _$ActionLogResponseCopyWithImpl<$Res> implements $ActionLogResponseCopyWith<$Res> { + _$ActionLogResponseCopyWithImpl(this._self, this._then); + + final ActionLogResponse _self; + final $Res Function(ActionLogResponse) _then; + + /// Create a copy of ActionLogResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? aiProviders = null, + Object? createdAt = null, + Object? custom = null, + Object? id = null, + Object? reason = null, + Object? reporterType = null, + Object? reviewQueueItem = freezed, + Object? targetUser = freezed, + Object? targetUserId = null, + Object? type = null, + Object? user = freezed, + Object? userId = null, + }) { + return _then( + ActionLogResponse( + aiProviders: null == aiProviders + ? _self.aiProviders + : aiProviders // ignore: cast_nullable_to_non_nullable + as List, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + reason: null == reason + ? _self.reason + : reason // ignore: cast_nullable_to_non_nullable + as String, + reporterType: null == reporterType + ? _self.reporterType + : reporterType // ignore: cast_nullable_to_non_nullable + as String, + reviewQueueItem: freezed == reviewQueueItem + ? _self.reviewQueueItem + : reviewQueueItem // ignore: cast_nullable_to_non_nullable + as ReviewQueueItemResponse?, + targetUser: freezed == targetUser + ? _self.targetUser + : targetUser // ignore: cast_nullable_to_non_nullable + as UserResponse?, + targetUserId: null == targetUserId + ? _self.targetUserId + : targetUserId // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponse?, + userId: null == userId + ? _self.userId + : userId // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/action_log_response.g.dart b/packages/stream_chat/lib/open_api/model/action_log_response.g.dart new file mode 100644 index 0000000000..a24348a7d3 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/action_log_response.g.dart @@ -0,0 +1,43 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'action_log_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ActionLogResponse _$ActionLogResponseFromJson(Map json) => ActionLogResponse( + aiProviders: (json['ai_providers'] as List).map((e) => e as String).toList(), + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + id: json['id'] as String, + reason: json['reason'] as String, + reporterType: json['reporter_type'] as String, + reviewQueueItem: json['review_queue_item'] == null + ? null + : ReviewQueueItemResponse.fromJson( + json['review_queue_item'] as Map, + ), + targetUser: json['target_user'] == null ? null : UserResponse.fromJson(json['target_user'] as Map), + targetUserId: json['target_user_id'] as String, + type: json['type'] as String, + user: json['user'] == null ? null : UserResponse.fromJson(json['user'] as Map), + userId: json['user_id'] as String, +); + +Map _$ActionLogResponseToJson(ActionLogResponse instance) => { + 'ai_providers': instance.aiProviders, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'id': instance.id, + 'reason': instance.reason, + 'reporter_type': instance.reporterType, + 'review_queue_item': instance.reviewQueueItem?.toJson(), + 'target_user': instance.targetUser?.toJson(), + 'target_user_id': instance.targetUserId, + 'type': instance.type, + 'user': instance.user?.toJson(), + 'user_id': instance.userId, +}; diff --git a/packages/stream_chat/lib/open_api/model/action_sequence.dart b/packages/stream_chat/lib/open_api/model/action_sequence.dart new file mode 100644 index 0000000000..40919c757f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/action_sequence.dart @@ -0,0 +1,61 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'action_sequence.g.dart'; +part 'action_sequence.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ActionSequence with _$ActionSequence { + const ActionSequence({ + required this.action, + required this.blur, + required this.cooldownPeriod, + required this.threshold, + required this.timeWindow, + required this.warning, + required this.warningText, + }); + + @override + @JsonKey(name: 'action') + final String action; + + @override + @JsonKey(name: 'blur') + final bool blur; + + @override + @JsonKey(name: 'cooldown_period') + final int cooldownPeriod; + + @override + @JsonKey(name: 'threshold') + final int threshold; + + @override + @JsonKey(name: 'time_window') + final int timeWindow; + + @override + @JsonKey(name: 'warning') + final bool warning; + + @override + @JsonKey(name: 'warning_text') + final String warningText; + + Map toJson() => _$ActionSequenceToJson(this); + + static ActionSequence fromJson(Map json) => _$ActionSequenceFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/action_sequence.freezed.dart b/packages/stream_chat/lib/open_api/model/action_sequence.freezed.dart new file mode 100644 index 0000000000..eda079a15b --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/action_sequence.freezed.dart @@ -0,0 +1,136 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'action_sequence.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ActionSequence { + String get action; + bool get blur; + int get cooldownPeriod; + int get threshold; + int get timeWindow; + bool get warning; + String get warningText; + + /// Create a copy of ActionSequence + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ActionSequenceCopyWith get copyWith => _$ActionSequenceCopyWithImpl( + this as ActionSequence, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ActionSequence && + (identical(other.action, action) || other.action == action) && + (identical(other.blur, blur) || other.blur == blur) && + (identical(other.cooldownPeriod, cooldownPeriod) || other.cooldownPeriod == cooldownPeriod) && + (identical(other.threshold, threshold) || other.threshold == threshold) && + (identical(other.timeWindow, timeWindow) || other.timeWindow == timeWindow) && + (identical(other.warning, warning) || other.warning == warning) && + (identical(other.warningText, warningText) || other.warningText == warningText)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + action, + blur, + cooldownPeriod, + threshold, + timeWindow, + warning, + warningText, + ); + + @override + String toString() { + return 'ActionSequence(action: $action, blur: $blur, cooldownPeriod: $cooldownPeriod, threshold: $threshold, timeWindow: $timeWindow, warning: $warning, warningText: $warningText)'; + } +} + +/// @nodoc +abstract mixin class $ActionSequenceCopyWith<$Res> { + factory $ActionSequenceCopyWith( + ActionSequence value, + $Res Function(ActionSequence) _then, + ) = _$ActionSequenceCopyWithImpl; + @useResult + $Res call({ + String action, + bool blur, + int cooldownPeriod, + int threshold, + int timeWindow, + bool warning, + String warningText, + }); +} + +/// @nodoc +class _$ActionSequenceCopyWithImpl<$Res> implements $ActionSequenceCopyWith<$Res> { + _$ActionSequenceCopyWithImpl(this._self, this._then); + + final ActionSequence _self; + final $Res Function(ActionSequence) _then; + + /// Create a copy of ActionSequence + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? action = null, + Object? blur = null, + Object? cooldownPeriod = null, + Object? threshold = null, + Object? timeWindow = null, + Object? warning = null, + Object? warningText = null, + }) { + return _then( + ActionSequence( + action: null == action + ? _self.action + : action // ignore: cast_nullable_to_non_nullable + as String, + blur: null == blur + ? _self.blur + : blur // ignore: cast_nullable_to_non_nullable + as bool, + cooldownPeriod: null == cooldownPeriod + ? _self.cooldownPeriod + : cooldownPeriod // ignore: cast_nullable_to_non_nullable + as int, + threshold: null == threshold + ? _self.threshold + : threshold // ignore: cast_nullable_to_non_nullable + as int, + timeWindow: null == timeWindow + ? _self.timeWindow + : timeWindow // ignore: cast_nullable_to_non_nullable + as int, + warning: null == warning + ? _self.warning + : warning // ignore: cast_nullable_to_non_nullable + as bool, + warningText: null == warningText + ? _self.warningText + : warningText // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/action_sequence.g.dart b/packages/stream_chat/lib/open_api/model/action_sequence.g.dart new file mode 100644 index 0000000000..90cda33c64 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/action_sequence.g.dart @@ -0,0 +1,27 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'action_sequence.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ActionSequence _$ActionSequenceFromJson(Map json) => ActionSequence( + action: json['action'] as String, + blur: json['blur'] as bool, + cooldownPeriod: (json['cooldown_period'] as num).toInt(), + threshold: (json['threshold'] as num).toInt(), + timeWindow: (json['time_window'] as num).toInt(), + warning: json['warning'] as bool, + warningText: json['warning_text'] as String, +); + +Map _$ActionSequenceToJson(ActionSequence instance) => { + 'action': instance.action, + 'blur': instance.blur, + 'cooldown_period': instance.cooldownPeriod, + 'threshold': instance.threshold, + 'time_window': instance.timeWindow, + 'warning': instance.warning, + 'warning_text': instance.warningText, +}; diff --git a/packages/stream_chat/lib/open_api/model/add_user_group_members_request.dart b/packages/stream_chat/lib/open_api/model/add_user_group_members_request.dart new file mode 100644 index 0000000000..4e05dbedcf --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/add_user_group_members_request.dart @@ -0,0 +1,41 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'add_user_group_members_request.g.dart'; +part 'add_user_group_members_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class AddUserGroupMembersRequest with _$AddUserGroupMembersRequest { + const AddUserGroupMembersRequest({ + this.asAdmin, + required this.memberIds, + this.teamId, + }); + + @override + @JsonKey(name: 'as_admin') + final bool? asAdmin; + + @override + @JsonKey(name: 'member_ids') + final List memberIds; + + @override + @JsonKey(name: 'team_id') + final String? teamId; + + Map toJson() => _$AddUserGroupMembersRequestToJson(this); + + static AddUserGroupMembersRequest fromJson(Map json) => _$AddUserGroupMembersRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/add_user_group_members_request.freezed.dart b/packages/stream_chat/lib/open_api/model/add_user_group_members_request.freezed.dart new file mode 100644 index 0000000000..4547e70731 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/add_user_group_members_request.freezed.dart @@ -0,0 +1,97 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'add_user_group_members_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$AddUserGroupMembersRequest { + bool? get asAdmin; + List get memberIds; + String? get teamId; + + /// Create a copy of AddUserGroupMembersRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $AddUserGroupMembersRequestCopyWith get copyWith => + _$AddUserGroupMembersRequestCopyWithImpl( + this as AddUserGroupMembersRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is AddUserGroupMembersRequest && + (identical(other.asAdmin, asAdmin) || other.asAdmin == asAdmin) && + const DeepCollectionEquality().equals(other.memberIds, memberIds) && + (identical(other.teamId, teamId) || other.teamId == teamId)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + asAdmin, + const DeepCollectionEquality().hash(memberIds), + teamId, + ); + + @override + String toString() { + return 'AddUserGroupMembersRequest(asAdmin: $asAdmin, memberIds: $memberIds, teamId: $teamId)'; + } +} + +/// @nodoc +abstract mixin class $AddUserGroupMembersRequestCopyWith<$Res> { + factory $AddUserGroupMembersRequestCopyWith( + AddUserGroupMembersRequest value, + $Res Function(AddUserGroupMembersRequest) _then, + ) = _$AddUserGroupMembersRequestCopyWithImpl; + @useResult + $Res call({bool? asAdmin, List memberIds, String? teamId}); +} + +/// @nodoc +class _$AddUserGroupMembersRequestCopyWithImpl<$Res> implements $AddUserGroupMembersRequestCopyWith<$Res> { + _$AddUserGroupMembersRequestCopyWithImpl(this._self, this._then); + + final AddUserGroupMembersRequest _self; + final $Res Function(AddUserGroupMembersRequest) _then; + + /// Create a copy of AddUserGroupMembersRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? asAdmin = freezed, + Object? memberIds = null, + Object? teamId = freezed, + }) { + return _then( + AddUserGroupMembersRequest( + asAdmin: freezed == asAdmin + ? _self.asAdmin + : asAdmin // ignore: cast_nullable_to_non_nullable + as bool?, + memberIds: null == memberIds + ? _self.memberIds + : memberIds // ignore: cast_nullable_to_non_nullable + as List, + teamId: freezed == teamId + ? _self.teamId + : teamId // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/add_user_group_members_request.g.dart b/packages/stream_chat/lib/open_api/model/add_user_group_members_request.g.dart new file mode 100644 index 0000000000..83be20cd24 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/add_user_group_members_request.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'add_user_group_members_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +AddUserGroupMembersRequest _$AddUserGroupMembersRequestFromJson( + Map json, +) => AddUserGroupMembersRequest( + asAdmin: json['as_admin'] as bool?, + memberIds: (json['member_ids'] as List).map((e) => e as String).toList(), + teamId: json['team_id'] as String?, +); + +Map _$AddUserGroupMembersRequestToJson( + AddUserGroupMembersRequest instance, +) => { + 'as_admin': instance.asAdmin, + 'member_ids': instance.memberIds, + 'team_id': instance.teamId, +}; diff --git a/packages/stream_chat/lib/open_api/model/add_user_group_members_response.dart b/packages/stream_chat/lib/open_api/model/add_user_group_members_response.dart new file mode 100644 index 0000000000..6566c81760 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/add_user_group_members_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'add_user_group_members_response.g.dart'; +part 'add_user_group_members_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class AddUserGroupMembersResponse with _$AddUserGroupMembersResponse { + const AddUserGroupMembersResponse({ + required this.duration, + this.userGroup, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'user_group') + final UserGroupResponse? userGroup; + + Map toJson() => _$AddUserGroupMembersResponseToJson(this); + + static AddUserGroupMembersResponse fromJson(Map json) => _$AddUserGroupMembersResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/add_user_group_members_response.freezed.dart b/packages/stream_chat/lib/open_api/model/add_user_group_members_response.freezed.dart new file mode 100644 index 0000000000..008d0b5d63 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/add_user_group_members_response.freezed.dart @@ -0,0 +1,82 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'add_user_group_members_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$AddUserGroupMembersResponse { + String get duration; + UserGroupResponse? get userGroup; + + /// Create a copy of AddUserGroupMembersResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $AddUserGroupMembersResponseCopyWith get copyWith => + _$AddUserGroupMembersResponseCopyWithImpl( + this as AddUserGroupMembersResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is AddUserGroupMembersResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.userGroup, userGroup) || other.userGroup == userGroup)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration, userGroup); + + @override + String toString() { + return 'AddUserGroupMembersResponse(duration: $duration, userGroup: $userGroup)'; + } +} + +/// @nodoc +abstract mixin class $AddUserGroupMembersResponseCopyWith<$Res> { + factory $AddUserGroupMembersResponseCopyWith( + AddUserGroupMembersResponse value, + $Res Function(AddUserGroupMembersResponse) _then, + ) = _$AddUserGroupMembersResponseCopyWithImpl; + @useResult + $Res call({String duration, UserGroupResponse? userGroup}); +} + +/// @nodoc +class _$AddUserGroupMembersResponseCopyWithImpl<$Res> implements $AddUserGroupMembersResponseCopyWith<$Res> { + _$AddUserGroupMembersResponseCopyWithImpl(this._self, this._then); + + final AddUserGroupMembersResponse _self; + final $Res Function(AddUserGroupMembersResponse) _then; + + /// Create a copy of AddUserGroupMembersResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? userGroup = freezed}) { + return _then( + AddUserGroupMembersResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + userGroup: freezed == userGroup + ? _self.userGroup + : userGroup // ignore: cast_nullable_to_non_nullable + as UserGroupResponse?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/add_user_group_members_response.g.dart b/packages/stream_chat/lib/open_api/model/add_user_group_members_response.g.dart new file mode 100644 index 0000000000..34157f2e5c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/add_user_group_members_response.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'add_user_group_members_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +AddUserGroupMembersResponse _$AddUserGroupMembersResponseFromJson( + Map json, +) => AddUserGroupMembersResponse( + duration: json['duration'] as String, + userGroup: json['user_group'] == null ? null : UserGroupResponse.fromJson(json['user_group'] as Map), +); + +Map _$AddUserGroupMembersResponseToJson( + AddUserGroupMembersResponse instance, +) => { + 'duration': instance.duration, + 'user_group': instance.userGroup?.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/ai_audio_config_request.dart b/packages/stream_chat/lib/open_api/model/ai_audio_config_request.dart new file mode 100644 index 0000000000..61b4d34a02 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ai_audio_config_request.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'ai_audio_config_request.g.dart'; +part 'ai_audio_config_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class AIAudioConfigRequest with _$AIAudioConfigRequest { + const AIAudioConfigRequest({ + this.profile, + this.rules, + }); + + @override + @JsonKey(name: 'profile') + final String? profile; + + @override + @JsonKey(name: 'rules') + final List? rules; + + Map toJson() => _$AIAudioConfigRequestToJson(this); + + static AIAudioConfigRequest fromJson(Map json) => _$AIAudioConfigRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/ai_audio_config_request.freezed.dart b/packages/stream_chat/lib/open_api/model/ai_audio_config_request.freezed.dart new file mode 100644 index 0000000000..c97d840558 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ai_audio_config_request.freezed.dart @@ -0,0 +1,86 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'ai_audio_config_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$AIAudioConfigRequest { + String? get profile; + List? get rules; + + /// Create a copy of AIAudioConfigRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $AIAudioConfigRequestCopyWith get copyWith => + _$AIAudioConfigRequestCopyWithImpl( + this as AIAudioConfigRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is AIAudioConfigRequest && + (identical(other.profile, profile) || other.profile == profile) && + const DeepCollectionEquality().equals(other.rules, rules)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + profile, + const DeepCollectionEquality().hash(rules), + ); + + @override + String toString() { + return 'AIAudioConfigRequest(profile: $profile, rules: $rules)'; + } +} + +/// @nodoc +abstract mixin class $AIAudioConfigRequestCopyWith<$Res> { + factory $AIAudioConfigRequestCopyWith( + AIAudioConfigRequest value, + $Res Function(AIAudioConfigRequest) _then, + ) = _$AIAudioConfigRequestCopyWithImpl; + @useResult + $Res call({String? profile, List? rules}); +} + +/// @nodoc +class _$AIAudioConfigRequestCopyWithImpl<$Res> implements $AIAudioConfigRequestCopyWith<$Res> { + _$AIAudioConfigRequestCopyWithImpl(this._self, this._then); + + final AIAudioConfigRequest _self; + final $Res Function(AIAudioConfigRequest) _then; + + /// Create a copy of AIAudioConfigRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? profile = freezed, Object? rules = freezed}) { + return _then( + AIAudioConfigRequest( + profile: freezed == profile + ? _self.profile + : profile // ignore: cast_nullable_to_non_nullable + as String?, + rules: freezed == rules + ? _self.rules + : rules // ignore: cast_nullable_to_non_nullable + as List?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/ai_audio_config_request.g.dart b/packages/stream_chat/lib/open_api/model/ai_audio_config_request.g.dart new file mode 100644 index 0000000000..77e22ca033 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ai_audio_config_request.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'ai_audio_config_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +AIAudioConfigRequest _$AIAudioConfigRequestFromJson( + Map json, +) => AIAudioConfigRequest( + profile: json['profile'] as String?, + rules: (json['rules'] as List?)?.map((e) => BodyguardRule.fromJson(e as Map)).toList(), +); + +Map _$AIAudioConfigRequestToJson( + AIAudioConfigRequest instance, +) => { + 'profile': instance.profile, + 'rules': instance.rules?.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/ai_audio_config_response.dart b/packages/stream_chat/lib/open_api/model/ai_audio_config_response.dart new file mode 100644 index 0000000000..553d5d7f4a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ai_audio_config_response.dart @@ -0,0 +1,41 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'ai_audio_config_response.g.dart'; +part 'ai_audio_config_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class AIAudioConfigResponse with _$AIAudioConfigResponse { + const AIAudioConfigResponse({ + required this.enabled, + required this.profile, + required this.rules, + }); + + @override + @JsonKey(name: 'enabled') + final bool enabled; + + @override + @JsonKey(name: 'profile') + final String profile; + + @override + @JsonKey(name: 'rules') + final List rules; + + Map toJson() => _$AIAudioConfigResponseToJson(this); + + static AIAudioConfigResponse fromJson(Map json) => _$AIAudioConfigResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/ai_audio_config_response.freezed.dart b/packages/stream_chat/lib/open_api/model/ai_audio_config_response.freezed.dart new file mode 100644 index 0000000000..d5833297c2 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ai_audio_config_response.freezed.dart @@ -0,0 +1,97 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'ai_audio_config_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$AIAudioConfigResponse { + bool get enabled; + String get profile; + List get rules; + + /// Create a copy of AIAudioConfigResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $AIAudioConfigResponseCopyWith get copyWith => + _$AIAudioConfigResponseCopyWithImpl( + this as AIAudioConfigResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is AIAudioConfigResponse && + (identical(other.enabled, enabled) || other.enabled == enabled) && + (identical(other.profile, profile) || other.profile == profile) && + const DeepCollectionEquality().equals(other.rules, rules)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + enabled, + profile, + const DeepCollectionEquality().hash(rules), + ); + + @override + String toString() { + return 'AIAudioConfigResponse(enabled: $enabled, profile: $profile, rules: $rules)'; + } +} + +/// @nodoc +abstract mixin class $AIAudioConfigResponseCopyWith<$Res> { + factory $AIAudioConfigResponseCopyWith( + AIAudioConfigResponse value, + $Res Function(AIAudioConfigResponse) _then, + ) = _$AIAudioConfigResponseCopyWithImpl; + @useResult + $Res call({bool enabled, String profile, List rules}); +} + +/// @nodoc +class _$AIAudioConfigResponseCopyWithImpl<$Res> implements $AIAudioConfigResponseCopyWith<$Res> { + _$AIAudioConfigResponseCopyWithImpl(this._self, this._then); + + final AIAudioConfigResponse _self; + final $Res Function(AIAudioConfigResponse) _then; + + /// Create a copy of AIAudioConfigResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? enabled = null, + Object? profile = null, + Object? rules = null, + }) { + return _then( + AIAudioConfigResponse( + enabled: null == enabled + ? _self.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool, + profile: null == profile + ? _self.profile + : profile // ignore: cast_nullable_to_non_nullable + as String, + rules: null == rules + ? _self.rules + : rules // ignore: cast_nullable_to_non_nullable + as List, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/ai_audio_config_response.g.dart b/packages/stream_chat/lib/open_api/model/ai_audio_config_response.g.dart new file mode 100644 index 0000000000..1f89d17ac5 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ai_audio_config_response.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'ai_audio_config_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +AIAudioConfigResponse _$AIAudioConfigResponseFromJson( + Map json, +) => AIAudioConfigResponse( + enabled: json['enabled'] as bool, + profile: json['profile'] as String, + rules: (json['rules'] as List).map((e) => BodyguardRule.fromJson(e as Map)).toList(), +); + +Map _$AIAudioConfigResponseToJson( + AIAudioConfigResponse instance, +) => { + 'enabled': instance.enabled, + 'profile': instance.profile, + 'rules': instance.rules.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/ai_image_config.dart b/packages/stream_chat/lib/open_api/model/ai_image_config.dart new file mode 100644 index 0000000000..3ddf2fb1e8 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ai_image_config.dart @@ -0,0 +1,46 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'ai_image_config.g.dart'; +part 'ai_image_config.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class AIImageConfig with _$AIImageConfig { + const AIImageConfig({ + this.async, + required this.enabled, + required this.ocrRules, + required this.rules, + }); + + @override + @JsonKey(name: 'async') + final bool? async; + + @override + @JsonKey(name: 'enabled') + final bool enabled; + + @override + @JsonKey(name: 'ocr_rules') + final List ocrRules; + + @override + @JsonKey(name: 'rules') + final List rules; + + Map toJson() => _$AIImageConfigToJson(this); + + static AIImageConfig fromJson(Map json) => _$AIImageConfigFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/ai_image_config.freezed.dart b/packages/stream_chat/lib/open_api/model/ai_image_config.freezed.dart new file mode 100644 index 0000000000..e3b7592cae --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ai_image_config.freezed.dart @@ -0,0 +1,109 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'ai_image_config.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$AIImageConfig { + bool? get async; + bool get enabled; + List get ocrRules; + List get rules; + + /// Create a copy of AIImageConfig + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $AIImageConfigCopyWith get copyWith => _$AIImageConfigCopyWithImpl( + this as AIImageConfig, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is AIImageConfig && + (identical(other.async, async) || other.async == async) && + (identical(other.enabled, enabled) || other.enabled == enabled) && + const DeepCollectionEquality().equals(other.ocrRules, ocrRules) && + const DeepCollectionEquality().equals(other.rules, rules)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + async, + enabled, + const DeepCollectionEquality().hash(ocrRules), + const DeepCollectionEquality().hash(rules), + ); + + @override + String toString() { + return 'AIImageConfig(async: $async, enabled: $enabled, ocrRules: $ocrRules, rules: $rules)'; + } +} + +/// @nodoc +abstract mixin class $AIImageConfigCopyWith<$Res> { + factory $AIImageConfigCopyWith( + AIImageConfig value, + $Res Function(AIImageConfig) _then, + ) = _$AIImageConfigCopyWithImpl; + @useResult + $Res call({ + bool? async, + bool enabled, + List ocrRules, + List rules, + }); +} + +/// @nodoc +class _$AIImageConfigCopyWithImpl<$Res> implements $AIImageConfigCopyWith<$Res> { + _$AIImageConfigCopyWithImpl(this._self, this._then); + + final AIImageConfig _self; + final $Res Function(AIImageConfig) _then; + + /// Create a copy of AIImageConfig + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? async = freezed, + Object? enabled = null, + Object? ocrRules = null, + Object? rules = null, + }) { + return _then( + AIImageConfig( + async: freezed == async + ? _self.async + : async // ignore: cast_nullable_to_non_nullable + as bool?, + enabled: null == enabled + ? _self.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool, + ocrRules: null == ocrRules + ? _self.ocrRules + : ocrRules // ignore: cast_nullable_to_non_nullable + as List, + rules: null == rules + ? _self.rules + : rules // ignore: cast_nullable_to_non_nullable + as List, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/ai_image_config.g.dart b/packages/stream_chat/lib/open_api/model/ai_image_config.g.dart new file mode 100644 index 0000000000..14f032da13 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ai_image_config.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'ai_image_config.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +AIImageConfig _$AIImageConfigFromJson(Map json) => AIImageConfig( + async: json['async'] as bool?, + enabled: json['enabled'] as bool, + ocrRules: (json['ocr_rules'] as List).map((e) => OCRRule.fromJson(e as Map)).toList(), + rules: (json['rules'] as List).map((e) => AWSRekognitionRule.fromJson(e as Map)).toList(), +); + +Map _$AIImageConfigToJson(AIImageConfig instance) => { + 'async': instance.async, + 'enabled': instance.enabled, + 'ocr_rules': instance.ocrRules.map((e) => e.toJson()).toList(), + 'rules': instance.rules.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/ai_image_label_definition.dart b/packages/stream_chat/lib/open_api/model/ai_image_label_definition.dart new file mode 100644 index 0000000000..e93fbe5986 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ai_image_label_definition.dart @@ -0,0 +1,46 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'ai_image_label_definition.g.dart'; +part 'ai_image_label_definition.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class AIImageLabelDefinition with _$AIImageLabelDefinition { + const AIImageLabelDefinition({ + required this.description, + required this.group, + required this.key, + required this.label, + }); + + @override + @JsonKey(name: 'description') + final String description; + + @override + @JsonKey(name: 'group') + final String group; + + @override + @JsonKey(name: 'key') + final String key; + + @override + @JsonKey(name: 'label') + final String label; + + Map toJson() => _$AIImageLabelDefinitionToJson(this); + + static AIImageLabelDefinition fromJson(Map json) => _$AIImageLabelDefinitionFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/ai_image_label_definition.freezed.dart b/packages/stream_chat/lib/open_api/model/ai_image_label_definition.freezed.dart new file mode 100644 index 0000000000..e69f27be0c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ai_image_label_definition.freezed.dart @@ -0,0 +1,99 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'ai_image_label_definition.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$AIImageLabelDefinition { + String get description; + String get group; + String get key; + String get label; + + /// Create a copy of AIImageLabelDefinition + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $AIImageLabelDefinitionCopyWith get copyWith => + _$AIImageLabelDefinitionCopyWithImpl( + this as AIImageLabelDefinition, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is AIImageLabelDefinition && + (identical(other.description, description) || other.description == description) && + (identical(other.group, group) || other.group == group) && + (identical(other.key, key) || other.key == key) && + (identical(other.label, label) || other.label == label)); + } + + @override + int get hashCode => Object.hash(runtimeType, description, group, key, label); + + @override + String toString() { + return 'AIImageLabelDefinition(description: $description, group: $group, key: $key, label: $label)'; + } +} + +/// @nodoc +abstract mixin class $AIImageLabelDefinitionCopyWith<$Res> { + factory $AIImageLabelDefinitionCopyWith( + AIImageLabelDefinition value, + $Res Function(AIImageLabelDefinition) _then, + ) = _$AIImageLabelDefinitionCopyWithImpl; + @useResult + $Res call({String description, String group, String key, String label}); +} + +/// @nodoc +class _$AIImageLabelDefinitionCopyWithImpl<$Res> implements $AIImageLabelDefinitionCopyWith<$Res> { + _$AIImageLabelDefinitionCopyWithImpl(this._self, this._then); + + final AIImageLabelDefinition _self; + final $Res Function(AIImageLabelDefinition) _then; + + /// Create a copy of AIImageLabelDefinition + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? description = null, + Object? group = null, + Object? key = null, + Object? label = null, + }) { + return _then( + AIImageLabelDefinition( + description: null == description + ? _self.description + : description // ignore: cast_nullable_to_non_nullable + as String, + group: null == group + ? _self.group + : group // ignore: cast_nullable_to_non_nullable + as String, + key: null == key + ? _self.key + : key // ignore: cast_nullable_to_non_nullable + as String, + label: null == label + ? _self.label + : label // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/ai_image_label_definition.g.dart b/packages/stream_chat/lib/open_api/model/ai_image_label_definition.g.dart new file mode 100644 index 0000000000..c07e33969f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ai_image_label_definition.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'ai_image_label_definition.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +AIImageLabelDefinition _$AIImageLabelDefinitionFromJson( + Map json, +) => AIImageLabelDefinition( + description: json['description'] as String, + group: json['group'] as String, + key: json['key'] as String, + label: json['label'] as String, +); + +Map _$AIImageLabelDefinitionToJson( + AIImageLabelDefinition instance, +) => { + 'description': instance.description, + 'group': instance.group, + 'key': instance.key, + 'label': instance.label, +}; diff --git a/packages/stream_chat/lib/open_api/model/ai_indicator_clear_event.dart b/packages/stream_chat/lib/open_api/model/ai_indicator_clear_event.dart new file mode 100644 index 0000000000..8fda138aa1 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ai_indicator_clear_event.dart @@ -0,0 +1,63 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'ai_indicator_clear_event.g.dart'; +part 'ai_indicator_clear_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class AIIndicatorClearEvent extends core.WsEvent with _$AIIndicatorClearEvent { + const AIIndicatorClearEvent({ + this.channelId, + this.channelType, + this.cid, + required this.createdAt, + required this.custom, + this.receivedAt, + required this.type, + }); + + @override + @JsonKey(name: 'channel_id') + final String? channelId; + + @override + @JsonKey(name: 'channel_type') + final String? channelType; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'type') + final String type; + + Map toJson() => _$AIIndicatorClearEventToJson(this); + + static AIIndicatorClearEvent fromJson(Map json) => _$AIIndicatorClearEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/ai_indicator_clear_event.freezed.dart b/packages/stream_chat/lib/open_api/model/ai_indicator_clear_event.freezed.dart new file mode 100644 index 0000000000..7c365b08b7 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ai_indicator_clear_event.freezed.dart @@ -0,0 +1,137 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'ai_indicator_clear_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$AIIndicatorClearEvent { + String? get channelId; + String? get channelType; + String? get cid; + DateTime get createdAt; + Map get custom; + DateTime? get receivedAt; + String get type; + + /// Create a copy of AIIndicatorClearEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $AIIndicatorClearEventCopyWith get copyWith => + _$AIIndicatorClearEventCopyWithImpl( + this as AIIndicatorClearEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is AIIndicatorClearEvent && + (identical(other.channelId, channelId) || other.channelId == channelId) && + (identical(other.channelType, channelType) || other.channelType == channelType) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.type, type) || other.type == type)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channelId, + channelType, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + receivedAt, + type, + ); + + @override + String toString() { + return 'AIIndicatorClearEvent(channelId: $channelId, channelType: $channelType, cid: $cid, createdAt: $createdAt, custom: $custom, receivedAt: $receivedAt, type: $type)'; + } +} + +/// @nodoc +abstract mixin class $AIIndicatorClearEventCopyWith<$Res> { + factory $AIIndicatorClearEventCopyWith( + AIIndicatorClearEvent value, + $Res Function(AIIndicatorClearEvent) _then, + ) = _$AIIndicatorClearEventCopyWithImpl; + @useResult + $Res call({ + String? channelId, + String? channelType, + String? cid, + DateTime createdAt, + Map custom, + DateTime? receivedAt, + String type, + }); +} + +/// @nodoc +class _$AIIndicatorClearEventCopyWithImpl<$Res> implements $AIIndicatorClearEventCopyWith<$Res> { + _$AIIndicatorClearEventCopyWithImpl(this._self, this._then); + + final AIIndicatorClearEvent _self; + final $Res Function(AIIndicatorClearEvent) _then; + + /// Create a copy of AIIndicatorClearEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channelId = freezed, + Object? channelType = freezed, + Object? cid = freezed, + Object? createdAt = null, + Object? custom = null, + Object? receivedAt = freezed, + Object? type = null, + }) { + return _then( + AIIndicatorClearEvent( + channelId: freezed == channelId + ? _self.channelId + : channelId // ignore: cast_nullable_to_non_nullable + as String?, + channelType: freezed == channelType + ? _self.channelType + : channelType // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/ai_indicator_clear_event.g.dart b/packages/stream_chat/lib/open_api/model/ai_indicator_clear_event.g.dart new file mode 100644 index 0000000000..a7253f5cb8 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ai_indicator_clear_event.g.dart @@ -0,0 +1,49 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'ai_indicator_clear_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +AIIndicatorClearEvent _$AIIndicatorClearEventFromJson( + Map json, +) => AIIndicatorClearEvent( + channelId: json['channel_id'] as String?, + channelType: json['channel_type'] as String?, + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + type: json['type'] as String, +); + +Map _$AIIndicatorClearEventToJson( + AIIndicatorClearEvent instance, +) => { + 'channel_id': instance.channelId, + 'channel_type': instance.channelType, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'type': instance.type, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/ai_indicator_stop_event.dart b/packages/stream_chat/lib/open_api/model/ai_indicator_stop_event.dart new file mode 100644 index 0000000000..93f7fe9c5a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ai_indicator_stop_event.dart @@ -0,0 +1,63 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'ai_indicator_stop_event.g.dart'; +part 'ai_indicator_stop_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class AIIndicatorStopEvent extends core.WsEvent with _$AIIndicatorStopEvent { + const AIIndicatorStopEvent({ + this.channelId, + this.channelType, + this.cid, + required this.createdAt, + required this.custom, + this.receivedAt, + required this.type, + }); + + @override + @JsonKey(name: 'channel_id') + final String? channelId; + + @override + @JsonKey(name: 'channel_type') + final String? channelType; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'type') + final String type; + + Map toJson() => _$AIIndicatorStopEventToJson(this); + + static AIIndicatorStopEvent fromJson(Map json) => _$AIIndicatorStopEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/ai_indicator_stop_event.freezed.dart b/packages/stream_chat/lib/open_api/model/ai_indicator_stop_event.freezed.dart new file mode 100644 index 0000000000..ccc7674f51 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ai_indicator_stop_event.freezed.dart @@ -0,0 +1,137 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'ai_indicator_stop_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$AIIndicatorStopEvent { + String? get channelId; + String? get channelType; + String? get cid; + DateTime get createdAt; + Map get custom; + DateTime? get receivedAt; + String get type; + + /// Create a copy of AIIndicatorStopEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $AIIndicatorStopEventCopyWith get copyWith => + _$AIIndicatorStopEventCopyWithImpl( + this as AIIndicatorStopEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is AIIndicatorStopEvent && + (identical(other.channelId, channelId) || other.channelId == channelId) && + (identical(other.channelType, channelType) || other.channelType == channelType) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.type, type) || other.type == type)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channelId, + channelType, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + receivedAt, + type, + ); + + @override + String toString() { + return 'AIIndicatorStopEvent(channelId: $channelId, channelType: $channelType, cid: $cid, createdAt: $createdAt, custom: $custom, receivedAt: $receivedAt, type: $type)'; + } +} + +/// @nodoc +abstract mixin class $AIIndicatorStopEventCopyWith<$Res> { + factory $AIIndicatorStopEventCopyWith( + AIIndicatorStopEvent value, + $Res Function(AIIndicatorStopEvent) _then, + ) = _$AIIndicatorStopEventCopyWithImpl; + @useResult + $Res call({ + String? channelId, + String? channelType, + String? cid, + DateTime createdAt, + Map custom, + DateTime? receivedAt, + String type, + }); +} + +/// @nodoc +class _$AIIndicatorStopEventCopyWithImpl<$Res> implements $AIIndicatorStopEventCopyWith<$Res> { + _$AIIndicatorStopEventCopyWithImpl(this._self, this._then); + + final AIIndicatorStopEvent _self; + final $Res Function(AIIndicatorStopEvent) _then; + + /// Create a copy of AIIndicatorStopEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channelId = freezed, + Object? channelType = freezed, + Object? cid = freezed, + Object? createdAt = null, + Object? custom = null, + Object? receivedAt = freezed, + Object? type = null, + }) { + return _then( + AIIndicatorStopEvent( + channelId: freezed == channelId + ? _self.channelId + : channelId // ignore: cast_nullable_to_non_nullable + as String?, + channelType: freezed == channelType + ? _self.channelType + : channelType // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/ai_indicator_stop_event.g.dart b/packages/stream_chat/lib/open_api/model/ai_indicator_stop_event.g.dart new file mode 100644 index 0000000000..eaf2936c23 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ai_indicator_stop_event.g.dart @@ -0,0 +1,49 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'ai_indicator_stop_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +AIIndicatorStopEvent _$AIIndicatorStopEventFromJson( + Map json, +) => AIIndicatorStopEvent( + channelId: json['channel_id'] as String?, + channelType: json['channel_type'] as String?, + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + type: json['type'] as String, +); + +Map _$AIIndicatorStopEventToJson( + AIIndicatorStopEvent instance, +) => { + 'channel_id': instance.channelId, + 'channel_type': instance.channelType, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'type': instance.type, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/ai_indicator_update_event.dart b/packages/stream_chat/lib/open_api/model/ai_indicator_update_event.dart new file mode 100644 index 0000000000..820ef520b3 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ai_indicator_update_event.dart @@ -0,0 +1,78 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'ai_indicator_update_event.g.dart'; +part 'ai_indicator_update_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class AIIndicatorUpdateEvent extends core.WsEvent with _$AIIndicatorUpdateEvent { + const AIIndicatorUpdateEvent({ + this.aiMessage, + required this.aiState, + this.channelId, + this.channelType, + this.cid, + required this.createdAt, + required this.custom, + required this.messageId, + this.receivedAt, + required this.type, + }); + + @override + @JsonKey(name: 'ai_message') + final String? aiMessage; + + @override + @JsonKey(name: 'ai_state') + final String aiState; + + @override + @JsonKey(name: 'channel_id') + final String? channelId; + + @override + @JsonKey(name: 'channel_type') + final String? channelType; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'message_id') + final String messageId; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'type') + final String type; + + Map toJson() => _$AIIndicatorUpdateEventToJson(this); + + static AIIndicatorUpdateEvent fromJson(Map json) => _$AIIndicatorUpdateEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/ai_indicator_update_event.freezed.dart b/packages/stream_chat/lib/open_api/model/ai_indicator_update_event.freezed.dart new file mode 100644 index 0000000000..9e6eac306f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ai_indicator_update_event.freezed.dart @@ -0,0 +1,164 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'ai_indicator_update_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$AIIndicatorUpdateEvent { + String? get aiMessage; + String get aiState; + String? get channelId; + String? get channelType; + String? get cid; + DateTime get createdAt; + Map get custom; + String get messageId; + DateTime? get receivedAt; + String get type; + + /// Create a copy of AIIndicatorUpdateEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $AIIndicatorUpdateEventCopyWith get copyWith => + _$AIIndicatorUpdateEventCopyWithImpl( + this as AIIndicatorUpdateEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is AIIndicatorUpdateEvent && + (identical(other.aiMessage, aiMessage) || other.aiMessage == aiMessage) && + (identical(other.aiState, aiState) || other.aiState == aiState) && + (identical(other.channelId, channelId) || other.channelId == channelId) && + (identical(other.channelType, channelType) || other.channelType == channelType) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.messageId, messageId) || other.messageId == messageId) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.type, type) || other.type == type)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + aiMessage, + aiState, + channelId, + channelType, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + messageId, + receivedAt, + type, + ); + + @override + String toString() { + return 'AIIndicatorUpdateEvent(aiMessage: $aiMessage, aiState: $aiState, channelId: $channelId, channelType: $channelType, cid: $cid, createdAt: $createdAt, custom: $custom, messageId: $messageId, receivedAt: $receivedAt, type: $type)'; + } +} + +/// @nodoc +abstract mixin class $AIIndicatorUpdateEventCopyWith<$Res> { + factory $AIIndicatorUpdateEventCopyWith( + AIIndicatorUpdateEvent value, + $Res Function(AIIndicatorUpdateEvent) _then, + ) = _$AIIndicatorUpdateEventCopyWithImpl; + @useResult + $Res call({ + String? aiMessage, + String aiState, + String? channelId, + String? channelType, + String? cid, + DateTime createdAt, + Map custom, + String messageId, + DateTime? receivedAt, + String type, + }); +} + +/// @nodoc +class _$AIIndicatorUpdateEventCopyWithImpl<$Res> implements $AIIndicatorUpdateEventCopyWith<$Res> { + _$AIIndicatorUpdateEventCopyWithImpl(this._self, this._then); + + final AIIndicatorUpdateEvent _self; + final $Res Function(AIIndicatorUpdateEvent) _then; + + /// Create a copy of AIIndicatorUpdateEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? aiMessage = freezed, + Object? aiState = null, + Object? channelId = freezed, + Object? channelType = freezed, + Object? cid = freezed, + Object? createdAt = null, + Object? custom = null, + Object? messageId = null, + Object? receivedAt = freezed, + Object? type = null, + }) { + return _then( + AIIndicatorUpdateEvent( + aiMessage: freezed == aiMessage + ? _self.aiMessage + : aiMessage // ignore: cast_nullable_to_non_nullable + as String?, + aiState: null == aiState + ? _self.aiState + : aiState // ignore: cast_nullable_to_non_nullable + as String, + channelId: freezed == channelId + ? _self.channelId + : channelId // ignore: cast_nullable_to_non_nullable + as String?, + channelType: freezed == channelType + ? _self.channelType + : channelType // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + messageId: null == messageId + ? _self.messageId + : messageId // ignore: cast_nullable_to_non_nullable + as String, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/ai_indicator_update_event.g.dart b/packages/stream_chat/lib/open_api/model/ai_indicator_update_event.g.dart new file mode 100644 index 0000000000..010a25d95f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ai_indicator_update_event.g.dart @@ -0,0 +1,55 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'ai_indicator_update_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +AIIndicatorUpdateEvent _$AIIndicatorUpdateEventFromJson( + Map json, +) => AIIndicatorUpdateEvent( + aiMessage: json['ai_message'] as String?, + aiState: json['ai_state'] as String, + channelId: json['channel_id'] as String?, + channelType: json['channel_type'] as String?, + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + messageId: json['message_id'] as String, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + type: json['type'] as String, +); + +Map _$AIIndicatorUpdateEventToJson( + AIIndicatorUpdateEvent instance, +) => { + 'ai_message': instance.aiMessage, + 'ai_state': instance.aiState, + 'channel_id': instance.channelId, + 'channel_type': instance.channelType, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'message_id': instance.messageId, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'type': instance.type, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/ai_text_config.dart b/packages/stream_chat/lib/open_api/model/ai_text_config.dart new file mode 100644 index 0000000000..20bbc3de8e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ai_text_config.dart @@ -0,0 +1,51 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'ai_text_config.g.dart'; +part 'ai_text_config.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class AITextConfig with _$AITextConfig { + const AITextConfig({ + this.async, + required this.enabled, + required this.profile, + required this.rules, + required this.severityRules, + }); + + @override + @JsonKey(name: 'async') + final bool? async; + + @override + @JsonKey(name: 'enabled') + final bool enabled; + + @override + @JsonKey(name: 'profile') + final String profile; + + @override + @JsonKey(name: 'rules') + final List rules; + + @override + @JsonKey(name: 'severity_rules') + final List severityRules; + + Map toJson() => _$AITextConfigToJson(this); + + static AITextConfig fromJson(Map json) => _$AITextConfigFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/ai_text_config.freezed.dart b/packages/stream_chat/lib/open_api/model/ai_text_config.freezed.dart new file mode 100644 index 0000000000..4a00dff1c1 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ai_text_config.freezed.dart @@ -0,0 +1,121 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'ai_text_config.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$AITextConfig { + bool? get async; + bool get enabled; + String get profile; + List get rules; + List get severityRules; + + /// Create a copy of AITextConfig + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $AITextConfigCopyWith get copyWith => _$AITextConfigCopyWithImpl( + this as AITextConfig, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is AITextConfig && + (identical(other.async, async) || other.async == async) && + (identical(other.enabled, enabled) || other.enabled == enabled) && + (identical(other.profile, profile) || other.profile == profile) && + const DeepCollectionEquality().equals(other.rules, rules) && + const DeepCollectionEquality().equals( + other.severityRules, + severityRules, + )); + } + + @override + int get hashCode => Object.hash( + runtimeType, + async, + enabled, + profile, + const DeepCollectionEquality().hash(rules), + const DeepCollectionEquality().hash(severityRules), + ); + + @override + String toString() { + return 'AITextConfig(async: $async, enabled: $enabled, profile: $profile, rules: $rules, severityRules: $severityRules)'; + } +} + +/// @nodoc +abstract mixin class $AITextConfigCopyWith<$Res> { + factory $AITextConfigCopyWith( + AITextConfig value, + $Res Function(AITextConfig) _then, + ) = _$AITextConfigCopyWithImpl; + @useResult + $Res call({ + bool? async, + bool enabled, + String profile, + List rules, + List severityRules, + }); +} + +/// @nodoc +class _$AITextConfigCopyWithImpl<$Res> implements $AITextConfigCopyWith<$Res> { + _$AITextConfigCopyWithImpl(this._self, this._then); + + final AITextConfig _self; + final $Res Function(AITextConfig) _then; + + /// Create a copy of AITextConfig + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? async = freezed, + Object? enabled = null, + Object? profile = null, + Object? rules = null, + Object? severityRules = null, + }) { + return _then( + AITextConfig( + async: freezed == async + ? _self.async + : async // ignore: cast_nullable_to_non_nullable + as bool?, + enabled: null == enabled + ? _self.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool, + profile: null == profile + ? _self.profile + : profile // ignore: cast_nullable_to_non_nullable + as String, + rules: null == rules + ? _self.rules + : rules // ignore: cast_nullable_to_non_nullable + as List, + severityRules: null == severityRules + ? _self.severityRules + : severityRules // ignore: cast_nullable_to_non_nullable + as List, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/ai_text_config.g.dart b/packages/stream_chat/lib/open_api/model/ai_text_config.g.dart new file mode 100644 index 0000000000..91e9e0b98f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ai_text_config.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'ai_text_config.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +AITextConfig _$AITextConfigFromJson(Map json) => AITextConfig( + async: json['async'] as bool?, + enabled: json['enabled'] as bool, + profile: json['profile'] as String, + rules: (json['rules'] as List).map((e) => BodyguardRule.fromJson(e as Map)).toList(), + severityRules: (json['severity_rules'] as List) + .map((e) => BodyguardSeverityRule.fromJson(e as Map)) + .toList(), +); + +Map _$AITextConfigToJson(AITextConfig instance) => { + 'async': instance.async, + 'enabled': instance.enabled, + 'profile': instance.profile, + 'rules': instance.rules.map((e) => e.toJson()).toList(), + 'severity_rules': instance.severityRules.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/ai_video_config.dart b/packages/stream_chat/lib/open_api/model/ai_video_config.dart new file mode 100644 index 0000000000..6d370c9037 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ai_video_config.dart @@ -0,0 +1,41 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'ai_video_config.g.dart'; +part 'ai_video_config.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class AIVideoConfig with _$AIVideoConfig { + const AIVideoConfig({ + this.async, + required this.enabled, + required this.rules, + }); + + @override + @JsonKey(name: 'async') + final bool? async; + + @override + @JsonKey(name: 'enabled') + final bool enabled; + + @override + @JsonKey(name: 'rules') + final List rules; + + Map toJson() => _$AIVideoConfigToJson(this); + + static AIVideoConfig fromJson(Map json) => _$AIVideoConfigFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/ai_video_config.freezed.dart b/packages/stream_chat/lib/open_api/model/ai_video_config.freezed.dart new file mode 100644 index 0000000000..7850b0264e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ai_video_config.freezed.dart @@ -0,0 +1,96 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'ai_video_config.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$AIVideoConfig { + bool? get async; + bool get enabled; + List get rules; + + /// Create a copy of AIVideoConfig + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $AIVideoConfigCopyWith get copyWith => _$AIVideoConfigCopyWithImpl( + this as AIVideoConfig, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is AIVideoConfig && + (identical(other.async, async) || other.async == async) && + (identical(other.enabled, enabled) || other.enabled == enabled) && + const DeepCollectionEquality().equals(other.rules, rules)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + async, + enabled, + const DeepCollectionEquality().hash(rules), + ); + + @override + String toString() { + return 'AIVideoConfig(async: $async, enabled: $enabled, rules: $rules)'; + } +} + +/// @nodoc +abstract mixin class $AIVideoConfigCopyWith<$Res> { + factory $AIVideoConfigCopyWith( + AIVideoConfig value, + $Res Function(AIVideoConfig) _then, + ) = _$AIVideoConfigCopyWithImpl; + @useResult + $Res call({bool? async, bool enabled, List rules}); +} + +/// @nodoc +class _$AIVideoConfigCopyWithImpl<$Res> implements $AIVideoConfigCopyWith<$Res> { + _$AIVideoConfigCopyWithImpl(this._self, this._then); + + final AIVideoConfig _self; + final $Res Function(AIVideoConfig) _then; + + /// Create a copy of AIVideoConfig + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? async = freezed, + Object? enabled = null, + Object? rules = null, + }) { + return _then( + AIVideoConfig( + async: freezed == async + ? _self.async + : async // ignore: cast_nullable_to_non_nullable + as bool?, + enabled: null == enabled + ? _self.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool, + rules: null == rules + ? _self.rules + : rules // ignore: cast_nullable_to_non_nullable + as List, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/ai_video_config.g.dart b/packages/stream_chat/lib/open_api/model/ai_video_config.g.dart new file mode 100644 index 0000000000..54b166bb54 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ai_video_config.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'ai_video_config.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +AIVideoConfig _$AIVideoConfigFromJson(Map json) => AIVideoConfig( + async: json['async'] as bool?, + enabled: json['enabled'] as bool, + rules: (json['rules'] as List).map((e) => AWSRekognitionRule.fromJson(e as Map)).toList(), +); + +Map _$AIVideoConfigToJson(AIVideoConfig instance) => { + 'async': instance.async, + 'enabled': instance.enabled, + 'rules': instance.rules.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/app_event_response.dart b/packages/stream_chat/lib/open_api/model/app_event_response.dart new file mode 100644 index 0000000000..7796121459 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/app_event_response.dart @@ -0,0 +1,51 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'app_event_response.g.dart'; +part 'app_event_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class AppEventResponse with _$AppEventResponse { + const AppEventResponse({ + this.asyncUrlEnrichEnabled, + required this.autoTranslationEnabled, + this.fileUploadConfig, + this.imageUploadConfig, + required this.name, + }); + + @override + @JsonKey(name: 'async_url_enrich_enabled') + final bool? asyncUrlEnrichEnabled; + + @override + @JsonKey(name: 'auto_translation_enabled') + final bool autoTranslationEnabled; + + @override + @JsonKey(name: 'file_upload_config') + final FileUploadConfig? fileUploadConfig; + + @override + @JsonKey(name: 'image_upload_config') + final FileUploadConfig? imageUploadConfig; + + @override + @JsonKey(name: 'name') + final String name; + + Map toJson() => _$AppEventResponseToJson(this); + + static AppEventResponse fromJson(Map json) => _$AppEventResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/app_event_response.freezed.dart b/packages/stream_chat/lib/open_api/model/app_event_response.freezed.dart new file mode 100644 index 0000000000..28b4f93a85 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/app_event_response.freezed.dart @@ -0,0 +1,120 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'app_event_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$AppEventResponse { + bool? get asyncUrlEnrichEnabled; + bool get autoTranslationEnabled; + FileUploadConfig? get fileUploadConfig; + FileUploadConfig? get imageUploadConfig; + String get name; + + /// Create a copy of AppEventResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $AppEventResponseCopyWith get copyWith => _$AppEventResponseCopyWithImpl( + this as AppEventResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is AppEventResponse && + (identical(other.asyncUrlEnrichEnabled, asyncUrlEnrichEnabled) || + other.asyncUrlEnrichEnabled == asyncUrlEnrichEnabled) && + (identical(other.autoTranslationEnabled, autoTranslationEnabled) || + other.autoTranslationEnabled == autoTranslationEnabled) && + (identical(other.fileUploadConfig, fileUploadConfig) || other.fileUploadConfig == fileUploadConfig) && + (identical(other.imageUploadConfig, imageUploadConfig) || other.imageUploadConfig == imageUploadConfig) && + (identical(other.name, name) || other.name == name)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + asyncUrlEnrichEnabled, + autoTranslationEnabled, + fileUploadConfig, + imageUploadConfig, + name, + ); + + @override + String toString() { + return 'AppEventResponse(asyncUrlEnrichEnabled: $asyncUrlEnrichEnabled, autoTranslationEnabled: $autoTranslationEnabled, fileUploadConfig: $fileUploadConfig, imageUploadConfig: $imageUploadConfig, name: $name)'; + } +} + +/// @nodoc +abstract mixin class $AppEventResponseCopyWith<$Res> { + factory $AppEventResponseCopyWith( + AppEventResponse value, + $Res Function(AppEventResponse) _then, + ) = _$AppEventResponseCopyWithImpl; + @useResult + $Res call({ + bool? asyncUrlEnrichEnabled, + bool autoTranslationEnabled, + FileUploadConfig? fileUploadConfig, + FileUploadConfig? imageUploadConfig, + String name, + }); +} + +/// @nodoc +class _$AppEventResponseCopyWithImpl<$Res> implements $AppEventResponseCopyWith<$Res> { + _$AppEventResponseCopyWithImpl(this._self, this._then); + + final AppEventResponse _self; + final $Res Function(AppEventResponse) _then; + + /// Create a copy of AppEventResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? asyncUrlEnrichEnabled = freezed, + Object? autoTranslationEnabled = null, + Object? fileUploadConfig = freezed, + Object? imageUploadConfig = freezed, + Object? name = null, + }) { + return _then( + AppEventResponse( + asyncUrlEnrichEnabled: freezed == asyncUrlEnrichEnabled + ? _self.asyncUrlEnrichEnabled + : asyncUrlEnrichEnabled // ignore: cast_nullable_to_non_nullable + as bool?, + autoTranslationEnabled: null == autoTranslationEnabled + ? _self.autoTranslationEnabled + : autoTranslationEnabled // ignore: cast_nullable_to_non_nullable + as bool, + fileUploadConfig: freezed == fileUploadConfig + ? _self.fileUploadConfig + : fileUploadConfig // ignore: cast_nullable_to_non_nullable + as FileUploadConfig?, + imageUploadConfig: freezed == imageUploadConfig + ? _self.imageUploadConfig + : imageUploadConfig // ignore: cast_nullable_to_non_nullable + as FileUploadConfig?, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/app_event_response.g.dart b/packages/stream_chat/lib/open_api/model/app_event_response.g.dart new file mode 100644 index 0000000000..461f5eae0a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/app_event_response.g.dart @@ -0,0 +1,31 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'app_event_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +AppEventResponse _$AppEventResponseFromJson(Map json) => AppEventResponse( + asyncUrlEnrichEnabled: json['async_url_enrich_enabled'] as bool?, + autoTranslationEnabled: json['auto_translation_enabled'] as bool, + fileUploadConfig: json['file_upload_config'] == null + ? null + : FileUploadConfig.fromJson( + json['file_upload_config'] as Map, + ), + imageUploadConfig: json['image_upload_config'] == null + ? null + : FileUploadConfig.fromJson( + json['image_upload_config'] as Map, + ), + name: json['name'] as String, +); + +Map _$AppEventResponseToJson(AppEventResponse instance) => { + 'async_url_enrich_enabled': instance.asyncUrlEnrichEnabled, + 'auto_translation_enabled': instance.autoTranslationEnabled, + 'file_upload_config': instance.fileUploadConfig?.toJson(), + 'image_upload_config': instance.imageUploadConfig?.toJson(), + 'name': instance.name, +}; diff --git a/packages/stream_chat/lib/open_api/model/app_response_fields.dart b/packages/stream_chat/lib/open_api/model/app_response_fields.dart new file mode 100644 index 0000000000..798161f1be --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/app_response_fields.dart @@ -0,0 +1,61 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'app_response_fields.g.dart'; +part 'app_response_fields.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class AppResponseFields with _$AppResponseFields { + const AppResponseFields({ + required this.asyncUrlEnrichEnabled, + required this.autoTranslationEnabled, + required this.fileUploadConfig, + required this.id, + required this.imageUploadConfig, + required this.name, + required this.placement, + }); + + @override + @JsonKey(name: 'async_url_enrich_enabled') + final bool asyncUrlEnrichEnabled; + + @override + @JsonKey(name: 'auto_translation_enabled') + final bool autoTranslationEnabled; + + @override + @JsonKey(name: 'file_upload_config') + final FileUploadConfig fileUploadConfig; + + @override + @JsonKey(name: 'id') + final int id; + + @override + @JsonKey(name: 'image_upload_config') + final FileUploadConfig imageUploadConfig; + + @override + @JsonKey(name: 'name') + final String name; + + @override + @JsonKey(name: 'placement') + final String placement; + + Map toJson() => _$AppResponseFieldsToJson(this); + + static AppResponseFields fromJson(Map json) => _$AppResponseFieldsFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/app_response_fields.freezed.dart b/packages/stream_chat/lib/open_api/model/app_response_fields.freezed.dart new file mode 100644 index 0000000000..70e67a1579 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/app_response_fields.freezed.dart @@ -0,0 +1,138 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'app_response_fields.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$AppResponseFields { + bool get asyncUrlEnrichEnabled; + bool get autoTranslationEnabled; + FileUploadConfig get fileUploadConfig; + int get id; + FileUploadConfig get imageUploadConfig; + String get name; + String get placement; + + /// Create a copy of AppResponseFields + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $AppResponseFieldsCopyWith get copyWith => _$AppResponseFieldsCopyWithImpl( + this as AppResponseFields, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is AppResponseFields && + (identical(other.asyncUrlEnrichEnabled, asyncUrlEnrichEnabled) || + other.asyncUrlEnrichEnabled == asyncUrlEnrichEnabled) && + (identical(other.autoTranslationEnabled, autoTranslationEnabled) || + other.autoTranslationEnabled == autoTranslationEnabled) && + (identical(other.fileUploadConfig, fileUploadConfig) || other.fileUploadConfig == fileUploadConfig) && + (identical(other.id, id) || other.id == id) && + (identical(other.imageUploadConfig, imageUploadConfig) || other.imageUploadConfig == imageUploadConfig) && + (identical(other.name, name) || other.name == name) && + (identical(other.placement, placement) || other.placement == placement)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + asyncUrlEnrichEnabled, + autoTranslationEnabled, + fileUploadConfig, + id, + imageUploadConfig, + name, + placement, + ); + + @override + String toString() { + return 'AppResponseFields(asyncUrlEnrichEnabled: $asyncUrlEnrichEnabled, autoTranslationEnabled: $autoTranslationEnabled, fileUploadConfig: $fileUploadConfig, id: $id, imageUploadConfig: $imageUploadConfig, name: $name, placement: $placement)'; + } +} + +/// @nodoc +abstract mixin class $AppResponseFieldsCopyWith<$Res> { + factory $AppResponseFieldsCopyWith( + AppResponseFields value, + $Res Function(AppResponseFields) _then, + ) = _$AppResponseFieldsCopyWithImpl; + @useResult + $Res call({ + bool asyncUrlEnrichEnabled, + bool autoTranslationEnabled, + FileUploadConfig fileUploadConfig, + int id, + FileUploadConfig imageUploadConfig, + String name, + String placement, + }); +} + +/// @nodoc +class _$AppResponseFieldsCopyWithImpl<$Res> implements $AppResponseFieldsCopyWith<$Res> { + _$AppResponseFieldsCopyWithImpl(this._self, this._then); + + final AppResponseFields _self; + final $Res Function(AppResponseFields) _then; + + /// Create a copy of AppResponseFields + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? asyncUrlEnrichEnabled = null, + Object? autoTranslationEnabled = null, + Object? fileUploadConfig = null, + Object? id = null, + Object? imageUploadConfig = null, + Object? name = null, + Object? placement = null, + }) { + return _then( + AppResponseFields( + asyncUrlEnrichEnabled: null == asyncUrlEnrichEnabled + ? _self.asyncUrlEnrichEnabled + : asyncUrlEnrichEnabled // ignore: cast_nullable_to_non_nullable + as bool, + autoTranslationEnabled: null == autoTranslationEnabled + ? _self.autoTranslationEnabled + : autoTranslationEnabled // ignore: cast_nullable_to_non_nullable + as bool, + fileUploadConfig: null == fileUploadConfig + ? _self.fileUploadConfig + : fileUploadConfig // ignore: cast_nullable_to_non_nullable + as FileUploadConfig, + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as int, + imageUploadConfig: null == imageUploadConfig + ? _self.imageUploadConfig + : imageUploadConfig // ignore: cast_nullable_to_non_nullable + as FileUploadConfig, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + placement: null == placement + ? _self.placement + : placement // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/app_response_fields.g.dart b/packages/stream_chat/lib/open_api/model/app_response_fields.g.dart new file mode 100644 index 0000000000..3235ad1967 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/app_response_fields.g.dart @@ -0,0 +1,31 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'app_response_fields.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +AppResponseFields _$AppResponseFieldsFromJson(Map json) => AppResponseFields( + asyncUrlEnrichEnabled: json['async_url_enrich_enabled'] as bool, + autoTranslationEnabled: json['auto_translation_enabled'] as bool, + fileUploadConfig: FileUploadConfig.fromJson( + json['file_upload_config'] as Map, + ), + id: (json['id'] as num).toInt(), + imageUploadConfig: FileUploadConfig.fromJson( + json['image_upload_config'] as Map, + ), + name: json['name'] as String, + placement: json['placement'] as String, +); + +Map _$AppResponseFieldsToJson(AppResponseFields instance) => { + 'async_url_enrich_enabled': instance.asyncUrlEnrichEnabled, + 'auto_translation_enabled': instance.autoTranslationEnabled, + 'file_upload_config': instance.fileUploadConfig.toJson(), + 'id': instance.id, + 'image_upload_config': instance.imageUploadConfig.toJson(), + 'name': instance.name, + 'placement': instance.placement, +}; diff --git a/packages/stream_chat/lib/open_api/model/app_updated_event.dart b/packages/stream_chat/lib/open_api/model/app_updated_event.dart new file mode 100644 index 0000000000..d83ca31052 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/app_updated_event.dart @@ -0,0 +1,53 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'app_updated_event.g.dart'; +part 'app_updated_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class AppUpdatedEvent extends core.WsEvent with _$AppUpdatedEvent { + const AppUpdatedEvent({ + required this.app, + required this.createdAt, + required this.custom, + this.receivedAt, + required this.type, + }); + + @override + @JsonKey(name: 'app') + final AppEventResponse app; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'type') + final String type; + + Map toJson() => _$AppUpdatedEventToJson(this); + + static AppUpdatedEvent fromJson(Map json) => _$AppUpdatedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/app_updated_event.freezed.dart b/packages/stream_chat/lib/open_api/model/app_updated_event.freezed.dart new file mode 100644 index 0000000000..6b1215471a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/app_updated_event.freezed.dart @@ -0,0 +1,118 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'app_updated_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$AppUpdatedEvent { + AppEventResponse get app; + DateTime get createdAt; + Map get custom; + DateTime? get receivedAt; + String get type; + + /// Create a copy of AppUpdatedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $AppUpdatedEventCopyWith get copyWith => _$AppUpdatedEventCopyWithImpl( + this as AppUpdatedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is AppUpdatedEvent && + (identical(other.app, app) || other.app == app) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.type, type) || other.type == type)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + app, + createdAt, + const DeepCollectionEquality().hash(custom), + receivedAt, + type, + ); + + @override + String toString() { + return 'AppUpdatedEvent(app: $app, createdAt: $createdAt, custom: $custom, receivedAt: $receivedAt, type: $type)'; + } +} + +/// @nodoc +abstract mixin class $AppUpdatedEventCopyWith<$Res> { + factory $AppUpdatedEventCopyWith( + AppUpdatedEvent value, + $Res Function(AppUpdatedEvent) _then, + ) = _$AppUpdatedEventCopyWithImpl; + @useResult + $Res call({ + AppEventResponse app, + DateTime createdAt, + Map custom, + DateTime? receivedAt, + String type, + }); +} + +/// @nodoc +class _$AppUpdatedEventCopyWithImpl<$Res> implements $AppUpdatedEventCopyWith<$Res> { + _$AppUpdatedEventCopyWithImpl(this._self, this._then); + + final AppUpdatedEvent _self; + final $Res Function(AppUpdatedEvent) _then; + + /// Create a copy of AppUpdatedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? app = null, + Object? createdAt = null, + Object? custom = null, + Object? receivedAt = freezed, + Object? type = null, + }) { + return _then( + AppUpdatedEvent( + app: null == app + ? _self.app + : app // ignore: cast_nullable_to_non_nullable + as AppEventResponse, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/app_updated_event.g.dart b/packages/stream_chat/lib/open_api/model/app_updated_event.g.dart new file mode 100644 index 0000000000..a929926f11 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/app_updated_event.g.dart @@ -0,0 +1,41 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'app_updated_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +AppUpdatedEvent _$AppUpdatedEventFromJson(Map json) => AppUpdatedEvent( + app: AppEventResponse.fromJson(json['app'] as Map), + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + type: json['type'] as String, +); + +Map _$AppUpdatedEventToJson(AppUpdatedEvent instance) => { + 'app': instance.app.toJson(), + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'type': instance.type, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/appeal_item_response.dart b/packages/stream_chat/lib/open_api/model/appeal_item_response.dart new file mode 100644 index 0000000000..cb9f9da33e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/appeal_item_response.dart @@ -0,0 +1,143 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'appeal_item_response.g.dart'; +part 'appeal_item_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class AppealItemResponse with _$AppealItemResponse { + const AppealItemResponse({ + this.actions, + this.aiTextSeverity, + required this.appealReason, + this.attachments, + this.channelCid, + this.configKey, + required this.createdAt, + this.decisionReason, + this.entityContent, + required this.entityId, + required this.entityType, + this.flagLabels, + this.flagTypes, + this.flags, + required this.id, + this.moderationAction, + this.originalModerationAction, + this.recommendedAction, + this.reviewQueueItemId, + this.severity, + required this.status, + required this.updatedAt, + this.user, + }); + + @override + @JsonKey(name: 'actions') + final List? actions; + + @override + @JsonKey(name: 'ai_text_severity') + final String? aiTextSeverity; + + @override + @JsonKey(name: 'appeal_reason') + final String appealReason; + + @override + @JsonKey(name: 'attachments') + final List? attachments; + + @override + @JsonKey(name: 'channel_cid') + final String? channelCid; + + @override + @JsonKey(name: 'config_key') + final String? configKey; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'decision_reason') + final String? decisionReason; + + @override + @JsonKey(name: 'entity_content') + final ModerationPayload? entityContent; + + @override + @JsonKey(name: 'entity_id') + final String entityId; + + @override + @JsonKey(name: 'entity_type') + final String entityType; + + @override + @JsonKey(name: 'flag_labels') + final List? flagLabels; + + @override + @JsonKey(name: 'flag_types') + final List? flagTypes; + + @override + @JsonKey(name: 'flags') + final List? flags; + + @override + @JsonKey(name: 'id') + final String id; + + @override + @JsonKey(name: 'moderation_action') + final ActionLogResponse? moderationAction; + + @override + @JsonKey(name: 'original_moderation_action') + final ActionLogResponse? originalModerationAction; + + @override + @JsonKey(name: 'recommended_action') + final String? recommendedAction; + + @override + @JsonKey(name: 'review_queue_item_id') + final String? reviewQueueItemId; + + @override + @JsonKey(name: 'severity') + final int? severity; + + @override + @JsonKey(name: 'status') + final String status; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'updated_at') + final DateTime updatedAt; + + @override + @JsonKey(name: 'user') + final UserResponse? user; + + Map toJson() => _$AppealItemResponseToJson(this); + + static AppealItemResponse fromJson(Map json) => _$AppealItemResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/appeal_item_response.freezed.dart b/packages/stream_chat/lib/open_api/model/appeal_item_response.freezed.dart new file mode 100644 index 0000000000..03317cd650 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/appeal_item_response.freezed.dart @@ -0,0 +1,290 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'appeal_item_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$AppealItemResponse { + List? get actions; + String? get aiTextSeverity; + String get appealReason; + List? get attachments; + String? get channelCid; + String? get configKey; + DateTime get createdAt; + String? get decisionReason; + ModerationPayload? get entityContent; + String get entityId; + String get entityType; + List? get flagLabels; + List? get flagTypes; + List? get flags; + String get id; + ActionLogResponse? get moderationAction; + ActionLogResponse? get originalModerationAction; + String? get recommendedAction; + String? get reviewQueueItemId; + int? get severity; + String get status; + DateTime get updatedAt; + UserResponse? get user; + + /// Create a copy of AppealItemResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $AppealItemResponseCopyWith get copyWith => _$AppealItemResponseCopyWithImpl( + this as AppealItemResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is AppealItemResponse && + const DeepCollectionEquality().equals(other.actions, actions) && + (identical(other.aiTextSeverity, aiTextSeverity) || other.aiTextSeverity == aiTextSeverity) && + (identical(other.appealReason, appealReason) || other.appealReason == appealReason) && + const DeepCollectionEquality().equals( + other.attachments, + attachments, + ) && + (identical(other.channelCid, channelCid) || other.channelCid == channelCid) && + (identical(other.configKey, configKey) || other.configKey == configKey) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.decisionReason, decisionReason) || other.decisionReason == decisionReason) && + (identical(other.entityContent, entityContent) || other.entityContent == entityContent) && + (identical(other.entityId, entityId) || other.entityId == entityId) && + (identical(other.entityType, entityType) || other.entityType == entityType) && + const DeepCollectionEquality().equals( + other.flagLabels, + flagLabels, + ) && + const DeepCollectionEquality().equals(other.flagTypes, flagTypes) && + const DeepCollectionEquality().equals(other.flags, flags) && + (identical(other.id, id) || other.id == id) && + (identical(other.moderationAction, moderationAction) || other.moderationAction == moderationAction) && + (identical( + other.originalModerationAction, + originalModerationAction, + ) || + other.originalModerationAction == originalModerationAction) && + (identical(other.recommendedAction, recommendedAction) || other.recommendedAction == recommendedAction) && + (identical(other.reviewQueueItemId, reviewQueueItemId) || other.reviewQueueItemId == reviewQueueItemId) && + (identical(other.severity, severity) || other.severity == severity) && + (identical(other.status, status) || other.status == status) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hashAll([ + runtimeType, + const DeepCollectionEquality().hash(actions), + aiTextSeverity, + appealReason, + const DeepCollectionEquality().hash(attachments), + channelCid, + configKey, + createdAt, + decisionReason, + entityContent, + entityId, + entityType, + const DeepCollectionEquality().hash(flagLabels), + const DeepCollectionEquality().hash(flagTypes), + const DeepCollectionEquality().hash(flags), + id, + moderationAction, + originalModerationAction, + recommendedAction, + reviewQueueItemId, + severity, + status, + updatedAt, + user, + ]); + + @override + String toString() { + return 'AppealItemResponse(actions: $actions, aiTextSeverity: $aiTextSeverity, appealReason: $appealReason, attachments: $attachments, channelCid: $channelCid, configKey: $configKey, createdAt: $createdAt, decisionReason: $decisionReason, entityContent: $entityContent, entityId: $entityId, entityType: $entityType, flagLabels: $flagLabels, flagTypes: $flagTypes, flags: $flags, id: $id, moderationAction: $moderationAction, originalModerationAction: $originalModerationAction, recommendedAction: $recommendedAction, reviewQueueItemId: $reviewQueueItemId, severity: $severity, status: $status, updatedAt: $updatedAt, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $AppealItemResponseCopyWith<$Res> { + factory $AppealItemResponseCopyWith( + AppealItemResponse value, + $Res Function(AppealItemResponse) _then, + ) = _$AppealItemResponseCopyWithImpl; + @useResult + $Res call({ + List? actions, + String? aiTextSeverity, + String appealReason, + List? attachments, + String? channelCid, + String? configKey, + DateTime createdAt, + String? decisionReason, + ModerationPayload? entityContent, + String entityId, + String entityType, + List? flagLabels, + List? flagTypes, + List? flags, + String id, + ActionLogResponse? moderationAction, + ActionLogResponse? originalModerationAction, + String? recommendedAction, + String? reviewQueueItemId, + int? severity, + String status, + DateTime updatedAt, + UserResponse? user, + }); +} + +/// @nodoc +class _$AppealItemResponseCopyWithImpl<$Res> implements $AppealItemResponseCopyWith<$Res> { + _$AppealItemResponseCopyWithImpl(this._self, this._then); + + final AppealItemResponse _self; + final $Res Function(AppealItemResponse) _then; + + /// Create a copy of AppealItemResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? actions = freezed, + Object? aiTextSeverity = freezed, + Object? appealReason = null, + Object? attachments = freezed, + Object? channelCid = freezed, + Object? configKey = freezed, + Object? createdAt = null, + Object? decisionReason = freezed, + Object? entityContent = freezed, + Object? entityId = null, + Object? entityType = null, + Object? flagLabels = freezed, + Object? flagTypes = freezed, + Object? flags = freezed, + Object? id = null, + Object? moderationAction = freezed, + Object? originalModerationAction = freezed, + Object? recommendedAction = freezed, + Object? reviewQueueItemId = freezed, + Object? severity = freezed, + Object? status = null, + Object? updatedAt = null, + Object? user = freezed, + }) { + return _then( + AppealItemResponse( + actions: freezed == actions + ? _self.actions + : actions // ignore: cast_nullable_to_non_nullable + as List?, + aiTextSeverity: freezed == aiTextSeverity + ? _self.aiTextSeverity + : aiTextSeverity // ignore: cast_nullable_to_non_nullable + as String?, + appealReason: null == appealReason + ? _self.appealReason + : appealReason // ignore: cast_nullable_to_non_nullable + as String, + attachments: freezed == attachments + ? _self.attachments + : attachments // ignore: cast_nullable_to_non_nullable + as List?, + channelCid: freezed == channelCid + ? _self.channelCid + : channelCid // ignore: cast_nullable_to_non_nullable + as String?, + configKey: freezed == configKey + ? _self.configKey + : configKey // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + decisionReason: freezed == decisionReason + ? _self.decisionReason + : decisionReason // ignore: cast_nullable_to_non_nullable + as String?, + entityContent: freezed == entityContent + ? _self.entityContent + : entityContent // ignore: cast_nullable_to_non_nullable + as ModerationPayload?, + entityId: null == entityId + ? _self.entityId + : entityId // ignore: cast_nullable_to_non_nullable + as String, + entityType: null == entityType + ? _self.entityType + : entityType // ignore: cast_nullable_to_non_nullable + as String, + flagLabels: freezed == flagLabels + ? _self.flagLabels + : flagLabels // ignore: cast_nullable_to_non_nullable + as List?, + flagTypes: freezed == flagTypes + ? _self.flagTypes + : flagTypes // ignore: cast_nullable_to_non_nullable + as List?, + flags: freezed == flags + ? _self.flags + : flags // ignore: cast_nullable_to_non_nullable + as List?, + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + moderationAction: freezed == moderationAction + ? _self.moderationAction + : moderationAction // ignore: cast_nullable_to_non_nullable + as ActionLogResponse?, + originalModerationAction: freezed == originalModerationAction + ? _self.originalModerationAction + : originalModerationAction // ignore: cast_nullable_to_non_nullable + as ActionLogResponse?, + recommendedAction: freezed == recommendedAction + ? _self.recommendedAction + : recommendedAction // ignore: cast_nullable_to_non_nullable + as String?, + reviewQueueItemId: freezed == reviewQueueItemId + ? _self.reviewQueueItemId + : reviewQueueItemId // ignore: cast_nullable_to_non_nullable + as String?, + severity: freezed == severity + ? _self.severity + : severity // ignore: cast_nullable_to_non_nullable + as int?, + status: null == status + ? _self.status + : status // ignore: cast_nullable_to_non_nullable + as String, + updatedAt: null == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponse?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/appeal_item_response.g.dart b/packages/stream_chat/lib/open_api/model/appeal_item_response.g.dart new file mode 100644 index 0000000000..179ca9f54e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/appeal_item_response.g.dart @@ -0,0 +1,81 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'appeal_item_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +AppealItemResponse _$AppealItemResponseFromJson(Map json) => AppealItemResponse( + actions: (json['actions'] as List?) + ?.map((e) => ActionLogResponse.fromJson(e as Map)) + .toList(), + aiTextSeverity: json['ai_text_severity'] as String?, + appealReason: json['appeal_reason'] as String, + attachments: (json['attachments'] as List?)?.map((e) => e as String).toList(), + channelCid: json['channel_cid'] as String?, + configKey: json['config_key'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + decisionReason: json['decision_reason'] as String?, + entityContent: json['entity_content'] == null + ? null + : ModerationPayload.fromJson( + json['entity_content'] as Map, + ), + entityId: json['entity_id'] as String, + entityType: json['entity_type'] as String, + flagLabels: (json['flag_labels'] as List?)?.map((e) => e as String).toList(), + flagTypes: (json['flag_types'] as List?)?.map((e) => e as String).toList(), + flags: (json['flags'] as List?) + ?.map( + (e) => ModerationFlagResponse.fromJson(e as Map), + ) + .toList(), + id: json['id'] as String, + moderationAction: json['moderation_action'] == null + ? null + : ActionLogResponse.fromJson( + json['moderation_action'] as Map, + ), + originalModerationAction: json['original_moderation_action'] == null + ? null + : ActionLogResponse.fromJson( + json['original_moderation_action'] as Map, + ), + recommendedAction: json['recommended_action'] as String?, + reviewQueueItemId: json['review_queue_item_id'] as String?, + severity: (json['severity'] as num?)?.toInt(), + status: json['status'] as String, + updatedAt: const StreamDateTimeConverter().fromJson( + json['updated_at'] as Object, + ), + user: json['user'] == null ? null : UserResponse.fromJson(json['user'] as Map), +); + +Map _$AppealItemResponseToJson(AppealItemResponse instance) => { + 'actions': instance.actions?.map((e) => e.toJson()).toList(), + 'ai_text_severity': instance.aiTextSeverity, + 'appeal_reason': instance.appealReason, + 'attachments': instance.attachments, + 'channel_cid': instance.channelCid, + 'config_key': instance.configKey, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'decision_reason': instance.decisionReason, + 'entity_content': instance.entityContent?.toJson(), + 'entity_id': instance.entityId, + 'entity_type': instance.entityType, + 'flag_labels': instance.flagLabels, + 'flag_types': instance.flagTypes, + 'flags': instance.flags?.map((e) => e.toJson()).toList(), + 'id': instance.id, + 'moderation_action': instance.moderationAction?.toJson(), + 'original_moderation_action': instance.originalModerationAction?.toJson(), + 'recommended_action': instance.recommendedAction, + 'review_queue_item_id': instance.reviewQueueItemId, + 'severity': instance.severity, + 'status': instance.status, + 'updated_at': const StreamDateTimeConverter().toJson(instance.updatedAt), + 'user': instance.user?.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/appeal_request.dart b/packages/stream_chat/lib/open_api/model/appeal_request.dart new file mode 100644 index 0000000000..27259408e3 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/appeal_request.dart @@ -0,0 +1,51 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'appeal_request.g.dart'; +part 'appeal_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class AppealRequest with _$AppealRequest { + const AppealRequest({ + required this.appealReason, + this.attachments, + required this.entityId, + required this.entityType, + this.reviewQueueItemId, + }); + + @override + @JsonKey(name: 'appeal_reason') + final String appealReason; + + @override + @JsonKey(name: 'attachments') + final List? attachments; + + @override + @JsonKey(name: 'entity_id') + final String entityId; + + @override + @JsonKey(name: 'entity_type') + final String entityType; + + @override + @JsonKey(name: 'review_queue_item_id') + final String? reviewQueueItemId; + + Map toJson() => _$AppealRequestToJson(this); + + static AppealRequest fromJson(Map json) => _$AppealRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/appeal_request.freezed.dart b/packages/stream_chat/lib/open_api/model/appeal_request.freezed.dart new file mode 100644 index 0000000000..3c42ef2de1 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/appeal_request.freezed.dart @@ -0,0 +1,121 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'appeal_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$AppealRequest { + String get appealReason; + List? get attachments; + String get entityId; + String get entityType; + String? get reviewQueueItemId; + + /// Create a copy of AppealRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $AppealRequestCopyWith get copyWith => _$AppealRequestCopyWithImpl( + this as AppealRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is AppealRequest && + (identical(other.appealReason, appealReason) || other.appealReason == appealReason) && + const DeepCollectionEquality().equals( + other.attachments, + attachments, + ) && + (identical(other.entityId, entityId) || other.entityId == entityId) && + (identical(other.entityType, entityType) || other.entityType == entityType) && + (identical(other.reviewQueueItemId, reviewQueueItemId) || other.reviewQueueItemId == reviewQueueItemId)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + appealReason, + const DeepCollectionEquality().hash(attachments), + entityId, + entityType, + reviewQueueItemId, + ); + + @override + String toString() { + return 'AppealRequest(appealReason: $appealReason, attachments: $attachments, entityId: $entityId, entityType: $entityType, reviewQueueItemId: $reviewQueueItemId)'; + } +} + +/// @nodoc +abstract mixin class $AppealRequestCopyWith<$Res> { + factory $AppealRequestCopyWith( + AppealRequest value, + $Res Function(AppealRequest) _then, + ) = _$AppealRequestCopyWithImpl; + @useResult + $Res call({ + String appealReason, + List? attachments, + String entityId, + String entityType, + String? reviewQueueItemId, + }); +} + +/// @nodoc +class _$AppealRequestCopyWithImpl<$Res> implements $AppealRequestCopyWith<$Res> { + _$AppealRequestCopyWithImpl(this._self, this._then); + + final AppealRequest _self; + final $Res Function(AppealRequest) _then; + + /// Create a copy of AppealRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? appealReason = null, + Object? attachments = freezed, + Object? entityId = null, + Object? entityType = null, + Object? reviewQueueItemId = freezed, + }) { + return _then( + AppealRequest( + appealReason: null == appealReason + ? _self.appealReason + : appealReason // ignore: cast_nullable_to_non_nullable + as String, + attachments: freezed == attachments + ? _self.attachments + : attachments // ignore: cast_nullable_to_non_nullable + as List?, + entityId: null == entityId + ? _self.entityId + : entityId // ignore: cast_nullable_to_non_nullable + as String, + entityType: null == entityType + ? _self.entityType + : entityType // ignore: cast_nullable_to_non_nullable + as String, + reviewQueueItemId: freezed == reviewQueueItemId + ? _self.reviewQueueItemId + : reviewQueueItemId // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/appeal_request.g.dart b/packages/stream_chat/lib/open_api/model/appeal_request.g.dart new file mode 100644 index 0000000000..c489d13ccf --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/appeal_request.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'appeal_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +AppealRequest _$AppealRequestFromJson(Map json) => AppealRequest( + appealReason: json['appeal_reason'] as String, + attachments: (json['attachments'] as List?)?.map((e) => e as String).toList(), + entityId: json['entity_id'] as String, + entityType: json['entity_type'] as String, + reviewQueueItemId: json['review_queue_item_id'] as String?, +); + +Map _$AppealRequestToJson(AppealRequest instance) => { + 'appeal_reason': instance.appealReason, + 'attachments': instance.attachments, + 'entity_id': instance.entityId, + 'entity_type': instance.entityType, + 'review_queue_item_id': instance.reviewQueueItemId, +}; diff --git a/packages/stream_chat/lib/open_api/model/appeal_response.dart b/packages/stream_chat/lib/open_api/model/appeal_response.dart new file mode 100644 index 0000000000..b4a0104131 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/appeal_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'appeal_response.g.dart'; +part 'appeal_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class AppealResponse with _$AppealResponse { + const AppealResponse({ + required this.appealId, + required this.duration, + }); + + @override + @JsonKey(name: 'appeal_id') + final String appealId; + + @override + @JsonKey(name: 'duration') + final String duration; + + Map toJson() => _$AppealResponseToJson(this); + + static AppealResponse fromJson(Map json) => _$AppealResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/appeal_response.freezed.dart b/packages/stream_chat/lib/open_api/model/appeal_response.freezed.dart new file mode 100644 index 0000000000..df9b12d4f1 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/appeal_response.freezed.dart @@ -0,0 +1,81 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'appeal_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$AppealResponse { + String get appealId; + String get duration; + + /// Create a copy of AppealResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $AppealResponseCopyWith get copyWith => _$AppealResponseCopyWithImpl( + this as AppealResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is AppealResponse && + (identical(other.appealId, appealId) || other.appealId == appealId) && + (identical(other.duration, duration) || other.duration == duration)); + } + + @override + int get hashCode => Object.hash(runtimeType, appealId, duration); + + @override + String toString() { + return 'AppealResponse(appealId: $appealId, duration: $duration)'; + } +} + +/// @nodoc +abstract mixin class $AppealResponseCopyWith<$Res> { + factory $AppealResponseCopyWith( + AppealResponse value, + $Res Function(AppealResponse) _then, + ) = _$AppealResponseCopyWithImpl; + @useResult + $Res call({String appealId, String duration}); +} + +/// @nodoc +class _$AppealResponseCopyWithImpl<$Res> implements $AppealResponseCopyWith<$Res> { + _$AppealResponseCopyWithImpl(this._self, this._then); + + final AppealResponse _self; + final $Res Function(AppealResponse) _then; + + /// Create a copy of AppealResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? appealId = null, Object? duration = null}) { + return _then( + AppealResponse( + appealId: null == appealId + ? _self.appealId + : appealId // ignore: cast_nullable_to_non_nullable + as String, + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/appeal_response.g.dart b/packages/stream_chat/lib/open_api/model/appeal_response.g.dart new file mode 100644 index 0000000000..17ee2d5afb --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/appeal_response.g.dart @@ -0,0 +1,17 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'appeal_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +AppealResponse _$AppealResponseFromJson(Map json) => AppealResponse( + appealId: json['appeal_id'] as String, + duration: json['duration'] as String, +); + +Map _$AppealResponseToJson(AppealResponse instance) => { + 'appeal_id': instance.appealId, + 'duration': instance.duration, +}; diff --git a/packages/stream_chat/lib/open_api/model/attachment.dart b/packages/stream_chat/lib/open_api/model/attachment.dart new file mode 100644 index 0000000000..061fac17e8 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/attachment.dart @@ -0,0 +1,136 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'attachment.g.dart'; +part 'attachment.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class Attachment with _$Attachment { + const Attachment({ + this.actions, + this.assetUrl, + this.authorIcon, + this.authorLink, + this.authorName, + this.color, + required this.custom, + this.fallback, + this.fields, + this.footer, + this.footerIcon, + this.giphy, + this.imageUrl, + this.ogScrapeUrl, + this.originalHeight, + this.originalWidth, + this.pretext, + this.text, + this.thumbUrl, + this.title, + this.titleLink, + this.type, + }); + + @override + @JsonKey(name: 'actions') + final List? actions; + + @override + @JsonKey(name: 'asset_url') + final String? assetUrl; + + @override + @JsonKey(name: 'author_icon') + final String? authorIcon; + + @override + @JsonKey(name: 'author_link') + final String? authorLink; + + @override + @JsonKey(name: 'author_name') + final String? authorName; + + @override + @JsonKey(name: 'color') + final String? color; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'fallback') + final String? fallback; + + @override + @JsonKey(name: 'fields') + final List? fields; + + @override + @JsonKey(name: 'footer') + final String? footer; + + @override + @JsonKey(name: 'footer_icon') + final String? footerIcon; + + @override + @JsonKey(name: 'giphy') + final Images? giphy; + + @override + @JsonKey(name: 'image_url') + final String? imageUrl; + + @override + @JsonKey(name: 'og_scrape_url') + final String? ogScrapeUrl; + + @override + @JsonKey(name: 'original_height') + final int? originalHeight; + + @override + @JsonKey(name: 'original_width') + final int? originalWidth; + + @override + @JsonKey(name: 'pretext') + final String? pretext; + + @override + @JsonKey(name: 'text') + final String? text; + + @override + @JsonKey(name: 'thumb_url') + final String? thumbUrl; + + @override + @JsonKey(name: 'title') + final String? title; + + @override + @JsonKey(name: 'title_link') + final String? titleLink; + + @override + @JsonKey(name: 'type') + final String? type; + + Map toJson() => _$AttachmentToJson(this); + + static Attachment fromJson(Map json) => _$AttachmentFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/attachment.freezed.dart b/packages/stream_chat/lib/open_api/model/attachment.freezed.dart new file mode 100644 index 0000000000..6f240eec6e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/attachment.freezed.dart @@ -0,0 +1,268 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'attachment.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$Attachment { + List? get actions; + String? get assetUrl; + String? get authorIcon; + String? get authorLink; + String? get authorName; + String? get color; + Map get custom; + String? get fallback; + List? get fields; + String? get footer; + String? get footerIcon; + Images? get giphy; + String? get imageUrl; + String? get ogScrapeUrl; + int? get originalHeight; + int? get originalWidth; + String? get pretext; + String? get text; + String? get thumbUrl; + String? get title; + String? get titleLink; + String? get type; + + /// Create a copy of Attachment + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $AttachmentCopyWith get copyWith => _$AttachmentCopyWithImpl(this as Attachment, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is Attachment && + const DeepCollectionEquality().equals(other.actions, actions) && + (identical(other.assetUrl, assetUrl) || other.assetUrl == assetUrl) && + (identical(other.authorIcon, authorIcon) || other.authorIcon == authorIcon) && + (identical(other.authorLink, authorLink) || other.authorLink == authorLink) && + (identical(other.authorName, authorName) || other.authorName == authorName) && + (identical(other.color, color) || other.color == color) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.fallback, fallback) || other.fallback == fallback) && + const DeepCollectionEquality().equals(other.fields, fields) && + (identical(other.footer, footer) || other.footer == footer) && + (identical(other.footerIcon, footerIcon) || other.footerIcon == footerIcon) && + (identical(other.giphy, giphy) || other.giphy == giphy) && + (identical(other.imageUrl, imageUrl) || other.imageUrl == imageUrl) && + (identical(other.ogScrapeUrl, ogScrapeUrl) || other.ogScrapeUrl == ogScrapeUrl) && + (identical(other.originalHeight, originalHeight) || other.originalHeight == originalHeight) && + (identical(other.originalWidth, originalWidth) || other.originalWidth == originalWidth) && + (identical(other.pretext, pretext) || other.pretext == pretext) && + (identical(other.text, text) || other.text == text) && + (identical(other.thumbUrl, thumbUrl) || other.thumbUrl == thumbUrl) && + (identical(other.title, title) || other.title == title) && + (identical(other.titleLink, titleLink) || other.titleLink == titleLink) && + (identical(other.type, type) || other.type == type)); + } + + @override + int get hashCode => Object.hashAll([ + runtimeType, + const DeepCollectionEquality().hash(actions), + assetUrl, + authorIcon, + authorLink, + authorName, + color, + const DeepCollectionEquality().hash(custom), + fallback, + const DeepCollectionEquality().hash(fields), + footer, + footerIcon, + giphy, + imageUrl, + ogScrapeUrl, + originalHeight, + originalWidth, + pretext, + text, + thumbUrl, + title, + titleLink, + type, + ]); + + @override + String toString() { + return 'Attachment(actions: $actions, assetUrl: $assetUrl, authorIcon: $authorIcon, authorLink: $authorLink, authorName: $authorName, color: $color, custom: $custom, fallback: $fallback, fields: $fields, footer: $footer, footerIcon: $footerIcon, giphy: $giphy, imageUrl: $imageUrl, ogScrapeUrl: $ogScrapeUrl, originalHeight: $originalHeight, originalWidth: $originalWidth, pretext: $pretext, text: $text, thumbUrl: $thumbUrl, title: $title, titleLink: $titleLink, type: $type)'; + } +} + +/// @nodoc +abstract mixin class $AttachmentCopyWith<$Res> { + factory $AttachmentCopyWith( + Attachment value, + $Res Function(Attachment) _then, + ) = _$AttachmentCopyWithImpl; + @useResult + $Res call({ + List? actions, + String? assetUrl, + String? authorIcon, + String? authorLink, + String? authorName, + String? color, + Map custom, + String? fallback, + List? fields, + String? footer, + String? footerIcon, + Images? giphy, + String? imageUrl, + String? ogScrapeUrl, + int? originalHeight, + int? originalWidth, + String? pretext, + String? text, + String? thumbUrl, + String? title, + String? titleLink, + String? type, + }); +} + +/// @nodoc +class _$AttachmentCopyWithImpl<$Res> implements $AttachmentCopyWith<$Res> { + _$AttachmentCopyWithImpl(this._self, this._then); + + final Attachment _self; + final $Res Function(Attachment) _then; + + /// Create a copy of Attachment + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? actions = freezed, + Object? assetUrl = freezed, + Object? authorIcon = freezed, + Object? authorLink = freezed, + Object? authorName = freezed, + Object? color = freezed, + Object? custom = null, + Object? fallback = freezed, + Object? fields = freezed, + Object? footer = freezed, + Object? footerIcon = freezed, + Object? giphy = freezed, + Object? imageUrl = freezed, + Object? ogScrapeUrl = freezed, + Object? originalHeight = freezed, + Object? originalWidth = freezed, + Object? pretext = freezed, + Object? text = freezed, + Object? thumbUrl = freezed, + Object? title = freezed, + Object? titleLink = freezed, + Object? type = freezed, + }) { + return _then( + Attachment( + actions: freezed == actions + ? _self.actions + : actions // ignore: cast_nullable_to_non_nullable + as List?, + assetUrl: freezed == assetUrl + ? _self.assetUrl + : assetUrl // ignore: cast_nullable_to_non_nullable + as String?, + authorIcon: freezed == authorIcon + ? _self.authorIcon + : authorIcon // ignore: cast_nullable_to_non_nullable + as String?, + authorLink: freezed == authorLink + ? _self.authorLink + : authorLink // ignore: cast_nullable_to_non_nullable + as String?, + authorName: freezed == authorName + ? _self.authorName + : authorName // ignore: cast_nullable_to_non_nullable + as String?, + color: freezed == color + ? _self.color + : color // ignore: cast_nullable_to_non_nullable + as String?, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + fallback: freezed == fallback + ? _self.fallback + : fallback // ignore: cast_nullable_to_non_nullable + as String?, + fields: freezed == fields + ? _self.fields + : fields // ignore: cast_nullable_to_non_nullable + as List?, + footer: freezed == footer + ? _self.footer + : footer // ignore: cast_nullable_to_non_nullable + as String?, + footerIcon: freezed == footerIcon + ? _self.footerIcon + : footerIcon // ignore: cast_nullable_to_non_nullable + as String?, + giphy: freezed == giphy + ? _self.giphy + : giphy // ignore: cast_nullable_to_non_nullable + as Images?, + imageUrl: freezed == imageUrl + ? _self.imageUrl + : imageUrl // ignore: cast_nullable_to_non_nullable + as String?, + ogScrapeUrl: freezed == ogScrapeUrl + ? _self.ogScrapeUrl + : ogScrapeUrl // ignore: cast_nullable_to_non_nullable + as String?, + originalHeight: freezed == originalHeight + ? _self.originalHeight + : originalHeight // ignore: cast_nullable_to_non_nullable + as int?, + originalWidth: freezed == originalWidth + ? _self.originalWidth + : originalWidth // ignore: cast_nullable_to_non_nullable + as int?, + pretext: freezed == pretext + ? _self.pretext + : pretext // ignore: cast_nullable_to_non_nullable + as String?, + text: freezed == text + ? _self.text + : text // ignore: cast_nullable_to_non_nullable + as String?, + thumbUrl: freezed == thumbUrl + ? _self.thumbUrl + : thumbUrl // ignore: cast_nullable_to_non_nullable + as String?, + title: freezed == title + ? _self.title + : title // ignore: cast_nullable_to_non_nullable + as String?, + titleLink: freezed == titleLink + ? _self.titleLink + : titleLink // ignore: cast_nullable_to_non_nullable + as String?, + type: freezed == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/attachment.g.dart b/packages/stream_chat/lib/open_api/model/attachment.g.dart new file mode 100644 index 0000000000..1643be68da --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/attachment.g.dart @@ -0,0 +1,57 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'attachment.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +Attachment _$AttachmentFromJson(Map json) => Attachment( + actions: (json['actions'] as List?)?.map((e) => Action.fromJson(e as Map)).toList(), + assetUrl: json['asset_url'] as String?, + authorIcon: json['author_icon'] as String?, + authorLink: json['author_link'] as String?, + authorName: json['author_name'] as String?, + color: json['color'] as String?, + custom: json['custom'] as Map, + fallback: json['fallback'] as String?, + fields: (json['fields'] as List?)?.map((e) => Field.fromJson(e as Map)).toList(), + footer: json['footer'] as String?, + footerIcon: json['footer_icon'] as String?, + giphy: json['giphy'] == null ? null : Images.fromJson(json['giphy'] as Map), + imageUrl: json['image_url'] as String?, + ogScrapeUrl: json['og_scrape_url'] as String?, + originalHeight: (json['original_height'] as num?)?.toInt(), + originalWidth: (json['original_width'] as num?)?.toInt(), + pretext: json['pretext'] as String?, + text: json['text'] as String?, + thumbUrl: json['thumb_url'] as String?, + title: json['title'] as String?, + titleLink: json['title_link'] as String?, + type: json['type'] as String?, +); + +Map _$AttachmentToJson(Attachment instance) => { + 'actions': instance.actions?.map((e) => e.toJson()).toList(), + 'asset_url': instance.assetUrl, + 'author_icon': instance.authorIcon, + 'author_link': instance.authorLink, + 'author_name': instance.authorName, + 'color': instance.color, + 'custom': instance.custom, + 'fallback': instance.fallback, + 'fields': instance.fields?.map((e) => e.toJson()).toList(), + 'footer': instance.footer, + 'footer_icon': instance.footerIcon, + 'giphy': instance.giphy?.toJson(), + 'image_url': instance.imageUrl, + 'og_scrape_url': instance.ogScrapeUrl, + 'original_height': instance.originalHeight, + 'original_width': instance.originalWidth, + 'pretext': instance.pretext, + 'text': instance.text, + 'thumb_url': instance.thumbUrl, + 'title': instance.title, + 'title_link': instance.titleLink, + 'type': instance.type, +}; diff --git a/packages/stream_chat/lib/open_api/model/automod_details_response.dart b/packages/stream_chat/lib/open_api/model/automod_details_response.dart new file mode 100644 index 0000000000..21d5c483bb --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/automod_details_response.dart @@ -0,0 +1,51 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'automod_details_response.g.dart'; +part 'automod_details_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class AutomodDetailsResponse with _$AutomodDetailsResponse { + const AutomodDetailsResponse({ + this.action, + this.imageLabels, + this.messageDetails, + this.originalMessageType, + this.result, + }); + + @override + @JsonKey(name: 'action') + final String? action; + + @override + @JsonKey(name: 'image_labels') + final List? imageLabels; + + @override + @JsonKey(name: 'message_details') + final FlagMessageDetailsResponse? messageDetails; + + @override + @JsonKey(name: 'original_message_type') + final String? originalMessageType; + + @override + @JsonKey(name: 'result') + final MessageModerationResult? result; + + Map toJson() => _$AutomodDetailsResponseToJson(this); + + static AutomodDetailsResponse fromJson(Map json) => _$AutomodDetailsResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/automod_details_response.freezed.dart b/packages/stream_chat/lib/open_api/model/automod_details_response.freezed.dart new file mode 100644 index 0000000000..bbe66b7e40 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/automod_details_response.freezed.dart @@ -0,0 +1,123 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'automod_details_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$AutomodDetailsResponse { + String? get action; + List? get imageLabels; + FlagMessageDetailsResponse? get messageDetails; + String? get originalMessageType; + MessageModerationResult? get result; + + /// Create a copy of AutomodDetailsResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $AutomodDetailsResponseCopyWith get copyWith => + _$AutomodDetailsResponseCopyWithImpl( + this as AutomodDetailsResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is AutomodDetailsResponse && + (identical(other.action, action) || other.action == action) && + const DeepCollectionEquality().equals( + other.imageLabels, + imageLabels, + ) && + (identical(other.messageDetails, messageDetails) || other.messageDetails == messageDetails) && + (identical(other.originalMessageType, originalMessageType) || + other.originalMessageType == originalMessageType) && + (identical(other.result, result) || other.result == result)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + action, + const DeepCollectionEquality().hash(imageLabels), + messageDetails, + originalMessageType, + result, + ); + + @override + String toString() { + return 'AutomodDetailsResponse(action: $action, imageLabels: $imageLabels, messageDetails: $messageDetails, originalMessageType: $originalMessageType, result: $result)'; + } +} + +/// @nodoc +abstract mixin class $AutomodDetailsResponseCopyWith<$Res> { + factory $AutomodDetailsResponseCopyWith( + AutomodDetailsResponse value, + $Res Function(AutomodDetailsResponse) _then, + ) = _$AutomodDetailsResponseCopyWithImpl; + @useResult + $Res call({ + String? action, + List? imageLabels, + FlagMessageDetailsResponse? messageDetails, + String? originalMessageType, + MessageModerationResult? result, + }); +} + +/// @nodoc +class _$AutomodDetailsResponseCopyWithImpl<$Res> implements $AutomodDetailsResponseCopyWith<$Res> { + _$AutomodDetailsResponseCopyWithImpl(this._self, this._then); + + final AutomodDetailsResponse _self; + final $Res Function(AutomodDetailsResponse) _then; + + /// Create a copy of AutomodDetailsResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? action = freezed, + Object? imageLabels = freezed, + Object? messageDetails = freezed, + Object? originalMessageType = freezed, + Object? result = freezed, + }) { + return _then( + AutomodDetailsResponse( + action: freezed == action + ? _self.action + : action // ignore: cast_nullable_to_non_nullable + as String?, + imageLabels: freezed == imageLabels + ? _self.imageLabels + : imageLabels // ignore: cast_nullable_to_non_nullable + as List?, + messageDetails: freezed == messageDetails + ? _self.messageDetails + : messageDetails // ignore: cast_nullable_to_non_nullable + as FlagMessageDetailsResponse?, + originalMessageType: freezed == originalMessageType + ? _self.originalMessageType + : originalMessageType // ignore: cast_nullable_to_non_nullable + as String?, + result: freezed == result + ? _self.result + : result // ignore: cast_nullable_to_non_nullable + as MessageModerationResult?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/automod_details_response.g.dart b/packages/stream_chat/lib/open_api/model/automod_details_response.g.dart new file mode 100644 index 0000000000..627b72cb3f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/automod_details_response.g.dart @@ -0,0 +1,35 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'automod_details_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +AutomodDetailsResponse _$AutomodDetailsResponseFromJson( + Map json, +) => AutomodDetailsResponse( + action: json['action'] as String?, + imageLabels: (json['image_labels'] as List?)?.map((e) => e as String).toList(), + messageDetails: json['message_details'] == null + ? null + : FlagMessageDetailsResponse.fromJson( + json['message_details'] as Map, + ), + originalMessageType: json['original_message_type'] as String?, + result: json['result'] == null + ? null + : MessageModerationResult.fromJson( + json['result'] as Map, + ), +); + +Map _$AutomodDetailsResponseToJson( + AutomodDetailsResponse instance, +) => { + 'action': instance.action, + 'image_labels': instance.imageLabels, + 'message_details': instance.messageDetails?.toJson(), + 'original_message_type': instance.originalMessageType, + 'result': instance.result?.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/automod_platform_circumvention_config.dart b/packages/stream_chat/lib/open_api/model/automod_platform_circumvention_config.dart new file mode 100644 index 0000000000..9f706f11cc --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/automod_platform_circumvention_config.dart @@ -0,0 +1,42 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'automod_platform_circumvention_config.g.dart'; +part 'automod_platform_circumvention_config.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class AutomodPlatformCircumventionConfig with _$AutomodPlatformCircumventionConfig { + const AutomodPlatformCircumventionConfig({ + this.async, + required this.enabled, + required this.rules, + }); + + @override + @JsonKey(name: 'async') + final bool? async; + + @override + @JsonKey(name: 'enabled') + final bool enabled; + + @override + @JsonKey(name: 'rules') + final List rules; + + Map toJson() => _$AutomodPlatformCircumventionConfigToJson(this); + + static AutomodPlatformCircumventionConfig fromJson(Map json) => + _$AutomodPlatformCircumventionConfigFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/automod_platform_circumvention_config.freezed.dart b/packages/stream_chat/lib/open_api/model/automod_platform_circumvention_config.freezed.dart new file mode 100644 index 0000000000..aeae6a657f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/automod_platform_circumvention_config.freezed.dart @@ -0,0 +1,98 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'automod_platform_circumvention_config.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$AutomodPlatformCircumventionConfig { + bool? get async; + bool get enabled; + List get rules; + + /// Create a copy of AutomodPlatformCircumventionConfig + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $AutomodPlatformCircumventionConfigCopyWith get copyWith => + _$AutomodPlatformCircumventionConfigCopyWithImpl( + this as AutomodPlatformCircumventionConfig, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is AutomodPlatformCircumventionConfig && + (identical(other.async, async) || other.async == async) && + (identical(other.enabled, enabled) || other.enabled == enabled) && + const DeepCollectionEquality().equals(other.rules, rules)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + async, + enabled, + const DeepCollectionEquality().hash(rules), + ); + + @override + String toString() { + return 'AutomodPlatformCircumventionConfig(async: $async, enabled: $enabled, rules: $rules)'; + } +} + +/// @nodoc +abstract mixin class $AutomodPlatformCircumventionConfigCopyWith<$Res> { + factory $AutomodPlatformCircumventionConfigCopyWith( + AutomodPlatformCircumventionConfig value, + $Res Function(AutomodPlatformCircumventionConfig) _then, + ) = _$AutomodPlatformCircumventionConfigCopyWithImpl; + @useResult + $Res call({bool? async, bool enabled, List rules}); +} + +/// @nodoc +class _$AutomodPlatformCircumventionConfigCopyWithImpl<$Res> + implements $AutomodPlatformCircumventionConfigCopyWith<$Res> { + _$AutomodPlatformCircumventionConfigCopyWithImpl(this._self, this._then); + + final AutomodPlatformCircumventionConfig _self; + final $Res Function(AutomodPlatformCircumventionConfig) _then; + + /// Create a copy of AutomodPlatformCircumventionConfig + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? async = freezed, + Object? enabled = null, + Object? rules = null, + }) { + return _then( + AutomodPlatformCircumventionConfig( + async: freezed == async + ? _self.async + : async // ignore: cast_nullable_to_non_nullable + as bool?, + enabled: null == enabled + ? _self.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool, + rules: null == rules + ? _self.rules + : rules // ignore: cast_nullable_to_non_nullable + as List, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/automod_platform_circumvention_config.g.dart b/packages/stream_chat/lib/open_api/model/automod_platform_circumvention_config.g.dart new file mode 100644 index 0000000000..9a94077ff0 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/automod_platform_circumvention_config.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'automod_platform_circumvention_config.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +AutomodPlatformCircumventionConfig _$AutomodPlatformCircumventionConfigFromJson( + Map json, +) => AutomodPlatformCircumventionConfig( + async: json['async'] as bool?, + enabled: json['enabled'] as bool, + rules: (json['rules'] as List).map((e) => AutomodRule.fromJson(e as Map)).toList(), +); + +Map _$AutomodPlatformCircumventionConfigToJson( + AutomodPlatformCircumventionConfig instance, +) => { + 'async': instance.async, + 'enabled': instance.enabled, + 'rules': instance.rules.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/automod_rule.dart b/packages/stream_chat/lib/open_api/model/automod_rule.dart new file mode 100644 index 0000000000..b7ad7af7e3 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/automod_rule.dart @@ -0,0 +1,54 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'automod_rule.g.dart'; +part 'automod_rule.freezed.dart'; + +extension type const AutomodRuleAction._(String _) implements String { + static const bounce = AutomodRuleAction._('bounce'); + static const bounceFlag = AutomodRuleAction._('bounce_flag'); + static const bounceRemove = AutomodRuleAction._('bounce_remove'); + static const flag = AutomodRuleAction._('flag'); + static const remove = AutomodRuleAction._('remove'); + static const shadow = AutomodRuleAction._('shadow'); + + factory AutomodRuleAction.fromJson(String json) => AutomodRuleAction._(json); + + String toJson() => this; +} + +@freezed +@immutable +@JsonSerializable() +class AutomodRule with _$AutomodRule { + const AutomodRule({ + required this.action, + required this.label, + required this.threshold, + }); + + @override + @JsonKey(name: 'action') + final AutomodRuleAction action; + + @override + @JsonKey(name: 'label') + final String label; + + @override + @JsonKey(name: 'threshold') + final double threshold; + + Map toJson() => _$AutomodRuleToJson(this); + + static AutomodRule fromJson(Map json) => _$AutomodRuleFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/automod_rule.freezed.dart b/packages/stream_chat/lib/open_api/model/automod_rule.freezed.dart new file mode 100644 index 0000000000..8bffe1a7ce --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/automod_rule.freezed.dart @@ -0,0 +1,89 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'automod_rule.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$AutomodRule { + AutomodRuleAction get action; + String get label; + double get threshold; + + /// Create a copy of AutomodRule + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $AutomodRuleCopyWith get copyWith => + _$AutomodRuleCopyWithImpl(this as AutomodRule, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is AutomodRule && + (identical(other.action, action) || other.action == action) && + (identical(other.label, label) || other.label == label) && + (identical(other.threshold, threshold) || other.threshold == threshold)); + } + + @override + int get hashCode => Object.hash(runtimeType, action, label, threshold); + + @override + String toString() { + return 'AutomodRule(action: $action, label: $label, threshold: $threshold)'; + } +} + +/// @nodoc +abstract mixin class $AutomodRuleCopyWith<$Res> { + factory $AutomodRuleCopyWith( + AutomodRule value, + $Res Function(AutomodRule) _then, + ) = _$AutomodRuleCopyWithImpl; + @useResult + $Res call({AutomodRuleAction action, String label, double threshold}); +} + +/// @nodoc +class _$AutomodRuleCopyWithImpl<$Res> implements $AutomodRuleCopyWith<$Res> { + _$AutomodRuleCopyWithImpl(this._self, this._then); + + final AutomodRule _self; + final $Res Function(AutomodRule) _then; + + /// Create a copy of AutomodRule + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? action = null, + Object? label = null, + Object? threshold = null, + }) { + return _then( + AutomodRule( + action: null == action + ? _self.action + : action // ignore: cast_nullable_to_non_nullable + as AutomodRuleAction, + label: null == label + ? _self.label + : label // ignore: cast_nullable_to_non_nullable + as String, + threshold: null == threshold + ? _self.threshold + : threshold // ignore: cast_nullable_to_non_nullable + as double, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/automod_rule.g.dart b/packages/stream_chat/lib/open_api/model/automod_rule.g.dart new file mode 100644 index 0000000000..9db9b71ae0 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/automod_rule.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'automod_rule.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +AutomodRule _$AutomodRuleFromJson(Map json) => AutomodRule( + action: AutomodRuleAction.fromJson(json['action'] as String), + label: json['label'] as String, + threshold: (json['threshold'] as num).toDouble(), +); + +Map _$AutomodRuleToJson(AutomodRule instance) => { + 'action': instance.action.toJson(), + 'label': instance.label, + 'threshold': instance.threshold, +}; diff --git a/packages/stream_chat/lib/open_api/model/automod_semantic_filters_config.dart b/packages/stream_chat/lib/open_api/model/automod_semantic_filters_config.dart new file mode 100644 index 0000000000..1d50436b4a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/automod_semantic_filters_config.dart @@ -0,0 +1,42 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'automod_semantic_filters_config.g.dart'; +part 'automod_semantic_filters_config.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class AutomodSemanticFiltersConfig with _$AutomodSemanticFiltersConfig { + const AutomodSemanticFiltersConfig({ + this.async, + required this.enabled, + required this.rules, + }); + + @override + @JsonKey(name: 'async') + final bool? async; + + @override + @JsonKey(name: 'enabled') + final bool enabled; + + @override + @JsonKey(name: 'rules') + final List rules; + + Map toJson() => _$AutomodSemanticFiltersConfigToJson(this); + + static AutomodSemanticFiltersConfig fromJson(Map json) => + _$AutomodSemanticFiltersConfigFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/automod_semantic_filters_config.freezed.dart b/packages/stream_chat/lib/open_api/model/automod_semantic_filters_config.freezed.dart new file mode 100644 index 0000000000..d8e6f4dac6 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/automod_semantic_filters_config.freezed.dart @@ -0,0 +1,101 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'automod_semantic_filters_config.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$AutomodSemanticFiltersConfig { + bool? get async; + bool get enabled; + List get rules; + + /// Create a copy of AutomodSemanticFiltersConfig + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $AutomodSemanticFiltersConfigCopyWith get copyWith => + _$AutomodSemanticFiltersConfigCopyWithImpl( + this as AutomodSemanticFiltersConfig, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is AutomodSemanticFiltersConfig && + (identical(other.async, async) || other.async == async) && + (identical(other.enabled, enabled) || other.enabled == enabled) && + const DeepCollectionEquality().equals(other.rules, rules)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + async, + enabled, + const DeepCollectionEquality().hash(rules), + ); + + @override + String toString() { + return 'AutomodSemanticFiltersConfig(async: $async, enabled: $enabled, rules: $rules)'; + } +} + +/// @nodoc +abstract mixin class $AutomodSemanticFiltersConfigCopyWith<$Res> { + factory $AutomodSemanticFiltersConfigCopyWith( + AutomodSemanticFiltersConfig value, + $Res Function(AutomodSemanticFiltersConfig) _then, + ) = _$AutomodSemanticFiltersConfigCopyWithImpl; + @useResult + $Res call({ + bool? async, + bool enabled, + List rules, + }); +} + +/// @nodoc +class _$AutomodSemanticFiltersConfigCopyWithImpl<$Res> implements $AutomodSemanticFiltersConfigCopyWith<$Res> { + _$AutomodSemanticFiltersConfigCopyWithImpl(this._self, this._then); + + final AutomodSemanticFiltersConfig _self; + final $Res Function(AutomodSemanticFiltersConfig) _then; + + /// Create a copy of AutomodSemanticFiltersConfig + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? async = freezed, + Object? enabled = null, + Object? rules = null, + }) { + return _then( + AutomodSemanticFiltersConfig( + async: freezed == async + ? _self.async + : async // ignore: cast_nullable_to_non_nullable + as bool?, + enabled: null == enabled + ? _self.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool, + rules: null == rules + ? _self.rules + : rules // ignore: cast_nullable_to_non_nullable + as List, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/automod_semantic_filters_config.g.dart b/packages/stream_chat/lib/open_api/model/automod_semantic_filters_config.g.dart new file mode 100644 index 0000000000..514f8e267d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/automod_semantic_filters_config.g.dart @@ -0,0 +1,27 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'automod_semantic_filters_config.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +AutomodSemanticFiltersConfig _$AutomodSemanticFiltersConfigFromJson( + Map json, +) => AutomodSemanticFiltersConfig( + async: json['async'] as bool?, + enabled: json['enabled'] as bool, + rules: (json['rules'] as List) + .map( + (e) => AutomodSemanticFiltersRule.fromJson(e as Map), + ) + .toList(), +); + +Map _$AutomodSemanticFiltersConfigToJson( + AutomodSemanticFiltersConfig instance, +) => { + 'async': instance.async, + 'enabled': instance.enabled, + 'rules': instance.rules.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/automod_semantic_filters_rule.dart b/packages/stream_chat/lib/open_api/model/automod_semantic_filters_rule.dart new file mode 100644 index 0000000000..662a98f743 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/automod_semantic_filters_rule.dart @@ -0,0 +1,54 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'automod_semantic_filters_rule.g.dart'; +part 'automod_semantic_filters_rule.freezed.dart'; + +extension type const AutomodSemanticFiltersRuleAction._(String _) implements String { + static const bounce = AutomodSemanticFiltersRuleAction._('bounce'); + static const bounceFlag = AutomodSemanticFiltersRuleAction._('bounce_flag'); + static const bounceRemove = AutomodSemanticFiltersRuleAction._('bounce_remove'); + static const flag = AutomodSemanticFiltersRuleAction._('flag'); + static const remove = AutomodSemanticFiltersRuleAction._('remove'); + static const shadow = AutomodSemanticFiltersRuleAction._('shadow'); + + factory AutomodSemanticFiltersRuleAction.fromJson(String json) => AutomodSemanticFiltersRuleAction._(json); + + String toJson() => this; +} + +@freezed +@immutable +@JsonSerializable() +class AutomodSemanticFiltersRule with _$AutomodSemanticFiltersRule { + const AutomodSemanticFiltersRule({ + required this.action, + required this.name, + required this.threshold, + }); + + @override + @JsonKey(name: 'action') + final AutomodSemanticFiltersRuleAction action; + + @override + @JsonKey(name: 'name') + final String name; + + @override + @JsonKey(name: 'threshold') + final double threshold; + + Map toJson() => _$AutomodSemanticFiltersRuleToJson(this); + + static AutomodSemanticFiltersRule fromJson(Map json) => _$AutomodSemanticFiltersRuleFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/automod_semantic_filters_rule.freezed.dart b/packages/stream_chat/lib/open_api/model/automod_semantic_filters_rule.freezed.dart new file mode 100644 index 0000000000..64c3c5e052 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/automod_semantic_filters_rule.freezed.dart @@ -0,0 +1,96 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'automod_semantic_filters_rule.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$AutomodSemanticFiltersRule { + AutomodSemanticFiltersRuleAction get action; + String get name; + double get threshold; + + /// Create a copy of AutomodSemanticFiltersRule + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $AutomodSemanticFiltersRuleCopyWith get copyWith => + _$AutomodSemanticFiltersRuleCopyWithImpl( + this as AutomodSemanticFiltersRule, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is AutomodSemanticFiltersRule && + (identical(other.action, action) || other.action == action) && + (identical(other.name, name) || other.name == name) && + (identical(other.threshold, threshold) || other.threshold == threshold)); + } + + @override + int get hashCode => Object.hash(runtimeType, action, name, threshold); + + @override + String toString() { + return 'AutomodSemanticFiltersRule(action: $action, name: $name, threshold: $threshold)'; + } +} + +/// @nodoc +abstract mixin class $AutomodSemanticFiltersRuleCopyWith<$Res> { + factory $AutomodSemanticFiltersRuleCopyWith( + AutomodSemanticFiltersRule value, + $Res Function(AutomodSemanticFiltersRule) _then, + ) = _$AutomodSemanticFiltersRuleCopyWithImpl; + @useResult + $Res call({ + AutomodSemanticFiltersRuleAction action, + String name, + double threshold, + }); +} + +/// @nodoc +class _$AutomodSemanticFiltersRuleCopyWithImpl<$Res> implements $AutomodSemanticFiltersRuleCopyWith<$Res> { + _$AutomodSemanticFiltersRuleCopyWithImpl(this._self, this._then); + + final AutomodSemanticFiltersRule _self; + final $Res Function(AutomodSemanticFiltersRule) _then; + + /// Create a copy of AutomodSemanticFiltersRule + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? action = null, + Object? name = null, + Object? threshold = null, + }) { + return _then( + AutomodSemanticFiltersRule( + action: null == action + ? _self.action + : action // ignore: cast_nullable_to_non_nullable + as AutomodSemanticFiltersRuleAction, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + threshold: null == threshold + ? _self.threshold + : threshold // ignore: cast_nullable_to_non_nullable + as double, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/automod_semantic_filters_rule.g.dart b/packages/stream_chat/lib/open_api/model/automod_semantic_filters_rule.g.dart new file mode 100644 index 0000000000..06ed9fbef0 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/automod_semantic_filters_rule.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'automod_semantic_filters_rule.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +AutomodSemanticFiltersRule _$AutomodSemanticFiltersRuleFromJson( + Map json, +) => AutomodSemanticFiltersRule( + action: AutomodSemanticFiltersRuleAction.fromJson(json['action'] as String), + name: json['name'] as String, + threshold: (json['threshold'] as num).toDouble(), +); + +Map _$AutomodSemanticFiltersRuleToJson( + AutomodSemanticFiltersRule instance, +) => { + 'action': instance.action.toJson(), + 'name': instance.name, + 'threshold': instance.threshold, +}; diff --git a/packages/stream_chat/lib/open_api/model/automod_toxicity_config.dart b/packages/stream_chat/lib/open_api/model/automod_toxicity_config.dart new file mode 100644 index 0000000000..6007f1faae --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/automod_toxicity_config.dart @@ -0,0 +1,41 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'automod_toxicity_config.g.dart'; +part 'automod_toxicity_config.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class AutomodToxicityConfig with _$AutomodToxicityConfig { + const AutomodToxicityConfig({ + this.async, + required this.enabled, + required this.rules, + }); + + @override + @JsonKey(name: 'async') + final bool? async; + + @override + @JsonKey(name: 'enabled') + final bool enabled; + + @override + @JsonKey(name: 'rules') + final List rules; + + Map toJson() => _$AutomodToxicityConfigToJson(this); + + static AutomodToxicityConfig fromJson(Map json) => _$AutomodToxicityConfigFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/automod_toxicity_config.freezed.dart b/packages/stream_chat/lib/open_api/model/automod_toxicity_config.freezed.dart new file mode 100644 index 0000000000..44742b874e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/automod_toxicity_config.freezed.dart @@ -0,0 +1,97 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'automod_toxicity_config.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$AutomodToxicityConfig { + bool? get async; + bool get enabled; + List get rules; + + /// Create a copy of AutomodToxicityConfig + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $AutomodToxicityConfigCopyWith get copyWith => + _$AutomodToxicityConfigCopyWithImpl( + this as AutomodToxicityConfig, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is AutomodToxicityConfig && + (identical(other.async, async) || other.async == async) && + (identical(other.enabled, enabled) || other.enabled == enabled) && + const DeepCollectionEquality().equals(other.rules, rules)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + async, + enabled, + const DeepCollectionEquality().hash(rules), + ); + + @override + String toString() { + return 'AutomodToxicityConfig(async: $async, enabled: $enabled, rules: $rules)'; + } +} + +/// @nodoc +abstract mixin class $AutomodToxicityConfigCopyWith<$Res> { + factory $AutomodToxicityConfigCopyWith( + AutomodToxicityConfig value, + $Res Function(AutomodToxicityConfig) _then, + ) = _$AutomodToxicityConfigCopyWithImpl; + @useResult + $Res call({bool? async, bool enabled, List rules}); +} + +/// @nodoc +class _$AutomodToxicityConfigCopyWithImpl<$Res> implements $AutomodToxicityConfigCopyWith<$Res> { + _$AutomodToxicityConfigCopyWithImpl(this._self, this._then); + + final AutomodToxicityConfig _self; + final $Res Function(AutomodToxicityConfig) _then; + + /// Create a copy of AutomodToxicityConfig + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? async = freezed, + Object? enabled = null, + Object? rules = null, + }) { + return _then( + AutomodToxicityConfig( + async: freezed == async + ? _self.async + : async // ignore: cast_nullable_to_non_nullable + as bool?, + enabled: null == enabled + ? _self.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool, + rules: null == rules + ? _self.rules + : rules // ignore: cast_nullable_to_non_nullable + as List, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/automod_toxicity_config.g.dart b/packages/stream_chat/lib/open_api/model/automod_toxicity_config.g.dart new file mode 100644 index 0000000000..4f7e2ad92c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/automod_toxicity_config.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'automod_toxicity_config.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +AutomodToxicityConfig _$AutomodToxicityConfigFromJson( + Map json, +) => AutomodToxicityConfig( + async: json['async'] as bool?, + enabled: json['enabled'] as bool, + rules: (json['rules'] as List).map((e) => AutomodRule.fromJson(e as Map)).toList(), +); + +Map _$AutomodToxicityConfigToJson( + AutomodToxicityConfig instance, +) => { + 'async': instance.async, + 'enabled': instance.enabled, + 'rules': instance.rules.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/aws_rekognition_rule.dart b/packages/stream_chat/lib/open_api/model/aws_rekognition_rule.dart new file mode 100644 index 0000000000..7bc7b4a9ee --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/aws_rekognition_rule.dart @@ -0,0 +1,59 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'aws_rekognition_rule.g.dart'; +part 'aws_rekognition_rule.freezed.dart'; + +extension type const AWSRekognitionRuleAction._(String _) implements String { + static const bounce = AWSRekognitionRuleAction._('bounce'); + static const bounceFlag = AWSRekognitionRuleAction._('bounce_flag'); + static const bounceRemove = AWSRekognitionRuleAction._('bounce_remove'); + static const flag = AWSRekognitionRuleAction._('flag'); + static const remove = AWSRekognitionRuleAction._('remove'); + static const shadow = AWSRekognitionRuleAction._('shadow'); + + factory AWSRekognitionRuleAction.fromJson(String json) => AWSRekognitionRuleAction._(json); + + String toJson() => this; +} + +@freezed +@immutable +@JsonSerializable() +class AWSRekognitionRule with _$AWSRekognitionRule { + const AWSRekognitionRule({ + required this.action, + required this.label, + required this.minConfidence, + this.subclassifications, + }); + + @override + @JsonKey(name: 'action') + final AWSRekognitionRuleAction action; + + @override + @JsonKey(name: 'label') + final String label; + + @override + @JsonKey(name: 'min_confidence') + final double minConfidence; + + @override + @JsonKey(name: 'subclassifications') + final Map? subclassifications; + + Map toJson() => _$AWSRekognitionRuleToJson(this); + + static AWSRekognitionRule fromJson(Map json) => _$AWSRekognitionRuleFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/aws_rekognition_rule.freezed.dart b/packages/stream_chat/lib/open_api/model/aws_rekognition_rule.freezed.dart new file mode 100644 index 0000000000..31cabd10cb --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/aws_rekognition_rule.freezed.dart @@ -0,0 +1,112 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'aws_rekognition_rule.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$AWSRekognitionRule { + AWSRekognitionRuleAction get action; + String get label; + double get minConfidence; + Map? get subclassifications; + + /// Create a copy of AWSRekognitionRule + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $AWSRekognitionRuleCopyWith get copyWith => _$AWSRekognitionRuleCopyWithImpl( + this as AWSRekognitionRule, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is AWSRekognitionRule && + (identical(other.action, action) || other.action == action) && + (identical(other.label, label) || other.label == label) && + (identical(other.minConfidence, minConfidence) || other.minConfidence == minConfidence) && + const DeepCollectionEquality().equals( + other.subclassifications, + subclassifications, + )); + } + + @override + int get hashCode => Object.hash( + runtimeType, + action, + label, + minConfidence, + const DeepCollectionEquality().hash(subclassifications), + ); + + @override + String toString() { + return 'AWSRekognitionRule(action: $action, label: $label, minConfidence: $minConfidence, subclassifications: $subclassifications)'; + } +} + +/// @nodoc +abstract mixin class $AWSRekognitionRuleCopyWith<$Res> { + factory $AWSRekognitionRuleCopyWith( + AWSRekognitionRule value, + $Res Function(AWSRekognitionRule) _then, + ) = _$AWSRekognitionRuleCopyWithImpl; + @useResult + $Res call({ + AWSRekognitionRuleAction action, + String label, + double minConfidence, + Map? subclassifications, + }); +} + +/// @nodoc +class _$AWSRekognitionRuleCopyWithImpl<$Res> implements $AWSRekognitionRuleCopyWith<$Res> { + _$AWSRekognitionRuleCopyWithImpl(this._self, this._then); + + final AWSRekognitionRule _self; + final $Res Function(AWSRekognitionRule) _then; + + /// Create a copy of AWSRekognitionRule + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? action = null, + Object? label = null, + Object? minConfidence = null, + Object? subclassifications = freezed, + }) { + return _then( + AWSRekognitionRule( + action: null == action + ? _self.action + : action // ignore: cast_nullable_to_non_nullable + as AWSRekognitionRuleAction, + label: null == label + ? _self.label + : label // ignore: cast_nullable_to_non_nullable + as String, + minConfidence: null == minConfidence + ? _self.minConfidence + : minConfidence // ignore: cast_nullable_to_non_nullable + as double, + subclassifications: freezed == subclassifications + ? _self.subclassifications + : subclassifications // ignore: cast_nullable_to_non_nullable + as Map?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/aws_rekognition_rule.g.dart b/packages/stream_chat/lib/open_api/model/aws_rekognition_rule.g.dart new file mode 100644 index 0000000000..de4aec464d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/aws_rekognition_rule.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'aws_rekognition_rule.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +AWSRekognitionRule _$AWSRekognitionRuleFromJson(Map json) => AWSRekognitionRule( + action: AWSRekognitionRuleAction.fromJson(json['action'] as String), + label: json['label'] as String, + minConfidence: (json['min_confidence'] as num).toDouble(), + subclassifications: json['subclassifications'] as Map?, +); + +Map _$AWSRekognitionRuleToJson(AWSRekognitionRule instance) => { + 'action': instance.action.toJson(), + 'label': instance.label, + 'min_confidence': instance.minConfidence, + 'subclassifications': instance.subclassifications, +}; diff --git a/packages/stream_chat/lib/open_api/model/ban_action_request_payload.dart b/packages/stream_chat/lib/open_api/model/ban_action_request_payload.dart new file mode 100644 index 0000000000..86ae929537 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ban_action_request_payload.dart @@ -0,0 +1,81 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'ban_action_request_payload.g.dart'; +part 'ban_action_request_payload.freezed.dart'; + +extension type const BanActionRequestPayloadDeleteMessages._(String _) implements String { + static const hard = BanActionRequestPayloadDeleteMessages._('hard'); + static const pruning = BanActionRequestPayloadDeleteMessages._('pruning'); + static const soft = BanActionRequestPayloadDeleteMessages._('soft'); + + factory BanActionRequestPayloadDeleteMessages.fromJson(String json) => BanActionRequestPayloadDeleteMessages._(json); + + String toJson() => this; +} + +@freezed +@immutable +@JsonSerializable() +class BanActionRequestPayload with _$BanActionRequestPayload { + const BanActionRequestPayload({ + this.banFromFutureChannels, + this.channelBanOnly, + this.channelCid, + this.deleteMessages, + this.ipBan, + this.reason, + this.shadow, + this.targetUserId, + this.timeout, + }); + + @override + @JsonKey(name: 'ban_from_future_channels') + final bool? banFromFutureChannels; + + @override + @JsonKey(name: 'channel_ban_only') + final bool? channelBanOnly; + + @override + @JsonKey(name: 'channel_cid') + final String? channelCid; + + @override + @JsonKey(name: 'delete_messages') + final BanActionRequestPayloadDeleteMessages? deleteMessages; + + @override + @JsonKey(name: 'ip_ban') + final bool? ipBan; + + @override + @JsonKey(name: 'reason') + final String? reason; + + @override + @JsonKey(name: 'shadow') + final bool? shadow; + + @override + @JsonKey(name: 'target_user_id') + final String? targetUserId; + + @override + @JsonKey(name: 'timeout') + final int? timeout; + + Map toJson() => _$BanActionRequestPayloadToJson(this); + + static BanActionRequestPayload fromJson(Map json) => _$BanActionRequestPayloadFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/ban_action_request_payload.freezed.dart b/packages/stream_chat/lib/open_api/model/ban_action_request_payload.freezed.dart new file mode 100644 index 0000000000..f6cec4079f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ban_action_request_payload.freezed.dart @@ -0,0 +1,156 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'ban_action_request_payload.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$BanActionRequestPayload { + bool? get banFromFutureChannels; + bool? get channelBanOnly; + String? get channelCid; + BanActionRequestPayloadDeleteMessages? get deleteMessages; + bool? get ipBan; + String? get reason; + bool? get shadow; + String? get targetUserId; + int? get timeout; + + /// Create a copy of BanActionRequestPayload + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $BanActionRequestPayloadCopyWith get copyWith => + _$BanActionRequestPayloadCopyWithImpl( + this as BanActionRequestPayload, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is BanActionRequestPayload && + (identical(other.banFromFutureChannels, banFromFutureChannels) || + other.banFromFutureChannels == banFromFutureChannels) && + (identical(other.channelBanOnly, channelBanOnly) || other.channelBanOnly == channelBanOnly) && + (identical(other.channelCid, channelCid) || other.channelCid == channelCid) && + (identical(other.deleteMessages, deleteMessages) || other.deleteMessages == deleteMessages) && + (identical(other.ipBan, ipBan) || other.ipBan == ipBan) && + (identical(other.reason, reason) || other.reason == reason) && + (identical(other.shadow, shadow) || other.shadow == shadow) && + (identical(other.targetUserId, targetUserId) || other.targetUserId == targetUserId) && + (identical(other.timeout, timeout) || other.timeout == timeout)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + banFromFutureChannels, + channelBanOnly, + channelCid, + deleteMessages, + ipBan, + reason, + shadow, + targetUserId, + timeout, + ); + + @override + String toString() { + return 'BanActionRequestPayload(banFromFutureChannels: $banFromFutureChannels, channelBanOnly: $channelBanOnly, channelCid: $channelCid, deleteMessages: $deleteMessages, ipBan: $ipBan, reason: $reason, shadow: $shadow, targetUserId: $targetUserId, timeout: $timeout)'; + } +} + +/// @nodoc +abstract mixin class $BanActionRequestPayloadCopyWith<$Res> { + factory $BanActionRequestPayloadCopyWith( + BanActionRequestPayload value, + $Res Function(BanActionRequestPayload) _then, + ) = _$BanActionRequestPayloadCopyWithImpl; + @useResult + $Res call({ + bool? banFromFutureChannels, + bool? channelBanOnly, + String? channelCid, + BanActionRequestPayloadDeleteMessages? deleteMessages, + bool? ipBan, + String? reason, + bool? shadow, + String? targetUserId, + int? timeout, + }); +} + +/// @nodoc +class _$BanActionRequestPayloadCopyWithImpl<$Res> implements $BanActionRequestPayloadCopyWith<$Res> { + _$BanActionRequestPayloadCopyWithImpl(this._self, this._then); + + final BanActionRequestPayload _self; + final $Res Function(BanActionRequestPayload) _then; + + /// Create a copy of BanActionRequestPayload + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? banFromFutureChannels = freezed, + Object? channelBanOnly = freezed, + Object? channelCid = freezed, + Object? deleteMessages = freezed, + Object? ipBan = freezed, + Object? reason = freezed, + Object? shadow = freezed, + Object? targetUserId = freezed, + Object? timeout = freezed, + }) { + return _then( + BanActionRequestPayload( + banFromFutureChannels: freezed == banFromFutureChannels + ? _self.banFromFutureChannels + : banFromFutureChannels // ignore: cast_nullable_to_non_nullable + as bool?, + channelBanOnly: freezed == channelBanOnly + ? _self.channelBanOnly + : channelBanOnly // ignore: cast_nullable_to_non_nullable + as bool?, + channelCid: freezed == channelCid + ? _self.channelCid + : channelCid // ignore: cast_nullable_to_non_nullable + as String?, + deleteMessages: freezed == deleteMessages + ? _self.deleteMessages + : deleteMessages // ignore: cast_nullable_to_non_nullable + as BanActionRequestPayloadDeleteMessages?, + ipBan: freezed == ipBan + ? _self.ipBan + : ipBan // ignore: cast_nullable_to_non_nullable + as bool?, + reason: freezed == reason + ? _self.reason + : reason // ignore: cast_nullable_to_non_nullable + as String?, + shadow: freezed == shadow + ? _self.shadow + : shadow // ignore: cast_nullable_to_non_nullable + as bool?, + targetUserId: freezed == targetUserId + ? _self.targetUserId + : targetUserId // ignore: cast_nullable_to_non_nullable + as String?, + timeout: freezed == timeout + ? _self.timeout + : timeout // ignore: cast_nullable_to_non_nullable + as int?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/ban_action_request_payload.g.dart b/packages/stream_chat/lib/open_api/model/ban_action_request_payload.g.dart new file mode 100644 index 0000000000..38ab9cb299 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ban_action_request_payload.g.dart @@ -0,0 +1,39 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'ban_action_request_payload.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +BanActionRequestPayload _$BanActionRequestPayloadFromJson( + Map json, +) => BanActionRequestPayload( + banFromFutureChannels: json['ban_from_future_channels'] as bool?, + channelBanOnly: json['channel_ban_only'] as bool?, + channelCid: json['channel_cid'] as String?, + deleteMessages: json['delete_messages'] == null + ? null + : BanActionRequestPayloadDeleteMessages.fromJson( + json['delete_messages'] as String, + ), + ipBan: json['ip_ban'] as bool?, + reason: json['reason'] as String?, + shadow: json['shadow'] as bool?, + targetUserId: json['target_user_id'] as String?, + timeout: (json['timeout'] as num?)?.toInt(), +); + +Map _$BanActionRequestPayloadToJson( + BanActionRequestPayload instance, +) => { + 'ban_from_future_channels': instance.banFromFutureChannels, + 'channel_ban_only': instance.channelBanOnly, + 'channel_cid': instance.channelCid, + 'delete_messages': instance.deleteMessages?.toJson(), + 'ip_ban': instance.ipBan, + 'reason': instance.reason, + 'shadow': instance.shadow, + 'target_user_id': instance.targetUserId, + 'timeout': instance.timeout, +}; diff --git a/packages/stream_chat/lib/open_api/model/ban_info_response.dart b/packages/stream_chat/lib/open_api/model/ban_info_response.dart new file mode 100644 index 0000000000..c4a5baf683 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ban_info_response.dart @@ -0,0 +1,68 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'ban_info_response.g.dart'; +part 'ban_info_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class BanInfoResponse with _$BanInfoResponse { + const BanInfoResponse({ + this.channel, + this.channelCid, + required this.createdAt, + this.createdBy, + this.expires, + this.reason, + this.shadow, + this.user, + }); + + @override + @JsonKey(name: 'channel') + final ChannelMetadata? channel; + + @override + @JsonKey(name: 'channel_cid') + final String? channelCid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'created_by') + final UserResponse? createdBy; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'expires') + final DateTime? expires; + + @override + @JsonKey(name: 'reason') + final String? reason; + + @override + @JsonKey(name: 'shadow') + final bool? shadow; + + @override + @JsonKey(name: 'user') + final UserResponse? user; + + Map toJson() => _$BanInfoResponseToJson(this); + + static BanInfoResponse fromJson(Map json) => _$BanInfoResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/ban_info_response.freezed.dart b/packages/stream_chat/lib/open_api/model/ban_info_response.freezed.dart new file mode 100644 index 0000000000..6d7289ded0 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ban_info_response.freezed.dart @@ -0,0 +1,145 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'ban_info_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$BanInfoResponse { + ChannelMetadata? get channel; + String? get channelCid; + DateTime get createdAt; + UserResponse? get createdBy; + DateTime? get expires; + String? get reason; + bool? get shadow; + UserResponse? get user; + + /// Create a copy of BanInfoResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $BanInfoResponseCopyWith get copyWith => _$BanInfoResponseCopyWithImpl( + this as BanInfoResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is BanInfoResponse && + (identical(other.channel, channel) || other.channel == channel) && + (identical(other.channelCid, channelCid) || other.channelCid == channelCid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.createdBy, createdBy) || other.createdBy == createdBy) && + (identical(other.expires, expires) || other.expires == expires) && + (identical(other.reason, reason) || other.reason == reason) && + (identical(other.shadow, shadow) || other.shadow == shadow) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channel, + channelCid, + createdAt, + createdBy, + expires, + reason, + shadow, + user, + ); + + @override + String toString() { + return 'BanInfoResponse(channel: $channel, channelCid: $channelCid, createdAt: $createdAt, createdBy: $createdBy, expires: $expires, reason: $reason, shadow: $shadow, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $BanInfoResponseCopyWith<$Res> { + factory $BanInfoResponseCopyWith( + BanInfoResponse value, + $Res Function(BanInfoResponse) _then, + ) = _$BanInfoResponseCopyWithImpl; + @useResult + $Res call({ + ChannelMetadata? channel, + String? channelCid, + DateTime createdAt, + UserResponse? createdBy, + DateTime? expires, + String? reason, + bool? shadow, + UserResponse? user, + }); +} + +/// @nodoc +class _$BanInfoResponseCopyWithImpl<$Res> implements $BanInfoResponseCopyWith<$Res> { + _$BanInfoResponseCopyWithImpl(this._self, this._then); + + final BanInfoResponse _self; + final $Res Function(BanInfoResponse) _then; + + /// Create a copy of BanInfoResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channel = freezed, + Object? channelCid = freezed, + Object? createdAt = null, + Object? createdBy = freezed, + Object? expires = freezed, + Object? reason = freezed, + Object? shadow = freezed, + Object? user = freezed, + }) { + return _then( + BanInfoResponse( + channel: freezed == channel + ? _self.channel + : channel // ignore: cast_nullable_to_non_nullable + as ChannelMetadata?, + channelCid: freezed == channelCid + ? _self.channelCid + : channelCid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + createdBy: freezed == createdBy + ? _self.createdBy + : createdBy // ignore: cast_nullable_to_non_nullable + as UserResponse?, + expires: freezed == expires + ? _self.expires + : expires // ignore: cast_nullable_to_non_nullable + as DateTime?, + reason: freezed == reason + ? _self.reason + : reason // ignore: cast_nullable_to_non_nullable + as String?, + shadow: freezed == shadow + ? _self.shadow + : shadow // ignore: cast_nullable_to_non_nullable + as bool?, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponse?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/ban_info_response.g.dart b/packages/stream_chat/lib/open_api/model/ban_info_response.g.dart new file mode 100644 index 0000000000..9a878d126e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ban_info_response.g.dart @@ -0,0 +1,47 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'ban_info_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +BanInfoResponse _$BanInfoResponseFromJson(Map json) => BanInfoResponse( + channel: json['channel'] == null ? null : ChannelMetadata.fromJson(json['channel'] as Map), + channelCid: json['channel_cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + createdBy: json['created_by'] == null ? null : UserResponse.fromJson(json['created_by'] as Map), + expires: _$JsonConverterFromJson( + json['expires'], + const StreamDateTimeConverter().fromJson, + ), + reason: json['reason'] as String?, + shadow: json['shadow'] as bool?, + user: json['user'] == null ? null : UserResponse.fromJson(json['user'] as Map), +); + +Map _$BanInfoResponseToJson(BanInfoResponse instance) => { + 'channel': instance.channel?.toJson(), + 'channel_cid': instance.channelCid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'created_by': instance.createdBy?.toJson(), + 'expires': _$JsonConverterToJson( + instance.expires, + const StreamDateTimeConverter().toJson, + ), + 'reason': instance.reason, + 'shadow': instance.shadow, + 'user': instance.user?.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/ban_options.dart b/packages/stream_chat/lib/open_api/model/ban_options.dart new file mode 100644 index 0000000000..2ff0857a23 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ban_options.dart @@ -0,0 +1,61 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'ban_options.g.dart'; +part 'ban_options.freezed.dart'; + +extension type const BanOptionsDeleteMessages._(String _) implements String { + static const hard = BanOptionsDeleteMessages._('hard'); + static const pruning = BanOptionsDeleteMessages._('pruning'); + static const soft = BanOptionsDeleteMessages._('soft'); + + factory BanOptionsDeleteMessages.fromJson(String json) => BanOptionsDeleteMessages._(json); + + String toJson() => this; +} + +@freezed +@immutable +@JsonSerializable() +class BanOptions with _$BanOptions { + const BanOptions({ + this.deleteMessages, + this.duration, + this.ipBan, + this.reason, + this.shadowBan, + }); + + @override + @JsonKey(name: 'delete_messages') + final BanOptionsDeleteMessages? deleteMessages; + + @override + @JsonKey(name: 'duration') + final int? duration; + + @override + @JsonKey(name: 'ip_ban') + final bool? ipBan; + + @override + @JsonKey(name: 'reason') + final String? reason; + + @override + @JsonKey(name: 'shadow_ban') + final bool? shadowBan; + + Map toJson() => _$BanOptionsToJson(this); + + static BanOptions fromJson(Map json) => _$BanOptionsFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/ban_options.freezed.dart b/packages/stream_chat/lib/open_api/model/ban_options.freezed.dart new file mode 100644 index 0000000000..f296258b30 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ban_options.freezed.dart @@ -0,0 +1,115 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'ban_options.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$BanOptions { + BanOptionsDeleteMessages? get deleteMessages; + int? get duration; + bool? get ipBan; + String? get reason; + bool? get shadowBan; + + /// Create a copy of BanOptions + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $BanOptionsCopyWith get copyWith => _$BanOptionsCopyWithImpl(this as BanOptions, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is BanOptions && + (identical(other.deleteMessages, deleteMessages) || other.deleteMessages == deleteMessages) && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.ipBan, ipBan) || other.ipBan == ipBan) && + (identical(other.reason, reason) || other.reason == reason) && + (identical(other.shadowBan, shadowBan) || other.shadowBan == shadowBan)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + deleteMessages, + duration, + ipBan, + reason, + shadowBan, + ); + + @override + String toString() { + return 'BanOptions(deleteMessages: $deleteMessages, duration: $duration, ipBan: $ipBan, reason: $reason, shadowBan: $shadowBan)'; + } +} + +/// @nodoc +abstract mixin class $BanOptionsCopyWith<$Res> { + factory $BanOptionsCopyWith( + BanOptions value, + $Res Function(BanOptions) _then, + ) = _$BanOptionsCopyWithImpl; + @useResult + $Res call({ + BanOptionsDeleteMessages? deleteMessages, + int? duration, + bool? ipBan, + String? reason, + bool? shadowBan, + }); +} + +/// @nodoc +class _$BanOptionsCopyWithImpl<$Res> implements $BanOptionsCopyWith<$Res> { + _$BanOptionsCopyWithImpl(this._self, this._then); + + final BanOptions _self; + final $Res Function(BanOptions) _then; + + /// Create a copy of BanOptions + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? deleteMessages = freezed, + Object? duration = freezed, + Object? ipBan = freezed, + Object? reason = freezed, + Object? shadowBan = freezed, + }) { + return _then( + BanOptions( + deleteMessages: freezed == deleteMessages + ? _self.deleteMessages + : deleteMessages // ignore: cast_nullable_to_non_nullable + as BanOptionsDeleteMessages?, + duration: freezed == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as int?, + ipBan: freezed == ipBan + ? _self.ipBan + : ipBan // ignore: cast_nullable_to_non_nullable + as bool?, + reason: freezed == reason + ? _self.reason + : reason // ignore: cast_nullable_to_non_nullable + as String?, + shadowBan: freezed == shadowBan + ? _self.shadowBan + : shadowBan // ignore: cast_nullable_to_non_nullable + as bool?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/ban_options.g.dart b/packages/stream_chat/lib/open_api/model/ban_options.g.dart new file mode 100644 index 0000000000..9f9b811129 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ban_options.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'ban_options.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +BanOptions _$BanOptionsFromJson(Map json) => BanOptions( + deleteMessages: json['delete_messages'] == null + ? null + : BanOptionsDeleteMessages.fromJson(json['delete_messages'] as String), + duration: (json['duration'] as num?)?.toInt(), + ipBan: json['ip_ban'] as bool?, + reason: json['reason'] as String?, + shadowBan: json['shadow_ban'] as bool?, +); + +Map _$BanOptionsToJson(BanOptions instance) => { + 'delete_messages': instance.deleteMessages?.toJson(), + 'duration': instance.duration, + 'ip_ban': instance.ipBan, + 'reason': instance.reason, + 'shadow_ban': instance.shadowBan, +}; diff --git a/packages/stream_chat/lib/open_api/model/ban_request.dart b/packages/stream_chat/lib/open_api/model/ban_request.dart new file mode 100644 index 0000000000..2b81bf04e5 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ban_request.dart @@ -0,0 +1,81 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'ban_request.g.dart'; +part 'ban_request.freezed.dart'; + +extension type const BanRequestDeleteMessages._(String _) implements String { + static const hard = BanRequestDeleteMessages._('hard'); + static const pruning = BanRequestDeleteMessages._('pruning'); + static const soft = BanRequestDeleteMessages._('soft'); + + factory BanRequestDeleteMessages.fromJson(String json) => BanRequestDeleteMessages._(json); + + String toJson() => this; +} + +@freezed +@immutable +@JsonSerializable() +class BanRequest with _$BanRequest { + const BanRequest({ + this.bannedBy, + this.bannedById, + this.channelCid, + this.deleteMessages, + this.ipBan, + this.reason, + this.shadow, + required this.targetUserId, + this.timeout, + }); + + @override + @JsonKey(name: 'banned_by') + final UserRequest? bannedBy; + + @override + @JsonKey(name: 'banned_by_id') + final String? bannedById; + + @override + @JsonKey(name: 'channel_cid') + final String? channelCid; + + @override + @JsonKey(name: 'delete_messages') + final BanRequestDeleteMessages? deleteMessages; + + @override + @JsonKey(name: 'ip_ban') + final bool? ipBan; + + @override + @JsonKey(name: 'reason') + final String? reason; + + @override + @JsonKey(name: 'shadow') + final bool? shadow; + + @override + @JsonKey(name: 'target_user_id') + final String targetUserId; + + @override + @JsonKey(name: 'timeout') + final int? timeout; + + Map toJson() => _$BanRequestToJson(this); + + static BanRequest fromJson(Map json) => _$BanRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/ban_request.freezed.dart b/packages/stream_chat/lib/open_api/model/ban_request.freezed.dart new file mode 100644 index 0000000000..2845d7ec41 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ban_request.freezed.dart @@ -0,0 +1,151 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'ban_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$BanRequest { + UserRequest? get bannedBy; + String? get bannedById; + String? get channelCid; + BanRequestDeleteMessages? get deleteMessages; + bool? get ipBan; + String? get reason; + bool? get shadow; + String get targetUserId; + int? get timeout; + + /// Create a copy of BanRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $BanRequestCopyWith get copyWith => _$BanRequestCopyWithImpl(this as BanRequest, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is BanRequest && + (identical(other.bannedBy, bannedBy) || other.bannedBy == bannedBy) && + (identical(other.bannedById, bannedById) || other.bannedById == bannedById) && + (identical(other.channelCid, channelCid) || other.channelCid == channelCid) && + (identical(other.deleteMessages, deleteMessages) || other.deleteMessages == deleteMessages) && + (identical(other.ipBan, ipBan) || other.ipBan == ipBan) && + (identical(other.reason, reason) || other.reason == reason) && + (identical(other.shadow, shadow) || other.shadow == shadow) && + (identical(other.targetUserId, targetUserId) || other.targetUserId == targetUserId) && + (identical(other.timeout, timeout) || other.timeout == timeout)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + bannedBy, + bannedById, + channelCid, + deleteMessages, + ipBan, + reason, + shadow, + targetUserId, + timeout, + ); + + @override + String toString() { + return 'BanRequest(bannedBy: $bannedBy, bannedById: $bannedById, channelCid: $channelCid, deleteMessages: $deleteMessages, ipBan: $ipBan, reason: $reason, shadow: $shadow, targetUserId: $targetUserId, timeout: $timeout)'; + } +} + +/// @nodoc +abstract mixin class $BanRequestCopyWith<$Res> { + factory $BanRequestCopyWith( + BanRequest value, + $Res Function(BanRequest) _then, + ) = _$BanRequestCopyWithImpl; + @useResult + $Res call({ + UserRequest? bannedBy, + String? bannedById, + String? channelCid, + BanRequestDeleteMessages? deleteMessages, + bool? ipBan, + String? reason, + bool? shadow, + String targetUserId, + int? timeout, + }); +} + +/// @nodoc +class _$BanRequestCopyWithImpl<$Res> implements $BanRequestCopyWith<$Res> { + _$BanRequestCopyWithImpl(this._self, this._then); + + final BanRequest _self; + final $Res Function(BanRequest) _then; + + /// Create a copy of BanRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? bannedBy = freezed, + Object? bannedById = freezed, + Object? channelCid = freezed, + Object? deleteMessages = freezed, + Object? ipBan = freezed, + Object? reason = freezed, + Object? shadow = freezed, + Object? targetUserId = null, + Object? timeout = freezed, + }) { + return _then( + BanRequest( + bannedBy: freezed == bannedBy + ? _self.bannedBy + : bannedBy // ignore: cast_nullable_to_non_nullable + as UserRequest?, + bannedById: freezed == bannedById + ? _self.bannedById + : bannedById // ignore: cast_nullable_to_non_nullable + as String?, + channelCid: freezed == channelCid + ? _self.channelCid + : channelCid // ignore: cast_nullable_to_non_nullable + as String?, + deleteMessages: freezed == deleteMessages + ? _self.deleteMessages + : deleteMessages // ignore: cast_nullable_to_non_nullable + as BanRequestDeleteMessages?, + ipBan: freezed == ipBan + ? _self.ipBan + : ipBan // ignore: cast_nullable_to_non_nullable + as bool?, + reason: freezed == reason + ? _self.reason + : reason // ignore: cast_nullable_to_non_nullable + as String?, + shadow: freezed == shadow + ? _self.shadow + : shadow // ignore: cast_nullable_to_non_nullable + as bool?, + targetUserId: null == targetUserId + ? _self.targetUserId + : targetUserId // ignore: cast_nullable_to_non_nullable + as String, + timeout: freezed == timeout + ? _self.timeout + : timeout // ignore: cast_nullable_to_non_nullable + as int?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/ban_request.g.dart b/packages/stream_chat/lib/open_api/model/ban_request.g.dart new file mode 100644 index 0000000000..1221ca3ad7 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ban_request.g.dart @@ -0,0 +1,33 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'ban_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +BanRequest _$BanRequestFromJson(Map json) => BanRequest( + bannedBy: json['banned_by'] == null ? null : UserRequest.fromJson(json['banned_by'] as Map), + bannedById: json['banned_by_id'] as String?, + channelCid: json['channel_cid'] as String?, + deleteMessages: json['delete_messages'] == null + ? null + : BanRequestDeleteMessages.fromJson(json['delete_messages'] as String), + ipBan: json['ip_ban'] as bool?, + reason: json['reason'] as String?, + shadow: json['shadow'] as bool?, + targetUserId: json['target_user_id'] as String, + timeout: (json['timeout'] as num?)?.toInt(), +); + +Map _$BanRequestToJson(BanRequest instance) => { + 'banned_by': instance.bannedBy?.toJson(), + 'banned_by_id': instance.bannedById, + 'channel_cid': instance.channelCid, + 'delete_messages': instance.deleteMessages?.toJson(), + 'ip_ban': instance.ipBan, + 'reason': instance.reason, + 'shadow': instance.shadow, + 'target_user_id': instance.targetUserId, + 'timeout': instance.timeout, +}; diff --git a/packages/stream_chat/lib/open_api/model/ban_response.dart b/packages/stream_chat/lib/open_api/model/ban_response.dart new file mode 100644 index 0000000000..32b8084d59 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ban_response.dart @@ -0,0 +1,63 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'ban_response.g.dart'; +part 'ban_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class BanResponse with _$BanResponse { + const BanResponse({ + this.bannedBy, + this.channel, + required this.createdAt, + this.expires, + this.reason, + this.shadow, + this.user, + }); + + @override + @JsonKey(name: 'banned_by') + final UserResponse? bannedBy; + + @override + @JsonKey(name: 'channel') + final ChannelResponse? channel; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'expires') + final DateTime? expires; + + @override + @JsonKey(name: 'reason') + final String? reason; + + @override + @JsonKey(name: 'shadow') + final bool? shadow; + + @override + @JsonKey(name: 'user') + final UserResponse? user; + + Map toJson() => _$BanResponseToJson(this); + + static BanResponse fromJson(Map json) => _$BanResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/ban_response.freezed.dart b/packages/stream_chat/lib/open_api/model/ban_response.freezed.dart new file mode 100644 index 0000000000..88361d5698 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ban_response.freezed.dart @@ -0,0 +1,134 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'ban_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$BanResponse { + UserResponse? get bannedBy; + ChannelResponse? get channel; + DateTime get createdAt; + DateTime? get expires; + String? get reason; + bool? get shadow; + UserResponse? get user; + + /// Create a copy of BanResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $BanResponseCopyWith get copyWith => + _$BanResponseCopyWithImpl(this as BanResponse, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is BanResponse && + (identical(other.bannedBy, bannedBy) || other.bannedBy == bannedBy) && + (identical(other.channel, channel) || other.channel == channel) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.expires, expires) || other.expires == expires) && + (identical(other.reason, reason) || other.reason == reason) && + (identical(other.shadow, shadow) || other.shadow == shadow) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + bannedBy, + channel, + createdAt, + expires, + reason, + shadow, + user, + ); + + @override + String toString() { + return 'BanResponse(bannedBy: $bannedBy, channel: $channel, createdAt: $createdAt, expires: $expires, reason: $reason, shadow: $shadow, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $BanResponseCopyWith<$Res> { + factory $BanResponseCopyWith( + BanResponse value, + $Res Function(BanResponse) _then, + ) = _$BanResponseCopyWithImpl; + @useResult + $Res call({ + UserResponse? bannedBy, + ChannelResponse? channel, + DateTime createdAt, + DateTime? expires, + String? reason, + bool? shadow, + UserResponse? user, + }); +} + +/// @nodoc +class _$BanResponseCopyWithImpl<$Res> implements $BanResponseCopyWith<$Res> { + _$BanResponseCopyWithImpl(this._self, this._then); + + final BanResponse _self; + final $Res Function(BanResponse) _then; + + /// Create a copy of BanResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? bannedBy = freezed, + Object? channel = freezed, + Object? createdAt = null, + Object? expires = freezed, + Object? reason = freezed, + Object? shadow = freezed, + Object? user = freezed, + }) { + return _then( + BanResponse( + bannedBy: freezed == bannedBy + ? _self.bannedBy + : bannedBy // ignore: cast_nullable_to_non_nullable + as UserResponse?, + channel: freezed == channel + ? _self.channel + : channel // ignore: cast_nullable_to_non_nullable + as ChannelResponse?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + expires: freezed == expires + ? _self.expires + : expires // ignore: cast_nullable_to_non_nullable + as DateTime?, + reason: freezed == reason + ? _self.reason + : reason // ignore: cast_nullable_to_non_nullable + as String?, + shadow: freezed == shadow + ? _self.shadow + : shadow // ignore: cast_nullable_to_non_nullable + as bool?, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponse?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/ban_response.g.dart b/packages/stream_chat/lib/open_api/model/ban_response.g.dart new file mode 100644 index 0000000000..29ba31c362 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ban_response.g.dart @@ -0,0 +1,45 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'ban_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +BanResponse _$BanResponseFromJson(Map json) => BanResponse( + bannedBy: json['banned_by'] == null ? null : UserResponse.fromJson(json['banned_by'] as Map), + channel: json['channel'] == null ? null : ChannelResponse.fromJson(json['channel'] as Map), + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + expires: _$JsonConverterFromJson( + json['expires'], + const StreamDateTimeConverter().fromJson, + ), + reason: json['reason'] as String?, + shadow: json['shadow'] as bool?, + user: json['user'] == null ? null : UserResponse.fromJson(json['user'] as Map), +); + +Map _$BanResponseToJson(BanResponse instance) => { + 'banned_by': instance.bannedBy?.toJson(), + 'channel': instance.channel?.toJson(), + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'expires': _$JsonConverterToJson( + instance.expires, + const StreamDateTimeConverter().toJson, + ), + 'reason': instance.reason, + 'shadow': instance.shadow, + 'user': instance.user?.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/block_action_request_payload.dart b/packages/stream_chat/lib/open_api/model/block_action_request_payload.dart new file mode 100644 index 0000000000..a85447c713 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/block_action_request_payload.dart @@ -0,0 +1,31 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'block_action_request_payload.g.dart'; +part 'block_action_request_payload.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class BlockActionRequestPayload with _$BlockActionRequestPayload { + const BlockActionRequestPayload({ + this.reason, + }); + + @override + @JsonKey(name: 'reason') + final String? reason; + + Map toJson() => _$BlockActionRequestPayloadToJson(this); + + static BlockActionRequestPayload fromJson(Map json) => _$BlockActionRequestPayloadFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/block_action_request_payload.freezed.dart b/packages/stream_chat/lib/open_api/model/block_action_request_payload.freezed.dart new file mode 100644 index 0000000000..52c9aa032e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/block_action_request_payload.freezed.dart @@ -0,0 +1,76 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'block_action_request_payload.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$BlockActionRequestPayload { + String? get reason; + + /// Create a copy of BlockActionRequestPayload + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $BlockActionRequestPayloadCopyWith get copyWith => + _$BlockActionRequestPayloadCopyWithImpl( + this as BlockActionRequestPayload, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is BlockActionRequestPayload && + (identical(other.reason, reason) || other.reason == reason)); + } + + @override + int get hashCode => Object.hash(runtimeType, reason); + + @override + String toString() { + return 'BlockActionRequestPayload(reason: $reason)'; + } +} + +/// @nodoc +abstract mixin class $BlockActionRequestPayloadCopyWith<$Res> { + factory $BlockActionRequestPayloadCopyWith( + BlockActionRequestPayload value, + $Res Function(BlockActionRequestPayload) _then, + ) = _$BlockActionRequestPayloadCopyWithImpl; + @useResult + $Res call({String? reason}); +} + +/// @nodoc +class _$BlockActionRequestPayloadCopyWithImpl<$Res> implements $BlockActionRequestPayloadCopyWith<$Res> { + _$BlockActionRequestPayloadCopyWithImpl(this._self, this._then); + + final BlockActionRequestPayload _self; + final $Res Function(BlockActionRequestPayload) _then; + + /// Create a copy of BlockActionRequestPayload + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? reason = freezed}) { + return _then( + BlockActionRequestPayload( + reason: freezed == reason + ? _self.reason + : reason // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/block_action_request_payload.g.dart b/packages/stream_chat/lib/open_api/model/block_action_request_payload.g.dart new file mode 100644 index 0000000000..a4411654fa --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/block_action_request_payload.g.dart @@ -0,0 +1,15 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'block_action_request_payload.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +BlockActionRequestPayload _$BlockActionRequestPayloadFromJson( + Map json, +) => BlockActionRequestPayload(reason: json['reason'] as String?); + +Map _$BlockActionRequestPayloadToJson( + BlockActionRequestPayload instance, +) => {'reason': instance.reason}; diff --git a/packages/stream_chat/lib/open_api/model/block_list_config.dart b/packages/stream_chat/lib/open_api/model/block_list_config.dart new file mode 100644 index 0000000000..7fb37b8916 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/block_list_config.dart @@ -0,0 +1,46 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'block_list_config.g.dart'; +part 'block_list_config.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class BlockListConfig with _$BlockListConfig { + const BlockListConfig({ + this.async, + required this.enabled, + this.matchSubstring, + required this.rules, + }); + + @override + @JsonKey(name: 'async') + final bool? async; + + @override + @JsonKey(name: 'enabled') + final bool enabled; + + @override + @JsonKey(name: 'match_substring') + final bool? matchSubstring; + + @override + @JsonKey(name: 'rules') + final List rules; + + Map toJson() => _$BlockListConfigToJson(this); + + static BlockListConfig fromJson(Map json) => _$BlockListConfigFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/block_list_config.freezed.dart b/packages/stream_chat/lib/open_api/model/block_list_config.freezed.dart new file mode 100644 index 0000000000..07d507a5b7 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/block_list_config.freezed.dart @@ -0,0 +1,109 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'block_list_config.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$BlockListConfig { + bool? get async; + bool get enabled; + bool? get matchSubstring; + List get rules; + + /// Create a copy of BlockListConfig + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $BlockListConfigCopyWith get copyWith => _$BlockListConfigCopyWithImpl( + this as BlockListConfig, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is BlockListConfig && + (identical(other.async, async) || other.async == async) && + (identical(other.enabled, enabled) || other.enabled == enabled) && + (identical(other.matchSubstring, matchSubstring) || other.matchSubstring == matchSubstring) && + const DeepCollectionEquality().equals(other.rules, rules)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + async, + enabled, + matchSubstring, + const DeepCollectionEquality().hash(rules), + ); + + @override + String toString() { + return 'BlockListConfig(async: $async, enabled: $enabled, matchSubstring: $matchSubstring, rules: $rules)'; + } +} + +/// @nodoc +abstract mixin class $BlockListConfigCopyWith<$Res> { + factory $BlockListConfigCopyWith( + BlockListConfig value, + $Res Function(BlockListConfig) _then, + ) = _$BlockListConfigCopyWithImpl; + @useResult + $Res call({ + bool? async, + bool enabled, + bool? matchSubstring, + List rules, + }); +} + +/// @nodoc +class _$BlockListConfigCopyWithImpl<$Res> implements $BlockListConfigCopyWith<$Res> { + _$BlockListConfigCopyWithImpl(this._self, this._then); + + final BlockListConfig _self; + final $Res Function(BlockListConfig) _then; + + /// Create a copy of BlockListConfig + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? async = freezed, + Object? enabled = null, + Object? matchSubstring = freezed, + Object? rules = null, + }) { + return _then( + BlockListConfig( + async: freezed == async + ? _self.async + : async // ignore: cast_nullable_to_non_nullable + as bool?, + enabled: null == enabled + ? _self.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool, + matchSubstring: freezed == matchSubstring + ? _self.matchSubstring + : matchSubstring // ignore: cast_nullable_to_non_nullable + as bool?, + rules: null == rules + ? _self.rules + : rules // ignore: cast_nullable_to_non_nullable + as List, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/block_list_config.g.dart b/packages/stream_chat/lib/open_api/model/block_list_config.g.dart new file mode 100644 index 0000000000..412b4526ef --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/block_list_config.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'block_list_config.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +BlockListConfig _$BlockListConfigFromJson(Map json) => BlockListConfig( + async: json['async'] as bool?, + enabled: json['enabled'] as bool, + matchSubstring: json['match_substring'] as bool?, + rules: (json['rules'] as List).map((e) => BlockListRule.fromJson(e as Map)).toList(), +); + +Map _$BlockListConfigToJson(BlockListConfig instance) => { + 'async': instance.async, + 'enabled': instance.enabled, + 'match_substring': instance.matchSubstring, + 'rules': instance.rules.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/block_list_options.dart b/packages/stream_chat/lib/open_api/model/block_list_options.dart new file mode 100644 index 0000000000..a6c700c29d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/block_list_options.dart @@ -0,0 +1,46 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'block_list_options.g.dart'; +part 'block_list_options.freezed.dart'; + +extension type const BlockListOptionsBehavior._(String _) implements String { + static const block = BlockListOptionsBehavior._('block'); + static const flag = BlockListOptionsBehavior._('flag'); + static const shadowBlock = BlockListOptionsBehavior._('shadow_block'); + + factory BlockListOptionsBehavior.fromJson(String json) => BlockListOptionsBehavior._(json); + + String toJson() => this; +} + +@freezed +@immutable +@JsonSerializable() +class BlockListOptions with _$BlockListOptions { + const BlockListOptions({ + required this.behavior, + required this.blocklist, + }); + + @override + @JsonKey(name: 'behavior') + final BlockListOptionsBehavior behavior; + + @override + @JsonKey(name: 'blocklist') + final String blocklist; + + Map toJson() => _$BlockListOptionsToJson(this); + + static BlockListOptions fromJson(Map json) => _$BlockListOptionsFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/block_list_options.freezed.dart b/packages/stream_chat/lib/open_api/model/block_list_options.freezed.dart new file mode 100644 index 0000000000..0751b33586 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/block_list_options.freezed.dart @@ -0,0 +1,81 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'block_list_options.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$BlockListOptions { + BlockListOptionsBehavior get behavior; + String get blocklist; + + /// Create a copy of BlockListOptions + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $BlockListOptionsCopyWith get copyWith => _$BlockListOptionsCopyWithImpl( + this as BlockListOptions, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is BlockListOptions && + (identical(other.behavior, behavior) || other.behavior == behavior) && + (identical(other.blocklist, blocklist) || other.blocklist == blocklist)); + } + + @override + int get hashCode => Object.hash(runtimeType, behavior, blocklist); + + @override + String toString() { + return 'BlockListOptions(behavior: $behavior, blocklist: $blocklist)'; + } +} + +/// @nodoc +abstract mixin class $BlockListOptionsCopyWith<$Res> { + factory $BlockListOptionsCopyWith( + BlockListOptions value, + $Res Function(BlockListOptions) _then, + ) = _$BlockListOptionsCopyWithImpl; + @useResult + $Res call({BlockListOptionsBehavior behavior, String blocklist}); +} + +/// @nodoc +class _$BlockListOptionsCopyWithImpl<$Res> implements $BlockListOptionsCopyWith<$Res> { + _$BlockListOptionsCopyWithImpl(this._self, this._then); + + final BlockListOptions _self; + final $Res Function(BlockListOptions) _then; + + /// Create a copy of BlockListOptions + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? behavior = null, Object? blocklist = null}) { + return _then( + BlockListOptions( + behavior: null == behavior + ? _self.behavior + : behavior // ignore: cast_nullable_to_non_nullable + as BlockListOptionsBehavior, + blocklist: null == blocklist + ? _self.blocklist + : blocklist // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/block_list_options.g.dart b/packages/stream_chat/lib/open_api/model/block_list_options.g.dart new file mode 100644 index 0000000000..555221dee6 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/block_list_options.g.dart @@ -0,0 +1,17 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'block_list_options.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +BlockListOptions _$BlockListOptionsFromJson(Map json) => BlockListOptions( + behavior: BlockListOptionsBehavior.fromJson(json['behavior'] as String), + blocklist: json['blocklist'] as String, +); + +Map _$BlockListOptionsToJson(BlockListOptions instance) => { + 'behavior': instance.behavior.toJson(), + 'blocklist': instance.blocklist, +}; diff --git a/packages/stream_chat/lib/open_api/model/block_list_response.dart b/packages/stream_chat/lib/open_api/model/block_list_response.dart new file mode 100644 index 0000000000..820620cdf2 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/block_list_response.dart @@ -0,0 +1,88 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'block_list_response.g.dart'; +part 'block_list_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class BlockListResponse with _$BlockListResponse { + const BlockListResponse({ + this.createdAt, + this.id, + required this.isConfusableFoldingEnabled, + required this.isLeetCheckEnabled, + required this.isPluralCheckEnabled, + required this.isSubstringMatchingEnabled, + required this.name, + this.ownerUserId, + this.team, + required this.type, + this.updatedAt, + required this.words, + }); + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime? createdAt; + + @override + @JsonKey(name: 'id') + final String? id; + + @override + @JsonKey(name: 'is_confusable_folding_enabled') + final bool isConfusableFoldingEnabled; + + @override + @JsonKey(name: 'is_leet_check_enabled') + final bool isLeetCheckEnabled; + + @override + @JsonKey(name: 'is_plural_check_enabled') + final bool isPluralCheckEnabled; + + @override + @JsonKey(name: 'is_substring_matching_enabled') + final bool isSubstringMatchingEnabled; + + @override + @JsonKey(name: 'name') + final String name; + + @override + @JsonKey(name: 'owner_user_id') + final String? ownerUserId; + + @override + @JsonKey(name: 'team') + final String? team; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'updated_at') + final DateTime? updatedAt; + + @override + @JsonKey(name: 'words') + final List words; + + Map toJson() => _$BlockListResponseToJson(this); + + static BlockListResponse fromJson(Map json) => _$BlockListResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/block_list_response.freezed.dart b/packages/stream_chat/lib/open_api/model/block_list_response.freezed.dart new file mode 100644 index 0000000000..a3926e53da --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/block_list_response.freezed.dart @@ -0,0 +1,191 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'block_list_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$BlockListResponse { + DateTime? get createdAt; + String? get id; + bool get isConfusableFoldingEnabled; + bool get isLeetCheckEnabled; + bool get isPluralCheckEnabled; + bool get isSubstringMatchingEnabled; + String get name; + String? get ownerUserId; + String? get team; + String get type; + DateTime? get updatedAt; + List get words; + + /// Create a copy of BlockListResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $BlockListResponseCopyWith get copyWith => _$BlockListResponseCopyWithImpl( + this as BlockListResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is BlockListResponse && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.id, id) || other.id == id) && + (identical( + other.isConfusableFoldingEnabled, + isConfusableFoldingEnabled, + ) || + other.isConfusableFoldingEnabled == isConfusableFoldingEnabled) && + (identical(other.isLeetCheckEnabled, isLeetCheckEnabled) || + other.isLeetCheckEnabled == isLeetCheckEnabled) && + (identical(other.isPluralCheckEnabled, isPluralCheckEnabled) || + other.isPluralCheckEnabled == isPluralCheckEnabled) && + (identical( + other.isSubstringMatchingEnabled, + isSubstringMatchingEnabled, + ) || + other.isSubstringMatchingEnabled == isSubstringMatchingEnabled) && + (identical(other.name, name) || other.name == name) && + (identical(other.ownerUserId, ownerUserId) || other.ownerUserId == ownerUserId) && + (identical(other.team, team) || other.team == team) && + (identical(other.type, type) || other.type == type) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt) && + const DeepCollectionEquality().equals(other.words, words)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + createdAt, + id, + isConfusableFoldingEnabled, + isLeetCheckEnabled, + isPluralCheckEnabled, + isSubstringMatchingEnabled, + name, + ownerUserId, + team, + type, + updatedAt, + const DeepCollectionEquality().hash(words), + ); + + @override + String toString() { + return 'BlockListResponse(createdAt: $createdAt, id: $id, isConfusableFoldingEnabled: $isConfusableFoldingEnabled, isLeetCheckEnabled: $isLeetCheckEnabled, isPluralCheckEnabled: $isPluralCheckEnabled, isSubstringMatchingEnabled: $isSubstringMatchingEnabled, name: $name, ownerUserId: $ownerUserId, team: $team, type: $type, updatedAt: $updatedAt, words: $words)'; + } +} + +/// @nodoc +abstract mixin class $BlockListResponseCopyWith<$Res> { + factory $BlockListResponseCopyWith( + BlockListResponse value, + $Res Function(BlockListResponse) _then, + ) = _$BlockListResponseCopyWithImpl; + @useResult + $Res call({ + DateTime? createdAt, + String? id, + bool isConfusableFoldingEnabled, + bool isLeetCheckEnabled, + bool isPluralCheckEnabled, + bool isSubstringMatchingEnabled, + String name, + String? ownerUserId, + String? team, + String type, + DateTime? updatedAt, + List words, + }); +} + +/// @nodoc +class _$BlockListResponseCopyWithImpl<$Res> implements $BlockListResponseCopyWith<$Res> { + _$BlockListResponseCopyWithImpl(this._self, this._then); + + final BlockListResponse _self; + final $Res Function(BlockListResponse) _then; + + /// Create a copy of BlockListResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? createdAt = freezed, + Object? id = freezed, + Object? isConfusableFoldingEnabled = null, + Object? isLeetCheckEnabled = null, + Object? isPluralCheckEnabled = null, + Object? isSubstringMatchingEnabled = null, + Object? name = null, + Object? ownerUserId = freezed, + Object? team = freezed, + Object? type = null, + Object? updatedAt = freezed, + Object? words = null, + }) { + return _then( + BlockListResponse( + createdAt: freezed == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + id: freezed == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String?, + isConfusableFoldingEnabled: null == isConfusableFoldingEnabled + ? _self.isConfusableFoldingEnabled + : isConfusableFoldingEnabled // ignore: cast_nullable_to_non_nullable + as bool, + isLeetCheckEnabled: null == isLeetCheckEnabled + ? _self.isLeetCheckEnabled + : isLeetCheckEnabled // ignore: cast_nullable_to_non_nullable + as bool, + isPluralCheckEnabled: null == isPluralCheckEnabled + ? _self.isPluralCheckEnabled + : isPluralCheckEnabled // ignore: cast_nullable_to_non_nullable + as bool, + isSubstringMatchingEnabled: null == isSubstringMatchingEnabled + ? _self.isSubstringMatchingEnabled + : isSubstringMatchingEnabled // ignore: cast_nullable_to_non_nullable + as bool, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + ownerUserId: freezed == ownerUserId + ? _self.ownerUserId + : ownerUserId // ignore: cast_nullable_to_non_nullable + as String?, + team: freezed == team + ? _self.team + : team // ignore: cast_nullable_to_non_nullable + as String?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + updatedAt: freezed == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + words: null == words + ? _self.words + : words // ignore: cast_nullable_to_non_nullable + as List, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/block_list_response.g.dart b/packages/stream_chat/lib/open_api/model/block_list_response.g.dart new file mode 100644 index 0000000000..989383cf72 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/block_list_response.g.dart @@ -0,0 +1,59 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'block_list_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +BlockListResponse _$BlockListResponseFromJson(Map json) => BlockListResponse( + createdAt: _$JsonConverterFromJson( + json['created_at'], + const StreamDateTimeConverter().fromJson, + ), + id: json['id'] as String?, + isConfusableFoldingEnabled: json['is_confusable_folding_enabled'] as bool, + isLeetCheckEnabled: json['is_leet_check_enabled'] as bool, + isPluralCheckEnabled: json['is_plural_check_enabled'] as bool, + isSubstringMatchingEnabled: json['is_substring_matching_enabled'] as bool, + name: json['name'] as String, + ownerUserId: json['owner_user_id'] as String?, + team: json['team'] as String?, + type: json['type'] as String, + updatedAt: _$JsonConverterFromJson( + json['updated_at'], + const StreamDateTimeConverter().fromJson, + ), + words: (json['words'] as List).map((e) => e as String).toList(), +); + +Map _$BlockListResponseToJson(BlockListResponse instance) => { + 'created_at': _$JsonConverterToJson( + instance.createdAt, + const StreamDateTimeConverter().toJson, + ), + 'id': instance.id, + 'is_confusable_folding_enabled': instance.isConfusableFoldingEnabled, + 'is_leet_check_enabled': instance.isLeetCheckEnabled, + 'is_plural_check_enabled': instance.isPluralCheckEnabled, + 'is_substring_matching_enabled': instance.isSubstringMatchingEnabled, + 'name': instance.name, + 'owner_user_id': instance.ownerUserId, + 'team': instance.team, + 'type': instance.type, + 'updated_at': _$JsonConverterToJson( + instance.updatedAt, + const StreamDateTimeConverter().toJson, + ), + 'words': instance.words, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/block_list_rule.dart b/packages/stream_chat/lib/open_api/model/block_list_rule.dart new file mode 100644 index 0000000000..00cf6cc295 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/block_list_rule.dart @@ -0,0 +1,56 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'block_list_rule.g.dart'; +part 'block_list_rule.freezed.dart'; + +extension type const BlockListRuleAction._(String _) implements String { + static const bounce = BlockListRuleAction._('bounce'); + static const bounceFlag = BlockListRuleAction._('bounce_flag'); + static const bounceRemove = BlockListRuleAction._('bounce_remove'); + static const flag = BlockListRuleAction._('flag'); + static const mask = BlockListRuleAction._('mask'); + static const maskFlag = BlockListRuleAction._('mask_flag'); + static const remove = BlockListRuleAction._('remove'); + static const shadow = BlockListRuleAction._('shadow'); + + factory BlockListRuleAction.fromJson(String json) => BlockListRuleAction._(json); + + String toJson() => this; +} + +@freezed +@immutable +@JsonSerializable() +class BlockListRule with _$BlockListRule { + const BlockListRule({ + required this.action, + required this.name, + required this.team, + }); + + @override + @JsonKey(name: 'action') + final BlockListRuleAction action; + + @override + @JsonKey(name: 'name') + final String name; + + @override + @JsonKey(name: 'team') + final String team; + + Map toJson() => _$BlockListRuleToJson(this); + + static BlockListRule fromJson(Map json) => _$BlockListRuleFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/block_list_rule.freezed.dart b/packages/stream_chat/lib/open_api/model/block_list_rule.freezed.dart new file mode 100644 index 0000000000..d333ea6973 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/block_list_rule.freezed.dart @@ -0,0 +1,87 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'block_list_rule.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$BlockListRule { + BlockListRuleAction get action; + String get name; + String get team; + + /// Create a copy of BlockListRule + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $BlockListRuleCopyWith get copyWith => _$BlockListRuleCopyWithImpl( + this as BlockListRule, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is BlockListRule && + (identical(other.action, action) || other.action == action) && + (identical(other.name, name) || other.name == name) && + (identical(other.team, team) || other.team == team)); + } + + @override + int get hashCode => Object.hash(runtimeType, action, name, team); + + @override + String toString() { + return 'BlockListRule(action: $action, name: $name, team: $team)'; + } +} + +/// @nodoc +abstract mixin class $BlockListRuleCopyWith<$Res> { + factory $BlockListRuleCopyWith( + BlockListRule value, + $Res Function(BlockListRule) _then, + ) = _$BlockListRuleCopyWithImpl; + @useResult + $Res call({BlockListRuleAction action, String name, String team}); +} + +/// @nodoc +class _$BlockListRuleCopyWithImpl<$Res> implements $BlockListRuleCopyWith<$Res> { + _$BlockListRuleCopyWithImpl(this._self, this._then); + + final BlockListRule _self; + final $Res Function(BlockListRule) _then; + + /// Create a copy of BlockListRule + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? action = null, Object? name = null, Object? team = null}) { + return _then( + BlockListRule( + action: null == action + ? _self.action + : action // ignore: cast_nullable_to_non_nullable + as BlockListRuleAction, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + team: null == team + ? _self.team + : team // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/block_list_rule.g.dart b/packages/stream_chat/lib/open_api/model/block_list_rule.g.dart new file mode 100644 index 0000000000..afad399b0e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/block_list_rule.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'block_list_rule.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +BlockListRule _$BlockListRuleFromJson(Map json) => BlockListRule( + action: BlockListRuleAction.fromJson(json['action'] as String), + name: json['name'] as String, + team: json['team'] as String, +); + +Map _$BlockListRuleToJson(BlockListRule instance) => { + 'action': instance.action.toJson(), + 'name': instance.name, + 'team': instance.team, +}; diff --git a/packages/stream_chat/lib/open_api/model/block_users_request.dart b/packages/stream_chat/lib/open_api/model/block_users_request.dart new file mode 100644 index 0000000000..b02f909de1 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/block_users_request.dart @@ -0,0 +1,31 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'block_users_request.g.dart'; +part 'block_users_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class BlockUsersRequest with _$BlockUsersRequest { + const BlockUsersRequest({ + required this.blockedUserId, + }); + + @override + @JsonKey(name: 'blocked_user_id') + final String blockedUserId; + + Map toJson() => _$BlockUsersRequestToJson(this); + + static BlockUsersRequest fromJson(Map json) => _$BlockUsersRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/block_users_request.freezed.dart b/packages/stream_chat/lib/open_api/model/block_users_request.freezed.dart new file mode 100644 index 0000000000..c0a63400b9 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/block_users_request.freezed.dart @@ -0,0 +1,75 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'block_users_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$BlockUsersRequest { + String get blockedUserId; + + /// Create a copy of BlockUsersRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $BlockUsersRequestCopyWith get copyWith => _$BlockUsersRequestCopyWithImpl( + this as BlockUsersRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is BlockUsersRequest && + (identical(other.blockedUserId, blockedUserId) || other.blockedUserId == blockedUserId)); + } + + @override + int get hashCode => Object.hash(runtimeType, blockedUserId); + + @override + String toString() { + return 'BlockUsersRequest(blockedUserId: $blockedUserId)'; + } +} + +/// @nodoc +abstract mixin class $BlockUsersRequestCopyWith<$Res> { + factory $BlockUsersRequestCopyWith( + BlockUsersRequest value, + $Res Function(BlockUsersRequest) _then, + ) = _$BlockUsersRequestCopyWithImpl; + @useResult + $Res call({String blockedUserId}); +} + +/// @nodoc +class _$BlockUsersRequestCopyWithImpl<$Res> implements $BlockUsersRequestCopyWith<$Res> { + _$BlockUsersRequestCopyWithImpl(this._self, this._then); + + final BlockUsersRequest _self; + final $Res Function(BlockUsersRequest) _then; + + /// Create a copy of BlockUsersRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? blockedUserId = null}) { + return _then( + BlockUsersRequest( + blockedUserId: null == blockedUserId + ? _self.blockedUserId + : blockedUserId // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/block_users_request.g.dart b/packages/stream_chat/lib/open_api/model/block_users_request.g.dart new file mode 100644 index 0000000000..b410fd9203 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/block_users_request.g.dart @@ -0,0 +1,14 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'block_users_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +BlockUsersRequest _$BlockUsersRequestFromJson(Map json) => + BlockUsersRequest(blockedUserId: json['blocked_user_id'] as String); + +Map _$BlockUsersRequestToJson(BlockUsersRequest instance) => { + 'blocked_user_id': instance.blockedUserId, +}; diff --git a/packages/stream_chat/lib/open_api/model/block_users_response.dart b/packages/stream_chat/lib/open_api/model/block_users_response.dart new file mode 100644 index 0000000000..fd53b97dc5 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/block_users_response.dart @@ -0,0 +1,47 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'block_users_response.g.dart'; +part 'block_users_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class BlockUsersResponse with _$BlockUsersResponse { + const BlockUsersResponse({ + required this.blockedByUserId, + required this.blockedUserId, + required this.createdAt, + required this.duration, + }); + + @override + @JsonKey(name: 'blocked_by_user_id') + final String blockedByUserId; + + @override + @JsonKey(name: 'blocked_user_id') + final String blockedUserId; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'duration') + final String duration; + + Map toJson() => _$BlockUsersResponseToJson(this); + + static BlockUsersResponse fromJson(Map json) => _$BlockUsersResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/block_users_response.freezed.dart b/packages/stream_chat/lib/open_api/model/block_users_response.freezed.dart new file mode 100644 index 0000000000..342fc3f657 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/block_users_response.freezed.dart @@ -0,0 +1,109 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'block_users_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$BlockUsersResponse { + String get blockedByUserId; + String get blockedUserId; + DateTime get createdAt; + String get duration; + + /// Create a copy of BlockUsersResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $BlockUsersResponseCopyWith get copyWith => _$BlockUsersResponseCopyWithImpl( + this as BlockUsersResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is BlockUsersResponse && + (identical(other.blockedByUserId, blockedByUserId) || other.blockedByUserId == blockedByUserId) && + (identical(other.blockedUserId, blockedUserId) || other.blockedUserId == blockedUserId) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.duration, duration) || other.duration == duration)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + blockedByUserId, + blockedUserId, + createdAt, + duration, + ); + + @override + String toString() { + return 'BlockUsersResponse(blockedByUserId: $blockedByUserId, blockedUserId: $blockedUserId, createdAt: $createdAt, duration: $duration)'; + } +} + +/// @nodoc +abstract mixin class $BlockUsersResponseCopyWith<$Res> { + factory $BlockUsersResponseCopyWith( + BlockUsersResponse value, + $Res Function(BlockUsersResponse) _then, + ) = _$BlockUsersResponseCopyWithImpl; + @useResult + $Res call({ + String blockedByUserId, + String blockedUserId, + DateTime createdAt, + String duration, + }); +} + +/// @nodoc +class _$BlockUsersResponseCopyWithImpl<$Res> implements $BlockUsersResponseCopyWith<$Res> { + _$BlockUsersResponseCopyWithImpl(this._self, this._then); + + final BlockUsersResponse _self; + final $Res Function(BlockUsersResponse) _then; + + /// Create a copy of BlockUsersResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? blockedByUserId = null, + Object? blockedUserId = null, + Object? createdAt = null, + Object? duration = null, + }) { + return _then( + BlockUsersResponse( + blockedByUserId: null == blockedByUserId + ? _self.blockedByUserId + : blockedByUserId // ignore: cast_nullable_to_non_nullable + as String, + blockedUserId: null == blockedUserId + ? _self.blockedUserId + : blockedUserId // ignore: cast_nullable_to_non_nullable + as String, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/block_users_response.g.dart b/packages/stream_chat/lib/open_api/model/block_users_response.g.dart new file mode 100644 index 0000000000..1323f73b67 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/block_users_response.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'block_users_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +BlockUsersResponse _$BlockUsersResponseFromJson(Map json) => BlockUsersResponse( + blockedByUserId: json['blocked_by_user_id'] as String, + blockedUserId: json['blocked_user_id'] as String, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + duration: json['duration'] as String, +); + +Map _$BlockUsersResponseToJson(BlockUsersResponse instance) => { + 'blocked_by_user_id': instance.blockedByUserId, + 'blocked_user_id': instance.blockedUserId, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'duration': instance.duration, +}; diff --git a/packages/stream_chat/lib/open_api/model/blocked_user_response.dart b/packages/stream_chat/lib/open_api/model/blocked_user_response.dart new file mode 100644 index 0000000000..8bf2fb36c7 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/blocked_user_response.dart @@ -0,0 +1,52 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'blocked_user_response.g.dart'; +part 'blocked_user_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class BlockedUserResponse with _$BlockedUserResponse { + const BlockedUserResponse({ + required this.blockedUser, + required this.blockedUserId, + required this.createdAt, + required this.user, + required this.userId, + }); + + @override + @JsonKey(name: 'blocked_user') + final UserResponse blockedUser; + + @override + @JsonKey(name: 'blocked_user_id') + final String blockedUserId; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'user') + final UserResponse user; + + @override + @JsonKey(name: 'user_id') + final String userId; + + Map toJson() => _$BlockedUserResponseToJson(this); + + static BlockedUserResponse fromJson(Map json) => _$BlockedUserResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/blocked_user_response.freezed.dart b/packages/stream_chat/lib/open_api/model/blocked_user_response.freezed.dart new file mode 100644 index 0000000000..108b616cee --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/blocked_user_response.freezed.dart @@ -0,0 +1,119 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'blocked_user_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$BlockedUserResponse { + UserResponse get blockedUser; + String get blockedUserId; + DateTime get createdAt; + UserResponse get user; + String get userId; + + /// Create a copy of BlockedUserResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $BlockedUserResponseCopyWith get copyWith => + _$BlockedUserResponseCopyWithImpl( + this as BlockedUserResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is BlockedUserResponse && + (identical(other.blockedUser, blockedUser) || other.blockedUser == blockedUser) && + (identical(other.blockedUserId, blockedUserId) || other.blockedUserId == blockedUserId) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.user, user) || other.user == user) && + (identical(other.userId, userId) || other.userId == userId)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + blockedUser, + blockedUserId, + createdAt, + user, + userId, + ); + + @override + String toString() { + return 'BlockedUserResponse(blockedUser: $blockedUser, blockedUserId: $blockedUserId, createdAt: $createdAt, user: $user, userId: $userId)'; + } +} + +/// @nodoc +abstract mixin class $BlockedUserResponseCopyWith<$Res> { + factory $BlockedUserResponseCopyWith( + BlockedUserResponse value, + $Res Function(BlockedUserResponse) _then, + ) = _$BlockedUserResponseCopyWithImpl; + @useResult + $Res call({ + UserResponse blockedUser, + String blockedUserId, + DateTime createdAt, + UserResponse user, + String userId, + }); +} + +/// @nodoc +class _$BlockedUserResponseCopyWithImpl<$Res> implements $BlockedUserResponseCopyWith<$Res> { + _$BlockedUserResponseCopyWithImpl(this._self, this._then); + + final BlockedUserResponse _self; + final $Res Function(BlockedUserResponse) _then; + + /// Create a copy of BlockedUserResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? blockedUser = null, + Object? blockedUserId = null, + Object? createdAt = null, + Object? user = null, + Object? userId = null, + }) { + return _then( + BlockedUserResponse( + blockedUser: null == blockedUser + ? _self.blockedUser + : blockedUser // ignore: cast_nullable_to_non_nullable + as UserResponse, + blockedUserId: null == blockedUserId + ? _self.blockedUserId + : blockedUserId // ignore: cast_nullable_to_non_nullable + as String, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + user: null == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponse, + userId: null == userId + ? _self.userId + : userId // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/blocked_user_response.g.dart b/packages/stream_chat/lib/open_api/model/blocked_user_response.g.dart new file mode 100644 index 0000000000..e394370106 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/blocked_user_response.g.dart @@ -0,0 +1,29 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'blocked_user_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +BlockedUserResponse _$BlockedUserResponseFromJson(Map json) => BlockedUserResponse( + blockedUser: UserResponse.fromJson( + json['blocked_user'] as Map, + ), + blockedUserId: json['blocked_user_id'] as String, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + user: UserResponse.fromJson(json['user'] as Map), + userId: json['user_id'] as String, +); + +Map _$BlockedUserResponseToJson( + BlockedUserResponse instance, +) => { + 'blocked_user': instance.blockedUser.toJson(), + 'blocked_user_id': instance.blockedUserId, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'user': instance.user.toJson(), + 'user_id': instance.userId, +}; diff --git a/packages/stream_chat/lib/open_api/model/bodyguard_profile_summary.dart b/packages/stream_chat/lib/open_api/model/bodyguard_profile_summary.dart new file mode 100644 index 0000000000..07002a7f11 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/bodyguard_profile_summary.dart @@ -0,0 +1,41 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'bodyguard_profile_summary.g.dart'; +part 'bodyguard_profile_summary.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class BodyguardProfileSummary with _$BodyguardProfileSummary { + const BodyguardProfileSummary({ + this.displayName, + required this.name, + this.textType, + }); + + @override + @JsonKey(name: 'display_name') + final String? displayName; + + @override + @JsonKey(name: 'name') + final String name; + + @override + @JsonKey(name: 'text_type') + final String? textType; + + Map toJson() => _$BodyguardProfileSummaryToJson(this); + + static BodyguardProfileSummary fromJson(Map json) => _$BodyguardProfileSummaryFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/bodyguard_profile_summary.freezed.dart b/packages/stream_chat/lib/open_api/model/bodyguard_profile_summary.freezed.dart new file mode 100644 index 0000000000..f61a18128d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/bodyguard_profile_summary.freezed.dart @@ -0,0 +1,92 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'bodyguard_profile_summary.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$BodyguardProfileSummary { + String? get displayName; + String get name; + String? get textType; + + /// Create a copy of BodyguardProfileSummary + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $BodyguardProfileSummaryCopyWith get copyWith => + _$BodyguardProfileSummaryCopyWithImpl( + this as BodyguardProfileSummary, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is BodyguardProfileSummary && + (identical(other.displayName, displayName) || other.displayName == displayName) && + (identical(other.name, name) || other.name == name) && + (identical(other.textType, textType) || other.textType == textType)); + } + + @override + int get hashCode => Object.hash(runtimeType, displayName, name, textType); + + @override + String toString() { + return 'BodyguardProfileSummary(displayName: $displayName, name: $name, textType: $textType)'; + } +} + +/// @nodoc +abstract mixin class $BodyguardProfileSummaryCopyWith<$Res> { + factory $BodyguardProfileSummaryCopyWith( + BodyguardProfileSummary value, + $Res Function(BodyguardProfileSummary) _then, + ) = _$BodyguardProfileSummaryCopyWithImpl; + @useResult + $Res call({String? displayName, String name, String? textType}); +} + +/// @nodoc +class _$BodyguardProfileSummaryCopyWithImpl<$Res> implements $BodyguardProfileSummaryCopyWith<$Res> { + _$BodyguardProfileSummaryCopyWithImpl(this._self, this._then); + + final BodyguardProfileSummary _self; + final $Res Function(BodyguardProfileSummary) _then; + + /// Create a copy of BodyguardProfileSummary + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? displayName = freezed, + Object? name = null, + Object? textType = freezed, + }) { + return _then( + BodyguardProfileSummary( + displayName: freezed == displayName + ? _self.displayName + : displayName // ignore: cast_nullable_to_non_nullable + as String?, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + textType: freezed == textType + ? _self.textType + : textType // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/bodyguard_profile_summary.g.dart b/packages/stream_chat/lib/open_api/model/bodyguard_profile_summary.g.dart new file mode 100644 index 0000000000..e55b563525 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/bodyguard_profile_summary.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'bodyguard_profile_summary.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +BodyguardProfileSummary _$BodyguardProfileSummaryFromJson( + Map json, +) => BodyguardProfileSummary( + displayName: json['display_name'] as String?, + name: json['name'] as String, + textType: json['text_type'] as String?, +); + +Map _$BodyguardProfileSummaryToJson( + BodyguardProfileSummary instance, +) => { + 'display_name': instance.displayName, + 'name': instance.name, + 'text_type': instance.textType, +}; diff --git a/packages/stream_chat/lib/open_api/model/bodyguard_rule.dart b/packages/stream_chat/lib/open_api/model/bodyguard_rule.dart new file mode 100644 index 0000000000..3073d93755 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/bodyguard_rule.dart @@ -0,0 +1,57 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'bodyguard_rule.g.dart'; +part 'bodyguard_rule.freezed.dart'; + +extension type const BodyguardRuleAction._(String _) implements String { + static const bounce = BodyguardRuleAction._('bounce'); + static const bounceFlag = BodyguardRuleAction._('bounce_flag'); + static const bounceRemove = BodyguardRuleAction._('bounce_remove'); + static const flag = BodyguardRuleAction._('flag'); + static const keep = BodyguardRuleAction._('keep'); + static const mask = BodyguardRuleAction._('mask'); + static const maskFlag = BodyguardRuleAction._('mask_flag'); + static const remove = BodyguardRuleAction._('remove'); + static const shadow = BodyguardRuleAction._('shadow'); + + factory BodyguardRuleAction.fromJson(String json) => BodyguardRuleAction._(json); + + String toJson() => this; +} + +@freezed +@immutable +@JsonSerializable() +class BodyguardRule with _$BodyguardRule { + const BodyguardRule({ + required this.action, + required this.label, + required this.severityRules, + }); + + @override + @JsonKey(name: 'action') + final BodyguardRuleAction action; + + @override + @JsonKey(name: 'label') + final String label; + + @override + @JsonKey(name: 'severity_rules') + final List severityRules; + + Map toJson() => _$BodyguardRuleToJson(this); + + static BodyguardRule fromJson(Map json) => _$BodyguardRuleFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/bodyguard_rule.freezed.dart b/packages/stream_chat/lib/open_api/model/bodyguard_rule.freezed.dart new file mode 100644 index 0000000000..04c7b1bf59 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/bodyguard_rule.freezed.dart @@ -0,0 +1,103 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'bodyguard_rule.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$BodyguardRule { + BodyguardRuleAction get action; + String get label; + List get severityRules; + + /// Create a copy of BodyguardRule + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $BodyguardRuleCopyWith get copyWith => _$BodyguardRuleCopyWithImpl( + this as BodyguardRule, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is BodyguardRule && + (identical(other.action, action) || other.action == action) && + (identical(other.label, label) || other.label == label) && + const DeepCollectionEquality().equals( + other.severityRules, + severityRules, + )); + } + + @override + int get hashCode => Object.hash( + runtimeType, + action, + label, + const DeepCollectionEquality().hash(severityRules), + ); + + @override + String toString() { + return 'BodyguardRule(action: $action, label: $label, severityRules: $severityRules)'; + } +} + +/// @nodoc +abstract mixin class $BodyguardRuleCopyWith<$Res> { + factory $BodyguardRuleCopyWith( + BodyguardRule value, + $Res Function(BodyguardRule) _then, + ) = _$BodyguardRuleCopyWithImpl; + @useResult + $Res call({ + BodyguardRuleAction action, + String label, + List severityRules, + }); +} + +/// @nodoc +class _$BodyguardRuleCopyWithImpl<$Res> implements $BodyguardRuleCopyWith<$Res> { + _$BodyguardRuleCopyWithImpl(this._self, this._then); + + final BodyguardRule _self; + final $Res Function(BodyguardRule) _then; + + /// Create a copy of BodyguardRule + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? action = null, + Object? label = null, + Object? severityRules = null, + }) { + return _then( + BodyguardRule( + action: null == action + ? _self.action + : action // ignore: cast_nullable_to_non_nullable + as BodyguardRuleAction, + label: null == label + ? _self.label + : label // ignore: cast_nullable_to_non_nullable + as String, + severityRules: null == severityRules + ? _self.severityRules + : severityRules // ignore: cast_nullable_to_non_nullable + as List, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/bodyguard_rule.g.dart b/packages/stream_chat/lib/open_api/model/bodyguard_rule.g.dart new file mode 100644 index 0000000000..c54cd0abc3 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/bodyguard_rule.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'bodyguard_rule.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +BodyguardRule _$BodyguardRuleFromJson(Map json) => BodyguardRule( + action: BodyguardRuleAction.fromJson(json['action'] as String), + label: json['label'] as String, + severityRules: (json['severity_rules'] as List) + .map((e) => BodyguardSeverityRule.fromJson(e as Map)) + .toList(), +); + +Map _$BodyguardRuleToJson(BodyguardRule instance) => { + 'action': instance.action.toJson(), + 'label': instance.label, + 'severity_rules': instance.severityRules.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/bodyguard_severity_rule.dart b/packages/stream_chat/lib/open_api/model/bodyguard_severity_rule.dart new file mode 100644 index 0000000000..1b7e3f9b46 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/bodyguard_severity_rule.dart @@ -0,0 +1,62 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'bodyguard_severity_rule.g.dart'; +part 'bodyguard_severity_rule.freezed.dart'; + +extension type const BodyguardSeverityRuleAction._(String _) implements String { + static const bounce = BodyguardSeverityRuleAction._('bounce'); + static const bounceFlag = BodyguardSeverityRuleAction._('bounce_flag'); + static const bounceRemove = BodyguardSeverityRuleAction._('bounce_remove'); + static const flag = BodyguardSeverityRuleAction._('flag'); + static const keep = BodyguardSeverityRuleAction._('keep'); + static const mask = BodyguardSeverityRuleAction._('mask'); + static const remove = BodyguardSeverityRuleAction._('remove'); + static const shadow = BodyguardSeverityRuleAction._('shadow'); + + factory BodyguardSeverityRuleAction.fromJson(String json) => BodyguardSeverityRuleAction._(json); + + String toJson() => this; +} + +extension type const BodyguardSeverityRuleSeverity._(String _) implements String { + static const critical = BodyguardSeverityRuleSeverity._('critical'); + static const high = BodyguardSeverityRuleSeverity._('high'); + static const low = BodyguardSeverityRuleSeverity._('low'); + static const medium = BodyguardSeverityRuleSeverity._('medium'); + + factory BodyguardSeverityRuleSeverity.fromJson(String json) => BodyguardSeverityRuleSeverity._(json); + + String toJson() => this; +} + +@freezed +@immutable +@JsonSerializable() +class BodyguardSeverityRule with _$BodyguardSeverityRule { + const BodyguardSeverityRule({ + required this.action, + required this.severity, + }); + + @override + @JsonKey(name: 'action') + final BodyguardSeverityRuleAction action; + + @override + @JsonKey(name: 'severity') + final BodyguardSeverityRuleSeverity severity; + + Map toJson() => _$BodyguardSeverityRuleToJson(this); + + static BodyguardSeverityRule fromJson(Map json) => _$BodyguardSeverityRuleFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/bodyguard_severity_rule.freezed.dart b/packages/stream_chat/lib/open_api/model/bodyguard_severity_rule.freezed.dart new file mode 100644 index 0000000000..773eab86cb --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/bodyguard_severity_rule.freezed.dart @@ -0,0 +1,85 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'bodyguard_severity_rule.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$BodyguardSeverityRule { + BodyguardSeverityRuleAction get action; + BodyguardSeverityRuleSeverity get severity; + + /// Create a copy of BodyguardSeverityRule + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $BodyguardSeverityRuleCopyWith get copyWith => + _$BodyguardSeverityRuleCopyWithImpl( + this as BodyguardSeverityRule, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is BodyguardSeverityRule && + (identical(other.action, action) || other.action == action) && + (identical(other.severity, severity) || other.severity == severity)); + } + + @override + int get hashCode => Object.hash(runtimeType, action, severity); + + @override + String toString() { + return 'BodyguardSeverityRule(action: $action, severity: $severity)'; + } +} + +/// @nodoc +abstract mixin class $BodyguardSeverityRuleCopyWith<$Res> { + factory $BodyguardSeverityRuleCopyWith( + BodyguardSeverityRule value, + $Res Function(BodyguardSeverityRule) _then, + ) = _$BodyguardSeverityRuleCopyWithImpl; + @useResult + $Res call({ + BodyguardSeverityRuleAction action, + BodyguardSeverityRuleSeverity severity, + }); +} + +/// @nodoc +class _$BodyguardSeverityRuleCopyWithImpl<$Res> implements $BodyguardSeverityRuleCopyWith<$Res> { + _$BodyguardSeverityRuleCopyWithImpl(this._self, this._then); + + final BodyguardSeverityRule _self; + final $Res Function(BodyguardSeverityRule) _then; + + /// Create a copy of BodyguardSeverityRule + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? action = null, Object? severity = null}) { + return _then( + BodyguardSeverityRule( + action: null == action + ? _self.action + : action // ignore: cast_nullable_to_non_nullable + as BodyguardSeverityRuleAction, + severity: null == severity + ? _self.severity + : severity // ignore: cast_nullable_to_non_nullable + as BodyguardSeverityRuleSeverity, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/bodyguard_severity_rule.g.dart b/packages/stream_chat/lib/open_api/model/bodyguard_severity_rule.g.dart new file mode 100644 index 0000000000..45fa6525e8 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/bodyguard_severity_rule.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'bodyguard_severity_rule.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +BodyguardSeverityRule _$BodyguardSeverityRuleFromJson( + Map json, +) => BodyguardSeverityRule( + action: BodyguardSeverityRuleAction.fromJson(json['action'] as String), + severity: BodyguardSeverityRuleSeverity.fromJson(json['severity'] as String), +); + +Map _$BodyguardSeverityRuleToJson( + BodyguardSeverityRule instance, +) => { + 'action': instance.action.toJson(), + 'severity': instance.severity.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/bulk_action_appeals_request.dart b/packages/stream_chat/lib/open_api/model/bulk_action_appeals_request.dart new file mode 100644 index 0000000000..4021cfe961 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/bulk_action_appeals_request.dart @@ -0,0 +1,73 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'bulk_action_appeals_request.g.dart'; +part 'bulk_action_appeals_request.freezed.dart'; + +extension type const BulkActionAppealsRequestActionType._(String _) implements String { + static const markReviewed = BulkActionAppealsRequestActionType._('mark_reviewed'); + static const rejectAppeal = BulkActionAppealsRequestActionType._('reject_appeal'); + static const restore = BulkActionAppealsRequestActionType._('restore'); + static const unban = BulkActionAppealsRequestActionType._('unban'); + static const unblock = BulkActionAppealsRequestActionType._('unblock'); + + factory BulkActionAppealsRequestActionType.fromJson(String json) => BulkActionAppealsRequestActionType._(json); + + String toJson() => this; +} + +@freezed +@immutable +@JsonSerializable() +class BulkActionAppealsRequest with _$BulkActionAppealsRequest { + const BulkActionAppealsRequest({ + required this.actionType, + required this.appealIds, + this.markReviewed, + this.rejectAppeal, + this.restore, + this.unban, + this.unblock, + }); + + @override + @JsonKey(name: 'action_type') + final BulkActionAppealsRequestActionType actionType; + + @override + @JsonKey(name: 'appeal_ids') + final List appealIds; + + @override + @JsonKey(name: 'mark_reviewed') + final MarkReviewedRequestPayload? markReviewed; + + @override + @JsonKey(name: 'reject_appeal') + final RejectAppealRequestPayload? rejectAppeal; + + @override + @JsonKey(name: 'restore') + final RestoreActionRequestPayload? restore; + + @override + @JsonKey(name: 'unban') + final UnbanActionRequestPayload? unban; + + @override + @JsonKey(name: 'unblock') + final UnblockActionRequestPayload? unblock; + + Map toJson() => _$BulkActionAppealsRequestToJson(this); + + static BulkActionAppealsRequest fromJson(Map json) => _$BulkActionAppealsRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/bulk_action_appeals_request.freezed.dart b/packages/stream_chat/lib/open_api/model/bulk_action_appeals_request.freezed.dart new file mode 100644 index 0000000000..e1a06b26be --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/bulk_action_appeals_request.freezed.dart @@ -0,0 +1,137 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'bulk_action_appeals_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$BulkActionAppealsRequest { + BulkActionAppealsRequestActionType get actionType; + List get appealIds; + MarkReviewedRequestPayload? get markReviewed; + RejectAppealRequestPayload? get rejectAppeal; + RestoreActionRequestPayload? get restore; + UnbanActionRequestPayload? get unban; + UnblockActionRequestPayload? get unblock; + + /// Create a copy of BulkActionAppealsRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $BulkActionAppealsRequestCopyWith get copyWith => + _$BulkActionAppealsRequestCopyWithImpl( + this as BulkActionAppealsRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is BulkActionAppealsRequest && + (identical(other.actionType, actionType) || other.actionType == actionType) && + const DeepCollectionEquality().equals(other.appealIds, appealIds) && + (identical(other.markReviewed, markReviewed) || other.markReviewed == markReviewed) && + (identical(other.rejectAppeal, rejectAppeal) || other.rejectAppeal == rejectAppeal) && + (identical(other.restore, restore) || other.restore == restore) && + (identical(other.unban, unban) || other.unban == unban) && + (identical(other.unblock, unblock) || other.unblock == unblock)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + actionType, + const DeepCollectionEquality().hash(appealIds), + markReviewed, + rejectAppeal, + restore, + unban, + unblock, + ); + + @override + String toString() { + return 'BulkActionAppealsRequest(actionType: $actionType, appealIds: $appealIds, markReviewed: $markReviewed, rejectAppeal: $rejectAppeal, restore: $restore, unban: $unban, unblock: $unblock)'; + } +} + +/// @nodoc +abstract mixin class $BulkActionAppealsRequestCopyWith<$Res> { + factory $BulkActionAppealsRequestCopyWith( + BulkActionAppealsRequest value, + $Res Function(BulkActionAppealsRequest) _then, + ) = _$BulkActionAppealsRequestCopyWithImpl; + @useResult + $Res call({ + BulkActionAppealsRequestActionType actionType, + List appealIds, + MarkReviewedRequestPayload? markReviewed, + RejectAppealRequestPayload? rejectAppeal, + RestoreActionRequestPayload? restore, + UnbanActionRequestPayload? unban, + UnblockActionRequestPayload? unblock, + }); +} + +/// @nodoc +class _$BulkActionAppealsRequestCopyWithImpl<$Res> implements $BulkActionAppealsRequestCopyWith<$Res> { + _$BulkActionAppealsRequestCopyWithImpl(this._self, this._then); + + final BulkActionAppealsRequest _self; + final $Res Function(BulkActionAppealsRequest) _then; + + /// Create a copy of BulkActionAppealsRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? actionType = null, + Object? appealIds = null, + Object? markReviewed = freezed, + Object? rejectAppeal = freezed, + Object? restore = freezed, + Object? unban = freezed, + Object? unblock = freezed, + }) { + return _then( + BulkActionAppealsRequest( + actionType: null == actionType + ? _self.actionType + : actionType // ignore: cast_nullable_to_non_nullable + as BulkActionAppealsRequestActionType, + appealIds: null == appealIds + ? _self.appealIds + : appealIds // ignore: cast_nullable_to_non_nullable + as List, + markReviewed: freezed == markReviewed + ? _self.markReviewed + : markReviewed // ignore: cast_nullable_to_non_nullable + as MarkReviewedRequestPayload?, + rejectAppeal: freezed == rejectAppeal + ? _self.rejectAppeal + : rejectAppeal // ignore: cast_nullable_to_non_nullable + as RejectAppealRequestPayload?, + restore: freezed == restore + ? _self.restore + : restore // ignore: cast_nullable_to_non_nullable + as RestoreActionRequestPayload?, + unban: freezed == unban + ? _self.unban + : unban // ignore: cast_nullable_to_non_nullable + as UnbanActionRequestPayload?, + unblock: freezed == unblock + ? _self.unblock + : unblock // ignore: cast_nullable_to_non_nullable + as UnblockActionRequestPayload?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/bulk_action_appeals_request.g.dart b/packages/stream_chat/lib/open_api/model/bulk_action_appeals_request.g.dart new file mode 100644 index 0000000000..5a36481696 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/bulk_action_appeals_request.g.dart @@ -0,0 +1,53 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'bulk_action_appeals_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +BulkActionAppealsRequest _$BulkActionAppealsRequestFromJson( + Map json, +) => BulkActionAppealsRequest( + actionType: BulkActionAppealsRequestActionType.fromJson( + json['action_type'] as String, + ), + appealIds: (json['appeal_ids'] as List).map((e) => e as String).toList(), + markReviewed: json['mark_reviewed'] == null + ? null + : MarkReviewedRequestPayload.fromJson( + json['mark_reviewed'] as Map, + ), + rejectAppeal: json['reject_appeal'] == null + ? null + : RejectAppealRequestPayload.fromJson( + json['reject_appeal'] as Map, + ), + restore: json['restore'] == null + ? null + : RestoreActionRequestPayload.fromJson( + json['restore'] as Map, + ), + unban: json['unban'] == null + ? null + : UnbanActionRequestPayload.fromJson( + json['unban'] as Map, + ), + unblock: json['unblock'] == null + ? null + : UnblockActionRequestPayload.fromJson( + json['unblock'] as Map, + ), +); + +Map _$BulkActionAppealsRequestToJson( + BulkActionAppealsRequest instance, +) => { + 'action_type': instance.actionType.toJson(), + 'appeal_ids': instance.appealIds, + 'mark_reviewed': instance.markReviewed?.toJson(), + 'reject_appeal': instance.rejectAppeal?.toJson(), + 'restore': instance.restore?.toJson(), + 'unban': instance.unban?.toJson(), + 'unblock': instance.unblock?.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/bulk_action_appeals_response.dart b/packages/stream_chat/lib/open_api/model/bulk_action_appeals_response.dart new file mode 100644 index 0000000000..4714b0188d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/bulk_action_appeals_response.dart @@ -0,0 +1,41 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'bulk_action_appeals_response.g.dart'; +part 'bulk_action_appeals_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class BulkActionAppealsResponse with _$BulkActionAppealsResponse { + const BulkActionAppealsResponse({ + required this.duration, + required this.errors, + required this.results, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'errors') + final List errors; + + @override + @JsonKey(name: 'results') + final List results; + + Map toJson() => _$BulkActionAppealsResponseToJson(this); + + static BulkActionAppealsResponse fromJson(Map json) => _$BulkActionAppealsResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/bulk_action_appeals_response.freezed.dart b/packages/stream_chat/lib/open_api/model/bulk_action_appeals_response.freezed.dart new file mode 100644 index 0000000000..97d2537b62 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/bulk_action_appeals_response.freezed.dart @@ -0,0 +1,101 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'bulk_action_appeals_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$BulkActionAppealsResponse { + String get duration; + List get errors; + List get results; + + /// Create a copy of BulkActionAppealsResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $BulkActionAppealsResponseCopyWith get copyWith => + _$BulkActionAppealsResponseCopyWithImpl( + this as BulkActionAppealsResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is BulkActionAppealsResponse && + (identical(other.duration, duration) || other.duration == duration) && + const DeepCollectionEquality().equals(other.errors, errors) && + const DeepCollectionEquality().equals(other.results, results)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + duration, + const DeepCollectionEquality().hash(errors), + const DeepCollectionEquality().hash(results), + ); + + @override + String toString() { + return 'BulkActionAppealsResponse(duration: $duration, errors: $errors, results: $results)'; + } +} + +/// @nodoc +abstract mixin class $BulkActionAppealsResponseCopyWith<$Res> { + factory $BulkActionAppealsResponseCopyWith( + BulkActionAppealsResponse value, + $Res Function(BulkActionAppealsResponse) _then, + ) = _$BulkActionAppealsResponseCopyWithImpl; + @useResult + $Res call({ + String duration, + List errors, + List results, + }); +} + +/// @nodoc +class _$BulkActionAppealsResponseCopyWithImpl<$Res> implements $BulkActionAppealsResponseCopyWith<$Res> { + _$BulkActionAppealsResponseCopyWithImpl(this._self, this._then); + + final BulkActionAppealsResponse _self; + final $Res Function(BulkActionAppealsResponse) _then; + + /// Create a copy of BulkActionAppealsResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? duration = null, + Object? errors = null, + Object? results = null, + }) { + return _then( + BulkActionAppealsResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + errors: null == errors + ? _self.errors + : errors // ignore: cast_nullable_to_non_nullable + as List, + results: null == results + ? _self.results + : results // ignore: cast_nullable_to_non_nullable + as List, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/bulk_action_appeals_response.g.dart b/packages/stream_chat/lib/open_api/model/bulk_action_appeals_response.g.dart new file mode 100644 index 0000000000..af66d4b444 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/bulk_action_appeals_response.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'bulk_action_appeals_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +BulkActionAppealsResponse _$BulkActionAppealsResponseFromJson( + Map json, +) => BulkActionAppealsResponse( + duration: json['duration'] as String, + errors: (json['errors'] as List).map((e) => BulkAppealError.fromJson(e as Map)).toList(), + results: (json['results'] as List).map((e) => BulkAppealResult.fromJson(e as Map)).toList(), +); + +Map _$BulkActionAppealsResponseToJson( + BulkActionAppealsResponse instance, +) => { + 'duration': instance.duration, + 'errors': instance.errors.map((e) => e.toJson()).toList(), + 'results': instance.results.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/bulk_appeal_error.dart b/packages/stream_chat/lib/open_api/model/bulk_appeal_error.dart new file mode 100644 index 0000000000..6f71645383 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/bulk_appeal_error.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'bulk_appeal_error.g.dart'; +part 'bulk_appeal_error.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class BulkAppealError with _$BulkAppealError { + const BulkAppealError({ + required this.appealId, + required this.error, + }); + + @override + @JsonKey(name: 'appeal_id') + final String appealId; + + @override + @JsonKey(name: 'error') + final String error; + + Map toJson() => _$BulkAppealErrorToJson(this); + + static BulkAppealError fromJson(Map json) => _$BulkAppealErrorFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/bulk_appeal_error.freezed.dart b/packages/stream_chat/lib/open_api/model/bulk_appeal_error.freezed.dart new file mode 100644 index 0000000000..299a4cd433 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/bulk_appeal_error.freezed.dart @@ -0,0 +1,81 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'bulk_appeal_error.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$BulkAppealError { + String get appealId; + String get error; + + /// Create a copy of BulkAppealError + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $BulkAppealErrorCopyWith get copyWith => _$BulkAppealErrorCopyWithImpl( + this as BulkAppealError, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is BulkAppealError && + (identical(other.appealId, appealId) || other.appealId == appealId) && + (identical(other.error, error) || other.error == error)); + } + + @override + int get hashCode => Object.hash(runtimeType, appealId, error); + + @override + String toString() { + return 'BulkAppealError(appealId: $appealId, error: $error)'; + } +} + +/// @nodoc +abstract mixin class $BulkAppealErrorCopyWith<$Res> { + factory $BulkAppealErrorCopyWith( + BulkAppealError value, + $Res Function(BulkAppealError) _then, + ) = _$BulkAppealErrorCopyWithImpl; + @useResult + $Res call({String appealId, String error}); +} + +/// @nodoc +class _$BulkAppealErrorCopyWithImpl<$Res> implements $BulkAppealErrorCopyWith<$Res> { + _$BulkAppealErrorCopyWithImpl(this._self, this._then); + + final BulkAppealError _self; + final $Res Function(BulkAppealError) _then; + + /// Create a copy of BulkAppealError + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? appealId = null, Object? error = null}) { + return _then( + BulkAppealError( + appealId: null == appealId + ? _self.appealId + : appealId // ignore: cast_nullable_to_non_nullable + as String, + error: null == error + ? _self.error + : error // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/bulk_appeal_error.g.dart b/packages/stream_chat/lib/open_api/model/bulk_appeal_error.g.dart new file mode 100644 index 0000000000..378e0164bf --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/bulk_appeal_error.g.dart @@ -0,0 +1,17 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'bulk_appeal_error.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +BulkAppealError _$BulkAppealErrorFromJson(Map json) => BulkAppealError( + appealId: json['appeal_id'] as String, + error: json['error'] as String, +); + +Map _$BulkAppealErrorToJson(BulkAppealError instance) => { + 'appeal_id': instance.appealId, + 'error': instance.error, +}; diff --git a/packages/stream_chat/lib/open_api/model/bulk_appeal_result.dart b/packages/stream_chat/lib/open_api/model/bulk_appeal_result.dart new file mode 100644 index 0000000000..44242ed5da --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/bulk_appeal_result.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'bulk_appeal_result.g.dart'; +part 'bulk_appeal_result.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class BulkAppealResult with _$BulkAppealResult { + const BulkAppealResult({ + required this.appealId, + this.appealItem, + }); + + @override + @JsonKey(name: 'appeal_id') + final String appealId; + + @override + @JsonKey(name: 'appeal_item') + final AppealItemResponse? appealItem; + + Map toJson() => _$BulkAppealResultToJson(this); + + static BulkAppealResult fromJson(Map json) => _$BulkAppealResultFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/bulk_appeal_result.freezed.dart b/packages/stream_chat/lib/open_api/model/bulk_appeal_result.freezed.dart new file mode 100644 index 0000000000..b138919b2e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/bulk_appeal_result.freezed.dart @@ -0,0 +1,81 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'bulk_appeal_result.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$BulkAppealResult { + String get appealId; + AppealItemResponse? get appealItem; + + /// Create a copy of BulkAppealResult + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $BulkAppealResultCopyWith get copyWith => _$BulkAppealResultCopyWithImpl( + this as BulkAppealResult, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is BulkAppealResult && + (identical(other.appealId, appealId) || other.appealId == appealId) && + (identical(other.appealItem, appealItem) || other.appealItem == appealItem)); + } + + @override + int get hashCode => Object.hash(runtimeType, appealId, appealItem); + + @override + String toString() { + return 'BulkAppealResult(appealId: $appealId, appealItem: $appealItem)'; + } +} + +/// @nodoc +abstract mixin class $BulkAppealResultCopyWith<$Res> { + factory $BulkAppealResultCopyWith( + BulkAppealResult value, + $Res Function(BulkAppealResult) _then, + ) = _$BulkAppealResultCopyWithImpl; + @useResult + $Res call({String appealId, AppealItemResponse? appealItem}); +} + +/// @nodoc +class _$BulkAppealResultCopyWithImpl<$Res> implements $BulkAppealResultCopyWith<$Res> { + _$BulkAppealResultCopyWithImpl(this._self, this._then); + + final BulkAppealResult _self; + final $Res Function(BulkAppealResult) _then; + + /// Create a copy of BulkAppealResult + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? appealId = null, Object? appealItem = freezed}) { + return _then( + BulkAppealResult( + appealId: null == appealId + ? _self.appealId + : appealId // ignore: cast_nullable_to_non_nullable + as String, + appealItem: freezed == appealItem + ? _self.appealItem + : appealItem // ignore: cast_nullable_to_non_nullable + as AppealItemResponse?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/bulk_appeal_result.g.dart b/packages/stream_chat/lib/open_api/model/bulk_appeal_result.g.dart new file mode 100644 index 0000000000..053f5b83ef --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/bulk_appeal_result.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'bulk_appeal_result.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +BulkAppealResult _$BulkAppealResultFromJson(Map json) => BulkAppealResult( + appealId: json['appeal_id'] as String, + appealItem: json['appeal_item'] == null + ? null + : AppealItemResponse.fromJson( + json['appeal_item'] as Map, + ), +); + +Map _$BulkAppealResultToJson(BulkAppealResult instance) => { + 'appeal_id': instance.appealId, + 'appeal_item': instance.appealItem?.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/bulk_delete_action_config_request.dart b/packages/stream_chat/lib/open_api/model/bulk_delete_action_config_request.dart new file mode 100644 index 0000000000..03c956cef4 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/bulk_delete_action_config_request.dart @@ -0,0 +1,32 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'bulk_delete_action_config_request.g.dart'; +part 'bulk_delete_action_config_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class BulkDeleteActionConfigRequest with _$BulkDeleteActionConfigRequest { + const BulkDeleteActionConfigRequest({ + required this.ids, + }); + + @override + @JsonKey(name: 'ids') + final List ids; + + Map toJson() => _$BulkDeleteActionConfigRequestToJson(this); + + static BulkDeleteActionConfigRequest fromJson(Map json) => + _$BulkDeleteActionConfigRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/bulk_delete_action_config_request.freezed.dart b/packages/stream_chat/lib/open_api/model/bulk_delete_action_config_request.freezed.dart new file mode 100644 index 0000000000..9e5384c3dc --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/bulk_delete_action_config_request.freezed.dart @@ -0,0 +1,76 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'bulk_delete_action_config_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$BulkDeleteActionConfigRequest { + List get ids; + + /// Create a copy of BulkDeleteActionConfigRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $BulkDeleteActionConfigRequestCopyWith get copyWith => + _$BulkDeleteActionConfigRequestCopyWithImpl( + this as BulkDeleteActionConfigRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is BulkDeleteActionConfigRequest && + const DeepCollectionEquality().equals(other.ids, ids)); + } + + @override + int get hashCode => Object.hash(runtimeType, const DeepCollectionEquality().hash(ids)); + + @override + String toString() { + return 'BulkDeleteActionConfigRequest(ids: $ids)'; + } +} + +/// @nodoc +abstract mixin class $BulkDeleteActionConfigRequestCopyWith<$Res> { + factory $BulkDeleteActionConfigRequestCopyWith( + BulkDeleteActionConfigRequest value, + $Res Function(BulkDeleteActionConfigRequest) _then, + ) = _$BulkDeleteActionConfigRequestCopyWithImpl; + @useResult + $Res call({List ids}); +} + +/// @nodoc +class _$BulkDeleteActionConfigRequestCopyWithImpl<$Res> implements $BulkDeleteActionConfigRequestCopyWith<$Res> { + _$BulkDeleteActionConfigRequestCopyWithImpl(this._self, this._then); + + final BulkDeleteActionConfigRequest _self; + final $Res Function(BulkDeleteActionConfigRequest) _then; + + /// Create a copy of BulkDeleteActionConfigRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? ids = null}) { + return _then( + BulkDeleteActionConfigRequest( + ids: null == ids + ? _self.ids + : ids // ignore: cast_nullable_to_non_nullable + as List, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/bulk_delete_action_config_request.g.dart b/packages/stream_chat/lib/open_api/model/bulk_delete_action_config_request.g.dart new file mode 100644 index 0000000000..5c7156b9ad --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/bulk_delete_action_config_request.g.dart @@ -0,0 +1,17 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'bulk_delete_action_config_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +BulkDeleteActionConfigRequest _$BulkDeleteActionConfigRequestFromJson( + Map json, +) => BulkDeleteActionConfigRequest( + ids: (json['ids'] as List).map((e) => e as String).toList(), +); + +Map _$BulkDeleteActionConfigRequestToJson( + BulkDeleteActionConfigRequest instance, +) => {'ids': instance.ids}; diff --git a/packages/stream_chat/lib/open_api/model/bulk_delete_action_config_response.dart b/packages/stream_chat/lib/open_api/model/bulk_delete_action_config_response.dart new file mode 100644 index 0000000000..1314c92387 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/bulk_delete_action_config_response.dart @@ -0,0 +1,37 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'bulk_delete_action_config_response.g.dart'; +part 'bulk_delete_action_config_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class BulkDeleteActionConfigResponse with _$BulkDeleteActionConfigResponse { + const BulkDeleteActionConfigResponse({ + required this.deleted, + required this.duration, + }); + + @override + @JsonKey(name: 'deleted') + final int deleted; + + @override + @JsonKey(name: 'duration') + final String duration; + + Map toJson() => _$BulkDeleteActionConfigResponseToJson(this); + + static BulkDeleteActionConfigResponse fromJson(Map json) => + _$BulkDeleteActionConfigResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/bulk_delete_action_config_response.freezed.dart b/packages/stream_chat/lib/open_api/model/bulk_delete_action_config_response.freezed.dart new file mode 100644 index 0000000000..3488ab6b99 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/bulk_delete_action_config_response.freezed.dart @@ -0,0 +1,82 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'bulk_delete_action_config_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$BulkDeleteActionConfigResponse { + int get deleted; + String get duration; + + /// Create a copy of BulkDeleteActionConfigResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $BulkDeleteActionConfigResponseCopyWith get copyWith => + _$BulkDeleteActionConfigResponseCopyWithImpl( + this as BulkDeleteActionConfigResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is BulkDeleteActionConfigResponse && + (identical(other.deleted, deleted) || other.deleted == deleted) && + (identical(other.duration, duration) || other.duration == duration)); + } + + @override + int get hashCode => Object.hash(runtimeType, deleted, duration); + + @override + String toString() { + return 'BulkDeleteActionConfigResponse(deleted: $deleted, duration: $duration)'; + } +} + +/// @nodoc +abstract mixin class $BulkDeleteActionConfigResponseCopyWith<$Res> { + factory $BulkDeleteActionConfigResponseCopyWith( + BulkDeleteActionConfigResponse value, + $Res Function(BulkDeleteActionConfigResponse) _then, + ) = _$BulkDeleteActionConfigResponseCopyWithImpl; + @useResult + $Res call({int deleted, String duration}); +} + +/// @nodoc +class _$BulkDeleteActionConfigResponseCopyWithImpl<$Res> implements $BulkDeleteActionConfigResponseCopyWith<$Res> { + _$BulkDeleteActionConfigResponseCopyWithImpl(this._self, this._then); + + final BulkDeleteActionConfigResponse _self; + final $Res Function(BulkDeleteActionConfigResponse) _then; + + /// Create a copy of BulkDeleteActionConfigResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? deleted = null, Object? duration = null}) { + return _then( + BulkDeleteActionConfigResponse( + deleted: null == deleted + ? _self.deleted + : deleted // ignore: cast_nullable_to_non_nullable + as int, + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/bulk_delete_action_config_response.g.dart b/packages/stream_chat/lib/open_api/model/bulk_delete_action_config_response.g.dart new file mode 100644 index 0000000000..0500779c2e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/bulk_delete_action_config_response.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'bulk_delete_action_config_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +BulkDeleteActionConfigResponse _$BulkDeleteActionConfigResponseFromJson( + Map json, +) => BulkDeleteActionConfigResponse( + deleted: (json['deleted'] as num).toInt(), + duration: json['duration'] as String, +); + +Map _$BulkDeleteActionConfigResponseToJson( + BulkDeleteActionConfigResponse instance, +) => { + 'deleted': instance.deleted, + 'duration': instance.duration, +}; diff --git a/packages/stream_chat/lib/open_api/model/bulk_upsert_action_config_request.dart b/packages/stream_chat/lib/open_api/model/bulk_upsert_action_config_request.dart new file mode 100644 index 0000000000..7d8c56c064 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/bulk_upsert_action_config_request.dart @@ -0,0 +1,32 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'bulk_upsert_action_config_request.g.dart'; +part 'bulk_upsert_action_config_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class BulkUpsertActionConfigRequest with _$BulkUpsertActionConfigRequest { + const BulkUpsertActionConfigRequest({ + required this.actionConfigs, + }); + + @override + @JsonKey(name: 'action_configs') + final List actionConfigs; + + Map toJson() => _$BulkUpsertActionConfigRequestToJson(this); + + static BulkUpsertActionConfigRequest fromJson(Map json) => + _$BulkUpsertActionConfigRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/bulk_upsert_action_config_request.freezed.dart b/packages/stream_chat/lib/open_api/model/bulk_upsert_action_config_request.freezed.dart new file mode 100644 index 0000000000..0ea9081519 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/bulk_upsert_action_config_request.freezed.dart @@ -0,0 +1,82 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'bulk_upsert_action_config_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$BulkUpsertActionConfigRequest { + List get actionConfigs; + + /// Create a copy of BulkUpsertActionConfigRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $BulkUpsertActionConfigRequestCopyWith get copyWith => + _$BulkUpsertActionConfigRequestCopyWithImpl( + this as BulkUpsertActionConfigRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is BulkUpsertActionConfigRequest && + const DeepCollectionEquality().equals( + other.actionConfigs, + actionConfigs, + )); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(actionConfigs), + ); + + @override + String toString() { + return 'BulkUpsertActionConfigRequest(actionConfigs: $actionConfigs)'; + } +} + +/// @nodoc +abstract mixin class $BulkUpsertActionConfigRequestCopyWith<$Res> { + factory $BulkUpsertActionConfigRequestCopyWith( + BulkUpsertActionConfigRequest value, + $Res Function(BulkUpsertActionConfigRequest) _then, + ) = _$BulkUpsertActionConfigRequestCopyWithImpl; + @useResult + $Res call({List actionConfigs}); +} + +/// @nodoc +class _$BulkUpsertActionConfigRequestCopyWithImpl<$Res> implements $BulkUpsertActionConfigRequestCopyWith<$Res> { + _$BulkUpsertActionConfigRequestCopyWithImpl(this._self, this._then); + + final BulkUpsertActionConfigRequest _self; + final $Res Function(BulkUpsertActionConfigRequest) _then; + + /// Create a copy of BulkUpsertActionConfigRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? actionConfigs = null}) { + return _then( + BulkUpsertActionConfigRequest( + actionConfigs: null == actionConfigs + ? _self.actionConfigs + : actionConfigs // ignore: cast_nullable_to_non_nullable + as List, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/bulk_upsert_action_config_request.g.dart b/packages/stream_chat/lib/open_api/model/bulk_upsert_action_config_request.g.dart new file mode 100644 index 0000000000..d378c06467 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/bulk_upsert_action_config_request.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'bulk_upsert_action_config_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +BulkUpsertActionConfigRequest _$BulkUpsertActionConfigRequestFromJson( + Map json, +) => BulkUpsertActionConfigRequest( + actionConfigs: (json['action_configs'] as List) + .map((e) => UpsertActionConfigItem.fromJson(e as Map)) + .toList(), +); + +Map _$BulkUpsertActionConfigRequestToJson( + BulkUpsertActionConfigRequest instance, +) => { + 'action_configs': instance.actionConfigs.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/bulk_upsert_action_config_response.dart b/packages/stream_chat/lib/open_api/model/bulk_upsert_action_config_response.dart new file mode 100644 index 0000000000..898d7b366a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/bulk_upsert_action_config_response.dart @@ -0,0 +1,37 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'bulk_upsert_action_config_response.g.dart'; +part 'bulk_upsert_action_config_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class BulkUpsertActionConfigResponse with _$BulkUpsertActionConfigResponse { + const BulkUpsertActionConfigResponse({ + required this.actionConfigs, + required this.duration, + }); + + @override + @JsonKey(name: 'action_configs') + final List actionConfigs; + + @override + @JsonKey(name: 'duration') + final String duration; + + Map toJson() => _$BulkUpsertActionConfigResponseToJson(this); + + static BulkUpsertActionConfigResponse fromJson(Map json) => + _$BulkUpsertActionConfigResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/bulk_upsert_action_config_response.freezed.dart b/packages/stream_chat/lib/open_api/model/bulk_upsert_action_config_response.freezed.dart new file mode 100644 index 0000000000..181b2c1606 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/bulk_upsert_action_config_response.freezed.dart @@ -0,0 +1,92 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'bulk_upsert_action_config_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$BulkUpsertActionConfigResponse { + List get actionConfigs; + String get duration; + + /// Create a copy of BulkUpsertActionConfigResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $BulkUpsertActionConfigResponseCopyWith get copyWith => + _$BulkUpsertActionConfigResponseCopyWithImpl( + this as BulkUpsertActionConfigResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is BulkUpsertActionConfigResponse && + const DeepCollectionEquality().equals( + other.actionConfigs, + actionConfigs, + ) && + (identical(other.duration, duration) || other.duration == duration)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(actionConfigs), + duration, + ); + + @override + String toString() { + return 'BulkUpsertActionConfigResponse(actionConfigs: $actionConfigs, duration: $duration)'; + } +} + +/// @nodoc +abstract mixin class $BulkUpsertActionConfigResponseCopyWith<$Res> { + factory $BulkUpsertActionConfigResponseCopyWith( + BulkUpsertActionConfigResponse value, + $Res Function(BulkUpsertActionConfigResponse) _then, + ) = _$BulkUpsertActionConfigResponseCopyWithImpl; + @useResult + $Res call({ + List actionConfigs, + String duration, + }); +} + +/// @nodoc +class _$BulkUpsertActionConfigResponseCopyWithImpl<$Res> implements $BulkUpsertActionConfigResponseCopyWith<$Res> { + _$BulkUpsertActionConfigResponseCopyWithImpl(this._self, this._then); + + final BulkUpsertActionConfigResponse _self; + final $Res Function(BulkUpsertActionConfigResponse) _then; + + /// Create a copy of BulkUpsertActionConfigResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? actionConfigs = null, Object? duration = null}) { + return _then( + BulkUpsertActionConfigResponse( + actionConfigs: null == actionConfigs + ? _self.actionConfigs + : actionConfigs // ignore: cast_nullable_to_non_nullable + as List, + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/bulk_upsert_action_config_response.g.dart b/packages/stream_chat/lib/open_api/model/bulk_upsert_action_config_response.g.dart new file mode 100644 index 0000000000..33d5b788f3 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/bulk_upsert_action_config_response.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'bulk_upsert_action_config_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +BulkUpsertActionConfigResponse _$BulkUpsertActionConfigResponseFromJson( + Map json, +) => BulkUpsertActionConfigResponse( + actionConfigs: (json['action_configs'] as List) + .map( + (e) => ModerationActionConfigResponse.fromJson(e as Map), + ) + .toList(), + duration: json['duration'] as String, +); + +Map _$BulkUpsertActionConfigResponseToJson( + BulkUpsertActionConfigResponse instance, +) => { + 'action_configs': instance.actionConfigs.map((e) => e.toJson()).toList(), + 'duration': instance.duration, +}; diff --git a/packages/stream_chat/lib/open_api/model/bypass_action_request.dart b/packages/stream_chat/lib/open_api/model/bypass_action_request.dart new file mode 100644 index 0000000000..e665f413a2 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/bypass_action_request.dart @@ -0,0 +1,31 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'bypass_action_request.g.dart'; +part 'bypass_action_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class BypassActionRequest with _$BypassActionRequest { + const BypassActionRequest({ + this.enabled, + }); + + @override + @JsonKey(name: 'enabled') + final bool? enabled; + + Map toJson() => _$BypassActionRequestToJson(this); + + static BypassActionRequest fromJson(Map json) => _$BypassActionRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/bypass_action_request.freezed.dart b/packages/stream_chat/lib/open_api/model/bypass_action_request.freezed.dart new file mode 100644 index 0000000000..ba09e42ed2 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/bypass_action_request.freezed.dart @@ -0,0 +1,76 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'bypass_action_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$BypassActionRequest { + bool? get enabled; + + /// Create a copy of BypassActionRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $BypassActionRequestCopyWith get copyWith => + _$BypassActionRequestCopyWithImpl( + this as BypassActionRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is BypassActionRequest && + (identical(other.enabled, enabled) || other.enabled == enabled)); + } + + @override + int get hashCode => Object.hash(runtimeType, enabled); + + @override + String toString() { + return 'BypassActionRequest(enabled: $enabled)'; + } +} + +/// @nodoc +abstract mixin class $BypassActionRequestCopyWith<$Res> { + factory $BypassActionRequestCopyWith( + BypassActionRequest value, + $Res Function(BypassActionRequest) _then, + ) = _$BypassActionRequestCopyWithImpl; + @useResult + $Res call({bool? enabled}); +} + +/// @nodoc +class _$BypassActionRequestCopyWithImpl<$Res> implements $BypassActionRequestCopyWith<$Res> { + _$BypassActionRequestCopyWithImpl(this._self, this._then); + + final BypassActionRequest _self; + final $Res Function(BypassActionRequest) _then; + + /// Create a copy of BypassActionRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? enabled = freezed}) { + return _then( + BypassActionRequest( + enabled: freezed == enabled + ? _self.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/bypass_action_request.g.dart b/packages/stream_chat/lib/open_api/model/bypass_action_request.g.dart new file mode 100644 index 0000000000..06130e1802 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/bypass_action_request.g.dart @@ -0,0 +1,14 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'bypass_action_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +BypassActionRequest _$BypassActionRequestFromJson(Map json) => + BypassActionRequest(enabled: json['enabled'] as bool?); + +Map _$BypassActionRequestToJson( + BypassActionRequest instance, +) => {'enabled': instance.enabled}; diff --git a/packages/stream_chat/lib/open_api/model/call_action_options.dart b/packages/stream_chat/lib/open_api/model/call_action_options.dart new file mode 100644 index 0000000000..acb1dbe55a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/call_action_options.dart @@ -0,0 +1,61 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'call_action_options.g.dart'; +part 'call_action_options.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class CallActionOptions with _$CallActionOptions { + const CallActionOptions({ + this.duration, + this.flagReason, + this.kickReason, + this.muteAudio, + this.muteVideo, + this.reason, + this.warningText, + }); + + @override + @JsonKey(name: 'duration') + final int? duration; + + @override + @JsonKey(name: 'flag_reason') + final String? flagReason; + + @override + @JsonKey(name: 'kick_reason') + final String? kickReason; + + @override + @JsonKey(name: 'mute_audio') + final bool? muteAudio; + + @override + @JsonKey(name: 'mute_video') + final bool? muteVideo; + + @override + @JsonKey(name: 'reason') + final String? reason; + + @override + @JsonKey(name: 'warning_text') + final String? warningText; + + Map toJson() => _$CallActionOptionsToJson(this); + + static CallActionOptions fromJson(Map json) => _$CallActionOptionsFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/call_action_options.freezed.dart b/packages/stream_chat/lib/open_api/model/call_action_options.freezed.dart new file mode 100644 index 0000000000..85d9cd41ca --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/call_action_options.freezed.dart @@ -0,0 +1,136 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'call_action_options.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$CallActionOptions { + int? get duration; + String? get flagReason; + String? get kickReason; + bool? get muteAudio; + bool? get muteVideo; + String? get reason; + String? get warningText; + + /// Create a copy of CallActionOptions + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $CallActionOptionsCopyWith get copyWith => _$CallActionOptionsCopyWithImpl( + this as CallActionOptions, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is CallActionOptions && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.flagReason, flagReason) || other.flagReason == flagReason) && + (identical(other.kickReason, kickReason) || other.kickReason == kickReason) && + (identical(other.muteAudio, muteAudio) || other.muteAudio == muteAudio) && + (identical(other.muteVideo, muteVideo) || other.muteVideo == muteVideo) && + (identical(other.reason, reason) || other.reason == reason) && + (identical(other.warningText, warningText) || other.warningText == warningText)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + duration, + flagReason, + kickReason, + muteAudio, + muteVideo, + reason, + warningText, + ); + + @override + String toString() { + return 'CallActionOptions(duration: $duration, flagReason: $flagReason, kickReason: $kickReason, muteAudio: $muteAudio, muteVideo: $muteVideo, reason: $reason, warningText: $warningText)'; + } +} + +/// @nodoc +abstract mixin class $CallActionOptionsCopyWith<$Res> { + factory $CallActionOptionsCopyWith( + CallActionOptions value, + $Res Function(CallActionOptions) _then, + ) = _$CallActionOptionsCopyWithImpl; + @useResult + $Res call({ + int? duration, + String? flagReason, + String? kickReason, + bool? muteAudio, + bool? muteVideo, + String? reason, + String? warningText, + }); +} + +/// @nodoc +class _$CallActionOptionsCopyWithImpl<$Res> implements $CallActionOptionsCopyWith<$Res> { + _$CallActionOptionsCopyWithImpl(this._self, this._then); + + final CallActionOptions _self; + final $Res Function(CallActionOptions) _then; + + /// Create a copy of CallActionOptions + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? duration = freezed, + Object? flagReason = freezed, + Object? kickReason = freezed, + Object? muteAudio = freezed, + Object? muteVideo = freezed, + Object? reason = freezed, + Object? warningText = freezed, + }) { + return _then( + CallActionOptions( + duration: freezed == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as int?, + flagReason: freezed == flagReason + ? _self.flagReason + : flagReason // ignore: cast_nullable_to_non_nullable + as String?, + kickReason: freezed == kickReason + ? _self.kickReason + : kickReason // ignore: cast_nullable_to_non_nullable + as String?, + muteAudio: freezed == muteAudio + ? _self.muteAudio + : muteAudio // ignore: cast_nullable_to_non_nullable + as bool?, + muteVideo: freezed == muteVideo + ? _self.muteVideo + : muteVideo // ignore: cast_nullable_to_non_nullable + as bool?, + reason: freezed == reason + ? _self.reason + : reason // ignore: cast_nullable_to_non_nullable + as String?, + warningText: freezed == warningText + ? _self.warningText + : warningText // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/call_action_options.g.dart b/packages/stream_chat/lib/open_api/model/call_action_options.g.dart new file mode 100644 index 0000000000..375f3ab7eb --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/call_action_options.g.dart @@ -0,0 +1,27 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'call_action_options.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +CallActionOptions _$CallActionOptionsFromJson(Map json) => CallActionOptions( + duration: (json['duration'] as num?)?.toInt(), + flagReason: json['flag_reason'] as String?, + kickReason: json['kick_reason'] as String?, + muteAudio: json['mute_audio'] as bool?, + muteVideo: json['mute_video'] as bool?, + reason: json['reason'] as String?, + warningText: json['warning_text'] as String?, +); + +Map _$CallActionOptionsToJson(CallActionOptions instance) => { + 'duration': instance.duration, + 'flag_reason': instance.flagReason, + 'kick_reason': instance.kickReason, + 'mute_audio': instance.muteAudio, + 'mute_video': instance.muteVideo, + 'reason': instance.reason, + 'warning_text': instance.warningText, +}; diff --git a/packages/stream_chat/lib/open_api/model/call_custom_property_parameters.dart b/packages/stream_chat/lib/open_api/model/call_custom_property_parameters.dart new file mode 100644 index 0000000000..af5743c776 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/call_custom_property_parameters.dart @@ -0,0 +1,37 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'call_custom_property_parameters.g.dart'; +part 'call_custom_property_parameters.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class CallCustomPropertyParameters with _$CallCustomPropertyParameters { + const CallCustomPropertyParameters({ + this.operator, + this.propertyKey, + }); + + @override + @JsonKey(name: 'operator') + final String? operator; + + @override + @JsonKey(name: 'property_key') + final String? propertyKey; + + Map toJson() => _$CallCustomPropertyParametersToJson(this); + + static CallCustomPropertyParameters fromJson(Map json) => + _$CallCustomPropertyParametersFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/call_custom_property_parameters.freezed.dart b/packages/stream_chat/lib/open_api/model/call_custom_property_parameters.freezed.dart new file mode 100644 index 0000000000..2a23843ad5 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/call_custom_property_parameters.freezed.dart @@ -0,0 +1,82 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'call_custom_property_parameters.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$CallCustomPropertyParameters { + String? get operator; + String? get propertyKey; + + /// Create a copy of CallCustomPropertyParameters + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $CallCustomPropertyParametersCopyWith get copyWith => + _$CallCustomPropertyParametersCopyWithImpl( + this as CallCustomPropertyParameters, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is CallCustomPropertyParameters && + (identical(other.operator, operator) || other.operator == operator) && + (identical(other.propertyKey, propertyKey) || other.propertyKey == propertyKey)); + } + + @override + int get hashCode => Object.hash(runtimeType, operator, propertyKey); + + @override + String toString() { + return 'CallCustomPropertyParameters(operator: $operator, propertyKey: $propertyKey)'; + } +} + +/// @nodoc +abstract mixin class $CallCustomPropertyParametersCopyWith<$Res> { + factory $CallCustomPropertyParametersCopyWith( + CallCustomPropertyParameters value, + $Res Function(CallCustomPropertyParameters) _then, + ) = _$CallCustomPropertyParametersCopyWithImpl; + @useResult + $Res call({String? operator, String? propertyKey}); +} + +/// @nodoc +class _$CallCustomPropertyParametersCopyWithImpl<$Res> implements $CallCustomPropertyParametersCopyWith<$Res> { + _$CallCustomPropertyParametersCopyWithImpl(this._self, this._then); + + final CallCustomPropertyParameters _self; + final $Res Function(CallCustomPropertyParameters) _then; + + /// Create a copy of CallCustomPropertyParameters + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? operator = freezed, Object? propertyKey = freezed}) { + return _then( + CallCustomPropertyParameters( + operator: freezed == operator + ? _self.operator + : operator // ignore: cast_nullable_to_non_nullable + as String?, + propertyKey: freezed == propertyKey + ? _self.propertyKey + : propertyKey // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/call_custom_property_parameters.g.dart b/packages/stream_chat/lib/open_api/model/call_custom_property_parameters.g.dart new file mode 100644 index 0000000000..00fb7befce --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/call_custom_property_parameters.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'call_custom_property_parameters.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +CallCustomPropertyParameters _$CallCustomPropertyParametersFromJson( + Map json, +) => CallCustomPropertyParameters( + operator: json['operator'] as String?, + propertyKey: json['property_key'] as String?, +); + +Map _$CallCustomPropertyParametersToJson( + CallCustomPropertyParameters instance, +) => { + 'operator': instance.operator, + 'property_key': instance.propertyKey, +}; diff --git a/packages/stream_chat/lib/open_api/model/call_rule_action_sequence.dart b/packages/stream_chat/lib/open_api/model/call_rule_action_sequence.dart new file mode 100644 index 0000000000..e1422acbe4 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/call_rule_action_sequence.dart @@ -0,0 +1,41 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'call_rule_action_sequence.g.dart'; +part 'call_rule_action_sequence.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class CallRuleActionSequence with _$CallRuleActionSequence { + const CallRuleActionSequence({ + this.actions, + this.callOptions, + this.violationNumber, + }); + + @override + @JsonKey(name: 'actions') + final List? actions; + + @override + @JsonKey(name: 'call_options') + final CallActionOptions? callOptions; + + @override + @JsonKey(name: 'violation_number') + final int? violationNumber; + + Map toJson() => _$CallRuleActionSequenceToJson(this); + + static CallRuleActionSequence fromJson(Map json) => _$CallRuleActionSequenceFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/call_rule_action_sequence.freezed.dart b/packages/stream_chat/lib/open_api/model/call_rule_action_sequence.freezed.dart new file mode 100644 index 0000000000..ef8c4c92c5 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/call_rule_action_sequence.freezed.dart @@ -0,0 +1,101 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'call_rule_action_sequence.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$CallRuleActionSequence { + List? get actions; + CallActionOptions? get callOptions; + int? get violationNumber; + + /// Create a copy of CallRuleActionSequence + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $CallRuleActionSequenceCopyWith get copyWith => + _$CallRuleActionSequenceCopyWithImpl( + this as CallRuleActionSequence, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is CallRuleActionSequence && + const DeepCollectionEquality().equals(other.actions, actions) && + (identical(other.callOptions, callOptions) || other.callOptions == callOptions) && + (identical(other.violationNumber, violationNumber) || other.violationNumber == violationNumber)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(actions), + callOptions, + violationNumber, + ); + + @override + String toString() { + return 'CallRuleActionSequence(actions: $actions, callOptions: $callOptions, violationNumber: $violationNumber)'; + } +} + +/// @nodoc +abstract mixin class $CallRuleActionSequenceCopyWith<$Res> { + factory $CallRuleActionSequenceCopyWith( + CallRuleActionSequence value, + $Res Function(CallRuleActionSequence) _then, + ) = _$CallRuleActionSequenceCopyWithImpl; + @useResult + $Res call({ + List? actions, + CallActionOptions? callOptions, + int? violationNumber, + }); +} + +/// @nodoc +class _$CallRuleActionSequenceCopyWithImpl<$Res> implements $CallRuleActionSequenceCopyWith<$Res> { + _$CallRuleActionSequenceCopyWithImpl(this._self, this._then); + + final CallRuleActionSequence _self; + final $Res Function(CallRuleActionSequence) _then; + + /// Create a copy of CallRuleActionSequence + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? actions = freezed, + Object? callOptions = freezed, + Object? violationNumber = freezed, + }) { + return _then( + CallRuleActionSequence( + actions: freezed == actions + ? _self.actions + : actions // ignore: cast_nullable_to_non_nullable + as List?, + callOptions: freezed == callOptions + ? _self.callOptions + : callOptions // ignore: cast_nullable_to_non_nullable + as CallActionOptions?, + violationNumber: freezed == violationNumber + ? _self.violationNumber + : violationNumber // ignore: cast_nullable_to_non_nullable + as int?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/call_rule_action_sequence.g.dart b/packages/stream_chat/lib/open_api/model/call_rule_action_sequence.g.dart new file mode 100644 index 0000000000..964d11a971 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/call_rule_action_sequence.g.dart @@ -0,0 +1,27 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'call_rule_action_sequence.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +CallRuleActionSequence _$CallRuleActionSequenceFromJson( + Map json, +) => CallRuleActionSequence( + actions: (json['actions'] as List?)?.map((e) => e as String).toList(), + callOptions: json['call_options'] == null + ? null + : CallActionOptions.fromJson( + json['call_options'] as Map, + ), + violationNumber: (json['violation_number'] as num?)?.toInt(), +); + +Map _$CallRuleActionSequenceToJson( + CallRuleActionSequence instance, +) => { + 'actions': instance.actions, + 'call_options': instance.callOptions?.toJson(), + 'violation_number': instance.violationNumber, +}; diff --git a/packages/stream_chat/lib/open_api/model/call_type_rule_parameters.dart b/packages/stream_chat/lib/open_api/model/call_type_rule_parameters.dart new file mode 100644 index 0000000000..bb8b3da168 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/call_type_rule_parameters.dart @@ -0,0 +1,31 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'call_type_rule_parameters.g.dart'; +part 'call_type_rule_parameters.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class CallTypeRuleParameters with _$CallTypeRuleParameters { + const CallTypeRuleParameters({ + this.callType, + }); + + @override + @JsonKey(name: 'call_type') + final String? callType; + + Map toJson() => _$CallTypeRuleParametersToJson(this); + + static CallTypeRuleParameters fromJson(Map json) => _$CallTypeRuleParametersFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/call_type_rule_parameters.freezed.dart b/packages/stream_chat/lib/open_api/model/call_type_rule_parameters.freezed.dart new file mode 100644 index 0000000000..ca7425f081 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/call_type_rule_parameters.freezed.dart @@ -0,0 +1,76 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'call_type_rule_parameters.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$CallTypeRuleParameters { + String? get callType; + + /// Create a copy of CallTypeRuleParameters + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $CallTypeRuleParametersCopyWith get copyWith => + _$CallTypeRuleParametersCopyWithImpl( + this as CallTypeRuleParameters, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is CallTypeRuleParameters && + (identical(other.callType, callType) || other.callType == callType)); + } + + @override + int get hashCode => Object.hash(runtimeType, callType); + + @override + String toString() { + return 'CallTypeRuleParameters(callType: $callType)'; + } +} + +/// @nodoc +abstract mixin class $CallTypeRuleParametersCopyWith<$Res> { + factory $CallTypeRuleParametersCopyWith( + CallTypeRuleParameters value, + $Res Function(CallTypeRuleParameters) _then, + ) = _$CallTypeRuleParametersCopyWithImpl; + @useResult + $Res call({String? callType}); +} + +/// @nodoc +class _$CallTypeRuleParametersCopyWithImpl<$Res> implements $CallTypeRuleParametersCopyWith<$Res> { + _$CallTypeRuleParametersCopyWithImpl(this._self, this._then); + + final CallTypeRuleParameters _self; + final $Res Function(CallTypeRuleParameters) _then; + + /// Create a copy of CallTypeRuleParameters + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? callType = freezed}) { + return _then( + CallTypeRuleParameters( + callType: freezed == callType + ? _self.callType + : callType // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/call_type_rule_parameters.g.dart b/packages/stream_chat/lib/open_api/model/call_type_rule_parameters.g.dart new file mode 100644 index 0000000000..de7de306c2 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/call_type_rule_parameters.g.dart @@ -0,0 +1,15 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'call_type_rule_parameters.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +CallTypeRuleParameters _$CallTypeRuleParametersFromJson( + Map json, +) => CallTypeRuleParameters(callType: json['call_type'] as String?); + +Map _$CallTypeRuleParametersToJson( + CallTypeRuleParameters instance, +) => {'call_type': instance.callType}; diff --git a/packages/stream_chat/lib/open_api/model/call_violation_count_parameters.dart b/packages/stream_chat/lib/open_api/model/call_violation_count_parameters.dart new file mode 100644 index 0000000000..1569417069 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/call_violation_count_parameters.dart @@ -0,0 +1,37 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'call_violation_count_parameters.g.dart'; +part 'call_violation_count_parameters.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class CallViolationCountParameters with _$CallViolationCountParameters { + const CallViolationCountParameters({ + this.threshold, + this.timeWindow, + }); + + @override + @JsonKey(name: 'threshold') + final int? threshold; + + @override + @JsonKey(name: 'time_window') + final String? timeWindow; + + Map toJson() => _$CallViolationCountParametersToJson(this); + + static CallViolationCountParameters fromJson(Map json) => + _$CallViolationCountParametersFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/call_violation_count_parameters.freezed.dart b/packages/stream_chat/lib/open_api/model/call_violation_count_parameters.freezed.dart new file mode 100644 index 0000000000..5d9c09f327 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/call_violation_count_parameters.freezed.dart @@ -0,0 +1,82 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'call_violation_count_parameters.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$CallViolationCountParameters { + int? get threshold; + String? get timeWindow; + + /// Create a copy of CallViolationCountParameters + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $CallViolationCountParametersCopyWith get copyWith => + _$CallViolationCountParametersCopyWithImpl( + this as CallViolationCountParameters, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is CallViolationCountParameters && + (identical(other.threshold, threshold) || other.threshold == threshold) && + (identical(other.timeWindow, timeWindow) || other.timeWindow == timeWindow)); + } + + @override + int get hashCode => Object.hash(runtimeType, threshold, timeWindow); + + @override + String toString() { + return 'CallViolationCountParameters(threshold: $threshold, timeWindow: $timeWindow)'; + } +} + +/// @nodoc +abstract mixin class $CallViolationCountParametersCopyWith<$Res> { + factory $CallViolationCountParametersCopyWith( + CallViolationCountParameters value, + $Res Function(CallViolationCountParameters) _then, + ) = _$CallViolationCountParametersCopyWithImpl; + @useResult + $Res call({int? threshold, String? timeWindow}); +} + +/// @nodoc +class _$CallViolationCountParametersCopyWithImpl<$Res> implements $CallViolationCountParametersCopyWith<$Res> { + _$CallViolationCountParametersCopyWithImpl(this._self, this._then); + + final CallViolationCountParameters _self; + final $Res Function(CallViolationCountParameters) _then; + + /// Create a copy of CallViolationCountParameters + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? threshold = freezed, Object? timeWindow = freezed}) { + return _then( + CallViolationCountParameters( + threshold: freezed == threshold + ? _self.threshold + : threshold // ignore: cast_nullable_to_non_nullable + as int?, + timeWindow: freezed == timeWindow + ? _self.timeWindow + : timeWindow // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/call_violation_count_parameters.g.dart b/packages/stream_chat/lib/open_api/model/call_violation_count_parameters.g.dart new file mode 100644 index 0000000000..d10f2b6806 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/call_violation_count_parameters.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'call_violation_count_parameters.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +CallViolationCountParameters _$CallViolationCountParametersFromJson( + Map json, +) => CallViolationCountParameters( + threshold: (json['threshold'] as num?)?.toInt(), + timeWindow: json['time_window'] as String?, +); + +Map _$CallViolationCountParametersToJson( + CallViolationCountParameters instance, +) => { + 'threshold': instance.threshold, + 'time_window': instance.timeWindow, +}; diff --git a/packages/stream_chat/lib/open_api/model/cast_poll_vote_request.dart b/packages/stream_chat/lib/open_api/model/cast_poll_vote_request.dart new file mode 100644 index 0000000000..fde368df9a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/cast_poll_vote_request.dart @@ -0,0 +1,31 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'cast_poll_vote_request.g.dart'; +part 'cast_poll_vote_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class CastPollVoteRequest with _$CastPollVoteRequest { + const CastPollVoteRequest({ + this.vote, + }); + + @override + @JsonKey(name: 'vote') + final VoteData? vote; + + Map toJson() => _$CastPollVoteRequestToJson(this); + + static CastPollVoteRequest fromJson(Map json) => _$CastPollVoteRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/cast_poll_vote_request.freezed.dart b/packages/stream_chat/lib/open_api/model/cast_poll_vote_request.freezed.dart new file mode 100644 index 0000000000..ff70b1cd16 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/cast_poll_vote_request.freezed.dart @@ -0,0 +1,76 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'cast_poll_vote_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$CastPollVoteRequest { + VoteData? get vote; + + /// Create a copy of CastPollVoteRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $CastPollVoteRequestCopyWith get copyWith => + _$CastPollVoteRequestCopyWithImpl( + this as CastPollVoteRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is CastPollVoteRequest && + (identical(other.vote, vote) || other.vote == vote)); + } + + @override + int get hashCode => Object.hash(runtimeType, vote); + + @override + String toString() { + return 'CastPollVoteRequest(vote: $vote)'; + } +} + +/// @nodoc +abstract mixin class $CastPollVoteRequestCopyWith<$Res> { + factory $CastPollVoteRequestCopyWith( + CastPollVoteRequest value, + $Res Function(CastPollVoteRequest) _then, + ) = _$CastPollVoteRequestCopyWithImpl; + @useResult + $Res call({VoteData? vote}); +} + +/// @nodoc +class _$CastPollVoteRequestCopyWithImpl<$Res> implements $CastPollVoteRequestCopyWith<$Res> { + _$CastPollVoteRequestCopyWithImpl(this._self, this._then); + + final CastPollVoteRequest _self; + final $Res Function(CastPollVoteRequest) _then; + + /// Create a copy of CastPollVoteRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? vote = freezed}) { + return _then( + CastPollVoteRequest( + vote: freezed == vote + ? _self.vote + : vote // ignore: cast_nullable_to_non_nullable + as VoteData?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/cast_poll_vote_request.g.dart b/packages/stream_chat/lib/open_api/model/cast_poll_vote_request.g.dart new file mode 100644 index 0000000000..e7835282cb --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/cast_poll_vote_request.g.dart @@ -0,0 +1,15 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'cast_poll_vote_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +CastPollVoteRequest _$CastPollVoteRequestFromJson(Map json) => CastPollVoteRequest( + vote: json['vote'] == null ? null : VoteData.fromJson(json['vote'] as Map), +); + +Map _$CastPollVoteRequestToJson( + CastPollVoteRequest instance, +) => {'vote': instance.vote?.toJson()}; diff --git a/packages/stream_chat/lib/open_api/model/channel_config_overrides.dart b/packages/stream_chat/lib/open_api/model/channel_config_overrides.dart new file mode 100644 index 0000000000..dc260179b9 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_config_overrides.dart @@ -0,0 +1,128 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'channel_config_overrides.g.dart'; +part 'channel_config_overrides.freezed.dart'; + +extension type const ChannelConfigOverridesBlocklistBehavior._(String _) implements String { + static const block = ChannelConfigOverridesBlocklistBehavior._('block'); + static const flag = ChannelConfigOverridesBlocklistBehavior._('flag'); + + factory ChannelConfigOverridesBlocklistBehavior.fromJson(String json) => + ChannelConfigOverridesBlocklistBehavior._(json); + + String toJson() => this; +} + +extension type const ChannelConfigOverridesPushLevel._(String _) implements String { + static const all = ChannelConfigOverridesPushLevel._('all'); + static const allMentions = ChannelConfigOverridesPushLevel._('all_mentions'); + static const directMentions = ChannelConfigOverridesPushLevel._('direct_mentions'); + static const mentions = ChannelConfigOverridesPushLevel._('mentions'); + static const none = ChannelConfigOverridesPushLevel._('none'); + + factory ChannelConfigOverridesPushLevel.fromJson(String json) => ChannelConfigOverridesPushLevel._(json); + + String toJson() => this; +} + +@freezed +@immutable +@JsonSerializable() +class ChannelConfigOverrides with _$ChannelConfigOverrides { + const ChannelConfigOverrides({ + this.blocklist, + this.blocklistBehavior, + this.chatPreferences, + this.commands, + this.countMessages, + this.grants, + this.maxMessageLength, + this.pushLevel, + this.quotes, + this.reactions, + this.replies, + this.sharedLocations, + this.typingEvents, + this.uploads, + this.urlEnrichment, + this.userMessageReminders, + }); + + @override + @JsonKey(name: 'blocklist') + final String? blocklist; + + @override + @JsonKey(name: 'blocklist_behavior') + final ChannelConfigOverridesBlocklistBehavior? blocklistBehavior; + + @override + @JsonKey(name: 'chat_preferences') + final ChatPreferences? chatPreferences; + + @override + @JsonKey(name: 'commands') + final List? commands; + + @override + @JsonKey(name: 'count_messages') + final bool? countMessages; + + @override + @JsonKey(name: 'grants') + final Map>? grants; + + @override + @JsonKey(name: 'max_message_length') + final int? maxMessageLength; + + @override + @JsonKey(name: 'push_level') + final ChannelConfigOverridesPushLevel? pushLevel; + + @override + @JsonKey(name: 'quotes') + final bool? quotes; + + @override + @JsonKey(name: 'reactions') + final bool? reactions; + + @override + @JsonKey(name: 'replies') + final bool? replies; + + @override + @JsonKey(name: 'shared_locations') + final bool? sharedLocations; + + @override + @JsonKey(name: 'typing_events') + final bool? typingEvents; + + @override + @JsonKey(name: 'uploads') + final bool? uploads; + + @override + @JsonKey(name: 'url_enrichment') + final bool? urlEnrichment; + + @override + @JsonKey(name: 'user_message_reminders') + final bool? userMessageReminders; + + Map toJson() => _$ChannelConfigOverridesToJson(this); + + static ChannelConfigOverrides fromJson(Map json) => _$ChannelConfigOverridesFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/channel_config_overrides.freezed.dart b/packages/stream_chat/lib/open_api/model/channel_config_overrides.freezed.dart new file mode 100644 index 0000000000..c902b61974 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_config_overrides.freezed.dart @@ -0,0 +1,219 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'channel_config_overrides.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ChannelConfigOverrides { + String? get blocklist; + ChannelConfigOverridesBlocklistBehavior? get blocklistBehavior; + ChatPreferences? get chatPreferences; + List? get commands; + bool? get countMessages; + Map>? get grants; + int? get maxMessageLength; + ChannelConfigOverridesPushLevel? get pushLevel; + bool? get quotes; + bool? get reactions; + bool? get replies; + bool? get sharedLocations; + bool? get typingEvents; + bool? get uploads; + bool? get urlEnrichment; + bool? get userMessageReminders; + + /// Create a copy of ChannelConfigOverrides + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ChannelConfigOverridesCopyWith get copyWith => + _$ChannelConfigOverridesCopyWithImpl( + this as ChannelConfigOverrides, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ChannelConfigOverrides && + (identical(other.blocklist, blocklist) || other.blocklist == blocklist) && + (identical(other.blocklistBehavior, blocklistBehavior) || other.blocklistBehavior == blocklistBehavior) && + (identical(other.chatPreferences, chatPreferences) || other.chatPreferences == chatPreferences) && + const DeepCollectionEquality().equals(other.commands, commands) && + (identical(other.countMessages, countMessages) || other.countMessages == countMessages) && + const DeepCollectionEquality().equals(other.grants, grants) && + (identical(other.maxMessageLength, maxMessageLength) || other.maxMessageLength == maxMessageLength) && + (identical(other.pushLevel, pushLevel) || other.pushLevel == pushLevel) && + (identical(other.quotes, quotes) || other.quotes == quotes) && + (identical(other.reactions, reactions) || other.reactions == reactions) && + (identical(other.replies, replies) || other.replies == replies) && + (identical(other.sharedLocations, sharedLocations) || other.sharedLocations == sharedLocations) && + (identical(other.typingEvents, typingEvents) || other.typingEvents == typingEvents) && + (identical(other.uploads, uploads) || other.uploads == uploads) && + (identical(other.urlEnrichment, urlEnrichment) || other.urlEnrichment == urlEnrichment) && + (identical(other.userMessageReminders, userMessageReminders) || + other.userMessageReminders == userMessageReminders)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + blocklist, + blocklistBehavior, + chatPreferences, + const DeepCollectionEquality().hash(commands), + countMessages, + const DeepCollectionEquality().hash(grants), + maxMessageLength, + pushLevel, + quotes, + reactions, + replies, + sharedLocations, + typingEvents, + uploads, + urlEnrichment, + userMessageReminders, + ); + + @override + String toString() { + return 'ChannelConfigOverrides(blocklist: $blocklist, blocklistBehavior: $blocklistBehavior, chatPreferences: $chatPreferences, commands: $commands, countMessages: $countMessages, grants: $grants, maxMessageLength: $maxMessageLength, pushLevel: $pushLevel, quotes: $quotes, reactions: $reactions, replies: $replies, sharedLocations: $sharedLocations, typingEvents: $typingEvents, uploads: $uploads, urlEnrichment: $urlEnrichment, userMessageReminders: $userMessageReminders)'; + } +} + +/// @nodoc +abstract mixin class $ChannelConfigOverridesCopyWith<$Res> { + factory $ChannelConfigOverridesCopyWith( + ChannelConfigOverrides value, + $Res Function(ChannelConfigOverrides) _then, + ) = _$ChannelConfigOverridesCopyWithImpl; + @useResult + $Res call({ + String? blocklist, + ChannelConfigOverridesBlocklistBehavior? blocklistBehavior, + ChatPreferences? chatPreferences, + List? commands, + bool? countMessages, + Map>? grants, + int? maxMessageLength, + ChannelConfigOverridesPushLevel? pushLevel, + bool? quotes, + bool? reactions, + bool? replies, + bool? sharedLocations, + bool? typingEvents, + bool? uploads, + bool? urlEnrichment, + bool? userMessageReminders, + }); +} + +/// @nodoc +class _$ChannelConfigOverridesCopyWithImpl<$Res> implements $ChannelConfigOverridesCopyWith<$Res> { + _$ChannelConfigOverridesCopyWithImpl(this._self, this._then); + + final ChannelConfigOverrides _self; + final $Res Function(ChannelConfigOverrides) _then; + + /// Create a copy of ChannelConfigOverrides + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? blocklist = freezed, + Object? blocklistBehavior = freezed, + Object? chatPreferences = freezed, + Object? commands = freezed, + Object? countMessages = freezed, + Object? grants = freezed, + Object? maxMessageLength = freezed, + Object? pushLevel = freezed, + Object? quotes = freezed, + Object? reactions = freezed, + Object? replies = freezed, + Object? sharedLocations = freezed, + Object? typingEvents = freezed, + Object? uploads = freezed, + Object? urlEnrichment = freezed, + Object? userMessageReminders = freezed, + }) { + return _then( + ChannelConfigOverrides( + blocklist: freezed == blocklist + ? _self.blocklist + : blocklist // ignore: cast_nullable_to_non_nullable + as String?, + blocklistBehavior: freezed == blocklistBehavior + ? _self.blocklistBehavior + : blocklistBehavior // ignore: cast_nullable_to_non_nullable + as ChannelConfigOverridesBlocklistBehavior?, + chatPreferences: freezed == chatPreferences + ? _self.chatPreferences + : chatPreferences // ignore: cast_nullable_to_non_nullable + as ChatPreferences?, + commands: freezed == commands + ? _self.commands + : commands // ignore: cast_nullable_to_non_nullable + as List?, + countMessages: freezed == countMessages + ? _self.countMessages + : countMessages // ignore: cast_nullable_to_non_nullable + as bool?, + grants: freezed == grants + ? _self.grants + : grants // ignore: cast_nullable_to_non_nullable + as Map>?, + maxMessageLength: freezed == maxMessageLength + ? _self.maxMessageLength + : maxMessageLength // ignore: cast_nullable_to_non_nullable + as int?, + pushLevel: freezed == pushLevel + ? _self.pushLevel + : pushLevel // ignore: cast_nullable_to_non_nullable + as ChannelConfigOverridesPushLevel?, + quotes: freezed == quotes + ? _self.quotes + : quotes // ignore: cast_nullable_to_non_nullable + as bool?, + reactions: freezed == reactions + ? _self.reactions + : reactions // ignore: cast_nullable_to_non_nullable + as bool?, + replies: freezed == replies + ? _self.replies + : replies // ignore: cast_nullable_to_non_nullable + as bool?, + sharedLocations: freezed == sharedLocations + ? _self.sharedLocations + : sharedLocations // ignore: cast_nullable_to_non_nullable + as bool?, + typingEvents: freezed == typingEvents + ? _self.typingEvents + : typingEvents // ignore: cast_nullable_to_non_nullable + as bool?, + uploads: freezed == uploads + ? _self.uploads + : uploads // ignore: cast_nullable_to_non_nullable + as bool?, + urlEnrichment: freezed == urlEnrichment + ? _self.urlEnrichment + : urlEnrichment // ignore: cast_nullable_to_non_nullable + as bool?, + userMessageReminders: freezed == userMessageReminders + ? _self.userMessageReminders + : userMessageReminders // ignore: cast_nullable_to_non_nullable + as bool?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/channel_config_overrides.g.dart b/packages/stream_chat/lib/open_api/model/channel_config_overrides.g.dart new file mode 100644 index 0000000000..0db4229c4c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_config_overrides.g.dart @@ -0,0 +1,59 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'channel_config_overrides.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ChannelConfigOverrides _$ChannelConfigOverridesFromJson( + Map json, +) => ChannelConfigOverrides( + blocklist: json['blocklist'] as String?, + blocklistBehavior: json['blocklist_behavior'] == null + ? null + : ChannelConfigOverridesBlocklistBehavior.fromJson( + json['blocklist_behavior'] as String, + ), + chatPreferences: json['chat_preferences'] == null + ? null + : ChatPreferences.fromJson( + json['chat_preferences'] as Map, + ), + commands: (json['commands'] as List?)?.map((e) => e as String).toList(), + countMessages: json['count_messages'] as bool?, + grants: (json['grants'] as Map?)?.map( + (k, e) => MapEntry(k, (e as List).map((e) => e as String).toList()), + ), + maxMessageLength: (json['max_message_length'] as num?)?.toInt(), + pushLevel: json['push_level'] == null ? null : ChannelConfigOverridesPushLevel.fromJson(json['push_level'] as String), + quotes: json['quotes'] as bool?, + reactions: json['reactions'] as bool?, + replies: json['replies'] as bool?, + sharedLocations: json['shared_locations'] as bool?, + typingEvents: json['typing_events'] as bool?, + uploads: json['uploads'] as bool?, + urlEnrichment: json['url_enrichment'] as bool?, + userMessageReminders: json['user_message_reminders'] as bool?, +); + +Map _$ChannelConfigOverridesToJson( + ChannelConfigOverrides instance, +) => { + 'blocklist': instance.blocklist, + 'blocklist_behavior': instance.blocklistBehavior?.toJson(), + 'chat_preferences': instance.chatPreferences?.toJson(), + 'commands': instance.commands, + 'count_messages': instance.countMessages, + 'grants': instance.grants, + 'max_message_length': instance.maxMessageLength, + 'push_level': instance.pushLevel?.toJson(), + 'quotes': instance.quotes, + 'reactions': instance.reactions, + 'replies': instance.replies, + 'shared_locations': instance.sharedLocations, + 'typing_events': instance.typingEvents, + 'uploads': instance.uploads, + 'url_enrichment': instance.urlEnrichment, + 'user_message_reminders': instance.userMessageReminders, +}; diff --git a/packages/stream_chat/lib/open_api/model/channel_config_with_info.dart b/packages/stream_chat/lib/open_api/model/channel_config_with_info.dart new file mode 100644 index 0000000000..0b22b00596 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_config_with_info.dart @@ -0,0 +1,261 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'channel_config_with_info.g.dart'; +part 'channel_config_with_info.freezed.dart'; + +extension type const ChannelConfigWithInfoAutomod._(String _) implements String { + static const aI = ChannelConfigWithInfoAutomod._('AI'); + static const disabled = ChannelConfigWithInfoAutomod._('disabled'); + static const simple = ChannelConfigWithInfoAutomod._('simple'); + + factory ChannelConfigWithInfoAutomod.fromJson(String json) => ChannelConfigWithInfoAutomod._(json); + + String toJson() => this; +} + +extension type const ChannelConfigWithInfoAutomodBehavior._(String _) implements String { + static const block = ChannelConfigWithInfoAutomodBehavior._('block'); + static const flag = ChannelConfigWithInfoAutomodBehavior._('flag'); + static const shadowBlock = ChannelConfigWithInfoAutomodBehavior._('shadow_block'); + + factory ChannelConfigWithInfoAutomodBehavior.fromJson(String json) => ChannelConfigWithInfoAutomodBehavior._(json); + + String toJson() => this; +} + +extension type const ChannelConfigWithInfoBlocklistBehavior._(String _) implements String { + static const block = ChannelConfigWithInfoBlocklistBehavior._('block'); + static const flag = ChannelConfigWithInfoBlocklistBehavior._('flag'); + static const shadowBlock = ChannelConfigWithInfoBlocklistBehavior._('shadow_block'); + + factory ChannelConfigWithInfoBlocklistBehavior.fromJson(String json) => + ChannelConfigWithInfoBlocklistBehavior._(json); + + String toJson() => this; +} + +extension type const ChannelConfigWithInfoPushLevel._(String _) implements String { + static const all = ChannelConfigWithInfoPushLevel._('all'); + static const allMentions = ChannelConfigWithInfoPushLevel._('all_mentions'); + static const directMentions = ChannelConfigWithInfoPushLevel._('direct_mentions'); + static const mentions = ChannelConfigWithInfoPushLevel._('mentions'); + static const none = ChannelConfigWithInfoPushLevel._('none'); + + factory ChannelConfigWithInfoPushLevel.fromJson(String json) => ChannelConfigWithInfoPushLevel._(json); + + String toJson() => this; +} + +@freezed +@immutable +@JsonSerializable() +class ChannelConfigWithInfo with _$ChannelConfigWithInfo { + const ChannelConfigWithInfo({ + this.allowedFlagReasons, + required this.automod, + required this.automodBehavior, + this.automodThresholds, + this.blocklist, + this.blocklistBehavior, + this.blocklists, + this.chatPreferences, + required this.commands, + required this.connectEvents, + required this.countMessages, + required this.createdAt, + required this.customEvents, + required this.deliveryEvents, + this.grants, + required this.markMessagesPending, + required this.maxMessageLength, + required this.messageRetention, + required this.mutes, + required this.name, + this.partitionSize, + this.partitionTtl, + required this.polls, + this.pushLevel, + required this.pushNotifications, + required this.quotes, + required this.reactions, + required this.readEvents, + required this.reminders, + required this.replies, + required this.search, + required this.sharedLocations, + required this.skipLastMsgUpdateForSystemMsgs, + required this.typingEvents, + required this.updatedAt, + required this.uploads, + required this.urlEnrichment, + required this.userMessageReminders, + }); + + @override + @JsonKey(name: 'allowed_flag_reasons') + final List? allowedFlagReasons; + + @override + @JsonKey(name: 'automod') + final ChannelConfigWithInfoAutomod automod; + + @override + @JsonKey(name: 'automod_behavior') + final ChannelConfigWithInfoAutomodBehavior automodBehavior; + + @override + @JsonKey(name: 'automod_thresholds') + final Thresholds? automodThresholds; + + @override + @JsonKey(name: 'blocklist') + final String? blocklist; + + @override + @JsonKey(name: 'blocklist_behavior') + final ChannelConfigWithInfoBlocklistBehavior? blocklistBehavior; + + @override + @JsonKey(name: 'blocklists') + final List? blocklists; + + @override + @JsonKey(name: 'chat_preferences') + final ChatPreferences? chatPreferences; + + @override + @JsonKey(name: 'commands') + final List commands; + + @override + @JsonKey(name: 'connect_events') + final bool connectEvents; + + @override + @JsonKey(name: 'count_messages') + final bool countMessages; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom_events') + final bool customEvents; + + @override + @JsonKey(name: 'delivery_events') + final bool deliveryEvents; + + @override + @JsonKey(name: 'grants') + final Map>? grants; + + @override + @JsonKey(name: 'mark_messages_pending') + final bool markMessagesPending; + + @override + @JsonKey(name: 'max_message_length') + final int maxMessageLength; + + @override + @JsonKey(name: 'message_retention') + final String messageRetention; + + @override + @JsonKey(name: 'mutes') + final bool mutes; + + @override + @JsonKey(name: 'name') + final String name; + + @override + @JsonKey(name: 'partition_size') + final int? partitionSize; + + @override + @JsonKey(name: 'partition_ttl') + final String? partitionTtl; + + @override + @JsonKey(name: 'polls') + final bool polls; + + @override + @JsonKey(name: 'push_level') + final ChannelConfigWithInfoPushLevel? pushLevel; + + @override + @JsonKey(name: 'push_notifications') + final bool pushNotifications; + + @override + @JsonKey(name: 'quotes') + final bool quotes; + + @override + @JsonKey(name: 'reactions') + final bool reactions; + + @override + @JsonKey(name: 'read_events') + final bool readEvents; + + @override + @JsonKey(name: 'reminders') + final bool reminders; + + @override + @JsonKey(name: 'replies') + final bool replies; + + @override + @JsonKey(name: 'search') + final bool search; + + @override + @JsonKey(name: 'shared_locations') + final bool sharedLocations; + + @override + @JsonKey(name: 'skip_last_msg_update_for_system_msgs') + final bool skipLastMsgUpdateForSystemMsgs; + + @override + @JsonKey(name: 'typing_events') + final bool typingEvents; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'updated_at') + final DateTime updatedAt; + + @override + @JsonKey(name: 'uploads') + final bool uploads; + + @override + @JsonKey(name: 'url_enrichment') + final bool urlEnrichment; + + @override + @JsonKey(name: 'user_message_reminders') + final bool userMessageReminders; + + Map toJson() => _$ChannelConfigWithInfoToJson(this); + + static ChannelConfigWithInfo fromJson(Map json) => _$ChannelConfigWithInfoFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/channel_config_with_info.freezed.dart b/packages/stream_chat/lib/open_api/model/channel_config_with_info.freezed.dart new file mode 100644 index 0000000000..90bef0ab15 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_config_with_info.freezed.dart @@ -0,0 +1,428 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'channel_config_with_info.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ChannelConfigWithInfo { + List? get allowedFlagReasons; + ChannelConfigWithInfoAutomod get automod; + ChannelConfigWithInfoAutomodBehavior get automodBehavior; + Thresholds? get automodThresholds; + String? get blocklist; + ChannelConfigWithInfoBlocklistBehavior? get blocklistBehavior; + List? get blocklists; + ChatPreferences? get chatPreferences; + List get commands; + bool get connectEvents; + bool get countMessages; + DateTime get createdAt; + bool get customEvents; + bool get deliveryEvents; + Map>? get grants; + bool get markMessagesPending; + int get maxMessageLength; + String get messageRetention; + bool get mutes; + String get name; + int? get partitionSize; + String? get partitionTtl; + bool get polls; + ChannelConfigWithInfoPushLevel? get pushLevel; + bool get pushNotifications; + bool get quotes; + bool get reactions; + bool get readEvents; + bool get reminders; + bool get replies; + bool get search; + bool get sharedLocations; + bool get skipLastMsgUpdateForSystemMsgs; + bool get typingEvents; + DateTime get updatedAt; + bool get uploads; + bool get urlEnrichment; + bool get userMessageReminders; + + /// Create a copy of ChannelConfigWithInfo + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ChannelConfigWithInfoCopyWith get copyWith => + _$ChannelConfigWithInfoCopyWithImpl( + this as ChannelConfigWithInfo, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ChannelConfigWithInfo && + const DeepCollectionEquality().equals( + other.allowedFlagReasons, + allowedFlagReasons, + ) && + (identical(other.automod, automod) || other.automod == automod) && + (identical(other.automodBehavior, automodBehavior) || other.automodBehavior == automodBehavior) && + (identical(other.automodThresholds, automodThresholds) || other.automodThresholds == automodThresholds) && + (identical(other.blocklist, blocklist) || other.blocklist == blocklist) && + (identical(other.blocklistBehavior, blocklistBehavior) || other.blocklistBehavior == blocklistBehavior) && + const DeepCollectionEquality().equals( + other.blocklists, + blocklists, + ) && + (identical(other.chatPreferences, chatPreferences) || other.chatPreferences == chatPreferences) && + const DeepCollectionEquality().equals(other.commands, commands) && + (identical(other.connectEvents, connectEvents) || other.connectEvents == connectEvents) && + (identical(other.countMessages, countMessages) || other.countMessages == countMessages) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.customEvents, customEvents) || other.customEvents == customEvents) && + (identical(other.deliveryEvents, deliveryEvents) || other.deliveryEvents == deliveryEvents) && + const DeepCollectionEquality().equals(other.grants, grants) && + (identical(other.markMessagesPending, markMessagesPending) || + other.markMessagesPending == markMessagesPending) && + (identical(other.maxMessageLength, maxMessageLength) || other.maxMessageLength == maxMessageLength) && + (identical(other.messageRetention, messageRetention) || other.messageRetention == messageRetention) && + (identical(other.mutes, mutes) || other.mutes == mutes) && + (identical(other.name, name) || other.name == name) && + (identical(other.partitionSize, partitionSize) || other.partitionSize == partitionSize) && + (identical(other.partitionTtl, partitionTtl) || other.partitionTtl == partitionTtl) && + (identical(other.polls, polls) || other.polls == polls) && + (identical(other.pushLevel, pushLevel) || other.pushLevel == pushLevel) && + (identical(other.pushNotifications, pushNotifications) || other.pushNotifications == pushNotifications) && + (identical(other.quotes, quotes) || other.quotes == quotes) && + (identical(other.reactions, reactions) || other.reactions == reactions) && + (identical(other.readEvents, readEvents) || other.readEvents == readEvents) && + (identical(other.reminders, reminders) || other.reminders == reminders) && + (identical(other.replies, replies) || other.replies == replies) && + (identical(other.search, search) || other.search == search) && + (identical(other.sharedLocations, sharedLocations) || other.sharedLocations == sharedLocations) && + (identical( + other.skipLastMsgUpdateForSystemMsgs, + skipLastMsgUpdateForSystemMsgs, + ) || + other.skipLastMsgUpdateForSystemMsgs == skipLastMsgUpdateForSystemMsgs) && + (identical(other.typingEvents, typingEvents) || other.typingEvents == typingEvents) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt) && + (identical(other.uploads, uploads) || other.uploads == uploads) && + (identical(other.urlEnrichment, urlEnrichment) || other.urlEnrichment == urlEnrichment) && + (identical(other.userMessageReminders, userMessageReminders) || + other.userMessageReminders == userMessageReminders)); + } + + @override + int get hashCode => Object.hashAll([ + runtimeType, + const DeepCollectionEquality().hash(allowedFlagReasons), + automod, + automodBehavior, + automodThresholds, + blocklist, + blocklistBehavior, + const DeepCollectionEquality().hash(blocklists), + chatPreferences, + const DeepCollectionEquality().hash(commands), + connectEvents, + countMessages, + createdAt, + customEvents, + deliveryEvents, + const DeepCollectionEquality().hash(grants), + markMessagesPending, + maxMessageLength, + messageRetention, + mutes, + name, + partitionSize, + partitionTtl, + polls, + pushLevel, + pushNotifications, + quotes, + reactions, + readEvents, + reminders, + replies, + search, + sharedLocations, + skipLastMsgUpdateForSystemMsgs, + typingEvents, + updatedAt, + uploads, + urlEnrichment, + userMessageReminders, + ]); + + @override + String toString() { + return 'ChannelConfigWithInfo(allowedFlagReasons: $allowedFlagReasons, automod: $automod, automodBehavior: $automodBehavior, automodThresholds: $automodThresholds, blocklist: $blocklist, blocklistBehavior: $blocklistBehavior, blocklists: $blocklists, chatPreferences: $chatPreferences, commands: $commands, connectEvents: $connectEvents, countMessages: $countMessages, createdAt: $createdAt, customEvents: $customEvents, deliveryEvents: $deliveryEvents, grants: $grants, markMessagesPending: $markMessagesPending, maxMessageLength: $maxMessageLength, messageRetention: $messageRetention, mutes: $mutes, name: $name, partitionSize: $partitionSize, partitionTtl: $partitionTtl, polls: $polls, pushLevel: $pushLevel, pushNotifications: $pushNotifications, quotes: $quotes, reactions: $reactions, readEvents: $readEvents, reminders: $reminders, replies: $replies, search: $search, sharedLocations: $sharedLocations, skipLastMsgUpdateForSystemMsgs: $skipLastMsgUpdateForSystemMsgs, typingEvents: $typingEvents, updatedAt: $updatedAt, uploads: $uploads, urlEnrichment: $urlEnrichment, userMessageReminders: $userMessageReminders)'; + } +} + +/// @nodoc +abstract mixin class $ChannelConfigWithInfoCopyWith<$Res> { + factory $ChannelConfigWithInfoCopyWith( + ChannelConfigWithInfo value, + $Res Function(ChannelConfigWithInfo) _then, + ) = _$ChannelConfigWithInfoCopyWithImpl; + @useResult + $Res call({ + List? allowedFlagReasons, + ChannelConfigWithInfoAutomod automod, + ChannelConfigWithInfoAutomodBehavior automodBehavior, + Thresholds? automodThresholds, + String? blocklist, + ChannelConfigWithInfoBlocklistBehavior? blocklistBehavior, + List? blocklists, + ChatPreferences? chatPreferences, + List commands, + bool connectEvents, + bool countMessages, + DateTime createdAt, + bool customEvents, + bool deliveryEvents, + Map>? grants, + bool markMessagesPending, + int maxMessageLength, + String messageRetention, + bool mutes, + String name, + int? partitionSize, + String? partitionTtl, + bool polls, + ChannelConfigWithInfoPushLevel? pushLevel, + bool pushNotifications, + bool quotes, + bool reactions, + bool readEvents, + bool reminders, + bool replies, + bool search, + bool sharedLocations, + bool skipLastMsgUpdateForSystemMsgs, + bool typingEvents, + DateTime updatedAt, + bool uploads, + bool urlEnrichment, + bool userMessageReminders, + }); +} + +/// @nodoc +class _$ChannelConfigWithInfoCopyWithImpl<$Res> implements $ChannelConfigWithInfoCopyWith<$Res> { + _$ChannelConfigWithInfoCopyWithImpl(this._self, this._then); + + final ChannelConfigWithInfo _self; + final $Res Function(ChannelConfigWithInfo) _then; + + /// Create a copy of ChannelConfigWithInfo + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? allowedFlagReasons = freezed, + Object? automod = null, + Object? automodBehavior = null, + Object? automodThresholds = freezed, + Object? blocklist = freezed, + Object? blocklistBehavior = freezed, + Object? blocklists = freezed, + Object? chatPreferences = freezed, + Object? commands = null, + Object? connectEvents = null, + Object? countMessages = null, + Object? createdAt = null, + Object? customEvents = null, + Object? deliveryEvents = null, + Object? grants = freezed, + Object? markMessagesPending = null, + Object? maxMessageLength = null, + Object? messageRetention = null, + Object? mutes = null, + Object? name = null, + Object? partitionSize = freezed, + Object? partitionTtl = freezed, + Object? polls = null, + Object? pushLevel = freezed, + Object? pushNotifications = null, + Object? quotes = null, + Object? reactions = null, + Object? readEvents = null, + Object? reminders = null, + Object? replies = null, + Object? search = null, + Object? sharedLocations = null, + Object? skipLastMsgUpdateForSystemMsgs = null, + Object? typingEvents = null, + Object? updatedAt = null, + Object? uploads = null, + Object? urlEnrichment = null, + Object? userMessageReminders = null, + }) { + return _then( + ChannelConfigWithInfo( + allowedFlagReasons: freezed == allowedFlagReasons + ? _self.allowedFlagReasons + : allowedFlagReasons // ignore: cast_nullable_to_non_nullable + as List?, + automod: null == automod + ? _self.automod + : automod // ignore: cast_nullable_to_non_nullable + as ChannelConfigWithInfoAutomod, + automodBehavior: null == automodBehavior + ? _self.automodBehavior + : automodBehavior // ignore: cast_nullable_to_non_nullable + as ChannelConfigWithInfoAutomodBehavior, + automodThresholds: freezed == automodThresholds + ? _self.automodThresholds + : automodThresholds // ignore: cast_nullable_to_non_nullable + as Thresholds?, + blocklist: freezed == blocklist + ? _self.blocklist + : blocklist // ignore: cast_nullable_to_non_nullable + as String?, + blocklistBehavior: freezed == blocklistBehavior + ? _self.blocklistBehavior + : blocklistBehavior // ignore: cast_nullable_to_non_nullable + as ChannelConfigWithInfoBlocklistBehavior?, + blocklists: freezed == blocklists + ? _self.blocklists + : blocklists // ignore: cast_nullable_to_non_nullable + as List?, + chatPreferences: freezed == chatPreferences + ? _self.chatPreferences + : chatPreferences // ignore: cast_nullable_to_non_nullable + as ChatPreferences?, + commands: null == commands + ? _self.commands + : commands // ignore: cast_nullable_to_non_nullable + as List, + connectEvents: null == connectEvents + ? _self.connectEvents + : connectEvents // ignore: cast_nullable_to_non_nullable + as bool, + countMessages: null == countMessages + ? _self.countMessages + : countMessages // ignore: cast_nullable_to_non_nullable + as bool, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + customEvents: null == customEvents + ? _self.customEvents + : customEvents // ignore: cast_nullable_to_non_nullable + as bool, + deliveryEvents: null == deliveryEvents + ? _self.deliveryEvents + : deliveryEvents // ignore: cast_nullable_to_non_nullable + as bool, + grants: freezed == grants + ? _self.grants + : grants // ignore: cast_nullable_to_non_nullable + as Map>?, + markMessagesPending: null == markMessagesPending + ? _self.markMessagesPending + : markMessagesPending // ignore: cast_nullable_to_non_nullable + as bool, + maxMessageLength: null == maxMessageLength + ? _self.maxMessageLength + : maxMessageLength // ignore: cast_nullable_to_non_nullable + as int, + messageRetention: null == messageRetention + ? _self.messageRetention + : messageRetention // ignore: cast_nullable_to_non_nullable + as String, + mutes: null == mutes + ? _self.mutes + : mutes // ignore: cast_nullable_to_non_nullable + as bool, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + partitionSize: freezed == partitionSize + ? _self.partitionSize + : partitionSize // ignore: cast_nullable_to_non_nullable + as int?, + partitionTtl: freezed == partitionTtl + ? _self.partitionTtl + : partitionTtl // ignore: cast_nullable_to_non_nullable + as String?, + polls: null == polls + ? _self.polls + : polls // ignore: cast_nullable_to_non_nullable + as bool, + pushLevel: freezed == pushLevel + ? _self.pushLevel + : pushLevel // ignore: cast_nullable_to_non_nullable + as ChannelConfigWithInfoPushLevel?, + pushNotifications: null == pushNotifications + ? _self.pushNotifications + : pushNotifications // ignore: cast_nullable_to_non_nullable + as bool, + quotes: null == quotes + ? _self.quotes + : quotes // ignore: cast_nullable_to_non_nullable + as bool, + reactions: null == reactions + ? _self.reactions + : reactions // ignore: cast_nullable_to_non_nullable + as bool, + readEvents: null == readEvents + ? _self.readEvents + : readEvents // ignore: cast_nullable_to_non_nullable + as bool, + reminders: null == reminders + ? _self.reminders + : reminders // ignore: cast_nullable_to_non_nullable + as bool, + replies: null == replies + ? _self.replies + : replies // ignore: cast_nullable_to_non_nullable + as bool, + search: null == search + ? _self.search + : search // ignore: cast_nullable_to_non_nullable + as bool, + sharedLocations: null == sharedLocations + ? _self.sharedLocations + : sharedLocations // ignore: cast_nullable_to_non_nullable + as bool, + skipLastMsgUpdateForSystemMsgs: null == skipLastMsgUpdateForSystemMsgs + ? _self.skipLastMsgUpdateForSystemMsgs + : skipLastMsgUpdateForSystemMsgs // ignore: cast_nullable_to_non_nullable + as bool, + typingEvents: null == typingEvents + ? _self.typingEvents + : typingEvents // ignore: cast_nullable_to_non_nullable + as bool, + updatedAt: null == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + uploads: null == uploads + ? _self.uploads + : uploads // ignore: cast_nullable_to_non_nullable + as bool, + urlEnrichment: null == urlEnrichment + ? _self.urlEnrichment + : urlEnrichment // ignore: cast_nullable_to_non_nullable + as bool, + userMessageReminders: null == userMessageReminders + ? _self.userMessageReminders + : userMessageReminders // ignore: cast_nullable_to_non_nullable + as bool, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/channel_config_with_info.g.dart b/packages/stream_chat/lib/open_api/model/channel_config_with_info.g.dart new file mode 100644 index 0000000000..78179bffba --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_config_with_info.g.dart @@ -0,0 +1,113 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'channel_config_with_info.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ChannelConfigWithInfo _$ChannelConfigWithInfoFromJson( + Map json, +) => ChannelConfigWithInfo( + allowedFlagReasons: (json['allowed_flag_reasons'] as List?)?.map((e) => e as String).toList(), + automod: ChannelConfigWithInfoAutomod.fromJson(json['automod'] as String), + automodBehavior: ChannelConfigWithInfoAutomodBehavior.fromJson( + json['automod_behavior'] as String, + ), + automodThresholds: json['automod_thresholds'] == null + ? null + : Thresholds.fromJson(json['automod_thresholds'] as Map), + blocklist: json['blocklist'] as String?, + blocklistBehavior: json['blocklist_behavior'] == null + ? null + : ChannelConfigWithInfoBlocklistBehavior.fromJson( + json['blocklist_behavior'] as String, + ), + blocklists: (json['blocklists'] as List?) + ?.map((e) => BlockListOptions.fromJson(e as Map)) + .toList(), + chatPreferences: json['chat_preferences'] == null + ? null + : ChatPreferences.fromJson( + json['chat_preferences'] as Map, + ), + commands: (json['commands'] as List).map((e) => Command.fromJson(e as Map)).toList(), + connectEvents: json['connect_events'] as bool, + countMessages: json['count_messages'] as bool, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + customEvents: json['custom_events'] as bool, + deliveryEvents: json['delivery_events'] as bool, + grants: (json['grants'] as Map?)?.map( + (k, e) => MapEntry(k, (e as List).map((e) => e as String).toList()), + ), + markMessagesPending: json['mark_messages_pending'] as bool, + maxMessageLength: (json['max_message_length'] as num).toInt(), + messageRetention: json['message_retention'] as String, + mutes: json['mutes'] as bool, + name: json['name'] as String, + partitionSize: (json['partition_size'] as num?)?.toInt(), + partitionTtl: json['partition_ttl'] as String?, + polls: json['polls'] as bool, + pushLevel: json['push_level'] == null ? null : ChannelConfigWithInfoPushLevel.fromJson(json['push_level'] as String), + pushNotifications: json['push_notifications'] as bool, + quotes: json['quotes'] as bool, + reactions: json['reactions'] as bool, + readEvents: json['read_events'] as bool, + reminders: json['reminders'] as bool, + replies: json['replies'] as bool, + search: json['search'] as bool, + sharedLocations: json['shared_locations'] as bool, + skipLastMsgUpdateForSystemMsgs: json['skip_last_msg_update_for_system_msgs'] as bool, + typingEvents: json['typing_events'] as bool, + updatedAt: const StreamDateTimeConverter().fromJson( + json['updated_at'] as Object, + ), + uploads: json['uploads'] as bool, + urlEnrichment: json['url_enrichment'] as bool, + userMessageReminders: json['user_message_reminders'] as bool, +); + +Map _$ChannelConfigWithInfoToJson( + ChannelConfigWithInfo instance, +) => { + 'allowed_flag_reasons': instance.allowedFlagReasons, + 'automod': instance.automod.toJson(), + 'automod_behavior': instance.automodBehavior.toJson(), + 'automod_thresholds': instance.automodThresholds?.toJson(), + 'blocklist': instance.blocklist, + 'blocklist_behavior': instance.blocklistBehavior?.toJson(), + 'blocklists': instance.blocklists?.map((e) => e.toJson()).toList(), + 'chat_preferences': instance.chatPreferences?.toJson(), + 'commands': instance.commands.map((e) => e.toJson()).toList(), + 'connect_events': instance.connectEvents, + 'count_messages': instance.countMessages, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom_events': instance.customEvents, + 'delivery_events': instance.deliveryEvents, + 'grants': instance.grants, + 'mark_messages_pending': instance.markMessagesPending, + 'max_message_length': instance.maxMessageLength, + 'message_retention': instance.messageRetention, + 'mutes': instance.mutes, + 'name': instance.name, + 'partition_size': instance.partitionSize, + 'partition_ttl': instance.partitionTtl, + 'polls': instance.polls, + 'push_level': instance.pushLevel?.toJson(), + 'push_notifications': instance.pushNotifications, + 'quotes': instance.quotes, + 'reactions': instance.reactions, + 'read_events': instance.readEvents, + 'reminders': instance.reminders, + 'replies': instance.replies, + 'search': instance.search, + 'shared_locations': instance.sharedLocations, + 'skip_last_msg_update_for_system_msgs': instance.skipLastMsgUpdateForSystemMsgs, + 'typing_events': instance.typingEvents, + 'updated_at': const StreamDateTimeConverter().toJson(instance.updatedAt), + 'uploads': instance.uploads, + 'url_enrichment': instance.urlEnrichment, + 'user_message_reminders': instance.userMessageReminders, +}; diff --git a/packages/stream_chat/lib/open_api/model/channel_context_response.dart b/packages/stream_chat/lib/open_api/model/channel_context_response.dart new file mode 100644 index 0000000000..bff7d27c78 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_context_response.dart @@ -0,0 +1,46 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'channel_context_response.g.dart'; +part 'channel_context_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ChannelContextResponse with _$ChannelContextResponse { + const ChannelContextResponse({ + required this.cid, + this.createdBy, + required this.id, + required this.type, + }); + + @override + @JsonKey(name: 'cid') + final String cid; + + @override + @JsonKey(name: 'created_by') + final UserResponse? createdBy; + + @override + @JsonKey(name: 'id') + final String id; + + @override + @JsonKey(name: 'type') + final String type; + + Map toJson() => _$ChannelContextResponseToJson(this); + + static ChannelContextResponse fromJson(Map json) => _$ChannelContextResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/channel_context_response.freezed.dart b/packages/stream_chat/lib/open_api/model/channel_context_response.freezed.dart new file mode 100644 index 0000000000..6e33f8d4dc --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_context_response.freezed.dart @@ -0,0 +1,99 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'channel_context_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ChannelContextResponse { + String get cid; + UserResponse? get createdBy; + String get id; + String get type; + + /// Create a copy of ChannelContextResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ChannelContextResponseCopyWith get copyWith => + _$ChannelContextResponseCopyWithImpl( + this as ChannelContextResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ChannelContextResponse && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdBy, createdBy) || other.createdBy == createdBy) && + (identical(other.id, id) || other.id == id) && + (identical(other.type, type) || other.type == type)); + } + + @override + int get hashCode => Object.hash(runtimeType, cid, createdBy, id, type); + + @override + String toString() { + return 'ChannelContextResponse(cid: $cid, createdBy: $createdBy, id: $id, type: $type)'; + } +} + +/// @nodoc +abstract mixin class $ChannelContextResponseCopyWith<$Res> { + factory $ChannelContextResponseCopyWith( + ChannelContextResponse value, + $Res Function(ChannelContextResponse) _then, + ) = _$ChannelContextResponseCopyWithImpl; + @useResult + $Res call({String cid, UserResponse? createdBy, String id, String type}); +} + +/// @nodoc +class _$ChannelContextResponseCopyWithImpl<$Res> implements $ChannelContextResponseCopyWith<$Res> { + _$ChannelContextResponseCopyWithImpl(this._self, this._then); + + final ChannelContextResponse _self; + final $Res Function(ChannelContextResponse) _then; + + /// Create a copy of ChannelContextResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? cid = null, + Object? createdBy = freezed, + Object? id = null, + Object? type = null, + }) { + return _then( + ChannelContextResponse( + cid: null == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String, + createdBy: freezed == createdBy + ? _self.createdBy + : createdBy // ignore: cast_nullable_to_non_nullable + as UserResponse?, + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/channel_context_response.g.dart b/packages/stream_chat/lib/open_api/model/channel_context_response.g.dart new file mode 100644 index 0000000000..e9dbfbfa78 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_context_response.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'channel_context_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ChannelContextResponse _$ChannelContextResponseFromJson( + Map json, +) => ChannelContextResponse( + cid: json['cid'] as String, + createdBy: json['created_by'] == null ? null : UserResponse.fromJson(json['created_by'] as Map), + id: json['id'] as String, + type: json['type'] as String, +); + +Map _$ChannelContextResponseToJson( + ChannelContextResponse instance, +) => { + 'cid': instance.cid, + 'created_by': instance.createdBy?.toJson(), + 'id': instance.id, + 'type': instance.type, +}; diff --git a/packages/stream_chat/lib/open_api/model/channel_created_event.dart b/packages/stream_chat/lib/open_api/model/channel_created_event.dart new file mode 100644 index 0000000000..df52825935 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_created_event.dart @@ -0,0 +1,93 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'channel_created_event.g.dart'; +part 'channel_created_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ChannelCreatedEvent extends core.WsEvent with _$ChannelCreatedEvent { + const ChannelCreatedEvent({ + required this.channel, + this.channelCustom, + this.channelId, + this.channelMemberCount, + this.channelMessageCount, + this.channelType, + this.cid, + required this.createdAt, + required this.custom, + this.receivedAt, + this.team, + required this.type, + this.user, + }); + + @override + @JsonKey(name: 'channel') + final ChannelResponse channel; + + @override + @JsonKey(name: 'channel_custom') + final Map? channelCustom; + + @override + @JsonKey(name: 'channel_id') + final String? channelId; + + @override + @JsonKey(name: 'channel_member_count') + final int? channelMemberCount; + + @override + @JsonKey(name: 'channel_message_count') + final int? channelMessageCount; + + @override + @JsonKey(name: 'channel_type') + final String? channelType; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'team') + final String? team; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'user') + final UserResponseCommonFields? user; + + Map toJson() => _$ChannelCreatedEventToJson(this); + + static ChannelCreatedEvent fromJson(Map json) => _$ChannelCreatedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/channel_created_event.freezed.dart b/packages/stream_chat/lib/open_api/model/channel_created_event.freezed.dart new file mode 100644 index 0000000000..13e82baa9d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_created_event.freezed.dart @@ -0,0 +1,196 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'channel_created_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ChannelCreatedEvent { + ChannelResponse get channel; + Map? get channelCustom; + String? get channelId; + int? get channelMemberCount; + int? get channelMessageCount; + String? get channelType; + String? get cid; + DateTime get createdAt; + Map get custom; + DateTime? get receivedAt; + String? get team; + String get type; + UserResponseCommonFields? get user; + + /// Create a copy of ChannelCreatedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ChannelCreatedEventCopyWith get copyWith => + _$ChannelCreatedEventCopyWithImpl( + this as ChannelCreatedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ChannelCreatedEvent && + (identical(other.channel, channel) || other.channel == channel) && + const DeepCollectionEquality().equals( + other.channelCustom, + channelCustom, + ) && + (identical(other.channelId, channelId) || other.channelId == channelId) && + (identical(other.channelMemberCount, channelMemberCount) || + other.channelMemberCount == channelMemberCount) && + (identical(other.channelMessageCount, channelMessageCount) || + other.channelMessageCount == channelMessageCount) && + (identical(other.channelType, channelType) || other.channelType == channelType) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.team, team) || other.team == team) && + (identical(other.type, type) || other.type == type) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channel, + const DeepCollectionEquality().hash(channelCustom), + channelId, + channelMemberCount, + channelMessageCount, + channelType, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + receivedAt, + team, + type, + user, + ); + + @override + String toString() { + return 'ChannelCreatedEvent(channel: $channel, channelCustom: $channelCustom, channelId: $channelId, channelMemberCount: $channelMemberCount, channelMessageCount: $channelMessageCount, channelType: $channelType, cid: $cid, createdAt: $createdAt, custom: $custom, receivedAt: $receivedAt, team: $team, type: $type, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $ChannelCreatedEventCopyWith<$Res> { + factory $ChannelCreatedEventCopyWith( + ChannelCreatedEvent value, + $Res Function(ChannelCreatedEvent) _then, + ) = _$ChannelCreatedEventCopyWithImpl; + @useResult + $Res call({ + ChannelResponse channel, + Map? channelCustom, + String? channelId, + int? channelMemberCount, + int? channelMessageCount, + String? channelType, + String? cid, + DateTime createdAt, + Map custom, + DateTime? receivedAt, + String? team, + String type, + UserResponseCommonFields? user, + }); +} + +/// @nodoc +class _$ChannelCreatedEventCopyWithImpl<$Res> implements $ChannelCreatedEventCopyWith<$Res> { + _$ChannelCreatedEventCopyWithImpl(this._self, this._then); + + final ChannelCreatedEvent _self; + final $Res Function(ChannelCreatedEvent) _then; + + /// Create a copy of ChannelCreatedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channel = null, + Object? channelCustom = freezed, + Object? channelId = freezed, + Object? channelMemberCount = freezed, + Object? channelMessageCount = freezed, + Object? channelType = freezed, + Object? cid = freezed, + Object? createdAt = null, + Object? custom = null, + Object? receivedAt = freezed, + Object? team = freezed, + Object? type = null, + Object? user = freezed, + }) { + return _then( + ChannelCreatedEvent( + channel: null == channel + ? _self.channel + : channel // ignore: cast_nullable_to_non_nullable + as ChannelResponse, + channelCustom: freezed == channelCustom + ? _self.channelCustom + : channelCustom // ignore: cast_nullable_to_non_nullable + as Map?, + channelId: freezed == channelId + ? _self.channelId + : channelId // ignore: cast_nullable_to_non_nullable + as String?, + channelMemberCount: freezed == channelMemberCount + ? _self.channelMemberCount + : channelMemberCount // ignore: cast_nullable_to_non_nullable + as int?, + channelMessageCount: freezed == channelMessageCount + ? _self.channelMessageCount + : channelMessageCount // ignore: cast_nullable_to_non_nullable + as int?, + channelType: freezed == channelType + ? _self.channelType + : channelType // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + team: freezed == team + ? _self.team + : team // ignore: cast_nullable_to_non_nullable + as String?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponseCommonFields?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/channel_created_event.g.dart b/packages/stream_chat/lib/open_api/model/channel_created_event.g.dart new file mode 100644 index 0000000000..b0f10e3e9c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_created_event.g.dart @@ -0,0 +1,61 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'channel_created_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ChannelCreatedEvent _$ChannelCreatedEventFromJson( + Map json, +) => ChannelCreatedEvent( + channel: ChannelResponse.fromJson(json['channel'] as Map), + channelCustom: json['channel_custom'] as Map?, + channelId: json['channel_id'] as String?, + channelMemberCount: (json['channel_member_count'] as num?)?.toInt(), + channelMessageCount: (json['channel_message_count'] as num?)?.toInt(), + channelType: json['channel_type'] as String?, + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + team: json['team'] as String?, + type: json['type'] as String, + user: json['user'] == null ? null : UserResponseCommonFields.fromJson(json['user'] as Map), +); + +Map _$ChannelCreatedEventToJson( + ChannelCreatedEvent instance, +) => { + 'channel': instance.channel.toJson(), + 'channel_custom': instance.channelCustom, + 'channel_id': instance.channelId, + 'channel_member_count': instance.channelMemberCount, + 'channel_message_count': instance.channelMessageCount, + 'channel_type': instance.channelType, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'team': instance.team, + 'type': instance.type, + 'user': instance.user?.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/channel_deleted_event.dart b/packages/stream_chat/lib/open_api/model/channel_deleted_event.dart new file mode 100644 index 0000000000..2c67c4c7ea --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_deleted_event.dart @@ -0,0 +1,93 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'channel_deleted_event.g.dart'; +part 'channel_deleted_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ChannelDeletedEvent extends core.WsEvent with _$ChannelDeletedEvent { + const ChannelDeletedEvent({ + required this.channel, + this.channelCustom, + this.channelId, + this.channelMemberCount, + this.channelMessageCount, + this.channelType, + this.cid, + required this.createdAt, + required this.custom, + this.receivedAt, + this.team, + required this.type, + this.user, + }); + + @override + @JsonKey(name: 'channel') + final ChannelResponse channel; + + @override + @JsonKey(name: 'channel_custom') + final Map? channelCustom; + + @override + @JsonKey(name: 'channel_id') + final String? channelId; + + @override + @JsonKey(name: 'channel_member_count') + final int? channelMemberCount; + + @override + @JsonKey(name: 'channel_message_count') + final int? channelMessageCount; + + @override + @JsonKey(name: 'channel_type') + final String? channelType; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'team') + final String? team; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'user') + final UserResponseCommonFields? user; + + Map toJson() => _$ChannelDeletedEventToJson(this); + + static ChannelDeletedEvent fromJson(Map json) => _$ChannelDeletedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/channel_deleted_event.freezed.dart b/packages/stream_chat/lib/open_api/model/channel_deleted_event.freezed.dart new file mode 100644 index 0000000000..ede3c3c2a8 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_deleted_event.freezed.dart @@ -0,0 +1,196 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'channel_deleted_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ChannelDeletedEvent { + ChannelResponse get channel; + Map? get channelCustom; + String? get channelId; + int? get channelMemberCount; + int? get channelMessageCount; + String? get channelType; + String? get cid; + DateTime get createdAt; + Map get custom; + DateTime? get receivedAt; + String? get team; + String get type; + UserResponseCommonFields? get user; + + /// Create a copy of ChannelDeletedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ChannelDeletedEventCopyWith get copyWith => + _$ChannelDeletedEventCopyWithImpl( + this as ChannelDeletedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ChannelDeletedEvent && + (identical(other.channel, channel) || other.channel == channel) && + const DeepCollectionEquality().equals( + other.channelCustom, + channelCustom, + ) && + (identical(other.channelId, channelId) || other.channelId == channelId) && + (identical(other.channelMemberCount, channelMemberCount) || + other.channelMemberCount == channelMemberCount) && + (identical(other.channelMessageCount, channelMessageCount) || + other.channelMessageCount == channelMessageCount) && + (identical(other.channelType, channelType) || other.channelType == channelType) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.team, team) || other.team == team) && + (identical(other.type, type) || other.type == type) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channel, + const DeepCollectionEquality().hash(channelCustom), + channelId, + channelMemberCount, + channelMessageCount, + channelType, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + receivedAt, + team, + type, + user, + ); + + @override + String toString() { + return 'ChannelDeletedEvent(channel: $channel, channelCustom: $channelCustom, channelId: $channelId, channelMemberCount: $channelMemberCount, channelMessageCount: $channelMessageCount, channelType: $channelType, cid: $cid, createdAt: $createdAt, custom: $custom, receivedAt: $receivedAt, team: $team, type: $type, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $ChannelDeletedEventCopyWith<$Res> { + factory $ChannelDeletedEventCopyWith( + ChannelDeletedEvent value, + $Res Function(ChannelDeletedEvent) _then, + ) = _$ChannelDeletedEventCopyWithImpl; + @useResult + $Res call({ + ChannelResponse channel, + Map? channelCustom, + String? channelId, + int? channelMemberCount, + int? channelMessageCount, + String? channelType, + String? cid, + DateTime createdAt, + Map custom, + DateTime? receivedAt, + String? team, + String type, + UserResponseCommonFields? user, + }); +} + +/// @nodoc +class _$ChannelDeletedEventCopyWithImpl<$Res> implements $ChannelDeletedEventCopyWith<$Res> { + _$ChannelDeletedEventCopyWithImpl(this._self, this._then); + + final ChannelDeletedEvent _self; + final $Res Function(ChannelDeletedEvent) _then; + + /// Create a copy of ChannelDeletedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channel = null, + Object? channelCustom = freezed, + Object? channelId = freezed, + Object? channelMemberCount = freezed, + Object? channelMessageCount = freezed, + Object? channelType = freezed, + Object? cid = freezed, + Object? createdAt = null, + Object? custom = null, + Object? receivedAt = freezed, + Object? team = freezed, + Object? type = null, + Object? user = freezed, + }) { + return _then( + ChannelDeletedEvent( + channel: null == channel + ? _self.channel + : channel // ignore: cast_nullable_to_non_nullable + as ChannelResponse, + channelCustom: freezed == channelCustom + ? _self.channelCustom + : channelCustom // ignore: cast_nullable_to_non_nullable + as Map?, + channelId: freezed == channelId + ? _self.channelId + : channelId // ignore: cast_nullable_to_non_nullable + as String?, + channelMemberCount: freezed == channelMemberCount + ? _self.channelMemberCount + : channelMemberCount // ignore: cast_nullable_to_non_nullable + as int?, + channelMessageCount: freezed == channelMessageCount + ? _self.channelMessageCount + : channelMessageCount // ignore: cast_nullable_to_non_nullable + as int?, + channelType: freezed == channelType + ? _self.channelType + : channelType // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + team: freezed == team + ? _self.team + : team // ignore: cast_nullable_to_non_nullable + as String?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponseCommonFields?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/channel_deleted_event.g.dart b/packages/stream_chat/lib/open_api/model/channel_deleted_event.g.dart new file mode 100644 index 0000000000..af05d7ce86 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_deleted_event.g.dart @@ -0,0 +1,61 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'channel_deleted_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ChannelDeletedEvent _$ChannelDeletedEventFromJson( + Map json, +) => ChannelDeletedEvent( + channel: ChannelResponse.fromJson(json['channel'] as Map), + channelCustom: json['channel_custom'] as Map?, + channelId: json['channel_id'] as String?, + channelMemberCount: (json['channel_member_count'] as num?)?.toInt(), + channelMessageCount: (json['channel_message_count'] as num?)?.toInt(), + channelType: json['channel_type'] as String?, + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + team: json['team'] as String?, + type: json['type'] as String, + user: json['user'] == null ? null : UserResponseCommonFields.fromJson(json['user'] as Map), +); + +Map _$ChannelDeletedEventToJson( + ChannelDeletedEvent instance, +) => { + 'channel': instance.channel.toJson(), + 'channel_custom': instance.channelCustom, + 'channel_id': instance.channelId, + 'channel_member_count': instance.channelMemberCount, + 'channel_message_count': instance.channelMessageCount, + 'channel_type': instance.channelType, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'team': instance.team, + 'type': instance.type, + 'user': instance.user?.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/channel_frozen_event.dart b/packages/stream_chat/lib/open_api/model/channel_frozen_event.dart new file mode 100644 index 0000000000..846e31da94 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_frozen_event.dart @@ -0,0 +1,63 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'channel_frozen_event.g.dart'; +part 'channel_frozen_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ChannelFrozenEvent extends core.WsEvent with _$ChannelFrozenEvent { + const ChannelFrozenEvent({ + this.channelId, + this.channelType, + this.cid, + required this.createdAt, + required this.custom, + this.receivedAt, + required this.type, + }); + + @override + @JsonKey(name: 'channel_id') + final String? channelId; + + @override + @JsonKey(name: 'channel_type') + final String? channelType; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'type') + final String type; + + Map toJson() => _$ChannelFrozenEventToJson(this); + + static ChannelFrozenEvent fromJson(Map json) => _$ChannelFrozenEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/channel_frozen_event.freezed.dart b/packages/stream_chat/lib/open_api/model/channel_frozen_event.freezed.dart new file mode 100644 index 0000000000..1eaa09b1d9 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_frozen_event.freezed.dart @@ -0,0 +1,136 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'channel_frozen_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ChannelFrozenEvent { + String? get channelId; + String? get channelType; + String? get cid; + DateTime get createdAt; + Map get custom; + DateTime? get receivedAt; + String get type; + + /// Create a copy of ChannelFrozenEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ChannelFrozenEventCopyWith get copyWith => _$ChannelFrozenEventCopyWithImpl( + this as ChannelFrozenEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ChannelFrozenEvent && + (identical(other.channelId, channelId) || other.channelId == channelId) && + (identical(other.channelType, channelType) || other.channelType == channelType) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.type, type) || other.type == type)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channelId, + channelType, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + receivedAt, + type, + ); + + @override + String toString() { + return 'ChannelFrozenEvent(channelId: $channelId, channelType: $channelType, cid: $cid, createdAt: $createdAt, custom: $custom, receivedAt: $receivedAt, type: $type)'; + } +} + +/// @nodoc +abstract mixin class $ChannelFrozenEventCopyWith<$Res> { + factory $ChannelFrozenEventCopyWith( + ChannelFrozenEvent value, + $Res Function(ChannelFrozenEvent) _then, + ) = _$ChannelFrozenEventCopyWithImpl; + @useResult + $Res call({ + String? channelId, + String? channelType, + String? cid, + DateTime createdAt, + Map custom, + DateTime? receivedAt, + String type, + }); +} + +/// @nodoc +class _$ChannelFrozenEventCopyWithImpl<$Res> implements $ChannelFrozenEventCopyWith<$Res> { + _$ChannelFrozenEventCopyWithImpl(this._self, this._then); + + final ChannelFrozenEvent _self; + final $Res Function(ChannelFrozenEvent) _then; + + /// Create a copy of ChannelFrozenEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channelId = freezed, + Object? channelType = freezed, + Object? cid = freezed, + Object? createdAt = null, + Object? custom = null, + Object? receivedAt = freezed, + Object? type = null, + }) { + return _then( + ChannelFrozenEvent( + channelId: freezed == channelId + ? _self.channelId + : channelId // ignore: cast_nullable_to_non_nullable + as String?, + channelType: freezed == channelType + ? _self.channelType + : channelType // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/channel_frozen_event.g.dart b/packages/stream_chat/lib/open_api/model/channel_frozen_event.g.dart new file mode 100644 index 0000000000..3c9ae5a1cd --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_frozen_event.g.dart @@ -0,0 +1,45 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'channel_frozen_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ChannelFrozenEvent _$ChannelFrozenEventFromJson(Map json) => ChannelFrozenEvent( + channelId: json['channel_id'] as String?, + channelType: json['channel_type'] as String?, + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + type: json['type'] as String, +); + +Map _$ChannelFrozenEventToJson(ChannelFrozenEvent instance) => { + 'channel_id': instance.channelId, + 'channel_type': instance.channelType, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'type': instance.type, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/channel_get_or_create_request.dart b/packages/stream_chat/lib/open_api/model/channel_get_or_create_request.dart new file mode 100644 index 0000000000..fc7064feee --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_get_or_create_request.dart @@ -0,0 +1,76 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'channel_get_or_create_request.g.dart'; +part 'channel_get_or_create_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ChannelGetOrCreateRequest with _$ChannelGetOrCreateRequest { + const ChannelGetOrCreateRequest({ + this.data, + this.hideForCreator, + this.memberCustomInclude, + this.members, + this.messages, + this.presence, + this.state, + this.threadUnreadCounts, + this.watch, + this.watchers, + }); + + @override + @JsonKey(name: 'data') + final ChannelInput? data; + + @override + @JsonKey(name: 'hide_for_creator') + final bool? hideForCreator; + + @override + @JsonKey(name: 'member_custom_include') + final List? memberCustomInclude; + + @override + @JsonKey(name: 'members') + final PaginationParams? members; + + @override + @JsonKey(name: 'messages') + final MessagePaginationParams? messages; + + @override + @JsonKey(name: 'presence') + final bool? presence; + + @override + @JsonKey(name: 'state') + final bool? state; + + @override + @JsonKey(name: 'thread_unread_counts') + final bool? threadUnreadCounts; + + @override + @JsonKey(name: 'watch') + final bool? watch; + + @override + @JsonKey(name: 'watchers') + final PaginationParams? watchers; + + Map toJson() => _$ChannelGetOrCreateRequestToJson(this); + + static ChannelGetOrCreateRequest fromJson(Map json) => _$ChannelGetOrCreateRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/channel_get_or_create_request.freezed.dart b/packages/stream_chat/lib/open_api/model/channel_get_or_create_request.freezed.dart new file mode 100644 index 0000000000..2535a46dca --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_get_or_create_request.freezed.dart @@ -0,0 +1,168 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'channel_get_or_create_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ChannelGetOrCreateRequest { + ChannelInput? get data; + bool? get hideForCreator; + List? get memberCustomInclude; + PaginationParams? get members; + MessagePaginationParams? get messages; + bool? get presence; + bool? get state; + bool? get threadUnreadCounts; + bool? get watch; + PaginationParams? get watchers; + + /// Create a copy of ChannelGetOrCreateRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ChannelGetOrCreateRequestCopyWith get copyWith => + _$ChannelGetOrCreateRequestCopyWithImpl( + this as ChannelGetOrCreateRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ChannelGetOrCreateRequest && + (identical(other.data, data) || other.data == data) && + (identical(other.hideForCreator, hideForCreator) || other.hideForCreator == hideForCreator) && + const DeepCollectionEquality().equals( + other.memberCustomInclude, + memberCustomInclude, + ) && + (identical(other.members, members) || other.members == members) && + (identical(other.messages, messages) || other.messages == messages) && + (identical(other.presence, presence) || other.presence == presence) && + (identical(other.state, state) || other.state == state) && + (identical(other.threadUnreadCounts, threadUnreadCounts) || + other.threadUnreadCounts == threadUnreadCounts) && + (identical(other.watch, watch) || other.watch == watch) && + (identical(other.watchers, watchers) || other.watchers == watchers)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + data, + hideForCreator, + const DeepCollectionEquality().hash(memberCustomInclude), + members, + messages, + presence, + state, + threadUnreadCounts, + watch, + watchers, + ); + + @override + String toString() { + return 'ChannelGetOrCreateRequest(data: $data, hideForCreator: $hideForCreator, memberCustomInclude: $memberCustomInclude, members: $members, messages: $messages, presence: $presence, state: $state, threadUnreadCounts: $threadUnreadCounts, watch: $watch, watchers: $watchers)'; + } +} + +/// @nodoc +abstract mixin class $ChannelGetOrCreateRequestCopyWith<$Res> { + factory $ChannelGetOrCreateRequestCopyWith( + ChannelGetOrCreateRequest value, + $Res Function(ChannelGetOrCreateRequest) _then, + ) = _$ChannelGetOrCreateRequestCopyWithImpl; + @useResult + $Res call({ + ChannelInput? data, + bool? hideForCreator, + List? memberCustomInclude, + PaginationParams? members, + MessagePaginationParams? messages, + bool? presence, + bool? state, + bool? threadUnreadCounts, + bool? watch, + PaginationParams? watchers, + }); +} + +/// @nodoc +class _$ChannelGetOrCreateRequestCopyWithImpl<$Res> implements $ChannelGetOrCreateRequestCopyWith<$Res> { + _$ChannelGetOrCreateRequestCopyWithImpl(this._self, this._then); + + final ChannelGetOrCreateRequest _self; + final $Res Function(ChannelGetOrCreateRequest) _then; + + /// Create a copy of ChannelGetOrCreateRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? data = freezed, + Object? hideForCreator = freezed, + Object? memberCustomInclude = freezed, + Object? members = freezed, + Object? messages = freezed, + Object? presence = freezed, + Object? state = freezed, + Object? threadUnreadCounts = freezed, + Object? watch = freezed, + Object? watchers = freezed, + }) { + return _then( + ChannelGetOrCreateRequest( + data: freezed == data + ? _self.data + : data // ignore: cast_nullable_to_non_nullable + as ChannelInput?, + hideForCreator: freezed == hideForCreator + ? _self.hideForCreator + : hideForCreator // ignore: cast_nullable_to_non_nullable + as bool?, + memberCustomInclude: freezed == memberCustomInclude + ? _self.memberCustomInclude + : memberCustomInclude // ignore: cast_nullable_to_non_nullable + as List?, + members: freezed == members + ? _self.members + : members // ignore: cast_nullable_to_non_nullable + as PaginationParams?, + messages: freezed == messages + ? _self.messages + : messages // ignore: cast_nullable_to_non_nullable + as MessagePaginationParams?, + presence: freezed == presence + ? _self.presence + : presence // ignore: cast_nullable_to_non_nullable + as bool?, + state: freezed == state + ? _self.state + : state // ignore: cast_nullable_to_non_nullable + as bool?, + threadUnreadCounts: freezed == threadUnreadCounts + ? _self.threadUnreadCounts + : threadUnreadCounts // ignore: cast_nullable_to_non_nullable + as bool?, + watch: freezed == watch + ? _self.watch + : watch // ignore: cast_nullable_to_non_nullable + as bool?, + watchers: freezed == watchers + ? _self.watchers + : watchers // ignore: cast_nullable_to_non_nullable + as PaginationParams?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/channel_get_or_create_request.g.dart b/packages/stream_chat/lib/open_api/model/channel_get_or_create_request.g.dart new file mode 100644 index 0000000000..b4ae1531ce --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_get_or_create_request.g.dart @@ -0,0 +1,41 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'channel_get_or_create_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ChannelGetOrCreateRequest _$ChannelGetOrCreateRequestFromJson( + Map json, +) => ChannelGetOrCreateRequest( + data: json['data'] == null ? null : ChannelInput.fromJson(json['data'] as Map), + hideForCreator: json['hide_for_creator'] as bool?, + memberCustomInclude: (json['member_custom_include'] as List?)?.map((e) => e as String).toList(), + members: json['members'] == null ? null : PaginationParams.fromJson(json['members'] as Map), + messages: json['messages'] == null + ? null + : MessagePaginationParams.fromJson( + json['messages'] as Map, + ), + presence: json['presence'] as bool?, + state: json['state'] as bool?, + threadUnreadCounts: json['thread_unread_counts'] as bool?, + watch: json['watch'] as bool?, + watchers: json['watchers'] == null ? null : PaginationParams.fromJson(json['watchers'] as Map), +); + +Map _$ChannelGetOrCreateRequestToJson( + ChannelGetOrCreateRequest instance, +) => { + 'data': instance.data?.toJson(), + 'hide_for_creator': instance.hideForCreator, + 'member_custom_include': instance.memberCustomInclude, + 'members': instance.members?.toJson(), + 'messages': instance.messages?.toJson(), + 'presence': instance.presence, + 'state': instance.state, + 'thread_unread_counts': instance.threadUnreadCounts, + 'watch': instance.watch, + 'watchers': instance.watchers?.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/channel_hidden_event.dart b/packages/stream_chat/lib/open_api/model/channel_hidden_event.dart new file mode 100644 index 0000000000..ff175474d0 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_hidden_event.dart @@ -0,0 +1,98 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'channel_hidden_event.g.dart'; +part 'channel_hidden_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ChannelHiddenEvent extends core.WsEvent with _$ChannelHiddenEvent { + const ChannelHiddenEvent({ + required this.channel, + this.channelCustom, + this.channelId, + this.channelMemberCount, + this.channelMessageCount, + this.channelType, + this.cid, + required this.clearHistory, + required this.createdAt, + required this.custom, + this.receivedAt, + this.team, + required this.type, + this.user, + }); + + @override + @JsonKey(name: 'channel') + final ChannelResponse channel; + + @override + @JsonKey(name: 'channel_custom') + final Map? channelCustom; + + @override + @JsonKey(name: 'channel_id') + final String? channelId; + + @override + @JsonKey(name: 'channel_member_count') + final int? channelMemberCount; + + @override + @JsonKey(name: 'channel_message_count') + final int? channelMessageCount; + + @override + @JsonKey(name: 'channel_type') + final String? channelType; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @JsonKey(name: 'clear_history') + final bool clearHistory; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'team') + final String? team; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'user') + final UserResponseCommonFields? user; + + Map toJson() => _$ChannelHiddenEventToJson(this); + + static ChannelHiddenEvent fromJson(Map json) => _$ChannelHiddenEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/channel_hidden_event.freezed.dart b/packages/stream_chat/lib/open_api/model/channel_hidden_event.freezed.dart new file mode 100644 index 0000000000..37b8583a96 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_hidden_event.freezed.dart @@ -0,0 +1,204 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'channel_hidden_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ChannelHiddenEvent { + ChannelResponse get channel; + Map? get channelCustom; + String? get channelId; + int? get channelMemberCount; + int? get channelMessageCount; + String? get channelType; + String? get cid; + bool get clearHistory; + DateTime get createdAt; + Map get custom; + DateTime? get receivedAt; + String? get team; + String get type; + UserResponseCommonFields? get user; + + /// Create a copy of ChannelHiddenEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ChannelHiddenEventCopyWith get copyWith => _$ChannelHiddenEventCopyWithImpl( + this as ChannelHiddenEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ChannelHiddenEvent && + (identical(other.channel, channel) || other.channel == channel) && + const DeepCollectionEquality().equals( + other.channelCustom, + channelCustom, + ) && + (identical(other.channelId, channelId) || other.channelId == channelId) && + (identical(other.channelMemberCount, channelMemberCount) || + other.channelMemberCount == channelMemberCount) && + (identical(other.channelMessageCount, channelMessageCount) || + other.channelMessageCount == channelMessageCount) && + (identical(other.channelType, channelType) || other.channelType == channelType) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.clearHistory, clearHistory) || other.clearHistory == clearHistory) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.team, team) || other.team == team) && + (identical(other.type, type) || other.type == type) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channel, + const DeepCollectionEquality().hash(channelCustom), + channelId, + channelMemberCount, + channelMessageCount, + channelType, + cid, + clearHistory, + createdAt, + const DeepCollectionEquality().hash(custom), + receivedAt, + team, + type, + user, + ); + + @override + String toString() { + return 'ChannelHiddenEvent(channel: $channel, channelCustom: $channelCustom, channelId: $channelId, channelMemberCount: $channelMemberCount, channelMessageCount: $channelMessageCount, channelType: $channelType, cid: $cid, clearHistory: $clearHistory, createdAt: $createdAt, custom: $custom, receivedAt: $receivedAt, team: $team, type: $type, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $ChannelHiddenEventCopyWith<$Res> { + factory $ChannelHiddenEventCopyWith( + ChannelHiddenEvent value, + $Res Function(ChannelHiddenEvent) _then, + ) = _$ChannelHiddenEventCopyWithImpl; + @useResult + $Res call({ + ChannelResponse channel, + Map? channelCustom, + String? channelId, + int? channelMemberCount, + int? channelMessageCount, + String? channelType, + String? cid, + bool clearHistory, + DateTime createdAt, + Map custom, + DateTime? receivedAt, + String? team, + String type, + UserResponseCommonFields? user, + }); +} + +/// @nodoc +class _$ChannelHiddenEventCopyWithImpl<$Res> implements $ChannelHiddenEventCopyWith<$Res> { + _$ChannelHiddenEventCopyWithImpl(this._self, this._then); + + final ChannelHiddenEvent _self; + final $Res Function(ChannelHiddenEvent) _then; + + /// Create a copy of ChannelHiddenEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channel = null, + Object? channelCustom = freezed, + Object? channelId = freezed, + Object? channelMemberCount = freezed, + Object? channelMessageCount = freezed, + Object? channelType = freezed, + Object? cid = freezed, + Object? clearHistory = null, + Object? createdAt = null, + Object? custom = null, + Object? receivedAt = freezed, + Object? team = freezed, + Object? type = null, + Object? user = freezed, + }) { + return _then( + ChannelHiddenEvent( + channel: null == channel + ? _self.channel + : channel // ignore: cast_nullable_to_non_nullable + as ChannelResponse, + channelCustom: freezed == channelCustom + ? _self.channelCustom + : channelCustom // ignore: cast_nullable_to_non_nullable + as Map?, + channelId: freezed == channelId + ? _self.channelId + : channelId // ignore: cast_nullable_to_non_nullable + as String?, + channelMemberCount: freezed == channelMemberCount + ? _self.channelMemberCount + : channelMemberCount // ignore: cast_nullable_to_non_nullable + as int?, + channelMessageCount: freezed == channelMessageCount + ? _self.channelMessageCount + : channelMessageCount // ignore: cast_nullable_to_non_nullable + as int?, + channelType: freezed == channelType + ? _self.channelType + : channelType // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + clearHistory: null == clearHistory + ? _self.clearHistory + : clearHistory // ignore: cast_nullable_to_non_nullable + as bool, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + team: freezed == team + ? _self.team + : team // ignore: cast_nullable_to_non_nullable + as String?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponseCommonFields?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/channel_hidden_event.g.dart b/packages/stream_chat/lib/open_api/model/channel_hidden_event.g.dart new file mode 100644 index 0000000000..0f5ffce400 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_hidden_event.g.dart @@ -0,0 +1,61 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'channel_hidden_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ChannelHiddenEvent _$ChannelHiddenEventFromJson( + Map json, +) => ChannelHiddenEvent( + channel: ChannelResponse.fromJson(json['channel'] as Map), + channelCustom: json['channel_custom'] as Map?, + channelId: json['channel_id'] as String?, + channelMemberCount: (json['channel_member_count'] as num?)?.toInt(), + channelMessageCount: (json['channel_message_count'] as num?)?.toInt(), + channelType: json['channel_type'] as String?, + cid: json['cid'] as String?, + clearHistory: json['clear_history'] as bool, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + team: json['team'] as String?, + type: json['type'] as String, + user: json['user'] == null ? null : UserResponseCommonFields.fromJson(json['user'] as Map), +); + +Map _$ChannelHiddenEventToJson(ChannelHiddenEvent instance) => { + 'channel': instance.channel.toJson(), + 'channel_custom': instance.channelCustom, + 'channel_id': instance.channelId, + 'channel_member_count': instance.channelMemberCount, + 'channel_message_count': instance.channelMessageCount, + 'channel_type': instance.channelType, + 'cid': instance.cid, + 'clear_history': instance.clearHistory, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'team': instance.team, + 'type': instance.type, + 'user': instance.user?.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/channel_input.dart b/packages/stream_chat/lib/open_api/model/channel_input.dart new file mode 100644 index 0000000000..bac59312b8 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_input.dart @@ -0,0 +1,91 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'channel_input.g.dart'; +part 'channel_input.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ChannelInput with _$ChannelInput { + const ChannelInput({ + this.autoTranslationEnabled, + this.autoTranslationLanguage, + this.configOverrides, + this.createdBy, + this.createdById, + this.custom, + this.disabled, + this.filterTags, + this.frozen, + this.invites, + this.members, + this.team, + this.truncatedById, + }); + + @override + @JsonKey(name: 'auto_translation_enabled') + final bool? autoTranslationEnabled; + + @override + @JsonKey(name: 'auto_translation_language') + final String? autoTranslationLanguage; + + @override + @JsonKey(name: 'config_overrides') + final ChannelConfigOverrides? configOverrides; + + @override + @JsonKey(name: 'created_by') + final UserRequest? createdBy; + + @override + @JsonKey(name: 'created_by_id') + final String? createdById; + + @override + @JsonKey(name: 'custom') + final Map? custom; + + @override + @JsonKey(name: 'disabled') + final bool? disabled; + + @override + @JsonKey(name: 'filter_tags') + final List? filterTags; + + @override + @JsonKey(name: 'frozen') + final bool? frozen; + + @override + @JsonKey(name: 'invites') + final List? invites; + + @override + @JsonKey(name: 'members') + final List? members; + + @override + @JsonKey(name: 'team') + final String? team; + + @override + @JsonKey(name: 'truncated_by_id') + final String? truncatedById; + + Map toJson() => _$ChannelInputToJson(this); + + static ChannelInput fromJson(Map json) => _$ChannelInputFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/channel_input.freezed.dart b/packages/stream_chat/lib/open_api/model/channel_input.freezed.dart new file mode 100644 index 0000000000..e7873fa260 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_input.freezed.dart @@ -0,0 +1,198 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'channel_input.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ChannelInput { + bool? get autoTranslationEnabled; + String? get autoTranslationLanguage; + ChannelConfigOverrides? get configOverrides; + UserRequest? get createdBy; + String? get createdById; + Map? get custom; + bool? get disabled; + List? get filterTags; + bool? get frozen; + List? get invites; + List? get members; + String? get team; + String? get truncatedById; + + /// Create a copy of ChannelInput + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ChannelInputCopyWith get copyWith => _$ChannelInputCopyWithImpl( + this as ChannelInput, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ChannelInput && + (identical(other.autoTranslationEnabled, autoTranslationEnabled) || + other.autoTranslationEnabled == autoTranslationEnabled) && + (identical( + other.autoTranslationLanguage, + autoTranslationLanguage, + ) || + other.autoTranslationLanguage == autoTranslationLanguage) && + (identical(other.configOverrides, configOverrides) || other.configOverrides == configOverrides) && + (identical(other.createdBy, createdBy) || other.createdBy == createdBy) && + (identical(other.createdById, createdById) || other.createdById == createdById) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.disabled, disabled) || other.disabled == disabled) && + const DeepCollectionEquality().equals( + other.filterTags, + filterTags, + ) && + (identical(other.frozen, frozen) || other.frozen == frozen) && + const DeepCollectionEquality().equals(other.invites, invites) && + const DeepCollectionEquality().equals(other.members, members) && + (identical(other.team, team) || other.team == team) && + (identical(other.truncatedById, truncatedById) || other.truncatedById == truncatedById)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + autoTranslationEnabled, + autoTranslationLanguage, + configOverrides, + createdBy, + createdById, + const DeepCollectionEquality().hash(custom), + disabled, + const DeepCollectionEquality().hash(filterTags), + frozen, + const DeepCollectionEquality().hash(invites), + const DeepCollectionEquality().hash(members), + team, + truncatedById, + ); + + @override + String toString() { + return 'ChannelInput(autoTranslationEnabled: $autoTranslationEnabled, autoTranslationLanguage: $autoTranslationLanguage, configOverrides: $configOverrides, createdBy: $createdBy, createdById: $createdById, custom: $custom, disabled: $disabled, filterTags: $filterTags, frozen: $frozen, invites: $invites, members: $members, team: $team, truncatedById: $truncatedById)'; + } +} + +/// @nodoc +abstract mixin class $ChannelInputCopyWith<$Res> { + factory $ChannelInputCopyWith( + ChannelInput value, + $Res Function(ChannelInput) _then, + ) = _$ChannelInputCopyWithImpl; + @useResult + $Res call({ + bool? autoTranslationEnabled, + String? autoTranslationLanguage, + ChannelConfigOverrides? configOverrides, + UserRequest? createdBy, + String? createdById, + Map? custom, + bool? disabled, + List? filterTags, + bool? frozen, + List? invites, + List? members, + String? team, + String? truncatedById, + }); +} + +/// @nodoc +class _$ChannelInputCopyWithImpl<$Res> implements $ChannelInputCopyWith<$Res> { + _$ChannelInputCopyWithImpl(this._self, this._then); + + final ChannelInput _self; + final $Res Function(ChannelInput) _then; + + /// Create a copy of ChannelInput + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? autoTranslationEnabled = freezed, + Object? autoTranslationLanguage = freezed, + Object? configOverrides = freezed, + Object? createdBy = freezed, + Object? createdById = freezed, + Object? custom = freezed, + Object? disabled = freezed, + Object? filterTags = freezed, + Object? frozen = freezed, + Object? invites = freezed, + Object? members = freezed, + Object? team = freezed, + Object? truncatedById = freezed, + }) { + return _then( + ChannelInput( + autoTranslationEnabled: freezed == autoTranslationEnabled + ? _self.autoTranslationEnabled + : autoTranslationEnabled // ignore: cast_nullable_to_non_nullable + as bool?, + autoTranslationLanguage: freezed == autoTranslationLanguage + ? _self.autoTranslationLanguage + : autoTranslationLanguage // ignore: cast_nullable_to_non_nullable + as String?, + configOverrides: freezed == configOverrides + ? _self.configOverrides + : configOverrides // ignore: cast_nullable_to_non_nullable + as ChannelConfigOverrides?, + createdBy: freezed == createdBy + ? _self.createdBy + : createdBy // ignore: cast_nullable_to_non_nullable + as UserRequest?, + createdById: freezed == createdById + ? _self.createdById + : createdById // ignore: cast_nullable_to_non_nullable + as String?, + custom: freezed == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map?, + disabled: freezed == disabled + ? _self.disabled + : disabled // ignore: cast_nullable_to_non_nullable + as bool?, + filterTags: freezed == filterTags + ? _self.filterTags + : filterTags // ignore: cast_nullable_to_non_nullable + as List?, + frozen: freezed == frozen + ? _self.frozen + : frozen // ignore: cast_nullable_to_non_nullable + as bool?, + invites: freezed == invites + ? _self.invites + : invites // ignore: cast_nullable_to_non_nullable + as List?, + members: freezed == members + ? _self.members + : members // ignore: cast_nullable_to_non_nullable + as List?, + team: freezed == team + ? _self.team + : team // ignore: cast_nullable_to_non_nullable + as String?, + truncatedById: freezed == truncatedById + ? _self.truncatedById + : truncatedById // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/channel_input.g.dart b/packages/stream_chat/lib/open_api/model/channel_input.g.dart new file mode 100644 index 0000000000..4f4dcf836d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_input.g.dart @@ -0,0 +1,47 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'channel_input.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ChannelInput _$ChannelInputFromJson(Map json) => ChannelInput( + autoTranslationEnabled: json['auto_translation_enabled'] as bool?, + autoTranslationLanguage: json['auto_translation_language'] as String?, + configOverrides: json['config_overrides'] == null + ? null + : ChannelConfigOverrides.fromJson( + json['config_overrides'] as Map, + ), + createdBy: json['created_by'] == null ? null : UserRequest.fromJson(json['created_by'] as Map), + createdById: json['created_by_id'] as String?, + custom: json['custom'] as Map?, + disabled: json['disabled'] as bool?, + filterTags: (json['filter_tags'] as List?)?.map((e) => e as String).toList(), + frozen: json['frozen'] as bool?, + invites: (json['invites'] as List?) + ?.map((e) => ChannelMemberRequest.fromJson(e as Map)) + .toList(), + members: (json['members'] as List?) + ?.map((e) => ChannelMemberRequest.fromJson(e as Map)) + .toList(), + team: json['team'] as String?, + truncatedById: json['truncated_by_id'] as String?, +); + +Map _$ChannelInputToJson(ChannelInput instance) => { + 'auto_translation_enabled': instance.autoTranslationEnabled, + 'auto_translation_language': instance.autoTranslationLanguage, + 'config_overrides': instance.configOverrides?.toJson(), + 'created_by': instance.createdBy?.toJson(), + 'created_by_id': instance.createdById, + 'custom': instance.custom, + 'disabled': instance.disabled, + 'filter_tags': instance.filterTags, + 'frozen': instance.frozen, + 'invites': instance.invites?.map((e) => e.toJson()).toList(), + 'members': instance.members?.map((e) => e.toJson()).toList(), + 'team': instance.team, + 'truncated_by_id': instance.truncatedById, +}; diff --git a/packages/stream_chat/lib/open_api/model/channel_input_request.dart b/packages/stream_chat/lib/open_api/model/channel_input_request.dart new file mode 100644 index 0000000000..c2308c36cd --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_input_request.dart @@ -0,0 +1,76 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'channel_input_request.g.dart'; +part 'channel_input_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ChannelInputRequest with _$ChannelInputRequest { + const ChannelInputRequest({ + this.autoTranslationEnabled, + this.autoTranslationLanguage, + this.configOverrides, + this.createdBy, + this.custom, + this.disabled, + this.frozen, + this.invites, + this.members, + this.team, + }); + + @override + @JsonKey(name: 'auto_translation_enabled') + final bool? autoTranslationEnabled; + + @override + @JsonKey(name: 'auto_translation_language') + final String? autoTranslationLanguage; + + @override + @JsonKey(name: 'config_overrides') + final ConfigOverridesRequest? configOverrides; + + @override + @JsonKey(name: 'created_by') + final UserRequest? createdBy; + + @override + @JsonKey(name: 'custom') + final Map? custom; + + @override + @JsonKey(name: 'disabled') + final bool? disabled; + + @override + @JsonKey(name: 'frozen') + final bool? frozen; + + @override + @JsonKey(name: 'invites') + final List? invites; + + @override + @JsonKey(name: 'members') + final List? members; + + @override + @JsonKey(name: 'team') + final String? team; + + Map toJson() => _$ChannelInputRequestToJson(this); + + static ChannelInputRequest fromJson(Map json) => _$ChannelInputRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/channel_input_request.freezed.dart b/packages/stream_chat/lib/open_api/model/channel_input_request.freezed.dart new file mode 100644 index 0000000000..2f1b619856 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_input_request.freezed.dart @@ -0,0 +1,169 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'channel_input_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ChannelInputRequest { + bool? get autoTranslationEnabled; + String? get autoTranslationLanguage; + ConfigOverridesRequest? get configOverrides; + UserRequest? get createdBy; + Map? get custom; + bool? get disabled; + bool? get frozen; + List? get invites; + List? get members; + String? get team; + + /// Create a copy of ChannelInputRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ChannelInputRequestCopyWith get copyWith => + _$ChannelInputRequestCopyWithImpl( + this as ChannelInputRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ChannelInputRequest && + (identical(other.autoTranslationEnabled, autoTranslationEnabled) || + other.autoTranslationEnabled == autoTranslationEnabled) && + (identical( + other.autoTranslationLanguage, + autoTranslationLanguage, + ) || + other.autoTranslationLanguage == autoTranslationLanguage) && + (identical(other.configOverrides, configOverrides) || other.configOverrides == configOverrides) && + (identical(other.createdBy, createdBy) || other.createdBy == createdBy) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.disabled, disabled) || other.disabled == disabled) && + (identical(other.frozen, frozen) || other.frozen == frozen) && + const DeepCollectionEquality().equals(other.invites, invites) && + const DeepCollectionEquality().equals(other.members, members) && + (identical(other.team, team) || other.team == team)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + autoTranslationEnabled, + autoTranslationLanguage, + configOverrides, + createdBy, + const DeepCollectionEquality().hash(custom), + disabled, + frozen, + const DeepCollectionEquality().hash(invites), + const DeepCollectionEquality().hash(members), + team, + ); + + @override + String toString() { + return 'ChannelInputRequest(autoTranslationEnabled: $autoTranslationEnabled, autoTranslationLanguage: $autoTranslationLanguage, configOverrides: $configOverrides, createdBy: $createdBy, custom: $custom, disabled: $disabled, frozen: $frozen, invites: $invites, members: $members, team: $team)'; + } +} + +/// @nodoc +abstract mixin class $ChannelInputRequestCopyWith<$Res> { + factory $ChannelInputRequestCopyWith( + ChannelInputRequest value, + $Res Function(ChannelInputRequest) _then, + ) = _$ChannelInputRequestCopyWithImpl; + @useResult + $Res call({ + bool? autoTranslationEnabled, + String? autoTranslationLanguage, + ConfigOverridesRequest? configOverrides, + UserRequest? createdBy, + Map? custom, + bool? disabled, + bool? frozen, + List? invites, + List? members, + String? team, + }); +} + +/// @nodoc +class _$ChannelInputRequestCopyWithImpl<$Res> implements $ChannelInputRequestCopyWith<$Res> { + _$ChannelInputRequestCopyWithImpl(this._self, this._then); + + final ChannelInputRequest _self; + final $Res Function(ChannelInputRequest) _then; + + /// Create a copy of ChannelInputRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? autoTranslationEnabled = freezed, + Object? autoTranslationLanguage = freezed, + Object? configOverrides = freezed, + Object? createdBy = freezed, + Object? custom = freezed, + Object? disabled = freezed, + Object? frozen = freezed, + Object? invites = freezed, + Object? members = freezed, + Object? team = freezed, + }) { + return _then( + ChannelInputRequest( + autoTranslationEnabled: freezed == autoTranslationEnabled + ? _self.autoTranslationEnabled + : autoTranslationEnabled // ignore: cast_nullable_to_non_nullable + as bool?, + autoTranslationLanguage: freezed == autoTranslationLanguage + ? _self.autoTranslationLanguage + : autoTranslationLanguage // ignore: cast_nullable_to_non_nullable + as String?, + configOverrides: freezed == configOverrides + ? _self.configOverrides + : configOverrides // ignore: cast_nullable_to_non_nullable + as ConfigOverridesRequest?, + createdBy: freezed == createdBy + ? _self.createdBy + : createdBy // ignore: cast_nullable_to_non_nullable + as UserRequest?, + custom: freezed == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map?, + disabled: freezed == disabled + ? _self.disabled + : disabled // ignore: cast_nullable_to_non_nullable + as bool?, + frozen: freezed == frozen + ? _self.frozen + : frozen // ignore: cast_nullable_to_non_nullable + as bool?, + invites: freezed == invites + ? _self.invites + : invites // ignore: cast_nullable_to_non_nullable + as List?, + members: freezed == members + ? _self.members + : members // ignore: cast_nullable_to_non_nullable + as List?, + team: freezed == team + ? _self.team + : team // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/channel_input_request.g.dart b/packages/stream_chat/lib/open_api/model/channel_input_request.g.dart new file mode 100644 index 0000000000..5dbf292e09 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_input_request.g.dart @@ -0,0 +1,43 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'channel_input_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ChannelInputRequest _$ChannelInputRequestFromJson(Map json) => ChannelInputRequest( + autoTranslationEnabled: json['auto_translation_enabled'] as bool?, + autoTranslationLanguage: json['auto_translation_language'] as String?, + configOverrides: json['config_overrides'] == null + ? null + : ConfigOverridesRequest.fromJson( + json['config_overrides'] as Map, + ), + createdBy: json['created_by'] == null ? null : UserRequest.fromJson(json['created_by'] as Map), + custom: json['custom'] as Map?, + disabled: json['disabled'] as bool?, + frozen: json['frozen'] as bool?, + invites: (json['invites'] as List?) + ?.map((e) => ChannelMemberRequest.fromJson(e as Map)) + .toList(), + members: (json['members'] as List?) + ?.map((e) => ChannelMemberRequest.fromJson(e as Map)) + .toList(), + team: json['team'] as String?, +); + +Map _$ChannelInputRequestToJson( + ChannelInputRequest instance, +) => { + 'auto_translation_enabled': instance.autoTranslationEnabled, + 'auto_translation_language': instance.autoTranslationLanguage, + 'config_overrides': instance.configOverrides?.toJson(), + 'created_by': instance.createdBy?.toJson(), + 'custom': instance.custom, + 'disabled': instance.disabled, + 'frozen': instance.frozen, + 'invites': instance.invites?.map((e) => e.toJson()).toList(), + 'members': instance.members?.map((e) => e.toJson()).toList(), + 'team': instance.team, +}; diff --git a/packages/stream_chat/lib/open_api/model/channel_kicked_event.dart b/packages/stream_chat/lib/open_api/model/channel_kicked_event.dart new file mode 100644 index 0000000000..b94546220b --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_kicked_event.dart @@ -0,0 +1,83 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'channel_kicked_event.g.dart'; +part 'channel_kicked_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ChannelKickedEvent extends core.WsEvent with _$ChannelKickedEvent { + const ChannelKickedEvent({ + this.channelCustom, + this.channelId, + this.channelMemberCount, + this.channelMessageCount, + this.channelType, + this.cid, + required this.createdAt, + required this.custom, + this.receivedAt, + this.team, + required this.type, + }); + + @override + @JsonKey(name: 'channel_custom') + final Map? channelCustom; + + @override + @JsonKey(name: 'channel_id') + final String? channelId; + + @override + @JsonKey(name: 'channel_member_count') + final int? channelMemberCount; + + @override + @JsonKey(name: 'channel_message_count') + final int? channelMessageCount; + + @override + @JsonKey(name: 'channel_type') + final String? channelType; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'team') + final String? team; + + @override + @JsonKey(name: 'type') + final String type; + + Map toJson() => _$ChannelKickedEventToJson(this); + + static ChannelKickedEvent fromJson(Map json) => _$ChannelKickedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/channel_kicked_event.freezed.dart b/packages/stream_chat/lib/open_api/model/channel_kicked_event.freezed.dart new file mode 100644 index 0000000000..931a71173f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_kicked_event.freezed.dart @@ -0,0 +1,177 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'channel_kicked_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ChannelKickedEvent { + Map? get channelCustom; + String? get channelId; + int? get channelMemberCount; + int? get channelMessageCount; + String? get channelType; + String? get cid; + DateTime get createdAt; + Map get custom; + DateTime? get receivedAt; + String? get team; + String get type; + + /// Create a copy of ChannelKickedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ChannelKickedEventCopyWith get copyWith => _$ChannelKickedEventCopyWithImpl( + this as ChannelKickedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ChannelKickedEvent && + const DeepCollectionEquality().equals( + other.channelCustom, + channelCustom, + ) && + (identical(other.channelId, channelId) || other.channelId == channelId) && + (identical(other.channelMemberCount, channelMemberCount) || + other.channelMemberCount == channelMemberCount) && + (identical(other.channelMessageCount, channelMessageCount) || + other.channelMessageCount == channelMessageCount) && + (identical(other.channelType, channelType) || other.channelType == channelType) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.team, team) || other.team == team) && + (identical(other.type, type) || other.type == type)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(channelCustom), + channelId, + channelMemberCount, + channelMessageCount, + channelType, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + receivedAt, + team, + type, + ); + + @override + String toString() { + return 'ChannelKickedEvent(channelCustom: $channelCustom, channelId: $channelId, channelMemberCount: $channelMemberCount, channelMessageCount: $channelMessageCount, channelType: $channelType, cid: $cid, createdAt: $createdAt, custom: $custom, receivedAt: $receivedAt, team: $team, type: $type)'; + } +} + +/// @nodoc +abstract mixin class $ChannelKickedEventCopyWith<$Res> { + factory $ChannelKickedEventCopyWith( + ChannelKickedEvent value, + $Res Function(ChannelKickedEvent) _then, + ) = _$ChannelKickedEventCopyWithImpl; + @useResult + $Res call({ + Map? channelCustom, + String? channelId, + int? channelMemberCount, + int? channelMessageCount, + String? channelType, + String? cid, + DateTime createdAt, + Map custom, + DateTime? receivedAt, + String? team, + String type, + }); +} + +/// @nodoc +class _$ChannelKickedEventCopyWithImpl<$Res> implements $ChannelKickedEventCopyWith<$Res> { + _$ChannelKickedEventCopyWithImpl(this._self, this._then); + + final ChannelKickedEvent _self; + final $Res Function(ChannelKickedEvent) _then; + + /// Create a copy of ChannelKickedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channelCustom = freezed, + Object? channelId = freezed, + Object? channelMemberCount = freezed, + Object? channelMessageCount = freezed, + Object? channelType = freezed, + Object? cid = freezed, + Object? createdAt = null, + Object? custom = null, + Object? receivedAt = freezed, + Object? team = freezed, + Object? type = null, + }) { + return _then( + ChannelKickedEvent( + channelCustom: freezed == channelCustom + ? _self.channelCustom + : channelCustom // ignore: cast_nullable_to_non_nullable + as Map?, + channelId: freezed == channelId + ? _self.channelId + : channelId // ignore: cast_nullable_to_non_nullable + as String?, + channelMemberCount: freezed == channelMemberCount + ? _self.channelMemberCount + : channelMemberCount // ignore: cast_nullable_to_non_nullable + as int?, + channelMessageCount: freezed == channelMessageCount + ? _self.channelMessageCount + : channelMessageCount // ignore: cast_nullable_to_non_nullable + as int?, + channelType: freezed == channelType + ? _self.channelType + : channelType // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + team: freezed == team + ? _self.team + : team // ignore: cast_nullable_to_non_nullable + as String?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/channel_kicked_event.g.dart b/packages/stream_chat/lib/open_api/model/channel_kicked_event.g.dart new file mode 100644 index 0000000000..11176ec86a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_kicked_event.g.dart @@ -0,0 +1,53 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'channel_kicked_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ChannelKickedEvent _$ChannelKickedEventFromJson(Map json) => ChannelKickedEvent( + channelCustom: json['channel_custom'] as Map?, + channelId: json['channel_id'] as String?, + channelMemberCount: (json['channel_member_count'] as num?)?.toInt(), + channelMessageCount: (json['channel_message_count'] as num?)?.toInt(), + channelType: json['channel_type'] as String?, + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + team: json['team'] as String?, + type: json['type'] as String, +); + +Map _$ChannelKickedEventToJson(ChannelKickedEvent instance) => { + 'channel_custom': instance.channelCustom, + 'channel_id': instance.channelId, + 'channel_member_count': instance.channelMemberCount, + 'channel_message_count': instance.channelMessageCount, + 'channel_type': instance.channelType, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'team': instance.team, + 'type': instance.type, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/channel_member_partial_response.dart b/packages/stream_chat/lib/open_api/model/channel_member_partial_response.dart new file mode 100644 index 0000000000..20cb9ba264 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_member_partial_response.dart @@ -0,0 +1,42 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'channel_member_partial_response.g.dart'; +part 'channel_member_partial_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ChannelMemberPartialResponse with _$ChannelMemberPartialResponse { + const ChannelMemberPartialResponse({ + required this.channelRole, + this.custom, + required this.notificationsMuted, + }); + + @override + @JsonKey(name: 'channel_role') + final String channelRole; + + @override + @JsonKey(name: 'custom') + final Map? custom; + + @override + @JsonKey(name: 'notifications_muted') + final bool notificationsMuted; + + Map toJson() => _$ChannelMemberPartialResponseToJson(this); + + static ChannelMemberPartialResponse fromJson(Map json) => + _$ChannelMemberPartialResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/channel_member_partial_response.freezed.dart b/packages/stream_chat/lib/open_api/model/channel_member_partial_response.freezed.dart new file mode 100644 index 0000000000..f440ebed57 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_member_partial_response.freezed.dart @@ -0,0 +1,102 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'channel_member_partial_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ChannelMemberPartialResponse { + String get channelRole; + Map? get custom; + bool get notificationsMuted; + + /// Create a copy of ChannelMemberPartialResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ChannelMemberPartialResponseCopyWith get copyWith => + _$ChannelMemberPartialResponseCopyWithImpl( + this as ChannelMemberPartialResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ChannelMemberPartialResponse && + (identical(other.channelRole, channelRole) || other.channelRole == channelRole) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.notificationsMuted, notificationsMuted) || + other.notificationsMuted == notificationsMuted)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channelRole, + const DeepCollectionEquality().hash(custom), + notificationsMuted, + ); + + @override + String toString() { + return 'ChannelMemberPartialResponse(channelRole: $channelRole, custom: $custom, notificationsMuted: $notificationsMuted)'; + } +} + +/// @nodoc +abstract mixin class $ChannelMemberPartialResponseCopyWith<$Res> { + factory $ChannelMemberPartialResponseCopyWith( + ChannelMemberPartialResponse value, + $Res Function(ChannelMemberPartialResponse) _then, + ) = _$ChannelMemberPartialResponseCopyWithImpl; + @useResult + $Res call({ + String channelRole, + Map? custom, + bool notificationsMuted, + }); +} + +/// @nodoc +class _$ChannelMemberPartialResponseCopyWithImpl<$Res> implements $ChannelMemberPartialResponseCopyWith<$Res> { + _$ChannelMemberPartialResponseCopyWithImpl(this._self, this._then); + + final ChannelMemberPartialResponse _self; + final $Res Function(ChannelMemberPartialResponse) _then; + + /// Create a copy of ChannelMemberPartialResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channelRole = null, + Object? custom = freezed, + Object? notificationsMuted = null, + }) { + return _then( + ChannelMemberPartialResponse( + channelRole: null == channelRole + ? _self.channelRole + : channelRole // ignore: cast_nullable_to_non_nullable + as String, + custom: freezed == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map?, + notificationsMuted: null == notificationsMuted + ? _self.notificationsMuted + : notificationsMuted // ignore: cast_nullable_to_non_nullable + as bool, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/channel_member_partial_response.g.dart b/packages/stream_chat/lib/open_api/model/channel_member_partial_response.g.dart new file mode 100644 index 0000000000..928f52e331 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_member_partial_response.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'channel_member_partial_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ChannelMemberPartialResponse _$ChannelMemberPartialResponseFromJson( + Map json, +) => ChannelMemberPartialResponse( + channelRole: json['channel_role'] as String, + custom: json['custom'] as Map?, + notificationsMuted: json['notifications_muted'] as bool, +); + +Map _$ChannelMemberPartialResponseToJson( + ChannelMemberPartialResponse instance, +) => { + 'channel_role': instance.channelRole, + 'custom': instance.custom, + 'notifications_muted': instance.notificationsMuted, +}; diff --git a/packages/stream_chat/lib/open_api/model/channel_member_request.dart b/packages/stream_chat/lib/open_api/model/channel_member_request.dart new file mode 100644 index 0000000000..a2db75d203 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_member_request.dart @@ -0,0 +1,46 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'channel_member_request.g.dart'; +part 'channel_member_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ChannelMemberRequest with _$ChannelMemberRequest { + const ChannelMemberRequest({ + this.channelRole, + this.custom, + this.user, + this.userId, + }); + + @override + @JsonKey(name: 'channel_role') + final String? channelRole; + + @override + @JsonKey(name: 'custom') + final Map? custom; + + @override + @JsonKey(name: 'user') + final MemberUserRequest? user; + + @override + @JsonKey(name: 'user_id') + final String? userId; + + Map toJson() => _$ChannelMemberRequestToJson(this); + + static ChannelMemberRequest fromJson(Map json) => _$ChannelMemberRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/channel_member_request.freezed.dart b/packages/stream_chat/lib/open_api/model/channel_member_request.freezed.dart new file mode 100644 index 0000000000..83c557a104 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_member_request.freezed.dart @@ -0,0 +1,110 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'channel_member_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ChannelMemberRequest { + String? get channelRole; + Map? get custom; + MemberUserRequest? get user; + String? get userId; + + /// Create a copy of ChannelMemberRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ChannelMemberRequestCopyWith get copyWith => + _$ChannelMemberRequestCopyWithImpl( + this as ChannelMemberRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ChannelMemberRequest && + (identical(other.channelRole, channelRole) || other.channelRole == channelRole) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.user, user) || other.user == user) && + (identical(other.userId, userId) || other.userId == userId)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channelRole, + const DeepCollectionEquality().hash(custom), + user, + userId, + ); + + @override + String toString() { + return 'ChannelMemberRequest(channelRole: $channelRole, custom: $custom, user: $user, userId: $userId)'; + } +} + +/// @nodoc +abstract mixin class $ChannelMemberRequestCopyWith<$Res> { + factory $ChannelMemberRequestCopyWith( + ChannelMemberRequest value, + $Res Function(ChannelMemberRequest) _then, + ) = _$ChannelMemberRequestCopyWithImpl; + @useResult + $Res call({ + String? channelRole, + Map? custom, + MemberUserRequest? user, + String? userId, + }); +} + +/// @nodoc +class _$ChannelMemberRequestCopyWithImpl<$Res> implements $ChannelMemberRequestCopyWith<$Res> { + _$ChannelMemberRequestCopyWithImpl(this._self, this._then); + + final ChannelMemberRequest _self; + final $Res Function(ChannelMemberRequest) _then; + + /// Create a copy of ChannelMemberRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channelRole = freezed, + Object? custom = freezed, + Object? user = freezed, + Object? userId = freezed, + }) { + return _then( + ChannelMemberRequest( + channelRole: freezed == channelRole + ? _self.channelRole + : channelRole // ignore: cast_nullable_to_non_nullable + as String?, + custom: freezed == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map?, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as MemberUserRequest?, + userId: freezed == userId + ? _self.userId + : userId // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/channel_member_request.g.dart b/packages/stream_chat/lib/open_api/model/channel_member_request.g.dart new file mode 100644 index 0000000000..f40aa837e3 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_member_request.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'channel_member_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ChannelMemberRequest _$ChannelMemberRequestFromJson( + Map json, +) => ChannelMemberRequest( + channelRole: json['channel_role'] as String?, + custom: json['custom'] as Map?, + user: json['user'] == null ? null : MemberUserRequest.fromJson(json['user'] as Map), + userId: json['user_id'] as String?, +); + +Map _$ChannelMemberRequestToJson( + ChannelMemberRequest instance, +) => { + 'channel_role': instance.channelRole, + 'custom': instance.custom, + 'user': instance.user?.toJson(), + 'user_id': instance.userId, +}; diff --git a/packages/stream_chat/lib/open_api/model/channel_member_response.dart b/packages/stream_chat/lib/open_api/model/channel_member_response.dart new file mode 100644 index 0000000000..7faccd68f2 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_member_response.dart @@ -0,0 +1,145 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'channel_member_response.g.dart'; +part 'channel_member_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ChannelMemberResponse with _$ChannelMemberResponse { + const ChannelMemberResponse({ + this.archivedAt, + this.banExpires, + this.banFromFutureChannels, + required this.banned, + required this.channelRole, + required this.createdAt, + required this.custom, + this.deletedAt, + this.deletedMessages, + this.futureChannelBanExpires, + this.inviteAcceptedAt, + this.inviteRejectedAt, + this.invited, + this.isModerator, + required this.notificationsMuted, + this.pinnedAt, + this.role, + required this.shadowBanned, + this.status, + required this.updatedAt, + this.user, + this.userId, + }); + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'archived_at') + final DateTime? archivedAt; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'ban_expires') + final DateTime? banExpires; + + @override + @JsonKey(name: 'ban_from_future_channels') + final bool? banFromFutureChannels; + + @override + @JsonKey(name: 'banned') + final bool banned; + + @override + @JsonKey(name: 'channel_role') + final String channelRole; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'deleted_at') + final DateTime? deletedAt; + + @override + @JsonKey(name: 'deleted_messages') + final List? deletedMessages; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'future_channel_ban_expires') + final DateTime? futureChannelBanExpires; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'invite_accepted_at') + final DateTime? inviteAcceptedAt; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'invite_rejected_at') + final DateTime? inviteRejectedAt; + + @override + @JsonKey(name: 'invited') + final bool? invited; + + @override + @JsonKey(name: 'is_moderator') + final bool? isModerator; + + @override + @JsonKey(name: 'notifications_muted') + final bool notificationsMuted; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'pinned_at') + final DateTime? pinnedAt; + + @override + @JsonKey(name: 'role') + final String? role; + + @override + @JsonKey(name: 'shadow_banned') + final bool shadowBanned; + + @override + @JsonKey(name: 'status') + final String? status; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'updated_at') + final DateTime updatedAt; + + @override + @JsonKey(name: 'user') + final UserResponse? user; + + @override + @JsonKey(name: 'user_id') + final String? userId; + + Map toJson() => _$ChannelMemberResponseToJson(this); + + static ChannelMemberResponse fromJson(Map json) => _$ChannelMemberResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/channel_member_response.freezed.dart b/packages/stream_chat/lib/open_api/model/channel_member_response.freezed.dart new file mode 100644 index 0000000000..3a4e0fae89 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_member_response.freezed.dart @@ -0,0 +1,281 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'channel_member_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ChannelMemberResponse { + DateTime? get archivedAt; + DateTime? get banExpires; + bool? get banFromFutureChannels; + bool get banned; + String get channelRole; + DateTime get createdAt; + Map get custom; + DateTime? get deletedAt; + List? get deletedMessages; + DateTime? get futureChannelBanExpires; + DateTime? get inviteAcceptedAt; + DateTime? get inviteRejectedAt; + bool? get invited; + bool? get isModerator; + bool get notificationsMuted; + DateTime? get pinnedAt; + String? get role; + bool get shadowBanned; + String? get status; + DateTime get updatedAt; + UserResponse? get user; + String? get userId; + + /// Create a copy of ChannelMemberResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ChannelMemberResponseCopyWith get copyWith => + _$ChannelMemberResponseCopyWithImpl( + this as ChannelMemberResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ChannelMemberResponse && + (identical(other.archivedAt, archivedAt) || other.archivedAt == archivedAt) && + (identical(other.banExpires, banExpires) || other.banExpires == banExpires) && + (identical(other.banFromFutureChannels, banFromFutureChannels) || + other.banFromFutureChannels == banFromFutureChannels) && + (identical(other.banned, banned) || other.banned == banned) && + (identical(other.channelRole, channelRole) || other.channelRole == channelRole) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt) && + const DeepCollectionEquality().equals( + other.deletedMessages, + deletedMessages, + ) && + (identical( + other.futureChannelBanExpires, + futureChannelBanExpires, + ) || + other.futureChannelBanExpires == futureChannelBanExpires) && + (identical(other.inviteAcceptedAt, inviteAcceptedAt) || other.inviteAcceptedAt == inviteAcceptedAt) && + (identical(other.inviteRejectedAt, inviteRejectedAt) || other.inviteRejectedAt == inviteRejectedAt) && + (identical(other.invited, invited) || other.invited == invited) && + (identical(other.isModerator, isModerator) || other.isModerator == isModerator) && + (identical(other.notificationsMuted, notificationsMuted) || + other.notificationsMuted == notificationsMuted) && + (identical(other.pinnedAt, pinnedAt) || other.pinnedAt == pinnedAt) && + (identical(other.role, role) || other.role == role) && + (identical(other.shadowBanned, shadowBanned) || other.shadowBanned == shadowBanned) && + (identical(other.status, status) || other.status == status) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt) && + (identical(other.user, user) || other.user == user) && + (identical(other.userId, userId) || other.userId == userId)); + } + + @override + int get hashCode => Object.hashAll([ + runtimeType, + archivedAt, + banExpires, + banFromFutureChannels, + banned, + channelRole, + createdAt, + const DeepCollectionEquality().hash(custom), + deletedAt, + const DeepCollectionEquality().hash(deletedMessages), + futureChannelBanExpires, + inviteAcceptedAt, + inviteRejectedAt, + invited, + isModerator, + notificationsMuted, + pinnedAt, + role, + shadowBanned, + status, + updatedAt, + user, + userId, + ]); + + @override + String toString() { + return 'ChannelMemberResponse(archivedAt: $archivedAt, banExpires: $banExpires, banFromFutureChannels: $banFromFutureChannels, banned: $banned, channelRole: $channelRole, createdAt: $createdAt, custom: $custom, deletedAt: $deletedAt, deletedMessages: $deletedMessages, futureChannelBanExpires: $futureChannelBanExpires, inviteAcceptedAt: $inviteAcceptedAt, inviteRejectedAt: $inviteRejectedAt, invited: $invited, isModerator: $isModerator, notificationsMuted: $notificationsMuted, pinnedAt: $pinnedAt, role: $role, shadowBanned: $shadowBanned, status: $status, updatedAt: $updatedAt, user: $user, userId: $userId)'; + } +} + +/// @nodoc +abstract mixin class $ChannelMemberResponseCopyWith<$Res> { + factory $ChannelMemberResponseCopyWith( + ChannelMemberResponse value, + $Res Function(ChannelMemberResponse) _then, + ) = _$ChannelMemberResponseCopyWithImpl; + @useResult + $Res call({ + DateTime? archivedAt, + DateTime? banExpires, + bool? banFromFutureChannels, + bool banned, + String channelRole, + DateTime createdAt, + Map custom, + DateTime? deletedAt, + List? deletedMessages, + DateTime? futureChannelBanExpires, + DateTime? inviteAcceptedAt, + DateTime? inviteRejectedAt, + bool? invited, + bool? isModerator, + bool notificationsMuted, + DateTime? pinnedAt, + String? role, + bool shadowBanned, + String? status, + DateTime updatedAt, + UserResponse? user, + String? userId, + }); +} + +/// @nodoc +class _$ChannelMemberResponseCopyWithImpl<$Res> implements $ChannelMemberResponseCopyWith<$Res> { + _$ChannelMemberResponseCopyWithImpl(this._self, this._then); + + final ChannelMemberResponse _self; + final $Res Function(ChannelMemberResponse) _then; + + /// Create a copy of ChannelMemberResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? archivedAt = freezed, + Object? banExpires = freezed, + Object? banFromFutureChannels = freezed, + Object? banned = null, + Object? channelRole = null, + Object? createdAt = null, + Object? custom = null, + Object? deletedAt = freezed, + Object? deletedMessages = freezed, + Object? futureChannelBanExpires = freezed, + Object? inviteAcceptedAt = freezed, + Object? inviteRejectedAt = freezed, + Object? invited = freezed, + Object? isModerator = freezed, + Object? notificationsMuted = null, + Object? pinnedAt = freezed, + Object? role = freezed, + Object? shadowBanned = null, + Object? status = freezed, + Object? updatedAt = null, + Object? user = freezed, + Object? userId = freezed, + }) { + return _then( + ChannelMemberResponse( + archivedAt: freezed == archivedAt + ? _self.archivedAt + : archivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + banExpires: freezed == banExpires + ? _self.banExpires + : banExpires // ignore: cast_nullable_to_non_nullable + as DateTime?, + banFromFutureChannels: freezed == banFromFutureChannels + ? _self.banFromFutureChannels + : banFromFutureChannels // ignore: cast_nullable_to_non_nullable + as bool?, + banned: null == banned + ? _self.banned + : banned // ignore: cast_nullable_to_non_nullable + as bool, + channelRole: null == channelRole + ? _self.channelRole + : channelRole // ignore: cast_nullable_to_non_nullable + as String, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + deletedAt: freezed == deletedAt + ? _self.deletedAt + : deletedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + deletedMessages: freezed == deletedMessages + ? _self.deletedMessages + : deletedMessages // ignore: cast_nullable_to_non_nullable + as List?, + futureChannelBanExpires: freezed == futureChannelBanExpires + ? _self.futureChannelBanExpires + : futureChannelBanExpires // ignore: cast_nullable_to_non_nullable + as DateTime?, + inviteAcceptedAt: freezed == inviteAcceptedAt + ? _self.inviteAcceptedAt + : inviteAcceptedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + inviteRejectedAt: freezed == inviteRejectedAt + ? _self.inviteRejectedAt + : inviteRejectedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + invited: freezed == invited + ? _self.invited + : invited // ignore: cast_nullable_to_non_nullable + as bool?, + isModerator: freezed == isModerator + ? _self.isModerator + : isModerator // ignore: cast_nullable_to_non_nullable + as bool?, + notificationsMuted: null == notificationsMuted + ? _self.notificationsMuted + : notificationsMuted // ignore: cast_nullable_to_non_nullable + as bool, + pinnedAt: freezed == pinnedAt + ? _self.pinnedAt + : pinnedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + role: freezed == role + ? _self.role + : role // ignore: cast_nullable_to_non_nullable + as String?, + shadowBanned: null == shadowBanned + ? _self.shadowBanned + : shadowBanned // ignore: cast_nullable_to_non_nullable + as bool, + status: freezed == status + ? _self.status + : status // ignore: cast_nullable_to_non_nullable + as String?, + updatedAt: null == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponse?, + userId: freezed == userId + ? _self.userId + : userId // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/channel_member_response.g.dart b/packages/stream_chat/lib/open_api/model/channel_member_response.g.dart new file mode 100644 index 0000000000..afae5f7bc6 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_member_response.g.dart @@ -0,0 +1,117 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'channel_member_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ChannelMemberResponse _$ChannelMemberResponseFromJson( + Map json, +) => ChannelMemberResponse( + archivedAt: _$JsonConverterFromJson( + json['archived_at'], + const StreamDateTimeConverter().fromJson, + ), + banExpires: _$JsonConverterFromJson( + json['ban_expires'], + const StreamDateTimeConverter().fromJson, + ), + banFromFutureChannels: json['ban_from_future_channels'] as bool?, + banned: json['banned'] as bool, + channelRole: json['channel_role'] as String, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + deletedAt: _$JsonConverterFromJson( + json['deleted_at'], + const StreamDateTimeConverter().fromJson, + ), + deletedMessages: (json['deleted_messages'] as List?)?.map((e) => e as String).toList(), + futureChannelBanExpires: _$JsonConverterFromJson( + json['future_channel_ban_expires'], + const StreamDateTimeConverter().fromJson, + ), + inviteAcceptedAt: _$JsonConverterFromJson( + json['invite_accepted_at'], + const StreamDateTimeConverter().fromJson, + ), + inviteRejectedAt: _$JsonConverterFromJson( + json['invite_rejected_at'], + const StreamDateTimeConverter().fromJson, + ), + invited: json['invited'] as bool?, + isModerator: json['is_moderator'] as bool?, + notificationsMuted: json['notifications_muted'] as bool, + pinnedAt: _$JsonConverterFromJson( + json['pinned_at'], + const StreamDateTimeConverter().fromJson, + ), + role: json['role'] as String?, + shadowBanned: json['shadow_banned'] as bool, + status: json['status'] as String?, + updatedAt: const StreamDateTimeConverter().fromJson( + json['updated_at'] as Object, + ), + user: json['user'] == null ? null : UserResponse.fromJson(json['user'] as Map), + userId: json['user_id'] as String?, +); + +Map _$ChannelMemberResponseToJson( + ChannelMemberResponse instance, +) => { + 'archived_at': _$JsonConverterToJson( + instance.archivedAt, + const StreamDateTimeConverter().toJson, + ), + 'ban_expires': _$JsonConverterToJson( + instance.banExpires, + const StreamDateTimeConverter().toJson, + ), + 'ban_from_future_channels': instance.banFromFutureChannels, + 'banned': instance.banned, + 'channel_role': instance.channelRole, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'deleted_at': _$JsonConverterToJson( + instance.deletedAt, + const StreamDateTimeConverter().toJson, + ), + 'deleted_messages': instance.deletedMessages, + 'future_channel_ban_expires': _$JsonConverterToJson( + instance.futureChannelBanExpires, + const StreamDateTimeConverter().toJson, + ), + 'invite_accepted_at': _$JsonConverterToJson( + instance.inviteAcceptedAt, + const StreamDateTimeConverter().toJson, + ), + 'invite_rejected_at': _$JsonConverterToJson( + instance.inviteRejectedAt, + const StreamDateTimeConverter().toJson, + ), + 'invited': instance.invited, + 'is_moderator': instance.isModerator, + 'notifications_muted': instance.notificationsMuted, + 'pinned_at': _$JsonConverterToJson( + instance.pinnedAt, + const StreamDateTimeConverter().toJson, + ), + 'role': instance.role, + 'shadow_banned': instance.shadowBanned, + 'status': instance.status, + 'updated_at': const StreamDateTimeConverter().toJson(instance.updatedAt), + 'user': instance.user?.toJson(), + 'user_id': instance.userId, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/channel_message_count_rule_parameters.dart b/packages/stream_chat/lib/open_api/model/channel_message_count_rule_parameters.dart new file mode 100644 index 0000000000..6329648079 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_message_count_rule_parameters.dart @@ -0,0 +1,37 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'channel_message_count_rule_parameters.g.dart'; +part 'channel_message_count_rule_parameters.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ChannelMessageCountRuleParameters with _$ChannelMessageCountRuleParameters { + const ChannelMessageCountRuleParameters({ + this.operator, + this.threshold, + }); + + @override + @JsonKey(name: 'operator') + final String? operator; + + @override + @JsonKey(name: 'threshold') + final int? threshold; + + Map toJson() => _$ChannelMessageCountRuleParametersToJson(this); + + static ChannelMessageCountRuleParameters fromJson(Map json) => + _$ChannelMessageCountRuleParametersFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/channel_message_count_rule_parameters.freezed.dart b/packages/stream_chat/lib/open_api/model/channel_message_count_rule_parameters.freezed.dart new file mode 100644 index 0000000000..0e86adc327 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_message_count_rule_parameters.freezed.dart @@ -0,0 +1,83 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'channel_message_count_rule_parameters.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ChannelMessageCountRuleParameters { + String? get operator; + int? get threshold; + + /// Create a copy of ChannelMessageCountRuleParameters + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ChannelMessageCountRuleParametersCopyWith get copyWith => + _$ChannelMessageCountRuleParametersCopyWithImpl( + this as ChannelMessageCountRuleParameters, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ChannelMessageCountRuleParameters && + (identical(other.operator, operator) || other.operator == operator) && + (identical(other.threshold, threshold) || other.threshold == threshold)); + } + + @override + int get hashCode => Object.hash(runtimeType, operator, threshold); + + @override + String toString() { + return 'ChannelMessageCountRuleParameters(operator: $operator, threshold: $threshold)'; + } +} + +/// @nodoc +abstract mixin class $ChannelMessageCountRuleParametersCopyWith<$Res> { + factory $ChannelMessageCountRuleParametersCopyWith( + ChannelMessageCountRuleParameters value, + $Res Function(ChannelMessageCountRuleParameters) _then, + ) = _$ChannelMessageCountRuleParametersCopyWithImpl; + @useResult + $Res call({String? operator, int? threshold}); +} + +/// @nodoc +class _$ChannelMessageCountRuleParametersCopyWithImpl<$Res> + implements $ChannelMessageCountRuleParametersCopyWith<$Res> { + _$ChannelMessageCountRuleParametersCopyWithImpl(this._self, this._then); + + final ChannelMessageCountRuleParameters _self; + final $Res Function(ChannelMessageCountRuleParameters) _then; + + /// Create a copy of ChannelMessageCountRuleParameters + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? operator = freezed, Object? threshold = freezed}) { + return _then( + ChannelMessageCountRuleParameters( + operator: freezed == operator + ? _self.operator + : operator // ignore: cast_nullable_to_non_nullable + as String?, + threshold: freezed == threshold + ? _self.threshold + : threshold // ignore: cast_nullable_to_non_nullable + as int?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/channel_message_count_rule_parameters.g.dart b/packages/stream_chat/lib/open_api/model/channel_message_count_rule_parameters.g.dart new file mode 100644 index 0000000000..3c7f39c739 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_message_count_rule_parameters.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'channel_message_count_rule_parameters.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ChannelMessageCountRuleParameters _$ChannelMessageCountRuleParametersFromJson( + Map json, +) => ChannelMessageCountRuleParameters( + operator: json['operator'] as String?, + threshold: (json['threshold'] as num?)?.toInt(), +); + +Map _$ChannelMessageCountRuleParametersToJson( + ChannelMessageCountRuleParameters instance, +) => { + 'operator': instance.operator, + 'threshold': instance.threshold, +}; diff --git a/packages/stream_chat/lib/open_api/model/channel_metadata.dart b/packages/stream_chat/lib/open_api/model/channel_metadata.dart new file mode 100644 index 0000000000..b0ab505f05 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_metadata.dart @@ -0,0 +1,72 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'channel_metadata.g.dart'; +part 'channel_metadata.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ChannelMetadata with _$ChannelMetadata { + const ChannelMetadata({ + required this.cid, + required this.custom, + required this.id, + this.lastMessageAt, + this.memberCount, + this.messageCount, + this.pushLevel, + this.team, + required this.type, + }); + + @override + @JsonKey(name: 'cid') + final String cid; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'id') + final String id; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'last_message_at') + final DateTime? lastMessageAt; + + @override + @JsonKey(name: 'member_count') + final int? memberCount; + + @override + @JsonKey(name: 'message_count') + final int? messageCount; + + @override + @JsonKey(name: 'push_level') + final String? pushLevel; + + @override + @JsonKey(name: 'team') + final String? team; + + @override + @JsonKey(name: 'type') + final String type; + + Map toJson() => _$ChannelMetadataToJson(this); + + static ChannelMetadata fromJson(Map json) => _$ChannelMetadataFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/channel_metadata.freezed.dart b/packages/stream_chat/lib/open_api/model/channel_metadata.freezed.dart new file mode 100644 index 0000000000..ef635337ad --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_metadata.freezed.dart @@ -0,0 +1,154 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'channel_metadata.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ChannelMetadata { + String get cid; + Map get custom; + String get id; + DateTime? get lastMessageAt; + int? get memberCount; + int? get messageCount; + String? get pushLevel; + String? get team; + String get type; + + /// Create a copy of ChannelMetadata + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ChannelMetadataCopyWith get copyWith => _$ChannelMetadataCopyWithImpl( + this as ChannelMetadata, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ChannelMetadata && + (identical(other.cid, cid) || other.cid == cid) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.id, id) || other.id == id) && + (identical(other.lastMessageAt, lastMessageAt) || other.lastMessageAt == lastMessageAt) && + (identical(other.memberCount, memberCount) || other.memberCount == memberCount) && + (identical(other.messageCount, messageCount) || other.messageCount == messageCount) && + (identical(other.pushLevel, pushLevel) || other.pushLevel == pushLevel) && + (identical(other.team, team) || other.team == team) && + (identical(other.type, type) || other.type == type)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + cid, + const DeepCollectionEquality().hash(custom), + id, + lastMessageAt, + memberCount, + messageCount, + pushLevel, + team, + type, + ); + + @override + String toString() { + return 'ChannelMetadata(cid: $cid, custom: $custom, id: $id, lastMessageAt: $lastMessageAt, memberCount: $memberCount, messageCount: $messageCount, pushLevel: $pushLevel, team: $team, type: $type)'; + } +} + +/// @nodoc +abstract mixin class $ChannelMetadataCopyWith<$Res> { + factory $ChannelMetadataCopyWith( + ChannelMetadata value, + $Res Function(ChannelMetadata) _then, + ) = _$ChannelMetadataCopyWithImpl; + @useResult + $Res call({ + String cid, + Map custom, + String id, + DateTime? lastMessageAt, + int? memberCount, + int? messageCount, + String? pushLevel, + String? team, + String type, + }); +} + +/// @nodoc +class _$ChannelMetadataCopyWithImpl<$Res> implements $ChannelMetadataCopyWith<$Res> { + _$ChannelMetadataCopyWithImpl(this._self, this._then); + + final ChannelMetadata _self; + final $Res Function(ChannelMetadata) _then; + + /// Create a copy of ChannelMetadata + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? cid = null, + Object? custom = null, + Object? id = null, + Object? lastMessageAt = freezed, + Object? memberCount = freezed, + Object? messageCount = freezed, + Object? pushLevel = freezed, + Object? team = freezed, + Object? type = null, + }) { + return _then( + ChannelMetadata( + cid: null == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + lastMessageAt: freezed == lastMessageAt + ? _self.lastMessageAt + : lastMessageAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + memberCount: freezed == memberCount + ? _self.memberCount + : memberCount // ignore: cast_nullable_to_non_nullable + as int?, + messageCount: freezed == messageCount + ? _self.messageCount + : messageCount // ignore: cast_nullable_to_non_nullable + as int?, + pushLevel: freezed == pushLevel + ? _self.pushLevel + : pushLevel // ignore: cast_nullable_to_non_nullable + as String?, + team: freezed == team + ? _self.team + : team // ignore: cast_nullable_to_non_nullable + as String?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/channel_metadata.g.dart b/packages/stream_chat/lib/open_api/model/channel_metadata.g.dart new file mode 100644 index 0000000000..934f14623b --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_metadata.g.dart @@ -0,0 +1,47 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'channel_metadata.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ChannelMetadata _$ChannelMetadataFromJson(Map json) => ChannelMetadata( + cid: json['cid'] as String, + custom: json['custom'] as Map, + id: json['id'] as String, + lastMessageAt: _$JsonConverterFromJson( + json['last_message_at'], + const StreamDateTimeConverter().fromJson, + ), + memberCount: (json['member_count'] as num?)?.toInt(), + messageCount: (json['message_count'] as num?)?.toInt(), + pushLevel: json['push_level'] as String?, + team: json['team'] as String?, + type: json['type'] as String, +); + +Map _$ChannelMetadataToJson(ChannelMetadata instance) => { + 'cid': instance.cid, + 'custom': instance.custom, + 'id': instance.id, + 'last_message_at': _$JsonConverterToJson( + instance.lastMessageAt, + const StreamDateTimeConverter().toJson, + ), + 'member_count': instance.memberCount, + 'message_count': instance.messageCount, + 'push_level': instance.pushLevel, + 'team': instance.team, + 'type': instance.type, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/channel_mute.dart b/packages/stream_chat/lib/open_api/model/channel_mute.dart new file mode 100644 index 0000000000..5ea67cfcf6 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_mute.dart @@ -0,0 +1,54 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'channel_mute.g.dart'; +part 'channel_mute.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ChannelMute with _$ChannelMute { + const ChannelMute({ + this.channel, + required this.createdAt, + this.expires, + required this.updatedAt, + this.user, + }); + + @override + @JsonKey(name: 'channel') + final ChannelResponse? channel; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'expires') + final DateTime? expires; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'updated_at') + final DateTime updatedAt; + + @override + @JsonKey(name: 'user') + final UserResponse? user; + + Map toJson() => _$ChannelMuteToJson(this); + + static ChannelMute fromJson(Map json) => _$ChannelMuteFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/channel_mute.freezed.dart b/packages/stream_chat/lib/open_api/model/channel_mute.freezed.dart new file mode 100644 index 0000000000..0c227e71d3 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_mute.freezed.dart @@ -0,0 +1,109 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'channel_mute.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ChannelMute { + ChannelResponse? get channel; + DateTime get createdAt; + DateTime? get expires; + DateTime get updatedAt; + UserResponse? get user; + + /// Create a copy of ChannelMute + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ChannelMuteCopyWith get copyWith => + _$ChannelMuteCopyWithImpl(this as ChannelMute, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ChannelMute && + (identical(other.channel, channel) || other.channel == channel) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.expires, expires) || other.expires == expires) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash(runtimeType, channel, createdAt, expires, updatedAt, user); + + @override + String toString() { + return 'ChannelMute(channel: $channel, createdAt: $createdAt, expires: $expires, updatedAt: $updatedAt, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $ChannelMuteCopyWith<$Res> { + factory $ChannelMuteCopyWith( + ChannelMute value, + $Res Function(ChannelMute) _then, + ) = _$ChannelMuteCopyWithImpl; + @useResult + $Res call({ + ChannelResponse? channel, + DateTime createdAt, + DateTime? expires, + DateTime updatedAt, + UserResponse? user, + }); +} + +/// @nodoc +class _$ChannelMuteCopyWithImpl<$Res> implements $ChannelMuteCopyWith<$Res> { + _$ChannelMuteCopyWithImpl(this._self, this._then); + + final ChannelMute _self; + final $Res Function(ChannelMute) _then; + + /// Create a copy of ChannelMute + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channel = freezed, + Object? createdAt = null, + Object? expires = freezed, + Object? updatedAt = null, + Object? user = freezed, + }) { + return _then( + ChannelMute( + channel: freezed == channel + ? _self.channel + : channel // ignore: cast_nullable_to_non_nullable + as ChannelResponse?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + expires: freezed == expires + ? _self.expires + : expires // ignore: cast_nullable_to_non_nullable + as DateTime?, + updatedAt: null == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponse?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/channel_mute.g.dart b/packages/stream_chat/lib/open_api/model/channel_mute.g.dart new file mode 100644 index 0000000000..ef3b97efbd --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_mute.g.dart @@ -0,0 +1,43 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'channel_mute.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ChannelMute _$ChannelMuteFromJson(Map json) => ChannelMute( + channel: json['channel'] == null ? null : ChannelResponse.fromJson(json['channel'] as Map), + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + expires: _$JsonConverterFromJson( + json['expires'], + const StreamDateTimeConverter().fromJson, + ), + updatedAt: const StreamDateTimeConverter().fromJson( + json['updated_at'] as Object, + ), + user: json['user'] == null ? null : UserResponse.fromJson(json['user'] as Map), +); + +Map _$ChannelMuteToJson(ChannelMute instance) => { + 'channel': instance.channel?.toJson(), + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'expires': _$JsonConverterToJson( + instance.expires, + const StreamDateTimeConverter().toJson, + ), + 'updated_at': const StreamDateTimeConverter().toJson(instance.updatedAt), + 'user': instance.user?.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/channel_own_capability.dart b/packages/stream_chat/lib/open_api/model/channel_own_capability.dart new file mode 100644 index 0000000000..f6ea09c45d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_own_capability.dart @@ -0,0 +1,55 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import '../models.dart'; + +extension type const ChannelOwnCapability._(String _) implements String { + static const banChannelMembers = ChannelOwnCapability._('ban-channel-members'); + static const castPollVote = ChannelOwnCapability._('cast-poll-vote'); + static const connectEvents = ChannelOwnCapability._('connect-events'); + static const createAttachment = ChannelOwnCapability._('create-attachment'); + static const createMention = ChannelOwnCapability._('create-mention'); + static const deleteAnyMessage = ChannelOwnCapability._('delete-any-message'); + static const deleteChannel = ChannelOwnCapability._('delete-channel'); + static const deleteOwnMessage = ChannelOwnCapability._('delete-own-message'); + static const deliveryEvents = ChannelOwnCapability._('delivery-events'); + static const flagMessage = ChannelOwnCapability._('flag-message'); + static const freezeChannel = ChannelOwnCapability._('freeze-channel'); + static const joinChannel = ChannelOwnCapability._('join-channel'); + static const leaveChannel = ChannelOwnCapability._('leave-channel'); + static const muteChannel = ChannelOwnCapability._('mute-channel'); + static const notifyChannel = ChannelOwnCapability._('notify-channel'); + static const notifyGroup = ChannelOwnCapability._('notify-group'); + static const notifyHere = ChannelOwnCapability._('notify-here'); + static const notifyRole = ChannelOwnCapability._('notify-role'); + static const pinMessage = ChannelOwnCapability._('pin-message'); + static const queryPollVotes = ChannelOwnCapability._('query-poll-votes'); + static const quoteMessage = ChannelOwnCapability._('quote-message'); + static const readEvents = ChannelOwnCapability._('read-events'); + static const searchMessages = ChannelOwnCapability._('search-messages'); + static const sendCustomEvents = ChannelOwnCapability._('send-custom-events'); + static const sendLinks = ChannelOwnCapability._('send-links'); + static const sendMessage = ChannelOwnCapability._('send-message'); + static const sendPoll = ChannelOwnCapability._('send-poll'); + static const sendReaction = ChannelOwnCapability._('send-reaction'); + static const sendReply = ChannelOwnCapability._('send-reply'); + static const sendRestrictedVisibilityMessage = ChannelOwnCapability._('send-restricted-visibility-message'); + static const sendTypingEvents = ChannelOwnCapability._('send-typing-events'); + static const setChannelCooldown = ChannelOwnCapability._('set-channel-cooldown'); + static const shareLocation = ChannelOwnCapability._('share-location'); + static const skipSlowMode = ChannelOwnCapability._('skip-slow-mode'); + static const slowMode = ChannelOwnCapability._('slow-mode'); + static const typingEvents = ChannelOwnCapability._('typing-events'); + static const updateAnyMessage = ChannelOwnCapability._('update-any-message'); + static const updateChannel = ChannelOwnCapability._('update-channel'); + static const updateChannelMembers = ChannelOwnCapability._('update-channel-members'); + static const updateOwnMessage = ChannelOwnCapability._('update-own-message'); + static const updateThread = ChannelOwnCapability._('update-thread'); + static const uploadFile = ChannelOwnCapability._('upload-file'); + + factory ChannelOwnCapability.fromJson(String json) => ChannelOwnCapability._(json); + + String toJson() => this; +} diff --git a/packages/stream_chat/lib/open_api/model/channel_push_preferences_response.dart b/packages/stream_chat/lib/open_api/model/channel_push_preferences_response.dart new file mode 100644 index 0000000000..a0ac50a63f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_push_preferences_response.dart @@ -0,0 +1,43 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'channel_push_preferences_response.g.dart'; +part 'channel_push_preferences_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ChannelPushPreferencesResponse with _$ChannelPushPreferencesResponse { + const ChannelPushPreferencesResponse({ + this.chatLevel, + this.chatPreferences, + this.disabledUntil, + }); + + @override + @JsonKey(name: 'chat_level') + final String? chatLevel; + + @override + @JsonKey(name: 'chat_preferences') + final ChatPreferencesResponse? chatPreferences; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'disabled_until') + final DateTime? disabledUntil; + + Map toJson() => _$ChannelPushPreferencesResponseToJson(this); + + static ChannelPushPreferencesResponse fromJson(Map json) => + _$ChannelPushPreferencesResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/channel_push_preferences_response.freezed.dart b/packages/stream_chat/lib/open_api/model/channel_push_preferences_response.freezed.dart new file mode 100644 index 0000000000..6d0f878e60 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_push_preferences_response.freezed.dart @@ -0,0 +1,96 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'channel_push_preferences_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ChannelPushPreferencesResponse { + String? get chatLevel; + ChatPreferencesResponse? get chatPreferences; + DateTime? get disabledUntil; + + /// Create a copy of ChannelPushPreferencesResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ChannelPushPreferencesResponseCopyWith get copyWith => + _$ChannelPushPreferencesResponseCopyWithImpl( + this as ChannelPushPreferencesResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ChannelPushPreferencesResponse && + (identical(other.chatLevel, chatLevel) || other.chatLevel == chatLevel) && + (identical(other.chatPreferences, chatPreferences) || other.chatPreferences == chatPreferences) && + (identical(other.disabledUntil, disabledUntil) || other.disabledUntil == disabledUntil)); + } + + @override + int get hashCode => Object.hash(runtimeType, chatLevel, chatPreferences, disabledUntil); + + @override + String toString() { + return 'ChannelPushPreferencesResponse(chatLevel: $chatLevel, chatPreferences: $chatPreferences, disabledUntil: $disabledUntil)'; + } +} + +/// @nodoc +abstract mixin class $ChannelPushPreferencesResponseCopyWith<$Res> { + factory $ChannelPushPreferencesResponseCopyWith( + ChannelPushPreferencesResponse value, + $Res Function(ChannelPushPreferencesResponse) _then, + ) = _$ChannelPushPreferencesResponseCopyWithImpl; + @useResult + $Res call({ + String? chatLevel, + ChatPreferencesResponse? chatPreferences, + DateTime? disabledUntil, + }); +} + +/// @nodoc +class _$ChannelPushPreferencesResponseCopyWithImpl<$Res> implements $ChannelPushPreferencesResponseCopyWith<$Res> { + _$ChannelPushPreferencesResponseCopyWithImpl(this._self, this._then); + + final ChannelPushPreferencesResponse _self; + final $Res Function(ChannelPushPreferencesResponse) _then; + + /// Create a copy of ChannelPushPreferencesResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? chatLevel = freezed, + Object? chatPreferences = freezed, + Object? disabledUntil = freezed, + }) { + return _then( + ChannelPushPreferencesResponse( + chatLevel: freezed == chatLevel + ? _self.chatLevel + : chatLevel // ignore: cast_nullable_to_non_nullable + as String?, + chatPreferences: freezed == chatPreferences + ? _self.chatPreferences + : chatPreferences // ignore: cast_nullable_to_non_nullable + as ChatPreferencesResponse?, + disabledUntil: freezed == disabledUntil + ? _self.disabledUntil + : disabledUntil // ignore: cast_nullable_to_non_nullable + as DateTime?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/channel_push_preferences_response.g.dart b/packages/stream_chat/lib/open_api/model/channel_push_preferences_response.g.dart new file mode 100644 index 0000000000..7213adc1ef --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_push_preferences_response.g.dart @@ -0,0 +1,43 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'channel_push_preferences_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ChannelPushPreferencesResponse _$ChannelPushPreferencesResponseFromJson( + Map json, +) => ChannelPushPreferencesResponse( + chatLevel: json['chat_level'] as String?, + chatPreferences: json['chat_preferences'] == null + ? null + : ChatPreferencesResponse.fromJson( + json['chat_preferences'] as Map, + ), + disabledUntil: _$JsonConverterFromJson( + json['disabled_until'], + const StreamDateTimeConverter().fromJson, + ), +); + +Map _$ChannelPushPreferencesResponseToJson( + ChannelPushPreferencesResponse instance, +) => { + 'chat_level': instance.chatLevel, + 'chat_preferences': instance.chatPreferences?.toJson(), + 'disabled_until': _$JsonConverterToJson( + instance.disabledUntil, + const StreamDateTimeConverter().toJson, + ), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/channel_response.dart b/packages/stream_chat/lib/open_api/model/channel_response.dart new file mode 100644 index 0000000000..9839dc913b --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_response.dart @@ -0,0 +1,173 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'channel_response.g.dart'; +part 'channel_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ChannelResponse with _$ChannelResponse { + const ChannelResponse({ + this.autoTranslationEnabled, + this.autoTranslationLanguage, + this.blocked, + required this.cid, + this.config, + this.cooldown, + required this.createdAt, + this.createdBy, + required this.custom, + this.deletedAt, + required this.disabled, + this.filterTags, + required this.frozen, + this.hidden, + this.hideMessagesBefore, + required this.id, + this.lastMessageAt, + this.memberCount, + this.members, + this.messageCount, + this.muteExpiresAt, + this.muted, + this.ownCapabilities, + this.team, + this.truncatedAt, + this.truncatedBy, + required this.type, + required this.updatedAt, + }); + + @override + @JsonKey(name: 'auto_translation_enabled') + final bool? autoTranslationEnabled; + + @override + @JsonKey(name: 'auto_translation_language') + final String? autoTranslationLanguage; + + @override + @JsonKey(name: 'blocked') + final bool? blocked; + + @override + @JsonKey(name: 'cid') + final String cid; + + @override + @JsonKey(name: 'config') + final ChannelConfigWithInfo? config; + + @override + @JsonKey(name: 'cooldown') + final int? cooldown; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'created_by') + final UserResponse? createdBy; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'deleted_at') + final DateTime? deletedAt; + + @override + @JsonKey(name: 'disabled') + final bool disabled; + + @override + @JsonKey(name: 'filter_tags') + final List? filterTags; + + @override + @JsonKey(name: 'frozen') + final bool frozen; + + @override + @JsonKey(name: 'hidden') + final bool? hidden; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'hide_messages_before') + final DateTime? hideMessagesBefore; + + @override + @JsonKey(name: 'id') + final String id; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'last_message_at') + final DateTime? lastMessageAt; + + @override + @JsonKey(name: 'member_count') + final int? memberCount; + + @override + @JsonKey(name: 'members') + final List? members; + + @override + @JsonKey(name: 'message_count') + final int? messageCount; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'mute_expires_at') + final DateTime? muteExpiresAt; + + @override + @JsonKey(name: 'muted') + final bool? muted; + + @override + @JsonKey(name: 'own_capabilities') + final List? ownCapabilities; + + @override + @JsonKey(name: 'team') + final String? team; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'truncated_at') + final DateTime? truncatedAt; + + @override + @JsonKey(name: 'truncated_by') + final UserResponse? truncatedBy; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'updated_at') + final DateTime updatedAt; + + Map toJson() => _$ChannelResponseToJson(this); + + static ChannelResponse fromJson(Map json) => _$ChannelResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/channel_response.freezed.dart b/packages/stream_chat/lib/open_api/model/channel_response.freezed.dart new file mode 100644 index 0000000000..0760e7e702 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_response.freezed.dart @@ -0,0 +1,337 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'channel_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ChannelResponse { + bool? get autoTranslationEnabled; + String? get autoTranslationLanguage; + bool? get blocked; + String get cid; + ChannelConfigWithInfo? get config; + int? get cooldown; + DateTime get createdAt; + UserResponse? get createdBy; + Map get custom; + DateTime? get deletedAt; + bool get disabled; + List? get filterTags; + bool get frozen; + bool? get hidden; + DateTime? get hideMessagesBefore; + String get id; + DateTime? get lastMessageAt; + int? get memberCount; + List? get members; + int? get messageCount; + DateTime? get muteExpiresAt; + bool? get muted; + List? get ownCapabilities; + String? get team; + DateTime? get truncatedAt; + UserResponse? get truncatedBy; + String get type; + DateTime get updatedAt; + + /// Create a copy of ChannelResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ChannelResponseCopyWith get copyWith => _$ChannelResponseCopyWithImpl( + this as ChannelResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ChannelResponse && + (identical(other.autoTranslationEnabled, autoTranslationEnabled) || + other.autoTranslationEnabled == autoTranslationEnabled) && + (identical( + other.autoTranslationLanguage, + autoTranslationLanguage, + ) || + other.autoTranslationLanguage == autoTranslationLanguage) && + (identical(other.blocked, blocked) || other.blocked == blocked) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.config, config) || other.config == config) && + (identical(other.cooldown, cooldown) || other.cooldown == cooldown) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.createdBy, createdBy) || other.createdBy == createdBy) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt) && + (identical(other.disabled, disabled) || other.disabled == disabled) && + const DeepCollectionEquality().equals( + other.filterTags, + filterTags, + ) && + (identical(other.frozen, frozen) || other.frozen == frozen) && + (identical(other.hidden, hidden) || other.hidden == hidden) && + (identical(other.hideMessagesBefore, hideMessagesBefore) || + other.hideMessagesBefore == hideMessagesBefore) && + (identical(other.id, id) || other.id == id) && + (identical(other.lastMessageAt, lastMessageAt) || other.lastMessageAt == lastMessageAt) && + (identical(other.memberCount, memberCount) || other.memberCount == memberCount) && + const DeepCollectionEquality().equals(other.members, members) && + (identical(other.messageCount, messageCount) || other.messageCount == messageCount) && + (identical(other.muteExpiresAt, muteExpiresAt) || other.muteExpiresAt == muteExpiresAt) && + (identical(other.muted, muted) || other.muted == muted) && + const DeepCollectionEquality().equals( + other.ownCapabilities, + ownCapabilities, + ) && + (identical(other.team, team) || other.team == team) && + (identical(other.truncatedAt, truncatedAt) || other.truncatedAt == truncatedAt) && + (identical(other.truncatedBy, truncatedBy) || other.truncatedBy == truncatedBy) && + (identical(other.type, type) || other.type == type) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)); + } + + @override + int get hashCode => Object.hashAll([ + runtimeType, + autoTranslationEnabled, + autoTranslationLanguage, + blocked, + cid, + config, + cooldown, + createdAt, + createdBy, + const DeepCollectionEquality().hash(custom), + deletedAt, + disabled, + const DeepCollectionEquality().hash(filterTags), + frozen, + hidden, + hideMessagesBefore, + id, + lastMessageAt, + memberCount, + const DeepCollectionEquality().hash(members), + messageCount, + muteExpiresAt, + muted, + const DeepCollectionEquality().hash(ownCapabilities), + team, + truncatedAt, + truncatedBy, + type, + updatedAt, + ]); + + @override + String toString() { + return 'ChannelResponse(autoTranslationEnabled: $autoTranslationEnabled, autoTranslationLanguage: $autoTranslationLanguage, blocked: $blocked, cid: $cid, config: $config, cooldown: $cooldown, createdAt: $createdAt, createdBy: $createdBy, custom: $custom, deletedAt: $deletedAt, disabled: $disabled, filterTags: $filterTags, frozen: $frozen, hidden: $hidden, hideMessagesBefore: $hideMessagesBefore, id: $id, lastMessageAt: $lastMessageAt, memberCount: $memberCount, members: $members, messageCount: $messageCount, muteExpiresAt: $muteExpiresAt, muted: $muted, ownCapabilities: $ownCapabilities, team: $team, truncatedAt: $truncatedAt, truncatedBy: $truncatedBy, type: $type, updatedAt: $updatedAt)'; + } +} + +/// @nodoc +abstract mixin class $ChannelResponseCopyWith<$Res> { + factory $ChannelResponseCopyWith( + ChannelResponse value, + $Res Function(ChannelResponse) _then, + ) = _$ChannelResponseCopyWithImpl; + @useResult + $Res call({ + bool? autoTranslationEnabled, + String? autoTranslationLanguage, + bool? blocked, + String cid, + ChannelConfigWithInfo? config, + int? cooldown, + DateTime createdAt, + UserResponse? createdBy, + Map custom, + DateTime? deletedAt, + bool disabled, + List? filterTags, + bool frozen, + bool? hidden, + DateTime? hideMessagesBefore, + String id, + DateTime? lastMessageAt, + int? memberCount, + List? members, + int? messageCount, + DateTime? muteExpiresAt, + bool? muted, + List? ownCapabilities, + String? team, + DateTime? truncatedAt, + UserResponse? truncatedBy, + String type, + DateTime updatedAt, + }); +} + +/// @nodoc +class _$ChannelResponseCopyWithImpl<$Res> implements $ChannelResponseCopyWith<$Res> { + _$ChannelResponseCopyWithImpl(this._self, this._then); + + final ChannelResponse _self; + final $Res Function(ChannelResponse) _then; + + /// Create a copy of ChannelResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? autoTranslationEnabled = freezed, + Object? autoTranslationLanguage = freezed, + Object? blocked = freezed, + Object? cid = null, + Object? config = freezed, + Object? cooldown = freezed, + Object? createdAt = null, + Object? createdBy = freezed, + Object? custom = null, + Object? deletedAt = freezed, + Object? disabled = null, + Object? filterTags = freezed, + Object? frozen = null, + Object? hidden = freezed, + Object? hideMessagesBefore = freezed, + Object? id = null, + Object? lastMessageAt = freezed, + Object? memberCount = freezed, + Object? members = freezed, + Object? messageCount = freezed, + Object? muteExpiresAt = freezed, + Object? muted = freezed, + Object? ownCapabilities = freezed, + Object? team = freezed, + Object? truncatedAt = freezed, + Object? truncatedBy = freezed, + Object? type = null, + Object? updatedAt = null, + }) { + return _then( + ChannelResponse( + autoTranslationEnabled: freezed == autoTranslationEnabled + ? _self.autoTranslationEnabled + : autoTranslationEnabled // ignore: cast_nullable_to_non_nullable + as bool?, + autoTranslationLanguage: freezed == autoTranslationLanguage + ? _self.autoTranslationLanguage + : autoTranslationLanguage // ignore: cast_nullable_to_non_nullable + as String?, + blocked: freezed == blocked + ? _self.blocked + : blocked // ignore: cast_nullable_to_non_nullable + as bool?, + cid: null == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String, + config: freezed == config + ? _self.config + : config // ignore: cast_nullable_to_non_nullable + as ChannelConfigWithInfo?, + cooldown: freezed == cooldown + ? _self.cooldown + : cooldown // ignore: cast_nullable_to_non_nullable + as int?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + createdBy: freezed == createdBy + ? _self.createdBy + : createdBy // ignore: cast_nullable_to_non_nullable + as UserResponse?, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + deletedAt: freezed == deletedAt + ? _self.deletedAt + : deletedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + disabled: null == disabled + ? _self.disabled + : disabled // ignore: cast_nullable_to_non_nullable + as bool, + filterTags: freezed == filterTags + ? _self.filterTags + : filterTags // ignore: cast_nullable_to_non_nullable + as List?, + frozen: null == frozen + ? _self.frozen + : frozen // ignore: cast_nullable_to_non_nullable + as bool, + hidden: freezed == hidden + ? _self.hidden + : hidden // ignore: cast_nullable_to_non_nullable + as bool?, + hideMessagesBefore: freezed == hideMessagesBefore + ? _self.hideMessagesBefore + : hideMessagesBefore // ignore: cast_nullable_to_non_nullable + as DateTime?, + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + lastMessageAt: freezed == lastMessageAt + ? _self.lastMessageAt + : lastMessageAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + memberCount: freezed == memberCount + ? _self.memberCount + : memberCount // ignore: cast_nullable_to_non_nullable + as int?, + members: freezed == members + ? _self.members + : members // ignore: cast_nullable_to_non_nullable + as List?, + messageCount: freezed == messageCount + ? _self.messageCount + : messageCount // ignore: cast_nullable_to_non_nullable + as int?, + muteExpiresAt: freezed == muteExpiresAt + ? _self.muteExpiresAt + : muteExpiresAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + muted: freezed == muted + ? _self.muted + : muted // ignore: cast_nullable_to_non_nullable + as bool?, + ownCapabilities: freezed == ownCapabilities + ? _self.ownCapabilities + : ownCapabilities // ignore: cast_nullable_to_non_nullable + as List?, + team: freezed == team + ? _self.team + : team // ignore: cast_nullable_to_non_nullable + as String?, + truncatedAt: freezed == truncatedAt + ? _self.truncatedAt + : truncatedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + truncatedBy: freezed == truncatedBy + ? _self.truncatedBy + : truncatedBy // ignore: cast_nullable_to_non_nullable + as UserResponse?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + updatedAt: null == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/channel_response.g.dart b/packages/stream_chat/lib/open_api/model/channel_response.g.dart new file mode 100644 index 0000000000..c9f5daabc4 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_response.g.dart @@ -0,0 +1,123 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'channel_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ChannelResponse _$ChannelResponseFromJson( + Map json, +) => ChannelResponse( + autoTranslationEnabled: json['auto_translation_enabled'] as bool?, + autoTranslationLanguage: json['auto_translation_language'] as String?, + blocked: json['blocked'] as bool?, + cid: json['cid'] as String, + config: json['config'] == null ? null : ChannelConfigWithInfo.fromJson(json['config'] as Map), + cooldown: (json['cooldown'] as num?)?.toInt(), + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + createdBy: json['created_by'] == null ? null : UserResponse.fromJson(json['created_by'] as Map), + custom: json['custom'] as Map, + deletedAt: _$JsonConverterFromJson( + json['deleted_at'], + const StreamDateTimeConverter().fromJson, + ), + disabled: json['disabled'] as bool, + filterTags: (json['filter_tags'] as List?)?.map((e) => e as String).toList(), + frozen: json['frozen'] as bool, + hidden: json['hidden'] as bool?, + hideMessagesBefore: _$JsonConverterFromJson( + json['hide_messages_before'], + const StreamDateTimeConverter().fromJson, + ), + id: json['id'] as String, + lastMessageAt: _$JsonConverterFromJson( + json['last_message_at'], + const StreamDateTimeConverter().fromJson, + ), + memberCount: (json['member_count'] as num?)?.toInt(), + members: (json['members'] as List?) + ?.map((e) => ChannelMemberResponse.fromJson(e as Map)) + .toList(), + messageCount: (json['message_count'] as num?)?.toInt(), + muteExpiresAt: _$JsonConverterFromJson( + json['mute_expires_at'], + const StreamDateTimeConverter().fromJson, + ), + muted: json['muted'] as bool?, + ownCapabilities: (json['own_capabilities'] as List?) + ?.map((e) => ChannelOwnCapability.fromJson(e as String)) + .toList(), + team: json['team'] as String?, + truncatedAt: _$JsonConverterFromJson( + json['truncated_at'], + const StreamDateTimeConverter().fromJson, + ), + truncatedBy: json['truncated_by'] == null + ? null + : UserResponse.fromJson(json['truncated_by'] as Map), + type: json['type'] as String, + updatedAt: const StreamDateTimeConverter().fromJson( + json['updated_at'] as Object, + ), +); + +Map _$ChannelResponseToJson( + ChannelResponse instance, +) => { + 'auto_translation_enabled': instance.autoTranslationEnabled, + 'auto_translation_language': instance.autoTranslationLanguage, + 'blocked': instance.blocked, + 'cid': instance.cid, + 'config': instance.config?.toJson(), + 'cooldown': instance.cooldown, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'created_by': instance.createdBy?.toJson(), + 'custom': instance.custom, + 'deleted_at': _$JsonConverterToJson( + instance.deletedAt, + const StreamDateTimeConverter().toJson, + ), + 'disabled': instance.disabled, + 'filter_tags': instance.filterTags, + 'frozen': instance.frozen, + 'hidden': instance.hidden, + 'hide_messages_before': _$JsonConverterToJson( + instance.hideMessagesBefore, + const StreamDateTimeConverter().toJson, + ), + 'id': instance.id, + 'last_message_at': _$JsonConverterToJson( + instance.lastMessageAt, + const StreamDateTimeConverter().toJson, + ), + 'member_count': instance.memberCount, + 'members': instance.members?.map((e) => e.toJson()).toList(), + 'message_count': instance.messageCount, + 'mute_expires_at': _$JsonConverterToJson( + instance.muteExpiresAt, + const StreamDateTimeConverter().toJson, + ), + 'muted': instance.muted, + 'own_capabilities': instance.ownCapabilities?.map((e) => e.toJson()).toList(), + 'team': instance.team, + 'truncated_at': _$JsonConverterToJson( + instance.truncatedAt, + const StreamDateTimeConverter().toJson, + ), + 'truncated_by': instance.truncatedBy?.toJson(), + 'type': instance.type, + 'updated_at': const StreamDateTimeConverter().toJson(instance.updatedAt), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/channel_state_response.dart b/packages/stream_chat/lib/open_api/model/channel_state_response.dart new file mode 100644 index 0000000000..8717392977 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_state_response.dart @@ -0,0 +1,107 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'channel_state_response.g.dart'; +part 'channel_state_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ChannelStateResponse with _$ChannelStateResponse { + const ChannelStateResponse({ + this.activeLiveLocations, + this.channel, + this.draft, + required this.duration, + this.hidden, + this.hideMessagesBefore, + required this.members, + this.membership, + required this.messages, + this.pendingMessages, + required this.pinnedMessages, + this.pushPreferences, + this.read, + required this.threads, + this.watcherCount, + this.watchers, + }); + + @override + @JsonKey(name: 'active_live_locations') + final List? activeLiveLocations; + + @override + @JsonKey(name: 'channel') + final ChannelResponse? channel; + + @override + @JsonKey(name: 'draft') + final DraftResponse? draft; + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'hidden') + final bool? hidden; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'hide_messages_before') + final DateTime? hideMessagesBefore; + + @override + @JsonKey(name: 'members') + final List members; + + @override + @JsonKey(name: 'membership') + final ChannelMemberResponse? membership; + + @override + @JsonKey(name: 'messages') + final List messages; + + @override + @JsonKey(name: 'pending_messages') + final List? pendingMessages; + + @override + @JsonKey(name: 'pinned_messages') + final List pinnedMessages; + + @override + @JsonKey(name: 'push_preferences') + final ChannelPushPreferencesResponse? pushPreferences; + + @override + @JsonKey(name: 'read') + final List? read; + + @override + @JsonKey(name: 'threads') + final List threads; + + @override + @JsonKey(name: 'watcher_count') + final int? watcherCount; + + @override + @JsonKey(name: 'watchers') + final List? watchers; + + Map toJson() => _$ChannelStateResponseToJson(this); + + static ChannelStateResponse fromJson(Map json) => _$ChannelStateResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/channel_state_response.freezed.dart b/packages/stream_chat/lib/open_api/model/channel_state_response.freezed.dart new file mode 100644 index 0000000000..7db14a630b --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_state_response.freezed.dart @@ -0,0 +1,228 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'channel_state_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ChannelStateResponse { + List? get activeLiveLocations; + ChannelResponse? get channel; + DraftResponse? get draft; + String get duration; + bool? get hidden; + DateTime? get hideMessagesBefore; + List get members; + ChannelMemberResponse? get membership; + List get messages; + List? get pendingMessages; + List get pinnedMessages; + ChannelPushPreferencesResponse? get pushPreferences; + List? get read; + List get threads; + int? get watcherCount; + List? get watchers; + + /// Create a copy of ChannelStateResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ChannelStateResponseCopyWith get copyWith => + _$ChannelStateResponseCopyWithImpl( + this as ChannelStateResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ChannelStateResponse && + const DeepCollectionEquality().equals( + other.activeLiveLocations, + activeLiveLocations, + ) && + (identical(other.channel, channel) || other.channel == channel) && + (identical(other.draft, draft) || other.draft == draft) && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.hidden, hidden) || other.hidden == hidden) && + (identical(other.hideMessagesBefore, hideMessagesBefore) || + other.hideMessagesBefore == hideMessagesBefore) && + const DeepCollectionEquality().equals(other.members, members) && + (identical(other.membership, membership) || other.membership == membership) && + const DeepCollectionEquality().equals(other.messages, messages) && + const DeepCollectionEquality().equals( + other.pendingMessages, + pendingMessages, + ) && + const DeepCollectionEquality().equals( + other.pinnedMessages, + pinnedMessages, + ) && + (identical(other.pushPreferences, pushPreferences) || other.pushPreferences == pushPreferences) && + const DeepCollectionEquality().equals(other.read, read) && + const DeepCollectionEquality().equals(other.threads, threads) && + (identical(other.watcherCount, watcherCount) || other.watcherCount == watcherCount) && + const DeepCollectionEquality().equals(other.watchers, watchers)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(activeLiveLocations), + channel, + draft, + duration, + hidden, + hideMessagesBefore, + const DeepCollectionEquality().hash(members), + membership, + const DeepCollectionEquality().hash(messages), + const DeepCollectionEquality().hash(pendingMessages), + const DeepCollectionEquality().hash(pinnedMessages), + pushPreferences, + const DeepCollectionEquality().hash(read), + const DeepCollectionEquality().hash(threads), + watcherCount, + const DeepCollectionEquality().hash(watchers), + ); + + @override + String toString() { + return 'ChannelStateResponse(activeLiveLocations: $activeLiveLocations, channel: $channel, draft: $draft, duration: $duration, hidden: $hidden, hideMessagesBefore: $hideMessagesBefore, members: $members, membership: $membership, messages: $messages, pendingMessages: $pendingMessages, pinnedMessages: $pinnedMessages, pushPreferences: $pushPreferences, read: $read, threads: $threads, watcherCount: $watcherCount, watchers: $watchers)'; + } +} + +/// @nodoc +abstract mixin class $ChannelStateResponseCopyWith<$Res> { + factory $ChannelStateResponseCopyWith( + ChannelStateResponse value, + $Res Function(ChannelStateResponse) _then, + ) = _$ChannelStateResponseCopyWithImpl; + @useResult + $Res call({ + List? activeLiveLocations, + ChannelResponse? channel, + DraftResponse? draft, + String duration, + bool? hidden, + DateTime? hideMessagesBefore, + List members, + ChannelMemberResponse? membership, + List messages, + List? pendingMessages, + List pinnedMessages, + ChannelPushPreferencesResponse? pushPreferences, + List? read, + List threads, + int? watcherCount, + List? watchers, + }); +} + +/// @nodoc +class _$ChannelStateResponseCopyWithImpl<$Res> implements $ChannelStateResponseCopyWith<$Res> { + _$ChannelStateResponseCopyWithImpl(this._self, this._then); + + final ChannelStateResponse _self; + final $Res Function(ChannelStateResponse) _then; + + /// Create a copy of ChannelStateResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? activeLiveLocations = freezed, + Object? channel = freezed, + Object? draft = freezed, + Object? duration = null, + Object? hidden = freezed, + Object? hideMessagesBefore = freezed, + Object? members = null, + Object? membership = freezed, + Object? messages = null, + Object? pendingMessages = freezed, + Object? pinnedMessages = null, + Object? pushPreferences = freezed, + Object? read = freezed, + Object? threads = null, + Object? watcherCount = freezed, + Object? watchers = freezed, + }) { + return _then( + ChannelStateResponse( + activeLiveLocations: freezed == activeLiveLocations + ? _self.activeLiveLocations + : activeLiveLocations // ignore: cast_nullable_to_non_nullable + as List?, + channel: freezed == channel + ? _self.channel + : channel // ignore: cast_nullable_to_non_nullable + as ChannelResponse?, + draft: freezed == draft + ? _self.draft + : draft // ignore: cast_nullable_to_non_nullable + as DraftResponse?, + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + hidden: freezed == hidden + ? _self.hidden + : hidden // ignore: cast_nullable_to_non_nullable + as bool?, + hideMessagesBefore: freezed == hideMessagesBefore + ? _self.hideMessagesBefore + : hideMessagesBefore // ignore: cast_nullable_to_non_nullable + as DateTime?, + members: null == members + ? _self.members + : members // ignore: cast_nullable_to_non_nullable + as List, + membership: freezed == membership + ? _self.membership + : membership // ignore: cast_nullable_to_non_nullable + as ChannelMemberResponse?, + messages: null == messages + ? _self.messages + : messages // ignore: cast_nullable_to_non_nullable + as List, + pendingMessages: freezed == pendingMessages + ? _self.pendingMessages + : pendingMessages // ignore: cast_nullable_to_non_nullable + as List?, + pinnedMessages: null == pinnedMessages + ? _self.pinnedMessages + : pinnedMessages // ignore: cast_nullable_to_non_nullable + as List, + pushPreferences: freezed == pushPreferences + ? _self.pushPreferences + : pushPreferences // ignore: cast_nullable_to_non_nullable + as ChannelPushPreferencesResponse?, + read: freezed == read + ? _self.read + : read // ignore: cast_nullable_to_non_nullable + as List?, + threads: null == threads + ? _self.threads + : threads // ignore: cast_nullable_to_non_nullable + as List, + watcherCount: freezed == watcherCount + ? _self.watcherCount + : watcherCount // ignore: cast_nullable_to_non_nullable + as int?, + watchers: freezed == watchers + ? _self.watchers + : watchers // ignore: cast_nullable_to_non_nullable + as List?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/channel_state_response.g.dart b/packages/stream_chat/lib/open_api/model/channel_state_response.g.dart new file mode 100644 index 0000000000..db105f7eba --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_state_response.g.dart @@ -0,0 +1,87 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'channel_state_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ChannelStateResponse _$ChannelStateResponseFromJson( + Map json, +) => ChannelStateResponse( + activeLiveLocations: (json['active_live_locations'] as List?) + ?.map( + (e) => SharedLocationResponseData.fromJson(e as Map), + ) + .toList(), + channel: json['channel'] == null ? null : ChannelResponse.fromJson(json['channel'] as Map), + draft: json['draft'] == null ? null : DraftResponse.fromJson(json['draft'] as Map), + duration: json['duration'] as String, + hidden: json['hidden'] as bool?, + hideMessagesBefore: _$JsonConverterFromJson( + json['hide_messages_before'], + const StreamDateTimeConverter().fromJson, + ), + members: (json['members'] as List) + .map((e) => ChannelMemberResponse.fromJson(e as Map)) + .toList(), + membership: json['membership'] == null + ? null + : ChannelMemberResponse.fromJson( + json['membership'] as Map, + ), + messages: (json['messages'] as List) + .map((e) => MessageResponse.fromJson(e as Map)) + .toList(), + pendingMessages: (json['pending_messages'] as List?) + ?.map((e) => PendingMessageResponse.fromJson(e as Map)) + .toList(), + pinnedMessages: (json['pinned_messages'] as List) + .map((e) => MessageResponse.fromJson(e as Map)) + .toList(), + pushPreferences: json['push_preferences'] == null + ? null + : ChannelPushPreferencesResponse.fromJson( + json['push_preferences'] as Map, + ), + read: (json['read'] as List?)?.map((e) => ReadStateResponse.fromJson(e as Map)).toList(), + threads: (json['threads'] as List) + .map((e) => ThreadStateResponse.fromJson(e as Map)) + .toList(), + watcherCount: (json['watcher_count'] as num?)?.toInt(), + watchers: (json['watchers'] as List?)?.map((e) => UserResponse.fromJson(e as Map)).toList(), +); + +Map _$ChannelStateResponseToJson( + ChannelStateResponse instance, +) => { + 'active_live_locations': instance.activeLiveLocations?.map((e) => e.toJson()).toList(), + 'channel': instance.channel?.toJson(), + 'draft': instance.draft?.toJson(), + 'duration': instance.duration, + 'hidden': instance.hidden, + 'hide_messages_before': _$JsonConverterToJson( + instance.hideMessagesBefore, + const StreamDateTimeConverter().toJson, + ), + 'members': instance.members.map((e) => e.toJson()).toList(), + 'membership': instance.membership?.toJson(), + 'messages': instance.messages.map((e) => e.toJson()).toList(), + 'pending_messages': instance.pendingMessages?.map((e) => e.toJson()).toList(), + 'pinned_messages': instance.pinnedMessages.map((e) => e.toJson()).toList(), + 'push_preferences': instance.pushPreferences?.toJson(), + 'read': instance.read?.map((e) => e.toJson()).toList(), + 'threads': instance.threads.map((e) => e.toJson()).toList(), + 'watcher_count': instance.watcherCount, + 'watchers': instance.watchers?.map((e) => e.toJson()).toList(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/channel_state_response_fields.dart b/packages/stream_chat/lib/open_api/model/channel_state_response_fields.dart new file mode 100644 index 0000000000..b0c3e9a97c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_state_response_fields.dart @@ -0,0 +1,102 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'channel_state_response_fields.g.dart'; +part 'channel_state_response_fields.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ChannelStateResponseFields with _$ChannelStateResponseFields { + const ChannelStateResponseFields({ + this.activeLiveLocations, + this.channel, + this.draft, + this.hidden, + this.hideMessagesBefore, + required this.members, + this.membership, + required this.messages, + this.pendingMessages, + required this.pinnedMessages, + this.pushPreferences, + this.read, + required this.threads, + this.watcherCount, + this.watchers, + }); + + @override + @JsonKey(name: 'active_live_locations') + final List? activeLiveLocations; + + @override + @JsonKey(name: 'channel') + final ChannelResponse? channel; + + @override + @JsonKey(name: 'draft') + final DraftResponse? draft; + + @override + @JsonKey(name: 'hidden') + final bool? hidden; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'hide_messages_before') + final DateTime? hideMessagesBefore; + + @override + @JsonKey(name: 'members') + final List members; + + @override + @JsonKey(name: 'membership') + final ChannelMemberResponse? membership; + + @override + @JsonKey(name: 'messages') + final List messages; + + @override + @JsonKey(name: 'pending_messages') + final List? pendingMessages; + + @override + @JsonKey(name: 'pinned_messages') + final List pinnedMessages; + + @override + @JsonKey(name: 'push_preferences') + final ChannelPushPreferencesResponse? pushPreferences; + + @override + @JsonKey(name: 'read') + final List? read; + + @override + @JsonKey(name: 'threads') + final List threads; + + @override + @JsonKey(name: 'watcher_count') + final int? watcherCount; + + @override + @JsonKey(name: 'watchers') + final List? watchers; + + Map toJson() => _$ChannelStateResponseFieldsToJson(this); + + static ChannelStateResponseFields fromJson(Map json) => _$ChannelStateResponseFieldsFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/channel_state_response_fields.freezed.dart b/packages/stream_chat/lib/open_api/model/channel_state_response_fields.freezed.dart new file mode 100644 index 0000000000..dd952764cb --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_state_response_fields.freezed.dart @@ -0,0 +1,219 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'channel_state_response_fields.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ChannelStateResponseFields { + List? get activeLiveLocations; + ChannelResponse? get channel; + DraftResponse? get draft; + bool? get hidden; + DateTime? get hideMessagesBefore; + List get members; + ChannelMemberResponse? get membership; + List get messages; + List? get pendingMessages; + List get pinnedMessages; + ChannelPushPreferencesResponse? get pushPreferences; + List? get read; + List get threads; + int? get watcherCount; + List? get watchers; + + /// Create a copy of ChannelStateResponseFields + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ChannelStateResponseFieldsCopyWith get copyWith => + _$ChannelStateResponseFieldsCopyWithImpl( + this as ChannelStateResponseFields, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ChannelStateResponseFields && + const DeepCollectionEquality().equals( + other.activeLiveLocations, + activeLiveLocations, + ) && + (identical(other.channel, channel) || other.channel == channel) && + (identical(other.draft, draft) || other.draft == draft) && + (identical(other.hidden, hidden) || other.hidden == hidden) && + (identical(other.hideMessagesBefore, hideMessagesBefore) || + other.hideMessagesBefore == hideMessagesBefore) && + const DeepCollectionEquality().equals(other.members, members) && + (identical(other.membership, membership) || other.membership == membership) && + const DeepCollectionEquality().equals(other.messages, messages) && + const DeepCollectionEquality().equals( + other.pendingMessages, + pendingMessages, + ) && + const DeepCollectionEquality().equals( + other.pinnedMessages, + pinnedMessages, + ) && + (identical(other.pushPreferences, pushPreferences) || other.pushPreferences == pushPreferences) && + const DeepCollectionEquality().equals(other.read, read) && + const DeepCollectionEquality().equals(other.threads, threads) && + (identical(other.watcherCount, watcherCount) || other.watcherCount == watcherCount) && + const DeepCollectionEquality().equals(other.watchers, watchers)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(activeLiveLocations), + channel, + draft, + hidden, + hideMessagesBefore, + const DeepCollectionEquality().hash(members), + membership, + const DeepCollectionEquality().hash(messages), + const DeepCollectionEquality().hash(pendingMessages), + const DeepCollectionEquality().hash(pinnedMessages), + pushPreferences, + const DeepCollectionEquality().hash(read), + const DeepCollectionEquality().hash(threads), + watcherCount, + const DeepCollectionEquality().hash(watchers), + ); + + @override + String toString() { + return 'ChannelStateResponseFields(activeLiveLocations: $activeLiveLocations, channel: $channel, draft: $draft, hidden: $hidden, hideMessagesBefore: $hideMessagesBefore, members: $members, membership: $membership, messages: $messages, pendingMessages: $pendingMessages, pinnedMessages: $pinnedMessages, pushPreferences: $pushPreferences, read: $read, threads: $threads, watcherCount: $watcherCount, watchers: $watchers)'; + } +} + +/// @nodoc +abstract mixin class $ChannelStateResponseFieldsCopyWith<$Res> { + factory $ChannelStateResponseFieldsCopyWith( + ChannelStateResponseFields value, + $Res Function(ChannelStateResponseFields) _then, + ) = _$ChannelStateResponseFieldsCopyWithImpl; + @useResult + $Res call({ + List? activeLiveLocations, + ChannelResponse? channel, + DraftResponse? draft, + bool? hidden, + DateTime? hideMessagesBefore, + List members, + ChannelMemberResponse? membership, + List messages, + List? pendingMessages, + List pinnedMessages, + ChannelPushPreferencesResponse? pushPreferences, + List? read, + List threads, + int? watcherCount, + List? watchers, + }); +} + +/// @nodoc +class _$ChannelStateResponseFieldsCopyWithImpl<$Res> implements $ChannelStateResponseFieldsCopyWith<$Res> { + _$ChannelStateResponseFieldsCopyWithImpl(this._self, this._then); + + final ChannelStateResponseFields _self; + final $Res Function(ChannelStateResponseFields) _then; + + /// Create a copy of ChannelStateResponseFields + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? activeLiveLocations = freezed, + Object? channel = freezed, + Object? draft = freezed, + Object? hidden = freezed, + Object? hideMessagesBefore = freezed, + Object? members = null, + Object? membership = freezed, + Object? messages = null, + Object? pendingMessages = freezed, + Object? pinnedMessages = null, + Object? pushPreferences = freezed, + Object? read = freezed, + Object? threads = null, + Object? watcherCount = freezed, + Object? watchers = freezed, + }) { + return _then( + ChannelStateResponseFields( + activeLiveLocations: freezed == activeLiveLocations + ? _self.activeLiveLocations + : activeLiveLocations // ignore: cast_nullable_to_non_nullable + as List?, + channel: freezed == channel + ? _self.channel + : channel // ignore: cast_nullable_to_non_nullable + as ChannelResponse?, + draft: freezed == draft + ? _self.draft + : draft // ignore: cast_nullable_to_non_nullable + as DraftResponse?, + hidden: freezed == hidden + ? _self.hidden + : hidden // ignore: cast_nullable_to_non_nullable + as bool?, + hideMessagesBefore: freezed == hideMessagesBefore + ? _self.hideMessagesBefore + : hideMessagesBefore // ignore: cast_nullable_to_non_nullable + as DateTime?, + members: null == members + ? _self.members + : members // ignore: cast_nullable_to_non_nullable + as List, + membership: freezed == membership + ? _self.membership + : membership // ignore: cast_nullable_to_non_nullable + as ChannelMemberResponse?, + messages: null == messages + ? _self.messages + : messages // ignore: cast_nullable_to_non_nullable + as List, + pendingMessages: freezed == pendingMessages + ? _self.pendingMessages + : pendingMessages // ignore: cast_nullable_to_non_nullable + as List?, + pinnedMessages: null == pinnedMessages + ? _self.pinnedMessages + : pinnedMessages // ignore: cast_nullable_to_non_nullable + as List, + pushPreferences: freezed == pushPreferences + ? _self.pushPreferences + : pushPreferences // ignore: cast_nullable_to_non_nullable + as ChannelPushPreferencesResponse?, + read: freezed == read + ? _self.read + : read // ignore: cast_nullable_to_non_nullable + as List?, + threads: null == threads + ? _self.threads + : threads // ignore: cast_nullable_to_non_nullable + as List, + watcherCount: freezed == watcherCount + ? _self.watcherCount + : watcherCount // ignore: cast_nullable_to_non_nullable + as int?, + watchers: freezed == watchers + ? _self.watchers + : watchers // ignore: cast_nullable_to_non_nullable + as List?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/channel_state_response_fields.g.dart b/packages/stream_chat/lib/open_api/model/channel_state_response_fields.g.dart new file mode 100644 index 0000000000..79f96d4f69 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_state_response_fields.g.dart @@ -0,0 +1,85 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'channel_state_response_fields.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ChannelStateResponseFields _$ChannelStateResponseFieldsFromJson( + Map json, +) => ChannelStateResponseFields( + activeLiveLocations: (json['active_live_locations'] as List?) + ?.map( + (e) => SharedLocationResponseData.fromJson(e as Map), + ) + .toList(), + channel: json['channel'] == null ? null : ChannelResponse.fromJson(json['channel'] as Map), + draft: json['draft'] == null ? null : DraftResponse.fromJson(json['draft'] as Map), + hidden: json['hidden'] as bool?, + hideMessagesBefore: _$JsonConverterFromJson( + json['hide_messages_before'], + const StreamDateTimeConverter().fromJson, + ), + members: (json['members'] as List) + .map((e) => ChannelMemberResponse.fromJson(e as Map)) + .toList(), + membership: json['membership'] == null + ? null + : ChannelMemberResponse.fromJson( + json['membership'] as Map, + ), + messages: (json['messages'] as List) + .map((e) => MessageResponse.fromJson(e as Map)) + .toList(), + pendingMessages: (json['pending_messages'] as List?) + ?.map((e) => PendingMessageResponse.fromJson(e as Map)) + .toList(), + pinnedMessages: (json['pinned_messages'] as List) + .map((e) => MessageResponse.fromJson(e as Map)) + .toList(), + pushPreferences: json['push_preferences'] == null + ? null + : ChannelPushPreferencesResponse.fromJson( + json['push_preferences'] as Map, + ), + read: (json['read'] as List?)?.map((e) => ReadStateResponse.fromJson(e as Map)).toList(), + threads: (json['threads'] as List) + .map((e) => ThreadStateResponse.fromJson(e as Map)) + .toList(), + watcherCount: (json['watcher_count'] as num?)?.toInt(), + watchers: (json['watchers'] as List?)?.map((e) => UserResponse.fromJson(e as Map)).toList(), +); + +Map _$ChannelStateResponseFieldsToJson( + ChannelStateResponseFields instance, +) => { + 'active_live_locations': instance.activeLiveLocations?.map((e) => e.toJson()).toList(), + 'channel': instance.channel?.toJson(), + 'draft': instance.draft?.toJson(), + 'hidden': instance.hidden, + 'hide_messages_before': _$JsonConverterToJson( + instance.hideMessagesBefore, + const StreamDateTimeConverter().toJson, + ), + 'members': instance.members.map((e) => e.toJson()).toList(), + 'membership': instance.membership?.toJson(), + 'messages': instance.messages.map((e) => e.toJson()).toList(), + 'pending_messages': instance.pendingMessages?.map((e) => e.toJson()).toList(), + 'pinned_messages': instance.pinnedMessages.map((e) => e.toJson()).toList(), + 'push_preferences': instance.pushPreferences?.toJson(), + 'read': instance.read?.map((e) => e.toJson()).toList(), + 'threads': instance.threads.map((e) => e.toJson()).toList(), + 'watcher_count': instance.watcherCount, + 'watchers': instance.watchers?.map((e) => e.toJson()).toList(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/channel_truncated_event.dart b/packages/stream_chat/lib/open_api/model/channel_truncated_event.dart new file mode 100644 index 0000000000..21f7970c9c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_truncated_event.dart @@ -0,0 +1,103 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'channel_truncated_event.g.dart'; +part 'channel_truncated_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ChannelTruncatedEvent extends core.WsEvent with _$ChannelTruncatedEvent { + const ChannelTruncatedEvent({ + required this.channel, + this.channelCustom, + this.channelId, + this.channelMemberCount, + this.channelMessageCount, + this.channelType, + this.cid, + required this.createdAt, + required this.custom, + this.message, + this.messageId, + this.receivedAt, + this.team, + required this.type, + this.user, + }); + + @override + @JsonKey(name: 'channel') + final ChannelResponse channel; + + @override + @JsonKey(name: 'channel_custom') + final Map? channelCustom; + + @override + @JsonKey(name: 'channel_id') + final String? channelId; + + @override + @JsonKey(name: 'channel_member_count') + final int? channelMemberCount; + + @override + @JsonKey(name: 'channel_message_count') + final int? channelMessageCount; + + @override + @JsonKey(name: 'channel_type') + final String? channelType; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'message') + final MessageResponse? message; + + @override + @JsonKey(name: 'message_id') + final String? messageId; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'team') + final String? team; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'user') + final UserResponseCommonFields? user; + + Map toJson() => _$ChannelTruncatedEventToJson(this); + + static ChannelTruncatedEvent fromJson(Map json) => _$ChannelTruncatedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/channel_truncated_event.freezed.dart b/packages/stream_chat/lib/open_api/model/channel_truncated_event.freezed.dart new file mode 100644 index 0000000000..5ed1e379e5 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_truncated_event.freezed.dart @@ -0,0 +1,214 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'channel_truncated_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ChannelTruncatedEvent { + ChannelResponse get channel; + Map? get channelCustom; + String? get channelId; + int? get channelMemberCount; + int? get channelMessageCount; + String? get channelType; + String? get cid; + DateTime get createdAt; + Map get custom; + MessageResponse? get message; + String? get messageId; + DateTime? get receivedAt; + String? get team; + String get type; + UserResponseCommonFields? get user; + + /// Create a copy of ChannelTruncatedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ChannelTruncatedEventCopyWith get copyWith => + _$ChannelTruncatedEventCopyWithImpl( + this as ChannelTruncatedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ChannelTruncatedEvent && + (identical(other.channel, channel) || other.channel == channel) && + const DeepCollectionEquality().equals( + other.channelCustom, + channelCustom, + ) && + (identical(other.channelId, channelId) || other.channelId == channelId) && + (identical(other.channelMemberCount, channelMemberCount) || + other.channelMemberCount == channelMemberCount) && + (identical(other.channelMessageCount, channelMessageCount) || + other.channelMessageCount == channelMessageCount) && + (identical(other.channelType, channelType) || other.channelType == channelType) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.message, message) || other.message == message) && + (identical(other.messageId, messageId) || other.messageId == messageId) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.team, team) || other.team == team) && + (identical(other.type, type) || other.type == type) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channel, + const DeepCollectionEquality().hash(channelCustom), + channelId, + channelMemberCount, + channelMessageCount, + channelType, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + message, + messageId, + receivedAt, + team, + type, + user, + ); + + @override + String toString() { + return 'ChannelTruncatedEvent(channel: $channel, channelCustom: $channelCustom, channelId: $channelId, channelMemberCount: $channelMemberCount, channelMessageCount: $channelMessageCount, channelType: $channelType, cid: $cid, createdAt: $createdAt, custom: $custom, message: $message, messageId: $messageId, receivedAt: $receivedAt, team: $team, type: $type, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $ChannelTruncatedEventCopyWith<$Res> { + factory $ChannelTruncatedEventCopyWith( + ChannelTruncatedEvent value, + $Res Function(ChannelTruncatedEvent) _then, + ) = _$ChannelTruncatedEventCopyWithImpl; + @useResult + $Res call({ + ChannelResponse channel, + Map? channelCustom, + String? channelId, + int? channelMemberCount, + int? channelMessageCount, + String? channelType, + String? cid, + DateTime createdAt, + Map custom, + MessageResponse? message, + String? messageId, + DateTime? receivedAt, + String? team, + String type, + UserResponseCommonFields? user, + }); +} + +/// @nodoc +class _$ChannelTruncatedEventCopyWithImpl<$Res> implements $ChannelTruncatedEventCopyWith<$Res> { + _$ChannelTruncatedEventCopyWithImpl(this._self, this._then); + + final ChannelTruncatedEvent _self; + final $Res Function(ChannelTruncatedEvent) _then; + + /// Create a copy of ChannelTruncatedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channel = null, + Object? channelCustom = freezed, + Object? channelId = freezed, + Object? channelMemberCount = freezed, + Object? channelMessageCount = freezed, + Object? channelType = freezed, + Object? cid = freezed, + Object? createdAt = null, + Object? custom = null, + Object? message = freezed, + Object? messageId = freezed, + Object? receivedAt = freezed, + Object? team = freezed, + Object? type = null, + Object? user = freezed, + }) { + return _then( + ChannelTruncatedEvent( + channel: null == channel + ? _self.channel + : channel // ignore: cast_nullable_to_non_nullable + as ChannelResponse, + channelCustom: freezed == channelCustom + ? _self.channelCustom + : channelCustom // ignore: cast_nullable_to_non_nullable + as Map?, + channelId: freezed == channelId + ? _self.channelId + : channelId // ignore: cast_nullable_to_non_nullable + as String?, + channelMemberCount: freezed == channelMemberCount + ? _self.channelMemberCount + : channelMemberCount // ignore: cast_nullable_to_non_nullable + as int?, + channelMessageCount: freezed == channelMessageCount + ? _self.channelMessageCount + : channelMessageCount // ignore: cast_nullable_to_non_nullable + as int?, + channelType: freezed == channelType + ? _self.channelType + : channelType // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + message: freezed == message + ? _self.message + : message // ignore: cast_nullable_to_non_nullable + as MessageResponse?, + messageId: freezed == messageId + ? _self.messageId + : messageId // ignore: cast_nullable_to_non_nullable + as String?, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + team: freezed == team + ? _self.team + : team // ignore: cast_nullable_to_non_nullable + as String?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponseCommonFields?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/channel_truncated_event.g.dart b/packages/stream_chat/lib/open_api/model/channel_truncated_event.g.dart new file mode 100644 index 0000000000..d6d8435822 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_truncated_event.g.dart @@ -0,0 +1,65 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'channel_truncated_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ChannelTruncatedEvent _$ChannelTruncatedEventFromJson( + Map json, +) => ChannelTruncatedEvent( + channel: ChannelResponse.fromJson(json['channel'] as Map), + channelCustom: json['channel_custom'] as Map?, + channelId: json['channel_id'] as String?, + channelMemberCount: (json['channel_member_count'] as num?)?.toInt(), + channelMessageCount: (json['channel_message_count'] as num?)?.toInt(), + channelType: json['channel_type'] as String?, + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + message: json['message'] == null ? null : MessageResponse.fromJson(json['message'] as Map), + messageId: json['message_id'] as String?, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + team: json['team'] as String?, + type: json['type'] as String, + user: json['user'] == null ? null : UserResponseCommonFields.fromJson(json['user'] as Map), +); + +Map _$ChannelTruncatedEventToJson( + ChannelTruncatedEvent instance, +) => { + 'channel': instance.channel.toJson(), + 'channel_custom': instance.channelCustom, + 'channel_id': instance.channelId, + 'channel_member_count': instance.channelMemberCount, + 'channel_message_count': instance.channelMessageCount, + 'channel_type': instance.channelType, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'message': instance.message?.toJson(), + 'message_id': instance.messageId, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'team': instance.team, + 'type': instance.type, + 'user': instance.user?.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/channel_un_frozen_event.dart b/packages/stream_chat/lib/open_api/model/channel_un_frozen_event.dart new file mode 100644 index 0000000000..9a93290851 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_un_frozen_event.dart @@ -0,0 +1,63 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'channel_un_frozen_event.g.dart'; +part 'channel_un_frozen_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ChannelUnFrozenEvent extends core.WsEvent with _$ChannelUnFrozenEvent { + const ChannelUnFrozenEvent({ + this.channelId, + this.channelType, + this.cid, + required this.createdAt, + required this.custom, + this.receivedAt, + required this.type, + }); + + @override + @JsonKey(name: 'channel_id') + final String? channelId; + + @override + @JsonKey(name: 'channel_type') + final String? channelType; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'type') + final String type; + + Map toJson() => _$ChannelUnFrozenEventToJson(this); + + static ChannelUnFrozenEvent fromJson(Map json) => _$ChannelUnFrozenEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/channel_un_frozen_event.freezed.dart b/packages/stream_chat/lib/open_api/model/channel_un_frozen_event.freezed.dart new file mode 100644 index 0000000000..51c946df4f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_un_frozen_event.freezed.dart @@ -0,0 +1,137 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'channel_un_frozen_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ChannelUnFrozenEvent { + String? get channelId; + String? get channelType; + String? get cid; + DateTime get createdAt; + Map get custom; + DateTime? get receivedAt; + String get type; + + /// Create a copy of ChannelUnFrozenEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ChannelUnFrozenEventCopyWith get copyWith => + _$ChannelUnFrozenEventCopyWithImpl( + this as ChannelUnFrozenEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ChannelUnFrozenEvent && + (identical(other.channelId, channelId) || other.channelId == channelId) && + (identical(other.channelType, channelType) || other.channelType == channelType) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.type, type) || other.type == type)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channelId, + channelType, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + receivedAt, + type, + ); + + @override + String toString() { + return 'ChannelUnFrozenEvent(channelId: $channelId, channelType: $channelType, cid: $cid, createdAt: $createdAt, custom: $custom, receivedAt: $receivedAt, type: $type)'; + } +} + +/// @nodoc +abstract mixin class $ChannelUnFrozenEventCopyWith<$Res> { + factory $ChannelUnFrozenEventCopyWith( + ChannelUnFrozenEvent value, + $Res Function(ChannelUnFrozenEvent) _then, + ) = _$ChannelUnFrozenEventCopyWithImpl; + @useResult + $Res call({ + String? channelId, + String? channelType, + String? cid, + DateTime createdAt, + Map custom, + DateTime? receivedAt, + String type, + }); +} + +/// @nodoc +class _$ChannelUnFrozenEventCopyWithImpl<$Res> implements $ChannelUnFrozenEventCopyWith<$Res> { + _$ChannelUnFrozenEventCopyWithImpl(this._self, this._then); + + final ChannelUnFrozenEvent _self; + final $Res Function(ChannelUnFrozenEvent) _then; + + /// Create a copy of ChannelUnFrozenEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channelId = freezed, + Object? channelType = freezed, + Object? cid = freezed, + Object? createdAt = null, + Object? custom = null, + Object? receivedAt = freezed, + Object? type = null, + }) { + return _then( + ChannelUnFrozenEvent( + channelId: freezed == channelId + ? _self.channelId + : channelId // ignore: cast_nullable_to_non_nullable + as String?, + channelType: freezed == channelType + ? _self.channelType + : channelType // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/channel_un_frozen_event.g.dart b/packages/stream_chat/lib/open_api/model/channel_un_frozen_event.g.dart new file mode 100644 index 0000000000..67fbefb0e0 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_un_frozen_event.g.dart @@ -0,0 +1,49 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'channel_un_frozen_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ChannelUnFrozenEvent _$ChannelUnFrozenEventFromJson( + Map json, +) => ChannelUnFrozenEvent( + channelId: json['channel_id'] as String?, + channelType: json['channel_type'] as String?, + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + type: json['type'] as String, +); + +Map _$ChannelUnFrozenEventToJson( + ChannelUnFrozenEvent instance, +) => { + 'channel_id': instance.channelId, + 'channel_type': instance.channelType, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'type': instance.type, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/channel_updated_event.dart b/packages/stream_chat/lib/open_api/model/channel_updated_event.dart new file mode 100644 index 0000000000..99fe1ceb8a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_updated_event.dart @@ -0,0 +1,103 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'channel_updated_event.g.dart'; +part 'channel_updated_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ChannelUpdatedEvent extends core.WsEvent with _$ChannelUpdatedEvent { + const ChannelUpdatedEvent({ + required this.channel, + this.channelCustom, + this.channelId, + this.channelMemberCount, + this.channelMessageCount, + this.channelType, + this.cid, + required this.createdAt, + required this.custom, + this.message, + this.messageId, + this.receivedAt, + this.team, + required this.type, + this.user, + }); + + @override + @JsonKey(name: 'channel') + final ChannelResponse channel; + + @override + @JsonKey(name: 'channel_custom') + final Map? channelCustom; + + @override + @JsonKey(name: 'channel_id') + final String? channelId; + + @override + @JsonKey(name: 'channel_member_count') + final int? channelMemberCount; + + @override + @JsonKey(name: 'channel_message_count') + final int? channelMessageCount; + + @override + @JsonKey(name: 'channel_type') + final String? channelType; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'message') + final MessageResponse? message; + + @override + @JsonKey(name: 'message_id') + final String? messageId; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'team') + final String? team; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'user') + final UserResponseCommonFields? user; + + Map toJson() => _$ChannelUpdatedEventToJson(this); + + static ChannelUpdatedEvent fromJson(Map json) => _$ChannelUpdatedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/channel_updated_event.freezed.dart b/packages/stream_chat/lib/open_api/model/channel_updated_event.freezed.dart new file mode 100644 index 0000000000..c1d9e58ffb --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_updated_event.freezed.dart @@ -0,0 +1,214 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'channel_updated_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ChannelUpdatedEvent { + ChannelResponse get channel; + Map? get channelCustom; + String? get channelId; + int? get channelMemberCount; + int? get channelMessageCount; + String? get channelType; + String? get cid; + DateTime get createdAt; + Map get custom; + MessageResponse? get message; + String? get messageId; + DateTime? get receivedAt; + String? get team; + String get type; + UserResponseCommonFields? get user; + + /// Create a copy of ChannelUpdatedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ChannelUpdatedEventCopyWith get copyWith => + _$ChannelUpdatedEventCopyWithImpl( + this as ChannelUpdatedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ChannelUpdatedEvent && + (identical(other.channel, channel) || other.channel == channel) && + const DeepCollectionEquality().equals( + other.channelCustom, + channelCustom, + ) && + (identical(other.channelId, channelId) || other.channelId == channelId) && + (identical(other.channelMemberCount, channelMemberCount) || + other.channelMemberCount == channelMemberCount) && + (identical(other.channelMessageCount, channelMessageCount) || + other.channelMessageCount == channelMessageCount) && + (identical(other.channelType, channelType) || other.channelType == channelType) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.message, message) || other.message == message) && + (identical(other.messageId, messageId) || other.messageId == messageId) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.team, team) || other.team == team) && + (identical(other.type, type) || other.type == type) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channel, + const DeepCollectionEquality().hash(channelCustom), + channelId, + channelMemberCount, + channelMessageCount, + channelType, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + message, + messageId, + receivedAt, + team, + type, + user, + ); + + @override + String toString() { + return 'ChannelUpdatedEvent(channel: $channel, channelCustom: $channelCustom, channelId: $channelId, channelMemberCount: $channelMemberCount, channelMessageCount: $channelMessageCount, channelType: $channelType, cid: $cid, createdAt: $createdAt, custom: $custom, message: $message, messageId: $messageId, receivedAt: $receivedAt, team: $team, type: $type, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $ChannelUpdatedEventCopyWith<$Res> { + factory $ChannelUpdatedEventCopyWith( + ChannelUpdatedEvent value, + $Res Function(ChannelUpdatedEvent) _then, + ) = _$ChannelUpdatedEventCopyWithImpl; + @useResult + $Res call({ + ChannelResponse channel, + Map? channelCustom, + String? channelId, + int? channelMemberCount, + int? channelMessageCount, + String? channelType, + String? cid, + DateTime createdAt, + Map custom, + MessageResponse? message, + String? messageId, + DateTime? receivedAt, + String? team, + String type, + UserResponseCommonFields? user, + }); +} + +/// @nodoc +class _$ChannelUpdatedEventCopyWithImpl<$Res> implements $ChannelUpdatedEventCopyWith<$Res> { + _$ChannelUpdatedEventCopyWithImpl(this._self, this._then); + + final ChannelUpdatedEvent _self; + final $Res Function(ChannelUpdatedEvent) _then; + + /// Create a copy of ChannelUpdatedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channel = null, + Object? channelCustom = freezed, + Object? channelId = freezed, + Object? channelMemberCount = freezed, + Object? channelMessageCount = freezed, + Object? channelType = freezed, + Object? cid = freezed, + Object? createdAt = null, + Object? custom = null, + Object? message = freezed, + Object? messageId = freezed, + Object? receivedAt = freezed, + Object? team = freezed, + Object? type = null, + Object? user = freezed, + }) { + return _then( + ChannelUpdatedEvent( + channel: null == channel + ? _self.channel + : channel // ignore: cast_nullable_to_non_nullable + as ChannelResponse, + channelCustom: freezed == channelCustom + ? _self.channelCustom + : channelCustom // ignore: cast_nullable_to_non_nullable + as Map?, + channelId: freezed == channelId + ? _self.channelId + : channelId // ignore: cast_nullable_to_non_nullable + as String?, + channelMemberCount: freezed == channelMemberCount + ? _self.channelMemberCount + : channelMemberCount // ignore: cast_nullable_to_non_nullable + as int?, + channelMessageCount: freezed == channelMessageCount + ? _self.channelMessageCount + : channelMessageCount // ignore: cast_nullable_to_non_nullable + as int?, + channelType: freezed == channelType + ? _self.channelType + : channelType // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + message: freezed == message + ? _self.message + : message // ignore: cast_nullable_to_non_nullable + as MessageResponse?, + messageId: freezed == messageId + ? _self.messageId + : messageId // ignore: cast_nullable_to_non_nullable + as String?, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + team: freezed == team + ? _self.team + : team // ignore: cast_nullable_to_non_nullable + as String?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponseCommonFields?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/channel_updated_event.g.dart b/packages/stream_chat/lib/open_api/model/channel_updated_event.g.dart new file mode 100644 index 0000000000..73671651ad --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_updated_event.g.dart @@ -0,0 +1,65 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'channel_updated_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ChannelUpdatedEvent _$ChannelUpdatedEventFromJson( + Map json, +) => ChannelUpdatedEvent( + channel: ChannelResponse.fromJson(json['channel'] as Map), + channelCustom: json['channel_custom'] as Map?, + channelId: json['channel_id'] as String?, + channelMemberCount: (json['channel_member_count'] as num?)?.toInt(), + channelMessageCount: (json['channel_message_count'] as num?)?.toInt(), + channelType: json['channel_type'] as String?, + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + message: json['message'] == null ? null : MessageResponse.fromJson(json['message'] as Map), + messageId: json['message_id'] as String?, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + team: json['team'] as String?, + type: json['type'] as String, + user: json['user'] == null ? null : UserResponseCommonFields.fromJson(json['user'] as Map), +); + +Map _$ChannelUpdatedEventToJson( + ChannelUpdatedEvent instance, +) => { + 'channel': instance.channel.toJson(), + 'channel_custom': instance.channelCustom, + 'channel_id': instance.channelId, + 'channel_member_count': instance.channelMemberCount, + 'channel_message_count': instance.channelMessageCount, + 'channel_type': instance.channelType, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'message': instance.message?.toJson(), + 'message_id': instance.messageId, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'team': instance.team, + 'type': instance.type, + 'user': instance.user?.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/channel_visible_event.dart b/packages/stream_chat/lib/open_api/model/channel_visible_event.dart new file mode 100644 index 0000000000..535ad1c1e9 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_visible_event.dart @@ -0,0 +1,93 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'channel_visible_event.g.dart'; +part 'channel_visible_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ChannelVisibleEvent extends core.WsEvent with _$ChannelVisibleEvent { + const ChannelVisibleEvent({ + required this.channel, + this.channelCustom, + this.channelId, + this.channelMemberCount, + this.channelMessageCount, + this.channelType, + this.cid, + required this.createdAt, + required this.custom, + this.receivedAt, + this.team, + required this.type, + this.user, + }); + + @override + @JsonKey(name: 'channel') + final ChannelResponse channel; + + @override + @JsonKey(name: 'channel_custom') + final Map? channelCustom; + + @override + @JsonKey(name: 'channel_id') + final String? channelId; + + @override + @JsonKey(name: 'channel_member_count') + final int? channelMemberCount; + + @override + @JsonKey(name: 'channel_message_count') + final int? channelMessageCount; + + @override + @JsonKey(name: 'channel_type') + final String? channelType; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'team') + final String? team; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'user') + final UserResponseCommonFields? user; + + Map toJson() => _$ChannelVisibleEventToJson(this); + + static ChannelVisibleEvent fromJson(Map json) => _$ChannelVisibleEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/channel_visible_event.freezed.dart b/packages/stream_chat/lib/open_api/model/channel_visible_event.freezed.dart new file mode 100644 index 0000000000..097883123e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_visible_event.freezed.dart @@ -0,0 +1,196 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'channel_visible_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ChannelVisibleEvent { + ChannelResponse get channel; + Map? get channelCustom; + String? get channelId; + int? get channelMemberCount; + int? get channelMessageCount; + String? get channelType; + String? get cid; + DateTime get createdAt; + Map get custom; + DateTime? get receivedAt; + String? get team; + String get type; + UserResponseCommonFields? get user; + + /// Create a copy of ChannelVisibleEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ChannelVisibleEventCopyWith get copyWith => + _$ChannelVisibleEventCopyWithImpl( + this as ChannelVisibleEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ChannelVisibleEvent && + (identical(other.channel, channel) || other.channel == channel) && + const DeepCollectionEquality().equals( + other.channelCustom, + channelCustom, + ) && + (identical(other.channelId, channelId) || other.channelId == channelId) && + (identical(other.channelMemberCount, channelMemberCount) || + other.channelMemberCount == channelMemberCount) && + (identical(other.channelMessageCount, channelMessageCount) || + other.channelMessageCount == channelMessageCount) && + (identical(other.channelType, channelType) || other.channelType == channelType) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.team, team) || other.team == team) && + (identical(other.type, type) || other.type == type) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channel, + const DeepCollectionEquality().hash(channelCustom), + channelId, + channelMemberCount, + channelMessageCount, + channelType, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + receivedAt, + team, + type, + user, + ); + + @override + String toString() { + return 'ChannelVisibleEvent(channel: $channel, channelCustom: $channelCustom, channelId: $channelId, channelMemberCount: $channelMemberCount, channelMessageCount: $channelMessageCount, channelType: $channelType, cid: $cid, createdAt: $createdAt, custom: $custom, receivedAt: $receivedAt, team: $team, type: $type, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $ChannelVisibleEventCopyWith<$Res> { + factory $ChannelVisibleEventCopyWith( + ChannelVisibleEvent value, + $Res Function(ChannelVisibleEvent) _then, + ) = _$ChannelVisibleEventCopyWithImpl; + @useResult + $Res call({ + ChannelResponse channel, + Map? channelCustom, + String? channelId, + int? channelMemberCount, + int? channelMessageCount, + String? channelType, + String? cid, + DateTime createdAt, + Map custom, + DateTime? receivedAt, + String? team, + String type, + UserResponseCommonFields? user, + }); +} + +/// @nodoc +class _$ChannelVisibleEventCopyWithImpl<$Res> implements $ChannelVisibleEventCopyWith<$Res> { + _$ChannelVisibleEventCopyWithImpl(this._self, this._then); + + final ChannelVisibleEvent _self; + final $Res Function(ChannelVisibleEvent) _then; + + /// Create a copy of ChannelVisibleEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channel = null, + Object? channelCustom = freezed, + Object? channelId = freezed, + Object? channelMemberCount = freezed, + Object? channelMessageCount = freezed, + Object? channelType = freezed, + Object? cid = freezed, + Object? createdAt = null, + Object? custom = null, + Object? receivedAt = freezed, + Object? team = freezed, + Object? type = null, + Object? user = freezed, + }) { + return _then( + ChannelVisibleEvent( + channel: null == channel + ? _self.channel + : channel // ignore: cast_nullable_to_non_nullable + as ChannelResponse, + channelCustom: freezed == channelCustom + ? _self.channelCustom + : channelCustom // ignore: cast_nullable_to_non_nullable + as Map?, + channelId: freezed == channelId + ? _self.channelId + : channelId // ignore: cast_nullable_to_non_nullable + as String?, + channelMemberCount: freezed == channelMemberCount + ? _self.channelMemberCount + : channelMemberCount // ignore: cast_nullable_to_non_nullable + as int?, + channelMessageCount: freezed == channelMessageCount + ? _self.channelMessageCount + : channelMessageCount // ignore: cast_nullable_to_non_nullable + as int?, + channelType: freezed == channelType + ? _self.channelType + : channelType // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + team: freezed == team + ? _self.team + : team // ignore: cast_nullable_to_non_nullable + as String?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponseCommonFields?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/channel_visible_event.g.dart b/packages/stream_chat/lib/open_api/model/channel_visible_event.g.dart new file mode 100644 index 0000000000..0b63b23ea8 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/channel_visible_event.g.dart @@ -0,0 +1,61 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'channel_visible_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ChannelVisibleEvent _$ChannelVisibleEventFromJson( + Map json, +) => ChannelVisibleEvent( + channel: ChannelResponse.fromJson(json['channel'] as Map), + channelCustom: json['channel_custom'] as Map?, + channelId: json['channel_id'] as String?, + channelMemberCount: (json['channel_member_count'] as num?)?.toInt(), + channelMessageCount: (json['channel_message_count'] as num?)?.toInt(), + channelType: json['channel_type'] as String?, + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + team: json['team'] as String?, + type: json['type'] as String, + user: json['user'] == null ? null : UserResponseCommonFields.fromJson(json['user'] as Map), +); + +Map _$ChannelVisibleEventToJson( + ChannelVisibleEvent instance, +) => { + 'channel': instance.channel.toJson(), + 'channel_custom': instance.channelCustom, + 'channel_id': instance.channelId, + 'channel_member_count': instance.channelMemberCount, + 'channel_message_count': instance.channelMessageCount, + 'channel_type': instance.channelType, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'team': instance.team, + 'type': instance.type, + 'user': instance.user?.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/chat_draft_payload_response.dart b/packages/stream_chat/lib/open_api/model/chat_draft_payload_response.dart new file mode 100644 index 0000000000..a5cabd3f10 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/chat_draft_payload_response.dart @@ -0,0 +1,91 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'chat_draft_payload_response.g.dart'; +part 'chat_draft_payload_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ChatDraftPayloadResponse with _$ChatDraftPayloadResponse { + const ChatDraftPayloadResponse({ + this.attachments, + required this.custom, + this.html, + required this.id, + this.mentionedUsers, + this.mml, + this.parentId, + this.pollId, + this.quotedMessageId, + this.showInChannel, + this.silent, + required this.text, + this.type, + }); + + @override + @JsonKey(name: 'attachments') + final List? attachments; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'html') + final String? html; + + @override + @JsonKey(name: 'id') + final String id; + + @override + @JsonKey(name: 'mentioned_users') + final List? mentionedUsers; + + @override + @JsonKey(name: 'mml') + final String? mml; + + @override + @JsonKey(name: 'parent_id') + final String? parentId; + + @override + @JsonKey(name: 'poll_id') + final String? pollId; + + @override + @JsonKey(name: 'quoted_message_id') + final String? quotedMessageId; + + @override + @JsonKey(name: 'show_in_channel') + final bool? showInChannel; + + @override + @JsonKey(name: 'silent') + final bool? silent; + + @override + @JsonKey(name: 'text') + final String text; + + @override + @JsonKey(name: 'type') + final String? type; + + Map toJson() => _$ChatDraftPayloadResponseToJson(this); + + static ChatDraftPayloadResponse fromJson(Map json) => _$ChatDraftPayloadResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/chat_draft_payload_response.freezed.dart b/packages/stream_chat/lib/open_api/model/chat_draft_payload_response.freezed.dart new file mode 100644 index 0000000000..6a95349cd7 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/chat_draft_payload_response.freezed.dart @@ -0,0 +1,197 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'chat_draft_payload_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ChatDraftPayloadResponse { + List? get attachments; + Map get custom; + String? get html; + String get id; + List? get mentionedUsers; + String? get mml; + String? get parentId; + String? get pollId; + String? get quotedMessageId; + bool? get showInChannel; + bool? get silent; + String get text; + String? get type; + + /// Create a copy of ChatDraftPayloadResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ChatDraftPayloadResponseCopyWith get copyWith => + _$ChatDraftPayloadResponseCopyWithImpl( + this as ChatDraftPayloadResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ChatDraftPayloadResponse && + const DeepCollectionEquality().equals( + other.attachments, + attachments, + ) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.html, html) || other.html == html) && + (identical(other.id, id) || other.id == id) && + const DeepCollectionEquality().equals( + other.mentionedUsers, + mentionedUsers, + ) && + (identical(other.mml, mml) || other.mml == mml) && + (identical(other.parentId, parentId) || other.parentId == parentId) && + (identical(other.pollId, pollId) || other.pollId == pollId) && + (identical(other.quotedMessageId, quotedMessageId) || other.quotedMessageId == quotedMessageId) && + (identical(other.showInChannel, showInChannel) || other.showInChannel == showInChannel) && + (identical(other.silent, silent) || other.silent == silent) && + (identical(other.text, text) || other.text == text) && + (identical(other.type, type) || other.type == type)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(attachments), + const DeepCollectionEquality().hash(custom), + html, + id, + const DeepCollectionEquality().hash(mentionedUsers), + mml, + parentId, + pollId, + quotedMessageId, + showInChannel, + silent, + text, + type, + ); + + @override + String toString() { + return 'ChatDraftPayloadResponse(attachments: $attachments, custom: $custom, html: $html, id: $id, mentionedUsers: $mentionedUsers, mml: $mml, parentId: $parentId, pollId: $pollId, quotedMessageId: $quotedMessageId, showInChannel: $showInChannel, silent: $silent, text: $text, type: $type)'; + } +} + +/// @nodoc +abstract mixin class $ChatDraftPayloadResponseCopyWith<$Res> { + factory $ChatDraftPayloadResponseCopyWith( + ChatDraftPayloadResponse value, + $Res Function(ChatDraftPayloadResponse) _then, + ) = _$ChatDraftPayloadResponseCopyWithImpl; + @useResult + $Res call({ + List? attachments, + Map custom, + String? html, + String id, + List? mentionedUsers, + String? mml, + String? parentId, + String? pollId, + String? quotedMessageId, + bool? showInChannel, + bool? silent, + String text, + String? type, + }); +} + +/// @nodoc +class _$ChatDraftPayloadResponseCopyWithImpl<$Res> implements $ChatDraftPayloadResponseCopyWith<$Res> { + _$ChatDraftPayloadResponseCopyWithImpl(this._self, this._then); + + final ChatDraftPayloadResponse _self; + final $Res Function(ChatDraftPayloadResponse) _then; + + /// Create a copy of ChatDraftPayloadResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? attachments = freezed, + Object? custom = null, + Object? html = freezed, + Object? id = null, + Object? mentionedUsers = freezed, + Object? mml = freezed, + Object? parentId = freezed, + Object? pollId = freezed, + Object? quotedMessageId = freezed, + Object? showInChannel = freezed, + Object? silent = freezed, + Object? text = null, + Object? type = freezed, + }) { + return _then( + ChatDraftPayloadResponse( + attachments: freezed == attachments + ? _self.attachments + : attachments // ignore: cast_nullable_to_non_nullable + as List?, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + html: freezed == html + ? _self.html + : html // ignore: cast_nullable_to_non_nullable + as String?, + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + mentionedUsers: freezed == mentionedUsers + ? _self.mentionedUsers + : mentionedUsers // ignore: cast_nullable_to_non_nullable + as List?, + mml: freezed == mml + ? _self.mml + : mml // ignore: cast_nullable_to_non_nullable + as String?, + parentId: freezed == parentId + ? _self.parentId + : parentId // ignore: cast_nullable_to_non_nullable + as String?, + pollId: freezed == pollId + ? _self.pollId + : pollId // ignore: cast_nullable_to_non_nullable + as String?, + quotedMessageId: freezed == quotedMessageId + ? _self.quotedMessageId + : quotedMessageId // ignore: cast_nullable_to_non_nullable + as String?, + showInChannel: freezed == showInChannel + ? _self.showInChannel + : showInChannel // ignore: cast_nullable_to_non_nullable + as bool?, + silent: freezed == silent + ? _self.silent + : silent // ignore: cast_nullable_to_non_nullable + as bool?, + text: null == text + ? _self.text + : text // ignore: cast_nullable_to_non_nullable + as String, + type: freezed == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/chat_draft_payload_response.g.dart b/packages/stream_chat/lib/open_api/model/chat_draft_payload_response.g.dart new file mode 100644 index 0000000000..13ec793c8c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/chat_draft_payload_response.g.dart @@ -0,0 +1,47 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'chat_draft_payload_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ChatDraftPayloadResponse _$ChatDraftPayloadResponseFromJson( + Map json, +) => ChatDraftPayloadResponse( + attachments: (json['attachments'] as List?) + ?.map((e) => Attachment.fromJson(e as Map)) + .toList(), + custom: json['custom'] as Map, + html: json['html'] as String?, + id: json['id'] as String, + mentionedUsers: (json['mentioned_users'] as List?) + ?.map((e) => UserResponse.fromJson(e as Map)) + .toList(), + mml: json['mml'] as String?, + parentId: json['parent_id'] as String?, + pollId: json['poll_id'] as String?, + quotedMessageId: json['quoted_message_id'] as String?, + showInChannel: json['show_in_channel'] as bool?, + silent: json['silent'] as bool?, + text: json['text'] as String, + type: json['type'] as String?, +); + +Map _$ChatDraftPayloadResponseToJson( + ChatDraftPayloadResponse instance, +) => { + 'attachments': instance.attachments?.map((e) => e.toJson()).toList(), + 'custom': instance.custom, + 'html': instance.html, + 'id': instance.id, + 'mentioned_users': instance.mentionedUsers?.map((e) => e.toJson()).toList(), + 'mml': instance.mml, + 'parent_id': instance.parentId, + 'poll_id': instance.pollId, + 'quoted_message_id': instance.quotedMessageId, + 'show_in_channel': instance.showInChannel, + 'silent': instance.silent, + 'text': instance.text, + 'type': instance.type, +}; diff --git a/packages/stream_chat/lib/open_api/model/chat_draft_response.dart b/packages/stream_chat/lib/open_api/model/chat_draft_response.dart new file mode 100644 index 0000000000..c2f5b73b74 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/chat_draft_response.dart @@ -0,0 +1,57 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'chat_draft_response.g.dart'; +part 'chat_draft_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ChatDraftResponse with _$ChatDraftResponse { + const ChatDraftResponse({ + required this.channelCid, + required this.createdAt, + required this.message, + this.parentId, + this.parentMessage, + this.quotedMessage, + }); + + @override + @JsonKey(name: 'channel_cid') + final String channelCid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'message') + final ChatDraftPayloadResponse message; + + @override + @JsonKey(name: 'parent_id') + final String? parentId; + + @override + @JsonKey(name: 'parent_message') + final ChatMessageResponse? parentMessage; + + @override + @JsonKey(name: 'quoted_message') + final ChatMessageResponse? quotedMessage; + + Map toJson() => _$ChatDraftResponseToJson(this); + + static ChatDraftResponse fromJson(Map json) => _$ChatDraftResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/chat_draft_response.freezed.dart b/packages/stream_chat/lib/open_api/model/chat_draft_response.freezed.dart new file mode 100644 index 0000000000..b6e241892b --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/chat_draft_response.freezed.dart @@ -0,0 +1,127 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'chat_draft_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ChatDraftResponse { + String get channelCid; + DateTime get createdAt; + ChatDraftPayloadResponse get message; + String? get parentId; + ChatMessageResponse? get parentMessage; + ChatMessageResponse? get quotedMessage; + + /// Create a copy of ChatDraftResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ChatDraftResponseCopyWith get copyWith => _$ChatDraftResponseCopyWithImpl( + this as ChatDraftResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ChatDraftResponse && + (identical(other.channelCid, channelCid) || other.channelCid == channelCid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.message, message) || other.message == message) && + (identical(other.parentId, parentId) || other.parentId == parentId) && + (identical(other.parentMessage, parentMessage) || other.parentMessage == parentMessage) && + (identical(other.quotedMessage, quotedMessage) || other.quotedMessage == quotedMessage)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channelCid, + createdAt, + message, + parentId, + parentMessage, + quotedMessage, + ); + + @override + String toString() { + return 'ChatDraftResponse(channelCid: $channelCid, createdAt: $createdAt, message: $message, parentId: $parentId, parentMessage: $parentMessage, quotedMessage: $quotedMessage)'; + } +} + +/// @nodoc +abstract mixin class $ChatDraftResponseCopyWith<$Res> { + factory $ChatDraftResponseCopyWith( + ChatDraftResponse value, + $Res Function(ChatDraftResponse) _then, + ) = _$ChatDraftResponseCopyWithImpl; + @useResult + $Res call({ + String channelCid, + DateTime createdAt, + ChatDraftPayloadResponse message, + String? parentId, + ChatMessageResponse? parentMessage, + ChatMessageResponse? quotedMessage, + }); +} + +/// @nodoc +class _$ChatDraftResponseCopyWithImpl<$Res> implements $ChatDraftResponseCopyWith<$Res> { + _$ChatDraftResponseCopyWithImpl(this._self, this._then); + + final ChatDraftResponse _self; + final $Res Function(ChatDraftResponse) _then; + + /// Create a copy of ChatDraftResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channelCid = null, + Object? createdAt = null, + Object? message = null, + Object? parentId = freezed, + Object? parentMessage = freezed, + Object? quotedMessage = freezed, + }) { + return _then( + ChatDraftResponse( + channelCid: null == channelCid + ? _self.channelCid + : channelCid // ignore: cast_nullable_to_non_nullable + as String, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + message: null == message + ? _self.message + : message // ignore: cast_nullable_to_non_nullable + as ChatDraftPayloadResponse, + parentId: freezed == parentId + ? _self.parentId + : parentId // ignore: cast_nullable_to_non_nullable + as String?, + parentMessage: freezed == parentMessage + ? _self.parentMessage + : parentMessage // ignore: cast_nullable_to_non_nullable + as ChatMessageResponse?, + quotedMessage: freezed == quotedMessage + ? _self.quotedMessage + : quotedMessage // ignore: cast_nullable_to_non_nullable + as ChatMessageResponse?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/chat_draft_response.g.dart b/packages/stream_chat/lib/open_api/model/chat_draft_response.g.dart new file mode 100644 index 0000000000..7dd49f0fbe --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/chat_draft_response.g.dart @@ -0,0 +1,37 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'chat_draft_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ChatDraftResponse _$ChatDraftResponseFromJson(Map json) => ChatDraftResponse( + channelCid: json['channel_cid'] as String, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + message: ChatDraftPayloadResponse.fromJson( + json['message'] as Map, + ), + parentId: json['parent_id'] as String?, + parentMessage: json['parent_message'] == null + ? null + : ChatMessageResponse.fromJson( + json['parent_message'] as Map, + ), + quotedMessage: json['quoted_message'] == null + ? null + : ChatMessageResponse.fromJson( + json['quoted_message'] as Map, + ), +); + +Map _$ChatDraftResponseToJson(ChatDraftResponse instance) => { + 'channel_cid': instance.channelCid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'message': instance.message.toJson(), + 'parent_id': instance.parentId, + 'parent_message': instance.parentMessage?.toJson(), + 'quoted_message': instance.quotedMessage?.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/chat_message_response.dart b/packages/stream_chat/lib/open_api/model/chat_message_response.dart new file mode 100644 index 0000000000..78f86c27f9 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/chat_message_response.dart @@ -0,0 +1,277 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'chat_message_response.g.dart'; +part 'chat_message_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ChatMessageResponse with _$ChatMessageResponse { + const ChatMessageResponse({ + required this.attachments, + required this.cid, + this.command, + required this.createdAt, + required this.custom, + this.deletedAt, + this.deletedForMe, + required this.deletedReplyCount, + this.draft, + required this.html, + this.i18n, + required this.id, + this.imageLabels, + required this.latestReactions, + this.member, + required this.mentionedChannel, + this.mentionedGroupIds, + this.mentionedGroups, + required this.mentionedHere, + this.mentionedRoles, + required this.mentionedUsers, + this.messageTextUpdatedAt, + this.mml, + this.moderation, + required this.ownReactions, + this.parentId, + this.pinExpires, + required this.pinned, + this.pinnedAt, + this.pinnedBy, + this.poll, + this.pollId, + this.quotedMessage, + this.quotedMessageId, + required this.reactionCounts, + this.reactionGroups, + required this.reactionScores, + this.reminder, + required this.replyCount, + required this.restrictedVisibility, + required this.shadowed, + this.sharedLocation, + this.showInChannel, + required this.silent, + required this.text, + this.threadParticipants, + required this.type, + required this.updatedAt, + required this.user, + }); + + @override + @JsonKey(name: 'attachments') + final List attachments; + + @override + @JsonKey(name: 'cid') + final String cid; + + @override + @JsonKey(name: 'command') + final String? command; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'deleted_at') + final DateTime? deletedAt; + + @override + @JsonKey(name: 'deleted_for_me') + final bool? deletedForMe; + + @override + @JsonKey(name: 'deleted_reply_count') + final int deletedReplyCount; + + @override + @JsonKey(name: 'draft') + final ChatDraftResponse? draft; + + @override + @JsonKey(name: 'html') + final String html; + + @override + @JsonKey(name: 'i18n') + final Map? i18n; + + @override + @JsonKey(name: 'id') + final String id; + + @override + @JsonKey(name: 'image_labels') + final Map>? imageLabels; + + @override + @JsonKey(name: 'latest_reactions') + final List latestReactions; + + @override + @JsonKey(name: 'member') + final ChannelMemberPartialResponse? member; + + @override + @JsonKey(name: 'mentioned_channel') + final bool mentionedChannel; + + @override + @JsonKey(name: 'mentioned_group_ids') + final List? mentionedGroupIds; + + @override + @JsonKey(name: 'mentioned_groups') + final List? mentionedGroups; + + @override + @JsonKey(name: 'mentioned_here') + final bool mentionedHere; + + @override + @JsonKey(name: 'mentioned_roles') + final List? mentionedRoles; + + @override + @JsonKey(name: 'mentioned_users') + final List mentionedUsers; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'message_text_updated_at') + final DateTime? messageTextUpdatedAt; + + @override + @JsonKey(name: 'mml') + final String? mml; + + @override + @JsonKey(name: 'moderation') + final ChatModerationV2Response? moderation; + + @override + @JsonKey(name: 'own_reactions') + final List ownReactions; + + @override + @JsonKey(name: 'parent_id') + final String? parentId; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'pin_expires') + final DateTime? pinExpires; + + @override + @JsonKey(name: 'pinned') + final bool pinned; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'pinned_at') + final DateTime? pinnedAt; + + @override + @JsonKey(name: 'pinned_by') + final UserResponse? pinnedBy; + + @override + @JsonKey(name: 'poll') + final PollResponseData? poll; + + @override + @JsonKey(name: 'poll_id') + final String? pollId; + + @override + @JsonKey(name: 'quoted_message') + final ChatMessageResponse? quotedMessage; + + @override + @JsonKey(name: 'quoted_message_id') + final String? quotedMessageId; + + @override + @JsonKey(name: 'reaction_counts') + final Map reactionCounts; + + @override + @JsonKey(name: 'reaction_groups') + final Map? reactionGroups; + + @override + @JsonKey(name: 'reaction_scores') + final Map reactionScores; + + @override + @JsonKey(name: 'reminder') + final ChatReminderResponseData? reminder; + + @override + @JsonKey(name: 'reply_count') + final int replyCount; + + @override + @JsonKey(name: 'restricted_visibility') + final List restrictedVisibility; + + @override + @JsonKey(name: 'shadowed') + final bool shadowed; + + @override + @JsonKey(name: 'shared_location') + final ChatSharedLocationResponseData? sharedLocation; + + @override + @JsonKey(name: 'show_in_channel') + final bool? showInChannel; + + @override + @JsonKey(name: 'silent') + final bool silent; + + @override + @JsonKey(name: 'text') + final String text; + + @override + @JsonKey(name: 'thread_participants') + final List? threadParticipants; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'updated_at') + final DateTime updatedAt; + + @override + @JsonKey(name: 'user') + final UserResponse user; + + Map toJson() => _$ChatMessageResponseToJson(this); + + static ChatMessageResponse fromJson(Map json) => _$ChatMessageResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/chat_message_response.freezed.dart b/packages/stream_chat/lib/open_api/model/chat_message_response.freezed.dart new file mode 100644 index 0000000000..7c43174c0d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/chat_message_response.freezed.dart @@ -0,0 +1,555 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'chat_message_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ChatMessageResponse { + List get attachments; + String get cid; + String? get command; + DateTime get createdAt; + Map get custom; + DateTime? get deletedAt; + bool? get deletedForMe; + int get deletedReplyCount; + ChatDraftResponse? get draft; + String get html; + Map? get i18n; + String get id; + Map>? get imageLabels; + List get latestReactions; + ChannelMemberPartialResponse? get member; + bool get mentionedChannel; + List? get mentionedGroupIds; + List? get mentionedGroups; + bool get mentionedHere; + List? get mentionedRoles; + List get mentionedUsers; + DateTime? get messageTextUpdatedAt; + String? get mml; + ChatModerationV2Response? get moderation; + List get ownReactions; + String? get parentId; + DateTime? get pinExpires; + bool get pinned; + DateTime? get pinnedAt; + UserResponse? get pinnedBy; + PollResponseData? get poll; + String? get pollId; + ChatMessageResponse? get quotedMessage; + String? get quotedMessageId; + Map get reactionCounts; + Map? get reactionGroups; + Map get reactionScores; + ChatReminderResponseData? get reminder; + int get replyCount; + List get restrictedVisibility; + bool get shadowed; + ChatSharedLocationResponseData? get sharedLocation; + bool? get showInChannel; + bool get silent; + String get text; + List? get threadParticipants; + String get type; + DateTime get updatedAt; + UserResponse get user; + + /// Create a copy of ChatMessageResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ChatMessageResponseCopyWith get copyWith => + _$ChatMessageResponseCopyWithImpl( + this as ChatMessageResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ChatMessageResponse && + const DeepCollectionEquality().equals( + other.attachments, + attachments, + ) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.command, command) || other.command == command) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt) && + (identical(other.deletedForMe, deletedForMe) || other.deletedForMe == deletedForMe) && + (identical(other.deletedReplyCount, deletedReplyCount) || other.deletedReplyCount == deletedReplyCount) && + (identical(other.draft, draft) || other.draft == draft) && + (identical(other.html, html) || other.html == html) && + const DeepCollectionEquality().equals(other.i18n, i18n) && + (identical(other.id, id) || other.id == id) && + const DeepCollectionEquality().equals( + other.imageLabels, + imageLabels, + ) && + const DeepCollectionEquality().equals( + other.latestReactions, + latestReactions, + ) && + (identical(other.member, member) || other.member == member) && + (identical(other.mentionedChannel, mentionedChannel) || other.mentionedChannel == mentionedChannel) && + const DeepCollectionEquality().equals( + other.mentionedGroupIds, + mentionedGroupIds, + ) && + const DeepCollectionEquality().equals( + other.mentionedGroups, + mentionedGroups, + ) && + (identical(other.mentionedHere, mentionedHere) || other.mentionedHere == mentionedHere) && + const DeepCollectionEquality().equals( + other.mentionedRoles, + mentionedRoles, + ) && + const DeepCollectionEquality().equals( + other.mentionedUsers, + mentionedUsers, + ) && + (identical(other.messageTextUpdatedAt, messageTextUpdatedAt) || + other.messageTextUpdatedAt == messageTextUpdatedAt) && + (identical(other.mml, mml) || other.mml == mml) && + (identical(other.moderation, moderation) || other.moderation == moderation) && + const DeepCollectionEquality().equals( + other.ownReactions, + ownReactions, + ) && + (identical(other.parentId, parentId) || other.parentId == parentId) && + (identical(other.pinExpires, pinExpires) || other.pinExpires == pinExpires) && + (identical(other.pinned, pinned) || other.pinned == pinned) && + (identical(other.pinnedAt, pinnedAt) || other.pinnedAt == pinnedAt) && + (identical(other.pinnedBy, pinnedBy) || other.pinnedBy == pinnedBy) && + (identical(other.poll, poll) || other.poll == poll) && + (identical(other.pollId, pollId) || other.pollId == pollId) && + (identical(other.quotedMessage, quotedMessage) || other.quotedMessage == quotedMessage) && + (identical(other.quotedMessageId, quotedMessageId) || other.quotedMessageId == quotedMessageId) && + const DeepCollectionEquality().equals( + other.reactionCounts, + reactionCounts, + ) && + const DeepCollectionEquality().equals( + other.reactionGroups, + reactionGroups, + ) && + const DeepCollectionEquality().equals( + other.reactionScores, + reactionScores, + ) && + (identical(other.reminder, reminder) || other.reminder == reminder) && + (identical(other.replyCount, replyCount) || other.replyCount == replyCount) && + const DeepCollectionEquality().equals( + other.restrictedVisibility, + restrictedVisibility, + ) && + (identical(other.shadowed, shadowed) || other.shadowed == shadowed) && + (identical(other.sharedLocation, sharedLocation) || other.sharedLocation == sharedLocation) && + (identical(other.showInChannel, showInChannel) || other.showInChannel == showInChannel) && + (identical(other.silent, silent) || other.silent == silent) && + (identical(other.text, text) || other.text == text) && + const DeepCollectionEquality().equals( + other.threadParticipants, + threadParticipants, + ) && + (identical(other.type, type) || other.type == type) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hashAll([ + runtimeType, + const DeepCollectionEquality().hash(attachments), + cid, + command, + createdAt, + const DeepCollectionEquality().hash(custom), + deletedAt, + deletedForMe, + deletedReplyCount, + draft, + html, + const DeepCollectionEquality().hash(i18n), + id, + const DeepCollectionEquality().hash(imageLabels), + const DeepCollectionEquality().hash(latestReactions), + member, + mentionedChannel, + const DeepCollectionEquality().hash(mentionedGroupIds), + const DeepCollectionEquality().hash(mentionedGroups), + mentionedHere, + const DeepCollectionEquality().hash(mentionedRoles), + const DeepCollectionEquality().hash(mentionedUsers), + messageTextUpdatedAt, + mml, + moderation, + const DeepCollectionEquality().hash(ownReactions), + parentId, + pinExpires, + pinned, + pinnedAt, + pinnedBy, + poll, + pollId, + quotedMessage, + quotedMessageId, + const DeepCollectionEquality().hash(reactionCounts), + const DeepCollectionEquality().hash(reactionGroups), + const DeepCollectionEquality().hash(reactionScores), + reminder, + replyCount, + const DeepCollectionEquality().hash(restrictedVisibility), + shadowed, + sharedLocation, + showInChannel, + silent, + text, + const DeepCollectionEquality().hash(threadParticipants), + type, + updatedAt, + user, + ]); + + @override + String toString() { + return 'ChatMessageResponse(attachments: $attachments, cid: $cid, command: $command, createdAt: $createdAt, custom: $custom, deletedAt: $deletedAt, deletedForMe: $deletedForMe, deletedReplyCount: $deletedReplyCount, draft: $draft, html: $html, i18n: $i18n, id: $id, imageLabels: $imageLabels, latestReactions: $latestReactions, member: $member, mentionedChannel: $mentionedChannel, mentionedGroupIds: $mentionedGroupIds, mentionedGroups: $mentionedGroups, mentionedHere: $mentionedHere, mentionedRoles: $mentionedRoles, mentionedUsers: $mentionedUsers, messageTextUpdatedAt: $messageTextUpdatedAt, mml: $mml, moderation: $moderation, ownReactions: $ownReactions, parentId: $parentId, pinExpires: $pinExpires, pinned: $pinned, pinnedAt: $pinnedAt, pinnedBy: $pinnedBy, poll: $poll, pollId: $pollId, quotedMessage: $quotedMessage, quotedMessageId: $quotedMessageId, reactionCounts: $reactionCounts, reactionGroups: $reactionGroups, reactionScores: $reactionScores, reminder: $reminder, replyCount: $replyCount, restrictedVisibility: $restrictedVisibility, shadowed: $shadowed, sharedLocation: $sharedLocation, showInChannel: $showInChannel, silent: $silent, text: $text, threadParticipants: $threadParticipants, type: $type, updatedAt: $updatedAt, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $ChatMessageResponseCopyWith<$Res> { + factory $ChatMessageResponseCopyWith( + ChatMessageResponse value, + $Res Function(ChatMessageResponse) _then, + ) = _$ChatMessageResponseCopyWithImpl; + @useResult + $Res call({ + List attachments, + String cid, + String? command, + DateTime createdAt, + Map custom, + DateTime? deletedAt, + bool? deletedForMe, + int deletedReplyCount, + ChatDraftResponse? draft, + String html, + Map? i18n, + String id, + Map>? imageLabels, + List latestReactions, + ChannelMemberPartialResponse? member, + bool mentionedChannel, + List? mentionedGroupIds, + List? mentionedGroups, + bool mentionedHere, + List? mentionedRoles, + List mentionedUsers, + DateTime? messageTextUpdatedAt, + String? mml, + ChatModerationV2Response? moderation, + List ownReactions, + String? parentId, + DateTime? pinExpires, + bool pinned, + DateTime? pinnedAt, + UserResponse? pinnedBy, + PollResponseData? poll, + String? pollId, + ChatMessageResponse? quotedMessage, + String? quotedMessageId, + Map reactionCounts, + Map? reactionGroups, + Map reactionScores, + ChatReminderResponseData? reminder, + int replyCount, + List restrictedVisibility, + bool shadowed, + ChatSharedLocationResponseData? sharedLocation, + bool? showInChannel, + bool silent, + String text, + List? threadParticipants, + String type, + DateTime updatedAt, + UserResponse user, + }); +} + +/// @nodoc +class _$ChatMessageResponseCopyWithImpl<$Res> implements $ChatMessageResponseCopyWith<$Res> { + _$ChatMessageResponseCopyWithImpl(this._self, this._then); + + final ChatMessageResponse _self; + final $Res Function(ChatMessageResponse) _then; + + /// Create a copy of ChatMessageResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? attachments = null, + Object? cid = null, + Object? command = freezed, + Object? createdAt = null, + Object? custom = null, + Object? deletedAt = freezed, + Object? deletedForMe = freezed, + Object? deletedReplyCount = null, + Object? draft = freezed, + Object? html = null, + Object? i18n = freezed, + Object? id = null, + Object? imageLabels = freezed, + Object? latestReactions = null, + Object? member = freezed, + Object? mentionedChannel = null, + Object? mentionedGroupIds = freezed, + Object? mentionedGroups = freezed, + Object? mentionedHere = null, + Object? mentionedRoles = freezed, + Object? mentionedUsers = null, + Object? messageTextUpdatedAt = freezed, + Object? mml = freezed, + Object? moderation = freezed, + Object? ownReactions = null, + Object? parentId = freezed, + Object? pinExpires = freezed, + Object? pinned = null, + Object? pinnedAt = freezed, + Object? pinnedBy = freezed, + Object? poll = freezed, + Object? pollId = freezed, + Object? quotedMessage = freezed, + Object? quotedMessageId = freezed, + Object? reactionCounts = null, + Object? reactionGroups = freezed, + Object? reactionScores = null, + Object? reminder = freezed, + Object? replyCount = null, + Object? restrictedVisibility = null, + Object? shadowed = null, + Object? sharedLocation = freezed, + Object? showInChannel = freezed, + Object? silent = null, + Object? text = null, + Object? threadParticipants = freezed, + Object? type = null, + Object? updatedAt = null, + Object? user = null, + }) { + return _then( + ChatMessageResponse( + attachments: null == attachments + ? _self.attachments + : attachments // ignore: cast_nullable_to_non_nullable + as List, + cid: null == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String, + command: freezed == command + ? _self.command + : command // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + deletedAt: freezed == deletedAt + ? _self.deletedAt + : deletedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + deletedForMe: freezed == deletedForMe + ? _self.deletedForMe + : deletedForMe // ignore: cast_nullable_to_non_nullable + as bool?, + deletedReplyCount: null == deletedReplyCount + ? _self.deletedReplyCount + : deletedReplyCount // ignore: cast_nullable_to_non_nullable + as int, + draft: freezed == draft + ? _self.draft + : draft // ignore: cast_nullable_to_non_nullable + as ChatDraftResponse?, + html: null == html + ? _self.html + : html // ignore: cast_nullable_to_non_nullable + as String, + i18n: freezed == i18n + ? _self.i18n + : i18n // ignore: cast_nullable_to_non_nullable + as Map?, + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + imageLabels: freezed == imageLabels + ? _self.imageLabels + : imageLabels // ignore: cast_nullable_to_non_nullable + as Map>?, + latestReactions: null == latestReactions + ? _self.latestReactions + : latestReactions // ignore: cast_nullable_to_non_nullable + as List, + member: freezed == member + ? _self.member + : member // ignore: cast_nullable_to_non_nullable + as ChannelMemberPartialResponse?, + mentionedChannel: null == mentionedChannel + ? _self.mentionedChannel + : mentionedChannel // ignore: cast_nullable_to_non_nullable + as bool, + mentionedGroupIds: freezed == mentionedGroupIds + ? _self.mentionedGroupIds + : mentionedGroupIds // ignore: cast_nullable_to_non_nullable + as List?, + mentionedGroups: freezed == mentionedGroups + ? _self.mentionedGroups + : mentionedGroups // ignore: cast_nullable_to_non_nullable + as List?, + mentionedHere: null == mentionedHere + ? _self.mentionedHere + : mentionedHere // ignore: cast_nullable_to_non_nullable + as bool, + mentionedRoles: freezed == mentionedRoles + ? _self.mentionedRoles + : mentionedRoles // ignore: cast_nullable_to_non_nullable + as List?, + mentionedUsers: null == mentionedUsers + ? _self.mentionedUsers + : mentionedUsers // ignore: cast_nullable_to_non_nullable + as List, + messageTextUpdatedAt: freezed == messageTextUpdatedAt + ? _self.messageTextUpdatedAt + : messageTextUpdatedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + mml: freezed == mml + ? _self.mml + : mml // ignore: cast_nullable_to_non_nullable + as String?, + moderation: freezed == moderation + ? _self.moderation + : moderation // ignore: cast_nullable_to_non_nullable + as ChatModerationV2Response?, + ownReactions: null == ownReactions + ? _self.ownReactions + : ownReactions // ignore: cast_nullable_to_non_nullable + as List, + parentId: freezed == parentId + ? _self.parentId + : parentId // ignore: cast_nullable_to_non_nullable + as String?, + pinExpires: freezed == pinExpires + ? _self.pinExpires + : pinExpires // ignore: cast_nullable_to_non_nullable + as DateTime?, + pinned: null == pinned + ? _self.pinned + : pinned // ignore: cast_nullable_to_non_nullable + as bool, + pinnedAt: freezed == pinnedAt + ? _self.pinnedAt + : pinnedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + pinnedBy: freezed == pinnedBy + ? _self.pinnedBy + : pinnedBy // ignore: cast_nullable_to_non_nullable + as UserResponse?, + poll: freezed == poll + ? _self.poll + : poll // ignore: cast_nullable_to_non_nullable + as PollResponseData?, + pollId: freezed == pollId + ? _self.pollId + : pollId // ignore: cast_nullable_to_non_nullable + as String?, + quotedMessage: freezed == quotedMessage + ? _self.quotedMessage + : quotedMessage // ignore: cast_nullable_to_non_nullable + as ChatMessageResponse?, + quotedMessageId: freezed == quotedMessageId + ? _self.quotedMessageId + : quotedMessageId // ignore: cast_nullable_to_non_nullable + as String?, + reactionCounts: null == reactionCounts + ? _self.reactionCounts + : reactionCounts // ignore: cast_nullable_to_non_nullable + as Map, + reactionGroups: freezed == reactionGroups + ? _self.reactionGroups + : reactionGroups // ignore: cast_nullable_to_non_nullable + as Map?, + reactionScores: null == reactionScores + ? _self.reactionScores + : reactionScores // ignore: cast_nullable_to_non_nullable + as Map, + reminder: freezed == reminder + ? _self.reminder + : reminder // ignore: cast_nullable_to_non_nullable + as ChatReminderResponseData?, + replyCount: null == replyCount + ? _self.replyCount + : replyCount // ignore: cast_nullable_to_non_nullable + as int, + restrictedVisibility: null == restrictedVisibility + ? _self.restrictedVisibility + : restrictedVisibility // ignore: cast_nullable_to_non_nullable + as List, + shadowed: null == shadowed + ? _self.shadowed + : shadowed // ignore: cast_nullable_to_non_nullable + as bool, + sharedLocation: freezed == sharedLocation + ? _self.sharedLocation + : sharedLocation // ignore: cast_nullable_to_non_nullable + as ChatSharedLocationResponseData?, + showInChannel: freezed == showInChannel + ? _self.showInChannel + : showInChannel // ignore: cast_nullable_to_non_nullable + as bool?, + silent: null == silent + ? _self.silent + : silent // ignore: cast_nullable_to_non_nullable + as bool, + text: null == text + ? _self.text + : text // ignore: cast_nullable_to_non_nullable + as String, + threadParticipants: freezed == threadParticipants + ? _self.threadParticipants + : threadParticipants // ignore: cast_nullable_to_non_nullable + as List?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + updatedAt: null == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + user: null == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponse, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/chat_message_response.g.dart b/packages/stream_chat/lib/open_api/model/chat_message_response.g.dart new file mode 100644 index 0000000000..4fa28a4222 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/chat_message_response.g.dart @@ -0,0 +1,194 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'chat_message_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ChatMessageResponse _$ChatMessageResponseFromJson(Map json) => ChatMessageResponse( + attachments: (json['attachments'] as List) + .map((e) => Attachment.fromJson(e as Map)) + .toList(), + cid: json['cid'] as String, + command: json['command'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + deletedAt: _$JsonConverterFromJson( + json['deleted_at'], + const StreamDateTimeConverter().fromJson, + ), + deletedForMe: json['deleted_for_me'] as bool?, + deletedReplyCount: (json['deleted_reply_count'] as num).toInt(), + draft: json['draft'] == null ? null : ChatDraftResponse.fromJson(json['draft'] as Map), + html: json['html'] as String, + i18n: (json['i18n'] as Map?)?.map( + (k, e) => MapEntry(k, e as String), + ), + id: json['id'] as String, + imageLabels: (json['image_labels'] as Map?)?.map( + (k, e) => MapEntry(k, (e as List).map((e) => e as String).toList()), + ), + latestReactions: (json['latest_reactions'] as List) + .map((e) => ChatReactionResponse.fromJson(e as Map)) + .toList(), + member: json['member'] == null + ? null + : ChannelMemberPartialResponse.fromJson( + json['member'] as Map, + ), + mentionedChannel: json['mentioned_channel'] as bool, + mentionedGroupIds: (json['mentioned_group_ids'] as List?)?.map((e) => e as String).toList(), + mentionedGroups: (json['mentioned_groups'] as List?) + ?.map((e) => UserGroupResponse.fromJson(e as Map)) + .toList(), + mentionedHere: json['mentioned_here'] as bool, + mentionedRoles: (json['mentioned_roles'] as List?)?.map((e) => e as String).toList(), + mentionedUsers: (json['mentioned_users'] as List) + .map((e) => UserResponse.fromJson(e as Map)) + .toList(), + messageTextUpdatedAt: _$JsonConverterFromJson( + json['message_text_updated_at'], + const StreamDateTimeConverter().fromJson, + ), + mml: json['mml'] as String?, + moderation: json['moderation'] == null + ? null + : ChatModerationV2Response.fromJson( + json['moderation'] as Map, + ), + ownReactions: (json['own_reactions'] as List) + .map((e) => ChatReactionResponse.fromJson(e as Map)) + .toList(), + parentId: json['parent_id'] as String?, + pinExpires: _$JsonConverterFromJson( + json['pin_expires'], + const StreamDateTimeConverter().fromJson, + ), + pinned: json['pinned'] as bool, + pinnedAt: _$JsonConverterFromJson( + json['pinned_at'], + const StreamDateTimeConverter().fromJson, + ), + pinnedBy: json['pinned_by'] == null ? null : UserResponse.fromJson(json['pinned_by'] as Map), + poll: json['poll'] == null ? null : PollResponseData.fromJson(json['poll'] as Map), + pollId: json['poll_id'] as String?, + quotedMessage: json['quoted_message'] == null + ? null + : ChatMessageResponse.fromJson( + json['quoted_message'] as Map, + ), + quotedMessageId: json['quoted_message_id'] as String?, + reactionCounts: Map.from(json['reaction_counts'] as Map), + reactionGroups: (json['reaction_groups'] as Map?)?.map( + (k, e) => MapEntry( + k, + ChatReactionGroupResponse.fromJson(e as Map), + ), + ), + reactionScores: Map.from(json['reaction_scores'] as Map), + reminder: json['reminder'] == null + ? null + : ChatReminderResponseData.fromJson( + json['reminder'] as Map, + ), + replyCount: (json['reply_count'] as num).toInt(), + restrictedVisibility: (json['restricted_visibility'] as List).map((e) => e as String).toList(), + shadowed: json['shadowed'] as bool, + sharedLocation: json['shared_location'] == null + ? null + : ChatSharedLocationResponseData.fromJson( + json['shared_location'] as Map, + ), + showInChannel: json['show_in_channel'] as bool?, + silent: json['silent'] as bool, + text: json['text'] as String, + threadParticipants: (json['thread_participants'] as List?) + ?.map((e) => UserResponse.fromJson(e as Map)) + .toList(), + type: json['type'] as String, + updatedAt: const StreamDateTimeConverter().fromJson( + json['updated_at'] as Object, + ), + user: UserResponse.fromJson(json['user'] as Map), +); + +Map _$ChatMessageResponseToJson( + ChatMessageResponse instance, +) => { + 'attachments': instance.attachments.map((e) => e.toJson()).toList(), + 'cid': instance.cid, + 'command': instance.command, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'deleted_at': _$JsonConverterToJson( + instance.deletedAt, + const StreamDateTimeConverter().toJson, + ), + 'deleted_for_me': instance.deletedForMe, + 'deleted_reply_count': instance.deletedReplyCount, + 'draft': instance.draft?.toJson(), + 'html': instance.html, + 'i18n': instance.i18n, + 'id': instance.id, + 'image_labels': instance.imageLabels, + 'latest_reactions': instance.latestReactions.map((e) => e.toJson()).toList(), + 'member': instance.member?.toJson(), + 'mentioned_channel': instance.mentionedChannel, + 'mentioned_group_ids': instance.mentionedGroupIds, + 'mentioned_groups': instance.mentionedGroups?.map((e) => e.toJson()).toList(), + 'mentioned_here': instance.mentionedHere, + 'mentioned_roles': instance.mentionedRoles, + 'mentioned_users': instance.mentionedUsers.map((e) => e.toJson()).toList(), + 'message_text_updated_at': _$JsonConverterToJson( + instance.messageTextUpdatedAt, + const StreamDateTimeConverter().toJson, + ), + 'mml': instance.mml, + 'moderation': instance.moderation?.toJson(), + 'own_reactions': instance.ownReactions.map((e) => e.toJson()).toList(), + 'parent_id': instance.parentId, + 'pin_expires': _$JsonConverterToJson( + instance.pinExpires, + const StreamDateTimeConverter().toJson, + ), + 'pinned': instance.pinned, + 'pinned_at': _$JsonConverterToJson( + instance.pinnedAt, + const StreamDateTimeConverter().toJson, + ), + 'pinned_by': instance.pinnedBy?.toJson(), + 'poll': instance.poll?.toJson(), + 'poll_id': instance.pollId, + 'quoted_message': instance.quotedMessage?.toJson(), + 'quoted_message_id': instance.quotedMessageId, + 'reaction_counts': instance.reactionCounts, + 'reaction_groups': instance.reactionGroups?.map( + (k, e) => MapEntry(k, e.toJson()), + ), + 'reaction_scores': instance.reactionScores, + 'reminder': instance.reminder?.toJson(), + 'reply_count': instance.replyCount, + 'restricted_visibility': instance.restrictedVisibility, + 'shadowed': instance.shadowed, + 'shared_location': instance.sharedLocation?.toJson(), + 'show_in_channel': instance.showInChannel, + 'silent': instance.silent, + 'text': instance.text, + 'thread_participants': instance.threadParticipants?.map((e) => e.toJson()).toList(), + 'type': instance.type, + 'updated_at': const StreamDateTimeConverter().toJson(instance.updatedAt), + 'user': instance.user.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/chat_moderation_v2_response.dart b/packages/stream_chat/lib/open_api/model/chat_moderation_v2_response.dart new file mode 100644 index 0000000000..b3d58e8a00 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/chat_moderation_v2_response.dart @@ -0,0 +1,66 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'chat_moderation_v2_response.g.dart'; +part 'chat_moderation_v2_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ChatModerationV2Response with _$ChatModerationV2Response { + const ChatModerationV2Response({ + required this.action, + this.blocklistMatched, + this.blocklistsMatched, + this.imageHarms, + required this.originalText, + this.platformCircumvented, + this.semanticFilterMatched, + this.textHarms, + }); + + @override + @JsonKey(name: 'action') + final String action; + + @override + @JsonKey(name: 'blocklist_matched') + final String? blocklistMatched; + + @override + @JsonKey(name: 'blocklists_matched') + final List? blocklistsMatched; + + @override + @JsonKey(name: 'image_harms') + final List? imageHarms; + + @override + @JsonKey(name: 'original_text') + final String originalText; + + @override + @JsonKey(name: 'platform_circumvented') + final bool? platformCircumvented; + + @override + @JsonKey(name: 'semantic_filter_matched') + final String? semanticFilterMatched; + + @override + @JsonKey(name: 'text_harms') + final List? textHarms; + + Map toJson() => _$ChatModerationV2ResponseToJson(this); + + static ChatModerationV2Response fromJson(Map json) => _$ChatModerationV2ResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/chat_moderation_v2_response.freezed.dart b/packages/stream_chat/lib/open_api/model/chat_moderation_v2_response.freezed.dart new file mode 100644 index 0000000000..50b1dd2404 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/chat_moderation_v2_response.freezed.dart @@ -0,0 +1,154 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'chat_moderation_v2_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ChatModerationV2Response { + String get action; + String? get blocklistMatched; + List? get blocklistsMatched; + List? get imageHarms; + String get originalText; + bool? get platformCircumvented; + String? get semanticFilterMatched; + List? get textHarms; + + /// Create a copy of ChatModerationV2Response + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ChatModerationV2ResponseCopyWith get copyWith => + _$ChatModerationV2ResponseCopyWithImpl( + this as ChatModerationV2Response, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ChatModerationV2Response && + (identical(other.action, action) || other.action == action) && + (identical(other.blocklistMatched, blocklistMatched) || other.blocklistMatched == blocklistMatched) && + const DeepCollectionEquality().equals( + other.blocklistsMatched, + blocklistsMatched, + ) && + const DeepCollectionEquality().equals( + other.imageHarms, + imageHarms, + ) && + (identical(other.originalText, originalText) || other.originalText == originalText) && + (identical(other.platformCircumvented, platformCircumvented) || + other.platformCircumvented == platformCircumvented) && + (identical(other.semanticFilterMatched, semanticFilterMatched) || + other.semanticFilterMatched == semanticFilterMatched) && + const DeepCollectionEquality().equals(other.textHarms, textHarms)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + action, + blocklistMatched, + const DeepCollectionEquality().hash(blocklistsMatched), + const DeepCollectionEquality().hash(imageHarms), + originalText, + platformCircumvented, + semanticFilterMatched, + const DeepCollectionEquality().hash(textHarms), + ); + + @override + String toString() { + return 'ChatModerationV2Response(action: $action, blocklistMatched: $blocklistMatched, blocklistsMatched: $blocklistsMatched, imageHarms: $imageHarms, originalText: $originalText, platformCircumvented: $platformCircumvented, semanticFilterMatched: $semanticFilterMatched, textHarms: $textHarms)'; + } +} + +/// @nodoc +abstract mixin class $ChatModerationV2ResponseCopyWith<$Res> { + factory $ChatModerationV2ResponseCopyWith( + ChatModerationV2Response value, + $Res Function(ChatModerationV2Response) _then, + ) = _$ChatModerationV2ResponseCopyWithImpl; + @useResult + $Res call({ + String action, + String? blocklistMatched, + List? blocklistsMatched, + List? imageHarms, + String originalText, + bool? platformCircumvented, + String? semanticFilterMatched, + List? textHarms, + }); +} + +/// @nodoc +class _$ChatModerationV2ResponseCopyWithImpl<$Res> implements $ChatModerationV2ResponseCopyWith<$Res> { + _$ChatModerationV2ResponseCopyWithImpl(this._self, this._then); + + final ChatModerationV2Response _self; + final $Res Function(ChatModerationV2Response) _then; + + /// Create a copy of ChatModerationV2Response + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? action = null, + Object? blocklistMatched = freezed, + Object? blocklistsMatched = freezed, + Object? imageHarms = freezed, + Object? originalText = null, + Object? platformCircumvented = freezed, + Object? semanticFilterMatched = freezed, + Object? textHarms = freezed, + }) { + return _then( + ChatModerationV2Response( + action: null == action + ? _self.action + : action // ignore: cast_nullable_to_non_nullable + as String, + blocklistMatched: freezed == blocklistMatched + ? _self.blocklistMatched + : blocklistMatched // ignore: cast_nullable_to_non_nullable + as String?, + blocklistsMatched: freezed == blocklistsMatched + ? _self.blocklistsMatched + : blocklistsMatched // ignore: cast_nullable_to_non_nullable + as List?, + imageHarms: freezed == imageHarms + ? _self.imageHarms + : imageHarms // ignore: cast_nullable_to_non_nullable + as List?, + originalText: null == originalText + ? _self.originalText + : originalText // ignore: cast_nullable_to_non_nullable + as String, + platformCircumvented: freezed == platformCircumvented + ? _self.platformCircumvented + : platformCircumvented // ignore: cast_nullable_to_non_nullable + as bool?, + semanticFilterMatched: freezed == semanticFilterMatched + ? _self.semanticFilterMatched + : semanticFilterMatched // ignore: cast_nullable_to_non_nullable + as String?, + textHarms: freezed == textHarms + ? _self.textHarms + : textHarms // ignore: cast_nullable_to_non_nullable + as List?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/chat_moderation_v2_response.g.dart b/packages/stream_chat/lib/open_api/model/chat_moderation_v2_response.g.dart new file mode 100644 index 0000000000..d68d1781ec --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/chat_moderation_v2_response.g.dart @@ -0,0 +1,33 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'chat_moderation_v2_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ChatModerationV2Response _$ChatModerationV2ResponseFromJson( + Map json, +) => ChatModerationV2Response( + action: json['action'] as String, + blocklistMatched: json['blocklist_matched'] as String?, + blocklistsMatched: (json['blocklists_matched'] as List?)?.map((e) => e as String).toList(), + imageHarms: (json['image_harms'] as List?)?.map((e) => e as String).toList(), + originalText: json['original_text'] as String, + platformCircumvented: json['platform_circumvented'] as bool?, + semanticFilterMatched: json['semantic_filter_matched'] as String?, + textHarms: (json['text_harms'] as List?)?.map((e) => e as String).toList(), +); + +Map _$ChatModerationV2ResponseToJson( + ChatModerationV2Response instance, +) => { + 'action': instance.action, + 'blocklist_matched': instance.blocklistMatched, + 'blocklists_matched': instance.blocklistsMatched, + 'image_harms': instance.imageHarms, + 'original_text': instance.originalText, + 'platform_circumvented': instance.platformCircumvented, + 'semantic_filter_matched': instance.semanticFilterMatched, + 'text_harms': instance.textHarms, +}; diff --git a/packages/stream_chat/lib/open_api/model/chat_preferences.dart b/packages/stream_chat/lib/open_api/model/chat_preferences.dart new file mode 100644 index 0000000000..7b18a8865d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/chat_preferences.dart @@ -0,0 +1,66 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'chat_preferences.g.dart'; +part 'chat_preferences.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ChatPreferences with _$ChatPreferences { + const ChatPreferences({ + this.channelMentions, + this.defaultPreference, + this.directMentions, + this.distinctChannelMessages, + this.groupMentions, + this.hereMentions, + this.roleMentions, + this.threadReplies, + }); + + @override + @JsonKey(name: 'channel_mentions') + final String? channelMentions; + + @override + @JsonKey(name: 'default_preference') + final String? defaultPreference; + + @override + @JsonKey(name: 'direct_mentions') + final String? directMentions; + + @override + @JsonKey(name: 'distinct_channel_messages') + final String? distinctChannelMessages; + + @override + @JsonKey(name: 'group_mentions') + final String? groupMentions; + + @override + @JsonKey(name: 'here_mentions') + final String? hereMentions; + + @override + @JsonKey(name: 'role_mentions') + final String? roleMentions; + + @override + @JsonKey(name: 'thread_replies') + final String? threadReplies; + + Map toJson() => _$ChatPreferencesToJson(this); + + static ChatPreferences fromJson(Map json) => _$ChatPreferencesFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/chat_preferences.freezed.dart b/packages/stream_chat/lib/open_api/model/chat_preferences.freezed.dart new file mode 100644 index 0000000000..60691e0480 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/chat_preferences.freezed.dart @@ -0,0 +1,149 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'chat_preferences.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ChatPreferences { + String? get channelMentions; + String? get defaultPreference; + String? get directMentions; + String? get distinctChannelMessages; + String? get groupMentions; + String? get hereMentions; + String? get roleMentions; + String? get threadReplies; + + /// Create a copy of ChatPreferences + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ChatPreferencesCopyWith get copyWith => _$ChatPreferencesCopyWithImpl( + this as ChatPreferences, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ChatPreferences && + (identical(other.channelMentions, channelMentions) || other.channelMentions == channelMentions) && + (identical(other.defaultPreference, defaultPreference) || other.defaultPreference == defaultPreference) && + (identical(other.directMentions, directMentions) || other.directMentions == directMentions) && + (identical( + other.distinctChannelMessages, + distinctChannelMessages, + ) || + other.distinctChannelMessages == distinctChannelMessages) && + (identical(other.groupMentions, groupMentions) || other.groupMentions == groupMentions) && + (identical(other.hereMentions, hereMentions) || other.hereMentions == hereMentions) && + (identical(other.roleMentions, roleMentions) || other.roleMentions == roleMentions) && + (identical(other.threadReplies, threadReplies) || other.threadReplies == threadReplies)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channelMentions, + defaultPreference, + directMentions, + distinctChannelMessages, + groupMentions, + hereMentions, + roleMentions, + threadReplies, + ); + + @override + String toString() { + return 'ChatPreferences(channelMentions: $channelMentions, defaultPreference: $defaultPreference, directMentions: $directMentions, distinctChannelMessages: $distinctChannelMessages, groupMentions: $groupMentions, hereMentions: $hereMentions, roleMentions: $roleMentions, threadReplies: $threadReplies)'; + } +} + +/// @nodoc +abstract mixin class $ChatPreferencesCopyWith<$Res> { + factory $ChatPreferencesCopyWith( + ChatPreferences value, + $Res Function(ChatPreferences) _then, + ) = _$ChatPreferencesCopyWithImpl; + @useResult + $Res call({ + String? channelMentions, + String? defaultPreference, + String? directMentions, + String? distinctChannelMessages, + String? groupMentions, + String? hereMentions, + String? roleMentions, + String? threadReplies, + }); +} + +/// @nodoc +class _$ChatPreferencesCopyWithImpl<$Res> implements $ChatPreferencesCopyWith<$Res> { + _$ChatPreferencesCopyWithImpl(this._self, this._then); + + final ChatPreferences _self; + final $Res Function(ChatPreferences) _then; + + /// Create a copy of ChatPreferences + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channelMentions = freezed, + Object? defaultPreference = freezed, + Object? directMentions = freezed, + Object? distinctChannelMessages = freezed, + Object? groupMentions = freezed, + Object? hereMentions = freezed, + Object? roleMentions = freezed, + Object? threadReplies = freezed, + }) { + return _then( + ChatPreferences( + channelMentions: freezed == channelMentions + ? _self.channelMentions + : channelMentions // ignore: cast_nullable_to_non_nullable + as String?, + defaultPreference: freezed == defaultPreference + ? _self.defaultPreference + : defaultPreference // ignore: cast_nullable_to_non_nullable + as String?, + directMentions: freezed == directMentions + ? _self.directMentions + : directMentions // ignore: cast_nullable_to_non_nullable + as String?, + distinctChannelMessages: freezed == distinctChannelMessages + ? _self.distinctChannelMessages + : distinctChannelMessages // ignore: cast_nullable_to_non_nullable + as String?, + groupMentions: freezed == groupMentions + ? _self.groupMentions + : groupMentions // ignore: cast_nullable_to_non_nullable + as String?, + hereMentions: freezed == hereMentions + ? _self.hereMentions + : hereMentions // ignore: cast_nullable_to_non_nullable + as String?, + roleMentions: freezed == roleMentions + ? _self.roleMentions + : roleMentions // ignore: cast_nullable_to_non_nullable + as String?, + threadReplies: freezed == threadReplies + ? _self.threadReplies + : threadReplies // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/chat_preferences.g.dart b/packages/stream_chat/lib/open_api/model/chat_preferences.g.dart new file mode 100644 index 0000000000..9485cd630e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/chat_preferences.g.dart @@ -0,0 +1,29 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'chat_preferences.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ChatPreferences _$ChatPreferencesFromJson(Map json) => ChatPreferences( + channelMentions: json['channel_mentions'] as String?, + defaultPreference: json['default_preference'] as String?, + directMentions: json['direct_mentions'] as String?, + distinctChannelMessages: json['distinct_channel_messages'] as String?, + groupMentions: json['group_mentions'] as String?, + hereMentions: json['here_mentions'] as String?, + roleMentions: json['role_mentions'] as String?, + threadReplies: json['thread_replies'] as String?, +); + +Map _$ChatPreferencesToJson(ChatPreferences instance) => { + 'channel_mentions': instance.channelMentions, + 'default_preference': instance.defaultPreference, + 'direct_mentions': instance.directMentions, + 'distinct_channel_messages': instance.distinctChannelMessages, + 'group_mentions': instance.groupMentions, + 'here_mentions': instance.hereMentions, + 'role_mentions': instance.roleMentions, + 'thread_replies': instance.threadReplies, +}; diff --git a/packages/stream_chat/lib/open_api/model/chat_preferences_input.dart b/packages/stream_chat/lib/open_api/model/chat_preferences_input.dart new file mode 100644 index 0000000000..b4fee21c75 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/chat_preferences_input.dart @@ -0,0 +1,124 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'chat_preferences_input.g.dart'; +part 'chat_preferences_input.freezed.dart'; + +extension type const ChatPreferencesInputChannelMentions._(String _) implements String { + static const all = ChatPreferencesInputChannelMentions._('all'); + static const none = ChatPreferencesInputChannelMentions._('none'); + + factory ChatPreferencesInputChannelMentions.fromJson(String json) => ChatPreferencesInputChannelMentions._(json); + + String toJson() => this; +} + +extension type const ChatPreferencesInputDefaultPreference._(String _) implements String { + static const all = ChatPreferencesInputDefaultPreference._('all'); + static const none = ChatPreferencesInputDefaultPreference._('none'); + + factory ChatPreferencesInputDefaultPreference.fromJson(String json) => ChatPreferencesInputDefaultPreference._(json); + + String toJson() => this; +} + +extension type const ChatPreferencesInputDirectMentions._(String _) implements String { + static const all = ChatPreferencesInputDirectMentions._('all'); + static const none = ChatPreferencesInputDirectMentions._('none'); + + factory ChatPreferencesInputDirectMentions.fromJson(String json) => ChatPreferencesInputDirectMentions._(json); + + String toJson() => this; +} + +extension type const ChatPreferencesInputGroupMentions._(String _) implements String { + static const all = ChatPreferencesInputGroupMentions._('all'); + static const none = ChatPreferencesInputGroupMentions._('none'); + + factory ChatPreferencesInputGroupMentions.fromJson(String json) => ChatPreferencesInputGroupMentions._(json); + + String toJson() => this; +} + +extension type const ChatPreferencesInputHereMentions._(String _) implements String { + static const all = ChatPreferencesInputHereMentions._('all'); + static const none = ChatPreferencesInputHereMentions._('none'); + + factory ChatPreferencesInputHereMentions.fromJson(String json) => ChatPreferencesInputHereMentions._(json); + + String toJson() => this; +} + +extension type const ChatPreferencesInputRoleMentions._(String _) implements String { + static const all = ChatPreferencesInputRoleMentions._('all'); + static const none = ChatPreferencesInputRoleMentions._('none'); + + factory ChatPreferencesInputRoleMentions.fromJson(String json) => ChatPreferencesInputRoleMentions._(json); + + String toJson() => this; +} + +extension type const ChatPreferencesInputThreadReplies._(String _) implements String { + static const all = ChatPreferencesInputThreadReplies._('all'); + static const none = ChatPreferencesInputThreadReplies._('none'); + + factory ChatPreferencesInputThreadReplies.fromJson(String json) => ChatPreferencesInputThreadReplies._(json); + + String toJson() => this; +} + +@freezed +@immutable +@JsonSerializable() +class ChatPreferencesInput with _$ChatPreferencesInput { + const ChatPreferencesInput({ + this.channelMentions, + this.defaultPreference, + this.directMentions, + this.groupMentions, + this.hereMentions, + this.roleMentions, + this.threadReplies, + }); + + @override + @JsonKey(name: 'channel_mentions') + final ChatPreferencesInputChannelMentions? channelMentions; + + @override + @JsonKey(name: 'default_preference') + final ChatPreferencesInputDefaultPreference? defaultPreference; + + @override + @JsonKey(name: 'direct_mentions') + final ChatPreferencesInputDirectMentions? directMentions; + + @override + @JsonKey(name: 'group_mentions') + final ChatPreferencesInputGroupMentions? groupMentions; + + @override + @JsonKey(name: 'here_mentions') + final ChatPreferencesInputHereMentions? hereMentions; + + @override + @JsonKey(name: 'role_mentions') + final ChatPreferencesInputRoleMentions? roleMentions; + + @override + @JsonKey(name: 'thread_replies') + final ChatPreferencesInputThreadReplies? threadReplies; + + Map toJson() => _$ChatPreferencesInputToJson(this); + + static ChatPreferencesInput fromJson(Map json) => _$ChatPreferencesInputFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/chat_preferences_input.freezed.dart b/packages/stream_chat/lib/open_api/model/chat_preferences_input.freezed.dart new file mode 100644 index 0000000000..d411dc96fc --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/chat_preferences_input.freezed.dart @@ -0,0 +1,137 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'chat_preferences_input.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ChatPreferencesInput { + ChatPreferencesInputChannelMentions? get channelMentions; + ChatPreferencesInputDefaultPreference? get defaultPreference; + ChatPreferencesInputDirectMentions? get directMentions; + ChatPreferencesInputGroupMentions? get groupMentions; + ChatPreferencesInputHereMentions? get hereMentions; + ChatPreferencesInputRoleMentions? get roleMentions; + ChatPreferencesInputThreadReplies? get threadReplies; + + /// Create a copy of ChatPreferencesInput + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ChatPreferencesInputCopyWith get copyWith => + _$ChatPreferencesInputCopyWithImpl( + this as ChatPreferencesInput, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ChatPreferencesInput && + (identical(other.channelMentions, channelMentions) || other.channelMentions == channelMentions) && + (identical(other.defaultPreference, defaultPreference) || other.defaultPreference == defaultPreference) && + (identical(other.directMentions, directMentions) || other.directMentions == directMentions) && + (identical(other.groupMentions, groupMentions) || other.groupMentions == groupMentions) && + (identical(other.hereMentions, hereMentions) || other.hereMentions == hereMentions) && + (identical(other.roleMentions, roleMentions) || other.roleMentions == roleMentions) && + (identical(other.threadReplies, threadReplies) || other.threadReplies == threadReplies)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channelMentions, + defaultPreference, + directMentions, + groupMentions, + hereMentions, + roleMentions, + threadReplies, + ); + + @override + String toString() { + return 'ChatPreferencesInput(channelMentions: $channelMentions, defaultPreference: $defaultPreference, directMentions: $directMentions, groupMentions: $groupMentions, hereMentions: $hereMentions, roleMentions: $roleMentions, threadReplies: $threadReplies)'; + } +} + +/// @nodoc +abstract mixin class $ChatPreferencesInputCopyWith<$Res> { + factory $ChatPreferencesInputCopyWith( + ChatPreferencesInput value, + $Res Function(ChatPreferencesInput) _then, + ) = _$ChatPreferencesInputCopyWithImpl; + @useResult + $Res call({ + ChatPreferencesInputChannelMentions? channelMentions, + ChatPreferencesInputDefaultPreference? defaultPreference, + ChatPreferencesInputDirectMentions? directMentions, + ChatPreferencesInputGroupMentions? groupMentions, + ChatPreferencesInputHereMentions? hereMentions, + ChatPreferencesInputRoleMentions? roleMentions, + ChatPreferencesInputThreadReplies? threadReplies, + }); +} + +/// @nodoc +class _$ChatPreferencesInputCopyWithImpl<$Res> implements $ChatPreferencesInputCopyWith<$Res> { + _$ChatPreferencesInputCopyWithImpl(this._self, this._then); + + final ChatPreferencesInput _self; + final $Res Function(ChatPreferencesInput) _then; + + /// Create a copy of ChatPreferencesInput + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channelMentions = freezed, + Object? defaultPreference = freezed, + Object? directMentions = freezed, + Object? groupMentions = freezed, + Object? hereMentions = freezed, + Object? roleMentions = freezed, + Object? threadReplies = freezed, + }) { + return _then( + ChatPreferencesInput( + channelMentions: freezed == channelMentions + ? _self.channelMentions + : channelMentions // ignore: cast_nullable_to_non_nullable + as ChatPreferencesInputChannelMentions?, + defaultPreference: freezed == defaultPreference + ? _self.defaultPreference + : defaultPreference // ignore: cast_nullable_to_non_nullable + as ChatPreferencesInputDefaultPreference?, + directMentions: freezed == directMentions + ? _self.directMentions + : directMentions // ignore: cast_nullable_to_non_nullable + as ChatPreferencesInputDirectMentions?, + groupMentions: freezed == groupMentions + ? _self.groupMentions + : groupMentions // ignore: cast_nullable_to_non_nullable + as ChatPreferencesInputGroupMentions?, + hereMentions: freezed == hereMentions + ? _self.hereMentions + : hereMentions // ignore: cast_nullable_to_non_nullable + as ChatPreferencesInputHereMentions?, + roleMentions: freezed == roleMentions + ? _self.roleMentions + : roleMentions // ignore: cast_nullable_to_non_nullable + as ChatPreferencesInputRoleMentions?, + threadReplies: freezed == threadReplies + ? _self.threadReplies + : threadReplies // ignore: cast_nullable_to_non_nullable + as ChatPreferencesInputThreadReplies?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/chat_preferences_input.g.dart b/packages/stream_chat/lib/open_api/model/chat_preferences_input.g.dart new file mode 100644 index 0000000000..9ef6febf25 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/chat_preferences_input.g.dart @@ -0,0 +1,59 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'chat_preferences_input.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ChatPreferencesInput _$ChatPreferencesInputFromJson( + Map json, +) => ChatPreferencesInput( + channelMentions: json['channel_mentions'] == null + ? null + : ChatPreferencesInputChannelMentions.fromJson( + json['channel_mentions'] as String, + ), + defaultPreference: json['default_preference'] == null + ? null + : ChatPreferencesInputDefaultPreference.fromJson( + json['default_preference'] as String, + ), + directMentions: json['direct_mentions'] == null + ? null + : ChatPreferencesInputDirectMentions.fromJson( + json['direct_mentions'] as String, + ), + groupMentions: json['group_mentions'] == null + ? null + : ChatPreferencesInputGroupMentions.fromJson( + json['group_mentions'] as String, + ), + hereMentions: json['here_mentions'] == null + ? null + : ChatPreferencesInputHereMentions.fromJson( + json['here_mentions'] as String, + ), + roleMentions: json['role_mentions'] == null + ? null + : ChatPreferencesInputRoleMentions.fromJson( + json['role_mentions'] as String, + ), + threadReplies: json['thread_replies'] == null + ? null + : ChatPreferencesInputThreadReplies.fromJson( + json['thread_replies'] as String, + ), +); + +Map _$ChatPreferencesInputToJson( + ChatPreferencesInput instance, +) => { + 'channel_mentions': instance.channelMentions?.toJson(), + 'default_preference': instance.defaultPreference?.toJson(), + 'direct_mentions': instance.directMentions?.toJson(), + 'group_mentions': instance.groupMentions?.toJson(), + 'here_mentions': instance.hereMentions?.toJson(), + 'role_mentions': instance.roleMentions?.toJson(), + 'thread_replies': instance.threadReplies?.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/chat_preferences_response.dart b/packages/stream_chat/lib/open_api/model/chat_preferences_response.dart new file mode 100644 index 0000000000..eb36cb543d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/chat_preferences_response.dart @@ -0,0 +1,61 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'chat_preferences_response.g.dart'; +part 'chat_preferences_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ChatPreferencesResponse with _$ChatPreferencesResponse { + const ChatPreferencesResponse({ + this.channelMentions, + this.defaultPreference, + this.directMentions, + this.groupMentions, + this.hereMentions, + this.roleMentions, + this.threadReplies, + }); + + @override + @JsonKey(name: 'channel_mentions') + final String? channelMentions; + + @override + @JsonKey(name: 'default_preference') + final String? defaultPreference; + + @override + @JsonKey(name: 'direct_mentions') + final String? directMentions; + + @override + @JsonKey(name: 'group_mentions') + final String? groupMentions; + + @override + @JsonKey(name: 'here_mentions') + final String? hereMentions; + + @override + @JsonKey(name: 'role_mentions') + final String? roleMentions; + + @override + @JsonKey(name: 'thread_replies') + final String? threadReplies; + + Map toJson() => _$ChatPreferencesResponseToJson(this); + + static ChatPreferencesResponse fromJson(Map json) => _$ChatPreferencesResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/chat_preferences_response.freezed.dart b/packages/stream_chat/lib/open_api/model/chat_preferences_response.freezed.dart new file mode 100644 index 0000000000..1b60931cd2 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/chat_preferences_response.freezed.dart @@ -0,0 +1,137 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'chat_preferences_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ChatPreferencesResponse { + String? get channelMentions; + String? get defaultPreference; + String? get directMentions; + String? get groupMentions; + String? get hereMentions; + String? get roleMentions; + String? get threadReplies; + + /// Create a copy of ChatPreferencesResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ChatPreferencesResponseCopyWith get copyWith => + _$ChatPreferencesResponseCopyWithImpl( + this as ChatPreferencesResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ChatPreferencesResponse && + (identical(other.channelMentions, channelMentions) || other.channelMentions == channelMentions) && + (identical(other.defaultPreference, defaultPreference) || other.defaultPreference == defaultPreference) && + (identical(other.directMentions, directMentions) || other.directMentions == directMentions) && + (identical(other.groupMentions, groupMentions) || other.groupMentions == groupMentions) && + (identical(other.hereMentions, hereMentions) || other.hereMentions == hereMentions) && + (identical(other.roleMentions, roleMentions) || other.roleMentions == roleMentions) && + (identical(other.threadReplies, threadReplies) || other.threadReplies == threadReplies)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channelMentions, + defaultPreference, + directMentions, + groupMentions, + hereMentions, + roleMentions, + threadReplies, + ); + + @override + String toString() { + return 'ChatPreferencesResponse(channelMentions: $channelMentions, defaultPreference: $defaultPreference, directMentions: $directMentions, groupMentions: $groupMentions, hereMentions: $hereMentions, roleMentions: $roleMentions, threadReplies: $threadReplies)'; + } +} + +/// @nodoc +abstract mixin class $ChatPreferencesResponseCopyWith<$Res> { + factory $ChatPreferencesResponseCopyWith( + ChatPreferencesResponse value, + $Res Function(ChatPreferencesResponse) _then, + ) = _$ChatPreferencesResponseCopyWithImpl; + @useResult + $Res call({ + String? channelMentions, + String? defaultPreference, + String? directMentions, + String? groupMentions, + String? hereMentions, + String? roleMentions, + String? threadReplies, + }); +} + +/// @nodoc +class _$ChatPreferencesResponseCopyWithImpl<$Res> implements $ChatPreferencesResponseCopyWith<$Res> { + _$ChatPreferencesResponseCopyWithImpl(this._self, this._then); + + final ChatPreferencesResponse _self; + final $Res Function(ChatPreferencesResponse) _then; + + /// Create a copy of ChatPreferencesResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channelMentions = freezed, + Object? defaultPreference = freezed, + Object? directMentions = freezed, + Object? groupMentions = freezed, + Object? hereMentions = freezed, + Object? roleMentions = freezed, + Object? threadReplies = freezed, + }) { + return _then( + ChatPreferencesResponse( + channelMentions: freezed == channelMentions + ? _self.channelMentions + : channelMentions // ignore: cast_nullable_to_non_nullable + as String?, + defaultPreference: freezed == defaultPreference + ? _self.defaultPreference + : defaultPreference // ignore: cast_nullable_to_non_nullable + as String?, + directMentions: freezed == directMentions + ? _self.directMentions + : directMentions // ignore: cast_nullable_to_non_nullable + as String?, + groupMentions: freezed == groupMentions + ? _self.groupMentions + : groupMentions // ignore: cast_nullable_to_non_nullable + as String?, + hereMentions: freezed == hereMentions + ? _self.hereMentions + : hereMentions // ignore: cast_nullable_to_non_nullable + as String?, + roleMentions: freezed == roleMentions + ? _self.roleMentions + : roleMentions // ignore: cast_nullable_to_non_nullable + as String?, + threadReplies: freezed == threadReplies + ? _self.threadReplies + : threadReplies // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/chat_preferences_response.g.dart b/packages/stream_chat/lib/open_api/model/chat_preferences_response.g.dart new file mode 100644 index 0000000000..a7db9ec13f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/chat_preferences_response.g.dart @@ -0,0 +1,31 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'chat_preferences_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ChatPreferencesResponse _$ChatPreferencesResponseFromJson( + Map json, +) => ChatPreferencesResponse( + channelMentions: json['channel_mentions'] as String?, + defaultPreference: json['default_preference'] as String?, + directMentions: json['direct_mentions'] as String?, + groupMentions: json['group_mentions'] as String?, + hereMentions: json['here_mentions'] as String?, + roleMentions: json['role_mentions'] as String?, + threadReplies: json['thread_replies'] as String?, +); + +Map _$ChatPreferencesResponseToJson( + ChatPreferencesResponse instance, +) => { + 'channel_mentions': instance.channelMentions, + 'default_preference': instance.defaultPreference, + 'direct_mentions': instance.directMentions, + 'group_mentions': instance.groupMentions, + 'here_mentions': instance.hereMentions, + 'role_mentions': instance.roleMentions, + 'thread_replies': instance.threadReplies, +}; diff --git a/packages/stream_chat/lib/open_api/model/chat_reaction_group_response.dart b/packages/stream_chat/lib/open_api/model/chat_reaction_group_response.dart new file mode 100644 index 0000000000..315a74ddf0 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/chat_reaction_group_response.dart @@ -0,0 +1,53 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'chat_reaction_group_response.g.dart'; +part 'chat_reaction_group_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ChatReactionGroupResponse with _$ChatReactionGroupResponse { + const ChatReactionGroupResponse({ + required this.count, + required this.firstReactionAt, + required this.lastReactionAt, + required this.latestReactionsBy, + required this.sumScores, + }); + + @override + @JsonKey(name: 'count') + final int count; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'first_reaction_at') + final DateTime firstReactionAt; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'last_reaction_at') + final DateTime lastReactionAt; + + @override + @JsonKey(name: 'latest_reactions_by') + final List latestReactionsBy; + + @override + @JsonKey(name: 'sum_scores') + final int sumScores; + + Map toJson() => _$ChatReactionGroupResponseToJson(this); + + static ChatReactionGroupResponse fromJson(Map json) => _$ChatReactionGroupResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/chat_reaction_group_response.freezed.dart b/packages/stream_chat/lib/open_api/model/chat_reaction_group_response.freezed.dart new file mode 100644 index 0000000000..312a53c85c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/chat_reaction_group_response.freezed.dart @@ -0,0 +1,122 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'chat_reaction_group_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ChatReactionGroupResponse { + int get count; + DateTime get firstReactionAt; + DateTime get lastReactionAt; + List get latestReactionsBy; + int get sumScores; + + /// Create a copy of ChatReactionGroupResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ChatReactionGroupResponseCopyWith get copyWith => + _$ChatReactionGroupResponseCopyWithImpl( + this as ChatReactionGroupResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ChatReactionGroupResponse && + (identical(other.count, count) || other.count == count) && + (identical(other.firstReactionAt, firstReactionAt) || other.firstReactionAt == firstReactionAt) && + (identical(other.lastReactionAt, lastReactionAt) || other.lastReactionAt == lastReactionAt) && + const DeepCollectionEquality().equals( + other.latestReactionsBy, + latestReactionsBy, + ) && + (identical(other.sumScores, sumScores) || other.sumScores == sumScores)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + count, + firstReactionAt, + lastReactionAt, + const DeepCollectionEquality().hash(latestReactionsBy), + sumScores, + ); + + @override + String toString() { + return 'ChatReactionGroupResponse(count: $count, firstReactionAt: $firstReactionAt, lastReactionAt: $lastReactionAt, latestReactionsBy: $latestReactionsBy, sumScores: $sumScores)'; + } +} + +/// @nodoc +abstract mixin class $ChatReactionGroupResponseCopyWith<$Res> { + factory $ChatReactionGroupResponseCopyWith( + ChatReactionGroupResponse value, + $Res Function(ChatReactionGroupResponse) _then, + ) = _$ChatReactionGroupResponseCopyWithImpl; + @useResult + $Res call({ + int count, + DateTime firstReactionAt, + DateTime lastReactionAt, + List latestReactionsBy, + int sumScores, + }); +} + +/// @nodoc +class _$ChatReactionGroupResponseCopyWithImpl<$Res> implements $ChatReactionGroupResponseCopyWith<$Res> { + _$ChatReactionGroupResponseCopyWithImpl(this._self, this._then); + + final ChatReactionGroupResponse _self; + final $Res Function(ChatReactionGroupResponse) _then; + + /// Create a copy of ChatReactionGroupResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? count = null, + Object? firstReactionAt = null, + Object? lastReactionAt = null, + Object? latestReactionsBy = null, + Object? sumScores = null, + }) { + return _then( + ChatReactionGroupResponse( + count: null == count + ? _self.count + : count // ignore: cast_nullable_to_non_nullable + as int, + firstReactionAt: null == firstReactionAt + ? _self.firstReactionAt + : firstReactionAt // ignore: cast_nullable_to_non_nullable + as DateTime, + lastReactionAt: null == lastReactionAt + ? _self.lastReactionAt + : lastReactionAt // ignore: cast_nullable_to_non_nullable + as DateTime, + latestReactionsBy: null == latestReactionsBy + ? _self.latestReactionsBy + : latestReactionsBy // ignore: cast_nullable_to_non_nullable + as List, + sumScores: null == sumScores + ? _self.sumScores + : sumScores // ignore: cast_nullable_to_non_nullable + as int, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/chat_reaction_group_response.g.dart b/packages/stream_chat/lib/open_api/model/chat_reaction_group_response.g.dart new file mode 100644 index 0000000000..884b14df85 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/chat_reaction_group_response.g.dart @@ -0,0 +1,39 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'chat_reaction_group_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ChatReactionGroupResponse _$ChatReactionGroupResponseFromJson( + Map json, +) => ChatReactionGroupResponse( + count: (json['count'] as num).toInt(), + firstReactionAt: const StreamDateTimeConverter().fromJson( + json['first_reaction_at'] as Object, + ), + lastReactionAt: const StreamDateTimeConverter().fromJson( + json['last_reaction_at'] as Object, + ), + latestReactionsBy: (json['latest_reactions_by'] as List) + .map( + (e) => ChatReactionGroupUserResponse.fromJson(e as Map), + ) + .toList(), + sumScores: (json['sum_scores'] as num).toInt(), +); + +Map _$ChatReactionGroupResponseToJson( + ChatReactionGroupResponse instance, +) => { + 'count': instance.count, + 'first_reaction_at': const StreamDateTimeConverter().toJson( + instance.firstReactionAt, + ), + 'last_reaction_at': const StreamDateTimeConverter().toJson( + instance.lastReactionAt, + ), + 'latest_reactions_by': instance.latestReactionsBy.map((e) => e.toJson()).toList(), + 'sum_scores': instance.sumScores, +}; diff --git a/packages/stream_chat/lib/open_api/model/chat_reaction_group_user_response.dart b/packages/stream_chat/lib/open_api/model/chat_reaction_group_user_response.dart new file mode 100644 index 0000000000..a9398658dd --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/chat_reaction_group_user_response.dart @@ -0,0 +1,43 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'chat_reaction_group_user_response.g.dart'; +part 'chat_reaction_group_user_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ChatReactionGroupUserResponse with _$ChatReactionGroupUserResponse { + const ChatReactionGroupUserResponse({ + required this.createdAt, + this.user, + required this.userId, + }); + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'user') + final UserResponse? user; + + @override + @JsonKey(name: 'user_id') + final String userId; + + Map toJson() => _$ChatReactionGroupUserResponseToJson(this); + + static ChatReactionGroupUserResponse fromJson(Map json) => + _$ChatReactionGroupUserResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/chat_reaction_group_user_response.freezed.dart b/packages/stream_chat/lib/open_api/model/chat_reaction_group_user_response.freezed.dart new file mode 100644 index 0000000000..a7b44526bb --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/chat_reaction_group_user_response.freezed.dart @@ -0,0 +1,92 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'chat_reaction_group_user_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ChatReactionGroupUserResponse { + DateTime get createdAt; + UserResponse? get user; + String get userId; + + /// Create a copy of ChatReactionGroupUserResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ChatReactionGroupUserResponseCopyWith get copyWith => + _$ChatReactionGroupUserResponseCopyWithImpl( + this as ChatReactionGroupUserResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ChatReactionGroupUserResponse && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.user, user) || other.user == user) && + (identical(other.userId, userId) || other.userId == userId)); + } + + @override + int get hashCode => Object.hash(runtimeType, createdAt, user, userId); + + @override + String toString() { + return 'ChatReactionGroupUserResponse(createdAt: $createdAt, user: $user, userId: $userId)'; + } +} + +/// @nodoc +abstract mixin class $ChatReactionGroupUserResponseCopyWith<$Res> { + factory $ChatReactionGroupUserResponseCopyWith( + ChatReactionGroupUserResponse value, + $Res Function(ChatReactionGroupUserResponse) _then, + ) = _$ChatReactionGroupUserResponseCopyWithImpl; + @useResult + $Res call({DateTime createdAt, UserResponse? user, String userId}); +} + +/// @nodoc +class _$ChatReactionGroupUserResponseCopyWithImpl<$Res> implements $ChatReactionGroupUserResponseCopyWith<$Res> { + _$ChatReactionGroupUserResponseCopyWithImpl(this._self, this._then); + + final ChatReactionGroupUserResponse _self; + final $Res Function(ChatReactionGroupUserResponse) _then; + + /// Create a copy of ChatReactionGroupUserResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? createdAt = null, + Object? user = freezed, + Object? userId = null, + }) { + return _then( + ChatReactionGroupUserResponse( + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponse?, + userId: null == userId + ? _self.userId + : userId // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/chat_reaction_group_user_response.g.dart b/packages/stream_chat/lib/open_api/model/chat_reaction_group_user_response.g.dart new file mode 100644 index 0000000000..fb7866abc8 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/chat_reaction_group_user_response.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'chat_reaction_group_user_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ChatReactionGroupUserResponse _$ChatReactionGroupUserResponseFromJson( + Map json, +) => ChatReactionGroupUserResponse( + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + user: json['user'] == null ? null : UserResponse.fromJson(json['user'] as Map), + userId: json['user_id'] as String, +); + +Map _$ChatReactionGroupUserResponseToJson( + ChatReactionGroupUserResponse instance, +) => { + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'user': instance.user?.toJson(), + 'user_id': instance.userId, +}; diff --git a/packages/stream_chat/lib/open_api/model/chat_reaction_response.dart b/packages/stream_chat/lib/open_api/model/chat_reaction_response.dart new file mode 100644 index 0000000000..d6632a94ac --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/chat_reaction_response.dart @@ -0,0 +1,68 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'chat_reaction_response.g.dart'; +part 'chat_reaction_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ChatReactionResponse with _$ChatReactionResponse { + const ChatReactionResponse({ + required this.createdAt, + required this.custom, + required this.messageId, + required this.score, + required this.type, + required this.updatedAt, + required this.user, + required this.userId, + }); + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'message_id') + final String messageId; + + @override + @JsonKey(name: 'score') + final int score; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'updated_at') + final DateTime updatedAt; + + @override + @JsonKey(name: 'user') + final UserResponse user; + + @override + @JsonKey(name: 'user_id') + final String userId; + + Map toJson() => _$ChatReactionResponseToJson(this); + + static ChatReactionResponse fromJson(Map json) => _$ChatReactionResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/chat_reaction_response.freezed.dart b/packages/stream_chat/lib/open_api/model/chat_reaction_response.freezed.dart new file mode 100644 index 0000000000..50f8a402cd --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/chat_reaction_response.freezed.dart @@ -0,0 +1,146 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'chat_reaction_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ChatReactionResponse { + DateTime get createdAt; + Map get custom; + String get messageId; + int get score; + String get type; + DateTime get updatedAt; + UserResponse get user; + String get userId; + + /// Create a copy of ChatReactionResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ChatReactionResponseCopyWith get copyWith => + _$ChatReactionResponseCopyWithImpl( + this as ChatReactionResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ChatReactionResponse && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.messageId, messageId) || other.messageId == messageId) && + (identical(other.score, score) || other.score == score) && + (identical(other.type, type) || other.type == type) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt) && + (identical(other.user, user) || other.user == user) && + (identical(other.userId, userId) || other.userId == userId)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + createdAt, + const DeepCollectionEquality().hash(custom), + messageId, + score, + type, + updatedAt, + user, + userId, + ); + + @override + String toString() { + return 'ChatReactionResponse(createdAt: $createdAt, custom: $custom, messageId: $messageId, score: $score, type: $type, updatedAt: $updatedAt, user: $user, userId: $userId)'; + } +} + +/// @nodoc +abstract mixin class $ChatReactionResponseCopyWith<$Res> { + factory $ChatReactionResponseCopyWith( + ChatReactionResponse value, + $Res Function(ChatReactionResponse) _then, + ) = _$ChatReactionResponseCopyWithImpl; + @useResult + $Res call({ + DateTime createdAt, + Map custom, + String messageId, + int score, + String type, + DateTime updatedAt, + UserResponse user, + String userId, + }); +} + +/// @nodoc +class _$ChatReactionResponseCopyWithImpl<$Res> implements $ChatReactionResponseCopyWith<$Res> { + _$ChatReactionResponseCopyWithImpl(this._self, this._then); + + final ChatReactionResponse _self; + final $Res Function(ChatReactionResponse) _then; + + /// Create a copy of ChatReactionResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? createdAt = null, + Object? custom = null, + Object? messageId = null, + Object? score = null, + Object? type = null, + Object? updatedAt = null, + Object? user = null, + Object? userId = null, + }) { + return _then( + ChatReactionResponse( + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + messageId: null == messageId + ? _self.messageId + : messageId // ignore: cast_nullable_to_non_nullable + as String, + score: null == score + ? _self.score + : score // ignore: cast_nullable_to_non_nullable + as int, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + updatedAt: null == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + user: null == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponse, + userId: null == userId + ? _self.userId + : userId // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/chat_reaction_response.g.dart b/packages/stream_chat/lib/open_api/model/chat_reaction_response.g.dart new file mode 100644 index 0000000000..48652e7274 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/chat_reaction_response.g.dart @@ -0,0 +1,37 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'chat_reaction_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ChatReactionResponse _$ChatReactionResponseFromJson( + Map json, +) => ChatReactionResponse( + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + messageId: json['message_id'] as String, + score: (json['score'] as num).toInt(), + type: json['type'] as String, + updatedAt: const StreamDateTimeConverter().fromJson( + json['updated_at'] as Object, + ), + user: UserResponse.fromJson(json['user'] as Map), + userId: json['user_id'] as String, +); + +Map _$ChatReactionResponseToJson( + ChatReactionResponse instance, +) => { + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'message_id': instance.messageId, + 'score': instance.score, + 'type': instance.type, + 'updated_at': const StreamDateTimeConverter().toJson(instance.updatedAt), + 'user': instance.user.toJson(), + 'user_id': instance.userId, +}; diff --git a/packages/stream_chat/lib/open_api/model/chat_reminder_response_data.dart b/packages/stream_chat/lib/open_api/model/chat_reminder_response_data.dart new file mode 100644 index 0000000000..102bea80d0 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/chat_reminder_response_data.dart @@ -0,0 +1,69 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'chat_reminder_response_data.g.dart'; +part 'chat_reminder_response_data.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ChatReminderResponseData with _$ChatReminderResponseData { + const ChatReminderResponseData({ + required this.channelCid, + required this.createdAt, + this.message, + required this.messageId, + this.remindAt, + required this.updatedAt, + this.user, + required this.userId, + }); + + @override + @JsonKey(name: 'channel_cid') + final String channelCid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'message') + final ChatMessageResponse? message; + + @override + @JsonKey(name: 'message_id') + final String messageId; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'remind_at') + final DateTime? remindAt; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'updated_at') + final DateTime updatedAt; + + @override + @JsonKey(name: 'user') + final UserResponse? user; + + @override + @JsonKey(name: 'user_id') + final String userId; + + Map toJson() => _$ChatReminderResponseDataToJson(this); + + static ChatReminderResponseData fromJson(Map json) => _$ChatReminderResponseDataFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/chat_reminder_response_data.freezed.dart b/packages/stream_chat/lib/open_api/model/chat_reminder_response_data.freezed.dart new file mode 100644 index 0000000000..7bef78b6f2 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/chat_reminder_response_data.freezed.dart @@ -0,0 +1,146 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'chat_reminder_response_data.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ChatReminderResponseData { + String get channelCid; + DateTime get createdAt; + ChatMessageResponse? get message; + String get messageId; + DateTime? get remindAt; + DateTime get updatedAt; + UserResponse? get user; + String get userId; + + /// Create a copy of ChatReminderResponseData + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ChatReminderResponseDataCopyWith get copyWith => + _$ChatReminderResponseDataCopyWithImpl( + this as ChatReminderResponseData, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ChatReminderResponseData && + (identical(other.channelCid, channelCid) || other.channelCid == channelCid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.message, message) || other.message == message) && + (identical(other.messageId, messageId) || other.messageId == messageId) && + (identical(other.remindAt, remindAt) || other.remindAt == remindAt) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt) && + (identical(other.user, user) || other.user == user) && + (identical(other.userId, userId) || other.userId == userId)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channelCid, + createdAt, + message, + messageId, + remindAt, + updatedAt, + user, + userId, + ); + + @override + String toString() { + return 'ChatReminderResponseData(channelCid: $channelCid, createdAt: $createdAt, message: $message, messageId: $messageId, remindAt: $remindAt, updatedAt: $updatedAt, user: $user, userId: $userId)'; + } +} + +/// @nodoc +abstract mixin class $ChatReminderResponseDataCopyWith<$Res> { + factory $ChatReminderResponseDataCopyWith( + ChatReminderResponseData value, + $Res Function(ChatReminderResponseData) _then, + ) = _$ChatReminderResponseDataCopyWithImpl; + @useResult + $Res call({ + String channelCid, + DateTime createdAt, + ChatMessageResponse? message, + String messageId, + DateTime? remindAt, + DateTime updatedAt, + UserResponse? user, + String userId, + }); +} + +/// @nodoc +class _$ChatReminderResponseDataCopyWithImpl<$Res> implements $ChatReminderResponseDataCopyWith<$Res> { + _$ChatReminderResponseDataCopyWithImpl(this._self, this._then); + + final ChatReminderResponseData _self; + final $Res Function(ChatReminderResponseData) _then; + + /// Create a copy of ChatReminderResponseData + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channelCid = null, + Object? createdAt = null, + Object? message = freezed, + Object? messageId = null, + Object? remindAt = freezed, + Object? updatedAt = null, + Object? user = freezed, + Object? userId = null, + }) { + return _then( + ChatReminderResponseData( + channelCid: null == channelCid + ? _self.channelCid + : channelCid // ignore: cast_nullable_to_non_nullable + as String, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + message: freezed == message + ? _self.message + : message // ignore: cast_nullable_to_non_nullable + as ChatMessageResponse?, + messageId: null == messageId + ? _self.messageId + : messageId // ignore: cast_nullable_to_non_nullable + as String, + remindAt: freezed == remindAt + ? _self.remindAt + : remindAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + updatedAt: null == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponse?, + userId: null == userId + ? _self.userId + : userId // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/chat_reminder_response_data.g.dart b/packages/stream_chat/lib/open_api/model/chat_reminder_response_data.g.dart new file mode 100644 index 0000000000..2a2c111de1 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/chat_reminder_response_data.g.dart @@ -0,0 +1,53 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'chat_reminder_response_data.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ChatReminderResponseData _$ChatReminderResponseDataFromJson( + Map json, +) => ChatReminderResponseData( + channelCid: json['channel_cid'] as String, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + message: json['message'] == null ? null : ChatMessageResponse.fromJson(json['message'] as Map), + messageId: json['message_id'] as String, + remindAt: _$JsonConverterFromJson( + json['remind_at'], + const StreamDateTimeConverter().fromJson, + ), + updatedAt: const StreamDateTimeConverter().fromJson( + json['updated_at'] as Object, + ), + user: json['user'] == null ? null : UserResponse.fromJson(json['user'] as Map), + userId: json['user_id'] as String, +); + +Map _$ChatReminderResponseDataToJson( + ChatReminderResponseData instance, +) => { + 'channel_cid': instance.channelCid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'message': instance.message?.toJson(), + 'message_id': instance.messageId, + 'remind_at': _$JsonConverterToJson( + instance.remindAt, + const StreamDateTimeConverter().toJson, + ), + 'updated_at': const StreamDateTimeConverter().toJson(instance.updatedAt), + 'user': instance.user?.toJson(), + 'user_id': instance.userId, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/chat_shared_location_response_data.dart b/packages/stream_chat/lib/open_api/model/chat_shared_location_response_data.dart new file mode 100644 index 0000000000..d01b11d408 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/chat_shared_location_response_data.dart @@ -0,0 +1,80 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'chat_shared_location_response_data.g.dart'; +part 'chat_shared_location_response_data.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ChatSharedLocationResponseData with _$ChatSharedLocationResponseData { + const ChatSharedLocationResponseData({ + required this.channelCid, + required this.createdAt, + required this.createdByDeviceId, + this.endAt, + required this.latitude, + required this.longitude, + this.message, + required this.messageId, + required this.updatedAt, + required this.userId, + }); + + @override + @JsonKey(name: 'channel_cid') + final String channelCid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'created_by_device_id') + final String createdByDeviceId; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'end_at') + final DateTime? endAt; + + @override + @JsonKey(name: 'latitude') + final double latitude; + + @override + @JsonKey(name: 'longitude') + final double longitude; + + @override + @JsonKey(name: 'message') + final ChatMessageResponse? message; + + @override + @JsonKey(name: 'message_id') + final String messageId; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'updated_at') + final DateTime updatedAt; + + @override + @JsonKey(name: 'user_id') + final String userId; + + Map toJson() => _$ChatSharedLocationResponseDataToJson(this); + + static ChatSharedLocationResponseData fromJson(Map json) => + _$ChatSharedLocationResponseDataFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/chat_shared_location_response_data.freezed.dart b/packages/stream_chat/lib/open_api/model/chat_shared_location_response_data.freezed.dart new file mode 100644 index 0000000000..14ac8d10e9 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/chat_shared_location_response_data.freezed.dart @@ -0,0 +1,164 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'chat_shared_location_response_data.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ChatSharedLocationResponseData { + String get channelCid; + DateTime get createdAt; + String get createdByDeviceId; + DateTime? get endAt; + double get latitude; + double get longitude; + ChatMessageResponse? get message; + String get messageId; + DateTime get updatedAt; + String get userId; + + /// Create a copy of ChatSharedLocationResponseData + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ChatSharedLocationResponseDataCopyWith get copyWith => + _$ChatSharedLocationResponseDataCopyWithImpl( + this as ChatSharedLocationResponseData, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ChatSharedLocationResponseData && + (identical(other.channelCid, channelCid) || other.channelCid == channelCid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.createdByDeviceId, createdByDeviceId) || other.createdByDeviceId == createdByDeviceId) && + (identical(other.endAt, endAt) || other.endAt == endAt) && + (identical(other.latitude, latitude) || other.latitude == latitude) && + (identical(other.longitude, longitude) || other.longitude == longitude) && + (identical(other.message, message) || other.message == message) && + (identical(other.messageId, messageId) || other.messageId == messageId) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt) && + (identical(other.userId, userId) || other.userId == userId)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channelCid, + createdAt, + createdByDeviceId, + endAt, + latitude, + longitude, + message, + messageId, + updatedAt, + userId, + ); + + @override + String toString() { + return 'ChatSharedLocationResponseData(channelCid: $channelCid, createdAt: $createdAt, createdByDeviceId: $createdByDeviceId, endAt: $endAt, latitude: $latitude, longitude: $longitude, message: $message, messageId: $messageId, updatedAt: $updatedAt, userId: $userId)'; + } +} + +/// @nodoc +abstract mixin class $ChatSharedLocationResponseDataCopyWith<$Res> { + factory $ChatSharedLocationResponseDataCopyWith( + ChatSharedLocationResponseData value, + $Res Function(ChatSharedLocationResponseData) _then, + ) = _$ChatSharedLocationResponseDataCopyWithImpl; + @useResult + $Res call({ + String channelCid, + DateTime createdAt, + String createdByDeviceId, + DateTime? endAt, + double latitude, + double longitude, + ChatMessageResponse? message, + String messageId, + DateTime updatedAt, + String userId, + }); +} + +/// @nodoc +class _$ChatSharedLocationResponseDataCopyWithImpl<$Res> implements $ChatSharedLocationResponseDataCopyWith<$Res> { + _$ChatSharedLocationResponseDataCopyWithImpl(this._self, this._then); + + final ChatSharedLocationResponseData _self; + final $Res Function(ChatSharedLocationResponseData) _then; + + /// Create a copy of ChatSharedLocationResponseData + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channelCid = null, + Object? createdAt = null, + Object? createdByDeviceId = null, + Object? endAt = freezed, + Object? latitude = null, + Object? longitude = null, + Object? message = freezed, + Object? messageId = null, + Object? updatedAt = null, + Object? userId = null, + }) { + return _then( + ChatSharedLocationResponseData( + channelCid: null == channelCid + ? _self.channelCid + : channelCid // ignore: cast_nullable_to_non_nullable + as String, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + createdByDeviceId: null == createdByDeviceId + ? _self.createdByDeviceId + : createdByDeviceId // ignore: cast_nullable_to_non_nullable + as String, + endAt: freezed == endAt + ? _self.endAt + : endAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + latitude: null == latitude + ? _self.latitude + : latitude // ignore: cast_nullable_to_non_nullable + as double, + longitude: null == longitude + ? _self.longitude + : longitude // ignore: cast_nullable_to_non_nullable + as double, + message: freezed == message + ? _self.message + : message // ignore: cast_nullable_to_non_nullable + as ChatMessageResponse?, + messageId: null == messageId + ? _self.messageId + : messageId // ignore: cast_nullable_to_non_nullable + as String, + updatedAt: null == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + userId: null == userId + ? _self.userId + : userId // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/chat_shared_location_response_data.g.dart b/packages/stream_chat/lib/open_api/model/chat_shared_location_response_data.g.dart new file mode 100644 index 0000000000..ebe39ff3b9 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/chat_shared_location_response_data.g.dart @@ -0,0 +1,57 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'chat_shared_location_response_data.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ChatSharedLocationResponseData _$ChatSharedLocationResponseDataFromJson( + Map json, +) => ChatSharedLocationResponseData( + channelCid: json['channel_cid'] as String, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + createdByDeviceId: json['created_by_device_id'] as String, + endAt: _$JsonConverterFromJson( + json['end_at'], + const StreamDateTimeConverter().fromJson, + ), + latitude: (json['latitude'] as num).toDouble(), + longitude: (json['longitude'] as num).toDouble(), + message: json['message'] == null ? null : ChatMessageResponse.fromJson(json['message'] as Map), + messageId: json['message_id'] as String, + updatedAt: const StreamDateTimeConverter().fromJson( + json['updated_at'] as Object, + ), + userId: json['user_id'] as String, +); + +Map _$ChatSharedLocationResponseDataToJson( + ChatSharedLocationResponseData instance, +) => { + 'channel_cid': instance.channelCid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'created_by_device_id': instance.createdByDeviceId, + 'end_at': _$JsonConverterToJson( + instance.endAt, + const StreamDateTimeConverter().toJson, + ), + 'latitude': instance.latitude, + 'longitude': instance.longitude, + 'message': instance.message?.toJson(), + 'message_id': instance.messageId, + 'updated_at': const StreamDateTimeConverter().toJson(instance.updatedAt), + 'user_id': instance.userId, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/closed_caption_rule_parameters.dart b/packages/stream_chat/lib/open_api/model/closed_caption_rule_parameters.dart new file mode 100644 index 0000000000..7e97140fa4 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/closed_caption_rule_parameters.dart @@ -0,0 +1,51 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'closed_caption_rule_parameters.g.dart'; +part 'closed_caption_rule_parameters.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ClosedCaptionRuleParameters with _$ClosedCaptionRuleParameters { + const ClosedCaptionRuleParameters({ + this.harmLabels, + this.llmHarmLabels, + this.severity, + this.threshold, + this.timeWindow, + }); + + @override + @JsonKey(name: 'harm_labels') + final List? harmLabels; + + @override + @JsonKey(name: 'llm_harm_labels') + final Map? llmHarmLabels; + + @override + @JsonKey(name: 'severity') + final String? severity; + + @override + @JsonKey(name: 'threshold') + final int? threshold; + + @override + @JsonKey(name: 'time_window') + final String? timeWindow; + + Map toJson() => _$ClosedCaptionRuleParametersToJson(this); + + static ClosedCaptionRuleParameters fromJson(Map json) => _$ClosedCaptionRuleParametersFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/closed_caption_rule_parameters.freezed.dart b/packages/stream_chat/lib/open_api/model/closed_caption_rule_parameters.freezed.dart new file mode 100644 index 0000000000..56ec2d01b0 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/closed_caption_rule_parameters.freezed.dart @@ -0,0 +1,125 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'closed_caption_rule_parameters.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ClosedCaptionRuleParameters { + List? get harmLabels; + Map? get llmHarmLabels; + String? get severity; + int? get threshold; + String? get timeWindow; + + /// Create a copy of ClosedCaptionRuleParameters + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ClosedCaptionRuleParametersCopyWith get copyWith => + _$ClosedCaptionRuleParametersCopyWithImpl( + this as ClosedCaptionRuleParameters, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ClosedCaptionRuleParameters && + const DeepCollectionEquality().equals( + other.harmLabels, + harmLabels, + ) && + const DeepCollectionEquality().equals( + other.llmHarmLabels, + llmHarmLabels, + ) && + (identical(other.severity, severity) || other.severity == severity) && + (identical(other.threshold, threshold) || other.threshold == threshold) && + (identical(other.timeWindow, timeWindow) || other.timeWindow == timeWindow)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(harmLabels), + const DeepCollectionEquality().hash(llmHarmLabels), + severity, + threshold, + timeWindow, + ); + + @override + String toString() { + return 'ClosedCaptionRuleParameters(harmLabels: $harmLabels, llmHarmLabels: $llmHarmLabels, severity: $severity, threshold: $threshold, timeWindow: $timeWindow)'; + } +} + +/// @nodoc +abstract mixin class $ClosedCaptionRuleParametersCopyWith<$Res> { + factory $ClosedCaptionRuleParametersCopyWith( + ClosedCaptionRuleParameters value, + $Res Function(ClosedCaptionRuleParameters) _then, + ) = _$ClosedCaptionRuleParametersCopyWithImpl; + @useResult + $Res call({ + List? harmLabels, + Map? llmHarmLabels, + String? severity, + int? threshold, + String? timeWindow, + }); +} + +/// @nodoc +class _$ClosedCaptionRuleParametersCopyWithImpl<$Res> implements $ClosedCaptionRuleParametersCopyWith<$Res> { + _$ClosedCaptionRuleParametersCopyWithImpl(this._self, this._then); + + final ClosedCaptionRuleParameters _self; + final $Res Function(ClosedCaptionRuleParameters) _then; + + /// Create a copy of ClosedCaptionRuleParameters + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? harmLabels = freezed, + Object? llmHarmLabels = freezed, + Object? severity = freezed, + Object? threshold = freezed, + Object? timeWindow = freezed, + }) { + return _then( + ClosedCaptionRuleParameters( + harmLabels: freezed == harmLabels + ? _self.harmLabels + : harmLabels // ignore: cast_nullable_to_non_nullable + as List?, + llmHarmLabels: freezed == llmHarmLabels + ? _self.llmHarmLabels + : llmHarmLabels // ignore: cast_nullable_to_non_nullable + as Map?, + severity: freezed == severity + ? _self.severity + : severity // ignore: cast_nullable_to_non_nullable + as String?, + threshold: freezed == threshold + ? _self.threshold + : threshold // ignore: cast_nullable_to_non_nullable + as int?, + timeWindow: freezed == timeWindow + ? _self.timeWindow + : timeWindow // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/closed_caption_rule_parameters.g.dart b/packages/stream_chat/lib/open_api/model/closed_caption_rule_parameters.g.dart new file mode 100644 index 0000000000..fb3519dfb2 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/closed_caption_rule_parameters.g.dart @@ -0,0 +1,29 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'closed_caption_rule_parameters.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ClosedCaptionRuleParameters _$ClosedCaptionRuleParametersFromJson( + Map json, +) => ClosedCaptionRuleParameters( + harmLabels: (json['harm_labels'] as List?)?.map((e) => e as String).toList(), + llmHarmLabels: (json['llm_harm_labels'] as Map?)?.map( + (k, e) => MapEntry(k, e as String), + ), + severity: json['severity'] as String?, + threshold: (json['threshold'] as num?)?.toInt(), + timeWindow: json['time_window'] as String?, +); + +Map _$ClosedCaptionRuleParametersToJson( + ClosedCaptionRuleParameters instance, +) => { + 'harm_labels': instance.harmLabels, + 'llm_harm_labels': instance.llmHarmLabels, + 'severity': instance.severity, + 'threshold': instance.threshold, + 'time_window': instance.timeWindow, +}; diff --git a/packages/stream_chat/lib/open_api/model/command.dart b/packages/stream_chat/lib/open_api/model/command.dart new file mode 100644 index 0000000000..57017c5038 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/command.dart @@ -0,0 +1,58 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'command.g.dart'; +part 'command.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class Command with _$Command { + const Command({ + required this.args, + this.createdAt, + required this.description, + required this.name, + required this.set, + this.updatedAt, + }); + + @override + @JsonKey(name: 'args') + final String args; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime? createdAt; + + @override + @JsonKey(name: 'description') + final String description; + + @override + @JsonKey(name: 'name') + final String name; + + @override + @JsonKey(name: 'set') + final String set; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'updated_at') + final DateTime? updatedAt; + + Map toJson() => _$CommandToJson(this); + + static Command fromJson(Map json) => _$CommandFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/command.freezed.dart b/packages/stream_chat/lib/open_api/model/command.freezed.dart new file mode 100644 index 0000000000..f3ae0ff042 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/command.freezed.dart @@ -0,0 +1,121 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'command.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$Command { + String get args; + DateTime? get createdAt; + String get description; + String get name; + String get set; + DateTime? get updatedAt; + + /// Create a copy of Command + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $CommandCopyWith get copyWith => _$CommandCopyWithImpl(this as Command, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is Command && + (identical(other.args, args) || other.args == args) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.description, description) || other.description == description) && + (identical(other.name, name) || other.name == name) && + (identical(other.set, set) || other.set == set) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + args, + createdAt, + description, + name, + set, + updatedAt, + ); + + @override + String toString() { + return 'Command(args: $args, createdAt: $createdAt, description: $description, name: $name, set: $set, updatedAt: $updatedAt)'; + } +} + +/// @nodoc +abstract mixin class $CommandCopyWith<$Res> { + factory $CommandCopyWith(Command value, $Res Function(Command) _then) = _$CommandCopyWithImpl; + @useResult + $Res call({ + String args, + DateTime? createdAt, + String description, + String name, + String set, + DateTime? updatedAt, + }); +} + +/// @nodoc +class _$CommandCopyWithImpl<$Res> implements $CommandCopyWith<$Res> { + _$CommandCopyWithImpl(this._self, this._then); + + final Command _self; + final $Res Function(Command) _then; + + /// Create a copy of Command + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? args = null, + Object? createdAt = freezed, + Object? description = null, + Object? name = null, + Object? set = null, + Object? updatedAt = freezed, + }) { + return _then( + Command( + args: null == args + ? _self.args + : args // ignore: cast_nullable_to_non_nullable + as String, + createdAt: freezed == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + description: null == description + ? _self.description + : description // ignore: cast_nullable_to_non_nullable + as String, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + set: null == set + ? _self.set + : set // ignore: cast_nullable_to_non_nullable + as String, + updatedAt: freezed == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/command.g.dart b/packages/stream_chat/lib/open_api/model/command.g.dart new file mode 100644 index 0000000000..06d7fe964b --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/command.g.dart @@ -0,0 +1,47 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'command.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +Command _$CommandFromJson(Map json) => Command( + args: json['args'] as String, + createdAt: _$JsonConverterFromJson( + json['created_at'], + const StreamDateTimeConverter().fromJson, + ), + description: json['description'] as String, + name: json['name'] as String, + set: json['set'] as String, + updatedAt: _$JsonConverterFromJson( + json['updated_at'], + const StreamDateTimeConverter().fromJson, + ), +); + +Map _$CommandToJson(Command instance) => { + 'args': instance.args, + 'created_at': _$JsonConverterToJson( + instance.createdAt, + const StreamDateTimeConverter().toJson, + ), + 'description': instance.description, + 'name': instance.name, + 'set': instance.set, + 'updated_at': _$JsonConverterToJson( + instance.updatedAt, + const StreamDateTimeConverter().toJson, + ), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/config_overrides_request.dart b/packages/stream_chat/lib/open_api/model/config_overrides_request.dart new file mode 100644 index 0000000000..a201e0f4f2 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/config_overrides_request.dart @@ -0,0 +1,128 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'config_overrides_request.g.dart'; +part 'config_overrides_request.freezed.dart'; + +extension type const ConfigOverridesRequestBlocklistBehavior._(String _) implements String { + static const block = ConfigOverridesRequestBlocklistBehavior._('block'); + static const flag = ConfigOverridesRequestBlocklistBehavior._('flag'); + + factory ConfigOverridesRequestBlocklistBehavior.fromJson(String json) => + ConfigOverridesRequestBlocklistBehavior._(json); + + String toJson() => this; +} + +extension type const ConfigOverridesRequestPushLevel._(String _) implements String { + static const all = ConfigOverridesRequestPushLevel._('all'); + static const allMentions = ConfigOverridesRequestPushLevel._('all_mentions'); + static const directMentions = ConfigOverridesRequestPushLevel._('direct_mentions'); + static const mentions = ConfigOverridesRequestPushLevel._('mentions'); + static const none = ConfigOverridesRequestPushLevel._('none'); + + factory ConfigOverridesRequestPushLevel.fromJson(String json) => ConfigOverridesRequestPushLevel._(json); + + String toJson() => this; +} + +@freezed +@immutable +@JsonSerializable() +class ConfigOverridesRequest with _$ConfigOverridesRequest { + const ConfigOverridesRequest({ + this.blocklist, + this.blocklistBehavior, + this.chatPreferences, + this.commands, + this.countMessages, + this.grants, + this.maxMessageLength, + this.pushLevel, + this.quotes, + this.reactions, + this.replies, + this.sharedLocations, + this.typingEvents, + this.uploads, + this.urlEnrichment, + this.userMessageReminders, + }); + + @override + @JsonKey(name: 'blocklist') + final String? blocklist; + + @override + @JsonKey(name: 'blocklist_behavior') + final ConfigOverridesRequestBlocklistBehavior? blocklistBehavior; + + @override + @JsonKey(name: 'chat_preferences') + final ChatPreferences? chatPreferences; + + @override + @JsonKey(name: 'commands') + final List? commands; + + @override + @JsonKey(name: 'count_messages') + final bool? countMessages; + + @override + @JsonKey(name: 'grants') + final Map>? grants; + + @override + @JsonKey(name: 'max_message_length') + final int? maxMessageLength; + + @override + @JsonKey(name: 'push_level') + final ConfigOverridesRequestPushLevel? pushLevel; + + @override + @JsonKey(name: 'quotes') + final bool? quotes; + + @override + @JsonKey(name: 'reactions') + final bool? reactions; + + @override + @JsonKey(name: 'replies') + final bool? replies; + + @override + @JsonKey(name: 'shared_locations') + final bool? sharedLocations; + + @override + @JsonKey(name: 'typing_events') + final bool? typingEvents; + + @override + @JsonKey(name: 'uploads') + final bool? uploads; + + @override + @JsonKey(name: 'url_enrichment') + final bool? urlEnrichment; + + @override + @JsonKey(name: 'user_message_reminders') + final bool? userMessageReminders; + + Map toJson() => _$ConfigOverridesRequestToJson(this); + + static ConfigOverridesRequest fromJson(Map json) => _$ConfigOverridesRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/config_overrides_request.freezed.dart b/packages/stream_chat/lib/open_api/model/config_overrides_request.freezed.dart new file mode 100644 index 0000000000..a2df98c9a5 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/config_overrides_request.freezed.dart @@ -0,0 +1,219 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'config_overrides_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ConfigOverridesRequest { + String? get blocklist; + ConfigOverridesRequestBlocklistBehavior? get blocklistBehavior; + ChatPreferences? get chatPreferences; + List? get commands; + bool? get countMessages; + Map>? get grants; + int? get maxMessageLength; + ConfigOverridesRequestPushLevel? get pushLevel; + bool? get quotes; + bool? get reactions; + bool? get replies; + bool? get sharedLocations; + bool? get typingEvents; + bool? get uploads; + bool? get urlEnrichment; + bool? get userMessageReminders; + + /// Create a copy of ConfigOverridesRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ConfigOverridesRequestCopyWith get copyWith => + _$ConfigOverridesRequestCopyWithImpl( + this as ConfigOverridesRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ConfigOverridesRequest && + (identical(other.blocklist, blocklist) || other.blocklist == blocklist) && + (identical(other.blocklistBehavior, blocklistBehavior) || other.blocklistBehavior == blocklistBehavior) && + (identical(other.chatPreferences, chatPreferences) || other.chatPreferences == chatPreferences) && + const DeepCollectionEquality().equals(other.commands, commands) && + (identical(other.countMessages, countMessages) || other.countMessages == countMessages) && + const DeepCollectionEquality().equals(other.grants, grants) && + (identical(other.maxMessageLength, maxMessageLength) || other.maxMessageLength == maxMessageLength) && + (identical(other.pushLevel, pushLevel) || other.pushLevel == pushLevel) && + (identical(other.quotes, quotes) || other.quotes == quotes) && + (identical(other.reactions, reactions) || other.reactions == reactions) && + (identical(other.replies, replies) || other.replies == replies) && + (identical(other.sharedLocations, sharedLocations) || other.sharedLocations == sharedLocations) && + (identical(other.typingEvents, typingEvents) || other.typingEvents == typingEvents) && + (identical(other.uploads, uploads) || other.uploads == uploads) && + (identical(other.urlEnrichment, urlEnrichment) || other.urlEnrichment == urlEnrichment) && + (identical(other.userMessageReminders, userMessageReminders) || + other.userMessageReminders == userMessageReminders)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + blocklist, + blocklistBehavior, + chatPreferences, + const DeepCollectionEquality().hash(commands), + countMessages, + const DeepCollectionEquality().hash(grants), + maxMessageLength, + pushLevel, + quotes, + reactions, + replies, + sharedLocations, + typingEvents, + uploads, + urlEnrichment, + userMessageReminders, + ); + + @override + String toString() { + return 'ConfigOverridesRequest(blocklist: $blocklist, blocklistBehavior: $blocklistBehavior, chatPreferences: $chatPreferences, commands: $commands, countMessages: $countMessages, grants: $grants, maxMessageLength: $maxMessageLength, pushLevel: $pushLevel, quotes: $quotes, reactions: $reactions, replies: $replies, sharedLocations: $sharedLocations, typingEvents: $typingEvents, uploads: $uploads, urlEnrichment: $urlEnrichment, userMessageReminders: $userMessageReminders)'; + } +} + +/// @nodoc +abstract mixin class $ConfigOverridesRequestCopyWith<$Res> { + factory $ConfigOverridesRequestCopyWith( + ConfigOverridesRequest value, + $Res Function(ConfigOverridesRequest) _then, + ) = _$ConfigOverridesRequestCopyWithImpl; + @useResult + $Res call({ + String? blocklist, + ConfigOverridesRequestBlocklistBehavior? blocklistBehavior, + ChatPreferences? chatPreferences, + List? commands, + bool? countMessages, + Map>? grants, + int? maxMessageLength, + ConfigOverridesRequestPushLevel? pushLevel, + bool? quotes, + bool? reactions, + bool? replies, + bool? sharedLocations, + bool? typingEvents, + bool? uploads, + bool? urlEnrichment, + bool? userMessageReminders, + }); +} + +/// @nodoc +class _$ConfigOverridesRequestCopyWithImpl<$Res> implements $ConfigOverridesRequestCopyWith<$Res> { + _$ConfigOverridesRequestCopyWithImpl(this._self, this._then); + + final ConfigOverridesRequest _self; + final $Res Function(ConfigOverridesRequest) _then; + + /// Create a copy of ConfigOverridesRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? blocklist = freezed, + Object? blocklistBehavior = freezed, + Object? chatPreferences = freezed, + Object? commands = freezed, + Object? countMessages = freezed, + Object? grants = freezed, + Object? maxMessageLength = freezed, + Object? pushLevel = freezed, + Object? quotes = freezed, + Object? reactions = freezed, + Object? replies = freezed, + Object? sharedLocations = freezed, + Object? typingEvents = freezed, + Object? uploads = freezed, + Object? urlEnrichment = freezed, + Object? userMessageReminders = freezed, + }) { + return _then( + ConfigOverridesRequest( + blocklist: freezed == blocklist + ? _self.blocklist + : blocklist // ignore: cast_nullable_to_non_nullable + as String?, + blocklistBehavior: freezed == blocklistBehavior + ? _self.blocklistBehavior + : blocklistBehavior // ignore: cast_nullable_to_non_nullable + as ConfigOverridesRequestBlocklistBehavior?, + chatPreferences: freezed == chatPreferences + ? _self.chatPreferences + : chatPreferences // ignore: cast_nullable_to_non_nullable + as ChatPreferences?, + commands: freezed == commands + ? _self.commands + : commands // ignore: cast_nullable_to_non_nullable + as List?, + countMessages: freezed == countMessages + ? _self.countMessages + : countMessages // ignore: cast_nullable_to_non_nullable + as bool?, + grants: freezed == grants + ? _self.grants + : grants // ignore: cast_nullable_to_non_nullable + as Map>?, + maxMessageLength: freezed == maxMessageLength + ? _self.maxMessageLength + : maxMessageLength // ignore: cast_nullable_to_non_nullable + as int?, + pushLevel: freezed == pushLevel + ? _self.pushLevel + : pushLevel // ignore: cast_nullable_to_non_nullable + as ConfigOverridesRequestPushLevel?, + quotes: freezed == quotes + ? _self.quotes + : quotes // ignore: cast_nullable_to_non_nullable + as bool?, + reactions: freezed == reactions + ? _self.reactions + : reactions // ignore: cast_nullable_to_non_nullable + as bool?, + replies: freezed == replies + ? _self.replies + : replies // ignore: cast_nullable_to_non_nullable + as bool?, + sharedLocations: freezed == sharedLocations + ? _self.sharedLocations + : sharedLocations // ignore: cast_nullable_to_non_nullable + as bool?, + typingEvents: freezed == typingEvents + ? _self.typingEvents + : typingEvents // ignore: cast_nullable_to_non_nullable + as bool?, + uploads: freezed == uploads + ? _self.uploads + : uploads // ignore: cast_nullable_to_non_nullable + as bool?, + urlEnrichment: freezed == urlEnrichment + ? _self.urlEnrichment + : urlEnrichment // ignore: cast_nullable_to_non_nullable + as bool?, + userMessageReminders: freezed == userMessageReminders + ? _self.userMessageReminders + : userMessageReminders // ignore: cast_nullable_to_non_nullable + as bool?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/config_overrides_request.g.dart b/packages/stream_chat/lib/open_api/model/config_overrides_request.g.dart new file mode 100644 index 0000000000..787eacbbf3 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/config_overrides_request.g.dart @@ -0,0 +1,59 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'config_overrides_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ConfigOverridesRequest _$ConfigOverridesRequestFromJson( + Map json, +) => ConfigOverridesRequest( + blocklist: json['blocklist'] as String?, + blocklistBehavior: json['blocklist_behavior'] == null + ? null + : ConfigOverridesRequestBlocklistBehavior.fromJson( + json['blocklist_behavior'] as String, + ), + chatPreferences: json['chat_preferences'] == null + ? null + : ChatPreferences.fromJson( + json['chat_preferences'] as Map, + ), + commands: (json['commands'] as List?)?.map((e) => e as String).toList(), + countMessages: json['count_messages'] as bool?, + grants: (json['grants'] as Map?)?.map( + (k, e) => MapEntry(k, (e as List).map((e) => e as String).toList()), + ), + maxMessageLength: (json['max_message_length'] as num?)?.toInt(), + pushLevel: json['push_level'] == null ? null : ConfigOverridesRequestPushLevel.fromJson(json['push_level'] as String), + quotes: json['quotes'] as bool?, + reactions: json['reactions'] as bool?, + replies: json['replies'] as bool?, + sharedLocations: json['shared_locations'] as bool?, + typingEvents: json['typing_events'] as bool?, + uploads: json['uploads'] as bool?, + urlEnrichment: json['url_enrichment'] as bool?, + userMessageReminders: json['user_message_reminders'] as bool?, +); + +Map _$ConfigOverridesRequestToJson( + ConfigOverridesRequest instance, +) => { + 'blocklist': instance.blocklist, + 'blocklist_behavior': instance.blocklistBehavior?.toJson(), + 'chat_preferences': instance.chatPreferences?.toJson(), + 'commands': instance.commands, + 'count_messages': instance.countMessages, + 'grants': instance.grants, + 'max_message_length': instance.maxMessageLength, + 'push_level': instance.pushLevel?.toJson(), + 'quotes': instance.quotes, + 'reactions': instance.reactions, + 'replies': instance.replies, + 'shared_locations': instance.sharedLocations, + 'typing_events': instance.typingEvents, + 'uploads': instance.uploads, + 'url_enrichment': instance.urlEnrichment, + 'user_message_reminders': instance.userMessageReminders, +}; diff --git a/packages/stream_chat/lib/open_api/model/config_response.dart b/packages/stream_chat/lib/open_api/model/config_response.dart new file mode 100644 index 0000000000..3c1d04b07e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/config_response.dart @@ -0,0 +1,133 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'config_response.g.dart'; +part 'config_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ConfigResponse with _$ConfigResponse { + const ConfigResponse({ + this.aiAudioConfig, + this.aiImageConfig, + this.aiImageLabelDefinitions, + this.aiImageSubclassifications, + this.aiTextConfig, + this.aiVideoConfig, + required this.async, + this.automodPlatformCircumventionConfig, + this.automodSemanticFiltersConfig, + this.automodToxicityConfig, + this.availableBodyguardProfiles, + this.blockListConfig, + required this.createdAt, + this.floodConfig, + required this.key, + this.llmConfig, + required this.supportedVideoCallHarmTypes, + required this.team, + required this.updatedAt, + this.velocityFilterConfig, + this.videoCallRuleConfig, + }); + + @override + @JsonKey(name: 'ai_audio_config') + final AIAudioConfigResponse? aiAudioConfig; + + @override + @JsonKey(name: 'ai_image_config') + final AIImageConfig? aiImageConfig; + + @override + @JsonKey(name: 'ai_image_label_definitions') + final List? aiImageLabelDefinitions; + + @override + @JsonKey(name: 'ai_image_subclassifications') + final Map>? aiImageSubclassifications; + + @override + @JsonKey(name: 'ai_text_config') + final AITextConfig? aiTextConfig; + + @override + @JsonKey(name: 'ai_video_config') + final AIVideoConfig? aiVideoConfig; + + @override + @JsonKey(name: 'async') + final bool async; + + @override + @JsonKey(name: 'automod_platform_circumvention_config') + final AutomodPlatformCircumventionConfig? automodPlatformCircumventionConfig; + + @override + @JsonKey(name: 'automod_semantic_filters_config') + final AutomodSemanticFiltersConfig? automodSemanticFiltersConfig; + + @override + @JsonKey(name: 'automod_toxicity_config') + final AutomodToxicityConfig? automodToxicityConfig; + + @override + @JsonKey(name: 'available_bodyguard_profiles') + final List? availableBodyguardProfiles; + + @override + @JsonKey(name: 'block_list_config') + final BlockListConfig? blockListConfig; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'flood_config') + final FloodConfig? floodConfig; + + @override + @JsonKey(name: 'key') + final String key; + + @override + @JsonKey(name: 'llm_config') + final LLMConfig? llmConfig; + + @override + @JsonKey(name: 'supported_video_call_harm_types') + final List supportedVideoCallHarmTypes; + + @override + @JsonKey(name: 'team') + final String team; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'updated_at') + final DateTime updatedAt; + + @override + @JsonKey(name: 'velocity_filter_config') + final VelocityFilterConfig? velocityFilterConfig; + + @override + @JsonKey(name: 'video_call_rule_config') + final VideoCallRuleConfig? videoCallRuleConfig; + + Map toJson() => _$ConfigResponseToJson(this); + + static ConfigResponse fromJson(Map json) => _$ConfigResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/config_response.freezed.dart b/packages/stream_chat/lib/open_api/model/config_response.freezed.dart new file mode 100644 index 0000000000..6407fe6b29 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/config_response.freezed.dart @@ -0,0 +1,285 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'config_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ConfigResponse { + AIAudioConfigResponse? get aiAudioConfig; + AIImageConfig? get aiImageConfig; + List? get aiImageLabelDefinitions; + Map>? get aiImageSubclassifications; + AITextConfig? get aiTextConfig; + AIVideoConfig? get aiVideoConfig; + bool get async; + AutomodPlatformCircumventionConfig? get automodPlatformCircumventionConfig; + AutomodSemanticFiltersConfig? get automodSemanticFiltersConfig; + AutomodToxicityConfig? get automodToxicityConfig; + List? get availableBodyguardProfiles; + BlockListConfig? get blockListConfig; + DateTime get createdAt; + FloodConfig? get floodConfig; + String get key; + LLMConfig? get llmConfig; + List get supportedVideoCallHarmTypes; + String get team; + DateTime get updatedAt; + VelocityFilterConfig? get velocityFilterConfig; + VideoCallRuleConfig? get videoCallRuleConfig; + + /// Create a copy of ConfigResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ConfigResponseCopyWith get copyWith => _$ConfigResponseCopyWithImpl( + this as ConfigResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ConfigResponse && + (identical(other.aiAudioConfig, aiAudioConfig) || other.aiAudioConfig == aiAudioConfig) && + (identical(other.aiImageConfig, aiImageConfig) || other.aiImageConfig == aiImageConfig) && + const DeepCollectionEquality().equals( + other.aiImageLabelDefinitions, + aiImageLabelDefinitions, + ) && + const DeepCollectionEquality().equals( + other.aiImageSubclassifications, + aiImageSubclassifications, + ) && + (identical(other.aiTextConfig, aiTextConfig) || other.aiTextConfig == aiTextConfig) && + (identical(other.aiVideoConfig, aiVideoConfig) || other.aiVideoConfig == aiVideoConfig) && + (identical(other.async, async) || other.async == async) && + (identical( + other.automodPlatformCircumventionConfig, + automodPlatformCircumventionConfig, + ) || + other.automodPlatformCircumventionConfig == automodPlatformCircumventionConfig) && + (identical( + other.automodSemanticFiltersConfig, + automodSemanticFiltersConfig, + ) || + other.automodSemanticFiltersConfig == automodSemanticFiltersConfig) && + (identical(other.automodToxicityConfig, automodToxicityConfig) || + other.automodToxicityConfig == automodToxicityConfig) && + const DeepCollectionEquality().equals( + other.availableBodyguardProfiles, + availableBodyguardProfiles, + ) && + (identical(other.blockListConfig, blockListConfig) || other.blockListConfig == blockListConfig) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.floodConfig, floodConfig) || other.floodConfig == floodConfig) && + (identical(other.key, key) || other.key == key) && + (identical(other.llmConfig, llmConfig) || other.llmConfig == llmConfig) && + const DeepCollectionEquality().equals( + other.supportedVideoCallHarmTypes, + supportedVideoCallHarmTypes, + ) && + (identical(other.team, team) || other.team == team) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt) && + (identical(other.velocityFilterConfig, velocityFilterConfig) || + other.velocityFilterConfig == velocityFilterConfig) && + (identical(other.videoCallRuleConfig, videoCallRuleConfig) || + other.videoCallRuleConfig == videoCallRuleConfig)); + } + + @override + int get hashCode => Object.hashAll([ + runtimeType, + aiAudioConfig, + aiImageConfig, + const DeepCollectionEquality().hash(aiImageLabelDefinitions), + const DeepCollectionEquality().hash(aiImageSubclassifications), + aiTextConfig, + aiVideoConfig, + async, + automodPlatformCircumventionConfig, + automodSemanticFiltersConfig, + automodToxicityConfig, + const DeepCollectionEquality().hash(availableBodyguardProfiles), + blockListConfig, + createdAt, + floodConfig, + key, + llmConfig, + const DeepCollectionEquality().hash(supportedVideoCallHarmTypes), + team, + updatedAt, + velocityFilterConfig, + videoCallRuleConfig, + ]); + + @override + String toString() { + return 'ConfigResponse(aiAudioConfig: $aiAudioConfig, aiImageConfig: $aiImageConfig, aiImageLabelDefinitions: $aiImageLabelDefinitions, aiImageSubclassifications: $aiImageSubclassifications, aiTextConfig: $aiTextConfig, aiVideoConfig: $aiVideoConfig, async: $async, automodPlatformCircumventionConfig: $automodPlatformCircumventionConfig, automodSemanticFiltersConfig: $automodSemanticFiltersConfig, automodToxicityConfig: $automodToxicityConfig, availableBodyguardProfiles: $availableBodyguardProfiles, blockListConfig: $blockListConfig, createdAt: $createdAt, floodConfig: $floodConfig, key: $key, llmConfig: $llmConfig, supportedVideoCallHarmTypes: $supportedVideoCallHarmTypes, team: $team, updatedAt: $updatedAt, velocityFilterConfig: $velocityFilterConfig, videoCallRuleConfig: $videoCallRuleConfig)'; + } +} + +/// @nodoc +abstract mixin class $ConfigResponseCopyWith<$Res> { + factory $ConfigResponseCopyWith( + ConfigResponse value, + $Res Function(ConfigResponse) _then, + ) = _$ConfigResponseCopyWithImpl; + @useResult + $Res call({ + AIAudioConfigResponse? aiAudioConfig, + AIImageConfig? aiImageConfig, + List? aiImageLabelDefinitions, + Map>? aiImageSubclassifications, + AITextConfig? aiTextConfig, + AIVideoConfig? aiVideoConfig, + bool async, + AutomodPlatformCircumventionConfig? automodPlatformCircumventionConfig, + AutomodSemanticFiltersConfig? automodSemanticFiltersConfig, + AutomodToxicityConfig? automodToxicityConfig, + List? availableBodyguardProfiles, + BlockListConfig? blockListConfig, + DateTime createdAt, + FloodConfig? floodConfig, + String key, + LLMConfig? llmConfig, + List supportedVideoCallHarmTypes, + String team, + DateTime updatedAt, + VelocityFilterConfig? velocityFilterConfig, + VideoCallRuleConfig? videoCallRuleConfig, + }); +} + +/// @nodoc +class _$ConfigResponseCopyWithImpl<$Res> implements $ConfigResponseCopyWith<$Res> { + _$ConfigResponseCopyWithImpl(this._self, this._then); + + final ConfigResponse _self; + final $Res Function(ConfigResponse) _then; + + /// Create a copy of ConfigResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? aiAudioConfig = freezed, + Object? aiImageConfig = freezed, + Object? aiImageLabelDefinitions = freezed, + Object? aiImageSubclassifications = freezed, + Object? aiTextConfig = freezed, + Object? aiVideoConfig = freezed, + Object? async = null, + Object? automodPlatformCircumventionConfig = freezed, + Object? automodSemanticFiltersConfig = freezed, + Object? automodToxicityConfig = freezed, + Object? availableBodyguardProfiles = freezed, + Object? blockListConfig = freezed, + Object? createdAt = null, + Object? floodConfig = freezed, + Object? key = null, + Object? llmConfig = freezed, + Object? supportedVideoCallHarmTypes = null, + Object? team = null, + Object? updatedAt = null, + Object? velocityFilterConfig = freezed, + Object? videoCallRuleConfig = freezed, + }) { + return _then( + ConfigResponse( + aiAudioConfig: freezed == aiAudioConfig + ? _self.aiAudioConfig + : aiAudioConfig // ignore: cast_nullable_to_non_nullable + as AIAudioConfigResponse?, + aiImageConfig: freezed == aiImageConfig + ? _self.aiImageConfig + : aiImageConfig // ignore: cast_nullable_to_non_nullable + as AIImageConfig?, + aiImageLabelDefinitions: freezed == aiImageLabelDefinitions + ? _self.aiImageLabelDefinitions + : aiImageLabelDefinitions // ignore: cast_nullable_to_non_nullable + as List?, + aiImageSubclassifications: freezed == aiImageSubclassifications + ? _self.aiImageSubclassifications + : aiImageSubclassifications // ignore: cast_nullable_to_non_nullable + as Map>?, + aiTextConfig: freezed == aiTextConfig + ? _self.aiTextConfig + : aiTextConfig // ignore: cast_nullable_to_non_nullable + as AITextConfig?, + aiVideoConfig: freezed == aiVideoConfig + ? _self.aiVideoConfig + : aiVideoConfig // ignore: cast_nullable_to_non_nullable + as AIVideoConfig?, + async: null == async + ? _self.async + : async // ignore: cast_nullable_to_non_nullable + as bool, + automodPlatformCircumventionConfig: freezed == automodPlatformCircumventionConfig + ? _self.automodPlatformCircumventionConfig + : automodPlatformCircumventionConfig // ignore: cast_nullable_to_non_nullable + as AutomodPlatformCircumventionConfig?, + automodSemanticFiltersConfig: freezed == automodSemanticFiltersConfig + ? _self.automodSemanticFiltersConfig + : automodSemanticFiltersConfig // ignore: cast_nullable_to_non_nullable + as AutomodSemanticFiltersConfig?, + automodToxicityConfig: freezed == automodToxicityConfig + ? _self.automodToxicityConfig + : automodToxicityConfig // ignore: cast_nullable_to_non_nullable + as AutomodToxicityConfig?, + availableBodyguardProfiles: freezed == availableBodyguardProfiles + ? _self.availableBodyguardProfiles + : availableBodyguardProfiles // ignore: cast_nullable_to_non_nullable + as List?, + blockListConfig: freezed == blockListConfig + ? _self.blockListConfig + : blockListConfig // ignore: cast_nullable_to_non_nullable + as BlockListConfig?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + floodConfig: freezed == floodConfig + ? _self.floodConfig + : floodConfig // ignore: cast_nullable_to_non_nullable + as FloodConfig?, + key: null == key + ? _self.key + : key // ignore: cast_nullable_to_non_nullable + as String, + llmConfig: freezed == llmConfig + ? _self.llmConfig + : llmConfig // ignore: cast_nullable_to_non_nullable + as LLMConfig?, + supportedVideoCallHarmTypes: null == supportedVideoCallHarmTypes + ? _self.supportedVideoCallHarmTypes + : supportedVideoCallHarmTypes // ignore: cast_nullable_to_non_nullable + as List, + team: null == team + ? _self.team + : team // ignore: cast_nullable_to_non_nullable + as String, + updatedAt: null == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + velocityFilterConfig: freezed == velocityFilterConfig + ? _self.velocityFilterConfig + : velocityFilterConfig // ignore: cast_nullable_to_non_nullable + as VelocityFilterConfig?, + videoCallRuleConfig: freezed == videoCallRuleConfig + ? _self.videoCallRuleConfig + : videoCallRuleConfig // ignore: cast_nullable_to_non_nullable + as VideoCallRuleConfig?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/config_response.g.dart b/packages/stream_chat/lib/open_api/model/config_response.g.dart new file mode 100644 index 0000000000..33ce58d87b --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/config_response.g.dart @@ -0,0 +1,107 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'config_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ConfigResponse _$ConfigResponseFromJson( + Map json, +) => ConfigResponse( + aiAudioConfig: json['ai_audio_config'] == null + ? null + : AIAudioConfigResponse.fromJson( + json['ai_audio_config'] as Map, + ), + aiImageConfig: json['ai_image_config'] == null + ? null + : AIImageConfig.fromJson(json['ai_image_config'] as Map), + aiImageLabelDefinitions: (json['ai_image_label_definitions'] as List?) + ?.map( + (e) => AIImageLabelDefinition.fromJson(e as Map), + ) + .toList(), + aiImageSubclassifications: (json['ai_image_subclassifications'] as Map?)?.map( + (k, e) => MapEntry(k, (e as List).map((e) => e as String).toList()), + ), + aiTextConfig: json['ai_text_config'] == null + ? null + : AITextConfig.fromJson(json['ai_text_config'] as Map), + aiVideoConfig: json['ai_video_config'] == null + ? null + : AIVideoConfig.fromJson(json['ai_video_config'] as Map), + async: json['async'] as bool, + automodPlatformCircumventionConfig: json['automod_platform_circumvention_config'] == null + ? null + : AutomodPlatformCircumventionConfig.fromJson( + json['automod_platform_circumvention_config'] as Map, + ), + automodSemanticFiltersConfig: json['automod_semantic_filters_config'] == null + ? null + : AutomodSemanticFiltersConfig.fromJson( + json['automod_semantic_filters_config'] as Map, + ), + automodToxicityConfig: json['automod_toxicity_config'] == null + ? null + : AutomodToxicityConfig.fromJson( + json['automod_toxicity_config'] as Map, + ), + availableBodyguardProfiles: (json['available_bodyguard_profiles'] as List?) + ?.map( + (e) => BodyguardProfileSummary.fromJson(e as Map), + ) + .toList(), + blockListConfig: json['block_list_config'] == null + ? null + : BlockListConfig.fromJson( + json['block_list_config'] as Map, + ), + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + floodConfig: json['flood_config'] == null ? null : FloodConfig.fromJson(json['flood_config'] as Map), + key: json['key'] as String, + llmConfig: json['llm_config'] == null ? null : LLMConfig.fromJson(json['llm_config'] as Map), + supportedVideoCallHarmTypes: (json['supported_video_call_harm_types'] as List) + .map((e) => e as String) + .toList(), + team: json['team'] as String, + updatedAt: const StreamDateTimeConverter().fromJson( + json['updated_at'] as Object, + ), + velocityFilterConfig: json['velocity_filter_config'] == null + ? null + : VelocityFilterConfig.fromJson( + json['velocity_filter_config'] as Map, + ), + videoCallRuleConfig: json['video_call_rule_config'] == null + ? null + : VideoCallRuleConfig.fromJson( + json['video_call_rule_config'] as Map, + ), +); + +Map _$ConfigResponseToJson(ConfigResponse instance) => { + 'ai_audio_config': instance.aiAudioConfig?.toJson(), + 'ai_image_config': instance.aiImageConfig?.toJson(), + 'ai_image_label_definitions': instance.aiImageLabelDefinitions?.map((e) => e.toJson()).toList(), + 'ai_image_subclassifications': instance.aiImageSubclassifications, + 'ai_text_config': instance.aiTextConfig?.toJson(), + 'ai_video_config': instance.aiVideoConfig?.toJson(), + 'async': instance.async, + 'automod_platform_circumvention_config': instance.automodPlatformCircumventionConfig?.toJson(), + 'automod_semantic_filters_config': instance.automodSemanticFiltersConfig?.toJson(), + 'automod_toxicity_config': instance.automodToxicityConfig?.toJson(), + 'available_bodyguard_profiles': instance.availableBodyguardProfiles?.map((e) => e.toJson()).toList(), + 'block_list_config': instance.blockListConfig?.toJson(), + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'flood_config': instance.floodConfig?.toJson(), + 'key': instance.key, + 'llm_config': instance.llmConfig?.toJson(), + 'supported_video_call_harm_types': instance.supportedVideoCallHarmTypes, + 'team': instance.team, + 'updated_at': const StreamDateTimeConverter().toJson(instance.updatedAt), + 'velocity_filter_config': instance.velocityFilterConfig?.toJson(), + 'video_call_rule_config': instance.videoCallRuleConfig?.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/content_count_rule_parameters.dart b/packages/stream_chat/lib/open_api/model/content_count_rule_parameters.dart new file mode 100644 index 0000000000..8240d4ef10 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/content_count_rule_parameters.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'content_count_rule_parameters.g.dart'; +part 'content_count_rule_parameters.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ContentCountRuleParameters with _$ContentCountRuleParameters { + const ContentCountRuleParameters({ + this.threshold, + this.timeWindow, + }); + + @override + @JsonKey(name: 'threshold') + final int? threshold; + + @override + @JsonKey(name: 'time_window') + final String? timeWindow; + + Map toJson() => _$ContentCountRuleParametersToJson(this); + + static ContentCountRuleParameters fromJson(Map json) => _$ContentCountRuleParametersFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/content_count_rule_parameters.freezed.dart b/packages/stream_chat/lib/open_api/model/content_count_rule_parameters.freezed.dart new file mode 100644 index 0000000000..27638fcec4 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/content_count_rule_parameters.freezed.dart @@ -0,0 +1,82 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'content_count_rule_parameters.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ContentCountRuleParameters { + int? get threshold; + String? get timeWindow; + + /// Create a copy of ContentCountRuleParameters + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ContentCountRuleParametersCopyWith get copyWith => + _$ContentCountRuleParametersCopyWithImpl( + this as ContentCountRuleParameters, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ContentCountRuleParameters && + (identical(other.threshold, threshold) || other.threshold == threshold) && + (identical(other.timeWindow, timeWindow) || other.timeWindow == timeWindow)); + } + + @override + int get hashCode => Object.hash(runtimeType, threshold, timeWindow); + + @override + String toString() { + return 'ContentCountRuleParameters(threshold: $threshold, timeWindow: $timeWindow)'; + } +} + +/// @nodoc +abstract mixin class $ContentCountRuleParametersCopyWith<$Res> { + factory $ContentCountRuleParametersCopyWith( + ContentCountRuleParameters value, + $Res Function(ContentCountRuleParameters) _then, + ) = _$ContentCountRuleParametersCopyWithImpl; + @useResult + $Res call({int? threshold, String? timeWindow}); +} + +/// @nodoc +class _$ContentCountRuleParametersCopyWithImpl<$Res> implements $ContentCountRuleParametersCopyWith<$Res> { + _$ContentCountRuleParametersCopyWithImpl(this._self, this._then); + + final ContentCountRuleParameters _self; + final $Res Function(ContentCountRuleParameters) _then; + + /// Create a copy of ContentCountRuleParameters + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? threshold = freezed, Object? timeWindow = freezed}) { + return _then( + ContentCountRuleParameters( + threshold: freezed == threshold + ? _self.threshold + : threshold // ignore: cast_nullable_to_non_nullable + as int?, + timeWindow: freezed == timeWindow + ? _self.timeWindow + : timeWindow // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/content_count_rule_parameters.g.dart b/packages/stream_chat/lib/open_api/model/content_count_rule_parameters.g.dart new file mode 100644 index 0000000000..6e58dbfe67 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/content_count_rule_parameters.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'content_count_rule_parameters.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ContentCountRuleParameters _$ContentCountRuleParametersFromJson( + Map json, +) => ContentCountRuleParameters( + threshold: (json['threshold'] as num?)?.toInt(), + timeWindow: json['time_window'] as String?, +); + +Map _$ContentCountRuleParametersToJson( + ContentCountRuleParameters instance, +) => { + 'threshold': instance.threshold, + 'time_window': instance.timeWindow, +}; diff --git a/packages/stream_chat/lib/open_api/model/content_custom_property_count_parameters.dart b/packages/stream_chat/lib/open_api/model/content_custom_property_count_parameters.dart new file mode 100644 index 0000000000..2138a1a8c2 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/content_custom_property_count_parameters.dart @@ -0,0 +1,47 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'content_custom_property_count_parameters.g.dart'; +part 'content_custom_property_count_parameters.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ContentCustomPropertyCountParameters with _$ContentCustomPropertyCountParameters { + const ContentCustomPropertyCountParameters({ + this.operator, + this.propertyKey, + this.threshold, + this.timeWindow, + }); + + @override + @JsonKey(name: 'operator') + final String? operator; + + @override + @JsonKey(name: 'property_key') + final String? propertyKey; + + @override + @JsonKey(name: 'threshold') + final int? threshold; + + @override + @JsonKey(name: 'time_window') + final String? timeWindow; + + Map toJson() => _$ContentCustomPropertyCountParametersToJson(this); + + static ContentCustomPropertyCountParameters fromJson(Map json) => + _$ContentCustomPropertyCountParametersFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/content_custom_property_count_parameters.freezed.dart b/packages/stream_chat/lib/open_api/model/content_custom_property_count_parameters.freezed.dart new file mode 100644 index 0000000000..e386f15645 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/content_custom_property_count_parameters.freezed.dart @@ -0,0 +1,105 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'content_custom_property_count_parameters.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ContentCustomPropertyCountParameters { + String? get operator; + String? get propertyKey; + int? get threshold; + String? get timeWindow; + + /// Create a copy of ContentCustomPropertyCountParameters + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ContentCustomPropertyCountParametersCopyWith get copyWith => + _$ContentCustomPropertyCountParametersCopyWithImpl( + this as ContentCustomPropertyCountParameters, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ContentCustomPropertyCountParameters && + (identical(other.operator, operator) || other.operator == operator) && + (identical(other.propertyKey, propertyKey) || other.propertyKey == propertyKey) && + (identical(other.threshold, threshold) || other.threshold == threshold) && + (identical(other.timeWindow, timeWindow) || other.timeWindow == timeWindow)); + } + + @override + int get hashCode => Object.hash(runtimeType, operator, propertyKey, threshold, timeWindow); + + @override + String toString() { + return 'ContentCustomPropertyCountParameters(operator: $operator, propertyKey: $propertyKey, threshold: $threshold, timeWindow: $timeWindow)'; + } +} + +/// @nodoc +abstract mixin class $ContentCustomPropertyCountParametersCopyWith<$Res> { + factory $ContentCustomPropertyCountParametersCopyWith( + ContentCustomPropertyCountParameters value, + $Res Function(ContentCustomPropertyCountParameters) _then, + ) = _$ContentCustomPropertyCountParametersCopyWithImpl; + @useResult + $Res call({ + String? operator, + String? propertyKey, + int? threshold, + String? timeWindow, + }); +} + +/// @nodoc +class _$ContentCustomPropertyCountParametersCopyWithImpl<$Res> + implements $ContentCustomPropertyCountParametersCopyWith<$Res> { + _$ContentCustomPropertyCountParametersCopyWithImpl(this._self, this._then); + + final ContentCustomPropertyCountParameters _self; + final $Res Function(ContentCustomPropertyCountParameters) _then; + + /// Create a copy of ContentCustomPropertyCountParameters + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? operator = freezed, + Object? propertyKey = freezed, + Object? threshold = freezed, + Object? timeWindow = freezed, + }) { + return _then( + ContentCustomPropertyCountParameters( + operator: freezed == operator + ? _self.operator + : operator // ignore: cast_nullable_to_non_nullable + as String?, + propertyKey: freezed == propertyKey + ? _self.propertyKey + : propertyKey // ignore: cast_nullable_to_non_nullable + as String?, + threshold: freezed == threshold + ? _self.threshold + : threshold // ignore: cast_nullable_to_non_nullable + as int?, + timeWindow: freezed == timeWindow + ? _self.timeWindow + : timeWindow // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/content_custom_property_count_parameters.g.dart b/packages/stream_chat/lib/open_api/model/content_custom_property_count_parameters.g.dart new file mode 100644 index 0000000000..3bb615997c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/content_custom_property_count_parameters.g.dart @@ -0,0 +1,24 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'content_custom_property_count_parameters.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ContentCustomPropertyCountParameters _$ContentCustomPropertyCountParametersFromJson(Map json) => + ContentCustomPropertyCountParameters( + operator: json['operator'] as String?, + propertyKey: json['property_key'] as String?, + threshold: (json['threshold'] as num?)?.toInt(), + timeWindow: json['time_window'] as String?, + ); + +Map _$ContentCustomPropertyCountParametersToJson( + ContentCustomPropertyCountParameters instance, +) => { + 'operator': instance.operator, + 'property_key': instance.propertyKey, + 'threshold': instance.threshold, + 'time_window': instance.timeWindow, +}; diff --git a/packages/stream_chat/lib/open_api/model/content_custom_property_parameters.dart b/packages/stream_chat/lib/open_api/model/content_custom_property_parameters.dart new file mode 100644 index 0000000000..a14fdcd8f5 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/content_custom_property_parameters.dart @@ -0,0 +1,37 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'content_custom_property_parameters.g.dart'; +part 'content_custom_property_parameters.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ContentCustomPropertyParameters with _$ContentCustomPropertyParameters { + const ContentCustomPropertyParameters({ + this.operator, + this.propertyKey, + }); + + @override + @JsonKey(name: 'operator') + final String? operator; + + @override + @JsonKey(name: 'property_key') + final String? propertyKey; + + Map toJson() => _$ContentCustomPropertyParametersToJson(this); + + static ContentCustomPropertyParameters fromJson(Map json) => + _$ContentCustomPropertyParametersFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/content_custom_property_parameters.freezed.dart b/packages/stream_chat/lib/open_api/model/content_custom_property_parameters.freezed.dart new file mode 100644 index 0000000000..f046986790 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/content_custom_property_parameters.freezed.dart @@ -0,0 +1,82 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'content_custom_property_parameters.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ContentCustomPropertyParameters { + String? get operator; + String? get propertyKey; + + /// Create a copy of ContentCustomPropertyParameters + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ContentCustomPropertyParametersCopyWith get copyWith => + _$ContentCustomPropertyParametersCopyWithImpl( + this as ContentCustomPropertyParameters, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ContentCustomPropertyParameters && + (identical(other.operator, operator) || other.operator == operator) && + (identical(other.propertyKey, propertyKey) || other.propertyKey == propertyKey)); + } + + @override + int get hashCode => Object.hash(runtimeType, operator, propertyKey); + + @override + String toString() { + return 'ContentCustomPropertyParameters(operator: $operator, propertyKey: $propertyKey)'; + } +} + +/// @nodoc +abstract mixin class $ContentCustomPropertyParametersCopyWith<$Res> { + factory $ContentCustomPropertyParametersCopyWith( + ContentCustomPropertyParameters value, + $Res Function(ContentCustomPropertyParameters) _then, + ) = _$ContentCustomPropertyParametersCopyWithImpl; + @useResult + $Res call({String? operator, String? propertyKey}); +} + +/// @nodoc +class _$ContentCustomPropertyParametersCopyWithImpl<$Res> implements $ContentCustomPropertyParametersCopyWith<$Res> { + _$ContentCustomPropertyParametersCopyWithImpl(this._self, this._then); + + final ContentCustomPropertyParameters _self; + final $Res Function(ContentCustomPropertyParameters) _then; + + /// Create a copy of ContentCustomPropertyParameters + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? operator = freezed, Object? propertyKey = freezed}) { + return _then( + ContentCustomPropertyParameters( + operator: freezed == operator + ? _self.operator + : operator // ignore: cast_nullable_to_non_nullable + as String?, + propertyKey: freezed == propertyKey + ? _self.propertyKey + : propertyKey // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/content_custom_property_parameters.g.dart b/packages/stream_chat/lib/open_api/model/content_custom_property_parameters.g.dart new file mode 100644 index 0000000000..655e1cdb1f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/content_custom_property_parameters.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'content_custom_property_parameters.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ContentCustomPropertyParameters _$ContentCustomPropertyParametersFromJson( + Map json, +) => ContentCustomPropertyParameters( + operator: json['operator'] as String?, + propertyKey: json['property_key'] as String?, +); + +Map _$ContentCustomPropertyParametersToJson( + ContentCustomPropertyParameters instance, +) => { + 'operator': instance.operator, + 'property_key': instance.propertyKey, +}; diff --git a/packages/stream_chat/lib/open_api/model/create_block_list_request.dart b/packages/stream_chat/lib/open_api/model/create_block_list_request.dart new file mode 100644 index 0000000000..0f68d52af2 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/create_block_list_request.dart @@ -0,0 +1,79 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'create_block_list_request.g.dart'; +part 'create_block_list_request.freezed.dart'; + +extension type const CreateBlockListRequestType._(String _) implements String { + static const domain = CreateBlockListRequestType._('domain'); + static const domainAllowlist = CreateBlockListRequestType._('domain_allowlist'); + static const email = CreateBlockListRequestType._('email'); + static const emailAllowlist = CreateBlockListRequestType._('email_allowlist'); + static const regex = CreateBlockListRequestType._('regex'); + static const word = CreateBlockListRequestType._('word'); + + factory CreateBlockListRequestType.fromJson(String json) => CreateBlockListRequestType._(json); + + String toJson() => this; +} + +@freezed +@immutable +@JsonSerializable() +class CreateBlockListRequest with _$CreateBlockListRequest { + const CreateBlockListRequest({ + this.isConfusableFoldingEnabled, + this.isLeetCheckEnabled, + this.isPluralCheckEnabled, + this.isSubstringMatchingEnabled, + required this.name, + this.team, + this.type, + required this.words, + }); + + @override + @JsonKey(name: 'is_confusable_folding_enabled') + final bool? isConfusableFoldingEnabled; + + @override + @JsonKey(name: 'is_leet_check_enabled') + final bool? isLeetCheckEnabled; + + @override + @JsonKey(name: 'is_plural_check_enabled') + final bool? isPluralCheckEnabled; + + @override + @JsonKey(name: 'is_substring_matching_enabled') + final bool? isSubstringMatchingEnabled; + + @override + @JsonKey(name: 'name') + final String name; + + @override + @JsonKey(name: 'team') + final String? team; + + @override + @JsonKey(name: 'type') + final CreateBlockListRequestType? type; + + @override + @JsonKey(name: 'words') + final List words; + + Map toJson() => _$CreateBlockListRequestToJson(this); + + static CreateBlockListRequest fromJson(Map json) => _$CreateBlockListRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/create_block_list_request.freezed.dart b/packages/stream_chat/lib/open_api/model/create_block_list_request.freezed.dart new file mode 100644 index 0000000000..06908e8790 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/create_block_list_request.freezed.dart @@ -0,0 +1,156 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'create_block_list_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$CreateBlockListRequest { + bool? get isConfusableFoldingEnabled; + bool? get isLeetCheckEnabled; + bool? get isPluralCheckEnabled; + bool? get isSubstringMatchingEnabled; + String get name; + String? get team; + CreateBlockListRequestType? get type; + List get words; + + /// Create a copy of CreateBlockListRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $CreateBlockListRequestCopyWith get copyWith => + _$CreateBlockListRequestCopyWithImpl( + this as CreateBlockListRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is CreateBlockListRequest && + (identical( + other.isConfusableFoldingEnabled, + isConfusableFoldingEnabled, + ) || + other.isConfusableFoldingEnabled == isConfusableFoldingEnabled) && + (identical(other.isLeetCheckEnabled, isLeetCheckEnabled) || + other.isLeetCheckEnabled == isLeetCheckEnabled) && + (identical(other.isPluralCheckEnabled, isPluralCheckEnabled) || + other.isPluralCheckEnabled == isPluralCheckEnabled) && + (identical( + other.isSubstringMatchingEnabled, + isSubstringMatchingEnabled, + ) || + other.isSubstringMatchingEnabled == isSubstringMatchingEnabled) && + (identical(other.name, name) || other.name == name) && + (identical(other.team, team) || other.team == team) && + (identical(other.type, type) || other.type == type) && + const DeepCollectionEquality().equals(other.words, words)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + isConfusableFoldingEnabled, + isLeetCheckEnabled, + isPluralCheckEnabled, + isSubstringMatchingEnabled, + name, + team, + type, + const DeepCollectionEquality().hash(words), + ); + + @override + String toString() { + return 'CreateBlockListRequest(isConfusableFoldingEnabled: $isConfusableFoldingEnabled, isLeetCheckEnabled: $isLeetCheckEnabled, isPluralCheckEnabled: $isPluralCheckEnabled, isSubstringMatchingEnabled: $isSubstringMatchingEnabled, name: $name, team: $team, type: $type, words: $words)'; + } +} + +/// @nodoc +abstract mixin class $CreateBlockListRequestCopyWith<$Res> { + factory $CreateBlockListRequestCopyWith( + CreateBlockListRequest value, + $Res Function(CreateBlockListRequest) _then, + ) = _$CreateBlockListRequestCopyWithImpl; + @useResult + $Res call({ + bool? isConfusableFoldingEnabled, + bool? isLeetCheckEnabled, + bool? isPluralCheckEnabled, + bool? isSubstringMatchingEnabled, + String name, + String? team, + CreateBlockListRequestType? type, + List words, + }); +} + +/// @nodoc +class _$CreateBlockListRequestCopyWithImpl<$Res> implements $CreateBlockListRequestCopyWith<$Res> { + _$CreateBlockListRequestCopyWithImpl(this._self, this._then); + + final CreateBlockListRequest _self; + final $Res Function(CreateBlockListRequest) _then; + + /// Create a copy of CreateBlockListRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? isConfusableFoldingEnabled = freezed, + Object? isLeetCheckEnabled = freezed, + Object? isPluralCheckEnabled = freezed, + Object? isSubstringMatchingEnabled = freezed, + Object? name = null, + Object? team = freezed, + Object? type = freezed, + Object? words = null, + }) { + return _then( + CreateBlockListRequest( + isConfusableFoldingEnabled: freezed == isConfusableFoldingEnabled + ? _self.isConfusableFoldingEnabled + : isConfusableFoldingEnabled // ignore: cast_nullable_to_non_nullable + as bool?, + isLeetCheckEnabled: freezed == isLeetCheckEnabled + ? _self.isLeetCheckEnabled + : isLeetCheckEnabled // ignore: cast_nullable_to_non_nullable + as bool?, + isPluralCheckEnabled: freezed == isPluralCheckEnabled + ? _self.isPluralCheckEnabled + : isPluralCheckEnabled // ignore: cast_nullable_to_non_nullable + as bool?, + isSubstringMatchingEnabled: freezed == isSubstringMatchingEnabled + ? _self.isSubstringMatchingEnabled + : isSubstringMatchingEnabled // ignore: cast_nullable_to_non_nullable + as bool?, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + team: freezed == team + ? _self.team + : team // ignore: cast_nullable_to_non_nullable + as String?, + type: freezed == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as CreateBlockListRequestType?, + words: null == words + ? _self.words + : words // ignore: cast_nullable_to_non_nullable + as List, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/create_block_list_request.g.dart b/packages/stream_chat/lib/open_api/model/create_block_list_request.g.dart new file mode 100644 index 0000000000..fff6197900 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/create_block_list_request.g.dart @@ -0,0 +1,33 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'create_block_list_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +CreateBlockListRequest _$CreateBlockListRequestFromJson( + Map json, +) => CreateBlockListRequest( + isConfusableFoldingEnabled: json['is_confusable_folding_enabled'] as bool?, + isLeetCheckEnabled: json['is_leet_check_enabled'] as bool?, + isPluralCheckEnabled: json['is_plural_check_enabled'] as bool?, + isSubstringMatchingEnabled: json['is_substring_matching_enabled'] as bool?, + name: json['name'] as String, + team: json['team'] as String?, + type: json['type'] == null ? null : CreateBlockListRequestType.fromJson(json['type'] as String), + words: (json['words'] as List).map((e) => e as String).toList(), +); + +Map _$CreateBlockListRequestToJson( + CreateBlockListRequest instance, +) => { + 'is_confusable_folding_enabled': instance.isConfusableFoldingEnabled, + 'is_leet_check_enabled': instance.isLeetCheckEnabled, + 'is_plural_check_enabled': instance.isPluralCheckEnabled, + 'is_substring_matching_enabled': instance.isSubstringMatchingEnabled, + 'name': instance.name, + 'team': instance.team, + 'type': instance.type?.toJson(), + 'words': instance.words, +}; diff --git a/packages/stream_chat/lib/open_api/model/create_block_list_response.dart b/packages/stream_chat/lib/open_api/model/create_block_list_response.dart new file mode 100644 index 0000000000..be016349e9 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/create_block_list_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'create_block_list_response.g.dart'; +part 'create_block_list_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class CreateBlockListResponse with _$CreateBlockListResponse { + const CreateBlockListResponse({ + this.blocklist, + required this.duration, + }); + + @override + @JsonKey(name: 'blocklist') + final BlockListResponse? blocklist; + + @override + @JsonKey(name: 'duration') + final String duration; + + Map toJson() => _$CreateBlockListResponseToJson(this); + + static CreateBlockListResponse fromJson(Map json) => _$CreateBlockListResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/create_block_list_response.freezed.dart b/packages/stream_chat/lib/open_api/model/create_block_list_response.freezed.dart new file mode 100644 index 0000000000..758514115a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/create_block_list_response.freezed.dart @@ -0,0 +1,82 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'create_block_list_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$CreateBlockListResponse { + BlockListResponse? get blocklist; + String get duration; + + /// Create a copy of CreateBlockListResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $CreateBlockListResponseCopyWith get copyWith => + _$CreateBlockListResponseCopyWithImpl( + this as CreateBlockListResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is CreateBlockListResponse && + (identical(other.blocklist, blocklist) || other.blocklist == blocklist) && + (identical(other.duration, duration) || other.duration == duration)); + } + + @override + int get hashCode => Object.hash(runtimeType, blocklist, duration); + + @override + String toString() { + return 'CreateBlockListResponse(blocklist: $blocklist, duration: $duration)'; + } +} + +/// @nodoc +abstract mixin class $CreateBlockListResponseCopyWith<$Res> { + factory $CreateBlockListResponseCopyWith( + CreateBlockListResponse value, + $Res Function(CreateBlockListResponse) _then, + ) = _$CreateBlockListResponseCopyWithImpl; + @useResult + $Res call({BlockListResponse? blocklist, String duration}); +} + +/// @nodoc +class _$CreateBlockListResponseCopyWithImpl<$Res> implements $CreateBlockListResponseCopyWith<$Res> { + _$CreateBlockListResponseCopyWithImpl(this._self, this._then); + + final CreateBlockListResponse _self; + final $Res Function(CreateBlockListResponse) _then; + + /// Create a copy of CreateBlockListResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? blocklist = freezed, Object? duration = null}) { + return _then( + CreateBlockListResponse( + blocklist: freezed == blocklist + ? _self.blocklist + : blocklist // ignore: cast_nullable_to_non_nullable + as BlockListResponse?, + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/create_block_list_response.g.dart b/packages/stream_chat/lib/open_api/model/create_block_list_response.g.dart new file mode 100644 index 0000000000..c78a7771ec --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/create_block_list_response.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'create_block_list_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +CreateBlockListResponse _$CreateBlockListResponseFromJson( + Map json, +) => CreateBlockListResponse( + blocklist: json['blocklist'] == null ? null : BlockListResponse.fromJson(json['blocklist'] as Map), + duration: json['duration'] as String, +); + +Map _$CreateBlockListResponseToJson( + CreateBlockListResponse instance, +) => { + 'blocklist': instance.blocklist?.toJson(), + 'duration': instance.duration, +}; diff --git a/packages/stream_chat/lib/open_api/model/create_device_request.dart b/packages/stream_chat/lib/open_api/model/create_device_request.dart new file mode 100644 index 0000000000..18140d898d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/create_device_request.dart @@ -0,0 +1,62 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'create_device_request.g.dart'; +part 'create_device_request.freezed.dart'; + +extension type const CreateDeviceRequestPushProvider._(String _) implements String { + static const apn = CreateDeviceRequestPushProvider._('apn'); + static const firebase = CreateDeviceRequestPushProvider._('firebase'); + static const huawei = CreateDeviceRequestPushProvider._('huawei'); + static const xiaomi = CreateDeviceRequestPushProvider._('xiaomi'); + + factory CreateDeviceRequestPushProvider.fromJson(String json) => CreateDeviceRequestPushProvider._(json); + + String toJson() => this; +} + +@freezed +@immutable +@JsonSerializable() +class CreateDeviceRequest with _$CreateDeviceRequest { + const CreateDeviceRequest({ + this.hardwareId, + required this.id, + required this.pushProvider, + this.pushProviderName, + this.voipToken, + }); + + @override + @JsonKey(name: 'hardware_id') + final String? hardwareId; + + @override + @JsonKey(name: 'id') + final String id; + + @override + @JsonKey(name: 'push_provider') + final CreateDeviceRequestPushProvider pushProvider; + + @override + @JsonKey(name: 'push_provider_name') + final String? pushProviderName; + + @override + @JsonKey(name: 'voip_token') + final bool? voipToken; + + Map toJson() => _$CreateDeviceRequestToJson(this); + + static CreateDeviceRequest fromJson(Map json) => _$CreateDeviceRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/create_device_request.freezed.dart b/packages/stream_chat/lib/open_api/model/create_device_request.freezed.dart new file mode 100644 index 0000000000..8c545aa90e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/create_device_request.freezed.dart @@ -0,0 +1,119 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'create_device_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$CreateDeviceRequest { + String? get hardwareId; + String get id; + CreateDeviceRequestPushProvider get pushProvider; + String? get pushProviderName; + bool? get voipToken; + + /// Create a copy of CreateDeviceRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $CreateDeviceRequestCopyWith get copyWith => + _$CreateDeviceRequestCopyWithImpl( + this as CreateDeviceRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is CreateDeviceRequest && + (identical(other.hardwareId, hardwareId) || other.hardwareId == hardwareId) && + (identical(other.id, id) || other.id == id) && + (identical(other.pushProvider, pushProvider) || other.pushProvider == pushProvider) && + (identical(other.pushProviderName, pushProviderName) || other.pushProviderName == pushProviderName) && + (identical(other.voipToken, voipToken) || other.voipToken == voipToken)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + hardwareId, + id, + pushProvider, + pushProviderName, + voipToken, + ); + + @override + String toString() { + return 'CreateDeviceRequest(hardwareId: $hardwareId, id: $id, pushProvider: $pushProvider, pushProviderName: $pushProviderName, voipToken: $voipToken)'; + } +} + +/// @nodoc +abstract mixin class $CreateDeviceRequestCopyWith<$Res> { + factory $CreateDeviceRequestCopyWith( + CreateDeviceRequest value, + $Res Function(CreateDeviceRequest) _then, + ) = _$CreateDeviceRequestCopyWithImpl; + @useResult + $Res call({ + String? hardwareId, + String id, + CreateDeviceRequestPushProvider pushProvider, + String? pushProviderName, + bool? voipToken, + }); +} + +/// @nodoc +class _$CreateDeviceRequestCopyWithImpl<$Res> implements $CreateDeviceRequestCopyWith<$Res> { + _$CreateDeviceRequestCopyWithImpl(this._self, this._then); + + final CreateDeviceRequest _self; + final $Res Function(CreateDeviceRequest) _then; + + /// Create a copy of CreateDeviceRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? hardwareId = freezed, + Object? id = null, + Object? pushProvider = null, + Object? pushProviderName = freezed, + Object? voipToken = freezed, + }) { + return _then( + CreateDeviceRequest( + hardwareId: freezed == hardwareId + ? _self.hardwareId + : hardwareId // ignore: cast_nullable_to_non_nullable + as String?, + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + pushProvider: null == pushProvider + ? _self.pushProvider + : pushProvider // ignore: cast_nullable_to_non_nullable + as CreateDeviceRequestPushProvider, + pushProviderName: freezed == pushProviderName + ? _self.pushProviderName + : pushProviderName // ignore: cast_nullable_to_non_nullable + as String?, + voipToken: freezed == voipToken + ? _self.voipToken + : voipToken // ignore: cast_nullable_to_non_nullable + as bool?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/create_device_request.g.dart b/packages/stream_chat/lib/open_api/model/create_device_request.g.dart new file mode 100644 index 0000000000..c47b1515e3 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/create_device_request.g.dart @@ -0,0 +1,27 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'create_device_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +CreateDeviceRequest _$CreateDeviceRequestFromJson(Map json) => CreateDeviceRequest( + hardwareId: json['hardware_id'] as String?, + id: json['id'] as String, + pushProvider: CreateDeviceRequestPushProvider.fromJson( + json['push_provider'] as String, + ), + pushProviderName: json['push_provider_name'] as String?, + voipToken: json['voip_token'] as bool?, +); + +Map _$CreateDeviceRequestToJson( + CreateDeviceRequest instance, +) => { + 'hardware_id': instance.hardwareId, + 'id': instance.id, + 'push_provider': instance.pushProvider.toJson(), + 'push_provider_name': instance.pushProviderName, + 'voip_token': instance.voipToken, +}; diff --git a/packages/stream_chat/lib/open_api/model/create_draft_request.dart b/packages/stream_chat/lib/open_api/model/create_draft_request.dart new file mode 100644 index 0000000000..0f734b4359 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/create_draft_request.dart @@ -0,0 +1,31 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'create_draft_request.g.dart'; +part 'create_draft_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class CreateDraftRequest with _$CreateDraftRequest { + const CreateDraftRequest({ + required this.message, + }); + + @override + @JsonKey(name: 'message') + final MessageRequest message; + + Map toJson() => _$CreateDraftRequestToJson(this); + + static CreateDraftRequest fromJson(Map json) => _$CreateDraftRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/create_draft_request.freezed.dart b/packages/stream_chat/lib/open_api/model/create_draft_request.freezed.dart new file mode 100644 index 0000000000..01373df255 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/create_draft_request.freezed.dart @@ -0,0 +1,75 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'create_draft_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$CreateDraftRequest { + MessageRequest get message; + + /// Create a copy of CreateDraftRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $CreateDraftRequestCopyWith get copyWith => _$CreateDraftRequestCopyWithImpl( + this as CreateDraftRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is CreateDraftRequest && + (identical(other.message, message) || other.message == message)); + } + + @override + int get hashCode => Object.hash(runtimeType, message); + + @override + String toString() { + return 'CreateDraftRequest(message: $message)'; + } +} + +/// @nodoc +abstract mixin class $CreateDraftRequestCopyWith<$Res> { + factory $CreateDraftRequestCopyWith( + CreateDraftRequest value, + $Res Function(CreateDraftRequest) _then, + ) = _$CreateDraftRequestCopyWithImpl; + @useResult + $Res call({MessageRequest message}); +} + +/// @nodoc +class _$CreateDraftRequestCopyWithImpl<$Res> implements $CreateDraftRequestCopyWith<$Res> { + _$CreateDraftRequestCopyWithImpl(this._self, this._then); + + final CreateDraftRequest _self; + final $Res Function(CreateDraftRequest) _then; + + /// Create a copy of CreateDraftRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? message = null}) { + return _then( + CreateDraftRequest( + message: null == message + ? _self.message + : message // ignore: cast_nullable_to_non_nullable + as MessageRequest, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/create_draft_request.g.dart b/packages/stream_chat/lib/open_api/model/create_draft_request.g.dart new file mode 100644 index 0000000000..eff596c37a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/create_draft_request.g.dart @@ -0,0 +1,15 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'create_draft_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +CreateDraftRequest _$CreateDraftRequestFromJson(Map json) => CreateDraftRequest( + message: MessageRequest.fromJson(json['message'] as Map), +); + +Map _$CreateDraftRequestToJson(CreateDraftRequest instance) => { + 'message': instance.message.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/create_draft_response.dart b/packages/stream_chat/lib/open_api/model/create_draft_response.dart new file mode 100644 index 0000000000..af02c90192 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/create_draft_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'create_draft_response.g.dart'; +part 'create_draft_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class CreateDraftResponse with _$CreateDraftResponse { + const CreateDraftResponse({ + required this.draft, + required this.duration, + }); + + @override + @JsonKey(name: 'draft') + final DraftResponse draft; + + @override + @JsonKey(name: 'duration') + final String duration; + + Map toJson() => _$CreateDraftResponseToJson(this); + + static CreateDraftResponse fromJson(Map json) => _$CreateDraftResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/create_draft_response.freezed.dart b/packages/stream_chat/lib/open_api/model/create_draft_response.freezed.dart new file mode 100644 index 0000000000..2acd1a3bc4 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/create_draft_response.freezed.dart @@ -0,0 +1,82 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'create_draft_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$CreateDraftResponse { + DraftResponse get draft; + String get duration; + + /// Create a copy of CreateDraftResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $CreateDraftResponseCopyWith get copyWith => + _$CreateDraftResponseCopyWithImpl( + this as CreateDraftResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is CreateDraftResponse && + (identical(other.draft, draft) || other.draft == draft) && + (identical(other.duration, duration) || other.duration == duration)); + } + + @override + int get hashCode => Object.hash(runtimeType, draft, duration); + + @override + String toString() { + return 'CreateDraftResponse(draft: $draft, duration: $duration)'; + } +} + +/// @nodoc +abstract mixin class $CreateDraftResponseCopyWith<$Res> { + factory $CreateDraftResponseCopyWith( + CreateDraftResponse value, + $Res Function(CreateDraftResponse) _then, + ) = _$CreateDraftResponseCopyWithImpl; + @useResult + $Res call({DraftResponse draft, String duration}); +} + +/// @nodoc +class _$CreateDraftResponseCopyWithImpl<$Res> implements $CreateDraftResponseCopyWith<$Res> { + _$CreateDraftResponseCopyWithImpl(this._self, this._then); + + final CreateDraftResponse _self; + final $Res Function(CreateDraftResponse) _then; + + /// Create a copy of CreateDraftResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? draft = null, Object? duration = null}) { + return _then( + CreateDraftResponse( + draft: null == draft + ? _self.draft + : draft // ignore: cast_nullable_to_non_nullable + as DraftResponse, + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/create_draft_response.g.dart b/packages/stream_chat/lib/open_api/model/create_draft_response.g.dart new file mode 100644 index 0000000000..e9218ede83 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/create_draft_response.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'create_draft_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +CreateDraftResponse _$CreateDraftResponseFromJson(Map json) => CreateDraftResponse( + draft: DraftResponse.fromJson(json['draft'] as Map), + duration: json['duration'] as String, +); + +Map _$CreateDraftResponseToJson( + CreateDraftResponse instance, +) => { + 'draft': instance.draft.toJson(), + 'duration': instance.duration, +}; diff --git a/packages/stream_chat/lib/open_api/model/create_guest_request.dart b/packages/stream_chat/lib/open_api/model/create_guest_request.dart new file mode 100644 index 0000000000..3204e83836 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/create_guest_request.dart @@ -0,0 +1,31 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'create_guest_request.g.dart'; +part 'create_guest_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class CreateGuestRequest with _$CreateGuestRequest { + const CreateGuestRequest({ + required this.user, + }); + + @override + @JsonKey(name: 'user') + final UserRequest user; + + Map toJson() => _$CreateGuestRequestToJson(this); + + static CreateGuestRequest fromJson(Map json) => _$CreateGuestRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/create_guest_request.freezed.dart b/packages/stream_chat/lib/open_api/model/create_guest_request.freezed.dart new file mode 100644 index 0000000000..853e3e45e7 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/create_guest_request.freezed.dart @@ -0,0 +1,75 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'create_guest_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$CreateGuestRequest { + UserRequest get user; + + /// Create a copy of CreateGuestRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $CreateGuestRequestCopyWith get copyWith => _$CreateGuestRequestCopyWithImpl( + this as CreateGuestRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is CreateGuestRequest && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash(runtimeType, user); + + @override + String toString() { + return 'CreateGuestRequest(user: $user)'; + } +} + +/// @nodoc +abstract mixin class $CreateGuestRequestCopyWith<$Res> { + factory $CreateGuestRequestCopyWith( + CreateGuestRequest value, + $Res Function(CreateGuestRequest) _then, + ) = _$CreateGuestRequestCopyWithImpl; + @useResult + $Res call({UserRequest user}); +} + +/// @nodoc +class _$CreateGuestRequestCopyWithImpl<$Res> implements $CreateGuestRequestCopyWith<$Res> { + _$CreateGuestRequestCopyWithImpl(this._self, this._then); + + final CreateGuestRequest _self; + final $Res Function(CreateGuestRequest) _then; + + /// Create a copy of CreateGuestRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? user = null}) { + return _then( + CreateGuestRequest( + user: null == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserRequest, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/create_guest_request.g.dart b/packages/stream_chat/lib/open_api/model/create_guest_request.g.dart new file mode 100644 index 0000000000..9c417731c0 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/create_guest_request.g.dart @@ -0,0 +1,15 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'create_guest_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +CreateGuestRequest _$CreateGuestRequestFromJson(Map json) => CreateGuestRequest( + user: UserRequest.fromJson(json['user'] as Map), +); + +Map _$CreateGuestRequestToJson(CreateGuestRequest instance) => { + 'user': instance.user.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/create_guest_response.dart b/packages/stream_chat/lib/open_api/model/create_guest_response.dart new file mode 100644 index 0000000000..c4b9d8ae58 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/create_guest_response.dart @@ -0,0 +1,41 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'create_guest_response.g.dart'; +part 'create_guest_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class CreateGuestResponse with _$CreateGuestResponse { + const CreateGuestResponse({ + required this.accessToken, + required this.duration, + required this.user, + }); + + @override + @JsonKey(name: 'access_token') + final String accessToken; + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'user') + final UserResponse user; + + Map toJson() => _$CreateGuestResponseToJson(this); + + static CreateGuestResponse fromJson(Map json) => _$CreateGuestResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/create_guest_response.freezed.dart b/packages/stream_chat/lib/open_api/model/create_guest_response.freezed.dart new file mode 100644 index 0000000000..79c27f29d2 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/create_guest_response.freezed.dart @@ -0,0 +1,92 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'create_guest_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$CreateGuestResponse { + String get accessToken; + String get duration; + UserResponse get user; + + /// Create a copy of CreateGuestResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $CreateGuestResponseCopyWith get copyWith => + _$CreateGuestResponseCopyWithImpl( + this as CreateGuestResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is CreateGuestResponse && + (identical(other.accessToken, accessToken) || other.accessToken == accessToken) && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash(runtimeType, accessToken, duration, user); + + @override + String toString() { + return 'CreateGuestResponse(accessToken: $accessToken, duration: $duration, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $CreateGuestResponseCopyWith<$Res> { + factory $CreateGuestResponseCopyWith( + CreateGuestResponse value, + $Res Function(CreateGuestResponse) _then, + ) = _$CreateGuestResponseCopyWithImpl; + @useResult + $Res call({String accessToken, String duration, UserResponse user}); +} + +/// @nodoc +class _$CreateGuestResponseCopyWithImpl<$Res> implements $CreateGuestResponseCopyWith<$Res> { + _$CreateGuestResponseCopyWithImpl(this._self, this._then); + + final CreateGuestResponse _self; + final $Res Function(CreateGuestResponse) _then; + + /// Create a copy of CreateGuestResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? accessToken = null, + Object? duration = null, + Object? user = null, + }) { + return _then( + CreateGuestResponse( + accessToken: null == accessToken + ? _self.accessToken + : accessToken // ignore: cast_nullable_to_non_nullable + as String, + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + user: null == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponse, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/create_guest_response.g.dart b/packages/stream_chat/lib/open_api/model/create_guest_response.g.dart new file mode 100644 index 0000000000..f874c19b3d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/create_guest_response.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'create_guest_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +CreateGuestResponse _$CreateGuestResponseFromJson(Map json) => CreateGuestResponse( + accessToken: json['access_token'] as String, + duration: json['duration'] as String, + user: UserResponse.fromJson(json['user'] as Map), +); + +Map _$CreateGuestResponseToJson( + CreateGuestResponse instance, +) => { + 'access_token': instance.accessToken, + 'duration': instance.duration, + 'user': instance.user.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/create_poll_option_request.dart b/packages/stream_chat/lib/open_api/model/create_poll_option_request.dart new file mode 100644 index 0000000000..dbb35844a4 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/create_poll_option_request.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'create_poll_option_request.g.dart'; +part 'create_poll_option_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class CreatePollOptionRequest with _$CreatePollOptionRequest { + const CreatePollOptionRequest({ + this.custom, + required this.text, + }); + + @override + @JsonKey(name: 'custom') + final Map? custom; + + @override + @JsonKey(name: 'text') + final String text; + + Map toJson() => _$CreatePollOptionRequestToJson(this); + + static CreatePollOptionRequest fromJson(Map json) => _$CreatePollOptionRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/create_poll_option_request.freezed.dart b/packages/stream_chat/lib/open_api/model/create_poll_option_request.freezed.dart new file mode 100644 index 0000000000..4de8ccca02 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/create_poll_option_request.freezed.dart @@ -0,0 +1,86 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'create_poll_option_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$CreatePollOptionRequest { + Map? get custom; + String get text; + + /// Create a copy of CreatePollOptionRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $CreatePollOptionRequestCopyWith get copyWith => + _$CreatePollOptionRequestCopyWithImpl( + this as CreatePollOptionRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is CreatePollOptionRequest && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.text, text) || other.text == text)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(custom), + text, + ); + + @override + String toString() { + return 'CreatePollOptionRequest(custom: $custom, text: $text)'; + } +} + +/// @nodoc +abstract mixin class $CreatePollOptionRequestCopyWith<$Res> { + factory $CreatePollOptionRequestCopyWith( + CreatePollOptionRequest value, + $Res Function(CreatePollOptionRequest) _then, + ) = _$CreatePollOptionRequestCopyWithImpl; + @useResult + $Res call({Map? custom, String text}); +} + +/// @nodoc +class _$CreatePollOptionRequestCopyWithImpl<$Res> implements $CreatePollOptionRequestCopyWith<$Res> { + _$CreatePollOptionRequestCopyWithImpl(this._self, this._then); + + final CreatePollOptionRequest _self; + final $Res Function(CreatePollOptionRequest) _then; + + /// Create a copy of CreatePollOptionRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? custom = freezed, Object? text = null}) { + return _then( + CreatePollOptionRequest( + custom: freezed == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map?, + text: null == text + ? _self.text + : text // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/create_poll_option_request.g.dart b/packages/stream_chat/lib/open_api/model/create_poll_option_request.g.dart new file mode 100644 index 0000000000..4aa494f9b3 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/create_poll_option_request.g.dart @@ -0,0 +1,18 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'create_poll_option_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +CreatePollOptionRequest _$CreatePollOptionRequestFromJson( + Map json, +) => CreatePollOptionRequest( + custom: json['custom'] as Map?, + text: json['text'] as String, +); + +Map _$CreatePollOptionRequestToJson( + CreatePollOptionRequest instance, +) => {'custom': instance.custom, 'text': instance.text}; diff --git a/packages/stream_chat/lib/open_api/model/create_poll_request.dart b/packages/stream_chat/lib/open_api/model/create_poll_request.dart new file mode 100644 index 0000000000..a45d523ec0 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/create_poll_request.dart @@ -0,0 +1,90 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'create_poll_request.g.dart'; +part 'create_poll_request.freezed.dart'; + +extension type const CreatePollRequestVotingVisibility._(String _) implements String { + static const anonymous = CreatePollRequestVotingVisibility._('anonymous'); + static const public = CreatePollRequestVotingVisibility._('public'); + + factory CreatePollRequestVotingVisibility.fromJson(String json) => CreatePollRequestVotingVisibility._(json); + + String toJson() => this; +} + +@freezed +@immutable +@JsonSerializable() +class CreatePollRequest with _$CreatePollRequest { + const CreatePollRequest({ + this.allowAnswers, + this.allowUserSuggestedOptions, + this.custom, + this.description, + this.enforceUniqueVote, + this.id, + this.isClosed, + this.maxVotesAllowed, + required this.name, + this.options, + this.votingVisibility, + }); + + @override + @JsonKey(name: 'allow_answers') + final bool? allowAnswers; + + @override + @JsonKey(name: 'allow_user_suggested_options') + final bool? allowUserSuggestedOptions; + + @override + @JsonKey(name: 'custom') + final Map? custom; + + @override + @JsonKey(name: 'description') + final String? description; + + @override + @JsonKey(name: 'enforce_unique_vote') + final bool? enforceUniqueVote; + + @override + @JsonKey(name: 'id') + final String? id; + + @override + @JsonKey(name: 'is_closed') + final bool? isClosed; + + @override + @JsonKey(name: 'max_votes_allowed') + final int? maxVotesAllowed; + + @override + @JsonKey(name: 'name') + final String name; + + @override + @JsonKey(name: 'options') + final List? options; + + @override + @JsonKey(name: 'voting_visibility') + final CreatePollRequestVotingVisibility? votingVisibility; + + Map toJson() => _$CreatePollRequestToJson(this); + + static CreatePollRequest fromJson(Map json) => _$CreatePollRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/create_poll_request.freezed.dart b/packages/stream_chat/lib/open_api/model/create_poll_request.freezed.dart new file mode 100644 index 0000000000..64928a07b3 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/create_poll_request.freezed.dart @@ -0,0 +1,176 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'create_poll_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$CreatePollRequest { + bool? get allowAnswers; + bool? get allowUserSuggestedOptions; + Map? get custom; + String? get description; + bool? get enforceUniqueVote; + String? get id; + bool? get isClosed; + int? get maxVotesAllowed; + String get name; + List? get options; + CreatePollRequestVotingVisibility? get votingVisibility; + + /// Create a copy of CreatePollRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $CreatePollRequestCopyWith get copyWith => _$CreatePollRequestCopyWithImpl( + this as CreatePollRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is CreatePollRequest && + (identical(other.allowAnswers, allowAnswers) || other.allowAnswers == allowAnswers) && + (identical( + other.allowUserSuggestedOptions, + allowUserSuggestedOptions, + ) || + other.allowUserSuggestedOptions == allowUserSuggestedOptions) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.description, description) || other.description == description) && + (identical(other.enforceUniqueVote, enforceUniqueVote) || other.enforceUniqueVote == enforceUniqueVote) && + (identical(other.id, id) || other.id == id) && + (identical(other.isClosed, isClosed) || other.isClosed == isClosed) && + (identical(other.maxVotesAllowed, maxVotesAllowed) || other.maxVotesAllowed == maxVotesAllowed) && + (identical(other.name, name) || other.name == name) && + const DeepCollectionEquality().equals(other.options, options) && + (identical(other.votingVisibility, votingVisibility) || other.votingVisibility == votingVisibility)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + allowAnswers, + allowUserSuggestedOptions, + const DeepCollectionEquality().hash(custom), + description, + enforceUniqueVote, + id, + isClosed, + maxVotesAllowed, + name, + const DeepCollectionEquality().hash(options), + votingVisibility, + ); + + @override + String toString() { + return 'CreatePollRequest(allowAnswers: $allowAnswers, allowUserSuggestedOptions: $allowUserSuggestedOptions, custom: $custom, description: $description, enforceUniqueVote: $enforceUniqueVote, id: $id, isClosed: $isClosed, maxVotesAllowed: $maxVotesAllowed, name: $name, options: $options, votingVisibility: $votingVisibility)'; + } +} + +/// @nodoc +abstract mixin class $CreatePollRequestCopyWith<$Res> { + factory $CreatePollRequestCopyWith( + CreatePollRequest value, + $Res Function(CreatePollRequest) _then, + ) = _$CreatePollRequestCopyWithImpl; + @useResult + $Res call({ + bool? allowAnswers, + bool? allowUserSuggestedOptions, + Map? custom, + String? description, + bool? enforceUniqueVote, + String? id, + bool? isClosed, + int? maxVotesAllowed, + String name, + List? options, + CreatePollRequestVotingVisibility? votingVisibility, + }); +} + +/// @nodoc +class _$CreatePollRequestCopyWithImpl<$Res> implements $CreatePollRequestCopyWith<$Res> { + _$CreatePollRequestCopyWithImpl(this._self, this._then); + + final CreatePollRequest _self; + final $Res Function(CreatePollRequest) _then; + + /// Create a copy of CreatePollRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? allowAnswers = freezed, + Object? allowUserSuggestedOptions = freezed, + Object? custom = freezed, + Object? description = freezed, + Object? enforceUniqueVote = freezed, + Object? id = freezed, + Object? isClosed = freezed, + Object? maxVotesAllowed = freezed, + Object? name = null, + Object? options = freezed, + Object? votingVisibility = freezed, + }) { + return _then( + CreatePollRequest( + allowAnswers: freezed == allowAnswers + ? _self.allowAnswers + : allowAnswers // ignore: cast_nullable_to_non_nullable + as bool?, + allowUserSuggestedOptions: freezed == allowUserSuggestedOptions + ? _self.allowUserSuggestedOptions + : allowUserSuggestedOptions // ignore: cast_nullable_to_non_nullable + as bool?, + custom: freezed == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map?, + description: freezed == description + ? _self.description + : description // ignore: cast_nullable_to_non_nullable + as String?, + enforceUniqueVote: freezed == enforceUniqueVote + ? _self.enforceUniqueVote + : enforceUniqueVote // ignore: cast_nullable_to_non_nullable + as bool?, + id: freezed == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String?, + isClosed: freezed == isClosed + ? _self.isClosed + : isClosed // ignore: cast_nullable_to_non_nullable + as bool?, + maxVotesAllowed: freezed == maxVotesAllowed + ? _self.maxVotesAllowed + : maxVotesAllowed // ignore: cast_nullable_to_non_nullable + as int?, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + options: freezed == options + ? _self.options + : options // ignore: cast_nullable_to_non_nullable + as List?, + votingVisibility: freezed == votingVisibility + ? _self.votingVisibility + : votingVisibility // ignore: cast_nullable_to_non_nullable + as CreatePollRequestVotingVisibility?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/create_poll_request.g.dart b/packages/stream_chat/lib/open_api/model/create_poll_request.g.dart new file mode 100644 index 0000000000..e6595ef130 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/create_poll_request.g.dart @@ -0,0 +1,41 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'create_poll_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +CreatePollRequest _$CreatePollRequestFromJson(Map json) => CreatePollRequest( + allowAnswers: json['allow_answers'] as bool?, + allowUserSuggestedOptions: json['allow_user_suggested_options'] as bool?, + custom: json['custom'] as Map?, + description: json['description'] as String?, + enforceUniqueVote: json['enforce_unique_vote'] as bool?, + id: json['id'] as String?, + isClosed: json['is_closed'] as bool?, + maxVotesAllowed: (json['max_votes_allowed'] as num?)?.toInt(), + name: json['name'] as String, + options: (json['options'] as List?) + ?.map((e) => PollOptionInput.fromJson(e as Map)) + .toList(), + votingVisibility: json['voting_visibility'] == null + ? null + : CreatePollRequestVotingVisibility.fromJson( + json['voting_visibility'] as String, + ), +); + +Map _$CreatePollRequestToJson(CreatePollRequest instance) => { + 'allow_answers': instance.allowAnswers, + 'allow_user_suggested_options': instance.allowUserSuggestedOptions, + 'custom': instance.custom, + 'description': instance.description, + 'enforce_unique_vote': instance.enforceUniqueVote, + 'id': instance.id, + 'is_closed': instance.isClosed, + 'max_votes_allowed': instance.maxVotesAllowed, + 'name': instance.name, + 'options': instance.options?.map((e) => e.toJson()).toList(), + 'voting_visibility': instance.votingVisibility?.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/create_queue_request.dart b/packages/stream_chat/lib/open_api/model/create_queue_request.dart new file mode 100644 index 0000000000..48399f7991 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/create_queue_request.dart @@ -0,0 +1,60 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'create_queue_request.g.dart'; +part 'create_queue_request.freezed.dart'; + +extension type const CreateQueueRequestType._(String _) implements String { + static const operationalQueue = CreateQueueRequestType._('operational_queue'); + static const personalView = CreateQueueRequestType._('personal_view'); + + factory CreateQueueRequestType.fromJson(String json) => CreateQueueRequestType._(json); + + String toJson() => this; +} + +@freezed +@immutable +@JsonSerializable() +class CreateQueueRequest with _$CreateQueueRequest { + const CreateQueueRequest({ + this.description, + this.filters, + required this.name, + this.sort, + required this.type, + }); + + @override + @JsonKey(name: 'description') + final String? description; + + @override + @JsonKey(name: 'filters') + final Map? filters; + + @override + @JsonKey(name: 'name') + final String name; + + @override + @JsonKey(name: 'sort') + final List>? sort; + + @override + @JsonKey(name: 'type') + final CreateQueueRequestType type; + + Map toJson() => _$CreateQueueRequestToJson(this); + + static CreateQueueRequest fromJson(Map json) => _$CreateQueueRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/create_queue_request.freezed.dart b/packages/stream_chat/lib/open_api/model/create_queue_request.freezed.dart new file mode 100644 index 0000000000..c0e6254e35 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/create_queue_request.freezed.dart @@ -0,0 +1,118 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'create_queue_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$CreateQueueRequest { + String? get description; + Map? get filters; + String get name; + List>? get sort; + CreateQueueRequestType get type; + + /// Create a copy of CreateQueueRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $CreateQueueRequestCopyWith get copyWith => _$CreateQueueRequestCopyWithImpl( + this as CreateQueueRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is CreateQueueRequest && + (identical(other.description, description) || other.description == description) && + const DeepCollectionEquality().equals(other.filters, filters) && + (identical(other.name, name) || other.name == name) && + const DeepCollectionEquality().equals(other.sort, sort) && + (identical(other.type, type) || other.type == type)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + description, + const DeepCollectionEquality().hash(filters), + name, + const DeepCollectionEquality().hash(sort), + type, + ); + + @override + String toString() { + return 'CreateQueueRequest(description: $description, filters: $filters, name: $name, sort: $sort, type: $type)'; + } +} + +/// @nodoc +abstract mixin class $CreateQueueRequestCopyWith<$Res> { + factory $CreateQueueRequestCopyWith( + CreateQueueRequest value, + $Res Function(CreateQueueRequest) _then, + ) = _$CreateQueueRequestCopyWithImpl; + @useResult + $Res call({ + String? description, + Map? filters, + String name, + List>? sort, + CreateQueueRequestType type, + }); +} + +/// @nodoc +class _$CreateQueueRequestCopyWithImpl<$Res> implements $CreateQueueRequestCopyWith<$Res> { + _$CreateQueueRequestCopyWithImpl(this._self, this._then); + + final CreateQueueRequest _self; + final $Res Function(CreateQueueRequest) _then; + + /// Create a copy of CreateQueueRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? description = freezed, + Object? filters = freezed, + Object? name = null, + Object? sort = freezed, + Object? type = null, + }) { + return _then( + CreateQueueRequest( + description: freezed == description + ? _self.description + : description // ignore: cast_nullable_to_non_nullable + as String?, + filters: freezed == filters + ? _self.filters + : filters // ignore: cast_nullable_to_non_nullable + as Map?, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + sort: freezed == sort + ? _self.sort + : sort // ignore: cast_nullable_to_non_nullable + as List>?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as CreateQueueRequestType, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/create_queue_request.g.dart b/packages/stream_chat/lib/open_api/model/create_queue_request.g.dart new file mode 100644 index 0000000000..f2e40ebd24 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/create_queue_request.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'create_queue_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +CreateQueueRequest _$CreateQueueRequestFromJson(Map json) => CreateQueueRequest( + description: json['description'] as String?, + filters: json['filters'] as Map?, + name: json['name'] as String, + sort: (json['sort'] as List?)?.map((e) => e as Map).toList(), + type: CreateQueueRequestType.fromJson(json['type'] as String), +); + +Map _$CreateQueueRequestToJson(CreateQueueRequest instance) => { + 'description': instance.description, + 'filters': instance.filters, + 'name': instance.name, + 'sort': instance.sort, + 'type': instance.type.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/create_reminder_request.dart b/packages/stream_chat/lib/open_api/model/create_reminder_request.dart new file mode 100644 index 0000000000..8a364f98e2 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/create_reminder_request.dart @@ -0,0 +1,32 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'create_reminder_request.g.dart'; +part 'create_reminder_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class CreateReminderRequest with _$CreateReminderRequest { + const CreateReminderRequest({ + this.remindAt, + }); + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'remind_at') + final DateTime? remindAt; + + Map toJson() => _$CreateReminderRequestToJson(this); + + static CreateReminderRequest fromJson(Map json) => _$CreateReminderRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/create_reminder_request.freezed.dart b/packages/stream_chat/lib/open_api/model/create_reminder_request.freezed.dart new file mode 100644 index 0000000000..fdf6eaf682 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/create_reminder_request.freezed.dart @@ -0,0 +1,76 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'create_reminder_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$CreateReminderRequest { + DateTime? get remindAt; + + /// Create a copy of CreateReminderRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $CreateReminderRequestCopyWith get copyWith => + _$CreateReminderRequestCopyWithImpl( + this as CreateReminderRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is CreateReminderRequest && + (identical(other.remindAt, remindAt) || other.remindAt == remindAt)); + } + + @override + int get hashCode => Object.hash(runtimeType, remindAt); + + @override + String toString() { + return 'CreateReminderRequest(remindAt: $remindAt)'; + } +} + +/// @nodoc +abstract mixin class $CreateReminderRequestCopyWith<$Res> { + factory $CreateReminderRequestCopyWith( + CreateReminderRequest value, + $Res Function(CreateReminderRequest) _then, + ) = _$CreateReminderRequestCopyWithImpl; + @useResult + $Res call({DateTime? remindAt}); +} + +/// @nodoc +class _$CreateReminderRequestCopyWithImpl<$Res> implements $CreateReminderRequestCopyWith<$Res> { + _$CreateReminderRequestCopyWithImpl(this._self, this._then); + + final CreateReminderRequest _self; + final $Res Function(CreateReminderRequest) _then; + + /// Create a copy of CreateReminderRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? remindAt = freezed}) { + return _then( + CreateReminderRequest( + remindAt: freezed == remindAt + ? _self.remindAt + : remindAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/create_reminder_request.g.dart b/packages/stream_chat/lib/open_api/model/create_reminder_request.g.dart new file mode 100644 index 0000000000..e344056046 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/create_reminder_request.g.dart @@ -0,0 +1,35 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'create_reminder_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +CreateReminderRequest _$CreateReminderRequestFromJson( + Map json, +) => CreateReminderRequest( + remindAt: _$JsonConverterFromJson( + json['remind_at'], + const StreamDateTimeConverter().fromJson, + ), +); + +Map _$CreateReminderRequestToJson( + CreateReminderRequest instance, +) => { + 'remind_at': _$JsonConverterToJson( + instance.remindAt, + const StreamDateTimeConverter().toJson, + ), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/create_user_group_request.dart b/packages/stream_chat/lib/open_api/model/create_user_group_request.dart new file mode 100644 index 0000000000..f2a48ba9ab --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/create_user_group_request.dart @@ -0,0 +1,51 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'create_user_group_request.g.dart'; +part 'create_user_group_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class CreateUserGroupRequest with _$CreateUserGroupRequest { + const CreateUserGroupRequest({ + this.description, + this.id, + this.memberIds, + required this.name, + this.teamId, + }); + + @override + @JsonKey(name: 'description') + final String? description; + + @override + @JsonKey(name: 'id') + final String? id; + + @override + @JsonKey(name: 'member_ids') + final List? memberIds; + + @override + @JsonKey(name: 'name') + final String name; + + @override + @JsonKey(name: 'team_id') + final String? teamId; + + Map toJson() => _$CreateUserGroupRequestToJson(this); + + static CreateUserGroupRequest fromJson(Map json) => _$CreateUserGroupRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/create_user_group_request.freezed.dart b/packages/stream_chat/lib/open_api/model/create_user_group_request.freezed.dart new file mode 100644 index 0000000000..8b2c3da904 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/create_user_group_request.freezed.dart @@ -0,0 +1,119 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'create_user_group_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$CreateUserGroupRequest { + String? get description; + String? get id; + List? get memberIds; + String get name; + String? get teamId; + + /// Create a copy of CreateUserGroupRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $CreateUserGroupRequestCopyWith get copyWith => + _$CreateUserGroupRequestCopyWithImpl( + this as CreateUserGroupRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is CreateUserGroupRequest && + (identical(other.description, description) || other.description == description) && + (identical(other.id, id) || other.id == id) && + const DeepCollectionEquality().equals(other.memberIds, memberIds) && + (identical(other.name, name) || other.name == name) && + (identical(other.teamId, teamId) || other.teamId == teamId)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + description, + id, + const DeepCollectionEquality().hash(memberIds), + name, + teamId, + ); + + @override + String toString() { + return 'CreateUserGroupRequest(description: $description, id: $id, memberIds: $memberIds, name: $name, teamId: $teamId)'; + } +} + +/// @nodoc +abstract mixin class $CreateUserGroupRequestCopyWith<$Res> { + factory $CreateUserGroupRequestCopyWith( + CreateUserGroupRequest value, + $Res Function(CreateUserGroupRequest) _then, + ) = _$CreateUserGroupRequestCopyWithImpl; + @useResult + $Res call({ + String? description, + String? id, + List? memberIds, + String name, + String? teamId, + }); +} + +/// @nodoc +class _$CreateUserGroupRequestCopyWithImpl<$Res> implements $CreateUserGroupRequestCopyWith<$Res> { + _$CreateUserGroupRequestCopyWithImpl(this._self, this._then); + + final CreateUserGroupRequest _self; + final $Res Function(CreateUserGroupRequest) _then; + + /// Create a copy of CreateUserGroupRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? description = freezed, + Object? id = freezed, + Object? memberIds = freezed, + Object? name = null, + Object? teamId = freezed, + }) { + return _then( + CreateUserGroupRequest( + description: freezed == description + ? _self.description + : description // ignore: cast_nullable_to_non_nullable + as String?, + id: freezed == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String?, + memberIds: freezed == memberIds + ? _self.memberIds + : memberIds // ignore: cast_nullable_to_non_nullable + as List?, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + teamId: freezed == teamId + ? _self.teamId + : teamId // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/create_user_group_request.g.dart b/packages/stream_chat/lib/open_api/model/create_user_group_request.g.dart new file mode 100644 index 0000000000..2d3294ba66 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/create_user_group_request.g.dart @@ -0,0 +1,27 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'create_user_group_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +CreateUserGroupRequest _$CreateUserGroupRequestFromJson( + Map json, +) => CreateUserGroupRequest( + description: json['description'] as String?, + id: json['id'] as String?, + memberIds: (json['member_ids'] as List?)?.map((e) => e as String).toList(), + name: json['name'] as String, + teamId: json['team_id'] as String?, +); + +Map _$CreateUserGroupRequestToJson( + CreateUserGroupRequest instance, +) => { + 'description': instance.description, + 'id': instance.id, + 'member_ids': instance.memberIds, + 'name': instance.name, + 'team_id': instance.teamId, +}; diff --git a/packages/stream_chat/lib/open_api/model/create_user_group_response.dart b/packages/stream_chat/lib/open_api/model/create_user_group_response.dart new file mode 100644 index 0000000000..4a8e2c72a2 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/create_user_group_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'create_user_group_response.g.dart'; +part 'create_user_group_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class CreateUserGroupResponse with _$CreateUserGroupResponse { + const CreateUserGroupResponse({ + required this.duration, + this.userGroup, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'user_group') + final UserGroupResponse? userGroup; + + Map toJson() => _$CreateUserGroupResponseToJson(this); + + static CreateUserGroupResponse fromJson(Map json) => _$CreateUserGroupResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/create_user_group_response.freezed.dart b/packages/stream_chat/lib/open_api/model/create_user_group_response.freezed.dart new file mode 100644 index 0000000000..85ae54d00d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/create_user_group_response.freezed.dart @@ -0,0 +1,82 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'create_user_group_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$CreateUserGroupResponse { + String get duration; + UserGroupResponse? get userGroup; + + /// Create a copy of CreateUserGroupResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $CreateUserGroupResponseCopyWith get copyWith => + _$CreateUserGroupResponseCopyWithImpl( + this as CreateUserGroupResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is CreateUserGroupResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.userGroup, userGroup) || other.userGroup == userGroup)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration, userGroup); + + @override + String toString() { + return 'CreateUserGroupResponse(duration: $duration, userGroup: $userGroup)'; + } +} + +/// @nodoc +abstract mixin class $CreateUserGroupResponseCopyWith<$Res> { + factory $CreateUserGroupResponseCopyWith( + CreateUserGroupResponse value, + $Res Function(CreateUserGroupResponse) _then, + ) = _$CreateUserGroupResponseCopyWithImpl; + @useResult + $Res call({String duration, UserGroupResponse? userGroup}); +} + +/// @nodoc +class _$CreateUserGroupResponseCopyWithImpl<$Res> implements $CreateUserGroupResponseCopyWith<$Res> { + _$CreateUserGroupResponseCopyWithImpl(this._self, this._then); + + final CreateUserGroupResponse _self; + final $Res Function(CreateUserGroupResponse) _then; + + /// Create a copy of CreateUserGroupResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? userGroup = freezed}) { + return _then( + CreateUserGroupResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + userGroup: freezed == userGroup + ? _self.userGroup + : userGroup // ignore: cast_nullable_to_non_nullable + as UserGroupResponse?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/create_user_group_response.g.dart b/packages/stream_chat/lib/open_api/model/create_user_group_response.g.dart new file mode 100644 index 0000000000..4fd822e441 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/create_user_group_response.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'create_user_group_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +CreateUserGroupResponse _$CreateUserGroupResponseFromJson( + Map json, +) => CreateUserGroupResponse( + duration: json['duration'] as String, + userGroup: json['user_group'] == null ? null : UserGroupResponse.fromJson(json['user_group'] as Map), +); + +Map _$CreateUserGroupResponseToJson( + CreateUserGroupResponse instance, +) => { + 'duration': instance.duration, + 'user_group': instance.userGroup?.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/custom_action_request_payload.dart b/packages/stream_chat/lib/open_api/model/custom_action_request_payload.dart new file mode 100644 index 0000000000..cc01026c08 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/custom_action_request_payload.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'custom_action_request_payload.g.dart'; +part 'custom_action_request_payload.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class CustomActionRequestPayload with _$CustomActionRequestPayload { + const CustomActionRequestPayload({ + this.id, + this.options, + }); + + @override + @JsonKey(name: 'id') + final String? id; + + @override + @JsonKey(name: 'options') + final Map? options; + + Map toJson() => _$CustomActionRequestPayloadToJson(this); + + static CustomActionRequestPayload fromJson(Map json) => _$CustomActionRequestPayloadFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/custom_action_request_payload.freezed.dart b/packages/stream_chat/lib/open_api/model/custom_action_request_payload.freezed.dart new file mode 100644 index 0000000000..26c2bce279 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/custom_action_request_payload.freezed.dart @@ -0,0 +1,86 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'custom_action_request_payload.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$CustomActionRequestPayload { + String? get id; + Map? get options; + + /// Create a copy of CustomActionRequestPayload + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $CustomActionRequestPayloadCopyWith get copyWith => + _$CustomActionRequestPayloadCopyWithImpl( + this as CustomActionRequestPayload, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is CustomActionRequestPayload && + (identical(other.id, id) || other.id == id) && + const DeepCollectionEquality().equals(other.options, options)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + id, + const DeepCollectionEquality().hash(options), + ); + + @override + String toString() { + return 'CustomActionRequestPayload(id: $id, options: $options)'; + } +} + +/// @nodoc +abstract mixin class $CustomActionRequestPayloadCopyWith<$Res> { + factory $CustomActionRequestPayloadCopyWith( + CustomActionRequestPayload value, + $Res Function(CustomActionRequestPayload) _then, + ) = _$CustomActionRequestPayloadCopyWithImpl; + @useResult + $Res call({String? id, Map? options}); +} + +/// @nodoc +class _$CustomActionRequestPayloadCopyWithImpl<$Res> implements $CustomActionRequestPayloadCopyWith<$Res> { + _$CustomActionRequestPayloadCopyWithImpl(this._self, this._then); + + final CustomActionRequestPayload _self; + final $Res Function(CustomActionRequestPayload) _then; + + /// Create a copy of CustomActionRequestPayload + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? id = freezed, Object? options = freezed}) { + return _then( + CustomActionRequestPayload( + id: freezed == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String?, + options: freezed == options + ? _self.options + : options // ignore: cast_nullable_to_non_nullable + as Map?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/custom_action_request_payload.g.dart b/packages/stream_chat/lib/open_api/model/custom_action_request_payload.g.dart new file mode 100644 index 0000000000..f5a6133fd9 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/custom_action_request_payload.g.dart @@ -0,0 +1,18 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'custom_action_request_payload.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +CustomActionRequestPayload _$CustomActionRequestPayloadFromJson( + Map json, +) => CustomActionRequestPayload( + id: json['id'] as String?, + options: json['options'] as Map?, +); + +Map _$CustomActionRequestPayloadToJson( + CustomActionRequestPayload instance, +) => {'id': instance.id, 'options': instance.options}; diff --git a/packages/stream_chat/lib/open_api/model/custom_event.dart b/packages/stream_chat/lib/open_api/model/custom_event.dart new file mode 100644 index 0000000000..57bab936a8 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/custom_event.dart @@ -0,0 +1,48 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'custom_event.g.dart'; +part 'custom_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class CustomEvent extends core.WsEvent with _$CustomEvent { + const CustomEvent({ + required this.createdAt, + required this.custom, + this.receivedAt, + required this.type, + }); + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'type') + final String type; + + Map toJson() => _$CustomEventToJson(this); + + static CustomEvent fromJson(Map json) => _$CustomEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/custom_event.freezed.dart b/packages/stream_chat/lib/open_api/model/custom_event.freezed.dart new file mode 100644 index 0000000000..3d7b1aa88d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/custom_event.freezed.dart @@ -0,0 +1,107 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'custom_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$CustomEvent { + DateTime get createdAt; + Map get custom; + DateTime? get receivedAt; + String get type; + + /// Create a copy of CustomEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $CustomEventCopyWith get copyWith => + _$CustomEventCopyWithImpl(this as CustomEvent, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is CustomEvent && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.type, type) || other.type == type)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + createdAt, + const DeepCollectionEquality().hash(custom), + receivedAt, + type, + ); + + @override + String toString() { + return 'CustomEvent(createdAt: $createdAt, custom: $custom, receivedAt: $receivedAt, type: $type)'; + } +} + +/// @nodoc +abstract mixin class $CustomEventCopyWith<$Res> { + factory $CustomEventCopyWith( + CustomEvent value, + $Res Function(CustomEvent) _then, + ) = _$CustomEventCopyWithImpl; + @useResult + $Res call({ + DateTime createdAt, + Map custom, + DateTime? receivedAt, + String type, + }); +} + +/// @nodoc +class _$CustomEventCopyWithImpl<$Res> implements $CustomEventCopyWith<$Res> { + _$CustomEventCopyWithImpl(this._self, this._then); + + final CustomEvent _self; + final $Res Function(CustomEvent) _then; + + /// Create a copy of CustomEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? createdAt = null, + Object? custom = null, + Object? receivedAt = freezed, + Object? type = null, + }) { + return _then( + CustomEvent( + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/custom_event.g.dart b/packages/stream_chat/lib/open_api/model/custom_event.g.dart new file mode 100644 index 0000000000..cf6e7fa9a4 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/custom_event.g.dart @@ -0,0 +1,39 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'custom_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +CustomEvent _$CustomEventFromJson(Map json) => CustomEvent( + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + type: json['type'] as String, +); + +Map _$CustomEventToJson(CustomEvent instance) => { + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'type': instance.type, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/data.dart b/packages/stream_chat/lib/open_api/model/data.dart new file mode 100644 index 0000000000..949398d05f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/data.dart @@ -0,0 +1,31 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'data.g.dart'; +part 'data.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class Data with _$Data { + const Data({ + required this.id, + }); + + @override + @JsonKey(name: 'id') + final String id; + + Map toJson() => _$DataToJson(this); + + static Data fromJson(Map json) => _$DataFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/data.freezed.dart b/packages/stream_chat/lib/open_api/model/data.freezed.dart new file mode 100644 index 0000000000..6b5d76c237 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/data.freezed.dart @@ -0,0 +1,67 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'data.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$Data { + String get id; + + /// Create a copy of Data + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $DataCopyWith get copyWith => _$DataCopyWithImpl(this as Data, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is Data && (identical(other.id, id) || other.id == id)); + } + + @override + int get hashCode => Object.hash(runtimeType, id); + + @override + String toString() { + return 'Data(id: $id)'; + } +} + +/// @nodoc +abstract mixin class $DataCopyWith<$Res> { + factory $DataCopyWith(Data value, $Res Function(Data) _then) = _$DataCopyWithImpl; + @useResult + $Res call({String id}); +} + +/// @nodoc +class _$DataCopyWithImpl<$Res> implements $DataCopyWith<$Res> { + _$DataCopyWithImpl(this._self, this._then); + + final Data _self; + final $Res Function(Data) _then; + + /// Create a copy of Data + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? id = null}) { + return _then( + Data( + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/data.g.dart b/packages/stream_chat/lib/open_api/model/data.g.dart new file mode 100644 index 0000000000..cb778c4d12 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/data.g.dart @@ -0,0 +1,13 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'data.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +Data _$DataFromJson(Map json) => Data(id: json['id'] as String); + +Map _$DataToJson(Data instance) => { + 'id': instance.id, +}; diff --git a/packages/stream_chat/lib/open_api/model/delete_action_config_response.dart b/packages/stream_chat/lib/open_api/model/delete_action_config_response.dart new file mode 100644 index 0000000000..bbd0fdaebd --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delete_action_config_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'delete_action_config_response.g.dart'; +part 'delete_action_config_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class DeleteActionConfigResponse with _$DeleteActionConfigResponse { + const DeleteActionConfigResponse({ + required this.deleted, + required this.duration, + }); + + @override + @JsonKey(name: 'deleted') + final int deleted; + + @override + @JsonKey(name: 'duration') + final String duration; + + Map toJson() => _$DeleteActionConfigResponseToJson(this); + + static DeleteActionConfigResponse fromJson(Map json) => _$DeleteActionConfigResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/delete_action_config_response.freezed.dart b/packages/stream_chat/lib/open_api/model/delete_action_config_response.freezed.dart new file mode 100644 index 0000000000..1580eef35a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delete_action_config_response.freezed.dart @@ -0,0 +1,82 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'delete_action_config_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$DeleteActionConfigResponse { + int get deleted; + String get duration; + + /// Create a copy of DeleteActionConfigResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $DeleteActionConfigResponseCopyWith get copyWith => + _$DeleteActionConfigResponseCopyWithImpl( + this as DeleteActionConfigResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is DeleteActionConfigResponse && + (identical(other.deleted, deleted) || other.deleted == deleted) && + (identical(other.duration, duration) || other.duration == duration)); + } + + @override + int get hashCode => Object.hash(runtimeType, deleted, duration); + + @override + String toString() { + return 'DeleteActionConfigResponse(deleted: $deleted, duration: $duration)'; + } +} + +/// @nodoc +abstract mixin class $DeleteActionConfigResponseCopyWith<$Res> { + factory $DeleteActionConfigResponseCopyWith( + DeleteActionConfigResponse value, + $Res Function(DeleteActionConfigResponse) _then, + ) = _$DeleteActionConfigResponseCopyWithImpl; + @useResult + $Res call({int deleted, String duration}); +} + +/// @nodoc +class _$DeleteActionConfigResponseCopyWithImpl<$Res> implements $DeleteActionConfigResponseCopyWith<$Res> { + _$DeleteActionConfigResponseCopyWithImpl(this._self, this._then); + + final DeleteActionConfigResponse _self; + final $Res Function(DeleteActionConfigResponse) _then; + + /// Create a copy of DeleteActionConfigResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? deleted = null, Object? duration = null}) { + return _then( + DeleteActionConfigResponse( + deleted: null == deleted + ? _self.deleted + : deleted // ignore: cast_nullable_to_non_nullable + as int, + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/delete_action_config_response.g.dart b/packages/stream_chat/lib/open_api/model/delete_action_config_response.g.dart new file mode 100644 index 0000000000..ac19dfd6f0 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delete_action_config_response.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'delete_action_config_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +DeleteActionConfigResponse _$DeleteActionConfigResponseFromJson( + Map json, +) => DeleteActionConfigResponse( + deleted: (json['deleted'] as num).toInt(), + duration: json['duration'] as String, +); + +Map _$DeleteActionConfigResponseToJson( + DeleteActionConfigResponse instance, +) => { + 'deleted': instance.deleted, + 'duration': instance.duration, +}; diff --git a/packages/stream_chat/lib/open_api/model/delete_activity_request_payload.dart b/packages/stream_chat/lib/open_api/model/delete_activity_request_payload.dart new file mode 100644 index 0000000000..59bef0a048 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delete_activity_request_payload.dart @@ -0,0 +1,47 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'delete_activity_request_payload.g.dart'; +part 'delete_activity_request_payload.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class DeleteActivityRequestPayload with _$DeleteActivityRequestPayload { + const DeleteActivityRequestPayload({ + this.entityId, + this.entityType, + this.hardDelete, + this.reason, + }); + + @override + @JsonKey(name: 'entity_id') + final String? entityId; + + @override + @JsonKey(name: 'entity_type') + final String? entityType; + + @override + @JsonKey(name: 'hard_delete') + final bool? hardDelete; + + @override + @JsonKey(name: 'reason') + final String? reason; + + Map toJson() => _$DeleteActivityRequestPayloadToJson(this); + + static DeleteActivityRequestPayload fromJson(Map json) => + _$DeleteActivityRequestPayloadFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/delete_activity_request_payload.freezed.dart b/packages/stream_chat/lib/open_api/model/delete_activity_request_payload.freezed.dart new file mode 100644 index 0000000000..1088745c0e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delete_activity_request_payload.freezed.dart @@ -0,0 +1,104 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'delete_activity_request_payload.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$DeleteActivityRequestPayload { + String? get entityId; + String? get entityType; + bool? get hardDelete; + String? get reason; + + /// Create a copy of DeleteActivityRequestPayload + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $DeleteActivityRequestPayloadCopyWith get copyWith => + _$DeleteActivityRequestPayloadCopyWithImpl( + this as DeleteActivityRequestPayload, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is DeleteActivityRequestPayload && + (identical(other.entityId, entityId) || other.entityId == entityId) && + (identical(other.entityType, entityType) || other.entityType == entityType) && + (identical(other.hardDelete, hardDelete) || other.hardDelete == hardDelete) && + (identical(other.reason, reason) || other.reason == reason)); + } + + @override + int get hashCode => Object.hash(runtimeType, entityId, entityType, hardDelete, reason); + + @override + String toString() { + return 'DeleteActivityRequestPayload(entityId: $entityId, entityType: $entityType, hardDelete: $hardDelete, reason: $reason)'; + } +} + +/// @nodoc +abstract mixin class $DeleteActivityRequestPayloadCopyWith<$Res> { + factory $DeleteActivityRequestPayloadCopyWith( + DeleteActivityRequestPayload value, + $Res Function(DeleteActivityRequestPayload) _then, + ) = _$DeleteActivityRequestPayloadCopyWithImpl; + @useResult + $Res call({ + String? entityId, + String? entityType, + bool? hardDelete, + String? reason, + }); +} + +/// @nodoc +class _$DeleteActivityRequestPayloadCopyWithImpl<$Res> implements $DeleteActivityRequestPayloadCopyWith<$Res> { + _$DeleteActivityRequestPayloadCopyWithImpl(this._self, this._then); + + final DeleteActivityRequestPayload _self; + final $Res Function(DeleteActivityRequestPayload) _then; + + /// Create a copy of DeleteActivityRequestPayload + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? entityId = freezed, + Object? entityType = freezed, + Object? hardDelete = freezed, + Object? reason = freezed, + }) { + return _then( + DeleteActivityRequestPayload( + entityId: freezed == entityId + ? _self.entityId + : entityId // ignore: cast_nullable_to_non_nullable + as String?, + entityType: freezed == entityType + ? _self.entityType + : entityType // ignore: cast_nullable_to_non_nullable + as String?, + hardDelete: freezed == hardDelete + ? _self.hardDelete + : hardDelete // ignore: cast_nullable_to_non_nullable + as bool?, + reason: freezed == reason + ? _self.reason + : reason // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/delete_activity_request_payload.g.dart b/packages/stream_chat/lib/open_api/model/delete_activity_request_payload.g.dart new file mode 100644 index 0000000000..a43b3dc23f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delete_activity_request_payload.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'delete_activity_request_payload.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +DeleteActivityRequestPayload _$DeleteActivityRequestPayloadFromJson( + Map json, +) => DeleteActivityRequestPayload( + entityId: json['entity_id'] as String?, + entityType: json['entity_type'] as String?, + hardDelete: json['hard_delete'] as bool?, + reason: json['reason'] as String?, +); + +Map _$DeleteActivityRequestPayloadToJson( + DeleteActivityRequestPayload instance, +) => { + 'entity_id': instance.entityId, + 'entity_type': instance.entityType, + 'hard_delete': instance.hardDelete, + 'reason': instance.reason, +}; diff --git a/packages/stream_chat/lib/open_api/model/delete_channel_response.dart b/packages/stream_chat/lib/open_api/model/delete_channel_response.dart new file mode 100644 index 0000000000..724596a33e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delete_channel_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'delete_channel_response.g.dart'; +part 'delete_channel_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class DeleteChannelResponse with _$DeleteChannelResponse { + const DeleteChannelResponse({ + this.channel, + required this.duration, + }); + + @override + @JsonKey(name: 'channel') + final ChannelResponse? channel; + + @override + @JsonKey(name: 'duration') + final String duration; + + Map toJson() => _$DeleteChannelResponseToJson(this); + + static DeleteChannelResponse fromJson(Map json) => _$DeleteChannelResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/delete_channel_response.freezed.dart b/packages/stream_chat/lib/open_api/model/delete_channel_response.freezed.dart new file mode 100644 index 0000000000..5d98e8b995 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delete_channel_response.freezed.dart @@ -0,0 +1,82 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'delete_channel_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$DeleteChannelResponse { + ChannelResponse? get channel; + String get duration; + + /// Create a copy of DeleteChannelResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $DeleteChannelResponseCopyWith get copyWith => + _$DeleteChannelResponseCopyWithImpl( + this as DeleteChannelResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is DeleteChannelResponse && + (identical(other.channel, channel) || other.channel == channel) && + (identical(other.duration, duration) || other.duration == duration)); + } + + @override + int get hashCode => Object.hash(runtimeType, channel, duration); + + @override + String toString() { + return 'DeleteChannelResponse(channel: $channel, duration: $duration)'; + } +} + +/// @nodoc +abstract mixin class $DeleteChannelResponseCopyWith<$Res> { + factory $DeleteChannelResponseCopyWith( + DeleteChannelResponse value, + $Res Function(DeleteChannelResponse) _then, + ) = _$DeleteChannelResponseCopyWithImpl; + @useResult + $Res call({ChannelResponse? channel, String duration}); +} + +/// @nodoc +class _$DeleteChannelResponseCopyWithImpl<$Res> implements $DeleteChannelResponseCopyWith<$Res> { + _$DeleteChannelResponseCopyWithImpl(this._self, this._then); + + final DeleteChannelResponse _self; + final $Res Function(DeleteChannelResponse) _then; + + /// Create a copy of DeleteChannelResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? channel = freezed, Object? duration = null}) { + return _then( + DeleteChannelResponse( + channel: freezed == channel + ? _self.channel + : channel // ignore: cast_nullable_to_non_nullable + as ChannelResponse?, + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/delete_channel_response.g.dart b/packages/stream_chat/lib/open_api/model/delete_channel_response.g.dart new file mode 100644 index 0000000000..e5b783b97b --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delete_channel_response.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'delete_channel_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +DeleteChannelResponse _$DeleteChannelResponseFromJson( + Map json, +) => DeleteChannelResponse( + channel: json['channel'] == null ? null : ChannelResponse.fromJson(json['channel'] as Map), + duration: json['duration'] as String, +); + +Map _$DeleteChannelResponseToJson( + DeleteChannelResponse instance, +) => { + 'channel': instance.channel?.toJson(), + 'duration': instance.duration, +}; diff --git a/packages/stream_chat/lib/open_api/model/delete_channels_request.dart b/packages/stream_chat/lib/open_api/model/delete_channels_request.dart new file mode 100644 index 0000000000..9424ba41de --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delete_channels_request.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'delete_channels_request.g.dart'; +part 'delete_channels_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class DeleteChannelsRequest with _$DeleteChannelsRequest { + const DeleteChannelsRequest({ + required this.cids, + this.hardDelete, + }); + + @override + @JsonKey(name: 'cids') + final List cids; + + @override + @JsonKey(name: 'hard_delete') + final bool? hardDelete; + + Map toJson() => _$DeleteChannelsRequestToJson(this); + + static DeleteChannelsRequest fromJson(Map json) => _$DeleteChannelsRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/delete_channels_request.freezed.dart b/packages/stream_chat/lib/open_api/model/delete_channels_request.freezed.dart new file mode 100644 index 0000000000..7121a9341c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delete_channels_request.freezed.dart @@ -0,0 +1,86 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'delete_channels_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$DeleteChannelsRequest { + List get cids; + bool? get hardDelete; + + /// Create a copy of DeleteChannelsRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $DeleteChannelsRequestCopyWith get copyWith => + _$DeleteChannelsRequestCopyWithImpl( + this as DeleteChannelsRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is DeleteChannelsRequest && + const DeepCollectionEquality().equals(other.cids, cids) && + (identical(other.hardDelete, hardDelete) || other.hardDelete == hardDelete)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(cids), + hardDelete, + ); + + @override + String toString() { + return 'DeleteChannelsRequest(cids: $cids, hardDelete: $hardDelete)'; + } +} + +/// @nodoc +abstract mixin class $DeleteChannelsRequestCopyWith<$Res> { + factory $DeleteChannelsRequestCopyWith( + DeleteChannelsRequest value, + $Res Function(DeleteChannelsRequest) _then, + ) = _$DeleteChannelsRequestCopyWithImpl; + @useResult + $Res call({List cids, bool? hardDelete}); +} + +/// @nodoc +class _$DeleteChannelsRequestCopyWithImpl<$Res> implements $DeleteChannelsRequestCopyWith<$Res> { + _$DeleteChannelsRequestCopyWithImpl(this._self, this._then); + + final DeleteChannelsRequest _self; + final $Res Function(DeleteChannelsRequest) _then; + + /// Create a copy of DeleteChannelsRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? cids = null, Object? hardDelete = freezed}) { + return _then( + DeleteChannelsRequest( + cids: null == cids + ? _self.cids + : cids // ignore: cast_nullable_to_non_nullable + as List, + hardDelete: freezed == hardDelete + ? _self.hardDelete + : hardDelete // ignore: cast_nullable_to_non_nullable + as bool?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/delete_channels_request.g.dart b/packages/stream_chat/lib/open_api/model/delete_channels_request.g.dart new file mode 100644 index 0000000000..b95aa980d3 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delete_channels_request.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'delete_channels_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +DeleteChannelsRequest _$DeleteChannelsRequestFromJson( + Map json, +) => DeleteChannelsRequest( + cids: (json['cids'] as List).map((e) => e as String).toList(), + hardDelete: json['hard_delete'] as bool?, +); + +Map _$DeleteChannelsRequestToJson( + DeleteChannelsRequest instance, +) => { + 'cids': instance.cids, + 'hard_delete': instance.hardDelete, +}; diff --git a/packages/stream_chat/lib/open_api/model/delete_channels_response.dart b/packages/stream_chat/lib/open_api/model/delete_channels_response.dart new file mode 100644 index 0000000000..107056bba1 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delete_channels_response.dart @@ -0,0 +1,41 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'delete_channels_response.g.dart'; +part 'delete_channels_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class DeleteChannelsResponse with _$DeleteChannelsResponse { + const DeleteChannelsResponse({ + required this.duration, + this.result, + this.taskId, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'result') + final Map? result; + + @override + @JsonKey(name: 'task_id') + final String? taskId; + + Map toJson() => _$DeleteChannelsResponseToJson(this); + + static DeleteChannelsResponse fromJson(Map json) => _$DeleteChannelsResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/delete_channels_response.freezed.dart b/packages/stream_chat/lib/open_api/model/delete_channels_response.freezed.dart new file mode 100644 index 0000000000..4cfe3ef0a4 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delete_channels_response.freezed.dart @@ -0,0 +1,101 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'delete_channels_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$DeleteChannelsResponse { + String get duration; + Map? get result; + String? get taskId; + + /// Create a copy of DeleteChannelsResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $DeleteChannelsResponseCopyWith get copyWith => + _$DeleteChannelsResponseCopyWithImpl( + this as DeleteChannelsResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is DeleteChannelsResponse && + (identical(other.duration, duration) || other.duration == duration) && + const DeepCollectionEquality().equals(other.result, result) && + (identical(other.taskId, taskId) || other.taskId == taskId)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + duration, + const DeepCollectionEquality().hash(result), + taskId, + ); + + @override + String toString() { + return 'DeleteChannelsResponse(duration: $duration, result: $result, taskId: $taskId)'; + } +} + +/// @nodoc +abstract mixin class $DeleteChannelsResponseCopyWith<$Res> { + factory $DeleteChannelsResponseCopyWith( + DeleteChannelsResponse value, + $Res Function(DeleteChannelsResponse) _then, + ) = _$DeleteChannelsResponseCopyWithImpl; + @useResult + $Res call({ + String duration, + Map? result, + String? taskId, + }); +} + +/// @nodoc +class _$DeleteChannelsResponseCopyWithImpl<$Res> implements $DeleteChannelsResponseCopyWith<$Res> { + _$DeleteChannelsResponseCopyWithImpl(this._self, this._then); + + final DeleteChannelsResponse _self; + final $Res Function(DeleteChannelsResponse) _then; + + /// Create a copy of DeleteChannelsResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? duration = null, + Object? result = freezed, + Object? taskId = freezed, + }) { + return _then( + DeleteChannelsResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + result: freezed == result + ? _self.result + : result // ignore: cast_nullable_to_non_nullable + as Map?, + taskId: freezed == taskId + ? _self.taskId + : taskId // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/delete_channels_response.g.dart b/packages/stream_chat/lib/open_api/model/delete_channels_response.g.dart new file mode 100644 index 0000000000..1a4ef3e1b4 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delete_channels_response.g.dart @@ -0,0 +1,28 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'delete_channels_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +DeleteChannelsResponse _$DeleteChannelsResponseFromJson( + Map json, +) => DeleteChannelsResponse( + duration: json['duration'] as String, + result: (json['result'] as Map?)?.map( + (k, e) => MapEntry( + k, + DeleteChannelsResultResponse.fromJson(e as Map), + ), + ), + taskId: json['task_id'] as String?, +); + +Map _$DeleteChannelsResponseToJson( + DeleteChannelsResponse instance, +) => { + 'duration': instance.duration, + 'result': instance.result?.map((k, e) => MapEntry(k, e.toJson())), + 'task_id': instance.taskId, +}; diff --git a/packages/stream_chat/lib/open_api/model/delete_channels_result_response.dart b/packages/stream_chat/lib/open_api/model/delete_channels_result_response.dart new file mode 100644 index 0000000000..86516129ff --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delete_channels_result_response.dart @@ -0,0 +1,37 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'delete_channels_result_response.g.dart'; +part 'delete_channels_result_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class DeleteChannelsResultResponse with _$DeleteChannelsResultResponse { + const DeleteChannelsResultResponse({ + this.error, + required this.status, + }); + + @override + @JsonKey(name: 'error') + final String? error; + + @override + @JsonKey(name: 'status') + final String status; + + Map toJson() => _$DeleteChannelsResultResponseToJson(this); + + static DeleteChannelsResultResponse fromJson(Map json) => + _$DeleteChannelsResultResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/delete_channels_result_response.freezed.dart b/packages/stream_chat/lib/open_api/model/delete_channels_result_response.freezed.dart new file mode 100644 index 0000000000..7a334a985d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delete_channels_result_response.freezed.dart @@ -0,0 +1,82 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'delete_channels_result_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$DeleteChannelsResultResponse { + String? get error; + String get status; + + /// Create a copy of DeleteChannelsResultResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $DeleteChannelsResultResponseCopyWith get copyWith => + _$DeleteChannelsResultResponseCopyWithImpl( + this as DeleteChannelsResultResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is DeleteChannelsResultResponse && + (identical(other.error, error) || other.error == error) && + (identical(other.status, status) || other.status == status)); + } + + @override + int get hashCode => Object.hash(runtimeType, error, status); + + @override + String toString() { + return 'DeleteChannelsResultResponse(error: $error, status: $status)'; + } +} + +/// @nodoc +abstract mixin class $DeleteChannelsResultResponseCopyWith<$Res> { + factory $DeleteChannelsResultResponseCopyWith( + DeleteChannelsResultResponse value, + $Res Function(DeleteChannelsResultResponse) _then, + ) = _$DeleteChannelsResultResponseCopyWithImpl; + @useResult + $Res call({String? error, String status}); +} + +/// @nodoc +class _$DeleteChannelsResultResponseCopyWithImpl<$Res> implements $DeleteChannelsResultResponseCopyWith<$Res> { + _$DeleteChannelsResultResponseCopyWithImpl(this._self, this._then); + + final DeleteChannelsResultResponse _self; + final $Res Function(DeleteChannelsResultResponse) _then; + + /// Create a copy of DeleteChannelsResultResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? error = freezed, Object? status = null}) { + return _then( + DeleteChannelsResultResponse( + error: freezed == error + ? _self.error + : error // ignore: cast_nullable_to_non_nullable + as String?, + status: null == status + ? _self.status + : status // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/delete_channels_result_response.g.dart b/packages/stream_chat/lib/open_api/model/delete_channels_result_response.g.dart new file mode 100644 index 0000000000..d9d754c9fb --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delete_channels_result_response.g.dart @@ -0,0 +1,18 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'delete_channels_result_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +DeleteChannelsResultResponse _$DeleteChannelsResultResponseFromJson( + Map json, +) => DeleteChannelsResultResponse( + error: json['error'] as String?, + status: json['status'] as String, +); + +Map _$DeleteChannelsResultResponseToJson( + DeleteChannelsResultResponse instance, +) => {'error': instance.error, 'status': instance.status}; diff --git a/packages/stream_chat/lib/open_api/model/delete_comment_request_payload.dart b/packages/stream_chat/lib/open_api/model/delete_comment_request_payload.dart new file mode 100644 index 0000000000..7071767b5e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delete_comment_request_payload.dart @@ -0,0 +1,46 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'delete_comment_request_payload.g.dart'; +part 'delete_comment_request_payload.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class DeleteCommentRequestPayload with _$DeleteCommentRequestPayload { + const DeleteCommentRequestPayload({ + this.entityId, + this.entityType, + this.hardDelete, + this.reason, + }); + + @override + @JsonKey(name: 'entity_id') + final String? entityId; + + @override + @JsonKey(name: 'entity_type') + final String? entityType; + + @override + @JsonKey(name: 'hard_delete') + final bool? hardDelete; + + @override + @JsonKey(name: 'reason') + final String? reason; + + Map toJson() => _$DeleteCommentRequestPayloadToJson(this); + + static DeleteCommentRequestPayload fromJson(Map json) => _$DeleteCommentRequestPayloadFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/delete_comment_request_payload.freezed.dart b/packages/stream_chat/lib/open_api/model/delete_comment_request_payload.freezed.dart new file mode 100644 index 0000000000..69db393952 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delete_comment_request_payload.freezed.dart @@ -0,0 +1,104 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'delete_comment_request_payload.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$DeleteCommentRequestPayload { + String? get entityId; + String? get entityType; + bool? get hardDelete; + String? get reason; + + /// Create a copy of DeleteCommentRequestPayload + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $DeleteCommentRequestPayloadCopyWith get copyWith => + _$DeleteCommentRequestPayloadCopyWithImpl( + this as DeleteCommentRequestPayload, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is DeleteCommentRequestPayload && + (identical(other.entityId, entityId) || other.entityId == entityId) && + (identical(other.entityType, entityType) || other.entityType == entityType) && + (identical(other.hardDelete, hardDelete) || other.hardDelete == hardDelete) && + (identical(other.reason, reason) || other.reason == reason)); + } + + @override + int get hashCode => Object.hash(runtimeType, entityId, entityType, hardDelete, reason); + + @override + String toString() { + return 'DeleteCommentRequestPayload(entityId: $entityId, entityType: $entityType, hardDelete: $hardDelete, reason: $reason)'; + } +} + +/// @nodoc +abstract mixin class $DeleteCommentRequestPayloadCopyWith<$Res> { + factory $DeleteCommentRequestPayloadCopyWith( + DeleteCommentRequestPayload value, + $Res Function(DeleteCommentRequestPayload) _then, + ) = _$DeleteCommentRequestPayloadCopyWithImpl; + @useResult + $Res call({ + String? entityId, + String? entityType, + bool? hardDelete, + String? reason, + }); +} + +/// @nodoc +class _$DeleteCommentRequestPayloadCopyWithImpl<$Res> implements $DeleteCommentRequestPayloadCopyWith<$Res> { + _$DeleteCommentRequestPayloadCopyWithImpl(this._self, this._then); + + final DeleteCommentRequestPayload _self; + final $Res Function(DeleteCommentRequestPayload) _then; + + /// Create a copy of DeleteCommentRequestPayload + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? entityId = freezed, + Object? entityType = freezed, + Object? hardDelete = freezed, + Object? reason = freezed, + }) { + return _then( + DeleteCommentRequestPayload( + entityId: freezed == entityId + ? _self.entityId + : entityId // ignore: cast_nullable_to_non_nullable + as String?, + entityType: freezed == entityType + ? _self.entityType + : entityType // ignore: cast_nullable_to_non_nullable + as String?, + hardDelete: freezed == hardDelete + ? _self.hardDelete + : hardDelete // ignore: cast_nullable_to_non_nullable + as bool?, + reason: freezed == reason + ? _self.reason + : reason // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/delete_comment_request_payload.g.dart b/packages/stream_chat/lib/open_api/model/delete_comment_request_payload.g.dart new file mode 100644 index 0000000000..7dfd258517 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delete_comment_request_payload.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'delete_comment_request_payload.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +DeleteCommentRequestPayload _$DeleteCommentRequestPayloadFromJson( + Map json, +) => DeleteCommentRequestPayload( + entityId: json['entity_id'] as String?, + entityType: json['entity_type'] as String?, + hardDelete: json['hard_delete'] as bool?, + reason: json['reason'] as String?, +); + +Map _$DeleteCommentRequestPayloadToJson( + DeleteCommentRequestPayload instance, +) => { + 'entity_id': instance.entityId, + 'entity_type': instance.entityType, + 'hard_delete': instance.hardDelete, + 'reason': instance.reason, +}; diff --git a/packages/stream_chat/lib/open_api/model/delete_message_request_payload.dart b/packages/stream_chat/lib/open_api/model/delete_message_request_payload.dart new file mode 100644 index 0000000000..81fee020f7 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delete_message_request_payload.dart @@ -0,0 +1,46 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'delete_message_request_payload.g.dart'; +part 'delete_message_request_payload.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class DeleteMessageRequestPayload with _$DeleteMessageRequestPayload { + const DeleteMessageRequestPayload({ + this.entityId, + this.entityType, + this.hardDelete, + this.reason, + }); + + @override + @JsonKey(name: 'entity_id') + final String? entityId; + + @override + @JsonKey(name: 'entity_type') + final String? entityType; + + @override + @JsonKey(name: 'hard_delete') + final bool? hardDelete; + + @override + @JsonKey(name: 'reason') + final String? reason; + + Map toJson() => _$DeleteMessageRequestPayloadToJson(this); + + static DeleteMessageRequestPayload fromJson(Map json) => _$DeleteMessageRequestPayloadFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/delete_message_request_payload.freezed.dart b/packages/stream_chat/lib/open_api/model/delete_message_request_payload.freezed.dart new file mode 100644 index 0000000000..fa3c9c4c88 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delete_message_request_payload.freezed.dart @@ -0,0 +1,104 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'delete_message_request_payload.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$DeleteMessageRequestPayload { + String? get entityId; + String? get entityType; + bool? get hardDelete; + String? get reason; + + /// Create a copy of DeleteMessageRequestPayload + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $DeleteMessageRequestPayloadCopyWith get copyWith => + _$DeleteMessageRequestPayloadCopyWithImpl( + this as DeleteMessageRequestPayload, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is DeleteMessageRequestPayload && + (identical(other.entityId, entityId) || other.entityId == entityId) && + (identical(other.entityType, entityType) || other.entityType == entityType) && + (identical(other.hardDelete, hardDelete) || other.hardDelete == hardDelete) && + (identical(other.reason, reason) || other.reason == reason)); + } + + @override + int get hashCode => Object.hash(runtimeType, entityId, entityType, hardDelete, reason); + + @override + String toString() { + return 'DeleteMessageRequestPayload(entityId: $entityId, entityType: $entityType, hardDelete: $hardDelete, reason: $reason)'; + } +} + +/// @nodoc +abstract mixin class $DeleteMessageRequestPayloadCopyWith<$Res> { + factory $DeleteMessageRequestPayloadCopyWith( + DeleteMessageRequestPayload value, + $Res Function(DeleteMessageRequestPayload) _then, + ) = _$DeleteMessageRequestPayloadCopyWithImpl; + @useResult + $Res call({ + String? entityId, + String? entityType, + bool? hardDelete, + String? reason, + }); +} + +/// @nodoc +class _$DeleteMessageRequestPayloadCopyWithImpl<$Res> implements $DeleteMessageRequestPayloadCopyWith<$Res> { + _$DeleteMessageRequestPayloadCopyWithImpl(this._self, this._then); + + final DeleteMessageRequestPayload _self; + final $Res Function(DeleteMessageRequestPayload) _then; + + /// Create a copy of DeleteMessageRequestPayload + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? entityId = freezed, + Object? entityType = freezed, + Object? hardDelete = freezed, + Object? reason = freezed, + }) { + return _then( + DeleteMessageRequestPayload( + entityId: freezed == entityId + ? _self.entityId + : entityId // ignore: cast_nullable_to_non_nullable + as String?, + entityType: freezed == entityType + ? _self.entityType + : entityType // ignore: cast_nullable_to_non_nullable + as String?, + hardDelete: freezed == hardDelete + ? _self.hardDelete + : hardDelete // ignore: cast_nullable_to_non_nullable + as bool?, + reason: freezed == reason + ? _self.reason + : reason // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/delete_message_request_payload.g.dart b/packages/stream_chat/lib/open_api/model/delete_message_request_payload.g.dart new file mode 100644 index 0000000000..5ce7334e44 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delete_message_request_payload.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'delete_message_request_payload.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +DeleteMessageRequestPayload _$DeleteMessageRequestPayloadFromJson( + Map json, +) => DeleteMessageRequestPayload( + entityId: json['entity_id'] as String?, + entityType: json['entity_type'] as String?, + hardDelete: json['hard_delete'] as bool?, + reason: json['reason'] as String?, +); + +Map _$DeleteMessageRequestPayloadToJson( + DeleteMessageRequestPayload instance, +) => { + 'entity_id': instance.entityId, + 'entity_type': instance.entityType, + 'hard_delete': instance.hardDelete, + 'reason': instance.reason, +}; diff --git a/packages/stream_chat/lib/open_api/model/delete_message_response.dart b/packages/stream_chat/lib/open_api/model/delete_message_response.dart new file mode 100644 index 0000000000..e7e8380c44 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delete_message_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'delete_message_response.g.dart'; +part 'delete_message_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class DeleteMessageResponse with _$DeleteMessageResponse { + const DeleteMessageResponse({ + required this.duration, + required this.message, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'message') + final MessageResponse message; + + Map toJson() => _$DeleteMessageResponseToJson(this); + + static DeleteMessageResponse fromJson(Map json) => _$DeleteMessageResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/delete_message_response.freezed.dart b/packages/stream_chat/lib/open_api/model/delete_message_response.freezed.dart new file mode 100644 index 0000000000..58f5eed7a6 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delete_message_response.freezed.dart @@ -0,0 +1,82 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'delete_message_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$DeleteMessageResponse { + String get duration; + MessageResponse get message; + + /// Create a copy of DeleteMessageResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $DeleteMessageResponseCopyWith get copyWith => + _$DeleteMessageResponseCopyWithImpl( + this as DeleteMessageResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is DeleteMessageResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.message, message) || other.message == message)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration, message); + + @override + String toString() { + return 'DeleteMessageResponse(duration: $duration, message: $message)'; + } +} + +/// @nodoc +abstract mixin class $DeleteMessageResponseCopyWith<$Res> { + factory $DeleteMessageResponseCopyWith( + DeleteMessageResponse value, + $Res Function(DeleteMessageResponse) _then, + ) = _$DeleteMessageResponseCopyWithImpl; + @useResult + $Res call({String duration, MessageResponse message}); +} + +/// @nodoc +class _$DeleteMessageResponseCopyWithImpl<$Res> implements $DeleteMessageResponseCopyWith<$Res> { + _$DeleteMessageResponseCopyWithImpl(this._self, this._then); + + final DeleteMessageResponse _self; + final $Res Function(DeleteMessageResponse) _then; + + /// Create a copy of DeleteMessageResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? message = null}) { + return _then( + DeleteMessageResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + message: null == message + ? _self.message + : message // ignore: cast_nullable_to_non_nullable + as MessageResponse, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/delete_message_response.g.dart b/packages/stream_chat/lib/open_api/model/delete_message_response.g.dart new file mode 100644 index 0000000000..12ac5bd931 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delete_message_response.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'delete_message_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +DeleteMessageResponse _$DeleteMessageResponseFromJson( + Map json, +) => DeleteMessageResponse( + duration: json['duration'] as String, + message: MessageResponse.fromJson(json['message'] as Map), +); + +Map _$DeleteMessageResponseToJson( + DeleteMessageResponse instance, +) => { + 'duration': instance.duration, + 'message': instance.message.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/delete_moderation_config_response.dart b/packages/stream_chat/lib/open_api/model/delete_moderation_config_response.dart new file mode 100644 index 0000000000..9176d1d02b --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delete_moderation_config_response.dart @@ -0,0 +1,32 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'delete_moderation_config_response.g.dart'; +part 'delete_moderation_config_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class DeleteModerationConfigResponse with _$DeleteModerationConfigResponse { + const DeleteModerationConfigResponse({ + required this.duration, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + Map toJson() => _$DeleteModerationConfigResponseToJson(this); + + static DeleteModerationConfigResponse fromJson(Map json) => + _$DeleteModerationConfigResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/delete_moderation_config_response.freezed.dart b/packages/stream_chat/lib/open_api/model/delete_moderation_config_response.freezed.dart new file mode 100644 index 0000000000..ff5fb4d069 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delete_moderation_config_response.freezed.dart @@ -0,0 +1,76 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'delete_moderation_config_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$DeleteModerationConfigResponse { + String get duration; + + /// Create a copy of DeleteModerationConfigResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $DeleteModerationConfigResponseCopyWith get copyWith => + _$DeleteModerationConfigResponseCopyWithImpl( + this as DeleteModerationConfigResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is DeleteModerationConfigResponse && + (identical(other.duration, duration) || other.duration == duration)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration); + + @override + String toString() { + return 'DeleteModerationConfigResponse(duration: $duration)'; + } +} + +/// @nodoc +abstract mixin class $DeleteModerationConfigResponseCopyWith<$Res> { + factory $DeleteModerationConfigResponseCopyWith( + DeleteModerationConfigResponse value, + $Res Function(DeleteModerationConfigResponse) _then, + ) = _$DeleteModerationConfigResponseCopyWithImpl; + @useResult + $Res call({String duration}); +} + +/// @nodoc +class _$DeleteModerationConfigResponseCopyWithImpl<$Res> implements $DeleteModerationConfigResponseCopyWith<$Res> { + _$DeleteModerationConfigResponseCopyWithImpl(this._self, this._then); + + final DeleteModerationConfigResponse _self; + final $Res Function(DeleteModerationConfigResponse) _then; + + /// Create a copy of DeleteModerationConfigResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null}) { + return _then( + DeleteModerationConfigResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/delete_moderation_config_response.g.dart b/packages/stream_chat/lib/open_api/model/delete_moderation_config_response.g.dart new file mode 100644 index 0000000000..375763d935 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delete_moderation_config_response.g.dart @@ -0,0 +1,15 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'delete_moderation_config_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +DeleteModerationConfigResponse _$DeleteModerationConfigResponseFromJson( + Map json, +) => DeleteModerationConfigResponse(duration: json['duration'] as String); + +Map _$DeleteModerationConfigResponseToJson( + DeleteModerationConfigResponse instance, +) => {'duration': instance.duration}; diff --git a/packages/stream_chat/lib/open_api/model/delete_reaction_request_payload.dart b/packages/stream_chat/lib/open_api/model/delete_reaction_request_payload.dart new file mode 100644 index 0000000000..ba472e5802 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delete_reaction_request_payload.dart @@ -0,0 +1,47 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'delete_reaction_request_payload.g.dart'; +part 'delete_reaction_request_payload.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class DeleteReactionRequestPayload with _$DeleteReactionRequestPayload { + const DeleteReactionRequestPayload({ + this.entityId, + this.entityType, + this.hardDelete, + this.reason, + }); + + @override + @JsonKey(name: 'entity_id') + final String? entityId; + + @override + @JsonKey(name: 'entity_type') + final String? entityType; + + @override + @JsonKey(name: 'hard_delete') + final bool? hardDelete; + + @override + @JsonKey(name: 'reason') + final String? reason; + + Map toJson() => _$DeleteReactionRequestPayloadToJson(this); + + static DeleteReactionRequestPayload fromJson(Map json) => + _$DeleteReactionRequestPayloadFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/delete_reaction_request_payload.freezed.dart b/packages/stream_chat/lib/open_api/model/delete_reaction_request_payload.freezed.dart new file mode 100644 index 0000000000..e5efd67d53 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delete_reaction_request_payload.freezed.dart @@ -0,0 +1,104 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'delete_reaction_request_payload.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$DeleteReactionRequestPayload { + String? get entityId; + String? get entityType; + bool? get hardDelete; + String? get reason; + + /// Create a copy of DeleteReactionRequestPayload + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $DeleteReactionRequestPayloadCopyWith get copyWith => + _$DeleteReactionRequestPayloadCopyWithImpl( + this as DeleteReactionRequestPayload, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is DeleteReactionRequestPayload && + (identical(other.entityId, entityId) || other.entityId == entityId) && + (identical(other.entityType, entityType) || other.entityType == entityType) && + (identical(other.hardDelete, hardDelete) || other.hardDelete == hardDelete) && + (identical(other.reason, reason) || other.reason == reason)); + } + + @override + int get hashCode => Object.hash(runtimeType, entityId, entityType, hardDelete, reason); + + @override + String toString() { + return 'DeleteReactionRequestPayload(entityId: $entityId, entityType: $entityType, hardDelete: $hardDelete, reason: $reason)'; + } +} + +/// @nodoc +abstract mixin class $DeleteReactionRequestPayloadCopyWith<$Res> { + factory $DeleteReactionRequestPayloadCopyWith( + DeleteReactionRequestPayload value, + $Res Function(DeleteReactionRequestPayload) _then, + ) = _$DeleteReactionRequestPayloadCopyWithImpl; + @useResult + $Res call({ + String? entityId, + String? entityType, + bool? hardDelete, + String? reason, + }); +} + +/// @nodoc +class _$DeleteReactionRequestPayloadCopyWithImpl<$Res> implements $DeleteReactionRequestPayloadCopyWith<$Res> { + _$DeleteReactionRequestPayloadCopyWithImpl(this._self, this._then); + + final DeleteReactionRequestPayload _self; + final $Res Function(DeleteReactionRequestPayload) _then; + + /// Create a copy of DeleteReactionRequestPayload + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? entityId = freezed, + Object? entityType = freezed, + Object? hardDelete = freezed, + Object? reason = freezed, + }) { + return _then( + DeleteReactionRequestPayload( + entityId: freezed == entityId + ? _self.entityId + : entityId // ignore: cast_nullable_to_non_nullable + as String?, + entityType: freezed == entityType + ? _self.entityType + : entityType // ignore: cast_nullable_to_non_nullable + as String?, + hardDelete: freezed == hardDelete + ? _self.hardDelete + : hardDelete // ignore: cast_nullable_to_non_nullable + as bool?, + reason: freezed == reason + ? _self.reason + : reason // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/delete_reaction_request_payload.g.dart b/packages/stream_chat/lib/open_api/model/delete_reaction_request_payload.g.dart new file mode 100644 index 0000000000..5240a94dbc --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delete_reaction_request_payload.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'delete_reaction_request_payload.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +DeleteReactionRequestPayload _$DeleteReactionRequestPayloadFromJson( + Map json, +) => DeleteReactionRequestPayload( + entityId: json['entity_id'] as String?, + entityType: json['entity_type'] as String?, + hardDelete: json['hard_delete'] as bool?, + reason: json['reason'] as String?, +); + +Map _$DeleteReactionRequestPayloadToJson( + DeleteReactionRequestPayload instance, +) => { + 'entity_id': instance.entityId, + 'entity_type': instance.entityType, + 'hard_delete': instance.hardDelete, + 'reason': instance.reason, +}; diff --git a/packages/stream_chat/lib/open_api/model/delete_reaction_response.dart b/packages/stream_chat/lib/open_api/model/delete_reaction_response.dart new file mode 100644 index 0000000000..1da3a1ab56 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delete_reaction_response.dart @@ -0,0 +1,41 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'delete_reaction_response.g.dart'; +part 'delete_reaction_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class DeleteReactionResponse with _$DeleteReactionResponse { + const DeleteReactionResponse({ + required this.duration, + required this.message, + required this.reaction, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'message') + final MessageResponse message; + + @override + @JsonKey(name: 'reaction') + final ReactionResponse reaction; + + Map toJson() => _$DeleteReactionResponseToJson(this); + + static DeleteReactionResponse fromJson(Map json) => _$DeleteReactionResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/delete_reaction_response.freezed.dart b/packages/stream_chat/lib/open_api/model/delete_reaction_response.freezed.dart new file mode 100644 index 0000000000..44e6d19e8e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delete_reaction_response.freezed.dart @@ -0,0 +1,96 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'delete_reaction_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$DeleteReactionResponse { + String get duration; + MessageResponse get message; + ReactionResponse get reaction; + + /// Create a copy of DeleteReactionResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $DeleteReactionResponseCopyWith get copyWith => + _$DeleteReactionResponseCopyWithImpl( + this as DeleteReactionResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is DeleteReactionResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.message, message) || other.message == message) && + (identical(other.reaction, reaction) || other.reaction == reaction)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration, message, reaction); + + @override + String toString() { + return 'DeleteReactionResponse(duration: $duration, message: $message, reaction: $reaction)'; + } +} + +/// @nodoc +abstract mixin class $DeleteReactionResponseCopyWith<$Res> { + factory $DeleteReactionResponseCopyWith( + DeleteReactionResponse value, + $Res Function(DeleteReactionResponse) _then, + ) = _$DeleteReactionResponseCopyWithImpl; + @useResult + $Res call({ + String duration, + MessageResponse message, + ReactionResponse reaction, + }); +} + +/// @nodoc +class _$DeleteReactionResponseCopyWithImpl<$Res> implements $DeleteReactionResponseCopyWith<$Res> { + _$DeleteReactionResponseCopyWithImpl(this._self, this._then); + + final DeleteReactionResponse _self; + final $Res Function(DeleteReactionResponse) _then; + + /// Create a copy of DeleteReactionResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? duration = null, + Object? message = null, + Object? reaction = null, + }) { + return _then( + DeleteReactionResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + message: null == message + ? _self.message + : message // ignore: cast_nullable_to_non_nullable + as MessageResponse, + reaction: null == reaction + ? _self.reaction + : reaction // ignore: cast_nullable_to_non_nullable + as ReactionResponse, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/delete_reaction_response.g.dart b/packages/stream_chat/lib/open_api/model/delete_reaction_response.g.dart new file mode 100644 index 0000000000..844795283a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delete_reaction_response.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'delete_reaction_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +DeleteReactionResponse _$DeleteReactionResponseFromJson( + Map json, +) => DeleteReactionResponse( + duration: json['duration'] as String, + message: MessageResponse.fromJson(json['message'] as Map), + reaction: ReactionResponse.fromJson(json['reaction'] as Map), +); + +Map _$DeleteReactionResponseToJson( + DeleteReactionResponse instance, +) => { + 'duration': instance.duration, + 'message': instance.message.toJson(), + 'reaction': instance.reaction.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/delete_reminder_response.dart b/packages/stream_chat/lib/open_api/model/delete_reminder_response.dart new file mode 100644 index 0000000000..d70411ce67 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delete_reminder_response.dart @@ -0,0 +1,31 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'delete_reminder_response.g.dart'; +part 'delete_reminder_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class DeleteReminderResponse with _$DeleteReminderResponse { + const DeleteReminderResponse({ + required this.duration, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + Map toJson() => _$DeleteReminderResponseToJson(this); + + static DeleteReminderResponse fromJson(Map json) => _$DeleteReminderResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/delete_reminder_response.freezed.dart b/packages/stream_chat/lib/open_api/model/delete_reminder_response.freezed.dart new file mode 100644 index 0000000000..332519d902 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delete_reminder_response.freezed.dart @@ -0,0 +1,76 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'delete_reminder_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$DeleteReminderResponse { + String get duration; + + /// Create a copy of DeleteReminderResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $DeleteReminderResponseCopyWith get copyWith => + _$DeleteReminderResponseCopyWithImpl( + this as DeleteReminderResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is DeleteReminderResponse && + (identical(other.duration, duration) || other.duration == duration)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration); + + @override + String toString() { + return 'DeleteReminderResponse(duration: $duration)'; + } +} + +/// @nodoc +abstract mixin class $DeleteReminderResponseCopyWith<$Res> { + factory $DeleteReminderResponseCopyWith( + DeleteReminderResponse value, + $Res Function(DeleteReminderResponse) _then, + ) = _$DeleteReminderResponseCopyWithImpl; + @useResult + $Res call({String duration}); +} + +/// @nodoc +class _$DeleteReminderResponseCopyWithImpl<$Res> implements $DeleteReminderResponseCopyWith<$Res> { + _$DeleteReminderResponseCopyWithImpl(this._self, this._then); + + final DeleteReminderResponse _self; + final $Res Function(DeleteReminderResponse) _then; + + /// Create a copy of DeleteReminderResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null}) { + return _then( + DeleteReminderResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/delete_reminder_response.g.dart b/packages/stream_chat/lib/open_api/model/delete_reminder_response.g.dart new file mode 100644 index 0000000000..9e9be20209 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delete_reminder_response.g.dart @@ -0,0 +1,15 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'delete_reminder_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +DeleteReminderResponse _$DeleteReminderResponseFromJson( + Map json, +) => DeleteReminderResponse(duration: json['duration'] as String); + +Map _$DeleteReminderResponseToJson( + DeleteReminderResponse instance, +) => {'duration': instance.duration}; diff --git a/packages/stream_chat/lib/open_api/model/delete_user_messages_request_payload.dart b/packages/stream_chat/lib/open_api/model/delete_user_messages_request_payload.dart new file mode 100644 index 0000000000..e2cd2fc6d8 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delete_user_messages_request_payload.dart @@ -0,0 +1,68 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'delete_user_messages_request_payload.g.dart'; +part 'delete_user_messages_request_payload.freezed.dart'; + +extension type const DeleteUserMessagesRequestPayloadDeleteMessages._(String _) implements String { + static const hard = DeleteUserMessagesRequestPayloadDeleteMessages._('hard'); + static const pruning = DeleteUserMessagesRequestPayloadDeleteMessages._('pruning'); + static const soft = DeleteUserMessagesRequestPayloadDeleteMessages._('soft'); + + factory DeleteUserMessagesRequestPayloadDeleteMessages.fromJson(String json) => + DeleteUserMessagesRequestPayloadDeleteMessages._(json); + + String toJson() => this; +} + +@freezed +@immutable +@JsonSerializable() +class DeleteUserMessagesRequestPayload with _$DeleteUserMessagesRequestPayload { + const DeleteUserMessagesRequestPayload({ + this.channelCid, + required this.deleteMessages, + this.deleteReactions, + this.entityId, + this.entityType, + this.reason, + }); + + @override + @JsonKey(name: 'channel_cid') + final String? channelCid; + + @override + @JsonKey(name: 'delete_messages') + final DeleteUserMessagesRequestPayloadDeleteMessages deleteMessages; + + @override + @JsonKey(name: 'delete_reactions') + final bool? deleteReactions; + + @override + @JsonKey(name: 'entity_id') + final String? entityId; + + @override + @JsonKey(name: 'entity_type') + final String? entityType; + + @override + @JsonKey(name: 'reason') + final String? reason; + + Map toJson() => _$DeleteUserMessagesRequestPayloadToJson(this); + + static DeleteUserMessagesRequestPayload fromJson(Map json) => + _$DeleteUserMessagesRequestPayloadFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/delete_user_messages_request_payload.freezed.dart b/packages/stream_chat/lib/open_api/model/delete_user_messages_request_payload.freezed.dart new file mode 100644 index 0000000000..f0c1ceb472 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delete_user_messages_request_payload.freezed.dart @@ -0,0 +1,128 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'delete_user_messages_request_payload.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$DeleteUserMessagesRequestPayload { + String? get channelCid; + DeleteUserMessagesRequestPayloadDeleteMessages get deleteMessages; + bool? get deleteReactions; + String? get entityId; + String? get entityType; + String? get reason; + + /// Create a copy of DeleteUserMessagesRequestPayload + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $DeleteUserMessagesRequestPayloadCopyWith get copyWith => + _$DeleteUserMessagesRequestPayloadCopyWithImpl( + this as DeleteUserMessagesRequestPayload, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is DeleteUserMessagesRequestPayload && + (identical(other.channelCid, channelCid) || other.channelCid == channelCid) && + (identical(other.deleteMessages, deleteMessages) || other.deleteMessages == deleteMessages) && + (identical(other.deleteReactions, deleteReactions) || other.deleteReactions == deleteReactions) && + (identical(other.entityId, entityId) || other.entityId == entityId) && + (identical(other.entityType, entityType) || other.entityType == entityType) && + (identical(other.reason, reason) || other.reason == reason)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channelCid, + deleteMessages, + deleteReactions, + entityId, + entityType, + reason, + ); + + @override + String toString() { + return 'DeleteUserMessagesRequestPayload(channelCid: $channelCid, deleteMessages: $deleteMessages, deleteReactions: $deleteReactions, entityId: $entityId, entityType: $entityType, reason: $reason)'; + } +} + +/// @nodoc +abstract mixin class $DeleteUserMessagesRequestPayloadCopyWith<$Res> { + factory $DeleteUserMessagesRequestPayloadCopyWith( + DeleteUserMessagesRequestPayload value, + $Res Function(DeleteUserMessagesRequestPayload) _then, + ) = _$DeleteUserMessagesRequestPayloadCopyWithImpl; + @useResult + $Res call({ + String? channelCid, + DeleteUserMessagesRequestPayloadDeleteMessages deleteMessages, + bool? deleteReactions, + String? entityId, + String? entityType, + String? reason, + }); +} + +/// @nodoc +class _$DeleteUserMessagesRequestPayloadCopyWithImpl<$Res> implements $DeleteUserMessagesRequestPayloadCopyWith<$Res> { + _$DeleteUserMessagesRequestPayloadCopyWithImpl(this._self, this._then); + + final DeleteUserMessagesRequestPayload _self; + final $Res Function(DeleteUserMessagesRequestPayload) _then; + + /// Create a copy of DeleteUserMessagesRequestPayload + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channelCid = freezed, + Object? deleteMessages = null, + Object? deleteReactions = freezed, + Object? entityId = freezed, + Object? entityType = freezed, + Object? reason = freezed, + }) { + return _then( + DeleteUserMessagesRequestPayload( + channelCid: freezed == channelCid + ? _self.channelCid + : channelCid // ignore: cast_nullable_to_non_nullable + as String?, + deleteMessages: null == deleteMessages + ? _self.deleteMessages + : deleteMessages // ignore: cast_nullable_to_non_nullable + as DeleteUserMessagesRequestPayloadDeleteMessages, + deleteReactions: freezed == deleteReactions + ? _self.deleteReactions + : deleteReactions // ignore: cast_nullable_to_non_nullable + as bool?, + entityId: freezed == entityId + ? _self.entityId + : entityId // ignore: cast_nullable_to_non_nullable + as String?, + entityType: freezed == entityType + ? _self.entityType + : entityType // ignore: cast_nullable_to_non_nullable + as String?, + reason: freezed == reason + ? _self.reason + : reason // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/delete_user_messages_request_payload.g.dart b/packages/stream_chat/lib/open_api/model/delete_user_messages_request_payload.g.dart new file mode 100644 index 0000000000..0a335ee826 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delete_user_messages_request_payload.g.dart @@ -0,0 +1,31 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'delete_user_messages_request_payload.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +DeleteUserMessagesRequestPayload _$DeleteUserMessagesRequestPayloadFromJson( + Map json, +) => DeleteUserMessagesRequestPayload( + channelCid: json['channel_cid'] as String?, + deleteMessages: DeleteUserMessagesRequestPayloadDeleteMessages.fromJson( + json['delete_messages'] as String, + ), + deleteReactions: json['delete_reactions'] as bool?, + entityId: json['entity_id'] as String?, + entityType: json['entity_type'] as String?, + reason: json['reason'] as String?, +); + +Map _$DeleteUserMessagesRequestPayloadToJson( + DeleteUserMessagesRequestPayload instance, +) => { + 'channel_cid': instance.channelCid, + 'delete_messages': instance.deleteMessages.toJson(), + 'delete_reactions': instance.deleteReactions, + 'entity_id': instance.entityId, + 'entity_type': instance.entityType, + 'reason': instance.reason, +}; diff --git a/packages/stream_chat/lib/open_api/model/delete_user_request_payload.dart b/packages/stream_chat/lib/open_api/model/delete_user_request_payload.dart new file mode 100644 index 0000000000..ef1439c4e8 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delete_user_request_payload.dart @@ -0,0 +1,61 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'delete_user_request_payload.g.dart'; +part 'delete_user_request_payload.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class DeleteUserRequestPayload with _$DeleteUserRequestPayload { + const DeleteUserRequestPayload({ + this.deleteConversationChannels, + this.deleteFeedsContent, + this.entityId, + this.entityType, + this.hardDelete, + this.markMessagesDeleted, + this.reason, + }); + + @override + @JsonKey(name: 'delete_conversation_channels') + final bool? deleteConversationChannels; + + @override + @JsonKey(name: 'delete_feeds_content') + final bool? deleteFeedsContent; + + @override + @JsonKey(name: 'entity_id') + final String? entityId; + + @override + @JsonKey(name: 'entity_type') + final String? entityType; + + @override + @JsonKey(name: 'hard_delete') + final bool? hardDelete; + + @override + @JsonKey(name: 'mark_messages_deleted') + final bool? markMessagesDeleted; + + @override + @JsonKey(name: 'reason') + final String? reason; + + Map toJson() => _$DeleteUserRequestPayloadToJson(this); + + static DeleteUserRequestPayload fromJson(Map json) => _$DeleteUserRequestPayloadFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/delete_user_request_payload.freezed.dart b/packages/stream_chat/lib/open_api/model/delete_user_request_payload.freezed.dart new file mode 100644 index 0000000000..8dc3c8ab15 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delete_user_request_payload.freezed.dart @@ -0,0 +1,143 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'delete_user_request_payload.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$DeleteUserRequestPayload { + bool? get deleteConversationChannels; + bool? get deleteFeedsContent; + String? get entityId; + String? get entityType; + bool? get hardDelete; + bool? get markMessagesDeleted; + String? get reason; + + /// Create a copy of DeleteUserRequestPayload + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $DeleteUserRequestPayloadCopyWith get copyWith => + _$DeleteUserRequestPayloadCopyWithImpl( + this as DeleteUserRequestPayload, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is DeleteUserRequestPayload && + (identical( + other.deleteConversationChannels, + deleteConversationChannels, + ) || + other.deleteConversationChannels == deleteConversationChannels) && + (identical(other.deleteFeedsContent, deleteFeedsContent) || + other.deleteFeedsContent == deleteFeedsContent) && + (identical(other.entityId, entityId) || other.entityId == entityId) && + (identical(other.entityType, entityType) || other.entityType == entityType) && + (identical(other.hardDelete, hardDelete) || other.hardDelete == hardDelete) && + (identical(other.markMessagesDeleted, markMessagesDeleted) || + other.markMessagesDeleted == markMessagesDeleted) && + (identical(other.reason, reason) || other.reason == reason)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + deleteConversationChannels, + deleteFeedsContent, + entityId, + entityType, + hardDelete, + markMessagesDeleted, + reason, + ); + + @override + String toString() { + return 'DeleteUserRequestPayload(deleteConversationChannels: $deleteConversationChannels, deleteFeedsContent: $deleteFeedsContent, entityId: $entityId, entityType: $entityType, hardDelete: $hardDelete, markMessagesDeleted: $markMessagesDeleted, reason: $reason)'; + } +} + +/// @nodoc +abstract mixin class $DeleteUserRequestPayloadCopyWith<$Res> { + factory $DeleteUserRequestPayloadCopyWith( + DeleteUserRequestPayload value, + $Res Function(DeleteUserRequestPayload) _then, + ) = _$DeleteUserRequestPayloadCopyWithImpl; + @useResult + $Res call({ + bool? deleteConversationChannels, + bool? deleteFeedsContent, + String? entityId, + String? entityType, + bool? hardDelete, + bool? markMessagesDeleted, + String? reason, + }); +} + +/// @nodoc +class _$DeleteUserRequestPayloadCopyWithImpl<$Res> implements $DeleteUserRequestPayloadCopyWith<$Res> { + _$DeleteUserRequestPayloadCopyWithImpl(this._self, this._then); + + final DeleteUserRequestPayload _self; + final $Res Function(DeleteUserRequestPayload) _then; + + /// Create a copy of DeleteUserRequestPayload + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? deleteConversationChannels = freezed, + Object? deleteFeedsContent = freezed, + Object? entityId = freezed, + Object? entityType = freezed, + Object? hardDelete = freezed, + Object? markMessagesDeleted = freezed, + Object? reason = freezed, + }) { + return _then( + DeleteUserRequestPayload( + deleteConversationChannels: freezed == deleteConversationChannels + ? _self.deleteConversationChannels + : deleteConversationChannels // ignore: cast_nullable_to_non_nullable + as bool?, + deleteFeedsContent: freezed == deleteFeedsContent + ? _self.deleteFeedsContent + : deleteFeedsContent // ignore: cast_nullable_to_non_nullable + as bool?, + entityId: freezed == entityId + ? _self.entityId + : entityId // ignore: cast_nullable_to_non_nullable + as String?, + entityType: freezed == entityType + ? _self.entityType + : entityType // ignore: cast_nullable_to_non_nullable + as String?, + hardDelete: freezed == hardDelete + ? _self.hardDelete + : hardDelete // ignore: cast_nullable_to_non_nullable + as bool?, + markMessagesDeleted: freezed == markMessagesDeleted + ? _self.markMessagesDeleted + : markMessagesDeleted // ignore: cast_nullable_to_non_nullable + as bool?, + reason: freezed == reason + ? _self.reason + : reason // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/delete_user_request_payload.g.dart b/packages/stream_chat/lib/open_api/model/delete_user_request_payload.g.dart new file mode 100644 index 0000000000..912423a11e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delete_user_request_payload.g.dart @@ -0,0 +1,31 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'delete_user_request_payload.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +DeleteUserRequestPayload _$DeleteUserRequestPayloadFromJson( + Map json, +) => DeleteUserRequestPayload( + deleteConversationChannels: json['delete_conversation_channels'] as bool?, + deleteFeedsContent: json['delete_feeds_content'] as bool?, + entityId: json['entity_id'] as String?, + entityType: json['entity_type'] as String?, + hardDelete: json['hard_delete'] as bool?, + markMessagesDeleted: json['mark_messages_deleted'] as bool?, + reason: json['reason'] as String?, +); + +Map _$DeleteUserRequestPayloadToJson( + DeleteUserRequestPayload instance, +) => { + 'delete_conversation_channels': instance.deleteConversationChannels, + 'delete_feeds_content': instance.deleteFeedsContent, + 'entity_id': instance.entityId, + 'entity_type': instance.entityType, + 'hard_delete': instance.hardDelete, + 'mark_messages_deleted': instance.markMessagesDeleted, + 'reason': instance.reason, +}; diff --git a/packages/stream_chat/lib/open_api/model/delivered_message_payload.dart b/packages/stream_chat/lib/open_api/model/delivered_message_payload.dart new file mode 100644 index 0000000000..375ac981d7 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delivered_message_payload.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'delivered_message_payload.g.dart'; +part 'delivered_message_payload.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class DeliveredMessagePayload with _$DeliveredMessagePayload { + const DeliveredMessagePayload({ + this.cid, + this.id, + }); + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @JsonKey(name: 'id') + final String? id; + + Map toJson() => _$DeliveredMessagePayloadToJson(this); + + static DeliveredMessagePayload fromJson(Map json) => _$DeliveredMessagePayloadFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/delivered_message_payload.freezed.dart b/packages/stream_chat/lib/open_api/model/delivered_message_payload.freezed.dart new file mode 100644 index 0000000000..477e3cb7dd --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delivered_message_payload.freezed.dart @@ -0,0 +1,82 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'delivered_message_payload.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$DeliveredMessagePayload { + String? get cid; + String? get id; + + /// Create a copy of DeliveredMessagePayload + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $DeliveredMessagePayloadCopyWith get copyWith => + _$DeliveredMessagePayloadCopyWithImpl( + this as DeliveredMessagePayload, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is DeliveredMessagePayload && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.id, id) || other.id == id)); + } + + @override + int get hashCode => Object.hash(runtimeType, cid, id); + + @override + String toString() { + return 'DeliveredMessagePayload(cid: $cid, id: $id)'; + } +} + +/// @nodoc +abstract mixin class $DeliveredMessagePayloadCopyWith<$Res> { + factory $DeliveredMessagePayloadCopyWith( + DeliveredMessagePayload value, + $Res Function(DeliveredMessagePayload) _then, + ) = _$DeliveredMessagePayloadCopyWithImpl; + @useResult + $Res call({String? cid, String? id}); +} + +/// @nodoc +class _$DeliveredMessagePayloadCopyWithImpl<$Res> implements $DeliveredMessagePayloadCopyWith<$Res> { + _$DeliveredMessagePayloadCopyWithImpl(this._self, this._then); + + final DeliveredMessagePayload _self; + final $Res Function(DeliveredMessagePayload) _then; + + /// Create a copy of DeliveredMessagePayload + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? cid = freezed, Object? id = freezed}) { + return _then( + DeliveredMessagePayload( + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + id: freezed == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/delivered_message_payload.g.dart b/packages/stream_chat/lib/open_api/model/delivered_message_payload.g.dart new file mode 100644 index 0000000000..a5d088be9d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delivered_message_payload.g.dart @@ -0,0 +1,18 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'delivered_message_payload.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +DeliveredMessagePayload _$DeliveredMessagePayloadFromJson( + Map json, +) => DeliveredMessagePayload( + cid: json['cid'] as String?, + id: json['id'] as String?, +); + +Map _$DeliveredMessagePayloadToJson( + DeliveredMessagePayload instance, +) => {'cid': instance.cid, 'id': instance.id}; diff --git a/packages/stream_chat/lib/open_api/model/delivery_receipts_response.dart b/packages/stream_chat/lib/open_api/model/delivery_receipts_response.dart new file mode 100644 index 0000000000..be475a37b8 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delivery_receipts_response.dart @@ -0,0 +1,31 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'delivery_receipts_response.g.dart'; +part 'delivery_receipts_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class DeliveryReceiptsResponse with _$DeliveryReceiptsResponse { + const DeliveryReceiptsResponse({ + required this.enabled, + }); + + @override + @JsonKey(name: 'enabled') + final bool enabled; + + Map toJson() => _$DeliveryReceiptsResponseToJson(this); + + static DeliveryReceiptsResponse fromJson(Map json) => _$DeliveryReceiptsResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/delivery_receipts_response.freezed.dart b/packages/stream_chat/lib/open_api/model/delivery_receipts_response.freezed.dart new file mode 100644 index 0000000000..22a8a39160 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delivery_receipts_response.freezed.dart @@ -0,0 +1,76 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'delivery_receipts_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$DeliveryReceiptsResponse { + bool get enabled; + + /// Create a copy of DeliveryReceiptsResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $DeliveryReceiptsResponseCopyWith get copyWith => + _$DeliveryReceiptsResponseCopyWithImpl( + this as DeliveryReceiptsResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is DeliveryReceiptsResponse && + (identical(other.enabled, enabled) || other.enabled == enabled)); + } + + @override + int get hashCode => Object.hash(runtimeType, enabled); + + @override + String toString() { + return 'DeliveryReceiptsResponse(enabled: $enabled)'; + } +} + +/// @nodoc +abstract mixin class $DeliveryReceiptsResponseCopyWith<$Res> { + factory $DeliveryReceiptsResponseCopyWith( + DeliveryReceiptsResponse value, + $Res Function(DeliveryReceiptsResponse) _then, + ) = _$DeliveryReceiptsResponseCopyWithImpl; + @useResult + $Res call({bool enabled}); +} + +/// @nodoc +class _$DeliveryReceiptsResponseCopyWithImpl<$Res> implements $DeliveryReceiptsResponseCopyWith<$Res> { + _$DeliveryReceiptsResponseCopyWithImpl(this._self, this._then); + + final DeliveryReceiptsResponse _self; + final $Res Function(DeliveryReceiptsResponse) _then; + + /// Create a copy of DeliveryReceiptsResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? enabled = null}) { + return _then( + DeliveryReceiptsResponse( + enabled: null == enabled + ? _self.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/delivery_receipts_response.g.dart b/packages/stream_chat/lib/open_api/model/delivery_receipts_response.g.dart new file mode 100644 index 0000000000..94896ca881 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/delivery_receipts_response.g.dart @@ -0,0 +1,15 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'delivery_receipts_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +DeliveryReceiptsResponse _$DeliveryReceiptsResponseFromJson( + Map json, +) => DeliveryReceiptsResponse(enabled: json['enabled'] as bool); + +Map _$DeliveryReceiptsResponseToJson( + DeliveryReceiptsResponse instance, +) => {'enabled': instance.enabled}; diff --git a/packages/stream_chat/lib/open_api/model/device_response.dart b/packages/stream_chat/lib/open_api/model/device_response.dart new file mode 100644 index 0000000000..70f55cc1ab --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/device_response.dart @@ -0,0 +1,72 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'device_response.g.dart'; +part 'device_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class DeviceResponse with _$DeviceResponse { + const DeviceResponse({ + required this.createdAt, + this.disabled, + this.disabledReason, + this.hardwareId, + required this.id, + required this.pushProvider, + this.pushProviderName, + required this.userId, + this.voip, + }); + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'disabled') + final bool? disabled; + + @override + @JsonKey(name: 'disabled_reason') + final String? disabledReason; + + @override + @JsonKey(name: 'hardware_id') + final String? hardwareId; + + @override + @JsonKey(name: 'id') + final String id; + + @override + @JsonKey(name: 'push_provider') + final String pushProvider; + + @override + @JsonKey(name: 'push_provider_name') + final String? pushProviderName; + + @override + @JsonKey(name: 'user_id') + final String userId; + + @override + @JsonKey(name: 'voip') + final bool? voip; + + Map toJson() => _$DeviceResponseToJson(this); + + static DeviceResponse fromJson(Map json) => _$DeviceResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/device_response.freezed.dart b/packages/stream_chat/lib/open_api/model/device_response.freezed.dart new file mode 100644 index 0000000000..04809c118c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/device_response.freezed.dart @@ -0,0 +1,154 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'device_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$DeviceResponse { + DateTime get createdAt; + bool? get disabled; + String? get disabledReason; + String? get hardwareId; + String get id; + String get pushProvider; + String? get pushProviderName; + String get userId; + bool? get voip; + + /// Create a copy of DeviceResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $DeviceResponseCopyWith get copyWith => _$DeviceResponseCopyWithImpl( + this as DeviceResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is DeviceResponse && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.disabled, disabled) || other.disabled == disabled) && + (identical(other.disabledReason, disabledReason) || other.disabledReason == disabledReason) && + (identical(other.hardwareId, hardwareId) || other.hardwareId == hardwareId) && + (identical(other.id, id) || other.id == id) && + (identical(other.pushProvider, pushProvider) || other.pushProvider == pushProvider) && + (identical(other.pushProviderName, pushProviderName) || other.pushProviderName == pushProviderName) && + (identical(other.userId, userId) || other.userId == userId) && + (identical(other.voip, voip) || other.voip == voip)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + createdAt, + disabled, + disabledReason, + hardwareId, + id, + pushProvider, + pushProviderName, + userId, + voip, + ); + + @override + String toString() { + return 'DeviceResponse(createdAt: $createdAt, disabled: $disabled, disabledReason: $disabledReason, hardwareId: $hardwareId, id: $id, pushProvider: $pushProvider, pushProviderName: $pushProviderName, userId: $userId, voip: $voip)'; + } +} + +/// @nodoc +abstract mixin class $DeviceResponseCopyWith<$Res> { + factory $DeviceResponseCopyWith( + DeviceResponse value, + $Res Function(DeviceResponse) _then, + ) = _$DeviceResponseCopyWithImpl; + @useResult + $Res call({ + DateTime createdAt, + bool? disabled, + String? disabledReason, + String? hardwareId, + String id, + String pushProvider, + String? pushProviderName, + String userId, + bool? voip, + }); +} + +/// @nodoc +class _$DeviceResponseCopyWithImpl<$Res> implements $DeviceResponseCopyWith<$Res> { + _$DeviceResponseCopyWithImpl(this._self, this._then); + + final DeviceResponse _self; + final $Res Function(DeviceResponse) _then; + + /// Create a copy of DeviceResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? createdAt = null, + Object? disabled = freezed, + Object? disabledReason = freezed, + Object? hardwareId = freezed, + Object? id = null, + Object? pushProvider = null, + Object? pushProviderName = freezed, + Object? userId = null, + Object? voip = freezed, + }) { + return _then( + DeviceResponse( + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + disabled: freezed == disabled + ? _self.disabled + : disabled // ignore: cast_nullable_to_non_nullable + as bool?, + disabledReason: freezed == disabledReason + ? _self.disabledReason + : disabledReason // ignore: cast_nullable_to_non_nullable + as String?, + hardwareId: freezed == hardwareId + ? _self.hardwareId + : hardwareId // ignore: cast_nullable_to_non_nullable + as String?, + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + pushProvider: null == pushProvider + ? _self.pushProvider + : pushProvider // ignore: cast_nullable_to_non_nullable + as String, + pushProviderName: freezed == pushProviderName + ? _self.pushProviderName + : pushProviderName // ignore: cast_nullable_to_non_nullable + as String?, + userId: null == userId + ? _self.userId + : userId // ignore: cast_nullable_to_non_nullable + as String, + voip: freezed == voip + ? _self.voip + : voip // ignore: cast_nullable_to_non_nullable + as bool?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/device_response.g.dart b/packages/stream_chat/lib/open_api/model/device_response.g.dart new file mode 100644 index 0000000000..050d787898 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/device_response.g.dart @@ -0,0 +1,33 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'device_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +DeviceResponse _$DeviceResponseFromJson(Map json) => DeviceResponse( + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + disabled: json['disabled'] as bool?, + disabledReason: json['disabled_reason'] as String?, + hardwareId: json['hardware_id'] as String?, + id: json['id'] as String, + pushProvider: json['push_provider'] as String, + pushProviderName: json['push_provider_name'] as String?, + userId: json['user_id'] as String, + voip: json['voip'] as bool?, +); + +Map _$DeviceResponseToJson(DeviceResponse instance) => { + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'disabled': instance.disabled, + 'disabled_reason': instance.disabledReason, + 'hardware_id': instance.hardwareId, + 'id': instance.id, + 'push_provider': instance.pushProvider, + 'push_provider_name': instance.pushProviderName, + 'user_id': instance.userId, + 'voip': instance.voip, +}; diff --git a/packages/stream_chat/lib/open_api/model/draft_deleted_event.dart b/packages/stream_chat/lib/open_api/model/draft_deleted_event.dart new file mode 100644 index 0000000000..077ba42362 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/draft_deleted_event.dart @@ -0,0 +1,63 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'draft_deleted_event.g.dart'; +part 'draft_deleted_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class DraftDeletedEvent extends core.WsEvent with _$DraftDeletedEvent { + const DraftDeletedEvent({ + this.cid, + required this.createdAt, + required this.custom, + this.draft, + this.parentId, + this.receivedAt, + required this.type, + }); + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'draft') + final DraftResponse? draft; + + @override + @JsonKey(name: 'parent_id') + final String? parentId; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'type') + final String type; + + Map toJson() => _$DraftDeletedEventToJson(this); + + static DraftDeletedEvent fromJson(Map json) => _$DraftDeletedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/draft_deleted_event.freezed.dart b/packages/stream_chat/lib/open_api/model/draft_deleted_event.freezed.dart new file mode 100644 index 0000000000..14a73610c4 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/draft_deleted_event.freezed.dart @@ -0,0 +1,136 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'draft_deleted_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$DraftDeletedEvent { + String? get cid; + DateTime get createdAt; + Map get custom; + DraftResponse? get draft; + String? get parentId; + DateTime? get receivedAt; + String get type; + + /// Create a copy of DraftDeletedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $DraftDeletedEventCopyWith get copyWith => _$DraftDeletedEventCopyWithImpl( + this as DraftDeletedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is DraftDeletedEvent && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.draft, draft) || other.draft == draft) && + (identical(other.parentId, parentId) || other.parentId == parentId) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.type, type) || other.type == type)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + draft, + parentId, + receivedAt, + type, + ); + + @override + String toString() { + return 'DraftDeletedEvent(cid: $cid, createdAt: $createdAt, custom: $custom, draft: $draft, parentId: $parentId, receivedAt: $receivedAt, type: $type)'; + } +} + +/// @nodoc +abstract mixin class $DraftDeletedEventCopyWith<$Res> { + factory $DraftDeletedEventCopyWith( + DraftDeletedEvent value, + $Res Function(DraftDeletedEvent) _then, + ) = _$DraftDeletedEventCopyWithImpl; + @useResult + $Res call({ + String? cid, + DateTime createdAt, + Map custom, + DraftResponse? draft, + String? parentId, + DateTime? receivedAt, + String type, + }); +} + +/// @nodoc +class _$DraftDeletedEventCopyWithImpl<$Res> implements $DraftDeletedEventCopyWith<$Res> { + _$DraftDeletedEventCopyWithImpl(this._self, this._then); + + final DraftDeletedEvent _self; + final $Res Function(DraftDeletedEvent) _then; + + /// Create a copy of DraftDeletedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? cid = freezed, + Object? createdAt = null, + Object? custom = null, + Object? draft = freezed, + Object? parentId = freezed, + Object? receivedAt = freezed, + Object? type = null, + }) { + return _then( + DraftDeletedEvent( + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + draft: freezed == draft + ? _self.draft + : draft // ignore: cast_nullable_to_non_nullable + as DraftResponse?, + parentId: freezed == parentId + ? _self.parentId + : parentId // ignore: cast_nullable_to_non_nullable + as String?, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/draft_deleted_event.g.dart b/packages/stream_chat/lib/open_api/model/draft_deleted_event.g.dart new file mode 100644 index 0000000000..cc0f595254 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/draft_deleted_event.g.dart @@ -0,0 +1,45 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'draft_deleted_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +DraftDeletedEvent _$DraftDeletedEventFromJson(Map json) => DraftDeletedEvent( + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + draft: json['draft'] == null ? null : DraftResponse.fromJson(json['draft'] as Map), + parentId: json['parent_id'] as String?, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + type: json['type'] as String, +); + +Map _$DraftDeletedEventToJson(DraftDeletedEvent instance) => { + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'draft': instance.draft?.toJson(), + 'parent_id': instance.parentId, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'type': instance.type, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/draft_payload_response.dart b/packages/stream_chat/lib/open_api/model/draft_payload_response.dart new file mode 100644 index 0000000000..6f3c0c3cc6 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/draft_payload_response.dart @@ -0,0 +1,91 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'draft_payload_response.g.dart'; +part 'draft_payload_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class DraftPayloadResponse with _$DraftPayloadResponse { + const DraftPayloadResponse({ + this.attachments, + required this.custom, + this.html, + required this.id, + this.mentionedUsers, + this.mml, + this.parentId, + this.pollId, + this.quotedMessageId, + this.showInChannel, + this.silent, + required this.text, + this.type, + }); + + @override + @JsonKey(name: 'attachments') + final List? attachments; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'html') + final String? html; + + @override + @JsonKey(name: 'id') + final String id; + + @override + @JsonKey(name: 'mentioned_users') + final List? mentionedUsers; + + @override + @JsonKey(name: 'mml') + final String? mml; + + @override + @JsonKey(name: 'parent_id') + final String? parentId; + + @override + @JsonKey(name: 'poll_id') + final String? pollId; + + @override + @JsonKey(name: 'quoted_message_id') + final String? quotedMessageId; + + @override + @JsonKey(name: 'show_in_channel') + final bool? showInChannel; + + @override + @JsonKey(name: 'silent') + final bool? silent; + + @override + @JsonKey(name: 'text') + final String text; + + @override + @JsonKey(name: 'type') + final String? type; + + Map toJson() => _$DraftPayloadResponseToJson(this); + + static DraftPayloadResponse fromJson(Map json) => _$DraftPayloadResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/draft_payload_response.freezed.dart b/packages/stream_chat/lib/open_api/model/draft_payload_response.freezed.dart new file mode 100644 index 0000000000..d713452556 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/draft_payload_response.freezed.dart @@ -0,0 +1,197 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'draft_payload_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$DraftPayloadResponse { + List? get attachments; + Map get custom; + String? get html; + String get id; + List? get mentionedUsers; + String? get mml; + String? get parentId; + String? get pollId; + String? get quotedMessageId; + bool? get showInChannel; + bool? get silent; + String get text; + String? get type; + + /// Create a copy of DraftPayloadResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $DraftPayloadResponseCopyWith get copyWith => + _$DraftPayloadResponseCopyWithImpl( + this as DraftPayloadResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is DraftPayloadResponse && + const DeepCollectionEquality().equals( + other.attachments, + attachments, + ) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.html, html) || other.html == html) && + (identical(other.id, id) || other.id == id) && + const DeepCollectionEquality().equals( + other.mentionedUsers, + mentionedUsers, + ) && + (identical(other.mml, mml) || other.mml == mml) && + (identical(other.parentId, parentId) || other.parentId == parentId) && + (identical(other.pollId, pollId) || other.pollId == pollId) && + (identical(other.quotedMessageId, quotedMessageId) || other.quotedMessageId == quotedMessageId) && + (identical(other.showInChannel, showInChannel) || other.showInChannel == showInChannel) && + (identical(other.silent, silent) || other.silent == silent) && + (identical(other.text, text) || other.text == text) && + (identical(other.type, type) || other.type == type)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(attachments), + const DeepCollectionEquality().hash(custom), + html, + id, + const DeepCollectionEquality().hash(mentionedUsers), + mml, + parentId, + pollId, + quotedMessageId, + showInChannel, + silent, + text, + type, + ); + + @override + String toString() { + return 'DraftPayloadResponse(attachments: $attachments, custom: $custom, html: $html, id: $id, mentionedUsers: $mentionedUsers, mml: $mml, parentId: $parentId, pollId: $pollId, quotedMessageId: $quotedMessageId, showInChannel: $showInChannel, silent: $silent, text: $text, type: $type)'; + } +} + +/// @nodoc +abstract mixin class $DraftPayloadResponseCopyWith<$Res> { + factory $DraftPayloadResponseCopyWith( + DraftPayloadResponse value, + $Res Function(DraftPayloadResponse) _then, + ) = _$DraftPayloadResponseCopyWithImpl; + @useResult + $Res call({ + List? attachments, + Map custom, + String? html, + String id, + List? mentionedUsers, + String? mml, + String? parentId, + String? pollId, + String? quotedMessageId, + bool? showInChannel, + bool? silent, + String text, + String? type, + }); +} + +/// @nodoc +class _$DraftPayloadResponseCopyWithImpl<$Res> implements $DraftPayloadResponseCopyWith<$Res> { + _$DraftPayloadResponseCopyWithImpl(this._self, this._then); + + final DraftPayloadResponse _self; + final $Res Function(DraftPayloadResponse) _then; + + /// Create a copy of DraftPayloadResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? attachments = freezed, + Object? custom = null, + Object? html = freezed, + Object? id = null, + Object? mentionedUsers = freezed, + Object? mml = freezed, + Object? parentId = freezed, + Object? pollId = freezed, + Object? quotedMessageId = freezed, + Object? showInChannel = freezed, + Object? silent = freezed, + Object? text = null, + Object? type = freezed, + }) { + return _then( + DraftPayloadResponse( + attachments: freezed == attachments + ? _self.attachments + : attachments // ignore: cast_nullable_to_non_nullable + as List?, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + html: freezed == html + ? _self.html + : html // ignore: cast_nullable_to_non_nullable + as String?, + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + mentionedUsers: freezed == mentionedUsers + ? _self.mentionedUsers + : mentionedUsers // ignore: cast_nullable_to_non_nullable + as List?, + mml: freezed == mml + ? _self.mml + : mml // ignore: cast_nullable_to_non_nullable + as String?, + parentId: freezed == parentId + ? _self.parentId + : parentId // ignore: cast_nullable_to_non_nullable + as String?, + pollId: freezed == pollId + ? _self.pollId + : pollId // ignore: cast_nullable_to_non_nullable + as String?, + quotedMessageId: freezed == quotedMessageId + ? _self.quotedMessageId + : quotedMessageId // ignore: cast_nullable_to_non_nullable + as String?, + showInChannel: freezed == showInChannel + ? _self.showInChannel + : showInChannel // ignore: cast_nullable_to_non_nullable + as bool?, + silent: freezed == silent + ? _self.silent + : silent // ignore: cast_nullable_to_non_nullable + as bool?, + text: null == text + ? _self.text + : text // ignore: cast_nullable_to_non_nullable + as String, + type: freezed == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/draft_payload_response.g.dart b/packages/stream_chat/lib/open_api/model/draft_payload_response.g.dart new file mode 100644 index 0000000000..bc4c1e9357 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/draft_payload_response.g.dart @@ -0,0 +1,47 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'draft_payload_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +DraftPayloadResponse _$DraftPayloadResponseFromJson( + Map json, +) => DraftPayloadResponse( + attachments: (json['attachments'] as List?) + ?.map((e) => Attachment.fromJson(e as Map)) + .toList(), + custom: json['custom'] as Map, + html: json['html'] as String?, + id: json['id'] as String, + mentionedUsers: (json['mentioned_users'] as List?) + ?.map((e) => UserResponse.fromJson(e as Map)) + .toList(), + mml: json['mml'] as String?, + parentId: json['parent_id'] as String?, + pollId: json['poll_id'] as String?, + quotedMessageId: json['quoted_message_id'] as String?, + showInChannel: json['show_in_channel'] as bool?, + silent: json['silent'] as bool?, + text: json['text'] as String, + type: json['type'] as String?, +); + +Map _$DraftPayloadResponseToJson( + DraftPayloadResponse instance, +) => { + 'attachments': instance.attachments?.map((e) => e.toJson()).toList(), + 'custom': instance.custom, + 'html': instance.html, + 'id': instance.id, + 'mentioned_users': instance.mentionedUsers?.map((e) => e.toJson()).toList(), + 'mml': instance.mml, + 'parent_id': instance.parentId, + 'poll_id': instance.pollId, + 'quoted_message_id': instance.quotedMessageId, + 'show_in_channel': instance.showInChannel, + 'silent': instance.silent, + 'text': instance.text, + 'type': instance.type, +}; diff --git a/packages/stream_chat/lib/open_api/model/draft_response.dart b/packages/stream_chat/lib/open_api/model/draft_response.dart new file mode 100644 index 0000000000..68d3c11e40 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/draft_response.dart @@ -0,0 +1,62 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'draft_response.g.dart'; +part 'draft_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class DraftResponse with _$DraftResponse { + const DraftResponse({ + this.channel, + required this.channelCid, + required this.createdAt, + required this.message, + this.parentId, + this.parentMessage, + this.quotedMessage, + }); + + @override + @JsonKey(name: 'channel') + final ChannelResponse? channel; + + @override + @JsonKey(name: 'channel_cid') + final String channelCid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'message') + final DraftPayloadResponse message; + + @override + @JsonKey(name: 'parent_id') + final String? parentId; + + @override + @JsonKey(name: 'parent_message') + final MessageResponse? parentMessage; + + @override + @JsonKey(name: 'quoted_message') + final MessageResponse? quotedMessage; + + Map toJson() => _$DraftResponseToJson(this); + + static DraftResponse fromJson(Map json) => _$DraftResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/draft_response.freezed.dart b/packages/stream_chat/lib/open_api/model/draft_response.freezed.dart new file mode 100644 index 0000000000..b90b293492 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/draft_response.freezed.dart @@ -0,0 +1,136 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'draft_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$DraftResponse { + ChannelResponse? get channel; + String get channelCid; + DateTime get createdAt; + DraftPayloadResponse get message; + String? get parentId; + MessageResponse? get parentMessage; + MessageResponse? get quotedMessage; + + /// Create a copy of DraftResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $DraftResponseCopyWith get copyWith => _$DraftResponseCopyWithImpl( + this as DraftResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is DraftResponse && + (identical(other.channel, channel) || other.channel == channel) && + (identical(other.channelCid, channelCid) || other.channelCid == channelCid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.message, message) || other.message == message) && + (identical(other.parentId, parentId) || other.parentId == parentId) && + (identical(other.parentMessage, parentMessage) || other.parentMessage == parentMessage) && + (identical(other.quotedMessage, quotedMessage) || other.quotedMessage == quotedMessage)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channel, + channelCid, + createdAt, + message, + parentId, + parentMessage, + quotedMessage, + ); + + @override + String toString() { + return 'DraftResponse(channel: $channel, channelCid: $channelCid, createdAt: $createdAt, message: $message, parentId: $parentId, parentMessage: $parentMessage, quotedMessage: $quotedMessage)'; + } +} + +/// @nodoc +abstract mixin class $DraftResponseCopyWith<$Res> { + factory $DraftResponseCopyWith( + DraftResponse value, + $Res Function(DraftResponse) _then, + ) = _$DraftResponseCopyWithImpl; + @useResult + $Res call({ + ChannelResponse? channel, + String channelCid, + DateTime createdAt, + DraftPayloadResponse message, + String? parentId, + MessageResponse? parentMessage, + MessageResponse? quotedMessage, + }); +} + +/// @nodoc +class _$DraftResponseCopyWithImpl<$Res> implements $DraftResponseCopyWith<$Res> { + _$DraftResponseCopyWithImpl(this._self, this._then); + + final DraftResponse _self; + final $Res Function(DraftResponse) _then; + + /// Create a copy of DraftResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channel = freezed, + Object? channelCid = null, + Object? createdAt = null, + Object? message = null, + Object? parentId = freezed, + Object? parentMessage = freezed, + Object? quotedMessage = freezed, + }) { + return _then( + DraftResponse( + channel: freezed == channel + ? _self.channel + : channel // ignore: cast_nullable_to_non_nullable + as ChannelResponse?, + channelCid: null == channelCid + ? _self.channelCid + : channelCid // ignore: cast_nullable_to_non_nullable + as String, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + message: null == message + ? _self.message + : message // ignore: cast_nullable_to_non_nullable + as DraftPayloadResponse, + parentId: freezed == parentId + ? _self.parentId + : parentId // ignore: cast_nullable_to_non_nullable + as String?, + parentMessage: freezed == parentMessage + ? _self.parentMessage + : parentMessage // ignore: cast_nullable_to_non_nullable + as MessageResponse?, + quotedMessage: freezed == quotedMessage + ? _self.quotedMessage + : quotedMessage // ignore: cast_nullable_to_non_nullable + as MessageResponse?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/draft_response.g.dart b/packages/stream_chat/lib/open_api/model/draft_response.g.dart new file mode 100644 index 0000000000..88bc710da0 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/draft_response.g.dart @@ -0,0 +1,39 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'draft_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +DraftResponse _$DraftResponseFromJson(Map json) => DraftResponse( + channel: json['channel'] == null ? null : ChannelResponse.fromJson(json['channel'] as Map), + channelCid: json['channel_cid'] as String, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + message: DraftPayloadResponse.fromJson( + json['message'] as Map, + ), + parentId: json['parent_id'] as String?, + parentMessage: json['parent_message'] == null + ? null + : MessageResponse.fromJson( + json['parent_message'] as Map, + ), + quotedMessage: json['quoted_message'] == null + ? null + : MessageResponse.fromJson( + json['quoted_message'] as Map, + ), +); + +Map _$DraftResponseToJson(DraftResponse instance) => { + 'channel': instance.channel?.toJson(), + 'channel_cid': instance.channelCid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'message': instance.message.toJson(), + 'parent_id': instance.parentId, + 'parent_message': instance.parentMessage?.toJson(), + 'quoted_message': instance.quotedMessage?.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/draft_updated_event.dart b/packages/stream_chat/lib/open_api/model/draft_updated_event.dart new file mode 100644 index 0000000000..ace9cbfcf0 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/draft_updated_event.dart @@ -0,0 +1,63 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'draft_updated_event.g.dart'; +part 'draft_updated_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class DraftUpdatedEvent extends core.WsEvent with _$DraftUpdatedEvent { + const DraftUpdatedEvent({ + this.cid, + required this.createdAt, + required this.custom, + this.draft, + this.parentId, + this.receivedAt, + required this.type, + }); + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'draft') + final DraftResponse? draft; + + @override + @JsonKey(name: 'parent_id') + final String? parentId; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'type') + final String type; + + Map toJson() => _$DraftUpdatedEventToJson(this); + + static DraftUpdatedEvent fromJson(Map json) => _$DraftUpdatedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/draft_updated_event.freezed.dart b/packages/stream_chat/lib/open_api/model/draft_updated_event.freezed.dart new file mode 100644 index 0000000000..92a9ee56a1 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/draft_updated_event.freezed.dart @@ -0,0 +1,136 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'draft_updated_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$DraftUpdatedEvent { + String? get cid; + DateTime get createdAt; + Map get custom; + DraftResponse? get draft; + String? get parentId; + DateTime? get receivedAt; + String get type; + + /// Create a copy of DraftUpdatedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $DraftUpdatedEventCopyWith get copyWith => _$DraftUpdatedEventCopyWithImpl( + this as DraftUpdatedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is DraftUpdatedEvent && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.draft, draft) || other.draft == draft) && + (identical(other.parentId, parentId) || other.parentId == parentId) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.type, type) || other.type == type)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + draft, + parentId, + receivedAt, + type, + ); + + @override + String toString() { + return 'DraftUpdatedEvent(cid: $cid, createdAt: $createdAt, custom: $custom, draft: $draft, parentId: $parentId, receivedAt: $receivedAt, type: $type)'; + } +} + +/// @nodoc +abstract mixin class $DraftUpdatedEventCopyWith<$Res> { + factory $DraftUpdatedEventCopyWith( + DraftUpdatedEvent value, + $Res Function(DraftUpdatedEvent) _then, + ) = _$DraftUpdatedEventCopyWithImpl; + @useResult + $Res call({ + String? cid, + DateTime createdAt, + Map custom, + DraftResponse? draft, + String? parentId, + DateTime? receivedAt, + String type, + }); +} + +/// @nodoc +class _$DraftUpdatedEventCopyWithImpl<$Res> implements $DraftUpdatedEventCopyWith<$Res> { + _$DraftUpdatedEventCopyWithImpl(this._self, this._then); + + final DraftUpdatedEvent _self; + final $Res Function(DraftUpdatedEvent) _then; + + /// Create a copy of DraftUpdatedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? cid = freezed, + Object? createdAt = null, + Object? custom = null, + Object? draft = freezed, + Object? parentId = freezed, + Object? receivedAt = freezed, + Object? type = null, + }) { + return _then( + DraftUpdatedEvent( + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + draft: freezed == draft + ? _self.draft + : draft // ignore: cast_nullable_to_non_nullable + as DraftResponse?, + parentId: freezed == parentId + ? _self.parentId + : parentId // ignore: cast_nullable_to_non_nullable + as String?, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/draft_updated_event.g.dart b/packages/stream_chat/lib/open_api/model/draft_updated_event.g.dart new file mode 100644 index 0000000000..fe33523cfa --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/draft_updated_event.g.dart @@ -0,0 +1,45 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'draft_updated_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +DraftUpdatedEvent _$DraftUpdatedEventFromJson(Map json) => DraftUpdatedEvent( + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + draft: json['draft'] == null ? null : DraftResponse.fromJson(json['draft'] as Map), + parentId: json['parent_id'] as String?, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + type: json['type'] as String, +); + +Map _$DraftUpdatedEventToJson(DraftUpdatedEvent instance) => { + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'draft': instance.draft?.toJson(), + 'parent_id': instance.parentId, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'type': instance.type, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/duration_response.dart b/packages/stream_chat/lib/open_api/model/duration_response.dart new file mode 100644 index 0000000000..6128a95243 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/duration_response.dart @@ -0,0 +1,31 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'duration_response.g.dart'; +part 'duration_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class DurationResponse with _$DurationResponse { + const DurationResponse({ + required this.duration, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + Map toJson() => _$DurationResponseToJson(this); + + static DurationResponse fromJson(Map json) => _$DurationResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/duration_response.freezed.dart b/packages/stream_chat/lib/open_api/model/duration_response.freezed.dart new file mode 100644 index 0000000000..c6bd64cf65 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/duration_response.freezed.dart @@ -0,0 +1,75 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'duration_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$DurationResponse { + String get duration; + + /// Create a copy of DurationResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $DurationResponseCopyWith get copyWith => _$DurationResponseCopyWithImpl( + this as DurationResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is DurationResponse && + (identical(other.duration, duration) || other.duration == duration)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration); + + @override + String toString() { + return 'DurationResponse(duration: $duration)'; + } +} + +/// @nodoc +abstract mixin class $DurationResponseCopyWith<$Res> { + factory $DurationResponseCopyWith( + DurationResponse value, + $Res Function(DurationResponse) _then, + ) = _$DurationResponseCopyWithImpl; + @useResult + $Res call({String duration}); +} + +/// @nodoc +class _$DurationResponseCopyWithImpl<$Res> implements $DurationResponseCopyWith<$Res> { + _$DurationResponseCopyWithImpl(this._self, this._then); + + final DurationResponse _self; + final $Res Function(DurationResponse) _then; + + /// Create a copy of DurationResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null}) { + return _then( + DurationResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/duration_response.g.dart b/packages/stream_chat/lib/open_api/model/duration_response.g.dart new file mode 100644 index 0000000000..cdd8bd70f0 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/duration_response.g.dart @@ -0,0 +1,14 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'duration_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +DurationResponse _$DurationResponseFromJson(Map json) => + DurationResponse(duration: json['duration'] as String); + +Map _$DurationResponseToJson(DurationResponse instance) => { + 'duration': instance.duration, +}; diff --git a/packages/stream_chat/lib/open_api/model/enriched_activity.dart b/packages/stream_chat/lib/open_api/model/enriched_activity.dart new file mode 100644 index 0000000000..78904c25f1 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/enriched_activity.dart @@ -0,0 +1,86 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'enriched_activity.g.dart'; +part 'enriched_activity.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class EnrichedActivity with _$EnrichedActivity { + const EnrichedActivity({ + this.actor, + this.foreignId, + this.id, + this.latestReactions, + this.object, + this.origin, + this.ownReactions, + this.reactionCounts, + this.score, + this.target, + this.to, + this.verb, + }); + + @override + @JsonKey(name: 'actor') + final Data? actor; + + @override + @JsonKey(name: 'foreign_id') + final String? foreignId; + + @override + @JsonKey(name: 'id') + final String? id; + + @override + @JsonKey(name: 'latest_reactions') + final Map>? latestReactions; + + @override + @JsonKey(name: 'object') + final Data? object; + + @override + @JsonKey(name: 'origin') + final Data? origin; + + @override + @JsonKey(name: 'own_reactions') + final Map>? ownReactions; + + @override + @JsonKey(name: 'reaction_counts') + final Map? reactionCounts; + + @override + @JsonKey(name: 'score') + final double? score; + + @override + @JsonKey(name: 'target') + final Data? target; + + @override + @JsonKey(name: 'to') + final List? to; + + @override + @JsonKey(name: 'verb') + final String? verb; + + Map toJson() => _$EnrichedActivityToJson(this); + + static EnrichedActivity fromJson(Map json) => _$EnrichedActivityFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/enriched_activity.freezed.dart b/packages/stream_chat/lib/open_api/model/enriched_activity.freezed.dart new file mode 100644 index 0000000000..1d2a352a35 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/enriched_activity.freezed.dart @@ -0,0 +1,190 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'enriched_activity.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$EnrichedActivity { + Data? get actor; + String? get foreignId; + String? get id; + Map>? get latestReactions; + Data? get object; + Data? get origin; + Map>? get ownReactions; + Map? get reactionCounts; + double? get score; + Data? get target; + List? get to; + String? get verb; + + /// Create a copy of EnrichedActivity + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $EnrichedActivityCopyWith get copyWith => _$EnrichedActivityCopyWithImpl( + this as EnrichedActivity, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is EnrichedActivity && + (identical(other.actor, actor) || other.actor == actor) && + (identical(other.foreignId, foreignId) || other.foreignId == foreignId) && + (identical(other.id, id) || other.id == id) && + const DeepCollectionEquality().equals( + other.latestReactions, + latestReactions, + ) && + (identical(other.object, object) || other.object == object) && + (identical(other.origin, origin) || other.origin == origin) && + const DeepCollectionEquality().equals( + other.ownReactions, + ownReactions, + ) && + const DeepCollectionEquality().equals( + other.reactionCounts, + reactionCounts, + ) && + (identical(other.score, score) || other.score == score) && + (identical(other.target, target) || other.target == target) && + const DeepCollectionEquality().equals(other.to, to) && + (identical(other.verb, verb) || other.verb == verb)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + actor, + foreignId, + id, + const DeepCollectionEquality().hash(latestReactions), + object, + origin, + const DeepCollectionEquality().hash(ownReactions), + const DeepCollectionEquality().hash(reactionCounts), + score, + target, + const DeepCollectionEquality().hash(to), + verb, + ); + + @override + String toString() { + return 'EnrichedActivity(actor: $actor, foreignId: $foreignId, id: $id, latestReactions: $latestReactions, object: $object, origin: $origin, ownReactions: $ownReactions, reactionCounts: $reactionCounts, score: $score, target: $target, to: $to, verb: $verb)'; + } +} + +/// @nodoc +abstract mixin class $EnrichedActivityCopyWith<$Res> { + factory $EnrichedActivityCopyWith( + EnrichedActivity value, + $Res Function(EnrichedActivity) _then, + ) = _$EnrichedActivityCopyWithImpl; + @useResult + $Res call({ + Data? actor, + String? foreignId, + String? id, + Map>? latestReactions, + Data? object, + Data? origin, + Map>? ownReactions, + Map? reactionCounts, + double? score, + Data? target, + List? to, + String? verb, + }); +} + +/// @nodoc +class _$EnrichedActivityCopyWithImpl<$Res> implements $EnrichedActivityCopyWith<$Res> { + _$EnrichedActivityCopyWithImpl(this._self, this._then); + + final EnrichedActivity _self; + final $Res Function(EnrichedActivity) _then; + + /// Create a copy of EnrichedActivity + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? actor = freezed, + Object? foreignId = freezed, + Object? id = freezed, + Object? latestReactions = freezed, + Object? object = freezed, + Object? origin = freezed, + Object? ownReactions = freezed, + Object? reactionCounts = freezed, + Object? score = freezed, + Object? target = freezed, + Object? to = freezed, + Object? verb = freezed, + }) { + return _then( + EnrichedActivity( + actor: freezed == actor + ? _self.actor + : actor // ignore: cast_nullable_to_non_nullable + as Data?, + foreignId: freezed == foreignId + ? _self.foreignId + : foreignId // ignore: cast_nullable_to_non_nullable + as String?, + id: freezed == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String?, + latestReactions: freezed == latestReactions + ? _self.latestReactions + : latestReactions // ignore: cast_nullable_to_non_nullable + as Map>?, + object: freezed == object + ? _self.object + : object // ignore: cast_nullable_to_non_nullable + as Data?, + origin: freezed == origin + ? _self.origin + : origin // ignore: cast_nullable_to_non_nullable + as Data?, + ownReactions: freezed == ownReactions + ? _self.ownReactions + : ownReactions // ignore: cast_nullable_to_non_nullable + as Map>?, + reactionCounts: freezed == reactionCounts + ? _self.reactionCounts + : reactionCounts // ignore: cast_nullable_to_non_nullable + as Map?, + score: freezed == score + ? _self.score + : score // ignore: cast_nullable_to_non_nullable + as double?, + target: freezed == target + ? _self.target + : target // ignore: cast_nullable_to_non_nullable + as Data?, + to: freezed == to + ? _self.to + : to // ignore: cast_nullable_to_non_nullable + as List?, + verb: freezed == verb + ? _self.verb + : verb // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/enriched_activity.g.dart b/packages/stream_chat/lib/open_api/model/enriched_activity.g.dart new file mode 100644 index 0000000000..208e38dbd9 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/enriched_activity.g.dart @@ -0,0 +1,53 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'enriched_activity.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +EnrichedActivity _$EnrichedActivityFromJson(Map json) => EnrichedActivity( + actor: json['actor'] == null ? null : Data.fromJson(json['actor'] as Map), + foreignId: json['foreign_id'] as String?, + id: json['id'] as String?, + latestReactions: (json['latest_reactions'] as Map?)?.map( + (k, e) => MapEntry( + k, + (e as List).map((e) => EnrichedReaction.fromJson(e as Map)).toList(), + ), + ), + object: json['object'] == null ? null : Data.fromJson(json['object'] as Map), + origin: json['origin'] == null ? null : Data.fromJson(json['origin'] as Map), + ownReactions: (json['own_reactions'] as Map?)?.map( + (k, e) => MapEntry( + k, + (e as List).map((e) => EnrichedReaction.fromJson(e as Map)).toList(), + ), + ), + reactionCounts: (json['reaction_counts'] as Map?)?.map( + (k, e) => MapEntry(k, (e as num).toInt()), + ), + score: (json['score'] as num?)?.toDouble(), + target: json['target'] == null ? null : Data.fromJson(json['target'] as Map), + to: (json['to'] as List?)?.map((e) => e as String).toList(), + verb: json['verb'] as String?, +); + +Map _$EnrichedActivityToJson(EnrichedActivity instance) => { + 'actor': instance.actor?.toJson(), + 'foreign_id': instance.foreignId, + 'id': instance.id, + 'latest_reactions': instance.latestReactions?.map( + (k, e) => MapEntry(k, e.map((e) => e.toJson()).toList()), + ), + 'object': instance.object?.toJson(), + 'origin': instance.origin?.toJson(), + 'own_reactions': instance.ownReactions?.map( + (k, e) => MapEntry(k, e.map((e) => e.toJson()).toList()), + ), + 'reaction_counts': instance.reactionCounts, + 'score': instance.score, + 'target': instance.target?.toJson(), + 'to': instance.to, + 'verb': instance.verb, +}; diff --git a/packages/stream_chat/lib/open_api/model/enriched_reaction.dart b/packages/stream_chat/lib/open_api/model/enriched_reaction.dart new file mode 100644 index 0000000000..324e9ce048 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/enriched_reaction.dart @@ -0,0 +1,81 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'enriched_reaction.g.dart'; +part 'enriched_reaction.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class EnrichedReaction with _$EnrichedReaction { + const EnrichedReaction({ + required this.activityId, + this.childrenCounts, + this.data, + this.id, + required this.kind, + this.latestChildren, + this.ownChildren, + this.parent, + this.targetFeeds, + this.user, + required this.userId, + }); + + @override + @JsonKey(name: 'activity_id') + final String activityId; + + @override + @JsonKey(name: 'children_counts') + final Map? childrenCounts; + + @override + @JsonKey(name: 'data') + final Map? data; + + @override + @JsonKey(name: 'id') + final String? id; + + @override + @JsonKey(name: 'kind') + final String kind; + + @override + @JsonKey(name: 'latest_children') + final Map>? latestChildren; + + @override + @JsonKey(name: 'own_children') + final Map>? ownChildren; + + @override + @JsonKey(name: 'parent') + final String? parent; + + @override + @JsonKey(name: 'target_feeds') + final List? targetFeeds; + + @override + @JsonKey(name: 'user') + final Data? user; + + @override + @JsonKey(name: 'user_id') + final String userId; + + Map toJson() => _$EnrichedReactionToJson(this); + + static EnrichedReaction fromJson(Map json) => _$EnrichedReactionFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/enriched_reaction.freezed.dart b/packages/stream_chat/lib/open_api/model/enriched_reaction.freezed.dart new file mode 100644 index 0000000000..32a1cbf32b --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/enriched_reaction.freezed.dart @@ -0,0 +1,184 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'enriched_reaction.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$EnrichedReaction { + String get activityId; + Map? get childrenCounts; + Map? get data; + String? get id; + String get kind; + Map>? get latestChildren; + Map>? get ownChildren; + String? get parent; + List? get targetFeeds; + Data? get user; + String get userId; + + /// Create a copy of EnrichedReaction + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $EnrichedReactionCopyWith get copyWith => _$EnrichedReactionCopyWithImpl( + this as EnrichedReaction, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is EnrichedReaction && + (identical(other.activityId, activityId) || other.activityId == activityId) && + const DeepCollectionEquality().equals( + other.childrenCounts, + childrenCounts, + ) && + const DeepCollectionEquality().equals(other.data, data) && + (identical(other.id, id) || other.id == id) && + (identical(other.kind, kind) || other.kind == kind) && + const DeepCollectionEquality().equals( + other.latestChildren, + latestChildren, + ) && + const DeepCollectionEquality().equals( + other.ownChildren, + ownChildren, + ) && + (identical(other.parent, parent) || other.parent == parent) && + const DeepCollectionEquality().equals( + other.targetFeeds, + targetFeeds, + ) && + (identical(other.user, user) || other.user == user) && + (identical(other.userId, userId) || other.userId == userId)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + activityId, + const DeepCollectionEquality().hash(childrenCounts), + const DeepCollectionEquality().hash(data), + id, + kind, + const DeepCollectionEquality().hash(latestChildren), + const DeepCollectionEquality().hash(ownChildren), + parent, + const DeepCollectionEquality().hash(targetFeeds), + user, + userId, + ); + + @override + String toString() { + return 'EnrichedReaction(activityId: $activityId, childrenCounts: $childrenCounts, data: $data, id: $id, kind: $kind, latestChildren: $latestChildren, ownChildren: $ownChildren, parent: $parent, targetFeeds: $targetFeeds, user: $user, userId: $userId)'; + } +} + +/// @nodoc +abstract mixin class $EnrichedReactionCopyWith<$Res> { + factory $EnrichedReactionCopyWith( + EnrichedReaction value, + $Res Function(EnrichedReaction) _then, + ) = _$EnrichedReactionCopyWithImpl; + @useResult + $Res call({ + String activityId, + Map? childrenCounts, + Map? data, + String? id, + String kind, + Map>? latestChildren, + Map>? ownChildren, + String? parent, + List? targetFeeds, + Data? user, + String userId, + }); +} + +/// @nodoc +class _$EnrichedReactionCopyWithImpl<$Res> implements $EnrichedReactionCopyWith<$Res> { + _$EnrichedReactionCopyWithImpl(this._self, this._then); + + final EnrichedReaction _self; + final $Res Function(EnrichedReaction) _then; + + /// Create a copy of EnrichedReaction + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? activityId = null, + Object? childrenCounts = freezed, + Object? data = freezed, + Object? id = freezed, + Object? kind = null, + Object? latestChildren = freezed, + Object? ownChildren = freezed, + Object? parent = freezed, + Object? targetFeeds = freezed, + Object? user = freezed, + Object? userId = null, + }) { + return _then( + EnrichedReaction( + activityId: null == activityId + ? _self.activityId + : activityId // ignore: cast_nullable_to_non_nullable + as String, + childrenCounts: freezed == childrenCounts + ? _self.childrenCounts + : childrenCounts // ignore: cast_nullable_to_non_nullable + as Map?, + data: freezed == data + ? _self.data + : data // ignore: cast_nullable_to_non_nullable + as Map?, + id: freezed == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String?, + kind: null == kind + ? _self.kind + : kind // ignore: cast_nullable_to_non_nullable + as String, + latestChildren: freezed == latestChildren + ? _self.latestChildren + : latestChildren // ignore: cast_nullable_to_non_nullable + as Map>?, + ownChildren: freezed == ownChildren + ? _self.ownChildren + : ownChildren // ignore: cast_nullable_to_non_nullable + as Map>?, + parent: freezed == parent + ? _self.parent + : parent // ignore: cast_nullable_to_non_nullable + as String?, + targetFeeds: freezed == targetFeeds + ? _self.targetFeeds + : targetFeeds // ignore: cast_nullable_to_non_nullable + as List?, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as Data?, + userId: null == userId + ? _self.userId + : userId // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/enriched_reaction.g.dart b/packages/stream_chat/lib/open_api/model/enriched_reaction.g.dart new file mode 100644 index 0000000000..ce04edc694 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/enriched_reaction.g.dart @@ -0,0 +1,51 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'enriched_reaction.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +EnrichedReaction _$EnrichedReactionFromJson(Map json) => EnrichedReaction( + activityId: json['activity_id'] as String, + childrenCounts: (json['children_counts'] as Map?)?.map( + (k, e) => MapEntry(k, (e as num).toInt()), + ), + data: json['data'] as Map?, + id: json['id'] as String?, + kind: json['kind'] as String, + latestChildren: (json['latest_children'] as Map?)?.map( + (k, e) => MapEntry( + k, + (e as List).map((e) => EnrichedReaction.fromJson(e as Map)).toList(), + ), + ), + ownChildren: (json['own_children'] as Map?)?.map( + (k, e) => MapEntry( + k, + (e as List).map((e) => EnrichedReaction.fromJson(e as Map)).toList(), + ), + ), + parent: json['parent'] as String?, + targetFeeds: (json['target_feeds'] as List?)?.map((e) => e as String).toList(), + user: json['user'] == null ? null : Data.fromJson(json['user'] as Map), + userId: json['user_id'] as String, +); + +Map _$EnrichedReactionToJson(EnrichedReaction instance) => { + 'activity_id': instance.activityId, + 'children_counts': instance.childrenCounts, + 'data': instance.data, + 'id': instance.id, + 'kind': instance.kind, + 'latest_children': instance.latestChildren?.map( + (k, e) => MapEntry(k, e.map((e) => e.toJson()).toList()), + ), + 'own_children': instance.ownChildren?.map( + (k, e) => MapEntry(k, e.map((e) => e.toJson()).toList()), + ), + 'parent': instance.parent, + 'target_feeds': instance.targetFeeds, + 'user': instance.user?.toJson(), + 'user_id': instance.userId, +}; diff --git a/packages/stream_chat/lib/open_api/model/entity_creator_response.dart b/packages/stream_chat/lib/open_api/model/entity_creator_response.dart new file mode 100644 index 0000000000..5fc7b999d3 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/entity_creator_response.dart @@ -0,0 +1,137 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'entity_creator_response.g.dart'; +part 'entity_creator_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class EntityCreatorResponse with _$EntityCreatorResponse { + const EntityCreatorResponse({ + this.avgResponseTime, + required this.banCount, + required this.banned, + required this.blockedUserIds, + required this.createdAt, + required this.custom, + this.deactivatedAt, + this.deletedAt, + required this.deletedContentCount, + required this.flaggedCount, + required this.id, + this.image, + required this.language, + this.lastActive, + this.name, + required this.online, + this.revokeTokensIssuedBefore, + required this.role, + required this.teams, + this.teamsRole, + required this.updatedAt, + }); + + @override + @JsonKey(name: 'avg_response_time') + final int? avgResponseTime; + + @override + @JsonKey(name: 'ban_count') + final int banCount; + + @override + @JsonKey(name: 'banned') + final bool banned; + + @override + @JsonKey(name: 'blocked_user_ids') + final List blockedUserIds; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'deactivated_at') + final DateTime? deactivatedAt; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'deleted_at') + final DateTime? deletedAt; + + @override + @JsonKey(name: 'deleted_content_count') + final int deletedContentCount; + + @override + @JsonKey(name: 'flagged_count') + final int flaggedCount; + + @override + @JsonKey(name: 'id') + final String id; + + @override + @JsonKey(name: 'image') + final String? image; + + @override + @JsonKey(name: 'language') + final String language; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'last_active') + final DateTime? lastActive; + + @override + @JsonKey(name: 'name') + final String? name; + + @override + @JsonKey(name: 'online') + final bool online; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'revoke_tokens_issued_before') + final DateTime? revokeTokensIssuedBefore; + + @override + @JsonKey(name: 'role') + final String role; + + @override + @JsonKey(name: 'teams') + final List teams; + + @override + @JsonKey(name: 'teams_role') + final Map? teamsRole; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'updated_at') + final DateTime updatedAt; + + Map toJson() => _$EntityCreatorResponseToJson(this); + + static EntityCreatorResponse fromJson(Map json) => _$EntityCreatorResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/entity_creator_response.freezed.dart b/packages/stream_chat/lib/open_api/model/entity_creator_response.freezed.dart new file mode 100644 index 0000000000..c4f9050750 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/entity_creator_response.freezed.dart @@ -0,0 +1,271 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'entity_creator_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$EntityCreatorResponse { + int? get avgResponseTime; + int get banCount; + bool get banned; + List get blockedUserIds; + DateTime get createdAt; + Map get custom; + DateTime? get deactivatedAt; + DateTime? get deletedAt; + int get deletedContentCount; + int get flaggedCount; + String get id; + String? get image; + String get language; + DateTime? get lastActive; + String? get name; + bool get online; + DateTime? get revokeTokensIssuedBefore; + String get role; + List get teams; + Map? get teamsRole; + DateTime get updatedAt; + + /// Create a copy of EntityCreatorResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $EntityCreatorResponseCopyWith get copyWith => + _$EntityCreatorResponseCopyWithImpl( + this as EntityCreatorResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is EntityCreatorResponse && + (identical(other.avgResponseTime, avgResponseTime) || other.avgResponseTime == avgResponseTime) && + (identical(other.banCount, banCount) || other.banCount == banCount) && + (identical(other.banned, banned) || other.banned == banned) && + const DeepCollectionEquality().equals( + other.blockedUserIds, + blockedUserIds, + ) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.deactivatedAt, deactivatedAt) || other.deactivatedAt == deactivatedAt) && + (identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt) && + (identical(other.deletedContentCount, deletedContentCount) || + other.deletedContentCount == deletedContentCount) && + (identical(other.flaggedCount, flaggedCount) || other.flaggedCount == flaggedCount) && + (identical(other.id, id) || other.id == id) && + (identical(other.image, image) || other.image == image) && + (identical(other.language, language) || other.language == language) && + (identical(other.lastActive, lastActive) || other.lastActive == lastActive) && + (identical(other.name, name) || other.name == name) && + (identical(other.online, online) || other.online == online) && + (identical( + other.revokeTokensIssuedBefore, + revokeTokensIssuedBefore, + ) || + other.revokeTokensIssuedBefore == revokeTokensIssuedBefore) && + (identical(other.role, role) || other.role == role) && + const DeepCollectionEquality().equals(other.teams, teams) && + const DeepCollectionEquality().equals(other.teamsRole, teamsRole) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)); + } + + @override + int get hashCode => Object.hashAll([ + runtimeType, + avgResponseTime, + banCount, + banned, + const DeepCollectionEquality().hash(blockedUserIds), + createdAt, + const DeepCollectionEquality().hash(custom), + deactivatedAt, + deletedAt, + deletedContentCount, + flaggedCount, + id, + image, + language, + lastActive, + name, + online, + revokeTokensIssuedBefore, + role, + const DeepCollectionEquality().hash(teams), + const DeepCollectionEquality().hash(teamsRole), + updatedAt, + ]); + + @override + String toString() { + return 'EntityCreatorResponse(avgResponseTime: $avgResponseTime, banCount: $banCount, banned: $banned, blockedUserIds: $blockedUserIds, createdAt: $createdAt, custom: $custom, deactivatedAt: $deactivatedAt, deletedAt: $deletedAt, deletedContentCount: $deletedContentCount, flaggedCount: $flaggedCount, id: $id, image: $image, language: $language, lastActive: $lastActive, name: $name, online: $online, revokeTokensIssuedBefore: $revokeTokensIssuedBefore, role: $role, teams: $teams, teamsRole: $teamsRole, updatedAt: $updatedAt)'; + } +} + +/// @nodoc +abstract mixin class $EntityCreatorResponseCopyWith<$Res> { + factory $EntityCreatorResponseCopyWith( + EntityCreatorResponse value, + $Res Function(EntityCreatorResponse) _then, + ) = _$EntityCreatorResponseCopyWithImpl; + @useResult + $Res call({ + int? avgResponseTime, + int banCount, + bool banned, + List blockedUserIds, + DateTime createdAt, + Map custom, + DateTime? deactivatedAt, + DateTime? deletedAt, + int deletedContentCount, + int flaggedCount, + String id, + String? image, + String language, + DateTime? lastActive, + String? name, + bool online, + DateTime? revokeTokensIssuedBefore, + String role, + List teams, + Map? teamsRole, + DateTime updatedAt, + }); +} + +/// @nodoc +class _$EntityCreatorResponseCopyWithImpl<$Res> implements $EntityCreatorResponseCopyWith<$Res> { + _$EntityCreatorResponseCopyWithImpl(this._self, this._then); + + final EntityCreatorResponse _self; + final $Res Function(EntityCreatorResponse) _then; + + /// Create a copy of EntityCreatorResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? avgResponseTime = freezed, + Object? banCount = null, + Object? banned = null, + Object? blockedUserIds = null, + Object? createdAt = null, + Object? custom = null, + Object? deactivatedAt = freezed, + Object? deletedAt = freezed, + Object? deletedContentCount = null, + Object? flaggedCount = null, + Object? id = null, + Object? image = freezed, + Object? language = null, + Object? lastActive = freezed, + Object? name = freezed, + Object? online = null, + Object? revokeTokensIssuedBefore = freezed, + Object? role = null, + Object? teams = null, + Object? teamsRole = freezed, + Object? updatedAt = null, + }) { + return _then( + EntityCreatorResponse( + avgResponseTime: freezed == avgResponseTime + ? _self.avgResponseTime + : avgResponseTime // ignore: cast_nullable_to_non_nullable + as int?, + banCount: null == banCount + ? _self.banCount + : banCount // ignore: cast_nullable_to_non_nullable + as int, + banned: null == banned + ? _self.banned + : banned // ignore: cast_nullable_to_non_nullable + as bool, + blockedUserIds: null == blockedUserIds + ? _self.blockedUserIds + : blockedUserIds // ignore: cast_nullable_to_non_nullable + as List, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + deactivatedAt: freezed == deactivatedAt + ? _self.deactivatedAt + : deactivatedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + deletedAt: freezed == deletedAt + ? _self.deletedAt + : deletedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + deletedContentCount: null == deletedContentCount + ? _self.deletedContentCount + : deletedContentCount // ignore: cast_nullable_to_non_nullable + as int, + flaggedCount: null == flaggedCount + ? _self.flaggedCount + : flaggedCount // ignore: cast_nullable_to_non_nullable + as int, + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + image: freezed == image + ? _self.image + : image // ignore: cast_nullable_to_non_nullable + as String?, + language: null == language + ? _self.language + : language // ignore: cast_nullable_to_non_nullable + as String, + lastActive: freezed == lastActive + ? _self.lastActive + : lastActive // ignore: cast_nullable_to_non_nullable + as DateTime?, + name: freezed == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + online: null == online + ? _self.online + : online // ignore: cast_nullable_to_non_nullable + as bool, + revokeTokensIssuedBefore: freezed == revokeTokensIssuedBefore + ? _self.revokeTokensIssuedBefore + : revokeTokensIssuedBefore // ignore: cast_nullable_to_non_nullable + as DateTime?, + role: null == role + ? _self.role + : role // ignore: cast_nullable_to_non_nullable + as String, + teams: null == teams + ? _self.teams + : teams // ignore: cast_nullable_to_non_nullable + as List, + teamsRole: freezed == teamsRole + ? _self.teamsRole + : teamsRole // ignore: cast_nullable_to_non_nullable + as Map?, + updatedAt: null == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/entity_creator_response.g.dart b/packages/stream_chat/lib/open_api/model/entity_creator_response.g.dart new file mode 100644 index 0000000000..951a1ea533 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/entity_creator_response.g.dart @@ -0,0 +1,99 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'entity_creator_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +EntityCreatorResponse _$EntityCreatorResponseFromJson( + Map json, +) => EntityCreatorResponse( + avgResponseTime: (json['avg_response_time'] as num?)?.toInt(), + banCount: (json['ban_count'] as num).toInt(), + banned: json['banned'] as bool, + blockedUserIds: (json['blocked_user_ids'] as List).map((e) => e as String).toList(), + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + deactivatedAt: _$JsonConverterFromJson( + json['deactivated_at'], + const StreamDateTimeConverter().fromJson, + ), + deletedAt: _$JsonConverterFromJson( + json['deleted_at'], + const StreamDateTimeConverter().fromJson, + ), + deletedContentCount: (json['deleted_content_count'] as num).toInt(), + flaggedCount: (json['flagged_count'] as num).toInt(), + id: json['id'] as String, + image: json['image'] as String?, + language: json['language'] as String, + lastActive: _$JsonConverterFromJson( + json['last_active'], + const StreamDateTimeConverter().fromJson, + ), + name: json['name'] as String?, + online: json['online'] as bool, + revokeTokensIssuedBefore: _$JsonConverterFromJson( + json['revoke_tokens_issued_before'], + const StreamDateTimeConverter().fromJson, + ), + role: json['role'] as String, + teams: (json['teams'] as List).map((e) => e as String).toList(), + teamsRole: (json['teams_role'] as Map?)?.map( + (k, e) => MapEntry(k, e as String), + ), + updatedAt: const StreamDateTimeConverter().fromJson( + json['updated_at'] as Object, + ), +); + +Map _$EntityCreatorResponseToJson( + EntityCreatorResponse instance, +) => { + 'avg_response_time': instance.avgResponseTime, + 'ban_count': instance.banCount, + 'banned': instance.banned, + 'blocked_user_ids': instance.blockedUserIds, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'deactivated_at': _$JsonConverterToJson( + instance.deactivatedAt, + const StreamDateTimeConverter().toJson, + ), + 'deleted_at': _$JsonConverterToJson( + instance.deletedAt, + const StreamDateTimeConverter().toJson, + ), + 'deleted_content_count': instance.deletedContentCount, + 'flagged_count': instance.flaggedCount, + 'id': instance.id, + 'image': instance.image, + 'language': instance.language, + 'last_active': _$JsonConverterToJson( + instance.lastActive, + const StreamDateTimeConverter().toJson, + ), + 'name': instance.name, + 'online': instance.online, + 'revoke_tokens_issued_before': _$JsonConverterToJson( + instance.revokeTokensIssuedBefore, + const StreamDateTimeConverter().toJson, + ), + 'role': instance.role, + 'teams': instance.teams, + 'teams_role': instance.teamsRole, + 'updated_at': const StreamDateTimeConverter().toJson(instance.updatedAt), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/escalate_payload.dart b/packages/stream_chat/lib/open_api/model/escalate_payload.dart new file mode 100644 index 0000000000..39195a19c4 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/escalate_payload.dart @@ -0,0 +1,41 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'escalate_payload.g.dart'; +part 'escalate_payload.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class EscalatePayload with _$EscalatePayload { + const EscalatePayload({ + this.notes, + this.priority, + this.reason, + }); + + @override + @JsonKey(name: 'notes') + final String? notes; + + @override + @JsonKey(name: 'priority') + final String? priority; + + @override + @JsonKey(name: 'reason') + final String? reason; + + Map toJson() => _$EscalatePayloadToJson(this); + + static EscalatePayload fromJson(Map json) => _$EscalatePayloadFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/escalate_payload.freezed.dart b/packages/stream_chat/lib/open_api/model/escalate_payload.freezed.dart new file mode 100644 index 0000000000..712f27c9c4 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/escalate_payload.freezed.dart @@ -0,0 +1,91 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'escalate_payload.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$EscalatePayload { + String? get notes; + String? get priority; + String? get reason; + + /// Create a copy of EscalatePayload + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $EscalatePayloadCopyWith get copyWith => _$EscalatePayloadCopyWithImpl( + this as EscalatePayload, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is EscalatePayload && + (identical(other.notes, notes) || other.notes == notes) && + (identical(other.priority, priority) || other.priority == priority) && + (identical(other.reason, reason) || other.reason == reason)); + } + + @override + int get hashCode => Object.hash(runtimeType, notes, priority, reason); + + @override + String toString() { + return 'EscalatePayload(notes: $notes, priority: $priority, reason: $reason)'; + } +} + +/// @nodoc +abstract mixin class $EscalatePayloadCopyWith<$Res> { + factory $EscalatePayloadCopyWith( + EscalatePayload value, + $Res Function(EscalatePayload) _then, + ) = _$EscalatePayloadCopyWithImpl; + @useResult + $Res call({String? notes, String? priority, String? reason}); +} + +/// @nodoc +class _$EscalatePayloadCopyWithImpl<$Res> implements $EscalatePayloadCopyWith<$Res> { + _$EscalatePayloadCopyWithImpl(this._self, this._then); + + final EscalatePayload _self; + final $Res Function(EscalatePayload) _then; + + /// Create a copy of EscalatePayload + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? notes = freezed, + Object? priority = freezed, + Object? reason = freezed, + }) { + return _then( + EscalatePayload( + notes: freezed == notes + ? _self.notes + : notes // ignore: cast_nullable_to_non_nullable + as String?, + priority: freezed == priority + ? _self.priority + : priority // ignore: cast_nullable_to_non_nullable + as String?, + reason: freezed == reason + ? _self.reason + : reason // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/escalate_payload.g.dart b/packages/stream_chat/lib/open_api/model/escalate_payload.g.dart new file mode 100644 index 0000000000..8bb9f33755 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/escalate_payload.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'escalate_payload.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +EscalatePayload _$EscalatePayloadFromJson(Map json) => EscalatePayload( + notes: json['notes'] as String?, + priority: json['priority'] as String?, + reason: json['reason'] as String?, +); + +Map _$EscalatePayloadToJson(EscalatePayload instance) => { + 'notes': instance.notes, + 'priority': instance.priority, + 'reason': instance.reason, +}; diff --git a/packages/stream_chat/lib/open_api/model/escalation_metadata.dart b/packages/stream_chat/lib/open_api/model/escalation_metadata.dart new file mode 100644 index 0000000000..9cd638bff9 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/escalation_metadata.dart @@ -0,0 +1,41 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'escalation_metadata.g.dart'; +part 'escalation_metadata.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class EscalationMetadata with _$EscalationMetadata { + const EscalationMetadata({ + this.notes, + this.priority, + this.reason, + }); + + @override + @JsonKey(name: 'notes') + final String? notes; + + @override + @JsonKey(name: 'priority') + final String? priority; + + @override + @JsonKey(name: 'reason') + final String? reason; + + Map toJson() => _$EscalationMetadataToJson(this); + + static EscalationMetadata fromJson(Map json) => _$EscalationMetadataFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/escalation_metadata.freezed.dart b/packages/stream_chat/lib/open_api/model/escalation_metadata.freezed.dart new file mode 100644 index 0000000000..c056ad55c0 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/escalation_metadata.freezed.dart @@ -0,0 +1,91 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'escalation_metadata.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$EscalationMetadata { + String? get notes; + String? get priority; + String? get reason; + + /// Create a copy of EscalationMetadata + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $EscalationMetadataCopyWith get copyWith => _$EscalationMetadataCopyWithImpl( + this as EscalationMetadata, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is EscalationMetadata && + (identical(other.notes, notes) || other.notes == notes) && + (identical(other.priority, priority) || other.priority == priority) && + (identical(other.reason, reason) || other.reason == reason)); + } + + @override + int get hashCode => Object.hash(runtimeType, notes, priority, reason); + + @override + String toString() { + return 'EscalationMetadata(notes: $notes, priority: $priority, reason: $reason)'; + } +} + +/// @nodoc +abstract mixin class $EscalationMetadataCopyWith<$Res> { + factory $EscalationMetadataCopyWith( + EscalationMetadata value, + $Res Function(EscalationMetadata) _then, + ) = _$EscalationMetadataCopyWithImpl; + @useResult + $Res call({String? notes, String? priority, String? reason}); +} + +/// @nodoc +class _$EscalationMetadataCopyWithImpl<$Res> implements $EscalationMetadataCopyWith<$Res> { + _$EscalationMetadataCopyWithImpl(this._self, this._then); + + final EscalationMetadata _self; + final $Res Function(EscalationMetadata) _then; + + /// Create a copy of EscalationMetadata + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? notes = freezed, + Object? priority = freezed, + Object? reason = freezed, + }) { + return _then( + EscalationMetadata( + notes: freezed == notes + ? _self.notes + : notes // ignore: cast_nullable_to_non_nullable + as String?, + priority: freezed == priority + ? _self.priority + : priority // ignore: cast_nullable_to_non_nullable + as String?, + reason: freezed == reason + ? _self.reason + : reason // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/escalation_metadata.g.dart b/packages/stream_chat/lib/open_api/model/escalation_metadata.g.dart new file mode 100644 index 0000000000..c8a5848b64 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/escalation_metadata.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'escalation_metadata.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +EscalationMetadata _$EscalationMetadataFromJson(Map json) => EscalationMetadata( + notes: json['notes'] as String?, + priority: json['priority'] as String?, + reason: json['reason'] as String?, +); + +Map _$EscalationMetadataToJson(EscalationMetadata instance) => { + 'notes': instance.notes, + 'priority': instance.priority, + 'reason': instance.reason, +}; diff --git a/packages/stream_chat/lib/open_api/model/event_request.dart b/packages/stream_chat/lib/open_api/model/event_request.dart new file mode 100644 index 0000000000..a349d35da3 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/event_request.dart @@ -0,0 +1,41 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'event_request.g.dart'; +part 'event_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class EventRequest with _$EventRequest { + const EventRequest({ + this.custom, + this.parentId, + required this.type, + }); + + @override + @JsonKey(name: 'custom') + final Map? custom; + + @override + @JsonKey(name: 'parent_id') + final String? parentId; + + @override + @JsonKey(name: 'type') + final String type; + + Map toJson() => _$EventRequestToJson(this); + + static EventRequest fromJson(Map json) => _$EventRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/event_request.freezed.dart b/packages/stream_chat/lib/open_api/model/event_request.freezed.dart new file mode 100644 index 0000000000..212d6f88a4 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/event_request.freezed.dart @@ -0,0 +1,96 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'event_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$EventRequest { + Map? get custom; + String? get parentId; + String get type; + + /// Create a copy of EventRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $EventRequestCopyWith get copyWith => _$EventRequestCopyWithImpl( + this as EventRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is EventRequest && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.parentId, parentId) || other.parentId == parentId) && + (identical(other.type, type) || other.type == type)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(custom), + parentId, + type, + ); + + @override + String toString() { + return 'EventRequest(custom: $custom, parentId: $parentId, type: $type)'; + } +} + +/// @nodoc +abstract mixin class $EventRequestCopyWith<$Res> { + factory $EventRequestCopyWith( + EventRequest value, + $Res Function(EventRequest) _then, + ) = _$EventRequestCopyWithImpl; + @useResult + $Res call({Map? custom, String? parentId, String type}); +} + +/// @nodoc +class _$EventRequestCopyWithImpl<$Res> implements $EventRequestCopyWith<$Res> { + _$EventRequestCopyWithImpl(this._self, this._then); + + final EventRequest _self; + final $Res Function(EventRequest) _then; + + /// Create a copy of EventRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? custom = freezed, + Object? parentId = freezed, + Object? type = null, + }) { + return _then( + EventRequest( + custom: freezed == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map?, + parentId: freezed == parentId + ? _self.parentId + : parentId // ignore: cast_nullable_to_non_nullable + as String?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/event_request.g.dart b/packages/stream_chat/lib/open_api/model/event_request.g.dart new file mode 100644 index 0000000000..2b5c66e191 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/event_request.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'event_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +EventRequest _$EventRequestFromJson(Map json) => EventRequest( + custom: json['custom'] as Map?, + parentId: json['parent_id'] as String?, + type: json['type'] as String, +); + +Map _$EventRequestToJson(EventRequest instance) => { + 'custom': instance.custom, + 'parent_id': instance.parentId, + 'type': instance.type, +}; diff --git a/packages/stream_chat/lib/open_api/model/event_response.dart b/packages/stream_chat/lib/open_api/model/event_response.dart new file mode 100644 index 0000000000..080c46e9de --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/event_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'event_response.g.dart'; +part 'event_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class EventResponse with _$EventResponse { + const EventResponse({ + required this.duration, + required this.event, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'event', fromJson: wsEventFromJson, toJson: wsEventToJson) + final WSEvent event; + + Map toJson() => _$EventResponseToJson(this); + + static EventResponse fromJson(Map json) => _$EventResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/event_response.freezed.dart b/packages/stream_chat/lib/open_api/model/event_response.freezed.dart new file mode 100644 index 0000000000..d9d2c238b0 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/event_response.freezed.dart @@ -0,0 +1,81 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'event_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$EventResponse { + String get duration; + WSEvent get event; + + /// Create a copy of EventResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $EventResponseCopyWith get copyWith => _$EventResponseCopyWithImpl( + this as EventResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is EventResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.event, event) || other.event == event)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration, event); + + @override + String toString() { + return 'EventResponse(duration: $duration, event: $event)'; + } +} + +/// @nodoc +abstract mixin class $EventResponseCopyWith<$Res> { + factory $EventResponseCopyWith( + EventResponse value, + $Res Function(EventResponse) _then, + ) = _$EventResponseCopyWithImpl; + @useResult + $Res call({String duration, WSEvent event}); +} + +/// @nodoc +class _$EventResponseCopyWithImpl<$Res> implements $EventResponseCopyWith<$Res> { + _$EventResponseCopyWithImpl(this._self, this._then); + + final EventResponse _self; + final $Res Function(EventResponse) _then; + + /// Create a copy of EventResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? event = null}) { + return _then( + EventResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + event: null == event + ? _self.event + : event // ignore: cast_nullable_to_non_nullable + as WSEvent, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/event_response.g.dart b/packages/stream_chat/lib/open_api/model/event_response.g.dart new file mode 100644 index 0000000000..8f7872236a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/event_response.g.dart @@ -0,0 +1,17 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'event_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +EventResponse _$EventResponseFromJson(Map json) => EventResponse( + duration: json['duration'] as String, + event: wsEventFromJson(json['event'] as Map), +); + +Map _$EventResponseToJson(EventResponse instance) => { + 'duration': instance.duration, + 'event': wsEventToJson(instance.event), +}; diff --git a/packages/stream_chat/lib/open_api/model/feeds_activity_location.dart b/packages/stream_chat/lib/open_api/model/feeds_activity_location.dart new file mode 100644 index 0000000000..230aed947b --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/feeds_activity_location.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'feeds_activity_location.g.dart'; +part 'feeds_activity_location.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class FeedsActivityLocation with _$FeedsActivityLocation { + const FeedsActivityLocation({ + required this.lat, + required this.lng, + }); + + @override + @JsonKey(name: 'lat') + final double lat; + + @override + @JsonKey(name: 'lng') + final double lng; + + Map toJson() => _$FeedsActivityLocationToJson(this); + + static FeedsActivityLocation fromJson(Map json) => _$FeedsActivityLocationFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/feeds_activity_location.freezed.dart b/packages/stream_chat/lib/open_api/model/feeds_activity_location.freezed.dart new file mode 100644 index 0000000000..6a8f24f210 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/feeds_activity_location.freezed.dart @@ -0,0 +1,82 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'feeds_activity_location.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$FeedsActivityLocation { + double get lat; + double get lng; + + /// Create a copy of FeedsActivityLocation + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $FeedsActivityLocationCopyWith get copyWith => + _$FeedsActivityLocationCopyWithImpl( + this as FeedsActivityLocation, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is FeedsActivityLocation && + (identical(other.lat, lat) || other.lat == lat) && + (identical(other.lng, lng) || other.lng == lng)); + } + + @override + int get hashCode => Object.hash(runtimeType, lat, lng); + + @override + String toString() { + return 'FeedsActivityLocation(lat: $lat, lng: $lng)'; + } +} + +/// @nodoc +abstract mixin class $FeedsActivityLocationCopyWith<$Res> { + factory $FeedsActivityLocationCopyWith( + FeedsActivityLocation value, + $Res Function(FeedsActivityLocation) _then, + ) = _$FeedsActivityLocationCopyWithImpl; + @useResult + $Res call({double lat, double lng}); +} + +/// @nodoc +class _$FeedsActivityLocationCopyWithImpl<$Res> implements $FeedsActivityLocationCopyWith<$Res> { + _$FeedsActivityLocationCopyWithImpl(this._self, this._then); + + final FeedsActivityLocation _self; + final $Res Function(FeedsActivityLocation) _then; + + /// Create a copy of FeedsActivityLocation + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? lat = null, Object? lng = null}) { + return _then( + FeedsActivityLocation( + lat: null == lat + ? _self.lat + : lat // ignore: cast_nullable_to_non_nullable + as double, + lng: null == lng + ? _self.lng + : lng // ignore: cast_nullable_to_non_nullable + as double, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/feeds_activity_location.g.dart b/packages/stream_chat/lib/open_api/model/feeds_activity_location.g.dart new file mode 100644 index 0000000000..20e2e48236 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/feeds_activity_location.g.dart @@ -0,0 +1,18 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'feeds_activity_location.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +FeedsActivityLocation _$FeedsActivityLocationFromJson( + Map json, +) => FeedsActivityLocation( + lat: (json['lat'] as num).toDouble(), + lng: (json['lng'] as num).toDouble(), +); + +Map _$FeedsActivityLocationToJson( + FeedsActivityLocation instance, +) => {'lat': instance.lat, 'lng': instance.lng}; diff --git a/packages/stream_chat/lib/open_api/model/feeds_bookmark_response.dart b/packages/stream_chat/lib/open_api/model/feeds_bookmark_response.dart new file mode 100644 index 0000000000..bbd4fe4e81 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/feeds_bookmark_response.dart @@ -0,0 +1,63 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'feeds_bookmark_response.g.dart'; +part 'feeds_bookmark_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class FeedsBookmarkResponse with _$FeedsBookmarkResponse { + const FeedsBookmarkResponse({ + this.activityId, + required this.createdAt, + this.custom, + required this.objectId, + required this.objectType, + required this.updatedAt, + required this.user, + }); + + @override + @JsonKey(name: 'activity_id') + final String? activityId; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map? custom; + + @override + @JsonKey(name: 'object_id') + final String objectId; + + @override + @JsonKey(name: 'object_type') + final String objectType; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'updated_at') + final DateTime updatedAt; + + @override + @JsonKey(name: 'user') + final UserResponse user; + + Map toJson() => _$FeedsBookmarkResponseToJson(this); + + static FeedsBookmarkResponse fromJson(Map json) => _$FeedsBookmarkResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/feeds_bookmark_response.freezed.dart b/packages/stream_chat/lib/open_api/model/feeds_bookmark_response.freezed.dart new file mode 100644 index 0000000000..92102b54fa --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/feeds_bookmark_response.freezed.dart @@ -0,0 +1,137 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'feeds_bookmark_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$FeedsBookmarkResponse { + String? get activityId; + DateTime get createdAt; + Map? get custom; + String get objectId; + String get objectType; + DateTime get updatedAt; + UserResponse get user; + + /// Create a copy of FeedsBookmarkResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $FeedsBookmarkResponseCopyWith get copyWith => + _$FeedsBookmarkResponseCopyWithImpl( + this as FeedsBookmarkResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is FeedsBookmarkResponse && + (identical(other.activityId, activityId) || other.activityId == activityId) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.objectId, objectId) || other.objectId == objectId) && + (identical(other.objectType, objectType) || other.objectType == objectType) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + activityId, + createdAt, + const DeepCollectionEquality().hash(custom), + objectId, + objectType, + updatedAt, + user, + ); + + @override + String toString() { + return 'FeedsBookmarkResponse(activityId: $activityId, createdAt: $createdAt, custom: $custom, objectId: $objectId, objectType: $objectType, updatedAt: $updatedAt, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $FeedsBookmarkResponseCopyWith<$Res> { + factory $FeedsBookmarkResponseCopyWith( + FeedsBookmarkResponse value, + $Res Function(FeedsBookmarkResponse) _then, + ) = _$FeedsBookmarkResponseCopyWithImpl; + @useResult + $Res call({ + String? activityId, + DateTime createdAt, + Map? custom, + String objectId, + String objectType, + DateTime updatedAt, + UserResponse user, + }); +} + +/// @nodoc +class _$FeedsBookmarkResponseCopyWithImpl<$Res> implements $FeedsBookmarkResponseCopyWith<$Res> { + _$FeedsBookmarkResponseCopyWithImpl(this._self, this._then); + + final FeedsBookmarkResponse _self; + final $Res Function(FeedsBookmarkResponse) _then; + + /// Create a copy of FeedsBookmarkResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? activityId = freezed, + Object? createdAt = null, + Object? custom = freezed, + Object? objectId = null, + Object? objectType = null, + Object? updatedAt = null, + Object? user = null, + }) { + return _then( + FeedsBookmarkResponse( + activityId: freezed == activityId + ? _self.activityId + : activityId // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: freezed == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map?, + objectId: null == objectId + ? _self.objectId + : objectId // ignore: cast_nullable_to_non_nullable + as String, + objectType: null == objectType + ? _self.objectType + : objectType // ignore: cast_nullable_to_non_nullable + as String, + updatedAt: null == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + user: null == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponse, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/feeds_bookmark_response.g.dart b/packages/stream_chat/lib/open_api/model/feeds_bookmark_response.g.dart new file mode 100644 index 0000000000..f0c1f41c6f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/feeds_bookmark_response.g.dart @@ -0,0 +1,35 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'feeds_bookmark_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +FeedsBookmarkResponse _$FeedsBookmarkResponseFromJson( + Map json, +) => FeedsBookmarkResponse( + activityId: json['activity_id'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map?, + objectId: json['object_id'] as String, + objectType: json['object_type'] as String, + updatedAt: const StreamDateTimeConverter().fromJson( + json['updated_at'] as Object, + ), + user: UserResponse.fromJson(json['user'] as Map), +); + +Map _$FeedsBookmarkResponseToJson( + FeedsBookmarkResponse instance, +) => { + 'activity_id': instance.activityId, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'object_id': instance.objectId, + 'object_type': instance.objectType, + 'updated_at': const StreamDateTimeConverter().toJson(instance.updatedAt), + 'user': instance.user.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/feeds_enriched_collection_response.dart b/packages/stream_chat/lib/open_api/model/feeds_enriched_collection_response.dart new file mode 100644 index 0000000000..34a98030ec --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/feeds_enriched_collection_response.dart @@ -0,0 +1,64 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'feeds_enriched_collection_response.g.dart'; +part 'feeds_enriched_collection_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class FeedsEnrichedCollectionResponse with _$FeedsEnrichedCollectionResponse { + const FeedsEnrichedCollectionResponse({ + required this.createdAt, + required this.custom, + required this.id, + required this.name, + required this.status, + required this.updatedAt, + required this.userId, + }); + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'id') + final String id; + + @override + @JsonKey(name: 'name') + final String name; + + @override + @JsonKey(name: 'status') + final String status; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'updated_at') + final DateTime updatedAt; + + @override + @JsonKey(name: 'user_id') + final String userId; + + Map toJson() => _$FeedsEnrichedCollectionResponseToJson(this); + + static FeedsEnrichedCollectionResponse fromJson(Map json) => + _$FeedsEnrichedCollectionResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/feeds_enriched_collection_response.freezed.dart b/packages/stream_chat/lib/open_api/model/feeds_enriched_collection_response.freezed.dart new file mode 100644 index 0000000000..d82191fc13 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/feeds_enriched_collection_response.freezed.dart @@ -0,0 +1,137 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'feeds_enriched_collection_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$FeedsEnrichedCollectionResponse { + DateTime get createdAt; + Map get custom; + String get id; + String get name; + String get status; + DateTime get updatedAt; + String get userId; + + /// Create a copy of FeedsEnrichedCollectionResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $FeedsEnrichedCollectionResponseCopyWith get copyWith => + _$FeedsEnrichedCollectionResponseCopyWithImpl( + this as FeedsEnrichedCollectionResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is FeedsEnrichedCollectionResponse && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.id, id) || other.id == id) && + (identical(other.name, name) || other.name == name) && + (identical(other.status, status) || other.status == status) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt) && + (identical(other.userId, userId) || other.userId == userId)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + createdAt, + const DeepCollectionEquality().hash(custom), + id, + name, + status, + updatedAt, + userId, + ); + + @override + String toString() { + return 'FeedsEnrichedCollectionResponse(createdAt: $createdAt, custom: $custom, id: $id, name: $name, status: $status, updatedAt: $updatedAt, userId: $userId)'; + } +} + +/// @nodoc +abstract mixin class $FeedsEnrichedCollectionResponseCopyWith<$Res> { + factory $FeedsEnrichedCollectionResponseCopyWith( + FeedsEnrichedCollectionResponse value, + $Res Function(FeedsEnrichedCollectionResponse) _then, + ) = _$FeedsEnrichedCollectionResponseCopyWithImpl; + @useResult + $Res call({ + DateTime createdAt, + Map custom, + String id, + String name, + String status, + DateTime updatedAt, + String userId, + }); +} + +/// @nodoc +class _$FeedsEnrichedCollectionResponseCopyWithImpl<$Res> implements $FeedsEnrichedCollectionResponseCopyWith<$Res> { + _$FeedsEnrichedCollectionResponseCopyWithImpl(this._self, this._then); + + final FeedsEnrichedCollectionResponse _self; + final $Res Function(FeedsEnrichedCollectionResponse) _then; + + /// Create a copy of FeedsEnrichedCollectionResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? createdAt = null, + Object? custom = null, + Object? id = null, + Object? name = null, + Object? status = null, + Object? updatedAt = null, + Object? userId = null, + }) { + return _then( + FeedsEnrichedCollectionResponse( + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + status: null == status + ? _self.status + : status // ignore: cast_nullable_to_non_nullable + as String, + updatedAt: null == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + userId: null == userId + ? _self.userId + : userId // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/feeds_enriched_collection_response.g.dart b/packages/stream_chat/lib/open_api/model/feeds_enriched_collection_response.g.dart new file mode 100644 index 0000000000..4466092abf --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/feeds_enriched_collection_response.g.dart @@ -0,0 +1,35 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'feeds_enriched_collection_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +FeedsEnrichedCollectionResponse _$FeedsEnrichedCollectionResponseFromJson( + Map json, +) => FeedsEnrichedCollectionResponse( + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + id: json['id'] as String, + name: json['name'] as String, + status: json['status'] as String, + updatedAt: const StreamDateTimeConverter().fromJson( + json['updated_at'] as Object, + ), + userId: json['user_id'] as String, +); + +Map _$FeedsEnrichedCollectionResponseToJson( + FeedsEnrichedCollectionResponse instance, +) => { + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'id': instance.id, + 'name': instance.name, + 'status': instance.status, + 'updated_at': const StreamDateTimeConverter().toJson(instance.updatedAt), + 'user_id': instance.userId, +}; diff --git a/packages/stream_chat/lib/open_api/model/feeds_feed_response.dart b/packages/stream_chat/lib/open_api/model/feeds_feed_response.dart new file mode 100644 index 0000000000..4e6d1f4d4d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/feeds_feed_response.dart @@ -0,0 +1,119 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'feeds_feed_response.g.dart'; +part 'feeds_feed_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class FeedsFeedResponse with _$FeedsFeedResponse { + const FeedsFeedResponse({ + required this.activityCount, + required this.createdAt, + required this.createdBy, + this.custom, + this.deletedAt, + required this.description, + required this.feed, + this.filterTags, + required this.followerCount, + required this.followingCount, + required this.groupId, + required this.id, + this.location, + required this.memberCount, + required this.name, + required this.pinCount, + required this.updatedAt, + this.visibility, + }); + + @override + @JsonKey(name: 'activity_count') + final int activityCount; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'created_by') + final UserResponse createdBy; + + @override + @JsonKey(name: 'custom') + final Map? custom; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'deleted_at') + final DateTime? deletedAt; + + @override + @JsonKey(name: 'description') + final String description; + + @override + @JsonKey(name: 'feed') + final String feed; + + @override + @JsonKey(name: 'filter_tags') + final List? filterTags; + + @override + @JsonKey(name: 'follower_count') + final int followerCount; + + @override + @JsonKey(name: 'following_count') + final int followingCount; + + @override + @JsonKey(name: 'group_id') + final String groupId; + + @override + @JsonKey(name: 'id') + final String id; + + @override + @JsonKey(name: 'location') + final FeedsActivityLocation? location; + + @override + @JsonKey(name: 'member_count') + final int memberCount; + + @override + @JsonKey(name: 'name') + final String name; + + @override + @JsonKey(name: 'pin_count') + final int pinCount; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'updated_at') + final DateTime updatedAt; + + @override + @JsonKey(name: 'visibility') + final String? visibility; + + Map toJson() => _$FeedsFeedResponseToJson(this); + + static FeedsFeedResponse fromJson(Map json) => _$FeedsFeedResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/feeds_feed_response.freezed.dart b/packages/stream_chat/lib/open_api/model/feeds_feed_response.freezed.dart new file mode 100644 index 0000000000..992ac7e61f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/feeds_feed_response.freezed.dart @@ -0,0 +1,238 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'feeds_feed_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$FeedsFeedResponse { + int get activityCount; + DateTime get createdAt; + UserResponse get createdBy; + Map? get custom; + DateTime? get deletedAt; + String get description; + String get feed; + List? get filterTags; + int get followerCount; + int get followingCount; + String get groupId; + String get id; + FeedsActivityLocation? get location; + int get memberCount; + String get name; + int get pinCount; + DateTime get updatedAt; + String? get visibility; + + /// Create a copy of FeedsFeedResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $FeedsFeedResponseCopyWith get copyWith => _$FeedsFeedResponseCopyWithImpl( + this as FeedsFeedResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is FeedsFeedResponse && + (identical(other.activityCount, activityCount) || other.activityCount == activityCount) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.createdBy, createdBy) || other.createdBy == createdBy) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt) && + (identical(other.description, description) || other.description == description) && + (identical(other.feed, feed) || other.feed == feed) && + const DeepCollectionEquality().equals( + other.filterTags, + filterTags, + ) && + (identical(other.followerCount, followerCount) || other.followerCount == followerCount) && + (identical(other.followingCount, followingCount) || other.followingCount == followingCount) && + (identical(other.groupId, groupId) || other.groupId == groupId) && + (identical(other.id, id) || other.id == id) && + (identical(other.location, location) || other.location == location) && + (identical(other.memberCount, memberCount) || other.memberCount == memberCount) && + (identical(other.name, name) || other.name == name) && + (identical(other.pinCount, pinCount) || other.pinCount == pinCount) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt) && + (identical(other.visibility, visibility) || other.visibility == visibility)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + activityCount, + createdAt, + createdBy, + const DeepCollectionEquality().hash(custom), + deletedAt, + description, + feed, + const DeepCollectionEquality().hash(filterTags), + followerCount, + followingCount, + groupId, + id, + location, + memberCount, + name, + pinCount, + updatedAt, + visibility, + ); + + @override + String toString() { + return 'FeedsFeedResponse(activityCount: $activityCount, createdAt: $createdAt, createdBy: $createdBy, custom: $custom, deletedAt: $deletedAt, description: $description, feed: $feed, filterTags: $filterTags, followerCount: $followerCount, followingCount: $followingCount, groupId: $groupId, id: $id, location: $location, memberCount: $memberCount, name: $name, pinCount: $pinCount, updatedAt: $updatedAt, visibility: $visibility)'; + } +} + +/// @nodoc +abstract mixin class $FeedsFeedResponseCopyWith<$Res> { + factory $FeedsFeedResponseCopyWith( + FeedsFeedResponse value, + $Res Function(FeedsFeedResponse) _then, + ) = _$FeedsFeedResponseCopyWithImpl; + @useResult + $Res call({ + int activityCount, + DateTime createdAt, + UserResponse createdBy, + Map? custom, + DateTime? deletedAt, + String description, + String feed, + List? filterTags, + int followerCount, + int followingCount, + String groupId, + String id, + FeedsActivityLocation? location, + int memberCount, + String name, + int pinCount, + DateTime updatedAt, + String? visibility, + }); +} + +/// @nodoc +class _$FeedsFeedResponseCopyWithImpl<$Res> implements $FeedsFeedResponseCopyWith<$Res> { + _$FeedsFeedResponseCopyWithImpl(this._self, this._then); + + final FeedsFeedResponse _self; + final $Res Function(FeedsFeedResponse) _then; + + /// Create a copy of FeedsFeedResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? activityCount = null, + Object? createdAt = null, + Object? createdBy = null, + Object? custom = freezed, + Object? deletedAt = freezed, + Object? description = null, + Object? feed = null, + Object? filterTags = freezed, + Object? followerCount = null, + Object? followingCount = null, + Object? groupId = null, + Object? id = null, + Object? location = freezed, + Object? memberCount = null, + Object? name = null, + Object? pinCount = null, + Object? updatedAt = null, + Object? visibility = freezed, + }) { + return _then( + FeedsFeedResponse( + activityCount: null == activityCount + ? _self.activityCount + : activityCount // ignore: cast_nullable_to_non_nullable + as int, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + createdBy: null == createdBy + ? _self.createdBy + : createdBy // ignore: cast_nullable_to_non_nullable + as UserResponse, + custom: freezed == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map?, + deletedAt: freezed == deletedAt + ? _self.deletedAt + : deletedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + description: null == description + ? _self.description + : description // ignore: cast_nullable_to_non_nullable + as String, + feed: null == feed + ? _self.feed + : feed // ignore: cast_nullable_to_non_nullable + as String, + filterTags: freezed == filterTags + ? _self.filterTags + : filterTags // ignore: cast_nullable_to_non_nullable + as List?, + followerCount: null == followerCount + ? _self.followerCount + : followerCount // ignore: cast_nullable_to_non_nullable + as int, + followingCount: null == followingCount + ? _self.followingCount + : followingCount // ignore: cast_nullable_to_non_nullable + as int, + groupId: null == groupId + ? _self.groupId + : groupId // ignore: cast_nullable_to_non_nullable + as String, + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + location: freezed == location + ? _self.location + : location // ignore: cast_nullable_to_non_nullable + as FeedsActivityLocation?, + memberCount: null == memberCount + ? _self.memberCount + : memberCount // ignore: cast_nullable_to_non_nullable + as int, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + pinCount: null == pinCount + ? _self.pinCount + : pinCount // ignore: cast_nullable_to_non_nullable + as int, + updatedAt: null == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + visibility: freezed == visibility + ? _self.visibility + : visibility // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/feeds_feed_response.g.dart b/packages/stream_chat/lib/open_api/model/feeds_feed_response.g.dart new file mode 100644 index 0000000000..c4147d2b49 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/feeds_feed_response.g.dart @@ -0,0 +1,75 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'feeds_feed_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +FeedsFeedResponse _$FeedsFeedResponseFromJson(Map json) => FeedsFeedResponse( + activityCount: (json['activity_count'] as num).toInt(), + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + createdBy: UserResponse.fromJson( + json['created_by'] as Map, + ), + custom: json['custom'] as Map?, + deletedAt: _$JsonConverterFromJson( + json['deleted_at'], + const StreamDateTimeConverter().fromJson, + ), + description: json['description'] as String, + feed: json['feed'] as String, + filterTags: (json['filter_tags'] as List?)?.map((e) => e as String).toList(), + followerCount: (json['follower_count'] as num).toInt(), + followingCount: (json['following_count'] as num).toInt(), + groupId: json['group_id'] as String, + id: json['id'] as String, + location: json['location'] == null + ? null + : FeedsActivityLocation.fromJson( + json['location'] as Map, + ), + memberCount: (json['member_count'] as num).toInt(), + name: json['name'] as String, + pinCount: (json['pin_count'] as num).toInt(), + updatedAt: const StreamDateTimeConverter().fromJson( + json['updated_at'] as Object, + ), + visibility: json['visibility'] as String?, +); + +Map _$FeedsFeedResponseToJson(FeedsFeedResponse instance) => { + 'activity_count': instance.activityCount, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'created_by': instance.createdBy.toJson(), + 'custom': instance.custom, + 'deleted_at': _$JsonConverterToJson( + instance.deletedAt, + const StreamDateTimeConverter().toJson, + ), + 'description': instance.description, + 'feed': instance.feed, + 'filter_tags': instance.filterTags, + 'follower_count': instance.followerCount, + 'following_count': instance.followingCount, + 'group_id': instance.groupId, + 'id': instance.id, + 'location': instance.location?.toJson(), + 'member_count': instance.memberCount, + 'name': instance.name, + 'pin_count': instance.pinCount, + 'updated_at': const StreamDateTimeConverter().toJson(instance.updatedAt), + 'visibility': instance.visibility, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/feeds_notification_comment.dart b/packages/stream_chat/lib/open_api/model/feeds_notification_comment.dart new file mode 100644 index 0000000000..e22d56e3a9 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/feeds_notification_comment.dart @@ -0,0 +1,46 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'feeds_notification_comment.g.dart'; +part 'feeds_notification_comment.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class FeedsNotificationComment with _$FeedsNotificationComment { + const FeedsNotificationComment({ + this.attachments, + required this.comment, + required this.id, + required this.userId, + }); + + @override + @JsonKey(name: 'attachments') + final List? attachments; + + @override + @JsonKey(name: 'comment') + final String comment; + + @override + @JsonKey(name: 'id') + final String id; + + @override + @JsonKey(name: 'user_id') + final String userId; + + Map toJson() => _$FeedsNotificationCommentToJson(this); + + static FeedsNotificationComment fromJson(Map json) => _$FeedsNotificationCommentFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/feeds_notification_comment.freezed.dart b/packages/stream_chat/lib/open_api/model/feeds_notification_comment.freezed.dart new file mode 100644 index 0000000000..4201f03ca6 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/feeds_notification_comment.freezed.dart @@ -0,0 +1,113 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'feeds_notification_comment.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$FeedsNotificationComment { + List? get attachments; + String get comment; + String get id; + String get userId; + + /// Create a copy of FeedsNotificationComment + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $FeedsNotificationCommentCopyWith get copyWith => + _$FeedsNotificationCommentCopyWithImpl( + this as FeedsNotificationComment, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is FeedsNotificationComment && + const DeepCollectionEquality().equals( + other.attachments, + attachments, + ) && + (identical(other.comment, comment) || other.comment == comment) && + (identical(other.id, id) || other.id == id) && + (identical(other.userId, userId) || other.userId == userId)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(attachments), + comment, + id, + userId, + ); + + @override + String toString() { + return 'FeedsNotificationComment(attachments: $attachments, comment: $comment, id: $id, userId: $userId)'; + } +} + +/// @nodoc +abstract mixin class $FeedsNotificationCommentCopyWith<$Res> { + factory $FeedsNotificationCommentCopyWith( + FeedsNotificationComment value, + $Res Function(FeedsNotificationComment) _then, + ) = _$FeedsNotificationCommentCopyWithImpl; + @useResult + $Res call({ + List? attachments, + String comment, + String id, + String userId, + }); +} + +/// @nodoc +class _$FeedsNotificationCommentCopyWithImpl<$Res> implements $FeedsNotificationCommentCopyWith<$Res> { + _$FeedsNotificationCommentCopyWithImpl(this._self, this._then); + + final FeedsNotificationComment _self; + final $Res Function(FeedsNotificationComment) _then; + + /// Create a copy of FeedsNotificationComment + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? attachments = freezed, + Object? comment = null, + Object? id = null, + Object? userId = null, + }) { + return _then( + FeedsNotificationComment( + attachments: freezed == attachments + ? _self.attachments + : attachments // ignore: cast_nullable_to_non_nullable + as List?, + comment: null == comment + ? _self.comment + : comment // ignore: cast_nullable_to_non_nullable + as String, + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + userId: null == userId + ? _self.userId + : userId // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/feeds_notification_comment.g.dart b/packages/stream_chat/lib/open_api/model/feeds_notification_comment.g.dart new file mode 100644 index 0000000000..720c493e96 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/feeds_notification_comment.g.dart @@ -0,0 +1,27 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'feeds_notification_comment.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +FeedsNotificationComment _$FeedsNotificationCommentFromJson( + Map json, +) => FeedsNotificationComment( + attachments: (json['attachments'] as List?) + ?.map((e) => Attachment.fromJson(e as Map)) + .toList(), + comment: json['comment'] as String, + id: json['id'] as String, + userId: json['user_id'] as String, +); + +Map _$FeedsNotificationCommentToJson( + FeedsNotificationComment instance, +) => { + 'attachments': instance.attachments?.map((e) => e.toJson()).toList(), + 'comment': instance.comment, + 'id': instance.id, + 'user_id': instance.userId, +}; diff --git a/packages/stream_chat/lib/open_api/model/feeds_notification_context.dart b/packages/stream_chat/lib/open_api/model/feeds_notification_context.dart new file mode 100644 index 0000000000..fd2d42bc31 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/feeds_notification_context.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'feeds_notification_context.g.dart'; +part 'feeds_notification_context.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class FeedsNotificationContext with _$FeedsNotificationContext { + const FeedsNotificationContext({ + this.target, + this.trigger, + }); + + @override + @JsonKey(name: 'target') + final FeedsNotificationTarget? target; + + @override + @JsonKey(name: 'trigger') + final FeedsNotificationTrigger? trigger; + + Map toJson() => _$FeedsNotificationContextToJson(this); + + static FeedsNotificationContext fromJson(Map json) => _$FeedsNotificationContextFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/feeds_notification_context.freezed.dart b/packages/stream_chat/lib/open_api/model/feeds_notification_context.freezed.dart new file mode 100644 index 0000000000..741790930b --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/feeds_notification_context.freezed.dart @@ -0,0 +1,85 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'feeds_notification_context.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$FeedsNotificationContext { + FeedsNotificationTarget? get target; + FeedsNotificationTrigger? get trigger; + + /// Create a copy of FeedsNotificationContext + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $FeedsNotificationContextCopyWith get copyWith => + _$FeedsNotificationContextCopyWithImpl( + this as FeedsNotificationContext, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is FeedsNotificationContext && + (identical(other.target, target) || other.target == target) && + (identical(other.trigger, trigger) || other.trigger == trigger)); + } + + @override + int get hashCode => Object.hash(runtimeType, target, trigger); + + @override + String toString() { + return 'FeedsNotificationContext(target: $target, trigger: $trigger)'; + } +} + +/// @nodoc +abstract mixin class $FeedsNotificationContextCopyWith<$Res> { + factory $FeedsNotificationContextCopyWith( + FeedsNotificationContext value, + $Res Function(FeedsNotificationContext) _then, + ) = _$FeedsNotificationContextCopyWithImpl; + @useResult + $Res call({ + FeedsNotificationTarget? target, + FeedsNotificationTrigger? trigger, + }); +} + +/// @nodoc +class _$FeedsNotificationContextCopyWithImpl<$Res> implements $FeedsNotificationContextCopyWith<$Res> { + _$FeedsNotificationContextCopyWithImpl(this._self, this._then); + + final FeedsNotificationContext _self; + final $Res Function(FeedsNotificationContext) _then; + + /// Create a copy of FeedsNotificationContext + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? target = freezed, Object? trigger = freezed}) { + return _then( + FeedsNotificationContext( + target: freezed == target + ? _self.target + : target // ignore: cast_nullable_to_non_nullable + as FeedsNotificationTarget?, + trigger: freezed == trigger + ? _self.trigger + : trigger // ignore: cast_nullable_to_non_nullable + as FeedsNotificationTrigger?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/feeds_notification_context.g.dart b/packages/stream_chat/lib/open_api/model/feeds_notification_context.g.dart new file mode 100644 index 0000000000..9f6828b6f5 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/feeds_notification_context.g.dart @@ -0,0 +1,29 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'feeds_notification_context.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +FeedsNotificationContext _$FeedsNotificationContextFromJson( + Map json, +) => FeedsNotificationContext( + target: json['target'] == null + ? null + : FeedsNotificationTarget.fromJson( + json['target'] as Map, + ), + trigger: json['trigger'] == null + ? null + : FeedsNotificationTrigger.fromJson( + json['trigger'] as Map, + ), +); + +Map _$FeedsNotificationContextToJson( + FeedsNotificationContext instance, +) => { + 'target': instance.target?.toJson(), + 'trigger': instance.trigger?.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/feeds_notification_parent_activity.dart b/packages/stream_chat/lib/open_api/model/feeds_notification_parent_activity.dart new file mode 100644 index 0000000000..db07de0ba5 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/feeds_notification_parent_activity.dart @@ -0,0 +1,52 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'feeds_notification_parent_activity.g.dart'; +part 'feeds_notification_parent_activity.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class FeedsNotificationParentActivity with _$FeedsNotificationParentActivity { + const FeedsNotificationParentActivity({ + this.attachments, + required this.id, + this.text, + this.type, + this.userId, + }); + + @override + @JsonKey(name: 'attachments') + final List? attachments; + + @override + @JsonKey(name: 'id') + final String id; + + @override + @JsonKey(name: 'text') + final String? text; + + @override + @JsonKey(name: 'type') + final String? type; + + @override + @JsonKey(name: 'user_id') + final String? userId; + + Map toJson() => _$FeedsNotificationParentActivityToJson(this); + + static FeedsNotificationParentActivity fromJson(Map json) => + _$FeedsNotificationParentActivityFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/feeds_notification_parent_activity.freezed.dart b/packages/stream_chat/lib/open_api/model/feeds_notification_parent_activity.freezed.dart new file mode 100644 index 0000000000..b9a302d562 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/feeds_notification_parent_activity.freezed.dart @@ -0,0 +1,122 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'feeds_notification_parent_activity.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$FeedsNotificationParentActivity { + List? get attachments; + String get id; + String? get text; + String? get type; + String? get userId; + + /// Create a copy of FeedsNotificationParentActivity + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $FeedsNotificationParentActivityCopyWith get copyWith => + _$FeedsNotificationParentActivityCopyWithImpl( + this as FeedsNotificationParentActivity, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is FeedsNotificationParentActivity && + const DeepCollectionEquality().equals( + other.attachments, + attachments, + ) && + (identical(other.id, id) || other.id == id) && + (identical(other.text, text) || other.text == text) && + (identical(other.type, type) || other.type == type) && + (identical(other.userId, userId) || other.userId == userId)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(attachments), + id, + text, + type, + userId, + ); + + @override + String toString() { + return 'FeedsNotificationParentActivity(attachments: $attachments, id: $id, text: $text, type: $type, userId: $userId)'; + } +} + +/// @nodoc +abstract mixin class $FeedsNotificationParentActivityCopyWith<$Res> { + factory $FeedsNotificationParentActivityCopyWith( + FeedsNotificationParentActivity value, + $Res Function(FeedsNotificationParentActivity) _then, + ) = _$FeedsNotificationParentActivityCopyWithImpl; + @useResult + $Res call({ + List? attachments, + String id, + String? text, + String? type, + String? userId, + }); +} + +/// @nodoc +class _$FeedsNotificationParentActivityCopyWithImpl<$Res> implements $FeedsNotificationParentActivityCopyWith<$Res> { + _$FeedsNotificationParentActivityCopyWithImpl(this._self, this._then); + + final FeedsNotificationParentActivity _self; + final $Res Function(FeedsNotificationParentActivity) _then; + + /// Create a copy of FeedsNotificationParentActivity + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? attachments = freezed, + Object? id = null, + Object? text = freezed, + Object? type = freezed, + Object? userId = freezed, + }) { + return _then( + FeedsNotificationParentActivity( + attachments: freezed == attachments + ? _self.attachments + : attachments // ignore: cast_nullable_to_non_nullable + as List?, + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + text: freezed == text + ? _self.text + : text // ignore: cast_nullable_to_non_nullable + as String?, + type: freezed == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String?, + userId: freezed == userId + ? _self.userId + : userId // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/feeds_notification_parent_activity.g.dart b/packages/stream_chat/lib/open_api/model/feeds_notification_parent_activity.g.dart new file mode 100644 index 0000000000..14816a0861 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/feeds_notification_parent_activity.g.dart @@ -0,0 +1,29 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'feeds_notification_parent_activity.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +FeedsNotificationParentActivity _$FeedsNotificationParentActivityFromJson( + Map json, +) => FeedsNotificationParentActivity( + attachments: (json['attachments'] as List?) + ?.map((e) => Attachment.fromJson(e as Map)) + .toList(), + id: json['id'] as String, + text: json['text'] as String?, + type: json['type'] as String?, + userId: json['user_id'] as String?, +); + +Map _$FeedsNotificationParentActivityToJson( + FeedsNotificationParentActivity instance, +) => { + 'attachments': instance.attachments?.map((e) => e.toJson()).toList(), + 'id': instance.id, + 'text': instance.text, + 'type': instance.type, + 'user_id': instance.userId, +}; diff --git a/packages/stream_chat/lib/open_api/model/feeds_notification_target.dart b/packages/stream_chat/lib/open_api/model/feeds_notification_target.dart new file mode 100644 index 0000000000..cbffa044ec --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/feeds_notification_target.dart @@ -0,0 +1,71 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'feeds_notification_target.g.dart'; +part 'feeds_notification_target.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class FeedsNotificationTarget with _$FeedsNotificationTarget { + const FeedsNotificationTarget({ + this.attachments, + this.comment, + this.custom, + required this.id, + this.name, + this.parentActivity, + this.text, + this.type, + this.userId, + }); + + @override + @JsonKey(name: 'attachments') + final List? attachments; + + @override + @JsonKey(name: 'comment') + final FeedsNotificationComment? comment; + + @override + @JsonKey(name: 'custom') + final Map? custom; + + @override + @JsonKey(name: 'id') + final String id; + + @override + @JsonKey(name: 'name') + final String? name; + + @override + @JsonKey(name: 'parent_activity') + final FeedsNotificationParentActivity? parentActivity; + + @override + @JsonKey(name: 'text') + final String? text; + + @override + @JsonKey(name: 'type') + final String? type; + + @override + @JsonKey(name: 'user_id') + final String? userId; + + Map toJson() => _$FeedsNotificationTargetToJson(this); + + static FeedsNotificationTarget fromJson(Map json) => _$FeedsNotificationTargetFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/feeds_notification_target.freezed.dart b/packages/stream_chat/lib/open_api/model/feeds_notification_target.freezed.dart new file mode 100644 index 0000000000..7d5d9cc14e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/feeds_notification_target.freezed.dart @@ -0,0 +1,158 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'feeds_notification_target.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$FeedsNotificationTarget { + List? get attachments; + FeedsNotificationComment? get comment; + Map? get custom; + String get id; + String? get name; + FeedsNotificationParentActivity? get parentActivity; + String? get text; + String? get type; + String? get userId; + + /// Create a copy of FeedsNotificationTarget + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $FeedsNotificationTargetCopyWith get copyWith => + _$FeedsNotificationTargetCopyWithImpl( + this as FeedsNotificationTarget, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is FeedsNotificationTarget && + const DeepCollectionEquality().equals( + other.attachments, + attachments, + ) && + (identical(other.comment, comment) || other.comment == comment) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.id, id) || other.id == id) && + (identical(other.name, name) || other.name == name) && + (identical(other.parentActivity, parentActivity) || other.parentActivity == parentActivity) && + (identical(other.text, text) || other.text == text) && + (identical(other.type, type) || other.type == type) && + (identical(other.userId, userId) || other.userId == userId)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(attachments), + comment, + const DeepCollectionEquality().hash(custom), + id, + name, + parentActivity, + text, + type, + userId, + ); + + @override + String toString() { + return 'FeedsNotificationTarget(attachments: $attachments, comment: $comment, custom: $custom, id: $id, name: $name, parentActivity: $parentActivity, text: $text, type: $type, userId: $userId)'; + } +} + +/// @nodoc +abstract mixin class $FeedsNotificationTargetCopyWith<$Res> { + factory $FeedsNotificationTargetCopyWith( + FeedsNotificationTarget value, + $Res Function(FeedsNotificationTarget) _then, + ) = _$FeedsNotificationTargetCopyWithImpl; + @useResult + $Res call({ + List? attachments, + FeedsNotificationComment? comment, + Map? custom, + String id, + String? name, + FeedsNotificationParentActivity? parentActivity, + String? text, + String? type, + String? userId, + }); +} + +/// @nodoc +class _$FeedsNotificationTargetCopyWithImpl<$Res> implements $FeedsNotificationTargetCopyWith<$Res> { + _$FeedsNotificationTargetCopyWithImpl(this._self, this._then); + + final FeedsNotificationTarget _self; + final $Res Function(FeedsNotificationTarget) _then; + + /// Create a copy of FeedsNotificationTarget + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? attachments = freezed, + Object? comment = freezed, + Object? custom = freezed, + Object? id = null, + Object? name = freezed, + Object? parentActivity = freezed, + Object? text = freezed, + Object? type = freezed, + Object? userId = freezed, + }) { + return _then( + FeedsNotificationTarget( + attachments: freezed == attachments + ? _self.attachments + : attachments // ignore: cast_nullable_to_non_nullable + as List?, + comment: freezed == comment + ? _self.comment + : comment // ignore: cast_nullable_to_non_nullable + as FeedsNotificationComment?, + custom: freezed == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map?, + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + name: freezed == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + parentActivity: freezed == parentActivity + ? _self.parentActivity + : parentActivity // ignore: cast_nullable_to_non_nullable + as FeedsNotificationParentActivity?, + text: freezed == text + ? _self.text + : text // ignore: cast_nullable_to_non_nullable + as String?, + type: freezed == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String?, + userId: freezed == userId + ? _self.userId + : userId // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/feeds_notification_target.g.dart b/packages/stream_chat/lib/open_api/model/feeds_notification_target.g.dart new file mode 100644 index 0000000000..3a68242481 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/feeds_notification_target.g.dart @@ -0,0 +1,45 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'feeds_notification_target.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +FeedsNotificationTarget _$FeedsNotificationTargetFromJson( + Map json, +) => FeedsNotificationTarget( + attachments: (json['attachments'] as List?) + ?.map((e) => Attachment.fromJson(e as Map)) + .toList(), + comment: json['comment'] == null + ? null + : FeedsNotificationComment.fromJson( + json['comment'] as Map, + ), + custom: json['custom'] as Map?, + id: json['id'] as String, + name: json['name'] as String?, + parentActivity: json['parent_activity'] == null + ? null + : FeedsNotificationParentActivity.fromJson( + json['parent_activity'] as Map, + ), + text: json['text'] as String?, + type: json['type'] as String?, + userId: json['user_id'] as String?, +); + +Map _$FeedsNotificationTargetToJson( + FeedsNotificationTarget instance, +) => { + 'attachments': instance.attachments?.map((e) => e.toJson()).toList(), + 'comment': instance.comment?.toJson(), + 'custom': instance.custom, + 'id': instance.id, + 'name': instance.name, + 'parent_activity': instance.parentActivity?.toJson(), + 'text': instance.text, + 'type': instance.type, + 'user_id': instance.userId, +}; diff --git a/packages/stream_chat/lib/open_api/model/feeds_notification_trigger.dart b/packages/stream_chat/lib/open_api/model/feeds_notification_trigger.dart new file mode 100644 index 0000000000..9ca94b00f4 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/feeds_notification_trigger.dart @@ -0,0 +1,46 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'feeds_notification_trigger.g.dart'; +part 'feeds_notification_trigger.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class FeedsNotificationTrigger with _$FeedsNotificationTrigger { + const FeedsNotificationTrigger({ + this.comment, + this.custom, + required this.text, + required this.type, + }); + + @override + @JsonKey(name: 'comment') + final FeedsNotificationComment? comment; + + @override + @JsonKey(name: 'custom') + final Map? custom; + + @override + @JsonKey(name: 'text') + final String text; + + @override + @JsonKey(name: 'type') + final String type; + + Map toJson() => _$FeedsNotificationTriggerToJson(this); + + static FeedsNotificationTrigger fromJson(Map json) => _$FeedsNotificationTriggerFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/feeds_notification_trigger.freezed.dart b/packages/stream_chat/lib/open_api/model/feeds_notification_trigger.freezed.dart new file mode 100644 index 0000000000..82e9e5d612 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/feeds_notification_trigger.freezed.dart @@ -0,0 +1,110 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'feeds_notification_trigger.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$FeedsNotificationTrigger { + FeedsNotificationComment? get comment; + Map? get custom; + String get text; + String get type; + + /// Create a copy of FeedsNotificationTrigger + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $FeedsNotificationTriggerCopyWith get copyWith => + _$FeedsNotificationTriggerCopyWithImpl( + this as FeedsNotificationTrigger, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is FeedsNotificationTrigger && + (identical(other.comment, comment) || other.comment == comment) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.text, text) || other.text == text) && + (identical(other.type, type) || other.type == type)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + comment, + const DeepCollectionEquality().hash(custom), + text, + type, + ); + + @override + String toString() { + return 'FeedsNotificationTrigger(comment: $comment, custom: $custom, text: $text, type: $type)'; + } +} + +/// @nodoc +abstract mixin class $FeedsNotificationTriggerCopyWith<$Res> { + factory $FeedsNotificationTriggerCopyWith( + FeedsNotificationTrigger value, + $Res Function(FeedsNotificationTrigger) _then, + ) = _$FeedsNotificationTriggerCopyWithImpl; + @useResult + $Res call({ + FeedsNotificationComment? comment, + Map? custom, + String text, + String type, + }); +} + +/// @nodoc +class _$FeedsNotificationTriggerCopyWithImpl<$Res> implements $FeedsNotificationTriggerCopyWith<$Res> { + _$FeedsNotificationTriggerCopyWithImpl(this._self, this._then); + + final FeedsNotificationTrigger _self; + final $Res Function(FeedsNotificationTrigger) _then; + + /// Create a copy of FeedsNotificationTrigger + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? comment = freezed, + Object? custom = freezed, + Object? text = null, + Object? type = null, + }) { + return _then( + FeedsNotificationTrigger( + comment: freezed == comment + ? _self.comment + : comment // ignore: cast_nullable_to_non_nullable + as FeedsNotificationComment?, + custom: freezed == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map?, + text: null == text + ? _self.text + : text // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/feeds_notification_trigger.g.dart b/packages/stream_chat/lib/open_api/model/feeds_notification_trigger.g.dart new file mode 100644 index 0000000000..58bb9b55df --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/feeds_notification_trigger.g.dart @@ -0,0 +1,29 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'feeds_notification_trigger.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +FeedsNotificationTrigger _$FeedsNotificationTriggerFromJson( + Map json, +) => FeedsNotificationTrigger( + comment: json['comment'] == null + ? null + : FeedsNotificationComment.fromJson( + json['comment'] as Map, + ), + custom: json['custom'] as Map?, + text: json['text'] as String, + type: json['type'] as String, +); + +Map _$FeedsNotificationTriggerToJson( + FeedsNotificationTrigger instance, +) => { + 'comment': instance.comment?.toJson(), + 'custom': instance.custom, + 'text': instance.text, + 'type': instance.type, +}; diff --git a/packages/stream_chat/lib/open_api/model/feeds_preferences.dart b/packages/stream_chat/lib/open_api/model/feeds_preferences.dart new file mode 100644 index 0000000000..750f87f94a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/feeds_preferences.dart @@ -0,0 +1,129 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'feeds_preferences.g.dart'; +part 'feeds_preferences.freezed.dart'; + +extension type const FeedsPreferencesComment._(String _) implements String { + static const all = FeedsPreferencesComment._('all'); + static const none = FeedsPreferencesComment._('none'); + + factory FeedsPreferencesComment.fromJson(String json) => FeedsPreferencesComment._(json); + + String toJson() => this; +} + +extension type const FeedsPreferencesCommentMention._(String _) implements String { + static const all = FeedsPreferencesCommentMention._('all'); + static const none = FeedsPreferencesCommentMention._('none'); + + factory FeedsPreferencesCommentMention.fromJson(String json) => FeedsPreferencesCommentMention._(json); + + String toJson() => this; +} + +extension type const FeedsPreferencesCommentReaction._(String _) implements String { + static const all = FeedsPreferencesCommentReaction._('all'); + static const none = FeedsPreferencesCommentReaction._('none'); + + factory FeedsPreferencesCommentReaction.fromJson(String json) => FeedsPreferencesCommentReaction._(json); + + String toJson() => this; +} + +extension type const FeedsPreferencesCommentReply._(String _) implements String { + static const all = FeedsPreferencesCommentReply._('all'); + static const none = FeedsPreferencesCommentReply._('none'); + + factory FeedsPreferencesCommentReply.fromJson(String json) => FeedsPreferencesCommentReply._(json); + + String toJson() => this; +} + +extension type const FeedsPreferencesFollow._(String _) implements String { + static const all = FeedsPreferencesFollow._('all'); + static const none = FeedsPreferencesFollow._('none'); + + factory FeedsPreferencesFollow.fromJson(String json) => FeedsPreferencesFollow._(json); + + String toJson() => this; +} + +extension type const FeedsPreferencesMention._(String _) implements String { + static const all = FeedsPreferencesMention._('all'); + static const none = FeedsPreferencesMention._('none'); + + factory FeedsPreferencesMention.fromJson(String json) => FeedsPreferencesMention._(json); + + String toJson() => this; +} + +extension type const FeedsPreferencesReaction._(String _) implements String { + static const all = FeedsPreferencesReaction._('all'); + static const none = FeedsPreferencesReaction._('none'); + + factory FeedsPreferencesReaction.fromJson(String json) => FeedsPreferencesReaction._(json); + + String toJson() => this; +} + +@freezed +@immutable +@JsonSerializable() +class FeedsPreferences with _$FeedsPreferences { + const FeedsPreferences({ + this.comment, + this.commentMention, + this.commentReaction, + this.commentReply, + this.customActivityTypes, + this.follow, + this.mention, + this.reaction, + }); + + @override + @JsonKey(name: 'comment') + final FeedsPreferencesComment? comment; + + @override + @JsonKey(name: 'comment_mention') + final FeedsPreferencesCommentMention? commentMention; + + @override + @JsonKey(name: 'comment_reaction') + final FeedsPreferencesCommentReaction? commentReaction; + + @override + @JsonKey(name: 'comment_reply') + final FeedsPreferencesCommentReply? commentReply; + + @override + @JsonKey(name: 'custom_activity_types') + final Map? customActivityTypes; + + @override + @JsonKey(name: 'follow') + final FeedsPreferencesFollow? follow; + + @override + @JsonKey(name: 'mention') + final FeedsPreferencesMention? mention; + + @override + @JsonKey(name: 'reaction') + final FeedsPreferencesReaction? reaction; + + Map toJson() => _$FeedsPreferencesToJson(this); + + static FeedsPreferences fromJson(Map json) => _$FeedsPreferencesFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/feeds_preferences.freezed.dart b/packages/stream_chat/lib/open_api/model/feeds_preferences.freezed.dart new file mode 100644 index 0000000000..9a758f744f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/feeds_preferences.freezed.dart @@ -0,0 +1,148 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'feeds_preferences.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$FeedsPreferences { + FeedsPreferencesComment? get comment; + FeedsPreferencesCommentMention? get commentMention; + FeedsPreferencesCommentReaction? get commentReaction; + FeedsPreferencesCommentReply? get commentReply; + Map? get customActivityTypes; + FeedsPreferencesFollow? get follow; + FeedsPreferencesMention? get mention; + FeedsPreferencesReaction? get reaction; + + /// Create a copy of FeedsPreferences + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $FeedsPreferencesCopyWith get copyWith => _$FeedsPreferencesCopyWithImpl( + this as FeedsPreferences, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is FeedsPreferences && + (identical(other.comment, comment) || other.comment == comment) && + (identical(other.commentMention, commentMention) || other.commentMention == commentMention) && + (identical(other.commentReaction, commentReaction) || other.commentReaction == commentReaction) && + (identical(other.commentReply, commentReply) || other.commentReply == commentReply) && + const DeepCollectionEquality().equals( + other.customActivityTypes, + customActivityTypes, + ) && + (identical(other.follow, follow) || other.follow == follow) && + (identical(other.mention, mention) || other.mention == mention) && + (identical(other.reaction, reaction) || other.reaction == reaction)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + comment, + commentMention, + commentReaction, + commentReply, + const DeepCollectionEquality().hash(customActivityTypes), + follow, + mention, + reaction, + ); + + @override + String toString() { + return 'FeedsPreferences(comment: $comment, commentMention: $commentMention, commentReaction: $commentReaction, commentReply: $commentReply, customActivityTypes: $customActivityTypes, follow: $follow, mention: $mention, reaction: $reaction)'; + } +} + +/// @nodoc +abstract mixin class $FeedsPreferencesCopyWith<$Res> { + factory $FeedsPreferencesCopyWith( + FeedsPreferences value, + $Res Function(FeedsPreferences) _then, + ) = _$FeedsPreferencesCopyWithImpl; + @useResult + $Res call({ + FeedsPreferencesComment? comment, + FeedsPreferencesCommentMention? commentMention, + FeedsPreferencesCommentReaction? commentReaction, + FeedsPreferencesCommentReply? commentReply, + Map? customActivityTypes, + FeedsPreferencesFollow? follow, + FeedsPreferencesMention? mention, + FeedsPreferencesReaction? reaction, + }); +} + +/// @nodoc +class _$FeedsPreferencesCopyWithImpl<$Res> implements $FeedsPreferencesCopyWith<$Res> { + _$FeedsPreferencesCopyWithImpl(this._self, this._then); + + final FeedsPreferences _self; + final $Res Function(FeedsPreferences) _then; + + /// Create a copy of FeedsPreferences + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? comment = freezed, + Object? commentMention = freezed, + Object? commentReaction = freezed, + Object? commentReply = freezed, + Object? customActivityTypes = freezed, + Object? follow = freezed, + Object? mention = freezed, + Object? reaction = freezed, + }) { + return _then( + FeedsPreferences( + comment: freezed == comment + ? _self.comment + : comment // ignore: cast_nullable_to_non_nullable + as FeedsPreferencesComment?, + commentMention: freezed == commentMention + ? _self.commentMention + : commentMention // ignore: cast_nullable_to_non_nullable + as FeedsPreferencesCommentMention?, + commentReaction: freezed == commentReaction + ? _self.commentReaction + : commentReaction // ignore: cast_nullable_to_non_nullable + as FeedsPreferencesCommentReaction?, + commentReply: freezed == commentReply + ? _self.commentReply + : commentReply // ignore: cast_nullable_to_non_nullable + as FeedsPreferencesCommentReply?, + customActivityTypes: freezed == customActivityTypes + ? _self.customActivityTypes + : customActivityTypes // ignore: cast_nullable_to_non_nullable + as Map?, + follow: freezed == follow + ? _self.follow + : follow // ignore: cast_nullable_to_non_nullable + as FeedsPreferencesFollow?, + mention: freezed == mention + ? _self.mention + : mention // ignore: cast_nullable_to_non_nullable + as FeedsPreferencesMention?, + reaction: freezed == reaction + ? _self.reaction + : reaction // ignore: cast_nullable_to_non_nullable + as FeedsPreferencesReaction?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/feeds_preferences.g.dart b/packages/stream_chat/lib/open_api/model/feeds_preferences.g.dart new file mode 100644 index 0000000000..64172d519e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/feeds_preferences.g.dart @@ -0,0 +1,43 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'feeds_preferences.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +FeedsPreferences _$FeedsPreferencesFromJson( + Map json, +) => FeedsPreferences( + comment: json['comment'] == null ? null : FeedsPreferencesComment.fromJson(json['comment'] as String), + commentMention: json['comment_mention'] == null + ? null + : FeedsPreferencesCommentMention.fromJson( + json['comment_mention'] as String, + ), + commentReaction: json['comment_reaction'] == null + ? null + : FeedsPreferencesCommentReaction.fromJson( + json['comment_reaction'] as String, + ), + commentReply: json['comment_reply'] == null + ? null + : FeedsPreferencesCommentReply.fromJson(json['comment_reply'] as String), + customActivityTypes: (json['custom_activity_types'] as Map?)?.map( + (k, e) => MapEntry(k, e as String), + ), + follow: json['follow'] == null ? null : FeedsPreferencesFollow.fromJson(json['follow'] as String), + mention: json['mention'] == null ? null : FeedsPreferencesMention.fromJson(json['mention'] as String), + reaction: json['reaction'] == null ? null : FeedsPreferencesReaction.fromJson(json['reaction'] as String), +); + +Map _$FeedsPreferencesToJson(FeedsPreferences instance) => { + 'comment': instance.comment?.toJson(), + 'comment_mention': instance.commentMention?.toJson(), + 'comment_reaction': instance.commentReaction?.toJson(), + 'comment_reply': instance.commentReply?.toJson(), + 'custom_activity_types': instance.customActivityTypes, + 'follow': instance.follow?.toJson(), + 'mention': instance.mention?.toJson(), + 'reaction': instance.reaction?.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/feeds_preferences_response.dart b/packages/stream_chat/lib/open_api/model/feeds_preferences_response.dart new file mode 100644 index 0000000000..82cf1e74b1 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/feeds_preferences_response.dart @@ -0,0 +1,66 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'feeds_preferences_response.g.dart'; +part 'feeds_preferences_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class FeedsPreferencesResponse with _$FeedsPreferencesResponse { + const FeedsPreferencesResponse({ + this.comment, + this.commentMention, + this.commentReaction, + this.commentReply, + this.customActivityTypes, + this.follow, + this.mention, + this.reaction, + }); + + @override + @JsonKey(name: 'comment') + final String? comment; + + @override + @JsonKey(name: 'comment_mention') + final String? commentMention; + + @override + @JsonKey(name: 'comment_reaction') + final String? commentReaction; + + @override + @JsonKey(name: 'comment_reply') + final String? commentReply; + + @override + @JsonKey(name: 'custom_activity_types') + final Map? customActivityTypes; + + @override + @JsonKey(name: 'follow') + final String? follow; + + @override + @JsonKey(name: 'mention') + final String? mention; + + @override + @JsonKey(name: 'reaction') + final String? reaction; + + Map toJson() => _$FeedsPreferencesResponseToJson(this); + + static FeedsPreferencesResponse fromJson(Map json) => _$FeedsPreferencesResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/feeds_preferences_response.freezed.dart b/packages/stream_chat/lib/open_api/model/feeds_preferences_response.freezed.dart new file mode 100644 index 0000000000..e0b0815a43 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/feeds_preferences_response.freezed.dart @@ -0,0 +1,149 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'feeds_preferences_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$FeedsPreferencesResponse { + String? get comment; + String? get commentMention; + String? get commentReaction; + String? get commentReply; + Map? get customActivityTypes; + String? get follow; + String? get mention; + String? get reaction; + + /// Create a copy of FeedsPreferencesResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $FeedsPreferencesResponseCopyWith get copyWith => + _$FeedsPreferencesResponseCopyWithImpl( + this as FeedsPreferencesResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is FeedsPreferencesResponse && + (identical(other.comment, comment) || other.comment == comment) && + (identical(other.commentMention, commentMention) || other.commentMention == commentMention) && + (identical(other.commentReaction, commentReaction) || other.commentReaction == commentReaction) && + (identical(other.commentReply, commentReply) || other.commentReply == commentReply) && + const DeepCollectionEquality().equals( + other.customActivityTypes, + customActivityTypes, + ) && + (identical(other.follow, follow) || other.follow == follow) && + (identical(other.mention, mention) || other.mention == mention) && + (identical(other.reaction, reaction) || other.reaction == reaction)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + comment, + commentMention, + commentReaction, + commentReply, + const DeepCollectionEquality().hash(customActivityTypes), + follow, + mention, + reaction, + ); + + @override + String toString() { + return 'FeedsPreferencesResponse(comment: $comment, commentMention: $commentMention, commentReaction: $commentReaction, commentReply: $commentReply, customActivityTypes: $customActivityTypes, follow: $follow, mention: $mention, reaction: $reaction)'; + } +} + +/// @nodoc +abstract mixin class $FeedsPreferencesResponseCopyWith<$Res> { + factory $FeedsPreferencesResponseCopyWith( + FeedsPreferencesResponse value, + $Res Function(FeedsPreferencesResponse) _then, + ) = _$FeedsPreferencesResponseCopyWithImpl; + @useResult + $Res call({ + String? comment, + String? commentMention, + String? commentReaction, + String? commentReply, + Map? customActivityTypes, + String? follow, + String? mention, + String? reaction, + }); +} + +/// @nodoc +class _$FeedsPreferencesResponseCopyWithImpl<$Res> implements $FeedsPreferencesResponseCopyWith<$Res> { + _$FeedsPreferencesResponseCopyWithImpl(this._self, this._then); + + final FeedsPreferencesResponse _self; + final $Res Function(FeedsPreferencesResponse) _then; + + /// Create a copy of FeedsPreferencesResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? comment = freezed, + Object? commentMention = freezed, + Object? commentReaction = freezed, + Object? commentReply = freezed, + Object? customActivityTypes = freezed, + Object? follow = freezed, + Object? mention = freezed, + Object? reaction = freezed, + }) { + return _then( + FeedsPreferencesResponse( + comment: freezed == comment + ? _self.comment + : comment // ignore: cast_nullable_to_non_nullable + as String?, + commentMention: freezed == commentMention + ? _self.commentMention + : commentMention // ignore: cast_nullable_to_non_nullable + as String?, + commentReaction: freezed == commentReaction + ? _self.commentReaction + : commentReaction // ignore: cast_nullable_to_non_nullable + as String?, + commentReply: freezed == commentReply + ? _self.commentReply + : commentReply // ignore: cast_nullable_to_non_nullable + as String?, + customActivityTypes: freezed == customActivityTypes + ? _self.customActivityTypes + : customActivityTypes // ignore: cast_nullable_to_non_nullable + as Map?, + follow: freezed == follow + ? _self.follow + : follow // ignore: cast_nullable_to_non_nullable + as String?, + mention: freezed == mention + ? _self.mention + : mention // ignore: cast_nullable_to_non_nullable + as String?, + reaction: freezed == reaction + ? _self.reaction + : reaction // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/feeds_preferences_response.g.dart b/packages/stream_chat/lib/open_api/model/feeds_preferences_response.g.dart new file mode 100644 index 0000000000..6cb9954535 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/feeds_preferences_response.g.dart @@ -0,0 +1,35 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'feeds_preferences_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +FeedsPreferencesResponse _$FeedsPreferencesResponseFromJson( + Map json, +) => FeedsPreferencesResponse( + comment: json['comment'] as String?, + commentMention: json['comment_mention'] as String?, + commentReaction: json['comment_reaction'] as String?, + commentReply: json['comment_reply'] as String?, + customActivityTypes: (json['custom_activity_types'] as Map?)?.map( + (k, e) => MapEntry(k, e as String), + ), + follow: json['follow'] as String?, + mention: json['mention'] as String?, + reaction: json['reaction'] as String?, +); + +Map _$FeedsPreferencesResponseToJson( + FeedsPreferencesResponse instance, +) => { + 'comment': instance.comment, + 'comment_mention': instance.commentMention, + 'comment_reaction': instance.commentReaction, + 'comment_reply': instance.commentReply, + 'custom_activity_types': instance.customActivityTypes, + 'follow': instance.follow, + 'mention': instance.mention, + 'reaction': instance.reaction, +}; diff --git a/packages/stream_chat/lib/open_api/model/feeds_reaction_group_response.dart b/packages/stream_chat/lib/open_api/model/feeds_reaction_group_response.dart new file mode 100644 index 0000000000..ea671135d7 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/feeds_reaction_group_response.dart @@ -0,0 +1,43 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'feeds_reaction_group_response.g.dart'; +part 'feeds_reaction_group_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class FeedsReactionGroupResponse with _$FeedsReactionGroupResponse { + const FeedsReactionGroupResponse({ + required this.count, + required this.firstReactionAt, + required this.lastReactionAt, + }); + + @override + @JsonKey(name: 'count') + final int count; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'first_reaction_at') + final DateTime firstReactionAt; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'last_reaction_at') + final DateTime lastReactionAt; + + Map toJson() => _$FeedsReactionGroupResponseToJson(this); + + static FeedsReactionGroupResponse fromJson(Map json) => _$FeedsReactionGroupResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/feeds_reaction_group_response.freezed.dart b/packages/stream_chat/lib/open_api/model/feeds_reaction_group_response.freezed.dart new file mode 100644 index 0000000000..c9efcf3efd --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/feeds_reaction_group_response.freezed.dart @@ -0,0 +1,92 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'feeds_reaction_group_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$FeedsReactionGroupResponse { + int get count; + DateTime get firstReactionAt; + DateTime get lastReactionAt; + + /// Create a copy of FeedsReactionGroupResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $FeedsReactionGroupResponseCopyWith get copyWith => + _$FeedsReactionGroupResponseCopyWithImpl( + this as FeedsReactionGroupResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is FeedsReactionGroupResponse && + (identical(other.count, count) || other.count == count) && + (identical(other.firstReactionAt, firstReactionAt) || other.firstReactionAt == firstReactionAt) && + (identical(other.lastReactionAt, lastReactionAt) || other.lastReactionAt == lastReactionAt)); + } + + @override + int get hashCode => Object.hash(runtimeType, count, firstReactionAt, lastReactionAt); + + @override + String toString() { + return 'FeedsReactionGroupResponse(count: $count, firstReactionAt: $firstReactionAt, lastReactionAt: $lastReactionAt)'; + } +} + +/// @nodoc +abstract mixin class $FeedsReactionGroupResponseCopyWith<$Res> { + factory $FeedsReactionGroupResponseCopyWith( + FeedsReactionGroupResponse value, + $Res Function(FeedsReactionGroupResponse) _then, + ) = _$FeedsReactionGroupResponseCopyWithImpl; + @useResult + $Res call({int count, DateTime firstReactionAt, DateTime lastReactionAt}); +} + +/// @nodoc +class _$FeedsReactionGroupResponseCopyWithImpl<$Res> implements $FeedsReactionGroupResponseCopyWith<$Res> { + _$FeedsReactionGroupResponseCopyWithImpl(this._self, this._then); + + final FeedsReactionGroupResponse _self; + final $Res Function(FeedsReactionGroupResponse) _then; + + /// Create a copy of FeedsReactionGroupResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? count = null, + Object? firstReactionAt = null, + Object? lastReactionAt = null, + }) { + return _then( + FeedsReactionGroupResponse( + count: null == count + ? _self.count + : count // ignore: cast_nullable_to_non_nullable + as int, + firstReactionAt: null == firstReactionAt + ? _self.firstReactionAt + : firstReactionAt // ignore: cast_nullable_to_non_nullable + as DateTime, + lastReactionAt: null == lastReactionAt + ? _self.lastReactionAt + : lastReactionAt // ignore: cast_nullable_to_non_nullable + as DateTime, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/feeds_reaction_group_response.g.dart b/packages/stream_chat/lib/open_api/model/feeds_reaction_group_response.g.dart new file mode 100644 index 0000000000..eb705a1f5b --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/feeds_reaction_group_response.g.dart @@ -0,0 +1,31 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'feeds_reaction_group_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +FeedsReactionGroupResponse _$FeedsReactionGroupResponseFromJson( + Map json, +) => FeedsReactionGroupResponse( + count: (json['count'] as num).toInt(), + firstReactionAt: const StreamDateTimeConverter().fromJson( + json['first_reaction_at'] as Object, + ), + lastReactionAt: const StreamDateTimeConverter().fromJson( + json['last_reaction_at'] as Object, + ), +); + +Map _$FeedsReactionGroupResponseToJson( + FeedsReactionGroupResponse instance, +) => { + 'count': instance.count, + 'first_reaction_at': const StreamDateTimeConverter().toJson( + instance.firstReactionAt, + ), + 'last_reaction_at': const StreamDateTimeConverter().toJson( + instance.lastReactionAt, + ), +}; diff --git a/packages/stream_chat/lib/open_api/model/feeds_reaction_response.dart b/packages/stream_chat/lib/open_api/model/feeds_reaction_response.dart new file mode 100644 index 0000000000..fec7096685 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/feeds_reaction_response.dart @@ -0,0 +1,63 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'feeds_reaction_response.g.dart'; +part 'feeds_reaction_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class FeedsReactionResponse with _$FeedsReactionResponse { + const FeedsReactionResponse({ + required this.activityId, + this.commentId, + required this.createdAt, + this.custom, + required this.type, + required this.updatedAt, + required this.user, + }); + + @override + @JsonKey(name: 'activity_id') + final String activityId; + + @override + @JsonKey(name: 'comment_id') + final String? commentId; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map? custom; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'updated_at') + final DateTime updatedAt; + + @override + @JsonKey(name: 'user') + final UserResponse user; + + Map toJson() => _$FeedsReactionResponseToJson(this); + + static FeedsReactionResponse fromJson(Map json) => _$FeedsReactionResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/feeds_reaction_response.freezed.dart b/packages/stream_chat/lib/open_api/model/feeds_reaction_response.freezed.dart new file mode 100644 index 0000000000..2c52ebc521 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/feeds_reaction_response.freezed.dart @@ -0,0 +1,137 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'feeds_reaction_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$FeedsReactionResponse { + String get activityId; + String? get commentId; + DateTime get createdAt; + Map? get custom; + String get type; + DateTime get updatedAt; + UserResponse get user; + + /// Create a copy of FeedsReactionResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $FeedsReactionResponseCopyWith get copyWith => + _$FeedsReactionResponseCopyWithImpl( + this as FeedsReactionResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is FeedsReactionResponse && + (identical(other.activityId, activityId) || other.activityId == activityId) && + (identical(other.commentId, commentId) || other.commentId == commentId) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.type, type) || other.type == type) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + activityId, + commentId, + createdAt, + const DeepCollectionEquality().hash(custom), + type, + updatedAt, + user, + ); + + @override + String toString() { + return 'FeedsReactionResponse(activityId: $activityId, commentId: $commentId, createdAt: $createdAt, custom: $custom, type: $type, updatedAt: $updatedAt, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $FeedsReactionResponseCopyWith<$Res> { + factory $FeedsReactionResponseCopyWith( + FeedsReactionResponse value, + $Res Function(FeedsReactionResponse) _then, + ) = _$FeedsReactionResponseCopyWithImpl; + @useResult + $Res call({ + String activityId, + String? commentId, + DateTime createdAt, + Map? custom, + String type, + DateTime updatedAt, + UserResponse user, + }); +} + +/// @nodoc +class _$FeedsReactionResponseCopyWithImpl<$Res> implements $FeedsReactionResponseCopyWith<$Res> { + _$FeedsReactionResponseCopyWithImpl(this._self, this._then); + + final FeedsReactionResponse _self; + final $Res Function(FeedsReactionResponse) _then; + + /// Create a copy of FeedsReactionResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? activityId = null, + Object? commentId = freezed, + Object? createdAt = null, + Object? custom = freezed, + Object? type = null, + Object? updatedAt = null, + Object? user = null, + }) { + return _then( + FeedsReactionResponse( + activityId: null == activityId + ? _self.activityId + : activityId // ignore: cast_nullable_to_non_nullable + as String, + commentId: freezed == commentId + ? _self.commentId + : commentId // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: freezed == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + updatedAt: null == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + user: null == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponse, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/feeds_reaction_response.g.dart b/packages/stream_chat/lib/open_api/model/feeds_reaction_response.g.dart new file mode 100644 index 0000000000..b168050f7f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/feeds_reaction_response.g.dart @@ -0,0 +1,35 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'feeds_reaction_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +FeedsReactionResponse _$FeedsReactionResponseFromJson( + Map json, +) => FeedsReactionResponse( + activityId: json['activity_id'] as String, + commentId: json['comment_id'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map?, + type: json['type'] as String, + updatedAt: const StreamDateTimeConverter().fromJson( + json['updated_at'] as Object, + ), + user: UserResponse.fromJson(json['user'] as Map), +); + +Map _$FeedsReactionResponseToJson( + FeedsReactionResponse instance, +) => { + 'activity_id': instance.activityId, + 'comment_id': instance.commentId, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'type': instance.type, + 'updated_at': const StreamDateTimeConverter().toJson(instance.updatedAt), + 'user': instance.user.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/feeds_share_response.dart b/packages/stream_chat/lib/open_api/model/feeds_share_response.dart new file mode 100644 index 0000000000..73fda8b801 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/feeds_share_response.dart @@ -0,0 +1,42 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'feeds_share_response.g.dart'; +part 'feeds_share_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class FeedsShareResponse with _$FeedsShareResponse { + const FeedsShareResponse({ + required this.activityId, + required this.createdAt, + required this.user, + }); + + @override + @JsonKey(name: 'activity_id') + final String activityId; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'user') + final UserResponse user; + + Map toJson() => _$FeedsShareResponseToJson(this); + + static FeedsShareResponse fromJson(Map json) => _$FeedsShareResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/feeds_share_response.freezed.dart b/packages/stream_chat/lib/open_api/model/feeds_share_response.freezed.dart new file mode 100644 index 0000000000..6cfaccd6d1 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/feeds_share_response.freezed.dart @@ -0,0 +1,91 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'feeds_share_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$FeedsShareResponse { + String get activityId; + DateTime get createdAt; + UserResponse get user; + + /// Create a copy of FeedsShareResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $FeedsShareResponseCopyWith get copyWith => _$FeedsShareResponseCopyWithImpl( + this as FeedsShareResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is FeedsShareResponse && + (identical(other.activityId, activityId) || other.activityId == activityId) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash(runtimeType, activityId, createdAt, user); + + @override + String toString() { + return 'FeedsShareResponse(activityId: $activityId, createdAt: $createdAt, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $FeedsShareResponseCopyWith<$Res> { + factory $FeedsShareResponseCopyWith( + FeedsShareResponse value, + $Res Function(FeedsShareResponse) _then, + ) = _$FeedsShareResponseCopyWithImpl; + @useResult + $Res call({String activityId, DateTime createdAt, UserResponse user}); +} + +/// @nodoc +class _$FeedsShareResponseCopyWithImpl<$Res> implements $FeedsShareResponseCopyWith<$Res> { + _$FeedsShareResponseCopyWithImpl(this._self, this._then); + + final FeedsShareResponse _self; + final $Res Function(FeedsShareResponse) _then; + + /// Create a copy of FeedsShareResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? activityId = null, + Object? createdAt = null, + Object? user = null, + }) { + return _then( + FeedsShareResponse( + activityId: null == activityId + ? _self.activityId + : activityId // ignore: cast_nullable_to_non_nullable + as String, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + user: null == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponse, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/feeds_share_response.g.dart b/packages/stream_chat/lib/open_api/model/feeds_share_response.g.dart new file mode 100644 index 0000000000..80f1fccca4 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/feeds_share_response.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'feeds_share_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +FeedsShareResponse _$FeedsShareResponseFromJson(Map json) => FeedsShareResponse( + activityId: json['activity_id'] as String, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + user: UserResponse.fromJson(json['user'] as Map), +); + +Map _$FeedsShareResponseToJson(FeedsShareResponse instance) => { + 'activity_id': instance.activityId, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'user': instance.user.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/feeds_v3_activity_response.dart b/packages/stream_chat/lib/open_api/model/feeds_v3_activity_response.dart new file mode 100644 index 0000000000..057b7736ee --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/feeds_v3_activity_response.dart @@ -0,0 +1,281 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'feeds_v3_activity_response.g.dart'; +part 'feeds_v3_activity_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class FeedsV3ActivityResponse with _$FeedsV3ActivityResponse { + const FeedsV3ActivityResponse({ + required this.attachments, + required this.bookmarkCount, + required this.collections, + required this.commentCount, + required this.comments, + required this.createdAt, + this.currentFeed, + required this.custom, + this.deletedAt, + this.editedAt, + this.expiresAt, + required this.feeds, + required this.filterTags, + this.friendReactionCount, + this.friendReactions, + required this.hidden, + this.i18n, + required this.id, + required this.interestTags, + this.isRead, + this.isSeen, + this.isWatched, + required this.latestReactions, + this.latestShares, + this.location, + required this.mentionedUsers, + this.metrics, + this.moderation, + this.moderationAction, + this.notificationContext, + required this.ownBookmarks, + required this.ownReactions, + this.parent, + this.poll, + required this.popularity, + required this.preview, + required this.reactionCount, + required this.reactionGroups, + required this.restrictReplies, + required this.score, + this.scoreVars, + required this.searchData, + this.selectorSource, + required this.shareCount, + this.text, + required this.type, + required this.updatedAt, + required this.user, + required this.visibility, + this.visibilityTag, + }); + + @override + @JsonKey(name: 'attachments') + final List attachments; + + @override + @JsonKey(name: 'bookmark_count') + final int bookmarkCount; + + @override + @JsonKey(name: 'collections') + final Map collections; + + @override + @JsonKey(name: 'comment_count') + final int commentCount; + + @override + @JsonKey(name: 'comments') + final List comments; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'current_feed') + final FeedsFeedResponse? currentFeed; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'deleted_at') + final DateTime? deletedAt; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'edited_at') + final DateTime? editedAt; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'expires_at') + final DateTime? expiresAt; + + @override + @JsonKey(name: 'feeds') + final List feeds; + + @override + @JsonKey(name: 'filter_tags') + final List filterTags; + + @override + @JsonKey(name: 'friend_reaction_count') + final int? friendReactionCount; + + @override + @JsonKey(name: 'friend_reactions') + final List? friendReactions; + + @override + @JsonKey(name: 'hidden') + final bool hidden; + + @override + @JsonKey(name: 'i18n') + final Map? i18n; + + @override + @JsonKey(name: 'id') + final String id; + + @override + @JsonKey(name: 'interest_tags') + final List interestTags; + + @override + @JsonKey(name: 'is_read') + final bool? isRead; + + @override + @JsonKey(name: 'is_seen') + final bool? isSeen; + + @override + @JsonKey(name: 'is_watched') + final bool? isWatched; + + @override + @JsonKey(name: 'latest_reactions') + final List latestReactions; + + @override + @JsonKey(name: 'latest_shares') + final List? latestShares; + + @override + @JsonKey(name: 'location') + final FeedsActivityLocation? location; + + @override + @JsonKey(name: 'mentioned_users') + final List mentionedUsers; + + @override + @JsonKey(name: 'metrics') + final Map? metrics; + + @override + @JsonKey(name: 'moderation') + final ModerationV2Response? moderation; + + @override + @JsonKey(name: 'moderation_action') + final String? moderationAction; + + @override + @JsonKey(name: 'notification_context') + final FeedsNotificationContext? notificationContext; + + @override + @JsonKey(name: 'own_bookmarks') + final List ownBookmarks; + + @override + @JsonKey(name: 'own_reactions') + final List ownReactions; + + @override + @JsonKey(name: 'parent') + final FeedsV3ActivityResponse? parent; + + @override + @JsonKey(name: 'poll') + final PollResponseData? poll; + + @override + @JsonKey(name: 'popularity') + final int popularity; + + @override + @JsonKey(name: 'preview') + final bool preview; + + @override + @JsonKey(name: 'reaction_count') + final int reactionCount; + + @override + @JsonKey(name: 'reaction_groups') + final Map reactionGroups; + + @override + @JsonKey(name: 'restrict_replies') + final String restrictReplies; + + @override + @JsonKey(name: 'score') + final double score; + + @override + @JsonKey(name: 'score_vars') + final Map? scoreVars; + + @override + @JsonKey(name: 'search_data') + final Map searchData; + + @override + @JsonKey(name: 'selector_source') + final String? selectorSource; + + @override + @JsonKey(name: 'share_count') + final int shareCount; + + @override + @JsonKey(name: 'text') + final String? text; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'updated_at') + final DateTime updatedAt; + + @override + @JsonKey(name: 'user') + final UserResponse user; + + @override + @JsonKey(name: 'visibility') + final String visibility; + + @override + @JsonKey(name: 'visibility_tag') + final String? visibilityTag; + + Map toJson() => _$FeedsV3ActivityResponseToJson(this); + + static FeedsV3ActivityResponse fromJson(Map json) => _$FeedsV3ActivityResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/feeds_v3_activity_response.freezed.dart b/packages/stream_chat/lib/open_api/model/feeds_v3_activity_response.freezed.dart new file mode 100644 index 0000000000..d0db4e15f3 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/feeds_v3_activity_response.freezed.dart @@ -0,0 +1,562 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'feeds_v3_activity_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$FeedsV3ActivityResponse { + List get attachments; + int get bookmarkCount; + Map get collections; + int get commentCount; + List get comments; + DateTime get createdAt; + FeedsFeedResponse? get currentFeed; + Map get custom; + DateTime? get deletedAt; + DateTime? get editedAt; + DateTime? get expiresAt; + List get feeds; + List get filterTags; + int? get friendReactionCount; + List? get friendReactions; + bool get hidden; + Map? get i18n; + String get id; + List get interestTags; + bool? get isRead; + bool? get isSeen; + bool? get isWatched; + List get latestReactions; + List? get latestShares; + FeedsActivityLocation? get location; + List get mentionedUsers; + Map? get metrics; + ModerationV2Response? get moderation; + String? get moderationAction; + FeedsNotificationContext? get notificationContext; + List get ownBookmarks; + List get ownReactions; + FeedsV3ActivityResponse? get parent; + PollResponseData? get poll; + int get popularity; + bool get preview; + int get reactionCount; + Map get reactionGroups; + String get restrictReplies; + double get score; + Map? get scoreVars; + Map get searchData; + String? get selectorSource; + int get shareCount; + String? get text; + String get type; + DateTime get updatedAt; + UserResponse get user; + String get visibility; + String? get visibilityTag; + + /// Create a copy of FeedsV3ActivityResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $FeedsV3ActivityResponseCopyWith get copyWith => + _$FeedsV3ActivityResponseCopyWithImpl( + this as FeedsV3ActivityResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is FeedsV3ActivityResponse && + const DeepCollectionEquality().equals( + other.attachments, + attachments, + ) && + (identical(other.bookmarkCount, bookmarkCount) || other.bookmarkCount == bookmarkCount) && + const DeepCollectionEquality().equals( + other.collections, + collections, + ) && + (identical(other.commentCount, commentCount) || other.commentCount == commentCount) && + const DeepCollectionEquality().equals(other.comments, comments) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.currentFeed, currentFeed) || other.currentFeed == currentFeed) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt) && + (identical(other.editedAt, editedAt) || other.editedAt == editedAt) && + (identical(other.expiresAt, expiresAt) || other.expiresAt == expiresAt) && + const DeepCollectionEquality().equals(other.feeds, feeds) && + const DeepCollectionEquality().equals( + other.filterTags, + filterTags, + ) && + (identical(other.friendReactionCount, friendReactionCount) || + other.friendReactionCount == friendReactionCount) && + const DeepCollectionEquality().equals( + other.friendReactions, + friendReactions, + ) && + (identical(other.hidden, hidden) || other.hidden == hidden) && + const DeepCollectionEquality().equals(other.i18n, i18n) && + (identical(other.id, id) || other.id == id) && + const DeepCollectionEquality().equals( + other.interestTags, + interestTags, + ) && + (identical(other.isRead, isRead) || other.isRead == isRead) && + (identical(other.isSeen, isSeen) || other.isSeen == isSeen) && + (identical(other.isWatched, isWatched) || other.isWatched == isWatched) && + const DeepCollectionEquality().equals( + other.latestReactions, + latestReactions, + ) && + const DeepCollectionEquality().equals( + other.latestShares, + latestShares, + ) && + (identical(other.location, location) || other.location == location) && + const DeepCollectionEquality().equals( + other.mentionedUsers, + mentionedUsers, + ) && + const DeepCollectionEquality().equals(other.metrics, metrics) && + (identical(other.moderation, moderation) || other.moderation == moderation) && + (identical(other.moderationAction, moderationAction) || other.moderationAction == moderationAction) && + (identical(other.notificationContext, notificationContext) || + other.notificationContext == notificationContext) && + const DeepCollectionEquality().equals( + other.ownBookmarks, + ownBookmarks, + ) && + const DeepCollectionEquality().equals( + other.ownReactions, + ownReactions, + ) && + (identical(other.parent, parent) || other.parent == parent) && + (identical(other.poll, poll) || other.poll == poll) && + (identical(other.popularity, popularity) || other.popularity == popularity) && + (identical(other.preview, preview) || other.preview == preview) && + (identical(other.reactionCount, reactionCount) || other.reactionCount == reactionCount) && + const DeepCollectionEquality().equals( + other.reactionGroups, + reactionGroups, + ) && + (identical(other.restrictReplies, restrictReplies) || other.restrictReplies == restrictReplies) && + (identical(other.score, score) || other.score == score) && + const DeepCollectionEquality().equals(other.scoreVars, scoreVars) && + const DeepCollectionEquality().equals( + other.searchData, + searchData, + ) && + (identical(other.selectorSource, selectorSource) || other.selectorSource == selectorSource) && + (identical(other.shareCount, shareCount) || other.shareCount == shareCount) && + (identical(other.text, text) || other.text == text) && + (identical(other.type, type) || other.type == type) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt) && + (identical(other.user, user) || other.user == user) && + (identical(other.visibility, visibility) || other.visibility == visibility) && + (identical(other.visibilityTag, visibilityTag) || other.visibilityTag == visibilityTag)); + } + + @override + int get hashCode => Object.hashAll([ + runtimeType, + const DeepCollectionEquality().hash(attachments), + bookmarkCount, + const DeepCollectionEquality().hash(collections), + commentCount, + const DeepCollectionEquality().hash(comments), + createdAt, + currentFeed, + const DeepCollectionEquality().hash(custom), + deletedAt, + editedAt, + expiresAt, + const DeepCollectionEquality().hash(feeds), + const DeepCollectionEquality().hash(filterTags), + friendReactionCount, + const DeepCollectionEquality().hash(friendReactions), + hidden, + const DeepCollectionEquality().hash(i18n), + id, + const DeepCollectionEquality().hash(interestTags), + isRead, + isSeen, + isWatched, + const DeepCollectionEquality().hash(latestReactions), + const DeepCollectionEquality().hash(latestShares), + location, + const DeepCollectionEquality().hash(mentionedUsers), + const DeepCollectionEquality().hash(metrics), + moderation, + moderationAction, + notificationContext, + const DeepCollectionEquality().hash(ownBookmarks), + const DeepCollectionEquality().hash(ownReactions), + parent, + poll, + popularity, + preview, + reactionCount, + const DeepCollectionEquality().hash(reactionGroups), + restrictReplies, + score, + const DeepCollectionEquality().hash(scoreVars), + const DeepCollectionEquality().hash(searchData), + selectorSource, + shareCount, + text, + type, + updatedAt, + user, + visibility, + visibilityTag, + ]); + + @override + String toString() { + return 'FeedsV3ActivityResponse(attachments: $attachments, bookmarkCount: $bookmarkCount, collections: $collections, commentCount: $commentCount, comments: $comments, createdAt: $createdAt, currentFeed: $currentFeed, custom: $custom, deletedAt: $deletedAt, editedAt: $editedAt, expiresAt: $expiresAt, feeds: $feeds, filterTags: $filterTags, friendReactionCount: $friendReactionCount, friendReactions: $friendReactions, hidden: $hidden, i18n: $i18n, id: $id, interestTags: $interestTags, isRead: $isRead, isSeen: $isSeen, isWatched: $isWatched, latestReactions: $latestReactions, latestShares: $latestShares, location: $location, mentionedUsers: $mentionedUsers, metrics: $metrics, moderation: $moderation, moderationAction: $moderationAction, notificationContext: $notificationContext, ownBookmarks: $ownBookmarks, ownReactions: $ownReactions, parent: $parent, poll: $poll, popularity: $popularity, preview: $preview, reactionCount: $reactionCount, reactionGroups: $reactionGroups, restrictReplies: $restrictReplies, score: $score, scoreVars: $scoreVars, searchData: $searchData, selectorSource: $selectorSource, shareCount: $shareCount, text: $text, type: $type, updatedAt: $updatedAt, user: $user, visibility: $visibility, visibilityTag: $visibilityTag)'; + } +} + +/// @nodoc +abstract mixin class $FeedsV3ActivityResponseCopyWith<$Res> { + factory $FeedsV3ActivityResponseCopyWith( + FeedsV3ActivityResponse value, + $Res Function(FeedsV3ActivityResponse) _then, + ) = _$FeedsV3ActivityResponseCopyWithImpl; + @useResult + $Res call({ + List attachments, + int bookmarkCount, + Map collections, + int commentCount, + List comments, + DateTime createdAt, + FeedsFeedResponse? currentFeed, + Map custom, + DateTime? deletedAt, + DateTime? editedAt, + DateTime? expiresAt, + List feeds, + List filterTags, + int? friendReactionCount, + List? friendReactions, + bool hidden, + Map? i18n, + String id, + List interestTags, + bool? isRead, + bool? isSeen, + bool? isWatched, + List latestReactions, + List? latestShares, + FeedsActivityLocation? location, + List mentionedUsers, + Map? metrics, + ModerationV2Response? moderation, + String? moderationAction, + FeedsNotificationContext? notificationContext, + List ownBookmarks, + List ownReactions, + FeedsV3ActivityResponse? parent, + PollResponseData? poll, + int popularity, + bool preview, + int reactionCount, + Map reactionGroups, + String restrictReplies, + double score, + Map? scoreVars, + Map searchData, + String? selectorSource, + int shareCount, + String? text, + String type, + DateTime updatedAt, + UserResponse user, + String visibility, + String? visibilityTag, + }); +} + +/// @nodoc +class _$FeedsV3ActivityResponseCopyWithImpl<$Res> implements $FeedsV3ActivityResponseCopyWith<$Res> { + _$FeedsV3ActivityResponseCopyWithImpl(this._self, this._then); + + final FeedsV3ActivityResponse _self; + final $Res Function(FeedsV3ActivityResponse) _then; + + /// Create a copy of FeedsV3ActivityResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? attachments = null, + Object? bookmarkCount = null, + Object? collections = null, + Object? commentCount = null, + Object? comments = null, + Object? createdAt = null, + Object? currentFeed = freezed, + Object? custom = null, + Object? deletedAt = freezed, + Object? editedAt = freezed, + Object? expiresAt = freezed, + Object? feeds = null, + Object? filterTags = null, + Object? friendReactionCount = freezed, + Object? friendReactions = freezed, + Object? hidden = null, + Object? i18n = freezed, + Object? id = null, + Object? interestTags = null, + Object? isRead = freezed, + Object? isSeen = freezed, + Object? isWatched = freezed, + Object? latestReactions = null, + Object? latestShares = freezed, + Object? location = freezed, + Object? mentionedUsers = null, + Object? metrics = freezed, + Object? moderation = freezed, + Object? moderationAction = freezed, + Object? notificationContext = freezed, + Object? ownBookmarks = null, + Object? ownReactions = null, + Object? parent = freezed, + Object? poll = freezed, + Object? popularity = null, + Object? preview = null, + Object? reactionCount = null, + Object? reactionGroups = null, + Object? restrictReplies = null, + Object? score = null, + Object? scoreVars = freezed, + Object? searchData = null, + Object? selectorSource = freezed, + Object? shareCount = null, + Object? text = freezed, + Object? type = null, + Object? updatedAt = null, + Object? user = null, + Object? visibility = null, + Object? visibilityTag = freezed, + }) { + return _then( + FeedsV3ActivityResponse( + attachments: null == attachments + ? _self.attachments + : attachments // ignore: cast_nullable_to_non_nullable + as List, + bookmarkCount: null == bookmarkCount + ? _self.bookmarkCount + : bookmarkCount // ignore: cast_nullable_to_non_nullable + as int, + collections: null == collections + ? _self.collections + : collections // ignore: cast_nullable_to_non_nullable + as Map, + commentCount: null == commentCount + ? _self.commentCount + : commentCount // ignore: cast_nullable_to_non_nullable + as int, + comments: null == comments + ? _self.comments + : comments // ignore: cast_nullable_to_non_nullable + as List, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + currentFeed: freezed == currentFeed + ? _self.currentFeed + : currentFeed // ignore: cast_nullable_to_non_nullable + as FeedsFeedResponse?, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + deletedAt: freezed == deletedAt + ? _self.deletedAt + : deletedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + editedAt: freezed == editedAt + ? _self.editedAt + : editedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + expiresAt: freezed == expiresAt + ? _self.expiresAt + : expiresAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + feeds: null == feeds + ? _self.feeds + : feeds // ignore: cast_nullable_to_non_nullable + as List, + filterTags: null == filterTags + ? _self.filterTags + : filterTags // ignore: cast_nullable_to_non_nullable + as List, + friendReactionCount: freezed == friendReactionCount + ? _self.friendReactionCount + : friendReactionCount // ignore: cast_nullable_to_non_nullable + as int?, + friendReactions: freezed == friendReactions + ? _self.friendReactions + : friendReactions // ignore: cast_nullable_to_non_nullable + as List?, + hidden: null == hidden + ? _self.hidden + : hidden // ignore: cast_nullable_to_non_nullable + as bool, + i18n: freezed == i18n + ? _self.i18n + : i18n // ignore: cast_nullable_to_non_nullable + as Map?, + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + interestTags: null == interestTags + ? _self.interestTags + : interestTags // ignore: cast_nullable_to_non_nullable + as List, + isRead: freezed == isRead + ? _self.isRead + : isRead // ignore: cast_nullable_to_non_nullable + as bool?, + isSeen: freezed == isSeen + ? _self.isSeen + : isSeen // ignore: cast_nullable_to_non_nullable + as bool?, + isWatched: freezed == isWatched + ? _self.isWatched + : isWatched // ignore: cast_nullable_to_non_nullable + as bool?, + latestReactions: null == latestReactions + ? _self.latestReactions + : latestReactions // ignore: cast_nullable_to_non_nullable + as List, + latestShares: freezed == latestShares + ? _self.latestShares + : latestShares // ignore: cast_nullable_to_non_nullable + as List?, + location: freezed == location + ? _self.location + : location // ignore: cast_nullable_to_non_nullable + as FeedsActivityLocation?, + mentionedUsers: null == mentionedUsers + ? _self.mentionedUsers + : mentionedUsers // ignore: cast_nullable_to_non_nullable + as List, + metrics: freezed == metrics + ? _self.metrics + : metrics // ignore: cast_nullable_to_non_nullable + as Map?, + moderation: freezed == moderation + ? _self.moderation + : moderation // ignore: cast_nullable_to_non_nullable + as ModerationV2Response?, + moderationAction: freezed == moderationAction + ? _self.moderationAction + : moderationAction // ignore: cast_nullable_to_non_nullable + as String?, + notificationContext: freezed == notificationContext + ? _self.notificationContext + : notificationContext // ignore: cast_nullable_to_non_nullable + as FeedsNotificationContext?, + ownBookmarks: null == ownBookmarks + ? _self.ownBookmarks + : ownBookmarks // ignore: cast_nullable_to_non_nullable + as List, + ownReactions: null == ownReactions + ? _self.ownReactions + : ownReactions // ignore: cast_nullable_to_non_nullable + as List, + parent: freezed == parent + ? _self.parent + : parent // ignore: cast_nullable_to_non_nullable + as FeedsV3ActivityResponse?, + poll: freezed == poll + ? _self.poll + : poll // ignore: cast_nullable_to_non_nullable + as PollResponseData?, + popularity: null == popularity + ? _self.popularity + : popularity // ignore: cast_nullable_to_non_nullable + as int, + preview: null == preview + ? _self.preview + : preview // ignore: cast_nullable_to_non_nullable + as bool, + reactionCount: null == reactionCount + ? _self.reactionCount + : reactionCount // ignore: cast_nullable_to_non_nullable + as int, + reactionGroups: null == reactionGroups + ? _self.reactionGroups + : reactionGroups // ignore: cast_nullable_to_non_nullable + as Map, + restrictReplies: null == restrictReplies + ? _self.restrictReplies + : restrictReplies // ignore: cast_nullable_to_non_nullable + as String, + score: null == score + ? _self.score + : score // ignore: cast_nullable_to_non_nullable + as double, + scoreVars: freezed == scoreVars + ? _self.scoreVars + : scoreVars // ignore: cast_nullable_to_non_nullable + as Map?, + searchData: null == searchData + ? _self.searchData + : searchData // ignore: cast_nullable_to_non_nullable + as Map, + selectorSource: freezed == selectorSource + ? _self.selectorSource + : selectorSource // ignore: cast_nullable_to_non_nullable + as String?, + shareCount: null == shareCount + ? _self.shareCount + : shareCount // ignore: cast_nullable_to_non_nullable + as int, + text: freezed == text + ? _self.text + : text // ignore: cast_nullable_to_non_nullable + as String?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + updatedAt: null == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + user: null == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponse, + visibility: null == visibility + ? _self.visibility + : visibility // ignore: cast_nullable_to_non_nullable + as String, + visibilityTag: freezed == visibilityTag + ? _self.visibilityTag + : visibilityTag // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/feeds_v3_activity_response.g.dart b/packages/stream_chat/lib/open_api/model/feeds_v3_activity_response.g.dart new file mode 100644 index 0000000000..76501b5045 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/feeds_v3_activity_response.g.dart @@ -0,0 +1,201 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'feeds_v3_activity_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +FeedsV3ActivityResponse _$FeedsV3ActivityResponseFromJson( + Map json, +) => FeedsV3ActivityResponse( + attachments: (json['attachments'] as List) + .map((e) => Attachment.fromJson(e as Map)) + .toList(), + bookmarkCount: (json['bookmark_count'] as num).toInt(), + collections: (json['collections'] as Map).map( + (k, e) => MapEntry( + k, + FeedsEnrichedCollectionResponse.fromJson(e as Map), + ), + ), + commentCount: (json['comment_count'] as num).toInt(), + comments: (json['comments'] as List) + .map((e) => FeedsV3CommentResponse.fromJson(e as Map)) + .toList(), + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + currentFeed: json['current_feed'] == null + ? null + : FeedsFeedResponse.fromJson( + json['current_feed'] as Map, + ), + custom: json['custom'] as Map, + deletedAt: _$JsonConverterFromJson( + json['deleted_at'], + const StreamDateTimeConverter().fromJson, + ), + editedAt: _$JsonConverterFromJson( + json['edited_at'], + const StreamDateTimeConverter().fromJson, + ), + expiresAt: _$JsonConverterFromJson( + json['expires_at'], + const StreamDateTimeConverter().fromJson, + ), + feeds: (json['feeds'] as List).map((e) => e as String).toList(), + filterTags: (json['filter_tags'] as List).map((e) => e as String).toList(), + friendReactionCount: (json['friend_reaction_count'] as num?)?.toInt(), + friendReactions: (json['friend_reactions'] as List?) + ?.map((e) => FeedsReactionResponse.fromJson(e as Map)) + .toList(), + hidden: json['hidden'] as bool, + i18n: (json['i18n'] as Map?)?.map( + (k, e) => MapEntry(k, e as String), + ), + id: json['id'] as String, + interestTags: (json['interest_tags'] as List).map((e) => e as String).toList(), + isRead: json['is_read'] as bool?, + isSeen: json['is_seen'] as bool?, + isWatched: json['is_watched'] as bool?, + latestReactions: (json['latest_reactions'] as List) + .map((e) => FeedsReactionResponse.fromJson(e as Map)) + .toList(), + latestShares: (json['latest_shares'] as List?) + ?.map((e) => FeedsShareResponse.fromJson(e as Map)) + .toList(), + location: json['location'] == null + ? null + : FeedsActivityLocation.fromJson( + json['location'] as Map, + ), + mentionedUsers: (json['mentioned_users'] as List) + .map((e) => UserResponse.fromJson(e as Map)) + .toList(), + metrics: (json['metrics'] as Map?)?.map( + (k, e) => MapEntry(k, (e as num).toInt()), + ), + moderation: json['moderation'] == null + ? null + : ModerationV2Response.fromJson( + json['moderation'] as Map, + ), + moderationAction: json['moderation_action'] as String?, + notificationContext: json['notification_context'] == null + ? null + : FeedsNotificationContext.fromJson( + json['notification_context'] as Map, + ), + ownBookmarks: (json['own_bookmarks'] as List) + .map((e) => FeedsBookmarkResponse.fromJson(e as Map)) + .toList(), + ownReactions: (json['own_reactions'] as List) + .map((e) => FeedsReactionResponse.fromJson(e as Map)) + .toList(), + parent: json['parent'] == null + ? null + : FeedsV3ActivityResponse.fromJson( + json['parent'] as Map, + ), + poll: json['poll'] == null ? null : PollResponseData.fromJson(json['poll'] as Map), + popularity: (json['popularity'] as num).toInt(), + preview: json['preview'] as bool, + reactionCount: (json['reaction_count'] as num).toInt(), + reactionGroups: (json['reaction_groups'] as Map).map( + (k, e) => MapEntry( + k, + FeedsReactionGroupResponse.fromJson(e as Map), + ), + ), + restrictReplies: json['restrict_replies'] as String, + score: (json['score'] as num).toDouble(), + scoreVars: json['score_vars'] as Map?, + searchData: json['search_data'] as Map, + selectorSource: json['selector_source'] as String?, + shareCount: (json['share_count'] as num).toInt(), + text: json['text'] as String?, + type: json['type'] as String, + updatedAt: const StreamDateTimeConverter().fromJson( + json['updated_at'] as Object, + ), + user: UserResponse.fromJson(json['user'] as Map), + visibility: json['visibility'] as String, + visibilityTag: json['visibility_tag'] as String?, +); + +Map _$FeedsV3ActivityResponseToJson( + FeedsV3ActivityResponse instance, +) => { + 'attachments': instance.attachments.map((e) => e.toJson()).toList(), + 'bookmark_count': instance.bookmarkCount, + 'collections': instance.collections.map((k, e) => MapEntry(k, e.toJson())), + 'comment_count': instance.commentCount, + 'comments': instance.comments.map((e) => e.toJson()).toList(), + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'current_feed': instance.currentFeed?.toJson(), + 'custom': instance.custom, + 'deleted_at': _$JsonConverterToJson( + instance.deletedAt, + const StreamDateTimeConverter().toJson, + ), + 'edited_at': _$JsonConverterToJson( + instance.editedAt, + const StreamDateTimeConverter().toJson, + ), + 'expires_at': _$JsonConverterToJson( + instance.expiresAt, + const StreamDateTimeConverter().toJson, + ), + 'feeds': instance.feeds, + 'filter_tags': instance.filterTags, + 'friend_reaction_count': instance.friendReactionCount, + 'friend_reactions': instance.friendReactions?.map((e) => e.toJson()).toList(), + 'hidden': instance.hidden, + 'i18n': instance.i18n, + 'id': instance.id, + 'interest_tags': instance.interestTags, + 'is_read': instance.isRead, + 'is_seen': instance.isSeen, + 'is_watched': instance.isWatched, + 'latest_reactions': instance.latestReactions.map((e) => e.toJson()).toList(), + 'latest_shares': instance.latestShares?.map((e) => e.toJson()).toList(), + 'location': instance.location?.toJson(), + 'mentioned_users': instance.mentionedUsers.map((e) => e.toJson()).toList(), + 'metrics': instance.metrics, + 'moderation': instance.moderation?.toJson(), + 'moderation_action': instance.moderationAction, + 'notification_context': instance.notificationContext?.toJson(), + 'own_bookmarks': instance.ownBookmarks.map((e) => e.toJson()).toList(), + 'own_reactions': instance.ownReactions.map((e) => e.toJson()).toList(), + 'parent': instance.parent?.toJson(), + 'poll': instance.poll?.toJson(), + 'popularity': instance.popularity, + 'preview': instance.preview, + 'reaction_count': instance.reactionCount, + 'reaction_groups': instance.reactionGroups.map( + (k, e) => MapEntry(k, e.toJson()), + ), + 'restrict_replies': instance.restrictReplies, + 'score': instance.score, + 'score_vars': instance.scoreVars, + 'search_data': instance.searchData, + 'selector_source': instance.selectorSource, + 'share_count': instance.shareCount, + 'text': instance.text, + 'type': instance.type, + 'updated_at': const StreamDateTimeConverter().toJson(instance.updatedAt), + 'user': instance.user.toJson(), + 'visibility': instance.visibility, + 'visibility_tag': instance.visibilityTag, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/feeds_v3_comment_response.dart b/packages/stream_chat/lib/open_api/model/feeds_v3_comment_response.dart new file mode 100644 index 0000000000..043277fafb --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/feeds_v3_comment_response.dart @@ -0,0 +1,165 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'feeds_v3_comment_response.g.dart'; +part 'feeds_v3_comment_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class FeedsV3CommentResponse with _$FeedsV3CommentResponse { + const FeedsV3CommentResponse({ + this.attachments, + required this.bookmarkCount, + required this.confidenceScore, + this.controversyScore, + required this.createdAt, + this.custom, + this.deletedAt, + required this.downvoteCount, + this.editedAt, + this.i18n, + required this.id, + this.latestReactions, + required this.mentionedUsers, + this.moderation, + required this.objectId, + required this.objectType, + required this.ownReactions, + this.parentId, + required this.reactionCount, + this.reactionGroups, + required this.replyCount, + required this.score, + required this.status, + this.text, + required this.updatedAt, + required this.upvoteCount, + required this.user, + }); + + @override + @JsonKey(name: 'attachments') + final List? attachments; + + @override + @JsonKey(name: 'bookmark_count') + final int bookmarkCount; + + @override + @JsonKey(name: 'confidence_score') + final double confidenceScore; + + @override + @JsonKey(name: 'controversy_score') + final double? controversyScore; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map? custom; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'deleted_at') + final DateTime? deletedAt; + + @override + @JsonKey(name: 'downvote_count') + final int downvoteCount; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'edited_at') + final DateTime? editedAt; + + @override + @JsonKey(name: 'i18n') + final Map? i18n; + + @override + @JsonKey(name: 'id') + final String id; + + @override + @JsonKey(name: 'latest_reactions') + final List? latestReactions; + + @override + @JsonKey(name: 'mentioned_users') + final List mentionedUsers; + + @override + @JsonKey(name: 'moderation') + final ModerationV2Response? moderation; + + @override + @JsonKey(name: 'object_id') + final String objectId; + + @override + @JsonKey(name: 'object_type') + final String objectType; + + @override + @JsonKey(name: 'own_reactions') + final List ownReactions; + + @override + @JsonKey(name: 'parent_id') + final String? parentId; + + @override + @JsonKey(name: 'reaction_count') + final int reactionCount; + + @override + @JsonKey(name: 'reaction_groups') + final Map? reactionGroups; + + @override + @JsonKey(name: 'reply_count') + final int replyCount; + + @override + @JsonKey(name: 'score') + final int score; + + @override + @JsonKey(name: 'status') + final String status; + + @override + @JsonKey(name: 'text') + final String? text; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'updated_at') + final DateTime updatedAt; + + @override + @JsonKey(name: 'upvote_count') + final int upvoteCount; + + @override + @JsonKey(name: 'user') + final UserResponse user; + + Map toJson() => _$FeedsV3CommentResponseToJson(this); + + static FeedsV3CommentResponse fromJson(Map json) => _$FeedsV3CommentResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/feeds_v3_comment_response.freezed.dart b/packages/stream_chat/lib/open_api/model/feeds_v3_comment_response.freezed.dart new file mode 100644 index 0000000000..7edd07cf5b --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/feeds_v3_comment_response.freezed.dart @@ -0,0 +1,332 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'feeds_v3_comment_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$FeedsV3CommentResponse { + List? get attachments; + int get bookmarkCount; + double get confidenceScore; + double? get controversyScore; + DateTime get createdAt; + Map? get custom; + DateTime? get deletedAt; + int get downvoteCount; + DateTime? get editedAt; + Map? get i18n; + String get id; + List? get latestReactions; + List get mentionedUsers; + ModerationV2Response? get moderation; + String get objectId; + String get objectType; + List get ownReactions; + String? get parentId; + int get reactionCount; + Map? get reactionGroups; + int get replyCount; + int get score; + String get status; + String? get text; + DateTime get updatedAt; + int get upvoteCount; + UserResponse get user; + + /// Create a copy of FeedsV3CommentResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $FeedsV3CommentResponseCopyWith get copyWith => + _$FeedsV3CommentResponseCopyWithImpl( + this as FeedsV3CommentResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is FeedsV3CommentResponse && + const DeepCollectionEquality().equals( + other.attachments, + attachments, + ) && + (identical(other.bookmarkCount, bookmarkCount) || other.bookmarkCount == bookmarkCount) && + (identical(other.confidenceScore, confidenceScore) || other.confidenceScore == confidenceScore) && + (identical(other.controversyScore, controversyScore) || other.controversyScore == controversyScore) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt) && + (identical(other.downvoteCount, downvoteCount) || other.downvoteCount == downvoteCount) && + (identical(other.editedAt, editedAt) || other.editedAt == editedAt) && + const DeepCollectionEquality().equals(other.i18n, i18n) && + (identical(other.id, id) || other.id == id) && + const DeepCollectionEquality().equals( + other.latestReactions, + latestReactions, + ) && + const DeepCollectionEquality().equals( + other.mentionedUsers, + mentionedUsers, + ) && + (identical(other.moderation, moderation) || other.moderation == moderation) && + (identical(other.objectId, objectId) || other.objectId == objectId) && + (identical(other.objectType, objectType) || other.objectType == objectType) && + const DeepCollectionEquality().equals( + other.ownReactions, + ownReactions, + ) && + (identical(other.parentId, parentId) || other.parentId == parentId) && + (identical(other.reactionCount, reactionCount) || other.reactionCount == reactionCount) && + const DeepCollectionEquality().equals( + other.reactionGroups, + reactionGroups, + ) && + (identical(other.replyCount, replyCount) || other.replyCount == replyCount) && + (identical(other.score, score) || other.score == score) && + (identical(other.status, status) || other.status == status) && + (identical(other.text, text) || other.text == text) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt) && + (identical(other.upvoteCount, upvoteCount) || other.upvoteCount == upvoteCount) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hashAll([ + runtimeType, + const DeepCollectionEquality().hash(attachments), + bookmarkCount, + confidenceScore, + controversyScore, + createdAt, + const DeepCollectionEquality().hash(custom), + deletedAt, + downvoteCount, + editedAt, + const DeepCollectionEquality().hash(i18n), + id, + const DeepCollectionEquality().hash(latestReactions), + const DeepCollectionEquality().hash(mentionedUsers), + moderation, + objectId, + objectType, + const DeepCollectionEquality().hash(ownReactions), + parentId, + reactionCount, + const DeepCollectionEquality().hash(reactionGroups), + replyCount, + score, + status, + text, + updatedAt, + upvoteCount, + user, + ]); + + @override + String toString() { + return 'FeedsV3CommentResponse(attachments: $attachments, bookmarkCount: $bookmarkCount, confidenceScore: $confidenceScore, controversyScore: $controversyScore, createdAt: $createdAt, custom: $custom, deletedAt: $deletedAt, downvoteCount: $downvoteCount, editedAt: $editedAt, i18n: $i18n, id: $id, latestReactions: $latestReactions, mentionedUsers: $mentionedUsers, moderation: $moderation, objectId: $objectId, objectType: $objectType, ownReactions: $ownReactions, parentId: $parentId, reactionCount: $reactionCount, reactionGroups: $reactionGroups, replyCount: $replyCount, score: $score, status: $status, text: $text, updatedAt: $updatedAt, upvoteCount: $upvoteCount, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $FeedsV3CommentResponseCopyWith<$Res> { + factory $FeedsV3CommentResponseCopyWith( + FeedsV3CommentResponse value, + $Res Function(FeedsV3CommentResponse) _then, + ) = _$FeedsV3CommentResponseCopyWithImpl; + @useResult + $Res call({ + List? attachments, + int bookmarkCount, + double confidenceScore, + double? controversyScore, + DateTime createdAt, + Map? custom, + DateTime? deletedAt, + int downvoteCount, + DateTime? editedAt, + Map? i18n, + String id, + List? latestReactions, + List mentionedUsers, + ModerationV2Response? moderation, + String objectId, + String objectType, + List ownReactions, + String? parentId, + int reactionCount, + Map? reactionGroups, + int replyCount, + int score, + String status, + String? text, + DateTime updatedAt, + int upvoteCount, + UserResponse user, + }); +} + +/// @nodoc +class _$FeedsV3CommentResponseCopyWithImpl<$Res> implements $FeedsV3CommentResponseCopyWith<$Res> { + _$FeedsV3CommentResponseCopyWithImpl(this._self, this._then); + + final FeedsV3CommentResponse _self; + final $Res Function(FeedsV3CommentResponse) _then; + + /// Create a copy of FeedsV3CommentResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? attachments = freezed, + Object? bookmarkCount = null, + Object? confidenceScore = null, + Object? controversyScore = freezed, + Object? createdAt = null, + Object? custom = freezed, + Object? deletedAt = freezed, + Object? downvoteCount = null, + Object? editedAt = freezed, + Object? i18n = freezed, + Object? id = null, + Object? latestReactions = freezed, + Object? mentionedUsers = null, + Object? moderation = freezed, + Object? objectId = null, + Object? objectType = null, + Object? ownReactions = null, + Object? parentId = freezed, + Object? reactionCount = null, + Object? reactionGroups = freezed, + Object? replyCount = null, + Object? score = null, + Object? status = null, + Object? text = freezed, + Object? updatedAt = null, + Object? upvoteCount = null, + Object? user = null, + }) { + return _then( + FeedsV3CommentResponse( + attachments: freezed == attachments + ? _self.attachments + : attachments // ignore: cast_nullable_to_non_nullable + as List?, + bookmarkCount: null == bookmarkCount + ? _self.bookmarkCount + : bookmarkCount // ignore: cast_nullable_to_non_nullable + as int, + confidenceScore: null == confidenceScore + ? _self.confidenceScore + : confidenceScore // ignore: cast_nullable_to_non_nullable + as double, + controversyScore: freezed == controversyScore + ? _self.controversyScore + : controversyScore // ignore: cast_nullable_to_non_nullable + as double?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: freezed == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map?, + deletedAt: freezed == deletedAt + ? _self.deletedAt + : deletedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + downvoteCount: null == downvoteCount + ? _self.downvoteCount + : downvoteCount // ignore: cast_nullable_to_non_nullable + as int, + editedAt: freezed == editedAt + ? _self.editedAt + : editedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + i18n: freezed == i18n + ? _self.i18n + : i18n // ignore: cast_nullable_to_non_nullable + as Map?, + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + latestReactions: freezed == latestReactions + ? _self.latestReactions + : latestReactions // ignore: cast_nullable_to_non_nullable + as List?, + mentionedUsers: null == mentionedUsers + ? _self.mentionedUsers + : mentionedUsers // ignore: cast_nullable_to_non_nullable + as List, + moderation: freezed == moderation + ? _self.moderation + : moderation // ignore: cast_nullable_to_non_nullable + as ModerationV2Response?, + objectId: null == objectId + ? _self.objectId + : objectId // ignore: cast_nullable_to_non_nullable + as String, + objectType: null == objectType + ? _self.objectType + : objectType // ignore: cast_nullable_to_non_nullable + as String, + ownReactions: null == ownReactions + ? _self.ownReactions + : ownReactions // ignore: cast_nullable_to_non_nullable + as List, + parentId: freezed == parentId + ? _self.parentId + : parentId // ignore: cast_nullable_to_non_nullable + as String?, + reactionCount: null == reactionCount + ? _self.reactionCount + : reactionCount // ignore: cast_nullable_to_non_nullable + as int, + reactionGroups: freezed == reactionGroups + ? _self.reactionGroups + : reactionGroups // ignore: cast_nullable_to_non_nullable + as Map?, + replyCount: null == replyCount + ? _self.replyCount + : replyCount // ignore: cast_nullable_to_non_nullable + as int, + score: null == score + ? _self.score + : score // ignore: cast_nullable_to_non_nullable + as int, + status: null == status + ? _self.status + : status // ignore: cast_nullable_to_non_nullable + as String, + text: freezed == text + ? _self.text + : text // ignore: cast_nullable_to_non_nullable + as String?, + updatedAt: null == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + upvoteCount: null == upvoteCount + ? _self.upvoteCount + : upvoteCount // ignore: cast_nullable_to_non_nullable + as int, + user: null == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponse, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/feeds_v3_comment_response.g.dart b/packages/stream_chat/lib/open_api/model/feeds_v3_comment_response.g.dart new file mode 100644 index 0000000000..7c6e751436 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/feeds_v3_comment_response.g.dart @@ -0,0 +1,118 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'feeds_v3_comment_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +FeedsV3CommentResponse _$FeedsV3CommentResponseFromJson( + Map json, +) => FeedsV3CommentResponse( + attachments: (json['attachments'] as List?) + ?.map((e) => Attachment.fromJson(e as Map)) + .toList(), + bookmarkCount: (json['bookmark_count'] as num).toInt(), + confidenceScore: (json['confidence_score'] as num).toDouble(), + controversyScore: (json['controversy_score'] as num?)?.toDouble(), + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map?, + deletedAt: _$JsonConverterFromJson( + json['deleted_at'], + const StreamDateTimeConverter().fromJson, + ), + downvoteCount: (json['downvote_count'] as num).toInt(), + editedAt: _$JsonConverterFromJson( + json['edited_at'], + const StreamDateTimeConverter().fromJson, + ), + i18n: (json['i18n'] as Map?)?.map( + (k, e) => MapEntry(k, e as String), + ), + id: json['id'] as String, + latestReactions: (json['latest_reactions'] as List?) + ?.map((e) => FeedsReactionResponse.fromJson(e as Map)) + .toList(), + mentionedUsers: (json['mentioned_users'] as List) + .map((e) => UserResponse.fromJson(e as Map)) + .toList(), + moderation: json['moderation'] == null + ? null + : ModerationV2Response.fromJson( + json['moderation'] as Map, + ), + objectId: json['object_id'] as String, + objectType: json['object_type'] as String, + ownReactions: (json['own_reactions'] as List) + .map((e) => FeedsReactionResponse.fromJson(e as Map)) + .toList(), + parentId: json['parent_id'] as String?, + reactionCount: (json['reaction_count'] as num).toInt(), + reactionGroups: (json['reaction_groups'] as Map?)?.map( + (k, e) => MapEntry( + k, + FeedsReactionGroupResponse.fromJson(e as Map), + ), + ), + replyCount: (json['reply_count'] as num).toInt(), + score: (json['score'] as num).toInt(), + status: json['status'] as String, + text: json['text'] as String?, + updatedAt: const StreamDateTimeConverter().fromJson( + json['updated_at'] as Object, + ), + upvoteCount: (json['upvote_count'] as num).toInt(), + user: UserResponse.fromJson(json['user'] as Map), +); + +Map _$FeedsV3CommentResponseToJson( + FeedsV3CommentResponse instance, +) => { + 'attachments': instance.attachments?.map((e) => e.toJson()).toList(), + 'bookmark_count': instance.bookmarkCount, + 'confidence_score': instance.confidenceScore, + 'controversy_score': instance.controversyScore, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'deleted_at': _$JsonConverterToJson( + instance.deletedAt, + const StreamDateTimeConverter().toJson, + ), + 'downvote_count': instance.downvoteCount, + 'edited_at': _$JsonConverterToJson( + instance.editedAt, + const StreamDateTimeConverter().toJson, + ), + 'i18n': instance.i18n, + 'id': instance.id, + 'latest_reactions': instance.latestReactions?.map((e) => e.toJson()).toList(), + 'mentioned_users': instance.mentionedUsers.map((e) => e.toJson()).toList(), + 'moderation': instance.moderation?.toJson(), + 'object_id': instance.objectId, + 'object_type': instance.objectType, + 'own_reactions': instance.ownReactions.map((e) => e.toJson()).toList(), + 'parent_id': instance.parentId, + 'reaction_count': instance.reactionCount, + 'reaction_groups': instance.reactionGroups?.map( + (k, e) => MapEntry(k, e.toJson()), + ), + 'reply_count': instance.replyCount, + 'score': instance.score, + 'status': instance.status, + 'text': instance.text, + 'updated_at': const StreamDateTimeConverter().toJson(instance.updatedAt), + 'upvote_count': instance.upvoteCount, + 'user': instance.user.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/field.dart b/packages/stream_chat/lib/open_api/model/field.dart new file mode 100644 index 0000000000..f9f14ce48e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/field.dart @@ -0,0 +1,41 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'field.g.dart'; +part 'field.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class Field with _$Field { + const Field({ + required this.short, + required this.title, + required this.value, + }); + + @override + @JsonKey(name: 'short') + final bool short; + + @override + @JsonKey(name: 'title') + final String title; + + @override + @JsonKey(name: 'value') + final String value; + + Map toJson() => _$FieldToJson(this); + + static Field fromJson(Map json) => _$FieldFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/field.freezed.dart b/packages/stream_chat/lib/open_api/model/field.freezed.dart new file mode 100644 index 0000000000..d26e1aeb8a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/field.freezed.dart @@ -0,0 +1,85 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'field.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$Field { + bool get short; + String get title; + String get value; + + /// Create a copy of Field + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $FieldCopyWith get copyWith => _$FieldCopyWithImpl(this as Field, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is Field && + (identical(other.short, short) || other.short == short) && + (identical(other.title, title) || other.title == title) && + (identical(other.value, value) || other.value == value)); + } + + @override + int get hashCode => Object.hash(runtimeType, short, title, value); + + @override + String toString() { + return 'Field(short: $short, title: $title, value: $value)'; + } +} + +/// @nodoc +abstract mixin class $FieldCopyWith<$Res> { + factory $FieldCopyWith(Field value, $Res Function(Field) _then) = _$FieldCopyWithImpl; + @useResult + $Res call({bool short, String title, String value}); +} + +/// @nodoc +class _$FieldCopyWithImpl<$Res> implements $FieldCopyWith<$Res> { + _$FieldCopyWithImpl(this._self, this._then); + + final Field _self; + final $Res Function(Field) _then; + + /// Create a copy of Field + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? short = null, + Object? title = null, + Object? value = null, + }) { + return _then( + Field( + short: null == short + ? _self.short + : short // ignore: cast_nullable_to_non_nullable + as bool, + title: null == title + ? _self.title + : title // ignore: cast_nullable_to_non_nullable + as String, + value: null == value + ? _self.value + : value // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/field.g.dart b/packages/stream_chat/lib/open_api/model/field.g.dart new file mode 100644 index 0000000000..702caeab66 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/field.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'field.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +Field _$FieldFromJson(Map json) => Field( + short: json['short'] as bool, + title: json['title'] as String, + value: json['value'] as String, +); + +Map _$FieldToJson(Field instance) => { + 'short': instance.short, + 'title': instance.title, + 'value': instance.value, +}; diff --git a/packages/stream_chat/lib/open_api/model/file_upload_config.dart b/packages/stream_chat/lib/open_api/model/file_upload_config.dart new file mode 100644 index 0000000000..7676de0bd2 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/file_upload_config.dart @@ -0,0 +1,51 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'file_upload_config.g.dart'; +part 'file_upload_config.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class FileUploadConfig with _$FileUploadConfig { + const FileUploadConfig({ + required this.allowedFileExtensions, + required this.allowedMimeTypes, + required this.blockedFileExtensions, + required this.blockedMimeTypes, + required this.sizeLimit, + }); + + @override + @JsonKey(name: 'allowed_file_extensions') + final List allowedFileExtensions; + + @override + @JsonKey(name: 'allowed_mime_types') + final List allowedMimeTypes; + + @override + @JsonKey(name: 'blocked_file_extensions') + final List blockedFileExtensions; + + @override + @JsonKey(name: 'blocked_mime_types') + final List blockedMimeTypes; + + @override + @JsonKey(name: 'size_limit') + final int sizeLimit; + + Map toJson() => _$FileUploadConfigToJson(this); + + static FileUploadConfig fromJson(Map json) => _$FileUploadConfigFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/file_upload_config.freezed.dart b/packages/stream_chat/lib/open_api/model/file_upload_config.freezed.dart new file mode 100644 index 0000000000..5e3dea7a24 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/file_upload_config.freezed.dart @@ -0,0 +1,130 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'file_upload_config.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$FileUploadConfig { + List get allowedFileExtensions; + List get allowedMimeTypes; + List get blockedFileExtensions; + List get blockedMimeTypes; + int get sizeLimit; + + /// Create a copy of FileUploadConfig + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $FileUploadConfigCopyWith get copyWith => _$FileUploadConfigCopyWithImpl( + this as FileUploadConfig, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is FileUploadConfig && + const DeepCollectionEquality().equals( + other.allowedFileExtensions, + allowedFileExtensions, + ) && + const DeepCollectionEquality().equals( + other.allowedMimeTypes, + allowedMimeTypes, + ) && + const DeepCollectionEquality().equals( + other.blockedFileExtensions, + blockedFileExtensions, + ) && + const DeepCollectionEquality().equals( + other.blockedMimeTypes, + blockedMimeTypes, + ) && + (identical(other.sizeLimit, sizeLimit) || other.sizeLimit == sizeLimit)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(allowedFileExtensions), + const DeepCollectionEquality().hash(allowedMimeTypes), + const DeepCollectionEquality().hash(blockedFileExtensions), + const DeepCollectionEquality().hash(blockedMimeTypes), + sizeLimit, + ); + + @override + String toString() { + return 'FileUploadConfig(allowedFileExtensions: $allowedFileExtensions, allowedMimeTypes: $allowedMimeTypes, blockedFileExtensions: $blockedFileExtensions, blockedMimeTypes: $blockedMimeTypes, sizeLimit: $sizeLimit)'; + } +} + +/// @nodoc +abstract mixin class $FileUploadConfigCopyWith<$Res> { + factory $FileUploadConfigCopyWith( + FileUploadConfig value, + $Res Function(FileUploadConfig) _then, + ) = _$FileUploadConfigCopyWithImpl; + @useResult + $Res call({ + List allowedFileExtensions, + List allowedMimeTypes, + List blockedFileExtensions, + List blockedMimeTypes, + int sizeLimit, + }); +} + +/// @nodoc +class _$FileUploadConfigCopyWithImpl<$Res> implements $FileUploadConfigCopyWith<$Res> { + _$FileUploadConfigCopyWithImpl(this._self, this._then); + + final FileUploadConfig _self; + final $Res Function(FileUploadConfig) _then; + + /// Create a copy of FileUploadConfig + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? allowedFileExtensions = null, + Object? allowedMimeTypes = null, + Object? blockedFileExtensions = null, + Object? blockedMimeTypes = null, + Object? sizeLimit = null, + }) { + return _then( + FileUploadConfig( + allowedFileExtensions: null == allowedFileExtensions + ? _self.allowedFileExtensions + : allowedFileExtensions // ignore: cast_nullable_to_non_nullable + as List, + allowedMimeTypes: null == allowedMimeTypes + ? _self.allowedMimeTypes + : allowedMimeTypes // ignore: cast_nullable_to_non_nullable + as List, + blockedFileExtensions: null == blockedFileExtensions + ? _self.blockedFileExtensions + : blockedFileExtensions // ignore: cast_nullable_to_non_nullable + as List, + blockedMimeTypes: null == blockedMimeTypes + ? _self.blockedMimeTypes + : blockedMimeTypes // ignore: cast_nullable_to_non_nullable + as List, + sizeLimit: null == sizeLimit + ? _self.sizeLimit + : sizeLimit // ignore: cast_nullable_to_non_nullable + as int, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/file_upload_config.g.dart b/packages/stream_chat/lib/open_api/model/file_upload_config.g.dart new file mode 100644 index 0000000000..18c46240fd --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/file_upload_config.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'file_upload_config.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +FileUploadConfig _$FileUploadConfigFromJson(Map json) => FileUploadConfig( + allowedFileExtensions: (json['allowed_file_extensions'] as List).map((e) => e as String).toList(), + allowedMimeTypes: (json['allowed_mime_types'] as List).map((e) => e as String).toList(), + blockedFileExtensions: (json['blocked_file_extensions'] as List).map((e) => e as String).toList(), + blockedMimeTypes: (json['blocked_mime_types'] as List).map((e) => e as String).toList(), + sizeLimit: (json['size_limit'] as num).toInt(), +); + +Map _$FileUploadConfigToJson(FileUploadConfig instance) => { + 'allowed_file_extensions': instance.allowedFileExtensions, + 'allowed_mime_types': instance.allowedMimeTypes, + 'blocked_file_extensions': instance.blockedFileExtensions, + 'blocked_mime_types': instance.blockedMimeTypes, + 'size_limit': instance.sizeLimit, +}; diff --git a/packages/stream_chat/lib/open_api/model/file_upload_request.dart b/packages/stream_chat/lib/open_api/model/file_upload_request.dart new file mode 100644 index 0000000000..bd4d8e4dac --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/file_upload_request.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'file_upload_request.g.dart'; +part 'file_upload_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class FileUploadRequest with _$FileUploadRequest { + const FileUploadRequest({ + this.file, + this.user, + }); + + @override + @JsonKey(name: 'file') + final String? file; + + @override + @JsonKey(name: 'user') + final OnlyUserID? user; + + Map toJson() => _$FileUploadRequestToJson(this); + + static FileUploadRequest fromJson(Map json) => _$FileUploadRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/file_upload_request.freezed.dart b/packages/stream_chat/lib/open_api/model/file_upload_request.freezed.dart new file mode 100644 index 0000000000..3170692a34 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/file_upload_request.freezed.dart @@ -0,0 +1,81 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'file_upload_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$FileUploadRequest { + String? get file; + OnlyUserID? get user; + + /// Create a copy of FileUploadRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $FileUploadRequestCopyWith get copyWith => _$FileUploadRequestCopyWithImpl( + this as FileUploadRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is FileUploadRequest && + (identical(other.file, file) || other.file == file) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash(runtimeType, file, user); + + @override + String toString() { + return 'FileUploadRequest(file: $file, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $FileUploadRequestCopyWith<$Res> { + factory $FileUploadRequestCopyWith( + FileUploadRequest value, + $Res Function(FileUploadRequest) _then, + ) = _$FileUploadRequestCopyWithImpl; + @useResult + $Res call({String? file, OnlyUserID? user}); +} + +/// @nodoc +class _$FileUploadRequestCopyWithImpl<$Res> implements $FileUploadRequestCopyWith<$Res> { + _$FileUploadRequestCopyWithImpl(this._self, this._then); + + final FileUploadRequest _self; + final $Res Function(FileUploadRequest) _then; + + /// Create a copy of FileUploadRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? file = freezed, Object? user = freezed}) { + return _then( + FileUploadRequest( + file: freezed == file + ? _self.file + : file // ignore: cast_nullable_to_non_nullable + as String?, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as OnlyUserID?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/file_upload_request.g.dart b/packages/stream_chat/lib/open_api/model/file_upload_request.g.dart new file mode 100644 index 0000000000..3d765d25d2 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/file_upload_request.g.dart @@ -0,0 +1,17 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'file_upload_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +FileUploadRequest _$FileUploadRequestFromJson(Map json) => FileUploadRequest( + file: json['file'] as String?, + user: json['user'] == null ? null : OnlyUserID.fromJson(json['user'] as Map), +); + +Map _$FileUploadRequestToJson(FileUploadRequest instance) => { + 'file': instance.file, + 'user': instance.user?.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/file_upload_response.dart b/packages/stream_chat/lib/open_api/model/file_upload_response.dart new file mode 100644 index 0000000000..e59aa77268 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/file_upload_response.dart @@ -0,0 +1,41 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'file_upload_response.g.dart'; +part 'file_upload_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class FileUploadResponse with _$FileUploadResponse { + const FileUploadResponse({ + required this.duration, + this.file, + this.thumbUrl, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'file') + final String? file; + + @override + @JsonKey(name: 'thumb_url') + final String? thumbUrl; + + Map toJson() => _$FileUploadResponseToJson(this); + + static FileUploadResponse fromJson(Map json) => _$FileUploadResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/file_upload_response.freezed.dart b/packages/stream_chat/lib/open_api/model/file_upload_response.freezed.dart new file mode 100644 index 0000000000..5e5971852c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/file_upload_response.freezed.dart @@ -0,0 +1,91 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'file_upload_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$FileUploadResponse { + String get duration; + String? get file; + String? get thumbUrl; + + /// Create a copy of FileUploadResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $FileUploadResponseCopyWith get copyWith => _$FileUploadResponseCopyWithImpl( + this as FileUploadResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is FileUploadResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.file, file) || other.file == file) && + (identical(other.thumbUrl, thumbUrl) || other.thumbUrl == thumbUrl)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration, file, thumbUrl); + + @override + String toString() { + return 'FileUploadResponse(duration: $duration, file: $file, thumbUrl: $thumbUrl)'; + } +} + +/// @nodoc +abstract mixin class $FileUploadResponseCopyWith<$Res> { + factory $FileUploadResponseCopyWith( + FileUploadResponse value, + $Res Function(FileUploadResponse) _then, + ) = _$FileUploadResponseCopyWithImpl; + @useResult + $Res call({String duration, String? file, String? thumbUrl}); +} + +/// @nodoc +class _$FileUploadResponseCopyWithImpl<$Res> implements $FileUploadResponseCopyWith<$Res> { + _$FileUploadResponseCopyWithImpl(this._self, this._then); + + final FileUploadResponse _self; + final $Res Function(FileUploadResponse) _then; + + /// Create a copy of FileUploadResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? duration = null, + Object? file = freezed, + Object? thumbUrl = freezed, + }) { + return _then( + FileUploadResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + file: freezed == file + ? _self.file + : file // ignore: cast_nullable_to_non_nullable + as String?, + thumbUrl: freezed == thumbUrl + ? _self.thumbUrl + : thumbUrl // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/file_upload_response.g.dart b/packages/stream_chat/lib/open_api/model/file_upload_response.g.dart new file mode 100644 index 0000000000..9621bbf238 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/file_upload_response.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'file_upload_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +FileUploadResponse _$FileUploadResponseFromJson(Map json) => FileUploadResponse( + duration: json['duration'] as String, + file: json['file'] as String?, + thumbUrl: json['thumb_url'] as String?, +); + +Map _$FileUploadResponseToJson(FileUploadResponse instance) => { + 'duration': instance.duration, + 'file': instance.file, + 'thumb_url': instance.thumbUrl, +}; diff --git a/packages/stream_chat/lib/open_api/model/filter_config_response.dart b/packages/stream_chat/lib/open_api/model/filter_config_response.dart new file mode 100644 index 0000000000..6a13efc34e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/filter_config_response.dart @@ -0,0 +1,56 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'filter_config_response.g.dart'; +part 'filter_config_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class FilterConfigResponse with _$FilterConfigResponse { + const FilterConfigResponse({ + this.aiImageLabels, + this.aiImageTaxonomy, + this.aiTextLabels, + this.configKeys, + this.filterableCustomKeys, + required this.llmLabels, + }); + + @override + @JsonKey(name: 'ai_image_labels') + final List? aiImageLabels; + + @override + @JsonKey(name: 'ai_image_taxonomy') + final Map>? aiImageTaxonomy; + + @override + @JsonKey(name: 'ai_text_labels') + final List? aiTextLabels; + + @override + @JsonKey(name: 'config_keys') + final List? configKeys; + + @override + @JsonKey(name: 'filterable_custom_keys') + final List? filterableCustomKeys; + + @override + @JsonKey(name: 'llm_labels') + final List llmLabels; + + Map toJson() => _$FilterConfigResponseToJson(this); + + static FilterConfigResponse fromJson(Map json) => _$FilterConfigResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/filter_config_response.freezed.dart b/packages/stream_chat/lib/open_api/model/filter_config_response.freezed.dart new file mode 100644 index 0000000000..c3ad6cab8f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/filter_config_response.freezed.dart @@ -0,0 +1,143 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'filter_config_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$FilterConfigResponse { + List? get aiImageLabels; + Map>? get aiImageTaxonomy; + List? get aiTextLabels; + List? get configKeys; + List? get filterableCustomKeys; + List get llmLabels; + + /// Create a copy of FilterConfigResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $FilterConfigResponseCopyWith get copyWith => + _$FilterConfigResponseCopyWithImpl( + this as FilterConfigResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is FilterConfigResponse && + const DeepCollectionEquality().equals( + other.aiImageLabels, + aiImageLabels, + ) && + const DeepCollectionEquality().equals( + other.aiImageTaxonomy, + aiImageTaxonomy, + ) && + const DeepCollectionEquality().equals( + other.aiTextLabels, + aiTextLabels, + ) && + const DeepCollectionEquality().equals( + other.configKeys, + configKeys, + ) && + const DeepCollectionEquality().equals( + other.filterableCustomKeys, + filterableCustomKeys, + ) && + const DeepCollectionEquality().equals(other.llmLabels, llmLabels)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(aiImageLabels), + const DeepCollectionEquality().hash(aiImageTaxonomy), + const DeepCollectionEquality().hash(aiTextLabels), + const DeepCollectionEquality().hash(configKeys), + const DeepCollectionEquality().hash(filterableCustomKeys), + const DeepCollectionEquality().hash(llmLabels), + ); + + @override + String toString() { + return 'FilterConfigResponse(aiImageLabels: $aiImageLabels, aiImageTaxonomy: $aiImageTaxonomy, aiTextLabels: $aiTextLabels, configKeys: $configKeys, filterableCustomKeys: $filterableCustomKeys, llmLabels: $llmLabels)'; + } +} + +/// @nodoc +abstract mixin class $FilterConfigResponseCopyWith<$Res> { + factory $FilterConfigResponseCopyWith( + FilterConfigResponse value, + $Res Function(FilterConfigResponse) _then, + ) = _$FilterConfigResponseCopyWithImpl; + @useResult + $Res call({ + List? aiImageLabels, + Map>? aiImageTaxonomy, + List? aiTextLabels, + List? configKeys, + List? filterableCustomKeys, + List llmLabels, + }); +} + +/// @nodoc +class _$FilterConfigResponseCopyWithImpl<$Res> implements $FilterConfigResponseCopyWith<$Res> { + _$FilterConfigResponseCopyWithImpl(this._self, this._then); + + final FilterConfigResponse _self; + final $Res Function(FilterConfigResponse) _then; + + /// Create a copy of FilterConfigResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? aiImageLabels = freezed, + Object? aiImageTaxonomy = freezed, + Object? aiTextLabels = freezed, + Object? configKeys = freezed, + Object? filterableCustomKeys = freezed, + Object? llmLabels = null, + }) { + return _then( + FilterConfigResponse( + aiImageLabels: freezed == aiImageLabels + ? _self.aiImageLabels + : aiImageLabels // ignore: cast_nullable_to_non_nullable + as List?, + aiImageTaxonomy: freezed == aiImageTaxonomy + ? _self.aiImageTaxonomy + : aiImageTaxonomy // ignore: cast_nullable_to_non_nullable + as Map>?, + aiTextLabels: freezed == aiTextLabels + ? _self.aiTextLabels + : aiTextLabels // ignore: cast_nullable_to_non_nullable + as List?, + configKeys: freezed == configKeys + ? _self.configKeys + : configKeys // ignore: cast_nullable_to_non_nullable + as List?, + filterableCustomKeys: freezed == filterableCustomKeys + ? _self.filterableCustomKeys + : filterableCustomKeys // ignore: cast_nullable_to_non_nullable + as List?, + llmLabels: null == llmLabels + ? _self.llmLabels + : llmLabels // ignore: cast_nullable_to_non_nullable + as List, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/filter_config_response.g.dart b/packages/stream_chat/lib/open_api/model/filter_config_response.g.dart new file mode 100644 index 0000000000..373695af68 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/filter_config_response.g.dart @@ -0,0 +1,31 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'filter_config_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +FilterConfigResponse _$FilterConfigResponseFromJson( + Map json, +) => FilterConfigResponse( + aiImageLabels: (json['ai_image_labels'] as List?)?.map((e) => e as String).toList(), + aiImageTaxonomy: (json['ai_image_taxonomy'] as Map?)?.map( + (k, e) => MapEntry(k, (e as List).map((e) => e as String).toList()), + ), + aiTextLabels: (json['ai_text_labels'] as List?)?.map((e) => e as String).toList(), + configKeys: (json['config_keys'] as List?)?.map((e) => e as String).toList(), + filterableCustomKeys: (json['filterable_custom_keys'] as List?)?.map((e) => e as String).toList(), + llmLabels: (json['llm_labels'] as List).map((e) => e as String).toList(), +); + +Map _$FilterConfigResponseToJson( + FilterConfigResponse instance, +) => { + 'ai_image_labels': instance.aiImageLabels, + 'ai_image_taxonomy': instance.aiImageTaxonomy, + 'ai_text_labels': instance.aiTextLabels, + 'config_keys': instance.configKeys, + 'filterable_custom_keys': instance.filterableCustomKeys, + 'llm_labels': instance.llmLabels, +}; diff --git a/packages/stream_chat/lib/open_api/model/flag_count_rule_parameters.dart b/packages/stream_chat/lib/open_api/model/flag_count_rule_parameters.dart new file mode 100644 index 0000000000..8fffe5be62 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/flag_count_rule_parameters.dart @@ -0,0 +1,31 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'flag_count_rule_parameters.g.dart'; +part 'flag_count_rule_parameters.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class FlagCountRuleParameters with _$FlagCountRuleParameters { + const FlagCountRuleParameters({ + this.threshold, + }); + + @override + @JsonKey(name: 'threshold') + final int? threshold; + + Map toJson() => _$FlagCountRuleParametersToJson(this); + + static FlagCountRuleParameters fromJson(Map json) => _$FlagCountRuleParametersFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/flag_count_rule_parameters.freezed.dart b/packages/stream_chat/lib/open_api/model/flag_count_rule_parameters.freezed.dart new file mode 100644 index 0000000000..d6587538ea --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/flag_count_rule_parameters.freezed.dart @@ -0,0 +1,76 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'flag_count_rule_parameters.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$FlagCountRuleParameters { + int? get threshold; + + /// Create a copy of FlagCountRuleParameters + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $FlagCountRuleParametersCopyWith get copyWith => + _$FlagCountRuleParametersCopyWithImpl( + this as FlagCountRuleParameters, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is FlagCountRuleParameters && + (identical(other.threshold, threshold) || other.threshold == threshold)); + } + + @override + int get hashCode => Object.hash(runtimeType, threshold); + + @override + String toString() { + return 'FlagCountRuleParameters(threshold: $threshold)'; + } +} + +/// @nodoc +abstract mixin class $FlagCountRuleParametersCopyWith<$Res> { + factory $FlagCountRuleParametersCopyWith( + FlagCountRuleParameters value, + $Res Function(FlagCountRuleParameters) _then, + ) = _$FlagCountRuleParametersCopyWithImpl; + @useResult + $Res call({int? threshold}); +} + +/// @nodoc +class _$FlagCountRuleParametersCopyWithImpl<$Res> implements $FlagCountRuleParametersCopyWith<$Res> { + _$FlagCountRuleParametersCopyWithImpl(this._self, this._then); + + final FlagCountRuleParameters _self; + final $Res Function(FlagCountRuleParameters) _then; + + /// Create a copy of FlagCountRuleParameters + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? threshold = freezed}) { + return _then( + FlagCountRuleParameters( + threshold: freezed == threshold + ? _self.threshold + : threshold // ignore: cast_nullable_to_non_nullable + as int?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/flag_count_rule_parameters.g.dart b/packages/stream_chat/lib/open_api/model/flag_count_rule_parameters.g.dart new file mode 100644 index 0000000000..e3441c66d2 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/flag_count_rule_parameters.g.dart @@ -0,0 +1,15 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'flag_count_rule_parameters.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +FlagCountRuleParameters _$FlagCountRuleParametersFromJson( + Map json, +) => FlagCountRuleParameters(threshold: (json['threshold'] as num?)?.toInt()); + +Map _$FlagCountRuleParametersToJson( + FlagCountRuleParameters instance, +) => {'threshold': instance.threshold}; diff --git a/packages/stream_chat/lib/open_api/model/flag_details_response.dart b/packages/stream_chat/lib/open_api/model/flag_details_response.dart new file mode 100644 index 0000000000..a00eeaf3c4 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/flag_details_response.dart @@ -0,0 +1,41 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'flag_details_response.g.dart'; +part 'flag_details_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class FlagDetailsResponse with _$FlagDetailsResponse { + const FlagDetailsResponse({ + this.automod, + this.extra, + required this.originalText, + }); + + @override + @JsonKey(name: 'automod') + final AutomodDetailsResponse? automod; + + @override + @JsonKey(name: 'extra') + final Map? extra; + + @override + @JsonKey(name: 'original_text') + final String originalText; + + Map toJson() => _$FlagDetailsResponseToJson(this); + + static FlagDetailsResponse fromJson(Map json) => _$FlagDetailsResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/flag_details_response.freezed.dart b/packages/stream_chat/lib/open_api/model/flag_details_response.freezed.dart new file mode 100644 index 0000000000..728575ddf0 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/flag_details_response.freezed.dart @@ -0,0 +1,101 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'flag_details_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$FlagDetailsResponse { + AutomodDetailsResponse? get automod; + Map? get extra; + String get originalText; + + /// Create a copy of FlagDetailsResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $FlagDetailsResponseCopyWith get copyWith => + _$FlagDetailsResponseCopyWithImpl( + this as FlagDetailsResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is FlagDetailsResponse && + (identical(other.automod, automod) || other.automod == automod) && + const DeepCollectionEquality().equals(other.extra, extra) && + (identical(other.originalText, originalText) || other.originalText == originalText)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + automod, + const DeepCollectionEquality().hash(extra), + originalText, + ); + + @override + String toString() { + return 'FlagDetailsResponse(automod: $automod, extra: $extra, originalText: $originalText)'; + } +} + +/// @nodoc +abstract mixin class $FlagDetailsResponseCopyWith<$Res> { + factory $FlagDetailsResponseCopyWith( + FlagDetailsResponse value, + $Res Function(FlagDetailsResponse) _then, + ) = _$FlagDetailsResponseCopyWithImpl; + @useResult + $Res call({ + AutomodDetailsResponse? automod, + Map? extra, + String originalText, + }); +} + +/// @nodoc +class _$FlagDetailsResponseCopyWithImpl<$Res> implements $FlagDetailsResponseCopyWith<$Res> { + _$FlagDetailsResponseCopyWithImpl(this._self, this._then); + + final FlagDetailsResponse _self; + final $Res Function(FlagDetailsResponse) _then; + + /// Create a copy of FlagDetailsResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? automod = freezed, + Object? extra = freezed, + Object? originalText = null, + }) { + return _then( + FlagDetailsResponse( + automod: freezed == automod + ? _self.automod + : automod // ignore: cast_nullable_to_non_nullable + as AutomodDetailsResponse?, + extra: freezed == extra + ? _self.extra + : extra // ignore: cast_nullable_to_non_nullable + as Map?, + originalText: null == originalText + ? _self.originalText + : originalText // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/flag_details_response.g.dart b/packages/stream_chat/lib/open_api/model/flag_details_response.g.dart new file mode 100644 index 0000000000..3bbb97f1d6 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/flag_details_response.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'flag_details_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +FlagDetailsResponse _$FlagDetailsResponseFromJson(Map json) => FlagDetailsResponse( + automod: json['automod'] == null + ? null + : AutomodDetailsResponse.fromJson( + json['automod'] as Map, + ), + extra: json['extra'] as Map?, + originalText: json['original_text'] as String, +); + +Map _$FlagDetailsResponseToJson( + FlagDetailsResponse instance, +) => { + 'automod': instance.automod?.toJson(), + 'extra': instance.extra, + 'original_text': instance.originalText, +}; diff --git a/packages/stream_chat/lib/open_api/model/flag_feedback_response.dart b/packages/stream_chat/lib/open_api/model/flag_feedback_response.dart new file mode 100644 index 0000000000..5a8beba58a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/flag_feedback_response.dart @@ -0,0 +1,42 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'flag_feedback_response.g.dart'; +part 'flag_feedback_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class FlagFeedbackResponse with _$FlagFeedbackResponse { + const FlagFeedbackResponse({ + required this.createdAt, + required this.labels, + required this.messageId, + }); + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'labels') + final List labels; + + @override + @JsonKey(name: 'message_id') + final String messageId; + + Map toJson() => _$FlagFeedbackResponseToJson(this); + + static FlagFeedbackResponse fromJson(Map json) => _$FlagFeedbackResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/flag_feedback_response.freezed.dart b/packages/stream_chat/lib/open_api/model/flag_feedback_response.freezed.dart new file mode 100644 index 0000000000..b5eca256b3 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/flag_feedback_response.freezed.dart @@ -0,0 +1,97 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'flag_feedback_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$FlagFeedbackResponse { + DateTime get createdAt; + List get labels; + String get messageId; + + /// Create a copy of FlagFeedbackResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $FlagFeedbackResponseCopyWith get copyWith => + _$FlagFeedbackResponseCopyWithImpl( + this as FlagFeedbackResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is FlagFeedbackResponse && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.labels, labels) && + (identical(other.messageId, messageId) || other.messageId == messageId)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + createdAt, + const DeepCollectionEquality().hash(labels), + messageId, + ); + + @override + String toString() { + return 'FlagFeedbackResponse(createdAt: $createdAt, labels: $labels, messageId: $messageId)'; + } +} + +/// @nodoc +abstract mixin class $FlagFeedbackResponseCopyWith<$Res> { + factory $FlagFeedbackResponseCopyWith( + FlagFeedbackResponse value, + $Res Function(FlagFeedbackResponse) _then, + ) = _$FlagFeedbackResponseCopyWithImpl; + @useResult + $Res call({DateTime createdAt, List labels, String messageId}); +} + +/// @nodoc +class _$FlagFeedbackResponseCopyWithImpl<$Res> implements $FlagFeedbackResponseCopyWith<$Res> { + _$FlagFeedbackResponseCopyWithImpl(this._self, this._then); + + final FlagFeedbackResponse _self; + final $Res Function(FlagFeedbackResponse) _then; + + /// Create a copy of FlagFeedbackResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? createdAt = null, + Object? labels = null, + Object? messageId = null, + }) { + return _then( + FlagFeedbackResponse( + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + labels: null == labels + ? _self.labels + : labels // ignore: cast_nullable_to_non_nullable + as List, + messageId: null == messageId + ? _self.messageId + : messageId // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/flag_feedback_response.g.dart b/packages/stream_chat/lib/open_api/model/flag_feedback_response.g.dart new file mode 100644 index 0000000000..10cf033660 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/flag_feedback_response.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'flag_feedback_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +FlagFeedbackResponse _$FlagFeedbackResponseFromJson( + Map json, +) => FlagFeedbackResponse( + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + labels: (json['labels'] as List).map((e) => LabelResponse.fromJson(e as Map)).toList(), + messageId: json['message_id'] as String, +); + +Map _$FlagFeedbackResponseToJson( + FlagFeedbackResponse instance, +) => { + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'labels': instance.labels.map((e) => e.toJson()).toList(), + 'message_id': instance.messageId, +}; diff --git a/packages/stream_chat/lib/open_api/model/flag_item_response.dart b/packages/stream_chat/lib/open_api/model/flag_item_response.dart new file mode 100644 index 0000000000..bc065d9043 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/flag_item_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'flag_item_response.g.dart'; +part 'flag_item_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class FlagItemResponse with _$FlagItemResponse { + const FlagItemResponse({ + required this.duration, + required this.itemId, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'item_id') + final String itemId; + + Map toJson() => _$FlagItemResponseToJson(this); + + static FlagItemResponse fromJson(Map json) => _$FlagItemResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/flag_item_response.freezed.dart b/packages/stream_chat/lib/open_api/model/flag_item_response.freezed.dart new file mode 100644 index 0000000000..4fbcdbbca7 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/flag_item_response.freezed.dart @@ -0,0 +1,81 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'flag_item_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$FlagItemResponse { + String get duration; + String get itemId; + + /// Create a copy of FlagItemResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $FlagItemResponseCopyWith get copyWith => _$FlagItemResponseCopyWithImpl( + this as FlagItemResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is FlagItemResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.itemId, itemId) || other.itemId == itemId)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration, itemId); + + @override + String toString() { + return 'FlagItemResponse(duration: $duration, itemId: $itemId)'; + } +} + +/// @nodoc +abstract mixin class $FlagItemResponseCopyWith<$Res> { + factory $FlagItemResponseCopyWith( + FlagItemResponse value, + $Res Function(FlagItemResponse) _then, + ) = _$FlagItemResponseCopyWithImpl; + @useResult + $Res call({String duration, String itemId}); +} + +/// @nodoc +class _$FlagItemResponseCopyWithImpl<$Res> implements $FlagItemResponseCopyWith<$Res> { + _$FlagItemResponseCopyWithImpl(this._self, this._then); + + final FlagItemResponse _self; + final $Res Function(FlagItemResponse) _then; + + /// Create a copy of FlagItemResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? itemId = null}) { + return _then( + FlagItemResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + itemId: null == itemId + ? _self.itemId + : itemId // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/flag_item_response.g.dart b/packages/stream_chat/lib/open_api/model/flag_item_response.g.dart new file mode 100644 index 0000000000..58d8b2d407 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/flag_item_response.g.dart @@ -0,0 +1,17 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'flag_item_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +FlagItemResponse _$FlagItemResponseFromJson(Map json) => FlagItemResponse( + duration: json['duration'] as String, + itemId: json['item_id'] as String, +); + +Map _$FlagItemResponseToJson(FlagItemResponse instance) => { + 'duration': instance.duration, + 'item_id': instance.itemId, +}; diff --git a/packages/stream_chat/lib/open_api/model/flag_message_details_response.dart b/packages/stream_chat/lib/open_api/model/flag_message_details_response.dart new file mode 100644 index 0000000000..3cd20a9ac8 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/flag_message_details_response.dart @@ -0,0 +1,46 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'flag_message_details_response.g.dart'; +part 'flag_message_details_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class FlagMessageDetailsResponse with _$FlagMessageDetailsResponse { + const FlagMessageDetailsResponse({ + this.pinChanged, + this.shouldEnrich, + this.skipPush, + this.updatedById, + }); + + @override + @JsonKey(name: 'pin_changed') + final bool? pinChanged; + + @override + @JsonKey(name: 'should_enrich') + final bool? shouldEnrich; + + @override + @JsonKey(name: 'skip_push') + final bool? skipPush; + + @override + @JsonKey(name: 'updated_by_id') + final String? updatedById; + + Map toJson() => _$FlagMessageDetailsResponseToJson(this); + + static FlagMessageDetailsResponse fromJson(Map json) => _$FlagMessageDetailsResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/flag_message_details_response.freezed.dart b/packages/stream_chat/lib/open_api/model/flag_message_details_response.freezed.dart new file mode 100644 index 0000000000..79d807671c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/flag_message_details_response.freezed.dart @@ -0,0 +1,104 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'flag_message_details_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$FlagMessageDetailsResponse { + bool? get pinChanged; + bool? get shouldEnrich; + bool? get skipPush; + String? get updatedById; + + /// Create a copy of FlagMessageDetailsResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $FlagMessageDetailsResponseCopyWith get copyWith => + _$FlagMessageDetailsResponseCopyWithImpl( + this as FlagMessageDetailsResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is FlagMessageDetailsResponse && + (identical(other.pinChanged, pinChanged) || other.pinChanged == pinChanged) && + (identical(other.shouldEnrich, shouldEnrich) || other.shouldEnrich == shouldEnrich) && + (identical(other.skipPush, skipPush) || other.skipPush == skipPush) && + (identical(other.updatedById, updatedById) || other.updatedById == updatedById)); + } + + @override + int get hashCode => Object.hash(runtimeType, pinChanged, shouldEnrich, skipPush, updatedById); + + @override + String toString() { + return 'FlagMessageDetailsResponse(pinChanged: $pinChanged, shouldEnrich: $shouldEnrich, skipPush: $skipPush, updatedById: $updatedById)'; + } +} + +/// @nodoc +abstract mixin class $FlagMessageDetailsResponseCopyWith<$Res> { + factory $FlagMessageDetailsResponseCopyWith( + FlagMessageDetailsResponse value, + $Res Function(FlagMessageDetailsResponse) _then, + ) = _$FlagMessageDetailsResponseCopyWithImpl; + @useResult + $Res call({ + bool? pinChanged, + bool? shouldEnrich, + bool? skipPush, + String? updatedById, + }); +} + +/// @nodoc +class _$FlagMessageDetailsResponseCopyWithImpl<$Res> implements $FlagMessageDetailsResponseCopyWith<$Res> { + _$FlagMessageDetailsResponseCopyWithImpl(this._self, this._then); + + final FlagMessageDetailsResponse _self; + final $Res Function(FlagMessageDetailsResponse) _then; + + /// Create a copy of FlagMessageDetailsResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? pinChanged = freezed, + Object? shouldEnrich = freezed, + Object? skipPush = freezed, + Object? updatedById = freezed, + }) { + return _then( + FlagMessageDetailsResponse( + pinChanged: freezed == pinChanged + ? _self.pinChanged + : pinChanged // ignore: cast_nullable_to_non_nullable + as bool?, + shouldEnrich: freezed == shouldEnrich + ? _self.shouldEnrich + : shouldEnrich // ignore: cast_nullable_to_non_nullable + as bool?, + skipPush: freezed == skipPush + ? _self.skipPush + : skipPush // ignore: cast_nullable_to_non_nullable + as bool?, + updatedById: freezed == updatedById + ? _self.updatedById + : updatedById // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/flag_message_details_response.g.dart b/packages/stream_chat/lib/open_api/model/flag_message_details_response.g.dart new file mode 100644 index 0000000000..03340e6814 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/flag_message_details_response.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'flag_message_details_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +FlagMessageDetailsResponse _$FlagMessageDetailsResponseFromJson( + Map json, +) => FlagMessageDetailsResponse( + pinChanged: json['pin_changed'] as bool?, + shouldEnrich: json['should_enrich'] as bool?, + skipPush: json['skip_push'] as bool?, + updatedById: json['updated_by_id'] as String?, +); + +Map _$FlagMessageDetailsResponseToJson( + FlagMessageDetailsResponse instance, +) => { + 'pin_changed': instance.pinChanged, + 'should_enrich': instance.shouldEnrich, + 'skip_push': instance.skipPush, + 'updated_by_id': instance.updatedById, +}; diff --git a/packages/stream_chat/lib/open_api/model/flag_request.dart b/packages/stream_chat/lib/open_api/model/flag_request.dart new file mode 100644 index 0000000000..04f8f5706a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/flag_request.dart @@ -0,0 +1,56 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'flag_request.g.dart'; +part 'flag_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class FlagRequest with _$FlagRequest { + const FlagRequest({ + this.custom, + this.entityCreatorId, + required this.entityId, + required this.entityType, + this.moderationPayload, + this.reason, + }); + + @override + @JsonKey(name: 'custom') + final Map? custom; + + @override + @JsonKey(name: 'entity_creator_id') + final String? entityCreatorId; + + @override + @JsonKey(name: 'entity_id') + final String entityId; + + @override + @JsonKey(name: 'entity_type') + final String entityType; + + @override + @JsonKey(name: 'moderation_payload') + final ModerationPayload? moderationPayload; + + @override + @JsonKey(name: 'reason') + final String? reason; + + Map toJson() => _$FlagRequestToJson(this); + + static FlagRequest fromJson(Map json) => _$FlagRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/flag_request.freezed.dart b/packages/stream_chat/lib/open_api/model/flag_request.freezed.dart new file mode 100644 index 0000000000..d7f5944b04 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/flag_request.freezed.dart @@ -0,0 +1,125 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'flag_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$FlagRequest { + Map? get custom; + String? get entityCreatorId; + String get entityId; + String get entityType; + ModerationPayload? get moderationPayload; + String? get reason; + + /// Create a copy of FlagRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $FlagRequestCopyWith get copyWith => + _$FlagRequestCopyWithImpl(this as FlagRequest, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is FlagRequest && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.entityCreatorId, entityCreatorId) || other.entityCreatorId == entityCreatorId) && + (identical(other.entityId, entityId) || other.entityId == entityId) && + (identical(other.entityType, entityType) || other.entityType == entityType) && + (identical(other.moderationPayload, moderationPayload) || other.moderationPayload == moderationPayload) && + (identical(other.reason, reason) || other.reason == reason)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(custom), + entityCreatorId, + entityId, + entityType, + moderationPayload, + reason, + ); + + @override + String toString() { + return 'FlagRequest(custom: $custom, entityCreatorId: $entityCreatorId, entityId: $entityId, entityType: $entityType, moderationPayload: $moderationPayload, reason: $reason)'; + } +} + +/// @nodoc +abstract mixin class $FlagRequestCopyWith<$Res> { + factory $FlagRequestCopyWith( + FlagRequest value, + $Res Function(FlagRequest) _then, + ) = _$FlagRequestCopyWithImpl; + @useResult + $Res call({ + Map? custom, + String? entityCreatorId, + String entityId, + String entityType, + ModerationPayload? moderationPayload, + String? reason, + }); +} + +/// @nodoc +class _$FlagRequestCopyWithImpl<$Res> implements $FlagRequestCopyWith<$Res> { + _$FlagRequestCopyWithImpl(this._self, this._then); + + final FlagRequest _self; + final $Res Function(FlagRequest) _then; + + /// Create a copy of FlagRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? custom = freezed, + Object? entityCreatorId = freezed, + Object? entityId = null, + Object? entityType = null, + Object? moderationPayload = freezed, + Object? reason = freezed, + }) { + return _then( + FlagRequest( + custom: freezed == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map?, + entityCreatorId: freezed == entityCreatorId + ? _self.entityCreatorId + : entityCreatorId // ignore: cast_nullable_to_non_nullable + as String?, + entityId: null == entityId + ? _self.entityId + : entityId // ignore: cast_nullable_to_non_nullable + as String, + entityType: null == entityType + ? _self.entityType + : entityType // ignore: cast_nullable_to_non_nullable + as String, + moderationPayload: freezed == moderationPayload + ? _self.moderationPayload + : moderationPayload // ignore: cast_nullable_to_non_nullable + as ModerationPayload?, + reason: freezed == reason + ? _self.reason + : reason // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/flag_request.g.dart b/packages/stream_chat/lib/open_api/model/flag_request.g.dart new file mode 100644 index 0000000000..83d38797a0 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/flag_request.g.dart @@ -0,0 +1,29 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'flag_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +FlagRequest _$FlagRequestFromJson(Map json) => FlagRequest( + custom: json['custom'] as Map?, + entityCreatorId: json['entity_creator_id'] as String?, + entityId: json['entity_id'] as String, + entityType: json['entity_type'] as String, + moderationPayload: json['moderation_payload'] == null + ? null + : ModerationPayload.fromJson( + json['moderation_payload'] as Map, + ), + reason: json['reason'] as String?, +); + +Map _$FlagRequestToJson(FlagRequest instance) => { + 'custom': instance.custom, + 'entity_creator_id': instance.entityCreatorId, + 'entity_id': instance.entityId, + 'entity_type': instance.entityType, + 'moderation_payload': instance.moderationPayload?.toJson(), + 'reason': instance.reason, +}; diff --git a/packages/stream_chat/lib/open_api/model/flag_user_options.dart b/packages/stream_chat/lib/open_api/model/flag_user_options.dart new file mode 100644 index 0000000000..a424c62a4a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/flag_user_options.dart @@ -0,0 +1,31 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'flag_user_options.g.dart'; +part 'flag_user_options.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class FlagUserOptions with _$FlagUserOptions { + const FlagUserOptions({ + this.reason, + }); + + @override + @JsonKey(name: 'reason') + final String? reason; + + Map toJson() => _$FlagUserOptionsToJson(this); + + static FlagUserOptions fromJson(Map json) => _$FlagUserOptionsFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/flag_user_options.freezed.dart b/packages/stream_chat/lib/open_api/model/flag_user_options.freezed.dart new file mode 100644 index 0000000000..6cef0e6180 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/flag_user_options.freezed.dart @@ -0,0 +1,75 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'flag_user_options.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$FlagUserOptions { + String? get reason; + + /// Create a copy of FlagUserOptions + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $FlagUserOptionsCopyWith get copyWith => _$FlagUserOptionsCopyWithImpl( + this as FlagUserOptions, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is FlagUserOptions && + (identical(other.reason, reason) || other.reason == reason)); + } + + @override + int get hashCode => Object.hash(runtimeType, reason); + + @override + String toString() { + return 'FlagUserOptions(reason: $reason)'; + } +} + +/// @nodoc +abstract mixin class $FlagUserOptionsCopyWith<$Res> { + factory $FlagUserOptionsCopyWith( + FlagUserOptions value, + $Res Function(FlagUserOptions) _then, + ) = _$FlagUserOptionsCopyWithImpl; + @useResult + $Res call({String? reason}); +} + +/// @nodoc +class _$FlagUserOptionsCopyWithImpl<$Res> implements $FlagUserOptionsCopyWith<$Res> { + _$FlagUserOptionsCopyWithImpl(this._self, this._then); + + final FlagUserOptions _self; + final $Res Function(FlagUserOptions) _then; + + /// Create a copy of FlagUserOptions + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? reason = freezed}) { + return _then( + FlagUserOptions( + reason: freezed == reason + ? _self.reason + : reason // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/flag_user_options.g.dart b/packages/stream_chat/lib/open_api/model/flag_user_options.g.dart new file mode 100644 index 0000000000..f493e17871 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/flag_user_options.g.dart @@ -0,0 +1,12 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'flag_user_options.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +FlagUserOptions _$FlagUserOptionsFromJson(Map json) => + FlagUserOptions(reason: json['reason'] as String?); + +Map _$FlagUserOptionsToJson(FlagUserOptions instance) => {'reason': instance.reason}; diff --git a/packages/stream_chat/lib/open_api/model/flood_config.dart b/packages/stream_chat/lib/open_api/model/flood_config.dart new file mode 100644 index 0000000000..5985b3137d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/flood_config.dart @@ -0,0 +1,41 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'flood_config.g.dart'; +part 'flood_config.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class FloodConfig with _$FloodConfig { + const FloodConfig({ + this.allowlist, + this.identical_, + this.similar, + }); + + @override + @JsonKey(name: 'allowlist') + final List? allowlist; + + @override + @JsonKey(name: 'identical') + final FloodIdenticalConfig? identical_; + + @override + @JsonKey(name: 'similar') + final FloodSimilarConfig? similar; + + Map toJson() => _$FloodConfigToJson(this); + + static FloodConfig fromJson(Map json) => _$FloodConfigFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/flood_config.freezed.dart b/packages/stream_chat/lib/open_api/model/flood_config.freezed.dart new file mode 100644 index 0000000000..5214b86fff --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/flood_config.freezed.dart @@ -0,0 +1,98 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'flood_config.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$FloodConfig { + List? get allowlist; + FloodIdenticalConfig? get identical_; + FloodSimilarConfig? get similar; + + /// Create a copy of FloodConfig + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $FloodConfigCopyWith get copyWith => + _$FloodConfigCopyWithImpl(this as FloodConfig, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is FloodConfig && + const DeepCollectionEquality().equals(other.allowlist, allowlist) && + (identical(other.identical_, identical_) || other.identical_ == identical_) && + (identical(other.similar, similar) || other.similar == similar)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(allowlist), + identical_, + similar, + ); + + @override + String toString() { + return 'FloodConfig(allowlist: $allowlist, identical_: $identical_, similar: $similar)'; + } +} + +/// @nodoc +abstract mixin class $FloodConfigCopyWith<$Res> { + factory $FloodConfigCopyWith( + FloodConfig value, + $Res Function(FloodConfig) _then, + ) = _$FloodConfigCopyWithImpl; + @useResult + $Res call({ + List? allowlist, + FloodIdenticalConfig? identical_, + FloodSimilarConfig? similar, + }); +} + +/// @nodoc +class _$FloodConfigCopyWithImpl<$Res> implements $FloodConfigCopyWith<$Res> { + _$FloodConfigCopyWithImpl(this._self, this._then); + + final FloodConfig _self; + final $Res Function(FloodConfig) _then; + + /// Create a copy of FloodConfig + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? allowlist = freezed, + Object? identical_ = freezed, + Object? similar = freezed, + }) { + return _then( + FloodConfig( + allowlist: freezed == allowlist + ? _self.allowlist + : allowlist // ignore: cast_nullable_to_non_nullable + as List?, + identical_: freezed == identical_ + ? _self.identical_ + : identical_ // ignore: cast_nullable_to_non_nullable + as FloodIdenticalConfig?, + similar: freezed == similar + ? _self.similar + : similar // ignore: cast_nullable_to_non_nullable + as FloodSimilarConfig?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/flood_config.g.dart b/packages/stream_chat/lib/open_api/model/flood_config.g.dart new file mode 100644 index 0000000000..ac3d8165f9 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/flood_config.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'flood_config.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +FloodConfig _$FloodConfigFromJson(Map json) => FloodConfig( + allowlist: (json['allowlist'] as List?)?.map((e) => e as String).toList(), + identical_: json['identical'] == null + ? null + : FloodIdenticalConfig.fromJson( + json['identical'] as Map, + ), + similar: json['similar'] == null ? null : FloodSimilarConfig.fromJson(json['similar'] as Map), +); + +Map _$FloodConfigToJson(FloodConfig instance) => { + 'allowlist': instance.allowlist, + 'identical': instance.identical_?.toJson(), + 'similar': instance.similar?.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/flood_identical_config.dart b/packages/stream_chat/lib/open_api/model/flood_identical_config.dart new file mode 100644 index 0000000000..e04e07056d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/flood_identical_config.dart @@ -0,0 +1,46 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'flood_identical_config.g.dart'; +part 'flood_identical_config.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class FloodIdenticalConfig with _$FloodIdenticalConfig { + const FloodIdenticalConfig({ + required this.action, + required this.enabled, + required this.threshold, + required this.timeWindow, + }); + + @override + @JsonKey(name: 'action') + final String action; + + @override + @JsonKey(name: 'enabled') + final bool enabled; + + @override + @JsonKey(name: 'threshold') + final int threshold; + + @override + @JsonKey(name: 'time_window') + final String timeWindow; + + Map toJson() => _$FloodIdenticalConfigToJson(this); + + static FloodIdenticalConfig fromJson(Map json) => _$FloodIdenticalConfigFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/flood_identical_config.freezed.dart b/packages/stream_chat/lib/open_api/model/flood_identical_config.freezed.dart new file mode 100644 index 0000000000..1986b9bfcc --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/flood_identical_config.freezed.dart @@ -0,0 +1,99 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'flood_identical_config.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$FloodIdenticalConfig { + String get action; + bool get enabled; + int get threshold; + String get timeWindow; + + /// Create a copy of FloodIdenticalConfig + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $FloodIdenticalConfigCopyWith get copyWith => + _$FloodIdenticalConfigCopyWithImpl( + this as FloodIdenticalConfig, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is FloodIdenticalConfig && + (identical(other.action, action) || other.action == action) && + (identical(other.enabled, enabled) || other.enabled == enabled) && + (identical(other.threshold, threshold) || other.threshold == threshold) && + (identical(other.timeWindow, timeWindow) || other.timeWindow == timeWindow)); + } + + @override + int get hashCode => Object.hash(runtimeType, action, enabled, threshold, timeWindow); + + @override + String toString() { + return 'FloodIdenticalConfig(action: $action, enabled: $enabled, threshold: $threshold, timeWindow: $timeWindow)'; + } +} + +/// @nodoc +abstract mixin class $FloodIdenticalConfigCopyWith<$Res> { + factory $FloodIdenticalConfigCopyWith( + FloodIdenticalConfig value, + $Res Function(FloodIdenticalConfig) _then, + ) = _$FloodIdenticalConfigCopyWithImpl; + @useResult + $Res call({String action, bool enabled, int threshold, String timeWindow}); +} + +/// @nodoc +class _$FloodIdenticalConfigCopyWithImpl<$Res> implements $FloodIdenticalConfigCopyWith<$Res> { + _$FloodIdenticalConfigCopyWithImpl(this._self, this._then); + + final FloodIdenticalConfig _self; + final $Res Function(FloodIdenticalConfig) _then; + + /// Create a copy of FloodIdenticalConfig + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? action = null, + Object? enabled = null, + Object? threshold = null, + Object? timeWindow = null, + }) { + return _then( + FloodIdenticalConfig( + action: null == action + ? _self.action + : action // ignore: cast_nullable_to_non_nullable + as String, + enabled: null == enabled + ? _self.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool, + threshold: null == threshold + ? _self.threshold + : threshold // ignore: cast_nullable_to_non_nullable + as int, + timeWindow: null == timeWindow + ? _self.timeWindow + : timeWindow // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/flood_identical_config.g.dart b/packages/stream_chat/lib/open_api/model/flood_identical_config.g.dart new file mode 100644 index 0000000000..dcc723d4ae --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/flood_identical_config.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'flood_identical_config.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +FloodIdenticalConfig _$FloodIdenticalConfigFromJson( + Map json, +) => FloodIdenticalConfig( + action: json['action'] as String, + enabled: json['enabled'] as bool, + threshold: (json['threshold'] as num).toInt(), + timeWindow: json['time_window'] as String, +); + +Map _$FloodIdenticalConfigToJson( + FloodIdenticalConfig instance, +) => { + 'action': instance.action, + 'enabled': instance.enabled, + 'threshold': instance.threshold, + 'time_window': instance.timeWindow, +}; diff --git a/packages/stream_chat/lib/open_api/model/flood_identical_rule_parameters.dart b/packages/stream_chat/lib/open_api/model/flood_identical_rule_parameters.dart new file mode 100644 index 0000000000..81518bd4af --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/flood_identical_rule_parameters.dart @@ -0,0 +1,42 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'flood_identical_rule_parameters.g.dart'; +part 'flood_identical_rule_parameters.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class FloodIdenticalRuleParameters with _$FloodIdenticalRuleParameters { + const FloodIdenticalRuleParameters({ + this.allowlist, + this.threshold, + this.timeWindow, + }); + + @override + @JsonKey(name: 'allowlist') + final List? allowlist; + + @override + @JsonKey(name: 'threshold') + final int? threshold; + + @override + @JsonKey(name: 'time_window') + final String? timeWindow; + + Map toJson() => _$FloodIdenticalRuleParametersToJson(this); + + static FloodIdenticalRuleParameters fromJson(Map json) => + _$FloodIdenticalRuleParametersFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/flood_identical_rule_parameters.freezed.dart b/packages/stream_chat/lib/open_api/model/flood_identical_rule_parameters.freezed.dart new file mode 100644 index 0000000000..5dba4da5e9 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/flood_identical_rule_parameters.freezed.dart @@ -0,0 +1,97 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'flood_identical_rule_parameters.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$FloodIdenticalRuleParameters { + List? get allowlist; + int? get threshold; + String? get timeWindow; + + /// Create a copy of FloodIdenticalRuleParameters + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $FloodIdenticalRuleParametersCopyWith get copyWith => + _$FloodIdenticalRuleParametersCopyWithImpl( + this as FloodIdenticalRuleParameters, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is FloodIdenticalRuleParameters && + const DeepCollectionEquality().equals(other.allowlist, allowlist) && + (identical(other.threshold, threshold) || other.threshold == threshold) && + (identical(other.timeWindow, timeWindow) || other.timeWindow == timeWindow)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(allowlist), + threshold, + timeWindow, + ); + + @override + String toString() { + return 'FloodIdenticalRuleParameters(allowlist: $allowlist, threshold: $threshold, timeWindow: $timeWindow)'; + } +} + +/// @nodoc +abstract mixin class $FloodIdenticalRuleParametersCopyWith<$Res> { + factory $FloodIdenticalRuleParametersCopyWith( + FloodIdenticalRuleParameters value, + $Res Function(FloodIdenticalRuleParameters) _then, + ) = _$FloodIdenticalRuleParametersCopyWithImpl; + @useResult + $Res call({List? allowlist, int? threshold, String? timeWindow}); +} + +/// @nodoc +class _$FloodIdenticalRuleParametersCopyWithImpl<$Res> implements $FloodIdenticalRuleParametersCopyWith<$Res> { + _$FloodIdenticalRuleParametersCopyWithImpl(this._self, this._then); + + final FloodIdenticalRuleParameters _self; + final $Res Function(FloodIdenticalRuleParameters) _then; + + /// Create a copy of FloodIdenticalRuleParameters + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? allowlist = freezed, + Object? threshold = freezed, + Object? timeWindow = freezed, + }) { + return _then( + FloodIdenticalRuleParameters( + allowlist: freezed == allowlist + ? _self.allowlist + : allowlist // ignore: cast_nullable_to_non_nullable + as List?, + threshold: freezed == threshold + ? _self.threshold + : threshold // ignore: cast_nullable_to_non_nullable + as int?, + timeWindow: freezed == timeWindow + ? _self.timeWindow + : timeWindow // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/flood_identical_rule_parameters.g.dart b/packages/stream_chat/lib/open_api/model/flood_identical_rule_parameters.g.dart new file mode 100644 index 0000000000..9e1c2cee7d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/flood_identical_rule_parameters.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'flood_identical_rule_parameters.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +FloodIdenticalRuleParameters _$FloodIdenticalRuleParametersFromJson( + Map json, +) => FloodIdenticalRuleParameters( + allowlist: (json['allowlist'] as List?)?.map((e) => e as String).toList(), + threshold: (json['threshold'] as num?)?.toInt(), + timeWindow: json['time_window'] as String?, +); + +Map _$FloodIdenticalRuleParametersToJson( + FloodIdenticalRuleParameters instance, +) => { + 'allowlist': instance.allowlist, + 'threshold': instance.threshold, + 'time_window': instance.timeWindow, +}; diff --git a/packages/stream_chat/lib/open_api/model/flood_similar_config.dart b/packages/stream_chat/lib/open_api/model/flood_similar_config.dart new file mode 100644 index 0000000000..4b020cb5a1 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/flood_similar_config.dart @@ -0,0 +1,51 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'flood_similar_config.g.dart'; +part 'flood_similar_config.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class FloodSimilarConfig with _$FloodSimilarConfig { + const FloodSimilarConfig({ + required this.action, + required this.enabled, + required this.similarityDistance, + required this.threshold, + required this.timeWindow, + }); + + @override + @JsonKey(name: 'action') + final String action; + + @override + @JsonKey(name: 'enabled') + final bool enabled; + + @override + @JsonKey(name: 'similarity_distance') + final int similarityDistance; + + @override + @JsonKey(name: 'threshold') + final int threshold; + + @override + @JsonKey(name: 'time_window') + final String timeWindow; + + Map toJson() => _$FloodSimilarConfigToJson(this); + + static FloodSimilarConfig fromJson(Map json) => _$FloodSimilarConfigFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/flood_similar_config.freezed.dart b/packages/stream_chat/lib/open_api/model/flood_similar_config.freezed.dart new file mode 100644 index 0000000000..446beccdb6 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/flood_similar_config.freezed.dart @@ -0,0 +1,119 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'flood_similar_config.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$FloodSimilarConfig { + String get action; + bool get enabled; + int get similarityDistance; + int get threshold; + String get timeWindow; + + /// Create a copy of FloodSimilarConfig + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $FloodSimilarConfigCopyWith get copyWith => _$FloodSimilarConfigCopyWithImpl( + this as FloodSimilarConfig, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is FloodSimilarConfig && + (identical(other.action, action) || other.action == action) && + (identical(other.enabled, enabled) || other.enabled == enabled) && + (identical(other.similarityDistance, similarityDistance) || + other.similarityDistance == similarityDistance) && + (identical(other.threshold, threshold) || other.threshold == threshold) && + (identical(other.timeWindow, timeWindow) || other.timeWindow == timeWindow)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + action, + enabled, + similarityDistance, + threshold, + timeWindow, + ); + + @override + String toString() { + return 'FloodSimilarConfig(action: $action, enabled: $enabled, similarityDistance: $similarityDistance, threshold: $threshold, timeWindow: $timeWindow)'; + } +} + +/// @nodoc +abstract mixin class $FloodSimilarConfigCopyWith<$Res> { + factory $FloodSimilarConfigCopyWith( + FloodSimilarConfig value, + $Res Function(FloodSimilarConfig) _then, + ) = _$FloodSimilarConfigCopyWithImpl; + @useResult + $Res call({ + String action, + bool enabled, + int similarityDistance, + int threshold, + String timeWindow, + }); +} + +/// @nodoc +class _$FloodSimilarConfigCopyWithImpl<$Res> implements $FloodSimilarConfigCopyWith<$Res> { + _$FloodSimilarConfigCopyWithImpl(this._self, this._then); + + final FloodSimilarConfig _self; + final $Res Function(FloodSimilarConfig) _then; + + /// Create a copy of FloodSimilarConfig + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? action = null, + Object? enabled = null, + Object? similarityDistance = null, + Object? threshold = null, + Object? timeWindow = null, + }) { + return _then( + FloodSimilarConfig( + action: null == action + ? _self.action + : action // ignore: cast_nullable_to_non_nullable + as String, + enabled: null == enabled + ? _self.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool, + similarityDistance: null == similarityDistance + ? _self.similarityDistance + : similarityDistance // ignore: cast_nullable_to_non_nullable + as int, + threshold: null == threshold + ? _self.threshold + : threshold // ignore: cast_nullable_to_non_nullable + as int, + timeWindow: null == timeWindow + ? _self.timeWindow + : timeWindow // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/flood_similar_config.g.dart b/packages/stream_chat/lib/open_api/model/flood_similar_config.g.dart new file mode 100644 index 0000000000..14b8495422 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/flood_similar_config.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'flood_similar_config.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +FloodSimilarConfig _$FloodSimilarConfigFromJson(Map json) => FloodSimilarConfig( + action: json['action'] as String, + enabled: json['enabled'] as bool, + similarityDistance: (json['similarity_distance'] as num).toInt(), + threshold: (json['threshold'] as num).toInt(), + timeWindow: json['time_window'] as String, +); + +Map _$FloodSimilarConfigToJson(FloodSimilarConfig instance) => { + 'action': instance.action, + 'enabled': instance.enabled, + 'similarity_distance': instance.similarityDistance, + 'threshold': instance.threshold, + 'time_window': instance.timeWindow, +}; diff --git a/packages/stream_chat/lib/open_api/model/flood_similar_rule_parameters.dart b/packages/stream_chat/lib/open_api/model/flood_similar_rule_parameters.dart new file mode 100644 index 0000000000..5623660569 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/flood_similar_rule_parameters.dart @@ -0,0 +1,46 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'flood_similar_rule_parameters.g.dart'; +part 'flood_similar_rule_parameters.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class FloodSimilarRuleParameters with _$FloodSimilarRuleParameters { + const FloodSimilarRuleParameters({ + this.allowlist, + this.similarityDistance, + this.threshold, + this.timeWindow, + }); + + @override + @JsonKey(name: 'allowlist') + final List? allowlist; + + @override + @JsonKey(name: 'similarity_distance') + final int? similarityDistance; + + @override + @JsonKey(name: 'threshold') + final int? threshold; + + @override + @JsonKey(name: 'time_window') + final String? timeWindow; + + Map toJson() => _$FloodSimilarRuleParametersToJson(this); + + static FloodSimilarRuleParameters fromJson(Map json) => _$FloodSimilarRuleParametersFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/flood_similar_rule_parameters.freezed.dart b/packages/stream_chat/lib/open_api/model/flood_similar_rule_parameters.freezed.dart new file mode 100644 index 0000000000..495e3cfbbd --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/flood_similar_rule_parameters.freezed.dart @@ -0,0 +1,111 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'flood_similar_rule_parameters.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$FloodSimilarRuleParameters { + List? get allowlist; + int? get similarityDistance; + int? get threshold; + String? get timeWindow; + + /// Create a copy of FloodSimilarRuleParameters + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $FloodSimilarRuleParametersCopyWith get copyWith => + _$FloodSimilarRuleParametersCopyWithImpl( + this as FloodSimilarRuleParameters, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is FloodSimilarRuleParameters && + const DeepCollectionEquality().equals(other.allowlist, allowlist) && + (identical(other.similarityDistance, similarityDistance) || + other.similarityDistance == similarityDistance) && + (identical(other.threshold, threshold) || other.threshold == threshold) && + (identical(other.timeWindow, timeWindow) || other.timeWindow == timeWindow)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(allowlist), + similarityDistance, + threshold, + timeWindow, + ); + + @override + String toString() { + return 'FloodSimilarRuleParameters(allowlist: $allowlist, similarityDistance: $similarityDistance, threshold: $threshold, timeWindow: $timeWindow)'; + } +} + +/// @nodoc +abstract mixin class $FloodSimilarRuleParametersCopyWith<$Res> { + factory $FloodSimilarRuleParametersCopyWith( + FloodSimilarRuleParameters value, + $Res Function(FloodSimilarRuleParameters) _then, + ) = _$FloodSimilarRuleParametersCopyWithImpl; + @useResult + $Res call({ + List? allowlist, + int? similarityDistance, + int? threshold, + String? timeWindow, + }); +} + +/// @nodoc +class _$FloodSimilarRuleParametersCopyWithImpl<$Res> implements $FloodSimilarRuleParametersCopyWith<$Res> { + _$FloodSimilarRuleParametersCopyWithImpl(this._self, this._then); + + final FloodSimilarRuleParameters _self; + final $Res Function(FloodSimilarRuleParameters) _then; + + /// Create a copy of FloodSimilarRuleParameters + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? allowlist = freezed, + Object? similarityDistance = freezed, + Object? threshold = freezed, + Object? timeWindow = freezed, + }) { + return _then( + FloodSimilarRuleParameters( + allowlist: freezed == allowlist + ? _self.allowlist + : allowlist // ignore: cast_nullable_to_non_nullable + as List?, + similarityDistance: freezed == similarityDistance + ? _self.similarityDistance + : similarityDistance // ignore: cast_nullable_to_non_nullable + as int?, + threshold: freezed == threshold + ? _self.threshold + : threshold // ignore: cast_nullable_to_non_nullable + as int?, + timeWindow: freezed == timeWindow + ? _self.timeWindow + : timeWindow // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/flood_similar_rule_parameters.g.dart b/packages/stream_chat/lib/open_api/model/flood_similar_rule_parameters.g.dart new file mode 100644 index 0000000000..6f0f3c7de3 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/flood_similar_rule_parameters.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'flood_similar_rule_parameters.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +FloodSimilarRuleParameters _$FloodSimilarRuleParametersFromJson( + Map json, +) => FloodSimilarRuleParameters( + allowlist: (json['allowlist'] as List?)?.map((e) => e as String).toList(), + similarityDistance: (json['similarity_distance'] as num?)?.toInt(), + threshold: (json['threshold'] as num?)?.toInt(), + timeWindow: json['time_window'] as String?, +); + +Map _$FloodSimilarRuleParametersToJson( + FloodSimilarRuleParameters instance, +) => { + 'allowlist': instance.allowlist, + 'similarity_distance': instance.similarityDistance, + 'threshold': instance.threshold, + 'time_window': instance.timeWindow, +}; diff --git a/packages/stream_chat/lib/open_api/model/full_user_response.dart b/packages/stream_chat/lib/open_api/model/full_user_response.dart new file mode 100644 index 0000000000..9031ae6d40 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/full_user_response.dart @@ -0,0 +1,183 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'full_user_response.g.dart'; +part 'full_user_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class FullUserResponse with _$FullUserResponse { + const FullUserResponse({ + this.avgResponseTime, + this.banExpires, + required this.banned, + required this.blockedUserIds, + required this.channelMutes, + required this.createdAt, + required this.custom, + this.deactivatedAt, + this.deletedAt, + required this.devices, + required this.id, + this.image, + required this.invisible, + required this.language, + this.lastActive, + this.latestHiddenChannels, + required this.mutes, + this.name, + required this.online, + this.privacySettings, + this.revokeTokensIssuedBefore, + required this.role, + required this.shadowBanned, + required this.teams, + this.teamsRole, + required this.totalUnreadCount, + required this.unreadChannels, + required this.unreadCount, + required this.unreadThreads, + required this.updatedAt, + }); + + @override + @JsonKey(name: 'avg_response_time') + final int? avgResponseTime; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'ban_expires') + final DateTime? banExpires; + + @override + @JsonKey(name: 'banned') + final bool banned; + + @override + @JsonKey(name: 'blocked_user_ids') + final List blockedUserIds; + + @override + @JsonKey(name: 'channel_mutes') + final List channelMutes; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'deactivated_at') + final DateTime? deactivatedAt; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'deleted_at') + final DateTime? deletedAt; + + @override + @JsonKey(name: 'devices') + final List devices; + + @override + @JsonKey(name: 'id') + final String id; + + @override + @JsonKey(name: 'image') + final String? image; + + @override + @JsonKey(name: 'invisible') + final bool invisible; + + @override + @JsonKey(name: 'language') + final String language; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'last_active') + final DateTime? lastActive; + + @override + @JsonKey(name: 'latest_hidden_channels') + final List? latestHiddenChannels; + + @override + @JsonKey(name: 'mutes') + final List mutes; + + @override + @JsonKey(name: 'name') + final String? name; + + @override + @JsonKey(name: 'online') + final bool online; + + @override + @JsonKey(name: 'privacy_settings') + final PrivacySettingsResponse? privacySettings; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'revoke_tokens_issued_before') + final DateTime? revokeTokensIssuedBefore; + + @override + @JsonKey(name: 'role') + final String role; + + @override + @JsonKey(name: 'shadow_banned') + final bool shadowBanned; + + @override + @JsonKey(name: 'teams') + final List teams; + + @override + @JsonKey(name: 'teams_role') + final Map? teamsRole; + + @override + @JsonKey(name: 'total_unread_count') + final int totalUnreadCount; + + @override + @JsonKey(name: 'unread_channels') + final int unreadChannels; + + @override + @JsonKey(name: 'unread_count') + final int unreadCount; + + @override + @JsonKey(name: 'unread_threads') + final int unreadThreads; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'updated_at') + final DateTime updatedAt; + + Map toJson() => _$FullUserResponseToJson(this); + + static FullUserResponse fromJson(Map json) => _$FullUserResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/full_user_response.freezed.dart b/packages/stream_chat/lib/open_api/model/full_user_response.freezed.dart new file mode 100644 index 0000000000..4b2358865c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/full_user_response.freezed.dart @@ -0,0 +1,356 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'full_user_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$FullUserResponse { + int? get avgResponseTime; + DateTime? get banExpires; + bool get banned; + List get blockedUserIds; + List get channelMutes; + DateTime get createdAt; + Map get custom; + DateTime? get deactivatedAt; + DateTime? get deletedAt; + List get devices; + String get id; + String? get image; + bool get invisible; + String get language; + DateTime? get lastActive; + List? get latestHiddenChannels; + List get mutes; + String? get name; + bool get online; + PrivacySettingsResponse? get privacySettings; + DateTime? get revokeTokensIssuedBefore; + String get role; + bool get shadowBanned; + List get teams; + Map? get teamsRole; + int get totalUnreadCount; + int get unreadChannels; + int get unreadCount; + int get unreadThreads; + DateTime get updatedAt; + + /// Create a copy of FullUserResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $FullUserResponseCopyWith get copyWith => _$FullUserResponseCopyWithImpl( + this as FullUserResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is FullUserResponse && + (identical(other.avgResponseTime, avgResponseTime) || other.avgResponseTime == avgResponseTime) && + (identical(other.banExpires, banExpires) || other.banExpires == banExpires) && + (identical(other.banned, banned) || other.banned == banned) && + const DeepCollectionEquality().equals( + other.blockedUserIds, + blockedUserIds, + ) && + const DeepCollectionEquality().equals( + other.channelMutes, + channelMutes, + ) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.deactivatedAt, deactivatedAt) || other.deactivatedAt == deactivatedAt) && + (identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt) && + const DeepCollectionEquality().equals(other.devices, devices) && + (identical(other.id, id) || other.id == id) && + (identical(other.image, image) || other.image == image) && + (identical(other.invisible, invisible) || other.invisible == invisible) && + (identical(other.language, language) || other.language == language) && + (identical(other.lastActive, lastActive) || other.lastActive == lastActive) && + const DeepCollectionEquality().equals( + other.latestHiddenChannels, + latestHiddenChannels, + ) && + const DeepCollectionEquality().equals(other.mutes, mutes) && + (identical(other.name, name) || other.name == name) && + (identical(other.online, online) || other.online == online) && + (identical(other.privacySettings, privacySettings) || other.privacySettings == privacySettings) && + (identical( + other.revokeTokensIssuedBefore, + revokeTokensIssuedBefore, + ) || + other.revokeTokensIssuedBefore == revokeTokensIssuedBefore) && + (identical(other.role, role) || other.role == role) && + (identical(other.shadowBanned, shadowBanned) || other.shadowBanned == shadowBanned) && + const DeepCollectionEquality().equals(other.teams, teams) && + const DeepCollectionEquality().equals(other.teamsRole, teamsRole) && + (identical(other.totalUnreadCount, totalUnreadCount) || other.totalUnreadCount == totalUnreadCount) && + (identical(other.unreadChannels, unreadChannels) || other.unreadChannels == unreadChannels) && + (identical(other.unreadCount, unreadCount) || other.unreadCount == unreadCount) && + (identical(other.unreadThreads, unreadThreads) || other.unreadThreads == unreadThreads) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)); + } + + @override + int get hashCode => Object.hashAll([ + runtimeType, + avgResponseTime, + banExpires, + banned, + const DeepCollectionEquality().hash(blockedUserIds), + const DeepCollectionEquality().hash(channelMutes), + createdAt, + const DeepCollectionEquality().hash(custom), + deactivatedAt, + deletedAt, + const DeepCollectionEquality().hash(devices), + id, + image, + invisible, + language, + lastActive, + const DeepCollectionEquality().hash(latestHiddenChannels), + const DeepCollectionEquality().hash(mutes), + name, + online, + privacySettings, + revokeTokensIssuedBefore, + role, + shadowBanned, + const DeepCollectionEquality().hash(teams), + const DeepCollectionEquality().hash(teamsRole), + totalUnreadCount, + unreadChannels, + unreadCount, + unreadThreads, + updatedAt, + ]); + + @override + String toString() { + return 'FullUserResponse(avgResponseTime: $avgResponseTime, banExpires: $banExpires, banned: $banned, blockedUserIds: $blockedUserIds, channelMutes: $channelMutes, createdAt: $createdAt, custom: $custom, deactivatedAt: $deactivatedAt, deletedAt: $deletedAt, devices: $devices, id: $id, image: $image, invisible: $invisible, language: $language, lastActive: $lastActive, latestHiddenChannels: $latestHiddenChannels, mutes: $mutes, name: $name, online: $online, privacySettings: $privacySettings, revokeTokensIssuedBefore: $revokeTokensIssuedBefore, role: $role, shadowBanned: $shadowBanned, teams: $teams, teamsRole: $teamsRole, totalUnreadCount: $totalUnreadCount, unreadChannels: $unreadChannels, unreadCount: $unreadCount, unreadThreads: $unreadThreads, updatedAt: $updatedAt)'; + } +} + +/// @nodoc +abstract mixin class $FullUserResponseCopyWith<$Res> { + factory $FullUserResponseCopyWith( + FullUserResponse value, + $Res Function(FullUserResponse) _then, + ) = _$FullUserResponseCopyWithImpl; + @useResult + $Res call({ + int? avgResponseTime, + DateTime? banExpires, + bool banned, + List blockedUserIds, + List channelMutes, + DateTime createdAt, + Map custom, + DateTime? deactivatedAt, + DateTime? deletedAt, + List devices, + String id, + String? image, + bool invisible, + String language, + DateTime? lastActive, + List? latestHiddenChannels, + List mutes, + String? name, + bool online, + PrivacySettingsResponse? privacySettings, + DateTime? revokeTokensIssuedBefore, + String role, + bool shadowBanned, + List teams, + Map? teamsRole, + int totalUnreadCount, + int unreadChannels, + int unreadCount, + int unreadThreads, + DateTime updatedAt, + }); +} + +/// @nodoc +class _$FullUserResponseCopyWithImpl<$Res> implements $FullUserResponseCopyWith<$Res> { + _$FullUserResponseCopyWithImpl(this._self, this._then); + + final FullUserResponse _self; + final $Res Function(FullUserResponse) _then; + + /// Create a copy of FullUserResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? avgResponseTime = freezed, + Object? banExpires = freezed, + Object? banned = null, + Object? blockedUserIds = null, + Object? channelMutes = null, + Object? createdAt = null, + Object? custom = null, + Object? deactivatedAt = freezed, + Object? deletedAt = freezed, + Object? devices = null, + Object? id = null, + Object? image = freezed, + Object? invisible = null, + Object? language = null, + Object? lastActive = freezed, + Object? latestHiddenChannels = freezed, + Object? mutes = null, + Object? name = freezed, + Object? online = null, + Object? privacySettings = freezed, + Object? revokeTokensIssuedBefore = freezed, + Object? role = null, + Object? shadowBanned = null, + Object? teams = null, + Object? teamsRole = freezed, + Object? totalUnreadCount = null, + Object? unreadChannels = null, + Object? unreadCount = null, + Object? unreadThreads = null, + Object? updatedAt = null, + }) { + return _then( + FullUserResponse( + avgResponseTime: freezed == avgResponseTime + ? _self.avgResponseTime + : avgResponseTime // ignore: cast_nullable_to_non_nullable + as int?, + banExpires: freezed == banExpires + ? _self.banExpires + : banExpires // ignore: cast_nullable_to_non_nullable + as DateTime?, + banned: null == banned + ? _self.banned + : banned // ignore: cast_nullable_to_non_nullable + as bool, + blockedUserIds: null == blockedUserIds + ? _self.blockedUserIds + : blockedUserIds // ignore: cast_nullable_to_non_nullable + as List, + channelMutes: null == channelMutes + ? _self.channelMutes + : channelMutes // ignore: cast_nullable_to_non_nullable + as List, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + deactivatedAt: freezed == deactivatedAt + ? _self.deactivatedAt + : deactivatedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + deletedAt: freezed == deletedAt + ? _self.deletedAt + : deletedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + devices: null == devices + ? _self.devices + : devices // ignore: cast_nullable_to_non_nullable + as List, + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + image: freezed == image + ? _self.image + : image // ignore: cast_nullable_to_non_nullable + as String?, + invisible: null == invisible + ? _self.invisible + : invisible // ignore: cast_nullable_to_non_nullable + as bool, + language: null == language + ? _self.language + : language // ignore: cast_nullable_to_non_nullable + as String, + lastActive: freezed == lastActive + ? _self.lastActive + : lastActive // ignore: cast_nullable_to_non_nullable + as DateTime?, + latestHiddenChannels: freezed == latestHiddenChannels + ? _self.latestHiddenChannels + : latestHiddenChannels // ignore: cast_nullable_to_non_nullable + as List?, + mutes: null == mutes + ? _self.mutes + : mutes // ignore: cast_nullable_to_non_nullable + as List, + name: freezed == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + online: null == online + ? _self.online + : online // ignore: cast_nullable_to_non_nullable + as bool, + privacySettings: freezed == privacySettings + ? _self.privacySettings + : privacySettings // ignore: cast_nullable_to_non_nullable + as PrivacySettingsResponse?, + revokeTokensIssuedBefore: freezed == revokeTokensIssuedBefore + ? _self.revokeTokensIssuedBefore + : revokeTokensIssuedBefore // ignore: cast_nullable_to_non_nullable + as DateTime?, + role: null == role + ? _self.role + : role // ignore: cast_nullable_to_non_nullable + as String, + shadowBanned: null == shadowBanned + ? _self.shadowBanned + : shadowBanned // ignore: cast_nullable_to_non_nullable + as bool, + teams: null == teams + ? _self.teams + : teams // ignore: cast_nullable_to_non_nullable + as List, + teamsRole: freezed == teamsRole + ? _self.teamsRole + : teamsRole // ignore: cast_nullable_to_non_nullable + as Map?, + totalUnreadCount: null == totalUnreadCount + ? _self.totalUnreadCount + : totalUnreadCount // ignore: cast_nullable_to_non_nullable + as int, + unreadChannels: null == unreadChannels + ? _self.unreadChannels + : unreadChannels // ignore: cast_nullable_to_non_nullable + as int, + unreadCount: null == unreadCount + ? _self.unreadCount + : unreadCount // ignore: cast_nullable_to_non_nullable + as int, + unreadThreads: null == unreadThreads + ? _self.unreadThreads + : unreadThreads // ignore: cast_nullable_to_non_nullable + as int, + updatedAt: null == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/full_user_response.g.dart b/packages/stream_chat/lib/open_api/model/full_user_response.g.dart new file mode 100644 index 0000000000..f413948221 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/full_user_response.g.dart @@ -0,0 +1,125 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'full_user_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +FullUserResponse _$FullUserResponseFromJson(Map json) => FullUserResponse( + avgResponseTime: (json['avg_response_time'] as num?)?.toInt(), + banExpires: _$JsonConverterFromJson( + json['ban_expires'], + const StreamDateTimeConverter().fromJson, + ), + banned: json['banned'] as bool, + blockedUserIds: (json['blocked_user_ids'] as List).map((e) => e as String).toList(), + channelMutes: (json['channel_mutes'] as List) + .map((e) => ChannelMute.fromJson(e as Map)) + .toList(), + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + deactivatedAt: _$JsonConverterFromJson( + json['deactivated_at'], + const StreamDateTimeConverter().fromJson, + ), + deletedAt: _$JsonConverterFromJson( + json['deleted_at'], + const StreamDateTimeConverter().fromJson, + ), + devices: (json['devices'] as List).map((e) => DeviceResponse.fromJson(e as Map)).toList(), + id: json['id'] as String, + image: json['image'] as String?, + invisible: json['invisible'] as bool, + language: json['language'] as String, + lastActive: _$JsonConverterFromJson( + json['last_active'], + const StreamDateTimeConverter().fromJson, + ), + latestHiddenChannels: (json['latest_hidden_channels'] as List?)?.map((e) => e as String).toList(), + mutes: (json['mutes'] as List).map((e) => UserMuteResponse.fromJson(e as Map)).toList(), + name: json['name'] as String?, + online: json['online'] as bool, + privacySettings: json['privacy_settings'] == null + ? null + : PrivacySettingsResponse.fromJson( + json['privacy_settings'] as Map, + ), + revokeTokensIssuedBefore: _$JsonConverterFromJson( + json['revoke_tokens_issued_before'], + const StreamDateTimeConverter().fromJson, + ), + role: json['role'] as String, + shadowBanned: json['shadow_banned'] as bool, + teams: (json['teams'] as List).map((e) => e as String).toList(), + teamsRole: (json['teams_role'] as Map?)?.map( + (k, e) => MapEntry(k, e as String), + ), + totalUnreadCount: (json['total_unread_count'] as num).toInt(), + unreadChannels: (json['unread_channels'] as num).toInt(), + unreadCount: (json['unread_count'] as num).toInt(), + unreadThreads: (json['unread_threads'] as num).toInt(), + updatedAt: const StreamDateTimeConverter().fromJson( + json['updated_at'] as Object, + ), +); + +Map _$FullUserResponseToJson(FullUserResponse instance) => { + 'avg_response_time': instance.avgResponseTime, + 'ban_expires': _$JsonConverterToJson( + instance.banExpires, + const StreamDateTimeConverter().toJson, + ), + 'banned': instance.banned, + 'blocked_user_ids': instance.blockedUserIds, + 'channel_mutes': instance.channelMutes.map((e) => e.toJson()).toList(), + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'deactivated_at': _$JsonConverterToJson( + instance.deactivatedAt, + const StreamDateTimeConverter().toJson, + ), + 'deleted_at': _$JsonConverterToJson( + instance.deletedAt, + const StreamDateTimeConverter().toJson, + ), + 'devices': instance.devices.map((e) => e.toJson()).toList(), + 'id': instance.id, + 'image': instance.image, + 'invisible': instance.invisible, + 'language': instance.language, + 'last_active': _$JsonConverterToJson( + instance.lastActive, + const StreamDateTimeConverter().toJson, + ), + 'latest_hidden_channels': instance.latestHiddenChannels, + 'mutes': instance.mutes.map((e) => e.toJson()).toList(), + 'name': instance.name, + 'online': instance.online, + 'privacy_settings': instance.privacySettings?.toJson(), + 'revoke_tokens_issued_before': _$JsonConverterToJson( + instance.revokeTokensIssuedBefore, + const StreamDateTimeConverter().toJson, + ), + 'role': instance.role, + 'shadow_banned': instance.shadowBanned, + 'teams': instance.teams, + 'teams_role': instance.teamsRole, + 'total_unread_count': instance.totalUnreadCount, + 'unread_channels': instance.unreadChannels, + 'unread_count': instance.unreadCount, + 'unread_threads': instance.unreadThreads, + 'updated_at': const StreamDateTimeConverter().toJson(instance.updatedAt), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/future_channel_ban_response.dart b/packages/stream_chat/lib/open_api/model/future_channel_ban_response.dart new file mode 100644 index 0000000000..9dcaa4c78c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/future_channel_ban_response.dart @@ -0,0 +1,58 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'future_channel_ban_response.g.dart'; +part 'future_channel_ban_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class FutureChannelBanResponse with _$FutureChannelBanResponse { + const FutureChannelBanResponse({ + this.bannedBy, + required this.createdAt, + this.expires, + this.reason, + this.shadow, + this.user, + }); + + @override + @JsonKey(name: 'banned_by') + final UserResponse? bannedBy; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'expires') + final DateTime? expires; + + @override + @JsonKey(name: 'reason') + final String? reason; + + @override + @JsonKey(name: 'shadow') + final bool? shadow; + + @override + @JsonKey(name: 'user') + final UserResponse? user; + + Map toJson() => _$FutureChannelBanResponseToJson(this); + + static FutureChannelBanResponse fromJson(Map json) => _$FutureChannelBanResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/future_channel_ban_response.freezed.dart b/packages/stream_chat/lib/open_api/model/future_channel_ban_response.freezed.dart new file mode 100644 index 0000000000..a358973e39 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/future_channel_ban_response.freezed.dart @@ -0,0 +1,128 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'future_channel_ban_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$FutureChannelBanResponse { + UserResponse? get bannedBy; + DateTime get createdAt; + DateTime? get expires; + String? get reason; + bool? get shadow; + UserResponse? get user; + + /// Create a copy of FutureChannelBanResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $FutureChannelBanResponseCopyWith get copyWith => + _$FutureChannelBanResponseCopyWithImpl( + this as FutureChannelBanResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is FutureChannelBanResponse && + (identical(other.bannedBy, bannedBy) || other.bannedBy == bannedBy) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.expires, expires) || other.expires == expires) && + (identical(other.reason, reason) || other.reason == reason) && + (identical(other.shadow, shadow) || other.shadow == shadow) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + bannedBy, + createdAt, + expires, + reason, + shadow, + user, + ); + + @override + String toString() { + return 'FutureChannelBanResponse(bannedBy: $bannedBy, createdAt: $createdAt, expires: $expires, reason: $reason, shadow: $shadow, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $FutureChannelBanResponseCopyWith<$Res> { + factory $FutureChannelBanResponseCopyWith( + FutureChannelBanResponse value, + $Res Function(FutureChannelBanResponse) _then, + ) = _$FutureChannelBanResponseCopyWithImpl; + @useResult + $Res call({ + UserResponse? bannedBy, + DateTime createdAt, + DateTime? expires, + String? reason, + bool? shadow, + UserResponse? user, + }); +} + +/// @nodoc +class _$FutureChannelBanResponseCopyWithImpl<$Res> implements $FutureChannelBanResponseCopyWith<$Res> { + _$FutureChannelBanResponseCopyWithImpl(this._self, this._then); + + final FutureChannelBanResponse _self; + final $Res Function(FutureChannelBanResponse) _then; + + /// Create a copy of FutureChannelBanResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? bannedBy = freezed, + Object? createdAt = null, + Object? expires = freezed, + Object? reason = freezed, + Object? shadow = freezed, + Object? user = freezed, + }) { + return _then( + FutureChannelBanResponse( + bannedBy: freezed == bannedBy + ? _self.bannedBy + : bannedBy // ignore: cast_nullable_to_non_nullable + as UserResponse?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + expires: freezed == expires + ? _self.expires + : expires // ignore: cast_nullable_to_non_nullable + as DateTime?, + reason: freezed == reason + ? _self.reason + : reason // ignore: cast_nullable_to_non_nullable + as String?, + shadow: freezed == shadow + ? _self.shadow + : shadow // ignore: cast_nullable_to_non_nullable + as bool?, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponse?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/future_channel_ban_response.g.dart b/packages/stream_chat/lib/open_api/model/future_channel_ban_response.g.dart new file mode 100644 index 0000000000..99e7aeae4e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/future_channel_ban_response.g.dart @@ -0,0 +1,47 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'future_channel_ban_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +FutureChannelBanResponse _$FutureChannelBanResponseFromJson( + Map json, +) => FutureChannelBanResponse( + bannedBy: json['banned_by'] == null ? null : UserResponse.fromJson(json['banned_by'] as Map), + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + expires: _$JsonConverterFromJson( + json['expires'], + const StreamDateTimeConverter().fromJson, + ), + reason: json['reason'] as String?, + shadow: json['shadow'] as bool?, + user: json['user'] == null ? null : UserResponse.fromJson(json['user'] as Map), +); + +Map _$FutureChannelBanResponseToJson( + FutureChannelBanResponse instance, +) => { + 'banned_by': instance.bannedBy?.toJson(), + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'expires': _$JsonConverterToJson( + instance.expires, + const StreamDateTimeConverter().toJson, + ), + 'reason': instance.reason, + 'shadow': instance.shadow, + 'user': instance.user?.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/get_action_config_response.dart b/packages/stream_chat/lib/open_api/model/get_action_config_response.dart new file mode 100644 index 0000000000..8a29fc09d0 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/get_action_config_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'get_action_config_response.g.dart'; +part 'get_action_config_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class GetActionConfigResponse with _$GetActionConfigResponse { + const GetActionConfigResponse({ + required this.actionConfig, + required this.duration, + }); + + @override + @JsonKey(name: 'action_config') + final Map> actionConfig; + + @override + @JsonKey(name: 'duration') + final String duration; + + Map toJson() => _$GetActionConfigResponseToJson(this); + + static GetActionConfigResponse fromJson(Map json) => _$GetActionConfigResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/get_action_config_response.freezed.dart b/packages/stream_chat/lib/open_api/model/get_action_config_response.freezed.dart new file mode 100644 index 0000000000..c0da3b2979 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/get_action_config_response.freezed.dart @@ -0,0 +1,92 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'get_action_config_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$GetActionConfigResponse { + Map> get actionConfig; + String get duration; + + /// Create a copy of GetActionConfigResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $GetActionConfigResponseCopyWith get copyWith => + _$GetActionConfigResponseCopyWithImpl( + this as GetActionConfigResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is GetActionConfigResponse && + const DeepCollectionEquality().equals( + other.actionConfig, + actionConfig, + ) && + (identical(other.duration, duration) || other.duration == duration)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(actionConfig), + duration, + ); + + @override + String toString() { + return 'GetActionConfigResponse(actionConfig: $actionConfig, duration: $duration)'; + } +} + +/// @nodoc +abstract mixin class $GetActionConfigResponseCopyWith<$Res> { + factory $GetActionConfigResponseCopyWith( + GetActionConfigResponse value, + $Res Function(GetActionConfigResponse) _then, + ) = _$GetActionConfigResponseCopyWithImpl; + @useResult + $Res call({ + Map> actionConfig, + String duration, + }); +} + +/// @nodoc +class _$GetActionConfigResponseCopyWithImpl<$Res> implements $GetActionConfigResponseCopyWith<$Res> { + _$GetActionConfigResponseCopyWithImpl(this._self, this._then); + + final GetActionConfigResponse _self; + final $Res Function(GetActionConfigResponse) _then; + + /// Create a copy of GetActionConfigResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? actionConfig = null, Object? duration = null}) { + return _then( + GetActionConfigResponse( + actionConfig: null == actionConfig + ? _self.actionConfig + : actionConfig // ignore: cast_nullable_to_non_nullable + as Map>, + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/get_action_config_response.g.dart b/packages/stream_chat/lib/open_api/model/get_action_config_response.g.dart new file mode 100644 index 0000000000..7b40f7d96b --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/get_action_config_response.g.dart @@ -0,0 +1,34 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'get_action_config_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +GetActionConfigResponse _$GetActionConfigResponseFromJson( + Map json, +) => GetActionConfigResponse( + actionConfig: (json['action_config'] as Map).map( + (k, e) => MapEntry( + k, + (e as List) + .map( + (e) => ModerationActionConfigResponse.fromJson( + e as Map, + ), + ) + .toList(), + ), + ), + duration: json['duration'] as String, +); + +Map _$GetActionConfigResponseToJson( + GetActionConfigResponse instance, +) => { + 'action_config': instance.actionConfig.map( + (k, e) => MapEntry(k, e.map((e) => e.toJson()).toList()), + ), + 'duration': instance.duration, +}; diff --git a/packages/stream_chat/lib/open_api/model/get_appeal_response.dart b/packages/stream_chat/lib/open_api/model/get_appeal_response.dart new file mode 100644 index 0000000000..cf25bf6780 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/get_appeal_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'get_appeal_response.g.dart'; +part 'get_appeal_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class GetAppealResponse with _$GetAppealResponse { + const GetAppealResponse({ + required this.duration, + this.item, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'item') + final AppealItemResponse? item; + + Map toJson() => _$GetAppealResponseToJson(this); + + static GetAppealResponse fromJson(Map json) => _$GetAppealResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/get_appeal_response.freezed.dart b/packages/stream_chat/lib/open_api/model/get_appeal_response.freezed.dart new file mode 100644 index 0000000000..a467015629 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/get_appeal_response.freezed.dart @@ -0,0 +1,81 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'get_appeal_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$GetAppealResponse { + String get duration; + AppealItemResponse? get item; + + /// Create a copy of GetAppealResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $GetAppealResponseCopyWith get copyWith => _$GetAppealResponseCopyWithImpl( + this as GetAppealResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is GetAppealResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.item, item) || other.item == item)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration, item); + + @override + String toString() { + return 'GetAppealResponse(duration: $duration, item: $item)'; + } +} + +/// @nodoc +abstract mixin class $GetAppealResponseCopyWith<$Res> { + factory $GetAppealResponseCopyWith( + GetAppealResponse value, + $Res Function(GetAppealResponse) _then, + ) = _$GetAppealResponseCopyWithImpl; + @useResult + $Res call({String duration, AppealItemResponse? item}); +} + +/// @nodoc +class _$GetAppealResponseCopyWithImpl<$Res> implements $GetAppealResponseCopyWith<$Res> { + _$GetAppealResponseCopyWithImpl(this._self, this._then); + + final GetAppealResponse _self; + final $Res Function(GetAppealResponse) _then; + + /// Create a copy of GetAppealResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? item = freezed}) { + return _then( + GetAppealResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + item: freezed == item + ? _self.item + : item // ignore: cast_nullable_to_non_nullable + as AppealItemResponse?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/get_appeal_response.g.dart b/packages/stream_chat/lib/open_api/model/get_appeal_response.g.dart new file mode 100644 index 0000000000..38eea4d482 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/get_appeal_response.g.dart @@ -0,0 +1,17 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'get_appeal_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +GetAppealResponse _$GetAppealResponseFromJson(Map json) => GetAppealResponse( + duration: json['duration'] as String, + item: json['item'] == null ? null : AppealItemResponse.fromJson(json['item'] as Map), +); + +Map _$GetAppealResponseToJson(GetAppealResponse instance) => { + 'duration': instance.duration, + 'item': instance.item?.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/get_application_response.dart b/packages/stream_chat/lib/open_api/model/get_application_response.dart new file mode 100644 index 0000000000..893e1c7e4d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/get_application_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'get_application_response.g.dart'; +part 'get_application_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class GetApplicationResponse with _$GetApplicationResponse { + const GetApplicationResponse({ + required this.app, + required this.duration, + }); + + @override + @JsonKey(name: 'app') + final AppResponseFields app; + + @override + @JsonKey(name: 'duration') + final String duration; + + Map toJson() => _$GetApplicationResponseToJson(this); + + static GetApplicationResponse fromJson(Map json) => _$GetApplicationResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/get_application_response.freezed.dart b/packages/stream_chat/lib/open_api/model/get_application_response.freezed.dart new file mode 100644 index 0000000000..a359bf01bc --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/get_application_response.freezed.dart @@ -0,0 +1,82 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'get_application_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$GetApplicationResponse { + AppResponseFields get app; + String get duration; + + /// Create a copy of GetApplicationResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $GetApplicationResponseCopyWith get copyWith => + _$GetApplicationResponseCopyWithImpl( + this as GetApplicationResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is GetApplicationResponse && + (identical(other.app, app) || other.app == app) && + (identical(other.duration, duration) || other.duration == duration)); + } + + @override + int get hashCode => Object.hash(runtimeType, app, duration); + + @override + String toString() { + return 'GetApplicationResponse(app: $app, duration: $duration)'; + } +} + +/// @nodoc +abstract mixin class $GetApplicationResponseCopyWith<$Res> { + factory $GetApplicationResponseCopyWith( + GetApplicationResponse value, + $Res Function(GetApplicationResponse) _then, + ) = _$GetApplicationResponseCopyWithImpl; + @useResult + $Res call({AppResponseFields app, String duration}); +} + +/// @nodoc +class _$GetApplicationResponseCopyWithImpl<$Res> implements $GetApplicationResponseCopyWith<$Res> { + _$GetApplicationResponseCopyWithImpl(this._self, this._then); + + final GetApplicationResponse _self; + final $Res Function(GetApplicationResponse) _then; + + /// Create a copy of GetApplicationResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? app = null, Object? duration = null}) { + return _then( + GetApplicationResponse( + app: null == app + ? _self.app + : app // ignore: cast_nullable_to_non_nullable + as AppResponseFields, + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/get_application_response.g.dart b/packages/stream_chat/lib/open_api/model/get_application_response.g.dart new file mode 100644 index 0000000000..886d15a8e9 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/get_application_response.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'get_application_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +GetApplicationResponse _$GetApplicationResponseFromJson( + Map json, +) => GetApplicationResponse( + app: AppResponseFields.fromJson(json['app'] as Map), + duration: json['duration'] as String, +); + +Map _$GetApplicationResponseToJson( + GetApplicationResponse instance, +) => { + 'app': instance.app.toJson(), + 'duration': instance.duration, +}; diff --git a/packages/stream_chat/lib/open_api/model/get_blocked_users_response.dart b/packages/stream_chat/lib/open_api/model/get_blocked_users_response.dart new file mode 100644 index 0000000000..db6b1d2353 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/get_blocked_users_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'get_blocked_users_response.g.dart'; +part 'get_blocked_users_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class GetBlockedUsersResponse with _$GetBlockedUsersResponse { + const GetBlockedUsersResponse({ + required this.blocks, + required this.duration, + }); + + @override + @JsonKey(name: 'blocks') + final List blocks; + + @override + @JsonKey(name: 'duration') + final String duration; + + Map toJson() => _$GetBlockedUsersResponseToJson(this); + + static GetBlockedUsersResponse fromJson(Map json) => _$GetBlockedUsersResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/get_blocked_users_response.freezed.dart b/packages/stream_chat/lib/open_api/model/get_blocked_users_response.freezed.dart new file mode 100644 index 0000000000..74e3ca346f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/get_blocked_users_response.freezed.dart @@ -0,0 +1,86 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'get_blocked_users_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$GetBlockedUsersResponse { + List get blocks; + String get duration; + + /// Create a copy of GetBlockedUsersResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $GetBlockedUsersResponseCopyWith get copyWith => + _$GetBlockedUsersResponseCopyWithImpl( + this as GetBlockedUsersResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is GetBlockedUsersResponse && + const DeepCollectionEquality().equals(other.blocks, blocks) && + (identical(other.duration, duration) || other.duration == duration)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(blocks), + duration, + ); + + @override + String toString() { + return 'GetBlockedUsersResponse(blocks: $blocks, duration: $duration)'; + } +} + +/// @nodoc +abstract mixin class $GetBlockedUsersResponseCopyWith<$Res> { + factory $GetBlockedUsersResponseCopyWith( + GetBlockedUsersResponse value, + $Res Function(GetBlockedUsersResponse) _then, + ) = _$GetBlockedUsersResponseCopyWithImpl; + @useResult + $Res call({List blocks, String duration}); +} + +/// @nodoc +class _$GetBlockedUsersResponseCopyWithImpl<$Res> implements $GetBlockedUsersResponseCopyWith<$Res> { + _$GetBlockedUsersResponseCopyWithImpl(this._self, this._then); + + final GetBlockedUsersResponse _self; + final $Res Function(GetBlockedUsersResponse) _then; + + /// Create a copy of GetBlockedUsersResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? blocks = null, Object? duration = null}) { + return _then( + GetBlockedUsersResponse( + blocks: null == blocks + ? _self.blocks + : blocks // ignore: cast_nullable_to_non_nullable + as List, + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/get_blocked_users_response.g.dart b/packages/stream_chat/lib/open_api/model/get_blocked_users_response.g.dart new file mode 100644 index 0000000000..2c69868f54 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/get_blocked_users_response.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'get_blocked_users_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +GetBlockedUsersResponse _$GetBlockedUsersResponseFromJson( + Map json, +) => GetBlockedUsersResponse( + blocks: (json['blocks'] as List) + .map((e) => BlockedUserResponse.fromJson(e as Map)) + .toList(), + duration: json['duration'] as String, +); + +Map _$GetBlockedUsersResponseToJson( + GetBlockedUsersResponse instance, +) => { + 'blocks': instance.blocks.map((e) => e.toJson()).toList(), + 'duration': instance.duration, +}; diff --git a/packages/stream_chat/lib/open_api/model/get_config_response.dart b/packages/stream_chat/lib/open_api/model/get_config_response.dart new file mode 100644 index 0000000000..87de0a2d3e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/get_config_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'get_config_response.g.dart'; +part 'get_config_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class GetConfigResponse with _$GetConfigResponse { + const GetConfigResponse({ + this.config, + required this.duration, + }); + + @override + @JsonKey(name: 'config') + final ConfigResponse? config; + + @override + @JsonKey(name: 'duration') + final String duration; + + Map toJson() => _$GetConfigResponseToJson(this); + + static GetConfigResponse fromJson(Map json) => _$GetConfigResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/get_config_response.freezed.dart b/packages/stream_chat/lib/open_api/model/get_config_response.freezed.dart new file mode 100644 index 0000000000..c5413110ef --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/get_config_response.freezed.dart @@ -0,0 +1,81 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'get_config_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$GetConfigResponse { + ConfigResponse? get config; + String get duration; + + /// Create a copy of GetConfigResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $GetConfigResponseCopyWith get copyWith => _$GetConfigResponseCopyWithImpl( + this as GetConfigResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is GetConfigResponse && + (identical(other.config, config) || other.config == config) && + (identical(other.duration, duration) || other.duration == duration)); + } + + @override + int get hashCode => Object.hash(runtimeType, config, duration); + + @override + String toString() { + return 'GetConfigResponse(config: $config, duration: $duration)'; + } +} + +/// @nodoc +abstract mixin class $GetConfigResponseCopyWith<$Res> { + factory $GetConfigResponseCopyWith( + GetConfigResponse value, + $Res Function(GetConfigResponse) _then, + ) = _$GetConfigResponseCopyWithImpl; + @useResult + $Res call({ConfigResponse? config, String duration}); +} + +/// @nodoc +class _$GetConfigResponseCopyWithImpl<$Res> implements $GetConfigResponseCopyWith<$Res> { + _$GetConfigResponseCopyWithImpl(this._self, this._then); + + final GetConfigResponse _self; + final $Res Function(GetConfigResponse) _then; + + /// Create a copy of GetConfigResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? config = freezed, Object? duration = null}) { + return _then( + GetConfigResponse( + config: freezed == config + ? _self.config + : config // ignore: cast_nullable_to_non_nullable + as ConfigResponse?, + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/get_config_response.g.dart b/packages/stream_chat/lib/open_api/model/get_config_response.g.dart new file mode 100644 index 0000000000..ab863fc079 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/get_config_response.g.dart @@ -0,0 +1,17 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'get_config_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +GetConfigResponse _$GetConfigResponseFromJson(Map json) => GetConfigResponse( + config: json['config'] == null ? null : ConfigResponse.fromJson(json['config'] as Map), + duration: json['duration'] as String, +); + +Map _$GetConfigResponseToJson(GetConfigResponse instance) => { + 'config': instance.config?.toJson(), + 'duration': instance.duration, +}; diff --git a/packages/stream_chat/lib/open_api/model/get_draft_response.dart b/packages/stream_chat/lib/open_api/model/get_draft_response.dart new file mode 100644 index 0000000000..8bac3a1d52 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/get_draft_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'get_draft_response.g.dart'; +part 'get_draft_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class GetDraftResponse with _$GetDraftResponse { + const GetDraftResponse({ + required this.draft, + required this.duration, + }); + + @override + @JsonKey(name: 'draft') + final DraftResponse draft; + + @override + @JsonKey(name: 'duration') + final String duration; + + Map toJson() => _$GetDraftResponseToJson(this); + + static GetDraftResponse fromJson(Map json) => _$GetDraftResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/get_draft_response.freezed.dart b/packages/stream_chat/lib/open_api/model/get_draft_response.freezed.dart new file mode 100644 index 0000000000..c4576ac0fc --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/get_draft_response.freezed.dart @@ -0,0 +1,81 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'get_draft_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$GetDraftResponse { + DraftResponse get draft; + String get duration; + + /// Create a copy of GetDraftResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $GetDraftResponseCopyWith get copyWith => _$GetDraftResponseCopyWithImpl( + this as GetDraftResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is GetDraftResponse && + (identical(other.draft, draft) || other.draft == draft) && + (identical(other.duration, duration) || other.duration == duration)); + } + + @override + int get hashCode => Object.hash(runtimeType, draft, duration); + + @override + String toString() { + return 'GetDraftResponse(draft: $draft, duration: $duration)'; + } +} + +/// @nodoc +abstract mixin class $GetDraftResponseCopyWith<$Res> { + factory $GetDraftResponseCopyWith( + GetDraftResponse value, + $Res Function(GetDraftResponse) _then, + ) = _$GetDraftResponseCopyWithImpl; + @useResult + $Res call({DraftResponse draft, String duration}); +} + +/// @nodoc +class _$GetDraftResponseCopyWithImpl<$Res> implements $GetDraftResponseCopyWith<$Res> { + _$GetDraftResponseCopyWithImpl(this._self, this._then); + + final GetDraftResponse _self; + final $Res Function(GetDraftResponse) _then; + + /// Create a copy of GetDraftResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? draft = null, Object? duration = null}) { + return _then( + GetDraftResponse( + draft: null == draft + ? _self.draft + : draft // ignore: cast_nullable_to_non_nullable + as DraftResponse, + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/get_draft_response.g.dart b/packages/stream_chat/lib/open_api/model/get_draft_response.g.dart new file mode 100644 index 0000000000..10e2ce3775 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/get_draft_response.g.dart @@ -0,0 +1,17 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'get_draft_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +GetDraftResponse _$GetDraftResponseFromJson(Map json) => GetDraftResponse( + draft: DraftResponse.fromJson(json['draft'] as Map), + duration: json['duration'] as String, +); + +Map _$GetDraftResponseToJson(GetDraftResponse instance) => { + 'draft': instance.draft.toJson(), + 'duration': instance.duration, +}; diff --git a/packages/stream_chat/lib/open_api/model/get_many_messages_response.dart b/packages/stream_chat/lib/open_api/model/get_many_messages_response.dart new file mode 100644 index 0000000000..744b0a2e07 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/get_many_messages_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'get_many_messages_response.g.dart'; +part 'get_many_messages_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class GetManyMessagesResponse with _$GetManyMessagesResponse { + const GetManyMessagesResponse({ + required this.duration, + required this.messages, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'messages') + final List messages; + + Map toJson() => _$GetManyMessagesResponseToJson(this); + + static GetManyMessagesResponse fromJson(Map json) => _$GetManyMessagesResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/get_many_messages_response.freezed.dart b/packages/stream_chat/lib/open_api/model/get_many_messages_response.freezed.dart new file mode 100644 index 0000000000..cadd0430f6 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/get_many_messages_response.freezed.dart @@ -0,0 +1,86 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'get_many_messages_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$GetManyMessagesResponse { + String get duration; + List get messages; + + /// Create a copy of GetManyMessagesResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $GetManyMessagesResponseCopyWith get copyWith => + _$GetManyMessagesResponseCopyWithImpl( + this as GetManyMessagesResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is GetManyMessagesResponse && + (identical(other.duration, duration) || other.duration == duration) && + const DeepCollectionEquality().equals(other.messages, messages)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + duration, + const DeepCollectionEquality().hash(messages), + ); + + @override + String toString() { + return 'GetManyMessagesResponse(duration: $duration, messages: $messages)'; + } +} + +/// @nodoc +abstract mixin class $GetManyMessagesResponseCopyWith<$Res> { + factory $GetManyMessagesResponseCopyWith( + GetManyMessagesResponse value, + $Res Function(GetManyMessagesResponse) _then, + ) = _$GetManyMessagesResponseCopyWithImpl; + @useResult + $Res call({String duration, List messages}); +} + +/// @nodoc +class _$GetManyMessagesResponseCopyWithImpl<$Res> implements $GetManyMessagesResponseCopyWith<$Res> { + _$GetManyMessagesResponseCopyWithImpl(this._self, this._then); + + final GetManyMessagesResponse _self; + final $Res Function(GetManyMessagesResponse) _then; + + /// Create a copy of GetManyMessagesResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? messages = null}) { + return _then( + GetManyMessagesResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + messages: null == messages + ? _self.messages + : messages // ignore: cast_nullable_to_non_nullable + as List, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/get_many_messages_response.g.dart b/packages/stream_chat/lib/open_api/model/get_many_messages_response.g.dart new file mode 100644 index 0000000000..4dd9d6460a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/get_many_messages_response.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'get_many_messages_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +GetManyMessagesResponse _$GetManyMessagesResponseFromJson( + Map json, +) => GetManyMessagesResponse( + duration: json['duration'] as String, + messages: (json['messages'] as List) + .map((e) => MessageResponse.fromJson(e as Map)) + .toList(), +); + +Map _$GetManyMessagesResponseToJson( + GetManyMessagesResponse instance, +) => { + 'duration': instance.duration, + 'messages': instance.messages.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/get_message_response.dart b/packages/stream_chat/lib/open_api/model/get_message_response.dart new file mode 100644 index 0000000000..a0a8f26f1a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/get_message_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'get_message_response.g.dart'; +part 'get_message_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class GetMessageResponse with _$GetMessageResponse { + const GetMessageResponse({ + required this.duration, + required this.message, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'message') + final MessageWithChannelResponse message; + + Map toJson() => _$GetMessageResponseToJson(this); + + static GetMessageResponse fromJson(Map json) => _$GetMessageResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/get_message_response.freezed.dart b/packages/stream_chat/lib/open_api/model/get_message_response.freezed.dart new file mode 100644 index 0000000000..70f86699af --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/get_message_response.freezed.dart @@ -0,0 +1,81 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'get_message_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$GetMessageResponse { + String get duration; + MessageWithChannelResponse get message; + + /// Create a copy of GetMessageResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $GetMessageResponseCopyWith get copyWith => _$GetMessageResponseCopyWithImpl( + this as GetMessageResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is GetMessageResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.message, message) || other.message == message)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration, message); + + @override + String toString() { + return 'GetMessageResponse(duration: $duration, message: $message)'; + } +} + +/// @nodoc +abstract mixin class $GetMessageResponseCopyWith<$Res> { + factory $GetMessageResponseCopyWith( + GetMessageResponse value, + $Res Function(GetMessageResponse) _then, + ) = _$GetMessageResponseCopyWithImpl; + @useResult + $Res call({String duration, MessageWithChannelResponse message}); +} + +/// @nodoc +class _$GetMessageResponseCopyWithImpl<$Res> implements $GetMessageResponseCopyWith<$Res> { + _$GetMessageResponseCopyWithImpl(this._self, this._then); + + final GetMessageResponse _self; + final $Res Function(GetMessageResponse) _then; + + /// Create a copy of GetMessageResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? message = null}) { + return _then( + GetMessageResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + message: null == message + ? _self.message + : message // ignore: cast_nullable_to_non_nullable + as MessageWithChannelResponse, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/get_message_response.g.dart b/packages/stream_chat/lib/open_api/model/get_message_response.g.dart new file mode 100644 index 0000000000..cd2c3d9c83 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/get_message_response.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'get_message_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +GetMessageResponse _$GetMessageResponseFromJson(Map json) => GetMessageResponse( + duration: json['duration'] as String, + message: MessageWithChannelResponse.fromJson( + json['message'] as Map, + ), +); + +Map _$GetMessageResponseToJson(GetMessageResponse instance) => { + 'duration': instance.duration, + 'message': instance.message.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/get_og_response.dart b/packages/stream_chat/lib/open_api/model/get_og_response.dart new file mode 100644 index 0000000000..147ef00395 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/get_og_response.dart @@ -0,0 +1,141 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'get_og_response.g.dart'; +part 'get_og_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class GetOGResponse with _$GetOGResponse { + const GetOGResponse({ + this.actions, + this.assetUrl, + this.authorIcon, + this.authorLink, + this.authorName, + this.color, + required this.custom, + required this.duration, + this.fallback, + this.fields, + this.footer, + this.footerIcon, + this.giphy, + this.imageUrl, + this.ogScrapeUrl, + this.originalHeight, + this.originalWidth, + this.pretext, + this.text, + this.thumbUrl, + this.title, + this.titleLink, + this.type, + }); + + @override + @JsonKey(name: 'actions') + final List? actions; + + @override + @JsonKey(name: 'asset_url') + final String? assetUrl; + + @override + @JsonKey(name: 'author_icon') + final String? authorIcon; + + @override + @JsonKey(name: 'author_link') + final String? authorLink; + + @override + @JsonKey(name: 'author_name') + final String? authorName; + + @override + @JsonKey(name: 'color') + final String? color; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'fallback') + final String? fallback; + + @override + @JsonKey(name: 'fields') + final List? fields; + + @override + @JsonKey(name: 'footer') + final String? footer; + + @override + @JsonKey(name: 'footer_icon') + final String? footerIcon; + + @override + @JsonKey(name: 'giphy') + final Images? giphy; + + @override + @JsonKey(name: 'image_url') + final String? imageUrl; + + @override + @JsonKey(name: 'og_scrape_url') + final String? ogScrapeUrl; + + @override + @JsonKey(name: 'original_height') + final int? originalHeight; + + @override + @JsonKey(name: 'original_width') + final int? originalWidth; + + @override + @JsonKey(name: 'pretext') + final String? pretext; + + @override + @JsonKey(name: 'text') + final String? text; + + @override + @JsonKey(name: 'thumb_url') + final String? thumbUrl; + + @override + @JsonKey(name: 'title') + final String? title; + + @override + @JsonKey(name: 'title_link') + final String? titleLink; + + @override + @JsonKey(name: 'type') + final String? type; + + Map toJson() => _$GetOGResponseToJson(this); + + static GetOGResponse fromJson(Map json) => _$GetOGResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/get_og_response.freezed.dart b/packages/stream_chat/lib/open_api/model/get_og_response.freezed.dart new file mode 100644 index 0000000000..bb6223f438 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/get_og_response.freezed.dart @@ -0,0 +1,280 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'get_og_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$GetOGResponse { + List? get actions; + String? get assetUrl; + String? get authorIcon; + String? get authorLink; + String? get authorName; + String? get color; + Map get custom; + String get duration; + String? get fallback; + List? get fields; + String? get footer; + String? get footerIcon; + Images? get giphy; + String? get imageUrl; + String? get ogScrapeUrl; + int? get originalHeight; + int? get originalWidth; + String? get pretext; + String? get text; + String? get thumbUrl; + String? get title; + String? get titleLink; + String? get type; + + /// Create a copy of GetOGResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $GetOGResponseCopyWith get copyWith => _$GetOGResponseCopyWithImpl( + this as GetOGResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is GetOGResponse && + const DeepCollectionEquality().equals(other.actions, actions) && + (identical(other.assetUrl, assetUrl) || other.assetUrl == assetUrl) && + (identical(other.authorIcon, authorIcon) || other.authorIcon == authorIcon) && + (identical(other.authorLink, authorLink) || other.authorLink == authorLink) && + (identical(other.authorName, authorName) || other.authorName == authorName) && + (identical(other.color, color) || other.color == color) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.fallback, fallback) || other.fallback == fallback) && + const DeepCollectionEquality().equals(other.fields, fields) && + (identical(other.footer, footer) || other.footer == footer) && + (identical(other.footerIcon, footerIcon) || other.footerIcon == footerIcon) && + (identical(other.giphy, giphy) || other.giphy == giphy) && + (identical(other.imageUrl, imageUrl) || other.imageUrl == imageUrl) && + (identical(other.ogScrapeUrl, ogScrapeUrl) || other.ogScrapeUrl == ogScrapeUrl) && + (identical(other.originalHeight, originalHeight) || other.originalHeight == originalHeight) && + (identical(other.originalWidth, originalWidth) || other.originalWidth == originalWidth) && + (identical(other.pretext, pretext) || other.pretext == pretext) && + (identical(other.text, text) || other.text == text) && + (identical(other.thumbUrl, thumbUrl) || other.thumbUrl == thumbUrl) && + (identical(other.title, title) || other.title == title) && + (identical(other.titleLink, titleLink) || other.titleLink == titleLink) && + (identical(other.type, type) || other.type == type)); + } + + @override + int get hashCode => Object.hashAll([ + runtimeType, + const DeepCollectionEquality().hash(actions), + assetUrl, + authorIcon, + authorLink, + authorName, + color, + const DeepCollectionEquality().hash(custom), + duration, + fallback, + const DeepCollectionEquality().hash(fields), + footer, + footerIcon, + giphy, + imageUrl, + ogScrapeUrl, + originalHeight, + originalWidth, + pretext, + text, + thumbUrl, + title, + titleLink, + type, + ]); + + @override + String toString() { + return 'GetOGResponse(actions: $actions, assetUrl: $assetUrl, authorIcon: $authorIcon, authorLink: $authorLink, authorName: $authorName, color: $color, custom: $custom, duration: $duration, fallback: $fallback, fields: $fields, footer: $footer, footerIcon: $footerIcon, giphy: $giphy, imageUrl: $imageUrl, ogScrapeUrl: $ogScrapeUrl, originalHeight: $originalHeight, originalWidth: $originalWidth, pretext: $pretext, text: $text, thumbUrl: $thumbUrl, title: $title, titleLink: $titleLink, type: $type)'; + } +} + +/// @nodoc +abstract mixin class $GetOGResponseCopyWith<$Res> { + factory $GetOGResponseCopyWith( + GetOGResponse value, + $Res Function(GetOGResponse) _then, + ) = _$GetOGResponseCopyWithImpl; + @useResult + $Res call({ + List? actions, + String? assetUrl, + String? authorIcon, + String? authorLink, + String? authorName, + String? color, + Map custom, + String duration, + String? fallback, + List? fields, + String? footer, + String? footerIcon, + Images? giphy, + String? imageUrl, + String? ogScrapeUrl, + int? originalHeight, + int? originalWidth, + String? pretext, + String? text, + String? thumbUrl, + String? title, + String? titleLink, + String? type, + }); +} + +/// @nodoc +class _$GetOGResponseCopyWithImpl<$Res> implements $GetOGResponseCopyWith<$Res> { + _$GetOGResponseCopyWithImpl(this._self, this._then); + + final GetOGResponse _self; + final $Res Function(GetOGResponse) _then; + + /// Create a copy of GetOGResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? actions = freezed, + Object? assetUrl = freezed, + Object? authorIcon = freezed, + Object? authorLink = freezed, + Object? authorName = freezed, + Object? color = freezed, + Object? custom = null, + Object? duration = null, + Object? fallback = freezed, + Object? fields = freezed, + Object? footer = freezed, + Object? footerIcon = freezed, + Object? giphy = freezed, + Object? imageUrl = freezed, + Object? ogScrapeUrl = freezed, + Object? originalHeight = freezed, + Object? originalWidth = freezed, + Object? pretext = freezed, + Object? text = freezed, + Object? thumbUrl = freezed, + Object? title = freezed, + Object? titleLink = freezed, + Object? type = freezed, + }) { + return _then( + GetOGResponse( + actions: freezed == actions + ? _self.actions + : actions // ignore: cast_nullable_to_non_nullable + as List?, + assetUrl: freezed == assetUrl + ? _self.assetUrl + : assetUrl // ignore: cast_nullable_to_non_nullable + as String?, + authorIcon: freezed == authorIcon + ? _self.authorIcon + : authorIcon // ignore: cast_nullable_to_non_nullable + as String?, + authorLink: freezed == authorLink + ? _self.authorLink + : authorLink // ignore: cast_nullable_to_non_nullable + as String?, + authorName: freezed == authorName + ? _self.authorName + : authorName // ignore: cast_nullable_to_non_nullable + as String?, + color: freezed == color + ? _self.color + : color // ignore: cast_nullable_to_non_nullable + as String?, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + fallback: freezed == fallback + ? _self.fallback + : fallback // ignore: cast_nullable_to_non_nullable + as String?, + fields: freezed == fields + ? _self.fields + : fields // ignore: cast_nullable_to_non_nullable + as List?, + footer: freezed == footer + ? _self.footer + : footer // ignore: cast_nullable_to_non_nullable + as String?, + footerIcon: freezed == footerIcon + ? _self.footerIcon + : footerIcon // ignore: cast_nullable_to_non_nullable + as String?, + giphy: freezed == giphy + ? _self.giphy + : giphy // ignore: cast_nullable_to_non_nullable + as Images?, + imageUrl: freezed == imageUrl + ? _self.imageUrl + : imageUrl // ignore: cast_nullable_to_non_nullable + as String?, + ogScrapeUrl: freezed == ogScrapeUrl + ? _self.ogScrapeUrl + : ogScrapeUrl // ignore: cast_nullable_to_non_nullable + as String?, + originalHeight: freezed == originalHeight + ? _self.originalHeight + : originalHeight // ignore: cast_nullable_to_non_nullable + as int?, + originalWidth: freezed == originalWidth + ? _self.originalWidth + : originalWidth // ignore: cast_nullable_to_non_nullable + as int?, + pretext: freezed == pretext + ? _self.pretext + : pretext // ignore: cast_nullable_to_non_nullable + as String?, + text: freezed == text + ? _self.text + : text // ignore: cast_nullable_to_non_nullable + as String?, + thumbUrl: freezed == thumbUrl + ? _self.thumbUrl + : thumbUrl // ignore: cast_nullable_to_non_nullable + as String?, + title: freezed == title + ? _self.title + : title // ignore: cast_nullable_to_non_nullable + as String?, + titleLink: freezed == titleLink + ? _self.titleLink + : titleLink // ignore: cast_nullable_to_non_nullable + as String?, + type: freezed == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/get_og_response.g.dart b/packages/stream_chat/lib/open_api/model/get_og_response.g.dart new file mode 100644 index 0000000000..7f8dc24314 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/get_og_response.g.dart @@ -0,0 +1,59 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'get_og_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +GetOGResponse _$GetOGResponseFromJson(Map json) => GetOGResponse( + actions: (json['actions'] as List?)?.map((e) => Action.fromJson(e as Map)).toList(), + assetUrl: json['asset_url'] as String?, + authorIcon: json['author_icon'] as String?, + authorLink: json['author_link'] as String?, + authorName: json['author_name'] as String?, + color: json['color'] as String?, + custom: json['custom'] as Map, + duration: json['duration'] as String, + fallback: json['fallback'] as String?, + fields: (json['fields'] as List?)?.map((e) => Field.fromJson(e as Map)).toList(), + footer: json['footer'] as String?, + footerIcon: json['footer_icon'] as String?, + giphy: json['giphy'] == null ? null : Images.fromJson(json['giphy'] as Map), + imageUrl: json['image_url'] as String?, + ogScrapeUrl: json['og_scrape_url'] as String?, + originalHeight: (json['original_height'] as num?)?.toInt(), + originalWidth: (json['original_width'] as num?)?.toInt(), + pretext: json['pretext'] as String?, + text: json['text'] as String?, + thumbUrl: json['thumb_url'] as String?, + title: json['title'] as String?, + titleLink: json['title_link'] as String?, + type: json['type'] as String?, +); + +Map _$GetOGResponseToJson(GetOGResponse instance) => { + 'actions': instance.actions?.map((e) => e.toJson()).toList(), + 'asset_url': instance.assetUrl, + 'author_icon': instance.authorIcon, + 'author_link': instance.authorLink, + 'author_name': instance.authorName, + 'color': instance.color, + 'custom': instance.custom, + 'duration': instance.duration, + 'fallback': instance.fallback, + 'fields': instance.fields?.map((e) => e.toJson()).toList(), + 'footer': instance.footer, + 'footer_icon': instance.footerIcon, + 'giphy': instance.giphy?.toJson(), + 'image_url': instance.imageUrl, + 'og_scrape_url': instance.ogScrapeUrl, + 'original_height': instance.originalHeight, + 'original_width': instance.originalWidth, + 'pretext': instance.pretext, + 'text': instance.text, + 'thumb_url': instance.thumbUrl, + 'title': instance.title, + 'title_link': instance.titleLink, + 'type': instance.type, +}; diff --git a/packages/stream_chat/lib/open_api/model/get_pinned_messages_response.dart b/packages/stream_chat/lib/open_api/model/get_pinned_messages_response.dart new file mode 100644 index 0000000000..821e416020 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/get_pinned_messages_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'get_pinned_messages_response.g.dart'; +part 'get_pinned_messages_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class GetPinnedMessagesResponse with _$GetPinnedMessagesResponse { + const GetPinnedMessagesResponse({ + required this.duration, + required this.messages, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'messages') + final List messages; + + Map toJson() => _$GetPinnedMessagesResponseToJson(this); + + static GetPinnedMessagesResponse fromJson(Map json) => _$GetPinnedMessagesResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/get_pinned_messages_response.freezed.dart b/packages/stream_chat/lib/open_api/model/get_pinned_messages_response.freezed.dart new file mode 100644 index 0000000000..2639a3e312 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/get_pinned_messages_response.freezed.dart @@ -0,0 +1,86 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'get_pinned_messages_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$GetPinnedMessagesResponse { + String get duration; + List get messages; + + /// Create a copy of GetPinnedMessagesResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $GetPinnedMessagesResponseCopyWith get copyWith => + _$GetPinnedMessagesResponseCopyWithImpl( + this as GetPinnedMessagesResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is GetPinnedMessagesResponse && + (identical(other.duration, duration) || other.duration == duration) && + const DeepCollectionEquality().equals(other.messages, messages)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + duration, + const DeepCollectionEquality().hash(messages), + ); + + @override + String toString() { + return 'GetPinnedMessagesResponse(duration: $duration, messages: $messages)'; + } +} + +/// @nodoc +abstract mixin class $GetPinnedMessagesResponseCopyWith<$Res> { + factory $GetPinnedMessagesResponseCopyWith( + GetPinnedMessagesResponse value, + $Res Function(GetPinnedMessagesResponse) _then, + ) = _$GetPinnedMessagesResponseCopyWithImpl; + @useResult + $Res call({String duration, List messages}); +} + +/// @nodoc +class _$GetPinnedMessagesResponseCopyWithImpl<$Res> implements $GetPinnedMessagesResponseCopyWith<$Res> { + _$GetPinnedMessagesResponseCopyWithImpl(this._self, this._then); + + final GetPinnedMessagesResponse _self; + final $Res Function(GetPinnedMessagesResponse) _then; + + /// Create a copy of GetPinnedMessagesResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? messages = null}) { + return _then( + GetPinnedMessagesResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + messages: null == messages + ? _self.messages + : messages // ignore: cast_nullable_to_non_nullable + as List, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/get_pinned_messages_response.g.dart b/packages/stream_chat/lib/open_api/model/get_pinned_messages_response.g.dart new file mode 100644 index 0000000000..fd524a1ab4 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/get_pinned_messages_response.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'get_pinned_messages_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +GetPinnedMessagesResponse _$GetPinnedMessagesResponseFromJson( + Map json, +) => GetPinnedMessagesResponse( + duration: json['duration'] as String, + messages: (json['messages'] as List) + .map((e) => MessageResponse.fromJson(e as Map)) + .toList(), +); + +Map _$GetPinnedMessagesResponseToJson( + GetPinnedMessagesResponse instance, +) => { + 'duration': instance.duration, + 'messages': instance.messages.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/get_reactions_response.dart b/packages/stream_chat/lib/open_api/model/get_reactions_response.dart new file mode 100644 index 0000000000..50c1ac5374 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/get_reactions_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'get_reactions_response.g.dart'; +part 'get_reactions_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class GetReactionsResponse with _$GetReactionsResponse { + const GetReactionsResponse({ + required this.duration, + required this.reactions, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'reactions') + final List reactions; + + Map toJson() => _$GetReactionsResponseToJson(this); + + static GetReactionsResponse fromJson(Map json) => _$GetReactionsResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/get_reactions_response.freezed.dart b/packages/stream_chat/lib/open_api/model/get_reactions_response.freezed.dart new file mode 100644 index 0000000000..7ee8870de3 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/get_reactions_response.freezed.dart @@ -0,0 +1,86 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'get_reactions_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$GetReactionsResponse { + String get duration; + List get reactions; + + /// Create a copy of GetReactionsResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $GetReactionsResponseCopyWith get copyWith => + _$GetReactionsResponseCopyWithImpl( + this as GetReactionsResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is GetReactionsResponse && + (identical(other.duration, duration) || other.duration == duration) && + const DeepCollectionEquality().equals(other.reactions, reactions)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + duration, + const DeepCollectionEquality().hash(reactions), + ); + + @override + String toString() { + return 'GetReactionsResponse(duration: $duration, reactions: $reactions)'; + } +} + +/// @nodoc +abstract mixin class $GetReactionsResponseCopyWith<$Res> { + factory $GetReactionsResponseCopyWith( + GetReactionsResponse value, + $Res Function(GetReactionsResponse) _then, + ) = _$GetReactionsResponseCopyWithImpl; + @useResult + $Res call({String duration, List reactions}); +} + +/// @nodoc +class _$GetReactionsResponseCopyWithImpl<$Res> implements $GetReactionsResponseCopyWith<$Res> { + _$GetReactionsResponseCopyWithImpl(this._self, this._then); + + final GetReactionsResponse _self; + final $Res Function(GetReactionsResponse) _then; + + /// Create a copy of GetReactionsResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? reactions = null}) { + return _then( + GetReactionsResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + reactions: null == reactions + ? _self.reactions + : reactions // ignore: cast_nullable_to_non_nullable + as List, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/get_reactions_response.g.dart b/packages/stream_chat/lib/open_api/model/get_reactions_response.g.dart new file mode 100644 index 0000000000..a40b3f0c04 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/get_reactions_response.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'get_reactions_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +GetReactionsResponse _$GetReactionsResponseFromJson( + Map json, +) => GetReactionsResponse( + duration: json['duration'] as String, + reactions: (json['reactions'] as List) + .map((e) => ReactionResponse.fromJson(e as Map)) + .toList(), +); + +Map _$GetReactionsResponseToJson( + GetReactionsResponse instance, +) => { + 'duration': instance.duration, + 'reactions': instance.reactions.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/get_replies_response.dart b/packages/stream_chat/lib/open_api/model/get_replies_response.dart new file mode 100644 index 0000000000..be6abc33f3 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/get_replies_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'get_replies_response.g.dart'; +part 'get_replies_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class GetRepliesResponse with _$GetRepliesResponse { + const GetRepliesResponse({ + required this.duration, + required this.messages, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'messages') + final List messages; + + Map toJson() => _$GetRepliesResponseToJson(this); + + static GetRepliesResponse fromJson(Map json) => _$GetRepliesResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/get_replies_response.freezed.dart b/packages/stream_chat/lib/open_api/model/get_replies_response.freezed.dart new file mode 100644 index 0000000000..b5539ce4ef --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/get_replies_response.freezed.dart @@ -0,0 +1,85 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'get_replies_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$GetRepliesResponse { + String get duration; + List get messages; + + /// Create a copy of GetRepliesResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $GetRepliesResponseCopyWith get copyWith => _$GetRepliesResponseCopyWithImpl( + this as GetRepliesResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is GetRepliesResponse && + (identical(other.duration, duration) || other.duration == duration) && + const DeepCollectionEquality().equals(other.messages, messages)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + duration, + const DeepCollectionEquality().hash(messages), + ); + + @override + String toString() { + return 'GetRepliesResponse(duration: $duration, messages: $messages)'; + } +} + +/// @nodoc +abstract mixin class $GetRepliesResponseCopyWith<$Res> { + factory $GetRepliesResponseCopyWith( + GetRepliesResponse value, + $Res Function(GetRepliesResponse) _then, + ) = _$GetRepliesResponseCopyWithImpl; + @useResult + $Res call({String duration, List messages}); +} + +/// @nodoc +class _$GetRepliesResponseCopyWithImpl<$Res> implements $GetRepliesResponseCopyWith<$Res> { + _$GetRepliesResponseCopyWithImpl(this._self, this._then); + + final GetRepliesResponse _self; + final $Res Function(GetRepliesResponse) _then; + + /// Create a copy of GetRepliesResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? messages = null}) { + return _then( + GetRepliesResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + messages: null == messages + ? _self.messages + : messages // ignore: cast_nullable_to_non_nullable + as List, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/get_replies_response.g.dart b/packages/stream_chat/lib/open_api/model/get_replies_response.g.dart new file mode 100644 index 0000000000..5718f9e817 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/get_replies_response.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'get_replies_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +GetRepliesResponse _$GetRepliesResponseFromJson(Map json) => GetRepliesResponse( + duration: json['duration'] as String, + messages: (json['messages'] as List) + .map((e) => MessageResponse.fromJson(e as Map)) + .toList(), +); + +Map _$GetRepliesResponseToJson(GetRepliesResponse instance) => { + 'duration': instance.duration, + 'messages': instance.messages.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/get_thread_response.dart b/packages/stream_chat/lib/open_api/model/get_thread_response.dart new file mode 100644 index 0000000000..e106b93502 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/get_thread_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'get_thread_response.g.dart'; +part 'get_thread_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class GetThreadResponse with _$GetThreadResponse { + const GetThreadResponse({ + required this.duration, + required this.thread, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'thread') + final ThreadStateResponse thread; + + Map toJson() => _$GetThreadResponseToJson(this); + + static GetThreadResponse fromJson(Map json) => _$GetThreadResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/get_thread_response.freezed.dart b/packages/stream_chat/lib/open_api/model/get_thread_response.freezed.dart new file mode 100644 index 0000000000..2de86c294f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/get_thread_response.freezed.dart @@ -0,0 +1,81 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'get_thread_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$GetThreadResponse { + String get duration; + ThreadStateResponse get thread; + + /// Create a copy of GetThreadResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $GetThreadResponseCopyWith get copyWith => _$GetThreadResponseCopyWithImpl( + this as GetThreadResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is GetThreadResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.thread, thread) || other.thread == thread)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration, thread); + + @override + String toString() { + return 'GetThreadResponse(duration: $duration, thread: $thread)'; + } +} + +/// @nodoc +abstract mixin class $GetThreadResponseCopyWith<$Res> { + factory $GetThreadResponseCopyWith( + GetThreadResponse value, + $Res Function(GetThreadResponse) _then, + ) = _$GetThreadResponseCopyWithImpl; + @useResult + $Res call({String duration, ThreadStateResponse thread}); +} + +/// @nodoc +class _$GetThreadResponseCopyWithImpl<$Res> implements $GetThreadResponseCopyWith<$Res> { + _$GetThreadResponseCopyWithImpl(this._self, this._then); + + final GetThreadResponse _self; + final $Res Function(GetThreadResponse) _then; + + /// Create a copy of GetThreadResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? thread = null}) { + return _then( + GetThreadResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + thread: null == thread + ? _self.thread + : thread // ignore: cast_nullable_to_non_nullable + as ThreadStateResponse, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/get_thread_response.g.dart b/packages/stream_chat/lib/open_api/model/get_thread_response.g.dart new file mode 100644 index 0000000000..155f15f7dd --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/get_thread_response.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'get_thread_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +GetThreadResponse _$GetThreadResponseFromJson(Map json) => GetThreadResponse( + duration: json['duration'] as String, + thread: ThreadStateResponse.fromJson( + json['thread'] as Map, + ), +); + +Map _$GetThreadResponseToJson(GetThreadResponse instance) => { + 'duration': instance.duration, + 'thread': instance.thread.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/get_user_group_response.dart b/packages/stream_chat/lib/open_api/model/get_user_group_response.dart new file mode 100644 index 0000000000..db2451f03a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/get_user_group_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'get_user_group_response.g.dart'; +part 'get_user_group_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class GetUserGroupResponse with _$GetUserGroupResponse { + const GetUserGroupResponse({ + required this.duration, + this.userGroup, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'user_group') + final UserGroupResponse? userGroup; + + Map toJson() => _$GetUserGroupResponseToJson(this); + + static GetUserGroupResponse fromJson(Map json) => _$GetUserGroupResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/get_user_group_response.freezed.dart b/packages/stream_chat/lib/open_api/model/get_user_group_response.freezed.dart new file mode 100644 index 0000000000..11dcf2ad5f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/get_user_group_response.freezed.dart @@ -0,0 +1,82 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'get_user_group_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$GetUserGroupResponse { + String get duration; + UserGroupResponse? get userGroup; + + /// Create a copy of GetUserGroupResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $GetUserGroupResponseCopyWith get copyWith => + _$GetUserGroupResponseCopyWithImpl( + this as GetUserGroupResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is GetUserGroupResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.userGroup, userGroup) || other.userGroup == userGroup)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration, userGroup); + + @override + String toString() { + return 'GetUserGroupResponse(duration: $duration, userGroup: $userGroup)'; + } +} + +/// @nodoc +abstract mixin class $GetUserGroupResponseCopyWith<$Res> { + factory $GetUserGroupResponseCopyWith( + GetUserGroupResponse value, + $Res Function(GetUserGroupResponse) _then, + ) = _$GetUserGroupResponseCopyWithImpl; + @useResult + $Res call({String duration, UserGroupResponse? userGroup}); +} + +/// @nodoc +class _$GetUserGroupResponseCopyWithImpl<$Res> implements $GetUserGroupResponseCopyWith<$Res> { + _$GetUserGroupResponseCopyWithImpl(this._self, this._then); + + final GetUserGroupResponse _self; + final $Res Function(GetUserGroupResponse) _then; + + /// Create a copy of GetUserGroupResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? userGroup = freezed}) { + return _then( + GetUserGroupResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + userGroup: freezed == userGroup + ? _self.userGroup + : userGroup // ignore: cast_nullable_to_non_nullable + as UserGroupResponse?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/get_user_group_response.g.dart b/packages/stream_chat/lib/open_api/model/get_user_group_response.g.dart new file mode 100644 index 0000000000..d7addd5416 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/get_user_group_response.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'get_user_group_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +GetUserGroupResponse _$GetUserGroupResponseFromJson( + Map json, +) => GetUserGroupResponse( + duration: json['duration'] as String, + userGroup: json['user_group'] == null ? null : UserGroupResponse.fromJson(json['user_group'] as Map), +); + +Map _$GetUserGroupResponseToJson( + GetUserGroupResponse instance, +) => { + 'duration': instance.duration, + 'user_group': instance.userGroup?.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/google_vision_config.dart b/packages/stream_chat/lib/open_api/model/google_vision_config.dart new file mode 100644 index 0000000000..fa7d37766b --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/google_vision_config.dart @@ -0,0 +1,31 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'google_vision_config.g.dart'; +part 'google_vision_config.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class GoogleVisionConfig with _$GoogleVisionConfig { + const GoogleVisionConfig({ + this.enabled, + }); + + @override + @JsonKey(name: 'enabled') + final bool? enabled; + + Map toJson() => _$GoogleVisionConfigToJson(this); + + static GoogleVisionConfig fromJson(Map json) => _$GoogleVisionConfigFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/google_vision_config.freezed.dart b/packages/stream_chat/lib/open_api/model/google_vision_config.freezed.dart new file mode 100644 index 0000000000..79b1f6dfa6 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/google_vision_config.freezed.dart @@ -0,0 +1,75 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'google_vision_config.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$GoogleVisionConfig { + bool? get enabled; + + /// Create a copy of GoogleVisionConfig + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $GoogleVisionConfigCopyWith get copyWith => _$GoogleVisionConfigCopyWithImpl( + this as GoogleVisionConfig, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is GoogleVisionConfig && + (identical(other.enabled, enabled) || other.enabled == enabled)); + } + + @override + int get hashCode => Object.hash(runtimeType, enabled); + + @override + String toString() { + return 'GoogleVisionConfig(enabled: $enabled)'; + } +} + +/// @nodoc +abstract mixin class $GoogleVisionConfigCopyWith<$Res> { + factory $GoogleVisionConfigCopyWith( + GoogleVisionConfig value, + $Res Function(GoogleVisionConfig) _then, + ) = _$GoogleVisionConfigCopyWithImpl; + @useResult + $Res call({bool? enabled}); +} + +/// @nodoc +class _$GoogleVisionConfigCopyWithImpl<$Res> implements $GoogleVisionConfigCopyWith<$Res> { + _$GoogleVisionConfigCopyWithImpl(this._self, this._then); + + final GoogleVisionConfig _self; + final $Res Function(GoogleVisionConfig) _then; + + /// Create a copy of GoogleVisionConfig + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? enabled = freezed}) { + return _then( + GoogleVisionConfig( + enabled: freezed == enabled + ? _self.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/google_vision_config.g.dart b/packages/stream_chat/lib/open_api/model/google_vision_config.g.dart new file mode 100644 index 0000000000..431b429aa2 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/google_vision_config.g.dart @@ -0,0 +1,14 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'google_vision_config.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +GoogleVisionConfig _$GoogleVisionConfigFromJson(Map json) => + GoogleVisionConfig(enabled: json['enabled'] as bool?); + +Map _$GoogleVisionConfigToJson(GoogleVisionConfig instance) => { + 'enabled': instance.enabled, +}; diff --git a/packages/stream_chat/lib/open_api/model/grouped_channels_bucket.dart b/packages/stream_chat/lib/open_api/model/grouped_channels_bucket.dart new file mode 100644 index 0000000000..7c78dc1519 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/grouped_channels_bucket.dart @@ -0,0 +1,46 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'grouped_channels_bucket.g.dart'; +part 'grouped_channels_bucket.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class GroupedChannelsBucket with _$GroupedChannelsBucket { + const GroupedChannelsBucket({ + required this.channels, + this.next, + this.prev, + this.unreadChannels, + }); + + @override + @JsonKey(name: 'channels') + final List channels; + + @override + @JsonKey(name: 'next') + final String? next; + + @override + @JsonKey(name: 'prev') + final String? prev; + + @override + @JsonKey(name: 'unread_channels') + final int? unreadChannels; + + Map toJson() => _$GroupedChannelsBucketToJson(this); + + static GroupedChannelsBucket fromJson(Map json) => _$GroupedChannelsBucketFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/grouped_channels_bucket.freezed.dart b/packages/stream_chat/lib/open_api/model/grouped_channels_bucket.freezed.dart new file mode 100644 index 0000000000..0412ba7233 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/grouped_channels_bucket.freezed.dart @@ -0,0 +1,110 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'grouped_channels_bucket.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$GroupedChannelsBucket { + List get channels; + String? get next; + String? get prev; + int? get unreadChannels; + + /// Create a copy of GroupedChannelsBucket + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $GroupedChannelsBucketCopyWith get copyWith => + _$GroupedChannelsBucketCopyWithImpl( + this as GroupedChannelsBucket, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is GroupedChannelsBucket && + const DeepCollectionEquality().equals(other.channels, channels) && + (identical(other.next, next) || other.next == next) && + (identical(other.prev, prev) || other.prev == prev) && + (identical(other.unreadChannels, unreadChannels) || other.unreadChannels == unreadChannels)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(channels), + next, + prev, + unreadChannels, + ); + + @override + String toString() { + return 'GroupedChannelsBucket(channels: $channels, next: $next, prev: $prev, unreadChannels: $unreadChannels)'; + } +} + +/// @nodoc +abstract mixin class $GroupedChannelsBucketCopyWith<$Res> { + factory $GroupedChannelsBucketCopyWith( + GroupedChannelsBucket value, + $Res Function(GroupedChannelsBucket) _then, + ) = _$GroupedChannelsBucketCopyWithImpl; + @useResult + $Res call({ + List channels, + String? next, + String? prev, + int? unreadChannels, + }); +} + +/// @nodoc +class _$GroupedChannelsBucketCopyWithImpl<$Res> implements $GroupedChannelsBucketCopyWith<$Res> { + _$GroupedChannelsBucketCopyWithImpl(this._self, this._then); + + final GroupedChannelsBucket _self; + final $Res Function(GroupedChannelsBucket) _then; + + /// Create a copy of GroupedChannelsBucket + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channels = null, + Object? next = freezed, + Object? prev = freezed, + Object? unreadChannels = freezed, + }) { + return _then( + GroupedChannelsBucket( + channels: null == channels + ? _self.channels + : channels // ignore: cast_nullable_to_non_nullable + as List, + next: freezed == next + ? _self.next + : next // ignore: cast_nullable_to_non_nullable + as String?, + prev: freezed == prev + ? _self.prev + : prev // ignore: cast_nullable_to_non_nullable + as String?, + unreadChannels: freezed == unreadChannels + ? _self.unreadChannels + : unreadChannels // ignore: cast_nullable_to_non_nullable + as int?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/grouped_channels_bucket.g.dart b/packages/stream_chat/lib/open_api/model/grouped_channels_bucket.g.dart new file mode 100644 index 0000000000..01ea217062 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/grouped_channels_bucket.g.dart @@ -0,0 +1,29 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'grouped_channels_bucket.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +GroupedChannelsBucket _$GroupedChannelsBucketFromJson( + Map json, +) => GroupedChannelsBucket( + channels: (json['channels'] as List) + .map( + (e) => ChannelStateResponseFields.fromJson(e as Map), + ) + .toList(), + next: json['next'] as String?, + prev: json['prev'] as String?, + unreadChannels: (json['unread_channels'] as num?)?.toInt(), +); + +Map _$GroupedChannelsBucketToJson( + GroupedChannelsBucket instance, +) => { + 'channels': instance.channels.map((e) => e.toJson()).toList(), + 'next': instance.next, + 'prev': instance.prev, + 'unread_channels': instance.unreadChannels, +}; diff --git a/packages/stream_chat/lib/open_api/model/grouped_channels_group_request.dart b/packages/stream_chat/lib/open_api/model/grouped_channels_group_request.dart new file mode 100644 index 0000000000..b60d7faa9b --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/grouped_channels_group_request.dart @@ -0,0 +1,41 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'grouped_channels_group_request.g.dart'; +part 'grouped_channels_group_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class GroupedChannelsGroupRequest with _$GroupedChannelsGroupRequest { + const GroupedChannelsGroupRequest({ + this.limit, + this.next, + this.prev, + }); + + @override + @JsonKey(name: 'limit') + final int? limit; + + @override + @JsonKey(name: 'next') + final String? next; + + @override + @JsonKey(name: 'prev') + final String? prev; + + Map toJson() => _$GroupedChannelsGroupRequestToJson(this); + + static GroupedChannelsGroupRequest fromJson(Map json) => _$GroupedChannelsGroupRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/grouped_channels_group_request.freezed.dart b/packages/stream_chat/lib/open_api/model/grouped_channels_group_request.freezed.dart new file mode 100644 index 0000000000..1700e70c63 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/grouped_channels_group_request.freezed.dart @@ -0,0 +1,92 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'grouped_channels_group_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$GroupedChannelsGroupRequest { + int? get limit; + String? get next; + String? get prev; + + /// Create a copy of GroupedChannelsGroupRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $GroupedChannelsGroupRequestCopyWith get copyWith => + _$GroupedChannelsGroupRequestCopyWithImpl( + this as GroupedChannelsGroupRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is GroupedChannelsGroupRequest && + (identical(other.limit, limit) || other.limit == limit) && + (identical(other.next, next) || other.next == next) && + (identical(other.prev, prev) || other.prev == prev)); + } + + @override + int get hashCode => Object.hash(runtimeType, limit, next, prev); + + @override + String toString() { + return 'GroupedChannelsGroupRequest(limit: $limit, next: $next, prev: $prev)'; + } +} + +/// @nodoc +abstract mixin class $GroupedChannelsGroupRequestCopyWith<$Res> { + factory $GroupedChannelsGroupRequestCopyWith( + GroupedChannelsGroupRequest value, + $Res Function(GroupedChannelsGroupRequest) _then, + ) = _$GroupedChannelsGroupRequestCopyWithImpl; + @useResult + $Res call({int? limit, String? next, String? prev}); +} + +/// @nodoc +class _$GroupedChannelsGroupRequestCopyWithImpl<$Res> implements $GroupedChannelsGroupRequestCopyWith<$Res> { + _$GroupedChannelsGroupRequestCopyWithImpl(this._self, this._then); + + final GroupedChannelsGroupRequest _self; + final $Res Function(GroupedChannelsGroupRequest) _then; + + /// Create a copy of GroupedChannelsGroupRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? limit = freezed, + Object? next = freezed, + Object? prev = freezed, + }) { + return _then( + GroupedChannelsGroupRequest( + limit: freezed == limit + ? _self.limit + : limit // ignore: cast_nullable_to_non_nullable + as int?, + next: freezed == next + ? _self.next + : next // ignore: cast_nullable_to_non_nullable + as String?, + prev: freezed == prev + ? _self.prev + : prev // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/grouped_channels_group_request.g.dart b/packages/stream_chat/lib/open_api/model/grouped_channels_group_request.g.dart new file mode 100644 index 0000000000..7d4c1c44d4 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/grouped_channels_group_request.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'grouped_channels_group_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +GroupedChannelsGroupRequest _$GroupedChannelsGroupRequestFromJson( + Map json, +) => GroupedChannelsGroupRequest( + limit: (json['limit'] as num?)?.toInt(), + next: json['next'] as String?, + prev: json['prev'] as String?, +); + +Map _$GroupedChannelsGroupRequestToJson( + GroupedChannelsGroupRequest instance, +) => { + 'limit': instance.limit, + 'next': instance.next, + 'prev': instance.prev, +}; diff --git a/packages/stream_chat/lib/open_api/model/grouped_query_channels_request.dart b/packages/stream_chat/lib/open_api/model/grouped_query_channels_request.dart new file mode 100644 index 0000000000..d68ce2c02c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/grouped_query_channels_request.dart @@ -0,0 +1,46 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'grouped_query_channels_request.g.dart'; +part 'grouped_query_channels_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class GroupedQueryChannelsRequest with _$GroupedQueryChannelsRequest { + const GroupedQueryChannelsRequest({ + this.groups, + this.limit, + this.presence, + this.watch, + }); + + @override + @JsonKey(name: 'groups') + final Map? groups; + + @override + @JsonKey(name: 'limit') + final int? limit; + + @override + @JsonKey(name: 'presence') + final bool? presence; + + @override + @JsonKey(name: 'watch') + final bool? watch; + + Map toJson() => _$GroupedQueryChannelsRequestToJson(this); + + static GroupedQueryChannelsRequest fromJson(Map json) => _$GroupedQueryChannelsRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/grouped_query_channels_request.freezed.dart b/packages/stream_chat/lib/open_api/model/grouped_query_channels_request.freezed.dart new file mode 100644 index 0000000000..d37fa47cd7 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/grouped_query_channels_request.freezed.dart @@ -0,0 +1,110 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'grouped_query_channels_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$GroupedQueryChannelsRequest { + Map? get groups; + int? get limit; + bool? get presence; + bool? get watch; + + /// Create a copy of GroupedQueryChannelsRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $GroupedQueryChannelsRequestCopyWith get copyWith => + _$GroupedQueryChannelsRequestCopyWithImpl( + this as GroupedQueryChannelsRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is GroupedQueryChannelsRequest && + const DeepCollectionEquality().equals(other.groups, groups) && + (identical(other.limit, limit) || other.limit == limit) && + (identical(other.presence, presence) || other.presence == presence) && + (identical(other.watch, watch) || other.watch == watch)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(groups), + limit, + presence, + watch, + ); + + @override + String toString() { + return 'GroupedQueryChannelsRequest(groups: $groups, limit: $limit, presence: $presence, watch: $watch)'; + } +} + +/// @nodoc +abstract mixin class $GroupedQueryChannelsRequestCopyWith<$Res> { + factory $GroupedQueryChannelsRequestCopyWith( + GroupedQueryChannelsRequest value, + $Res Function(GroupedQueryChannelsRequest) _then, + ) = _$GroupedQueryChannelsRequestCopyWithImpl; + @useResult + $Res call({ + Map? groups, + int? limit, + bool? presence, + bool? watch, + }); +} + +/// @nodoc +class _$GroupedQueryChannelsRequestCopyWithImpl<$Res> implements $GroupedQueryChannelsRequestCopyWith<$Res> { + _$GroupedQueryChannelsRequestCopyWithImpl(this._self, this._then); + + final GroupedQueryChannelsRequest _self; + final $Res Function(GroupedQueryChannelsRequest) _then; + + /// Create a copy of GroupedQueryChannelsRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? groups = freezed, + Object? limit = freezed, + Object? presence = freezed, + Object? watch = freezed, + }) { + return _then( + GroupedQueryChannelsRequest( + groups: freezed == groups + ? _self.groups + : groups // ignore: cast_nullable_to_non_nullable + as Map?, + limit: freezed == limit + ? _self.limit + : limit // ignore: cast_nullable_to_non_nullable + as int?, + presence: freezed == presence + ? _self.presence + : presence // ignore: cast_nullable_to_non_nullable + as bool?, + watch: freezed == watch + ? _self.watch + : watch // ignore: cast_nullable_to_non_nullable + as bool?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/grouped_query_channels_request.g.dart b/packages/stream_chat/lib/open_api/model/grouped_query_channels_request.g.dart new file mode 100644 index 0000000000..55b235f7dc --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/grouped_query_channels_request.g.dart @@ -0,0 +1,30 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'grouped_query_channels_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +GroupedQueryChannelsRequest _$GroupedQueryChannelsRequestFromJson( + Map json, +) => GroupedQueryChannelsRequest( + groups: (json['groups'] as Map?)?.map( + (k, e) => MapEntry( + k, + GroupedChannelsGroupRequest.fromJson(e as Map), + ), + ), + limit: (json['limit'] as num?)?.toInt(), + presence: json['presence'] as bool?, + watch: json['watch'] as bool?, +); + +Map _$GroupedQueryChannelsRequestToJson( + GroupedQueryChannelsRequest instance, +) => { + 'groups': instance.groups?.map((k, e) => MapEntry(k, e.toJson())), + 'limit': instance.limit, + 'presence': instance.presence, + 'watch': instance.watch, +}; diff --git a/packages/stream_chat/lib/open_api/model/grouped_query_channels_response.dart b/packages/stream_chat/lib/open_api/model/grouped_query_channels_response.dart new file mode 100644 index 0000000000..1274b02beb --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/grouped_query_channels_response.dart @@ -0,0 +1,37 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'grouped_query_channels_response.g.dart'; +part 'grouped_query_channels_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class GroupedQueryChannelsResponse with _$GroupedQueryChannelsResponse { + const GroupedQueryChannelsResponse({ + required this.duration, + required this.groups, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'groups') + final Map groups; + + Map toJson() => _$GroupedQueryChannelsResponseToJson(this); + + static GroupedQueryChannelsResponse fromJson(Map json) => + _$GroupedQueryChannelsResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/grouped_query_channels_response.freezed.dart b/packages/stream_chat/lib/open_api/model/grouped_query_channels_response.freezed.dart new file mode 100644 index 0000000000..ebd9c9ee80 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/grouped_query_channels_response.freezed.dart @@ -0,0 +1,86 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'grouped_query_channels_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$GroupedQueryChannelsResponse { + String get duration; + Map get groups; + + /// Create a copy of GroupedQueryChannelsResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $GroupedQueryChannelsResponseCopyWith get copyWith => + _$GroupedQueryChannelsResponseCopyWithImpl( + this as GroupedQueryChannelsResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is GroupedQueryChannelsResponse && + (identical(other.duration, duration) || other.duration == duration) && + const DeepCollectionEquality().equals(other.groups, groups)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + duration, + const DeepCollectionEquality().hash(groups), + ); + + @override + String toString() { + return 'GroupedQueryChannelsResponse(duration: $duration, groups: $groups)'; + } +} + +/// @nodoc +abstract mixin class $GroupedQueryChannelsResponseCopyWith<$Res> { + factory $GroupedQueryChannelsResponseCopyWith( + GroupedQueryChannelsResponse value, + $Res Function(GroupedQueryChannelsResponse) _then, + ) = _$GroupedQueryChannelsResponseCopyWithImpl; + @useResult + $Res call({String duration, Map groups}); +} + +/// @nodoc +class _$GroupedQueryChannelsResponseCopyWithImpl<$Res> implements $GroupedQueryChannelsResponseCopyWith<$Res> { + _$GroupedQueryChannelsResponseCopyWithImpl(this._self, this._then); + + final GroupedQueryChannelsResponse _self; + final $Res Function(GroupedQueryChannelsResponse) _then; + + /// Create a copy of GroupedQueryChannelsResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? groups = null}) { + return _then( + GroupedQueryChannelsResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + groups: null == groups + ? _self.groups + : groups // ignore: cast_nullable_to_non_nullable + as Map, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/grouped_query_channels_response.g.dart b/packages/stream_chat/lib/open_api/model/grouped_query_channels_response.g.dart new file mode 100644 index 0000000000..e3f65ebf67 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/grouped_query_channels_response.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'grouped_query_channels_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +GroupedQueryChannelsResponse _$GroupedQueryChannelsResponseFromJson( + Map json, +) => GroupedQueryChannelsResponse( + duration: json['duration'] as String, + groups: (json['groups'] as Map).map( + (k, e) => MapEntry(k, GroupedChannelsBucket.fromJson(e as Map)), + ), +); + +Map _$GroupedQueryChannelsResponseToJson( + GroupedQueryChannelsResponse instance, +) => { + 'duration': instance.duration, + 'groups': instance.groups.map((k, e) => MapEntry(k, e.toJson())), +}; diff --git a/packages/stream_chat/lib/open_api/model/harm_config.dart b/packages/stream_chat/lib/open_api/model/harm_config.dart new file mode 100644 index 0000000000..16658229e8 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/harm_config.dart @@ -0,0 +1,51 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'harm_config.g.dart'; +part 'harm_config.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class HarmConfig with _$HarmConfig { + const HarmConfig({ + required this.actionSequences, + required this.cooldownPeriod, + required this.harmTypes, + required this.severity, + required this.threshold, + }); + + @override + @JsonKey(name: 'action_sequences') + final List actionSequences; + + @override + @JsonKey(name: 'cooldown_period') + final int cooldownPeriod; + + @override + @JsonKey(name: 'harm_types') + final List harmTypes; + + @override + @JsonKey(name: 'severity') + final int severity; + + @override + @JsonKey(name: 'threshold') + final int threshold; + + Map toJson() => _$HarmConfigToJson(this); + + static HarmConfig fromJson(Map json) => _$HarmConfigFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/harm_config.freezed.dart b/packages/stream_chat/lib/open_api/model/harm_config.freezed.dart new file mode 100644 index 0000000000..2fc4e78c0d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/harm_config.freezed.dart @@ -0,0 +1,118 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'harm_config.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$HarmConfig { + List get actionSequences; + int get cooldownPeriod; + List get harmTypes; + int get severity; + int get threshold; + + /// Create a copy of HarmConfig + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $HarmConfigCopyWith get copyWith => _$HarmConfigCopyWithImpl(this as HarmConfig, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is HarmConfig && + const DeepCollectionEquality().equals( + other.actionSequences, + actionSequences, + ) && + (identical(other.cooldownPeriod, cooldownPeriod) || other.cooldownPeriod == cooldownPeriod) && + const DeepCollectionEquality().equals(other.harmTypes, harmTypes) && + (identical(other.severity, severity) || other.severity == severity) && + (identical(other.threshold, threshold) || other.threshold == threshold)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(actionSequences), + cooldownPeriod, + const DeepCollectionEquality().hash(harmTypes), + severity, + threshold, + ); + + @override + String toString() { + return 'HarmConfig(actionSequences: $actionSequences, cooldownPeriod: $cooldownPeriod, harmTypes: $harmTypes, severity: $severity, threshold: $threshold)'; + } +} + +/// @nodoc +abstract mixin class $HarmConfigCopyWith<$Res> { + factory $HarmConfigCopyWith( + HarmConfig value, + $Res Function(HarmConfig) _then, + ) = _$HarmConfigCopyWithImpl; + @useResult + $Res call({ + List actionSequences, + int cooldownPeriod, + List harmTypes, + int severity, + int threshold, + }); +} + +/// @nodoc +class _$HarmConfigCopyWithImpl<$Res> implements $HarmConfigCopyWith<$Res> { + _$HarmConfigCopyWithImpl(this._self, this._then); + + final HarmConfig _self; + final $Res Function(HarmConfig) _then; + + /// Create a copy of HarmConfig + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? actionSequences = null, + Object? cooldownPeriod = null, + Object? harmTypes = null, + Object? severity = null, + Object? threshold = null, + }) { + return _then( + HarmConfig( + actionSequences: null == actionSequences + ? _self.actionSequences + : actionSequences // ignore: cast_nullable_to_non_nullable + as List, + cooldownPeriod: null == cooldownPeriod + ? _self.cooldownPeriod + : cooldownPeriod // ignore: cast_nullable_to_non_nullable + as int, + harmTypes: null == harmTypes + ? _self.harmTypes + : harmTypes // ignore: cast_nullable_to_non_nullable + as List, + severity: null == severity + ? _self.severity + : severity // ignore: cast_nullable_to_non_nullable + as int, + threshold: null == threshold + ? _self.threshold + : threshold // ignore: cast_nullable_to_non_nullable + as int, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/harm_config.g.dart b/packages/stream_chat/lib/open_api/model/harm_config.g.dart new file mode 100644 index 0000000000..1f1f4a6951 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/harm_config.g.dart @@ -0,0 +1,27 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'harm_config.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +HarmConfig _$HarmConfigFromJson(Map json) => HarmConfig( + actionSequences: (json['action_sequences'] as List) + .map((e) => ActionSequence.fromJson(e as Map)) + .toList(), + cooldownPeriod: (json['cooldown_period'] as num).toInt(), + harmTypes: (json['harm_types'] as List).map((e) => e as String).toList(), + severity: (json['severity'] as num).toInt(), + threshold: (json['threshold'] as num).toInt(), +); + +Map _$HarmConfigToJson( + HarmConfig instance, +) => { + 'action_sequences': instance.actionSequences.map((e) => e.toJson()).toList(), + 'cooldown_period': instance.cooldownPeriod, + 'harm_types': instance.harmTypes, + 'severity': instance.severity, + 'threshold': instance.threshold, +}; diff --git a/packages/stream_chat/lib/open_api/model/hide_channel_request.dart b/packages/stream_chat/lib/open_api/model/hide_channel_request.dart new file mode 100644 index 0000000000..3a6b484daf --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/hide_channel_request.dart @@ -0,0 +1,31 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'hide_channel_request.g.dart'; +part 'hide_channel_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class HideChannelRequest with _$HideChannelRequest { + const HideChannelRequest({ + this.clearHistory, + }); + + @override + @JsonKey(name: 'clear_history') + final bool? clearHistory; + + Map toJson() => _$HideChannelRequestToJson(this); + + static HideChannelRequest fromJson(Map json) => _$HideChannelRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/hide_channel_request.freezed.dart b/packages/stream_chat/lib/open_api/model/hide_channel_request.freezed.dart new file mode 100644 index 0000000000..47ffde2e30 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/hide_channel_request.freezed.dart @@ -0,0 +1,75 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'hide_channel_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$HideChannelRequest { + bool? get clearHistory; + + /// Create a copy of HideChannelRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $HideChannelRequestCopyWith get copyWith => _$HideChannelRequestCopyWithImpl( + this as HideChannelRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is HideChannelRequest && + (identical(other.clearHistory, clearHistory) || other.clearHistory == clearHistory)); + } + + @override + int get hashCode => Object.hash(runtimeType, clearHistory); + + @override + String toString() { + return 'HideChannelRequest(clearHistory: $clearHistory)'; + } +} + +/// @nodoc +abstract mixin class $HideChannelRequestCopyWith<$Res> { + factory $HideChannelRequestCopyWith( + HideChannelRequest value, + $Res Function(HideChannelRequest) _then, + ) = _$HideChannelRequestCopyWithImpl; + @useResult + $Res call({bool? clearHistory}); +} + +/// @nodoc +class _$HideChannelRequestCopyWithImpl<$Res> implements $HideChannelRequestCopyWith<$Res> { + _$HideChannelRequestCopyWithImpl(this._self, this._then); + + final HideChannelRequest _self; + final $Res Function(HideChannelRequest) _then; + + /// Create a copy of HideChannelRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? clearHistory = freezed}) { + return _then( + HideChannelRequest( + clearHistory: freezed == clearHistory + ? _self.clearHistory + : clearHistory // ignore: cast_nullable_to_non_nullable + as bool?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/hide_channel_request.g.dart b/packages/stream_chat/lib/open_api/model/hide_channel_request.g.dart new file mode 100644 index 0000000000..31dd428993 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/hide_channel_request.g.dart @@ -0,0 +1,14 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'hide_channel_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +HideChannelRequest _$HideChannelRequestFromJson(Map json) => + HideChannelRequest(clearHistory: json['clear_history'] as bool?); + +Map _$HideChannelRequestToJson(HideChannelRequest instance) => { + 'clear_history': instance.clearHistory, +}; diff --git a/packages/stream_chat/lib/open_api/model/hide_channel_response.dart b/packages/stream_chat/lib/open_api/model/hide_channel_response.dart new file mode 100644 index 0000000000..2b88680711 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/hide_channel_response.dart @@ -0,0 +1,31 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'hide_channel_response.g.dart'; +part 'hide_channel_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class HideChannelResponse with _$HideChannelResponse { + const HideChannelResponse({ + required this.duration, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + Map toJson() => _$HideChannelResponseToJson(this); + + static HideChannelResponse fromJson(Map json) => _$HideChannelResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/hide_channel_response.freezed.dart b/packages/stream_chat/lib/open_api/model/hide_channel_response.freezed.dart new file mode 100644 index 0000000000..e10b0ef0eb --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/hide_channel_response.freezed.dart @@ -0,0 +1,76 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'hide_channel_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$HideChannelResponse { + String get duration; + + /// Create a copy of HideChannelResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $HideChannelResponseCopyWith get copyWith => + _$HideChannelResponseCopyWithImpl( + this as HideChannelResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is HideChannelResponse && + (identical(other.duration, duration) || other.duration == duration)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration); + + @override + String toString() { + return 'HideChannelResponse(duration: $duration)'; + } +} + +/// @nodoc +abstract mixin class $HideChannelResponseCopyWith<$Res> { + factory $HideChannelResponseCopyWith( + HideChannelResponse value, + $Res Function(HideChannelResponse) _then, + ) = _$HideChannelResponseCopyWithImpl; + @useResult + $Res call({String duration}); +} + +/// @nodoc +class _$HideChannelResponseCopyWithImpl<$Res> implements $HideChannelResponseCopyWith<$Res> { + _$HideChannelResponseCopyWithImpl(this._self, this._then); + + final HideChannelResponse _self; + final $Res Function(HideChannelResponse) _then; + + /// Create a copy of HideChannelResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null}) { + return _then( + HideChannelResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/hide_channel_response.g.dart b/packages/stream_chat/lib/open_api/model/hide_channel_response.g.dart new file mode 100644 index 0000000000..1188614536 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/hide_channel_response.g.dart @@ -0,0 +1,14 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'hide_channel_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +HideChannelResponse _$HideChannelResponseFromJson(Map json) => + HideChannelResponse(duration: json['duration'] as String); + +Map _$HideChannelResponseToJson( + HideChannelResponse instance, +) => {'duration': instance.duration}; diff --git a/packages/stream_chat/lib/open_api/model/image_content_parameters.dart b/packages/stream_chat/lib/open_api/model/image_content_parameters.dart new file mode 100644 index 0000000000..7b49956ba8 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/image_content_parameters.dart @@ -0,0 +1,41 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'image_content_parameters.g.dart'; +part 'image_content_parameters.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ImageContentParameters with _$ImageContentParameters { + const ImageContentParameters({ + this.harmLabels, + this.labelOperator, + this.minConfidence, + }); + + @override + @JsonKey(name: 'harm_labels') + final List? harmLabels; + + @override + @JsonKey(name: 'label_operator') + final String? labelOperator; + + @override + @JsonKey(name: 'min_confidence') + final double? minConfidence; + + Map toJson() => _$ImageContentParametersToJson(this); + + static ImageContentParameters fromJson(Map json) => _$ImageContentParametersFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/image_content_parameters.freezed.dart b/packages/stream_chat/lib/open_api/model/image_content_parameters.freezed.dart new file mode 100644 index 0000000000..7ecfe533d7 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/image_content_parameters.freezed.dart @@ -0,0 +1,104 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'image_content_parameters.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ImageContentParameters { + List? get harmLabels; + String? get labelOperator; + double? get minConfidence; + + /// Create a copy of ImageContentParameters + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ImageContentParametersCopyWith get copyWith => + _$ImageContentParametersCopyWithImpl( + this as ImageContentParameters, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ImageContentParameters && + const DeepCollectionEquality().equals( + other.harmLabels, + harmLabels, + ) && + (identical(other.labelOperator, labelOperator) || other.labelOperator == labelOperator) && + (identical(other.minConfidence, minConfidence) || other.minConfidence == minConfidence)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(harmLabels), + labelOperator, + minConfidence, + ); + + @override + String toString() { + return 'ImageContentParameters(harmLabels: $harmLabels, labelOperator: $labelOperator, minConfidence: $minConfidence)'; + } +} + +/// @nodoc +abstract mixin class $ImageContentParametersCopyWith<$Res> { + factory $ImageContentParametersCopyWith( + ImageContentParameters value, + $Res Function(ImageContentParameters) _then, + ) = _$ImageContentParametersCopyWithImpl; + @useResult + $Res call({ + List? harmLabels, + String? labelOperator, + double? minConfidence, + }); +} + +/// @nodoc +class _$ImageContentParametersCopyWithImpl<$Res> implements $ImageContentParametersCopyWith<$Res> { + _$ImageContentParametersCopyWithImpl(this._self, this._then); + + final ImageContentParameters _self; + final $Res Function(ImageContentParameters) _then; + + /// Create a copy of ImageContentParameters + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? harmLabels = freezed, + Object? labelOperator = freezed, + Object? minConfidence = freezed, + }) { + return _then( + ImageContentParameters( + harmLabels: freezed == harmLabels + ? _self.harmLabels + : harmLabels // ignore: cast_nullable_to_non_nullable + as List?, + labelOperator: freezed == labelOperator + ? _self.labelOperator + : labelOperator // ignore: cast_nullable_to_non_nullable + as String?, + minConfidence: freezed == minConfidence + ? _self.minConfidence + : minConfidence // ignore: cast_nullable_to_non_nullable + as double?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/image_content_parameters.g.dart b/packages/stream_chat/lib/open_api/model/image_content_parameters.g.dart new file mode 100644 index 0000000000..dad900d79f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/image_content_parameters.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'image_content_parameters.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ImageContentParameters _$ImageContentParametersFromJson( + Map json, +) => ImageContentParameters( + harmLabels: (json['harm_labels'] as List?)?.map((e) => e as String).toList(), + labelOperator: json['label_operator'] as String?, + minConfidence: (json['min_confidence'] as num?)?.toDouble(), +); + +Map _$ImageContentParametersToJson( + ImageContentParameters instance, +) => { + 'harm_labels': instance.harmLabels, + 'label_operator': instance.labelOperator, + 'min_confidence': instance.minConfidence, +}; diff --git a/packages/stream_chat/lib/open_api/model/image_data.dart b/packages/stream_chat/lib/open_api/model/image_data.dart new file mode 100644 index 0000000000..1894b4d4b1 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/image_data.dart @@ -0,0 +1,51 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'image_data.g.dart'; +part 'image_data.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ImageData with _$ImageData { + const ImageData({ + required this.frames, + required this.height, + required this.size, + required this.url, + required this.width, + }); + + @override + @JsonKey(name: 'frames') + final String frames; + + @override + @JsonKey(name: 'height') + final String height; + + @override + @JsonKey(name: 'size') + final String size; + + @override + @JsonKey(name: 'url') + final String url; + + @override + @JsonKey(name: 'width') + final String width; + + Map toJson() => _$ImageDataToJson(this); + + static ImageData fromJson(Map json) => _$ImageDataFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/image_data.freezed.dart b/packages/stream_chat/lib/open_api/model/image_data.freezed.dart new file mode 100644 index 0000000000..5e7ce4d7ef --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/image_data.freezed.dart @@ -0,0 +1,105 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'image_data.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ImageData { + String get frames; + String get height; + String get size; + String get url; + String get width; + + /// Create a copy of ImageData + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ImageDataCopyWith get copyWith => _$ImageDataCopyWithImpl(this as ImageData, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ImageData && + (identical(other.frames, frames) || other.frames == frames) && + (identical(other.height, height) || other.height == height) && + (identical(other.size, size) || other.size == size) && + (identical(other.url, url) || other.url == url) && + (identical(other.width, width) || other.width == width)); + } + + @override + int get hashCode => Object.hash(runtimeType, frames, height, size, url, width); + + @override + String toString() { + return 'ImageData(frames: $frames, height: $height, size: $size, url: $url, width: $width)'; + } +} + +/// @nodoc +abstract mixin class $ImageDataCopyWith<$Res> { + factory $ImageDataCopyWith(ImageData value, $Res Function(ImageData) _then) = _$ImageDataCopyWithImpl; + @useResult + $Res call({ + String frames, + String height, + String size, + String url, + String width, + }); +} + +/// @nodoc +class _$ImageDataCopyWithImpl<$Res> implements $ImageDataCopyWith<$Res> { + _$ImageDataCopyWithImpl(this._self, this._then); + + final ImageData _self; + final $Res Function(ImageData) _then; + + /// Create a copy of ImageData + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? frames = null, + Object? height = null, + Object? size = null, + Object? url = null, + Object? width = null, + }) { + return _then( + ImageData( + frames: null == frames + ? _self.frames + : frames // ignore: cast_nullable_to_non_nullable + as String, + height: null == height + ? _self.height + : height // ignore: cast_nullable_to_non_nullable + as String, + size: null == size + ? _self.size + : size // ignore: cast_nullable_to_non_nullable + as String, + url: null == url + ? _self.url + : url // ignore: cast_nullable_to_non_nullable + as String, + width: null == width + ? _self.width + : width // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/image_data.g.dart b/packages/stream_chat/lib/open_api/model/image_data.g.dart new file mode 100644 index 0000000000..37b8d605fb --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/image_data.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'image_data.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ImageData _$ImageDataFromJson(Map json) => ImageData( + frames: json['frames'] as String, + height: json['height'] as String, + size: json['size'] as String, + url: json['url'] as String, + width: json['width'] as String, +); + +Map _$ImageDataToJson(ImageData instance) => { + 'frames': instance.frames, + 'height': instance.height, + 'size': instance.size, + 'url': instance.url, + 'width': instance.width, +}; diff --git a/packages/stream_chat/lib/open_api/model/image_rule_parameters.dart b/packages/stream_chat/lib/open_api/model/image_rule_parameters.dart new file mode 100644 index 0000000000..260e3be95b --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/image_rule_parameters.dart @@ -0,0 +1,46 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'image_rule_parameters.g.dart'; +part 'image_rule_parameters.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ImageRuleParameters with _$ImageRuleParameters { + const ImageRuleParameters({ + this.harmLabels, + this.minConfidence, + this.threshold, + this.timeWindow, + }); + + @override + @JsonKey(name: 'harm_labels') + final List? harmLabels; + + @override + @JsonKey(name: 'min_confidence') + final double? minConfidence; + + @override + @JsonKey(name: 'threshold') + final int? threshold; + + @override + @JsonKey(name: 'time_window') + final String? timeWindow; + + Map toJson() => _$ImageRuleParametersToJson(this); + + static ImageRuleParameters fromJson(Map json) => _$ImageRuleParametersFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/image_rule_parameters.freezed.dart b/packages/stream_chat/lib/open_api/model/image_rule_parameters.freezed.dart new file mode 100644 index 0000000000..d07201d5b8 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/image_rule_parameters.freezed.dart @@ -0,0 +1,113 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'image_rule_parameters.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ImageRuleParameters { + List? get harmLabels; + double? get minConfidence; + int? get threshold; + String? get timeWindow; + + /// Create a copy of ImageRuleParameters + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ImageRuleParametersCopyWith get copyWith => + _$ImageRuleParametersCopyWithImpl( + this as ImageRuleParameters, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ImageRuleParameters && + const DeepCollectionEquality().equals( + other.harmLabels, + harmLabels, + ) && + (identical(other.minConfidence, minConfidence) || other.minConfidence == minConfidence) && + (identical(other.threshold, threshold) || other.threshold == threshold) && + (identical(other.timeWindow, timeWindow) || other.timeWindow == timeWindow)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(harmLabels), + minConfidence, + threshold, + timeWindow, + ); + + @override + String toString() { + return 'ImageRuleParameters(harmLabels: $harmLabels, minConfidence: $minConfidence, threshold: $threshold, timeWindow: $timeWindow)'; + } +} + +/// @nodoc +abstract mixin class $ImageRuleParametersCopyWith<$Res> { + factory $ImageRuleParametersCopyWith( + ImageRuleParameters value, + $Res Function(ImageRuleParameters) _then, + ) = _$ImageRuleParametersCopyWithImpl; + @useResult + $Res call({ + List? harmLabels, + double? minConfidence, + int? threshold, + String? timeWindow, + }); +} + +/// @nodoc +class _$ImageRuleParametersCopyWithImpl<$Res> implements $ImageRuleParametersCopyWith<$Res> { + _$ImageRuleParametersCopyWithImpl(this._self, this._then); + + final ImageRuleParameters _self; + final $Res Function(ImageRuleParameters) _then; + + /// Create a copy of ImageRuleParameters + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? harmLabels = freezed, + Object? minConfidence = freezed, + Object? threshold = freezed, + Object? timeWindow = freezed, + }) { + return _then( + ImageRuleParameters( + harmLabels: freezed == harmLabels + ? _self.harmLabels + : harmLabels // ignore: cast_nullable_to_non_nullable + as List?, + minConfidence: freezed == minConfidence + ? _self.minConfidence + : minConfidence // ignore: cast_nullable_to_non_nullable + as double?, + threshold: freezed == threshold + ? _self.threshold + : threshold // ignore: cast_nullable_to_non_nullable + as int?, + timeWindow: freezed == timeWindow + ? _self.timeWindow + : timeWindow // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/image_rule_parameters.g.dart b/packages/stream_chat/lib/open_api/model/image_rule_parameters.g.dart new file mode 100644 index 0000000000..2450f257ee --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/image_rule_parameters.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'image_rule_parameters.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ImageRuleParameters _$ImageRuleParametersFromJson(Map json) => ImageRuleParameters( + harmLabels: (json['harm_labels'] as List?)?.map((e) => e as String).toList(), + minConfidence: (json['min_confidence'] as num?)?.toDouble(), + threshold: (json['threshold'] as num?)?.toInt(), + timeWindow: json['time_window'] as String?, +); + +Map _$ImageRuleParametersToJson( + ImageRuleParameters instance, +) => { + 'harm_labels': instance.harmLabels, + 'min_confidence': instance.minConfidence, + 'threshold': instance.threshold, + 'time_window': instance.timeWindow, +}; diff --git a/packages/stream_chat/lib/open_api/model/image_size.dart b/packages/stream_chat/lib/open_api/model/image_size.dart new file mode 100644 index 0000000000..61355c41f1 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/image_size.dart @@ -0,0 +1,46 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'image_size.g.dart'; +part 'image_size.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ImageSize with _$ImageSize { + const ImageSize({ + this.crop, + this.height, + this.resize, + this.width, + }); + + @override + @JsonKey(name: 'crop') + final String? crop; + + @override + @JsonKey(name: 'height') + final int? height; + + @override + @JsonKey(name: 'resize') + final String? resize; + + @override + @JsonKey(name: 'width') + final int? width; + + Map toJson() => _$ImageSizeToJson(this); + + static ImageSize fromJson(Map json) => _$ImageSizeFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/image_size.freezed.dart b/packages/stream_chat/lib/open_api/model/image_size.freezed.dart new file mode 100644 index 0000000000..44976593ef --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/image_size.freezed.dart @@ -0,0 +1,92 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'image_size.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ImageSize { + String? get crop; + int? get height; + String? get resize; + int? get width; + + /// Create a copy of ImageSize + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ImageSizeCopyWith get copyWith => _$ImageSizeCopyWithImpl(this as ImageSize, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ImageSize && + (identical(other.crop, crop) || other.crop == crop) && + (identical(other.height, height) || other.height == height) && + (identical(other.resize, resize) || other.resize == resize) && + (identical(other.width, width) || other.width == width)); + } + + @override + int get hashCode => Object.hash(runtimeType, crop, height, resize, width); + + @override + String toString() { + return 'ImageSize(crop: $crop, height: $height, resize: $resize, width: $width)'; + } +} + +/// @nodoc +abstract mixin class $ImageSizeCopyWith<$Res> { + factory $ImageSizeCopyWith(ImageSize value, $Res Function(ImageSize) _then) = _$ImageSizeCopyWithImpl; + @useResult + $Res call({String? crop, int? height, String? resize, int? width}); +} + +/// @nodoc +class _$ImageSizeCopyWithImpl<$Res> implements $ImageSizeCopyWith<$Res> { + _$ImageSizeCopyWithImpl(this._self, this._then); + + final ImageSize _self; + final $Res Function(ImageSize) _then; + + /// Create a copy of ImageSize + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? crop = freezed, + Object? height = freezed, + Object? resize = freezed, + Object? width = freezed, + }) { + return _then( + ImageSize( + crop: freezed == crop + ? _self.crop + : crop // ignore: cast_nullable_to_non_nullable + as String?, + height: freezed == height + ? _self.height + : height // ignore: cast_nullable_to_non_nullable + as int?, + resize: freezed == resize + ? _self.resize + : resize // ignore: cast_nullable_to_non_nullable + as String?, + width: freezed == width + ? _self.width + : width // ignore: cast_nullable_to_non_nullable + as int?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/image_size.g.dart b/packages/stream_chat/lib/open_api/model/image_size.g.dart new file mode 100644 index 0000000000..ee5ab5684d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/image_size.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'image_size.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ImageSize _$ImageSizeFromJson(Map json) => ImageSize( + crop: json['crop'] as String?, + height: (json['height'] as num?)?.toInt(), + resize: json['resize'] as String?, + width: (json['width'] as num?)?.toInt(), +); + +Map _$ImageSizeToJson(ImageSize instance) => { + 'crop': instance.crop, + 'height': instance.height, + 'resize': instance.resize, + 'width': instance.width, +}; diff --git a/packages/stream_chat/lib/open_api/model/image_upload_request.dart b/packages/stream_chat/lib/open_api/model/image_upload_request.dart new file mode 100644 index 0000000000..ac33ec6d26 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/image_upload_request.dart @@ -0,0 +1,41 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'image_upload_request.g.dart'; +part 'image_upload_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ImageUploadRequest with _$ImageUploadRequest { + const ImageUploadRequest({ + this.file, + this.uploadSizes, + this.user, + }); + + @override + @JsonKey(name: 'file') + final String? file; + + @override + @JsonKey(name: 'upload_sizes') + final List? uploadSizes; + + @override + @JsonKey(name: 'user') + final OnlyUserID? user; + + Map toJson() => _$ImageUploadRequestToJson(this); + + static ImageUploadRequest fromJson(Map json) => _$ImageUploadRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/image_upload_request.freezed.dart b/packages/stream_chat/lib/open_api/model/image_upload_request.freezed.dart new file mode 100644 index 0000000000..6a61134dc0 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/image_upload_request.freezed.dart @@ -0,0 +1,99 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'image_upload_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ImageUploadRequest { + String? get file; + List? get uploadSizes; + OnlyUserID? get user; + + /// Create a copy of ImageUploadRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ImageUploadRequestCopyWith get copyWith => _$ImageUploadRequestCopyWithImpl( + this as ImageUploadRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ImageUploadRequest && + (identical(other.file, file) || other.file == file) && + const DeepCollectionEquality().equals( + other.uploadSizes, + uploadSizes, + ) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + file, + const DeepCollectionEquality().hash(uploadSizes), + user, + ); + + @override + String toString() { + return 'ImageUploadRequest(file: $file, uploadSizes: $uploadSizes, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $ImageUploadRequestCopyWith<$Res> { + factory $ImageUploadRequestCopyWith( + ImageUploadRequest value, + $Res Function(ImageUploadRequest) _then, + ) = _$ImageUploadRequestCopyWithImpl; + @useResult + $Res call({String? file, List? uploadSizes, OnlyUserID? user}); +} + +/// @nodoc +class _$ImageUploadRequestCopyWithImpl<$Res> implements $ImageUploadRequestCopyWith<$Res> { + _$ImageUploadRequestCopyWithImpl(this._self, this._then); + + final ImageUploadRequest _self; + final $Res Function(ImageUploadRequest) _then; + + /// Create a copy of ImageUploadRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? file = freezed, + Object? uploadSizes = freezed, + Object? user = freezed, + }) { + return _then( + ImageUploadRequest( + file: freezed == file + ? _self.file + : file // ignore: cast_nullable_to_non_nullable + as String?, + uploadSizes: freezed == uploadSizes + ? _self.uploadSizes + : uploadSizes // ignore: cast_nullable_to_non_nullable + as List?, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as OnlyUserID?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/image_upload_request.g.dart b/packages/stream_chat/lib/open_api/model/image_upload_request.g.dart new file mode 100644 index 0000000000..52447fcbdc --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/image_upload_request.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'image_upload_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ImageUploadRequest _$ImageUploadRequestFromJson(Map json) => ImageUploadRequest( + file: json['file'] as String?, + uploadSizes: (json['upload_sizes'] as List?) + ?.map((e) => ImageSize.fromJson(e as Map)) + .toList(), + user: json['user'] == null ? null : OnlyUserID.fromJson(json['user'] as Map), +); + +Map _$ImageUploadRequestToJson(ImageUploadRequest instance) => { + 'file': instance.file, + 'upload_sizes': instance.uploadSizes?.map((e) => e.toJson()).toList(), + 'user': instance.user?.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/image_upload_response.dart b/packages/stream_chat/lib/open_api/model/image_upload_response.dart new file mode 100644 index 0000000000..c2c5e736f3 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/image_upload_response.dart @@ -0,0 +1,46 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'image_upload_response.g.dart'; +part 'image_upload_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ImageUploadResponse with _$ImageUploadResponse { + const ImageUploadResponse({ + required this.duration, + this.file, + this.thumbUrl, + this.uploadSizes, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'file') + final String? file; + + @override + @JsonKey(name: 'thumb_url') + final String? thumbUrl; + + @override + @JsonKey(name: 'upload_sizes') + final List? uploadSizes; + + Map toJson() => _$ImageUploadResponseToJson(this); + + static ImageUploadResponse fromJson(Map json) => _$ImageUploadResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/image_upload_response.freezed.dart b/packages/stream_chat/lib/open_api/model/image_upload_response.freezed.dart new file mode 100644 index 0000000000..7f9d1f85ac --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/image_upload_response.freezed.dart @@ -0,0 +1,113 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'image_upload_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ImageUploadResponse { + String get duration; + String? get file; + String? get thumbUrl; + List? get uploadSizes; + + /// Create a copy of ImageUploadResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ImageUploadResponseCopyWith get copyWith => + _$ImageUploadResponseCopyWithImpl( + this as ImageUploadResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ImageUploadResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.file, file) || other.file == file) && + (identical(other.thumbUrl, thumbUrl) || other.thumbUrl == thumbUrl) && + const DeepCollectionEquality().equals( + other.uploadSizes, + uploadSizes, + )); + } + + @override + int get hashCode => Object.hash( + runtimeType, + duration, + file, + thumbUrl, + const DeepCollectionEquality().hash(uploadSizes), + ); + + @override + String toString() { + return 'ImageUploadResponse(duration: $duration, file: $file, thumbUrl: $thumbUrl, uploadSizes: $uploadSizes)'; + } +} + +/// @nodoc +abstract mixin class $ImageUploadResponseCopyWith<$Res> { + factory $ImageUploadResponseCopyWith( + ImageUploadResponse value, + $Res Function(ImageUploadResponse) _then, + ) = _$ImageUploadResponseCopyWithImpl; + @useResult + $Res call({ + String duration, + String? file, + String? thumbUrl, + List? uploadSizes, + }); +} + +/// @nodoc +class _$ImageUploadResponseCopyWithImpl<$Res> implements $ImageUploadResponseCopyWith<$Res> { + _$ImageUploadResponseCopyWithImpl(this._self, this._then); + + final ImageUploadResponse _self; + final $Res Function(ImageUploadResponse) _then; + + /// Create a copy of ImageUploadResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? duration = null, + Object? file = freezed, + Object? thumbUrl = freezed, + Object? uploadSizes = freezed, + }) { + return _then( + ImageUploadResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + file: freezed == file + ? _self.file + : file // ignore: cast_nullable_to_non_nullable + as String?, + thumbUrl: freezed == thumbUrl + ? _self.thumbUrl + : thumbUrl // ignore: cast_nullable_to_non_nullable + as String?, + uploadSizes: freezed == uploadSizes + ? _self.uploadSizes + : uploadSizes // ignore: cast_nullable_to_non_nullable + as List?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/image_upload_response.g.dart b/packages/stream_chat/lib/open_api/model/image_upload_response.g.dart new file mode 100644 index 0000000000..2902016ce6 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/image_upload_response.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'image_upload_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ImageUploadResponse _$ImageUploadResponseFromJson(Map json) => ImageUploadResponse( + duration: json['duration'] as String, + file: json['file'] as String?, + thumbUrl: json['thumb_url'] as String?, + uploadSizes: (json['upload_sizes'] as List?) + ?.map((e) => ImageSize.fromJson(e as Map)) + .toList(), +); + +Map _$ImageUploadResponseToJson( + ImageUploadResponse instance, +) => { + 'duration': instance.duration, + 'file': instance.file, + 'thumb_url': instance.thumbUrl, + 'upload_sizes': instance.uploadSizes?.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/images.dart b/packages/stream_chat/lib/open_api/model/images.dart new file mode 100644 index 0000000000..11cc77fe0e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/images.dart @@ -0,0 +1,61 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'images.g.dart'; +part 'images.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class Images with _$Images { + const Images({ + required this.fixedHeight, + required this.fixedHeightDownsampled, + required this.fixedHeightStill, + required this.fixedWidth, + required this.fixedWidthDownsampled, + required this.fixedWidthStill, + required this.original, + }); + + @override + @JsonKey(name: 'fixed_height') + final ImageData fixedHeight; + + @override + @JsonKey(name: 'fixed_height_downsampled') + final ImageData fixedHeightDownsampled; + + @override + @JsonKey(name: 'fixed_height_still') + final ImageData fixedHeightStill; + + @override + @JsonKey(name: 'fixed_width') + final ImageData fixedWidth; + + @override + @JsonKey(name: 'fixed_width_downsampled') + final ImageData fixedWidthDownsampled; + + @override + @JsonKey(name: 'fixed_width_still') + final ImageData fixedWidthStill; + + @override + @JsonKey(name: 'original') + final ImageData original; + + Map toJson() => _$ImagesToJson(this); + + static Images fromJson(Map json) => _$ImagesFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/images.freezed.dart b/packages/stream_chat/lib/open_api/model/images.freezed.dart new file mode 100644 index 0000000000..399dadf7b3 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/images.freezed.dart @@ -0,0 +1,132 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'images.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$Images { + ImageData get fixedHeight; + ImageData get fixedHeightDownsampled; + ImageData get fixedHeightStill; + ImageData get fixedWidth; + ImageData get fixedWidthDownsampled; + ImageData get fixedWidthStill; + ImageData get original; + + /// Create a copy of Images + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ImagesCopyWith get copyWith => _$ImagesCopyWithImpl(this as Images, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is Images && + (identical(other.fixedHeight, fixedHeight) || other.fixedHeight == fixedHeight) && + (identical(other.fixedHeightDownsampled, fixedHeightDownsampled) || + other.fixedHeightDownsampled == fixedHeightDownsampled) && + (identical(other.fixedHeightStill, fixedHeightStill) || other.fixedHeightStill == fixedHeightStill) && + (identical(other.fixedWidth, fixedWidth) || other.fixedWidth == fixedWidth) && + (identical(other.fixedWidthDownsampled, fixedWidthDownsampled) || + other.fixedWidthDownsampled == fixedWidthDownsampled) && + (identical(other.fixedWidthStill, fixedWidthStill) || other.fixedWidthStill == fixedWidthStill) && + (identical(other.original, original) || other.original == original)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + fixedHeight, + fixedHeightDownsampled, + fixedHeightStill, + fixedWidth, + fixedWidthDownsampled, + fixedWidthStill, + original, + ); + + @override + String toString() { + return 'Images(fixedHeight: $fixedHeight, fixedHeightDownsampled: $fixedHeightDownsampled, fixedHeightStill: $fixedHeightStill, fixedWidth: $fixedWidth, fixedWidthDownsampled: $fixedWidthDownsampled, fixedWidthStill: $fixedWidthStill, original: $original)'; + } +} + +/// @nodoc +abstract mixin class $ImagesCopyWith<$Res> { + factory $ImagesCopyWith(Images value, $Res Function(Images) _then) = _$ImagesCopyWithImpl; + @useResult + $Res call({ + ImageData fixedHeight, + ImageData fixedHeightDownsampled, + ImageData fixedHeightStill, + ImageData fixedWidth, + ImageData fixedWidthDownsampled, + ImageData fixedWidthStill, + ImageData original, + }); +} + +/// @nodoc +class _$ImagesCopyWithImpl<$Res> implements $ImagesCopyWith<$Res> { + _$ImagesCopyWithImpl(this._self, this._then); + + final Images _self; + final $Res Function(Images) _then; + + /// Create a copy of Images + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? fixedHeight = null, + Object? fixedHeightDownsampled = null, + Object? fixedHeightStill = null, + Object? fixedWidth = null, + Object? fixedWidthDownsampled = null, + Object? fixedWidthStill = null, + Object? original = null, + }) { + return _then( + Images( + fixedHeight: null == fixedHeight + ? _self.fixedHeight + : fixedHeight // ignore: cast_nullable_to_non_nullable + as ImageData, + fixedHeightDownsampled: null == fixedHeightDownsampled + ? _self.fixedHeightDownsampled + : fixedHeightDownsampled // ignore: cast_nullable_to_non_nullable + as ImageData, + fixedHeightStill: null == fixedHeightStill + ? _self.fixedHeightStill + : fixedHeightStill // ignore: cast_nullable_to_non_nullable + as ImageData, + fixedWidth: null == fixedWidth + ? _self.fixedWidth + : fixedWidth // ignore: cast_nullable_to_non_nullable + as ImageData, + fixedWidthDownsampled: null == fixedWidthDownsampled + ? _self.fixedWidthDownsampled + : fixedWidthDownsampled // ignore: cast_nullable_to_non_nullable + as ImageData, + fixedWidthStill: null == fixedWidthStill + ? _self.fixedWidthStill + : fixedWidthStill // ignore: cast_nullable_to_non_nullable + as ImageData, + original: null == original + ? _self.original + : original // ignore: cast_nullable_to_non_nullable + as ImageData, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/images.g.dart b/packages/stream_chat/lib/open_api/model/images.g.dart new file mode 100644 index 0000000000..b6cb60eee6 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/images.g.dart @@ -0,0 +1,35 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'images.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +Images _$ImagesFromJson(Map json) => Images( + fixedHeight: ImageData.fromJson(json['fixed_height'] as Map), + fixedHeightDownsampled: ImageData.fromJson( + json['fixed_height_downsampled'] as Map, + ), + fixedHeightStill: ImageData.fromJson( + json['fixed_height_still'] as Map, + ), + fixedWidth: ImageData.fromJson(json['fixed_width'] as Map), + fixedWidthDownsampled: ImageData.fromJson( + json['fixed_width_downsampled'] as Map, + ), + fixedWidthStill: ImageData.fromJson( + json['fixed_width_still'] as Map, + ), + original: ImageData.fromJson(json['original'] as Map), +); + +Map _$ImagesToJson(Images instance) => { + 'fixed_height': instance.fixedHeight.toJson(), + 'fixed_height_downsampled': instance.fixedHeightDownsampled.toJson(), + 'fixed_height_still': instance.fixedHeightStill.toJson(), + 'fixed_width': instance.fixedWidth.toJson(), + 'fixed_width_downsampled': instance.fixedWidthDownsampled.toJson(), + 'fixed_width_still': instance.fixedWidthStill.toJson(), + 'original': instance.original.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/import_block_list_request.dart b/packages/stream_chat/lib/open_api/model/import_block_list_request.dart new file mode 100644 index 0000000000..faaf2e1e7a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/import_block_list_request.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'import_block_list_request.g.dart'; +part 'import_block_list_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ImportBlockListRequest with _$ImportBlockListRequest { + const ImportBlockListRequest({ + this.chunkSize, + required this.items, + }); + + @override + @JsonKey(name: 'chunk_size') + final int? chunkSize; + + @override + @JsonKey(name: 'items') + final List items; + + Map toJson() => _$ImportBlockListRequestToJson(this); + + static ImportBlockListRequest fromJson(Map json) => _$ImportBlockListRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/import_block_list_request.freezed.dart b/packages/stream_chat/lib/open_api/model/import_block_list_request.freezed.dart new file mode 100644 index 0000000000..469b1e5f7f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/import_block_list_request.freezed.dart @@ -0,0 +1,86 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'import_block_list_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ImportBlockListRequest { + int? get chunkSize; + List get items; + + /// Create a copy of ImportBlockListRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ImportBlockListRequestCopyWith get copyWith => + _$ImportBlockListRequestCopyWithImpl( + this as ImportBlockListRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ImportBlockListRequest && + (identical(other.chunkSize, chunkSize) || other.chunkSize == chunkSize) && + const DeepCollectionEquality().equals(other.items, items)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + chunkSize, + const DeepCollectionEquality().hash(items), + ); + + @override + String toString() { + return 'ImportBlockListRequest(chunkSize: $chunkSize, items: $items)'; + } +} + +/// @nodoc +abstract mixin class $ImportBlockListRequestCopyWith<$Res> { + factory $ImportBlockListRequestCopyWith( + ImportBlockListRequest value, + $Res Function(ImportBlockListRequest) _then, + ) = _$ImportBlockListRequestCopyWithImpl; + @useResult + $Res call({int? chunkSize, List items}); +} + +/// @nodoc +class _$ImportBlockListRequestCopyWithImpl<$Res> implements $ImportBlockListRequestCopyWith<$Res> { + _$ImportBlockListRequestCopyWithImpl(this._self, this._then); + + final ImportBlockListRequest _self; + final $Res Function(ImportBlockListRequest) _then; + + /// Create a copy of ImportBlockListRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? chunkSize = freezed, Object? items = null}) { + return _then( + ImportBlockListRequest( + chunkSize: freezed == chunkSize + ? _self.chunkSize + : chunkSize // ignore: cast_nullable_to_non_nullable + as int?, + items: null == items + ? _self.items + : items // ignore: cast_nullable_to_non_nullable + as List, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/import_block_list_request.g.dart b/packages/stream_chat/lib/open_api/model/import_block_list_request.g.dart new file mode 100644 index 0000000000..a7507cd1bc --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/import_block_list_request.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'import_block_list_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ImportBlockListRequest _$ImportBlockListRequestFromJson( + Map json, +) => ImportBlockListRequest( + chunkSize: (json['chunk_size'] as num?)?.toInt(), + items: (json['items'] as List).map((e) => e as String).toList(), +); + +Map _$ImportBlockListRequestToJson( + ImportBlockListRequest instance, +) => { + 'chunk_size': instance.chunkSize, + 'items': instance.items, +}; diff --git a/packages/stream_chat/lib/open_api/model/import_block_list_response.dart b/packages/stream_chat/lib/open_api/model/import_block_list_response.dart new file mode 100644 index 0000000000..27daaf76e2 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/import_block_list_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'import_block_list_response.g.dart'; +part 'import_block_list_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ImportBlockListResponse with _$ImportBlockListResponse { + const ImportBlockListResponse({ + required this.duration, + required this.taskId, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'task_id') + final String taskId; + + Map toJson() => _$ImportBlockListResponseToJson(this); + + static ImportBlockListResponse fromJson(Map json) => _$ImportBlockListResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/import_block_list_response.freezed.dart b/packages/stream_chat/lib/open_api/model/import_block_list_response.freezed.dart new file mode 100644 index 0000000000..2bd9b9d9a2 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/import_block_list_response.freezed.dart @@ -0,0 +1,82 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'import_block_list_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ImportBlockListResponse { + String get duration; + String get taskId; + + /// Create a copy of ImportBlockListResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ImportBlockListResponseCopyWith get copyWith => + _$ImportBlockListResponseCopyWithImpl( + this as ImportBlockListResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ImportBlockListResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.taskId, taskId) || other.taskId == taskId)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration, taskId); + + @override + String toString() { + return 'ImportBlockListResponse(duration: $duration, taskId: $taskId)'; + } +} + +/// @nodoc +abstract mixin class $ImportBlockListResponseCopyWith<$Res> { + factory $ImportBlockListResponseCopyWith( + ImportBlockListResponse value, + $Res Function(ImportBlockListResponse) _then, + ) = _$ImportBlockListResponseCopyWithImpl; + @useResult + $Res call({String duration, String taskId}); +} + +/// @nodoc +class _$ImportBlockListResponseCopyWithImpl<$Res> implements $ImportBlockListResponseCopyWith<$Res> { + _$ImportBlockListResponseCopyWithImpl(this._self, this._then); + + final ImportBlockListResponse _self; + final $Res Function(ImportBlockListResponse) _then; + + /// Create a copy of ImportBlockListResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? taskId = null}) { + return _then( + ImportBlockListResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + taskId: null == taskId + ? _self.taskId + : taskId // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/import_block_list_response.g.dart b/packages/stream_chat/lib/open_api/model/import_block_list_response.g.dart new file mode 100644 index 0000000000..a501cb3ad3 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/import_block_list_response.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'import_block_list_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ImportBlockListResponse _$ImportBlockListResponseFromJson( + Map json, +) => ImportBlockListResponse( + duration: json['duration'] as String, + taskId: json['task_id'] as String, +); + +Map _$ImportBlockListResponseToJson( + ImportBlockListResponse instance, +) => { + 'duration': instance.duration, + 'task_id': instance.taskId, +}; diff --git a/packages/stream_chat/lib/open_api/model/ip_content_count_rule_parameters.dart b/packages/stream_chat/lib/open_api/model/ip_content_count_rule_parameters.dart new file mode 100644 index 0000000000..b44e932de7 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ip_content_count_rule_parameters.dart @@ -0,0 +1,37 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'ip_content_count_rule_parameters.g.dart'; +part 'ip_content_count_rule_parameters.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class IPContentCountRuleParameters with _$IPContentCountRuleParameters { + const IPContentCountRuleParameters({ + this.threshold, + this.timeWindow, + }); + + @override + @JsonKey(name: 'threshold') + final int? threshold; + + @override + @JsonKey(name: 'time_window') + final String? timeWindow; + + Map toJson() => _$IPContentCountRuleParametersToJson(this); + + static IPContentCountRuleParameters fromJson(Map json) => + _$IPContentCountRuleParametersFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/ip_content_count_rule_parameters.freezed.dart b/packages/stream_chat/lib/open_api/model/ip_content_count_rule_parameters.freezed.dart new file mode 100644 index 0000000000..de94e400c4 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ip_content_count_rule_parameters.freezed.dart @@ -0,0 +1,82 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'ip_content_count_rule_parameters.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$IPContentCountRuleParameters { + int? get threshold; + String? get timeWindow; + + /// Create a copy of IPContentCountRuleParameters + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $IPContentCountRuleParametersCopyWith get copyWith => + _$IPContentCountRuleParametersCopyWithImpl( + this as IPContentCountRuleParameters, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is IPContentCountRuleParameters && + (identical(other.threshold, threshold) || other.threshold == threshold) && + (identical(other.timeWindow, timeWindow) || other.timeWindow == timeWindow)); + } + + @override + int get hashCode => Object.hash(runtimeType, threshold, timeWindow); + + @override + String toString() { + return 'IPContentCountRuleParameters(threshold: $threshold, timeWindow: $timeWindow)'; + } +} + +/// @nodoc +abstract mixin class $IPContentCountRuleParametersCopyWith<$Res> { + factory $IPContentCountRuleParametersCopyWith( + IPContentCountRuleParameters value, + $Res Function(IPContentCountRuleParameters) _then, + ) = _$IPContentCountRuleParametersCopyWithImpl; + @useResult + $Res call({int? threshold, String? timeWindow}); +} + +/// @nodoc +class _$IPContentCountRuleParametersCopyWithImpl<$Res> implements $IPContentCountRuleParametersCopyWith<$Res> { + _$IPContentCountRuleParametersCopyWithImpl(this._self, this._then); + + final IPContentCountRuleParameters _self; + final $Res Function(IPContentCountRuleParameters) _then; + + /// Create a copy of IPContentCountRuleParameters + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? threshold = freezed, Object? timeWindow = freezed}) { + return _then( + IPContentCountRuleParameters( + threshold: freezed == threshold + ? _self.threshold + : threshold // ignore: cast_nullable_to_non_nullable + as int?, + timeWindow: freezed == timeWindow + ? _self.timeWindow + : timeWindow // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/ip_content_count_rule_parameters.g.dart b/packages/stream_chat/lib/open_api/model/ip_content_count_rule_parameters.g.dart new file mode 100644 index 0000000000..c9d465abca --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ip_content_count_rule_parameters.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'ip_content_count_rule_parameters.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +IPContentCountRuleParameters _$IPContentCountRuleParametersFromJson( + Map json, +) => IPContentCountRuleParameters( + threshold: (json['threshold'] as num?)?.toInt(), + timeWindow: json['time_window'] as String?, +); + +Map _$IPContentCountRuleParametersToJson( + IPContentCountRuleParameters instance, +) => { + 'threshold': instance.threshold, + 'time_window': instance.timeWindow, +}; diff --git a/packages/stream_chat/lib/open_api/model/ip_flag_count_rule_parameters.dart b/packages/stream_chat/lib/open_api/model/ip_flag_count_rule_parameters.dart new file mode 100644 index 0000000000..8799e61b4e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ip_flag_count_rule_parameters.dart @@ -0,0 +1,46 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'ip_flag_count_rule_parameters.g.dart'; +part 'ip_flag_count_rule_parameters.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class IPFlagCountRuleParameters with _$IPFlagCountRuleParameters { + const IPFlagCountRuleParameters({ + this.harmLabels, + this.severity, + this.threshold, + this.timeWindow, + }); + + @override + @JsonKey(name: 'harm_labels') + final List? harmLabels; + + @override + @JsonKey(name: 'severity') + final String? severity; + + @override + @JsonKey(name: 'threshold') + final int? threshold; + + @override + @JsonKey(name: 'time_window') + final String? timeWindow; + + Map toJson() => _$IPFlagCountRuleParametersToJson(this); + + static IPFlagCountRuleParameters fromJson(Map json) => _$IPFlagCountRuleParametersFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/ip_flag_count_rule_parameters.freezed.dart b/packages/stream_chat/lib/open_api/model/ip_flag_count_rule_parameters.freezed.dart new file mode 100644 index 0000000000..1728b5b2d8 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ip_flag_count_rule_parameters.freezed.dart @@ -0,0 +1,113 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'ip_flag_count_rule_parameters.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$IPFlagCountRuleParameters { + List? get harmLabels; + String? get severity; + int? get threshold; + String? get timeWindow; + + /// Create a copy of IPFlagCountRuleParameters + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $IPFlagCountRuleParametersCopyWith get copyWith => + _$IPFlagCountRuleParametersCopyWithImpl( + this as IPFlagCountRuleParameters, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is IPFlagCountRuleParameters && + const DeepCollectionEquality().equals( + other.harmLabels, + harmLabels, + ) && + (identical(other.severity, severity) || other.severity == severity) && + (identical(other.threshold, threshold) || other.threshold == threshold) && + (identical(other.timeWindow, timeWindow) || other.timeWindow == timeWindow)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(harmLabels), + severity, + threshold, + timeWindow, + ); + + @override + String toString() { + return 'IPFlagCountRuleParameters(harmLabels: $harmLabels, severity: $severity, threshold: $threshold, timeWindow: $timeWindow)'; + } +} + +/// @nodoc +abstract mixin class $IPFlagCountRuleParametersCopyWith<$Res> { + factory $IPFlagCountRuleParametersCopyWith( + IPFlagCountRuleParameters value, + $Res Function(IPFlagCountRuleParameters) _then, + ) = _$IPFlagCountRuleParametersCopyWithImpl; + @useResult + $Res call({ + List? harmLabels, + String? severity, + int? threshold, + String? timeWindow, + }); +} + +/// @nodoc +class _$IPFlagCountRuleParametersCopyWithImpl<$Res> implements $IPFlagCountRuleParametersCopyWith<$Res> { + _$IPFlagCountRuleParametersCopyWithImpl(this._self, this._then); + + final IPFlagCountRuleParameters _self; + final $Res Function(IPFlagCountRuleParameters) _then; + + /// Create a copy of IPFlagCountRuleParameters + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? harmLabels = freezed, + Object? severity = freezed, + Object? threshold = freezed, + Object? timeWindow = freezed, + }) { + return _then( + IPFlagCountRuleParameters( + harmLabels: freezed == harmLabels + ? _self.harmLabels + : harmLabels // ignore: cast_nullable_to_non_nullable + as List?, + severity: freezed == severity + ? _self.severity + : severity // ignore: cast_nullable_to_non_nullable + as String?, + threshold: freezed == threshold + ? _self.threshold + : threshold // ignore: cast_nullable_to_non_nullable + as int?, + timeWindow: freezed == timeWindow + ? _self.timeWindow + : timeWindow // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/ip_flag_count_rule_parameters.g.dart b/packages/stream_chat/lib/open_api/model/ip_flag_count_rule_parameters.g.dart new file mode 100644 index 0000000000..4f5a289e2f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ip_flag_count_rule_parameters.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'ip_flag_count_rule_parameters.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +IPFlagCountRuleParameters _$IPFlagCountRuleParametersFromJson( + Map json, +) => IPFlagCountRuleParameters( + harmLabels: (json['harm_labels'] as List?)?.map((e) => e as String).toList(), + severity: json['severity'] as String?, + threshold: (json['threshold'] as num?)?.toInt(), + timeWindow: json['time_window'] as String?, +); + +Map _$IPFlagCountRuleParametersToJson( + IPFlagCountRuleParameters instance, +) => { + 'harm_labels': instance.harmLabels, + 'severity': instance.severity, + 'threshold': instance.threshold, + 'time_window': instance.timeWindow, +}; diff --git a/packages/stream_chat/lib/open_api/model/keyframe_ocr_rule_parameters.dart b/packages/stream_chat/lib/open_api/model/keyframe_ocr_rule_parameters.dart new file mode 100644 index 0000000000..91512186f7 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/keyframe_ocr_rule_parameters.dart @@ -0,0 +1,41 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'keyframe_ocr_rule_parameters.g.dart'; +part 'keyframe_ocr_rule_parameters.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class KeyframeOCRRuleParameters with _$KeyframeOCRRuleParameters { + const KeyframeOCRRuleParameters({ + this.harmLabels, + this.threshold, + this.timeWindow, + }); + + @override + @JsonKey(name: 'harm_labels') + final List? harmLabels; + + @override + @JsonKey(name: 'threshold') + final int? threshold; + + @override + @JsonKey(name: 'time_window') + final String? timeWindow; + + Map toJson() => _$KeyframeOCRRuleParametersToJson(this); + + static KeyframeOCRRuleParameters fromJson(Map json) => _$KeyframeOCRRuleParametersFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/keyframe_ocr_rule_parameters.freezed.dart b/packages/stream_chat/lib/open_api/model/keyframe_ocr_rule_parameters.freezed.dart new file mode 100644 index 0000000000..0e2423111d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/keyframe_ocr_rule_parameters.freezed.dart @@ -0,0 +1,100 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'keyframe_ocr_rule_parameters.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$KeyframeOCRRuleParameters { + List? get harmLabels; + int? get threshold; + String? get timeWindow; + + /// Create a copy of KeyframeOCRRuleParameters + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $KeyframeOCRRuleParametersCopyWith get copyWith => + _$KeyframeOCRRuleParametersCopyWithImpl( + this as KeyframeOCRRuleParameters, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is KeyframeOCRRuleParameters && + const DeepCollectionEquality().equals( + other.harmLabels, + harmLabels, + ) && + (identical(other.threshold, threshold) || other.threshold == threshold) && + (identical(other.timeWindow, timeWindow) || other.timeWindow == timeWindow)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(harmLabels), + threshold, + timeWindow, + ); + + @override + String toString() { + return 'KeyframeOCRRuleParameters(harmLabels: $harmLabels, threshold: $threshold, timeWindow: $timeWindow)'; + } +} + +/// @nodoc +abstract mixin class $KeyframeOCRRuleParametersCopyWith<$Res> { + factory $KeyframeOCRRuleParametersCopyWith( + KeyframeOCRRuleParameters value, + $Res Function(KeyframeOCRRuleParameters) _then, + ) = _$KeyframeOCRRuleParametersCopyWithImpl; + @useResult + $Res call({List? harmLabels, int? threshold, String? timeWindow}); +} + +/// @nodoc +class _$KeyframeOCRRuleParametersCopyWithImpl<$Res> implements $KeyframeOCRRuleParametersCopyWith<$Res> { + _$KeyframeOCRRuleParametersCopyWithImpl(this._self, this._then); + + final KeyframeOCRRuleParameters _self; + final $Res Function(KeyframeOCRRuleParameters) _then; + + /// Create a copy of KeyframeOCRRuleParameters + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? harmLabels = freezed, + Object? threshold = freezed, + Object? timeWindow = freezed, + }) { + return _then( + KeyframeOCRRuleParameters( + harmLabels: freezed == harmLabels + ? _self.harmLabels + : harmLabels // ignore: cast_nullable_to_non_nullable + as List?, + threshold: freezed == threshold + ? _self.threshold + : threshold // ignore: cast_nullable_to_non_nullable + as int?, + timeWindow: freezed == timeWindow + ? _self.timeWindow + : timeWindow // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/keyframe_ocr_rule_parameters.g.dart b/packages/stream_chat/lib/open_api/model/keyframe_ocr_rule_parameters.g.dart new file mode 100644 index 0000000000..5458bedd00 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/keyframe_ocr_rule_parameters.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'keyframe_ocr_rule_parameters.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +KeyframeOCRRuleParameters _$KeyframeOCRRuleParametersFromJson( + Map json, +) => KeyframeOCRRuleParameters( + harmLabels: (json['harm_labels'] as List?)?.map((e) => e as String).toList(), + threshold: (json['threshold'] as num?)?.toInt(), + timeWindow: json['time_window'] as String?, +); + +Map _$KeyframeOCRRuleParametersToJson( + KeyframeOCRRuleParameters instance, +) => { + 'harm_labels': instance.harmLabels, + 'threshold': instance.threshold, + 'time_window': instance.timeWindow, +}; diff --git a/packages/stream_chat/lib/open_api/model/keyframe_rule_parameters.dart b/packages/stream_chat/lib/open_api/model/keyframe_rule_parameters.dart new file mode 100644 index 0000000000..327fda3941 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/keyframe_rule_parameters.dart @@ -0,0 +1,46 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'keyframe_rule_parameters.g.dart'; +part 'keyframe_rule_parameters.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class KeyframeRuleParameters with _$KeyframeRuleParameters { + const KeyframeRuleParameters({ + this.harmLabels, + this.minConfidence, + this.threshold, + this.timeWindow, + }); + + @override + @JsonKey(name: 'harm_labels') + final List? harmLabels; + + @override + @JsonKey(name: 'min_confidence') + final double? minConfidence; + + @override + @JsonKey(name: 'threshold') + final int? threshold; + + @override + @JsonKey(name: 'time_window') + final String? timeWindow; + + Map toJson() => _$KeyframeRuleParametersToJson(this); + + static KeyframeRuleParameters fromJson(Map json) => _$KeyframeRuleParametersFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/keyframe_rule_parameters.freezed.dart b/packages/stream_chat/lib/open_api/model/keyframe_rule_parameters.freezed.dart new file mode 100644 index 0000000000..55b33df35b --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/keyframe_rule_parameters.freezed.dart @@ -0,0 +1,113 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'keyframe_rule_parameters.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$KeyframeRuleParameters { + List? get harmLabels; + double? get minConfidence; + int? get threshold; + String? get timeWindow; + + /// Create a copy of KeyframeRuleParameters + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $KeyframeRuleParametersCopyWith get copyWith => + _$KeyframeRuleParametersCopyWithImpl( + this as KeyframeRuleParameters, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is KeyframeRuleParameters && + const DeepCollectionEquality().equals( + other.harmLabels, + harmLabels, + ) && + (identical(other.minConfidence, minConfidence) || other.minConfidence == minConfidence) && + (identical(other.threshold, threshold) || other.threshold == threshold) && + (identical(other.timeWindow, timeWindow) || other.timeWindow == timeWindow)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(harmLabels), + minConfidence, + threshold, + timeWindow, + ); + + @override + String toString() { + return 'KeyframeRuleParameters(harmLabels: $harmLabels, minConfidence: $minConfidence, threshold: $threshold, timeWindow: $timeWindow)'; + } +} + +/// @nodoc +abstract mixin class $KeyframeRuleParametersCopyWith<$Res> { + factory $KeyframeRuleParametersCopyWith( + KeyframeRuleParameters value, + $Res Function(KeyframeRuleParameters) _then, + ) = _$KeyframeRuleParametersCopyWithImpl; + @useResult + $Res call({ + List? harmLabels, + double? minConfidence, + int? threshold, + String? timeWindow, + }); +} + +/// @nodoc +class _$KeyframeRuleParametersCopyWithImpl<$Res> implements $KeyframeRuleParametersCopyWith<$Res> { + _$KeyframeRuleParametersCopyWithImpl(this._self, this._then); + + final KeyframeRuleParameters _self; + final $Res Function(KeyframeRuleParameters) _then; + + /// Create a copy of KeyframeRuleParameters + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? harmLabels = freezed, + Object? minConfidence = freezed, + Object? threshold = freezed, + Object? timeWindow = freezed, + }) { + return _then( + KeyframeRuleParameters( + harmLabels: freezed == harmLabels + ? _self.harmLabels + : harmLabels // ignore: cast_nullable_to_non_nullable + as List?, + minConfidence: freezed == minConfidence + ? _self.minConfidence + : minConfidence // ignore: cast_nullable_to_non_nullable + as double?, + threshold: freezed == threshold + ? _self.threshold + : threshold // ignore: cast_nullable_to_non_nullable + as int?, + timeWindow: freezed == timeWindow + ? _self.timeWindow + : timeWindow // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/keyframe_rule_parameters.g.dart b/packages/stream_chat/lib/open_api/model/keyframe_rule_parameters.g.dart new file mode 100644 index 0000000000..30853cce2d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/keyframe_rule_parameters.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'keyframe_rule_parameters.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +KeyframeRuleParameters _$KeyframeRuleParametersFromJson( + Map json, +) => KeyframeRuleParameters( + harmLabels: (json['harm_labels'] as List?)?.map((e) => e as String).toList(), + minConfidence: (json['min_confidence'] as num?)?.toDouble(), + threshold: (json['threshold'] as num?)?.toInt(), + timeWindow: json['time_window'] as String?, +); + +Map _$KeyframeRuleParametersToJson( + KeyframeRuleParameters instance, +) => { + 'harm_labels': instance.harmLabels, + 'min_confidence': instance.minConfidence, + 'threshold': instance.threshold, + 'time_window': instance.timeWindow, +}; diff --git a/packages/stream_chat/lib/open_api/model/label_response.dart b/packages/stream_chat/lib/open_api/model/label_response.dart new file mode 100644 index 0000000000..67428f625f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/label_response.dart @@ -0,0 +1,41 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'label_response.g.dart'; +part 'label_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class LabelResponse with _$LabelResponse { + const LabelResponse({ + this.harmLabels, + required this.name, + this.phraseListIds, + }); + + @override + @JsonKey(name: 'harm_labels') + final List? harmLabels; + + @override + @JsonKey(name: 'name') + final String name; + + @override + @JsonKey(name: 'phrase_list_ids') + final List? phraseListIds; + + Map toJson() => _$LabelResponseToJson(this); + + static LabelResponse fromJson(Map json) => _$LabelResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/label_response.freezed.dart b/packages/stream_chat/lib/open_api/model/label_response.freezed.dart new file mode 100644 index 0000000000..b09136b285 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/label_response.freezed.dart @@ -0,0 +1,102 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'label_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$LabelResponse { + List? get harmLabels; + String get name; + List? get phraseListIds; + + /// Create a copy of LabelResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $LabelResponseCopyWith get copyWith => _$LabelResponseCopyWithImpl( + this as LabelResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is LabelResponse && + const DeepCollectionEquality().equals( + other.harmLabels, + harmLabels, + ) && + (identical(other.name, name) || other.name == name) && + const DeepCollectionEquality().equals( + other.phraseListIds, + phraseListIds, + )); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(harmLabels), + name, + const DeepCollectionEquality().hash(phraseListIds), + ); + + @override + String toString() { + return 'LabelResponse(harmLabels: $harmLabels, name: $name, phraseListIds: $phraseListIds)'; + } +} + +/// @nodoc +abstract mixin class $LabelResponseCopyWith<$Res> { + factory $LabelResponseCopyWith( + LabelResponse value, + $Res Function(LabelResponse) _then, + ) = _$LabelResponseCopyWithImpl; + @useResult + $Res call({List? harmLabels, String name, List? phraseListIds}); +} + +/// @nodoc +class _$LabelResponseCopyWithImpl<$Res> implements $LabelResponseCopyWith<$Res> { + _$LabelResponseCopyWithImpl(this._self, this._then); + + final LabelResponse _self; + final $Res Function(LabelResponse) _then; + + /// Create a copy of LabelResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? harmLabels = freezed, + Object? name = null, + Object? phraseListIds = freezed, + }) { + return _then( + LabelResponse( + harmLabels: freezed == harmLabels + ? _self.harmLabels + : harmLabels // ignore: cast_nullable_to_non_nullable + as List?, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + phraseListIds: freezed == phraseListIds + ? _self.phraseListIds + : phraseListIds // ignore: cast_nullable_to_non_nullable + as List?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/label_response.g.dart b/packages/stream_chat/lib/open_api/model/label_response.g.dart new file mode 100644 index 0000000000..97e31c8e8c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/label_response.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'label_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +LabelResponse _$LabelResponseFromJson(Map json) => LabelResponse( + harmLabels: (json['harm_labels'] as List?)?.map((e) => e as String).toList(), + name: json['name'] as String, + phraseListIds: (json['phrase_list_ids'] as List?)?.map((e) => (e as num).toInt()).toList(), +); + +Map _$LabelResponseToJson(LabelResponse instance) => { + 'harm_labels': instance.harmLabels, + 'name': instance.name, + 'phrase_list_ids': instance.phraseListIds, +}; diff --git a/packages/stream_chat/lib/open_api/model/label_thresholds.dart b/packages/stream_chat/lib/open_api/model/label_thresholds.dart new file mode 100644 index 0000000000..be5bee259d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/label_thresholds.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'label_thresholds.g.dart'; +part 'label_thresholds.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class LabelThresholds with _$LabelThresholds { + const LabelThresholds({ + this.block, + this.flag, + }); + + @override + @JsonKey(name: 'block') + final double? block; + + @override + @JsonKey(name: 'flag') + final double? flag; + + Map toJson() => _$LabelThresholdsToJson(this); + + static LabelThresholds fromJson(Map json) => _$LabelThresholdsFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/label_thresholds.freezed.dart b/packages/stream_chat/lib/open_api/model/label_thresholds.freezed.dart new file mode 100644 index 0000000000..e43b67b59d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/label_thresholds.freezed.dart @@ -0,0 +1,81 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'label_thresholds.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$LabelThresholds { + double? get block; + double? get flag; + + /// Create a copy of LabelThresholds + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $LabelThresholdsCopyWith get copyWith => _$LabelThresholdsCopyWithImpl( + this as LabelThresholds, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is LabelThresholds && + (identical(other.block, block) || other.block == block) && + (identical(other.flag, flag) || other.flag == flag)); + } + + @override + int get hashCode => Object.hash(runtimeType, block, flag); + + @override + String toString() { + return 'LabelThresholds(block: $block, flag: $flag)'; + } +} + +/// @nodoc +abstract mixin class $LabelThresholdsCopyWith<$Res> { + factory $LabelThresholdsCopyWith( + LabelThresholds value, + $Res Function(LabelThresholds) _then, + ) = _$LabelThresholdsCopyWithImpl; + @useResult + $Res call({double? block, double? flag}); +} + +/// @nodoc +class _$LabelThresholdsCopyWithImpl<$Res> implements $LabelThresholdsCopyWith<$Res> { + _$LabelThresholdsCopyWithImpl(this._self, this._then); + + final LabelThresholds _self; + final $Res Function(LabelThresholds) _then; + + /// Create a copy of LabelThresholds + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? block = freezed, Object? flag = freezed}) { + return _then( + LabelThresholds( + block: freezed == block + ? _self.block + : block // ignore: cast_nullable_to_non_nullable + as double?, + flag: freezed == flag + ? _self.flag + : flag // ignore: cast_nullable_to_non_nullable + as double?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/label_thresholds.g.dart b/packages/stream_chat/lib/open_api/model/label_thresholds.g.dart new file mode 100644 index 0000000000..9040fb622b --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/label_thresholds.g.dart @@ -0,0 +1,17 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'label_thresholds.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +LabelThresholds _$LabelThresholdsFromJson(Map json) => LabelThresholds( + block: (json['block'] as num?)?.toDouble(), + flag: (json['flag'] as num?)?.toDouble(), +); + +Map _$LabelThresholdsToJson(LabelThresholds instance) => { + 'block': instance.block, + 'flag': instance.flag, +}; diff --git a/packages/stream_chat/lib/open_api/model/list_block_list_response.dart b/packages/stream_chat/lib/open_api/model/list_block_list_response.dart new file mode 100644 index 0000000000..eca6807095 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/list_block_list_response.dart @@ -0,0 +1,41 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'list_block_list_response.g.dart'; +part 'list_block_list_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ListBlockListResponse with _$ListBlockListResponse { + const ListBlockListResponse({ + required this.blocklists, + required this.duration, + this.nextCursor, + }); + + @override + @JsonKey(name: 'blocklists') + final List blocklists; + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'next_cursor') + final String? nextCursor; + + Map toJson() => _$ListBlockListResponseToJson(this); + + static ListBlockListResponse fromJson(Map json) => _$ListBlockListResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/list_block_list_response.freezed.dart b/packages/stream_chat/lib/open_api/model/list_block_list_response.freezed.dart new file mode 100644 index 0000000000..36d817e7c4 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/list_block_list_response.freezed.dart @@ -0,0 +1,104 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'list_block_list_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ListBlockListResponse { + List get blocklists; + String get duration; + String? get nextCursor; + + /// Create a copy of ListBlockListResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ListBlockListResponseCopyWith get copyWith => + _$ListBlockListResponseCopyWithImpl( + this as ListBlockListResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ListBlockListResponse && + const DeepCollectionEquality().equals( + other.blocklists, + blocklists, + ) && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.nextCursor, nextCursor) || other.nextCursor == nextCursor)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(blocklists), + duration, + nextCursor, + ); + + @override + String toString() { + return 'ListBlockListResponse(blocklists: $blocklists, duration: $duration, nextCursor: $nextCursor)'; + } +} + +/// @nodoc +abstract mixin class $ListBlockListResponseCopyWith<$Res> { + factory $ListBlockListResponseCopyWith( + ListBlockListResponse value, + $Res Function(ListBlockListResponse) _then, + ) = _$ListBlockListResponseCopyWithImpl; + @useResult + $Res call({ + List blocklists, + String duration, + String? nextCursor, + }); +} + +/// @nodoc +class _$ListBlockListResponseCopyWithImpl<$Res> implements $ListBlockListResponseCopyWith<$Res> { + _$ListBlockListResponseCopyWithImpl(this._self, this._then); + + final ListBlockListResponse _self; + final $Res Function(ListBlockListResponse) _then; + + /// Create a copy of ListBlockListResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? blocklists = null, + Object? duration = null, + Object? nextCursor = freezed, + }) { + return _then( + ListBlockListResponse( + blocklists: null == blocklists + ? _self.blocklists + : blocklists // ignore: cast_nullable_to_non_nullable + as List, + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + nextCursor: freezed == nextCursor + ? _self.nextCursor + : nextCursor // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/list_block_list_response.g.dart b/packages/stream_chat/lib/open_api/model/list_block_list_response.g.dart new file mode 100644 index 0000000000..ee05f2b7e8 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/list_block_list_response.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'list_block_list_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ListBlockListResponse _$ListBlockListResponseFromJson( + Map json, +) => ListBlockListResponse( + blocklists: (json['blocklists'] as List) + .map((e) => BlockListResponse.fromJson(e as Map)) + .toList(), + duration: json['duration'] as String, + nextCursor: json['next_cursor'] as String?, +); + +Map _$ListBlockListResponseToJson( + ListBlockListResponse instance, +) => { + 'blocklists': instance.blocklists.map((e) => e.toJson()).toList(), + 'duration': instance.duration, + 'next_cursor': instance.nextCursor, +}; diff --git a/packages/stream_chat/lib/open_api/model/list_devices_response.dart b/packages/stream_chat/lib/open_api/model/list_devices_response.dart new file mode 100644 index 0000000000..ef18ccf808 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/list_devices_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'list_devices_response.g.dart'; +part 'list_devices_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ListDevicesResponse with _$ListDevicesResponse { + const ListDevicesResponse({ + required this.devices, + required this.duration, + }); + + @override + @JsonKey(name: 'devices') + final List devices; + + @override + @JsonKey(name: 'duration') + final String duration; + + Map toJson() => _$ListDevicesResponseToJson(this); + + static ListDevicesResponse fromJson(Map json) => _$ListDevicesResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/list_devices_response.freezed.dart b/packages/stream_chat/lib/open_api/model/list_devices_response.freezed.dart new file mode 100644 index 0000000000..c60874994f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/list_devices_response.freezed.dart @@ -0,0 +1,86 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'list_devices_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ListDevicesResponse { + List get devices; + String get duration; + + /// Create a copy of ListDevicesResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ListDevicesResponseCopyWith get copyWith => + _$ListDevicesResponseCopyWithImpl( + this as ListDevicesResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ListDevicesResponse && + const DeepCollectionEquality().equals(other.devices, devices) && + (identical(other.duration, duration) || other.duration == duration)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(devices), + duration, + ); + + @override + String toString() { + return 'ListDevicesResponse(devices: $devices, duration: $duration)'; + } +} + +/// @nodoc +abstract mixin class $ListDevicesResponseCopyWith<$Res> { + factory $ListDevicesResponseCopyWith( + ListDevicesResponse value, + $Res Function(ListDevicesResponse) _then, + ) = _$ListDevicesResponseCopyWithImpl; + @useResult + $Res call({List devices, String duration}); +} + +/// @nodoc +class _$ListDevicesResponseCopyWithImpl<$Res> implements $ListDevicesResponseCopyWith<$Res> { + _$ListDevicesResponseCopyWithImpl(this._self, this._then); + + final ListDevicesResponse _self; + final $Res Function(ListDevicesResponse) _then; + + /// Create a copy of ListDevicesResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? devices = null, Object? duration = null}) { + return _then( + ListDevicesResponse( + devices: null == devices + ? _self.devices + : devices // ignore: cast_nullable_to_non_nullable + as List, + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/list_devices_response.g.dart b/packages/stream_chat/lib/open_api/model/list_devices_response.g.dart new file mode 100644 index 0000000000..b1c328e7f3 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/list_devices_response.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'list_devices_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ListDevicesResponse _$ListDevicesResponseFromJson(Map json) => ListDevicesResponse( + devices: (json['devices'] as List).map((e) => DeviceResponse.fromJson(e as Map)).toList(), + duration: json['duration'] as String, +); + +Map _$ListDevicesResponseToJson( + ListDevicesResponse instance, +) => { + 'devices': instance.devices.map((e) => e.toJson()).toList(), + 'duration': instance.duration, +}; diff --git a/packages/stream_chat/lib/open_api/model/list_queues_response.dart b/packages/stream_chat/lib/open_api/model/list_queues_response.dart new file mode 100644 index 0000000000..c7e0e8e580 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/list_queues_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'list_queues_response.g.dart'; +part 'list_queues_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ListQueuesResponse with _$ListQueuesResponse { + const ListQueuesResponse({ + required this.duration, + required this.queues, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'queues') + final List queues; + + Map toJson() => _$ListQueuesResponseToJson(this); + + static ListQueuesResponse fromJson(Map json) => _$ListQueuesResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/list_queues_response.freezed.dart b/packages/stream_chat/lib/open_api/model/list_queues_response.freezed.dart new file mode 100644 index 0000000000..cfbb395eaa --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/list_queues_response.freezed.dart @@ -0,0 +1,85 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'list_queues_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ListQueuesResponse { + String get duration; + List get queues; + + /// Create a copy of ListQueuesResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ListQueuesResponseCopyWith get copyWith => _$ListQueuesResponseCopyWithImpl( + this as ListQueuesResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ListQueuesResponse && + (identical(other.duration, duration) || other.duration == duration) && + const DeepCollectionEquality().equals(other.queues, queues)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + duration, + const DeepCollectionEquality().hash(queues), + ); + + @override + String toString() { + return 'ListQueuesResponse(duration: $duration, queues: $queues)'; + } +} + +/// @nodoc +abstract mixin class $ListQueuesResponseCopyWith<$Res> { + factory $ListQueuesResponseCopyWith( + ListQueuesResponse value, + $Res Function(ListQueuesResponse) _then, + ) = _$ListQueuesResponseCopyWithImpl; + @useResult + $Res call({String duration, List queues}); +} + +/// @nodoc +class _$ListQueuesResponseCopyWithImpl<$Res> implements $ListQueuesResponseCopyWith<$Res> { + _$ListQueuesResponseCopyWithImpl(this._self, this._then); + + final ListQueuesResponse _self; + final $Res Function(ListQueuesResponse) _then; + + /// Create a copy of ListQueuesResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? queues = null}) { + return _then( + ListQueuesResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + queues: null == queues + ? _self.queues + : queues // ignore: cast_nullable_to_non_nullable + as List, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/list_queues_response.g.dart b/packages/stream_chat/lib/open_api/model/list_queues_response.g.dart new file mode 100644 index 0000000000..c1b0e65acd --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/list_queues_response.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'list_queues_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ListQueuesResponse _$ListQueuesResponseFromJson(Map json) => ListQueuesResponse( + duration: json['duration'] as String, + queues: (json['queues'] as List) + .map( + (e) => ModerationQueueResponse.fromJson(e as Map), + ) + .toList(), +); + +Map _$ListQueuesResponseToJson(ListQueuesResponse instance) => { + 'duration': instance.duration, + 'queues': instance.queues.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/list_user_groups_response.dart b/packages/stream_chat/lib/open_api/model/list_user_groups_response.dart new file mode 100644 index 0000000000..f7952dddbd --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/list_user_groups_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'list_user_groups_response.g.dart'; +part 'list_user_groups_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ListUserGroupsResponse with _$ListUserGroupsResponse { + const ListUserGroupsResponse({ + required this.duration, + required this.userGroups, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'user_groups') + final List userGroups; + + Map toJson() => _$ListUserGroupsResponseToJson(this); + + static ListUserGroupsResponse fromJson(Map json) => _$ListUserGroupsResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/list_user_groups_response.freezed.dart b/packages/stream_chat/lib/open_api/model/list_user_groups_response.freezed.dart new file mode 100644 index 0000000000..46aeb7409d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/list_user_groups_response.freezed.dart @@ -0,0 +1,89 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'list_user_groups_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ListUserGroupsResponse { + String get duration; + List get userGroups; + + /// Create a copy of ListUserGroupsResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ListUserGroupsResponseCopyWith get copyWith => + _$ListUserGroupsResponseCopyWithImpl( + this as ListUserGroupsResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ListUserGroupsResponse && + (identical(other.duration, duration) || other.duration == duration) && + const DeepCollectionEquality().equals( + other.userGroups, + userGroups, + )); + } + + @override + int get hashCode => Object.hash( + runtimeType, + duration, + const DeepCollectionEquality().hash(userGroups), + ); + + @override + String toString() { + return 'ListUserGroupsResponse(duration: $duration, userGroups: $userGroups)'; + } +} + +/// @nodoc +abstract mixin class $ListUserGroupsResponseCopyWith<$Res> { + factory $ListUserGroupsResponseCopyWith( + ListUserGroupsResponse value, + $Res Function(ListUserGroupsResponse) _then, + ) = _$ListUserGroupsResponseCopyWithImpl; + @useResult + $Res call({String duration, List userGroups}); +} + +/// @nodoc +class _$ListUserGroupsResponseCopyWithImpl<$Res> implements $ListUserGroupsResponseCopyWith<$Res> { + _$ListUserGroupsResponseCopyWithImpl(this._self, this._then); + + final ListUserGroupsResponse _self; + final $Res Function(ListUserGroupsResponse) _then; + + /// Create a copy of ListUserGroupsResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? userGroups = null}) { + return _then( + ListUserGroupsResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + userGroups: null == userGroups + ? _self.userGroups + : userGroups // ignore: cast_nullable_to_non_nullable + as List, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/list_user_groups_response.g.dart b/packages/stream_chat/lib/open_api/model/list_user_groups_response.g.dart new file mode 100644 index 0000000000..5c025d833f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/list_user_groups_response.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'list_user_groups_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ListUserGroupsResponse _$ListUserGroupsResponseFromJson( + Map json, +) => ListUserGroupsResponse( + duration: json['duration'] as String, + userGroups: (json['user_groups'] as List) + .map((e) => UserGroupResponse.fromJson(e as Map)) + .toList(), +); + +Map _$ListUserGroupsResponseToJson( + ListUserGroupsResponse instance, +) => { + 'duration': instance.duration, + 'user_groups': instance.userGroups.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/llm_config.dart b/packages/stream_chat/lib/open_api/model/llm_config.dart new file mode 100644 index 0000000000..175ff6f779 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/llm_config.dart @@ -0,0 +1,51 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'llm_config.g.dart'; +part 'llm_config.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class LLMConfig with _$LLMConfig { + const LLMConfig({ + this.appContext, + this.async, + required this.enabled, + required this.rules, + this.severityDescriptions, + }); + + @override + @JsonKey(name: 'app_context') + final String? appContext; + + @override + @JsonKey(name: 'async') + final bool? async; + + @override + @JsonKey(name: 'enabled') + final bool enabled; + + @override + @JsonKey(name: 'rules') + final List rules; + + @override + @JsonKey(name: 'severity_descriptions') + final Map? severityDescriptions; + + Map toJson() => _$LLMConfigToJson(this); + + static LLMConfig fromJson(Map json) => _$LLMConfigFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/llm_config.freezed.dart b/packages/stream_chat/lib/open_api/model/llm_config.freezed.dart new file mode 100644 index 0000000000..7a7846826d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/llm_config.freezed.dart @@ -0,0 +1,115 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'llm_config.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$LLMConfig { + String? get appContext; + bool? get async; + bool get enabled; + List get rules; + Map? get severityDescriptions; + + /// Create a copy of LLMConfig + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $LLMConfigCopyWith get copyWith => _$LLMConfigCopyWithImpl(this as LLMConfig, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is LLMConfig && + (identical(other.appContext, appContext) || other.appContext == appContext) && + (identical(other.async, async) || other.async == async) && + (identical(other.enabled, enabled) || other.enabled == enabled) && + const DeepCollectionEquality().equals(other.rules, rules) && + const DeepCollectionEquality().equals( + other.severityDescriptions, + severityDescriptions, + )); + } + + @override + int get hashCode => Object.hash( + runtimeType, + appContext, + async, + enabled, + const DeepCollectionEquality().hash(rules), + const DeepCollectionEquality().hash(severityDescriptions), + ); + + @override + String toString() { + return 'LLMConfig(appContext: $appContext, async: $async, enabled: $enabled, rules: $rules, severityDescriptions: $severityDescriptions)'; + } +} + +/// @nodoc +abstract mixin class $LLMConfigCopyWith<$Res> { + factory $LLMConfigCopyWith(LLMConfig value, $Res Function(LLMConfig) _then) = _$LLMConfigCopyWithImpl; + @useResult + $Res call({ + String? appContext, + bool? async, + bool enabled, + List rules, + Map? severityDescriptions, + }); +} + +/// @nodoc +class _$LLMConfigCopyWithImpl<$Res> implements $LLMConfigCopyWith<$Res> { + _$LLMConfigCopyWithImpl(this._self, this._then); + + final LLMConfig _self; + final $Res Function(LLMConfig) _then; + + /// Create a copy of LLMConfig + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? appContext = freezed, + Object? async = freezed, + Object? enabled = null, + Object? rules = null, + Object? severityDescriptions = freezed, + }) { + return _then( + LLMConfig( + appContext: freezed == appContext + ? _self.appContext + : appContext // ignore: cast_nullable_to_non_nullable + as String?, + async: freezed == async + ? _self.async + : async // ignore: cast_nullable_to_non_nullable + as bool?, + enabled: null == enabled + ? _self.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool, + rules: null == rules + ? _self.rules + : rules // ignore: cast_nullable_to_non_nullable + as List, + severityDescriptions: freezed == severityDescriptions + ? _self.severityDescriptions + : severityDescriptions // ignore: cast_nullable_to_non_nullable + as Map?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/llm_config.g.dart b/packages/stream_chat/lib/open_api/model/llm_config.g.dart new file mode 100644 index 0000000000..f91c85535d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/llm_config.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'llm_config.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +LLMConfig _$LLMConfigFromJson(Map json) => LLMConfig( + appContext: json['app_context'] as String?, + async: json['async'] as bool?, + enabled: json['enabled'] as bool, + rules: (json['rules'] as List).map((e) => LLMRule.fromJson(e as Map)).toList(), + severityDescriptions: (json['severity_descriptions'] as Map?)?.map( + (k, e) => MapEntry(k, e as String), + ), +); + +Map _$LLMConfigToJson(LLMConfig instance) => { + 'app_context': instance.appContext, + 'async': instance.async, + 'enabled': instance.enabled, + 'rules': instance.rules.map((e) => e.toJson()).toList(), + 'severity_descriptions': instance.severityDescriptions, +}; diff --git a/packages/stream_chat/lib/open_api/model/llm_rule.dart b/packages/stream_chat/lib/open_api/model/llm_rule.dart new file mode 100644 index 0000000000..2e869f2861 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/llm_rule.dart @@ -0,0 +1,60 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'llm_rule.g.dart'; +part 'llm_rule.freezed.dart'; + +extension type const LLMRuleAction._(String _) implements String { + static const bounce = LLMRuleAction._('bounce'); + static const bounceFlag = LLMRuleAction._('bounce_flag'); + static const bounceRemove = LLMRuleAction._('bounce_remove'); + static const flag = LLMRuleAction._('flag'); + static const keep = LLMRuleAction._('keep'); + static const remove = LLMRuleAction._('remove'); + static const shadow = LLMRuleAction._('shadow'); + + factory LLMRuleAction.fromJson(String json) => LLMRuleAction._(json); + + String toJson() => this; +} + +@freezed +@immutable +@JsonSerializable() +class LLMRule with _$LLMRule { + const LLMRule({ + required this.action, + required this.description, + required this.label, + required this.severityRules, + }); + + @override + @JsonKey(name: 'action') + final LLMRuleAction action; + + @override + @JsonKey(name: 'description') + final String description; + + @override + @JsonKey(name: 'label') + final String label; + + @override + @JsonKey(name: 'severity_rules') + final List severityRules; + + Map toJson() => _$LLMRuleToJson(this); + + static LLMRule fromJson(Map json) => _$LLMRuleFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/llm_rule.freezed.dart b/packages/stream_chat/lib/open_api/model/llm_rule.freezed.dart new file mode 100644 index 0000000000..86eb8334b4 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/llm_rule.freezed.dart @@ -0,0 +1,106 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'llm_rule.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$LLMRule { + LLMRuleAction get action; + String get description; + String get label; + List get severityRules; + + /// Create a copy of LLMRule + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $LLMRuleCopyWith get copyWith => _$LLMRuleCopyWithImpl(this as LLMRule, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is LLMRule && + (identical(other.action, action) || other.action == action) && + (identical(other.description, description) || other.description == description) && + (identical(other.label, label) || other.label == label) && + const DeepCollectionEquality().equals( + other.severityRules, + severityRules, + )); + } + + @override + int get hashCode => Object.hash( + runtimeType, + action, + description, + label, + const DeepCollectionEquality().hash(severityRules), + ); + + @override + String toString() { + return 'LLMRule(action: $action, description: $description, label: $label, severityRules: $severityRules)'; + } +} + +/// @nodoc +abstract mixin class $LLMRuleCopyWith<$Res> { + factory $LLMRuleCopyWith(LLMRule value, $Res Function(LLMRule) _then) = _$LLMRuleCopyWithImpl; + @useResult + $Res call({ + LLMRuleAction action, + String description, + String label, + List severityRules, + }); +} + +/// @nodoc +class _$LLMRuleCopyWithImpl<$Res> implements $LLMRuleCopyWith<$Res> { + _$LLMRuleCopyWithImpl(this._self, this._then); + + final LLMRule _self; + final $Res Function(LLMRule) _then; + + /// Create a copy of LLMRule + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? action = null, + Object? description = null, + Object? label = null, + Object? severityRules = null, + }) { + return _then( + LLMRule( + action: null == action + ? _self.action + : action // ignore: cast_nullable_to_non_nullable + as LLMRuleAction, + description: null == description + ? _self.description + : description // ignore: cast_nullable_to_non_nullable + as String, + label: null == label + ? _self.label + : label // ignore: cast_nullable_to_non_nullable + as String, + severityRules: null == severityRules + ? _self.severityRules + : severityRules // ignore: cast_nullable_to_non_nullable + as List, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/llm_rule.g.dart b/packages/stream_chat/lib/open_api/model/llm_rule.g.dart new file mode 100644 index 0000000000..ddd9fb8bed --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/llm_rule.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'llm_rule.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +LLMRule _$LLMRuleFromJson(Map json) => LLMRule( + action: LLMRuleAction.fromJson(json['action'] as String), + description: json['description'] as String, + label: json['label'] as String, + severityRules: (json['severity_rules'] as List) + .map((e) => BodyguardSeverityRule.fromJson(e as Map)) + .toList(), +); + +Map _$LLMRuleToJson(LLMRule instance) => { + 'action': instance.action.toJson(), + 'description': instance.description, + 'label': instance.label, + 'severity_rules': instance.severityRules.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/mark_channels_read_request.dart b/packages/stream_chat/lib/open_api/model/mark_channels_read_request.dart new file mode 100644 index 0000000000..1639576383 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/mark_channels_read_request.dart @@ -0,0 +1,31 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'mark_channels_read_request.g.dart'; +part 'mark_channels_read_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class MarkChannelsReadRequest with _$MarkChannelsReadRequest { + const MarkChannelsReadRequest({ + this.readByChannel, + }); + + @override + @JsonKey(name: 'read_by_channel') + final Map? readByChannel; + + Map toJson() => _$MarkChannelsReadRequestToJson(this); + + static MarkChannelsReadRequest fromJson(Map json) => _$MarkChannelsReadRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/mark_channels_read_request.freezed.dart b/packages/stream_chat/lib/open_api/model/mark_channels_read_request.freezed.dart new file mode 100644 index 0000000000..e9f78d0c70 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/mark_channels_read_request.freezed.dart @@ -0,0 +1,82 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'mark_channels_read_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$MarkChannelsReadRequest { + Map? get readByChannel; + + /// Create a copy of MarkChannelsReadRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $MarkChannelsReadRequestCopyWith get copyWith => + _$MarkChannelsReadRequestCopyWithImpl( + this as MarkChannelsReadRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is MarkChannelsReadRequest && + const DeepCollectionEquality().equals( + other.readByChannel, + readByChannel, + )); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(readByChannel), + ); + + @override + String toString() { + return 'MarkChannelsReadRequest(readByChannel: $readByChannel)'; + } +} + +/// @nodoc +abstract mixin class $MarkChannelsReadRequestCopyWith<$Res> { + factory $MarkChannelsReadRequestCopyWith( + MarkChannelsReadRequest value, + $Res Function(MarkChannelsReadRequest) _then, + ) = _$MarkChannelsReadRequestCopyWithImpl; + @useResult + $Res call({Map? readByChannel}); +} + +/// @nodoc +class _$MarkChannelsReadRequestCopyWithImpl<$Res> implements $MarkChannelsReadRequestCopyWith<$Res> { + _$MarkChannelsReadRequestCopyWithImpl(this._self, this._then); + + final MarkChannelsReadRequest _self; + final $Res Function(MarkChannelsReadRequest) _then; + + /// Create a copy of MarkChannelsReadRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? readByChannel = freezed}) { + return _then( + MarkChannelsReadRequest( + readByChannel: freezed == readByChannel + ? _self.readByChannel + : readByChannel // ignore: cast_nullable_to_non_nullable + as Map?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/mark_channels_read_request.g.dart b/packages/stream_chat/lib/open_api/model/mark_channels_read_request.g.dart new file mode 100644 index 0000000000..c94ff4b56e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/mark_channels_read_request.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'mark_channels_read_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +MarkChannelsReadRequest _$MarkChannelsReadRequestFromJson( + Map json, +) => MarkChannelsReadRequest( + readByChannel: (json['read_by_channel'] as Map?)?.map( + (k, e) => MapEntry(k, e as String), + ), +); + +Map _$MarkChannelsReadRequestToJson( + MarkChannelsReadRequest instance, +) => {'read_by_channel': instance.readByChannel}; diff --git a/packages/stream_chat/lib/open_api/model/mark_delivered_request.dart b/packages/stream_chat/lib/open_api/model/mark_delivered_request.dart new file mode 100644 index 0000000000..54c6925f48 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/mark_delivered_request.dart @@ -0,0 +1,31 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'mark_delivered_request.g.dart'; +part 'mark_delivered_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class MarkDeliveredRequest with _$MarkDeliveredRequest { + const MarkDeliveredRequest({ + this.latestDeliveredMessages, + }); + + @override + @JsonKey(name: 'latest_delivered_messages') + final List? latestDeliveredMessages; + + Map toJson() => _$MarkDeliveredRequestToJson(this); + + static MarkDeliveredRequest fromJson(Map json) => _$MarkDeliveredRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/mark_delivered_request.freezed.dart b/packages/stream_chat/lib/open_api/model/mark_delivered_request.freezed.dart new file mode 100644 index 0000000000..bf071210bb --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/mark_delivered_request.freezed.dart @@ -0,0 +1,82 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'mark_delivered_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$MarkDeliveredRequest { + List? get latestDeliveredMessages; + + /// Create a copy of MarkDeliveredRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $MarkDeliveredRequestCopyWith get copyWith => + _$MarkDeliveredRequestCopyWithImpl( + this as MarkDeliveredRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is MarkDeliveredRequest && + const DeepCollectionEquality().equals( + other.latestDeliveredMessages, + latestDeliveredMessages, + )); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(latestDeliveredMessages), + ); + + @override + String toString() { + return 'MarkDeliveredRequest(latestDeliveredMessages: $latestDeliveredMessages)'; + } +} + +/// @nodoc +abstract mixin class $MarkDeliveredRequestCopyWith<$Res> { + factory $MarkDeliveredRequestCopyWith( + MarkDeliveredRequest value, + $Res Function(MarkDeliveredRequest) _then, + ) = _$MarkDeliveredRequestCopyWithImpl; + @useResult + $Res call({List? latestDeliveredMessages}); +} + +/// @nodoc +class _$MarkDeliveredRequestCopyWithImpl<$Res> implements $MarkDeliveredRequestCopyWith<$Res> { + _$MarkDeliveredRequestCopyWithImpl(this._self, this._then); + + final MarkDeliveredRequest _self; + final $Res Function(MarkDeliveredRequest) _then; + + /// Create a copy of MarkDeliveredRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? latestDeliveredMessages = freezed}) { + return _then( + MarkDeliveredRequest( + latestDeliveredMessages: freezed == latestDeliveredMessages + ? _self.latestDeliveredMessages + : latestDeliveredMessages // ignore: cast_nullable_to_non_nullable + as List?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/mark_delivered_request.g.dart b/packages/stream_chat/lib/open_api/model/mark_delivered_request.g.dart new file mode 100644 index 0000000000..353ecd2cc5 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/mark_delivered_request.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'mark_delivered_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +MarkDeliveredRequest _$MarkDeliveredRequestFromJson( + Map json, +) => MarkDeliveredRequest( + latestDeliveredMessages: (json['latest_delivered_messages'] as List?) + ?.map((e) => DeliveredMessagePayload.fromJson(e as Map)) + .toList(), +); + +Map _$MarkDeliveredRequestToJson( + MarkDeliveredRequest instance, +) => { + 'latest_delivered_messages': instance.latestDeliveredMessages?.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/mark_delivered_response.dart b/packages/stream_chat/lib/open_api/model/mark_delivered_response.dart new file mode 100644 index 0000000000..bc20f4a7b2 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/mark_delivered_response.dart @@ -0,0 +1,31 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'mark_delivered_response.g.dart'; +part 'mark_delivered_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class MarkDeliveredResponse with _$MarkDeliveredResponse { + const MarkDeliveredResponse({ + required this.duration, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + Map toJson() => _$MarkDeliveredResponseToJson(this); + + static MarkDeliveredResponse fromJson(Map json) => _$MarkDeliveredResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/mark_delivered_response.freezed.dart b/packages/stream_chat/lib/open_api/model/mark_delivered_response.freezed.dart new file mode 100644 index 0000000000..7f97495f31 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/mark_delivered_response.freezed.dart @@ -0,0 +1,76 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'mark_delivered_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$MarkDeliveredResponse { + String get duration; + + /// Create a copy of MarkDeliveredResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $MarkDeliveredResponseCopyWith get copyWith => + _$MarkDeliveredResponseCopyWithImpl( + this as MarkDeliveredResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is MarkDeliveredResponse && + (identical(other.duration, duration) || other.duration == duration)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration); + + @override + String toString() { + return 'MarkDeliveredResponse(duration: $duration)'; + } +} + +/// @nodoc +abstract mixin class $MarkDeliveredResponseCopyWith<$Res> { + factory $MarkDeliveredResponseCopyWith( + MarkDeliveredResponse value, + $Res Function(MarkDeliveredResponse) _then, + ) = _$MarkDeliveredResponseCopyWithImpl; + @useResult + $Res call({String duration}); +} + +/// @nodoc +class _$MarkDeliveredResponseCopyWithImpl<$Res> implements $MarkDeliveredResponseCopyWith<$Res> { + _$MarkDeliveredResponseCopyWithImpl(this._self, this._then); + + final MarkDeliveredResponse _self; + final $Res Function(MarkDeliveredResponse) _then; + + /// Create a copy of MarkDeliveredResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null}) { + return _then( + MarkDeliveredResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/mark_delivered_response.g.dart b/packages/stream_chat/lib/open_api/model/mark_delivered_response.g.dart new file mode 100644 index 0000000000..b465bd5239 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/mark_delivered_response.g.dart @@ -0,0 +1,15 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'mark_delivered_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +MarkDeliveredResponse _$MarkDeliveredResponseFromJson( + Map json, +) => MarkDeliveredResponse(duration: json['duration'] as String); + +Map _$MarkDeliveredResponseToJson( + MarkDeliveredResponse instance, +) => {'duration': instance.duration}; diff --git a/packages/stream_chat/lib/open_api/model/mark_read_request.dart b/packages/stream_chat/lib/open_api/model/mark_read_request.dart new file mode 100644 index 0000000000..8a6c8ce2ad --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/mark_read_request.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'mark_read_request.g.dart'; +part 'mark_read_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class MarkReadRequest with _$MarkReadRequest { + const MarkReadRequest({ + this.messageId, + this.threadId, + }); + + @override + @JsonKey(name: 'message_id') + final String? messageId; + + @override + @JsonKey(name: 'thread_id') + final String? threadId; + + Map toJson() => _$MarkReadRequestToJson(this); + + static MarkReadRequest fromJson(Map json) => _$MarkReadRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/mark_read_request.freezed.dart b/packages/stream_chat/lib/open_api/model/mark_read_request.freezed.dart new file mode 100644 index 0000000000..d0f661a319 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/mark_read_request.freezed.dart @@ -0,0 +1,81 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'mark_read_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$MarkReadRequest { + String? get messageId; + String? get threadId; + + /// Create a copy of MarkReadRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $MarkReadRequestCopyWith get copyWith => _$MarkReadRequestCopyWithImpl( + this as MarkReadRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is MarkReadRequest && + (identical(other.messageId, messageId) || other.messageId == messageId) && + (identical(other.threadId, threadId) || other.threadId == threadId)); + } + + @override + int get hashCode => Object.hash(runtimeType, messageId, threadId); + + @override + String toString() { + return 'MarkReadRequest(messageId: $messageId, threadId: $threadId)'; + } +} + +/// @nodoc +abstract mixin class $MarkReadRequestCopyWith<$Res> { + factory $MarkReadRequestCopyWith( + MarkReadRequest value, + $Res Function(MarkReadRequest) _then, + ) = _$MarkReadRequestCopyWithImpl; + @useResult + $Res call({String? messageId, String? threadId}); +} + +/// @nodoc +class _$MarkReadRequestCopyWithImpl<$Res> implements $MarkReadRequestCopyWith<$Res> { + _$MarkReadRequestCopyWithImpl(this._self, this._then); + + final MarkReadRequest _self; + final $Res Function(MarkReadRequest) _then; + + /// Create a copy of MarkReadRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? messageId = freezed, Object? threadId = freezed}) { + return _then( + MarkReadRequest( + messageId: freezed == messageId + ? _self.messageId + : messageId // ignore: cast_nullable_to_non_nullable + as String?, + threadId: freezed == threadId + ? _self.threadId + : threadId // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/mark_read_request.g.dart b/packages/stream_chat/lib/open_api/model/mark_read_request.g.dart new file mode 100644 index 0000000000..eb2b9d0608 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/mark_read_request.g.dart @@ -0,0 +1,17 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'mark_read_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +MarkReadRequest _$MarkReadRequestFromJson(Map json) => MarkReadRequest( + messageId: json['message_id'] as String?, + threadId: json['thread_id'] as String?, +); + +Map _$MarkReadRequestToJson(MarkReadRequest instance) => { + 'message_id': instance.messageId, + 'thread_id': instance.threadId, +}; diff --git a/packages/stream_chat/lib/open_api/model/mark_read_response.dart b/packages/stream_chat/lib/open_api/model/mark_read_response.dart new file mode 100644 index 0000000000..5e88ca7143 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/mark_read_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'mark_read_response.g.dart'; +part 'mark_read_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class MarkReadResponse with _$MarkReadResponse { + const MarkReadResponse({ + required this.duration, + this.event, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'event') + final MarkReadResponseEvent? event; + + Map toJson() => _$MarkReadResponseToJson(this); + + static MarkReadResponse fromJson(Map json) => _$MarkReadResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/mark_read_response.freezed.dart b/packages/stream_chat/lib/open_api/model/mark_read_response.freezed.dart new file mode 100644 index 0000000000..415242ece1 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/mark_read_response.freezed.dart @@ -0,0 +1,81 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'mark_read_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$MarkReadResponse { + String get duration; + MarkReadResponseEvent? get event; + + /// Create a copy of MarkReadResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $MarkReadResponseCopyWith get copyWith => _$MarkReadResponseCopyWithImpl( + this as MarkReadResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is MarkReadResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.event, event) || other.event == event)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration, event); + + @override + String toString() { + return 'MarkReadResponse(duration: $duration, event: $event)'; + } +} + +/// @nodoc +abstract mixin class $MarkReadResponseCopyWith<$Res> { + factory $MarkReadResponseCopyWith( + MarkReadResponse value, + $Res Function(MarkReadResponse) _then, + ) = _$MarkReadResponseCopyWithImpl; + @useResult + $Res call({String duration, MarkReadResponseEvent? event}); +} + +/// @nodoc +class _$MarkReadResponseCopyWithImpl<$Res> implements $MarkReadResponseCopyWith<$Res> { + _$MarkReadResponseCopyWithImpl(this._self, this._then); + + final MarkReadResponse _self; + final $Res Function(MarkReadResponse) _then; + + /// Create a copy of MarkReadResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? event = freezed}) { + return _then( + MarkReadResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + event: freezed == event + ? _self.event + : event // ignore: cast_nullable_to_non_nullable + as MarkReadResponseEvent?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/mark_read_response.g.dart b/packages/stream_chat/lib/open_api/model/mark_read_response.g.dart new file mode 100644 index 0000000000..36bab7131c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/mark_read_response.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'mark_read_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +MarkReadResponse _$MarkReadResponseFromJson(Map json) => MarkReadResponse( + duration: json['duration'] as String, + event: json['event'] == null + ? null + : MarkReadResponseEvent.fromJson( + json['event'] as Map, + ), +); + +Map _$MarkReadResponseToJson(MarkReadResponse instance) => { + 'duration': instance.duration, + 'event': instance.event?.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/mark_read_response_event.dart b/packages/stream_chat/lib/open_api/model/mark_read_response_event.dart new file mode 100644 index 0000000000..d6c4bfe552 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/mark_read_response_event.dart @@ -0,0 +1,83 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'mark_read_response_event.g.dart'; +part 'mark_read_response_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class MarkReadResponseEvent with _$MarkReadResponseEvent { + const MarkReadResponseEvent({ + this.channel, + required this.channelId, + this.channelLastMessageAt, + required this.channelType, + required this.cid, + required this.createdAt, + this.lastReadMessageId, + this.team, + this.thread, + required this.type, + this.user, + }); + + @override + @JsonKey(name: 'channel') + final ChannelResponse? channel; + + @override + @JsonKey(name: 'channel_id') + final String channelId; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'channel_last_message_at') + final DateTime? channelLastMessageAt; + + @override + @JsonKey(name: 'channel_type') + final String channelType; + + @override + @JsonKey(name: 'cid') + final String cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'last_read_message_id') + final String? lastReadMessageId; + + @override + @JsonKey(name: 'team') + final String? team; + + @override + @JsonKey(name: 'thread') + final ThreadResponse? thread; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'user') + final UserResponseCommonFields? user; + + Map toJson() => _$MarkReadResponseEventToJson(this); + + static MarkReadResponseEvent fromJson(Map json) => _$MarkReadResponseEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/mark_read_response_event.freezed.dart b/packages/stream_chat/lib/open_api/model/mark_read_response_event.freezed.dart new file mode 100644 index 0000000000..2a8cda1d50 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/mark_read_response_event.freezed.dart @@ -0,0 +1,174 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'mark_read_response_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$MarkReadResponseEvent { + ChannelResponse? get channel; + String get channelId; + DateTime? get channelLastMessageAt; + String get channelType; + String get cid; + DateTime get createdAt; + String? get lastReadMessageId; + String? get team; + ThreadResponse? get thread; + String get type; + UserResponseCommonFields? get user; + + /// Create a copy of MarkReadResponseEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $MarkReadResponseEventCopyWith get copyWith => + _$MarkReadResponseEventCopyWithImpl( + this as MarkReadResponseEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is MarkReadResponseEvent && + (identical(other.channel, channel) || other.channel == channel) && + (identical(other.channelId, channelId) || other.channelId == channelId) && + (identical(other.channelLastMessageAt, channelLastMessageAt) || + other.channelLastMessageAt == channelLastMessageAt) && + (identical(other.channelType, channelType) || other.channelType == channelType) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.lastReadMessageId, lastReadMessageId) || other.lastReadMessageId == lastReadMessageId) && + (identical(other.team, team) || other.team == team) && + (identical(other.thread, thread) || other.thread == thread) && + (identical(other.type, type) || other.type == type) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channel, + channelId, + channelLastMessageAt, + channelType, + cid, + createdAt, + lastReadMessageId, + team, + thread, + type, + user, + ); + + @override + String toString() { + return 'MarkReadResponseEvent(channel: $channel, channelId: $channelId, channelLastMessageAt: $channelLastMessageAt, channelType: $channelType, cid: $cid, createdAt: $createdAt, lastReadMessageId: $lastReadMessageId, team: $team, thread: $thread, type: $type, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $MarkReadResponseEventCopyWith<$Res> { + factory $MarkReadResponseEventCopyWith( + MarkReadResponseEvent value, + $Res Function(MarkReadResponseEvent) _then, + ) = _$MarkReadResponseEventCopyWithImpl; + @useResult + $Res call({ + ChannelResponse? channel, + String channelId, + DateTime? channelLastMessageAt, + String channelType, + String cid, + DateTime createdAt, + String? lastReadMessageId, + String? team, + ThreadResponse? thread, + String type, + UserResponseCommonFields? user, + }); +} + +/// @nodoc +class _$MarkReadResponseEventCopyWithImpl<$Res> implements $MarkReadResponseEventCopyWith<$Res> { + _$MarkReadResponseEventCopyWithImpl(this._self, this._then); + + final MarkReadResponseEvent _self; + final $Res Function(MarkReadResponseEvent) _then; + + /// Create a copy of MarkReadResponseEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channel = freezed, + Object? channelId = null, + Object? channelLastMessageAt = freezed, + Object? channelType = null, + Object? cid = null, + Object? createdAt = null, + Object? lastReadMessageId = freezed, + Object? team = freezed, + Object? thread = freezed, + Object? type = null, + Object? user = freezed, + }) { + return _then( + MarkReadResponseEvent( + channel: freezed == channel + ? _self.channel + : channel // ignore: cast_nullable_to_non_nullable + as ChannelResponse?, + channelId: null == channelId + ? _self.channelId + : channelId // ignore: cast_nullable_to_non_nullable + as String, + channelLastMessageAt: freezed == channelLastMessageAt + ? _self.channelLastMessageAt + : channelLastMessageAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + channelType: null == channelType + ? _self.channelType + : channelType // ignore: cast_nullable_to_non_nullable + as String, + cid: null == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + lastReadMessageId: freezed == lastReadMessageId + ? _self.lastReadMessageId + : lastReadMessageId // ignore: cast_nullable_to_non_nullable + as String?, + team: freezed == team + ? _self.team + : team // ignore: cast_nullable_to_non_nullable + as String?, + thread: freezed == thread + ? _self.thread + : thread // ignore: cast_nullable_to_non_nullable + as ThreadResponse?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponseCommonFields?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/mark_read_response_event.g.dart b/packages/stream_chat/lib/open_api/model/mark_read_response_event.g.dart new file mode 100644 index 0000000000..87a3958120 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/mark_read_response_event.g.dart @@ -0,0 +1,57 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'mark_read_response_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +MarkReadResponseEvent _$MarkReadResponseEventFromJson( + Map json, +) => MarkReadResponseEvent( + channel: json['channel'] == null ? null : ChannelResponse.fromJson(json['channel'] as Map), + channelId: json['channel_id'] as String, + channelLastMessageAt: _$JsonConverterFromJson( + json['channel_last_message_at'], + const StreamDateTimeConverter().fromJson, + ), + channelType: json['channel_type'] as String, + cid: json['cid'] as String, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + lastReadMessageId: json['last_read_message_id'] as String?, + team: json['team'] as String?, + thread: json['thread'] == null ? null : ThreadResponse.fromJson(json['thread'] as Map), + type: json['type'] as String, + user: json['user'] == null ? null : UserResponseCommonFields.fromJson(json['user'] as Map), +); + +Map _$MarkReadResponseEventToJson( + MarkReadResponseEvent instance, +) => { + 'channel': instance.channel?.toJson(), + 'channel_id': instance.channelId, + 'channel_last_message_at': _$JsonConverterToJson( + instance.channelLastMessageAt, + const StreamDateTimeConverter().toJson, + ), + 'channel_type': instance.channelType, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'last_read_message_id': instance.lastReadMessageId, + 'team': instance.team, + 'thread': instance.thread?.toJson(), + 'type': instance.type, + 'user': instance.user?.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/mark_reviewed_request_payload.dart b/packages/stream_chat/lib/open_api/model/mark_reviewed_request_payload.dart new file mode 100644 index 0000000000..6ee817d3f0 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/mark_reviewed_request_payload.dart @@ -0,0 +1,41 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'mark_reviewed_request_payload.g.dart'; +part 'mark_reviewed_request_payload.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class MarkReviewedRequestPayload with _$MarkReviewedRequestPayload { + const MarkReviewedRequestPayload({ + this.contentToMarkAsReviewedLimit, + this.decisionReason, + this.disableMarkingContentAsReviewed, + }); + + @override + @JsonKey(name: 'content_to_mark_as_reviewed_limit') + final int? contentToMarkAsReviewedLimit; + + @override + @JsonKey(name: 'decision_reason') + final String? decisionReason; + + @override + @JsonKey(name: 'disable_marking_content_as_reviewed') + final bool? disableMarkingContentAsReviewed; + + Map toJson() => _$MarkReviewedRequestPayloadToJson(this); + + static MarkReviewedRequestPayload fromJson(Map json) => _$MarkReviewedRequestPayloadFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/mark_reviewed_request_payload.freezed.dart b/packages/stream_chat/lib/open_api/model/mark_reviewed_request_payload.freezed.dart new file mode 100644 index 0000000000..6fbd4176ca --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/mark_reviewed_request_payload.freezed.dart @@ -0,0 +1,109 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'mark_reviewed_request_payload.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$MarkReviewedRequestPayload { + int? get contentToMarkAsReviewedLimit; + String? get decisionReason; + bool? get disableMarkingContentAsReviewed; + + /// Create a copy of MarkReviewedRequestPayload + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $MarkReviewedRequestPayloadCopyWith get copyWith => + _$MarkReviewedRequestPayloadCopyWithImpl( + this as MarkReviewedRequestPayload, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is MarkReviewedRequestPayload && + (identical( + other.contentToMarkAsReviewedLimit, + contentToMarkAsReviewedLimit, + ) || + other.contentToMarkAsReviewedLimit == contentToMarkAsReviewedLimit) && + (identical(other.decisionReason, decisionReason) || other.decisionReason == decisionReason) && + (identical( + other.disableMarkingContentAsReviewed, + disableMarkingContentAsReviewed, + ) || + other.disableMarkingContentAsReviewed == disableMarkingContentAsReviewed)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + contentToMarkAsReviewedLimit, + decisionReason, + disableMarkingContentAsReviewed, + ); + + @override + String toString() { + return 'MarkReviewedRequestPayload(contentToMarkAsReviewedLimit: $contentToMarkAsReviewedLimit, decisionReason: $decisionReason, disableMarkingContentAsReviewed: $disableMarkingContentAsReviewed)'; + } +} + +/// @nodoc +abstract mixin class $MarkReviewedRequestPayloadCopyWith<$Res> { + factory $MarkReviewedRequestPayloadCopyWith( + MarkReviewedRequestPayload value, + $Res Function(MarkReviewedRequestPayload) _then, + ) = _$MarkReviewedRequestPayloadCopyWithImpl; + @useResult + $Res call({ + int? contentToMarkAsReviewedLimit, + String? decisionReason, + bool? disableMarkingContentAsReviewed, + }); +} + +/// @nodoc +class _$MarkReviewedRequestPayloadCopyWithImpl<$Res> implements $MarkReviewedRequestPayloadCopyWith<$Res> { + _$MarkReviewedRequestPayloadCopyWithImpl(this._self, this._then); + + final MarkReviewedRequestPayload _self; + final $Res Function(MarkReviewedRequestPayload) _then; + + /// Create a copy of MarkReviewedRequestPayload + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? contentToMarkAsReviewedLimit = freezed, + Object? decisionReason = freezed, + Object? disableMarkingContentAsReviewed = freezed, + }) { + return _then( + MarkReviewedRequestPayload( + contentToMarkAsReviewedLimit: freezed == contentToMarkAsReviewedLimit + ? _self.contentToMarkAsReviewedLimit + : contentToMarkAsReviewedLimit // ignore: cast_nullable_to_non_nullable + as int?, + decisionReason: freezed == decisionReason + ? _self.decisionReason + : decisionReason // ignore: cast_nullable_to_non_nullable + as String?, + disableMarkingContentAsReviewed: freezed == disableMarkingContentAsReviewed + ? _self.disableMarkingContentAsReviewed + : disableMarkingContentAsReviewed // ignore: cast_nullable_to_non_nullable + as bool?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/mark_reviewed_request_payload.g.dart b/packages/stream_chat/lib/open_api/model/mark_reviewed_request_payload.g.dart new file mode 100644 index 0000000000..5c99c4dcd7 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/mark_reviewed_request_payload.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'mark_reviewed_request_payload.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +MarkReviewedRequestPayload _$MarkReviewedRequestPayloadFromJson( + Map json, +) => MarkReviewedRequestPayload( + contentToMarkAsReviewedLimit: (json['content_to_mark_as_reviewed_limit'] as num?)?.toInt(), + decisionReason: json['decision_reason'] as String?, + disableMarkingContentAsReviewed: json['disable_marking_content_as_reviewed'] as bool?, +); + +Map _$MarkReviewedRequestPayloadToJson( + MarkReviewedRequestPayload instance, +) => { + 'content_to_mark_as_reviewed_limit': instance.contentToMarkAsReviewedLimit, + 'decision_reason': instance.decisionReason, + 'disable_marking_content_as_reviewed': instance.disableMarkingContentAsReviewed, +}; diff --git a/packages/stream_chat/lib/open_api/model/mark_unread_request.dart b/packages/stream_chat/lib/open_api/model/mark_unread_request.dart new file mode 100644 index 0000000000..83e62df858 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/mark_unread_request.dart @@ -0,0 +1,42 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'mark_unread_request.g.dart'; +part 'mark_unread_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class MarkUnreadRequest with _$MarkUnreadRequest { + const MarkUnreadRequest({ + this.messageId, + this.messageTimestamp, + this.threadId, + }); + + @override + @JsonKey(name: 'message_id') + final String? messageId; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'message_timestamp') + final DateTime? messageTimestamp; + + @override + @JsonKey(name: 'thread_id') + final String? threadId; + + Map toJson() => _$MarkUnreadRequestToJson(this); + + static MarkUnreadRequest fromJson(Map json) => _$MarkUnreadRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/mark_unread_request.freezed.dart b/packages/stream_chat/lib/open_api/model/mark_unread_request.freezed.dart new file mode 100644 index 0000000000..aa5ae3b394 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/mark_unread_request.freezed.dart @@ -0,0 +1,91 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'mark_unread_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$MarkUnreadRequest { + String? get messageId; + DateTime? get messageTimestamp; + String? get threadId; + + /// Create a copy of MarkUnreadRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $MarkUnreadRequestCopyWith get copyWith => _$MarkUnreadRequestCopyWithImpl( + this as MarkUnreadRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is MarkUnreadRequest && + (identical(other.messageId, messageId) || other.messageId == messageId) && + (identical(other.messageTimestamp, messageTimestamp) || other.messageTimestamp == messageTimestamp) && + (identical(other.threadId, threadId) || other.threadId == threadId)); + } + + @override + int get hashCode => Object.hash(runtimeType, messageId, messageTimestamp, threadId); + + @override + String toString() { + return 'MarkUnreadRequest(messageId: $messageId, messageTimestamp: $messageTimestamp, threadId: $threadId)'; + } +} + +/// @nodoc +abstract mixin class $MarkUnreadRequestCopyWith<$Res> { + factory $MarkUnreadRequestCopyWith( + MarkUnreadRequest value, + $Res Function(MarkUnreadRequest) _then, + ) = _$MarkUnreadRequestCopyWithImpl; + @useResult + $Res call({String? messageId, DateTime? messageTimestamp, String? threadId}); +} + +/// @nodoc +class _$MarkUnreadRequestCopyWithImpl<$Res> implements $MarkUnreadRequestCopyWith<$Res> { + _$MarkUnreadRequestCopyWithImpl(this._self, this._then); + + final MarkUnreadRequest _self; + final $Res Function(MarkUnreadRequest) _then; + + /// Create a copy of MarkUnreadRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? messageId = freezed, + Object? messageTimestamp = freezed, + Object? threadId = freezed, + }) { + return _then( + MarkUnreadRequest( + messageId: freezed == messageId + ? _self.messageId + : messageId // ignore: cast_nullable_to_non_nullable + as String?, + messageTimestamp: freezed == messageTimestamp + ? _self.messageTimestamp + : messageTimestamp // ignore: cast_nullable_to_non_nullable + as DateTime?, + threadId: freezed == threadId + ? _self.threadId + : threadId // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/mark_unread_request.g.dart b/packages/stream_chat/lib/open_api/model/mark_unread_request.g.dart new file mode 100644 index 0000000000..c8ce9dd76e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/mark_unread_request.g.dart @@ -0,0 +1,35 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'mark_unread_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +MarkUnreadRequest _$MarkUnreadRequestFromJson(Map json) => MarkUnreadRequest( + messageId: json['message_id'] as String?, + messageTimestamp: _$JsonConverterFromJson( + json['message_timestamp'], + const StreamDateTimeConverter().fromJson, + ), + threadId: json['thread_id'] as String?, +); + +Map _$MarkUnreadRequestToJson(MarkUnreadRequest instance) => { + 'message_id': instance.messageId, + 'message_timestamp': _$JsonConverterToJson( + instance.messageTimestamp, + const StreamDateTimeConverter().toJson, + ), + 'thread_id': instance.threadId, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/max_streak_changed_event.dart b/packages/stream_chat/lib/open_api/model/max_streak_changed_event.dart new file mode 100644 index 0000000000..3c84442f2d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/max_streak_changed_event.dart @@ -0,0 +1,48 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'max_streak_changed_event.g.dart'; +part 'max_streak_changed_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class MaxStreakChangedEvent extends core.WsEvent with _$MaxStreakChangedEvent { + const MaxStreakChangedEvent({ + required this.createdAt, + required this.custom, + this.receivedAt, + required this.type, + }); + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'type') + final String type; + + Map toJson() => _$MaxStreakChangedEventToJson(this); + + static MaxStreakChangedEvent fromJson(Map json) => _$MaxStreakChangedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/max_streak_changed_event.freezed.dart b/packages/stream_chat/lib/open_api/model/max_streak_changed_event.freezed.dart new file mode 100644 index 0000000000..a9c5000b16 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/max_streak_changed_event.freezed.dart @@ -0,0 +1,110 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'max_streak_changed_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$MaxStreakChangedEvent { + DateTime get createdAt; + Map get custom; + DateTime? get receivedAt; + String get type; + + /// Create a copy of MaxStreakChangedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $MaxStreakChangedEventCopyWith get copyWith => + _$MaxStreakChangedEventCopyWithImpl( + this as MaxStreakChangedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is MaxStreakChangedEvent && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.type, type) || other.type == type)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + createdAt, + const DeepCollectionEquality().hash(custom), + receivedAt, + type, + ); + + @override + String toString() { + return 'MaxStreakChangedEvent(createdAt: $createdAt, custom: $custom, receivedAt: $receivedAt, type: $type)'; + } +} + +/// @nodoc +abstract mixin class $MaxStreakChangedEventCopyWith<$Res> { + factory $MaxStreakChangedEventCopyWith( + MaxStreakChangedEvent value, + $Res Function(MaxStreakChangedEvent) _then, + ) = _$MaxStreakChangedEventCopyWithImpl; + @useResult + $Res call({ + DateTime createdAt, + Map custom, + DateTime? receivedAt, + String type, + }); +} + +/// @nodoc +class _$MaxStreakChangedEventCopyWithImpl<$Res> implements $MaxStreakChangedEventCopyWith<$Res> { + _$MaxStreakChangedEventCopyWithImpl(this._self, this._then); + + final MaxStreakChangedEvent _self; + final $Res Function(MaxStreakChangedEvent) _then; + + /// Create a copy of MaxStreakChangedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? createdAt = null, + Object? custom = null, + Object? receivedAt = freezed, + Object? type = null, + }) { + return _then( + MaxStreakChangedEvent( + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/max_streak_changed_event.g.dart b/packages/stream_chat/lib/open_api/model/max_streak_changed_event.g.dart new file mode 100644 index 0000000000..f433d7fe8e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/max_streak_changed_event.g.dart @@ -0,0 +1,43 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'max_streak_changed_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +MaxStreakChangedEvent _$MaxStreakChangedEventFromJson( + Map json, +) => MaxStreakChangedEvent( + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + type: json['type'] as String, +); + +Map _$MaxStreakChangedEventToJson( + MaxStreakChangedEvent instance, +) => { + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'type': instance.type, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/member_added_event.dart b/packages/stream_chat/lib/open_api/model/member_added_event.dart new file mode 100644 index 0000000000..51356e20c3 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/member_added_event.dart @@ -0,0 +1,98 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'member_added_event.g.dart'; +part 'member_added_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class MemberAddedEvent extends core.WsEvent with _$MemberAddedEvent { + const MemberAddedEvent({ + required this.channel, + this.channelCustom, + this.channelId, + this.channelMemberCount, + this.channelMessageCount, + this.channelType, + this.cid, + required this.createdAt, + required this.custom, + required this.member, + this.receivedAt, + this.team, + required this.type, + this.user, + }); + + @override + @JsonKey(name: 'channel') + final ChannelResponse channel; + + @override + @JsonKey(name: 'channel_custom') + final Map? channelCustom; + + @override + @JsonKey(name: 'channel_id') + final String? channelId; + + @override + @JsonKey(name: 'channel_member_count') + final int? channelMemberCount; + + @override + @JsonKey(name: 'channel_message_count') + final int? channelMessageCount; + + @override + @JsonKey(name: 'channel_type') + final String? channelType; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'member') + final ChannelMemberResponse member; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'team') + final String? team; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'user') + final UserResponseCommonFields? user; + + Map toJson() => _$MemberAddedEventToJson(this); + + static MemberAddedEvent fromJson(Map json) => _$MemberAddedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/member_added_event.freezed.dart b/packages/stream_chat/lib/open_api/model/member_added_event.freezed.dart new file mode 100644 index 0000000000..1476dd99df --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/member_added_event.freezed.dart @@ -0,0 +1,204 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'member_added_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$MemberAddedEvent { + ChannelResponse get channel; + Map? get channelCustom; + String? get channelId; + int? get channelMemberCount; + int? get channelMessageCount; + String? get channelType; + String? get cid; + DateTime get createdAt; + Map get custom; + ChannelMemberResponse get member; + DateTime? get receivedAt; + String? get team; + String get type; + UserResponseCommonFields? get user; + + /// Create a copy of MemberAddedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $MemberAddedEventCopyWith get copyWith => _$MemberAddedEventCopyWithImpl( + this as MemberAddedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is MemberAddedEvent && + (identical(other.channel, channel) || other.channel == channel) && + const DeepCollectionEquality().equals( + other.channelCustom, + channelCustom, + ) && + (identical(other.channelId, channelId) || other.channelId == channelId) && + (identical(other.channelMemberCount, channelMemberCount) || + other.channelMemberCount == channelMemberCount) && + (identical(other.channelMessageCount, channelMessageCount) || + other.channelMessageCount == channelMessageCount) && + (identical(other.channelType, channelType) || other.channelType == channelType) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.member, member) || other.member == member) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.team, team) || other.team == team) && + (identical(other.type, type) || other.type == type) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channel, + const DeepCollectionEquality().hash(channelCustom), + channelId, + channelMemberCount, + channelMessageCount, + channelType, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + member, + receivedAt, + team, + type, + user, + ); + + @override + String toString() { + return 'MemberAddedEvent(channel: $channel, channelCustom: $channelCustom, channelId: $channelId, channelMemberCount: $channelMemberCount, channelMessageCount: $channelMessageCount, channelType: $channelType, cid: $cid, createdAt: $createdAt, custom: $custom, member: $member, receivedAt: $receivedAt, team: $team, type: $type, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $MemberAddedEventCopyWith<$Res> { + factory $MemberAddedEventCopyWith( + MemberAddedEvent value, + $Res Function(MemberAddedEvent) _then, + ) = _$MemberAddedEventCopyWithImpl; + @useResult + $Res call({ + ChannelResponse channel, + Map? channelCustom, + String? channelId, + int? channelMemberCount, + int? channelMessageCount, + String? channelType, + String? cid, + DateTime createdAt, + Map custom, + ChannelMemberResponse member, + DateTime? receivedAt, + String? team, + String type, + UserResponseCommonFields? user, + }); +} + +/// @nodoc +class _$MemberAddedEventCopyWithImpl<$Res> implements $MemberAddedEventCopyWith<$Res> { + _$MemberAddedEventCopyWithImpl(this._self, this._then); + + final MemberAddedEvent _self; + final $Res Function(MemberAddedEvent) _then; + + /// Create a copy of MemberAddedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channel = null, + Object? channelCustom = freezed, + Object? channelId = freezed, + Object? channelMemberCount = freezed, + Object? channelMessageCount = freezed, + Object? channelType = freezed, + Object? cid = freezed, + Object? createdAt = null, + Object? custom = null, + Object? member = null, + Object? receivedAt = freezed, + Object? team = freezed, + Object? type = null, + Object? user = freezed, + }) { + return _then( + MemberAddedEvent( + channel: null == channel + ? _self.channel + : channel // ignore: cast_nullable_to_non_nullable + as ChannelResponse, + channelCustom: freezed == channelCustom + ? _self.channelCustom + : channelCustom // ignore: cast_nullable_to_non_nullable + as Map?, + channelId: freezed == channelId + ? _self.channelId + : channelId // ignore: cast_nullable_to_non_nullable + as String?, + channelMemberCount: freezed == channelMemberCount + ? _self.channelMemberCount + : channelMemberCount // ignore: cast_nullable_to_non_nullable + as int?, + channelMessageCount: freezed == channelMessageCount + ? _self.channelMessageCount + : channelMessageCount // ignore: cast_nullable_to_non_nullable + as int?, + channelType: freezed == channelType + ? _self.channelType + : channelType // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + member: null == member + ? _self.member + : member // ignore: cast_nullable_to_non_nullable + as ChannelMemberResponse, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + team: freezed == team + ? _self.team + : team // ignore: cast_nullable_to_non_nullable + as String?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponseCommonFields?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/member_added_event.g.dart b/packages/stream_chat/lib/open_api/model/member_added_event.g.dart new file mode 100644 index 0000000000..8e543e2d63 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/member_added_event.g.dart @@ -0,0 +1,63 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'member_added_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +MemberAddedEvent _$MemberAddedEventFromJson( + Map json, +) => MemberAddedEvent( + channel: ChannelResponse.fromJson(json['channel'] as Map), + channelCustom: json['channel_custom'] as Map?, + channelId: json['channel_id'] as String?, + channelMemberCount: (json['channel_member_count'] as num?)?.toInt(), + channelMessageCount: (json['channel_message_count'] as num?)?.toInt(), + channelType: json['channel_type'] as String?, + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + member: ChannelMemberResponse.fromJson( + json['member'] as Map, + ), + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + team: json['team'] as String?, + type: json['type'] as String, + user: json['user'] == null ? null : UserResponseCommonFields.fromJson(json['user'] as Map), +); + +Map _$MemberAddedEventToJson(MemberAddedEvent instance) => { + 'channel': instance.channel.toJson(), + 'channel_custom': instance.channelCustom, + 'channel_id': instance.channelId, + 'channel_member_count': instance.channelMemberCount, + 'channel_message_count': instance.channelMessageCount, + 'channel_type': instance.channelType, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'member': instance.member.toJson(), + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'team': instance.team, + 'type': instance.type, + 'user': instance.user?.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/member_removed_event.dart b/packages/stream_chat/lib/open_api/model/member_removed_event.dart new file mode 100644 index 0000000000..e67536ad2e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/member_removed_event.dart @@ -0,0 +1,98 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'member_removed_event.g.dart'; +part 'member_removed_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class MemberRemovedEvent extends core.WsEvent with _$MemberRemovedEvent { + const MemberRemovedEvent({ + required this.channel, + this.channelCustom, + this.channelId, + this.channelMemberCount, + this.channelMessageCount, + this.channelType, + this.cid, + required this.createdAt, + required this.custom, + required this.member, + this.receivedAt, + this.team, + required this.type, + this.user, + }); + + @override + @JsonKey(name: 'channel') + final ChannelResponse channel; + + @override + @JsonKey(name: 'channel_custom') + final Map? channelCustom; + + @override + @JsonKey(name: 'channel_id') + final String? channelId; + + @override + @JsonKey(name: 'channel_member_count') + final int? channelMemberCount; + + @override + @JsonKey(name: 'channel_message_count') + final int? channelMessageCount; + + @override + @JsonKey(name: 'channel_type') + final String? channelType; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'member') + final ChannelMemberResponse member; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'team') + final String? team; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'user') + final UserResponseCommonFields? user; + + Map toJson() => _$MemberRemovedEventToJson(this); + + static MemberRemovedEvent fromJson(Map json) => _$MemberRemovedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/member_removed_event.freezed.dart b/packages/stream_chat/lib/open_api/model/member_removed_event.freezed.dart new file mode 100644 index 0000000000..04eca2f241 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/member_removed_event.freezed.dart @@ -0,0 +1,204 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'member_removed_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$MemberRemovedEvent { + ChannelResponse get channel; + Map? get channelCustom; + String? get channelId; + int? get channelMemberCount; + int? get channelMessageCount; + String? get channelType; + String? get cid; + DateTime get createdAt; + Map get custom; + ChannelMemberResponse get member; + DateTime? get receivedAt; + String? get team; + String get type; + UserResponseCommonFields? get user; + + /// Create a copy of MemberRemovedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $MemberRemovedEventCopyWith get copyWith => _$MemberRemovedEventCopyWithImpl( + this as MemberRemovedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is MemberRemovedEvent && + (identical(other.channel, channel) || other.channel == channel) && + const DeepCollectionEquality().equals( + other.channelCustom, + channelCustom, + ) && + (identical(other.channelId, channelId) || other.channelId == channelId) && + (identical(other.channelMemberCount, channelMemberCount) || + other.channelMemberCount == channelMemberCount) && + (identical(other.channelMessageCount, channelMessageCount) || + other.channelMessageCount == channelMessageCount) && + (identical(other.channelType, channelType) || other.channelType == channelType) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.member, member) || other.member == member) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.team, team) || other.team == team) && + (identical(other.type, type) || other.type == type) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channel, + const DeepCollectionEquality().hash(channelCustom), + channelId, + channelMemberCount, + channelMessageCount, + channelType, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + member, + receivedAt, + team, + type, + user, + ); + + @override + String toString() { + return 'MemberRemovedEvent(channel: $channel, channelCustom: $channelCustom, channelId: $channelId, channelMemberCount: $channelMemberCount, channelMessageCount: $channelMessageCount, channelType: $channelType, cid: $cid, createdAt: $createdAt, custom: $custom, member: $member, receivedAt: $receivedAt, team: $team, type: $type, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $MemberRemovedEventCopyWith<$Res> { + factory $MemberRemovedEventCopyWith( + MemberRemovedEvent value, + $Res Function(MemberRemovedEvent) _then, + ) = _$MemberRemovedEventCopyWithImpl; + @useResult + $Res call({ + ChannelResponse channel, + Map? channelCustom, + String? channelId, + int? channelMemberCount, + int? channelMessageCount, + String? channelType, + String? cid, + DateTime createdAt, + Map custom, + ChannelMemberResponse member, + DateTime? receivedAt, + String? team, + String type, + UserResponseCommonFields? user, + }); +} + +/// @nodoc +class _$MemberRemovedEventCopyWithImpl<$Res> implements $MemberRemovedEventCopyWith<$Res> { + _$MemberRemovedEventCopyWithImpl(this._self, this._then); + + final MemberRemovedEvent _self; + final $Res Function(MemberRemovedEvent) _then; + + /// Create a copy of MemberRemovedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channel = null, + Object? channelCustom = freezed, + Object? channelId = freezed, + Object? channelMemberCount = freezed, + Object? channelMessageCount = freezed, + Object? channelType = freezed, + Object? cid = freezed, + Object? createdAt = null, + Object? custom = null, + Object? member = null, + Object? receivedAt = freezed, + Object? team = freezed, + Object? type = null, + Object? user = freezed, + }) { + return _then( + MemberRemovedEvent( + channel: null == channel + ? _self.channel + : channel // ignore: cast_nullable_to_non_nullable + as ChannelResponse, + channelCustom: freezed == channelCustom + ? _self.channelCustom + : channelCustom // ignore: cast_nullable_to_non_nullable + as Map?, + channelId: freezed == channelId + ? _self.channelId + : channelId // ignore: cast_nullable_to_non_nullable + as String?, + channelMemberCount: freezed == channelMemberCount + ? _self.channelMemberCount + : channelMemberCount // ignore: cast_nullable_to_non_nullable + as int?, + channelMessageCount: freezed == channelMessageCount + ? _self.channelMessageCount + : channelMessageCount // ignore: cast_nullable_to_non_nullable + as int?, + channelType: freezed == channelType + ? _self.channelType + : channelType // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + member: null == member + ? _self.member + : member // ignore: cast_nullable_to_non_nullable + as ChannelMemberResponse, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + team: freezed == team + ? _self.team + : team // ignore: cast_nullable_to_non_nullable + as String?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponseCommonFields?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/member_removed_event.g.dart b/packages/stream_chat/lib/open_api/model/member_removed_event.g.dart new file mode 100644 index 0000000000..aff039c6f0 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/member_removed_event.g.dart @@ -0,0 +1,63 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'member_removed_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +MemberRemovedEvent _$MemberRemovedEventFromJson( + Map json, +) => MemberRemovedEvent( + channel: ChannelResponse.fromJson(json['channel'] as Map), + channelCustom: json['channel_custom'] as Map?, + channelId: json['channel_id'] as String?, + channelMemberCount: (json['channel_member_count'] as num?)?.toInt(), + channelMessageCount: (json['channel_message_count'] as num?)?.toInt(), + channelType: json['channel_type'] as String?, + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + member: ChannelMemberResponse.fromJson( + json['member'] as Map, + ), + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + team: json['team'] as String?, + type: json['type'] as String, + user: json['user'] == null ? null : UserResponseCommonFields.fromJson(json['user'] as Map), +); + +Map _$MemberRemovedEventToJson(MemberRemovedEvent instance) => { + 'channel': instance.channel.toJson(), + 'channel_custom': instance.channelCustom, + 'channel_id': instance.channelId, + 'channel_member_count': instance.channelMemberCount, + 'channel_message_count': instance.channelMessageCount, + 'channel_type': instance.channelType, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'member': instance.member.toJson(), + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'team': instance.team, + 'type': instance.type, + 'user': instance.user?.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/member_updated_event.dart b/packages/stream_chat/lib/open_api/model/member_updated_event.dart new file mode 100644 index 0000000000..4105dc0f5f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/member_updated_event.dart @@ -0,0 +1,98 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'member_updated_event.g.dart'; +part 'member_updated_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class MemberUpdatedEvent extends core.WsEvent with _$MemberUpdatedEvent { + const MemberUpdatedEvent({ + required this.channel, + this.channelCustom, + this.channelId, + this.channelMemberCount, + this.channelMessageCount, + this.channelType, + this.cid, + required this.createdAt, + required this.custom, + required this.member, + this.receivedAt, + this.team, + required this.type, + this.user, + }); + + @override + @JsonKey(name: 'channel') + final ChannelResponse channel; + + @override + @JsonKey(name: 'channel_custom') + final Map? channelCustom; + + @override + @JsonKey(name: 'channel_id') + final String? channelId; + + @override + @JsonKey(name: 'channel_member_count') + final int? channelMemberCount; + + @override + @JsonKey(name: 'channel_message_count') + final int? channelMessageCount; + + @override + @JsonKey(name: 'channel_type') + final String? channelType; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'member') + final ChannelMemberResponse member; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'team') + final String? team; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'user') + final UserResponseCommonFields? user; + + Map toJson() => _$MemberUpdatedEventToJson(this); + + static MemberUpdatedEvent fromJson(Map json) => _$MemberUpdatedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/member_updated_event.freezed.dart b/packages/stream_chat/lib/open_api/model/member_updated_event.freezed.dart new file mode 100644 index 0000000000..05f258e240 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/member_updated_event.freezed.dart @@ -0,0 +1,204 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'member_updated_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$MemberUpdatedEvent { + ChannelResponse get channel; + Map? get channelCustom; + String? get channelId; + int? get channelMemberCount; + int? get channelMessageCount; + String? get channelType; + String? get cid; + DateTime get createdAt; + Map get custom; + ChannelMemberResponse get member; + DateTime? get receivedAt; + String? get team; + String get type; + UserResponseCommonFields? get user; + + /// Create a copy of MemberUpdatedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $MemberUpdatedEventCopyWith get copyWith => _$MemberUpdatedEventCopyWithImpl( + this as MemberUpdatedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is MemberUpdatedEvent && + (identical(other.channel, channel) || other.channel == channel) && + const DeepCollectionEquality().equals( + other.channelCustom, + channelCustom, + ) && + (identical(other.channelId, channelId) || other.channelId == channelId) && + (identical(other.channelMemberCount, channelMemberCount) || + other.channelMemberCount == channelMemberCount) && + (identical(other.channelMessageCount, channelMessageCount) || + other.channelMessageCount == channelMessageCount) && + (identical(other.channelType, channelType) || other.channelType == channelType) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.member, member) || other.member == member) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.team, team) || other.team == team) && + (identical(other.type, type) || other.type == type) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channel, + const DeepCollectionEquality().hash(channelCustom), + channelId, + channelMemberCount, + channelMessageCount, + channelType, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + member, + receivedAt, + team, + type, + user, + ); + + @override + String toString() { + return 'MemberUpdatedEvent(channel: $channel, channelCustom: $channelCustom, channelId: $channelId, channelMemberCount: $channelMemberCount, channelMessageCount: $channelMessageCount, channelType: $channelType, cid: $cid, createdAt: $createdAt, custom: $custom, member: $member, receivedAt: $receivedAt, team: $team, type: $type, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $MemberUpdatedEventCopyWith<$Res> { + factory $MemberUpdatedEventCopyWith( + MemberUpdatedEvent value, + $Res Function(MemberUpdatedEvent) _then, + ) = _$MemberUpdatedEventCopyWithImpl; + @useResult + $Res call({ + ChannelResponse channel, + Map? channelCustom, + String? channelId, + int? channelMemberCount, + int? channelMessageCount, + String? channelType, + String? cid, + DateTime createdAt, + Map custom, + ChannelMemberResponse member, + DateTime? receivedAt, + String? team, + String type, + UserResponseCommonFields? user, + }); +} + +/// @nodoc +class _$MemberUpdatedEventCopyWithImpl<$Res> implements $MemberUpdatedEventCopyWith<$Res> { + _$MemberUpdatedEventCopyWithImpl(this._self, this._then); + + final MemberUpdatedEvent _self; + final $Res Function(MemberUpdatedEvent) _then; + + /// Create a copy of MemberUpdatedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channel = null, + Object? channelCustom = freezed, + Object? channelId = freezed, + Object? channelMemberCount = freezed, + Object? channelMessageCount = freezed, + Object? channelType = freezed, + Object? cid = freezed, + Object? createdAt = null, + Object? custom = null, + Object? member = null, + Object? receivedAt = freezed, + Object? team = freezed, + Object? type = null, + Object? user = freezed, + }) { + return _then( + MemberUpdatedEvent( + channel: null == channel + ? _self.channel + : channel // ignore: cast_nullable_to_non_nullable + as ChannelResponse, + channelCustom: freezed == channelCustom + ? _self.channelCustom + : channelCustom // ignore: cast_nullable_to_non_nullable + as Map?, + channelId: freezed == channelId + ? _self.channelId + : channelId // ignore: cast_nullable_to_non_nullable + as String?, + channelMemberCount: freezed == channelMemberCount + ? _self.channelMemberCount + : channelMemberCount // ignore: cast_nullable_to_non_nullable + as int?, + channelMessageCount: freezed == channelMessageCount + ? _self.channelMessageCount + : channelMessageCount // ignore: cast_nullable_to_non_nullable + as int?, + channelType: freezed == channelType + ? _self.channelType + : channelType // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + member: null == member + ? _self.member + : member // ignore: cast_nullable_to_non_nullable + as ChannelMemberResponse, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + team: freezed == team + ? _self.team + : team // ignore: cast_nullable_to_non_nullable + as String?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponseCommonFields?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/member_updated_event.g.dart b/packages/stream_chat/lib/open_api/model/member_updated_event.g.dart new file mode 100644 index 0000000000..a830e26188 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/member_updated_event.g.dart @@ -0,0 +1,63 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'member_updated_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +MemberUpdatedEvent _$MemberUpdatedEventFromJson( + Map json, +) => MemberUpdatedEvent( + channel: ChannelResponse.fromJson(json['channel'] as Map), + channelCustom: json['channel_custom'] as Map?, + channelId: json['channel_id'] as String?, + channelMemberCount: (json['channel_member_count'] as num?)?.toInt(), + channelMessageCount: (json['channel_message_count'] as num?)?.toInt(), + channelType: json['channel_type'] as String?, + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + member: ChannelMemberResponse.fromJson( + json['member'] as Map, + ), + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + team: json['team'] as String?, + type: json['type'] as String, + user: json['user'] == null ? null : UserResponseCommonFields.fromJson(json['user'] as Map), +); + +Map _$MemberUpdatedEventToJson(MemberUpdatedEvent instance) => { + 'channel': instance.channel.toJson(), + 'channel_custom': instance.channelCustom, + 'channel_id': instance.channelId, + 'channel_member_count': instance.channelMemberCount, + 'channel_message_count': instance.channelMessageCount, + 'channel_type': instance.channelType, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'member': instance.member.toJson(), + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'team': instance.team, + 'type': instance.type, + 'user': instance.user?.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/member_user_request.dart b/packages/stream_chat/lib/open_api/model/member_user_request.dart new file mode 100644 index 0000000000..0faed382fc --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/member_user_request.dart @@ -0,0 +1,61 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'member_user_request.g.dart'; +part 'member_user_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class MemberUserRequest with _$MemberUserRequest { + const MemberUserRequest({ + this.custom, + required this.id, + this.image, + this.invisible, + this.language, + this.name, + this.privacySettings, + }); + + @override + @JsonKey(name: 'custom') + final Map? custom; + + @override + @JsonKey(name: 'id') + final String id; + + @override + @JsonKey(name: 'image') + final String? image; + + @override + @JsonKey(name: 'invisible') + final bool? invisible; + + @override + @JsonKey(name: 'language') + final String? language; + + @override + @JsonKey(name: 'name') + final String? name; + + @override + @JsonKey(name: 'privacy_settings') + final PrivacySettingsResponse? privacySettings; + + Map toJson() => _$MemberUserRequestToJson(this); + + static MemberUserRequest fromJson(Map json) => _$MemberUserRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/member_user_request.freezed.dart b/packages/stream_chat/lib/open_api/model/member_user_request.freezed.dart new file mode 100644 index 0000000000..6b67839d00 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/member_user_request.freezed.dart @@ -0,0 +1,136 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'member_user_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$MemberUserRequest { + Map? get custom; + String get id; + String? get image; + bool? get invisible; + String? get language; + String? get name; + PrivacySettingsResponse? get privacySettings; + + /// Create a copy of MemberUserRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $MemberUserRequestCopyWith get copyWith => _$MemberUserRequestCopyWithImpl( + this as MemberUserRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is MemberUserRequest && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.id, id) || other.id == id) && + (identical(other.image, image) || other.image == image) && + (identical(other.invisible, invisible) || other.invisible == invisible) && + (identical(other.language, language) || other.language == language) && + (identical(other.name, name) || other.name == name) && + (identical(other.privacySettings, privacySettings) || other.privacySettings == privacySettings)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(custom), + id, + image, + invisible, + language, + name, + privacySettings, + ); + + @override + String toString() { + return 'MemberUserRequest(custom: $custom, id: $id, image: $image, invisible: $invisible, language: $language, name: $name, privacySettings: $privacySettings)'; + } +} + +/// @nodoc +abstract mixin class $MemberUserRequestCopyWith<$Res> { + factory $MemberUserRequestCopyWith( + MemberUserRequest value, + $Res Function(MemberUserRequest) _then, + ) = _$MemberUserRequestCopyWithImpl; + @useResult + $Res call({ + Map? custom, + String id, + String? image, + bool? invisible, + String? language, + String? name, + PrivacySettingsResponse? privacySettings, + }); +} + +/// @nodoc +class _$MemberUserRequestCopyWithImpl<$Res> implements $MemberUserRequestCopyWith<$Res> { + _$MemberUserRequestCopyWithImpl(this._self, this._then); + + final MemberUserRequest _self; + final $Res Function(MemberUserRequest) _then; + + /// Create a copy of MemberUserRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? custom = freezed, + Object? id = null, + Object? image = freezed, + Object? invisible = freezed, + Object? language = freezed, + Object? name = freezed, + Object? privacySettings = freezed, + }) { + return _then( + MemberUserRequest( + custom: freezed == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map?, + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + image: freezed == image + ? _self.image + : image // ignore: cast_nullable_to_non_nullable + as String?, + invisible: freezed == invisible + ? _self.invisible + : invisible // ignore: cast_nullable_to_non_nullable + as bool?, + language: freezed == language + ? _self.language + : language // ignore: cast_nullable_to_non_nullable + as String?, + name: freezed == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + privacySettings: freezed == privacySettings + ? _self.privacySettings + : privacySettings // ignore: cast_nullable_to_non_nullable + as PrivacySettingsResponse?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/member_user_request.g.dart b/packages/stream_chat/lib/open_api/model/member_user_request.g.dart new file mode 100644 index 0000000000..f89f56bf96 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/member_user_request.g.dart @@ -0,0 +1,31 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'member_user_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +MemberUserRequest _$MemberUserRequestFromJson(Map json) => MemberUserRequest( + custom: json['custom'] as Map?, + id: json['id'] as String, + image: json['image'] as String?, + invisible: json['invisible'] as bool?, + language: json['language'] as String?, + name: json['name'] as String?, + privacySettings: json['privacy_settings'] == null + ? null + : PrivacySettingsResponse.fromJson( + json['privacy_settings'] as Map, + ), +); + +Map _$MemberUserRequestToJson(MemberUserRequest instance) => { + 'custom': instance.custom, + 'id': instance.id, + 'image': instance.image, + 'invisible': instance.invisible, + 'language': instance.language, + 'name': instance.name, + 'privacy_settings': instance.privacySettings?.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/members_response.dart b/packages/stream_chat/lib/open_api/model/members_response.dart new file mode 100644 index 0000000000..cc15628523 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/members_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'members_response.g.dart'; +part 'members_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class MembersResponse with _$MembersResponse { + const MembersResponse({ + required this.duration, + required this.members, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'members') + final List members; + + Map toJson() => _$MembersResponseToJson(this); + + static MembersResponse fromJson(Map json) => _$MembersResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/members_response.freezed.dart b/packages/stream_chat/lib/open_api/model/members_response.freezed.dart new file mode 100644 index 0000000000..491a0f2cf5 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/members_response.freezed.dart @@ -0,0 +1,85 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'members_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$MembersResponse { + String get duration; + List get members; + + /// Create a copy of MembersResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $MembersResponseCopyWith get copyWith => _$MembersResponseCopyWithImpl( + this as MembersResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is MembersResponse && + (identical(other.duration, duration) || other.duration == duration) && + const DeepCollectionEquality().equals(other.members, members)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + duration, + const DeepCollectionEquality().hash(members), + ); + + @override + String toString() { + return 'MembersResponse(duration: $duration, members: $members)'; + } +} + +/// @nodoc +abstract mixin class $MembersResponseCopyWith<$Res> { + factory $MembersResponseCopyWith( + MembersResponse value, + $Res Function(MembersResponse) _then, + ) = _$MembersResponseCopyWithImpl; + @useResult + $Res call({String duration, List members}); +} + +/// @nodoc +class _$MembersResponseCopyWithImpl<$Res> implements $MembersResponseCopyWith<$Res> { + _$MembersResponseCopyWithImpl(this._self, this._then); + + final MembersResponse _self; + final $Res Function(MembersResponse) _then; + + /// Create a copy of MembersResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? members = null}) { + return _then( + MembersResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + members: null == members + ? _self.members + : members // ignore: cast_nullable_to_non_nullable + as List, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/members_response.g.dart b/packages/stream_chat/lib/open_api/model/members_response.g.dart new file mode 100644 index 0000000000..4f6aa896ee --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/members_response.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'members_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +MembersResponse _$MembersResponseFromJson(Map json) => MembersResponse( + duration: json['duration'] as String, + members: (json['members'] as List) + .map((e) => ChannelMemberResponse.fromJson(e as Map)) + .toList(), +); + +Map _$MembersResponseToJson(MembersResponse instance) => { + 'duration': instance.duration, + 'members': instance.members.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/message_action_request.dart b/packages/stream_chat/lib/open_api/model/message_action_request.dart new file mode 100644 index 0000000000..07e3aae81a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_action_request.dart @@ -0,0 +1,31 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'message_action_request.g.dart'; +part 'message_action_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class MessageActionRequest with _$MessageActionRequest { + const MessageActionRequest({ + required this.formData, + }); + + @override + @JsonKey(name: 'form_data') + final Map formData; + + Map toJson() => _$MessageActionRequestToJson(this); + + static MessageActionRequest fromJson(Map json) => _$MessageActionRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/message_action_request.freezed.dart b/packages/stream_chat/lib/open_api/model/message_action_request.freezed.dart new file mode 100644 index 0000000000..a724b9f38f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_action_request.freezed.dart @@ -0,0 +1,76 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'message_action_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$MessageActionRequest { + Map get formData; + + /// Create a copy of MessageActionRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $MessageActionRequestCopyWith get copyWith => + _$MessageActionRequestCopyWithImpl( + this as MessageActionRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is MessageActionRequest && + const DeepCollectionEquality().equals(other.formData, formData)); + } + + @override + int get hashCode => Object.hash(runtimeType, const DeepCollectionEquality().hash(formData)); + + @override + String toString() { + return 'MessageActionRequest(formData: $formData)'; + } +} + +/// @nodoc +abstract mixin class $MessageActionRequestCopyWith<$Res> { + factory $MessageActionRequestCopyWith( + MessageActionRequest value, + $Res Function(MessageActionRequest) _then, + ) = _$MessageActionRequestCopyWithImpl; + @useResult + $Res call({Map formData}); +} + +/// @nodoc +class _$MessageActionRequestCopyWithImpl<$Res> implements $MessageActionRequestCopyWith<$Res> { + _$MessageActionRequestCopyWithImpl(this._self, this._then); + + final MessageActionRequest _self; + final $Res Function(MessageActionRequest) _then; + + /// Create a copy of MessageActionRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? formData = null}) { + return _then( + MessageActionRequest( + formData: null == formData + ? _self.formData + : formData // ignore: cast_nullable_to_non_nullable + as Map, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/message_action_request.g.dart b/packages/stream_chat/lib/open_api/model/message_action_request.g.dart new file mode 100644 index 0000000000..6093430ffc --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_action_request.g.dart @@ -0,0 +1,17 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'message_action_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +MessageActionRequest _$MessageActionRequestFromJson( + Map json, +) => MessageActionRequest( + formData: Map.from(json['form_data'] as Map), +); + +Map _$MessageActionRequestToJson( + MessageActionRequest instance, +) => {'form_data': instance.formData}; diff --git a/packages/stream_chat/lib/open_api/model/message_action_response.dart b/packages/stream_chat/lib/open_api/model/message_action_response.dart new file mode 100644 index 0000000000..4b323c61c1 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_action_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'message_action_response.g.dart'; +part 'message_action_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class MessageActionResponse with _$MessageActionResponse { + const MessageActionResponse({ + required this.duration, + this.message, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'message') + final MessageResponse? message; + + Map toJson() => _$MessageActionResponseToJson(this); + + static MessageActionResponse fromJson(Map json) => _$MessageActionResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/message_action_response.freezed.dart b/packages/stream_chat/lib/open_api/model/message_action_response.freezed.dart new file mode 100644 index 0000000000..d131b986c8 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_action_response.freezed.dart @@ -0,0 +1,82 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'message_action_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$MessageActionResponse { + String get duration; + MessageResponse? get message; + + /// Create a copy of MessageActionResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $MessageActionResponseCopyWith get copyWith => + _$MessageActionResponseCopyWithImpl( + this as MessageActionResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is MessageActionResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.message, message) || other.message == message)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration, message); + + @override + String toString() { + return 'MessageActionResponse(duration: $duration, message: $message)'; + } +} + +/// @nodoc +abstract mixin class $MessageActionResponseCopyWith<$Res> { + factory $MessageActionResponseCopyWith( + MessageActionResponse value, + $Res Function(MessageActionResponse) _then, + ) = _$MessageActionResponseCopyWithImpl; + @useResult + $Res call({String duration, MessageResponse? message}); +} + +/// @nodoc +class _$MessageActionResponseCopyWithImpl<$Res> implements $MessageActionResponseCopyWith<$Res> { + _$MessageActionResponseCopyWithImpl(this._self, this._then); + + final MessageActionResponse _self; + final $Res Function(MessageActionResponse) _then; + + /// Create a copy of MessageActionResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? message = freezed}) { + return _then( + MessageActionResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + message: freezed == message + ? _self.message + : message // ignore: cast_nullable_to_non_nullable + as MessageResponse?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/message_action_response.g.dart b/packages/stream_chat/lib/open_api/model/message_action_response.g.dart new file mode 100644 index 0000000000..224f7dd145 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_action_response.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'message_action_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +MessageActionResponse _$MessageActionResponseFromJson( + Map json, +) => MessageActionResponse( + duration: json['duration'] as String, + message: json['message'] == null ? null : MessageResponse.fromJson(json['message'] as Map), +); + +Map _$MessageActionResponseToJson( + MessageActionResponse instance, +) => { + 'duration': instance.duration, + 'message': instance.message?.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/message_change_set.dart b/packages/stream_chat/lib/open_api/model/message_change_set.dart new file mode 100644 index 0000000000..dc894ff466 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_change_set.dart @@ -0,0 +1,71 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'message_change_set.g.dart'; +part 'message_change_set.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class MessageChangeSet with _$MessageChangeSet { + const MessageChangeSet({ + required this.attachments, + required this.custom, + required this.html, + required this.mentionedUserIds, + required this.mml, + required this.pin, + required this.quotedMessageId, + required this.silent, + required this.text, + }); + + @override + @JsonKey(name: 'attachments') + final bool attachments; + + @override + @JsonKey(name: 'custom') + final bool custom; + + @override + @JsonKey(name: 'html') + final bool html; + + @override + @JsonKey(name: 'mentioned_user_ids') + final bool mentionedUserIds; + + @override + @JsonKey(name: 'mml') + final bool mml; + + @override + @JsonKey(name: 'pin') + final bool pin; + + @override + @JsonKey(name: 'quoted_message_id') + final bool quotedMessageId; + + @override + @JsonKey(name: 'silent') + final bool silent; + + @override + @JsonKey(name: 'text') + final bool text; + + Map toJson() => _$MessageChangeSetToJson(this); + + static MessageChangeSet fromJson(Map json) => _$MessageChangeSetFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/message_change_set.freezed.dart b/packages/stream_chat/lib/open_api/model/message_change_set.freezed.dart new file mode 100644 index 0000000000..38d089fdcd --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_change_set.freezed.dart @@ -0,0 +1,154 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'message_change_set.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$MessageChangeSet { + bool get attachments; + bool get custom; + bool get html; + bool get mentionedUserIds; + bool get mml; + bool get pin; + bool get quotedMessageId; + bool get silent; + bool get text; + + /// Create a copy of MessageChangeSet + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $MessageChangeSetCopyWith get copyWith => _$MessageChangeSetCopyWithImpl( + this as MessageChangeSet, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is MessageChangeSet && + (identical(other.attachments, attachments) || other.attachments == attachments) && + (identical(other.custom, custom) || other.custom == custom) && + (identical(other.html, html) || other.html == html) && + (identical(other.mentionedUserIds, mentionedUserIds) || other.mentionedUserIds == mentionedUserIds) && + (identical(other.mml, mml) || other.mml == mml) && + (identical(other.pin, pin) || other.pin == pin) && + (identical(other.quotedMessageId, quotedMessageId) || other.quotedMessageId == quotedMessageId) && + (identical(other.silent, silent) || other.silent == silent) && + (identical(other.text, text) || other.text == text)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + attachments, + custom, + html, + mentionedUserIds, + mml, + pin, + quotedMessageId, + silent, + text, + ); + + @override + String toString() { + return 'MessageChangeSet(attachments: $attachments, custom: $custom, html: $html, mentionedUserIds: $mentionedUserIds, mml: $mml, pin: $pin, quotedMessageId: $quotedMessageId, silent: $silent, text: $text)'; + } +} + +/// @nodoc +abstract mixin class $MessageChangeSetCopyWith<$Res> { + factory $MessageChangeSetCopyWith( + MessageChangeSet value, + $Res Function(MessageChangeSet) _then, + ) = _$MessageChangeSetCopyWithImpl; + @useResult + $Res call({ + bool attachments, + bool custom, + bool html, + bool mentionedUserIds, + bool mml, + bool pin, + bool quotedMessageId, + bool silent, + bool text, + }); +} + +/// @nodoc +class _$MessageChangeSetCopyWithImpl<$Res> implements $MessageChangeSetCopyWith<$Res> { + _$MessageChangeSetCopyWithImpl(this._self, this._then); + + final MessageChangeSet _self; + final $Res Function(MessageChangeSet) _then; + + /// Create a copy of MessageChangeSet + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? attachments = null, + Object? custom = null, + Object? html = null, + Object? mentionedUserIds = null, + Object? mml = null, + Object? pin = null, + Object? quotedMessageId = null, + Object? silent = null, + Object? text = null, + }) { + return _then( + MessageChangeSet( + attachments: null == attachments + ? _self.attachments + : attachments // ignore: cast_nullable_to_non_nullable + as bool, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as bool, + html: null == html + ? _self.html + : html // ignore: cast_nullable_to_non_nullable + as bool, + mentionedUserIds: null == mentionedUserIds + ? _self.mentionedUserIds + : mentionedUserIds // ignore: cast_nullable_to_non_nullable + as bool, + mml: null == mml + ? _self.mml + : mml // ignore: cast_nullable_to_non_nullable + as bool, + pin: null == pin + ? _self.pin + : pin // ignore: cast_nullable_to_non_nullable + as bool, + quotedMessageId: null == quotedMessageId + ? _self.quotedMessageId + : quotedMessageId // ignore: cast_nullable_to_non_nullable + as bool, + silent: null == silent + ? _self.silent + : silent // ignore: cast_nullable_to_non_nullable + as bool, + text: null == text + ? _self.text + : text // ignore: cast_nullable_to_non_nullable + as bool, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/message_change_set.g.dart b/packages/stream_chat/lib/open_api/model/message_change_set.g.dart new file mode 100644 index 0000000000..d92da87fc4 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_change_set.g.dart @@ -0,0 +1,31 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'message_change_set.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +MessageChangeSet _$MessageChangeSetFromJson(Map json) => MessageChangeSet( + attachments: json['attachments'] as bool, + custom: json['custom'] as bool, + html: json['html'] as bool, + mentionedUserIds: json['mentioned_user_ids'] as bool, + mml: json['mml'] as bool, + pin: json['pin'] as bool, + quotedMessageId: json['quoted_message_id'] as bool, + silent: json['silent'] as bool, + text: json['text'] as bool, +); + +Map _$MessageChangeSetToJson(MessageChangeSet instance) => { + 'attachments': instance.attachments, + 'custom': instance.custom, + 'html': instance.html, + 'mentioned_user_ids': instance.mentionedUserIds, + 'mml': instance.mml, + 'pin': instance.pin, + 'quoted_message_id': instance.quotedMessageId, + 'silent': instance.silent, + 'text': instance.text, +}; diff --git a/packages/stream_chat/lib/open_api/model/message_deleted_event.dart b/packages/stream_chat/lib/open_api/model/message_deleted_event.dart new file mode 100644 index 0000000000..8a9e7fcd5a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_deleted_event.dart @@ -0,0 +1,108 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'message_deleted_event.g.dart'; +part 'message_deleted_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class MessageDeletedEvent extends core.WsEvent with _$MessageDeletedEvent { + const MessageDeletedEvent({ + this.channelCustom, + this.channelId, + this.channelMemberCount, + this.channelMessageCount, + this.channelType, + this.cid, + required this.createdAt, + required this.custom, + this.deletedForMe, + required this.hardDelete, + required this.message, + required this.messageId, + this.receivedAt, + this.team, + required this.type, + this.user, + }); + + @override + @JsonKey(name: 'channel_custom') + final Map? channelCustom; + + @override + @JsonKey(name: 'channel_id') + final String? channelId; + + @override + @JsonKey(name: 'channel_member_count') + final int? channelMemberCount; + + @override + @JsonKey(name: 'channel_message_count') + final int? channelMessageCount; + + @override + @JsonKey(name: 'channel_type') + final String? channelType; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'deleted_for_me') + final bool? deletedForMe; + + @override + @JsonKey(name: 'hard_delete') + final bool hardDelete; + + @override + @JsonKey(name: 'message') + final MessageResponse message; + + @override + @JsonKey(name: 'message_id') + final String messageId; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'team') + final String? team; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'user') + final UserResponseCommonFields? user; + + Map toJson() => _$MessageDeletedEventToJson(this); + + static MessageDeletedEvent fromJson(Map json) => _$MessageDeletedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/message_deleted_event.freezed.dart b/packages/stream_chat/lib/open_api/model/message_deleted_event.freezed.dart new file mode 100644 index 0000000000..ddd839193b --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_deleted_event.freezed.dart @@ -0,0 +1,223 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'message_deleted_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$MessageDeletedEvent { + Map? get channelCustom; + String? get channelId; + int? get channelMemberCount; + int? get channelMessageCount; + String? get channelType; + String? get cid; + DateTime get createdAt; + Map get custom; + bool? get deletedForMe; + bool get hardDelete; + MessageResponse get message; + String get messageId; + DateTime? get receivedAt; + String? get team; + String get type; + UserResponseCommonFields? get user; + + /// Create a copy of MessageDeletedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $MessageDeletedEventCopyWith get copyWith => + _$MessageDeletedEventCopyWithImpl( + this as MessageDeletedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is MessageDeletedEvent && + const DeepCollectionEquality().equals( + other.channelCustom, + channelCustom, + ) && + (identical(other.channelId, channelId) || other.channelId == channelId) && + (identical(other.channelMemberCount, channelMemberCount) || + other.channelMemberCount == channelMemberCount) && + (identical(other.channelMessageCount, channelMessageCount) || + other.channelMessageCount == channelMessageCount) && + (identical(other.channelType, channelType) || other.channelType == channelType) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.deletedForMe, deletedForMe) || other.deletedForMe == deletedForMe) && + (identical(other.hardDelete, hardDelete) || other.hardDelete == hardDelete) && + (identical(other.message, message) || other.message == message) && + (identical(other.messageId, messageId) || other.messageId == messageId) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.team, team) || other.team == team) && + (identical(other.type, type) || other.type == type) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(channelCustom), + channelId, + channelMemberCount, + channelMessageCount, + channelType, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + deletedForMe, + hardDelete, + message, + messageId, + receivedAt, + team, + type, + user, + ); + + @override + String toString() { + return 'MessageDeletedEvent(channelCustom: $channelCustom, channelId: $channelId, channelMemberCount: $channelMemberCount, channelMessageCount: $channelMessageCount, channelType: $channelType, cid: $cid, createdAt: $createdAt, custom: $custom, deletedForMe: $deletedForMe, hardDelete: $hardDelete, message: $message, messageId: $messageId, receivedAt: $receivedAt, team: $team, type: $type, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $MessageDeletedEventCopyWith<$Res> { + factory $MessageDeletedEventCopyWith( + MessageDeletedEvent value, + $Res Function(MessageDeletedEvent) _then, + ) = _$MessageDeletedEventCopyWithImpl; + @useResult + $Res call({ + Map? channelCustom, + String? channelId, + int? channelMemberCount, + int? channelMessageCount, + String? channelType, + String? cid, + DateTime createdAt, + Map custom, + bool? deletedForMe, + bool hardDelete, + MessageResponse message, + String messageId, + DateTime? receivedAt, + String? team, + String type, + UserResponseCommonFields? user, + }); +} + +/// @nodoc +class _$MessageDeletedEventCopyWithImpl<$Res> implements $MessageDeletedEventCopyWith<$Res> { + _$MessageDeletedEventCopyWithImpl(this._self, this._then); + + final MessageDeletedEvent _self; + final $Res Function(MessageDeletedEvent) _then; + + /// Create a copy of MessageDeletedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channelCustom = freezed, + Object? channelId = freezed, + Object? channelMemberCount = freezed, + Object? channelMessageCount = freezed, + Object? channelType = freezed, + Object? cid = freezed, + Object? createdAt = null, + Object? custom = null, + Object? deletedForMe = freezed, + Object? hardDelete = null, + Object? message = null, + Object? messageId = null, + Object? receivedAt = freezed, + Object? team = freezed, + Object? type = null, + Object? user = freezed, + }) { + return _then( + MessageDeletedEvent( + channelCustom: freezed == channelCustom + ? _self.channelCustom + : channelCustom // ignore: cast_nullable_to_non_nullable + as Map?, + channelId: freezed == channelId + ? _self.channelId + : channelId // ignore: cast_nullable_to_non_nullable + as String?, + channelMemberCount: freezed == channelMemberCount + ? _self.channelMemberCount + : channelMemberCount // ignore: cast_nullable_to_non_nullable + as int?, + channelMessageCount: freezed == channelMessageCount + ? _self.channelMessageCount + : channelMessageCount // ignore: cast_nullable_to_non_nullable + as int?, + channelType: freezed == channelType + ? _self.channelType + : channelType // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + deletedForMe: freezed == deletedForMe + ? _self.deletedForMe + : deletedForMe // ignore: cast_nullable_to_non_nullable + as bool?, + hardDelete: null == hardDelete + ? _self.hardDelete + : hardDelete // ignore: cast_nullable_to_non_nullable + as bool, + message: null == message + ? _self.message + : message // ignore: cast_nullable_to_non_nullable + as MessageResponse, + messageId: null == messageId + ? _self.messageId + : messageId // ignore: cast_nullable_to_non_nullable + as String, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + team: freezed == team + ? _self.team + : team // ignore: cast_nullable_to_non_nullable + as String?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponseCommonFields?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/message_deleted_event.g.dart b/packages/stream_chat/lib/open_api/model/message_deleted_event.g.dart new file mode 100644 index 0000000000..1cc65292b4 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_deleted_event.g.dart @@ -0,0 +1,67 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'message_deleted_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +MessageDeletedEvent _$MessageDeletedEventFromJson( + Map json, +) => MessageDeletedEvent( + channelCustom: json['channel_custom'] as Map?, + channelId: json['channel_id'] as String?, + channelMemberCount: (json['channel_member_count'] as num?)?.toInt(), + channelMessageCount: (json['channel_message_count'] as num?)?.toInt(), + channelType: json['channel_type'] as String?, + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + deletedForMe: json['deleted_for_me'] as bool?, + hardDelete: json['hard_delete'] as bool, + message: MessageResponse.fromJson(json['message'] as Map), + messageId: json['message_id'] as String, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + team: json['team'] as String?, + type: json['type'] as String, + user: json['user'] == null ? null : UserResponseCommonFields.fromJson(json['user'] as Map), +); + +Map _$MessageDeletedEventToJson( + MessageDeletedEvent instance, +) => { + 'channel_custom': instance.channelCustom, + 'channel_id': instance.channelId, + 'channel_member_count': instance.channelMemberCount, + 'channel_message_count': instance.channelMessageCount, + 'channel_type': instance.channelType, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'deleted_for_me': instance.deletedForMe, + 'hard_delete': instance.hardDelete, + 'message': instance.message.toJson(), + 'message_id': instance.messageId, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'team': instance.team, + 'type': instance.type, + 'user': instance.user?.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/message_delivered_event.dart b/packages/stream_chat/lib/open_api/model/message_delivered_event.dart new file mode 100644 index 0000000000..fa682eee33 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_delivered_event.dart @@ -0,0 +1,103 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'message_delivered_event.g.dart'; +part 'message_delivered_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class MessageDeliveredEvent extends core.WsEvent with _$MessageDeliveredEvent { + const MessageDeliveredEvent({ + this.channel, + this.channelCustom, + this.channelId, + this.channelMemberCount, + this.channelMessageCount, + this.channelType, + this.cid, + required this.createdAt, + required this.custom, + this.lastDeliveredAt, + this.lastDeliveredMessageId, + this.receivedAt, + this.team, + required this.type, + this.user, + }); + + @override + @JsonKey(name: 'channel') + final ChannelResponse? channel; + + @override + @JsonKey(name: 'channel_custom') + final Map? channelCustom; + + @override + @JsonKey(name: 'channel_id') + final String? channelId; + + @override + @JsonKey(name: 'channel_member_count') + final int? channelMemberCount; + + @override + @JsonKey(name: 'channel_message_count') + final int? channelMessageCount; + + @override + @JsonKey(name: 'channel_type') + final String? channelType; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'last_delivered_at') + final String? lastDeliveredAt; + + @override + @JsonKey(name: 'last_delivered_message_id') + final String? lastDeliveredMessageId; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'team') + final String? team; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'user') + final UserResponseCommonFields? user; + + Map toJson() => _$MessageDeliveredEventToJson(this); + + static MessageDeliveredEvent fromJson(Map json) => _$MessageDeliveredEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/message_delivered_event.freezed.dart b/packages/stream_chat/lib/open_api/model/message_delivered_event.freezed.dart new file mode 100644 index 0000000000..bd931cc0a2 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_delivered_event.freezed.dart @@ -0,0 +1,215 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'message_delivered_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$MessageDeliveredEvent { + ChannelResponse? get channel; + Map? get channelCustom; + String? get channelId; + int? get channelMemberCount; + int? get channelMessageCount; + String? get channelType; + String? get cid; + DateTime get createdAt; + Map get custom; + String? get lastDeliveredAt; + String? get lastDeliveredMessageId; + DateTime? get receivedAt; + String? get team; + String get type; + UserResponseCommonFields? get user; + + /// Create a copy of MessageDeliveredEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $MessageDeliveredEventCopyWith get copyWith => + _$MessageDeliveredEventCopyWithImpl( + this as MessageDeliveredEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is MessageDeliveredEvent && + (identical(other.channel, channel) || other.channel == channel) && + const DeepCollectionEquality().equals( + other.channelCustom, + channelCustom, + ) && + (identical(other.channelId, channelId) || other.channelId == channelId) && + (identical(other.channelMemberCount, channelMemberCount) || + other.channelMemberCount == channelMemberCount) && + (identical(other.channelMessageCount, channelMessageCount) || + other.channelMessageCount == channelMessageCount) && + (identical(other.channelType, channelType) || other.channelType == channelType) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.lastDeliveredAt, lastDeliveredAt) || other.lastDeliveredAt == lastDeliveredAt) && + (identical(other.lastDeliveredMessageId, lastDeliveredMessageId) || + other.lastDeliveredMessageId == lastDeliveredMessageId) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.team, team) || other.team == team) && + (identical(other.type, type) || other.type == type) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channel, + const DeepCollectionEquality().hash(channelCustom), + channelId, + channelMemberCount, + channelMessageCount, + channelType, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + lastDeliveredAt, + lastDeliveredMessageId, + receivedAt, + team, + type, + user, + ); + + @override + String toString() { + return 'MessageDeliveredEvent(channel: $channel, channelCustom: $channelCustom, channelId: $channelId, channelMemberCount: $channelMemberCount, channelMessageCount: $channelMessageCount, channelType: $channelType, cid: $cid, createdAt: $createdAt, custom: $custom, lastDeliveredAt: $lastDeliveredAt, lastDeliveredMessageId: $lastDeliveredMessageId, receivedAt: $receivedAt, team: $team, type: $type, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $MessageDeliveredEventCopyWith<$Res> { + factory $MessageDeliveredEventCopyWith( + MessageDeliveredEvent value, + $Res Function(MessageDeliveredEvent) _then, + ) = _$MessageDeliveredEventCopyWithImpl; + @useResult + $Res call({ + ChannelResponse? channel, + Map? channelCustom, + String? channelId, + int? channelMemberCount, + int? channelMessageCount, + String? channelType, + String? cid, + DateTime createdAt, + Map custom, + String? lastDeliveredAt, + String? lastDeliveredMessageId, + DateTime? receivedAt, + String? team, + String type, + UserResponseCommonFields? user, + }); +} + +/// @nodoc +class _$MessageDeliveredEventCopyWithImpl<$Res> implements $MessageDeliveredEventCopyWith<$Res> { + _$MessageDeliveredEventCopyWithImpl(this._self, this._then); + + final MessageDeliveredEvent _self; + final $Res Function(MessageDeliveredEvent) _then; + + /// Create a copy of MessageDeliveredEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channel = freezed, + Object? channelCustom = freezed, + Object? channelId = freezed, + Object? channelMemberCount = freezed, + Object? channelMessageCount = freezed, + Object? channelType = freezed, + Object? cid = freezed, + Object? createdAt = null, + Object? custom = null, + Object? lastDeliveredAt = freezed, + Object? lastDeliveredMessageId = freezed, + Object? receivedAt = freezed, + Object? team = freezed, + Object? type = null, + Object? user = freezed, + }) { + return _then( + MessageDeliveredEvent( + channel: freezed == channel + ? _self.channel + : channel // ignore: cast_nullable_to_non_nullable + as ChannelResponse?, + channelCustom: freezed == channelCustom + ? _self.channelCustom + : channelCustom // ignore: cast_nullable_to_non_nullable + as Map?, + channelId: freezed == channelId + ? _self.channelId + : channelId // ignore: cast_nullable_to_non_nullable + as String?, + channelMemberCount: freezed == channelMemberCount + ? _self.channelMemberCount + : channelMemberCount // ignore: cast_nullable_to_non_nullable + as int?, + channelMessageCount: freezed == channelMessageCount + ? _self.channelMessageCount + : channelMessageCount // ignore: cast_nullable_to_non_nullable + as int?, + channelType: freezed == channelType + ? _self.channelType + : channelType // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + lastDeliveredAt: freezed == lastDeliveredAt + ? _self.lastDeliveredAt + : lastDeliveredAt // ignore: cast_nullable_to_non_nullable + as String?, + lastDeliveredMessageId: freezed == lastDeliveredMessageId + ? _self.lastDeliveredMessageId + : lastDeliveredMessageId // ignore: cast_nullable_to_non_nullable + as String?, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + team: freezed == team + ? _self.team + : team // ignore: cast_nullable_to_non_nullable + as String?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponseCommonFields?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/message_delivered_event.g.dart b/packages/stream_chat/lib/open_api/model/message_delivered_event.g.dart new file mode 100644 index 0000000000..8e50c17c61 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_delivered_event.g.dart @@ -0,0 +1,65 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'message_delivered_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +MessageDeliveredEvent _$MessageDeliveredEventFromJson( + Map json, +) => MessageDeliveredEvent( + channel: json['channel'] == null ? null : ChannelResponse.fromJson(json['channel'] as Map), + channelCustom: json['channel_custom'] as Map?, + channelId: json['channel_id'] as String?, + channelMemberCount: (json['channel_member_count'] as num?)?.toInt(), + channelMessageCount: (json['channel_message_count'] as num?)?.toInt(), + channelType: json['channel_type'] as String?, + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + lastDeliveredAt: json['last_delivered_at'] as String?, + lastDeliveredMessageId: json['last_delivered_message_id'] as String?, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + team: json['team'] as String?, + type: json['type'] as String, + user: json['user'] == null ? null : UserResponseCommonFields.fromJson(json['user'] as Map), +); + +Map _$MessageDeliveredEventToJson( + MessageDeliveredEvent instance, +) => { + 'channel': instance.channel?.toJson(), + 'channel_custom': instance.channelCustom, + 'channel_id': instance.channelId, + 'channel_member_count': instance.channelMemberCount, + 'channel_message_count': instance.channelMessageCount, + 'channel_type': instance.channelType, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'last_delivered_at': instance.lastDeliveredAt, + 'last_delivered_message_id': instance.lastDeliveredMessageId, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'team': instance.team, + 'type': instance.type, + 'user': instance.user?.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/message_flag_response.dart b/packages/stream_chat/lib/open_api/model/message_flag_response.dart new file mode 100644 index 0000000000..0434f33b7c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_flag_response.dart @@ -0,0 +1,101 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'message_flag_response.g.dart'; +part 'message_flag_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class MessageFlagResponse with _$MessageFlagResponse { + const MessageFlagResponse({ + this.approvedAt, + required this.createdAt, + required this.createdByAutomod, + this.custom, + this.details, + this.message, + this.moderationFeedback, + this.moderationResult, + this.reason, + this.rejectedAt, + this.reviewedAt, + this.reviewedBy, + required this.updatedAt, + this.user, + }); + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'approved_at') + final DateTime? approvedAt; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'created_by_automod') + final bool createdByAutomod; + + @override + @JsonKey(name: 'custom') + final Map? custom; + + @override + @JsonKey(name: 'details') + final FlagDetailsResponse? details; + + @override + @JsonKey(name: 'message') + final MessageResponse? message; + + @override + @JsonKey(name: 'moderation_feedback') + final FlagFeedbackResponse? moderationFeedback; + + @override + @JsonKey(name: 'moderation_result') + final MessageModerationResult? moderationResult; + + @override + @JsonKey(name: 'reason') + final String? reason; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'rejected_at') + final DateTime? rejectedAt; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'reviewed_at') + final DateTime? reviewedAt; + + @override + @JsonKey(name: 'reviewed_by') + final UserResponse? reviewedBy; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'updated_at') + final DateTime updatedAt; + + @override + @JsonKey(name: 'user') + final UserResponse? user; + + Map toJson() => _$MessageFlagResponseToJson(this); + + static MessageFlagResponse fromJson(Map json) => _$MessageFlagResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/message_flag_response.freezed.dart b/packages/stream_chat/lib/open_api/model/message_flag_response.freezed.dart new file mode 100644 index 0000000000..53278d2044 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_flag_response.freezed.dart @@ -0,0 +1,201 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'message_flag_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$MessageFlagResponse { + DateTime? get approvedAt; + DateTime get createdAt; + bool get createdByAutomod; + Map? get custom; + FlagDetailsResponse? get details; + MessageResponse? get message; + FlagFeedbackResponse? get moderationFeedback; + MessageModerationResult? get moderationResult; + String? get reason; + DateTime? get rejectedAt; + DateTime? get reviewedAt; + UserResponse? get reviewedBy; + DateTime get updatedAt; + UserResponse? get user; + + /// Create a copy of MessageFlagResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $MessageFlagResponseCopyWith get copyWith => + _$MessageFlagResponseCopyWithImpl( + this as MessageFlagResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is MessageFlagResponse && + (identical(other.approvedAt, approvedAt) || other.approvedAt == approvedAt) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.createdByAutomod, createdByAutomod) || other.createdByAutomod == createdByAutomod) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.details, details) || other.details == details) && + (identical(other.message, message) || other.message == message) && + (identical(other.moderationFeedback, moderationFeedback) || + other.moderationFeedback == moderationFeedback) && + (identical(other.moderationResult, moderationResult) || other.moderationResult == moderationResult) && + (identical(other.reason, reason) || other.reason == reason) && + (identical(other.rejectedAt, rejectedAt) || other.rejectedAt == rejectedAt) && + (identical(other.reviewedAt, reviewedAt) || other.reviewedAt == reviewedAt) && + (identical(other.reviewedBy, reviewedBy) || other.reviewedBy == reviewedBy) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + approvedAt, + createdAt, + createdByAutomod, + const DeepCollectionEquality().hash(custom), + details, + message, + moderationFeedback, + moderationResult, + reason, + rejectedAt, + reviewedAt, + reviewedBy, + updatedAt, + user, + ); + + @override + String toString() { + return 'MessageFlagResponse(approvedAt: $approvedAt, createdAt: $createdAt, createdByAutomod: $createdByAutomod, custom: $custom, details: $details, message: $message, moderationFeedback: $moderationFeedback, moderationResult: $moderationResult, reason: $reason, rejectedAt: $rejectedAt, reviewedAt: $reviewedAt, reviewedBy: $reviewedBy, updatedAt: $updatedAt, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $MessageFlagResponseCopyWith<$Res> { + factory $MessageFlagResponseCopyWith( + MessageFlagResponse value, + $Res Function(MessageFlagResponse) _then, + ) = _$MessageFlagResponseCopyWithImpl; + @useResult + $Res call({ + DateTime? approvedAt, + DateTime createdAt, + bool createdByAutomod, + Map? custom, + FlagDetailsResponse? details, + MessageResponse? message, + FlagFeedbackResponse? moderationFeedback, + MessageModerationResult? moderationResult, + String? reason, + DateTime? rejectedAt, + DateTime? reviewedAt, + UserResponse? reviewedBy, + DateTime updatedAt, + UserResponse? user, + }); +} + +/// @nodoc +class _$MessageFlagResponseCopyWithImpl<$Res> implements $MessageFlagResponseCopyWith<$Res> { + _$MessageFlagResponseCopyWithImpl(this._self, this._then); + + final MessageFlagResponse _self; + final $Res Function(MessageFlagResponse) _then; + + /// Create a copy of MessageFlagResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? approvedAt = freezed, + Object? createdAt = null, + Object? createdByAutomod = null, + Object? custom = freezed, + Object? details = freezed, + Object? message = freezed, + Object? moderationFeedback = freezed, + Object? moderationResult = freezed, + Object? reason = freezed, + Object? rejectedAt = freezed, + Object? reviewedAt = freezed, + Object? reviewedBy = freezed, + Object? updatedAt = null, + Object? user = freezed, + }) { + return _then( + MessageFlagResponse( + approvedAt: freezed == approvedAt + ? _self.approvedAt + : approvedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + createdByAutomod: null == createdByAutomod + ? _self.createdByAutomod + : createdByAutomod // ignore: cast_nullable_to_non_nullable + as bool, + custom: freezed == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map?, + details: freezed == details + ? _self.details + : details // ignore: cast_nullable_to_non_nullable + as FlagDetailsResponse?, + message: freezed == message + ? _self.message + : message // ignore: cast_nullable_to_non_nullable + as MessageResponse?, + moderationFeedback: freezed == moderationFeedback + ? _self.moderationFeedback + : moderationFeedback // ignore: cast_nullable_to_non_nullable + as FlagFeedbackResponse?, + moderationResult: freezed == moderationResult + ? _self.moderationResult + : moderationResult // ignore: cast_nullable_to_non_nullable + as MessageModerationResult?, + reason: freezed == reason + ? _self.reason + : reason // ignore: cast_nullable_to_non_nullable + as String?, + rejectedAt: freezed == rejectedAt + ? _self.rejectedAt + : rejectedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + reviewedAt: freezed == reviewedAt + ? _self.reviewedAt + : reviewedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + reviewedBy: freezed == reviewedBy + ? _self.reviewedBy + : reviewedBy // ignore: cast_nullable_to_non_nullable + as UserResponse?, + updatedAt: null == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponse?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/message_flag_response.g.dart b/packages/stream_chat/lib/open_api/model/message_flag_response.g.dart new file mode 100644 index 0000000000..6d7f8533e4 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_flag_response.g.dart @@ -0,0 +1,87 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'message_flag_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +MessageFlagResponse _$MessageFlagResponseFromJson(Map json) => MessageFlagResponse( + approvedAt: _$JsonConverterFromJson( + json['approved_at'], + const StreamDateTimeConverter().fromJson, + ), + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + createdByAutomod: json['created_by_automod'] as bool, + custom: json['custom'] as Map?, + details: json['details'] == null + ? null + : FlagDetailsResponse.fromJson( + json['details'] as Map, + ), + message: json['message'] == null ? null : MessageResponse.fromJson(json['message'] as Map), + moderationFeedback: json['moderation_feedback'] == null + ? null + : FlagFeedbackResponse.fromJson( + json['moderation_feedback'] as Map, + ), + moderationResult: json['moderation_result'] == null + ? null + : MessageModerationResult.fromJson( + json['moderation_result'] as Map, + ), + reason: json['reason'] as String?, + rejectedAt: _$JsonConverterFromJson( + json['rejected_at'], + const StreamDateTimeConverter().fromJson, + ), + reviewedAt: _$JsonConverterFromJson( + json['reviewed_at'], + const StreamDateTimeConverter().fromJson, + ), + reviewedBy: json['reviewed_by'] == null ? null : UserResponse.fromJson(json['reviewed_by'] as Map), + updatedAt: const StreamDateTimeConverter().fromJson( + json['updated_at'] as Object, + ), + user: json['user'] == null ? null : UserResponse.fromJson(json['user'] as Map), +); + +Map _$MessageFlagResponseToJson( + MessageFlagResponse instance, +) => { + 'approved_at': _$JsonConverterToJson( + instance.approvedAt, + const StreamDateTimeConverter().toJson, + ), + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'created_by_automod': instance.createdByAutomod, + 'custom': instance.custom, + 'details': instance.details?.toJson(), + 'message': instance.message?.toJson(), + 'moderation_feedback': instance.moderationFeedback?.toJson(), + 'moderation_result': instance.moderationResult?.toJson(), + 'reason': instance.reason, + 'rejected_at': _$JsonConverterToJson( + instance.rejectedAt, + const StreamDateTimeConverter().toJson, + ), + 'reviewed_at': _$JsonConverterToJson( + instance.reviewedAt, + const StreamDateTimeConverter().toJson, + ), + 'reviewed_by': instance.reviewedBy?.toJson(), + 'updated_at': const StreamDateTimeConverter().toJson(instance.updatedAt), + 'user': instance.user?.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/message_moderation_result.dart b/packages/stream_chat/lib/open_api/model/message_moderation_result.dart new file mode 100644 index 0000000000..da93ee4223 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_moderation_result.dart @@ -0,0 +1,83 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'message_moderation_result.g.dart'; +part 'message_moderation_result.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class MessageModerationResult with _$MessageModerationResult { + const MessageModerationResult({ + required this.action, + this.aiModerationResponse, + this.blockedWord, + this.blocklistName, + required this.createdAt, + required this.messageId, + this.moderatedBy, + this.moderationThresholds, + required this.updatedAt, + required this.userBadKarma, + required this.userKarma, + }); + + @override + @JsonKey(name: 'action') + final String action; + + @override + @JsonKey(name: 'ai_moderation_response') + final ModerationResponse? aiModerationResponse; + + @override + @JsonKey(name: 'blocked_word') + final String? blockedWord; + + @override + @JsonKey(name: 'blocklist_name') + final String? blocklistName; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'message_id') + final String messageId; + + @override + @JsonKey(name: 'moderated_by') + final String? moderatedBy; + + @override + @JsonKey(name: 'moderation_thresholds') + final Thresholds? moderationThresholds; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'updated_at') + final DateTime updatedAt; + + @override + @JsonKey(name: 'user_bad_karma') + final bool userBadKarma; + + @override + @JsonKey(name: 'user_karma') + final double userKarma; + + Map toJson() => _$MessageModerationResultToJson(this); + + static MessageModerationResult fromJson(Map json) => _$MessageModerationResultFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/message_moderation_result.freezed.dart b/packages/stream_chat/lib/open_api/model/message_moderation_result.freezed.dart new file mode 100644 index 0000000000..b0ad77de68 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_moderation_result.freezed.dart @@ -0,0 +1,175 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'message_moderation_result.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$MessageModerationResult { + String get action; + ModerationResponse? get aiModerationResponse; + String? get blockedWord; + String? get blocklistName; + DateTime get createdAt; + String get messageId; + String? get moderatedBy; + Thresholds? get moderationThresholds; + DateTime get updatedAt; + bool get userBadKarma; + double get userKarma; + + /// Create a copy of MessageModerationResult + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $MessageModerationResultCopyWith get copyWith => + _$MessageModerationResultCopyWithImpl( + this as MessageModerationResult, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is MessageModerationResult && + (identical(other.action, action) || other.action == action) && + (identical(other.aiModerationResponse, aiModerationResponse) || + other.aiModerationResponse == aiModerationResponse) && + (identical(other.blockedWord, blockedWord) || other.blockedWord == blockedWord) && + (identical(other.blocklistName, blocklistName) || other.blocklistName == blocklistName) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.messageId, messageId) || other.messageId == messageId) && + (identical(other.moderatedBy, moderatedBy) || other.moderatedBy == moderatedBy) && + (identical(other.moderationThresholds, moderationThresholds) || + other.moderationThresholds == moderationThresholds) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt) && + (identical(other.userBadKarma, userBadKarma) || other.userBadKarma == userBadKarma) && + (identical(other.userKarma, userKarma) || other.userKarma == userKarma)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + action, + aiModerationResponse, + blockedWord, + blocklistName, + createdAt, + messageId, + moderatedBy, + moderationThresholds, + updatedAt, + userBadKarma, + userKarma, + ); + + @override + String toString() { + return 'MessageModerationResult(action: $action, aiModerationResponse: $aiModerationResponse, blockedWord: $blockedWord, blocklistName: $blocklistName, createdAt: $createdAt, messageId: $messageId, moderatedBy: $moderatedBy, moderationThresholds: $moderationThresholds, updatedAt: $updatedAt, userBadKarma: $userBadKarma, userKarma: $userKarma)'; + } +} + +/// @nodoc +abstract mixin class $MessageModerationResultCopyWith<$Res> { + factory $MessageModerationResultCopyWith( + MessageModerationResult value, + $Res Function(MessageModerationResult) _then, + ) = _$MessageModerationResultCopyWithImpl; + @useResult + $Res call({ + String action, + ModerationResponse? aiModerationResponse, + String? blockedWord, + String? blocklistName, + DateTime createdAt, + String messageId, + String? moderatedBy, + Thresholds? moderationThresholds, + DateTime updatedAt, + bool userBadKarma, + double userKarma, + }); +} + +/// @nodoc +class _$MessageModerationResultCopyWithImpl<$Res> implements $MessageModerationResultCopyWith<$Res> { + _$MessageModerationResultCopyWithImpl(this._self, this._then); + + final MessageModerationResult _self; + final $Res Function(MessageModerationResult) _then; + + /// Create a copy of MessageModerationResult + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? action = null, + Object? aiModerationResponse = freezed, + Object? blockedWord = freezed, + Object? blocklistName = freezed, + Object? createdAt = null, + Object? messageId = null, + Object? moderatedBy = freezed, + Object? moderationThresholds = freezed, + Object? updatedAt = null, + Object? userBadKarma = null, + Object? userKarma = null, + }) { + return _then( + MessageModerationResult( + action: null == action + ? _self.action + : action // ignore: cast_nullable_to_non_nullable + as String, + aiModerationResponse: freezed == aiModerationResponse + ? _self.aiModerationResponse + : aiModerationResponse // ignore: cast_nullable_to_non_nullable + as ModerationResponse?, + blockedWord: freezed == blockedWord + ? _self.blockedWord + : blockedWord // ignore: cast_nullable_to_non_nullable + as String?, + blocklistName: freezed == blocklistName + ? _self.blocklistName + : blocklistName // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + messageId: null == messageId + ? _self.messageId + : messageId // ignore: cast_nullable_to_non_nullable + as String, + moderatedBy: freezed == moderatedBy + ? _self.moderatedBy + : moderatedBy // ignore: cast_nullable_to_non_nullable + as String?, + moderationThresholds: freezed == moderationThresholds + ? _self.moderationThresholds + : moderationThresholds // ignore: cast_nullable_to_non_nullable + as Thresholds?, + updatedAt: null == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + userBadKarma: null == userBadKarma + ? _self.userBadKarma + : userBadKarma // ignore: cast_nullable_to_non_nullable + as bool, + userKarma: null == userKarma + ? _self.userKarma + : userKarma // ignore: cast_nullable_to_non_nullable + as double, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/message_moderation_result.g.dart b/packages/stream_chat/lib/open_api/model/message_moderation_result.g.dart new file mode 100644 index 0000000000..15b3ca01f2 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_moderation_result.g.dart @@ -0,0 +1,51 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'message_moderation_result.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +MessageModerationResult _$MessageModerationResultFromJson( + Map json, +) => MessageModerationResult( + action: json['action'] as String, + aiModerationResponse: json['ai_moderation_response'] == null + ? null + : ModerationResponse.fromJson( + json['ai_moderation_response'] as Map, + ), + blockedWord: json['blocked_word'] as String?, + blocklistName: json['blocklist_name'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + messageId: json['message_id'] as String, + moderatedBy: json['moderated_by'] as String?, + moderationThresholds: json['moderation_thresholds'] == null + ? null + : Thresholds.fromJson( + json['moderation_thresholds'] as Map, + ), + updatedAt: const StreamDateTimeConverter().fromJson( + json['updated_at'] as Object, + ), + userBadKarma: json['user_bad_karma'] as bool, + userKarma: (json['user_karma'] as num).toDouble(), +); + +Map _$MessageModerationResultToJson( + MessageModerationResult instance, +) => { + 'action': instance.action, + 'ai_moderation_response': instance.aiModerationResponse?.toJson(), + 'blocked_word': instance.blockedWord, + 'blocklist_name': instance.blocklistName, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'message_id': instance.messageId, + 'moderated_by': instance.moderatedBy, + 'moderation_thresholds': instance.moderationThresholds?.toJson(), + 'updated_at': const StreamDateTimeConverter().toJson(instance.updatedAt), + 'user_bad_karma': instance.userBadKarma, + 'user_karma': instance.userKarma, +}; diff --git a/packages/stream_chat/lib/open_api/model/message_new_event.dart b/packages/stream_chat/lib/open_api/model/message_new_event.dart new file mode 100644 index 0000000000..124a8cdc32 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_new_event.dart @@ -0,0 +1,138 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'message_new_event.g.dart'; +part 'message_new_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class MessageNewEvent extends core.WsEvent with _$MessageNewEvent { + const MessageNewEvent({ + this.channel, + this.channelCustom, + this.channelId, + this.channelMemberCount, + this.channelMessageCount, + this.channelType, + this.cid, + required this.createdAt, + required this.custom, + this.groupedUnreadChannels, + required this.message, + required this.messageId, + this.parentAuthor, + this.receivedAt, + this.team, + this.threadParticipants, + this.totalUnreadCount, + required this.type, + this.unreadChannels, + this.unreadCount, + this.user, + required this.watcherCount, + }); + + @override + @JsonKey(name: 'channel') + final ChannelResponse? channel; + + @override + @JsonKey(name: 'channel_custom') + final Map? channelCustom; + + @override + @JsonKey(name: 'channel_id') + final String? channelId; + + @override + @JsonKey(name: 'channel_member_count') + final int? channelMemberCount; + + @override + @JsonKey(name: 'channel_message_count') + final int? channelMessageCount; + + @override + @JsonKey(name: 'channel_type') + final String? channelType; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'grouped_unread_channels') + final Map? groupedUnreadChannels; + + @override + @JsonKey(name: 'message') + final MessageResponse message; + + @override + @JsonKey(name: 'message_id') + final String messageId; + + @override + @JsonKey(name: 'parent_author') + final String? parentAuthor; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'team') + final String? team; + + @override + @JsonKey(name: 'thread_participants') + final List? threadParticipants; + + @override + @JsonKey(name: 'total_unread_count') + final int? totalUnreadCount; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'unread_channels') + final int? unreadChannels; + + @override + @JsonKey(name: 'unread_count') + final int? unreadCount; + + @override + @JsonKey(name: 'user') + final UserResponseCommonFields? user; + + @override + @JsonKey(name: 'watcher_count') + final int watcherCount; + + Map toJson() => _$MessageNewEventToJson(this); + + static MessageNewEvent fromJson(Map json) => _$MessageNewEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/message_new_event.freezed.dart b/packages/stream_chat/lib/open_api/model/message_new_event.freezed.dart new file mode 100644 index 0000000000..85aa0f87c0 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_new_event.freezed.dart @@ -0,0 +1,282 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'message_new_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$MessageNewEvent { + ChannelResponse? get channel; + Map? get channelCustom; + String? get channelId; + int? get channelMemberCount; + int? get channelMessageCount; + String? get channelType; + String? get cid; + DateTime get createdAt; + Map get custom; + Map? get groupedUnreadChannels; + MessageResponse get message; + String get messageId; + String? get parentAuthor; + DateTime? get receivedAt; + String? get team; + List? get threadParticipants; + int? get totalUnreadCount; + String get type; + int? get unreadChannels; + int? get unreadCount; + UserResponseCommonFields? get user; + int get watcherCount; + + /// Create a copy of MessageNewEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $MessageNewEventCopyWith get copyWith => _$MessageNewEventCopyWithImpl( + this as MessageNewEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is MessageNewEvent && + (identical(other.channel, channel) || other.channel == channel) && + const DeepCollectionEquality().equals( + other.channelCustom, + channelCustom, + ) && + (identical(other.channelId, channelId) || other.channelId == channelId) && + (identical(other.channelMemberCount, channelMemberCount) || + other.channelMemberCount == channelMemberCount) && + (identical(other.channelMessageCount, channelMessageCount) || + other.channelMessageCount == channelMessageCount) && + (identical(other.channelType, channelType) || other.channelType == channelType) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + const DeepCollectionEquality().equals( + other.groupedUnreadChannels, + groupedUnreadChannels, + ) && + (identical(other.message, message) || other.message == message) && + (identical(other.messageId, messageId) || other.messageId == messageId) && + (identical(other.parentAuthor, parentAuthor) || other.parentAuthor == parentAuthor) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.team, team) || other.team == team) && + const DeepCollectionEquality().equals( + other.threadParticipants, + threadParticipants, + ) && + (identical(other.totalUnreadCount, totalUnreadCount) || other.totalUnreadCount == totalUnreadCount) && + (identical(other.type, type) || other.type == type) && + (identical(other.unreadChannels, unreadChannels) || other.unreadChannels == unreadChannels) && + (identical(other.unreadCount, unreadCount) || other.unreadCount == unreadCount) && + (identical(other.user, user) || other.user == user) && + (identical(other.watcherCount, watcherCount) || other.watcherCount == watcherCount)); + } + + @override + int get hashCode => Object.hashAll([ + runtimeType, + channel, + const DeepCollectionEquality().hash(channelCustom), + channelId, + channelMemberCount, + channelMessageCount, + channelType, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + const DeepCollectionEquality().hash(groupedUnreadChannels), + message, + messageId, + parentAuthor, + receivedAt, + team, + const DeepCollectionEquality().hash(threadParticipants), + totalUnreadCount, + type, + unreadChannels, + unreadCount, + user, + watcherCount, + ]); + + @override + String toString() { + return 'MessageNewEvent(channel: $channel, channelCustom: $channelCustom, channelId: $channelId, channelMemberCount: $channelMemberCount, channelMessageCount: $channelMessageCount, channelType: $channelType, cid: $cid, createdAt: $createdAt, custom: $custom, groupedUnreadChannels: $groupedUnreadChannels, message: $message, messageId: $messageId, parentAuthor: $parentAuthor, receivedAt: $receivedAt, team: $team, threadParticipants: $threadParticipants, totalUnreadCount: $totalUnreadCount, type: $type, unreadChannels: $unreadChannels, unreadCount: $unreadCount, user: $user, watcherCount: $watcherCount)'; + } +} + +/// @nodoc +abstract mixin class $MessageNewEventCopyWith<$Res> { + factory $MessageNewEventCopyWith( + MessageNewEvent value, + $Res Function(MessageNewEvent) _then, + ) = _$MessageNewEventCopyWithImpl; + @useResult + $Res call({ + ChannelResponse? channel, + Map? channelCustom, + String? channelId, + int? channelMemberCount, + int? channelMessageCount, + String? channelType, + String? cid, + DateTime createdAt, + Map custom, + Map? groupedUnreadChannels, + MessageResponse message, + String messageId, + String? parentAuthor, + DateTime? receivedAt, + String? team, + List? threadParticipants, + int? totalUnreadCount, + String type, + int? unreadChannels, + int? unreadCount, + UserResponseCommonFields? user, + int watcherCount, + }); +} + +/// @nodoc +class _$MessageNewEventCopyWithImpl<$Res> implements $MessageNewEventCopyWith<$Res> { + _$MessageNewEventCopyWithImpl(this._self, this._then); + + final MessageNewEvent _self; + final $Res Function(MessageNewEvent) _then; + + /// Create a copy of MessageNewEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channel = freezed, + Object? channelCustom = freezed, + Object? channelId = freezed, + Object? channelMemberCount = freezed, + Object? channelMessageCount = freezed, + Object? channelType = freezed, + Object? cid = freezed, + Object? createdAt = null, + Object? custom = null, + Object? groupedUnreadChannels = freezed, + Object? message = null, + Object? messageId = null, + Object? parentAuthor = freezed, + Object? receivedAt = freezed, + Object? team = freezed, + Object? threadParticipants = freezed, + Object? totalUnreadCount = freezed, + Object? type = null, + Object? unreadChannels = freezed, + Object? unreadCount = freezed, + Object? user = freezed, + Object? watcherCount = null, + }) { + return _then( + MessageNewEvent( + channel: freezed == channel + ? _self.channel + : channel // ignore: cast_nullable_to_non_nullable + as ChannelResponse?, + channelCustom: freezed == channelCustom + ? _self.channelCustom + : channelCustom // ignore: cast_nullable_to_non_nullable + as Map?, + channelId: freezed == channelId + ? _self.channelId + : channelId // ignore: cast_nullable_to_non_nullable + as String?, + channelMemberCount: freezed == channelMemberCount + ? _self.channelMemberCount + : channelMemberCount // ignore: cast_nullable_to_non_nullable + as int?, + channelMessageCount: freezed == channelMessageCount + ? _self.channelMessageCount + : channelMessageCount // ignore: cast_nullable_to_non_nullable + as int?, + channelType: freezed == channelType + ? _self.channelType + : channelType // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + groupedUnreadChannels: freezed == groupedUnreadChannels + ? _self.groupedUnreadChannels + : groupedUnreadChannels // ignore: cast_nullable_to_non_nullable + as Map?, + message: null == message + ? _self.message + : message // ignore: cast_nullable_to_non_nullable + as MessageResponse, + messageId: null == messageId + ? _self.messageId + : messageId // ignore: cast_nullable_to_non_nullable + as String, + parentAuthor: freezed == parentAuthor + ? _self.parentAuthor + : parentAuthor // ignore: cast_nullable_to_non_nullable + as String?, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + team: freezed == team + ? _self.team + : team // ignore: cast_nullable_to_non_nullable + as String?, + threadParticipants: freezed == threadParticipants + ? _self.threadParticipants + : threadParticipants // ignore: cast_nullable_to_non_nullable + as List?, + totalUnreadCount: freezed == totalUnreadCount + ? _self.totalUnreadCount + : totalUnreadCount // ignore: cast_nullable_to_non_nullable + as int?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + unreadChannels: freezed == unreadChannels + ? _self.unreadChannels + : unreadChannels // ignore: cast_nullable_to_non_nullable + as int?, + unreadCount: freezed == unreadCount + ? _self.unreadCount + : unreadCount // ignore: cast_nullable_to_non_nullable + as int?, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponseCommonFields?, + watcherCount: null == watcherCount + ? _self.watcherCount + : watcherCount // ignore: cast_nullable_to_non_nullable + as int, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/message_new_event.g.dart b/packages/stream_chat/lib/open_api/model/message_new_event.g.dart new file mode 100644 index 0000000000..378eaf77a5 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_new_event.g.dart @@ -0,0 +1,81 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'message_new_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +MessageNewEvent _$MessageNewEventFromJson( + Map json, +) => MessageNewEvent( + channel: json['channel'] == null ? null : ChannelResponse.fromJson(json['channel'] as Map), + channelCustom: json['channel_custom'] as Map?, + channelId: json['channel_id'] as String?, + channelMemberCount: (json['channel_member_count'] as num?)?.toInt(), + channelMessageCount: (json['channel_message_count'] as num?)?.toInt(), + channelType: json['channel_type'] as String?, + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + groupedUnreadChannels: (json['grouped_unread_channels'] as Map?)?.map( + (k, e) => MapEntry(k, (e as num).toInt()), + ), + message: MessageResponse.fromJson(json['message'] as Map), + messageId: json['message_id'] as String, + parentAuthor: json['parent_author'] as String?, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + team: json['team'] as String?, + threadParticipants: (json['thread_participants'] as List?) + ?.map((e) => UserResponseCommonFields.fromJson(e as Map)) + .toList(), + totalUnreadCount: (json['total_unread_count'] as num?)?.toInt(), + type: json['type'] as String, + unreadChannels: (json['unread_channels'] as num?)?.toInt(), + unreadCount: (json['unread_count'] as num?)?.toInt(), + user: json['user'] == null ? null : UserResponseCommonFields.fromJson(json['user'] as Map), + watcherCount: (json['watcher_count'] as num).toInt(), +); + +Map _$MessageNewEventToJson(MessageNewEvent instance) => { + 'channel': instance.channel?.toJson(), + 'channel_custom': instance.channelCustom, + 'channel_id': instance.channelId, + 'channel_member_count': instance.channelMemberCount, + 'channel_message_count': instance.channelMessageCount, + 'channel_type': instance.channelType, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'grouped_unread_channels': instance.groupedUnreadChannels, + 'message': instance.message.toJson(), + 'message_id': instance.messageId, + 'parent_author': instance.parentAuthor, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'team': instance.team, + 'thread_participants': instance.threadParticipants?.map((e) => e.toJson()).toList(), + 'total_unread_count': instance.totalUnreadCount, + 'type': instance.type, + 'unread_channels': instance.unreadChannels, + 'unread_count': instance.unreadCount, + 'user': instance.user?.toJson(), + 'watcher_count': instance.watcherCount, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/message_options.dart b/packages/stream_chat/lib/open_api/model/message_options.dart new file mode 100644 index 0000000000..db31d6df0a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_options.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'message_options.g.dart'; +part 'message_options.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class MessageOptions with _$MessageOptions { + const MessageOptions({ + this.includeThreadParticipants, + this.memberCustomInclude, + }); + + @override + @JsonKey(name: 'include_thread_participants') + final bool? includeThreadParticipants; + + @override + @JsonKey(name: 'member_custom_include') + final List? memberCustomInclude; + + Map toJson() => _$MessageOptionsToJson(this); + + static MessageOptions fromJson(Map json) => _$MessageOptionsFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/message_options.freezed.dart b/packages/stream_chat/lib/open_api/model/message_options.freezed.dart new file mode 100644 index 0000000000..1e6f6cff1d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_options.freezed.dart @@ -0,0 +1,98 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'message_options.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$MessageOptions { + bool? get includeThreadParticipants; + List? get memberCustomInclude; + + /// Create a copy of MessageOptions + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $MessageOptionsCopyWith get copyWith => _$MessageOptionsCopyWithImpl( + this as MessageOptions, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is MessageOptions && + (identical( + other.includeThreadParticipants, + includeThreadParticipants, + ) || + other.includeThreadParticipants == includeThreadParticipants) && + const DeepCollectionEquality().equals( + other.memberCustomInclude, + memberCustomInclude, + )); + } + + @override + int get hashCode => Object.hash( + runtimeType, + includeThreadParticipants, + const DeepCollectionEquality().hash(memberCustomInclude), + ); + + @override + String toString() { + return 'MessageOptions(includeThreadParticipants: $includeThreadParticipants, memberCustomInclude: $memberCustomInclude)'; + } +} + +/// @nodoc +abstract mixin class $MessageOptionsCopyWith<$Res> { + factory $MessageOptionsCopyWith( + MessageOptions value, + $Res Function(MessageOptions) _then, + ) = _$MessageOptionsCopyWithImpl; + @useResult + $Res call({ + bool? includeThreadParticipants, + List? memberCustomInclude, + }); +} + +/// @nodoc +class _$MessageOptionsCopyWithImpl<$Res> implements $MessageOptionsCopyWith<$Res> { + _$MessageOptionsCopyWithImpl(this._self, this._then); + + final MessageOptions _self; + final $Res Function(MessageOptions) _then; + + /// Create a copy of MessageOptions + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? includeThreadParticipants = freezed, + Object? memberCustomInclude = freezed, + }) { + return _then( + MessageOptions( + includeThreadParticipants: freezed == includeThreadParticipants + ? _self.includeThreadParticipants + : includeThreadParticipants // ignore: cast_nullable_to_non_nullable + as bool?, + memberCustomInclude: freezed == memberCustomInclude + ? _self.memberCustomInclude + : memberCustomInclude // ignore: cast_nullable_to_non_nullable + as List?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/message_options.g.dart b/packages/stream_chat/lib/open_api/model/message_options.g.dart new file mode 100644 index 0000000000..e8128cd08f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_options.g.dart @@ -0,0 +1,17 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'message_options.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +MessageOptions _$MessageOptionsFromJson(Map json) => MessageOptions( + includeThreadParticipants: json['include_thread_participants'] as bool?, + memberCustomInclude: (json['member_custom_include'] as List?)?.map((e) => e as String).toList(), +); + +Map _$MessageOptionsToJson(MessageOptions instance) => { + 'include_thread_participants': instance.includeThreadParticipants, + 'member_custom_include': instance.memberCustomInclude, +}; diff --git a/packages/stream_chat/lib/open_api/model/message_pagination_params.dart b/packages/stream_chat/lib/open_api/model/message_pagination_params.dart new file mode 100644 index 0000000000..5c7c8f770c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_pagination_params.dart @@ -0,0 +1,86 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'message_pagination_params.g.dart'; +part 'message_pagination_params.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class MessagePaginationParams with _$MessagePaginationParams { + const MessagePaginationParams({ + this.createdAtAfter, + this.createdAtAfterOrEqual, + this.createdAtAround, + this.createdAtBefore, + this.createdAtBeforeOrEqual, + this.idAround, + this.idGt, + this.idGte, + this.idLt, + this.idLte, + this.limit, + }); + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at_after') + final DateTime? createdAtAfter; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at_after_or_equal') + final DateTime? createdAtAfterOrEqual; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at_around') + final DateTime? createdAtAround; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at_before') + final DateTime? createdAtBefore; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at_before_or_equal') + final DateTime? createdAtBeforeOrEqual; + + @override + @JsonKey(name: 'id_around') + final String? idAround; + + @override + @JsonKey(name: 'id_gt') + final String? idGt; + + @override + @JsonKey(name: 'id_gte') + final String? idGte; + + @override + @JsonKey(name: 'id_lt') + final String? idLt; + + @override + @JsonKey(name: 'id_lte') + final String? idLte; + + @override + @JsonKey(name: 'limit') + final int? limit; + + Map toJson() => _$MessagePaginationParamsToJson(this); + + static MessagePaginationParams fromJson(Map json) => _$MessagePaginationParamsFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/message_pagination_params.freezed.dart b/packages/stream_chat/lib/open_api/model/message_pagination_params.freezed.dart new file mode 100644 index 0000000000..6edb4fc8d5 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_pagination_params.freezed.dart @@ -0,0 +1,175 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'message_pagination_params.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$MessagePaginationParams { + DateTime? get createdAtAfter; + DateTime? get createdAtAfterOrEqual; + DateTime? get createdAtAround; + DateTime? get createdAtBefore; + DateTime? get createdAtBeforeOrEqual; + String? get idAround; + String? get idGt; + String? get idGte; + String? get idLt; + String? get idLte; + int? get limit; + + /// Create a copy of MessagePaginationParams + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $MessagePaginationParamsCopyWith get copyWith => + _$MessagePaginationParamsCopyWithImpl( + this as MessagePaginationParams, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is MessagePaginationParams && + (identical(other.createdAtAfter, createdAtAfter) || other.createdAtAfter == createdAtAfter) && + (identical(other.createdAtAfterOrEqual, createdAtAfterOrEqual) || + other.createdAtAfterOrEqual == createdAtAfterOrEqual) && + (identical(other.createdAtAround, createdAtAround) || other.createdAtAround == createdAtAround) && + (identical(other.createdAtBefore, createdAtBefore) || other.createdAtBefore == createdAtBefore) && + (identical(other.createdAtBeforeOrEqual, createdAtBeforeOrEqual) || + other.createdAtBeforeOrEqual == createdAtBeforeOrEqual) && + (identical(other.idAround, idAround) || other.idAround == idAround) && + (identical(other.idGt, idGt) || other.idGt == idGt) && + (identical(other.idGte, idGte) || other.idGte == idGte) && + (identical(other.idLt, idLt) || other.idLt == idLt) && + (identical(other.idLte, idLte) || other.idLte == idLte) && + (identical(other.limit, limit) || other.limit == limit)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + createdAtAfter, + createdAtAfterOrEqual, + createdAtAround, + createdAtBefore, + createdAtBeforeOrEqual, + idAround, + idGt, + idGte, + idLt, + idLte, + limit, + ); + + @override + String toString() { + return 'MessagePaginationParams(createdAtAfter: $createdAtAfter, createdAtAfterOrEqual: $createdAtAfterOrEqual, createdAtAround: $createdAtAround, createdAtBefore: $createdAtBefore, createdAtBeforeOrEqual: $createdAtBeforeOrEqual, idAround: $idAround, idGt: $idGt, idGte: $idGte, idLt: $idLt, idLte: $idLte, limit: $limit)'; + } +} + +/// @nodoc +abstract mixin class $MessagePaginationParamsCopyWith<$Res> { + factory $MessagePaginationParamsCopyWith( + MessagePaginationParams value, + $Res Function(MessagePaginationParams) _then, + ) = _$MessagePaginationParamsCopyWithImpl; + @useResult + $Res call({ + DateTime? createdAtAfter, + DateTime? createdAtAfterOrEqual, + DateTime? createdAtAround, + DateTime? createdAtBefore, + DateTime? createdAtBeforeOrEqual, + String? idAround, + String? idGt, + String? idGte, + String? idLt, + String? idLte, + int? limit, + }); +} + +/// @nodoc +class _$MessagePaginationParamsCopyWithImpl<$Res> implements $MessagePaginationParamsCopyWith<$Res> { + _$MessagePaginationParamsCopyWithImpl(this._self, this._then); + + final MessagePaginationParams _self; + final $Res Function(MessagePaginationParams) _then; + + /// Create a copy of MessagePaginationParams + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? createdAtAfter = freezed, + Object? createdAtAfterOrEqual = freezed, + Object? createdAtAround = freezed, + Object? createdAtBefore = freezed, + Object? createdAtBeforeOrEqual = freezed, + Object? idAround = freezed, + Object? idGt = freezed, + Object? idGte = freezed, + Object? idLt = freezed, + Object? idLte = freezed, + Object? limit = freezed, + }) { + return _then( + MessagePaginationParams( + createdAtAfter: freezed == createdAtAfter + ? _self.createdAtAfter + : createdAtAfter // ignore: cast_nullable_to_non_nullable + as DateTime?, + createdAtAfterOrEqual: freezed == createdAtAfterOrEqual + ? _self.createdAtAfterOrEqual + : createdAtAfterOrEqual // ignore: cast_nullable_to_non_nullable + as DateTime?, + createdAtAround: freezed == createdAtAround + ? _self.createdAtAround + : createdAtAround // ignore: cast_nullable_to_non_nullable + as DateTime?, + createdAtBefore: freezed == createdAtBefore + ? _self.createdAtBefore + : createdAtBefore // ignore: cast_nullable_to_non_nullable + as DateTime?, + createdAtBeforeOrEqual: freezed == createdAtBeforeOrEqual + ? _self.createdAtBeforeOrEqual + : createdAtBeforeOrEqual // ignore: cast_nullable_to_non_nullable + as DateTime?, + idAround: freezed == idAround + ? _self.idAround + : idAround // ignore: cast_nullable_to_non_nullable + as String?, + idGt: freezed == idGt + ? _self.idGt + : idGt // ignore: cast_nullable_to_non_nullable + as String?, + idGte: freezed == idGte + ? _self.idGte + : idGte // ignore: cast_nullable_to_non_nullable + as String?, + idLt: freezed == idLt + ? _self.idLt + : idLt // ignore: cast_nullable_to_non_nullable + as String?, + idLte: freezed == idLte + ? _self.idLte + : idLte // ignore: cast_nullable_to_non_nullable + as String?, + limit: freezed == limit + ? _self.limit + : limit // ignore: cast_nullable_to_non_nullable + as int?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/message_pagination_params.g.dart b/packages/stream_chat/lib/open_api/model/message_pagination_params.g.dart new file mode 100644 index 0000000000..9f0bdcf01a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_pagination_params.g.dart @@ -0,0 +1,79 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'message_pagination_params.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +MessagePaginationParams _$MessagePaginationParamsFromJson( + Map json, +) => MessagePaginationParams( + createdAtAfter: _$JsonConverterFromJson( + json['created_at_after'], + const StreamDateTimeConverter().fromJson, + ), + createdAtAfterOrEqual: _$JsonConverterFromJson( + json['created_at_after_or_equal'], + const StreamDateTimeConverter().fromJson, + ), + createdAtAround: _$JsonConverterFromJson( + json['created_at_around'], + const StreamDateTimeConverter().fromJson, + ), + createdAtBefore: _$JsonConverterFromJson( + json['created_at_before'], + const StreamDateTimeConverter().fromJson, + ), + createdAtBeforeOrEqual: _$JsonConverterFromJson( + json['created_at_before_or_equal'], + const StreamDateTimeConverter().fromJson, + ), + idAround: json['id_around'] as String?, + idGt: json['id_gt'] as String?, + idGte: json['id_gte'] as String?, + idLt: json['id_lt'] as String?, + idLte: json['id_lte'] as String?, + limit: (json['limit'] as num?)?.toInt(), +); + +Map _$MessagePaginationParamsToJson( + MessagePaginationParams instance, +) => { + 'created_at_after': _$JsonConverterToJson( + instance.createdAtAfter, + const StreamDateTimeConverter().toJson, + ), + 'created_at_after_or_equal': _$JsonConverterToJson( + instance.createdAtAfterOrEqual, + const StreamDateTimeConverter().toJson, + ), + 'created_at_around': _$JsonConverterToJson( + instance.createdAtAround, + const StreamDateTimeConverter().toJson, + ), + 'created_at_before': _$JsonConverterToJson( + instance.createdAtBefore, + const StreamDateTimeConverter().toJson, + ), + 'created_at_before_or_equal': _$JsonConverterToJson( + instance.createdAtBeforeOrEqual, + const StreamDateTimeConverter().toJson, + ), + 'id_around': instance.idAround, + 'id_gt': instance.idGt, + 'id_gte': instance.idGte, + 'id_lt': instance.idLt, + 'id_lte': instance.idLte, + 'limit': instance.limit, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/message_read_event.dart b/packages/stream_chat/lib/open_api/model/message_read_event.dart new file mode 100644 index 0000000000..b78b39c885 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_read_event.dart @@ -0,0 +1,103 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'message_read_event.g.dart'; +part 'message_read_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class MessageReadEvent extends core.WsEvent with _$MessageReadEvent { + const MessageReadEvent({ + this.channel, + this.channelCustom, + this.channelId, + this.channelMemberCount, + this.channelMessageCount, + this.channelType, + this.cid, + required this.createdAt, + required this.custom, + this.lastReadMessageId, + this.receivedAt, + this.team, + this.thread, + required this.type, + this.user, + }); + + @override + @JsonKey(name: 'channel') + final ChannelResponse? channel; + + @override + @JsonKey(name: 'channel_custom') + final Map? channelCustom; + + @override + @JsonKey(name: 'channel_id') + final String? channelId; + + @override + @JsonKey(name: 'channel_member_count') + final int? channelMemberCount; + + @override + @JsonKey(name: 'channel_message_count') + final int? channelMessageCount; + + @override + @JsonKey(name: 'channel_type') + final String? channelType; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'last_read_message_id') + final String? lastReadMessageId; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'team') + final String? team; + + @override + @JsonKey(name: 'thread') + final ThreadResponse? thread; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'user') + final UserResponseCommonFields? user; + + Map toJson() => _$MessageReadEventToJson(this); + + static MessageReadEvent fromJson(Map json) => _$MessageReadEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/message_read_event.freezed.dart b/packages/stream_chat/lib/open_api/model/message_read_event.freezed.dart new file mode 100644 index 0000000000..9c679841d5 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_read_event.freezed.dart @@ -0,0 +1,213 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'message_read_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$MessageReadEvent { + ChannelResponse? get channel; + Map? get channelCustom; + String? get channelId; + int? get channelMemberCount; + int? get channelMessageCount; + String? get channelType; + String? get cid; + DateTime get createdAt; + Map get custom; + String? get lastReadMessageId; + DateTime? get receivedAt; + String? get team; + ThreadResponse? get thread; + String get type; + UserResponseCommonFields? get user; + + /// Create a copy of MessageReadEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $MessageReadEventCopyWith get copyWith => _$MessageReadEventCopyWithImpl( + this as MessageReadEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is MessageReadEvent && + (identical(other.channel, channel) || other.channel == channel) && + const DeepCollectionEquality().equals( + other.channelCustom, + channelCustom, + ) && + (identical(other.channelId, channelId) || other.channelId == channelId) && + (identical(other.channelMemberCount, channelMemberCount) || + other.channelMemberCount == channelMemberCount) && + (identical(other.channelMessageCount, channelMessageCount) || + other.channelMessageCount == channelMessageCount) && + (identical(other.channelType, channelType) || other.channelType == channelType) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.lastReadMessageId, lastReadMessageId) || other.lastReadMessageId == lastReadMessageId) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.team, team) || other.team == team) && + (identical(other.thread, thread) || other.thread == thread) && + (identical(other.type, type) || other.type == type) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channel, + const DeepCollectionEquality().hash(channelCustom), + channelId, + channelMemberCount, + channelMessageCount, + channelType, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + lastReadMessageId, + receivedAt, + team, + thread, + type, + user, + ); + + @override + String toString() { + return 'MessageReadEvent(channel: $channel, channelCustom: $channelCustom, channelId: $channelId, channelMemberCount: $channelMemberCount, channelMessageCount: $channelMessageCount, channelType: $channelType, cid: $cid, createdAt: $createdAt, custom: $custom, lastReadMessageId: $lastReadMessageId, receivedAt: $receivedAt, team: $team, thread: $thread, type: $type, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $MessageReadEventCopyWith<$Res> { + factory $MessageReadEventCopyWith( + MessageReadEvent value, + $Res Function(MessageReadEvent) _then, + ) = _$MessageReadEventCopyWithImpl; + @useResult + $Res call({ + ChannelResponse? channel, + Map? channelCustom, + String? channelId, + int? channelMemberCount, + int? channelMessageCount, + String? channelType, + String? cid, + DateTime createdAt, + Map custom, + String? lastReadMessageId, + DateTime? receivedAt, + String? team, + ThreadResponse? thread, + String type, + UserResponseCommonFields? user, + }); +} + +/// @nodoc +class _$MessageReadEventCopyWithImpl<$Res> implements $MessageReadEventCopyWith<$Res> { + _$MessageReadEventCopyWithImpl(this._self, this._then); + + final MessageReadEvent _self; + final $Res Function(MessageReadEvent) _then; + + /// Create a copy of MessageReadEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channel = freezed, + Object? channelCustom = freezed, + Object? channelId = freezed, + Object? channelMemberCount = freezed, + Object? channelMessageCount = freezed, + Object? channelType = freezed, + Object? cid = freezed, + Object? createdAt = null, + Object? custom = null, + Object? lastReadMessageId = freezed, + Object? receivedAt = freezed, + Object? team = freezed, + Object? thread = freezed, + Object? type = null, + Object? user = freezed, + }) { + return _then( + MessageReadEvent( + channel: freezed == channel + ? _self.channel + : channel // ignore: cast_nullable_to_non_nullable + as ChannelResponse?, + channelCustom: freezed == channelCustom + ? _self.channelCustom + : channelCustom // ignore: cast_nullable_to_non_nullable + as Map?, + channelId: freezed == channelId + ? _self.channelId + : channelId // ignore: cast_nullable_to_non_nullable + as String?, + channelMemberCount: freezed == channelMemberCount + ? _self.channelMemberCount + : channelMemberCount // ignore: cast_nullable_to_non_nullable + as int?, + channelMessageCount: freezed == channelMessageCount + ? _self.channelMessageCount + : channelMessageCount // ignore: cast_nullable_to_non_nullable + as int?, + channelType: freezed == channelType + ? _self.channelType + : channelType // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + lastReadMessageId: freezed == lastReadMessageId + ? _self.lastReadMessageId + : lastReadMessageId // ignore: cast_nullable_to_non_nullable + as String?, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + team: freezed == team + ? _self.team + : team // ignore: cast_nullable_to_non_nullable + as String?, + thread: freezed == thread + ? _self.thread + : thread // ignore: cast_nullable_to_non_nullable + as ThreadResponse?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponseCommonFields?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/message_read_event.g.dart b/packages/stream_chat/lib/open_api/model/message_read_event.g.dart new file mode 100644 index 0000000000..e896342481 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_read_event.g.dart @@ -0,0 +1,65 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'message_read_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +MessageReadEvent _$MessageReadEventFromJson(Map json) => MessageReadEvent( + channel: json['channel'] == null ? null : ChannelResponse.fromJson(json['channel'] as Map), + channelCustom: json['channel_custom'] as Map?, + channelId: json['channel_id'] as String?, + channelMemberCount: (json['channel_member_count'] as num?)?.toInt(), + channelMessageCount: (json['channel_message_count'] as num?)?.toInt(), + channelType: json['channel_type'] as String?, + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + lastReadMessageId: json['last_read_message_id'] as String?, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + team: json['team'] as String?, + thread: json['thread'] == null ? null : ThreadResponse.fromJson(json['thread'] as Map), + type: json['type'] as String, + user: json['user'] == null + ? null + : UserResponseCommonFields.fromJson( + json['user'] as Map, + ), +); + +Map _$MessageReadEventToJson(MessageReadEvent instance) => { + 'channel': instance.channel?.toJson(), + 'channel_custom': instance.channelCustom, + 'channel_id': instance.channelId, + 'channel_member_count': instance.channelMemberCount, + 'channel_message_count': instance.channelMessageCount, + 'channel_type': instance.channelType, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'last_read_message_id': instance.lastReadMessageId, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'team': instance.team, + 'thread': instance.thread?.toJson(), + 'type': instance.type, + 'user': instance.user?.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/message_request.dart b/packages/stream_chat/lib/open_api/model/message_request.dart new file mode 100644 index 0000000000..da729c19fe --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_request.dart @@ -0,0 +1,142 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'message_request.g.dart'; +part 'message_request.freezed.dart'; + +extension type const MessageRequestType._(String _) implements String { + static const regular = MessageRequestType._('regular'); + static const system = MessageRequestType._('system'); + + factory MessageRequestType.fromJson(String json) => MessageRequestType._(json); + + String toJson() => this; +} + +@freezed +@immutable +@JsonSerializable() +class MessageRequest with _$MessageRequest { + const MessageRequest({ + this.attachments, + this.custom, + this.id, + this.mentionedChannel, + this.mentionedGroupIds, + this.mentionedHere, + this.mentionedRoles, + this.mentionedUsers, + this.mml, + this.parentId, + this.pinExpires, + this.pinned, + this.pinnedAt, + this.pollId, + this.quotedMessageId, + this.restrictedVisibility, + this.sharedLocation, + this.showInChannel, + this.silent, + this.text, + this.type, + }); + + @override + @JsonKey(name: 'attachments') + final List? attachments; + + @override + @JsonKey(name: 'custom') + final Map? custom; + + @override + @JsonKey(name: 'id') + final String? id; + + @override + @JsonKey(name: 'mentioned_channel') + final bool? mentionedChannel; + + @override + @JsonKey(name: 'mentioned_group_ids') + final List? mentionedGroupIds; + + @override + @JsonKey(name: 'mentioned_here') + final bool? mentionedHere; + + @override + @JsonKey(name: 'mentioned_roles') + final List? mentionedRoles; + + @override + @JsonKey(name: 'mentioned_users') + final List? mentionedUsers; + + @override + @JsonKey(name: 'mml') + final String? mml; + + @override + @JsonKey(name: 'parent_id') + final String? parentId; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'pin_expires') + final DateTime? pinExpires; + + @override + @JsonKey(name: 'pinned') + final bool? pinned; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'pinned_at') + final DateTime? pinnedAt; + + @override + @JsonKey(name: 'poll_id') + final String? pollId; + + @override + @JsonKey(name: 'quoted_message_id') + final String? quotedMessageId; + + @override + @JsonKey(name: 'restricted_visibility') + final List? restrictedVisibility; + + @override + @JsonKey(name: 'shared_location') + final SharedLocation? sharedLocation; + + @override + @JsonKey(name: 'show_in_channel') + final bool? showInChannel; + + @override + @JsonKey(name: 'silent') + final bool? silent; + + @override + @JsonKey(name: 'text') + final String? text; + + @override + @JsonKey(name: 'type') + final MessageRequestType? type; + + Map toJson() => _$MessageRequestToJson(this); + + static MessageRequest fromJson(Map json) => _$MessageRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/message_request.freezed.dart b/packages/stream_chat/lib/open_api/model/message_request.freezed.dart new file mode 100644 index 0000000000..bf54d8ac18 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_request.freezed.dart @@ -0,0 +1,277 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'message_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$MessageRequest { + List? get attachments; + Map? get custom; + String? get id; + bool? get mentionedChannel; + List? get mentionedGroupIds; + bool? get mentionedHere; + List? get mentionedRoles; + List? get mentionedUsers; + String? get mml; + String? get parentId; + DateTime? get pinExpires; + bool? get pinned; + DateTime? get pinnedAt; + String? get pollId; + String? get quotedMessageId; + List? get restrictedVisibility; + SharedLocation? get sharedLocation; + bool? get showInChannel; + bool? get silent; + String? get text; + MessageRequestType? get type; + + /// Create a copy of MessageRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $MessageRequestCopyWith get copyWith => _$MessageRequestCopyWithImpl( + this as MessageRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is MessageRequest && + const DeepCollectionEquality().equals( + other.attachments, + attachments, + ) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.id, id) || other.id == id) && + (identical(other.mentionedChannel, mentionedChannel) || other.mentionedChannel == mentionedChannel) && + const DeepCollectionEquality().equals( + other.mentionedGroupIds, + mentionedGroupIds, + ) && + (identical(other.mentionedHere, mentionedHere) || other.mentionedHere == mentionedHere) && + const DeepCollectionEquality().equals( + other.mentionedRoles, + mentionedRoles, + ) && + const DeepCollectionEquality().equals( + other.mentionedUsers, + mentionedUsers, + ) && + (identical(other.mml, mml) || other.mml == mml) && + (identical(other.parentId, parentId) || other.parentId == parentId) && + (identical(other.pinExpires, pinExpires) || other.pinExpires == pinExpires) && + (identical(other.pinned, pinned) || other.pinned == pinned) && + (identical(other.pinnedAt, pinnedAt) || other.pinnedAt == pinnedAt) && + (identical(other.pollId, pollId) || other.pollId == pollId) && + (identical(other.quotedMessageId, quotedMessageId) || other.quotedMessageId == quotedMessageId) && + const DeepCollectionEquality().equals( + other.restrictedVisibility, + restrictedVisibility, + ) && + (identical(other.sharedLocation, sharedLocation) || other.sharedLocation == sharedLocation) && + (identical(other.showInChannel, showInChannel) || other.showInChannel == showInChannel) && + (identical(other.silent, silent) || other.silent == silent) && + (identical(other.text, text) || other.text == text) && + (identical(other.type, type) || other.type == type)); + } + + @override + int get hashCode => Object.hashAll([ + runtimeType, + const DeepCollectionEquality().hash(attachments), + const DeepCollectionEquality().hash(custom), + id, + mentionedChannel, + const DeepCollectionEquality().hash(mentionedGroupIds), + mentionedHere, + const DeepCollectionEquality().hash(mentionedRoles), + const DeepCollectionEquality().hash(mentionedUsers), + mml, + parentId, + pinExpires, + pinned, + pinnedAt, + pollId, + quotedMessageId, + const DeepCollectionEquality().hash(restrictedVisibility), + sharedLocation, + showInChannel, + silent, + text, + type, + ]); + + @override + String toString() { + return 'MessageRequest(attachments: $attachments, custom: $custom, id: $id, mentionedChannel: $mentionedChannel, mentionedGroupIds: $mentionedGroupIds, mentionedHere: $mentionedHere, mentionedRoles: $mentionedRoles, mentionedUsers: $mentionedUsers, mml: $mml, parentId: $parentId, pinExpires: $pinExpires, pinned: $pinned, pinnedAt: $pinnedAt, pollId: $pollId, quotedMessageId: $quotedMessageId, restrictedVisibility: $restrictedVisibility, sharedLocation: $sharedLocation, showInChannel: $showInChannel, silent: $silent, text: $text, type: $type)'; + } +} + +/// @nodoc +abstract mixin class $MessageRequestCopyWith<$Res> { + factory $MessageRequestCopyWith( + MessageRequest value, + $Res Function(MessageRequest) _then, + ) = _$MessageRequestCopyWithImpl; + @useResult + $Res call({ + List? attachments, + Map? custom, + String? id, + bool? mentionedChannel, + List? mentionedGroupIds, + bool? mentionedHere, + List? mentionedRoles, + List? mentionedUsers, + String? mml, + String? parentId, + DateTime? pinExpires, + bool? pinned, + DateTime? pinnedAt, + String? pollId, + String? quotedMessageId, + List? restrictedVisibility, + SharedLocation? sharedLocation, + bool? showInChannel, + bool? silent, + String? text, + MessageRequestType? type, + }); +} + +/// @nodoc +class _$MessageRequestCopyWithImpl<$Res> implements $MessageRequestCopyWith<$Res> { + _$MessageRequestCopyWithImpl(this._self, this._then); + + final MessageRequest _self; + final $Res Function(MessageRequest) _then; + + /// Create a copy of MessageRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? attachments = freezed, + Object? custom = freezed, + Object? id = freezed, + Object? mentionedChannel = freezed, + Object? mentionedGroupIds = freezed, + Object? mentionedHere = freezed, + Object? mentionedRoles = freezed, + Object? mentionedUsers = freezed, + Object? mml = freezed, + Object? parentId = freezed, + Object? pinExpires = freezed, + Object? pinned = freezed, + Object? pinnedAt = freezed, + Object? pollId = freezed, + Object? quotedMessageId = freezed, + Object? restrictedVisibility = freezed, + Object? sharedLocation = freezed, + Object? showInChannel = freezed, + Object? silent = freezed, + Object? text = freezed, + Object? type = freezed, + }) { + return _then( + MessageRequest( + attachments: freezed == attachments + ? _self.attachments + : attachments // ignore: cast_nullable_to_non_nullable + as List?, + custom: freezed == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map?, + id: freezed == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String?, + mentionedChannel: freezed == mentionedChannel + ? _self.mentionedChannel + : mentionedChannel // ignore: cast_nullable_to_non_nullable + as bool?, + mentionedGroupIds: freezed == mentionedGroupIds + ? _self.mentionedGroupIds + : mentionedGroupIds // ignore: cast_nullable_to_non_nullable + as List?, + mentionedHere: freezed == mentionedHere + ? _self.mentionedHere + : mentionedHere // ignore: cast_nullable_to_non_nullable + as bool?, + mentionedRoles: freezed == mentionedRoles + ? _self.mentionedRoles + : mentionedRoles // ignore: cast_nullable_to_non_nullable + as List?, + mentionedUsers: freezed == mentionedUsers + ? _self.mentionedUsers + : mentionedUsers // ignore: cast_nullable_to_non_nullable + as List?, + mml: freezed == mml + ? _self.mml + : mml // ignore: cast_nullable_to_non_nullable + as String?, + parentId: freezed == parentId + ? _self.parentId + : parentId // ignore: cast_nullable_to_non_nullable + as String?, + pinExpires: freezed == pinExpires + ? _self.pinExpires + : pinExpires // ignore: cast_nullable_to_non_nullable + as DateTime?, + pinned: freezed == pinned + ? _self.pinned + : pinned // ignore: cast_nullable_to_non_nullable + as bool?, + pinnedAt: freezed == pinnedAt + ? _self.pinnedAt + : pinnedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + pollId: freezed == pollId + ? _self.pollId + : pollId // ignore: cast_nullable_to_non_nullable + as String?, + quotedMessageId: freezed == quotedMessageId + ? _self.quotedMessageId + : quotedMessageId // ignore: cast_nullable_to_non_nullable + as String?, + restrictedVisibility: freezed == restrictedVisibility + ? _self.restrictedVisibility + : restrictedVisibility // ignore: cast_nullable_to_non_nullable + as List?, + sharedLocation: freezed == sharedLocation + ? _self.sharedLocation + : sharedLocation // ignore: cast_nullable_to_non_nullable + as SharedLocation?, + showInChannel: freezed == showInChannel + ? _self.showInChannel + : showInChannel // ignore: cast_nullable_to_non_nullable + as bool?, + silent: freezed == silent + ? _self.silent + : silent // ignore: cast_nullable_to_non_nullable + as bool?, + text: freezed == text + ? _self.text + : text // ignore: cast_nullable_to_non_nullable + as String?, + type: freezed == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as MessageRequestType?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/message_request.g.dart b/packages/stream_chat/lib/open_api/model/message_request.g.dart new file mode 100644 index 0000000000..2385580b54 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_request.g.dart @@ -0,0 +1,83 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'message_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +MessageRequest _$MessageRequestFromJson(Map json) => MessageRequest( + attachments: (json['attachments'] as List?) + ?.map((e) => Attachment.fromJson(e as Map)) + .toList(), + custom: json['custom'] as Map?, + id: json['id'] as String?, + mentionedChannel: json['mentioned_channel'] as bool?, + mentionedGroupIds: (json['mentioned_group_ids'] as List?)?.map((e) => e as String).toList(), + mentionedHere: json['mentioned_here'] as bool?, + mentionedRoles: (json['mentioned_roles'] as List?)?.map((e) => e as String).toList(), + mentionedUsers: (json['mentioned_users'] as List?)?.map((e) => e as String).toList(), + mml: json['mml'] as String?, + parentId: json['parent_id'] as String?, + pinExpires: _$JsonConverterFromJson( + json['pin_expires'], + const StreamDateTimeConverter().fromJson, + ), + pinned: json['pinned'] as bool?, + pinnedAt: _$JsonConverterFromJson( + json['pinned_at'], + const StreamDateTimeConverter().fromJson, + ), + pollId: json['poll_id'] as String?, + quotedMessageId: json['quoted_message_id'] as String?, + restrictedVisibility: (json['restricted_visibility'] as List?)?.map((e) => e as String).toList(), + sharedLocation: json['shared_location'] == null + ? null + : SharedLocation.fromJson( + json['shared_location'] as Map, + ), + showInChannel: json['show_in_channel'] as bool?, + silent: json['silent'] as bool?, + text: json['text'] as String?, + type: json['type'] == null ? null : MessageRequestType.fromJson(json['type'] as String), +); + +Map _$MessageRequestToJson(MessageRequest instance) => { + 'attachments': instance.attachments?.map((e) => e.toJson()).toList(), + 'custom': instance.custom, + 'id': instance.id, + 'mentioned_channel': instance.mentionedChannel, + 'mentioned_group_ids': instance.mentionedGroupIds, + 'mentioned_here': instance.mentionedHere, + 'mentioned_roles': instance.mentionedRoles, + 'mentioned_users': instance.mentionedUsers, + 'mml': instance.mml, + 'parent_id': instance.parentId, + 'pin_expires': _$JsonConverterToJson( + instance.pinExpires, + const StreamDateTimeConverter().toJson, + ), + 'pinned': instance.pinned, + 'pinned_at': _$JsonConverterToJson( + instance.pinnedAt, + const StreamDateTimeConverter().toJson, + ), + 'poll_id': instance.pollId, + 'quoted_message_id': instance.quotedMessageId, + 'restricted_visibility': instance.restrictedVisibility, + 'shared_location': instance.sharedLocation?.toJson(), + 'show_in_channel': instance.showInChannel, + 'silent': instance.silent, + 'text': instance.text, + 'type': instance.type?.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/message_response.dart b/packages/stream_chat/lib/open_api/model/message_response.dart new file mode 100644 index 0000000000..a2826dbcdb --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_response.dart @@ -0,0 +1,282 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'message_response.g.dart'; +part 'message_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class MessageResponse with _$MessageResponse { + const MessageResponse({ + required this.attachments, + required this.cid, + this.command, + required this.createdAt, + required this.custom, + this.deletedAt, + this.deletedForMe, + required this.deletedReplyCount, + this.draft, + required this.html, + this.i18n, + required this.id, + this.imageLabels, + required this.latestReactions, + this.member, + required this.mentionedChannel, + this.mentionedChannelMembers, + this.mentionedGroupIds, + this.mentionedGroups, + required this.mentionedHere, + this.mentionedRoles, + required this.mentionedUsers, + this.messageTextUpdatedAt, + this.mml, + this.moderation, + required this.ownReactions, + this.parentId, + this.pinExpires, + required this.pinned, + this.pinnedAt, + this.pinnedBy, + this.poll, + this.pollId, + this.quotedMessage, + this.quotedMessageId, + required this.reactionCounts, + this.reactionGroups, + required this.reactionScores, + this.reminder, + required this.replyCount, + required this.restrictedVisibility, + required this.shadowed, + this.sharedLocation, + this.showInChannel, + required this.silent, + required this.text, + this.threadParticipants, + required this.type, + required this.updatedAt, + required this.user, + }); + + @override + @JsonKey(name: 'attachments') + final List attachments; + + @override + @JsonKey(name: 'cid') + final String cid; + + @override + @JsonKey(name: 'command') + final String? command; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'deleted_at') + final DateTime? deletedAt; + + @override + @JsonKey(name: 'deleted_for_me') + final bool? deletedForMe; + + @override + @JsonKey(name: 'deleted_reply_count') + final int deletedReplyCount; + + @override + @JsonKey(name: 'draft') + final DraftResponse? draft; + + @override + @JsonKey(name: 'html') + final String html; + + @override + @JsonKey(name: 'i18n') + final Map? i18n; + + @override + @JsonKey(name: 'id') + final String id; + + @override + @JsonKey(name: 'image_labels') + final Map>? imageLabels; + + @override + @JsonKey(name: 'latest_reactions') + final List latestReactions; + + @override + @JsonKey(name: 'member') + final ChannelMemberPartialResponse? member; + + @override + @JsonKey(name: 'mentioned_channel') + final bool mentionedChannel; + + @override + @JsonKey(name: 'mentioned_channel_members') + final Map? mentionedChannelMembers; + + @override + @JsonKey(name: 'mentioned_group_ids') + final List? mentionedGroupIds; + + @override + @JsonKey(name: 'mentioned_groups') + final List? mentionedGroups; + + @override + @JsonKey(name: 'mentioned_here') + final bool mentionedHere; + + @override + @JsonKey(name: 'mentioned_roles') + final List? mentionedRoles; + + @override + @JsonKey(name: 'mentioned_users') + final List mentionedUsers; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'message_text_updated_at') + final DateTime? messageTextUpdatedAt; + + @override + @JsonKey(name: 'mml') + final String? mml; + + @override + @JsonKey(name: 'moderation') + final ModerationV2Response? moderation; + + @override + @JsonKey(name: 'own_reactions') + final List ownReactions; + + @override + @JsonKey(name: 'parent_id') + final String? parentId; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'pin_expires') + final DateTime? pinExpires; + + @override + @JsonKey(name: 'pinned') + final bool pinned; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'pinned_at') + final DateTime? pinnedAt; + + @override + @JsonKey(name: 'pinned_by') + final UserResponse? pinnedBy; + + @override + @JsonKey(name: 'poll') + final PollResponseData? poll; + + @override + @JsonKey(name: 'poll_id') + final String? pollId; + + @override + @JsonKey(name: 'quoted_message') + final MessageResponse? quotedMessage; + + @override + @JsonKey(name: 'quoted_message_id') + final String? quotedMessageId; + + @override + @JsonKey(name: 'reaction_counts') + final Map reactionCounts; + + @override + @JsonKey(name: 'reaction_groups') + final Map? reactionGroups; + + @override + @JsonKey(name: 'reaction_scores') + final Map reactionScores; + + @override + @JsonKey(name: 'reminder') + final ReminderResponseData? reminder; + + @override + @JsonKey(name: 'reply_count') + final int replyCount; + + @override + @JsonKey(name: 'restricted_visibility') + final List restrictedVisibility; + + @override + @JsonKey(name: 'shadowed') + final bool shadowed; + + @override + @JsonKey(name: 'shared_location') + final SharedLocationResponseData? sharedLocation; + + @override + @JsonKey(name: 'show_in_channel') + final bool? showInChannel; + + @override + @JsonKey(name: 'silent') + final bool silent; + + @override + @JsonKey(name: 'text') + final String text; + + @override + @JsonKey(name: 'thread_participants') + final List? threadParticipants; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'updated_at') + final DateTime updatedAt; + + @override + @JsonKey(name: 'user') + final UserResponse user; + + Map toJson() => _$MessageResponseToJson(this); + + static MessageResponse fromJson(Map json) => _$MessageResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/message_response.freezed.dart b/packages/stream_chat/lib/open_api/model/message_response.freezed.dart new file mode 100644 index 0000000000..6d24d0b337 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_response.freezed.dart @@ -0,0 +1,566 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'message_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$MessageResponse { + List get attachments; + String get cid; + String? get command; + DateTime get createdAt; + Map get custom; + DateTime? get deletedAt; + bool? get deletedForMe; + int get deletedReplyCount; + DraftResponse? get draft; + String get html; + Map? get i18n; + String get id; + Map>? get imageLabels; + List get latestReactions; + ChannelMemberPartialResponse? get member; + bool get mentionedChannel; + Map? get mentionedChannelMembers; + List? get mentionedGroupIds; + List? get mentionedGroups; + bool get mentionedHere; + List? get mentionedRoles; + List get mentionedUsers; + DateTime? get messageTextUpdatedAt; + String? get mml; + ModerationV2Response? get moderation; + List get ownReactions; + String? get parentId; + DateTime? get pinExpires; + bool get pinned; + DateTime? get pinnedAt; + UserResponse? get pinnedBy; + PollResponseData? get poll; + String? get pollId; + MessageResponse? get quotedMessage; + String? get quotedMessageId; + Map get reactionCounts; + Map? get reactionGroups; + Map get reactionScores; + ReminderResponseData? get reminder; + int get replyCount; + List get restrictedVisibility; + bool get shadowed; + SharedLocationResponseData? get sharedLocation; + bool? get showInChannel; + bool get silent; + String get text; + List? get threadParticipants; + String get type; + DateTime get updatedAt; + UserResponse get user; + + /// Create a copy of MessageResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $MessageResponseCopyWith get copyWith => _$MessageResponseCopyWithImpl( + this as MessageResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is MessageResponse && + const DeepCollectionEquality().equals( + other.attachments, + attachments, + ) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.command, command) || other.command == command) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt) && + (identical(other.deletedForMe, deletedForMe) || other.deletedForMe == deletedForMe) && + (identical(other.deletedReplyCount, deletedReplyCount) || other.deletedReplyCount == deletedReplyCount) && + (identical(other.draft, draft) || other.draft == draft) && + (identical(other.html, html) || other.html == html) && + const DeepCollectionEquality().equals(other.i18n, i18n) && + (identical(other.id, id) || other.id == id) && + const DeepCollectionEquality().equals( + other.imageLabels, + imageLabels, + ) && + const DeepCollectionEquality().equals( + other.latestReactions, + latestReactions, + ) && + (identical(other.member, member) || other.member == member) && + (identical(other.mentionedChannel, mentionedChannel) || other.mentionedChannel == mentionedChannel) && + const DeepCollectionEquality().equals( + other.mentionedChannelMembers, + mentionedChannelMembers, + ) && + const DeepCollectionEquality().equals( + other.mentionedGroupIds, + mentionedGroupIds, + ) && + const DeepCollectionEquality().equals( + other.mentionedGroups, + mentionedGroups, + ) && + (identical(other.mentionedHere, mentionedHere) || other.mentionedHere == mentionedHere) && + const DeepCollectionEquality().equals( + other.mentionedRoles, + mentionedRoles, + ) && + const DeepCollectionEquality().equals( + other.mentionedUsers, + mentionedUsers, + ) && + (identical(other.messageTextUpdatedAt, messageTextUpdatedAt) || + other.messageTextUpdatedAt == messageTextUpdatedAt) && + (identical(other.mml, mml) || other.mml == mml) && + (identical(other.moderation, moderation) || other.moderation == moderation) && + const DeepCollectionEquality().equals( + other.ownReactions, + ownReactions, + ) && + (identical(other.parentId, parentId) || other.parentId == parentId) && + (identical(other.pinExpires, pinExpires) || other.pinExpires == pinExpires) && + (identical(other.pinned, pinned) || other.pinned == pinned) && + (identical(other.pinnedAt, pinnedAt) || other.pinnedAt == pinnedAt) && + (identical(other.pinnedBy, pinnedBy) || other.pinnedBy == pinnedBy) && + (identical(other.poll, poll) || other.poll == poll) && + (identical(other.pollId, pollId) || other.pollId == pollId) && + (identical(other.quotedMessage, quotedMessage) || other.quotedMessage == quotedMessage) && + (identical(other.quotedMessageId, quotedMessageId) || other.quotedMessageId == quotedMessageId) && + const DeepCollectionEquality().equals( + other.reactionCounts, + reactionCounts, + ) && + const DeepCollectionEquality().equals( + other.reactionGroups, + reactionGroups, + ) && + const DeepCollectionEquality().equals( + other.reactionScores, + reactionScores, + ) && + (identical(other.reminder, reminder) || other.reminder == reminder) && + (identical(other.replyCount, replyCount) || other.replyCount == replyCount) && + const DeepCollectionEquality().equals( + other.restrictedVisibility, + restrictedVisibility, + ) && + (identical(other.shadowed, shadowed) || other.shadowed == shadowed) && + (identical(other.sharedLocation, sharedLocation) || other.sharedLocation == sharedLocation) && + (identical(other.showInChannel, showInChannel) || other.showInChannel == showInChannel) && + (identical(other.silent, silent) || other.silent == silent) && + (identical(other.text, text) || other.text == text) && + const DeepCollectionEquality().equals( + other.threadParticipants, + threadParticipants, + ) && + (identical(other.type, type) || other.type == type) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hashAll([ + runtimeType, + const DeepCollectionEquality().hash(attachments), + cid, + command, + createdAt, + const DeepCollectionEquality().hash(custom), + deletedAt, + deletedForMe, + deletedReplyCount, + draft, + html, + const DeepCollectionEquality().hash(i18n), + id, + const DeepCollectionEquality().hash(imageLabels), + const DeepCollectionEquality().hash(latestReactions), + member, + mentionedChannel, + const DeepCollectionEquality().hash(mentionedChannelMembers), + const DeepCollectionEquality().hash(mentionedGroupIds), + const DeepCollectionEquality().hash(mentionedGroups), + mentionedHere, + const DeepCollectionEquality().hash(mentionedRoles), + const DeepCollectionEquality().hash(mentionedUsers), + messageTextUpdatedAt, + mml, + moderation, + const DeepCollectionEquality().hash(ownReactions), + parentId, + pinExpires, + pinned, + pinnedAt, + pinnedBy, + poll, + pollId, + quotedMessage, + quotedMessageId, + const DeepCollectionEquality().hash(reactionCounts), + const DeepCollectionEquality().hash(reactionGroups), + const DeepCollectionEquality().hash(reactionScores), + reminder, + replyCount, + const DeepCollectionEquality().hash(restrictedVisibility), + shadowed, + sharedLocation, + showInChannel, + silent, + text, + const DeepCollectionEquality().hash(threadParticipants), + type, + updatedAt, + user, + ]); + + @override + String toString() { + return 'MessageResponse(attachments: $attachments, cid: $cid, command: $command, createdAt: $createdAt, custom: $custom, deletedAt: $deletedAt, deletedForMe: $deletedForMe, deletedReplyCount: $deletedReplyCount, draft: $draft, html: $html, i18n: $i18n, id: $id, imageLabels: $imageLabels, latestReactions: $latestReactions, member: $member, mentionedChannel: $mentionedChannel, mentionedChannelMembers: $mentionedChannelMembers, mentionedGroupIds: $mentionedGroupIds, mentionedGroups: $mentionedGroups, mentionedHere: $mentionedHere, mentionedRoles: $mentionedRoles, mentionedUsers: $mentionedUsers, messageTextUpdatedAt: $messageTextUpdatedAt, mml: $mml, moderation: $moderation, ownReactions: $ownReactions, parentId: $parentId, pinExpires: $pinExpires, pinned: $pinned, pinnedAt: $pinnedAt, pinnedBy: $pinnedBy, poll: $poll, pollId: $pollId, quotedMessage: $quotedMessage, quotedMessageId: $quotedMessageId, reactionCounts: $reactionCounts, reactionGroups: $reactionGroups, reactionScores: $reactionScores, reminder: $reminder, replyCount: $replyCount, restrictedVisibility: $restrictedVisibility, shadowed: $shadowed, sharedLocation: $sharedLocation, showInChannel: $showInChannel, silent: $silent, text: $text, threadParticipants: $threadParticipants, type: $type, updatedAt: $updatedAt, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $MessageResponseCopyWith<$Res> { + factory $MessageResponseCopyWith( + MessageResponse value, + $Res Function(MessageResponse) _then, + ) = _$MessageResponseCopyWithImpl; + @useResult + $Res call({ + List attachments, + String cid, + String? command, + DateTime createdAt, + Map custom, + DateTime? deletedAt, + bool? deletedForMe, + int deletedReplyCount, + DraftResponse? draft, + String html, + Map? i18n, + String id, + Map>? imageLabels, + List latestReactions, + ChannelMemberPartialResponse? member, + bool mentionedChannel, + Map? mentionedChannelMembers, + List? mentionedGroupIds, + List? mentionedGroups, + bool mentionedHere, + List? mentionedRoles, + List mentionedUsers, + DateTime? messageTextUpdatedAt, + String? mml, + ModerationV2Response? moderation, + List ownReactions, + String? parentId, + DateTime? pinExpires, + bool pinned, + DateTime? pinnedAt, + UserResponse? pinnedBy, + PollResponseData? poll, + String? pollId, + MessageResponse? quotedMessage, + String? quotedMessageId, + Map reactionCounts, + Map? reactionGroups, + Map reactionScores, + ReminderResponseData? reminder, + int replyCount, + List restrictedVisibility, + bool shadowed, + SharedLocationResponseData? sharedLocation, + bool? showInChannel, + bool silent, + String text, + List? threadParticipants, + String type, + DateTime updatedAt, + UserResponse user, + }); +} + +/// @nodoc +class _$MessageResponseCopyWithImpl<$Res> implements $MessageResponseCopyWith<$Res> { + _$MessageResponseCopyWithImpl(this._self, this._then); + + final MessageResponse _self; + final $Res Function(MessageResponse) _then; + + /// Create a copy of MessageResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? attachments = null, + Object? cid = null, + Object? command = freezed, + Object? createdAt = null, + Object? custom = null, + Object? deletedAt = freezed, + Object? deletedForMe = freezed, + Object? deletedReplyCount = null, + Object? draft = freezed, + Object? html = null, + Object? i18n = freezed, + Object? id = null, + Object? imageLabels = freezed, + Object? latestReactions = null, + Object? member = freezed, + Object? mentionedChannel = null, + Object? mentionedChannelMembers = freezed, + Object? mentionedGroupIds = freezed, + Object? mentionedGroups = freezed, + Object? mentionedHere = null, + Object? mentionedRoles = freezed, + Object? mentionedUsers = null, + Object? messageTextUpdatedAt = freezed, + Object? mml = freezed, + Object? moderation = freezed, + Object? ownReactions = null, + Object? parentId = freezed, + Object? pinExpires = freezed, + Object? pinned = null, + Object? pinnedAt = freezed, + Object? pinnedBy = freezed, + Object? poll = freezed, + Object? pollId = freezed, + Object? quotedMessage = freezed, + Object? quotedMessageId = freezed, + Object? reactionCounts = null, + Object? reactionGroups = freezed, + Object? reactionScores = null, + Object? reminder = freezed, + Object? replyCount = null, + Object? restrictedVisibility = null, + Object? shadowed = null, + Object? sharedLocation = freezed, + Object? showInChannel = freezed, + Object? silent = null, + Object? text = null, + Object? threadParticipants = freezed, + Object? type = null, + Object? updatedAt = null, + Object? user = null, + }) { + return _then( + MessageResponse( + attachments: null == attachments + ? _self.attachments + : attachments // ignore: cast_nullable_to_non_nullable + as List, + cid: null == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String, + command: freezed == command + ? _self.command + : command // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + deletedAt: freezed == deletedAt + ? _self.deletedAt + : deletedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + deletedForMe: freezed == deletedForMe + ? _self.deletedForMe + : deletedForMe // ignore: cast_nullable_to_non_nullable + as bool?, + deletedReplyCount: null == deletedReplyCount + ? _self.deletedReplyCount + : deletedReplyCount // ignore: cast_nullable_to_non_nullable + as int, + draft: freezed == draft + ? _self.draft + : draft // ignore: cast_nullable_to_non_nullable + as DraftResponse?, + html: null == html + ? _self.html + : html // ignore: cast_nullable_to_non_nullable + as String, + i18n: freezed == i18n + ? _self.i18n + : i18n // ignore: cast_nullable_to_non_nullable + as Map?, + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + imageLabels: freezed == imageLabels + ? _self.imageLabels + : imageLabels // ignore: cast_nullable_to_non_nullable + as Map>?, + latestReactions: null == latestReactions + ? _self.latestReactions + : latestReactions // ignore: cast_nullable_to_non_nullable + as List, + member: freezed == member + ? _self.member + : member // ignore: cast_nullable_to_non_nullable + as ChannelMemberPartialResponse?, + mentionedChannel: null == mentionedChannel + ? _self.mentionedChannel + : mentionedChannel // ignore: cast_nullable_to_non_nullable + as bool, + mentionedChannelMembers: freezed == mentionedChannelMembers + ? _self.mentionedChannelMembers + : mentionedChannelMembers // ignore: cast_nullable_to_non_nullable + as Map?, + mentionedGroupIds: freezed == mentionedGroupIds + ? _self.mentionedGroupIds + : mentionedGroupIds // ignore: cast_nullable_to_non_nullable + as List?, + mentionedGroups: freezed == mentionedGroups + ? _self.mentionedGroups + : mentionedGroups // ignore: cast_nullable_to_non_nullable + as List?, + mentionedHere: null == mentionedHere + ? _self.mentionedHere + : mentionedHere // ignore: cast_nullable_to_non_nullable + as bool, + mentionedRoles: freezed == mentionedRoles + ? _self.mentionedRoles + : mentionedRoles // ignore: cast_nullable_to_non_nullable + as List?, + mentionedUsers: null == mentionedUsers + ? _self.mentionedUsers + : mentionedUsers // ignore: cast_nullable_to_non_nullable + as List, + messageTextUpdatedAt: freezed == messageTextUpdatedAt + ? _self.messageTextUpdatedAt + : messageTextUpdatedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + mml: freezed == mml + ? _self.mml + : mml // ignore: cast_nullable_to_non_nullable + as String?, + moderation: freezed == moderation + ? _self.moderation + : moderation // ignore: cast_nullable_to_non_nullable + as ModerationV2Response?, + ownReactions: null == ownReactions + ? _self.ownReactions + : ownReactions // ignore: cast_nullable_to_non_nullable + as List, + parentId: freezed == parentId + ? _self.parentId + : parentId // ignore: cast_nullable_to_non_nullable + as String?, + pinExpires: freezed == pinExpires + ? _self.pinExpires + : pinExpires // ignore: cast_nullable_to_non_nullable + as DateTime?, + pinned: null == pinned + ? _self.pinned + : pinned // ignore: cast_nullable_to_non_nullable + as bool, + pinnedAt: freezed == pinnedAt + ? _self.pinnedAt + : pinnedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + pinnedBy: freezed == pinnedBy + ? _self.pinnedBy + : pinnedBy // ignore: cast_nullable_to_non_nullable + as UserResponse?, + poll: freezed == poll + ? _self.poll + : poll // ignore: cast_nullable_to_non_nullable + as PollResponseData?, + pollId: freezed == pollId + ? _self.pollId + : pollId // ignore: cast_nullable_to_non_nullable + as String?, + quotedMessage: freezed == quotedMessage + ? _self.quotedMessage + : quotedMessage // ignore: cast_nullable_to_non_nullable + as MessageResponse?, + quotedMessageId: freezed == quotedMessageId + ? _self.quotedMessageId + : quotedMessageId // ignore: cast_nullable_to_non_nullable + as String?, + reactionCounts: null == reactionCounts + ? _self.reactionCounts + : reactionCounts // ignore: cast_nullable_to_non_nullable + as Map, + reactionGroups: freezed == reactionGroups + ? _self.reactionGroups + : reactionGroups // ignore: cast_nullable_to_non_nullable + as Map?, + reactionScores: null == reactionScores + ? _self.reactionScores + : reactionScores // ignore: cast_nullable_to_non_nullable + as Map, + reminder: freezed == reminder + ? _self.reminder + : reminder // ignore: cast_nullable_to_non_nullable + as ReminderResponseData?, + replyCount: null == replyCount + ? _self.replyCount + : replyCount // ignore: cast_nullable_to_non_nullable + as int, + restrictedVisibility: null == restrictedVisibility + ? _self.restrictedVisibility + : restrictedVisibility // ignore: cast_nullable_to_non_nullable + as List, + shadowed: null == shadowed + ? _self.shadowed + : shadowed // ignore: cast_nullable_to_non_nullable + as bool, + sharedLocation: freezed == sharedLocation + ? _self.sharedLocation + : sharedLocation // ignore: cast_nullable_to_non_nullable + as SharedLocationResponseData?, + showInChannel: freezed == showInChannel + ? _self.showInChannel + : showInChannel // ignore: cast_nullable_to_non_nullable + as bool?, + silent: null == silent + ? _self.silent + : silent // ignore: cast_nullable_to_non_nullable + as bool, + text: null == text + ? _self.text + : text // ignore: cast_nullable_to_non_nullable + as String, + threadParticipants: freezed == threadParticipants + ? _self.threadParticipants + : threadParticipants // ignore: cast_nullable_to_non_nullable + as List?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + updatedAt: null == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + user: null == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponse, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/message_response.g.dart b/packages/stream_chat/lib/open_api/model/message_response.g.dart new file mode 100644 index 0000000000..e8909ba7e3 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_response.g.dart @@ -0,0 +1,198 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'message_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +MessageResponse _$MessageResponseFromJson( + Map json, +) => MessageResponse( + attachments: (json['attachments'] as List) + .map((e) => Attachment.fromJson(e as Map)) + .toList(), + cid: json['cid'] as String, + command: json['command'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + deletedAt: _$JsonConverterFromJson( + json['deleted_at'], + const StreamDateTimeConverter().fromJson, + ), + deletedForMe: json['deleted_for_me'] as bool?, + deletedReplyCount: (json['deleted_reply_count'] as num).toInt(), + draft: json['draft'] == null ? null : DraftResponse.fromJson(json['draft'] as Map), + html: json['html'] as String, + i18n: (json['i18n'] as Map?)?.map( + (k, e) => MapEntry(k, e as String), + ), + id: json['id'] as String, + imageLabels: (json['image_labels'] as Map?)?.map( + (k, e) => MapEntry(k, (e as List).map((e) => e as String).toList()), + ), + latestReactions: (json['latest_reactions'] as List) + .map((e) => ReactionResponse.fromJson(e as Map)) + .toList(), + member: json['member'] == null + ? null + : ChannelMemberPartialResponse.fromJson( + json['member'] as Map, + ), + mentionedChannel: json['mentioned_channel'] as bool, + mentionedChannelMembers: (json['mentioned_channel_members'] as Map?)?.map( + (k, e) => MapEntry( + k, + ChannelMemberPartialResponse.fromJson(e as Map), + ), + ), + mentionedGroupIds: (json['mentioned_group_ids'] as List?)?.map((e) => e as String).toList(), + mentionedGroups: (json['mentioned_groups'] as List?) + ?.map((e) => UserGroupResponse.fromJson(e as Map)) + .toList(), + mentionedHere: json['mentioned_here'] as bool, + mentionedRoles: (json['mentioned_roles'] as List?)?.map((e) => e as String).toList(), + mentionedUsers: (json['mentioned_users'] as List) + .map((e) => UserResponse.fromJson(e as Map)) + .toList(), + messageTextUpdatedAt: _$JsonConverterFromJson( + json['message_text_updated_at'], + const StreamDateTimeConverter().fromJson, + ), + mml: json['mml'] as String?, + moderation: json['moderation'] == null + ? null + : ModerationV2Response.fromJson( + json['moderation'] as Map, + ), + ownReactions: (json['own_reactions'] as List) + .map((e) => ReactionResponse.fromJson(e as Map)) + .toList(), + parentId: json['parent_id'] as String?, + pinExpires: _$JsonConverterFromJson( + json['pin_expires'], + const StreamDateTimeConverter().fromJson, + ), + pinned: json['pinned'] as bool, + pinnedAt: _$JsonConverterFromJson( + json['pinned_at'], + const StreamDateTimeConverter().fromJson, + ), + pinnedBy: json['pinned_by'] == null ? null : UserResponse.fromJson(json['pinned_by'] as Map), + poll: json['poll'] == null ? null : PollResponseData.fromJson(json['poll'] as Map), + pollId: json['poll_id'] as String?, + quotedMessage: json['quoted_message'] == null + ? null + : MessageResponse.fromJson( + json['quoted_message'] as Map, + ), + quotedMessageId: json['quoted_message_id'] as String?, + reactionCounts: Map.from(json['reaction_counts'] as Map), + reactionGroups: (json['reaction_groups'] as Map?)?.map( + (k, e) => MapEntry(k, ReactionGroupResponse.fromJson(e as Map)), + ), + reactionScores: Map.from(json['reaction_scores'] as Map), + reminder: json['reminder'] == null ? null : ReminderResponseData.fromJson(json['reminder'] as Map), + replyCount: (json['reply_count'] as num).toInt(), + restrictedVisibility: (json['restricted_visibility'] as List).map((e) => e as String).toList(), + shadowed: json['shadowed'] as bool, + sharedLocation: json['shared_location'] == null + ? null + : SharedLocationResponseData.fromJson( + json['shared_location'] as Map, + ), + showInChannel: json['show_in_channel'] as bool?, + silent: json['silent'] as bool, + text: json['text'] as String, + threadParticipants: (json['thread_participants'] as List?) + ?.map((e) => UserResponse.fromJson(e as Map)) + .toList(), + type: json['type'] as String, + updatedAt: const StreamDateTimeConverter().fromJson( + json['updated_at'] as Object, + ), + user: UserResponse.fromJson(json['user'] as Map), +); + +Map _$MessageResponseToJson( + MessageResponse instance, +) => { + 'attachments': instance.attachments.map((e) => e.toJson()).toList(), + 'cid': instance.cid, + 'command': instance.command, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'deleted_at': _$JsonConverterToJson( + instance.deletedAt, + const StreamDateTimeConverter().toJson, + ), + 'deleted_for_me': instance.deletedForMe, + 'deleted_reply_count': instance.deletedReplyCount, + 'draft': instance.draft?.toJson(), + 'html': instance.html, + 'i18n': instance.i18n, + 'id': instance.id, + 'image_labels': instance.imageLabels, + 'latest_reactions': instance.latestReactions.map((e) => e.toJson()).toList(), + 'member': instance.member?.toJson(), + 'mentioned_channel': instance.mentionedChannel, + 'mentioned_channel_members': instance.mentionedChannelMembers?.map( + (k, e) => MapEntry(k, e.toJson()), + ), + 'mentioned_group_ids': instance.mentionedGroupIds, + 'mentioned_groups': instance.mentionedGroups?.map((e) => e.toJson()).toList(), + 'mentioned_here': instance.mentionedHere, + 'mentioned_roles': instance.mentionedRoles, + 'mentioned_users': instance.mentionedUsers.map((e) => e.toJson()).toList(), + 'message_text_updated_at': _$JsonConverterToJson( + instance.messageTextUpdatedAt, + const StreamDateTimeConverter().toJson, + ), + 'mml': instance.mml, + 'moderation': instance.moderation?.toJson(), + 'own_reactions': instance.ownReactions.map((e) => e.toJson()).toList(), + 'parent_id': instance.parentId, + 'pin_expires': _$JsonConverterToJson( + instance.pinExpires, + const StreamDateTimeConverter().toJson, + ), + 'pinned': instance.pinned, + 'pinned_at': _$JsonConverterToJson( + instance.pinnedAt, + const StreamDateTimeConverter().toJson, + ), + 'pinned_by': instance.pinnedBy?.toJson(), + 'poll': instance.poll?.toJson(), + 'poll_id': instance.pollId, + 'quoted_message': instance.quotedMessage?.toJson(), + 'quoted_message_id': instance.quotedMessageId, + 'reaction_counts': instance.reactionCounts, + 'reaction_groups': instance.reactionGroups?.map( + (k, e) => MapEntry(k, e.toJson()), + ), + 'reaction_scores': instance.reactionScores, + 'reminder': instance.reminder?.toJson(), + 'reply_count': instance.replyCount, + 'restricted_visibility': instance.restrictedVisibility, + 'shadowed': instance.shadowed, + 'shared_location': instance.sharedLocation?.toJson(), + 'show_in_channel': instance.showInChannel, + 'silent': instance.silent, + 'text': instance.text, + 'thread_participants': instance.threadParticipants?.map((e) => e.toJson()).toList(), + 'type': instance.type, + 'updated_at': const StreamDateTimeConverter().toJson(instance.updatedAt), + 'user': instance.user.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/message_undeleted_event.dart b/packages/stream_chat/lib/open_api/model/message_undeleted_event.dart new file mode 100644 index 0000000000..18bce36dcd --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_undeleted_event.dart @@ -0,0 +1,93 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'message_undeleted_event.g.dart'; +part 'message_undeleted_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class MessageUndeletedEvent extends core.WsEvent with _$MessageUndeletedEvent { + const MessageUndeletedEvent({ + this.channelCustom, + this.channelId, + this.channelMemberCount, + this.channelMessageCount, + this.channelType, + this.cid, + required this.createdAt, + required this.custom, + required this.message, + required this.messageId, + this.receivedAt, + this.team, + required this.type, + }); + + @override + @JsonKey(name: 'channel_custom') + final Map? channelCustom; + + @override + @JsonKey(name: 'channel_id') + final String? channelId; + + @override + @JsonKey(name: 'channel_member_count') + final int? channelMemberCount; + + @override + @JsonKey(name: 'channel_message_count') + final int? channelMessageCount; + + @override + @JsonKey(name: 'channel_type') + final String? channelType; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'message') + final MessageResponse message; + + @override + @JsonKey(name: 'message_id') + final String messageId; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'team') + final String? team; + + @override + @JsonKey(name: 'type') + final String type; + + Map toJson() => _$MessageUndeletedEventToJson(this); + + static MessageUndeletedEvent fromJson(Map json) => _$MessageUndeletedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/message_undeleted_event.freezed.dart b/packages/stream_chat/lib/open_api/model/message_undeleted_event.freezed.dart new file mode 100644 index 0000000000..14c212f7a7 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_undeleted_event.freezed.dart @@ -0,0 +1,196 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'message_undeleted_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$MessageUndeletedEvent { + Map? get channelCustom; + String? get channelId; + int? get channelMemberCount; + int? get channelMessageCount; + String? get channelType; + String? get cid; + DateTime get createdAt; + Map get custom; + MessageResponse get message; + String get messageId; + DateTime? get receivedAt; + String? get team; + String get type; + + /// Create a copy of MessageUndeletedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $MessageUndeletedEventCopyWith get copyWith => + _$MessageUndeletedEventCopyWithImpl( + this as MessageUndeletedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is MessageUndeletedEvent && + const DeepCollectionEquality().equals( + other.channelCustom, + channelCustom, + ) && + (identical(other.channelId, channelId) || other.channelId == channelId) && + (identical(other.channelMemberCount, channelMemberCount) || + other.channelMemberCount == channelMemberCount) && + (identical(other.channelMessageCount, channelMessageCount) || + other.channelMessageCount == channelMessageCount) && + (identical(other.channelType, channelType) || other.channelType == channelType) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.message, message) || other.message == message) && + (identical(other.messageId, messageId) || other.messageId == messageId) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.team, team) || other.team == team) && + (identical(other.type, type) || other.type == type)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(channelCustom), + channelId, + channelMemberCount, + channelMessageCount, + channelType, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + message, + messageId, + receivedAt, + team, + type, + ); + + @override + String toString() { + return 'MessageUndeletedEvent(channelCustom: $channelCustom, channelId: $channelId, channelMemberCount: $channelMemberCount, channelMessageCount: $channelMessageCount, channelType: $channelType, cid: $cid, createdAt: $createdAt, custom: $custom, message: $message, messageId: $messageId, receivedAt: $receivedAt, team: $team, type: $type)'; + } +} + +/// @nodoc +abstract mixin class $MessageUndeletedEventCopyWith<$Res> { + factory $MessageUndeletedEventCopyWith( + MessageUndeletedEvent value, + $Res Function(MessageUndeletedEvent) _then, + ) = _$MessageUndeletedEventCopyWithImpl; + @useResult + $Res call({ + Map? channelCustom, + String? channelId, + int? channelMemberCount, + int? channelMessageCount, + String? channelType, + String? cid, + DateTime createdAt, + Map custom, + MessageResponse message, + String messageId, + DateTime? receivedAt, + String? team, + String type, + }); +} + +/// @nodoc +class _$MessageUndeletedEventCopyWithImpl<$Res> implements $MessageUndeletedEventCopyWith<$Res> { + _$MessageUndeletedEventCopyWithImpl(this._self, this._then); + + final MessageUndeletedEvent _self; + final $Res Function(MessageUndeletedEvent) _then; + + /// Create a copy of MessageUndeletedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channelCustom = freezed, + Object? channelId = freezed, + Object? channelMemberCount = freezed, + Object? channelMessageCount = freezed, + Object? channelType = freezed, + Object? cid = freezed, + Object? createdAt = null, + Object? custom = null, + Object? message = null, + Object? messageId = null, + Object? receivedAt = freezed, + Object? team = freezed, + Object? type = null, + }) { + return _then( + MessageUndeletedEvent( + channelCustom: freezed == channelCustom + ? _self.channelCustom + : channelCustom // ignore: cast_nullable_to_non_nullable + as Map?, + channelId: freezed == channelId + ? _self.channelId + : channelId // ignore: cast_nullable_to_non_nullable + as String?, + channelMemberCount: freezed == channelMemberCount + ? _self.channelMemberCount + : channelMemberCount // ignore: cast_nullable_to_non_nullable + as int?, + channelMessageCount: freezed == channelMessageCount + ? _self.channelMessageCount + : channelMessageCount // ignore: cast_nullable_to_non_nullable + as int?, + channelType: freezed == channelType + ? _self.channelType + : channelType // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + message: null == message + ? _self.message + : message // ignore: cast_nullable_to_non_nullable + as MessageResponse, + messageId: null == messageId + ? _self.messageId + : messageId // ignore: cast_nullable_to_non_nullable + as String, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + team: freezed == team + ? _self.team + : team // ignore: cast_nullable_to_non_nullable + as String?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/message_undeleted_event.g.dart b/packages/stream_chat/lib/open_api/model/message_undeleted_event.g.dart new file mode 100644 index 0000000000..2ee0a0255c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_undeleted_event.g.dart @@ -0,0 +1,61 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'message_undeleted_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +MessageUndeletedEvent _$MessageUndeletedEventFromJson( + Map json, +) => MessageUndeletedEvent( + channelCustom: json['channel_custom'] as Map?, + channelId: json['channel_id'] as String?, + channelMemberCount: (json['channel_member_count'] as num?)?.toInt(), + channelMessageCount: (json['channel_message_count'] as num?)?.toInt(), + channelType: json['channel_type'] as String?, + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + message: MessageResponse.fromJson(json['message'] as Map), + messageId: json['message_id'] as String, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + team: json['team'] as String?, + type: json['type'] as String, +); + +Map _$MessageUndeletedEventToJson( + MessageUndeletedEvent instance, +) => { + 'channel_custom': instance.channelCustom, + 'channel_id': instance.channelId, + 'channel_member_count': instance.channelMemberCount, + 'channel_message_count': instance.channelMessageCount, + 'channel_type': instance.channelType, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'message': instance.message.toJson(), + 'message_id': instance.messageId, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'team': instance.team, + 'type': instance.type, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/message_update.dart b/packages/stream_chat/lib/open_api/model/message_update.dart new file mode 100644 index 0000000000..8451f33aff --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_update.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'message_update.g.dart'; +part 'message_update.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class MessageUpdate with _$MessageUpdate { + const MessageUpdate({ + this.changeSet, + this.oldText, + }); + + @override + @JsonKey(name: 'change_set') + final MessageChangeSet? changeSet; + + @override + @JsonKey(name: 'old_text') + final String? oldText; + + Map toJson() => _$MessageUpdateToJson(this); + + static MessageUpdate fromJson(Map json) => _$MessageUpdateFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/message_update.freezed.dart b/packages/stream_chat/lib/open_api/model/message_update.freezed.dart new file mode 100644 index 0000000000..4e7ba145c1 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_update.freezed.dart @@ -0,0 +1,81 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'message_update.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$MessageUpdate { + MessageChangeSet? get changeSet; + String? get oldText; + + /// Create a copy of MessageUpdate + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $MessageUpdateCopyWith get copyWith => _$MessageUpdateCopyWithImpl( + this as MessageUpdate, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is MessageUpdate && + (identical(other.changeSet, changeSet) || other.changeSet == changeSet) && + (identical(other.oldText, oldText) || other.oldText == oldText)); + } + + @override + int get hashCode => Object.hash(runtimeType, changeSet, oldText); + + @override + String toString() { + return 'MessageUpdate(changeSet: $changeSet, oldText: $oldText)'; + } +} + +/// @nodoc +abstract mixin class $MessageUpdateCopyWith<$Res> { + factory $MessageUpdateCopyWith( + MessageUpdate value, + $Res Function(MessageUpdate) _then, + ) = _$MessageUpdateCopyWithImpl; + @useResult + $Res call({MessageChangeSet? changeSet, String? oldText}); +} + +/// @nodoc +class _$MessageUpdateCopyWithImpl<$Res> implements $MessageUpdateCopyWith<$Res> { + _$MessageUpdateCopyWithImpl(this._self, this._then); + + final MessageUpdate _self; + final $Res Function(MessageUpdate) _then; + + /// Create a copy of MessageUpdate + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? changeSet = freezed, Object? oldText = freezed}) { + return _then( + MessageUpdate( + changeSet: freezed == changeSet + ? _self.changeSet + : changeSet // ignore: cast_nullable_to_non_nullable + as MessageChangeSet?, + oldText: freezed == oldText + ? _self.oldText + : oldText // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/message_update.g.dart b/packages/stream_chat/lib/open_api/model/message_update.g.dart new file mode 100644 index 0000000000..51ac5420b6 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_update.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'message_update.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +MessageUpdate _$MessageUpdateFromJson(Map json) => MessageUpdate( + changeSet: json['change_set'] == null + ? null + : MessageChangeSet.fromJson( + json['change_set'] as Map, + ), + oldText: json['old_text'] as String?, +); + +Map _$MessageUpdateToJson(MessageUpdate instance) => { + 'change_set': instance.changeSet?.toJson(), + 'old_text': instance.oldText, +}; diff --git a/packages/stream_chat/lib/open_api/model/message_updated_event.dart b/packages/stream_chat/lib/open_api/model/message_updated_event.dart new file mode 100644 index 0000000000..e3040fa71a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_updated_event.dart @@ -0,0 +1,103 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'message_updated_event.g.dart'; +part 'message_updated_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class MessageUpdatedEvent extends core.WsEvent with _$MessageUpdatedEvent { + const MessageUpdatedEvent({ + this.channelCustom, + this.channelId, + this.channelMemberCount, + this.channelMessageCount, + this.channelType, + this.cid, + required this.createdAt, + required this.custom, + required this.message, + required this.messageId, + this.messageUpdate, + this.receivedAt, + this.team, + required this.type, + this.user, + }); + + @override + @JsonKey(name: 'channel_custom') + final Map? channelCustom; + + @override + @JsonKey(name: 'channel_id') + final String? channelId; + + @override + @JsonKey(name: 'channel_member_count') + final int? channelMemberCount; + + @override + @JsonKey(name: 'channel_message_count') + final int? channelMessageCount; + + @override + @JsonKey(name: 'channel_type') + final String? channelType; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'message') + final MessageResponse message; + + @override + @JsonKey(name: 'message_id') + final String messageId; + + @override + @JsonKey(name: 'message_update') + final MessageUpdate? messageUpdate; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'team') + final String? team; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'user') + final UserResponseCommonFields? user; + + Map toJson() => _$MessageUpdatedEventToJson(this); + + static MessageUpdatedEvent fromJson(Map json) => _$MessageUpdatedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/message_updated_event.freezed.dart b/packages/stream_chat/lib/open_api/model/message_updated_event.freezed.dart new file mode 100644 index 0000000000..e89541140c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_updated_event.freezed.dart @@ -0,0 +1,214 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'message_updated_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$MessageUpdatedEvent { + Map? get channelCustom; + String? get channelId; + int? get channelMemberCount; + int? get channelMessageCount; + String? get channelType; + String? get cid; + DateTime get createdAt; + Map get custom; + MessageResponse get message; + String get messageId; + MessageUpdate? get messageUpdate; + DateTime? get receivedAt; + String? get team; + String get type; + UserResponseCommonFields? get user; + + /// Create a copy of MessageUpdatedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $MessageUpdatedEventCopyWith get copyWith => + _$MessageUpdatedEventCopyWithImpl( + this as MessageUpdatedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is MessageUpdatedEvent && + const DeepCollectionEquality().equals( + other.channelCustom, + channelCustom, + ) && + (identical(other.channelId, channelId) || other.channelId == channelId) && + (identical(other.channelMemberCount, channelMemberCount) || + other.channelMemberCount == channelMemberCount) && + (identical(other.channelMessageCount, channelMessageCount) || + other.channelMessageCount == channelMessageCount) && + (identical(other.channelType, channelType) || other.channelType == channelType) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.message, message) || other.message == message) && + (identical(other.messageId, messageId) || other.messageId == messageId) && + (identical(other.messageUpdate, messageUpdate) || other.messageUpdate == messageUpdate) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.team, team) || other.team == team) && + (identical(other.type, type) || other.type == type) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(channelCustom), + channelId, + channelMemberCount, + channelMessageCount, + channelType, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + message, + messageId, + messageUpdate, + receivedAt, + team, + type, + user, + ); + + @override + String toString() { + return 'MessageUpdatedEvent(channelCustom: $channelCustom, channelId: $channelId, channelMemberCount: $channelMemberCount, channelMessageCount: $channelMessageCount, channelType: $channelType, cid: $cid, createdAt: $createdAt, custom: $custom, message: $message, messageId: $messageId, messageUpdate: $messageUpdate, receivedAt: $receivedAt, team: $team, type: $type, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $MessageUpdatedEventCopyWith<$Res> { + factory $MessageUpdatedEventCopyWith( + MessageUpdatedEvent value, + $Res Function(MessageUpdatedEvent) _then, + ) = _$MessageUpdatedEventCopyWithImpl; + @useResult + $Res call({ + Map? channelCustom, + String? channelId, + int? channelMemberCount, + int? channelMessageCount, + String? channelType, + String? cid, + DateTime createdAt, + Map custom, + MessageResponse message, + String messageId, + MessageUpdate? messageUpdate, + DateTime? receivedAt, + String? team, + String type, + UserResponseCommonFields? user, + }); +} + +/// @nodoc +class _$MessageUpdatedEventCopyWithImpl<$Res> implements $MessageUpdatedEventCopyWith<$Res> { + _$MessageUpdatedEventCopyWithImpl(this._self, this._then); + + final MessageUpdatedEvent _self; + final $Res Function(MessageUpdatedEvent) _then; + + /// Create a copy of MessageUpdatedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channelCustom = freezed, + Object? channelId = freezed, + Object? channelMemberCount = freezed, + Object? channelMessageCount = freezed, + Object? channelType = freezed, + Object? cid = freezed, + Object? createdAt = null, + Object? custom = null, + Object? message = null, + Object? messageId = null, + Object? messageUpdate = freezed, + Object? receivedAt = freezed, + Object? team = freezed, + Object? type = null, + Object? user = freezed, + }) { + return _then( + MessageUpdatedEvent( + channelCustom: freezed == channelCustom + ? _self.channelCustom + : channelCustom // ignore: cast_nullable_to_non_nullable + as Map?, + channelId: freezed == channelId + ? _self.channelId + : channelId // ignore: cast_nullable_to_non_nullable + as String?, + channelMemberCount: freezed == channelMemberCount + ? _self.channelMemberCount + : channelMemberCount // ignore: cast_nullable_to_non_nullable + as int?, + channelMessageCount: freezed == channelMessageCount + ? _self.channelMessageCount + : channelMessageCount // ignore: cast_nullable_to_non_nullable + as int?, + channelType: freezed == channelType + ? _self.channelType + : channelType // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + message: null == message + ? _self.message + : message // ignore: cast_nullable_to_non_nullable + as MessageResponse, + messageId: null == messageId + ? _self.messageId + : messageId // ignore: cast_nullable_to_non_nullable + as String, + messageUpdate: freezed == messageUpdate + ? _self.messageUpdate + : messageUpdate // ignore: cast_nullable_to_non_nullable + as MessageUpdate?, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + team: freezed == team + ? _self.team + : team // ignore: cast_nullable_to_non_nullable + as String?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponseCommonFields?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/message_updated_event.g.dart b/packages/stream_chat/lib/open_api/model/message_updated_event.g.dart new file mode 100644 index 0000000000..bf029fb081 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_updated_event.g.dart @@ -0,0 +1,67 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'message_updated_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +MessageUpdatedEvent _$MessageUpdatedEventFromJson( + Map json, +) => MessageUpdatedEvent( + channelCustom: json['channel_custom'] as Map?, + channelId: json['channel_id'] as String?, + channelMemberCount: (json['channel_member_count'] as num?)?.toInt(), + channelMessageCount: (json['channel_message_count'] as num?)?.toInt(), + channelType: json['channel_type'] as String?, + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + message: MessageResponse.fromJson(json['message'] as Map), + messageId: json['message_id'] as String, + messageUpdate: json['message_update'] == null + ? null + : MessageUpdate.fromJson(json['message_update'] as Map), + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + team: json['team'] as String?, + type: json['type'] as String, + user: json['user'] == null ? null : UserResponseCommonFields.fromJson(json['user'] as Map), +); + +Map _$MessageUpdatedEventToJson( + MessageUpdatedEvent instance, +) => { + 'channel_custom': instance.channelCustom, + 'channel_id': instance.channelId, + 'channel_member_count': instance.channelMemberCount, + 'channel_message_count': instance.channelMessageCount, + 'channel_type': instance.channelType, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'message': instance.message.toJson(), + 'message_id': instance.messageId, + 'message_update': instance.messageUpdate?.toJson(), + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'team': instance.team, + 'type': instance.type, + 'user': instance.user?.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/message_with_channel_response.dart b/packages/stream_chat/lib/open_api/model/message_with_channel_response.dart new file mode 100644 index 0000000000..898bb7b37f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_with_channel_response.dart @@ -0,0 +1,287 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'message_with_channel_response.g.dart'; +part 'message_with_channel_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class MessageWithChannelResponse with _$MessageWithChannelResponse { + const MessageWithChannelResponse({ + required this.attachments, + required this.channel, + required this.cid, + this.command, + required this.createdAt, + required this.custom, + this.deletedAt, + this.deletedForMe, + required this.deletedReplyCount, + this.draft, + required this.html, + this.i18n, + required this.id, + this.imageLabels, + required this.latestReactions, + this.member, + required this.mentionedChannel, + this.mentionedChannelMembers, + this.mentionedGroupIds, + this.mentionedGroups, + required this.mentionedHere, + this.mentionedRoles, + required this.mentionedUsers, + this.messageTextUpdatedAt, + this.mml, + this.moderation, + required this.ownReactions, + this.parentId, + this.pinExpires, + required this.pinned, + this.pinnedAt, + this.pinnedBy, + this.poll, + this.pollId, + this.quotedMessage, + this.quotedMessageId, + required this.reactionCounts, + this.reactionGroups, + required this.reactionScores, + this.reminder, + required this.replyCount, + required this.restrictedVisibility, + required this.shadowed, + this.sharedLocation, + this.showInChannel, + required this.silent, + required this.text, + this.threadParticipants, + required this.type, + required this.updatedAt, + required this.user, + }); + + @override + @JsonKey(name: 'attachments') + final List attachments; + + @override + @JsonKey(name: 'channel') + final ChannelResponse channel; + + @override + @JsonKey(name: 'cid') + final String cid; + + @override + @JsonKey(name: 'command') + final String? command; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'deleted_at') + final DateTime? deletedAt; + + @override + @JsonKey(name: 'deleted_for_me') + final bool? deletedForMe; + + @override + @JsonKey(name: 'deleted_reply_count') + final int deletedReplyCount; + + @override + @JsonKey(name: 'draft') + final DraftResponse? draft; + + @override + @JsonKey(name: 'html') + final String html; + + @override + @JsonKey(name: 'i18n') + final Map? i18n; + + @override + @JsonKey(name: 'id') + final String id; + + @override + @JsonKey(name: 'image_labels') + final Map>? imageLabels; + + @override + @JsonKey(name: 'latest_reactions') + final List latestReactions; + + @override + @JsonKey(name: 'member') + final ChannelMemberPartialResponse? member; + + @override + @JsonKey(name: 'mentioned_channel') + final bool mentionedChannel; + + @override + @JsonKey(name: 'mentioned_channel_members') + final Map? mentionedChannelMembers; + + @override + @JsonKey(name: 'mentioned_group_ids') + final List? mentionedGroupIds; + + @override + @JsonKey(name: 'mentioned_groups') + final List? mentionedGroups; + + @override + @JsonKey(name: 'mentioned_here') + final bool mentionedHere; + + @override + @JsonKey(name: 'mentioned_roles') + final List? mentionedRoles; + + @override + @JsonKey(name: 'mentioned_users') + final List mentionedUsers; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'message_text_updated_at') + final DateTime? messageTextUpdatedAt; + + @override + @JsonKey(name: 'mml') + final String? mml; + + @override + @JsonKey(name: 'moderation') + final ModerationV2Response? moderation; + + @override + @JsonKey(name: 'own_reactions') + final List ownReactions; + + @override + @JsonKey(name: 'parent_id') + final String? parentId; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'pin_expires') + final DateTime? pinExpires; + + @override + @JsonKey(name: 'pinned') + final bool pinned; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'pinned_at') + final DateTime? pinnedAt; + + @override + @JsonKey(name: 'pinned_by') + final UserResponse? pinnedBy; + + @override + @JsonKey(name: 'poll') + final PollResponseData? poll; + + @override + @JsonKey(name: 'poll_id') + final String? pollId; + + @override + @JsonKey(name: 'quoted_message') + final MessageResponse? quotedMessage; + + @override + @JsonKey(name: 'quoted_message_id') + final String? quotedMessageId; + + @override + @JsonKey(name: 'reaction_counts') + final Map reactionCounts; + + @override + @JsonKey(name: 'reaction_groups') + final Map? reactionGroups; + + @override + @JsonKey(name: 'reaction_scores') + final Map reactionScores; + + @override + @JsonKey(name: 'reminder') + final ReminderResponseData? reminder; + + @override + @JsonKey(name: 'reply_count') + final int replyCount; + + @override + @JsonKey(name: 'restricted_visibility') + final List restrictedVisibility; + + @override + @JsonKey(name: 'shadowed') + final bool shadowed; + + @override + @JsonKey(name: 'shared_location') + final SharedLocationResponseData? sharedLocation; + + @override + @JsonKey(name: 'show_in_channel') + final bool? showInChannel; + + @override + @JsonKey(name: 'silent') + final bool silent; + + @override + @JsonKey(name: 'text') + final String text; + + @override + @JsonKey(name: 'thread_participants') + final List? threadParticipants; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'updated_at') + final DateTime updatedAt; + + @override + @JsonKey(name: 'user') + final UserResponse user; + + Map toJson() => _$MessageWithChannelResponseToJson(this); + + static MessageWithChannelResponse fromJson(Map json) => _$MessageWithChannelResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/message_with_channel_response.freezed.dart b/packages/stream_chat/lib/open_api/model/message_with_channel_response.freezed.dart new file mode 100644 index 0000000000..88580e0503 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_with_channel_response.freezed.dart @@ -0,0 +1,576 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'message_with_channel_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$MessageWithChannelResponse { + List get attachments; + ChannelResponse get channel; + String get cid; + String? get command; + DateTime get createdAt; + Map get custom; + DateTime? get deletedAt; + bool? get deletedForMe; + int get deletedReplyCount; + DraftResponse? get draft; + String get html; + Map? get i18n; + String get id; + Map>? get imageLabels; + List get latestReactions; + ChannelMemberPartialResponse? get member; + bool get mentionedChannel; + Map? get mentionedChannelMembers; + List? get mentionedGroupIds; + List? get mentionedGroups; + bool get mentionedHere; + List? get mentionedRoles; + List get mentionedUsers; + DateTime? get messageTextUpdatedAt; + String? get mml; + ModerationV2Response? get moderation; + List get ownReactions; + String? get parentId; + DateTime? get pinExpires; + bool get pinned; + DateTime? get pinnedAt; + UserResponse? get pinnedBy; + PollResponseData? get poll; + String? get pollId; + MessageResponse? get quotedMessage; + String? get quotedMessageId; + Map get reactionCounts; + Map? get reactionGroups; + Map get reactionScores; + ReminderResponseData? get reminder; + int get replyCount; + List get restrictedVisibility; + bool get shadowed; + SharedLocationResponseData? get sharedLocation; + bool? get showInChannel; + bool get silent; + String get text; + List? get threadParticipants; + String get type; + DateTime get updatedAt; + UserResponse get user; + + /// Create a copy of MessageWithChannelResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $MessageWithChannelResponseCopyWith get copyWith => + _$MessageWithChannelResponseCopyWithImpl( + this as MessageWithChannelResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is MessageWithChannelResponse && + const DeepCollectionEquality().equals( + other.attachments, + attachments, + ) && + (identical(other.channel, channel) || other.channel == channel) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.command, command) || other.command == command) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt) && + (identical(other.deletedForMe, deletedForMe) || other.deletedForMe == deletedForMe) && + (identical(other.deletedReplyCount, deletedReplyCount) || other.deletedReplyCount == deletedReplyCount) && + (identical(other.draft, draft) || other.draft == draft) && + (identical(other.html, html) || other.html == html) && + const DeepCollectionEquality().equals(other.i18n, i18n) && + (identical(other.id, id) || other.id == id) && + const DeepCollectionEquality().equals( + other.imageLabels, + imageLabels, + ) && + const DeepCollectionEquality().equals( + other.latestReactions, + latestReactions, + ) && + (identical(other.member, member) || other.member == member) && + (identical(other.mentionedChannel, mentionedChannel) || other.mentionedChannel == mentionedChannel) && + const DeepCollectionEquality().equals( + other.mentionedChannelMembers, + mentionedChannelMembers, + ) && + const DeepCollectionEquality().equals( + other.mentionedGroupIds, + mentionedGroupIds, + ) && + const DeepCollectionEquality().equals( + other.mentionedGroups, + mentionedGroups, + ) && + (identical(other.mentionedHere, mentionedHere) || other.mentionedHere == mentionedHere) && + const DeepCollectionEquality().equals( + other.mentionedRoles, + mentionedRoles, + ) && + const DeepCollectionEquality().equals( + other.mentionedUsers, + mentionedUsers, + ) && + (identical(other.messageTextUpdatedAt, messageTextUpdatedAt) || + other.messageTextUpdatedAt == messageTextUpdatedAt) && + (identical(other.mml, mml) || other.mml == mml) && + (identical(other.moderation, moderation) || other.moderation == moderation) && + const DeepCollectionEquality().equals( + other.ownReactions, + ownReactions, + ) && + (identical(other.parentId, parentId) || other.parentId == parentId) && + (identical(other.pinExpires, pinExpires) || other.pinExpires == pinExpires) && + (identical(other.pinned, pinned) || other.pinned == pinned) && + (identical(other.pinnedAt, pinnedAt) || other.pinnedAt == pinnedAt) && + (identical(other.pinnedBy, pinnedBy) || other.pinnedBy == pinnedBy) && + (identical(other.poll, poll) || other.poll == poll) && + (identical(other.pollId, pollId) || other.pollId == pollId) && + (identical(other.quotedMessage, quotedMessage) || other.quotedMessage == quotedMessage) && + (identical(other.quotedMessageId, quotedMessageId) || other.quotedMessageId == quotedMessageId) && + const DeepCollectionEquality().equals( + other.reactionCounts, + reactionCounts, + ) && + const DeepCollectionEquality().equals( + other.reactionGroups, + reactionGroups, + ) && + const DeepCollectionEquality().equals( + other.reactionScores, + reactionScores, + ) && + (identical(other.reminder, reminder) || other.reminder == reminder) && + (identical(other.replyCount, replyCount) || other.replyCount == replyCount) && + const DeepCollectionEquality().equals( + other.restrictedVisibility, + restrictedVisibility, + ) && + (identical(other.shadowed, shadowed) || other.shadowed == shadowed) && + (identical(other.sharedLocation, sharedLocation) || other.sharedLocation == sharedLocation) && + (identical(other.showInChannel, showInChannel) || other.showInChannel == showInChannel) && + (identical(other.silent, silent) || other.silent == silent) && + (identical(other.text, text) || other.text == text) && + const DeepCollectionEquality().equals( + other.threadParticipants, + threadParticipants, + ) && + (identical(other.type, type) || other.type == type) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hashAll([ + runtimeType, + const DeepCollectionEquality().hash(attachments), + channel, + cid, + command, + createdAt, + const DeepCollectionEquality().hash(custom), + deletedAt, + deletedForMe, + deletedReplyCount, + draft, + html, + const DeepCollectionEquality().hash(i18n), + id, + const DeepCollectionEquality().hash(imageLabels), + const DeepCollectionEquality().hash(latestReactions), + member, + mentionedChannel, + const DeepCollectionEquality().hash(mentionedChannelMembers), + const DeepCollectionEquality().hash(mentionedGroupIds), + const DeepCollectionEquality().hash(mentionedGroups), + mentionedHere, + const DeepCollectionEquality().hash(mentionedRoles), + const DeepCollectionEquality().hash(mentionedUsers), + messageTextUpdatedAt, + mml, + moderation, + const DeepCollectionEquality().hash(ownReactions), + parentId, + pinExpires, + pinned, + pinnedAt, + pinnedBy, + poll, + pollId, + quotedMessage, + quotedMessageId, + const DeepCollectionEquality().hash(reactionCounts), + const DeepCollectionEquality().hash(reactionGroups), + const DeepCollectionEquality().hash(reactionScores), + reminder, + replyCount, + const DeepCollectionEquality().hash(restrictedVisibility), + shadowed, + sharedLocation, + showInChannel, + silent, + text, + const DeepCollectionEquality().hash(threadParticipants), + type, + updatedAt, + user, + ]); + + @override + String toString() { + return 'MessageWithChannelResponse(attachments: $attachments, channel: $channel, cid: $cid, command: $command, createdAt: $createdAt, custom: $custom, deletedAt: $deletedAt, deletedForMe: $deletedForMe, deletedReplyCount: $deletedReplyCount, draft: $draft, html: $html, i18n: $i18n, id: $id, imageLabels: $imageLabels, latestReactions: $latestReactions, member: $member, mentionedChannel: $mentionedChannel, mentionedChannelMembers: $mentionedChannelMembers, mentionedGroupIds: $mentionedGroupIds, mentionedGroups: $mentionedGroups, mentionedHere: $mentionedHere, mentionedRoles: $mentionedRoles, mentionedUsers: $mentionedUsers, messageTextUpdatedAt: $messageTextUpdatedAt, mml: $mml, moderation: $moderation, ownReactions: $ownReactions, parentId: $parentId, pinExpires: $pinExpires, pinned: $pinned, pinnedAt: $pinnedAt, pinnedBy: $pinnedBy, poll: $poll, pollId: $pollId, quotedMessage: $quotedMessage, quotedMessageId: $quotedMessageId, reactionCounts: $reactionCounts, reactionGroups: $reactionGroups, reactionScores: $reactionScores, reminder: $reminder, replyCount: $replyCount, restrictedVisibility: $restrictedVisibility, shadowed: $shadowed, sharedLocation: $sharedLocation, showInChannel: $showInChannel, silent: $silent, text: $text, threadParticipants: $threadParticipants, type: $type, updatedAt: $updatedAt, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $MessageWithChannelResponseCopyWith<$Res> { + factory $MessageWithChannelResponseCopyWith( + MessageWithChannelResponse value, + $Res Function(MessageWithChannelResponse) _then, + ) = _$MessageWithChannelResponseCopyWithImpl; + @useResult + $Res call({ + List attachments, + ChannelResponse channel, + String cid, + String? command, + DateTime createdAt, + Map custom, + DateTime? deletedAt, + bool? deletedForMe, + int deletedReplyCount, + DraftResponse? draft, + String html, + Map? i18n, + String id, + Map>? imageLabels, + List latestReactions, + ChannelMemberPartialResponse? member, + bool mentionedChannel, + Map? mentionedChannelMembers, + List? mentionedGroupIds, + List? mentionedGroups, + bool mentionedHere, + List? mentionedRoles, + List mentionedUsers, + DateTime? messageTextUpdatedAt, + String? mml, + ModerationV2Response? moderation, + List ownReactions, + String? parentId, + DateTime? pinExpires, + bool pinned, + DateTime? pinnedAt, + UserResponse? pinnedBy, + PollResponseData? poll, + String? pollId, + MessageResponse? quotedMessage, + String? quotedMessageId, + Map reactionCounts, + Map? reactionGroups, + Map reactionScores, + ReminderResponseData? reminder, + int replyCount, + List restrictedVisibility, + bool shadowed, + SharedLocationResponseData? sharedLocation, + bool? showInChannel, + bool silent, + String text, + List? threadParticipants, + String type, + DateTime updatedAt, + UserResponse user, + }); +} + +/// @nodoc +class _$MessageWithChannelResponseCopyWithImpl<$Res> implements $MessageWithChannelResponseCopyWith<$Res> { + _$MessageWithChannelResponseCopyWithImpl(this._self, this._then); + + final MessageWithChannelResponse _self; + final $Res Function(MessageWithChannelResponse) _then; + + /// Create a copy of MessageWithChannelResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? attachments = null, + Object? channel = null, + Object? cid = null, + Object? command = freezed, + Object? createdAt = null, + Object? custom = null, + Object? deletedAt = freezed, + Object? deletedForMe = freezed, + Object? deletedReplyCount = null, + Object? draft = freezed, + Object? html = null, + Object? i18n = freezed, + Object? id = null, + Object? imageLabels = freezed, + Object? latestReactions = null, + Object? member = freezed, + Object? mentionedChannel = null, + Object? mentionedChannelMembers = freezed, + Object? mentionedGroupIds = freezed, + Object? mentionedGroups = freezed, + Object? mentionedHere = null, + Object? mentionedRoles = freezed, + Object? mentionedUsers = null, + Object? messageTextUpdatedAt = freezed, + Object? mml = freezed, + Object? moderation = freezed, + Object? ownReactions = null, + Object? parentId = freezed, + Object? pinExpires = freezed, + Object? pinned = null, + Object? pinnedAt = freezed, + Object? pinnedBy = freezed, + Object? poll = freezed, + Object? pollId = freezed, + Object? quotedMessage = freezed, + Object? quotedMessageId = freezed, + Object? reactionCounts = null, + Object? reactionGroups = freezed, + Object? reactionScores = null, + Object? reminder = freezed, + Object? replyCount = null, + Object? restrictedVisibility = null, + Object? shadowed = null, + Object? sharedLocation = freezed, + Object? showInChannel = freezed, + Object? silent = null, + Object? text = null, + Object? threadParticipants = freezed, + Object? type = null, + Object? updatedAt = null, + Object? user = null, + }) { + return _then( + MessageWithChannelResponse( + attachments: null == attachments + ? _self.attachments + : attachments // ignore: cast_nullable_to_non_nullable + as List, + channel: null == channel + ? _self.channel + : channel // ignore: cast_nullable_to_non_nullable + as ChannelResponse, + cid: null == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String, + command: freezed == command + ? _self.command + : command // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + deletedAt: freezed == deletedAt + ? _self.deletedAt + : deletedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + deletedForMe: freezed == deletedForMe + ? _self.deletedForMe + : deletedForMe // ignore: cast_nullable_to_non_nullable + as bool?, + deletedReplyCount: null == deletedReplyCount + ? _self.deletedReplyCount + : deletedReplyCount // ignore: cast_nullable_to_non_nullable + as int, + draft: freezed == draft + ? _self.draft + : draft // ignore: cast_nullable_to_non_nullable + as DraftResponse?, + html: null == html + ? _self.html + : html // ignore: cast_nullable_to_non_nullable + as String, + i18n: freezed == i18n + ? _self.i18n + : i18n // ignore: cast_nullable_to_non_nullable + as Map?, + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + imageLabels: freezed == imageLabels + ? _self.imageLabels + : imageLabels // ignore: cast_nullable_to_non_nullable + as Map>?, + latestReactions: null == latestReactions + ? _self.latestReactions + : latestReactions // ignore: cast_nullable_to_non_nullable + as List, + member: freezed == member + ? _self.member + : member // ignore: cast_nullable_to_non_nullable + as ChannelMemberPartialResponse?, + mentionedChannel: null == mentionedChannel + ? _self.mentionedChannel + : mentionedChannel // ignore: cast_nullable_to_non_nullable + as bool, + mentionedChannelMembers: freezed == mentionedChannelMembers + ? _self.mentionedChannelMembers + : mentionedChannelMembers // ignore: cast_nullable_to_non_nullable + as Map?, + mentionedGroupIds: freezed == mentionedGroupIds + ? _self.mentionedGroupIds + : mentionedGroupIds // ignore: cast_nullable_to_non_nullable + as List?, + mentionedGroups: freezed == mentionedGroups + ? _self.mentionedGroups + : mentionedGroups // ignore: cast_nullable_to_non_nullable + as List?, + mentionedHere: null == mentionedHere + ? _self.mentionedHere + : mentionedHere // ignore: cast_nullable_to_non_nullable + as bool, + mentionedRoles: freezed == mentionedRoles + ? _self.mentionedRoles + : mentionedRoles // ignore: cast_nullable_to_non_nullable + as List?, + mentionedUsers: null == mentionedUsers + ? _self.mentionedUsers + : mentionedUsers // ignore: cast_nullable_to_non_nullable + as List, + messageTextUpdatedAt: freezed == messageTextUpdatedAt + ? _self.messageTextUpdatedAt + : messageTextUpdatedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + mml: freezed == mml + ? _self.mml + : mml // ignore: cast_nullable_to_non_nullable + as String?, + moderation: freezed == moderation + ? _self.moderation + : moderation // ignore: cast_nullable_to_non_nullable + as ModerationV2Response?, + ownReactions: null == ownReactions + ? _self.ownReactions + : ownReactions // ignore: cast_nullable_to_non_nullable + as List, + parentId: freezed == parentId + ? _self.parentId + : parentId // ignore: cast_nullable_to_non_nullable + as String?, + pinExpires: freezed == pinExpires + ? _self.pinExpires + : pinExpires // ignore: cast_nullable_to_non_nullable + as DateTime?, + pinned: null == pinned + ? _self.pinned + : pinned // ignore: cast_nullable_to_non_nullable + as bool, + pinnedAt: freezed == pinnedAt + ? _self.pinnedAt + : pinnedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + pinnedBy: freezed == pinnedBy + ? _self.pinnedBy + : pinnedBy // ignore: cast_nullable_to_non_nullable + as UserResponse?, + poll: freezed == poll + ? _self.poll + : poll // ignore: cast_nullable_to_non_nullable + as PollResponseData?, + pollId: freezed == pollId + ? _self.pollId + : pollId // ignore: cast_nullable_to_non_nullable + as String?, + quotedMessage: freezed == quotedMessage + ? _self.quotedMessage + : quotedMessage // ignore: cast_nullable_to_non_nullable + as MessageResponse?, + quotedMessageId: freezed == quotedMessageId + ? _self.quotedMessageId + : quotedMessageId // ignore: cast_nullable_to_non_nullable + as String?, + reactionCounts: null == reactionCounts + ? _self.reactionCounts + : reactionCounts // ignore: cast_nullable_to_non_nullable + as Map, + reactionGroups: freezed == reactionGroups + ? _self.reactionGroups + : reactionGroups // ignore: cast_nullable_to_non_nullable + as Map?, + reactionScores: null == reactionScores + ? _self.reactionScores + : reactionScores // ignore: cast_nullable_to_non_nullable + as Map, + reminder: freezed == reminder + ? _self.reminder + : reminder // ignore: cast_nullable_to_non_nullable + as ReminderResponseData?, + replyCount: null == replyCount + ? _self.replyCount + : replyCount // ignore: cast_nullable_to_non_nullable + as int, + restrictedVisibility: null == restrictedVisibility + ? _self.restrictedVisibility + : restrictedVisibility // ignore: cast_nullable_to_non_nullable + as List, + shadowed: null == shadowed + ? _self.shadowed + : shadowed // ignore: cast_nullable_to_non_nullable + as bool, + sharedLocation: freezed == sharedLocation + ? _self.sharedLocation + : sharedLocation // ignore: cast_nullable_to_non_nullable + as SharedLocationResponseData?, + showInChannel: freezed == showInChannel + ? _self.showInChannel + : showInChannel // ignore: cast_nullable_to_non_nullable + as bool?, + silent: null == silent + ? _self.silent + : silent // ignore: cast_nullable_to_non_nullable + as bool, + text: null == text + ? _self.text + : text // ignore: cast_nullable_to_non_nullable + as String, + threadParticipants: freezed == threadParticipants + ? _self.threadParticipants + : threadParticipants // ignore: cast_nullable_to_non_nullable + as List?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + updatedAt: null == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + user: null == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponse, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/message_with_channel_response.g.dart b/packages/stream_chat/lib/open_api/model/message_with_channel_response.g.dart new file mode 100644 index 0000000000..0dc0a8d189 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/message_with_channel_response.g.dart @@ -0,0 +1,200 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'message_with_channel_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +MessageWithChannelResponse _$MessageWithChannelResponseFromJson( + Map json, +) => MessageWithChannelResponse( + attachments: (json['attachments'] as List) + .map((e) => Attachment.fromJson(e as Map)) + .toList(), + channel: ChannelResponse.fromJson(json['channel'] as Map), + cid: json['cid'] as String, + command: json['command'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + deletedAt: _$JsonConverterFromJson( + json['deleted_at'], + const StreamDateTimeConverter().fromJson, + ), + deletedForMe: json['deleted_for_me'] as bool?, + deletedReplyCount: (json['deleted_reply_count'] as num).toInt(), + draft: json['draft'] == null ? null : DraftResponse.fromJson(json['draft'] as Map), + html: json['html'] as String, + i18n: (json['i18n'] as Map?)?.map( + (k, e) => MapEntry(k, e as String), + ), + id: json['id'] as String, + imageLabels: (json['image_labels'] as Map?)?.map( + (k, e) => MapEntry(k, (e as List).map((e) => e as String).toList()), + ), + latestReactions: (json['latest_reactions'] as List) + .map((e) => ReactionResponse.fromJson(e as Map)) + .toList(), + member: json['member'] == null + ? null + : ChannelMemberPartialResponse.fromJson( + json['member'] as Map, + ), + mentionedChannel: json['mentioned_channel'] as bool, + mentionedChannelMembers: (json['mentioned_channel_members'] as Map?)?.map( + (k, e) => MapEntry( + k, + ChannelMemberPartialResponse.fromJson(e as Map), + ), + ), + mentionedGroupIds: (json['mentioned_group_ids'] as List?)?.map((e) => e as String).toList(), + mentionedGroups: (json['mentioned_groups'] as List?) + ?.map((e) => UserGroupResponse.fromJson(e as Map)) + .toList(), + mentionedHere: json['mentioned_here'] as bool, + mentionedRoles: (json['mentioned_roles'] as List?)?.map((e) => e as String).toList(), + mentionedUsers: (json['mentioned_users'] as List) + .map((e) => UserResponse.fromJson(e as Map)) + .toList(), + messageTextUpdatedAt: _$JsonConverterFromJson( + json['message_text_updated_at'], + const StreamDateTimeConverter().fromJson, + ), + mml: json['mml'] as String?, + moderation: json['moderation'] == null + ? null + : ModerationV2Response.fromJson( + json['moderation'] as Map, + ), + ownReactions: (json['own_reactions'] as List) + .map((e) => ReactionResponse.fromJson(e as Map)) + .toList(), + parentId: json['parent_id'] as String?, + pinExpires: _$JsonConverterFromJson( + json['pin_expires'], + const StreamDateTimeConverter().fromJson, + ), + pinned: json['pinned'] as bool, + pinnedAt: _$JsonConverterFromJson( + json['pinned_at'], + const StreamDateTimeConverter().fromJson, + ), + pinnedBy: json['pinned_by'] == null ? null : UserResponse.fromJson(json['pinned_by'] as Map), + poll: json['poll'] == null ? null : PollResponseData.fromJson(json['poll'] as Map), + pollId: json['poll_id'] as String?, + quotedMessage: json['quoted_message'] == null + ? null + : MessageResponse.fromJson( + json['quoted_message'] as Map, + ), + quotedMessageId: json['quoted_message_id'] as String?, + reactionCounts: Map.from(json['reaction_counts'] as Map), + reactionGroups: (json['reaction_groups'] as Map?)?.map( + (k, e) => MapEntry(k, ReactionGroupResponse.fromJson(e as Map)), + ), + reactionScores: Map.from(json['reaction_scores'] as Map), + reminder: json['reminder'] == null ? null : ReminderResponseData.fromJson(json['reminder'] as Map), + replyCount: (json['reply_count'] as num).toInt(), + restrictedVisibility: (json['restricted_visibility'] as List).map((e) => e as String).toList(), + shadowed: json['shadowed'] as bool, + sharedLocation: json['shared_location'] == null + ? null + : SharedLocationResponseData.fromJson( + json['shared_location'] as Map, + ), + showInChannel: json['show_in_channel'] as bool?, + silent: json['silent'] as bool, + text: json['text'] as String, + threadParticipants: (json['thread_participants'] as List?) + ?.map((e) => UserResponse.fromJson(e as Map)) + .toList(), + type: json['type'] as String, + updatedAt: const StreamDateTimeConverter().fromJson( + json['updated_at'] as Object, + ), + user: UserResponse.fromJson(json['user'] as Map), +); + +Map _$MessageWithChannelResponseToJson( + MessageWithChannelResponse instance, +) => { + 'attachments': instance.attachments.map((e) => e.toJson()).toList(), + 'channel': instance.channel.toJson(), + 'cid': instance.cid, + 'command': instance.command, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'deleted_at': _$JsonConverterToJson( + instance.deletedAt, + const StreamDateTimeConverter().toJson, + ), + 'deleted_for_me': instance.deletedForMe, + 'deleted_reply_count': instance.deletedReplyCount, + 'draft': instance.draft?.toJson(), + 'html': instance.html, + 'i18n': instance.i18n, + 'id': instance.id, + 'image_labels': instance.imageLabels, + 'latest_reactions': instance.latestReactions.map((e) => e.toJson()).toList(), + 'member': instance.member?.toJson(), + 'mentioned_channel': instance.mentionedChannel, + 'mentioned_channel_members': instance.mentionedChannelMembers?.map( + (k, e) => MapEntry(k, e.toJson()), + ), + 'mentioned_group_ids': instance.mentionedGroupIds, + 'mentioned_groups': instance.mentionedGroups?.map((e) => e.toJson()).toList(), + 'mentioned_here': instance.mentionedHere, + 'mentioned_roles': instance.mentionedRoles, + 'mentioned_users': instance.mentionedUsers.map((e) => e.toJson()).toList(), + 'message_text_updated_at': _$JsonConverterToJson( + instance.messageTextUpdatedAt, + const StreamDateTimeConverter().toJson, + ), + 'mml': instance.mml, + 'moderation': instance.moderation?.toJson(), + 'own_reactions': instance.ownReactions.map((e) => e.toJson()).toList(), + 'parent_id': instance.parentId, + 'pin_expires': _$JsonConverterToJson( + instance.pinExpires, + const StreamDateTimeConverter().toJson, + ), + 'pinned': instance.pinned, + 'pinned_at': _$JsonConverterToJson( + instance.pinnedAt, + const StreamDateTimeConverter().toJson, + ), + 'pinned_by': instance.pinnedBy?.toJson(), + 'poll': instance.poll?.toJson(), + 'poll_id': instance.pollId, + 'quoted_message': instance.quotedMessage?.toJson(), + 'quoted_message_id': instance.quotedMessageId, + 'reaction_counts': instance.reactionCounts, + 'reaction_groups': instance.reactionGroups?.map( + (k, e) => MapEntry(k, e.toJson()), + ), + 'reaction_scores': instance.reactionScores, + 'reminder': instance.reminder?.toJson(), + 'reply_count': instance.replyCount, + 'restricted_visibility': instance.restrictedVisibility, + 'shadowed': instance.shadowed, + 'shared_location': instance.sharedLocation?.toJson(), + 'show_in_channel': instance.showInChannel, + 'silent': instance.silent, + 'text': instance.text, + 'thread_participants': instance.threadParticipants?.map((e) => e.toJson()).toList(), + 'type': instance.type, + 'updated_at': const StreamDateTimeConverter().toJson(instance.updatedAt), + 'user': instance.user.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/moderation_action_config_response.dart b/packages/stream_chat/lib/open_api/model/moderation_action_config_response.dart new file mode 100644 index 0000000000..d3c105f3ab --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/moderation_action_config_response.dart @@ -0,0 +1,67 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'moderation_action_config_response.g.dart'; +part 'moderation_action_config_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ModerationActionConfigResponse with _$ModerationActionConfigResponse { + const ModerationActionConfigResponse({ + required this.action, + this.custom, + required this.description, + required this.entityType, + required this.icon, + this.id, + required this.order, + this.queueType, + }); + + @override + @JsonKey(name: 'action') + final String action; + + @override + @JsonKey(name: 'custom') + final Map? custom; + + @override + @JsonKey(name: 'description') + final String description; + + @override + @JsonKey(name: 'entity_type') + final String entityType; + + @override + @JsonKey(name: 'icon') + final String icon; + + @override + @JsonKey(name: 'id') + final String? id; + + @override + @JsonKey(name: 'order') + final int order; + + @override + @JsonKey(name: 'queue_type') + final String? queueType; + + Map toJson() => _$ModerationActionConfigResponseToJson(this); + + static ModerationActionConfigResponse fromJson(Map json) => + _$ModerationActionConfigResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/moderation_action_config_response.freezed.dart b/packages/stream_chat/lib/open_api/model/moderation_action_config_response.freezed.dart new file mode 100644 index 0000000000..7eed4770b6 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/moderation_action_config_response.freezed.dart @@ -0,0 +1,146 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'moderation_action_config_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ModerationActionConfigResponse { + String get action; + Map? get custom; + String get description; + String get entityType; + String get icon; + String? get id; + int get order; + String? get queueType; + + /// Create a copy of ModerationActionConfigResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ModerationActionConfigResponseCopyWith get copyWith => + _$ModerationActionConfigResponseCopyWithImpl( + this as ModerationActionConfigResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ModerationActionConfigResponse && + (identical(other.action, action) || other.action == action) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.description, description) || other.description == description) && + (identical(other.entityType, entityType) || other.entityType == entityType) && + (identical(other.icon, icon) || other.icon == icon) && + (identical(other.id, id) || other.id == id) && + (identical(other.order, order) || other.order == order) && + (identical(other.queueType, queueType) || other.queueType == queueType)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + action, + const DeepCollectionEquality().hash(custom), + description, + entityType, + icon, + id, + order, + queueType, + ); + + @override + String toString() { + return 'ModerationActionConfigResponse(action: $action, custom: $custom, description: $description, entityType: $entityType, icon: $icon, id: $id, order: $order, queueType: $queueType)'; + } +} + +/// @nodoc +abstract mixin class $ModerationActionConfigResponseCopyWith<$Res> { + factory $ModerationActionConfigResponseCopyWith( + ModerationActionConfigResponse value, + $Res Function(ModerationActionConfigResponse) _then, + ) = _$ModerationActionConfigResponseCopyWithImpl; + @useResult + $Res call({ + String action, + Map? custom, + String description, + String entityType, + String icon, + String? id, + int order, + String? queueType, + }); +} + +/// @nodoc +class _$ModerationActionConfigResponseCopyWithImpl<$Res> implements $ModerationActionConfigResponseCopyWith<$Res> { + _$ModerationActionConfigResponseCopyWithImpl(this._self, this._then); + + final ModerationActionConfigResponse _self; + final $Res Function(ModerationActionConfigResponse) _then; + + /// Create a copy of ModerationActionConfigResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? action = null, + Object? custom = freezed, + Object? description = null, + Object? entityType = null, + Object? icon = null, + Object? id = freezed, + Object? order = null, + Object? queueType = freezed, + }) { + return _then( + ModerationActionConfigResponse( + action: null == action + ? _self.action + : action // ignore: cast_nullable_to_non_nullable + as String, + custom: freezed == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map?, + description: null == description + ? _self.description + : description // ignore: cast_nullable_to_non_nullable + as String, + entityType: null == entityType + ? _self.entityType + : entityType // ignore: cast_nullable_to_non_nullable + as String, + icon: null == icon + ? _self.icon + : icon // ignore: cast_nullable_to_non_nullable + as String, + id: freezed == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String?, + order: null == order + ? _self.order + : order // ignore: cast_nullable_to_non_nullable + as int, + queueType: freezed == queueType + ? _self.queueType + : queueType // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/moderation_action_config_response.g.dart b/packages/stream_chat/lib/open_api/model/moderation_action_config_response.g.dart new file mode 100644 index 0000000000..8f1b2615fc --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/moderation_action_config_response.g.dart @@ -0,0 +1,33 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'moderation_action_config_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ModerationActionConfigResponse _$ModerationActionConfigResponseFromJson( + Map json, +) => ModerationActionConfigResponse( + action: json['action'] as String, + custom: json['custom'] as Map?, + description: json['description'] as String, + entityType: json['entity_type'] as String, + icon: json['icon'] as String, + id: json['id'] as String?, + order: (json['order'] as num).toInt(), + queueType: json['queue_type'] as String?, +); + +Map _$ModerationActionConfigResponseToJson( + ModerationActionConfigResponse instance, +) => { + 'action': instance.action, + 'custom': instance.custom, + 'description': instance.description, + 'entity_type': instance.entityType, + 'icon': instance.icon, + 'id': instance.id, + 'order': instance.order, + 'queue_type': instance.queueType, +}; diff --git a/packages/stream_chat/lib/open_api/model/moderation_ban_response.dart b/packages/stream_chat/lib/open_api/model/moderation_ban_response.dart new file mode 100644 index 0000000000..0a7ba432fe --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/moderation_ban_response.dart @@ -0,0 +1,31 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'moderation_ban_response.g.dart'; +part 'moderation_ban_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ModerationBanResponse with _$ModerationBanResponse { + const ModerationBanResponse({ + required this.duration, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + Map toJson() => _$ModerationBanResponseToJson(this); + + static ModerationBanResponse fromJson(Map json) => _$ModerationBanResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/moderation_ban_response.freezed.dart b/packages/stream_chat/lib/open_api/model/moderation_ban_response.freezed.dart new file mode 100644 index 0000000000..b557cb35d0 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/moderation_ban_response.freezed.dart @@ -0,0 +1,76 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'moderation_ban_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ModerationBanResponse { + String get duration; + + /// Create a copy of ModerationBanResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ModerationBanResponseCopyWith get copyWith => + _$ModerationBanResponseCopyWithImpl( + this as ModerationBanResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ModerationBanResponse && + (identical(other.duration, duration) || other.duration == duration)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration); + + @override + String toString() { + return 'ModerationBanResponse(duration: $duration)'; + } +} + +/// @nodoc +abstract mixin class $ModerationBanResponseCopyWith<$Res> { + factory $ModerationBanResponseCopyWith( + ModerationBanResponse value, + $Res Function(ModerationBanResponse) _then, + ) = _$ModerationBanResponseCopyWithImpl; + @useResult + $Res call({String duration}); +} + +/// @nodoc +class _$ModerationBanResponseCopyWithImpl<$Res> implements $ModerationBanResponseCopyWith<$Res> { + _$ModerationBanResponseCopyWithImpl(this._self, this._then); + + final ModerationBanResponse _self; + final $Res Function(ModerationBanResponse) _then; + + /// Create a copy of ModerationBanResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null}) { + return _then( + ModerationBanResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/moderation_ban_response.g.dart b/packages/stream_chat/lib/open_api/model/moderation_ban_response.g.dart new file mode 100644 index 0000000000..254ca6d82d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/moderation_ban_response.g.dart @@ -0,0 +1,15 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'moderation_ban_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ModerationBanResponse _$ModerationBanResponseFromJson( + Map json, +) => ModerationBanResponse(duration: json['duration'] as String); + +Map _$ModerationBanResponseToJson( + ModerationBanResponse instance, +) => {'duration': instance.duration}; diff --git a/packages/stream_chat/lib/open_api/model/moderation_call_response.dart b/packages/stream_chat/lib/open_api/model/moderation_call_response.dart new file mode 100644 index 0000000000..a5e523e542 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/moderation_call_response.dart @@ -0,0 +1,130 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'moderation_call_response.g.dart'; +part 'moderation_call_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ModerationCallResponse with _$ModerationCallResponse { + const ModerationCallResponse({ + required this.backstage, + required this.blockedUserIds, + required this.captioning, + this.channelCid, + required this.cid, + required this.createdAt, + this.createdBy, + required this.currentSessionId, + required this.custom, + this.endedAt, + required this.id, + this.joinAheadTimeSeconds, + required this.recording, + this.routingNumber, + this.startsAt, + this.team, + required this.transcribing, + required this.translating, + required this.type, + required this.updatedAt, + }); + + @override + @JsonKey(name: 'backstage') + final bool backstage; + + @override + @JsonKey(name: 'blocked_user_ids') + final List blockedUserIds; + + @override + @JsonKey(name: 'captioning') + final bool captioning; + + @override + @JsonKey(name: 'channel_cid') + final String? channelCid; + + @override + @JsonKey(name: 'cid') + final String cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'created_by') + final UserResponse? createdBy; + + @override + @JsonKey(name: 'current_session_id') + final String currentSessionId; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'ended_at') + final DateTime? endedAt; + + @override + @JsonKey(name: 'id') + final String id; + + @override + @JsonKey(name: 'join_ahead_time_seconds') + final int? joinAheadTimeSeconds; + + @override + @JsonKey(name: 'recording') + final bool recording; + + @override + @JsonKey(name: 'routing_number') + final String? routingNumber; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'starts_at') + final DateTime? startsAt; + + @override + @JsonKey(name: 'team') + final String? team; + + @override + @JsonKey(name: 'transcribing') + final bool transcribing; + + @override + @JsonKey(name: 'translating') + final bool translating; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'updated_at') + final DateTime updatedAt; + + Map toJson() => _$ModerationCallResponseToJson(this); + + static ModerationCallResponse fromJson(Map json) => _$ModerationCallResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/moderation_call_response.freezed.dart b/packages/stream_chat/lib/open_api/model/moderation_call_response.freezed.dart new file mode 100644 index 0000000000..fa5e29287d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/moderation_call_response.freezed.dart @@ -0,0 +1,258 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'moderation_call_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ModerationCallResponse { + bool get backstage; + List get blockedUserIds; + bool get captioning; + String? get channelCid; + String get cid; + DateTime get createdAt; + UserResponse? get createdBy; + String get currentSessionId; + Map get custom; + DateTime? get endedAt; + String get id; + int? get joinAheadTimeSeconds; + bool get recording; + String? get routingNumber; + DateTime? get startsAt; + String? get team; + bool get transcribing; + bool get translating; + String get type; + DateTime get updatedAt; + + /// Create a copy of ModerationCallResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ModerationCallResponseCopyWith get copyWith => + _$ModerationCallResponseCopyWithImpl( + this as ModerationCallResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ModerationCallResponse && + (identical(other.backstage, backstage) || other.backstage == backstage) && + const DeepCollectionEquality().equals( + other.blockedUserIds, + blockedUserIds, + ) && + (identical(other.captioning, captioning) || other.captioning == captioning) && + (identical(other.channelCid, channelCid) || other.channelCid == channelCid) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.createdBy, createdBy) || other.createdBy == createdBy) && + (identical(other.currentSessionId, currentSessionId) || other.currentSessionId == currentSessionId) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.endedAt, endedAt) || other.endedAt == endedAt) && + (identical(other.id, id) || other.id == id) && + (identical(other.joinAheadTimeSeconds, joinAheadTimeSeconds) || + other.joinAheadTimeSeconds == joinAheadTimeSeconds) && + (identical(other.recording, recording) || other.recording == recording) && + (identical(other.routingNumber, routingNumber) || other.routingNumber == routingNumber) && + (identical(other.startsAt, startsAt) || other.startsAt == startsAt) && + (identical(other.team, team) || other.team == team) && + (identical(other.transcribing, transcribing) || other.transcribing == transcribing) && + (identical(other.translating, translating) || other.translating == translating) && + (identical(other.type, type) || other.type == type) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)); + } + + @override + int get hashCode => Object.hashAll([ + runtimeType, + backstage, + const DeepCollectionEquality().hash(blockedUserIds), + captioning, + channelCid, + cid, + createdAt, + createdBy, + currentSessionId, + const DeepCollectionEquality().hash(custom), + endedAt, + id, + joinAheadTimeSeconds, + recording, + routingNumber, + startsAt, + team, + transcribing, + translating, + type, + updatedAt, + ]); + + @override + String toString() { + return 'ModerationCallResponse(backstage: $backstage, blockedUserIds: $blockedUserIds, captioning: $captioning, channelCid: $channelCid, cid: $cid, createdAt: $createdAt, createdBy: $createdBy, currentSessionId: $currentSessionId, custom: $custom, endedAt: $endedAt, id: $id, joinAheadTimeSeconds: $joinAheadTimeSeconds, recording: $recording, routingNumber: $routingNumber, startsAt: $startsAt, team: $team, transcribing: $transcribing, translating: $translating, type: $type, updatedAt: $updatedAt)'; + } +} + +/// @nodoc +abstract mixin class $ModerationCallResponseCopyWith<$Res> { + factory $ModerationCallResponseCopyWith( + ModerationCallResponse value, + $Res Function(ModerationCallResponse) _then, + ) = _$ModerationCallResponseCopyWithImpl; + @useResult + $Res call({ + bool backstage, + List blockedUserIds, + bool captioning, + String? channelCid, + String cid, + DateTime createdAt, + UserResponse? createdBy, + String currentSessionId, + Map custom, + DateTime? endedAt, + String id, + int? joinAheadTimeSeconds, + bool recording, + String? routingNumber, + DateTime? startsAt, + String? team, + bool transcribing, + bool translating, + String type, + DateTime updatedAt, + }); +} + +/// @nodoc +class _$ModerationCallResponseCopyWithImpl<$Res> implements $ModerationCallResponseCopyWith<$Res> { + _$ModerationCallResponseCopyWithImpl(this._self, this._then); + + final ModerationCallResponse _self; + final $Res Function(ModerationCallResponse) _then; + + /// Create a copy of ModerationCallResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? backstage = null, + Object? blockedUserIds = null, + Object? captioning = null, + Object? channelCid = freezed, + Object? cid = null, + Object? createdAt = null, + Object? createdBy = freezed, + Object? currentSessionId = null, + Object? custom = null, + Object? endedAt = freezed, + Object? id = null, + Object? joinAheadTimeSeconds = freezed, + Object? recording = null, + Object? routingNumber = freezed, + Object? startsAt = freezed, + Object? team = freezed, + Object? transcribing = null, + Object? translating = null, + Object? type = null, + Object? updatedAt = null, + }) { + return _then( + ModerationCallResponse( + backstage: null == backstage + ? _self.backstage + : backstage // ignore: cast_nullable_to_non_nullable + as bool, + blockedUserIds: null == blockedUserIds + ? _self.blockedUserIds + : blockedUserIds // ignore: cast_nullable_to_non_nullable + as List, + captioning: null == captioning + ? _self.captioning + : captioning // ignore: cast_nullable_to_non_nullable + as bool, + channelCid: freezed == channelCid + ? _self.channelCid + : channelCid // ignore: cast_nullable_to_non_nullable + as String?, + cid: null == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + createdBy: freezed == createdBy + ? _self.createdBy + : createdBy // ignore: cast_nullable_to_non_nullable + as UserResponse?, + currentSessionId: null == currentSessionId + ? _self.currentSessionId + : currentSessionId // ignore: cast_nullable_to_non_nullable + as String, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + endedAt: freezed == endedAt + ? _self.endedAt + : endedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + joinAheadTimeSeconds: freezed == joinAheadTimeSeconds + ? _self.joinAheadTimeSeconds + : joinAheadTimeSeconds // ignore: cast_nullable_to_non_nullable + as int?, + recording: null == recording + ? _self.recording + : recording // ignore: cast_nullable_to_non_nullable + as bool, + routingNumber: freezed == routingNumber + ? _self.routingNumber + : routingNumber // ignore: cast_nullable_to_non_nullable + as String?, + startsAt: freezed == startsAt + ? _self.startsAt + : startsAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + team: freezed == team + ? _self.team + : team // ignore: cast_nullable_to_non_nullable + as String?, + transcribing: null == transcribing + ? _self.transcribing + : transcribing // ignore: cast_nullable_to_non_nullable + as bool, + translating: null == translating + ? _self.translating + : translating // ignore: cast_nullable_to_non_nullable + as bool, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + updatedAt: null == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/moderation_call_response.g.dart b/packages/stream_chat/lib/open_api/model/moderation_call_response.g.dart new file mode 100644 index 0000000000..67c515a508 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/moderation_call_response.g.dart @@ -0,0 +1,83 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'moderation_call_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ModerationCallResponse _$ModerationCallResponseFromJson( + Map json, +) => ModerationCallResponse( + backstage: json['backstage'] as bool, + blockedUserIds: (json['blocked_user_ids'] as List).map((e) => e as String).toList(), + captioning: json['captioning'] as bool, + channelCid: json['channel_cid'] as String?, + cid: json['cid'] as String, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + createdBy: json['created_by'] == null ? null : UserResponse.fromJson(json['created_by'] as Map), + currentSessionId: json['current_session_id'] as String, + custom: json['custom'] as Map, + endedAt: _$JsonConverterFromJson( + json['ended_at'], + const StreamDateTimeConverter().fromJson, + ), + id: json['id'] as String, + joinAheadTimeSeconds: (json['join_ahead_time_seconds'] as num?)?.toInt(), + recording: json['recording'] as bool, + routingNumber: json['routing_number'] as String?, + startsAt: _$JsonConverterFromJson( + json['starts_at'], + const StreamDateTimeConverter().fromJson, + ), + team: json['team'] as String?, + transcribing: json['transcribing'] as bool, + translating: json['translating'] as bool, + type: json['type'] as String, + updatedAt: const StreamDateTimeConverter().fromJson( + json['updated_at'] as Object, + ), +); + +Map _$ModerationCallResponseToJson( + ModerationCallResponse instance, +) => { + 'backstage': instance.backstage, + 'blocked_user_ids': instance.blockedUserIds, + 'captioning': instance.captioning, + 'channel_cid': instance.channelCid, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'created_by': instance.createdBy?.toJson(), + 'current_session_id': instance.currentSessionId, + 'custom': instance.custom, + 'ended_at': _$JsonConverterToJson( + instance.endedAt, + const StreamDateTimeConverter().toJson, + ), + 'id': instance.id, + 'join_ahead_time_seconds': instance.joinAheadTimeSeconds, + 'recording': instance.recording, + 'routing_number': instance.routingNumber, + 'starts_at': _$JsonConverterToJson( + instance.startsAt, + const StreamDateTimeConverter().toJson, + ), + 'team': instance.team, + 'transcribing': instance.transcribing, + 'translating': instance.translating, + 'type': instance.type, + 'updated_at': const StreamDateTimeConverter().toJson(instance.updatedAt), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/moderation_custom_action_event.dart b/packages/stream_chat/lib/open_api/model/moderation_custom_action_event.dart new file mode 100644 index 0000000000..1ebf19770a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/moderation_custom_action_event.dart @@ -0,0 +1,68 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'moderation_custom_action_event.g.dart'; +part 'moderation_custom_action_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ModerationCustomActionEvent extends core.WsEvent with _$ModerationCustomActionEvent { + const ModerationCustomActionEvent({ + required this.actionId, + this.actionOptions, + required this.createdAt, + required this.custom, + this.message, + this.receivedAt, + required this.reviewQueueItem, + required this.type, + }); + + @override + @JsonKey(name: 'action_id') + final String actionId; + + @override + @JsonKey(name: 'action_options') + final Map? actionOptions; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'message') + final MessageResponse? message; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'review_queue_item') + final ReviewQueueItemResponse reviewQueueItem; + + @override + @JsonKey(name: 'type') + final String type; + + Map toJson() => _$ModerationCustomActionEventToJson(this); + + static ModerationCustomActionEvent fromJson(Map json) => _$ModerationCustomActionEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/moderation_custom_action_event.freezed.dart b/packages/stream_chat/lib/open_api/model/moderation_custom_action_event.freezed.dart new file mode 100644 index 0000000000..66d20a0b12 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/moderation_custom_action_event.freezed.dart @@ -0,0 +1,149 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'moderation_custom_action_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ModerationCustomActionEvent { + String get actionId; + Map? get actionOptions; + DateTime get createdAt; + Map get custom; + MessageResponse? get message; + DateTime? get receivedAt; + ReviewQueueItemResponse get reviewQueueItem; + String get type; + + /// Create a copy of ModerationCustomActionEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ModerationCustomActionEventCopyWith get copyWith => + _$ModerationCustomActionEventCopyWithImpl( + this as ModerationCustomActionEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ModerationCustomActionEvent && + (identical(other.actionId, actionId) || other.actionId == actionId) && + const DeepCollectionEquality().equals( + other.actionOptions, + actionOptions, + ) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.message, message) || other.message == message) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.reviewQueueItem, reviewQueueItem) || other.reviewQueueItem == reviewQueueItem) && + (identical(other.type, type) || other.type == type)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + actionId, + const DeepCollectionEquality().hash(actionOptions), + createdAt, + const DeepCollectionEquality().hash(custom), + message, + receivedAt, + reviewQueueItem, + type, + ); + + @override + String toString() { + return 'ModerationCustomActionEvent(actionId: $actionId, actionOptions: $actionOptions, createdAt: $createdAt, custom: $custom, message: $message, receivedAt: $receivedAt, reviewQueueItem: $reviewQueueItem, type: $type)'; + } +} + +/// @nodoc +abstract mixin class $ModerationCustomActionEventCopyWith<$Res> { + factory $ModerationCustomActionEventCopyWith( + ModerationCustomActionEvent value, + $Res Function(ModerationCustomActionEvent) _then, + ) = _$ModerationCustomActionEventCopyWithImpl; + @useResult + $Res call({ + String actionId, + Map? actionOptions, + DateTime createdAt, + Map custom, + MessageResponse? message, + DateTime? receivedAt, + ReviewQueueItemResponse reviewQueueItem, + String type, + }); +} + +/// @nodoc +class _$ModerationCustomActionEventCopyWithImpl<$Res> implements $ModerationCustomActionEventCopyWith<$Res> { + _$ModerationCustomActionEventCopyWithImpl(this._self, this._then); + + final ModerationCustomActionEvent _self; + final $Res Function(ModerationCustomActionEvent) _then; + + /// Create a copy of ModerationCustomActionEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? actionId = null, + Object? actionOptions = freezed, + Object? createdAt = null, + Object? custom = null, + Object? message = freezed, + Object? receivedAt = freezed, + Object? reviewQueueItem = null, + Object? type = null, + }) { + return _then( + ModerationCustomActionEvent( + actionId: null == actionId + ? _self.actionId + : actionId // ignore: cast_nullable_to_non_nullable + as String, + actionOptions: freezed == actionOptions + ? _self.actionOptions + : actionOptions // ignore: cast_nullable_to_non_nullable + as Map?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + message: freezed == message + ? _self.message + : message // ignore: cast_nullable_to_non_nullable + as MessageResponse?, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + reviewQueueItem: null == reviewQueueItem + ? _self.reviewQueueItem + : reviewQueueItem // ignore: cast_nullable_to_non_nullable + as ReviewQueueItemResponse, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/moderation_custom_action_event.g.dart b/packages/stream_chat/lib/open_api/model/moderation_custom_action_event.g.dart new file mode 100644 index 0000000000..7d551e79e5 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/moderation_custom_action_event.g.dart @@ -0,0 +1,53 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'moderation_custom_action_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ModerationCustomActionEvent _$ModerationCustomActionEventFromJson( + Map json, +) => ModerationCustomActionEvent( + actionId: json['action_id'] as String, + actionOptions: json['action_options'] as Map?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + message: json['message'] == null ? null : MessageResponse.fromJson(json['message'] as Map), + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + reviewQueueItem: ReviewQueueItemResponse.fromJson( + json['review_queue_item'] as Map, + ), + type: json['type'] as String, +); + +Map _$ModerationCustomActionEventToJson( + ModerationCustomActionEvent instance, +) => { + 'action_id': instance.actionId, + 'action_options': instance.actionOptions, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'message': instance.message?.toJson(), + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'review_queue_item': instance.reviewQueueItem.toJson(), + 'type': instance.type, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/moderation_flag_response.dart b/packages/stream_chat/lib/open_api/model/moderation_flag_response.dart new file mode 100644 index 0000000000..74bab102cf --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/moderation_flag_response.dart @@ -0,0 +1,103 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'moderation_flag_response.g.dart'; +part 'moderation_flag_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ModerationFlagResponse with _$ModerationFlagResponse { + const ModerationFlagResponse({ + required this.createdAt, + this.custom, + this.entityCreatorId, + required this.entityId, + required this.entityType, + this.labels, + this.moderationPayload, + this.reason, + required this.result, + this.reviewQueueItem, + this.reviewQueueItemId, + required this.type, + required this.updatedAt, + this.user, + required this.userId, + }); + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map? custom; + + @override + @JsonKey(name: 'entity_creator_id') + final String? entityCreatorId; + + @override + @JsonKey(name: 'entity_id') + final String entityId; + + @override + @JsonKey(name: 'entity_type') + final String entityType; + + @override + @JsonKey(name: 'labels') + final List? labels; + + @override + @JsonKey(name: 'moderation_payload') + final ModerationPayloadResponse? moderationPayload; + + @override + @JsonKey(name: 'reason') + final String? reason; + + @override + @JsonKey(name: 'result') + final List> result; + + @override + @JsonKey(name: 'review_queue_item') + final ReviewQueueItemResponse? reviewQueueItem; + + @override + @JsonKey(name: 'review_queue_item_id') + final String? reviewQueueItemId; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'updated_at') + final DateTime updatedAt; + + @override + @JsonKey(name: 'user') + final UserResponse? user; + + @override + @JsonKey(name: 'user_id') + final String userId; + + Map toJson() => _$ModerationFlagResponseToJson(this); + + static ModerationFlagResponse fromJson(Map json) => _$ModerationFlagResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/moderation_flag_response.freezed.dart b/packages/stream_chat/lib/open_api/model/moderation_flag_response.freezed.dart new file mode 100644 index 0000000000..23c4ce823d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/moderation_flag_response.freezed.dart @@ -0,0 +1,209 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'moderation_flag_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ModerationFlagResponse { + DateTime get createdAt; + Map? get custom; + String? get entityCreatorId; + String get entityId; + String get entityType; + List? get labels; + ModerationPayloadResponse? get moderationPayload; + String? get reason; + List> get result; + ReviewQueueItemResponse? get reviewQueueItem; + String? get reviewQueueItemId; + String get type; + DateTime get updatedAt; + UserResponse? get user; + String get userId; + + /// Create a copy of ModerationFlagResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ModerationFlagResponseCopyWith get copyWith => + _$ModerationFlagResponseCopyWithImpl( + this as ModerationFlagResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ModerationFlagResponse && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.entityCreatorId, entityCreatorId) || other.entityCreatorId == entityCreatorId) && + (identical(other.entityId, entityId) || other.entityId == entityId) && + (identical(other.entityType, entityType) || other.entityType == entityType) && + const DeepCollectionEquality().equals(other.labels, labels) && + (identical(other.moderationPayload, moderationPayload) || other.moderationPayload == moderationPayload) && + (identical(other.reason, reason) || other.reason == reason) && + const DeepCollectionEquality().equals(other.result, result) && + (identical(other.reviewQueueItem, reviewQueueItem) || other.reviewQueueItem == reviewQueueItem) && + (identical(other.reviewQueueItemId, reviewQueueItemId) || other.reviewQueueItemId == reviewQueueItemId) && + (identical(other.type, type) || other.type == type) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt) && + (identical(other.user, user) || other.user == user) && + (identical(other.userId, userId) || other.userId == userId)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + createdAt, + const DeepCollectionEquality().hash(custom), + entityCreatorId, + entityId, + entityType, + const DeepCollectionEquality().hash(labels), + moderationPayload, + reason, + const DeepCollectionEquality().hash(result), + reviewQueueItem, + reviewQueueItemId, + type, + updatedAt, + user, + userId, + ); + + @override + String toString() { + return 'ModerationFlagResponse(createdAt: $createdAt, custom: $custom, entityCreatorId: $entityCreatorId, entityId: $entityId, entityType: $entityType, labels: $labels, moderationPayload: $moderationPayload, reason: $reason, result: $result, reviewQueueItem: $reviewQueueItem, reviewQueueItemId: $reviewQueueItemId, type: $type, updatedAt: $updatedAt, user: $user, userId: $userId)'; + } +} + +/// @nodoc +abstract mixin class $ModerationFlagResponseCopyWith<$Res> { + factory $ModerationFlagResponseCopyWith( + ModerationFlagResponse value, + $Res Function(ModerationFlagResponse) _then, + ) = _$ModerationFlagResponseCopyWithImpl; + @useResult + $Res call({ + DateTime createdAt, + Map? custom, + String? entityCreatorId, + String entityId, + String entityType, + List? labels, + ModerationPayloadResponse? moderationPayload, + String? reason, + List> result, + ReviewQueueItemResponse? reviewQueueItem, + String? reviewQueueItemId, + String type, + DateTime updatedAt, + UserResponse? user, + String userId, + }); +} + +/// @nodoc +class _$ModerationFlagResponseCopyWithImpl<$Res> implements $ModerationFlagResponseCopyWith<$Res> { + _$ModerationFlagResponseCopyWithImpl(this._self, this._then); + + final ModerationFlagResponse _self; + final $Res Function(ModerationFlagResponse) _then; + + /// Create a copy of ModerationFlagResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? createdAt = null, + Object? custom = freezed, + Object? entityCreatorId = freezed, + Object? entityId = null, + Object? entityType = null, + Object? labels = freezed, + Object? moderationPayload = freezed, + Object? reason = freezed, + Object? result = null, + Object? reviewQueueItem = freezed, + Object? reviewQueueItemId = freezed, + Object? type = null, + Object? updatedAt = null, + Object? user = freezed, + Object? userId = null, + }) { + return _then( + ModerationFlagResponse( + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: freezed == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map?, + entityCreatorId: freezed == entityCreatorId + ? _self.entityCreatorId + : entityCreatorId // ignore: cast_nullable_to_non_nullable + as String?, + entityId: null == entityId + ? _self.entityId + : entityId // ignore: cast_nullable_to_non_nullable + as String, + entityType: null == entityType + ? _self.entityType + : entityType // ignore: cast_nullable_to_non_nullable + as String, + labels: freezed == labels + ? _self.labels + : labels // ignore: cast_nullable_to_non_nullable + as List?, + moderationPayload: freezed == moderationPayload + ? _self.moderationPayload + : moderationPayload // ignore: cast_nullable_to_non_nullable + as ModerationPayloadResponse?, + reason: freezed == reason + ? _self.reason + : reason // ignore: cast_nullable_to_non_nullable + as String?, + result: null == result + ? _self.result + : result // ignore: cast_nullable_to_non_nullable + as List>, + reviewQueueItem: freezed == reviewQueueItem + ? _self.reviewQueueItem + : reviewQueueItem // ignore: cast_nullable_to_non_nullable + as ReviewQueueItemResponse?, + reviewQueueItemId: freezed == reviewQueueItemId + ? _self.reviewQueueItemId + : reviewQueueItemId // ignore: cast_nullable_to_non_nullable + as String?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + updatedAt: null == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponse?, + userId: null == userId + ? _self.userId + : userId // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/moderation_flag_response.g.dart b/packages/stream_chat/lib/open_api/model/moderation_flag_response.g.dart new file mode 100644 index 0000000000..10f5d9a17f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/moderation_flag_response.g.dart @@ -0,0 +1,59 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'moderation_flag_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ModerationFlagResponse _$ModerationFlagResponseFromJson( + Map json, +) => ModerationFlagResponse( + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map?, + entityCreatorId: json['entity_creator_id'] as String?, + entityId: json['entity_id'] as String, + entityType: json['entity_type'] as String, + labels: (json['labels'] as List?)?.map((e) => e as String).toList(), + moderationPayload: json['moderation_payload'] == null + ? null + : ModerationPayloadResponse.fromJson( + json['moderation_payload'] as Map, + ), + reason: json['reason'] as String?, + result: (json['result'] as List).map((e) => e as Map).toList(), + reviewQueueItem: json['review_queue_item'] == null + ? null + : ReviewQueueItemResponse.fromJson( + json['review_queue_item'] as Map, + ), + reviewQueueItemId: json['review_queue_item_id'] as String?, + type: json['type'] as String, + updatedAt: const StreamDateTimeConverter().fromJson( + json['updated_at'] as Object, + ), + user: json['user'] == null ? null : UserResponse.fromJson(json['user'] as Map), + userId: json['user_id'] as String, +); + +Map _$ModerationFlagResponseToJson( + ModerationFlagResponse instance, +) => { + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'entity_creator_id': instance.entityCreatorId, + 'entity_id': instance.entityId, + 'entity_type': instance.entityType, + 'labels': instance.labels, + 'moderation_payload': instance.moderationPayload?.toJson(), + 'reason': instance.reason, + 'result': instance.result, + 'review_queue_item': instance.reviewQueueItem?.toJson(), + 'review_queue_item_id': instance.reviewQueueItemId, + 'type': instance.type, + 'updated_at': const StreamDateTimeConverter().toJson(instance.updatedAt), + 'user': instance.user?.toJson(), + 'user_id': instance.userId, +}; diff --git a/packages/stream_chat/lib/open_api/model/moderation_flagged_event.dart b/packages/stream_chat/lib/open_api/model/moderation_flagged_event.dart new file mode 100644 index 0000000000..7fe5615200 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/moderation_flagged_event.dart @@ -0,0 +1,58 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'moderation_flagged_event.g.dart'; +part 'moderation_flagged_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ModerationFlaggedEvent extends core.WsEvent with _$ModerationFlaggedEvent { + const ModerationFlaggedEvent({ + required this.contentType, + required this.createdAt, + required this.custom, + required this.objectId, + this.receivedAt, + required this.type, + }); + + @override + @JsonKey(name: 'content_type') + final String contentType; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'object_id') + final String objectId; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'type') + final String type; + + Map toJson() => _$ModerationFlaggedEventToJson(this); + + static ModerationFlaggedEvent fromJson(Map json) => _$ModerationFlaggedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/moderation_flagged_event.freezed.dart b/packages/stream_chat/lib/open_api/model/moderation_flagged_event.freezed.dart new file mode 100644 index 0000000000..b96e698a2b --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/moderation_flagged_event.freezed.dart @@ -0,0 +1,128 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'moderation_flagged_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ModerationFlaggedEvent { + String get contentType; + DateTime get createdAt; + Map get custom; + String get objectId; + DateTime? get receivedAt; + String get type; + + /// Create a copy of ModerationFlaggedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ModerationFlaggedEventCopyWith get copyWith => + _$ModerationFlaggedEventCopyWithImpl( + this as ModerationFlaggedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ModerationFlaggedEvent && + (identical(other.contentType, contentType) || other.contentType == contentType) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.objectId, objectId) || other.objectId == objectId) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.type, type) || other.type == type)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + contentType, + createdAt, + const DeepCollectionEquality().hash(custom), + objectId, + receivedAt, + type, + ); + + @override + String toString() { + return 'ModerationFlaggedEvent(contentType: $contentType, createdAt: $createdAt, custom: $custom, objectId: $objectId, receivedAt: $receivedAt, type: $type)'; + } +} + +/// @nodoc +abstract mixin class $ModerationFlaggedEventCopyWith<$Res> { + factory $ModerationFlaggedEventCopyWith( + ModerationFlaggedEvent value, + $Res Function(ModerationFlaggedEvent) _then, + ) = _$ModerationFlaggedEventCopyWithImpl; + @useResult + $Res call({ + String contentType, + DateTime createdAt, + Map custom, + String objectId, + DateTime? receivedAt, + String type, + }); +} + +/// @nodoc +class _$ModerationFlaggedEventCopyWithImpl<$Res> implements $ModerationFlaggedEventCopyWith<$Res> { + _$ModerationFlaggedEventCopyWithImpl(this._self, this._then); + + final ModerationFlaggedEvent _self; + final $Res Function(ModerationFlaggedEvent) _then; + + /// Create a copy of ModerationFlaggedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? contentType = null, + Object? createdAt = null, + Object? custom = null, + Object? objectId = null, + Object? receivedAt = freezed, + Object? type = null, + }) { + return _then( + ModerationFlaggedEvent( + contentType: null == contentType + ? _self.contentType + : contentType // ignore: cast_nullable_to_non_nullable + as String, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + objectId: null == objectId + ? _self.objectId + : objectId // ignore: cast_nullable_to_non_nullable + as String, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/moderation_flagged_event.g.dart b/packages/stream_chat/lib/open_api/model/moderation_flagged_event.g.dart new file mode 100644 index 0000000000..a59491b26a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/moderation_flagged_event.g.dart @@ -0,0 +1,47 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'moderation_flagged_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ModerationFlaggedEvent _$ModerationFlaggedEventFromJson( + Map json, +) => ModerationFlaggedEvent( + contentType: json['content_type'] as String, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + objectId: json['object_id'] as String, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + type: json['type'] as String, +); + +Map _$ModerationFlaggedEventToJson( + ModerationFlaggedEvent instance, +) => { + 'content_type': instance.contentType, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'object_id': instance.objectId, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'type': instance.type, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/moderation_mark_reviewed_event.dart b/packages/stream_chat/lib/open_api/model/moderation_mark_reviewed_event.dart new file mode 100644 index 0000000000..a841e49f26 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/moderation_mark_reviewed_event.dart @@ -0,0 +1,58 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'moderation_mark_reviewed_event.g.dart'; +part 'moderation_mark_reviewed_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ModerationMarkReviewedEvent extends core.WsEvent with _$ModerationMarkReviewedEvent { + const ModerationMarkReviewedEvent({ + required this.createdAt, + required this.custom, + required this.item, + this.message, + this.receivedAt, + required this.type, + }); + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'item') + final ReviewQueueItemResponse item; + + @override + @JsonKey(name: 'message') + final MessageResponse? message; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'type') + final String type; + + Map toJson() => _$ModerationMarkReviewedEventToJson(this); + + static ModerationMarkReviewedEvent fromJson(Map json) => _$ModerationMarkReviewedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/moderation_mark_reviewed_event.freezed.dart b/packages/stream_chat/lib/open_api/model/moderation_mark_reviewed_event.freezed.dart new file mode 100644 index 0000000000..63c550f12d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/moderation_mark_reviewed_event.freezed.dart @@ -0,0 +1,128 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'moderation_mark_reviewed_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ModerationMarkReviewedEvent { + DateTime get createdAt; + Map get custom; + ReviewQueueItemResponse get item; + MessageResponse? get message; + DateTime? get receivedAt; + String get type; + + /// Create a copy of ModerationMarkReviewedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ModerationMarkReviewedEventCopyWith get copyWith => + _$ModerationMarkReviewedEventCopyWithImpl( + this as ModerationMarkReviewedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ModerationMarkReviewedEvent && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.item, item) || other.item == item) && + (identical(other.message, message) || other.message == message) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.type, type) || other.type == type)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + createdAt, + const DeepCollectionEquality().hash(custom), + item, + message, + receivedAt, + type, + ); + + @override + String toString() { + return 'ModerationMarkReviewedEvent(createdAt: $createdAt, custom: $custom, item: $item, message: $message, receivedAt: $receivedAt, type: $type)'; + } +} + +/// @nodoc +abstract mixin class $ModerationMarkReviewedEventCopyWith<$Res> { + factory $ModerationMarkReviewedEventCopyWith( + ModerationMarkReviewedEvent value, + $Res Function(ModerationMarkReviewedEvent) _then, + ) = _$ModerationMarkReviewedEventCopyWithImpl; + @useResult + $Res call({ + DateTime createdAt, + Map custom, + ReviewQueueItemResponse item, + MessageResponse? message, + DateTime? receivedAt, + String type, + }); +} + +/// @nodoc +class _$ModerationMarkReviewedEventCopyWithImpl<$Res> implements $ModerationMarkReviewedEventCopyWith<$Res> { + _$ModerationMarkReviewedEventCopyWithImpl(this._self, this._then); + + final ModerationMarkReviewedEvent _self; + final $Res Function(ModerationMarkReviewedEvent) _then; + + /// Create a copy of ModerationMarkReviewedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? createdAt = null, + Object? custom = null, + Object? item = null, + Object? message = freezed, + Object? receivedAt = freezed, + Object? type = null, + }) { + return _then( + ModerationMarkReviewedEvent( + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + item: null == item + ? _self.item + : item // ignore: cast_nullable_to_non_nullable + as ReviewQueueItemResponse, + message: freezed == message + ? _self.message + : message // ignore: cast_nullable_to_non_nullable + as MessageResponse?, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/moderation_mark_reviewed_event.g.dart b/packages/stream_chat/lib/open_api/model/moderation_mark_reviewed_event.g.dart new file mode 100644 index 0000000000..b58d6ef5fc --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/moderation_mark_reviewed_event.g.dart @@ -0,0 +1,47 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'moderation_mark_reviewed_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ModerationMarkReviewedEvent _$ModerationMarkReviewedEventFromJson( + Map json, +) => ModerationMarkReviewedEvent( + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + item: ReviewQueueItemResponse.fromJson(json['item'] as Map), + message: json['message'] == null ? null : MessageResponse.fromJson(json['message'] as Map), + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + type: json['type'] as String, +); + +Map _$ModerationMarkReviewedEventToJson( + ModerationMarkReviewedEvent instance, +) => { + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'item': instance.item.toJson(), + 'message': instance.message?.toJson(), + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'type': instance.type, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/moderation_payload.dart b/packages/stream_chat/lib/open_api/model/moderation_payload.dart new file mode 100644 index 0000000000..8adfea2854 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/moderation_payload.dart @@ -0,0 +1,76 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'moderation_payload.g.dart'; +part 'moderation_payload.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ModerationPayload with _$ModerationPayload { + const ModerationPayload({ + this.audios, + this.custom, + this.imageIds, + this.imageOrderedKeys, + this.images, + this.otherMedia, + this.textIds, + this.textOrderedKeys, + this.texts, + this.videos, + }); + + @override + @JsonKey(name: 'audios') + final List? audios; + + @override + @JsonKey(name: 'custom') + final Map? custom; + + @override + @JsonKey(name: 'image_ids') + final Map? imageIds; + + @override + @JsonKey(name: 'image_ordered_keys') + final List? imageOrderedKeys; + + @override + @JsonKey(name: 'images') + final List? images; + + @override + @JsonKey(name: 'other_media') + final List? otherMedia; + + @override + @JsonKey(name: 'text_ids') + final Map? textIds; + + @override + @JsonKey(name: 'text_ordered_keys') + final List? textOrderedKeys; + + @override + @JsonKey(name: 'texts') + final List? texts; + + @override + @JsonKey(name: 'videos') + final List? videos; + + Map toJson() => _$ModerationPayloadToJson(this); + + static ModerationPayload fromJson(Map json) => _$ModerationPayloadFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/moderation_payload.freezed.dart b/packages/stream_chat/lib/open_api/model/moderation_payload.freezed.dart new file mode 100644 index 0000000000..44036e0421 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/moderation_payload.freezed.dart @@ -0,0 +1,172 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'moderation_payload.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ModerationPayload { + List? get audios; + Map? get custom; + Map? get imageIds; + List? get imageOrderedKeys; + List? get images; + List? get otherMedia; + Map? get textIds; + List? get textOrderedKeys; + List? get texts; + List? get videos; + + /// Create a copy of ModerationPayload + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ModerationPayloadCopyWith get copyWith => _$ModerationPayloadCopyWithImpl( + this as ModerationPayload, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ModerationPayload && + const DeepCollectionEquality().equals(other.audios, audios) && + const DeepCollectionEquality().equals(other.custom, custom) && + const DeepCollectionEquality().equals(other.imageIds, imageIds) && + const DeepCollectionEquality().equals( + other.imageOrderedKeys, + imageOrderedKeys, + ) && + const DeepCollectionEquality().equals(other.images, images) && + const DeepCollectionEquality().equals( + other.otherMedia, + otherMedia, + ) && + const DeepCollectionEquality().equals(other.textIds, textIds) && + const DeepCollectionEquality().equals( + other.textOrderedKeys, + textOrderedKeys, + ) && + const DeepCollectionEquality().equals(other.texts, texts) && + const DeepCollectionEquality().equals(other.videos, videos)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(audios), + const DeepCollectionEquality().hash(custom), + const DeepCollectionEquality().hash(imageIds), + const DeepCollectionEquality().hash(imageOrderedKeys), + const DeepCollectionEquality().hash(images), + const DeepCollectionEquality().hash(otherMedia), + const DeepCollectionEquality().hash(textIds), + const DeepCollectionEquality().hash(textOrderedKeys), + const DeepCollectionEquality().hash(texts), + const DeepCollectionEquality().hash(videos), + ); + + @override + String toString() { + return 'ModerationPayload(audios: $audios, custom: $custom, imageIds: $imageIds, imageOrderedKeys: $imageOrderedKeys, images: $images, otherMedia: $otherMedia, textIds: $textIds, textOrderedKeys: $textOrderedKeys, texts: $texts, videos: $videos)'; + } +} + +/// @nodoc +abstract mixin class $ModerationPayloadCopyWith<$Res> { + factory $ModerationPayloadCopyWith( + ModerationPayload value, + $Res Function(ModerationPayload) _then, + ) = _$ModerationPayloadCopyWithImpl; + @useResult + $Res call({ + List? audios, + Map? custom, + Map? imageIds, + List? imageOrderedKeys, + List? images, + List? otherMedia, + Map? textIds, + List? textOrderedKeys, + List? texts, + List? videos, + }); +} + +/// @nodoc +class _$ModerationPayloadCopyWithImpl<$Res> implements $ModerationPayloadCopyWith<$Res> { + _$ModerationPayloadCopyWithImpl(this._self, this._then); + + final ModerationPayload _self; + final $Res Function(ModerationPayload) _then; + + /// Create a copy of ModerationPayload + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? audios = freezed, + Object? custom = freezed, + Object? imageIds = freezed, + Object? imageOrderedKeys = freezed, + Object? images = freezed, + Object? otherMedia = freezed, + Object? textIds = freezed, + Object? textOrderedKeys = freezed, + Object? texts = freezed, + Object? videos = freezed, + }) { + return _then( + ModerationPayload( + audios: freezed == audios + ? _self.audios + : audios // ignore: cast_nullable_to_non_nullable + as List?, + custom: freezed == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map?, + imageIds: freezed == imageIds + ? _self.imageIds + : imageIds // ignore: cast_nullable_to_non_nullable + as Map?, + imageOrderedKeys: freezed == imageOrderedKeys + ? _self.imageOrderedKeys + : imageOrderedKeys // ignore: cast_nullable_to_non_nullable + as List?, + images: freezed == images + ? _self.images + : images // ignore: cast_nullable_to_non_nullable + as List?, + otherMedia: freezed == otherMedia + ? _self.otherMedia + : otherMedia // ignore: cast_nullable_to_non_nullable + as List?, + textIds: freezed == textIds + ? _self.textIds + : textIds // ignore: cast_nullable_to_non_nullable + as Map?, + textOrderedKeys: freezed == textOrderedKeys + ? _self.textOrderedKeys + : textOrderedKeys // ignore: cast_nullable_to_non_nullable + as List?, + texts: freezed == texts + ? _self.texts + : texts // ignore: cast_nullable_to_non_nullable + as List?, + videos: freezed == videos + ? _self.videos + : videos // ignore: cast_nullable_to_non_nullable + as List?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/moderation_payload.g.dart b/packages/stream_chat/lib/open_api/model/moderation_payload.g.dart new file mode 100644 index 0000000000..6ac9b35241 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/moderation_payload.g.dart @@ -0,0 +1,39 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'moderation_payload.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ModerationPayload _$ModerationPayloadFromJson( + Map json, +) => ModerationPayload( + audios: (json['audios'] as List?)?.map((e) => e as String).toList(), + custom: json['custom'] as Map?, + imageIds: (json['image_ids'] as Map?)?.map( + (k, e) => MapEntry(k, e as String), + ), + imageOrderedKeys: (json['image_ordered_keys'] as List?)?.map((e) => e as String).toList(), + images: (json['images'] as List?)?.map((e) => e as String).toList(), + otherMedia: (json['other_media'] as List?)?.map((e) => e as String).toList(), + textIds: (json['text_ids'] as Map?)?.map( + (k, e) => MapEntry(k, e as String), + ), + textOrderedKeys: (json['text_ordered_keys'] as List?)?.map((e) => e as String).toList(), + texts: (json['texts'] as List?)?.map((e) => e as String).toList(), + videos: (json['videos'] as List?)?.map((e) => e as String).toList(), +); + +Map _$ModerationPayloadToJson(ModerationPayload instance) => { + 'audios': instance.audios, + 'custom': instance.custom, + 'image_ids': instance.imageIds, + 'image_ordered_keys': instance.imageOrderedKeys, + 'images': instance.images, + 'other_media': instance.otherMedia, + 'text_ids': instance.textIds, + 'text_ordered_keys': instance.textOrderedKeys, + 'texts': instance.texts, + 'videos': instance.videos, +}; diff --git a/packages/stream_chat/lib/open_api/model/moderation_payload_response.dart b/packages/stream_chat/lib/open_api/model/moderation_payload_response.dart new file mode 100644 index 0000000000..e075ce946a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/moderation_payload_response.dart @@ -0,0 +1,76 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'moderation_payload_response.g.dart'; +part 'moderation_payload_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ModerationPayloadResponse with _$ModerationPayloadResponse { + const ModerationPayloadResponse({ + this.audios, + this.custom, + this.imageIds, + this.imageOrderedKeys, + this.images, + this.otherMedia, + this.textIds, + this.textOrderedKeys, + this.texts, + this.videos, + }); + + @override + @JsonKey(name: 'audios') + final List? audios; + + @override + @JsonKey(name: 'custom') + final Map? custom; + + @override + @JsonKey(name: 'image_ids') + final Map? imageIds; + + @override + @JsonKey(name: 'image_ordered_keys') + final List? imageOrderedKeys; + + @override + @JsonKey(name: 'images') + final List? images; + + @override + @JsonKey(name: 'other_media') + final List? otherMedia; + + @override + @JsonKey(name: 'text_ids') + final Map? textIds; + + @override + @JsonKey(name: 'text_ordered_keys') + final List? textOrderedKeys; + + @override + @JsonKey(name: 'texts') + final List? texts; + + @override + @JsonKey(name: 'videos') + final List? videos; + + Map toJson() => _$ModerationPayloadResponseToJson(this); + + static ModerationPayloadResponse fromJson(Map json) => _$ModerationPayloadResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/moderation_payload_response.freezed.dart b/packages/stream_chat/lib/open_api/model/moderation_payload_response.freezed.dart new file mode 100644 index 0000000000..bb0e23e587 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/moderation_payload_response.freezed.dart @@ -0,0 +1,173 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'moderation_payload_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ModerationPayloadResponse { + List? get audios; + Map? get custom; + Map? get imageIds; + List? get imageOrderedKeys; + List? get images; + List? get otherMedia; + Map? get textIds; + List? get textOrderedKeys; + List? get texts; + List? get videos; + + /// Create a copy of ModerationPayloadResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ModerationPayloadResponseCopyWith get copyWith => + _$ModerationPayloadResponseCopyWithImpl( + this as ModerationPayloadResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ModerationPayloadResponse && + const DeepCollectionEquality().equals(other.audios, audios) && + const DeepCollectionEquality().equals(other.custom, custom) && + const DeepCollectionEquality().equals(other.imageIds, imageIds) && + const DeepCollectionEquality().equals( + other.imageOrderedKeys, + imageOrderedKeys, + ) && + const DeepCollectionEquality().equals(other.images, images) && + const DeepCollectionEquality().equals( + other.otherMedia, + otherMedia, + ) && + const DeepCollectionEquality().equals(other.textIds, textIds) && + const DeepCollectionEquality().equals( + other.textOrderedKeys, + textOrderedKeys, + ) && + const DeepCollectionEquality().equals(other.texts, texts) && + const DeepCollectionEquality().equals(other.videos, videos)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(audios), + const DeepCollectionEquality().hash(custom), + const DeepCollectionEquality().hash(imageIds), + const DeepCollectionEquality().hash(imageOrderedKeys), + const DeepCollectionEquality().hash(images), + const DeepCollectionEquality().hash(otherMedia), + const DeepCollectionEquality().hash(textIds), + const DeepCollectionEquality().hash(textOrderedKeys), + const DeepCollectionEquality().hash(texts), + const DeepCollectionEquality().hash(videos), + ); + + @override + String toString() { + return 'ModerationPayloadResponse(audios: $audios, custom: $custom, imageIds: $imageIds, imageOrderedKeys: $imageOrderedKeys, images: $images, otherMedia: $otherMedia, textIds: $textIds, textOrderedKeys: $textOrderedKeys, texts: $texts, videos: $videos)'; + } +} + +/// @nodoc +abstract mixin class $ModerationPayloadResponseCopyWith<$Res> { + factory $ModerationPayloadResponseCopyWith( + ModerationPayloadResponse value, + $Res Function(ModerationPayloadResponse) _then, + ) = _$ModerationPayloadResponseCopyWithImpl; + @useResult + $Res call({ + List? audios, + Map? custom, + Map? imageIds, + List? imageOrderedKeys, + List? images, + List? otherMedia, + Map? textIds, + List? textOrderedKeys, + List? texts, + List? videos, + }); +} + +/// @nodoc +class _$ModerationPayloadResponseCopyWithImpl<$Res> implements $ModerationPayloadResponseCopyWith<$Res> { + _$ModerationPayloadResponseCopyWithImpl(this._self, this._then); + + final ModerationPayloadResponse _self; + final $Res Function(ModerationPayloadResponse) _then; + + /// Create a copy of ModerationPayloadResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? audios = freezed, + Object? custom = freezed, + Object? imageIds = freezed, + Object? imageOrderedKeys = freezed, + Object? images = freezed, + Object? otherMedia = freezed, + Object? textIds = freezed, + Object? textOrderedKeys = freezed, + Object? texts = freezed, + Object? videos = freezed, + }) { + return _then( + ModerationPayloadResponse( + audios: freezed == audios + ? _self.audios + : audios // ignore: cast_nullable_to_non_nullable + as List?, + custom: freezed == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map?, + imageIds: freezed == imageIds + ? _self.imageIds + : imageIds // ignore: cast_nullable_to_non_nullable + as Map?, + imageOrderedKeys: freezed == imageOrderedKeys + ? _self.imageOrderedKeys + : imageOrderedKeys // ignore: cast_nullable_to_non_nullable + as List?, + images: freezed == images + ? _self.images + : images // ignore: cast_nullable_to_non_nullable + as List?, + otherMedia: freezed == otherMedia + ? _self.otherMedia + : otherMedia // ignore: cast_nullable_to_non_nullable + as List?, + textIds: freezed == textIds + ? _self.textIds + : textIds // ignore: cast_nullable_to_non_nullable + as Map?, + textOrderedKeys: freezed == textOrderedKeys + ? _self.textOrderedKeys + : textOrderedKeys // ignore: cast_nullable_to_non_nullable + as List?, + texts: freezed == texts + ? _self.texts + : texts // ignore: cast_nullable_to_non_nullable + as List?, + videos: freezed == videos + ? _self.videos + : videos // ignore: cast_nullable_to_non_nullable + as List?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/moderation_payload_response.g.dart b/packages/stream_chat/lib/open_api/model/moderation_payload_response.g.dart new file mode 100644 index 0000000000..723ce9843c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/moderation_payload_response.g.dart @@ -0,0 +1,41 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'moderation_payload_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ModerationPayloadResponse _$ModerationPayloadResponseFromJson( + Map json, +) => ModerationPayloadResponse( + audios: (json['audios'] as List?)?.map((e) => e as String).toList(), + custom: json['custom'] as Map?, + imageIds: (json['image_ids'] as Map?)?.map( + (k, e) => MapEntry(k, e as String), + ), + imageOrderedKeys: (json['image_ordered_keys'] as List?)?.map((e) => e as String).toList(), + images: (json['images'] as List?)?.map((e) => e as String).toList(), + otherMedia: (json['other_media'] as List?)?.map((e) => e as String).toList(), + textIds: (json['text_ids'] as Map?)?.map( + (k, e) => MapEntry(k, e as String), + ), + textOrderedKeys: (json['text_ordered_keys'] as List?)?.map((e) => e as String).toList(), + texts: (json['texts'] as List?)?.map((e) => e as String).toList(), + videos: (json['videos'] as List?)?.map((e) => e as String).toList(), +); + +Map _$ModerationPayloadResponseToJson( + ModerationPayloadResponse instance, +) => { + 'audios': instance.audios, + 'custom': instance.custom, + 'image_ids': instance.imageIds, + 'image_ordered_keys': instance.imageOrderedKeys, + 'images': instance.images, + 'other_media': instance.otherMedia, + 'text_ids': instance.textIds, + 'text_ordered_keys': instance.textOrderedKeys, + 'texts': instance.texts, + 'videos': instance.videos, +}; diff --git a/packages/stream_chat/lib/open_api/model/moderation_queue_response.dart b/packages/stream_chat/lib/open_api/model/moderation_queue_response.dart new file mode 100644 index 0000000000..7c173649bb --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/moderation_queue_response.dart @@ -0,0 +1,78 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'moderation_queue_response.g.dart'; +part 'moderation_queue_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ModerationQueueResponse with _$ModerationQueueResponse { + const ModerationQueueResponse({ + required this.createdAt, + required this.createdBy, + required this.description, + required this.filters, + required this.id, + required this.itemCount, + required this.name, + required this.sort, + required this.type, + required this.updatedAt, + }); + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'created_by') + final String createdBy; + + @override + @JsonKey(name: 'description') + final String description; + + @override + @JsonKey(name: 'filters') + final Map filters; + + @override + @JsonKey(name: 'id') + final String id; + + @override + @JsonKey(name: 'item_count') + final int itemCount; + + @override + @JsonKey(name: 'name') + final String name; + + @override + @JsonKey(name: 'sort') + final List> sort; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'updated_at') + final DateTime updatedAt; + + Map toJson() => _$ModerationQueueResponseToJson(this); + + static ModerationQueueResponse fromJson(Map json) => _$ModerationQueueResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/moderation_queue_response.freezed.dart b/packages/stream_chat/lib/open_api/model/moderation_queue_response.freezed.dart new file mode 100644 index 0000000000..c4a695cc38 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/moderation_queue_response.freezed.dart @@ -0,0 +1,164 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'moderation_queue_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ModerationQueueResponse { + DateTime get createdAt; + String get createdBy; + String get description; + Map get filters; + String get id; + int get itemCount; + String get name; + List> get sort; + String get type; + DateTime get updatedAt; + + /// Create a copy of ModerationQueueResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ModerationQueueResponseCopyWith get copyWith => + _$ModerationQueueResponseCopyWithImpl( + this as ModerationQueueResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ModerationQueueResponse && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.createdBy, createdBy) || other.createdBy == createdBy) && + (identical(other.description, description) || other.description == description) && + const DeepCollectionEquality().equals(other.filters, filters) && + (identical(other.id, id) || other.id == id) && + (identical(other.itemCount, itemCount) || other.itemCount == itemCount) && + (identical(other.name, name) || other.name == name) && + const DeepCollectionEquality().equals(other.sort, sort) && + (identical(other.type, type) || other.type == type) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + createdAt, + createdBy, + description, + const DeepCollectionEquality().hash(filters), + id, + itemCount, + name, + const DeepCollectionEquality().hash(sort), + type, + updatedAt, + ); + + @override + String toString() { + return 'ModerationQueueResponse(createdAt: $createdAt, createdBy: $createdBy, description: $description, filters: $filters, id: $id, itemCount: $itemCount, name: $name, sort: $sort, type: $type, updatedAt: $updatedAt)'; + } +} + +/// @nodoc +abstract mixin class $ModerationQueueResponseCopyWith<$Res> { + factory $ModerationQueueResponseCopyWith( + ModerationQueueResponse value, + $Res Function(ModerationQueueResponse) _then, + ) = _$ModerationQueueResponseCopyWithImpl; + @useResult + $Res call({ + DateTime createdAt, + String createdBy, + String description, + Map filters, + String id, + int itemCount, + String name, + List> sort, + String type, + DateTime updatedAt, + }); +} + +/// @nodoc +class _$ModerationQueueResponseCopyWithImpl<$Res> implements $ModerationQueueResponseCopyWith<$Res> { + _$ModerationQueueResponseCopyWithImpl(this._self, this._then); + + final ModerationQueueResponse _self; + final $Res Function(ModerationQueueResponse) _then; + + /// Create a copy of ModerationQueueResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? createdAt = null, + Object? createdBy = null, + Object? description = null, + Object? filters = null, + Object? id = null, + Object? itemCount = null, + Object? name = null, + Object? sort = null, + Object? type = null, + Object? updatedAt = null, + }) { + return _then( + ModerationQueueResponse( + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + createdBy: null == createdBy + ? _self.createdBy + : createdBy // ignore: cast_nullable_to_non_nullable + as String, + description: null == description + ? _self.description + : description // ignore: cast_nullable_to_non_nullable + as String, + filters: null == filters + ? _self.filters + : filters // ignore: cast_nullable_to_non_nullable + as Map, + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + itemCount: null == itemCount + ? _self.itemCount + : itemCount // ignore: cast_nullable_to_non_nullable + as int, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + sort: null == sort + ? _self.sort + : sort // ignore: cast_nullable_to_non_nullable + as List>, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + updatedAt: null == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/moderation_queue_response.g.dart b/packages/stream_chat/lib/open_api/model/moderation_queue_response.g.dart new file mode 100644 index 0000000000..737d81c724 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/moderation_queue_response.g.dart @@ -0,0 +1,41 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'moderation_queue_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ModerationQueueResponse _$ModerationQueueResponseFromJson( + Map json, +) => ModerationQueueResponse( + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + createdBy: json['created_by'] as String, + description: json['description'] as String, + filters: json['filters'] as Map, + id: json['id'] as String, + itemCount: (json['item_count'] as num).toInt(), + name: json['name'] as String, + sort: (json['sort'] as List).map((e) => e as Map).toList(), + type: json['type'] as String, + updatedAt: const StreamDateTimeConverter().fromJson( + json['updated_at'] as Object, + ), +); + +Map _$ModerationQueueResponseToJson( + ModerationQueueResponse instance, +) => { + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'created_by': instance.createdBy, + 'description': instance.description, + 'filters': instance.filters, + 'id': instance.id, + 'item_count': instance.itemCount, + 'name': instance.name, + 'sort': instance.sort, + 'type': instance.type, + 'updated_at': const StreamDateTimeConverter().toJson(instance.updatedAt), +}; diff --git a/packages/stream_chat/lib/open_api/model/moderation_response.dart b/packages/stream_chat/lib/open_api/model/moderation_response.dart new file mode 100644 index 0000000000..f562e0637a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/moderation_response.dart @@ -0,0 +1,46 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'moderation_response.g.dart'; +part 'moderation_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ModerationResponse with _$ModerationResponse { + const ModerationResponse({ + required this.action, + required this.explicit, + required this.spam, + required this.toxic, + }); + + @override + @JsonKey(name: 'action') + final String action; + + @override + @JsonKey(name: 'explicit') + final double explicit; + + @override + @JsonKey(name: 'spam') + final double spam; + + @override + @JsonKey(name: 'toxic') + final double toxic; + + Map toJson() => _$ModerationResponseToJson(this); + + static ModerationResponse fromJson(Map json) => _$ModerationResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/moderation_response.freezed.dart b/packages/stream_chat/lib/open_api/model/moderation_response.freezed.dart new file mode 100644 index 0000000000..bb91c4b45b --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/moderation_response.freezed.dart @@ -0,0 +1,98 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'moderation_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ModerationResponse { + String get action; + double get explicit; + double get spam; + double get toxic; + + /// Create a copy of ModerationResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ModerationResponseCopyWith get copyWith => _$ModerationResponseCopyWithImpl( + this as ModerationResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ModerationResponse && + (identical(other.action, action) || other.action == action) && + (identical(other.explicit, explicit) || other.explicit == explicit) && + (identical(other.spam, spam) || other.spam == spam) && + (identical(other.toxic, toxic) || other.toxic == toxic)); + } + + @override + int get hashCode => Object.hash(runtimeType, action, explicit, spam, toxic); + + @override + String toString() { + return 'ModerationResponse(action: $action, explicit: $explicit, spam: $spam, toxic: $toxic)'; + } +} + +/// @nodoc +abstract mixin class $ModerationResponseCopyWith<$Res> { + factory $ModerationResponseCopyWith( + ModerationResponse value, + $Res Function(ModerationResponse) _then, + ) = _$ModerationResponseCopyWithImpl; + @useResult + $Res call({String action, double explicit, double spam, double toxic}); +} + +/// @nodoc +class _$ModerationResponseCopyWithImpl<$Res> implements $ModerationResponseCopyWith<$Res> { + _$ModerationResponseCopyWithImpl(this._self, this._then); + + final ModerationResponse _self; + final $Res Function(ModerationResponse) _then; + + /// Create a copy of ModerationResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? action = null, + Object? explicit = null, + Object? spam = null, + Object? toxic = null, + }) { + return _then( + ModerationResponse( + action: null == action + ? _self.action + : action // ignore: cast_nullable_to_non_nullable + as String, + explicit: null == explicit + ? _self.explicit + : explicit // ignore: cast_nullable_to_non_nullable + as double, + spam: null == spam + ? _self.spam + : spam // ignore: cast_nullable_to_non_nullable + as double, + toxic: null == toxic + ? _self.toxic + : toxic // ignore: cast_nullable_to_non_nullable + as double, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/moderation_response.g.dart b/packages/stream_chat/lib/open_api/model/moderation_response.g.dart new file mode 100644 index 0000000000..16097cbc17 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/moderation_response.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'moderation_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ModerationResponse _$ModerationResponseFromJson(Map json) => ModerationResponse( + action: json['action'] as String, + explicit: (json['explicit'] as num).toDouble(), + spam: (json['spam'] as num).toDouble(), + toxic: (json['toxic'] as num).toDouble(), +); + +Map _$ModerationResponseToJson(ModerationResponse instance) => { + 'action': instance.action, + 'explicit': instance.explicit, + 'spam': instance.spam, + 'toxic': instance.toxic, +}; diff --git a/packages/stream_chat/lib/open_api/model/moderation_v2_response.dart b/packages/stream_chat/lib/open_api/model/moderation_v2_response.dart new file mode 100644 index 0000000000..5c1544b8be --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/moderation_v2_response.dart @@ -0,0 +1,66 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'moderation_v2_response.g.dart'; +part 'moderation_v2_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ModerationV2Response with _$ModerationV2Response { + const ModerationV2Response({ + required this.action, + this.blocklistMatched, + this.blocklistsMatched, + this.imageHarms, + required this.originalText, + this.platformCircumvented, + this.semanticFilterMatched, + this.textHarms, + }); + + @override + @JsonKey(name: 'action') + final String action; + + @override + @JsonKey(name: 'blocklist_matched') + final String? blocklistMatched; + + @override + @JsonKey(name: 'blocklists_matched') + final List? blocklistsMatched; + + @override + @JsonKey(name: 'image_harms') + final List? imageHarms; + + @override + @JsonKey(name: 'original_text') + final String originalText; + + @override + @JsonKey(name: 'platform_circumvented') + final bool? platformCircumvented; + + @override + @JsonKey(name: 'semantic_filter_matched') + final String? semanticFilterMatched; + + @override + @JsonKey(name: 'text_harms') + final List? textHarms; + + Map toJson() => _$ModerationV2ResponseToJson(this); + + static ModerationV2Response fromJson(Map json) => _$ModerationV2ResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/moderation_v2_response.freezed.dart b/packages/stream_chat/lib/open_api/model/moderation_v2_response.freezed.dart new file mode 100644 index 0000000000..729a8a0e7d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/moderation_v2_response.freezed.dart @@ -0,0 +1,154 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'moderation_v2_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ModerationV2Response { + String get action; + String? get blocklistMatched; + List? get blocklistsMatched; + List? get imageHarms; + String get originalText; + bool? get platformCircumvented; + String? get semanticFilterMatched; + List? get textHarms; + + /// Create a copy of ModerationV2Response + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ModerationV2ResponseCopyWith get copyWith => + _$ModerationV2ResponseCopyWithImpl( + this as ModerationV2Response, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ModerationV2Response && + (identical(other.action, action) || other.action == action) && + (identical(other.blocklistMatched, blocklistMatched) || other.blocklistMatched == blocklistMatched) && + const DeepCollectionEquality().equals( + other.blocklistsMatched, + blocklistsMatched, + ) && + const DeepCollectionEquality().equals( + other.imageHarms, + imageHarms, + ) && + (identical(other.originalText, originalText) || other.originalText == originalText) && + (identical(other.platformCircumvented, platformCircumvented) || + other.platformCircumvented == platformCircumvented) && + (identical(other.semanticFilterMatched, semanticFilterMatched) || + other.semanticFilterMatched == semanticFilterMatched) && + const DeepCollectionEquality().equals(other.textHarms, textHarms)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + action, + blocklistMatched, + const DeepCollectionEquality().hash(blocklistsMatched), + const DeepCollectionEquality().hash(imageHarms), + originalText, + platformCircumvented, + semanticFilterMatched, + const DeepCollectionEquality().hash(textHarms), + ); + + @override + String toString() { + return 'ModerationV2Response(action: $action, blocklistMatched: $blocklistMatched, blocklistsMatched: $blocklistsMatched, imageHarms: $imageHarms, originalText: $originalText, platformCircumvented: $platformCircumvented, semanticFilterMatched: $semanticFilterMatched, textHarms: $textHarms)'; + } +} + +/// @nodoc +abstract mixin class $ModerationV2ResponseCopyWith<$Res> { + factory $ModerationV2ResponseCopyWith( + ModerationV2Response value, + $Res Function(ModerationV2Response) _then, + ) = _$ModerationV2ResponseCopyWithImpl; + @useResult + $Res call({ + String action, + String? blocklistMatched, + List? blocklistsMatched, + List? imageHarms, + String originalText, + bool? platformCircumvented, + String? semanticFilterMatched, + List? textHarms, + }); +} + +/// @nodoc +class _$ModerationV2ResponseCopyWithImpl<$Res> implements $ModerationV2ResponseCopyWith<$Res> { + _$ModerationV2ResponseCopyWithImpl(this._self, this._then); + + final ModerationV2Response _self; + final $Res Function(ModerationV2Response) _then; + + /// Create a copy of ModerationV2Response + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? action = null, + Object? blocklistMatched = freezed, + Object? blocklistsMatched = freezed, + Object? imageHarms = freezed, + Object? originalText = null, + Object? platformCircumvented = freezed, + Object? semanticFilterMatched = freezed, + Object? textHarms = freezed, + }) { + return _then( + ModerationV2Response( + action: null == action + ? _self.action + : action // ignore: cast_nullable_to_non_nullable + as String, + blocklistMatched: freezed == blocklistMatched + ? _self.blocklistMatched + : blocklistMatched // ignore: cast_nullable_to_non_nullable + as String?, + blocklistsMatched: freezed == blocklistsMatched + ? _self.blocklistsMatched + : blocklistsMatched // ignore: cast_nullable_to_non_nullable + as List?, + imageHarms: freezed == imageHarms + ? _self.imageHarms + : imageHarms // ignore: cast_nullable_to_non_nullable + as List?, + originalText: null == originalText + ? _self.originalText + : originalText // ignore: cast_nullable_to_non_nullable + as String, + platformCircumvented: freezed == platformCircumvented + ? _self.platformCircumvented + : platformCircumvented // ignore: cast_nullable_to_non_nullable + as bool?, + semanticFilterMatched: freezed == semanticFilterMatched + ? _self.semanticFilterMatched + : semanticFilterMatched // ignore: cast_nullable_to_non_nullable + as String?, + textHarms: freezed == textHarms + ? _self.textHarms + : textHarms // ignore: cast_nullable_to_non_nullable + as List?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/moderation_v2_response.g.dart b/packages/stream_chat/lib/open_api/model/moderation_v2_response.g.dart new file mode 100644 index 0000000000..e28c7ada2d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/moderation_v2_response.g.dart @@ -0,0 +1,33 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'moderation_v2_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ModerationV2Response _$ModerationV2ResponseFromJson( + Map json, +) => ModerationV2Response( + action: json['action'] as String, + blocklistMatched: json['blocklist_matched'] as String?, + blocklistsMatched: (json['blocklists_matched'] as List?)?.map((e) => e as String).toList(), + imageHarms: (json['image_harms'] as List?)?.map((e) => e as String).toList(), + originalText: json['original_text'] as String, + platformCircumvented: json['platform_circumvented'] as bool?, + semanticFilterMatched: json['semantic_filter_matched'] as String?, + textHarms: (json['text_harms'] as List?)?.map((e) => e as String).toList(), +); + +Map _$ModerationV2ResponseToJson( + ModerationV2Response instance, +) => { + 'action': instance.action, + 'blocklist_matched': instance.blocklistMatched, + 'blocklists_matched': instance.blocklistsMatched, + 'image_harms': instance.imageHarms, + 'original_text': instance.originalText, + 'platform_circumvented': instance.platformCircumvented, + 'semantic_filter_matched': instance.semanticFilterMatched, + 'text_harms': instance.textHarms, +}; diff --git a/packages/stream_chat/lib/open_api/model/mute_channel_request.dart b/packages/stream_chat/lib/open_api/model/mute_channel_request.dart new file mode 100644 index 0000000000..be4aabfceb --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/mute_channel_request.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'mute_channel_request.g.dart'; +part 'mute_channel_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class MuteChannelRequest with _$MuteChannelRequest { + const MuteChannelRequest({ + this.channelCids, + this.expiration, + }); + + @override + @JsonKey(name: 'channel_cids') + final List? channelCids; + + @override + @JsonKey(name: 'expiration') + final int? expiration; + + Map toJson() => _$MuteChannelRequestToJson(this); + + static MuteChannelRequest fromJson(Map json) => _$MuteChannelRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/mute_channel_request.freezed.dart b/packages/stream_chat/lib/open_api/model/mute_channel_request.freezed.dart new file mode 100644 index 0000000000..ac53c58065 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/mute_channel_request.freezed.dart @@ -0,0 +1,88 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'mute_channel_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$MuteChannelRequest { + List? get channelCids; + int? get expiration; + + /// Create a copy of MuteChannelRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $MuteChannelRequestCopyWith get copyWith => _$MuteChannelRequestCopyWithImpl( + this as MuteChannelRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is MuteChannelRequest && + const DeepCollectionEquality().equals( + other.channelCids, + channelCids, + ) && + (identical(other.expiration, expiration) || other.expiration == expiration)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(channelCids), + expiration, + ); + + @override + String toString() { + return 'MuteChannelRequest(channelCids: $channelCids, expiration: $expiration)'; + } +} + +/// @nodoc +abstract mixin class $MuteChannelRequestCopyWith<$Res> { + factory $MuteChannelRequestCopyWith( + MuteChannelRequest value, + $Res Function(MuteChannelRequest) _then, + ) = _$MuteChannelRequestCopyWithImpl; + @useResult + $Res call({List? channelCids, int? expiration}); +} + +/// @nodoc +class _$MuteChannelRequestCopyWithImpl<$Res> implements $MuteChannelRequestCopyWith<$Res> { + _$MuteChannelRequestCopyWithImpl(this._self, this._then); + + final MuteChannelRequest _self; + final $Res Function(MuteChannelRequest) _then; + + /// Create a copy of MuteChannelRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? channelCids = freezed, Object? expiration = freezed}) { + return _then( + MuteChannelRequest( + channelCids: freezed == channelCids + ? _self.channelCids + : channelCids // ignore: cast_nullable_to_non_nullable + as List?, + expiration: freezed == expiration + ? _self.expiration + : expiration // ignore: cast_nullable_to_non_nullable + as int?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/mute_channel_request.g.dart b/packages/stream_chat/lib/open_api/model/mute_channel_request.g.dart new file mode 100644 index 0000000000..befb5f404c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/mute_channel_request.g.dart @@ -0,0 +1,17 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'mute_channel_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +MuteChannelRequest _$MuteChannelRequestFromJson(Map json) => MuteChannelRequest( + channelCids: (json['channel_cids'] as List?)?.map((e) => e as String).toList(), + expiration: (json['expiration'] as num?)?.toInt(), +); + +Map _$MuteChannelRequestToJson(MuteChannelRequest instance) => { + 'channel_cids': instance.channelCids, + 'expiration': instance.expiration, +}; diff --git a/packages/stream_chat/lib/open_api/model/mute_channel_response.dart b/packages/stream_chat/lib/open_api/model/mute_channel_response.dart new file mode 100644 index 0000000000..066bfeac9a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/mute_channel_response.dart @@ -0,0 +1,46 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'mute_channel_response.g.dart'; +part 'mute_channel_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class MuteChannelResponse with _$MuteChannelResponse { + const MuteChannelResponse({ + this.channelMute, + this.channelMutes, + required this.duration, + this.ownUser, + }); + + @override + @JsonKey(name: 'channel_mute') + final ChannelMute? channelMute; + + @override + @JsonKey(name: 'channel_mutes') + final List? channelMutes; + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'own_user') + final OwnUserResponse? ownUser; + + Map toJson() => _$MuteChannelResponseToJson(this); + + static MuteChannelResponse fromJson(Map json) => _$MuteChannelResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/mute_channel_response.freezed.dart b/packages/stream_chat/lib/open_api/model/mute_channel_response.freezed.dart new file mode 100644 index 0000000000..5ea5f24d62 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/mute_channel_response.freezed.dart @@ -0,0 +1,113 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'mute_channel_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$MuteChannelResponse { + ChannelMute? get channelMute; + List? get channelMutes; + String get duration; + OwnUserResponse? get ownUser; + + /// Create a copy of MuteChannelResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $MuteChannelResponseCopyWith get copyWith => + _$MuteChannelResponseCopyWithImpl( + this as MuteChannelResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is MuteChannelResponse && + (identical(other.channelMute, channelMute) || other.channelMute == channelMute) && + const DeepCollectionEquality().equals( + other.channelMutes, + channelMutes, + ) && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.ownUser, ownUser) || other.ownUser == ownUser)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channelMute, + const DeepCollectionEquality().hash(channelMutes), + duration, + ownUser, + ); + + @override + String toString() { + return 'MuteChannelResponse(channelMute: $channelMute, channelMutes: $channelMutes, duration: $duration, ownUser: $ownUser)'; + } +} + +/// @nodoc +abstract mixin class $MuteChannelResponseCopyWith<$Res> { + factory $MuteChannelResponseCopyWith( + MuteChannelResponse value, + $Res Function(MuteChannelResponse) _then, + ) = _$MuteChannelResponseCopyWithImpl; + @useResult + $Res call({ + ChannelMute? channelMute, + List? channelMutes, + String duration, + OwnUserResponse? ownUser, + }); +} + +/// @nodoc +class _$MuteChannelResponseCopyWithImpl<$Res> implements $MuteChannelResponseCopyWith<$Res> { + _$MuteChannelResponseCopyWithImpl(this._self, this._then); + + final MuteChannelResponse _self; + final $Res Function(MuteChannelResponse) _then; + + /// Create a copy of MuteChannelResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channelMute = freezed, + Object? channelMutes = freezed, + Object? duration = null, + Object? ownUser = freezed, + }) { + return _then( + MuteChannelResponse( + channelMute: freezed == channelMute + ? _self.channelMute + : channelMute // ignore: cast_nullable_to_non_nullable + as ChannelMute?, + channelMutes: freezed == channelMutes + ? _self.channelMutes + : channelMutes // ignore: cast_nullable_to_non_nullable + as List?, + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + ownUser: freezed == ownUser + ? _self.ownUser + : ownUser // ignore: cast_nullable_to_non_nullable + as OwnUserResponse?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/mute_channel_response.g.dart b/packages/stream_chat/lib/open_api/model/mute_channel_response.g.dart new file mode 100644 index 0000000000..5d18bba5b7 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/mute_channel_response.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'mute_channel_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +MuteChannelResponse _$MuteChannelResponseFromJson(Map json) => MuteChannelResponse( + channelMute: json['channel_mute'] == null ? null : ChannelMute.fromJson(json['channel_mute'] as Map), + channelMutes: (json['channel_mutes'] as List?) + ?.map((e) => ChannelMute.fromJson(e as Map)) + .toList(), + duration: json['duration'] as String, + ownUser: json['own_user'] == null ? null : OwnUserResponse.fromJson(json['own_user'] as Map), +); + +Map _$MuteChannelResponseToJson( + MuteChannelResponse instance, +) => { + 'channel_mute': instance.channelMute?.toJson(), + 'channel_mutes': instance.channelMutes?.map((e) => e.toJson()).toList(), + 'duration': instance.duration, + 'own_user': instance.ownUser?.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/mute_request.dart b/packages/stream_chat/lib/open_api/model/mute_request.dart new file mode 100644 index 0000000000..5608503ffb --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/mute_request.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'mute_request.g.dart'; +part 'mute_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class MuteRequest with _$MuteRequest { + const MuteRequest({ + required this.targetIds, + this.timeout, + }); + + @override + @JsonKey(name: 'target_ids') + final List targetIds; + + @override + @JsonKey(name: 'timeout') + final int? timeout; + + Map toJson() => _$MuteRequestToJson(this); + + static MuteRequest fromJson(Map json) => _$MuteRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/mute_request.freezed.dart b/packages/stream_chat/lib/open_api/model/mute_request.freezed.dart new file mode 100644 index 0000000000..1a3e861c14 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/mute_request.freezed.dart @@ -0,0 +1,83 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'mute_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$MuteRequest { + List get targetIds; + int? get timeout; + + /// Create a copy of MuteRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $MuteRequestCopyWith get copyWith => + _$MuteRequestCopyWithImpl(this as MuteRequest, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is MuteRequest && + const DeepCollectionEquality().equals(other.targetIds, targetIds) && + (identical(other.timeout, timeout) || other.timeout == timeout)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(targetIds), + timeout, + ); + + @override + String toString() { + return 'MuteRequest(targetIds: $targetIds, timeout: $timeout)'; + } +} + +/// @nodoc +abstract mixin class $MuteRequestCopyWith<$Res> { + factory $MuteRequestCopyWith( + MuteRequest value, + $Res Function(MuteRequest) _then, + ) = _$MuteRequestCopyWithImpl; + @useResult + $Res call({List targetIds, int? timeout}); +} + +/// @nodoc +class _$MuteRequestCopyWithImpl<$Res> implements $MuteRequestCopyWith<$Res> { + _$MuteRequestCopyWithImpl(this._self, this._then); + + final MuteRequest _self; + final $Res Function(MuteRequest) _then; + + /// Create a copy of MuteRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? targetIds = null, Object? timeout = freezed}) { + return _then( + MuteRequest( + targetIds: null == targetIds + ? _self.targetIds + : targetIds // ignore: cast_nullable_to_non_nullable + as List, + timeout: freezed == timeout + ? _self.timeout + : timeout // ignore: cast_nullable_to_non_nullable + as int?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/mute_request.g.dart b/packages/stream_chat/lib/open_api/model/mute_request.g.dart new file mode 100644 index 0000000000..248472c7ef --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/mute_request.g.dart @@ -0,0 +1,17 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'mute_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +MuteRequest _$MuteRequestFromJson(Map json) => MuteRequest( + targetIds: (json['target_ids'] as List).map((e) => e as String).toList(), + timeout: (json['timeout'] as num?)?.toInt(), +); + +Map _$MuteRequestToJson(MuteRequest instance) => { + 'target_ids': instance.targetIds, + 'timeout': instance.timeout, +}; diff --git a/packages/stream_chat/lib/open_api/model/mute_response.dart b/packages/stream_chat/lib/open_api/model/mute_response.dart new file mode 100644 index 0000000000..f9eede2862 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/mute_response.dart @@ -0,0 +1,46 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'mute_response.g.dart'; +part 'mute_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class MuteResponse with _$MuteResponse { + const MuteResponse({ + required this.duration, + this.mutes, + this.nonExistingUsers, + this.ownUser, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'mutes') + final List? mutes; + + @override + @JsonKey(name: 'non_existing_users') + final List? nonExistingUsers; + + @override + @JsonKey(name: 'own_user') + final OwnUserResponse? ownUser; + + Map toJson() => _$MuteResponseToJson(this); + + static MuteResponse fromJson(Map json) => _$MuteResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/mute_response.freezed.dart b/packages/stream_chat/lib/open_api/model/mute_response.freezed.dart new file mode 100644 index 0000000000..66a6d848d0 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/mute_response.freezed.dart @@ -0,0 +1,112 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'mute_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$MuteResponse { + String get duration; + List? get mutes; + List? get nonExistingUsers; + OwnUserResponse? get ownUser; + + /// Create a copy of MuteResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $MuteResponseCopyWith get copyWith => _$MuteResponseCopyWithImpl( + this as MuteResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is MuteResponse && + (identical(other.duration, duration) || other.duration == duration) && + const DeepCollectionEquality().equals(other.mutes, mutes) && + const DeepCollectionEquality().equals( + other.nonExistingUsers, + nonExistingUsers, + ) && + (identical(other.ownUser, ownUser) || other.ownUser == ownUser)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + duration, + const DeepCollectionEquality().hash(mutes), + const DeepCollectionEquality().hash(nonExistingUsers), + ownUser, + ); + + @override + String toString() { + return 'MuteResponse(duration: $duration, mutes: $mutes, nonExistingUsers: $nonExistingUsers, ownUser: $ownUser)'; + } +} + +/// @nodoc +abstract mixin class $MuteResponseCopyWith<$Res> { + factory $MuteResponseCopyWith( + MuteResponse value, + $Res Function(MuteResponse) _then, + ) = _$MuteResponseCopyWithImpl; + @useResult + $Res call({ + String duration, + List? mutes, + List? nonExistingUsers, + OwnUserResponse? ownUser, + }); +} + +/// @nodoc +class _$MuteResponseCopyWithImpl<$Res> implements $MuteResponseCopyWith<$Res> { + _$MuteResponseCopyWithImpl(this._self, this._then); + + final MuteResponse _self; + final $Res Function(MuteResponse) _then; + + /// Create a copy of MuteResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? duration = null, + Object? mutes = freezed, + Object? nonExistingUsers = freezed, + Object? ownUser = freezed, + }) { + return _then( + MuteResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + mutes: freezed == mutes + ? _self.mutes + : mutes // ignore: cast_nullable_to_non_nullable + as List?, + nonExistingUsers: freezed == nonExistingUsers + ? _self.nonExistingUsers + : nonExistingUsers // ignore: cast_nullable_to_non_nullable + as List?, + ownUser: freezed == ownUser + ? _self.ownUser + : ownUser // ignore: cast_nullable_to_non_nullable + as OwnUserResponse?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/mute_response.g.dart b/packages/stream_chat/lib/open_api/model/mute_response.g.dart new file mode 100644 index 0000000000..2cdb3748fb --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/mute_response.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'mute_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +MuteResponse _$MuteResponseFromJson(Map json) => MuteResponse( + duration: json['duration'] as String, + mutes: (json['mutes'] as List?)?.map((e) => UserMuteResponse.fromJson(e as Map)).toList(), + nonExistingUsers: (json['non_existing_users'] as List?)?.map((e) => e as String).toList(), + ownUser: json['own_user'] == null ? null : OwnUserResponse.fromJson(json['own_user'] as Map), +); + +Map _$MuteResponseToJson(MuteResponse instance) => { + 'duration': instance.duration, + 'mutes': instance.mutes?.map((e) => e.toJson()).toList(), + 'non_existing_users': instance.nonExistingUsers, + 'own_user': instance.ownUser?.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/notification_added_to_channel_event.dart b/packages/stream_chat/lib/open_api/model/notification_added_to_channel_event.dart new file mode 100644 index 0000000000..e26ab1f383 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/notification_added_to_channel_event.dart @@ -0,0 +1,94 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'notification_added_to_channel_event.g.dart'; +part 'notification_added_to_channel_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class NotificationAddedToChannelEvent extends core.WsEvent with _$NotificationAddedToChannelEvent { + const NotificationAddedToChannelEvent({ + required this.channel, + this.channelCustom, + this.channelId, + this.channelMemberCount, + this.channelMessageCount, + this.channelType, + this.cid, + required this.createdAt, + required this.custom, + required this.member, + this.receivedAt, + this.team, + required this.type, + }); + + @override + @JsonKey(name: 'channel') + final ChannelResponse channel; + + @override + @JsonKey(name: 'channel_custom') + final Map? channelCustom; + + @override + @JsonKey(name: 'channel_id') + final String? channelId; + + @override + @JsonKey(name: 'channel_member_count') + final int? channelMemberCount; + + @override + @JsonKey(name: 'channel_message_count') + final int? channelMessageCount; + + @override + @JsonKey(name: 'channel_type') + final String? channelType; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'member') + final ChannelMemberResponse member; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'team') + final String? team; + + @override + @JsonKey(name: 'type') + final String type; + + Map toJson() => _$NotificationAddedToChannelEventToJson(this); + + static NotificationAddedToChannelEvent fromJson(Map json) => + _$NotificationAddedToChannelEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/notification_added_to_channel_event.freezed.dart b/packages/stream_chat/lib/open_api/model/notification_added_to_channel_event.freezed.dart new file mode 100644 index 0000000000..c07b83decc --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/notification_added_to_channel_event.freezed.dart @@ -0,0 +1,196 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'notification_added_to_channel_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$NotificationAddedToChannelEvent { + ChannelResponse get channel; + Map? get channelCustom; + String? get channelId; + int? get channelMemberCount; + int? get channelMessageCount; + String? get channelType; + String? get cid; + DateTime get createdAt; + Map get custom; + ChannelMemberResponse get member; + DateTime? get receivedAt; + String? get team; + String get type; + + /// Create a copy of NotificationAddedToChannelEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $NotificationAddedToChannelEventCopyWith get copyWith => + _$NotificationAddedToChannelEventCopyWithImpl( + this as NotificationAddedToChannelEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is NotificationAddedToChannelEvent && + (identical(other.channel, channel) || other.channel == channel) && + const DeepCollectionEquality().equals( + other.channelCustom, + channelCustom, + ) && + (identical(other.channelId, channelId) || other.channelId == channelId) && + (identical(other.channelMemberCount, channelMemberCount) || + other.channelMemberCount == channelMemberCount) && + (identical(other.channelMessageCount, channelMessageCount) || + other.channelMessageCount == channelMessageCount) && + (identical(other.channelType, channelType) || other.channelType == channelType) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.member, member) || other.member == member) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.team, team) || other.team == team) && + (identical(other.type, type) || other.type == type)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channel, + const DeepCollectionEquality().hash(channelCustom), + channelId, + channelMemberCount, + channelMessageCount, + channelType, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + member, + receivedAt, + team, + type, + ); + + @override + String toString() { + return 'NotificationAddedToChannelEvent(channel: $channel, channelCustom: $channelCustom, channelId: $channelId, channelMemberCount: $channelMemberCount, channelMessageCount: $channelMessageCount, channelType: $channelType, cid: $cid, createdAt: $createdAt, custom: $custom, member: $member, receivedAt: $receivedAt, team: $team, type: $type)'; + } +} + +/// @nodoc +abstract mixin class $NotificationAddedToChannelEventCopyWith<$Res> { + factory $NotificationAddedToChannelEventCopyWith( + NotificationAddedToChannelEvent value, + $Res Function(NotificationAddedToChannelEvent) _then, + ) = _$NotificationAddedToChannelEventCopyWithImpl; + @useResult + $Res call({ + ChannelResponse channel, + Map? channelCustom, + String? channelId, + int? channelMemberCount, + int? channelMessageCount, + String? channelType, + String? cid, + DateTime createdAt, + Map custom, + ChannelMemberResponse member, + DateTime? receivedAt, + String? team, + String type, + }); +} + +/// @nodoc +class _$NotificationAddedToChannelEventCopyWithImpl<$Res> implements $NotificationAddedToChannelEventCopyWith<$Res> { + _$NotificationAddedToChannelEventCopyWithImpl(this._self, this._then); + + final NotificationAddedToChannelEvent _self; + final $Res Function(NotificationAddedToChannelEvent) _then; + + /// Create a copy of NotificationAddedToChannelEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channel = null, + Object? channelCustom = freezed, + Object? channelId = freezed, + Object? channelMemberCount = freezed, + Object? channelMessageCount = freezed, + Object? channelType = freezed, + Object? cid = freezed, + Object? createdAt = null, + Object? custom = null, + Object? member = null, + Object? receivedAt = freezed, + Object? team = freezed, + Object? type = null, + }) { + return _then( + NotificationAddedToChannelEvent( + channel: null == channel + ? _self.channel + : channel // ignore: cast_nullable_to_non_nullable + as ChannelResponse, + channelCustom: freezed == channelCustom + ? _self.channelCustom + : channelCustom // ignore: cast_nullable_to_non_nullable + as Map?, + channelId: freezed == channelId + ? _self.channelId + : channelId // ignore: cast_nullable_to_non_nullable + as String?, + channelMemberCount: freezed == channelMemberCount + ? _self.channelMemberCount + : channelMemberCount // ignore: cast_nullable_to_non_nullable + as int?, + channelMessageCount: freezed == channelMessageCount + ? _self.channelMessageCount + : channelMessageCount // ignore: cast_nullable_to_non_nullable + as int?, + channelType: freezed == channelType + ? _self.channelType + : channelType // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + member: null == member + ? _self.member + : member // ignore: cast_nullable_to_non_nullable + as ChannelMemberResponse, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + team: freezed == team + ? _self.team + : team // ignore: cast_nullable_to_non_nullable + as String?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/notification_added_to_channel_event.g.dart b/packages/stream_chat/lib/open_api/model/notification_added_to_channel_event.g.dart new file mode 100644 index 0000000000..1c9a55aca2 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/notification_added_to_channel_event.g.dart @@ -0,0 +1,63 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'notification_added_to_channel_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +NotificationAddedToChannelEvent _$NotificationAddedToChannelEventFromJson( + Map json, +) => NotificationAddedToChannelEvent( + channel: ChannelResponse.fromJson(json['channel'] as Map), + channelCustom: json['channel_custom'] as Map?, + channelId: json['channel_id'] as String?, + channelMemberCount: (json['channel_member_count'] as num?)?.toInt(), + channelMessageCount: (json['channel_message_count'] as num?)?.toInt(), + channelType: json['channel_type'] as String?, + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + member: ChannelMemberResponse.fromJson( + json['member'] as Map, + ), + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + team: json['team'] as String?, + type: json['type'] as String, +); + +Map _$NotificationAddedToChannelEventToJson( + NotificationAddedToChannelEvent instance, +) => { + 'channel': instance.channel.toJson(), + 'channel_custom': instance.channelCustom, + 'channel_id': instance.channelId, + 'channel_member_count': instance.channelMemberCount, + 'channel_message_count': instance.channelMessageCount, + 'channel_type': instance.channelType, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'member': instance.member.toJson(), + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'team': instance.team, + 'type': instance.type, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/notification_channel_deleted_event.dart b/packages/stream_chat/lib/open_api/model/notification_channel_deleted_event.dart new file mode 100644 index 0000000000..21c2e609b1 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/notification_channel_deleted_event.dart @@ -0,0 +1,109 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'notification_channel_deleted_event.g.dart'; +part 'notification_channel_deleted_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class NotificationChannelDeletedEvent extends core.WsEvent with _$NotificationChannelDeletedEvent { + const NotificationChannelDeletedEvent({ + required this.channel, + this.channelCustom, + this.channelId, + this.channelMemberCount, + this.channelMessageCount, + this.channelType, + this.cid, + required this.createdAt, + required this.custom, + this.groupedUnreadChannels, + this.receivedAt, + this.team, + this.totalUnreadCount, + required this.type, + this.unreadChannels, + this.unreadCount, + }); + + @override + @JsonKey(name: 'channel') + final ChannelResponse channel; + + @override + @JsonKey(name: 'channel_custom') + final Map? channelCustom; + + @override + @JsonKey(name: 'channel_id') + final String? channelId; + + @override + @JsonKey(name: 'channel_member_count') + final int? channelMemberCount; + + @override + @JsonKey(name: 'channel_message_count') + final int? channelMessageCount; + + @override + @JsonKey(name: 'channel_type') + final String? channelType; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'grouped_unread_channels') + final Map? groupedUnreadChannels; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'team') + final String? team; + + @override + @JsonKey(name: 'total_unread_count') + final int? totalUnreadCount; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'unread_channels') + final int? unreadChannels; + + @override + @JsonKey(name: 'unread_count') + final int? unreadCount; + + Map toJson() => _$NotificationChannelDeletedEventToJson(this); + + static NotificationChannelDeletedEvent fromJson(Map json) => + _$NotificationChannelDeletedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/notification_channel_deleted_event.freezed.dart b/packages/stream_chat/lib/open_api/model/notification_channel_deleted_event.freezed.dart new file mode 100644 index 0000000000..d96b209a4e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/notification_channel_deleted_event.freezed.dart @@ -0,0 +1,226 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'notification_channel_deleted_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$NotificationChannelDeletedEvent { + ChannelResponse get channel; + Map? get channelCustom; + String? get channelId; + int? get channelMemberCount; + int? get channelMessageCount; + String? get channelType; + String? get cid; + DateTime get createdAt; + Map get custom; + Map? get groupedUnreadChannels; + DateTime? get receivedAt; + String? get team; + int? get totalUnreadCount; + String get type; + int? get unreadChannels; + int? get unreadCount; + + /// Create a copy of NotificationChannelDeletedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $NotificationChannelDeletedEventCopyWith get copyWith => + _$NotificationChannelDeletedEventCopyWithImpl( + this as NotificationChannelDeletedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is NotificationChannelDeletedEvent && + (identical(other.channel, channel) || other.channel == channel) && + const DeepCollectionEquality().equals( + other.channelCustom, + channelCustom, + ) && + (identical(other.channelId, channelId) || other.channelId == channelId) && + (identical(other.channelMemberCount, channelMemberCount) || + other.channelMemberCount == channelMemberCount) && + (identical(other.channelMessageCount, channelMessageCount) || + other.channelMessageCount == channelMessageCount) && + (identical(other.channelType, channelType) || other.channelType == channelType) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + const DeepCollectionEquality().equals( + other.groupedUnreadChannels, + groupedUnreadChannels, + ) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.team, team) || other.team == team) && + (identical(other.totalUnreadCount, totalUnreadCount) || other.totalUnreadCount == totalUnreadCount) && + (identical(other.type, type) || other.type == type) && + (identical(other.unreadChannels, unreadChannels) || other.unreadChannels == unreadChannels) && + (identical(other.unreadCount, unreadCount) || other.unreadCount == unreadCount)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channel, + const DeepCollectionEquality().hash(channelCustom), + channelId, + channelMemberCount, + channelMessageCount, + channelType, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + const DeepCollectionEquality().hash(groupedUnreadChannels), + receivedAt, + team, + totalUnreadCount, + type, + unreadChannels, + unreadCount, + ); + + @override + String toString() { + return 'NotificationChannelDeletedEvent(channel: $channel, channelCustom: $channelCustom, channelId: $channelId, channelMemberCount: $channelMemberCount, channelMessageCount: $channelMessageCount, channelType: $channelType, cid: $cid, createdAt: $createdAt, custom: $custom, groupedUnreadChannels: $groupedUnreadChannels, receivedAt: $receivedAt, team: $team, totalUnreadCount: $totalUnreadCount, type: $type, unreadChannels: $unreadChannels, unreadCount: $unreadCount)'; + } +} + +/// @nodoc +abstract mixin class $NotificationChannelDeletedEventCopyWith<$Res> { + factory $NotificationChannelDeletedEventCopyWith( + NotificationChannelDeletedEvent value, + $Res Function(NotificationChannelDeletedEvent) _then, + ) = _$NotificationChannelDeletedEventCopyWithImpl; + @useResult + $Res call({ + ChannelResponse channel, + Map? channelCustom, + String? channelId, + int? channelMemberCount, + int? channelMessageCount, + String? channelType, + String? cid, + DateTime createdAt, + Map custom, + Map? groupedUnreadChannels, + DateTime? receivedAt, + String? team, + int? totalUnreadCount, + String type, + int? unreadChannels, + int? unreadCount, + }); +} + +/// @nodoc +class _$NotificationChannelDeletedEventCopyWithImpl<$Res> implements $NotificationChannelDeletedEventCopyWith<$Res> { + _$NotificationChannelDeletedEventCopyWithImpl(this._self, this._then); + + final NotificationChannelDeletedEvent _self; + final $Res Function(NotificationChannelDeletedEvent) _then; + + /// Create a copy of NotificationChannelDeletedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channel = null, + Object? channelCustom = freezed, + Object? channelId = freezed, + Object? channelMemberCount = freezed, + Object? channelMessageCount = freezed, + Object? channelType = freezed, + Object? cid = freezed, + Object? createdAt = null, + Object? custom = null, + Object? groupedUnreadChannels = freezed, + Object? receivedAt = freezed, + Object? team = freezed, + Object? totalUnreadCount = freezed, + Object? type = null, + Object? unreadChannels = freezed, + Object? unreadCount = freezed, + }) { + return _then( + NotificationChannelDeletedEvent( + channel: null == channel + ? _self.channel + : channel // ignore: cast_nullable_to_non_nullable + as ChannelResponse, + channelCustom: freezed == channelCustom + ? _self.channelCustom + : channelCustom // ignore: cast_nullable_to_non_nullable + as Map?, + channelId: freezed == channelId + ? _self.channelId + : channelId // ignore: cast_nullable_to_non_nullable + as String?, + channelMemberCount: freezed == channelMemberCount + ? _self.channelMemberCount + : channelMemberCount // ignore: cast_nullable_to_non_nullable + as int?, + channelMessageCount: freezed == channelMessageCount + ? _self.channelMessageCount + : channelMessageCount // ignore: cast_nullable_to_non_nullable + as int?, + channelType: freezed == channelType + ? _self.channelType + : channelType // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + groupedUnreadChannels: freezed == groupedUnreadChannels + ? _self.groupedUnreadChannels + : groupedUnreadChannels // ignore: cast_nullable_to_non_nullable + as Map?, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + team: freezed == team + ? _self.team + : team // ignore: cast_nullable_to_non_nullable + as String?, + totalUnreadCount: freezed == totalUnreadCount + ? _self.totalUnreadCount + : totalUnreadCount // ignore: cast_nullable_to_non_nullable + as int?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + unreadChannels: freezed == unreadChannels + ? _self.unreadChannels + : unreadChannels // ignore: cast_nullable_to_non_nullable + as int?, + unreadCount: freezed == unreadCount + ? _self.unreadCount + : unreadCount // ignore: cast_nullable_to_non_nullable + as int?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/notification_channel_deleted_event.g.dart b/packages/stream_chat/lib/open_api/model/notification_channel_deleted_event.g.dart new file mode 100644 index 0000000000..72cd75eac0 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/notification_channel_deleted_event.g.dart @@ -0,0 +1,69 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'notification_channel_deleted_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +NotificationChannelDeletedEvent _$NotificationChannelDeletedEventFromJson( + Map json, +) => NotificationChannelDeletedEvent( + channel: ChannelResponse.fromJson(json['channel'] as Map), + channelCustom: json['channel_custom'] as Map?, + channelId: json['channel_id'] as String?, + channelMemberCount: (json['channel_member_count'] as num?)?.toInt(), + channelMessageCount: (json['channel_message_count'] as num?)?.toInt(), + channelType: json['channel_type'] as String?, + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + groupedUnreadChannels: (json['grouped_unread_channels'] as Map?)?.map( + (k, e) => MapEntry(k, (e as num).toInt()), + ), + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + team: json['team'] as String?, + totalUnreadCount: (json['total_unread_count'] as num?)?.toInt(), + type: json['type'] as String, + unreadChannels: (json['unread_channels'] as num?)?.toInt(), + unreadCount: (json['unread_count'] as num?)?.toInt(), +); + +Map _$NotificationChannelDeletedEventToJson( + NotificationChannelDeletedEvent instance, +) => { + 'channel': instance.channel.toJson(), + 'channel_custom': instance.channelCustom, + 'channel_id': instance.channelId, + 'channel_member_count': instance.channelMemberCount, + 'channel_message_count': instance.channelMessageCount, + 'channel_type': instance.channelType, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'grouped_unread_channels': instance.groupedUnreadChannels, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'team': instance.team, + 'total_unread_count': instance.totalUnreadCount, + 'type': instance.type, + 'unread_channels': instance.unreadChannels, + 'unread_count': instance.unreadCount, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/notification_channel_mutes_updated_event.dart b/packages/stream_chat/lib/open_api/model/notification_channel_mutes_updated_event.dart new file mode 100644 index 0000000000..48208ab996 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/notification_channel_mutes_updated_event.dart @@ -0,0 +1,54 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'notification_channel_mutes_updated_event.g.dart'; +part 'notification_channel_mutes_updated_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class NotificationChannelMutesUpdatedEvent extends core.WsEvent with _$NotificationChannelMutesUpdatedEvent { + const NotificationChannelMutesUpdatedEvent({ + required this.createdAt, + required this.custom, + required this.me, + this.receivedAt, + required this.type, + }); + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'me') + final OwnUserResponse me; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'type') + final String type; + + Map toJson() => _$NotificationChannelMutesUpdatedEventToJson(this); + + static NotificationChannelMutesUpdatedEvent fromJson(Map json) => + _$NotificationChannelMutesUpdatedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/notification_channel_mutes_updated_event.freezed.dart b/packages/stream_chat/lib/open_api/model/notification_channel_mutes_updated_event.freezed.dart new file mode 100644 index 0000000000..0437e59fa0 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/notification_channel_mutes_updated_event.freezed.dart @@ -0,0 +1,120 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'notification_channel_mutes_updated_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$NotificationChannelMutesUpdatedEvent { + DateTime get createdAt; + Map get custom; + OwnUserResponse get me; + DateTime? get receivedAt; + String get type; + + /// Create a copy of NotificationChannelMutesUpdatedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $NotificationChannelMutesUpdatedEventCopyWith get copyWith => + _$NotificationChannelMutesUpdatedEventCopyWithImpl( + this as NotificationChannelMutesUpdatedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is NotificationChannelMutesUpdatedEvent && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.me, me) || other.me == me) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.type, type) || other.type == type)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + createdAt, + const DeepCollectionEquality().hash(custom), + me, + receivedAt, + type, + ); + + @override + String toString() { + return 'NotificationChannelMutesUpdatedEvent(createdAt: $createdAt, custom: $custom, me: $me, receivedAt: $receivedAt, type: $type)'; + } +} + +/// @nodoc +abstract mixin class $NotificationChannelMutesUpdatedEventCopyWith<$Res> { + factory $NotificationChannelMutesUpdatedEventCopyWith( + NotificationChannelMutesUpdatedEvent value, + $Res Function(NotificationChannelMutesUpdatedEvent) _then, + ) = _$NotificationChannelMutesUpdatedEventCopyWithImpl; + @useResult + $Res call({ + DateTime createdAt, + Map custom, + OwnUserResponse me, + DateTime? receivedAt, + String type, + }); +} + +/// @nodoc +class _$NotificationChannelMutesUpdatedEventCopyWithImpl<$Res> + implements $NotificationChannelMutesUpdatedEventCopyWith<$Res> { + _$NotificationChannelMutesUpdatedEventCopyWithImpl(this._self, this._then); + + final NotificationChannelMutesUpdatedEvent _self; + final $Res Function(NotificationChannelMutesUpdatedEvent) _then; + + /// Create a copy of NotificationChannelMutesUpdatedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? createdAt = null, + Object? custom = null, + Object? me = null, + Object? receivedAt = freezed, + Object? type = null, + }) { + return _then( + NotificationChannelMutesUpdatedEvent( + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + me: null == me + ? _self.me + : me // ignore: cast_nullable_to_non_nullable + as OwnUserResponse, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/notification_channel_mutes_updated_event.g.dart b/packages/stream_chat/lib/open_api/model/notification_channel_mutes_updated_event.g.dart new file mode 100644 index 0000000000..b069e6bbcc --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/notification_channel_mutes_updated_event.g.dart @@ -0,0 +1,44 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'notification_channel_mutes_updated_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +NotificationChannelMutesUpdatedEvent _$NotificationChannelMutesUpdatedEventFromJson(Map json) => + NotificationChannelMutesUpdatedEvent( + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + me: OwnUserResponse.fromJson(json['me'] as Map), + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + type: json['type'] as String, + ); + +Map _$NotificationChannelMutesUpdatedEventToJson( + NotificationChannelMutesUpdatedEvent instance, +) => { + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'me': instance.me.toJson(), + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'type': instance.type, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/notification_channel_truncated_event.dart b/packages/stream_chat/lib/open_api/model/notification_channel_truncated_event.dart new file mode 100644 index 0000000000..cec3bf4557 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/notification_channel_truncated_event.dart @@ -0,0 +1,119 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'notification_channel_truncated_event.g.dart'; +part 'notification_channel_truncated_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class NotificationChannelTruncatedEvent extends core.WsEvent with _$NotificationChannelTruncatedEvent { + const NotificationChannelTruncatedEvent({ + required this.channel, + this.channelCustom, + this.channelId, + this.channelMemberCount, + this.channelMessageCount, + this.channelType, + this.cid, + required this.createdAt, + required this.custom, + this.groupedUnreadChannels, + this.message, + this.messageId, + this.receivedAt, + this.team, + this.totalUnreadCount, + required this.type, + this.unreadChannels, + this.unreadCount, + }); + + @override + @JsonKey(name: 'channel') + final ChannelResponse channel; + + @override + @JsonKey(name: 'channel_custom') + final Map? channelCustom; + + @override + @JsonKey(name: 'channel_id') + final String? channelId; + + @override + @JsonKey(name: 'channel_member_count') + final int? channelMemberCount; + + @override + @JsonKey(name: 'channel_message_count') + final int? channelMessageCount; + + @override + @JsonKey(name: 'channel_type') + final String? channelType; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'grouped_unread_channels') + final Map? groupedUnreadChannels; + + @override + @JsonKey(name: 'message') + final MessageResponse? message; + + @override + @JsonKey(name: 'message_id') + final String? messageId; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'team') + final String? team; + + @override + @JsonKey(name: 'total_unread_count') + final int? totalUnreadCount; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'unread_channels') + final int? unreadChannels; + + @override + @JsonKey(name: 'unread_count') + final int? unreadCount; + + Map toJson() => _$NotificationChannelTruncatedEventToJson(this); + + static NotificationChannelTruncatedEvent fromJson(Map json) => + _$NotificationChannelTruncatedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/notification_channel_truncated_event.freezed.dart b/packages/stream_chat/lib/open_api/model/notification_channel_truncated_event.freezed.dart new file mode 100644 index 0000000000..62ba2f66da --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/notification_channel_truncated_event.freezed.dart @@ -0,0 +1,245 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'notification_channel_truncated_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$NotificationChannelTruncatedEvent { + ChannelResponse get channel; + Map? get channelCustom; + String? get channelId; + int? get channelMemberCount; + int? get channelMessageCount; + String? get channelType; + String? get cid; + DateTime get createdAt; + Map get custom; + Map? get groupedUnreadChannels; + MessageResponse? get message; + String? get messageId; + DateTime? get receivedAt; + String? get team; + int? get totalUnreadCount; + String get type; + int? get unreadChannels; + int? get unreadCount; + + /// Create a copy of NotificationChannelTruncatedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $NotificationChannelTruncatedEventCopyWith get copyWith => + _$NotificationChannelTruncatedEventCopyWithImpl( + this as NotificationChannelTruncatedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is NotificationChannelTruncatedEvent && + (identical(other.channel, channel) || other.channel == channel) && + const DeepCollectionEquality().equals( + other.channelCustom, + channelCustom, + ) && + (identical(other.channelId, channelId) || other.channelId == channelId) && + (identical(other.channelMemberCount, channelMemberCount) || + other.channelMemberCount == channelMemberCount) && + (identical(other.channelMessageCount, channelMessageCount) || + other.channelMessageCount == channelMessageCount) && + (identical(other.channelType, channelType) || other.channelType == channelType) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + const DeepCollectionEquality().equals( + other.groupedUnreadChannels, + groupedUnreadChannels, + ) && + (identical(other.message, message) || other.message == message) && + (identical(other.messageId, messageId) || other.messageId == messageId) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.team, team) || other.team == team) && + (identical(other.totalUnreadCount, totalUnreadCount) || other.totalUnreadCount == totalUnreadCount) && + (identical(other.type, type) || other.type == type) && + (identical(other.unreadChannels, unreadChannels) || other.unreadChannels == unreadChannels) && + (identical(other.unreadCount, unreadCount) || other.unreadCount == unreadCount)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channel, + const DeepCollectionEquality().hash(channelCustom), + channelId, + channelMemberCount, + channelMessageCount, + channelType, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + const DeepCollectionEquality().hash(groupedUnreadChannels), + message, + messageId, + receivedAt, + team, + totalUnreadCount, + type, + unreadChannels, + unreadCount, + ); + + @override + String toString() { + return 'NotificationChannelTruncatedEvent(channel: $channel, channelCustom: $channelCustom, channelId: $channelId, channelMemberCount: $channelMemberCount, channelMessageCount: $channelMessageCount, channelType: $channelType, cid: $cid, createdAt: $createdAt, custom: $custom, groupedUnreadChannels: $groupedUnreadChannels, message: $message, messageId: $messageId, receivedAt: $receivedAt, team: $team, totalUnreadCount: $totalUnreadCount, type: $type, unreadChannels: $unreadChannels, unreadCount: $unreadCount)'; + } +} + +/// @nodoc +abstract mixin class $NotificationChannelTruncatedEventCopyWith<$Res> { + factory $NotificationChannelTruncatedEventCopyWith( + NotificationChannelTruncatedEvent value, + $Res Function(NotificationChannelTruncatedEvent) _then, + ) = _$NotificationChannelTruncatedEventCopyWithImpl; + @useResult + $Res call({ + ChannelResponse channel, + Map? channelCustom, + String? channelId, + int? channelMemberCount, + int? channelMessageCount, + String? channelType, + String? cid, + DateTime createdAt, + Map custom, + Map? groupedUnreadChannels, + MessageResponse? message, + String? messageId, + DateTime? receivedAt, + String? team, + int? totalUnreadCount, + String type, + int? unreadChannels, + int? unreadCount, + }); +} + +/// @nodoc +class _$NotificationChannelTruncatedEventCopyWithImpl<$Res> + implements $NotificationChannelTruncatedEventCopyWith<$Res> { + _$NotificationChannelTruncatedEventCopyWithImpl(this._self, this._then); + + final NotificationChannelTruncatedEvent _self; + final $Res Function(NotificationChannelTruncatedEvent) _then; + + /// Create a copy of NotificationChannelTruncatedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channel = null, + Object? channelCustom = freezed, + Object? channelId = freezed, + Object? channelMemberCount = freezed, + Object? channelMessageCount = freezed, + Object? channelType = freezed, + Object? cid = freezed, + Object? createdAt = null, + Object? custom = null, + Object? groupedUnreadChannels = freezed, + Object? message = freezed, + Object? messageId = freezed, + Object? receivedAt = freezed, + Object? team = freezed, + Object? totalUnreadCount = freezed, + Object? type = null, + Object? unreadChannels = freezed, + Object? unreadCount = freezed, + }) { + return _then( + NotificationChannelTruncatedEvent( + channel: null == channel + ? _self.channel + : channel // ignore: cast_nullable_to_non_nullable + as ChannelResponse, + channelCustom: freezed == channelCustom + ? _self.channelCustom + : channelCustom // ignore: cast_nullable_to_non_nullable + as Map?, + channelId: freezed == channelId + ? _self.channelId + : channelId // ignore: cast_nullable_to_non_nullable + as String?, + channelMemberCount: freezed == channelMemberCount + ? _self.channelMemberCount + : channelMemberCount // ignore: cast_nullable_to_non_nullable + as int?, + channelMessageCount: freezed == channelMessageCount + ? _self.channelMessageCount + : channelMessageCount // ignore: cast_nullable_to_non_nullable + as int?, + channelType: freezed == channelType + ? _self.channelType + : channelType // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + groupedUnreadChannels: freezed == groupedUnreadChannels + ? _self.groupedUnreadChannels + : groupedUnreadChannels // ignore: cast_nullable_to_non_nullable + as Map?, + message: freezed == message + ? _self.message + : message // ignore: cast_nullable_to_non_nullable + as MessageResponse?, + messageId: freezed == messageId + ? _self.messageId + : messageId // ignore: cast_nullable_to_non_nullable + as String?, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + team: freezed == team + ? _self.team + : team // ignore: cast_nullable_to_non_nullable + as String?, + totalUnreadCount: freezed == totalUnreadCount + ? _self.totalUnreadCount + : totalUnreadCount // ignore: cast_nullable_to_non_nullable + as int?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + unreadChannels: freezed == unreadChannels + ? _self.unreadChannels + : unreadChannels // ignore: cast_nullable_to_non_nullable + as int?, + unreadCount: freezed == unreadCount + ? _self.unreadCount + : unreadCount // ignore: cast_nullable_to_non_nullable + as int?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/notification_channel_truncated_event.g.dart b/packages/stream_chat/lib/open_api/model/notification_channel_truncated_event.g.dart new file mode 100644 index 0000000000..3cbe71d8fa --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/notification_channel_truncated_event.g.dart @@ -0,0 +1,73 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'notification_channel_truncated_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +NotificationChannelTruncatedEvent _$NotificationChannelTruncatedEventFromJson( + Map json, +) => NotificationChannelTruncatedEvent( + channel: ChannelResponse.fromJson(json['channel'] as Map), + channelCustom: json['channel_custom'] as Map?, + channelId: json['channel_id'] as String?, + channelMemberCount: (json['channel_member_count'] as num?)?.toInt(), + channelMessageCount: (json['channel_message_count'] as num?)?.toInt(), + channelType: json['channel_type'] as String?, + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + groupedUnreadChannels: (json['grouped_unread_channels'] as Map?)?.map( + (k, e) => MapEntry(k, (e as num).toInt()), + ), + message: json['message'] == null ? null : MessageResponse.fromJson(json['message'] as Map), + messageId: json['message_id'] as String?, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + team: json['team'] as String?, + totalUnreadCount: (json['total_unread_count'] as num?)?.toInt(), + type: json['type'] as String, + unreadChannels: (json['unread_channels'] as num?)?.toInt(), + unreadCount: (json['unread_count'] as num?)?.toInt(), +); + +Map _$NotificationChannelTruncatedEventToJson( + NotificationChannelTruncatedEvent instance, +) => { + 'channel': instance.channel.toJson(), + 'channel_custom': instance.channelCustom, + 'channel_id': instance.channelId, + 'channel_member_count': instance.channelMemberCount, + 'channel_message_count': instance.channelMessageCount, + 'channel_type': instance.channelType, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'grouped_unread_channels': instance.groupedUnreadChannels, + 'message': instance.message?.toJson(), + 'message_id': instance.messageId, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'team': instance.team, + 'total_unread_count': instance.totalUnreadCount, + 'type': instance.type, + 'unread_channels': instance.unreadChannels, + 'unread_count': instance.unreadCount, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/notification_invite_accepted_event.dart b/packages/stream_chat/lib/open_api/model/notification_invite_accepted_event.dart new file mode 100644 index 0000000000..cddf2b983d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/notification_invite_accepted_event.dart @@ -0,0 +1,99 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'notification_invite_accepted_event.g.dart'; +part 'notification_invite_accepted_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class NotificationInviteAcceptedEvent extends core.WsEvent with _$NotificationInviteAcceptedEvent { + const NotificationInviteAcceptedEvent({ + required this.channel, + this.channelCustom, + this.channelId, + this.channelMemberCount, + this.channelMessageCount, + this.channelType, + this.cid, + required this.createdAt, + required this.custom, + required this.member, + this.receivedAt, + this.team, + required this.type, + this.user, + }); + + @override + @JsonKey(name: 'channel') + final ChannelResponse channel; + + @override + @JsonKey(name: 'channel_custom') + final Map? channelCustom; + + @override + @JsonKey(name: 'channel_id') + final String? channelId; + + @override + @JsonKey(name: 'channel_member_count') + final int? channelMemberCount; + + @override + @JsonKey(name: 'channel_message_count') + final int? channelMessageCount; + + @override + @JsonKey(name: 'channel_type') + final String? channelType; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'member') + final ChannelMemberResponse member; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'team') + final String? team; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'user') + final UserResponseCommonFields? user; + + Map toJson() => _$NotificationInviteAcceptedEventToJson(this); + + static NotificationInviteAcceptedEvent fromJson(Map json) => + _$NotificationInviteAcceptedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/notification_invite_accepted_event.freezed.dart b/packages/stream_chat/lib/open_api/model/notification_invite_accepted_event.freezed.dart new file mode 100644 index 0000000000..97a104a8cb --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/notification_invite_accepted_event.freezed.dart @@ -0,0 +1,205 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'notification_invite_accepted_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$NotificationInviteAcceptedEvent { + ChannelResponse get channel; + Map? get channelCustom; + String? get channelId; + int? get channelMemberCount; + int? get channelMessageCount; + String? get channelType; + String? get cid; + DateTime get createdAt; + Map get custom; + ChannelMemberResponse get member; + DateTime? get receivedAt; + String? get team; + String get type; + UserResponseCommonFields? get user; + + /// Create a copy of NotificationInviteAcceptedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $NotificationInviteAcceptedEventCopyWith get copyWith => + _$NotificationInviteAcceptedEventCopyWithImpl( + this as NotificationInviteAcceptedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is NotificationInviteAcceptedEvent && + (identical(other.channel, channel) || other.channel == channel) && + const DeepCollectionEquality().equals( + other.channelCustom, + channelCustom, + ) && + (identical(other.channelId, channelId) || other.channelId == channelId) && + (identical(other.channelMemberCount, channelMemberCount) || + other.channelMemberCount == channelMemberCount) && + (identical(other.channelMessageCount, channelMessageCount) || + other.channelMessageCount == channelMessageCount) && + (identical(other.channelType, channelType) || other.channelType == channelType) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.member, member) || other.member == member) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.team, team) || other.team == team) && + (identical(other.type, type) || other.type == type) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channel, + const DeepCollectionEquality().hash(channelCustom), + channelId, + channelMemberCount, + channelMessageCount, + channelType, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + member, + receivedAt, + team, + type, + user, + ); + + @override + String toString() { + return 'NotificationInviteAcceptedEvent(channel: $channel, channelCustom: $channelCustom, channelId: $channelId, channelMemberCount: $channelMemberCount, channelMessageCount: $channelMessageCount, channelType: $channelType, cid: $cid, createdAt: $createdAt, custom: $custom, member: $member, receivedAt: $receivedAt, team: $team, type: $type, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $NotificationInviteAcceptedEventCopyWith<$Res> { + factory $NotificationInviteAcceptedEventCopyWith( + NotificationInviteAcceptedEvent value, + $Res Function(NotificationInviteAcceptedEvent) _then, + ) = _$NotificationInviteAcceptedEventCopyWithImpl; + @useResult + $Res call({ + ChannelResponse channel, + Map? channelCustom, + String? channelId, + int? channelMemberCount, + int? channelMessageCount, + String? channelType, + String? cid, + DateTime createdAt, + Map custom, + ChannelMemberResponse member, + DateTime? receivedAt, + String? team, + String type, + UserResponseCommonFields? user, + }); +} + +/// @nodoc +class _$NotificationInviteAcceptedEventCopyWithImpl<$Res> implements $NotificationInviteAcceptedEventCopyWith<$Res> { + _$NotificationInviteAcceptedEventCopyWithImpl(this._self, this._then); + + final NotificationInviteAcceptedEvent _self; + final $Res Function(NotificationInviteAcceptedEvent) _then; + + /// Create a copy of NotificationInviteAcceptedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channel = null, + Object? channelCustom = freezed, + Object? channelId = freezed, + Object? channelMemberCount = freezed, + Object? channelMessageCount = freezed, + Object? channelType = freezed, + Object? cid = freezed, + Object? createdAt = null, + Object? custom = null, + Object? member = null, + Object? receivedAt = freezed, + Object? team = freezed, + Object? type = null, + Object? user = freezed, + }) { + return _then( + NotificationInviteAcceptedEvent( + channel: null == channel + ? _self.channel + : channel // ignore: cast_nullable_to_non_nullable + as ChannelResponse, + channelCustom: freezed == channelCustom + ? _self.channelCustom + : channelCustom // ignore: cast_nullable_to_non_nullable + as Map?, + channelId: freezed == channelId + ? _self.channelId + : channelId // ignore: cast_nullable_to_non_nullable + as String?, + channelMemberCount: freezed == channelMemberCount + ? _self.channelMemberCount + : channelMemberCount // ignore: cast_nullable_to_non_nullable + as int?, + channelMessageCount: freezed == channelMessageCount + ? _self.channelMessageCount + : channelMessageCount // ignore: cast_nullable_to_non_nullable + as int?, + channelType: freezed == channelType + ? _self.channelType + : channelType // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + member: null == member + ? _self.member + : member // ignore: cast_nullable_to_non_nullable + as ChannelMemberResponse, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + team: freezed == team + ? _self.team + : team // ignore: cast_nullable_to_non_nullable + as String?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponseCommonFields?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/notification_invite_accepted_event.g.dart b/packages/stream_chat/lib/open_api/model/notification_invite_accepted_event.g.dart new file mode 100644 index 0000000000..598be07300 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/notification_invite_accepted_event.g.dart @@ -0,0 +1,65 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'notification_invite_accepted_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +NotificationInviteAcceptedEvent _$NotificationInviteAcceptedEventFromJson( + Map json, +) => NotificationInviteAcceptedEvent( + channel: ChannelResponse.fromJson(json['channel'] as Map), + channelCustom: json['channel_custom'] as Map?, + channelId: json['channel_id'] as String?, + channelMemberCount: (json['channel_member_count'] as num?)?.toInt(), + channelMessageCount: (json['channel_message_count'] as num?)?.toInt(), + channelType: json['channel_type'] as String?, + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + member: ChannelMemberResponse.fromJson( + json['member'] as Map, + ), + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + team: json['team'] as String?, + type: json['type'] as String, + user: json['user'] == null ? null : UserResponseCommonFields.fromJson(json['user'] as Map), +); + +Map _$NotificationInviteAcceptedEventToJson( + NotificationInviteAcceptedEvent instance, +) => { + 'channel': instance.channel.toJson(), + 'channel_custom': instance.channelCustom, + 'channel_id': instance.channelId, + 'channel_member_count': instance.channelMemberCount, + 'channel_message_count': instance.channelMessageCount, + 'channel_type': instance.channelType, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'member': instance.member.toJson(), + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'team': instance.team, + 'type': instance.type, + 'user': instance.user?.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/notification_invite_rejected_event.dart b/packages/stream_chat/lib/open_api/model/notification_invite_rejected_event.dart new file mode 100644 index 0000000000..fa841cc1a6 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/notification_invite_rejected_event.dart @@ -0,0 +1,99 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'notification_invite_rejected_event.g.dart'; +part 'notification_invite_rejected_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class NotificationInviteRejectedEvent extends core.WsEvent with _$NotificationInviteRejectedEvent { + const NotificationInviteRejectedEvent({ + required this.channel, + this.channelCustom, + this.channelId, + this.channelMemberCount, + this.channelMessageCount, + this.channelType, + this.cid, + required this.createdAt, + required this.custom, + required this.member, + this.receivedAt, + this.team, + required this.type, + this.user, + }); + + @override + @JsonKey(name: 'channel') + final ChannelResponse channel; + + @override + @JsonKey(name: 'channel_custom') + final Map? channelCustom; + + @override + @JsonKey(name: 'channel_id') + final String? channelId; + + @override + @JsonKey(name: 'channel_member_count') + final int? channelMemberCount; + + @override + @JsonKey(name: 'channel_message_count') + final int? channelMessageCount; + + @override + @JsonKey(name: 'channel_type') + final String? channelType; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'member') + final ChannelMemberResponse member; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'team') + final String? team; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'user') + final UserResponseCommonFields? user; + + Map toJson() => _$NotificationInviteRejectedEventToJson(this); + + static NotificationInviteRejectedEvent fromJson(Map json) => + _$NotificationInviteRejectedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/notification_invite_rejected_event.freezed.dart b/packages/stream_chat/lib/open_api/model/notification_invite_rejected_event.freezed.dart new file mode 100644 index 0000000000..42e7ea910a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/notification_invite_rejected_event.freezed.dart @@ -0,0 +1,205 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'notification_invite_rejected_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$NotificationInviteRejectedEvent { + ChannelResponse get channel; + Map? get channelCustom; + String? get channelId; + int? get channelMemberCount; + int? get channelMessageCount; + String? get channelType; + String? get cid; + DateTime get createdAt; + Map get custom; + ChannelMemberResponse get member; + DateTime? get receivedAt; + String? get team; + String get type; + UserResponseCommonFields? get user; + + /// Create a copy of NotificationInviteRejectedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $NotificationInviteRejectedEventCopyWith get copyWith => + _$NotificationInviteRejectedEventCopyWithImpl( + this as NotificationInviteRejectedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is NotificationInviteRejectedEvent && + (identical(other.channel, channel) || other.channel == channel) && + const DeepCollectionEquality().equals( + other.channelCustom, + channelCustom, + ) && + (identical(other.channelId, channelId) || other.channelId == channelId) && + (identical(other.channelMemberCount, channelMemberCount) || + other.channelMemberCount == channelMemberCount) && + (identical(other.channelMessageCount, channelMessageCount) || + other.channelMessageCount == channelMessageCount) && + (identical(other.channelType, channelType) || other.channelType == channelType) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.member, member) || other.member == member) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.team, team) || other.team == team) && + (identical(other.type, type) || other.type == type) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channel, + const DeepCollectionEquality().hash(channelCustom), + channelId, + channelMemberCount, + channelMessageCount, + channelType, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + member, + receivedAt, + team, + type, + user, + ); + + @override + String toString() { + return 'NotificationInviteRejectedEvent(channel: $channel, channelCustom: $channelCustom, channelId: $channelId, channelMemberCount: $channelMemberCount, channelMessageCount: $channelMessageCount, channelType: $channelType, cid: $cid, createdAt: $createdAt, custom: $custom, member: $member, receivedAt: $receivedAt, team: $team, type: $type, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $NotificationInviteRejectedEventCopyWith<$Res> { + factory $NotificationInviteRejectedEventCopyWith( + NotificationInviteRejectedEvent value, + $Res Function(NotificationInviteRejectedEvent) _then, + ) = _$NotificationInviteRejectedEventCopyWithImpl; + @useResult + $Res call({ + ChannelResponse channel, + Map? channelCustom, + String? channelId, + int? channelMemberCount, + int? channelMessageCount, + String? channelType, + String? cid, + DateTime createdAt, + Map custom, + ChannelMemberResponse member, + DateTime? receivedAt, + String? team, + String type, + UserResponseCommonFields? user, + }); +} + +/// @nodoc +class _$NotificationInviteRejectedEventCopyWithImpl<$Res> implements $NotificationInviteRejectedEventCopyWith<$Res> { + _$NotificationInviteRejectedEventCopyWithImpl(this._self, this._then); + + final NotificationInviteRejectedEvent _self; + final $Res Function(NotificationInviteRejectedEvent) _then; + + /// Create a copy of NotificationInviteRejectedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channel = null, + Object? channelCustom = freezed, + Object? channelId = freezed, + Object? channelMemberCount = freezed, + Object? channelMessageCount = freezed, + Object? channelType = freezed, + Object? cid = freezed, + Object? createdAt = null, + Object? custom = null, + Object? member = null, + Object? receivedAt = freezed, + Object? team = freezed, + Object? type = null, + Object? user = freezed, + }) { + return _then( + NotificationInviteRejectedEvent( + channel: null == channel + ? _self.channel + : channel // ignore: cast_nullable_to_non_nullable + as ChannelResponse, + channelCustom: freezed == channelCustom + ? _self.channelCustom + : channelCustom // ignore: cast_nullable_to_non_nullable + as Map?, + channelId: freezed == channelId + ? _self.channelId + : channelId // ignore: cast_nullable_to_non_nullable + as String?, + channelMemberCount: freezed == channelMemberCount + ? _self.channelMemberCount + : channelMemberCount // ignore: cast_nullable_to_non_nullable + as int?, + channelMessageCount: freezed == channelMessageCount + ? _self.channelMessageCount + : channelMessageCount // ignore: cast_nullable_to_non_nullable + as int?, + channelType: freezed == channelType + ? _self.channelType + : channelType // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + member: null == member + ? _self.member + : member // ignore: cast_nullable_to_non_nullable + as ChannelMemberResponse, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + team: freezed == team + ? _self.team + : team // ignore: cast_nullable_to_non_nullable + as String?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponseCommonFields?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/notification_invite_rejected_event.g.dart b/packages/stream_chat/lib/open_api/model/notification_invite_rejected_event.g.dart new file mode 100644 index 0000000000..f2c68d4b0a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/notification_invite_rejected_event.g.dart @@ -0,0 +1,65 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'notification_invite_rejected_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +NotificationInviteRejectedEvent _$NotificationInviteRejectedEventFromJson( + Map json, +) => NotificationInviteRejectedEvent( + channel: ChannelResponse.fromJson(json['channel'] as Map), + channelCustom: json['channel_custom'] as Map?, + channelId: json['channel_id'] as String?, + channelMemberCount: (json['channel_member_count'] as num?)?.toInt(), + channelMessageCount: (json['channel_message_count'] as num?)?.toInt(), + channelType: json['channel_type'] as String?, + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + member: ChannelMemberResponse.fromJson( + json['member'] as Map, + ), + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + team: json['team'] as String?, + type: json['type'] as String, + user: json['user'] == null ? null : UserResponseCommonFields.fromJson(json['user'] as Map), +); + +Map _$NotificationInviteRejectedEventToJson( + NotificationInviteRejectedEvent instance, +) => { + 'channel': instance.channel.toJson(), + 'channel_custom': instance.channelCustom, + 'channel_id': instance.channelId, + 'channel_member_count': instance.channelMemberCount, + 'channel_message_count': instance.channelMessageCount, + 'channel_type': instance.channelType, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'member': instance.member.toJson(), + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'team': instance.team, + 'type': instance.type, + 'user': instance.user?.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/notification_invited_event.dart b/packages/stream_chat/lib/open_api/model/notification_invited_event.dart new file mode 100644 index 0000000000..ab238ee0f9 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/notification_invited_event.dart @@ -0,0 +1,98 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'notification_invited_event.g.dart'; +part 'notification_invited_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class NotificationInvitedEvent extends core.WsEvent with _$NotificationInvitedEvent { + const NotificationInvitedEvent({ + required this.channel, + this.channelCustom, + this.channelId, + this.channelMemberCount, + this.channelMessageCount, + this.channelType, + this.cid, + required this.createdAt, + required this.custom, + required this.member, + this.receivedAt, + this.team, + required this.type, + this.user, + }); + + @override + @JsonKey(name: 'channel') + final ChannelResponse channel; + + @override + @JsonKey(name: 'channel_custom') + final Map? channelCustom; + + @override + @JsonKey(name: 'channel_id') + final String? channelId; + + @override + @JsonKey(name: 'channel_member_count') + final int? channelMemberCount; + + @override + @JsonKey(name: 'channel_message_count') + final int? channelMessageCount; + + @override + @JsonKey(name: 'channel_type') + final String? channelType; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'member') + final ChannelMemberResponse member; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'team') + final String? team; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'user') + final UserResponseCommonFields? user; + + Map toJson() => _$NotificationInvitedEventToJson(this); + + static NotificationInvitedEvent fromJson(Map json) => _$NotificationInvitedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/notification_invited_event.freezed.dart b/packages/stream_chat/lib/open_api/model/notification_invited_event.freezed.dart new file mode 100644 index 0000000000..43fff95ef8 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/notification_invited_event.freezed.dart @@ -0,0 +1,205 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'notification_invited_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$NotificationInvitedEvent { + ChannelResponse get channel; + Map? get channelCustom; + String? get channelId; + int? get channelMemberCount; + int? get channelMessageCount; + String? get channelType; + String? get cid; + DateTime get createdAt; + Map get custom; + ChannelMemberResponse get member; + DateTime? get receivedAt; + String? get team; + String get type; + UserResponseCommonFields? get user; + + /// Create a copy of NotificationInvitedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $NotificationInvitedEventCopyWith get copyWith => + _$NotificationInvitedEventCopyWithImpl( + this as NotificationInvitedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is NotificationInvitedEvent && + (identical(other.channel, channel) || other.channel == channel) && + const DeepCollectionEquality().equals( + other.channelCustom, + channelCustom, + ) && + (identical(other.channelId, channelId) || other.channelId == channelId) && + (identical(other.channelMemberCount, channelMemberCount) || + other.channelMemberCount == channelMemberCount) && + (identical(other.channelMessageCount, channelMessageCount) || + other.channelMessageCount == channelMessageCount) && + (identical(other.channelType, channelType) || other.channelType == channelType) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.member, member) || other.member == member) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.team, team) || other.team == team) && + (identical(other.type, type) || other.type == type) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channel, + const DeepCollectionEquality().hash(channelCustom), + channelId, + channelMemberCount, + channelMessageCount, + channelType, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + member, + receivedAt, + team, + type, + user, + ); + + @override + String toString() { + return 'NotificationInvitedEvent(channel: $channel, channelCustom: $channelCustom, channelId: $channelId, channelMemberCount: $channelMemberCount, channelMessageCount: $channelMessageCount, channelType: $channelType, cid: $cid, createdAt: $createdAt, custom: $custom, member: $member, receivedAt: $receivedAt, team: $team, type: $type, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $NotificationInvitedEventCopyWith<$Res> { + factory $NotificationInvitedEventCopyWith( + NotificationInvitedEvent value, + $Res Function(NotificationInvitedEvent) _then, + ) = _$NotificationInvitedEventCopyWithImpl; + @useResult + $Res call({ + ChannelResponse channel, + Map? channelCustom, + String? channelId, + int? channelMemberCount, + int? channelMessageCount, + String? channelType, + String? cid, + DateTime createdAt, + Map custom, + ChannelMemberResponse member, + DateTime? receivedAt, + String? team, + String type, + UserResponseCommonFields? user, + }); +} + +/// @nodoc +class _$NotificationInvitedEventCopyWithImpl<$Res> implements $NotificationInvitedEventCopyWith<$Res> { + _$NotificationInvitedEventCopyWithImpl(this._self, this._then); + + final NotificationInvitedEvent _self; + final $Res Function(NotificationInvitedEvent) _then; + + /// Create a copy of NotificationInvitedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channel = null, + Object? channelCustom = freezed, + Object? channelId = freezed, + Object? channelMemberCount = freezed, + Object? channelMessageCount = freezed, + Object? channelType = freezed, + Object? cid = freezed, + Object? createdAt = null, + Object? custom = null, + Object? member = null, + Object? receivedAt = freezed, + Object? team = freezed, + Object? type = null, + Object? user = freezed, + }) { + return _then( + NotificationInvitedEvent( + channel: null == channel + ? _self.channel + : channel // ignore: cast_nullable_to_non_nullable + as ChannelResponse, + channelCustom: freezed == channelCustom + ? _self.channelCustom + : channelCustom // ignore: cast_nullable_to_non_nullable + as Map?, + channelId: freezed == channelId + ? _self.channelId + : channelId // ignore: cast_nullable_to_non_nullable + as String?, + channelMemberCount: freezed == channelMemberCount + ? _self.channelMemberCount + : channelMemberCount // ignore: cast_nullable_to_non_nullable + as int?, + channelMessageCount: freezed == channelMessageCount + ? _self.channelMessageCount + : channelMessageCount // ignore: cast_nullable_to_non_nullable + as int?, + channelType: freezed == channelType + ? _self.channelType + : channelType // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + member: null == member + ? _self.member + : member // ignore: cast_nullable_to_non_nullable + as ChannelMemberResponse, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + team: freezed == team + ? _self.team + : team // ignore: cast_nullable_to_non_nullable + as String?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponseCommonFields?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/notification_invited_event.g.dart b/packages/stream_chat/lib/open_api/model/notification_invited_event.g.dart new file mode 100644 index 0000000000..cf099ad50a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/notification_invited_event.g.dart @@ -0,0 +1,65 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'notification_invited_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +NotificationInvitedEvent _$NotificationInvitedEventFromJson( + Map json, +) => NotificationInvitedEvent( + channel: ChannelResponse.fromJson(json['channel'] as Map), + channelCustom: json['channel_custom'] as Map?, + channelId: json['channel_id'] as String?, + channelMemberCount: (json['channel_member_count'] as num?)?.toInt(), + channelMessageCount: (json['channel_message_count'] as num?)?.toInt(), + channelType: json['channel_type'] as String?, + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + member: ChannelMemberResponse.fromJson( + json['member'] as Map, + ), + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + team: json['team'] as String?, + type: json['type'] as String, + user: json['user'] == null ? null : UserResponseCommonFields.fromJson(json['user'] as Map), +); + +Map _$NotificationInvitedEventToJson( + NotificationInvitedEvent instance, +) => { + 'channel': instance.channel.toJson(), + 'channel_custom': instance.channelCustom, + 'channel_id': instance.channelId, + 'channel_member_count': instance.channelMemberCount, + 'channel_message_count': instance.channelMessageCount, + 'channel_type': instance.channelType, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'member': instance.member.toJson(), + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'team': instance.team, + 'type': instance.type, + 'user': instance.user?.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/notification_mark_read_event.dart b/packages/stream_chat/lib/open_api/model/notification_mark_read_event.dart new file mode 100644 index 0000000000..73b6719837 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/notification_mark_read_event.dart @@ -0,0 +1,138 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'notification_mark_read_event.g.dart'; +part 'notification_mark_read_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class NotificationMarkReadEvent extends core.WsEvent with _$NotificationMarkReadEvent { + const NotificationMarkReadEvent({ + this.channel, + this.channelCustom, + this.channelId, + this.channelMemberCount, + this.channelMessageCount, + this.channelType, + this.cid, + required this.createdAt, + required this.custom, + this.groupedUnreadChannels, + this.lastReadMessageId, + this.receivedAt, + this.team, + this.thread, + this.threadId, + required this.totalUnreadCount, + required this.type, + required this.unreadChannels, + required this.unreadCount, + this.unreadThreadMessages, + this.unreadThreads, + this.user, + }); + + @override + @JsonKey(name: 'channel') + final ChannelResponse? channel; + + @override + @JsonKey(name: 'channel_custom') + final Map? channelCustom; + + @override + @JsonKey(name: 'channel_id') + final String? channelId; + + @override + @JsonKey(name: 'channel_member_count') + final int? channelMemberCount; + + @override + @JsonKey(name: 'channel_message_count') + final int? channelMessageCount; + + @override + @JsonKey(name: 'channel_type') + final String? channelType; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'grouped_unread_channels') + final Map? groupedUnreadChannels; + + @override + @JsonKey(name: 'last_read_message_id') + final String? lastReadMessageId; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'team') + final String? team; + + @override + @JsonKey(name: 'thread') + final ThreadResponse? thread; + + @override + @JsonKey(name: 'thread_id') + final String? threadId; + + @override + @JsonKey(name: 'total_unread_count') + final int totalUnreadCount; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'unread_channels') + final int unreadChannels; + + @override + @JsonKey(name: 'unread_count') + final int unreadCount; + + @override + @JsonKey(name: 'unread_thread_messages') + final int? unreadThreadMessages; + + @override + @JsonKey(name: 'unread_threads') + final int? unreadThreads; + + @override + @JsonKey(name: 'user') + final UserResponseCommonFields? user; + + Map toJson() => _$NotificationMarkReadEventToJson(this); + + static NotificationMarkReadEvent fromJson(Map json) => _$NotificationMarkReadEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/notification_mark_read_event.freezed.dart b/packages/stream_chat/lib/open_api/model/notification_mark_read_event.freezed.dart new file mode 100644 index 0000000000..cf862f6ba4 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/notification_mark_read_event.freezed.dart @@ -0,0 +1,281 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'notification_mark_read_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$NotificationMarkReadEvent { + ChannelResponse? get channel; + Map? get channelCustom; + String? get channelId; + int? get channelMemberCount; + int? get channelMessageCount; + String? get channelType; + String? get cid; + DateTime get createdAt; + Map get custom; + Map? get groupedUnreadChannels; + String? get lastReadMessageId; + DateTime? get receivedAt; + String? get team; + ThreadResponse? get thread; + String? get threadId; + int get totalUnreadCount; + String get type; + int get unreadChannels; + int get unreadCount; + int? get unreadThreadMessages; + int? get unreadThreads; + UserResponseCommonFields? get user; + + /// Create a copy of NotificationMarkReadEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $NotificationMarkReadEventCopyWith get copyWith => + _$NotificationMarkReadEventCopyWithImpl( + this as NotificationMarkReadEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is NotificationMarkReadEvent && + (identical(other.channel, channel) || other.channel == channel) && + const DeepCollectionEquality().equals( + other.channelCustom, + channelCustom, + ) && + (identical(other.channelId, channelId) || other.channelId == channelId) && + (identical(other.channelMemberCount, channelMemberCount) || + other.channelMemberCount == channelMemberCount) && + (identical(other.channelMessageCount, channelMessageCount) || + other.channelMessageCount == channelMessageCount) && + (identical(other.channelType, channelType) || other.channelType == channelType) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + const DeepCollectionEquality().equals( + other.groupedUnreadChannels, + groupedUnreadChannels, + ) && + (identical(other.lastReadMessageId, lastReadMessageId) || other.lastReadMessageId == lastReadMessageId) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.team, team) || other.team == team) && + (identical(other.thread, thread) || other.thread == thread) && + (identical(other.threadId, threadId) || other.threadId == threadId) && + (identical(other.totalUnreadCount, totalUnreadCount) || other.totalUnreadCount == totalUnreadCount) && + (identical(other.type, type) || other.type == type) && + (identical(other.unreadChannels, unreadChannels) || other.unreadChannels == unreadChannels) && + (identical(other.unreadCount, unreadCount) || other.unreadCount == unreadCount) && + (identical(other.unreadThreadMessages, unreadThreadMessages) || + other.unreadThreadMessages == unreadThreadMessages) && + (identical(other.unreadThreads, unreadThreads) || other.unreadThreads == unreadThreads) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hashAll([ + runtimeType, + channel, + const DeepCollectionEquality().hash(channelCustom), + channelId, + channelMemberCount, + channelMessageCount, + channelType, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + const DeepCollectionEquality().hash(groupedUnreadChannels), + lastReadMessageId, + receivedAt, + team, + thread, + threadId, + totalUnreadCount, + type, + unreadChannels, + unreadCount, + unreadThreadMessages, + unreadThreads, + user, + ]); + + @override + String toString() { + return 'NotificationMarkReadEvent(channel: $channel, channelCustom: $channelCustom, channelId: $channelId, channelMemberCount: $channelMemberCount, channelMessageCount: $channelMessageCount, channelType: $channelType, cid: $cid, createdAt: $createdAt, custom: $custom, groupedUnreadChannels: $groupedUnreadChannels, lastReadMessageId: $lastReadMessageId, receivedAt: $receivedAt, team: $team, thread: $thread, threadId: $threadId, totalUnreadCount: $totalUnreadCount, type: $type, unreadChannels: $unreadChannels, unreadCount: $unreadCount, unreadThreadMessages: $unreadThreadMessages, unreadThreads: $unreadThreads, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $NotificationMarkReadEventCopyWith<$Res> { + factory $NotificationMarkReadEventCopyWith( + NotificationMarkReadEvent value, + $Res Function(NotificationMarkReadEvent) _then, + ) = _$NotificationMarkReadEventCopyWithImpl; + @useResult + $Res call({ + ChannelResponse? channel, + Map? channelCustom, + String? channelId, + int? channelMemberCount, + int? channelMessageCount, + String? channelType, + String? cid, + DateTime createdAt, + Map custom, + Map? groupedUnreadChannels, + String? lastReadMessageId, + DateTime? receivedAt, + String? team, + ThreadResponse? thread, + String? threadId, + int totalUnreadCount, + String type, + int unreadChannels, + int unreadCount, + int? unreadThreadMessages, + int? unreadThreads, + UserResponseCommonFields? user, + }); +} + +/// @nodoc +class _$NotificationMarkReadEventCopyWithImpl<$Res> implements $NotificationMarkReadEventCopyWith<$Res> { + _$NotificationMarkReadEventCopyWithImpl(this._self, this._then); + + final NotificationMarkReadEvent _self; + final $Res Function(NotificationMarkReadEvent) _then; + + /// Create a copy of NotificationMarkReadEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channel = freezed, + Object? channelCustom = freezed, + Object? channelId = freezed, + Object? channelMemberCount = freezed, + Object? channelMessageCount = freezed, + Object? channelType = freezed, + Object? cid = freezed, + Object? createdAt = null, + Object? custom = null, + Object? groupedUnreadChannels = freezed, + Object? lastReadMessageId = freezed, + Object? receivedAt = freezed, + Object? team = freezed, + Object? thread = freezed, + Object? threadId = freezed, + Object? totalUnreadCount = null, + Object? type = null, + Object? unreadChannels = null, + Object? unreadCount = null, + Object? unreadThreadMessages = freezed, + Object? unreadThreads = freezed, + Object? user = freezed, + }) { + return _then( + NotificationMarkReadEvent( + channel: freezed == channel + ? _self.channel + : channel // ignore: cast_nullable_to_non_nullable + as ChannelResponse?, + channelCustom: freezed == channelCustom + ? _self.channelCustom + : channelCustom // ignore: cast_nullable_to_non_nullable + as Map?, + channelId: freezed == channelId + ? _self.channelId + : channelId // ignore: cast_nullable_to_non_nullable + as String?, + channelMemberCount: freezed == channelMemberCount + ? _self.channelMemberCount + : channelMemberCount // ignore: cast_nullable_to_non_nullable + as int?, + channelMessageCount: freezed == channelMessageCount + ? _self.channelMessageCount + : channelMessageCount // ignore: cast_nullable_to_non_nullable + as int?, + channelType: freezed == channelType + ? _self.channelType + : channelType // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + groupedUnreadChannels: freezed == groupedUnreadChannels + ? _self.groupedUnreadChannels + : groupedUnreadChannels // ignore: cast_nullable_to_non_nullable + as Map?, + lastReadMessageId: freezed == lastReadMessageId + ? _self.lastReadMessageId + : lastReadMessageId // ignore: cast_nullable_to_non_nullable + as String?, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + team: freezed == team + ? _self.team + : team // ignore: cast_nullable_to_non_nullable + as String?, + thread: freezed == thread + ? _self.thread + : thread // ignore: cast_nullable_to_non_nullable + as ThreadResponse?, + threadId: freezed == threadId + ? _self.threadId + : threadId // ignore: cast_nullable_to_non_nullable + as String?, + totalUnreadCount: null == totalUnreadCount + ? _self.totalUnreadCount + : totalUnreadCount // ignore: cast_nullable_to_non_nullable + as int, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + unreadChannels: null == unreadChannels + ? _self.unreadChannels + : unreadChannels // ignore: cast_nullable_to_non_nullable + as int, + unreadCount: null == unreadCount + ? _self.unreadCount + : unreadCount // ignore: cast_nullable_to_non_nullable + as int, + unreadThreadMessages: freezed == unreadThreadMessages + ? _self.unreadThreadMessages + : unreadThreadMessages // ignore: cast_nullable_to_non_nullable + as int?, + unreadThreads: freezed == unreadThreads + ? _self.unreadThreads + : unreadThreads // ignore: cast_nullable_to_non_nullable + as int?, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponseCommonFields?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/notification_mark_read_event.g.dart b/packages/stream_chat/lib/open_api/model/notification_mark_read_event.g.dart new file mode 100644 index 0000000000..52860497f3 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/notification_mark_read_event.g.dart @@ -0,0 +1,81 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'notification_mark_read_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +NotificationMarkReadEvent _$NotificationMarkReadEventFromJson( + Map json, +) => NotificationMarkReadEvent( + channel: json['channel'] == null ? null : ChannelResponse.fromJson(json['channel'] as Map), + channelCustom: json['channel_custom'] as Map?, + channelId: json['channel_id'] as String?, + channelMemberCount: (json['channel_member_count'] as num?)?.toInt(), + channelMessageCount: (json['channel_message_count'] as num?)?.toInt(), + channelType: json['channel_type'] as String?, + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + groupedUnreadChannels: (json['grouped_unread_channels'] as Map?)?.map( + (k, e) => MapEntry(k, (e as num).toInt()), + ), + lastReadMessageId: json['last_read_message_id'] as String?, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + team: json['team'] as String?, + thread: json['thread'] == null ? null : ThreadResponse.fromJson(json['thread'] as Map), + threadId: json['thread_id'] as String?, + totalUnreadCount: (json['total_unread_count'] as num).toInt(), + type: json['type'] as String, + unreadChannels: (json['unread_channels'] as num).toInt(), + unreadCount: (json['unread_count'] as num).toInt(), + unreadThreadMessages: (json['unread_thread_messages'] as num?)?.toInt(), + unreadThreads: (json['unread_threads'] as num?)?.toInt(), + user: json['user'] == null ? null : UserResponseCommonFields.fromJson(json['user'] as Map), +); + +Map _$NotificationMarkReadEventToJson( + NotificationMarkReadEvent instance, +) => { + 'channel': instance.channel?.toJson(), + 'channel_custom': instance.channelCustom, + 'channel_id': instance.channelId, + 'channel_member_count': instance.channelMemberCount, + 'channel_message_count': instance.channelMessageCount, + 'channel_type': instance.channelType, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'grouped_unread_channels': instance.groupedUnreadChannels, + 'last_read_message_id': instance.lastReadMessageId, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'team': instance.team, + 'thread': instance.thread?.toJson(), + 'thread_id': instance.threadId, + 'total_unread_count': instance.totalUnreadCount, + 'type': instance.type, + 'unread_channels': instance.unreadChannels, + 'unread_count': instance.unreadCount, + 'unread_thread_messages': instance.unreadThreadMessages, + 'unread_threads': instance.unreadThreads, + 'user': instance.user?.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/notification_mark_unread_event.dart b/packages/stream_chat/lib/open_api/model/notification_mark_unread_event.dart new file mode 100644 index 0000000000..c4e2664132 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/notification_mark_unread_event.dart @@ -0,0 +1,149 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'notification_mark_unread_event.g.dart'; +part 'notification_mark_unread_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class NotificationMarkUnreadEvent extends core.WsEvent with _$NotificationMarkUnreadEvent { + const NotificationMarkUnreadEvent({ + this.channel, + this.channelCustom, + this.channelId, + this.channelMemberCount, + this.channelMessageCount, + this.channelType, + this.cid, + required this.createdAt, + required this.custom, + this.firstUnreadMessageId, + this.groupedUnreadChannels, + this.lastReadAt, + this.lastReadMessageId, + this.receivedAt, + this.team, + this.threadId, + this.totalUnreadCount, + required this.type, + this.unreadChannels, + this.unreadCount, + this.unreadMessages, + this.unreadThreadMessages, + this.unreadThreads, + this.user, + }); + + @override + @JsonKey(name: 'channel') + final ChannelResponse? channel; + + @override + @JsonKey(name: 'channel_custom') + final Map? channelCustom; + + @override + @JsonKey(name: 'channel_id') + final String? channelId; + + @override + @JsonKey(name: 'channel_member_count') + final int? channelMemberCount; + + @override + @JsonKey(name: 'channel_message_count') + final int? channelMessageCount; + + @override + @JsonKey(name: 'channel_type') + final String? channelType; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'first_unread_message_id') + final String? firstUnreadMessageId; + + @override + @JsonKey(name: 'grouped_unread_channels') + final Map? groupedUnreadChannels; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'last_read_at') + final DateTime? lastReadAt; + + @override + @JsonKey(name: 'last_read_message_id') + final String? lastReadMessageId; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'team') + final String? team; + + @override + @JsonKey(name: 'thread_id') + final String? threadId; + + @override + @JsonKey(name: 'total_unread_count') + final int? totalUnreadCount; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'unread_channels') + final int? unreadChannels; + + @override + @JsonKey(name: 'unread_count') + final int? unreadCount; + + @override + @JsonKey(name: 'unread_messages') + final int? unreadMessages; + + @override + @JsonKey(name: 'unread_thread_messages') + final int? unreadThreadMessages; + + @override + @JsonKey(name: 'unread_threads') + final int? unreadThreads; + + @override + @JsonKey(name: 'user') + final UserResponseCommonFields? user; + + Map toJson() => _$NotificationMarkUnreadEventToJson(this); + + static NotificationMarkUnreadEvent fromJson(Map json) => _$NotificationMarkUnreadEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/notification_mark_unread_event.freezed.dart b/packages/stream_chat/lib/open_api/model/notification_mark_unread_event.freezed.dart new file mode 100644 index 0000000000..5ac4708ac1 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/notification_mark_unread_event.freezed.dart @@ -0,0 +1,300 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'notification_mark_unread_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$NotificationMarkUnreadEvent { + ChannelResponse? get channel; + Map? get channelCustom; + String? get channelId; + int? get channelMemberCount; + int? get channelMessageCount; + String? get channelType; + String? get cid; + DateTime get createdAt; + Map get custom; + String? get firstUnreadMessageId; + Map? get groupedUnreadChannels; + DateTime? get lastReadAt; + String? get lastReadMessageId; + DateTime? get receivedAt; + String? get team; + String? get threadId; + int? get totalUnreadCount; + String get type; + int? get unreadChannels; + int? get unreadCount; + int? get unreadMessages; + int? get unreadThreadMessages; + int? get unreadThreads; + UserResponseCommonFields? get user; + + /// Create a copy of NotificationMarkUnreadEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $NotificationMarkUnreadEventCopyWith get copyWith => + _$NotificationMarkUnreadEventCopyWithImpl( + this as NotificationMarkUnreadEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is NotificationMarkUnreadEvent && + (identical(other.channel, channel) || other.channel == channel) && + const DeepCollectionEquality().equals( + other.channelCustom, + channelCustom, + ) && + (identical(other.channelId, channelId) || other.channelId == channelId) && + (identical(other.channelMemberCount, channelMemberCount) || + other.channelMemberCount == channelMemberCount) && + (identical(other.channelMessageCount, channelMessageCount) || + other.channelMessageCount == channelMessageCount) && + (identical(other.channelType, channelType) || other.channelType == channelType) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.firstUnreadMessageId, firstUnreadMessageId) || + other.firstUnreadMessageId == firstUnreadMessageId) && + const DeepCollectionEquality().equals( + other.groupedUnreadChannels, + groupedUnreadChannels, + ) && + (identical(other.lastReadAt, lastReadAt) || other.lastReadAt == lastReadAt) && + (identical(other.lastReadMessageId, lastReadMessageId) || other.lastReadMessageId == lastReadMessageId) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.team, team) || other.team == team) && + (identical(other.threadId, threadId) || other.threadId == threadId) && + (identical(other.totalUnreadCount, totalUnreadCount) || other.totalUnreadCount == totalUnreadCount) && + (identical(other.type, type) || other.type == type) && + (identical(other.unreadChannels, unreadChannels) || other.unreadChannels == unreadChannels) && + (identical(other.unreadCount, unreadCount) || other.unreadCount == unreadCount) && + (identical(other.unreadMessages, unreadMessages) || other.unreadMessages == unreadMessages) && + (identical(other.unreadThreadMessages, unreadThreadMessages) || + other.unreadThreadMessages == unreadThreadMessages) && + (identical(other.unreadThreads, unreadThreads) || other.unreadThreads == unreadThreads) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hashAll([ + runtimeType, + channel, + const DeepCollectionEquality().hash(channelCustom), + channelId, + channelMemberCount, + channelMessageCount, + channelType, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + firstUnreadMessageId, + const DeepCollectionEquality().hash(groupedUnreadChannels), + lastReadAt, + lastReadMessageId, + receivedAt, + team, + threadId, + totalUnreadCount, + type, + unreadChannels, + unreadCount, + unreadMessages, + unreadThreadMessages, + unreadThreads, + user, + ]); + + @override + String toString() { + return 'NotificationMarkUnreadEvent(channel: $channel, channelCustom: $channelCustom, channelId: $channelId, channelMemberCount: $channelMemberCount, channelMessageCount: $channelMessageCount, channelType: $channelType, cid: $cid, createdAt: $createdAt, custom: $custom, firstUnreadMessageId: $firstUnreadMessageId, groupedUnreadChannels: $groupedUnreadChannels, lastReadAt: $lastReadAt, lastReadMessageId: $lastReadMessageId, receivedAt: $receivedAt, team: $team, threadId: $threadId, totalUnreadCount: $totalUnreadCount, type: $type, unreadChannels: $unreadChannels, unreadCount: $unreadCount, unreadMessages: $unreadMessages, unreadThreadMessages: $unreadThreadMessages, unreadThreads: $unreadThreads, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $NotificationMarkUnreadEventCopyWith<$Res> { + factory $NotificationMarkUnreadEventCopyWith( + NotificationMarkUnreadEvent value, + $Res Function(NotificationMarkUnreadEvent) _then, + ) = _$NotificationMarkUnreadEventCopyWithImpl; + @useResult + $Res call({ + ChannelResponse? channel, + Map? channelCustom, + String? channelId, + int? channelMemberCount, + int? channelMessageCount, + String? channelType, + String? cid, + DateTime createdAt, + Map custom, + String? firstUnreadMessageId, + Map? groupedUnreadChannels, + DateTime? lastReadAt, + String? lastReadMessageId, + DateTime? receivedAt, + String? team, + String? threadId, + int? totalUnreadCount, + String type, + int? unreadChannels, + int? unreadCount, + int? unreadMessages, + int? unreadThreadMessages, + int? unreadThreads, + UserResponseCommonFields? user, + }); +} + +/// @nodoc +class _$NotificationMarkUnreadEventCopyWithImpl<$Res> implements $NotificationMarkUnreadEventCopyWith<$Res> { + _$NotificationMarkUnreadEventCopyWithImpl(this._self, this._then); + + final NotificationMarkUnreadEvent _self; + final $Res Function(NotificationMarkUnreadEvent) _then; + + /// Create a copy of NotificationMarkUnreadEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channel = freezed, + Object? channelCustom = freezed, + Object? channelId = freezed, + Object? channelMemberCount = freezed, + Object? channelMessageCount = freezed, + Object? channelType = freezed, + Object? cid = freezed, + Object? createdAt = null, + Object? custom = null, + Object? firstUnreadMessageId = freezed, + Object? groupedUnreadChannels = freezed, + Object? lastReadAt = freezed, + Object? lastReadMessageId = freezed, + Object? receivedAt = freezed, + Object? team = freezed, + Object? threadId = freezed, + Object? totalUnreadCount = freezed, + Object? type = null, + Object? unreadChannels = freezed, + Object? unreadCount = freezed, + Object? unreadMessages = freezed, + Object? unreadThreadMessages = freezed, + Object? unreadThreads = freezed, + Object? user = freezed, + }) { + return _then( + NotificationMarkUnreadEvent( + channel: freezed == channel + ? _self.channel + : channel // ignore: cast_nullable_to_non_nullable + as ChannelResponse?, + channelCustom: freezed == channelCustom + ? _self.channelCustom + : channelCustom // ignore: cast_nullable_to_non_nullable + as Map?, + channelId: freezed == channelId + ? _self.channelId + : channelId // ignore: cast_nullable_to_non_nullable + as String?, + channelMemberCount: freezed == channelMemberCount + ? _self.channelMemberCount + : channelMemberCount // ignore: cast_nullable_to_non_nullable + as int?, + channelMessageCount: freezed == channelMessageCount + ? _self.channelMessageCount + : channelMessageCount // ignore: cast_nullable_to_non_nullable + as int?, + channelType: freezed == channelType + ? _self.channelType + : channelType // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + firstUnreadMessageId: freezed == firstUnreadMessageId + ? _self.firstUnreadMessageId + : firstUnreadMessageId // ignore: cast_nullable_to_non_nullable + as String?, + groupedUnreadChannels: freezed == groupedUnreadChannels + ? _self.groupedUnreadChannels + : groupedUnreadChannels // ignore: cast_nullable_to_non_nullable + as Map?, + lastReadAt: freezed == lastReadAt + ? _self.lastReadAt + : lastReadAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + lastReadMessageId: freezed == lastReadMessageId + ? _self.lastReadMessageId + : lastReadMessageId // ignore: cast_nullable_to_non_nullable + as String?, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + team: freezed == team + ? _self.team + : team // ignore: cast_nullable_to_non_nullable + as String?, + threadId: freezed == threadId + ? _self.threadId + : threadId // ignore: cast_nullable_to_non_nullable + as String?, + totalUnreadCount: freezed == totalUnreadCount + ? _self.totalUnreadCount + : totalUnreadCount // ignore: cast_nullable_to_non_nullable + as int?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + unreadChannels: freezed == unreadChannels + ? _self.unreadChannels + : unreadChannels // ignore: cast_nullable_to_non_nullable + as int?, + unreadCount: freezed == unreadCount + ? _self.unreadCount + : unreadCount // ignore: cast_nullable_to_non_nullable + as int?, + unreadMessages: freezed == unreadMessages + ? _self.unreadMessages + : unreadMessages // ignore: cast_nullable_to_non_nullable + as int?, + unreadThreadMessages: freezed == unreadThreadMessages + ? _self.unreadThreadMessages + : unreadThreadMessages // ignore: cast_nullable_to_non_nullable + as int?, + unreadThreads: freezed == unreadThreads + ? _self.unreadThreads + : unreadThreads // ignore: cast_nullable_to_non_nullable + as int?, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponseCommonFields?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/notification_mark_unread_event.g.dart b/packages/stream_chat/lib/open_api/model/notification_mark_unread_event.g.dart new file mode 100644 index 0000000000..54d4fc95aa --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/notification_mark_unread_event.g.dart @@ -0,0 +1,91 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'notification_mark_unread_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +NotificationMarkUnreadEvent _$NotificationMarkUnreadEventFromJson( + Map json, +) => NotificationMarkUnreadEvent( + channel: json['channel'] == null ? null : ChannelResponse.fromJson(json['channel'] as Map), + channelCustom: json['channel_custom'] as Map?, + channelId: json['channel_id'] as String?, + channelMemberCount: (json['channel_member_count'] as num?)?.toInt(), + channelMessageCount: (json['channel_message_count'] as num?)?.toInt(), + channelType: json['channel_type'] as String?, + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + firstUnreadMessageId: json['first_unread_message_id'] as String?, + groupedUnreadChannels: (json['grouped_unread_channels'] as Map?)?.map( + (k, e) => MapEntry(k, (e as num).toInt()), + ), + lastReadAt: _$JsonConverterFromJson( + json['last_read_at'], + const StreamDateTimeConverter().fromJson, + ), + lastReadMessageId: json['last_read_message_id'] as String?, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + team: json['team'] as String?, + threadId: json['thread_id'] as String?, + totalUnreadCount: (json['total_unread_count'] as num?)?.toInt(), + type: json['type'] as String, + unreadChannels: (json['unread_channels'] as num?)?.toInt(), + unreadCount: (json['unread_count'] as num?)?.toInt(), + unreadMessages: (json['unread_messages'] as num?)?.toInt(), + unreadThreadMessages: (json['unread_thread_messages'] as num?)?.toInt(), + unreadThreads: (json['unread_threads'] as num?)?.toInt(), + user: json['user'] == null ? null : UserResponseCommonFields.fromJson(json['user'] as Map), +); + +Map _$NotificationMarkUnreadEventToJson( + NotificationMarkUnreadEvent instance, +) => { + 'channel': instance.channel?.toJson(), + 'channel_custom': instance.channelCustom, + 'channel_id': instance.channelId, + 'channel_member_count': instance.channelMemberCount, + 'channel_message_count': instance.channelMessageCount, + 'channel_type': instance.channelType, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'first_unread_message_id': instance.firstUnreadMessageId, + 'grouped_unread_channels': instance.groupedUnreadChannels, + 'last_read_at': _$JsonConverterToJson( + instance.lastReadAt, + const StreamDateTimeConverter().toJson, + ), + 'last_read_message_id': instance.lastReadMessageId, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'team': instance.team, + 'thread_id': instance.threadId, + 'total_unread_count': instance.totalUnreadCount, + 'type': instance.type, + 'unread_channels': instance.unreadChannels, + 'unread_count': instance.unreadCount, + 'unread_messages': instance.unreadMessages, + 'unread_thread_messages': instance.unreadThreadMessages, + 'unread_threads': instance.unreadThreads, + 'user': instance.user?.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/notification_mutes_updated_event.dart b/packages/stream_chat/lib/open_api/model/notification_mutes_updated_event.dart new file mode 100644 index 0000000000..e914622c6d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/notification_mutes_updated_event.dart @@ -0,0 +1,54 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'notification_mutes_updated_event.g.dart'; +part 'notification_mutes_updated_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class NotificationMutesUpdatedEvent extends core.WsEvent with _$NotificationMutesUpdatedEvent { + const NotificationMutesUpdatedEvent({ + required this.createdAt, + required this.custom, + required this.me, + this.receivedAt, + required this.type, + }); + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'me') + final OwnUserResponse me; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'type') + final String type; + + Map toJson() => _$NotificationMutesUpdatedEventToJson(this); + + static NotificationMutesUpdatedEvent fromJson(Map json) => + _$NotificationMutesUpdatedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/notification_mutes_updated_event.freezed.dart b/packages/stream_chat/lib/open_api/model/notification_mutes_updated_event.freezed.dart new file mode 100644 index 0000000000..d588e0b23c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/notification_mutes_updated_event.freezed.dart @@ -0,0 +1,119 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'notification_mutes_updated_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$NotificationMutesUpdatedEvent { + DateTime get createdAt; + Map get custom; + OwnUserResponse get me; + DateTime? get receivedAt; + String get type; + + /// Create a copy of NotificationMutesUpdatedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $NotificationMutesUpdatedEventCopyWith get copyWith => + _$NotificationMutesUpdatedEventCopyWithImpl( + this as NotificationMutesUpdatedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is NotificationMutesUpdatedEvent && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.me, me) || other.me == me) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.type, type) || other.type == type)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + createdAt, + const DeepCollectionEquality().hash(custom), + me, + receivedAt, + type, + ); + + @override + String toString() { + return 'NotificationMutesUpdatedEvent(createdAt: $createdAt, custom: $custom, me: $me, receivedAt: $receivedAt, type: $type)'; + } +} + +/// @nodoc +abstract mixin class $NotificationMutesUpdatedEventCopyWith<$Res> { + factory $NotificationMutesUpdatedEventCopyWith( + NotificationMutesUpdatedEvent value, + $Res Function(NotificationMutesUpdatedEvent) _then, + ) = _$NotificationMutesUpdatedEventCopyWithImpl; + @useResult + $Res call({ + DateTime createdAt, + Map custom, + OwnUserResponse me, + DateTime? receivedAt, + String type, + }); +} + +/// @nodoc +class _$NotificationMutesUpdatedEventCopyWithImpl<$Res> implements $NotificationMutesUpdatedEventCopyWith<$Res> { + _$NotificationMutesUpdatedEventCopyWithImpl(this._self, this._then); + + final NotificationMutesUpdatedEvent _self; + final $Res Function(NotificationMutesUpdatedEvent) _then; + + /// Create a copy of NotificationMutesUpdatedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? createdAt = null, + Object? custom = null, + Object? me = null, + Object? receivedAt = freezed, + Object? type = null, + }) { + return _then( + NotificationMutesUpdatedEvent( + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + me: null == me + ? _self.me + : me // ignore: cast_nullable_to_non_nullable + as OwnUserResponse, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/notification_mutes_updated_event.g.dart b/packages/stream_chat/lib/open_api/model/notification_mutes_updated_event.g.dart new file mode 100644 index 0000000000..551f3e916d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/notification_mutes_updated_event.g.dart @@ -0,0 +1,45 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'notification_mutes_updated_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +NotificationMutesUpdatedEvent _$NotificationMutesUpdatedEventFromJson( + Map json, +) => NotificationMutesUpdatedEvent( + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + me: OwnUserResponse.fromJson(json['me'] as Map), + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + type: json['type'] as String, +); + +Map _$NotificationMutesUpdatedEventToJson( + NotificationMutesUpdatedEvent instance, +) => { + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'me': instance.me.toJson(), + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'type': instance.type, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/notification_new_message_event.dart b/packages/stream_chat/lib/open_api/model/notification_new_message_event.dart new file mode 100644 index 0000000000..6fc9fad4fe --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/notification_new_message_event.dart @@ -0,0 +1,133 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'notification_new_message_event.g.dart'; +part 'notification_new_message_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class NotificationNewMessageEvent extends core.WsEvent with _$NotificationNewMessageEvent { + const NotificationNewMessageEvent({ + required this.channel, + this.channelCustom, + this.channelId, + this.channelMemberCount, + this.channelMessageCount, + this.channelType, + this.cid, + required this.createdAt, + required this.custom, + this.groupedUnreadChannels, + required this.message, + required this.messageId, + this.parentAuthor, + this.receivedAt, + this.team, + this.threadParticipants, + this.totalUnreadCount, + required this.type, + this.unreadChannels, + this.unreadCount, + required this.watcherCount, + }); + + @override + @JsonKey(name: 'channel') + final ChannelResponse channel; + + @override + @JsonKey(name: 'channel_custom') + final Map? channelCustom; + + @override + @JsonKey(name: 'channel_id') + final String? channelId; + + @override + @JsonKey(name: 'channel_member_count') + final int? channelMemberCount; + + @override + @JsonKey(name: 'channel_message_count') + final int? channelMessageCount; + + @override + @JsonKey(name: 'channel_type') + final String? channelType; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'grouped_unread_channels') + final Map? groupedUnreadChannels; + + @override + @JsonKey(name: 'message') + final MessageResponse message; + + @override + @JsonKey(name: 'message_id') + final String messageId; + + @override + @JsonKey(name: 'parent_author') + final String? parentAuthor; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'team') + final String? team; + + @override + @JsonKey(name: 'thread_participants') + final List? threadParticipants; + + @override + @JsonKey(name: 'total_unread_count') + final int? totalUnreadCount; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'unread_channels') + final int? unreadChannels; + + @override + @JsonKey(name: 'unread_count') + final int? unreadCount; + + @override + @JsonKey(name: 'watcher_count') + final int watcherCount; + + Map toJson() => _$NotificationNewMessageEventToJson(this); + + static NotificationNewMessageEvent fromJson(Map json) => _$NotificationNewMessageEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/notification_new_message_event.freezed.dart b/packages/stream_chat/lib/open_api/model/notification_new_message_event.freezed.dart new file mode 100644 index 0000000000..a972855305 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/notification_new_message_event.freezed.dart @@ -0,0 +1,274 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'notification_new_message_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$NotificationNewMessageEvent { + ChannelResponse get channel; + Map? get channelCustom; + String? get channelId; + int? get channelMemberCount; + int? get channelMessageCount; + String? get channelType; + String? get cid; + DateTime get createdAt; + Map get custom; + Map? get groupedUnreadChannels; + MessageResponse get message; + String get messageId; + String? get parentAuthor; + DateTime? get receivedAt; + String? get team; + List? get threadParticipants; + int? get totalUnreadCount; + String get type; + int? get unreadChannels; + int? get unreadCount; + int get watcherCount; + + /// Create a copy of NotificationNewMessageEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $NotificationNewMessageEventCopyWith get copyWith => + _$NotificationNewMessageEventCopyWithImpl( + this as NotificationNewMessageEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is NotificationNewMessageEvent && + (identical(other.channel, channel) || other.channel == channel) && + const DeepCollectionEquality().equals( + other.channelCustom, + channelCustom, + ) && + (identical(other.channelId, channelId) || other.channelId == channelId) && + (identical(other.channelMemberCount, channelMemberCount) || + other.channelMemberCount == channelMemberCount) && + (identical(other.channelMessageCount, channelMessageCount) || + other.channelMessageCount == channelMessageCount) && + (identical(other.channelType, channelType) || other.channelType == channelType) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + const DeepCollectionEquality().equals( + other.groupedUnreadChannels, + groupedUnreadChannels, + ) && + (identical(other.message, message) || other.message == message) && + (identical(other.messageId, messageId) || other.messageId == messageId) && + (identical(other.parentAuthor, parentAuthor) || other.parentAuthor == parentAuthor) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.team, team) || other.team == team) && + const DeepCollectionEquality().equals( + other.threadParticipants, + threadParticipants, + ) && + (identical(other.totalUnreadCount, totalUnreadCount) || other.totalUnreadCount == totalUnreadCount) && + (identical(other.type, type) || other.type == type) && + (identical(other.unreadChannels, unreadChannels) || other.unreadChannels == unreadChannels) && + (identical(other.unreadCount, unreadCount) || other.unreadCount == unreadCount) && + (identical(other.watcherCount, watcherCount) || other.watcherCount == watcherCount)); + } + + @override + int get hashCode => Object.hashAll([ + runtimeType, + channel, + const DeepCollectionEquality().hash(channelCustom), + channelId, + channelMemberCount, + channelMessageCount, + channelType, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + const DeepCollectionEquality().hash(groupedUnreadChannels), + message, + messageId, + parentAuthor, + receivedAt, + team, + const DeepCollectionEquality().hash(threadParticipants), + totalUnreadCount, + type, + unreadChannels, + unreadCount, + watcherCount, + ]); + + @override + String toString() { + return 'NotificationNewMessageEvent(channel: $channel, channelCustom: $channelCustom, channelId: $channelId, channelMemberCount: $channelMemberCount, channelMessageCount: $channelMessageCount, channelType: $channelType, cid: $cid, createdAt: $createdAt, custom: $custom, groupedUnreadChannels: $groupedUnreadChannels, message: $message, messageId: $messageId, parentAuthor: $parentAuthor, receivedAt: $receivedAt, team: $team, threadParticipants: $threadParticipants, totalUnreadCount: $totalUnreadCount, type: $type, unreadChannels: $unreadChannels, unreadCount: $unreadCount, watcherCount: $watcherCount)'; + } +} + +/// @nodoc +abstract mixin class $NotificationNewMessageEventCopyWith<$Res> { + factory $NotificationNewMessageEventCopyWith( + NotificationNewMessageEvent value, + $Res Function(NotificationNewMessageEvent) _then, + ) = _$NotificationNewMessageEventCopyWithImpl; + @useResult + $Res call({ + ChannelResponse channel, + Map? channelCustom, + String? channelId, + int? channelMemberCount, + int? channelMessageCount, + String? channelType, + String? cid, + DateTime createdAt, + Map custom, + Map? groupedUnreadChannels, + MessageResponse message, + String messageId, + String? parentAuthor, + DateTime? receivedAt, + String? team, + List? threadParticipants, + int? totalUnreadCount, + String type, + int? unreadChannels, + int? unreadCount, + int watcherCount, + }); +} + +/// @nodoc +class _$NotificationNewMessageEventCopyWithImpl<$Res> implements $NotificationNewMessageEventCopyWith<$Res> { + _$NotificationNewMessageEventCopyWithImpl(this._self, this._then); + + final NotificationNewMessageEvent _self; + final $Res Function(NotificationNewMessageEvent) _then; + + /// Create a copy of NotificationNewMessageEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channel = null, + Object? channelCustom = freezed, + Object? channelId = freezed, + Object? channelMemberCount = freezed, + Object? channelMessageCount = freezed, + Object? channelType = freezed, + Object? cid = freezed, + Object? createdAt = null, + Object? custom = null, + Object? groupedUnreadChannels = freezed, + Object? message = null, + Object? messageId = null, + Object? parentAuthor = freezed, + Object? receivedAt = freezed, + Object? team = freezed, + Object? threadParticipants = freezed, + Object? totalUnreadCount = freezed, + Object? type = null, + Object? unreadChannels = freezed, + Object? unreadCount = freezed, + Object? watcherCount = null, + }) { + return _then( + NotificationNewMessageEvent( + channel: null == channel + ? _self.channel + : channel // ignore: cast_nullable_to_non_nullable + as ChannelResponse, + channelCustom: freezed == channelCustom + ? _self.channelCustom + : channelCustom // ignore: cast_nullable_to_non_nullable + as Map?, + channelId: freezed == channelId + ? _self.channelId + : channelId // ignore: cast_nullable_to_non_nullable + as String?, + channelMemberCount: freezed == channelMemberCount + ? _self.channelMemberCount + : channelMemberCount // ignore: cast_nullable_to_non_nullable + as int?, + channelMessageCount: freezed == channelMessageCount + ? _self.channelMessageCount + : channelMessageCount // ignore: cast_nullable_to_non_nullable + as int?, + channelType: freezed == channelType + ? _self.channelType + : channelType // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + groupedUnreadChannels: freezed == groupedUnreadChannels + ? _self.groupedUnreadChannels + : groupedUnreadChannels // ignore: cast_nullable_to_non_nullable + as Map?, + message: null == message + ? _self.message + : message // ignore: cast_nullable_to_non_nullable + as MessageResponse, + messageId: null == messageId + ? _self.messageId + : messageId // ignore: cast_nullable_to_non_nullable + as String, + parentAuthor: freezed == parentAuthor + ? _self.parentAuthor + : parentAuthor // ignore: cast_nullable_to_non_nullable + as String?, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + team: freezed == team + ? _self.team + : team // ignore: cast_nullable_to_non_nullable + as String?, + threadParticipants: freezed == threadParticipants + ? _self.threadParticipants + : threadParticipants // ignore: cast_nullable_to_non_nullable + as List?, + totalUnreadCount: freezed == totalUnreadCount + ? _self.totalUnreadCount + : totalUnreadCount // ignore: cast_nullable_to_non_nullable + as int?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + unreadChannels: freezed == unreadChannels + ? _self.unreadChannels + : unreadChannels // ignore: cast_nullable_to_non_nullable + as int?, + unreadCount: freezed == unreadCount + ? _self.unreadCount + : unreadCount // ignore: cast_nullable_to_non_nullable + as int?, + watcherCount: null == watcherCount + ? _self.watcherCount + : watcherCount // ignore: cast_nullable_to_non_nullable + as int, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/notification_new_message_event.g.dart b/packages/stream_chat/lib/open_api/model/notification_new_message_event.g.dart new file mode 100644 index 0000000000..0a33a8e582 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/notification_new_message_event.g.dart @@ -0,0 +1,81 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'notification_new_message_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +NotificationNewMessageEvent _$NotificationNewMessageEventFromJson( + Map json, +) => NotificationNewMessageEvent( + channel: ChannelResponse.fromJson(json['channel'] as Map), + channelCustom: json['channel_custom'] as Map?, + channelId: json['channel_id'] as String?, + channelMemberCount: (json['channel_member_count'] as num?)?.toInt(), + channelMessageCount: (json['channel_message_count'] as num?)?.toInt(), + channelType: json['channel_type'] as String?, + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + groupedUnreadChannels: (json['grouped_unread_channels'] as Map?)?.map( + (k, e) => MapEntry(k, (e as num).toInt()), + ), + message: MessageResponse.fromJson(json['message'] as Map), + messageId: json['message_id'] as String, + parentAuthor: json['parent_author'] as String?, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + team: json['team'] as String?, + threadParticipants: (json['thread_participants'] as List?) + ?.map((e) => UserResponseCommonFields.fromJson(e as Map)) + .toList(), + totalUnreadCount: (json['total_unread_count'] as num?)?.toInt(), + type: json['type'] as String, + unreadChannels: (json['unread_channels'] as num?)?.toInt(), + unreadCount: (json['unread_count'] as num?)?.toInt(), + watcherCount: (json['watcher_count'] as num).toInt(), +); + +Map _$NotificationNewMessageEventToJson( + NotificationNewMessageEvent instance, +) => { + 'channel': instance.channel.toJson(), + 'channel_custom': instance.channelCustom, + 'channel_id': instance.channelId, + 'channel_member_count': instance.channelMemberCount, + 'channel_message_count': instance.channelMessageCount, + 'channel_type': instance.channelType, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'grouped_unread_channels': instance.groupedUnreadChannels, + 'message': instance.message.toJson(), + 'message_id': instance.messageId, + 'parent_author': instance.parentAuthor, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'team': instance.team, + 'thread_participants': instance.threadParticipants?.map((e) => e.toJson()).toList(), + 'total_unread_count': instance.totalUnreadCount, + 'type': instance.type, + 'unread_channels': instance.unreadChannels, + 'unread_count': instance.unreadCount, + 'watcher_count': instance.watcherCount, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/notification_removed_from_channel_event.dart b/packages/stream_chat/lib/open_api/model/notification_removed_from_channel_event.dart new file mode 100644 index 0000000000..23ef78b09c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/notification_removed_from_channel_event.dart @@ -0,0 +1,99 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'notification_removed_from_channel_event.g.dart'; +part 'notification_removed_from_channel_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class NotificationRemovedFromChannelEvent extends core.WsEvent with _$NotificationRemovedFromChannelEvent { + const NotificationRemovedFromChannelEvent({ + required this.channel, + this.channelCustom, + this.channelId, + this.channelMemberCount, + this.channelMessageCount, + this.channelType, + this.cid, + required this.createdAt, + required this.custom, + required this.member, + this.receivedAt, + this.team, + required this.type, + this.user, + }); + + @override + @JsonKey(name: 'channel') + final ChannelResponse channel; + + @override + @JsonKey(name: 'channel_custom') + final Map? channelCustom; + + @override + @JsonKey(name: 'channel_id') + final String? channelId; + + @override + @JsonKey(name: 'channel_member_count') + final int? channelMemberCount; + + @override + @JsonKey(name: 'channel_message_count') + final int? channelMessageCount; + + @override + @JsonKey(name: 'channel_type') + final String? channelType; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'member') + final ChannelMemberResponse member; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'team') + final String? team; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'user') + final UserResponseCommonFields? user; + + Map toJson() => _$NotificationRemovedFromChannelEventToJson(this); + + static NotificationRemovedFromChannelEvent fromJson(Map json) => + _$NotificationRemovedFromChannelEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/notification_removed_from_channel_event.freezed.dart b/packages/stream_chat/lib/open_api/model/notification_removed_from_channel_event.freezed.dart new file mode 100644 index 0000000000..6a80d80db5 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/notification_removed_from_channel_event.freezed.dart @@ -0,0 +1,206 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'notification_removed_from_channel_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$NotificationRemovedFromChannelEvent { + ChannelResponse get channel; + Map? get channelCustom; + String? get channelId; + int? get channelMemberCount; + int? get channelMessageCount; + String? get channelType; + String? get cid; + DateTime get createdAt; + Map get custom; + ChannelMemberResponse get member; + DateTime? get receivedAt; + String? get team; + String get type; + UserResponseCommonFields? get user; + + /// Create a copy of NotificationRemovedFromChannelEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $NotificationRemovedFromChannelEventCopyWith get copyWith => + _$NotificationRemovedFromChannelEventCopyWithImpl( + this as NotificationRemovedFromChannelEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is NotificationRemovedFromChannelEvent && + (identical(other.channel, channel) || other.channel == channel) && + const DeepCollectionEquality().equals( + other.channelCustom, + channelCustom, + ) && + (identical(other.channelId, channelId) || other.channelId == channelId) && + (identical(other.channelMemberCount, channelMemberCount) || + other.channelMemberCount == channelMemberCount) && + (identical(other.channelMessageCount, channelMessageCount) || + other.channelMessageCount == channelMessageCount) && + (identical(other.channelType, channelType) || other.channelType == channelType) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.member, member) || other.member == member) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.team, team) || other.team == team) && + (identical(other.type, type) || other.type == type) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channel, + const DeepCollectionEquality().hash(channelCustom), + channelId, + channelMemberCount, + channelMessageCount, + channelType, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + member, + receivedAt, + team, + type, + user, + ); + + @override + String toString() { + return 'NotificationRemovedFromChannelEvent(channel: $channel, channelCustom: $channelCustom, channelId: $channelId, channelMemberCount: $channelMemberCount, channelMessageCount: $channelMessageCount, channelType: $channelType, cid: $cid, createdAt: $createdAt, custom: $custom, member: $member, receivedAt: $receivedAt, team: $team, type: $type, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $NotificationRemovedFromChannelEventCopyWith<$Res> { + factory $NotificationRemovedFromChannelEventCopyWith( + NotificationRemovedFromChannelEvent value, + $Res Function(NotificationRemovedFromChannelEvent) _then, + ) = _$NotificationRemovedFromChannelEventCopyWithImpl; + @useResult + $Res call({ + ChannelResponse channel, + Map? channelCustom, + String? channelId, + int? channelMemberCount, + int? channelMessageCount, + String? channelType, + String? cid, + DateTime createdAt, + Map custom, + ChannelMemberResponse member, + DateTime? receivedAt, + String? team, + String type, + UserResponseCommonFields? user, + }); +} + +/// @nodoc +class _$NotificationRemovedFromChannelEventCopyWithImpl<$Res> + implements $NotificationRemovedFromChannelEventCopyWith<$Res> { + _$NotificationRemovedFromChannelEventCopyWithImpl(this._self, this._then); + + final NotificationRemovedFromChannelEvent _self; + final $Res Function(NotificationRemovedFromChannelEvent) _then; + + /// Create a copy of NotificationRemovedFromChannelEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channel = null, + Object? channelCustom = freezed, + Object? channelId = freezed, + Object? channelMemberCount = freezed, + Object? channelMessageCount = freezed, + Object? channelType = freezed, + Object? cid = freezed, + Object? createdAt = null, + Object? custom = null, + Object? member = null, + Object? receivedAt = freezed, + Object? team = freezed, + Object? type = null, + Object? user = freezed, + }) { + return _then( + NotificationRemovedFromChannelEvent( + channel: null == channel + ? _self.channel + : channel // ignore: cast_nullable_to_non_nullable + as ChannelResponse, + channelCustom: freezed == channelCustom + ? _self.channelCustom + : channelCustom // ignore: cast_nullable_to_non_nullable + as Map?, + channelId: freezed == channelId + ? _self.channelId + : channelId // ignore: cast_nullable_to_non_nullable + as String?, + channelMemberCount: freezed == channelMemberCount + ? _self.channelMemberCount + : channelMemberCount // ignore: cast_nullable_to_non_nullable + as int?, + channelMessageCount: freezed == channelMessageCount + ? _self.channelMessageCount + : channelMessageCount // ignore: cast_nullable_to_non_nullable + as int?, + channelType: freezed == channelType + ? _self.channelType + : channelType // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + member: null == member + ? _self.member + : member // ignore: cast_nullable_to_non_nullable + as ChannelMemberResponse, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + team: freezed == team + ? _self.team + : team // ignore: cast_nullable_to_non_nullable + as String?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponseCommonFields?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/notification_removed_from_channel_event.g.dart b/packages/stream_chat/lib/open_api/model/notification_removed_from_channel_event.g.dart new file mode 100644 index 0000000000..d30d6df226 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/notification_removed_from_channel_event.g.dart @@ -0,0 +1,65 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'notification_removed_from_channel_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +NotificationRemovedFromChannelEvent _$NotificationRemovedFromChannelEventFromJson( + Map json, +) => NotificationRemovedFromChannelEvent( + channel: ChannelResponse.fromJson(json['channel'] as Map), + channelCustom: json['channel_custom'] as Map?, + channelId: json['channel_id'] as String?, + channelMemberCount: (json['channel_member_count'] as num?)?.toInt(), + channelMessageCount: (json['channel_message_count'] as num?)?.toInt(), + channelType: json['channel_type'] as String?, + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + member: ChannelMemberResponse.fromJson( + json['member'] as Map, + ), + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + team: json['team'] as String?, + type: json['type'] as String, + user: json['user'] == null ? null : UserResponseCommonFields.fromJson(json['user'] as Map), +); + +Map _$NotificationRemovedFromChannelEventToJson( + NotificationRemovedFromChannelEvent instance, +) => { + 'channel': instance.channel.toJson(), + 'channel_custom': instance.channelCustom, + 'channel_id': instance.channelId, + 'channel_member_count': instance.channelMemberCount, + 'channel_message_count': instance.channelMessageCount, + 'channel_type': instance.channelType, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'member': instance.member.toJson(), + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'team': instance.team, + 'type': instance.type, + 'user': instance.user?.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/notification_thread_message_new_event.dart b/packages/stream_chat/lib/open_api/model/notification_thread_message_new_event.dart new file mode 100644 index 0000000000..3702a4e258 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/notification_thread_message_new_event.dart @@ -0,0 +1,129 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'notification_thread_message_new_event.g.dart'; +part 'notification_thread_message_new_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class NotificationThreadMessageNewEvent extends core.WsEvent with _$NotificationThreadMessageNewEvent { + const NotificationThreadMessageNewEvent({ + required this.channel, + this.channelCustom, + this.channelId, + this.channelMemberCount, + this.channelMessageCount, + this.channelType, + this.cid, + required this.createdAt, + required this.custom, + required this.message, + required this.messageId, + this.parentAuthor, + this.receivedAt, + this.team, + required this.threadId, + this.threadParticipants, + required this.type, + this.unreadThreadMessages, + this.unreadThreads, + required this.watcherCount, + }); + + @override + @JsonKey(name: 'channel') + final ChannelResponse channel; + + @override + @JsonKey(name: 'channel_custom') + final Map? channelCustom; + + @override + @JsonKey(name: 'channel_id') + final String? channelId; + + @override + @JsonKey(name: 'channel_member_count') + final int? channelMemberCount; + + @override + @JsonKey(name: 'channel_message_count') + final int? channelMessageCount; + + @override + @JsonKey(name: 'channel_type') + final String? channelType; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'message') + final MessageResponse message; + + @override + @JsonKey(name: 'message_id') + final String messageId; + + @override + @JsonKey(name: 'parent_author') + final String? parentAuthor; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'team') + final String? team; + + @override + @JsonKey(name: 'thread_id') + final String threadId; + + @override + @JsonKey(name: 'thread_participants') + final List? threadParticipants; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'unread_thread_messages') + final int? unreadThreadMessages; + + @override + @JsonKey(name: 'unread_threads') + final int? unreadThreads; + + @override + @JsonKey(name: 'watcher_count') + final int watcherCount; + + Map toJson() => _$NotificationThreadMessageNewEventToJson(this); + + static NotificationThreadMessageNewEvent fromJson(Map json) => + _$NotificationThreadMessageNewEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/notification_thread_message_new_event.freezed.dart b/packages/stream_chat/lib/open_api/model/notification_thread_message_new_event.freezed.dart new file mode 100644 index 0000000000..ce15269153 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/notification_thread_message_new_event.freezed.dart @@ -0,0 +1,264 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'notification_thread_message_new_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$NotificationThreadMessageNewEvent { + ChannelResponse get channel; + Map? get channelCustom; + String? get channelId; + int? get channelMemberCount; + int? get channelMessageCount; + String? get channelType; + String? get cid; + DateTime get createdAt; + Map get custom; + MessageResponse get message; + String get messageId; + String? get parentAuthor; + DateTime? get receivedAt; + String? get team; + String get threadId; + List? get threadParticipants; + String get type; + int? get unreadThreadMessages; + int? get unreadThreads; + int get watcherCount; + + /// Create a copy of NotificationThreadMessageNewEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $NotificationThreadMessageNewEventCopyWith get copyWith => + _$NotificationThreadMessageNewEventCopyWithImpl( + this as NotificationThreadMessageNewEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is NotificationThreadMessageNewEvent && + (identical(other.channel, channel) || other.channel == channel) && + const DeepCollectionEquality().equals( + other.channelCustom, + channelCustom, + ) && + (identical(other.channelId, channelId) || other.channelId == channelId) && + (identical(other.channelMemberCount, channelMemberCount) || + other.channelMemberCount == channelMemberCount) && + (identical(other.channelMessageCount, channelMessageCount) || + other.channelMessageCount == channelMessageCount) && + (identical(other.channelType, channelType) || other.channelType == channelType) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.message, message) || other.message == message) && + (identical(other.messageId, messageId) || other.messageId == messageId) && + (identical(other.parentAuthor, parentAuthor) || other.parentAuthor == parentAuthor) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.team, team) || other.team == team) && + (identical(other.threadId, threadId) || other.threadId == threadId) && + const DeepCollectionEquality().equals( + other.threadParticipants, + threadParticipants, + ) && + (identical(other.type, type) || other.type == type) && + (identical(other.unreadThreadMessages, unreadThreadMessages) || + other.unreadThreadMessages == unreadThreadMessages) && + (identical(other.unreadThreads, unreadThreads) || other.unreadThreads == unreadThreads) && + (identical(other.watcherCount, watcherCount) || other.watcherCount == watcherCount)); + } + + @override + int get hashCode => Object.hashAll([ + runtimeType, + channel, + const DeepCollectionEquality().hash(channelCustom), + channelId, + channelMemberCount, + channelMessageCount, + channelType, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + message, + messageId, + parentAuthor, + receivedAt, + team, + threadId, + const DeepCollectionEquality().hash(threadParticipants), + type, + unreadThreadMessages, + unreadThreads, + watcherCount, + ]); + + @override + String toString() { + return 'NotificationThreadMessageNewEvent(channel: $channel, channelCustom: $channelCustom, channelId: $channelId, channelMemberCount: $channelMemberCount, channelMessageCount: $channelMessageCount, channelType: $channelType, cid: $cid, createdAt: $createdAt, custom: $custom, message: $message, messageId: $messageId, parentAuthor: $parentAuthor, receivedAt: $receivedAt, team: $team, threadId: $threadId, threadParticipants: $threadParticipants, type: $type, unreadThreadMessages: $unreadThreadMessages, unreadThreads: $unreadThreads, watcherCount: $watcherCount)'; + } +} + +/// @nodoc +abstract mixin class $NotificationThreadMessageNewEventCopyWith<$Res> { + factory $NotificationThreadMessageNewEventCopyWith( + NotificationThreadMessageNewEvent value, + $Res Function(NotificationThreadMessageNewEvent) _then, + ) = _$NotificationThreadMessageNewEventCopyWithImpl; + @useResult + $Res call({ + ChannelResponse channel, + Map? channelCustom, + String? channelId, + int? channelMemberCount, + int? channelMessageCount, + String? channelType, + String? cid, + DateTime createdAt, + Map custom, + MessageResponse message, + String messageId, + String? parentAuthor, + DateTime? receivedAt, + String? team, + String threadId, + List? threadParticipants, + String type, + int? unreadThreadMessages, + int? unreadThreads, + int watcherCount, + }); +} + +/// @nodoc +class _$NotificationThreadMessageNewEventCopyWithImpl<$Res> + implements $NotificationThreadMessageNewEventCopyWith<$Res> { + _$NotificationThreadMessageNewEventCopyWithImpl(this._self, this._then); + + final NotificationThreadMessageNewEvent _self; + final $Res Function(NotificationThreadMessageNewEvent) _then; + + /// Create a copy of NotificationThreadMessageNewEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channel = null, + Object? channelCustom = freezed, + Object? channelId = freezed, + Object? channelMemberCount = freezed, + Object? channelMessageCount = freezed, + Object? channelType = freezed, + Object? cid = freezed, + Object? createdAt = null, + Object? custom = null, + Object? message = null, + Object? messageId = null, + Object? parentAuthor = freezed, + Object? receivedAt = freezed, + Object? team = freezed, + Object? threadId = null, + Object? threadParticipants = freezed, + Object? type = null, + Object? unreadThreadMessages = freezed, + Object? unreadThreads = freezed, + Object? watcherCount = null, + }) { + return _then( + NotificationThreadMessageNewEvent( + channel: null == channel + ? _self.channel + : channel // ignore: cast_nullable_to_non_nullable + as ChannelResponse, + channelCustom: freezed == channelCustom + ? _self.channelCustom + : channelCustom // ignore: cast_nullable_to_non_nullable + as Map?, + channelId: freezed == channelId + ? _self.channelId + : channelId // ignore: cast_nullable_to_non_nullable + as String?, + channelMemberCount: freezed == channelMemberCount + ? _self.channelMemberCount + : channelMemberCount // ignore: cast_nullable_to_non_nullable + as int?, + channelMessageCount: freezed == channelMessageCount + ? _self.channelMessageCount + : channelMessageCount // ignore: cast_nullable_to_non_nullable + as int?, + channelType: freezed == channelType + ? _self.channelType + : channelType // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + message: null == message + ? _self.message + : message // ignore: cast_nullable_to_non_nullable + as MessageResponse, + messageId: null == messageId + ? _self.messageId + : messageId // ignore: cast_nullable_to_non_nullable + as String, + parentAuthor: freezed == parentAuthor + ? _self.parentAuthor + : parentAuthor // ignore: cast_nullable_to_non_nullable + as String?, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + team: freezed == team + ? _self.team + : team // ignore: cast_nullable_to_non_nullable + as String?, + threadId: null == threadId + ? _self.threadId + : threadId // ignore: cast_nullable_to_non_nullable + as String, + threadParticipants: freezed == threadParticipants + ? _self.threadParticipants + : threadParticipants // ignore: cast_nullable_to_non_nullable + as List?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + unreadThreadMessages: freezed == unreadThreadMessages + ? _self.unreadThreadMessages + : unreadThreadMessages // ignore: cast_nullable_to_non_nullable + as int?, + unreadThreads: freezed == unreadThreads + ? _self.unreadThreads + : unreadThreads // ignore: cast_nullable_to_non_nullable + as int?, + watcherCount: null == watcherCount + ? _self.watcherCount + : watcherCount // ignore: cast_nullable_to_non_nullable + as int, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/notification_thread_message_new_event.g.dart b/packages/stream_chat/lib/open_api/model/notification_thread_message_new_event.g.dart new file mode 100644 index 0000000000..c7075ce084 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/notification_thread_message_new_event.g.dart @@ -0,0 +1,77 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'notification_thread_message_new_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +NotificationThreadMessageNewEvent _$NotificationThreadMessageNewEventFromJson( + Map json, +) => NotificationThreadMessageNewEvent( + channel: ChannelResponse.fromJson(json['channel'] as Map), + channelCustom: json['channel_custom'] as Map?, + channelId: json['channel_id'] as String?, + channelMemberCount: (json['channel_member_count'] as num?)?.toInt(), + channelMessageCount: (json['channel_message_count'] as num?)?.toInt(), + channelType: json['channel_type'] as String?, + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + message: MessageResponse.fromJson(json['message'] as Map), + messageId: json['message_id'] as String, + parentAuthor: json['parent_author'] as String?, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + team: json['team'] as String?, + threadId: json['thread_id'] as String, + threadParticipants: (json['thread_participants'] as List?) + ?.map((e) => UserResponseCommonFields.fromJson(e as Map)) + .toList(), + type: json['type'] as String, + unreadThreadMessages: (json['unread_thread_messages'] as num?)?.toInt(), + unreadThreads: (json['unread_threads'] as num?)?.toInt(), + watcherCount: (json['watcher_count'] as num).toInt(), +); + +Map _$NotificationThreadMessageNewEventToJson( + NotificationThreadMessageNewEvent instance, +) => { + 'channel': instance.channel.toJson(), + 'channel_custom': instance.channelCustom, + 'channel_id': instance.channelId, + 'channel_member_count': instance.channelMemberCount, + 'channel_message_count': instance.channelMessageCount, + 'channel_type': instance.channelType, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'message': instance.message.toJson(), + 'message_id': instance.messageId, + 'parent_author': instance.parentAuthor, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'team': instance.team, + 'thread_id': instance.threadId, + 'thread_participants': instance.threadParticipants?.map((e) => e.toJson()).toList(), + 'type': instance.type, + 'unread_thread_messages': instance.unreadThreadMessages, + 'unread_threads': instance.unreadThreads, + 'watcher_count': instance.watcherCount, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/ocr_content_parameters.dart b/packages/stream_chat/lib/open_api/model/ocr_content_parameters.dart new file mode 100644 index 0000000000..07838b3b21 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ocr_content_parameters.dart @@ -0,0 +1,41 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'ocr_content_parameters.g.dart'; +part 'ocr_content_parameters.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class OCRContentParameters with _$OCRContentParameters { + const OCRContentParameters({ + this.harmLabels, + this.labelOperator, + this.severity, + }); + + @override + @JsonKey(name: 'harm_labels') + final List? harmLabels; + + @override + @JsonKey(name: 'label_operator') + final String? labelOperator; + + @override + @JsonKey(name: 'severity') + final String? severity; + + Map toJson() => _$OCRContentParametersToJson(this); + + static OCRContentParameters fromJson(Map json) => _$OCRContentParametersFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/ocr_content_parameters.freezed.dart b/packages/stream_chat/lib/open_api/model/ocr_content_parameters.freezed.dart new file mode 100644 index 0000000000..e490f8fb37 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ocr_content_parameters.freezed.dart @@ -0,0 +1,104 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'ocr_content_parameters.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$OCRContentParameters { + List? get harmLabels; + String? get labelOperator; + String? get severity; + + /// Create a copy of OCRContentParameters + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $OCRContentParametersCopyWith get copyWith => + _$OCRContentParametersCopyWithImpl( + this as OCRContentParameters, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is OCRContentParameters && + const DeepCollectionEquality().equals( + other.harmLabels, + harmLabels, + ) && + (identical(other.labelOperator, labelOperator) || other.labelOperator == labelOperator) && + (identical(other.severity, severity) || other.severity == severity)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(harmLabels), + labelOperator, + severity, + ); + + @override + String toString() { + return 'OCRContentParameters(harmLabels: $harmLabels, labelOperator: $labelOperator, severity: $severity)'; + } +} + +/// @nodoc +abstract mixin class $OCRContentParametersCopyWith<$Res> { + factory $OCRContentParametersCopyWith( + OCRContentParameters value, + $Res Function(OCRContentParameters) _then, + ) = _$OCRContentParametersCopyWithImpl; + @useResult + $Res call({ + List? harmLabels, + String? labelOperator, + String? severity, + }); +} + +/// @nodoc +class _$OCRContentParametersCopyWithImpl<$Res> implements $OCRContentParametersCopyWith<$Res> { + _$OCRContentParametersCopyWithImpl(this._self, this._then); + + final OCRContentParameters _self; + final $Res Function(OCRContentParameters) _then; + + /// Create a copy of OCRContentParameters + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? harmLabels = freezed, + Object? labelOperator = freezed, + Object? severity = freezed, + }) { + return _then( + OCRContentParameters( + harmLabels: freezed == harmLabels + ? _self.harmLabels + : harmLabels // ignore: cast_nullable_to_non_nullable + as List?, + labelOperator: freezed == labelOperator + ? _self.labelOperator + : labelOperator // ignore: cast_nullable_to_non_nullable + as String?, + severity: freezed == severity + ? _self.severity + : severity // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/ocr_content_parameters.g.dart b/packages/stream_chat/lib/open_api/model/ocr_content_parameters.g.dart new file mode 100644 index 0000000000..ce4f746462 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ocr_content_parameters.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'ocr_content_parameters.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +OCRContentParameters _$OCRContentParametersFromJson( + Map json, +) => OCRContentParameters( + harmLabels: (json['harm_labels'] as List?)?.map((e) => e as String).toList(), + labelOperator: json['label_operator'] as String?, + severity: json['severity'] as String?, +); + +Map _$OCRContentParametersToJson( + OCRContentParameters instance, +) => { + 'harm_labels': instance.harmLabels, + 'label_operator': instance.labelOperator, + 'severity': instance.severity, +}; diff --git a/packages/stream_chat/lib/open_api/model/ocr_rule.dart b/packages/stream_chat/lib/open_api/model/ocr_rule.dart new file mode 100644 index 0000000000..48c863d19d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ocr_rule.dart @@ -0,0 +1,49 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'ocr_rule.g.dart'; +part 'ocr_rule.freezed.dart'; + +extension type const OCRRuleAction._(String _) implements String { + static const bounce = OCRRuleAction._('bounce'); + static const bounceFlag = OCRRuleAction._('bounce_flag'); + static const bounceRemove = OCRRuleAction._('bounce_remove'); + static const flag = OCRRuleAction._('flag'); + static const remove = OCRRuleAction._('remove'); + static const shadow = OCRRuleAction._('shadow'); + + factory OCRRuleAction.fromJson(String json) => OCRRuleAction._(json); + + String toJson() => this; +} + +@freezed +@immutable +@JsonSerializable() +class OCRRule with _$OCRRule { + const OCRRule({ + required this.action, + required this.label, + }); + + @override + @JsonKey(name: 'action') + final OCRRuleAction action; + + @override + @JsonKey(name: 'label') + final String label; + + Map toJson() => _$OCRRuleToJson(this); + + static OCRRule fromJson(Map json) => _$OCRRuleFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/ocr_rule.freezed.dart b/packages/stream_chat/lib/open_api/model/ocr_rule.freezed.dart new file mode 100644 index 0000000000..744fe8fb0b --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ocr_rule.freezed.dart @@ -0,0 +1,75 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'ocr_rule.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$OCRRule { + OCRRuleAction get action; + String get label; + + /// Create a copy of OCRRule + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $OCRRuleCopyWith get copyWith => _$OCRRuleCopyWithImpl(this as OCRRule, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is OCRRule && + (identical(other.action, action) || other.action == action) && + (identical(other.label, label) || other.label == label)); + } + + @override + int get hashCode => Object.hash(runtimeType, action, label); + + @override + String toString() { + return 'OCRRule(action: $action, label: $label)'; + } +} + +/// @nodoc +abstract mixin class $OCRRuleCopyWith<$Res> { + factory $OCRRuleCopyWith(OCRRule value, $Res Function(OCRRule) _then) = _$OCRRuleCopyWithImpl; + @useResult + $Res call({OCRRuleAction action, String label}); +} + +/// @nodoc +class _$OCRRuleCopyWithImpl<$Res> implements $OCRRuleCopyWith<$Res> { + _$OCRRuleCopyWithImpl(this._self, this._then); + + final OCRRule _self; + final $Res Function(OCRRule) _then; + + /// Create a copy of OCRRule + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? action = null, Object? label = null}) { + return _then( + OCRRule( + action: null == action + ? _self.action + : action // ignore: cast_nullable_to_non_nullable + as OCRRuleAction, + label: null == label + ? _self.label + : label // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/ocr_rule.g.dart b/packages/stream_chat/lib/open_api/model/ocr_rule.g.dart new file mode 100644 index 0000000000..2c7ad2a97e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ocr_rule.g.dart @@ -0,0 +1,17 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'ocr_rule.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +OCRRule _$OCRRuleFromJson(Map json) => OCRRule( + action: OCRRuleAction.fromJson(json['action'] as String), + label: json['label'] as String, +); + +Map _$OCRRuleToJson(OCRRule instance) => { + 'action': instance.action.toJson(), + 'label': instance.label, +}; diff --git a/packages/stream_chat/lib/open_api/model/only_user_id.dart b/packages/stream_chat/lib/open_api/model/only_user_id.dart new file mode 100644 index 0000000000..2a1ff01bb2 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/only_user_id.dart @@ -0,0 +1,31 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'only_user_id.g.dart'; +part 'only_user_id.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class OnlyUserID with _$OnlyUserID { + const OnlyUserID({ + required this.id, + }); + + @override + @JsonKey(name: 'id') + final String id; + + Map toJson() => _$OnlyUserIDToJson(this); + + static OnlyUserID fromJson(Map json) => _$OnlyUserIDFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/only_user_id.freezed.dart b/packages/stream_chat/lib/open_api/model/only_user_id.freezed.dart new file mode 100644 index 0000000000..5ecbc3bc2f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/only_user_id.freezed.dart @@ -0,0 +1,70 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'only_user_id.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$OnlyUserID { + String get id; + + /// Create a copy of OnlyUserID + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $OnlyUserIDCopyWith get copyWith => _$OnlyUserIDCopyWithImpl(this as OnlyUserID, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is OnlyUserID && (identical(other.id, id) || other.id == id)); + } + + @override + int get hashCode => Object.hash(runtimeType, id); + + @override + String toString() { + return 'OnlyUserID(id: $id)'; + } +} + +/// @nodoc +abstract mixin class $OnlyUserIDCopyWith<$Res> { + factory $OnlyUserIDCopyWith( + OnlyUserID value, + $Res Function(OnlyUserID) _then, + ) = _$OnlyUserIDCopyWithImpl; + @useResult + $Res call({String id}); +} + +/// @nodoc +class _$OnlyUserIDCopyWithImpl<$Res> implements $OnlyUserIDCopyWith<$Res> { + _$OnlyUserIDCopyWithImpl(this._self, this._then); + + final OnlyUserID _self; + final $Res Function(OnlyUserID) _then; + + /// Create a copy of OnlyUserID + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? id = null}) { + return _then( + OnlyUserID( + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/only_user_id.g.dart b/packages/stream_chat/lib/open_api/model/only_user_id.g.dart new file mode 100644 index 0000000000..61e55c2c7e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/only_user_id.g.dart @@ -0,0 +1,11 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'only_user_id.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +OnlyUserID _$OnlyUserIDFromJson(Map json) => OnlyUserID(id: json['id'] as String); + +Map _$OnlyUserIDToJson(OnlyUserID instance) => {'id': instance.id}; diff --git a/packages/stream_chat/lib/open_api/model/own_user_response.dart b/packages/stream_chat/lib/open_api/model/own_user_response.dart new file mode 100644 index 0000000000..bebb607fd5 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/own_user_response.dart @@ -0,0 +1,182 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'own_user_response.g.dart'; +part 'own_user_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class OwnUserResponse with _$OwnUserResponse { + const OwnUserResponse({ + this.avgResponseTime, + required this.banned, + this.blockedUserIds, + required this.channelMutes, + required this.createdAt, + required this.custom, + this.deactivatedAt, + this.deletedAt, + required this.devices, + required this.id, + this.image, + required this.invisible, + required this.language, + this.lastActive, + this.latestHiddenChannels, + required this.mutes, + this.name, + required this.online, + this.privacySettings, + this.pushPreferences, + this.revokeTokensIssuedBefore, + required this.role, + required this.teams, + this.teamsRole, + required this.totalUnreadCount, + this.totalUnreadCountByTeam, + required this.unreadChannels, + required this.unreadCount, + required this.unreadThreads, + required this.updatedAt, + }); + + @override + @JsonKey(name: 'avg_response_time') + final int? avgResponseTime; + + @override + @JsonKey(name: 'banned') + final bool banned; + + @override + @JsonKey(name: 'blocked_user_ids') + final List? blockedUserIds; + + @override + @JsonKey(name: 'channel_mutes') + final List channelMutes; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'deactivated_at') + final DateTime? deactivatedAt; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'deleted_at') + final DateTime? deletedAt; + + @override + @JsonKey(name: 'devices') + final List devices; + + @override + @JsonKey(name: 'id') + final String id; + + @override + @JsonKey(name: 'image') + final String? image; + + @override + @JsonKey(name: 'invisible') + final bool invisible; + + @override + @JsonKey(name: 'language') + final String language; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'last_active') + final DateTime? lastActive; + + @override + @JsonKey(name: 'latest_hidden_channels') + final List? latestHiddenChannels; + + @override + @JsonKey(name: 'mutes') + final List mutes; + + @override + @JsonKey(name: 'name') + final String? name; + + @override + @JsonKey(name: 'online') + final bool online; + + @override + @JsonKey(name: 'privacy_settings') + final PrivacySettingsResponse? privacySettings; + + @override + @JsonKey(name: 'push_preferences') + final PushPreferencesResponse? pushPreferences; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'revoke_tokens_issued_before') + final DateTime? revokeTokensIssuedBefore; + + @override + @JsonKey(name: 'role') + final String role; + + @override + @JsonKey(name: 'teams') + final List teams; + + @override + @JsonKey(name: 'teams_role') + final Map? teamsRole; + + @override + @JsonKey(name: 'total_unread_count') + final int totalUnreadCount; + + @override + @JsonKey(name: 'total_unread_count_by_team') + final Map? totalUnreadCountByTeam; + + @override + @JsonKey(name: 'unread_channels') + final int unreadChannels; + + @override + @JsonKey(name: 'unread_count') + final int unreadCount; + + @override + @JsonKey(name: 'unread_threads') + final int unreadThreads; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'updated_at') + final DateTime updatedAt; + + Map toJson() => _$OwnUserResponseToJson(this); + + static OwnUserResponse fromJson(Map json) => _$OwnUserResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/own_user_response.freezed.dart b/packages/stream_chat/lib/open_api/model/own_user_response.freezed.dart new file mode 100644 index 0000000000..ab0a5a761a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/own_user_response.freezed.dart @@ -0,0 +1,359 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'own_user_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$OwnUserResponse { + int? get avgResponseTime; + bool get banned; + List? get blockedUserIds; + List get channelMutes; + DateTime get createdAt; + Map get custom; + DateTime? get deactivatedAt; + DateTime? get deletedAt; + List get devices; + String get id; + String? get image; + bool get invisible; + String get language; + DateTime? get lastActive; + List? get latestHiddenChannels; + List get mutes; + String? get name; + bool get online; + PrivacySettingsResponse? get privacySettings; + PushPreferencesResponse? get pushPreferences; + DateTime? get revokeTokensIssuedBefore; + String get role; + List get teams; + Map? get teamsRole; + int get totalUnreadCount; + Map? get totalUnreadCountByTeam; + int get unreadChannels; + int get unreadCount; + int get unreadThreads; + DateTime get updatedAt; + + /// Create a copy of OwnUserResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $OwnUserResponseCopyWith get copyWith => _$OwnUserResponseCopyWithImpl( + this as OwnUserResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is OwnUserResponse && + (identical(other.avgResponseTime, avgResponseTime) || other.avgResponseTime == avgResponseTime) && + (identical(other.banned, banned) || other.banned == banned) && + const DeepCollectionEquality().equals( + other.blockedUserIds, + blockedUserIds, + ) && + const DeepCollectionEquality().equals( + other.channelMutes, + channelMutes, + ) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.deactivatedAt, deactivatedAt) || other.deactivatedAt == deactivatedAt) && + (identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt) && + const DeepCollectionEquality().equals(other.devices, devices) && + (identical(other.id, id) || other.id == id) && + (identical(other.image, image) || other.image == image) && + (identical(other.invisible, invisible) || other.invisible == invisible) && + (identical(other.language, language) || other.language == language) && + (identical(other.lastActive, lastActive) || other.lastActive == lastActive) && + const DeepCollectionEquality().equals( + other.latestHiddenChannels, + latestHiddenChannels, + ) && + const DeepCollectionEquality().equals(other.mutes, mutes) && + (identical(other.name, name) || other.name == name) && + (identical(other.online, online) || other.online == online) && + (identical(other.privacySettings, privacySettings) || other.privacySettings == privacySettings) && + (identical(other.pushPreferences, pushPreferences) || other.pushPreferences == pushPreferences) && + (identical( + other.revokeTokensIssuedBefore, + revokeTokensIssuedBefore, + ) || + other.revokeTokensIssuedBefore == revokeTokensIssuedBefore) && + (identical(other.role, role) || other.role == role) && + const DeepCollectionEquality().equals(other.teams, teams) && + const DeepCollectionEquality().equals(other.teamsRole, teamsRole) && + (identical(other.totalUnreadCount, totalUnreadCount) || other.totalUnreadCount == totalUnreadCount) && + const DeepCollectionEquality().equals( + other.totalUnreadCountByTeam, + totalUnreadCountByTeam, + ) && + (identical(other.unreadChannels, unreadChannels) || other.unreadChannels == unreadChannels) && + (identical(other.unreadCount, unreadCount) || other.unreadCount == unreadCount) && + (identical(other.unreadThreads, unreadThreads) || other.unreadThreads == unreadThreads) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)); + } + + @override + int get hashCode => Object.hashAll([ + runtimeType, + avgResponseTime, + banned, + const DeepCollectionEquality().hash(blockedUserIds), + const DeepCollectionEquality().hash(channelMutes), + createdAt, + const DeepCollectionEquality().hash(custom), + deactivatedAt, + deletedAt, + const DeepCollectionEquality().hash(devices), + id, + image, + invisible, + language, + lastActive, + const DeepCollectionEquality().hash(latestHiddenChannels), + const DeepCollectionEquality().hash(mutes), + name, + online, + privacySettings, + pushPreferences, + revokeTokensIssuedBefore, + role, + const DeepCollectionEquality().hash(teams), + const DeepCollectionEquality().hash(teamsRole), + totalUnreadCount, + const DeepCollectionEquality().hash(totalUnreadCountByTeam), + unreadChannels, + unreadCount, + unreadThreads, + updatedAt, + ]); + + @override + String toString() { + return 'OwnUserResponse(avgResponseTime: $avgResponseTime, banned: $banned, blockedUserIds: $blockedUserIds, channelMutes: $channelMutes, createdAt: $createdAt, custom: $custom, deactivatedAt: $deactivatedAt, deletedAt: $deletedAt, devices: $devices, id: $id, image: $image, invisible: $invisible, language: $language, lastActive: $lastActive, latestHiddenChannels: $latestHiddenChannels, mutes: $mutes, name: $name, online: $online, privacySettings: $privacySettings, pushPreferences: $pushPreferences, revokeTokensIssuedBefore: $revokeTokensIssuedBefore, role: $role, teams: $teams, teamsRole: $teamsRole, totalUnreadCount: $totalUnreadCount, totalUnreadCountByTeam: $totalUnreadCountByTeam, unreadChannels: $unreadChannels, unreadCount: $unreadCount, unreadThreads: $unreadThreads, updatedAt: $updatedAt)'; + } +} + +/// @nodoc +abstract mixin class $OwnUserResponseCopyWith<$Res> { + factory $OwnUserResponseCopyWith( + OwnUserResponse value, + $Res Function(OwnUserResponse) _then, + ) = _$OwnUserResponseCopyWithImpl; + @useResult + $Res call({ + int? avgResponseTime, + bool banned, + List? blockedUserIds, + List channelMutes, + DateTime createdAt, + Map custom, + DateTime? deactivatedAt, + DateTime? deletedAt, + List devices, + String id, + String? image, + bool invisible, + String language, + DateTime? lastActive, + List? latestHiddenChannels, + List mutes, + String? name, + bool online, + PrivacySettingsResponse? privacySettings, + PushPreferencesResponse? pushPreferences, + DateTime? revokeTokensIssuedBefore, + String role, + List teams, + Map? teamsRole, + int totalUnreadCount, + Map? totalUnreadCountByTeam, + int unreadChannels, + int unreadCount, + int unreadThreads, + DateTime updatedAt, + }); +} + +/// @nodoc +class _$OwnUserResponseCopyWithImpl<$Res> implements $OwnUserResponseCopyWith<$Res> { + _$OwnUserResponseCopyWithImpl(this._self, this._then); + + final OwnUserResponse _self; + final $Res Function(OwnUserResponse) _then; + + /// Create a copy of OwnUserResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? avgResponseTime = freezed, + Object? banned = null, + Object? blockedUserIds = freezed, + Object? channelMutes = null, + Object? createdAt = null, + Object? custom = null, + Object? deactivatedAt = freezed, + Object? deletedAt = freezed, + Object? devices = null, + Object? id = null, + Object? image = freezed, + Object? invisible = null, + Object? language = null, + Object? lastActive = freezed, + Object? latestHiddenChannels = freezed, + Object? mutes = null, + Object? name = freezed, + Object? online = null, + Object? privacySettings = freezed, + Object? pushPreferences = freezed, + Object? revokeTokensIssuedBefore = freezed, + Object? role = null, + Object? teams = null, + Object? teamsRole = freezed, + Object? totalUnreadCount = null, + Object? totalUnreadCountByTeam = freezed, + Object? unreadChannels = null, + Object? unreadCount = null, + Object? unreadThreads = null, + Object? updatedAt = null, + }) { + return _then( + OwnUserResponse( + avgResponseTime: freezed == avgResponseTime + ? _self.avgResponseTime + : avgResponseTime // ignore: cast_nullable_to_non_nullable + as int?, + banned: null == banned + ? _self.banned + : banned // ignore: cast_nullable_to_non_nullable + as bool, + blockedUserIds: freezed == blockedUserIds + ? _self.blockedUserIds + : blockedUserIds // ignore: cast_nullable_to_non_nullable + as List?, + channelMutes: null == channelMutes + ? _self.channelMutes + : channelMutes // ignore: cast_nullable_to_non_nullable + as List, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + deactivatedAt: freezed == deactivatedAt + ? _self.deactivatedAt + : deactivatedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + deletedAt: freezed == deletedAt + ? _self.deletedAt + : deletedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + devices: null == devices + ? _self.devices + : devices // ignore: cast_nullable_to_non_nullable + as List, + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + image: freezed == image + ? _self.image + : image // ignore: cast_nullable_to_non_nullable + as String?, + invisible: null == invisible + ? _self.invisible + : invisible // ignore: cast_nullable_to_non_nullable + as bool, + language: null == language + ? _self.language + : language // ignore: cast_nullable_to_non_nullable + as String, + lastActive: freezed == lastActive + ? _self.lastActive + : lastActive // ignore: cast_nullable_to_non_nullable + as DateTime?, + latestHiddenChannels: freezed == latestHiddenChannels + ? _self.latestHiddenChannels + : latestHiddenChannels // ignore: cast_nullable_to_non_nullable + as List?, + mutes: null == mutes + ? _self.mutes + : mutes // ignore: cast_nullable_to_non_nullable + as List, + name: freezed == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + online: null == online + ? _self.online + : online // ignore: cast_nullable_to_non_nullable + as bool, + privacySettings: freezed == privacySettings + ? _self.privacySettings + : privacySettings // ignore: cast_nullable_to_non_nullable + as PrivacySettingsResponse?, + pushPreferences: freezed == pushPreferences + ? _self.pushPreferences + : pushPreferences // ignore: cast_nullable_to_non_nullable + as PushPreferencesResponse?, + revokeTokensIssuedBefore: freezed == revokeTokensIssuedBefore + ? _self.revokeTokensIssuedBefore + : revokeTokensIssuedBefore // ignore: cast_nullable_to_non_nullable + as DateTime?, + role: null == role + ? _self.role + : role // ignore: cast_nullable_to_non_nullable + as String, + teams: null == teams + ? _self.teams + : teams // ignore: cast_nullable_to_non_nullable + as List, + teamsRole: freezed == teamsRole + ? _self.teamsRole + : teamsRole // ignore: cast_nullable_to_non_nullable + as Map?, + totalUnreadCount: null == totalUnreadCount + ? _self.totalUnreadCount + : totalUnreadCount // ignore: cast_nullable_to_non_nullable + as int, + totalUnreadCountByTeam: freezed == totalUnreadCountByTeam + ? _self.totalUnreadCountByTeam + : totalUnreadCountByTeam // ignore: cast_nullable_to_non_nullable + as Map?, + unreadChannels: null == unreadChannels + ? _self.unreadChannels + : unreadChannels // ignore: cast_nullable_to_non_nullable + as int, + unreadCount: null == unreadCount + ? _self.unreadCount + : unreadCount // ignore: cast_nullable_to_non_nullable + as int, + unreadThreads: null == unreadThreads + ? _self.unreadThreads + : unreadThreads // ignore: cast_nullable_to_non_nullable + as int, + updatedAt: null == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/own_user_response.g.dart b/packages/stream_chat/lib/open_api/model/own_user_response.g.dart new file mode 100644 index 0000000000..4f00112a60 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/own_user_response.g.dart @@ -0,0 +1,125 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'own_user_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +OwnUserResponse _$OwnUserResponseFromJson(Map json) => OwnUserResponse( + avgResponseTime: (json['avg_response_time'] as num?)?.toInt(), + banned: json['banned'] as bool, + blockedUserIds: (json['blocked_user_ids'] as List?)?.map((e) => e as String).toList(), + channelMutes: (json['channel_mutes'] as List) + .map((e) => ChannelMute.fromJson(e as Map)) + .toList(), + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + deactivatedAt: _$JsonConverterFromJson( + json['deactivated_at'], + const StreamDateTimeConverter().fromJson, + ), + deletedAt: _$JsonConverterFromJson( + json['deleted_at'], + const StreamDateTimeConverter().fromJson, + ), + devices: (json['devices'] as List).map((e) => DeviceResponse.fromJson(e as Map)).toList(), + id: json['id'] as String, + image: json['image'] as String?, + invisible: json['invisible'] as bool, + language: json['language'] as String, + lastActive: _$JsonConverterFromJson( + json['last_active'], + const StreamDateTimeConverter().fromJson, + ), + latestHiddenChannels: (json['latest_hidden_channels'] as List?)?.map((e) => e as String).toList(), + mutes: (json['mutes'] as List).map((e) => UserMuteResponse.fromJson(e as Map)).toList(), + name: json['name'] as String?, + online: json['online'] as bool, + privacySettings: json['privacy_settings'] == null + ? null + : PrivacySettingsResponse.fromJson( + json['privacy_settings'] as Map, + ), + pushPreferences: json['push_preferences'] == null + ? null + : PushPreferencesResponse.fromJson( + json['push_preferences'] as Map, + ), + revokeTokensIssuedBefore: _$JsonConverterFromJson( + json['revoke_tokens_issued_before'], + const StreamDateTimeConverter().fromJson, + ), + role: json['role'] as String, + teams: (json['teams'] as List).map((e) => e as String).toList(), + teamsRole: (json['teams_role'] as Map?)?.map( + (k, e) => MapEntry(k, e as String), + ), + totalUnreadCount: (json['total_unread_count'] as num).toInt(), + totalUnreadCountByTeam: (json['total_unread_count_by_team'] as Map?)?.map( + (k, e) => MapEntry(k, (e as num).toInt()), + ), + unreadChannels: (json['unread_channels'] as num).toInt(), + unreadCount: (json['unread_count'] as num).toInt(), + unreadThreads: (json['unread_threads'] as num).toInt(), + updatedAt: const StreamDateTimeConverter().fromJson( + json['updated_at'] as Object, + ), +); + +Map _$OwnUserResponseToJson(OwnUserResponse instance) => { + 'avg_response_time': instance.avgResponseTime, + 'banned': instance.banned, + 'blocked_user_ids': instance.blockedUserIds, + 'channel_mutes': instance.channelMutes.map((e) => e.toJson()).toList(), + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'deactivated_at': _$JsonConverterToJson( + instance.deactivatedAt, + const StreamDateTimeConverter().toJson, + ), + 'deleted_at': _$JsonConverterToJson( + instance.deletedAt, + const StreamDateTimeConverter().toJson, + ), + 'devices': instance.devices.map((e) => e.toJson()).toList(), + 'id': instance.id, + 'image': instance.image, + 'invisible': instance.invisible, + 'language': instance.language, + 'last_active': _$JsonConverterToJson( + instance.lastActive, + const StreamDateTimeConverter().toJson, + ), + 'latest_hidden_channels': instance.latestHiddenChannels, + 'mutes': instance.mutes.map((e) => e.toJson()).toList(), + 'name': instance.name, + 'online': instance.online, + 'privacy_settings': instance.privacySettings?.toJson(), + 'push_preferences': instance.pushPreferences?.toJson(), + 'revoke_tokens_issued_before': _$JsonConverterToJson( + instance.revokeTokensIssuedBefore, + const StreamDateTimeConverter().toJson, + ), + 'role': instance.role, + 'teams': instance.teams, + 'teams_role': instance.teamsRole, + 'total_unread_count': instance.totalUnreadCount, + 'total_unread_count_by_team': instance.totalUnreadCountByTeam, + 'unread_channels': instance.unreadChannels, + 'unread_count': instance.unreadCount, + 'unread_threads': instance.unreadThreads, + 'updated_at': const StreamDateTimeConverter().toJson(instance.updatedAt), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/pagination_params.dart b/packages/stream_chat/lib/open_api/model/pagination_params.dart new file mode 100644 index 0000000000..2a062f7541 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/pagination_params.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'pagination_params.g.dart'; +part 'pagination_params.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class PaginationParams with _$PaginationParams { + const PaginationParams({ + this.limit, + this.offset, + }); + + @override + @JsonKey(name: 'limit') + final int? limit; + + @override + @JsonKey(name: 'offset') + final int? offset; + + Map toJson() => _$PaginationParamsToJson(this); + + static PaginationParams fromJson(Map json) => _$PaginationParamsFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/pagination_params.freezed.dart b/packages/stream_chat/lib/open_api/model/pagination_params.freezed.dart new file mode 100644 index 0000000000..b275dc3f30 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/pagination_params.freezed.dart @@ -0,0 +1,81 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'pagination_params.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$PaginationParams { + int? get limit; + int? get offset; + + /// Create a copy of PaginationParams + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $PaginationParamsCopyWith get copyWith => _$PaginationParamsCopyWithImpl( + this as PaginationParams, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is PaginationParams && + (identical(other.limit, limit) || other.limit == limit) && + (identical(other.offset, offset) || other.offset == offset)); + } + + @override + int get hashCode => Object.hash(runtimeType, limit, offset); + + @override + String toString() { + return 'PaginationParams(limit: $limit, offset: $offset)'; + } +} + +/// @nodoc +abstract mixin class $PaginationParamsCopyWith<$Res> { + factory $PaginationParamsCopyWith( + PaginationParams value, + $Res Function(PaginationParams) _then, + ) = _$PaginationParamsCopyWithImpl; + @useResult + $Res call({int? limit, int? offset}); +} + +/// @nodoc +class _$PaginationParamsCopyWithImpl<$Res> implements $PaginationParamsCopyWith<$Res> { + _$PaginationParamsCopyWithImpl(this._self, this._then); + + final PaginationParams _self; + final $Res Function(PaginationParams) _then; + + /// Create a copy of PaginationParams + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? limit = freezed, Object? offset = freezed}) { + return _then( + PaginationParams( + limit: freezed == limit + ? _self.limit + : limit // ignore: cast_nullable_to_non_nullable + as int?, + offset: freezed == offset + ? _self.offset + : offset // ignore: cast_nullable_to_non_nullable + as int?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/pagination_params.g.dart b/packages/stream_chat/lib/open_api/model/pagination_params.g.dart new file mode 100644 index 0000000000..1c83843c85 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/pagination_params.g.dart @@ -0,0 +1,17 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'pagination_params.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +PaginationParams _$PaginationParamsFromJson(Map json) => PaginationParams( + limit: (json['limit'] as num?)?.toInt(), + offset: (json['offset'] as num?)?.toInt(), +); + +Map _$PaginationParamsToJson(PaginationParams instance) => { + 'limit': instance.limit, + 'offset': instance.offset, +}; diff --git a/packages/stream_chat/lib/open_api/model/parsed_predefined_filter_response.dart b/packages/stream_chat/lib/open_api/model/parsed_predefined_filter_response.dart new file mode 100644 index 0000000000..9ee4e8eb3e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/parsed_predefined_filter_response.dart @@ -0,0 +1,42 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'parsed_predefined_filter_response.g.dart'; +part 'parsed_predefined_filter_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ParsedPredefinedFilterResponse with _$ParsedPredefinedFilterResponse { + const ParsedPredefinedFilterResponse({ + required this.filter, + required this.name, + this.sort, + }); + + @override + @JsonKey(name: 'filter') + final Map filter; + + @override + @JsonKey(name: 'name') + final String name; + + @override + @JsonKey(name: 'sort') + final List? sort; + + Map toJson() => _$ParsedPredefinedFilterResponseToJson(this); + + static ParsedPredefinedFilterResponse fromJson(Map json) => + _$ParsedPredefinedFilterResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/parsed_predefined_filter_response.freezed.dart b/packages/stream_chat/lib/open_api/model/parsed_predefined_filter_response.freezed.dart new file mode 100644 index 0000000000..213350b109 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/parsed_predefined_filter_response.freezed.dart @@ -0,0 +1,101 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'parsed_predefined_filter_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ParsedPredefinedFilterResponse { + Map get filter; + String get name; + List? get sort; + + /// Create a copy of ParsedPredefinedFilterResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ParsedPredefinedFilterResponseCopyWith get copyWith => + _$ParsedPredefinedFilterResponseCopyWithImpl( + this as ParsedPredefinedFilterResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ParsedPredefinedFilterResponse && + const DeepCollectionEquality().equals(other.filter, filter) && + (identical(other.name, name) || other.name == name) && + const DeepCollectionEquality().equals(other.sort, sort)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(filter), + name, + const DeepCollectionEquality().hash(sort), + ); + + @override + String toString() { + return 'ParsedPredefinedFilterResponse(filter: $filter, name: $name, sort: $sort)'; + } +} + +/// @nodoc +abstract mixin class $ParsedPredefinedFilterResponseCopyWith<$Res> { + factory $ParsedPredefinedFilterResponseCopyWith( + ParsedPredefinedFilterResponse value, + $Res Function(ParsedPredefinedFilterResponse) _then, + ) = _$ParsedPredefinedFilterResponseCopyWithImpl; + @useResult + $Res call({ + Map filter, + String name, + List? sort, + }); +} + +/// @nodoc +class _$ParsedPredefinedFilterResponseCopyWithImpl<$Res> implements $ParsedPredefinedFilterResponseCopyWith<$Res> { + _$ParsedPredefinedFilterResponseCopyWithImpl(this._self, this._then); + + final ParsedPredefinedFilterResponse _self; + final $Res Function(ParsedPredefinedFilterResponse) _then; + + /// Create a copy of ParsedPredefinedFilterResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? filter = null, + Object? name = null, + Object? sort = freezed, + }) { + return _then( + ParsedPredefinedFilterResponse( + filter: null == filter + ? _self.filter + : filter // ignore: cast_nullable_to_non_nullable + as Map, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + sort: freezed == sort + ? _self.sort + : sort // ignore: cast_nullable_to_non_nullable + as List?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/parsed_predefined_filter_response.g.dart b/packages/stream_chat/lib/open_api/model/parsed_predefined_filter_response.g.dart new file mode 100644 index 0000000000..f0deca13ff --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/parsed_predefined_filter_response.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'parsed_predefined_filter_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ParsedPredefinedFilterResponse _$ParsedPredefinedFilterResponseFromJson( + Map json, +) => ParsedPredefinedFilterResponse( + filter: json['filter'] as Map, + name: json['name'] as String, + sort: (json['sort'] as List?)?.map((e) => SortParamRequest.fromJson(e as Map)).toList(), +); + +Map _$ParsedPredefinedFilterResponseToJson( + ParsedPredefinedFilterResponse instance, +) => { + 'filter': instance.filter, + 'name': instance.name, + 'sort': instance.sort?.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/pending_message_event.dart b/packages/stream_chat/lib/open_api/model/pending_message_event.dart new file mode 100644 index 0000000000..7fd5d0c8b7 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/pending_message_event.dart @@ -0,0 +1,73 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'pending_message_event.g.dart'; +part 'pending_message_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class PendingMessageEvent extends core.WsEvent with _$PendingMessageEvent { + const PendingMessageEvent({ + this.channel, + required this.createdAt, + required this.custom, + this.message, + this.metadata, + required this.method, + this.receivedAt, + required this.type, + this.user, + }); + + @override + @JsonKey(name: 'channel') + final ChannelResponse? channel; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'message') + final MessageResponse? message; + + @override + @JsonKey(name: 'metadata') + final Map? metadata; + + @override + @JsonKey(name: 'method') + final String method; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'user') + final UserResponse? user; + + Map toJson() => _$PendingMessageEventToJson(this); + + static PendingMessageEvent fromJson(Map json) => _$PendingMessageEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/pending_message_event.freezed.dart b/packages/stream_chat/lib/open_api/model/pending_message_event.freezed.dart new file mode 100644 index 0000000000..8f60e5c62a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/pending_message_event.freezed.dart @@ -0,0 +1,155 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'pending_message_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$PendingMessageEvent { + ChannelResponse? get channel; + DateTime get createdAt; + Map get custom; + MessageResponse? get message; + Map? get metadata; + String get method; + DateTime? get receivedAt; + String get type; + UserResponse? get user; + + /// Create a copy of PendingMessageEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $PendingMessageEventCopyWith get copyWith => + _$PendingMessageEventCopyWithImpl( + this as PendingMessageEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is PendingMessageEvent && + (identical(other.channel, channel) || other.channel == channel) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.message, message) || other.message == message) && + const DeepCollectionEquality().equals(other.metadata, metadata) && + (identical(other.method, method) || other.method == method) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.type, type) || other.type == type) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channel, + createdAt, + const DeepCollectionEquality().hash(custom), + message, + const DeepCollectionEquality().hash(metadata), + method, + receivedAt, + type, + user, + ); + + @override + String toString() { + return 'PendingMessageEvent(channel: $channel, createdAt: $createdAt, custom: $custom, message: $message, metadata: $metadata, method: $method, receivedAt: $receivedAt, type: $type, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $PendingMessageEventCopyWith<$Res> { + factory $PendingMessageEventCopyWith( + PendingMessageEvent value, + $Res Function(PendingMessageEvent) _then, + ) = _$PendingMessageEventCopyWithImpl; + @useResult + $Res call({ + ChannelResponse? channel, + DateTime createdAt, + Map custom, + MessageResponse? message, + Map? metadata, + String method, + DateTime? receivedAt, + String type, + UserResponse? user, + }); +} + +/// @nodoc +class _$PendingMessageEventCopyWithImpl<$Res> implements $PendingMessageEventCopyWith<$Res> { + _$PendingMessageEventCopyWithImpl(this._self, this._then); + + final PendingMessageEvent _self; + final $Res Function(PendingMessageEvent) _then; + + /// Create a copy of PendingMessageEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channel = freezed, + Object? createdAt = null, + Object? custom = null, + Object? message = freezed, + Object? metadata = freezed, + Object? method = null, + Object? receivedAt = freezed, + Object? type = null, + Object? user = freezed, + }) { + return _then( + PendingMessageEvent( + channel: freezed == channel + ? _self.channel + : channel // ignore: cast_nullable_to_non_nullable + as ChannelResponse?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + message: freezed == message + ? _self.message + : message // ignore: cast_nullable_to_non_nullable + as MessageResponse?, + metadata: freezed == metadata + ? _self.metadata + : metadata // ignore: cast_nullable_to_non_nullable + as Map?, + method: null == method + ? _self.method + : method // ignore: cast_nullable_to_non_nullable + as String, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponse?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/pending_message_event.g.dart b/packages/stream_chat/lib/open_api/model/pending_message_event.g.dart new file mode 100644 index 0000000000..44010d411d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/pending_message_event.g.dart @@ -0,0 +1,53 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'pending_message_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +PendingMessageEvent _$PendingMessageEventFromJson(Map json) => PendingMessageEvent( + channel: json['channel'] == null ? null : ChannelResponse.fromJson(json['channel'] as Map), + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + message: json['message'] == null ? null : MessageResponse.fromJson(json['message'] as Map), + metadata: (json['metadata'] as Map?)?.map( + (k, e) => MapEntry(k, e as String), + ), + method: json['method'] as String, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + type: json['type'] as String, + user: json['user'] == null ? null : UserResponse.fromJson(json['user'] as Map), +); + +Map _$PendingMessageEventToJson( + PendingMessageEvent instance, +) => { + 'channel': instance.channel?.toJson(), + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'message': instance.message?.toJson(), + 'metadata': instance.metadata, + 'method': instance.method, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'type': instance.type, + 'user': instance.user?.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/pending_message_response.dart b/packages/stream_chat/lib/open_api/model/pending_message_response.dart new file mode 100644 index 0000000000..759214c061 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/pending_message_response.dart @@ -0,0 +1,41 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'pending_message_response.g.dart'; +part 'pending_message_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class PendingMessageResponse with _$PendingMessageResponse { + const PendingMessageResponse({ + this.channel, + this.message, + this.user, + }); + + @override + @JsonKey(name: 'channel') + final ChannelResponse? channel; + + @override + @JsonKey(name: 'message') + final MessageResponse? message; + + @override + @JsonKey(name: 'user') + final UserResponse? user; + + Map toJson() => _$PendingMessageResponseToJson(this); + + static PendingMessageResponse fromJson(Map json) => _$PendingMessageResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/pending_message_response.freezed.dart b/packages/stream_chat/lib/open_api/model/pending_message_response.freezed.dart new file mode 100644 index 0000000000..1abbf66424 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/pending_message_response.freezed.dart @@ -0,0 +1,96 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'pending_message_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$PendingMessageResponse { + ChannelResponse? get channel; + MessageResponse? get message; + UserResponse? get user; + + /// Create a copy of PendingMessageResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $PendingMessageResponseCopyWith get copyWith => + _$PendingMessageResponseCopyWithImpl( + this as PendingMessageResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is PendingMessageResponse && + (identical(other.channel, channel) || other.channel == channel) && + (identical(other.message, message) || other.message == message) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash(runtimeType, channel, message, user); + + @override + String toString() { + return 'PendingMessageResponse(channel: $channel, message: $message, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $PendingMessageResponseCopyWith<$Res> { + factory $PendingMessageResponseCopyWith( + PendingMessageResponse value, + $Res Function(PendingMessageResponse) _then, + ) = _$PendingMessageResponseCopyWithImpl; + @useResult + $Res call({ + ChannelResponse? channel, + MessageResponse? message, + UserResponse? user, + }); +} + +/// @nodoc +class _$PendingMessageResponseCopyWithImpl<$Res> implements $PendingMessageResponseCopyWith<$Res> { + _$PendingMessageResponseCopyWithImpl(this._self, this._then); + + final PendingMessageResponse _self; + final $Res Function(PendingMessageResponse) _then; + + /// Create a copy of PendingMessageResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channel = freezed, + Object? message = freezed, + Object? user = freezed, + }) { + return _then( + PendingMessageResponse( + channel: freezed == channel + ? _self.channel + : channel // ignore: cast_nullable_to_non_nullable + as ChannelResponse?, + message: freezed == message + ? _self.message + : message // ignore: cast_nullable_to_non_nullable + as MessageResponse?, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponse?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/pending_message_response.g.dart b/packages/stream_chat/lib/open_api/model/pending_message_response.g.dart new file mode 100644 index 0000000000..421beec7c3 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/pending_message_response.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'pending_message_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +PendingMessageResponse _$PendingMessageResponseFromJson( + Map json, +) => PendingMessageResponse( + channel: json['channel'] == null ? null : ChannelResponse.fromJson(json['channel'] as Map), + message: json['message'] == null ? null : MessageResponse.fromJson(json['message'] as Map), + user: json['user'] == null ? null : UserResponse.fromJson(json['user'] as Map), +); + +Map _$PendingMessageResponseToJson( + PendingMessageResponse instance, +) => { + 'channel': instance.channel?.toJson(), + 'message': instance.message?.toJson(), + 'user': instance.user?.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/poll_closed_event.dart b/packages/stream_chat/lib/open_api/model/poll_closed_event.dart new file mode 100644 index 0000000000..7e235b5da9 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/poll_closed_event.dart @@ -0,0 +1,68 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'poll_closed_event.g.dart'; +part 'poll_closed_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class PollClosedEvent extends core.WsEvent with _$PollClosedEvent { + const PollClosedEvent({ + this.activityId, + this.cid, + required this.createdAt, + required this.custom, + this.messageId, + required this.poll, + this.receivedAt, + required this.type, + }); + + @override + @JsonKey(name: 'activity_id') + final String? activityId; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'message_id') + final String? messageId; + + @override + @JsonKey(name: 'poll') + final PollResponseData poll; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'type') + final String type; + + Map toJson() => _$PollClosedEventToJson(this); + + static PollClosedEvent fromJson(Map json) => _$PollClosedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/poll_closed_event.freezed.dart b/packages/stream_chat/lib/open_api/model/poll_closed_event.freezed.dart new file mode 100644 index 0000000000..9a39a63981 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/poll_closed_event.freezed.dart @@ -0,0 +1,145 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'poll_closed_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$PollClosedEvent { + String? get activityId; + String? get cid; + DateTime get createdAt; + Map get custom; + String? get messageId; + PollResponseData get poll; + DateTime? get receivedAt; + String get type; + + /// Create a copy of PollClosedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $PollClosedEventCopyWith get copyWith => _$PollClosedEventCopyWithImpl( + this as PollClosedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is PollClosedEvent && + (identical(other.activityId, activityId) || other.activityId == activityId) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.messageId, messageId) || other.messageId == messageId) && + (identical(other.poll, poll) || other.poll == poll) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.type, type) || other.type == type)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + activityId, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + messageId, + poll, + receivedAt, + type, + ); + + @override + String toString() { + return 'PollClosedEvent(activityId: $activityId, cid: $cid, createdAt: $createdAt, custom: $custom, messageId: $messageId, poll: $poll, receivedAt: $receivedAt, type: $type)'; + } +} + +/// @nodoc +abstract mixin class $PollClosedEventCopyWith<$Res> { + factory $PollClosedEventCopyWith( + PollClosedEvent value, + $Res Function(PollClosedEvent) _then, + ) = _$PollClosedEventCopyWithImpl; + @useResult + $Res call({ + String? activityId, + String? cid, + DateTime createdAt, + Map custom, + String? messageId, + PollResponseData poll, + DateTime? receivedAt, + String type, + }); +} + +/// @nodoc +class _$PollClosedEventCopyWithImpl<$Res> implements $PollClosedEventCopyWith<$Res> { + _$PollClosedEventCopyWithImpl(this._self, this._then); + + final PollClosedEvent _self; + final $Res Function(PollClosedEvent) _then; + + /// Create a copy of PollClosedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? activityId = freezed, + Object? cid = freezed, + Object? createdAt = null, + Object? custom = null, + Object? messageId = freezed, + Object? poll = null, + Object? receivedAt = freezed, + Object? type = null, + }) { + return _then( + PollClosedEvent( + activityId: freezed == activityId + ? _self.activityId + : activityId // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + messageId: freezed == messageId + ? _self.messageId + : messageId // ignore: cast_nullable_to_non_nullable + as String?, + poll: null == poll + ? _self.poll + : poll // ignore: cast_nullable_to_non_nullable + as PollResponseData, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/poll_closed_event.g.dart b/packages/stream_chat/lib/open_api/model/poll_closed_event.g.dart new file mode 100644 index 0000000000..fc06b1978e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/poll_closed_event.g.dart @@ -0,0 +1,47 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'poll_closed_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +PollClosedEvent _$PollClosedEventFromJson(Map json) => PollClosedEvent( + activityId: json['activity_id'] as String?, + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + messageId: json['message_id'] as String?, + poll: PollResponseData.fromJson(json['poll'] as Map), + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + type: json['type'] as String, +); + +Map _$PollClosedEventToJson(PollClosedEvent instance) => { + 'activity_id': instance.activityId, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'message_id': instance.messageId, + 'poll': instance.poll.toJson(), + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'type': instance.type, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/poll_deleted_event.dart b/packages/stream_chat/lib/open_api/model/poll_deleted_event.dart new file mode 100644 index 0000000000..b5a6da96d8 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/poll_deleted_event.dart @@ -0,0 +1,68 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'poll_deleted_event.g.dart'; +part 'poll_deleted_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class PollDeletedEvent extends core.WsEvent with _$PollDeletedEvent { + const PollDeletedEvent({ + this.activityId, + this.cid, + required this.createdAt, + required this.custom, + this.messageId, + required this.poll, + this.receivedAt, + required this.type, + }); + + @override + @JsonKey(name: 'activity_id') + final String? activityId; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'message_id') + final String? messageId; + + @override + @JsonKey(name: 'poll') + final PollResponseData poll; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'type') + final String type; + + Map toJson() => _$PollDeletedEventToJson(this); + + static PollDeletedEvent fromJson(Map json) => _$PollDeletedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/poll_deleted_event.freezed.dart b/packages/stream_chat/lib/open_api/model/poll_deleted_event.freezed.dart new file mode 100644 index 0000000000..7f134366a1 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/poll_deleted_event.freezed.dart @@ -0,0 +1,145 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'poll_deleted_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$PollDeletedEvent { + String? get activityId; + String? get cid; + DateTime get createdAt; + Map get custom; + String? get messageId; + PollResponseData get poll; + DateTime? get receivedAt; + String get type; + + /// Create a copy of PollDeletedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $PollDeletedEventCopyWith get copyWith => _$PollDeletedEventCopyWithImpl( + this as PollDeletedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is PollDeletedEvent && + (identical(other.activityId, activityId) || other.activityId == activityId) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.messageId, messageId) || other.messageId == messageId) && + (identical(other.poll, poll) || other.poll == poll) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.type, type) || other.type == type)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + activityId, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + messageId, + poll, + receivedAt, + type, + ); + + @override + String toString() { + return 'PollDeletedEvent(activityId: $activityId, cid: $cid, createdAt: $createdAt, custom: $custom, messageId: $messageId, poll: $poll, receivedAt: $receivedAt, type: $type)'; + } +} + +/// @nodoc +abstract mixin class $PollDeletedEventCopyWith<$Res> { + factory $PollDeletedEventCopyWith( + PollDeletedEvent value, + $Res Function(PollDeletedEvent) _then, + ) = _$PollDeletedEventCopyWithImpl; + @useResult + $Res call({ + String? activityId, + String? cid, + DateTime createdAt, + Map custom, + String? messageId, + PollResponseData poll, + DateTime? receivedAt, + String type, + }); +} + +/// @nodoc +class _$PollDeletedEventCopyWithImpl<$Res> implements $PollDeletedEventCopyWith<$Res> { + _$PollDeletedEventCopyWithImpl(this._self, this._then); + + final PollDeletedEvent _self; + final $Res Function(PollDeletedEvent) _then; + + /// Create a copy of PollDeletedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? activityId = freezed, + Object? cid = freezed, + Object? createdAt = null, + Object? custom = null, + Object? messageId = freezed, + Object? poll = null, + Object? receivedAt = freezed, + Object? type = null, + }) { + return _then( + PollDeletedEvent( + activityId: freezed == activityId + ? _self.activityId + : activityId // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + messageId: freezed == messageId + ? _self.messageId + : messageId // ignore: cast_nullable_to_non_nullable + as String?, + poll: null == poll + ? _self.poll + : poll // ignore: cast_nullable_to_non_nullable + as PollResponseData, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/poll_deleted_event.g.dart b/packages/stream_chat/lib/open_api/model/poll_deleted_event.g.dart new file mode 100644 index 0000000000..a66d099337 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/poll_deleted_event.g.dart @@ -0,0 +1,47 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'poll_deleted_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +PollDeletedEvent _$PollDeletedEventFromJson(Map json) => PollDeletedEvent( + activityId: json['activity_id'] as String?, + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + messageId: json['message_id'] as String?, + poll: PollResponseData.fromJson(json['poll'] as Map), + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + type: json['type'] as String, +); + +Map _$PollDeletedEventToJson(PollDeletedEvent instance) => { + 'activity_id': instance.activityId, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'message_id': instance.messageId, + 'poll': instance.poll.toJson(), + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'type': instance.type, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/poll_option_input.dart b/packages/stream_chat/lib/open_api/model/poll_option_input.dart new file mode 100644 index 0000000000..8807668e65 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/poll_option_input.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'poll_option_input.g.dart'; +part 'poll_option_input.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class PollOptionInput with _$PollOptionInput { + const PollOptionInput({ + this.custom, + this.text, + }); + + @override + @JsonKey(name: 'custom') + final Map? custom; + + @override + @JsonKey(name: 'text') + final String? text; + + Map toJson() => _$PollOptionInputToJson(this); + + static PollOptionInput fromJson(Map json) => _$PollOptionInputFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/poll_option_input.freezed.dart b/packages/stream_chat/lib/open_api/model/poll_option_input.freezed.dart new file mode 100644 index 0000000000..b8b19d6cbb --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/poll_option_input.freezed.dart @@ -0,0 +1,85 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'poll_option_input.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$PollOptionInput { + Map? get custom; + String? get text; + + /// Create a copy of PollOptionInput + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $PollOptionInputCopyWith get copyWith => _$PollOptionInputCopyWithImpl( + this as PollOptionInput, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is PollOptionInput && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.text, text) || other.text == text)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(custom), + text, + ); + + @override + String toString() { + return 'PollOptionInput(custom: $custom, text: $text)'; + } +} + +/// @nodoc +abstract mixin class $PollOptionInputCopyWith<$Res> { + factory $PollOptionInputCopyWith( + PollOptionInput value, + $Res Function(PollOptionInput) _then, + ) = _$PollOptionInputCopyWithImpl; + @useResult + $Res call({Map? custom, String? text}); +} + +/// @nodoc +class _$PollOptionInputCopyWithImpl<$Res> implements $PollOptionInputCopyWith<$Res> { + _$PollOptionInputCopyWithImpl(this._self, this._then); + + final PollOptionInput _self; + final $Res Function(PollOptionInput) _then; + + /// Create a copy of PollOptionInput + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? custom = freezed, Object? text = freezed}) { + return _then( + PollOptionInput( + custom: freezed == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map?, + text: freezed == text + ? _self.text + : text // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/poll_option_input.g.dart b/packages/stream_chat/lib/open_api/model/poll_option_input.g.dart new file mode 100644 index 0000000000..85dcf380e2 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/poll_option_input.g.dart @@ -0,0 +1,17 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'poll_option_input.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +PollOptionInput _$PollOptionInputFromJson(Map json) => PollOptionInput( + custom: json['custom'] as Map?, + text: json['text'] as String?, +); + +Map _$PollOptionInputToJson(PollOptionInput instance) => { + 'custom': instance.custom, + 'text': instance.text, +}; diff --git a/packages/stream_chat/lib/open_api/model/poll_option_request.dart b/packages/stream_chat/lib/open_api/model/poll_option_request.dart new file mode 100644 index 0000000000..2de85d6a69 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/poll_option_request.dart @@ -0,0 +1,41 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'poll_option_request.g.dart'; +part 'poll_option_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class PollOptionRequest with _$PollOptionRequest { + const PollOptionRequest({ + this.custom, + required this.id, + this.text, + }); + + @override + @JsonKey(name: 'custom') + final Map? custom; + + @override + @JsonKey(name: 'id') + final String id; + + @override + @JsonKey(name: 'text') + final String? text; + + Map toJson() => _$PollOptionRequestToJson(this); + + static PollOptionRequest fromJson(Map json) => _$PollOptionRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/poll_option_request.freezed.dart b/packages/stream_chat/lib/open_api/model/poll_option_request.freezed.dart new file mode 100644 index 0000000000..eea4ff8e83 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/poll_option_request.freezed.dart @@ -0,0 +1,96 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'poll_option_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$PollOptionRequest { + Map? get custom; + String get id; + String? get text; + + /// Create a copy of PollOptionRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $PollOptionRequestCopyWith get copyWith => _$PollOptionRequestCopyWithImpl( + this as PollOptionRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is PollOptionRequest && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.id, id) || other.id == id) && + (identical(other.text, text) || other.text == text)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(custom), + id, + text, + ); + + @override + String toString() { + return 'PollOptionRequest(custom: $custom, id: $id, text: $text)'; + } +} + +/// @nodoc +abstract mixin class $PollOptionRequestCopyWith<$Res> { + factory $PollOptionRequestCopyWith( + PollOptionRequest value, + $Res Function(PollOptionRequest) _then, + ) = _$PollOptionRequestCopyWithImpl; + @useResult + $Res call({Map? custom, String id, String? text}); +} + +/// @nodoc +class _$PollOptionRequestCopyWithImpl<$Res> implements $PollOptionRequestCopyWith<$Res> { + _$PollOptionRequestCopyWithImpl(this._self, this._then); + + final PollOptionRequest _self; + final $Res Function(PollOptionRequest) _then; + + /// Create a copy of PollOptionRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? custom = freezed, + Object? id = null, + Object? text = freezed, + }) { + return _then( + PollOptionRequest( + custom: freezed == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map?, + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + text: freezed == text + ? _self.text + : text // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/poll_option_request.g.dart b/packages/stream_chat/lib/open_api/model/poll_option_request.g.dart new file mode 100644 index 0000000000..02cf9f53ae --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/poll_option_request.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'poll_option_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +PollOptionRequest _$PollOptionRequestFromJson(Map json) => PollOptionRequest( + custom: json['custom'] as Map?, + id: json['id'] as String, + text: json['text'] as String?, +); + +Map _$PollOptionRequestToJson(PollOptionRequest instance) => { + 'custom': instance.custom, + 'id': instance.id, + 'text': instance.text, +}; diff --git a/packages/stream_chat/lib/open_api/model/poll_option_response.dart b/packages/stream_chat/lib/open_api/model/poll_option_response.dart new file mode 100644 index 0000000000..c7956f0b47 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/poll_option_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'poll_option_response.g.dart'; +part 'poll_option_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class PollOptionResponse with _$PollOptionResponse { + const PollOptionResponse({ + required this.duration, + required this.pollOption, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'poll_option') + final PollOptionResponseData pollOption; + + Map toJson() => _$PollOptionResponseToJson(this); + + static PollOptionResponse fromJson(Map json) => _$PollOptionResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/poll_option_response.freezed.dart b/packages/stream_chat/lib/open_api/model/poll_option_response.freezed.dart new file mode 100644 index 0000000000..9921ba8eed --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/poll_option_response.freezed.dart @@ -0,0 +1,81 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'poll_option_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$PollOptionResponse { + String get duration; + PollOptionResponseData get pollOption; + + /// Create a copy of PollOptionResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $PollOptionResponseCopyWith get copyWith => _$PollOptionResponseCopyWithImpl( + this as PollOptionResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is PollOptionResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.pollOption, pollOption) || other.pollOption == pollOption)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration, pollOption); + + @override + String toString() { + return 'PollOptionResponse(duration: $duration, pollOption: $pollOption)'; + } +} + +/// @nodoc +abstract mixin class $PollOptionResponseCopyWith<$Res> { + factory $PollOptionResponseCopyWith( + PollOptionResponse value, + $Res Function(PollOptionResponse) _then, + ) = _$PollOptionResponseCopyWithImpl; + @useResult + $Res call({String duration, PollOptionResponseData pollOption}); +} + +/// @nodoc +class _$PollOptionResponseCopyWithImpl<$Res> implements $PollOptionResponseCopyWith<$Res> { + _$PollOptionResponseCopyWithImpl(this._self, this._then); + + final PollOptionResponse _self; + final $Res Function(PollOptionResponse) _then; + + /// Create a copy of PollOptionResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? pollOption = null}) { + return _then( + PollOptionResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + pollOption: null == pollOption + ? _self.pollOption + : pollOption // ignore: cast_nullable_to_non_nullable + as PollOptionResponseData, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/poll_option_response.g.dart b/packages/stream_chat/lib/open_api/model/poll_option_response.g.dart new file mode 100644 index 0000000000..cc624ae4fc --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/poll_option_response.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'poll_option_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +PollOptionResponse _$PollOptionResponseFromJson(Map json) => PollOptionResponse( + duration: json['duration'] as String, + pollOption: PollOptionResponseData.fromJson( + json['poll_option'] as Map, + ), +); + +Map _$PollOptionResponseToJson(PollOptionResponse instance) => { + 'duration': instance.duration, + 'poll_option': instance.pollOption.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/poll_option_response_data.dart b/packages/stream_chat/lib/open_api/model/poll_option_response_data.dart new file mode 100644 index 0000000000..2c43a9ac3e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/poll_option_response_data.dart @@ -0,0 +1,41 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'poll_option_response_data.g.dart'; +part 'poll_option_response_data.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class PollOptionResponseData with _$PollOptionResponseData { + const PollOptionResponseData({ + required this.custom, + required this.id, + required this.text, + }); + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'id') + final String id; + + @override + @JsonKey(name: 'text') + final String text; + + Map toJson() => _$PollOptionResponseDataToJson(this); + + static PollOptionResponseData fromJson(Map json) => _$PollOptionResponseDataFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/poll_option_response_data.freezed.dart b/packages/stream_chat/lib/open_api/model/poll_option_response_data.freezed.dart new file mode 100644 index 0000000000..81ad5947f6 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/poll_option_response_data.freezed.dart @@ -0,0 +1,93 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'poll_option_response_data.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$PollOptionResponseData { + Map get custom; + String get id; + String get text; + + /// Create a copy of PollOptionResponseData + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $PollOptionResponseDataCopyWith get copyWith => + _$PollOptionResponseDataCopyWithImpl( + this as PollOptionResponseData, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is PollOptionResponseData && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.id, id) || other.id == id) && + (identical(other.text, text) || other.text == text)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(custom), + id, + text, + ); + + @override + String toString() { + return 'PollOptionResponseData(custom: $custom, id: $id, text: $text)'; + } +} + +/// @nodoc +abstract mixin class $PollOptionResponseDataCopyWith<$Res> { + factory $PollOptionResponseDataCopyWith( + PollOptionResponseData value, + $Res Function(PollOptionResponseData) _then, + ) = _$PollOptionResponseDataCopyWithImpl; + @useResult + $Res call({Map custom, String id, String text}); +} + +/// @nodoc +class _$PollOptionResponseDataCopyWithImpl<$Res> implements $PollOptionResponseDataCopyWith<$Res> { + _$PollOptionResponseDataCopyWithImpl(this._self, this._then); + + final PollOptionResponseData _self; + final $Res Function(PollOptionResponseData) _then; + + /// Create a copy of PollOptionResponseData + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? custom = null, Object? id = null, Object? text = null}) { + return _then( + PollOptionResponseData( + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + text: null == text + ? _self.text + : text // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/poll_option_response_data.g.dart b/packages/stream_chat/lib/open_api/model/poll_option_response_data.g.dart new file mode 100644 index 0000000000..8cb55c0986 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/poll_option_response_data.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'poll_option_response_data.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +PollOptionResponseData _$PollOptionResponseDataFromJson( + Map json, +) => PollOptionResponseData( + custom: json['custom'] as Map, + id: json['id'] as String, + text: json['text'] as String, +); + +Map _$PollOptionResponseDataToJson( + PollOptionResponseData instance, +) => { + 'custom': instance.custom, + 'id': instance.id, + 'text': instance.text, +}; diff --git a/packages/stream_chat/lib/open_api/model/poll_response.dart b/packages/stream_chat/lib/open_api/model/poll_response.dart new file mode 100644 index 0000000000..bff4241421 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/poll_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'poll_response.g.dart'; +part 'poll_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class PollResponse with _$PollResponse { + const PollResponse({ + required this.duration, + required this.poll, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'poll') + final PollResponseData poll; + + Map toJson() => _$PollResponseToJson(this); + + static PollResponse fromJson(Map json) => _$PollResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/poll_response.freezed.dart b/packages/stream_chat/lib/open_api/model/poll_response.freezed.dart new file mode 100644 index 0000000000..a4b9106016 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/poll_response.freezed.dart @@ -0,0 +1,81 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'poll_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$PollResponse { + String get duration; + PollResponseData get poll; + + /// Create a copy of PollResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $PollResponseCopyWith get copyWith => _$PollResponseCopyWithImpl( + this as PollResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is PollResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.poll, poll) || other.poll == poll)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration, poll); + + @override + String toString() { + return 'PollResponse(duration: $duration, poll: $poll)'; + } +} + +/// @nodoc +abstract mixin class $PollResponseCopyWith<$Res> { + factory $PollResponseCopyWith( + PollResponse value, + $Res Function(PollResponse) _then, + ) = _$PollResponseCopyWithImpl; + @useResult + $Res call({String duration, PollResponseData poll}); +} + +/// @nodoc +class _$PollResponseCopyWithImpl<$Res> implements $PollResponseCopyWith<$Res> { + _$PollResponseCopyWithImpl(this._self, this._then); + + final PollResponse _self; + final $Res Function(PollResponse) _then; + + /// Create a copy of PollResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? poll = null}) { + return _then( + PollResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + poll: null == poll + ? _self.poll + : poll // ignore: cast_nullable_to_non_nullable + as PollResponseData, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/poll_response.g.dart b/packages/stream_chat/lib/open_api/model/poll_response.g.dart new file mode 100644 index 0000000000..f600f5a1ea --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/poll_response.g.dart @@ -0,0 +1,17 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'poll_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +PollResponse _$PollResponseFromJson(Map json) => PollResponse( + duration: json['duration'] as String, + poll: PollResponseData.fromJson(json['poll'] as Map), +); + +Map _$PollResponseToJson(PollResponse instance) => { + 'duration': instance.duration, + 'poll': instance.poll.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/poll_response_data.dart b/packages/stream_chat/lib/open_api/model/poll_response_data.dart new file mode 100644 index 0000000000..ac1045bb1e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/poll_response_data.dart @@ -0,0 +1,142 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'poll_response_data.g.dart'; +part 'poll_response_data.freezed.dart'; + +extension type const PollResponseDataVotingVisibility._(String _) implements String { + static const anonymous = PollResponseDataVotingVisibility._('anonymous'); + static const public = PollResponseDataVotingVisibility._('public'); + + factory PollResponseDataVotingVisibility.fromJson(String json) => PollResponseDataVotingVisibility._(json); + + String toJson() => this; +} + +@freezed +@immutable +@JsonSerializable() +class PollResponseData with _$PollResponseData { + const PollResponseData({ + required this.allowAnswers, + required this.allowUserSuggestedOptions, + required this.answersCount, + required this.createdAt, + this.createdBy, + required this.createdById, + required this.custom, + required this.description, + required this.enforceUniqueVote, + required this.id, + this.isClosed, + required this.latestAnswers, + required this.latestVotesByOption, + this.maxVotesAllowed, + required this.name, + required this.options, + required this.ownVotes, + required this.updatedAt, + required this.voteCount, + required this.voteCountsByOption, + required this.votingVisibility, + }); + + @override + @JsonKey(name: 'allow_answers') + final bool allowAnswers; + + @override + @JsonKey(name: 'allow_user_suggested_options') + final bool allowUserSuggestedOptions; + + @override + @JsonKey(name: 'answers_count') + final int answersCount; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'created_by') + final UserResponse? createdBy; + + @override + @JsonKey(name: 'created_by_id') + final String createdById; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'description') + final String description; + + @override + @JsonKey(name: 'enforce_unique_vote') + final bool enforceUniqueVote; + + @override + @JsonKey(name: 'id') + final String id; + + @override + @JsonKey(name: 'is_closed') + final bool? isClosed; + + @override + @JsonKey(name: 'latest_answers') + final List latestAnswers; + + @override + @JsonKey(name: 'latest_votes_by_option') + final Map> latestVotesByOption; + + @override + @JsonKey(name: 'max_votes_allowed') + final int? maxVotesAllowed; + + @override + @JsonKey(name: 'name') + final String name; + + @override + @JsonKey(name: 'options') + final List options; + + @override + @JsonKey(name: 'own_votes') + final List ownVotes; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'updated_at') + final DateTime updatedAt; + + @override + @JsonKey(name: 'vote_count') + final int voteCount; + + @override + @JsonKey(name: 'vote_counts_by_option') + final Map voteCountsByOption; + + @override + @JsonKey(name: 'voting_visibility') + final PollResponseDataVotingVisibility votingVisibility; + + Map toJson() => _$PollResponseDataToJson(this); + + static PollResponseData fromJson(Map json) => _$PollResponseDataFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/poll_response_data.freezed.dart b/packages/stream_chat/lib/open_api/model/poll_response_data.freezed.dart new file mode 100644 index 0000000000..eb1a9fb80c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/poll_response_data.freezed.dart @@ -0,0 +1,275 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'poll_response_data.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$PollResponseData { + bool get allowAnswers; + bool get allowUserSuggestedOptions; + int get answersCount; + DateTime get createdAt; + UserResponse? get createdBy; + String get createdById; + Map get custom; + String get description; + bool get enforceUniqueVote; + String get id; + bool? get isClosed; + List get latestAnswers; + Map> get latestVotesByOption; + int? get maxVotesAllowed; + String get name; + List get options; + List get ownVotes; + DateTime get updatedAt; + int get voteCount; + Map get voteCountsByOption; + PollResponseDataVotingVisibility get votingVisibility; + + /// Create a copy of PollResponseData + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $PollResponseDataCopyWith get copyWith => _$PollResponseDataCopyWithImpl( + this as PollResponseData, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is PollResponseData && + (identical(other.allowAnswers, allowAnswers) || other.allowAnswers == allowAnswers) && + (identical( + other.allowUserSuggestedOptions, + allowUserSuggestedOptions, + ) || + other.allowUserSuggestedOptions == allowUserSuggestedOptions) && + (identical(other.answersCount, answersCount) || other.answersCount == answersCount) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.createdBy, createdBy) || other.createdBy == createdBy) && + (identical(other.createdById, createdById) || other.createdById == createdById) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.description, description) || other.description == description) && + (identical(other.enforceUniqueVote, enforceUniqueVote) || other.enforceUniqueVote == enforceUniqueVote) && + (identical(other.id, id) || other.id == id) && + (identical(other.isClosed, isClosed) || other.isClosed == isClosed) && + const DeepCollectionEquality().equals( + other.latestAnswers, + latestAnswers, + ) && + const DeepCollectionEquality().equals( + other.latestVotesByOption, + latestVotesByOption, + ) && + (identical(other.maxVotesAllowed, maxVotesAllowed) || other.maxVotesAllowed == maxVotesAllowed) && + (identical(other.name, name) || other.name == name) && + const DeepCollectionEquality().equals(other.options, options) && + const DeepCollectionEquality().equals(other.ownVotes, ownVotes) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt) && + (identical(other.voteCount, voteCount) || other.voteCount == voteCount) && + const DeepCollectionEquality().equals( + other.voteCountsByOption, + voteCountsByOption, + ) && + (identical(other.votingVisibility, votingVisibility) || other.votingVisibility == votingVisibility)); + } + + @override + int get hashCode => Object.hashAll([ + runtimeType, + allowAnswers, + allowUserSuggestedOptions, + answersCount, + createdAt, + createdBy, + createdById, + const DeepCollectionEquality().hash(custom), + description, + enforceUniqueVote, + id, + isClosed, + const DeepCollectionEquality().hash(latestAnswers), + const DeepCollectionEquality().hash(latestVotesByOption), + maxVotesAllowed, + name, + const DeepCollectionEquality().hash(options), + const DeepCollectionEquality().hash(ownVotes), + updatedAt, + voteCount, + const DeepCollectionEquality().hash(voteCountsByOption), + votingVisibility, + ]); + + @override + String toString() { + return 'PollResponseData(allowAnswers: $allowAnswers, allowUserSuggestedOptions: $allowUserSuggestedOptions, answersCount: $answersCount, createdAt: $createdAt, createdBy: $createdBy, createdById: $createdById, custom: $custom, description: $description, enforceUniqueVote: $enforceUniqueVote, id: $id, isClosed: $isClosed, latestAnswers: $latestAnswers, latestVotesByOption: $latestVotesByOption, maxVotesAllowed: $maxVotesAllowed, name: $name, options: $options, ownVotes: $ownVotes, updatedAt: $updatedAt, voteCount: $voteCount, voteCountsByOption: $voteCountsByOption, votingVisibility: $votingVisibility)'; + } +} + +/// @nodoc +abstract mixin class $PollResponseDataCopyWith<$Res> { + factory $PollResponseDataCopyWith( + PollResponseData value, + $Res Function(PollResponseData) _then, + ) = _$PollResponseDataCopyWithImpl; + @useResult + $Res call({ + bool allowAnswers, + bool allowUserSuggestedOptions, + int answersCount, + DateTime createdAt, + UserResponse? createdBy, + String createdById, + Map custom, + String description, + bool enforceUniqueVote, + String id, + bool? isClosed, + List latestAnswers, + Map> latestVotesByOption, + int? maxVotesAllowed, + String name, + List options, + List ownVotes, + DateTime updatedAt, + int voteCount, + Map voteCountsByOption, + PollResponseDataVotingVisibility votingVisibility, + }); +} + +/// @nodoc +class _$PollResponseDataCopyWithImpl<$Res> implements $PollResponseDataCopyWith<$Res> { + _$PollResponseDataCopyWithImpl(this._self, this._then); + + final PollResponseData _self; + final $Res Function(PollResponseData) _then; + + /// Create a copy of PollResponseData + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? allowAnswers = null, + Object? allowUserSuggestedOptions = null, + Object? answersCount = null, + Object? createdAt = null, + Object? createdBy = freezed, + Object? createdById = null, + Object? custom = null, + Object? description = null, + Object? enforceUniqueVote = null, + Object? id = null, + Object? isClosed = freezed, + Object? latestAnswers = null, + Object? latestVotesByOption = null, + Object? maxVotesAllowed = freezed, + Object? name = null, + Object? options = null, + Object? ownVotes = null, + Object? updatedAt = null, + Object? voteCount = null, + Object? voteCountsByOption = null, + Object? votingVisibility = null, + }) { + return _then( + PollResponseData( + allowAnswers: null == allowAnswers + ? _self.allowAnswers + : allowAnswers // ignore: cast_nullable_to_non_nullable + as bool, + allowUserSuggestedOptions: null == allowUserSuggestedOptions + ? _self.allowUserSuggestedOptions + : allowUserSuggestedOptions // ignore: cast_nullable_to_non_nullable + as bool, + answersCount: null == answersCount + ? _self.answersCount + : answersCount // ignore: cast_nullable_to_non_nullable + as int, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + createdBy: freezed == createdBy + ? _self.createdBy + : createdBy // ignore: cast_nullable_to_non_nullable + as UserResponse?, + createdById: null == createdById + ? _self.createdById + : createdById // ignore: cast_nullable_to_non_nullable + as String, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + description: null == description + ? _self.description + : description // ignore: cast_nullable_to_non_nullable + as String, + enforceUniqueVote: null == enforceUniqueVote + ? _self.enforceUniqueVote + : enforceUniqueVote // ignore: cast_nullable_to_non_nullable + as bool, + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + isClosed: freezed == isClosed + ? _self.isClosed + : isClosed // ignore: cast_nullable_to_non_nullable + as bool?, + latestAnswers: null == latestAnswers + ? _self.latestAnswers + : latestAnswers // ignore: cast_nullable_to_non_nullable + as List, + latestVotesByOption: null == latestVotesByOption + ? _self.latestVotesByOption + : latestVotesByOption // ignore: cast_nullable_to_non_nullable + as Map>, + maxVotesAllowed: freezed == maxVotesAllowed + ? _self.maxVotesAllowed + : maxVotesAllowed // ignore: cast_nullable_to_non_nullable + as int?, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + options: null == options + ? _self.options + : options // ignore: cast_nullable_to_non_nullable + as List, + ownVotes: null == ownVotes + ? _self.ownVotes + : ownVotes // ignore: cast_nullable_to_non_nullable + as List, + updatedAt: null == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + voteCount: null == voteCount + ? _self.voteCount + : voteCount // ignore: cast_nullable_to_non_nullable + as int, + voteCountsByOption: null == voteCountsByOption + ? _self.voteCountsByOption + : voteCountsByOption // ignore: cast_nullable_to_non_nullable + as Map, + votingVisibility: null == votingVisibility + ? _self.votingVisibility + : votingVisibility // ignore: cast_nullable_to_non_nullable + as PollResponseDataVotingVisibility, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/poll_response_data.g.dart b/packages/stream_chat/lib/open_api/model/poll_response_data.g.dart new file mode 100644 index 0000000000..a17be7d7d3 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/poll_response_data.g.dart @@ -0,0 +1,82 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'poll_response_data.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +PollResponseData _$PollResponseDataFromJson( + Map json, +) => PollResponseData( + allowAnswers: json['allow_answers'] as bool, + allowUserSuggestedOptions: json['allow_user_suggested_options'] as bool, + answersCount: (json['answers_count'] as num).toInt(), + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + createdBy: json['created_by'] == null ? null : UserResponse.fromJson(json['created_by'] as Map), + createdById: json['created_by_id'] as String, + custom: json['custom'] as Map, + description: json['description'] as String, + enforceUniqueVote: json['enforce_unique_vote'] as bool, + id: json['id'] as String, + isClosed: json['is_closed'] as bool?, + latestAnswers: (json['latest_answers'] as List) + .map((e) => PollVoteResponseData.fromJson(e as Map)) + .toList(), + latestVotesByOption: (json['latest_votes_by_option'] as Map).map( + (k, e) => MapEntry( + k, + (e as List) + .map( + (e) => PollVoteResponseData.fromJson(e as Map), + ) + .toList(), + ), + ), + maxVotesAllowed: (json['max_votes_allowed'] as num?)?.toInt(), + name: json['name'] as String, + options: (json['options'] as List) + .map((e) => PollOptionResponseData.fromJson(e as Map)) + .toList(), + ownVotes: (json['own_votes'] as List) + .map((e) => PollVoteResponseData.fromJson(e as Map)) + .toList(), + updatedAt: const StreamDateTimeConverter().fromJson( + json['updated_at'] as Object, + ), + voteCount: (json['vote_count'] as num).toInt(), + voteCountsByOption: Map.from( + json['vote_counts_by_option'] as Map, + ), + votingVisibility: PollResponseDataVotingVisibility.fromJson( + json['voting_visibility'] as String, + ), +); + +Map _$PollResponseDataToJson(PollResponseData instance) => { + 'allow_answers': instance.allowAnswers, + 'allow_user_suggested_options': instance.allowUserSuggestedOptions, + 'answers_count': instance.answersCount, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'created_by': instance.createdBy?.toJson(), + 'created_by_id': instance.createdById, + 'custom': instance.custom, + 'description': instance.description, + 'enforce_unique_vote': instance.enforceUniqueVote, + 'id': instance.id, + 'is_closed': instance.isClosed, + 'latest_answers': instance.latestAnswers.map((e) => e.toJson()).toList(), + 'latest_votes_by_option': instance.latestVotesByOption.map( + (k, e) => MapEntry(k, e.map((e) => e.toJson()).toList()), + ), + 'max_votes_allowed': instance.maxVotesAllowed, + 'name': instance.name, + 'options': instance.options.map((e) => e.toJson()).toList(), + 'own_votes': instance.ownVotes.map((e) => e.toJson()).toList(), + 'updated_at': const StreamDateTimeConverter().toJson(instance.updatedAt), + 'vote_count': instance.voteCount, + 'vote_counts_by_option': instance.voteCountsByOption, + 'voting_visibility': instance.votingVisibility.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/poll_updated_event.dart b/packages/stream_chat/lib/open_api/model/poll_updated_event.dart new file mode 100644 index 0000000000..f38eafa933 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/poll_updated_event.dart @@ -0,0 +1,68 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'poll_updated_event.g.dart'; +part 'poll_updated_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class PollUpdatedEvent extends core.WsEvent with _$PollUpdatedEvent { + const PollUpdatedEvent({ + this.activityId, + this.cid, + required this.createdAt, + required this.custom, + this.messageId, + required this.poll, + this.receivedAt, + required this.type, + }); + + @override + @JsonKey(name: 'activity_id') + final String? activityId; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'message_id') + final String? messageId; + + @override + @JsonKey(name: 'poll') + final PollResponseData poll; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'type') + final String type; + + Map toJson() => _$PollUpdatedEventToJson(this); + + static PollUpdatedEvent fromJson(Map json) => _$PollUpdatedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/poll_updated_event.freezed.dart b/packages/stream_chat/lib/open_api/model/poll_updated_event.freezed.dart new file mode 100644 index 0000000000..da40f7f2f2 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/poll_updated_event.freezed.dart @@ -0,0 +1,145 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'poll_updated_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$PollUpdatedEvent { + String? get activityId; + String? get cid; + DateTime get createdAt; + Map get custom; + String? get messageId; + PollResponseData get poll; + DateTime? get receivedAt; + String get type; + + /// Create a copy of PollUpdatedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $PollUpdatedEventCopyWith get copyWith => _$PollUpdatedEventCopyWithImpl( + this as PollUpdatedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is PollUpdatedEvent && + (identical(other.activityId, activityId) || other.activityId == activityId) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.messageId, messageId) || other.messageId == messageId) && + (identical(other.poll, poll) || other.poll == poll) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.type, type) || other.type == type)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + activityId, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + messageId, + poll, + receivedAt, + type, + ); + + @override + String toString() { + return 'PollUpdatedEvent(activityId: $activityId, cid: $cid, createdAt: $createdAt, custom: $custom, messageId: $messageId, poll: $poll, receivedAt: $receivedAt, type: $type)'; + } +} + +/// @nodoc +abstract mixin class $PollUpdatedEventCopyWith<$Res> { + factory $PollUpdatedEventCopyWith( + PollUpdatedEvent value, + $Res Function(PollUpdatedEvent) _then, + ) = _$PollUpdatedEventCopyWithImpl; + @useResult + $Res call({ + String? activityId, + String? cid, + DateTime createdAt, + Map custom, + String? messageId, + PollResponseData poll, + DateTime? receivedAt, + String type, + }); +} + +/// @nodoc +class _$PollUpdatedEventCopyWithImpl<$Res> implements $PollUpdatedEventCopyWith<$Res> { + _$PollUpdatedEventCopyWithImpl(this._self, this._then); + + final PollUpdatedEvent _self; + final $Res Function(PollUpdatedEvent) _then; + + /// Create a copy of PollUpdatedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? activityId = freezed, + Object? cid = freezed, + Object? createdAt = null, + Object? custom = null, + Object? messageId = freezed, + Object? poll = null, + Object? receivedAt = freezed, + Object? type = null, + }) { + return _then( + PollUpdatedEvent( + activityId: freezed == activityId + ? _self.activityId + : activityId // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + messageId: freezed == messageId + ? _self.messageId + : messageId // ignore: cast_nullable_to_non_nullable + as String?, + poll: null == poll + ? _self.poll + : poll // ignore: cast_nullable_to_non_nullable + as PollResponseData, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/poll_updated_event.g.dart b/packages/stream_chat/lib/open_api/model/poll_updated_event.g.dart new file mode 100644 index 0000000000..3e3ae4fdcb --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/poll_updated_event.g.dart @@ -0,0 +1,47 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'poll_updated_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +PollUpdatedEvent _$PollUpdatedEventFromJson(Map json) => PollUpdatedEvent( + activityId: json['activity_id'] as String?, + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + messageId: json['message_id'] as String?, + poll: PollResponseData.fromJson(json['poll'] as Map), + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + type: json['type'] as String, +); + +Map _$PollUpdatedEventToJson(PollUpdatedEvent instance) => { + 'activity_id': instance.activityId, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'message_id': instance.messageId, + 'poll': instance.poll.toJson(), + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'type': instance.type, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/poll_vote_casted_event.dart b/packages/stream_chat/lib/open_api/model/poll_vote_casted_event.dart new file mode 100644 index 0000000000..54acae4a93 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/poll_vote_casted_event.dart @@ -0,0 +1,73 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'poll_vote_casted_event.g.dart'; +part 'poll_vote_casted_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class PollVoteCastedEvent extends core.WsEvent with _$PollVoteCastedEvent { + const PollVoteCastedEvent({ + this.activityId, + this.cid, + required this.createdAt, + required this.custom, + this.messageId, + required this.poll, + required this.pollVote, + this.receivedAt, + required this.type, + }); + + @override + @JsonKey(name: 'activity_id') + final String? activityId; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'message_id') + final String? messageId; + + @override + @JsonKey(name: 'poll') + final PollResponseData poll; + + @override + @JsonKey(name: 'poll_vote') + final PollVoteResponseData pollVote; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'type') + final String type; + + Map toJson() => _$PollVoteCastedEventToJson(this); + + static PollVoteCastedEvent fromJson(Map json) => _$PollVoteCastedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/poll_vote_casted_event.freezed.dart b/packages/stream_chat/lib/open_api/model/poll_vote_casted_event.freezed.dart new file mode 100644 index 0000000000..d7793b53bd --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/poll_vote_casted_event.freezed.dart @@ -0,0 +1,155 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'poll_vote_casted_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$PollVoteCastedEvent { + String? get activityId; + String? get cid; + DateTime get createdAt; + Map get custom; + String? get messageId; + PollResponseData get poll; + PollVoteResponseData get pollVote; + DateTime? get receivedAt; + String get type; + + /// Create a copy of PollVoteCastedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $PollVoteCastedEventCopyWith get copyWith => + _$PollVoteCastedEventCopyWithImpl( + this as PollVoteCastedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is PollVoteCastedEvent && + (identical(other.activityId, activityId) || other.activityId == activityId) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.messageId, messageId) || other.messageId == messageId) && + (identical(other.poll, poll) || other.poll == poll) && + (identical(other.pollVote, pollVote) || other.pollVote == pollVote) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.type, type) || other.type == type)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + activityId, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + messageId, + poll, + pollVote, + receivedAt, + type, + ); + + @override + String toString() { + return 'PollVoteCastedEvent(activityId: $activityId, cid: $cid, createdAt: $createdAt, custom: $custom, messageId: $messageId, poll: $poll, pollVote: $pollVote, receivedAt: $receivedAt, type: $type)'; + } +} + +/// @nodoc +abstract mixin class $PollVoteCastedEventCopyWith<$Res> { + factory $PollVoteCastedEventCopyWith( + PollVoteCastedEvent value, + $Res Function(PollVoteCastedEvent) _then, + ) = _$PollVoteCastedEventCopyWithImpl; + @useResult + $Res call({ + String? activityId, + String? cid, + DateTime createdAt, + Map custom, + String? messageId, + PollResponseData poll, + PollVoteResponseData pollVote, + DateTime? receivedAt, + String type, + }); +} + +/// @nodoc +class _$PollVoteCastedEventCopyWithImpl<$Res> implements $PollVoteCastedEventCopyWith<$Res> { + _$PollVoteCastedEventCopyWithImpl(this._self, this._then); + + final PollVoteCastedEvent _self; + final $Res Function(PollVoteCastedEvent) _then; + + /// Create a copy of PollVoteCastedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? activityId = freezed, + Object? cid = freezed, + Object? createdAt = null, + Object? custom = null, + Object? messageId = freezed, + Object? poll = null, + Object? pollVote = null, + Object? receivedAt = freezed, + Object? type = null, + }) { + return _then( + PollVoteCastedEvent( + activityId: freezed == activityId + ? _self.activityId + : activityId // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + messageId: freezed == messageId + ? _self.messageId + : messageId // ignore: cast_nullable_to_non_nullable + as String?, + poll: null == poll + ? _self.poll + : poll // ignore: cast_nullable_to_non_nullable + as PollResponseData, + pollVote: null == pollVote + ? _self.pollVote + : pollVote // ignore: cast_nullable_to_non_nullable + as PollVoteResponseData, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/poll_vote_casted_event.g.dart b/packages/stream_chat/lib/open_api/model/poll_vote_casted_event.g.dart new file mode 100644 index 0000000000..c3d02b3dd3 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/poll_vote_casted_event.g.dart @@ -0,0 +1,53 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'poll_vote_casted_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +PollVoteCastedEvent _$PollVoteCastedEventFromJson(Map json) => PollVoteCastedEvent( + activityId: json['activity_id'] as String?, + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + messageId: json['message_id'] as String?, + poll: PollResponseData.fromJson(json['poll'] as Map), + pollVote: PollVoteResponseData.fromJson( + json['poll_vote'] as Map, + ), + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + type: json['type'] as String, +); + +Map _$PollVoteCastedEventToJson( + PollVoteCastedEvent instance, +) => { + 'activity_id': instance.activityId, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'message_id': instance.messageId, + 'poll': instance.poll.toJson(), + 'poll_vote': instance.pollVote.toJson(), + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'type': instance.type, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/poll_vote_changed_event.dart b/packages/stream_chat/lib/open_api/model/poll_vote_changed_event.dart new file mode 100644 index 0000000000..7c7132549a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/poll_vote_changed_event.dart @@ -0,0 +1,73 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'poll_vote_changed_event.g.dart'; +part 'poll_vote_changed_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class PollVoteChangedEvent extends core.WsEvent with _$PollVoteChangedEvent { + const PollVoteChangedEvent({ + this.activityId, + this.cid, + required this.createdAt, + required this.custom, + this.messageId, + required this.poll, + required this.pollVote, + this.receivedAt, + required this.type, + }); + + @override + @JsonKey(name: 'activity_id') + final String? activityId; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'message_id') + final String? messageId; + + @override + @JsonKey(name: 'poll') + final PollResponseData poll; + + @override + @JsonKey(name: 'poll_vote') + final PollVoteResponseData pollVote; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'type') + final String type; + + Map toJson() => _$PollVoteChangedEventToJson(this); + + static PollVoteChangedEvent fromJson(Map json) => _$PollVoteChangedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/poll_vote_changed_event.freezed.dart b/packages/stream_chat/lib/open_api/model/poll_vote_changed_event.freezed.dart new file mode 100644 index 0000000000..49c43db6fe --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/poll_vote_changed_event.freezed.dart @@ -0,0 +1,155 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'poll_vote_changed_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$PollVoteChangedEvent { + String? get activityId; + String? get cid; + DateTime get createdAt; + Map get custom; + String? get messageId; + PollResponseData get poll; + PollVoteResponseData get pollVote; + DateTime? get receivedAt; + String get type; + + /// Create a copy of PollVoteChangedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $PollVoteChangedEventCopyWith get copyWith => + _$PollVoteChangedEventCopyWithImpl( + this as PollVoteChangedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is PollVoteChangedEvent && + (identical(other.activityId, activityId) || other.activityId == activityId) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.messageId, messageId) || other.messageId == messageId) && + (identical(other.poll, poll) || other.poll == poll) && + (identical(other.pollVote, pollVote) || other.pollVote == pollVote) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.type, type) || other.type == type)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + activityId, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + messageId, + poll, + pollVote, + receivedAt, + type, + ); + + @override + String toString() { + return 'PollVoteChangedEvent(activityId: $activityId, cid: $cid, createdAt: $createdAt, custom: $custom, messageId: $messageId, poll: $poll, pollVote: $pollVote, receivedAt: $receivedAt, type: $type)'; + } +} + +/// @nodoc +abstract mixin class $PollVoteChangedEventCopyWith<$Res> { + factory $PollVoteChangedEventCopyWith( + PollVoteChangedEvent value, + $Res Function(PollVoteChangedEvent) _then, + ) = _$PollVoteChangedEventCopyWithImpl; + @useResult + $Res call({ + String? activityId, + String? cid, + DateTime createdAt, + Map custom, + String? messageId, + PollResponseData poll, + PollVoteResponseData pollVote, + DateTime? receivedAt, + String type, + }); +} + +/// @nodoc +class _$PollVoteChangedEventCopyWithImpl<$Res> implements $PollVoteChangedEventCopyWith<$Res> { + _$PollVoteChangedEventCopyWithImpl(this._self, this._then); + + final PollVoteChangedEvent _self; + final $Res Function(PollVoteChangedEvent) _then; + + /// Create a copy of PollVoteChangedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? activityId = freezed, + Object? cid = freezed, + Object? createdAt = null, + Object? custom = null, + Object? messageId = freezed, + Object? poll = null, + Object? pollVote = null, + Object? receivedAt = freezed, + Object? type = null, + }) { + return _then( + PollVoteChangedEvent( + activityId: freezed == activityId + ? _self.activityId + : activityId // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + messageId: freezed == messageId + ? _self.messageId + : messageId // ignore: cast_nullable_to_non_nullable + as String?, + poll: null == poll + ? _self.poll + : poll // ignore: cast_nullable_to_non_nullable + as PollResponseData, + pollVote: null == pollVote + ? _self.pollVote + : pollVote // ignore: cast_nullable_to_non_nullable + as PollVoteResponseData, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/poll_vote_changed_event.g.dart b/packages/stream_chat/lib/open_api/model/poll_vote_changed_event.g.dart new file mode 100644 index 0000000000..a5f974b150 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/poll_vote_changed_event.g.dart @@ -0,0 +1,55 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'poll_vote_changed_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +PollVoteChangedEvent _$PollVoteChangedEventFromJson( + Map json, +) => PollVoteChangedEvent( + activityId: json['activity_id'] as String?, + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + messageId: json['message_id'] as String?, + poll: PollResponseData.fromJson(json['poll'] as Map), + pollVote: PollVoteResponseData.fromJson( + json['poll_vote'] as Map, + ), + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + type: json['type'] as String, +); + +Map _$PollVoteChangedEventToJson( + PollVoteChangedEvent instance, +) => { + 'activity_id': instance.activityId, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'message_id': instance.messageId, + 'poll': instance.poll.toJson(), + 'poll_vote': instance.pollVote.toJson(), + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'type': instance.type, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/poll_vote_removed_event.dart b/packages/stream_chat/lib/open_api/model/poll_vote_removed_event.dart new file mode 100644 index 0000000000..0218dc017d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/poll_vote_removed_event.dart @@ -0,0 +1,73 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'poll_vote_removed_event.g.dart'; +part 'poll_vote_removed_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class PollVoteRemovedEvent extends core.WsEvent with _$PollVoteRemovedEvent { + const PollVoteRemovedEvent({ + this.activityId, + this.cid, + required this.createdAt, + required this.custom, + this.messageId, + required this.poll, + required this.pollVote, + this.receivedAt, + required this.type, + }); + + @override + @JsonKey(name: 'activity_id') + final String? activityId; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'message_id') + final String? messageId; + + @override + @JsonKey(name: 'poll') + final PollResponseData poll; + + @override + @JsonKey(name: 'poll_vote') + final PollVoteResponseData pollVote; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'type') + final String type; + + Map toJson() => _$PollVoteRemovedEventToJson(this); + + static PollVoteRemovedEvent fromJson(Map json) => _$PollVoteRemovedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/poll_vote_removed_event.freezed.dart b/packages/stream_chat/lib/open_api/model/poll_vote_removed_event.freezed.dart new file mode 100644 index 0000000000..7e954e4fb5 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/poll_vote_removed_event.freezed.dart @@ -0,0 +1,155 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'poll_vote_removed_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$PollVoteRemovedEvent { + String? get activityId; + String? get cid; + DateTime get createdAt; + Map get custom; + String? get messageId; + PollResponseData get poll; + PollVoteResponseData get pollVote; + DateTime? get receivedAt; + String get type; + + /// Create a copy of PollVoteRemovedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $PollVoteRemovedEventCopyWith get copyWith => + _$PollVoteRemovedEventCopyWithImpl( + this as PollVoteRemovedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is PollVoteRemovedEvent && + (identical(other.activityId, activityId) || other.activityId == activityId) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.messageId, messageId) || other.messageId == messageId) && + (identical(other.poll, poll) || other.poll == poll) && + (identical(other.pollVote, pollVote) || other.pollVote == pollVote) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.type, type) || other.type == type)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + activityId, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + messageId, + poll, + pollVote, + receivedAt, + type, + ); + + @override + String toString() { + return 'PollVoteRemovedEvent(activityId: $activityId, cid: $cid, createdAt: $createdAt, custom: $custom, messageId: $messageId, poll: $poll, pollVote: $pollVote, receivedAt: $receivedAt, type: $type)'; + } +} + +/// @nodoc +abstract mixin class $PollVoteRemovedEventCopyWith<$Res> { + factory $PollVoteRemovedEventCopyWith( + PollVoteRemovedEvent value, + $Res Function(PollVoteRemovedEvent) _then, + ) = _$PollVoteRemovedEventCopyWithImpl; + @useResult + $Res call({ + String? activityId, + String? cid, + DateTime createdAt, + Map custom, + String? messageId, + PollResponseData poll, + PollVoteResponseData pollVote, + DateTime? receivedAt, + String type, + }); +} + +/// @nodoc +class _$PollVoteRemovedEventCopyWithImpl<$Res> implements $PollVoteRemovedEventCopyWith<$Res> { + _$PollVoteRemovedEventCopyWithImpl(this._self, this._then); + + final PollVoteRemovedEvent _self; + final $Res Function(PollVoteRemovedEvent) _then; + + /// Create a copy of PollVoteRemovedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? activityId = freezed, + Object? cid = freezed, + Object? createdAt = null, + Object? custom = null, + Object? messageId = freezed, + Object? poll = null, + Object? pollVote = null, + Object? receivedAt = freezed, + Object? type = null, + }) { + return _then( + PollVoteRemovedEvent( + activityId: freezed == activityId + ? _self.activityId + : activityId // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + messageId: freezed == messageId + ? _self.messageId + : messageId // ignore: cast_nullable_to_non_nullable + as String?, + poll: null == poll + ? _self.poll + : poll // ignore: cast_nullable_to_non_nullable + as PollResponseData, + pollVote: null == pollVote + ? _self.pollVote + : pollVote // ignore: cast_nullable_to_non_nullable + as PollVoteResponseData, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/poll_vote_removed_event.g.dart b/packages/stream_chat/lib/open_api/model/poll_vote_removed_event.g.dart new file mode 100644 index 0000000000..d8fce4405c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/poll_vote_removed_event.g.dart @@ -0,0 +1,55 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'poll_vote_removed_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +PollVoteRemovedEvent _$PollVoteRemovedEventFromJson( + Map json, +) => PollVoteRemovedEvent( + activityId: json['activity_id'] as String?, + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + messageId: json['message_id'] as String?, + poll: PollResponseData.fromJson(json['poll'] as Map), + pollVote: PollVoteResponseData.fromJson( + json['poll_vote'] as Map, + ), + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + type: json['type'] as String, +); + +Map _$PollVoteRemovedEventToJson( + PollVoteRemovedEvent instance, +) => { + 'activity_id': instance.activityId, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'message_id': instance.messageId, + 'poll': instance.poll.toJson(), + 'poll_vote': instance.pollVote.toJson(), + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'type': instance.type, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/poll_vote_response.dart b/packages/stream_chat/lib/open_api/model/poll_vote_response.dart new file mode 100644 index 0000000000..815335daee --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/poll_vote_response.dart @@ -0,0 +1,41 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'poll_vote_response.g.dart'; +part 'poll_vote_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class PollVoteResponse with _$PollVoteResponse { + const PollVoteResponse({ + required this.duration, + this.poll, + this.vote, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'poll') + final PollResponseData? poll; + + @override + @JsonKey(name: 'vote') + final PollVoteResponseData? vote; + + Map toJson() => _$PollVoteResponseToJson(this); + + static PollVoteResponse fromJson(Map json) => _$PollVoteResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/poll_vote_response.freezed.dart b/packages/stream_chat/lib/open_api/model/poll_vote_response.freezed.dart new file mode 100644 index 0000000000..411bc451ad --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/poll_vote_response.freezed.dart @@ -0,0 +1,95 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'poll_vote_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$PollVoteResponse { + String get duration; + PollResponseData? get poll; + PollVoteResponseData? get vote; + + /// Create a copy of PollVoteResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $PollVoteResponseCopyWith get copyWith => _$PollVoteResponseCopyWithImpl( + this as PollVoteResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is PollVoteResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.poll, poll) || other.poll == poll) && + (identical(other.vote, vote) || other.vote == vote)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration, poll, vote); + + @override + String toString() { + return 'PollVoteResponse(duration: $duration, poll: $poll, vote: $vote)'; + } +} + +/// @nodoc +abstract mixin class $PollVoteResponseCopyWith<$Res> { + factory $PollVoteResponseCopyWith( + PollVoteResponse value, + $Res Function(PollVoteResponse) _then, + ) = _$PollVoteResponseCopyWithImpl; + @useResult + $Res call({ + String duration, + PollResponseData? poll, + PollVoteResponseData? vote, + }); +} + +/// @nodoc +class _$PollVoteResponseCopyWithImpl<$Res> implements $PollVoteResponseCopyWith<$Res> { + _$PollVoteResponseCopyWithImpl(this._self, this._then); + + final PollVoteResponse _self; + final $Res Function(PollVoteResponse) _then; + + /// Create a copy of PollVoteResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? duration = null, + Object? poll = freezed, + Object? vote = freezed, + }) { + return _then( + PollVoteResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + poll: freezed == poll + ? _self.poll + : poll // ignore: cast_nullable_to_non_nullable + as PollResponseData?, + vote: freezed == vote + ? _self.vote + : vote // ignore: cast_nullable_to_non_nullable + as PollVoteResponseData?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/poll_vote_response.g.dart b/packages/stream_chat/lib/open_api/model/poll_vote_response.g.dart new file mode 100644 index 0000000000..9ccde5f17b --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/poll_vote_response.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'poll_vote_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +PollVoteResponse _$PollVoteResponseFromJson(Map json) => PollVoteResponse( + duration: json['duration'] as String, + poll: json['poll'] == null ? null : PollResponseData.fromJson(json['poll'] as Map), + vote: json['vote'] == null ? null : PollVoteResponseData.fromJson(json['vote'] as Map), +); + +Map _$PollVoteResponseToJson(PollVoteResponse instance) => { + 'duration': instance.duration, + 'poll': instance.poll?.toJson(), + 'vote': instance.vote?.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/poll_vote_response_data.dart b/packages/stream_chat/lib/open_api/model/poll_vote_response_data.dart new file mode 100644 index 0000000000..13aa781eb0 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/poll_vote_response_data.dart @@ -0,0 +1,73 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'poll_vote_response_data.g.dart'; +part 'poll_vote_response_data.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class PollVoteResponseData with _$PollVoteResponseData { + const PollVoteResponseData({ + this.answerText, + required this.createdAt, + required this.id, + this.isAnswer, + required this.optionId, + required this.pollId, + required this.updatedAt, + this.user, + this.userId, + }); + + @override + @JsonKey(name: 'answer_text') + final String? answerText; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'id') + final String id; + + @override + @JsonKey(name: 'is_answer') + final bool? isAnswer; + + @override + @JsonKey(name: 'option_id') + final String optionId; + + @override + @JsonKey(name: 'poll_id') + final String pollId; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'updated_at') + final DateTime updatedAt; + + @override + @JsonKey(name: 'user') + final UserResponse? user; + + @override + @JsonKey(name: 'user_id') + final String? userId; + + Map toJson() => _$PollVoteResponseDataToJson(this); + + static PollVoteResponseData fromJson(Map json) => _$PollVoteResponseDataFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/poll_vote_response_data.freezed.dart b/packages/stream_chat/lib/open_api/model/poll_vote_response_data.freezed.dart new file mode 100644 index 0000000000..1c522e7b51 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/poll_vote_response_data.freezed.dart @@ -0,0 +1,155 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'poll_vote_response_data.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$PollVoteResponseData { + String? get answerText; + DateTime get createdAt; + String get id; + bool? get isAnswer; + String get optionId; + String get pollId; + DateTime get updatedAt; + UserResponse? get user; + String? get userId; + + /// Create a copy of PollVoteResponseData + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $PollVoteResponseDataCopyWith get copyWith => + _$PollVoteResponseDataCopyWithImpl( + this as PollVoteResponseData, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is PollVoteResponseData && + (identical(other.answerText, answerText) || other.answerText == answerText) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.id, id) || other.id == id) && + (identical(other.isAnswer, isAnswer) || other.isAnswer == isAnswer) && + (identical(other.optionId, optionId) || other.optionId == optionId) && + (identical(other.pollId, pollId) || other.pollId == pollId) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt) && + (identical(other.user, user) || other.user == user) && + (identical(other.userId, userId) || other.userId == userId)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + answerText, + createdAt, + id, + isAnswer, + optionId, + pollId, + updatedAt, + user, + userId, + ); + + @override + String toString() { + return 'PollVoteResponseData(answerText: $answerText, createdAt: $createdAt, id: $id, isAnswer: $isAnswer, optionId: $optionId, pollId: $pollId, updatedAt: $updatedAt, user: $user, userId: $userId)'; + } +} + +/// @nodoc +abstract mixin class $PollVoteResponseDataCopyWith<$Res> { + factory $PollVoteResponseDataCopyWith( + PollVoteResponseData value, + $Res Function(PollVoteResponseData) _then, + ) = _$PollVoteResponseDataCopyWithImpl; + @useResult + $Res call({ + String? answerText, + DateTime createdAt, + String id, + bool? isAnswer, + String optionId, + String pollId, + DateTime updatedAt, + UserResponse? user, + String? userId, + }); +} + +/// @nodoc +class _$PollVoteResponseDataCopyWithImpl<$Res> implements $PollVoteResponseDataCopyWith<$Res> { + _$PollVoteResponseDataCopyWithImpl(this._self, this._then); + + final PollVoteResponseData _self; + final $Res Function(PollVoteResponseData) _then; + + /// Create a copy of PollVoteResponseData + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? answerText = freezed, + Object? createdAt = null, + Object? id = null, + Object? isAnswer = freezed, + Object? optionId = null, + Object? pollId = null, + Object? updatedAt = null, + Object? user = freezed, + Object? userId = freezed, + }) { + return _then( + PollVoteResponseData( + answerText: freezed == answerText + ? _self.answerText + : answerText // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + isAnswer: freezed == isAnswer + ? _self.isAnswer + : isAnswer // ignore: cast_nullable_to_non_nullable + as bool?, + optionId: null == optionId + ? _self.optionId + : optionId // ignore: cast_nullable_to_non_nullable + as String, + pollId: null == pollId + ? _self.pollId + : pollId // ignore: cast_nullable_to_non_nullable + as String, + updatedAt: null == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponse?, + userId: freezed == userId + ? _self.userId + : userId // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/poll_vote_response_data.g.dart b/packages/stream_chat/lib/open_api/model/poll_vote_response_data.g.dart new file mode 100644 index 0000000000..df2a6eaa95 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/poll_vote_response_data.g.dart @@ -0,0 +1,39 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'poll_vote_response_data.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +PollVoteResponseData _$PollVoteResponseDataFromJson( + Map json, +) => PollVoteResponseData( + answerText: json['answer_text'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + id: json['id'] as String, + isAnswer: json['is_answer'] as bool?, + optionId: json['option_id'] as String, + pollId: json['poll_id'] as String, + updatedAt: const StreamDateTimeConverter().fromJson( + json['updated_at'] as Object, + ), + user: json['user'] == null ? null : UserResponse.fromJson(json['user'] as Map), + userId: json['user_id'] as String?, +); + +Map _$PollVoteResponseDataToJson( + PollVoteResponseData instance, +) => { + 'answer_text': instance.answerText, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'id': instance.id, + 'is_answer': instance.isAnswer, + 'option_id': instance.optionId, + 'poll_id': instance.pollId, + 'updated_at': const StreamDateTimeConverter().toJson(instance.updatedAt), + 'user': instance.user?.toJson(), + 'user_id': instance.userId, +}; diff --git a/packages/stream_chat/lib/open_api/model/poll_votes_response.dart b/packages/stream_chat/lib/open_api/model/poll_votes_response.dart new file mode 100644 index 0000000000..bdf6fbd0b9 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/poll_votes_response.dart @@ -0,0 +1,46 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'poll_votes_response.g.dart'; +part 'poll_votes_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class PollVotesResponse with _$PollVotesResponse { + const PollVotesResponse({ + required this.duration, + this.next, + this.prev, + required this.votes, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'next') + final String? next; + + @override + @JsonKey(name: 'prev') + final String? prev; + + @override + @JsonKey(name: 'votes') + final List votes; + + Map toJson() => _$PollVotesResponseToJson(this); + + static PollVotesResponse fromJson(Map json) => _$PollVotesResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/poll_votes_response.freezed.dart b/packages/stream_chat/lib/open_api/model/poll_votes_response.freezed.dart new file mode 100644 index 0000000000..2cc7bb1775 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/poll_votes_response.freezed.dart @@ -0,0 +1,109 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'poll_votes_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$PollVotesResponse { + String get duration; + String? get next; + String? get prev; + List get votes; + + /// Create a copy of PollVotesResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $PollVotesResponseCopyWith get copyWith => _$PollVotesResponseCopyWithImpl( + this as PollVotesResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is PollVotesResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.next, next) || other.next == next) && + (identical(other.prev, prev) || other.prev == prev) && + const DeepCollectionEquality().equals(other.votes, votes)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + duration, + next, + prev, + const DeepCollectionEquality().hash(votes), + ); + + @override + String toString() { + return 'PollVotesResponse(duration: $duration, next: $next, prev: $prev, votes: $votes)'; + } +} + +/// @nodoc +abstract mixin class $PollVotesResponseCopyWith<$Res> { + factory $PollVotesResponseCopyWith( + PollVotesResponse value, + $Res Function(PollVotesResponse) _then, + ) = _$PollVotesResponseCopyWithImpl; + @useResult + $Res call({ + String duration, + String? next, + String? prev, + List votes, + }); +} + +/// @nodoc +class _$PollVotesResponseCopyWithImpl<$Res> implements $PollVotesResponseCopyWith<$Res> { + _$PollVotesResponseCopyWithImpl(this._self, this._then); + + final PollVotesResponse _self; + final $Res Function(PollVotesResponse) _then; + + /// Create a copy of PollVotesResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? duration = null, + Object? next = freezed, + Object? prev = freezed, + Object? votes = null, + }) { + return _then( + PollVotesResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + next: freezed == next + ? _self.next + : next // ignore: cast_nullable_to_non_nullable + as String?, + prev: freezed == prev + ? _self.prev + : prev // ignore: cast_nullable_to_non_nullable + as String?, + votes: null == votes + ? _self.votes + : votes // ignore: cast_nullable_to_non_nullable + as List, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/poll_votes_response.g.dart b/packages/stream_chat/lib/open_api/model/poll_votes_response.g.dart new file mode 100644 index 0000000000..78676909af --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/poll_votes_response.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'poll_votes_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +PollVotesResponse _$PollVotesResponseFromJson(Map json) => PollVotesResponse( + duration: json['duration'] as String, + next: json['next'] as String?, + prev: json['prev'] as String?, + votes: (json['votes'] as List).map((e) => PollVoteResponseData.fromJson(e as Map)).toList(), +); + +Map _$PollVotesResponseToJson(PollVotesResponse instance) => { + 'duration': instance.duration, + 'next': instance.next, + 'prev': instance.prev, + 'votes': instance.votes.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/privacy_settings_response.dart b/packages/stream_chat/lib/open_api/model/privacy_settings_response.dart new file mode 100644 index 0000000000..5ec839a1e2 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/privacy_settings_response.dart @@ -0,0 +1,41 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'privacy_settings_response.g.dart'; +part 'privacy_settings_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class PrivacySettingsResponse with _$PrivacySettingsResponse { + const PrivacySettingsResponse({ + this.deliveryReceipts, + this.readReceipts, + this.typingIndicators, + }); + + @override + @JsonKey(name: 'delivery_receipts') + final DeliveryReceiptsResponse? deliveryReceipts; + + @override + @JsonKey(name: 'read_receipts') + final ReadReceiptsResponse? readReceipts; + + @override + @JsonKey(name: 'typing_indicators') + final TypingIndicatorsResponse? typingIndicators; + + Map toJson() => _$PrivacySettingsResponseToJson(this); + + static PrivacySettingsResponse fromJson(Map json) => _$PrivacySettingsResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/privacy_settings_response.freezed.dart b/packages/stream_chat/lib/open_api/model/privacy_settings_response.freezed.dart new file mode 100644 index 0000000000..4c1e3dc857 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/privacy_settings_response.freezed.dart @@ -0,0 +1,101 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'privacy_settings_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$PrivacySettingsResponse { + DeliveryReceiptsResponse? get deliveryReceipts; + ReadReceiptsResponse? get readReceipts; + TypingIndicatorsResponse? get typingIndicators; + + /// Create a copy of PrivacySettingsResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $PrivacySettingsResponseCopyWith get copyWith => + _$PrivacySettingsResponseCopyWithImpl( + this as PrivacySettingsResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is PrivacySettingsResponse && + (identical(other.deliveryReceipts, deliveryReceipts) || other.deliveryReceipts == deliveryReceipts) && + (identical(other.readReceipts, readReceipts) || other.readReceipts == readReceipts) && + (identical(other.typingIndicators, typingIndicators) || other.typingIndicators == typingIndicators)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + deliveryReceipts, + readReceipts, + typingIndicators, + ); + + @override + String toString() { + return 'PrivacySettingsResponse(deliveryReceipts: $deliveryReceipts, readReceipts: $readReceipts, typingIndicators: $typingIndicators)'; + } +} + +/// @nodoc +abstract mixin class $PrivacySettingsResponseCopyWith<$Res> { + factory $PrivacySettingsResponseCopyWith( + PrivacySettingsResponse value, + $Res Function(PrivacySettingsResponse) _then, + ) = _$PrivacySettingsResponseCopyWithImpl; + @useResult + $Res call({ + DeliveryReceiptsResponse? deliveryReceipts, + ReadReceiptsResponse? readReceipts, + TypingIndicatorsResponse? typingIndicators, + }); +} + +/// @nodoc +class _$PrivacySettingsResponseCopyWithImpl<$Res> implements $PrivacySettingsResponseCopyWith<$Res> { + _$PrivacySettingsResponseCopyWithImpl(this._self, this._then); + + final PrivacySettingsResponse _self; + final $Res Function(PrivacySettingsResponse) _then; + + /// Create a copy of PrivacySettingsResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? deliveryReceipts = freezed, + Object? readReceipts = freezed, + Object? typingIndicators = freezed, + }) { + return _then( + PrivacySettingsResponse( + deliveryReceipts: freezed == deliveryReceipts + ? _self.deliveryReceipts + : deliveryReceipts // ignore: cast_nullable_to_non_nullable + as DeliveryReceiptsResponse?, + readReceipts: freezed == readReceipts + ? _self.readReceipts + : readReceipts // ignore: cast_nullable_to_non_nullable + as ReadReceiptsResponse?, + typingIndicators: freezed == typingIndicators + ? _self.typingIndicators + : typingIndicators // ignore: cast_nullable_to_non_nullable + as TypingIndicatorsResponse?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/privacy_settings_response.g.dart b/packages/stream_chat/lib/open_api/model/privacy_settings_response.g.dart new file mode 100644 index 0000000000..1d43b7bbc3 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/privacy_settings_response.g.dart @@ -0,0 +1,35 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'privacy_settings_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +PrivacySettingsResponse _$PrivacySettingsResponseFromJson( + Map json, +) => PrivacySettingsResponse( + deliveryReceipts: json['delivery_receipts'] == null + ? null + : DeliveryReceiptsResponse.fromJson( + json['delivery_receipts'] as Map, + ), + readReceipts: json['read_receipts'] == null + ? null + : ReadReceiptsResponse.fromJson( + json['read_receipts'] as Map, + ), + typingIndicators: json['typing_indicators'] == null + ? null + : TypingIndicatorsResponse.fromJson( + json['typing_indicators'] as Map, + ), +); + +Map _$PrivacySettingsResponseToJson( + PrivacySettingsResponse instance, +) => { + 'delivery_receipts': instance.deliveryReceipts?.toJson(), + 'read_receipts': instance.readReceipts?.toJson(), + 'typing_indicators': instance.typingIndicators?.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/push_preference_input.dart b/packages/stream_chat/lib/open_api/model/push_preference_input.dart new file mode 100644 index 0000000000..5c10b6a5dd --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/push_preference_input.dart @@ -0,0 +1,105 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'push_preference_input.g.dart'; +part 'push_preference_input.freezed.dart'; + +extension type const PushPreferenceInputCallLevel._(String _) implements String { + static const all = PushPreferenceInputCallLevel._('all'); + static const default_ = PushPreferenceInputCallLevel._('default'); + static const none = PushPreferenceInputCallLevel._('none'); + + factory PushPreferenceInputCallLevel.fromJson(String json) => PushPreferenceInputCallLevel._(json); + + String toJson() => this; +} + +extension type const PushPreferenceInputChatLevel._(String _) implements String { + static const all = PushPreferenceInputChatLevel._('all'); + static const allMentions = PushPreferenceInputChatLevel._('all_mentions'); + static const default_ = PushPreferenceInputChatLevel._('default'); + static const directMentions = PushPreferenceInputChatLevel._('direct_mentions'); + static const mentions = PushPreferenceInputChatLevel._('mentions'); + static const none = PushPreferenceInputChatLevel._('none'); + + factory PushPreferenceInputChatLevel.fromJson(String json) => PushPreferenceInputChatLevel._(json); + + String toJson() => this; +} + +extension type const PushPreferenceInputFeedsLevel._(String _) implements String { + static const all = PushPreferenceInputFeedsLevel._('all'); + static const default_ = PushPreferenceInputFeedsLevel._('default'); + static const none = PushPreferenceInputFeedsLevel._('none'); + + factory PushPreferenceInputFeedsLevel.fromJson(String json) => PushPreferenceInputFeedsLevel._(json); + + String toJson() => this; +} + +@freezed +@immutable +@JsonSerializable() +class PushPreferenceInput with _$PushPreferenceInput { + const PushPreferenceInput({ + this.callLevel, + this.channelCid, + this.chatLevel, + this.chatPreferences, + this.disabledUntil, + this.feedsLevel, + this.feedsPreferences, + this.removeDisable, + this.userId, + }); + + @override + @JsonKey(name: 'call_level') + final PushPreferenceInputCallLevel? callLevel; + + @override + @JsonKey(name: 'channel_cid') + final String? channelCid; + + @override + @JsonKey(name: 'chat_level') + final PushPreferenceInputChatLevel? chatLevel; + + @override + @JsonKey(name: 'chat_preferences') + final ChatPreferencesInput? chatPreferences; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'disabled_until') + final DateTime? disabledUntil; + + @override + @JsonKey(name: 'feeds_level') + final PushPreferenceInputFeedsLevel? feedsLevel; + + @override + @JsonKey(name: 'feeds_preferences') + final FeedsPreferences? feedsPreferences; + + @override + @JsonKey(name: 'remove_disable') + final bool? removeDisable; + + @override + @JsonKey(name: 'user_id') + final String? userId; + + Map toJson() => _$PushPreferenceInputToJson(this); + + static PushPreferenceInput fromJson(Map json) => _$PushPreferenceInputFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/push_preference_input.freezed.dart b/packages/stream_chat/lib/open_api/model/push_preference_input.freezed.dart new file mode 100644 index 0000000000..49562bd438 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/push_preference_input.freezed.dart @@ -0,0 +1,155 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'push_preference_input.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$PushPreferenceInput { + PushPreferenceInputCallLevel? get callLevel; + String? get channelCid; + PushPreferenceInputChatLevel? get chatLevel; + ChatPreferencesInput? get chatPreferences; + DateTime? get disabledUntil; + PushPreferenceInputFeedsLevel? get feedsLevel; + FeedsPreferences? get feedsPreferences; + bool? get removeDisable; + String? get userId; + + /// Create a copy of PushPreferenceInput + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $PushPreferenceInputCopyWith get copyWith => + _$PushPreferenceInputCopyWithImpl( + this as PushPreferenceInput, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is PushPreferenceInput && + (identical(other.callLevel, callLevel) || other.callLevel == callLevel) && + (identical(other.channelCid, channelCid) || other.channelCid == channelCid) && + (identical(other.chatLevel, chatLevel) || other.chatLevel == chatLevel) && + (identical(other.chatPreferences, chatPreferences) || other.chatPreferences == chatPreferences) && + (identical(other.disabledUntil, disabledUntil) || other.disabledUntil == disabledUntil) && + (identical(other.feedsLevel, feedsLevel) || other.feedsLevel == feedsLevel) && + (identical(other.feedsPreferences, feedsPreferences) || other.feedsPreferences == feedsPreferences) && + (identical(other.removeDisable, removeDisable) || other.removeDisable == removeDisable) && + (identical(other.userId, userId) || other.userId == userId)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + callLevel, + channelCid, + chatLevel, + chatPreferences, + disabledUntil, + feedsLevel, + feedsPreferences, + removeDisable, + userId, + ); + + @override + String toString() { + return 'PushPreferenceInput(callLevel: $callLevel, channelCid: $channelCid, chatLevel: $chatLevel, chatPreferences: $chatPreferences, disabledUntil: $disabledUntil, feedsLevel: $feedsLevel, feedsPreferences: $feedsPreferences, removeDisable: $removeDisable, userId: $userId)'; + } +} + +/// @nodoc +abstract mixin class $PushPreferenceInputCopyWith<$Res> { + factory $PushPreferenceInputCopyWith( + PushPreferenceInput value, + $Res Function(PushPreferenceInput) _then, + ) = _$PushPreferenceInputCopyWithImpl; + @useResult + $Res call({ + PushPreferenceInputCallLevel? callLevel, + String? channelCid, + PushPreferenceInputChatLevel? chatLevel, + ChatPreferencesInput? chatPreferences, + DateTime? disabledUntil, + PushPreferenceInputFeedsLevel? feedsLevel, + FeedsPreferences? feedsPreferences, + bool? removeDisable, + String? userId, + }); +} + +/// @nodoc +class _$PushPreferenceInputCopyWithImpl<$Res> implements $PushPreferenceInputCopyWith<$Res> { + _$PushPreferenceInputCopyWithImpl(this._self, this._then); + + final PushPreferenceInput _self; + final $Res Function(PushPreferenceInput) _then; + + /// Create a copy of PushPreferenceInput + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? callLevel = freezed, + Object? channelCid = freezed, + Object? chatLevel = freezed, + Object? chatPreferences = freezed, + Object? disabledUntil = freezed, + Object? feedsLevel = freezed, + Object? feedsPreferences = freezed, + Object? removeDisable = freezed, + Object? userId = freezed, + }) { + return _then( + PushPreferenceInput( + callLevel: freezed == callLevel + ? _self.callLevel + : callLevel // ignore: cast_nullable_to_non_nullable + as PushPreferenceInputCallLevel?, + channelCid: freezed == channelCid + ? _self.channelCid + : channelCid // ignore: cast_nullable_to_non_nullable + as String?, + chatLevel: freezed == chatLevel + ? _self.chatLevel + : chatLevel // ignore: cast_nullable_to_non_nullable + as PushPreferenceInputChatLevel?, + chatPreferences: freezed == chatPreferences + ? _self.chatPreferences + : chatPreferences // ignore: cast_nullable_to_non_nullable + as ChatPreferencesInput?, + disabledUntil: freezed == disabledUntil + ? _self.disabledUntil + : disabledUntil // ignore: cast_nullable_to_non_nullable + as DateTime?, + feedsLevel: freezed == feedsLevel + ? _self.feedsLevel + : feedsLevel // ignore: cast_nullable_to_non_nullable + as PushPreferenceInputFeedsLevel?, + feedsPreferences: freezed == feedsPreferences + ? _self.feedsPreferences + : feedsPreferences // ignore: cast_nullable_to_non_nullable + as FeedsPreferences?, + removeDisable: freezed == removeDisable + ? _self.removeDisable + : removeDisable // ignore: cast_nullable_to_non_nullable + as bool?, + userId: freezed == userId + ? _self.userId + : userId // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/push_preference_input.g.dart b/packages/stream_chat/lib/open_api/model/push_preference_input.g.dart new file mode 100644 index 0000000000..6cb182a91a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/push_preference_input.g.dart @@ -0,0 +1,61 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'push_preference_input.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +PushPreferenceInput _$PushPreferenceInputFromJson(Map json) => PushPreferenceInput( + callLevel: json['call_level'] == null ? null : PushPreferenceInputCallLevel.fromJson(json['call_level'] as String), + channelCid: json['channel_cid'] as String?, + chatLevel: json['chat_level'] == null ? null : PushPreferenceInputChatLevel.fromJson(json['chat_level'] as String), + chatPreferences: json['chat_preferences'] == null + ? null + : ChatPreferencesInput.fromJson( + json['chat_preferences'] as Map, + ), + disabledUntil: _$JsonConverterFromJson( + json['disabled_until'], + const StreamDateTimeConverter().fromJson, + ), + feedsLevel: json['feeds_level'] == null + ? null + : PushPreferenceInputFeedsLevel.fromJson( + json['feeds_level'] as String, + ), + feedsPreferences: json['feeds_preferences'] == null + ? null + : FeedsPreferences.fromJson( + json['feeds_preferences'] as Map, + ), + removeDisable: json['remove_disable'] as bool?, + userId: json['user_id'] as String?, +); + +Map _$PushPreferenceInputToJson( + PushPreferenceInput instance, +) => { + 'call_level': instance.callLevel?.toJson(), + 'channel_cid': instance.channelCid, + 'chat_level': instance.chatLevel?.toJson(), + 'chat_preferences': instance.chatPreferences?.toJson(), + 'disabled_until': _$JsonConverterToJson( + instance.disabledUntil, + const StreamDateTimeConverter().toJson, + ), + 'feeds_level': instance.feedsLevel?.toJson(), + 'feeds_preferences': instance.feedsPreferences?.toJson(), + 'remove_disable': instance.removeDisable, + 'user_id': instance.userId, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/push_preferences_response.dart b/packages/stream_chat/lib/open_api/model/push_preferences_response.dart new file mode 100644 index 0000000000..f6f7e5b5af --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/push_preferences_response.dart @@ -0,0 +1,57 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'push_preferences_response.g.dart'; +part 'push_preferences_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class PushPreferencesResponse with _$PushPreferencesResponse { + const PushPreferencesResponse({ + this.callLevel, + this.chatLevel, + this.chatPreferences, + this.disabledUntil, + this.feedsLevel, + this.feedsPreferences, + }); + + @override + @JsonKey(name: 'call_level') + final String? callLevel; + + @override + @JsonKey(name: 'chat_level') + final String? chatLevel; + + @override + @JsonKey(name: 'chat_preferences') + final ChatPreferencesResponse? chatPreferences; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'disabled_until') + final DateTime? disabledUntil; + + @override + @JsonKey(name: 'feeds_level') + final String? feedsLevel; + + @override + @JsonKey(name: 'feeds_preferences') + final FeedsPreferencesResponse? feedsPreferences; + + Map toJson() => _$PushPreferencesResponseToJson(this); + + static PushPreferencesResponse fromJson(Map json) => _$PushPreferencesResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/push_preferences_response.freezed.dart b/packages/stream_chat/lib/open_api/model/push_preferences_response.freezed.dart new file mode 100644 index 0000000000..10266ee516 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/push_preferences_response.freezed.dart @@ -0,0 +1,128 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'push_preferences_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$PushPreferencesResponse { + String? get callLevel; + String? get chatLevel; + ChatPreferencesResponse? get chatPreferences; + DateTime? get disabledUntil; + String? get feedsLevel; + FeedsPreferencesResponse? get feedsPreferences; + + /// Create a copy of PushPreferencesResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $PushPreferencesResponseCopyWith get copyWith => + _$PushPreferencesResponseCopyWithImpl( + this as PushPreferencesResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is PushPreferencesResponse && + (identical(other.callLevel, callLevel) || other.callLevel == callLevel) && + (identical(other.chatLevel, chatLevel) || other.chatLevel == chatLevel) && + (identical(other.chatPreferences, chatPreferences) || other.chatPreferences == chatPreferences) && + (identical(other.disabledUntil, disabledUntil) || other.disabledUntil == disabledUntil) && + (identical(other.feedsLevel, feedsLevel) || other.feedsLevel == feedsLevel) && + (identical(other.feedsPreferences, feedsPreferences) || other.feedsPreferences == feedsPreferences)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + callLevel, + chatLevel, + chatPreferences, + disabledUntil, + feedsLevel, + feedsPreferences, + ); + + @override + String toString() { + return 'PushPreferencesResponse(callLevel: $callLevel, chatLevel: $chatLevel, chatPreferences: $chatPreferences, disabledUntil: $disabledUntil, feedsLevel: $feedsLevel, feedsPreferences: $feedsPreferences)'; + } +} + +/// @nodoc +abstract mixin class $PushPreferencesResponseCopyWith<$Res> { + factory $PushPreferencesResponseCopyWith( + PushPreferencesResponse value, + $Res Function(PushPreferencesResponse) _then, + ) = _$PushPreferencesResponseCopyWithImpl; + @useResult + $Res call({ + String? callLevel, + String? chatLevel, + ChatPreferencesResponse? chatPreferences, + DateTime? disabledUntil, + String? feedsLevel, + FeedsPreferencesResponse? feedsPreferences, + }); +} + +/// @nodoc +class _$PushPreferencesResponseCopyWithImpl<$Res> implements $PushPreferencesResponseCopyWith<$Res> { + _$PushPreferencesResponseCopyWithImpl(this._self, this._then); + + final PushPreferencesResponse _self; + final $Res Function(PushPreferencesResponse) _then; + + /// Create a copy of PushPreferencesResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? callLevel = freezed, + Object? chatLevel = freezed, + Object? chatPreferences = freezed, + Object? disabledUntil = freezed, + Object? feedsLevel = freezed, + Object? feedsPreferences = freezed, + }) { + return _then( + PushPreferencesResponse( + callLevel: freezed == callLevel + ? _self.callLevel + : callLevel // ignore: cast_nullable_to_non_nullable + as String?, + chatLevel: freezed == chatLevel + ? _self.chatLevel + : chatLevel // ignore: cast_nullable_to_non_nullable + as String?, + chatPreferences: freezed == chatPreferences + ? _self.chatPreferences + : chatPreferences // ignore: cast_nullable_to_non_nullable + as ChatPreferencesResponse?, + disabledUntil: freezed == disabledUntil + ? _self.disabledUntil + : disabledUntil // ignore: cast_nullable_to_non_nullable + as DateTime?, + feedsLevel: freezed == feedsLevel + ? _self.feedsLevel + : feedsLevel // ignore: cast_nullable_to_non_nullable + as String?, + feedsPreferences: freezed == feedsPreferences + ? _self.feedsPreferences + : feedsPreferences // ignore: cast_nullable_to_non_nullable + as FeedsPreferencesResponse?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/push_preferences_response.g.dart b/packages/stream_chat/lib/open_api/model/push_preferences_response.g.dart new file mode 100644 index 0000000000..e79b636259 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/push_preferences_response.g.dart @@ -0,0 +1,53 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'push_preferences_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +PushPreferencesResponse _$PushPreferencesResponseFromJson( + Map json, +) => PushPreferencesResponse( + callLevel: json['call_level'] as String?, + chatLevel: json['chat_level'] as String?, + chatPreferences: json['chat_preferences'] == null + ? null + : ChatPreferencesResponse.fromJson( + json['chat_preferences'] as Map, + ), + disabledUntil: _$JsonConverterFromJson( + json['disabled_until'], + const StreamDateTimeConverter().fromJson, + ), + feedsLevel: json['feeds_level'] as String?, + feedsPreferences: json['feeds_preferences'] == null + ? null + : FeedsPreferencesResponse.fromJson( + json['feeds_preferences'] as Map, + ), +); + +Map _$PushPreferencesResponseToJson( + PushPreferencesResponse instance, +) => { + 'call_level': instance.callLevel, + 'chat_level': instance.chatLevel, + 'chat_preferences': instance.chatPreferences?.toJson(), + 'disabled_until': _$JsonConverterToJson( + instance.disabledUntil, + const StreamDateTimeConverter().toJson, + ), + 'feeds_level': instance.feedsLevel, + 'feeds_preferences': instance.feedsPreferences?.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/query_appeals_request.dart b/packages/stream_chat/lib/open_api/model/query_appeals_request.dart new file mode 100644 index 0000000000..bd56b76061 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_appeals_request.dart @@ -0,0 +1,51 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'query_appeals_request.g.dart'; +part 'query_appeals_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class QueryAppealsRequest with _$QueryAppealsRequest { + const QueryAppealsRequest({ + this.filter, + this.limit, + this.next, + this.prev, + this.sort, + }); + + @override + @JsonKey(name: 'filter') + final Map? filter; + + @override + @JsonKey(name: 'limit') + final int? limit; + + @override + @JsonKey(name: 'next') + final String? next; + + @override + @JsonKey(name: 'prev') + final String? prev; + + @override + @JsonKey(name: 'sort') + final List? sort; + + Map toJson() => _$QueryAppealsRequestToJson(this); + + static QueryAppealsRequest fromJson(Map json) => _$QueryAppealsRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/query_appeals_request.freezed.dart b/packages/stream_chat/lib/open_api/model/query_appeals_request.freezed.dart new file mode 100644 index 0000000000..5fcffee0a2 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_appeals_request.freezed.dart @@ -0,0 +1,119 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'query_appeals_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$QueryAppealsRequest { + Map? get filter; + int? get limit; + String? get next; + String? get prev; + List? get sort; + + /// Create a copy of QueryAppealsRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $QueryAppealsRequestCopyWith get copyWith => + _$QueryAppealsRequestCopyWithImpl( + this as QueryAppealsRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is QueryAppealsRequest && + const DeepCollectionEquality().equals(other.filter, filter) && + (identical(other.limit, limit) || other.limit == limit) && + (identical(other.next, next) || other.next == next) && + (identical(other.prev, prev) || other.prev == prev) && + const DeepCollectionEquality().equals(other.sort, sort)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(filter), + limit, + next, + prev, + const DeepCollectionEquality().hash(sort), + ); + + @override + String toString() { + return 'QueryAppealsRequest(filter: $filter, limit: $limit, next: $next, prev: $prev, sort: $sort)'; + } +} + +/// @nodoc +abstract mixin class $QueryAppealsRequestCopyWith<$Res> { + factory $QueryAppealsRequestCopyWith( + QueryAppealsRequest value, + $Res Function(QueryAppealsRequest) _then, + ) = _$QueryAppealsRequestCopyWithImpl; + @useResult + $Res call({ + Map? filter, + int? limit, + String? next, + String? prev, + List? sort, + }); +} + +/// @nodoc +class _$QueryAppealsRequestCopyWithImpl<$Res> implements $QueryAppealsRequestCopyWith<$Res> { + _$QueryAppealsRequestCopyWithImpl(this._self, this._then); + + final QueryAppealsRequest _self; + final $Res Function(QueryAppealsRequest) _then; + + /// Create a copy of QueryAppealsRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? filter = freezed, + Object? limit = freezed, + Object? next = freezed, + Object? prev = freezed, + Object? sort = freezed, + }) { + return _then( + QueryAppealsRequest( + filter: freezed == filter + ? _self.filter + : filter // ignore: cast_nullable_to_non_nullable + as Map?, + limit: freezed == limit + ? _self.limit + : limit // ignore: cast_nullable_to_non_nullable + as int?, + next: freezed == next + ? _self.next + : next // ignore: cast_nullable_to_non_nullable + as String?, + prev: freezed == prev + ? _self.prev + : prev // ignore: cast_nullable_to_non_nullable + as String?, + sort: freezed == sort + ? _self.sort + : sort // ignore: cast_nullable_to_non_nullable + as List?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/query_appeals_request.g.dart b/packages/stream_chat/lib/open_api/model/query_appeals_request.g.dart new file mode 100644 index 0000000000..c7e6d67e6a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_appeals_request.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'query_appeals_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +QueryAppealsRequest _$QueryAppealsRequestFromJson(Map json) => QueryAppealsRequest( + filter: json['filter'] as Map?, + limit: (json['limit'] as num?)?.toInt(), + next: json['next'] as String?, + prev: json['prev'] as String?, + sort: (json['sort'] as List?)?.map((e) => SortParamRequest.fromJson(e as Map)).toList(), +); + +Map _$QueryAppealsRequestToJson( + QueryAppealsRequest instance, +) => { + 'filter': instance.filter, + 'limit': instance.limit, + 'next': instance.next, + 'prev': instance.prev, + 'sort': instance.sort?.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/query_appeals_response.dart b/packages/stream_chat/lib/open_api/model/query_appeals_response.dart new file mode 100644 index 0000000000..11a34755f4 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_appeals_response.dart @@ -0,0 +1,46 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'query_appeals_response.g.dart'; +part 'query_appeals_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class QueryAppealsResponse with _$QueryAppealsResponse { + const QueryAppealsResponse({ + required this.duration, + required this.items, + this.next, + this.prev, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'items') + final List items; + + @override + @JsonKey(name: 'next') + final String? next; + + @override + @JsonKey(name: 'prev') + final String? prev; + + Map toJson() => _$QueryAppealsResponseToJson(this); + + static QueryAppealsResponse fromJson(Map json) => _$QueryAppealsResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/query_appeals_response.freezed.dart b/packages/stream_chat/lib/open_api/model/query_appeals_response.freezed.dart new file mode 100644 index 0000000000..a06b2b4266 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_appeals_response.freezed.dart @@ -0,0 +1,110 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'query_appeals_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$QueryAppealsResponse { + String get duration; + List get items; + String? get next; + String? get prev; + + /// Create a copy of QueryAppealsResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $QueryAppealsResponseCopyWith get copyWith => + _$QueryAppealsResponseCopyWithImpl( + this as QueryAppealsResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is QueryAppealsResponse && + (identical(other.duration, duration) || other.duration == duration) && + const DeepCollectionEquality().equals(other.items, items) && + (identical(other.next, next) || other.next == next) && + (identical(other.prev, prev) || other.prev == prev)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + duration, + const DeepCollectionEquality().hash(items), + next, + prev, + ); + + @override + String toString() { + return 'QueryAppealsResponse(duration: $duration, items: $items, next: $next, prev: $prev)'; + } +} + +/// @nodoc +abstract mixin class $QueryAppealsResponseCopyWith<$Res> { + factory $QueryAppealsResponseCopyWith( + QueryAppealsResponse value, + $Res Function(QueryAppealsResponse) _then, + ) = _$QueryAppealsResponseCopyWithImpl; + @useResult + $Res call({ + String duration, + List items, + String? next, + String? prev, + }); +} + +/// @nodoc +class _$QueryAppealsResponseCopyWithImpl<$Res> implements $QueryAppealsResponseCopyWith<$Res> { + _$QueryAppealsResponseCopyWithImpl(this._self, this._then); + + final QueryAppealsResponse _self; + final $Res Function(QueryAppealsResponse) _then; + + /// Create a copy of QueryAppealsResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? duration = null, + Object? items = null, + Object? next = freezed, + Object? prev = freezed, + }) { + return _then( + QueryAppealsResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + items: null == items + ? _self.items + : items // ignore: cast_nullable_to_non_nullable + as List, + next: freezed == next + ? _self.next + : next // ignore: cast_nullable_to_non_nullable + as String?, + prev: freezed == prev + ? _self.prev + : prev // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/query_appeals_response.g.dart b/packages/stream_chat/lib/open_api/model/query_appeals_response.g.dart new file mode 100644 index 0000000000..84ed2c008f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_appeals_response.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'query_appeals_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +QueryAppealsResponse _$QueryAppealsResponseFromJson( + Map json, +) => QueryAppealsResponse( + duration: json['duration'] as String, + items: (json['items'] as List).map((e) => AppealItemResponse.fromJson(e as Map)).toList(), + next: json['next'] as String?, + prev: json['prev'] as String?, +); + +Map _$QueryAppealsResponseToJson( + QueryAppealsResponse instance, +) => { + 'duration': instance.duration, + 'items': instance.items.map((e) => e.toJson()).toList(), + 'next': instance.next, + 'prev': instance.prev, +}; diff --git a/packages/stream_chat/lib/open_api/model/query_banned_users_payload.dart b/packages/stream_chat/lib/open_api/model/query_banned_users_payload.dart new file mode 100644 index 0000000000..58cd5719d0 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_banned_users_payload.dart @@ -0,0 +1,51 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'query_banned_users_payload.g.dart'; +part 'query_banned_users_payload.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class QueryBannedUsersPayload with _$QueryBannedUsersPayload { + const QueryBannedUsersPayload({ + this.excludeExpiredBans, + required this.filterConditions, + this.limit, + this.offset, + this.sort, + }); + + @override + @JsonKey(name: 'exclude_expired_bans') + final bool? excludeExpiredBans; + + @override + @JsonKey(name: 'filter_conditions') + final Map filterConditions; + + @override + @JsonKey(name: 'limit') + final int? limit; + + @override + @JsonKey(name: 'offset') + final int? offset; + + @override + @JsonKey(name: 'sort') + final List? sort; + + Map toJson() => _$QueryBannedUsersPayloadToJson(this); + + static QueryBannedUsersPayload fromJson(Map json) => _$QueryBannedUsersPayloadFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/query_banned_users_payload.freezed.dart b/packages/stream_chat/lib/open_api/model/query_banned_users_payload.freezed.dart new file mode 100644 index 0000000000..ffd31b310c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_banned_users_payload.freezed.dart @@ -0,0 +1,123 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'query_banned_users_payload.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$QueryBannedUsersPayload { + bool? get excludeExpiredBans; + Map get filterConditions; + int? get limit; + int? get offset; + List? get sort; + + /// Create a copy of QueryBannedUsersPayload + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $QueryBannedUsersPayloadCopyWith get copyWith => + _$QueryBannedUsersPayloadCopyWithImpl( + this as QueryBannedUsersPayload, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is QueryBannedUsersPayload && + (identical(other.excludeExpiredBans, excludeExpiredBans) || + other.excludeExpiredBans == excludeExpiredBans) && + const DeepCollectionEquality().equals( + other.filterConditions, + filterConditions, + ) && + (identical(other.limit, limit) || other.limit == limit) && + (identical(other.offset, offset) || other.offset == offset) && + const DeepCollectionEquality().equals(other.sort, sort)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + excludeExpiredBans, + const DeepCollectionEquality().hash(filterConditions), + limit, + offset, + const DeepCollectionEquality().hash(sort), + ); + + @override + String toString() { + return 'QueryBannedUsersPayload(excludeExpiredBans: $excludeExpiredBans, filterConditions: $filterConditions, limit: $limit, offset: $offset, sort: $sort)'; + } +} + +/// @nodoc +abstract mixin class $QueryBannedUsersPayloadCopyWith<$Res> { + factory $QueryBannedUsersPayloadCopyWith( + QueryBannedUsersPayload value, + $Res Function(QueryBannedUsersPayload) _then, + ) = _$QueryBannedUsersPayloadCopyWithImpl; + @useResult + $Res call({ + bool? excludeExpiredBans, + Map filterConditions, + int? limit, + int? offset, + List? sort, + }); +} + +/// @nodoc +class _$QueryBannedUsersPayloadCopyWithImpl<$Res> implements $QueryBannedUsersPayloadCopyWith<$Res> { + _$QueryBannedUsersPayloadCopyWithImpl(this._self, this._then); + + final QueryBannedUsersPayload _self; + final $Res Function(QueryBannedUsersPayload) _then; + + /// Create a copy of QueryBannedUsersPayload + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? excludeExpiredBans = freezed, + Object? filterConditions = null, + Object? limit = freezed, + Object? offset = freezed, + Object? sort = freezed, + }) { + return _then( + QueryBannedUsersPayload( + excludeExpiredBans: freezed == excludeExpiredBans + ? _self.excludeExpiredBans + : excludeExpiredBans // ignore: cast_nullable_to_non_nullable + as bool?, + filterConditions: null == filterConditions + ? _self.filterConditions + : filterConditions // ignore: cast_nullable_to_non_nullable + as Map, + limit: freezed == limit + ? _self.limit + : limit // ignore: cast_nullable_to_non_nullable + as int?, + offset: freezed == offset + ? _self.offset + : offset // ignore: cast_nullable_to_non_nullable + as int?, + sort: freezed == sort + ? _self.sort + : sort // ignore: cast_nullable_to_non_nullable + as List?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/query_banned_users_payload.g.dart b/packages/stream_chat/lib/open_api/model/query_banned_users_payload.g.dart new file mode 100644 index 0000000000..ef5c453ef3 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_banned_users_payload.g.dart @@ -0,0 +1,27 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'query_banned_users_payload.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +QueryBannedUsersPayload _$QueryBannedUsersPayloadFromJson( + Map json, +) => QueryBannedUsersPayload( + excludeExpiredBans: json['exclude_expired_bans'] as bool?, + filterConditions: json['filter_conditions'] as Map, + limit: (json['limit'] as num?)?.toInt(), + offset: (json['offset'] as num?)?.toInt(), + sort: (json['sort'] as List?)?.map((e) => SortParamRequest.fromJson(e as Map)).toList(), +); + +Map _$QueryBannedUsersPayloadToJson( + QueryBannedUsersPayload instance, +) => { + 'exclude_expired_bans': instance.excludeExpiredBans, + 'filter_conditions': instance.filterConditions, + 'limit': instance.limit, + 'offset': instance.offset, + 'sort': instance.sort?.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/query_banned_users_response.dart b/packages/stream_chat/lib/open_api/model/query_banned_users_response.dart new file mode 100644 index 0000000000..68efac4db2 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_banned_users_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'query_banned_users_response.g.dart'; +part 'query_banned_users_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class QueryBannedUsersResponse with _$QueryBannedUsersResponse { + const QueryBannedUsersResponse({ + required this.bans, + required this.duration, + }); + + @override + @JsonKey(name: 'bans') + final List bans; + + @override + @JsonKey(name: 'duration') + final String duration; + + Map toJson() => _$QueryBannedUsersResponseToJson(this); + + static QueryBannedUsersResponse fromJson(Map json) => _$QueryBannedUsersResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/query_banned_users_response.freezed.dart b/packages/stream_chat/lib/open_api/model/query_banned_users_response.freezed.dart new file mode 100644 index 0000000000..75457707c2 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_banned_users_response.freezed.dart @@ -0,0 +1,86 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'query_banned_users_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$QueryBannedUsersResponse { + List get bans; + String get duration; + + /// Create a copy of QueryBannedUsersResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $QueryBannedUsersResponseCopyWith get copyWith => + _$QueryBannedUsersResponseCopyWithImpl( + this as QueryBannedUsersResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is QueryBannedUsersResponse && + const DeepCollectionEquality().equals(other.bans, bans) && + (identical(other.duration, duration) || other.duration == duration)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(bans), + duration, + ); + + @override + String toString() { + return 'QueryBannedUsersResponse(bans: $bans, duration: $duration)'; + } +} + +/// @nodoc +abstract mixin class $QueryBannedUsersResponseCopyWith<$Res> { + factory $QueryBannedUsersResponseCopyWith( + QueryBannedUsersResponse value, + $Res Function(QueryBannedUsersResponse) _then, + ) = _$QueryBannedUsersResponseCopyWithImpl; + @useResult + $Res call({List bans, String duration}); +} + +/// @nodoc +class _$QueryBannedUsersResponseCopyWithImpl<$Res> implements $QueryBannedUsersResponseCopyWith<$Res> { + _$QueryBannedUsersResponseCopyWithImpl(this._self, this._then); + + final QueryBannedUsersResponse _self; + final $Res Function(QueryBannedUsersResponse) _then; + + /// Create a copy of QueryBannedUsersResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? bans = null, Object? duration = null}) { + return _then( + QueryBannedUsersResponse( + bans: null == bans + ? _self.bans + : bans // ignore: cast_nullable_to_non_nullable + as List, + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/query_banned_users_response.g.dart b/packages/stream_chat/lib/open_api/model/query_banned_users_response.g.dart new file mode 100644 index 0000000000..223e8d171e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_banned_users_response.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'query_banned_users_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +QueryBannedUsersResponse _$QueryBannedUsersResponseFromJson( + Map json, +) => QueryBannedUsersResponse( + bans: (json['bans'] as List).map((e) => BanResponse.fromJson(e as Map)).toList(), + duration: json['duration'] as String, +); + +Map _$QueryBannedUsersResponseToJson( + QueryBannedUsersResponse instance, +) => { + 'bans': instance.bans.map((e) => e.toJson()).toList(), + 'duration': instance.duration, +}; diff --git a/packages/stream_chat/lib/open_api/model/query_channels_request.dart b/packages/stream_chat/lib/open_api/model/query_channels_request.dart new file mode 100644 index 0000000000..6c10ca7ad3 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_channels_request.dart @@ -0,0 +1,91 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'query_channels_request.g.dart'; +part 'query_channels_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class QueryChannelsRequest with _$QueryChannelsRequest { + const QueryChannelsRequest({ + this.filterConditions, + this.filterValues, + this.limit, + this.memberCustomInclude, + this.memberLimit, + this.messageLimit, + this.offset, + this.predefinedFilter, + this.presence, + this.sort, + this.sortValues, + this.state, + this.watch, + }); + + @override + @JsonKey(name: 'filter_conditions') + final Map? filterConditions; + + @override + @JsonKey(name: 'filter_values') + final Map? filterValues; + + @override + @JsonKey(name: 'limit') + final int? limit; + + @override + @JsonKey(name: 'member_custom_include') + final List? memberCustomInclude; + + @override + @JsonKey(name: 'member_limit') + final int? memberLimit; + + @override + @JsonKey(name: 'message_limit') + final int? messageLimit; + + @override + @JsonKey(name: 'offset') + final int? offset; + + @override + @JsonKey(name: 'predefined_filter') + final String? predefinedFilter; + + @override + @JsonKey(name: 'presence') + final bool? presence; + + @override + @JsonKey(name: 'sort') + final List? sort; + + @override + @JsonKey(name: 'sort_values') + final Map? sortValues; + + @override + @JsonKey(name: 'state') + final bool? state; + + @override + @JsonKey(name: 'watch') + final bool? watch; + + Map toJson() => _$QueryChannelsRequestToJson(this); + + static QueryChannelsRequest fromJson(Map json) => _$QueryChannelsRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/query_channels_request.freezed.dart b/packages/stream_chat/lib/open_api/model/query_channels_request.freezed.dart new file mode 100644 index 0000000000..6855ec65e5 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_channels_request.freezed.dart @@ -0,0 +1,203 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'query_channels_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$QueryChannelsRequest { + Map? get filterConditions; + Map? get filterValues; + int? get limit; + List? get memberCustomInclude; + int? get memberLimit; + int? get messageLimit; + int? get offset; + String? get predefinedFilter; + bool? get presence; + List? get sort; + Map? get sortValues; + bool? get state; + bool? get watch; + + /// Create a copy of QueryChannelsRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $QueryChannelsRequestCopyWith get copyWith => + _$QueryChannelsRequestCopyWithImpl( + this as QueryChannelsRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is QueryChannelsRequest && + const DeepCollectionEquality().equals( + other.filterConditions, + filterConditions, + ) && + const DeepCollectionEquality().equals( + other.filterValues, + filterValues, + ) && + (identical(other.limit, limit) || other.limit == limit) && + const DeepCollectionEquality().equals( + other.memberCustomInclude, + memberCustomInclude, + ) && + (identical(other.memberLimit, memberLimit) || other.memberLimit == memberLimit) && + (identical(other.messageLimit, messageLimit) || other.messageLimit == messageLimit) && + (identical(other.offset, offset) || other.offset == offset) && + (identical(other.predefinedFilter, predefinedFilter) || other.predefinedFilter == predefinedFilter) && + (identical(other.presence, presence) || other.presence == presence) && + const DeepCollectionEquality().equals(other.sort, sort) && + const DeepCollectionEquality().equals( + other.sortValues, + sortValues, + ) && + (identical(other.state, state) || other.state == state) && + (identical(other.watch, watch) || other.watch == watch)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(filterConditions), + const DeepCollectionEquality().hash(filterValues), + limit, + const DeepCollectionEquality().hash(memberCustomInclude), + memberLimit, + messageLimit, + offset, + predefinedFilter, + presence, + const DeepCollectionEquality().hash(sort), + const DeepCollectionEquality().hash(sortValues), + state, + watch, + ); + + @override + String toString() { + return 'QueryChannelsRequest(filterConditions: $filterConditions, filterValues: $filterValues, limit: $limit, memberCustomInclude: $memberCustomInclude, memberLimit: $memberLimit, messageLimit: $messageLimit, offset: $offset, predefinedFilter: $predefinedFilter, presence: $presence, sort: $sort, sortValues: $sortValues, state: $state, watch: $watch)'; + } +} + +/// @nodoc +abstract mixin class $QueryChannelsRequestCopyWith<$Res> { + factory $QueryChannelsRequestCopyWith( + QueryChannelsRequest value, + $Res Function(QueryChannelsRequest) _then, + ) = _$QueryChannelsRequestCopyWithImpl; + @useResult + $Res call({ + Map? filterConditions, + Map? filterValues, + int? limit, + List? memberCustomInclude, + int? memberLimit, + int? messageLimit, + int? offset, + String? predefinedFilter, + bool? presence, + List? sort, + Map? sortValues, + bool? state, + bool? watch, + }); +} + +/// @nodoc +class _$QueryChannelsRequestCopyWithImpl<$Res> implements $QueryChannelsRequestCopyWith<$Res> { + _$QueryChannelsRequestCopyWithImpl(this._self, this._then); + + final QueryChannelsRequest _self; + final $Res Function(QueryChannelsRequest) _then; + + /// Create a copy of QueryChannelsRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? filterConditions = freezed, + Object? filterValues = freezed, + Object? limit = freezed, + Object? memberCustomInclude = freezed, + Object? memberLimit = freezed, + Object? messageLimit = freezed, + Object? offset = freezed, + Object? predefinedFilter = freezed, + Object? presence = freezed, + Object? sort = freezed, + Object? sortValues = freezed, + Object? state = freezed, + Object? watch = freezed, + }) { + return _then( + QueryChannelsRequest( + filterConditions: freezed == filterConditions + ? _self.filterConditions + : filterConditions // ignore: cast_nullable_to_non_nullable + as Map?, + filterValues: freezed == filterValues + ? _self.filterValues + : filterValues // ignore: cast_nullable_to_non_nullable + as Map?, + limit: freezed == limit + ? _self.limit + : limit // ignore: cast_nullable_to_non_nullable + as int?, + memberCustomInclude: freezed == memberCustomInclude + ? _self.memberCustomInclude + : memberCustomInclude // ignore: cast_nullable_to_non_nullable + as List?, + memberLimit: freezed == memberLimit + ? _self.memberLimit + : memberLimit // ignore: cast_nullable_to_non_nullable + as int?, + messageLimit: freezed == messageLimit + ? _self.messageLimit + : messageLimit // ignore: cast_nullable_to_non_nullable + as int?, + offset: freezed == offset + ? _self.offset + : offset // ignore: cast_nullable_to_non_nullable + as int?, + predefinedFilter: freezed == predefinedFilter + ? _self.predefinedFilter + : predefinedFilter // ignore: cast_nullable_to_non_nullable + as String?, + presence: freezed == presence + ? _self.presence + : presence // ignore: cast_nullable_to_non_nullable + as bool?, + sort: freezed == sort + ? _self.sort + : sort // ignore: cast_nullable_to_non_nullable + as List?, + sortValues: freezed == sortValues + ? _self.sortValues + : sortValues // ignore: cast_nullable_to_non_nullable + as Map?, + state: freezed == state + ? _self.state + : state // ignore: cast_nullable_to_non_nullable + as bool?, + watch: freezed == watch + ? _self.watch + : watch // ignore: cast_nullable_to_non_nullable + as bool?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/query_channels_request.g.dart b/packages/stream_chat/lib/open_api/model/query_channels_request.g.dart new file mode 100644 index 0000000000..97b4b25290 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_channels_request.g.dart @@ -0,0 +1,43 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'query_channels_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +QueryChannelsRequest _$QueryChannelsRequestFromJson( + Map json, +) => QueryChannelsRequest( + filterConditions: json['filter_conditions'] as Map?, + filterValues: json['filter_values'] as Map?, + limit: (json['limit'] as num?)?.toInt(), + memberCustomInclude: (json['member_custom_include'] as List?)?.map((e) => e as String).toList(), + memberLimit: (json['member_limit'] as num?)?.toInt(), + messageLimit: (json['message_limit'] as num?)?.toInt(), + offset: (json['offset'] as num?)?.toInt(), + predefinedFilter: json['predefined_filter'] as String?, + presence: json['presence'] as bool?, + sort: (json['sort'] as List?)?.map((e) => SortParamRequest.fromJson(e as Map)).toList(), + sortValues: json['sort_values'] as Map?, + state: json['state'] as bool?, + watch: json['watch'] as bool?, +); + +Map _$QueryChannelsRequestToJson( + QueryChannelsRequest instance, +) => { + 'filter_conditions': instance.filterConditions, + 'filter_values': instance.filterValues, + 'limit': instance.limit, + 'member_custom_include': instance.memberCustomInclude, + 'member_limit': instance.memberLimit, + 'message_limit': instance.messageLimit, + 'offset': instance.offset, + 'predefined_filter': instance.predefinedFilter, + 'presence': instance.presence, + 'sort': instance.sort?.map((e) => e.toJson()).toList(), + 'sort_values': instance.sortValues, + 'state': instance.state, + 'watch': instance.watch, +}; diff --git a/packages/stream_chat/lib/open_api/model/query_channels_response.dart b/packages/stream_chat/lib/open_api/model/query_channels_response.dart new file mode 100644 index 0000000000..26593b8904 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_channels_response.dart @@ -0,0 +1,41 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'query_channels_response.g.dart'; +part 'query_channels_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class QueryChannelsResponse with _$QueryChannelsResponse { + const QueryChannelsResponse({ + required this.channels, + required this.duration, + this.predefinedFilter, + }); + + @override + @JsonKey(name: 'channels') + final List channels; + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'predefined_filter') + final ParsedPredefinedFilterResponse? predefinedFilter; + + Map toJson() => _$QueryChannelsResponseToJson(this); + + static QueryChannelsResponse fromJson(Map json) => _$QueryChannelsResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/query_channels_response.freezed.dart b/packages/stream_chat/lib/open_api/model/query_channels_response.freezed.dart new file mode 100644 index 0000000000..37449ebef3 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_channels_response.freezed.dart @@ -0,0 +1,101 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'query_channels_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$QueryChannelsResponse { + List get channels; + String get duration; + ParsedPredefinedFilterResponse? get predefinedFilter; + + /// Create a copy of QueryChannelsResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $QueryChannelsResponseCopyWith get copyWith => + _$QueryChannelsResponseCopyWithImpl( + this as QueryChannelsResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is QueryChannelsResponse && + const DeepCollectionEquality().equals(other.channels, channels) && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.predefinedFilter, predefinedFilter) || other.predefinedFilter == predefinedFilter)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(channels), + duration, + predefinedFilter, + ); + + @override + String toString() { + return 'QueryChannelsResponse(channels: $channels, duration: $duration, predefinedFilter: $predefinedFilter)'; + } +} + +/// @nodoc +abstract mixin class $QueryChannelsResponseCopyWith<$Res> { + factory $QueryChannelsResponseCopyWith( + QueryChannelsResponse value, + $Res Function(QueryChannelsResponse) _then, + ) = _$QueryChannelsResponseCopyWithImpl; + @useResult + $Res call({ + List channels, + String duration, + ParsedPredefinedFilterResponse? predefinedFilter, + }); +} + +/// @nodoc +class _$QueryChannelsResponseCopyWithImpl<$Res> implements $QueryChannelsResponseCopyWith<$Res> { + _$QueryChannelsResponseCopyWithImpl(this._self, this._then); + + final QueryChannelsResponse _self; + final $Res Function(QueryChannelsResponse) _then; + + /// Create a copy of QueryChannelsResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channels = null, + Object? duration = null, + Object? predefinedFilter = freezed, + }) { + return _then( + QueryChannelsResponse( + channels: null == channels + ? _self.channels + : channels // ignore: cast_nullable_to_non_nullable + as List, + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + predefinedFilter: freezed == predefinedFilter + ? _self.predefinedFilter + : predefinedFilter // ignore: cast_nullable_to_non_nullable + as ParsedPredefinedFilterResponse?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/query_channels_response.g.dart b/packages/stream_chat/lib/open_api/model/query_channels_response.g.dart new file mode 100644 index 0000000000..a18d34f94e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_channels_response.g.dart @@ -0,0 +1,31 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'query_channels_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +QueryChannelsResponse _$QueryChannelsResponseFromJson( + Map json, +) => QueryChannelsResponse( + channels: (json['channels'] as List) + .map( + (e) => ChannelStateResponseFields.fromJson(e as Map), + ) + .toList(), + duration: json['duration'] as String, + predefinedFilter: json['predefined_filter'] == null + ? null + : ParsedPredefinedFilterResponse.fromJson( + json['predefined_filter'] as Map, + ), +); + +Map _$QueryChannelsResponseToJson( + QueryChannelsResponse instance, +) => { + 'channels': instance.channels.map((e) => e.toJson()).toList(), + 'duration': instance.duration, + 'predefined_filter': instance.predefinedFilter?.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/query_drafts_request.dart b/packages/stream_chat/lib/open_api/model/query_drafts_request.dart new file mode 100644 index 0000000000..4dbbee4e6f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_drafts_request.dart @@ -0,0 +1,51 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'query_drafts_request.g.dart'; +part 'query_drafts_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class QueryDraftsRequest with _$QueryDraftsRequest { + const QueryDraftsRequest({ + this.filter, + this.limit, + this.next, + this.prev, + this.sort, + }); + + @override + @JsonKey(name: 'filter') + final Map? filter; + + @override + @JsonKey(name: 'limit') + final int? limit; + + @override + @JsonKey(name: 'next') + final String? next; + + @override + @JsonKey(name: 'prev') + final String? prev; + + @override + @JsonKey(name: 'sort') + final List? sort; + + Map toJson() => _$QueryDraftsRequestToJson(this); + + static QueryDraftsRequest fromJson(Map json) => _$QueryDraftsRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/query_drafts_request.freezed.dart b/packages/stream_chat/lib/open_api/model/query_drafts_request.freezed.dart new file mode 100644 index 0000000000..e7cbf8bd86 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_drafts_request.freezed.dart @@ -0,0 +1,118 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'query_drafts_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$QueryDraftsRequest { + Map? get filter; + int? get limit; + String? get next; + String? get prev; + List? get sort; + + /// Create a copy of QueryDraftsRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $QueryDraftsRequestCopyWith get copyWith => _$QueryDraftsRequestCopyWithImpl( + this as QueryDraftsRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is QueryDraftsRequest && + const DeepCollectionEquality().equals(other.filter, filter) && + (identical(other.limit, limit) || other.limit == limit) && + (identical(other.next, next) || other.next == next) && + (identical(other.prev, prev) || other.prev == prev) && + const DeepCollectionEquality().equals(other.sort, sort)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(filter), + limit, + next, + prev, + const DeepCollectionEquality().hash(sort), + ); + + @override + String toString() { + return 'QueryDraftsRequest(filter: $filter, limit: $limit, next: $next, prev: $prev, sort: $sort)'; + } +} + +/// @nodoc +abstract mixin class $QueryDraftsRequestCopyWith<$Res> { + factory $QueryDraftsRequestCopyWith( + QueryDraftsRequest value, + $Res Function(QueryDraftsRequest) _then, + ) = _$QueryDraftsRequestCopyWithImpl; + @useResult + $Res call({ + Map? filter, + int? limit, + String? next, + String? prev, + List? sort, + }); +} + +/// @nodoc +class _$QueryDraftsRequestCopyWithImpl<$Res> implements $QueryDraftsRequestCopyWith<$Res> { + _$QueryDraftsRequestCopyWithImpl(this._self, this._then); + + final QueryDraftsRequest _self; + final $Res Function(QueryDraftsRequest) _then; + + /// Create a copy of QueryDraftsRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? filter = freezed, + Object? limit = freezed, + Object? next = freezed, + Object? prev = freezed, + Object? sort = freezed, + }) { + return _then( + QueryDraftsRequest( + filter: freezed == filter + ? _self.filter + : filter // ignore: cast_nullable_to_non_nullable + as Map?, + limit: freezed == limit + ? _self.limit + : limit // ignore: cast_nullable_to_non_nullable + as int?, + next: freezed == next + ? _self.next + : next // ignore: cast_nullable_to_non_nullable + as String?, + prev: freezed == prev + ? _self.prev + : prev // ignore: cast_nullable_to_non_nullable + as String?, + sort: freezed == sort + ? _self.sort + : sort // ignore: cast_nullable_to_non_nullable + as List?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/query_drafts_request.g.dart b/packages/stream_chat/lib/open_api/model/query_drafts_request.g.dart new file mode 100644 index 0000000000..c297c210fb --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_drafts_request.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'query_drafts_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +QueryDraftsRequest _$QueryDraftsRequestFromJson(Map json) => QueryDraftsRequest( + filter: json['filter'] as Map?, + limit: (json['limit'] as num?)?.toInt(), + next: json['next'] as String?, + prev: json['prev'] as String?, + sort: (json['sort'] as List?)?.map((e) => SortParamRequest.fromJson(e as Map)).toList(), +); + +Map _$QueryDraftsRequestToJson(QueryDraftsRequest instance) => { + 'filter': instance.filter, + 'limit': instance.limit, + 'next': instance.next, + 'prev': instance.prev, + 'sort': instance.sort?.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/query_drafts_response.dart b/packages/stream_chat/lib/open_api/model/query_drafts_response.dart new file mode 100644 index 0000000000..dee738b40e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_drafts_response.dart @@ -0,0 +1,46 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'query_drafts_response.g.dart'; +part 'query_drafts_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class QueryDraftsResponse with _$QueryDraftsResponse { + const QueryDraftsResponse({ + required this.drafts, + required this.duration, + this.next, + this.prev, + }); + + @override + @JsonKey(name: 'drafts') + final List drafts; + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'next') + final String? next; + + @override + @JsonKey(name: 'prev') + final String? prev; + + Map toJson() => _$QueryDraftsResponseToJson(this); + + static QueryDraftsResponse fromJson(Map json) => _$QueryDraftsResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/query_drafts_response.freezed.dart b/packages/stream_chat/lib/open_api/model/query_drafts_response.freezed.dart new file mode 100644 index 0000000000..56bb59f1d5 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_drafts_response.freezed.dart @@ -0,0 +1,110 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'query_drafts_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$QueryDraftsResponse { + List get drafts; + String get duration; + String? get next; + String? get prev; + + /// Create a copy of QueryDraftsResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $QueryDraftsResponseCopyWith get copyWith => + _$QueryDraftsResponseCopyWithImpl( + this as QueryDraftsResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is QueryDraftsResponse && + const DeepCollectionEquality().equals(other.drafts, drafts) && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.next, next) || other.next == next) && + (identical(other.prev, prev) || other.prev == prev)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(drafts), + duration, + next, + prev, + ); + + @override + String toString() { + return 'QueryDraftsResponse(drafts: $drafts, duration: $duration, next: $next, prev: $prev)'; + } +} + +/// @nodoc +abstract mixin class $QueryDraftsResponseCopyWith<$Res> { + factory $QueryDraftsResponseCopyWith( + QueryDraftsResponse value, + $Res Function(QueryDraftsResponse) _then, + ) = _$QueryDraftsResponseCopyWithImpl; + @useResult + $Res call({ + List drafts, + String duration, + String? next, + String? prev, + }); +} + +/// @nodoc +class _$QueryDraftsResponseCopyWithImpl<$Res> implements $QueryDraftsResponseCopyWith<$Res> { + _$QueryDraftsResponseCopyWithImpl(this._self, this._then); + + final QueryDraftsResponse _self; + final $Res Function(QueryDraftsResponse) _then; + + /// Create a copy of QueryDraftsResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? drafts = null, + Object? duration = null, + Object? next = freezed, + Object? prev = freezed, + }) { + return _then( + QueryDraftsResponse( + drafts: null == drafts + ? _self.drafts + : drafts // ignore: cast_nullable_to_non_nullable + as List, + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + next: freezed == next + ? _self.next + : next // ignore: cast_nullable_to_non_nullable + as String?, + prev: freezed == prev + ? _self.prev + : prev // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/query_drafts_response.g.dart b/packages/stream_chat/lib/open_api/model/query_drafts_response.g.dart new file mode 100644 index 0000000000..865414ed1f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_drafts_response.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'query_drafts_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +QueryDraftsResponse _$QueryDraftsResponseFromJson(Map json) => QueryDraftsResponse( + drafts: (json['drafts'] as List).map((e) => DraftResponse.fromJson(e as Map)).toList(), + duration: json['duration'] as String, + next: json['next'] as String?, + prev: json['prev'] as String?, +); + +Map _$QueryDraftsResponseToJson( + QueryDraftsResponse instance, +) => { + 'drafts': instance.drafts.map((e) => e.toJson()).toList(), + 'duration': instance.duration, + 'next': instance.next, + 'prev': instance.prev, +}; diff --git a/packages/stream_chat/lib/open_api/model/query_future_channel_bans_payload.dart b/packages/stream_chat/lib/open_api/model/query_future_channel_bans_payload.dart new file mode 100644 index 0000000000..efad2d2e2c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_future_channel_bans_payload.dart @@ -0,0 +1,52 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'query_future_channel_bans_payload.g.dart'; +part 'query_future_channel_bans_payload.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class QueryFutureChannelBansPayload with _$QueryFutureChannelBansPayload { + const QueryFutureChannelBansPayload({ + this.excludeExpiredBans, + this.includeTotal, + this.limit, + this.offset, + this.targetUserId, + }); + + @override + @JsonKey(name: 'exclude_expired_bans') + final bool? excludeExpiredBans; + + @override + @JsonKey(name: 'include_total') + final bool? includeTotal; + + @override + @JsonKey(name: 'limit') + final int? limit; + + @override + @JsonKey(name: 'offset') + final int? offset; + + @override + @JsonKey(name: 'target_user_id') + final String? targetUserId; + + Map toJson() => _$QueryFutureChannelBansPayloadToJson(this); + + static QueryFutureChannelBansPayload fromJson(Map json) => + _$QueryFutureChannelBansPayloadFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/query_future_channel_bans_payload.freezed.dart b/packages/stream_chat/lib/open_api/model/query_future_channel_bans_payload.freezed.dart new file mode 100644 index 0000000000..9833b2175c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_future_channel_bans_payload.freezed.dart @@ -0,0 +1,120 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'query_future_channel_bans_payload.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$QueryFutureChannelBansPayload { + bool? get excludeExpiredBans; + bool? get includeTotal; + int? get limit; + int? get offset; + String? get targetUserId; + + /// Create a copy of QueryFutureChannelBansPayload + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $QueryFutureChannelBansPayloadCopyWith get copyWith => + _$QueryFutureChannelBansPayloadCopyWithImpl( + this as QueryFutureChannelBansPayload, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is QueryFutureChannelBansPayload && + (identical(other.excludeExpiredBans, excludeExpiredBans) || + other.excludeExpiredBans == excludeExpiredBans) && + (identical(other.includeTotal, includeTotal) || other.includeTotal == includeTotal) && + (identical(other.limit, limit) || other.limit == limit) && + (identical(other.offset, offset) || other.offset == offset) && + (identical(other.targetUserId, targetUserId) || other.targetUserId == targetUserId)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + excludeExpiredBans, + includeTotal, + limit, + offset, + targetUserId, + ); + + @override + String toString() { + return 'QueryFutureChannelBansPayload(excludeExpiredBans: $excludeExpiredBans, includeTotal: $includeTotal, limit: $limit, offset: $offset, targetUserId: $targetUserId)'; + } +} + +/// @nodoc +abstract mixin class $QueryFutureChannelBansPayloadCopyWith<$Res> { + factory $QueryFutureChannelBansPayloadCopyWith( + QueryFutureChannelBansPayload value, + $Res Function(QueryFutureChannelBansPayload) _then, + ) = _$QueryFutureChannelBansPayloadCopyWithImpl; + @useResult + $Res call({ + bool? excludeExpiredBans, + bool? includeTotal, + int? limit, + int? offset, + String? targetUserId, + }); +} + +/// @nodoc +class _$QueryFutureChannelBansPayloadCopyWithImpl<$Res> implements $QueryFutureChannelBansPayloadCopyWith<$Res> { + _$QueryFutureChannelBansPayloadCopyWithImpl(this._self, this._then); + + final QueryFutureChannelBansPayload _self; + final $Res Function(QueryFutureChannelBansPayload) _then; + + /// Create a copy of QueryFutureChannelBansPayload + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? excludeExpiredBans = freezed, + Object? includeTotal = freezed, + Object? limit = freezed, + Object? offset = freezed, + Object? targetUserId = freezed, + }) { + return _then( + QueryFutureChannelBansPayload( + excludeExpiredBans: freezed == excludeExpiredBans + ? _self.excludeExpiredBans + : excludeExpiredBans // ignore: cast_nullable_to_non_nullable + as bool?, + includeTotal: freezed == includeTotal + ? _self.includeTotal + : includeTotal // ignore: cast_nullable_to_non_nullable + as bool?, + limit: freezed == limit + ? _self.limit + : limit // ignore: cast_nullable_to_non_nullable + as int?, + offset: freezed == offset + ? _self.offset + : offset // ignore: cast_nullable_to_non_nullable + as int?, + targetUserId: freezed == targetUserId + ? _self.targetUserId + : targetUserId // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/query_future_channel_bans_payload.g.dart b/packages/stream_chat/lib/open_api/model/query_future_channel_bans_payload.g.dart new file mode 100644 index 0000000000..4ab53f060f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_future_channel_bans_payload.g.dart @@ -0,0 +1,27 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'query_future_channel_bans_payload.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +QueryFutureChannelBansPayload _$QueryFutureChannelBansPayloadFromJson( + Map json, +) => QueryFutureChannelBansPayload( + excludeExpiredBans: json['exclude_expired_bans'] as bool?, + includeTotal: json['include_total'] as bool?, + limit: (json['limit'] as num?)?.toInt(), + offset: (json['offset'] as num?)?.toInt(), + targetUserId: json['target_user_id'] as String?, +); + +Map _$QueryFutureChannelBansPayloadToJson( + QueryFutureChannelBansPayload instance, +) => { + 'exclude_expired_bans': instance.excludeExpiredBans, + 'include_total': instance.includeTotal, + 'limit': instance.limit, + 'offset': instance.offset, + 'target_user_id': instance.targetUserId, +}; diff --git a/packages/stream_chat/lib/open_api/model/query_future_channel_bans_response.dart b/packages/stream_chat/lib/open_api/model/query_future_channel_bans_response.dart new file mode 100644 index 0000000000..2b4fea4a0e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_future_channel_bans_response.dart @@ -0,0 +1,42 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'query_future_channel_bans_response.g.dart'; +part 'query_future_channel_bans_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class QueryFutureChannelBansResponse with _$QueryFutureChannelBansResponse { + const QueryFutureChannelBansResponse({ + required this.bans, + required this.duration, + this.total, + }); + + @override + @JsonKey(name: 'bans') + final List bans; + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'total') + final int? total; + + Map toJson() => _$QueryFutureChannelBansResponseToJson(this); + + static QueryFutureChannelBansResponse fromJson(Map json) => + _$QueryFutureChannelBansResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/query_future_channel_bans_response.freezed.dart b/packages/stream_chat/lib/open_api/model/query_future_channel_bans_response.freezed.dart new file mode 100644 index 0000000000..15907ebd4c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_future_channel_bans_response.freezed.dart @@ -0,0 +1,97 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'query_future_channel_bans_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$QueryFutureChannelBansResponse { + List get bans; + String get duration; + int? get total; + + /// Create a copy of QueryFutureChannelBansResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $QueryFutureChannelBansResponseCopyWith get copyWith => + _$QueryFutureChannelBansResponseCopyWithImpl( + this as QueryFutureChannelBansResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is QueryFutureChannelBansResponse && + const DeepCollectionEquality().equals(other.bans, bans) && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.total, total) || other.total == total)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(bans), + duration, + total, + ); + + @override + String toString() { + return 'QueryFutureChannelBansResponse(bans: $bans, duration: $duration, total: $total)'; + } +} + +/// @nodoc +abstract mixin class $QueryFutureChannelBansResponseCopyWith<$Res> { + factory $QueryFutureChannelBansResponseCopyWith( + QueryFutureChannelBansResponse value, + $Res Function(QueryFutureChannelBansResponse) _then, + ) = _$QueryFutureChannelBansResponseCopyWithImpl; + @useResult + $Res call({List bans, String duration, int? total}); +} + +/// @nodoc +class _$QueryFutureChannelBansResponseCopyWithImpl<$Res> implements $QueryFutureChannelBansResponseCopyWith<$Res> { + _$QueryFutureChannelBansResponseCopyWithImpl(this._self, this._then); + + final QueryFutureChannelBansResponse _self; + final $Res Function(QueryFutureChannelBansResponse) _then; + + /// Create a copy of QueryFutureChannelBansResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? bans = null, + Object? duration = null, + Object? total = freezed, + }) { + return _then( + QueryFutureChannelBansResponse( + bans: null == bans + ? _self.bans + : bans // ignore: cast_nullable_to_non_nullable + as List, + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + total: freezed == total + ? _self.total + : total // ignore: cast_nullable_to_non_nullable + as int?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/query_future_channel_bans_response.g.dart b/packages/stream_chat/lib/open_api/model/query_future_channel_bans_response.g.dart new file mode 100644 index 0000000000..066507a628 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_future_channel_bans_response.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'query_future_channel_bans_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +QueryFutureChannelBansResponse _$QueryFutureChannelBansResponseFromJson( + Map json, +) => QueryFutureChannelBansResponse( + bans: (json['bans'] as List) + .map((e) => FutureChannelBanResponse.fromJson(e as Map)) + .toList(), + duration: json['duration'] as String, + total: (json['total'] as num?)?.toInt(), +); + +Map _$QueryFutureChannelBansResponseToJson( + QueryFutureChannelBansResponse instance, +) => { + 'bans': instance.bans.map((e) => e.toJson()).toList(), + 'duration': instance.duration, + 'total': instance.total, +}; diff --git a/packages/stream_chat/lib/open_api/model/query_members_payload.dart b/packages/stream_chat/lib/open_api/model/query_members_payload.dart new file mode 100644 index 0000000000..82cd801342 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_members_payload.dart @@ -0,0 +1,61 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'query_members_payload.g.dart'; +part 'query_members_payload.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class QueryMembersPayload with _$QueryMembersPayload { + const QueryMembersPayload({ + this.filterConditions, + this.id, + this.limit, + this.members, + this.offset, + this.sort, + required this.type, + }); + + @override + @JsonKey(name: 'filter_conditions') + final Map? filterConditions; + + @override + @JsonKey(name: 'id') + final String? id; + + @override + @JsonKey(name: 'limit') + final int? limit; + + @override + @JsonKey(name: 'members') + final List? members; + + @override + @JsonKey(name: 'offset') + final int? offset; + + @override + @JsonKey(name: 'sort') + final List? sort; + + @override + @JsonKey(name: 'type') + final String type; + + Map toJson() => _$QueryMembersPayloadToJson(this); + + static QueryMembersPayload fromJson(Map json) => _$QueryMembersPayloadFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/query_members_payload.freezed.dart b/packages/stream_chat/lib/open_api/model/query_members_payload.freezed.dart new file mode 100644 index 0000000000..3a259362a5 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_members_payload.freezed.dart @@ -0,0 +1,140 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'query_members_payload.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$QueryMembersPayload { + Map? get filterConditions; + String? get id; + int? get limit; + List? get members; + int? get offset; + List? get sort; + String get type; + + /// Create a copy of QueryMembersPayload + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $QueryMembersPayloadCopyWith get copyWith => + _$QueryMembersPayloadCopyWithImpl( + this as QueryMembersPayload, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is QueryMembersPayload && + const DeepCollectionEquality().equals( + other.filterConditions, + filterConditions, + ) && + (identical(other.id, id) || other.id == id) && + (identical(other.limit, limit) || other.limit == limit) && + const DeepCollectionEquality().equals(other.members, members) && + (identical(other.offset, offset) || other.offset == offset) && + const DeepCollectionEquality().equals(other.sort, sort) && + (identical(other.type, type) || other.type == type)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(filterConditions), + id, + limit, + const DeepCollectionEquality().hash(members), + offset, + const DeepCollectionEquality().hash(sort), + type, + ); + + @override + String toString() { + return 'QueryMembersPayload(filterConditions: $filterConditions, id: $id, limit: $limit, members: $members, offset: $offset, sort: $sort, type: $type)'; + } +} + +/// @nodoc +abstract mixin class $QueryMembersPayloadCopyWith<$Res> { + factory $QueryMembersPayloadCopyWith( + QueryMembersPayload value, + $Res Function(QueryMembersPayload) _then, + ) = _$QueryMembersPayloadCopyWithImpl; + @useResult + $Res call({ + Map? filterConditions, + String? id, + int? limit, + List? members, + int? offset, + List? sort, + String type, + }); +} + +/// @nodoc +class _$QueryMembersPayloadCopyWithImpl<$Res> implements $QueryMembersPayloadCopyWith<$Res> { + _$QueryMembersPayloadCopyWithImpl(this._self, this._then); + + final QueryMembersPayload _self; + final $Res Function(QueryMembersPayload) _then; + + /// Create a copy of QueryMembersPayload + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? filterConditions = freezed, + Object? id = freezed, + Object? limit = freezed, + Object? members = freezed, + Object? offset = freezed, + Object? sort = freezed, + Object? type = null, + }) { + return _then( + QueryMembersPayload( + filterConditions: freezed == filterConditions + ? _self.filterConditions + : filterConditions // ignore: cast_nullable_to_non_nullable + as Map?, + id: freezed == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String?, + limit: freezed == limit + ? _self.limit + : limit // ignore: cast_nullable_to_non_nullable + as int?, + members: freezed == members + ? _self.members + : members // ignore: cast_nullable_to_non_nullable + as List?, + offset: freezed == offset + ? _self.offset + : offset // ignore: cast_nullable_to_non_nullable + as int?, + sort: freezed == sort + ? _self.sort + : sort // ignore: cast_nullable_to_non_nullable + as List?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/query_members_payload.g.dart b/packages/stream_chat/lib/open_api/model/query_members_payload.g.dart new file mode 100644 index 0000000000..55bb72803a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_members_payload.g.dart @@ -0,0 +1,31 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'query_members_payload.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +QueryMembersPayload _$QueryMembersPayloadFromJson(Map json) => QueryMembersPayload( + filterConditions: json['filter_conditions'] as Map?, + id: json['id'] as String?, + limit: (json['limit'] as num?)?.toInt(), + members: (json['members'] as List?) + ?.map((e) => ChannelMemberRequest.fromJson(e as Map)) + .toList(), + offset: (json['offset'] as num?)?.toInt(), + sort: (json['sort'] as List?)?.map((e) => SortParamRequest.fromJson(e as Map)).toList(), + type: json['type'] as String, +); + +Map _$QueryMembersPayloadToJson( + QueryMembersPayload instance, +) => { + 'filter_conditions': instance.filterConditions, + 'id': instance.id, + 'limit': instance.limit, + 'members': instance.members?.map((e) => e.toJson()).toList(), + 'offset': instance.offset, + 'sort': instance.sort?.map((e) => e.toJson()).toList(), + 'type': instance.type, +}; diff --git a/packages/stream_chat/lib/open_api/model/query_message_flags_payload.dart b/packages/stream_chat/lib/open_api/model/query_message_flags_payload.dart new file mode 100644 index 0000000000..9ab7fef067 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_message_flags_payload.dart @@ -0,0 +1,51 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'query_message_flags_payload.g.dart'; +part 'query_message_flags_payload.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class QueryMessageFlagsPayload with _$QueryMessageFlagsPayload { + const QueryMessageFlagsPayload({ + this.filterConditions, + this.limit, + this.offset, + this.showDeletedMessages, + this.sort, + }); + + @override + @JsonKey(name: 'filter_conditions') + final Map? filterConditions; + + @override + @JsonKey(name: 'limit') + final int? limit; + + @override + @JsonKey(name: 'offset') + final int? offset; + + @override + @JsonKey(name: 'show_deleted_messages') + final bool? showDeletedMessages; + + @override + @JsonKey(name: 'sort') + final List? sort; + + Map toJson() => _$QueryMessageFlagsPayloadToJson(this); + + static QueryMessageFlagsPayload fromJson(Map json) => _$QueryMessageFlagsPayloadFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/query_message_flags_payload.freezed.dart b/packages/stream_chat/lib/open_api/model/query_message_flags_payload.freezed.dart new file mode 100644 index 0000000000..e07456726e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_message_flags_payload.freezed.dart @@ -0,0 +1,123 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'query_message_flags_payload.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$QueryMessageFlagsPayload { + Map? get filterConditions; + int? get limit; + int? get offset; + bool? get showDeletedMessages; + List? get sort; + + /// Create a copy of QueryMessageFlagsPayload + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $QueryMessageFlagsPayloadCopyWith get copyWith => + _$QueryMessageFlagsPayloadCopyWithImpl( + this as QueryMessageFlagsPayload, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is QueryMessageFlagsPayload && + const DeepCollectionEquality().equals( + other.filterConditions, + filterConditions, + ) && + (identical(other.limit, limit) || other.limit == limit) && + (identical(other.offset, offset) || other.offset == offset) && + (identical(other.showDeletedMessages, showDeletedMessages) || + other.showDeletedMessages == showDeletedMessages) && + const DeepCollectionEquality().equals(other.sort, sort)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(filterConditions), + limit, + offset, + showDeletedMessages, + const DeepCollectionEquality().hash(sort), + ); + + @override + String toString() { + return 'QueryMessageFlagsPayload(filterConditions: $filterConditions, limit: $limit, offset: $offset, showDeletedMessages: $showDeletedMessages, sort: $sort)'; + } +} + +/// @nodoc +abstract mixin class $QueryMessageFlagsPayloadCopyWith<$Res> { + factory $QueryMessageFlagsPayloadCopyWith( + QueryMessageFlagsPayload value, + $Res Function(QueryMessageFlagsPayload) _then, + ) = _$QueryMessageFlagsPayloadCopyWithImpl; + @useResult + $Res call({ + Map? filterConditions, + int? limit, + int? offset, + bool? showDeletedMessages, + List? sort, + }); +} + +/// @nodoc +class _$QueryMessageFlagsPayloadCopyWithImpl<$Res> implements $QueryMessageFlagsPayloadCopyWith<$Res> { + _$QueryMessageFlagsPayloadCopyWithImpl(this._self, this._then); + + final QueryMessageFlagsPayload _self; + final $Res Function(QueryMessageFlagsPayload) _then; + + /// Create a copy of QueryMessageFlagsPayload + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? filterConditions = freezed, + Object? limit = freezed, + Object? offset = freezed, + Object? showDeletedMessages = freezed, + Object? sort = freezed, + }) { + return _then( + QueryMessageFlagsPayload( + filterConditions: freezed == filterConditions + ? _self.filterConditions + : filterConditions // ignore: cast_nullable_to_non_nullable + as Map?, + limit: freezed == limit + ? _self.limit + : limit // ignore: cast_nullable_to_non_nullable + as int?, + offset: freezed == offset + ? _self.offset + : offset // ignore: cast_nullable_to_non_nullable + as int?, + showDeletedMessages: freezed == showDeletedMessages + ? _self.showDeletedMessages + : showDeletedMessages // ignore: cast_nullable_to_non_nullable + as bool?, + sort: freezed == sort + ? _self.sort + : sort // ignore: cast_nullable_to_non_nullable + as List?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/query_message_flags_payload.g.dart b/packages/stream_chat/lib/open_api/model/query_message_flags_payload.g.dart new file mode 100644 index 0000000000..88e4e56d6b --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_message_flags_payload.g.dart @@ -0,0 +1,27 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'query_message_flags_payload.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +QueryMessageFlagsPayload _$QueryMessageFlagsPayloadFromJson( + Map json, +) => QueryMessageFlagsPayload( + filterConditions: json['filter_conditions'] as Map?, + limit: (json['limit'] as num?)?.toInt(), + offset: (json['offset'] as num?)?.toInt(), + showDeletedMessages: json['show_deleted_messages'] as bool?, + sort: (json['sort'] as List?)?.map((e) => SortParamRequest.fromJson(e as Map)).toList(), +); + +Map _$QueryMessageFlagsPayloadToJson( + QueryMessageFlagsPayload instance, +) => { + 'filter_conditions': instance.filterConditions, + 'limit': instance.limit, + 'offset': instance.offset, + 'show_deleted_messages': instance.showDeletedMessages, + 'sort': instance.sort?.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/query_message_flags_response.dart b/packages/stream_chat/lib/open_api/model/query_message_flags_response.dart new file mode 100644 index 0000000000..61dee74cf4 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_message_flags_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'query_message_flags_response.g.dart'; +part 'query_message_flags_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class QueryMessageFlagsResponse with _$QueryMessageFlagsResponse { + const QueryMessageFlagsResponse({ + required this.duration, + required this.flags, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'flags') + final List flags; + + Map toJson() => _$QueryMessageFlagsResponseToJson(this); + + static QueryMessageFlagsResponse fromJson(Map json) => _$QueryMessageFlagsResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/query_message_flags_response.freezed.dart b/packages/stream_chat/lib/open_api/model/query_message_flags_response.freezed.dart new file mode 100644 index 0000000000..b1d7707231 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_message_flags_response.freezed.dart @@ -0,0 +1,86 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'query_message_flags_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$QueryMessageFlagsResponse { + String get duration; + List get flags; + + /// Create a copy of QueryMessageFlagsResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $QueryMessageFlagsResponseCopyWith get copyWith => + _$QueryMessageFlagsResponseCopyWithImpl( + this as QueryMessageFlagsResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is QueryMessageFlagsResponse && + (identical(other.duration, duration) || other.duration == duration) && + const DeepCollectionEquality().equals(other.flags, flags)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + duration, + const DeepCollectionEquality().hash(flags), + ); + + @override + String toString() { + return 'QueryMessageFlagsResponse(duration: $duration, flags: $flags)'; + } +} + +/// @nodoc +abstract mixin class $QueryMessageFlagsResponseCopyWith<$Res> { + factory $QueryMessageFlagsResponseCopyWith( + QueryMessageFlagsResponse value, + $Res Function(QueryMessageFlagsResponse) _then, + ) = _$QueryMessageFlagsResponseCopyWithImpl; + @useResult + $Res call({String duration, List flags}); +} + +/// @nodoc +class _$QueryMessageFlagsResponseCopyWithImpl<$Res> implements $QueryMessageFlagsResponseCopyWith<$Res> { + _$QueryMessageFlagsResponseCopyWithImpl(this._self, this._then); + + final QueryMessageFlagsResponse _self; + final $Res Function(QueryMessageFlagsResponse) _then; + + /// Create a copy of QueryMessageFlagsResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? flags = null}) { + return _then( + QueryMessageFlagsResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + flags: null == flags + ? _self.flags + : flags // ignore: cast_nullable_to_non_nullable + as List, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/query_message_flags_response.g.dart b/packages/stream_chat/lib/open_api/model/query_message_flags_response.g.dart new file mode 100644 index 0000000000..9df836ae12 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_message_flags_response.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'query_message_flags_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +QueryMessageFlagsResponse _$QueryMessageFlagsResponseFromJson( + Map json, +) => QueryMessageFlagsResponse( + duration: json['duration'] as String, + flags: (json['flags'] as List).map((e) => MessageFlagResponse.fromJson(e as Map)).toList(), +); + +Map _$QueryMessageFlagsResponseToJson( + QueryMessageFlagsResponse instance, +) => { + 'duration': instance.duration, + 'flags': instance.flags.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/query_moderation_configs_request.dart b/packages/stream_chat/lib/open_api/model/query_moderation_configs_request.dart new file mode 100644 index 0000000000..f71004bd47 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_moderation_configs_request.dart @@ -0,0 +1,52 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'query_moderation_configs_request.g.dart'; +part 'query_moderation_configs_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class QueryModerationConfigsRequest with _$QueryModerationConfigsRequest { + const QueryModerationConfigsRequest({ + this.filter, + this.limit, + this.next, + this.prev, + this.sort, + }); + + @override + @JsonKey(name: 'filter') + final Map? filter; + + @override + @JsonKey(name: 'limit') + final int? limit; + + @override + @JsonKey(name: 'next') + final String? next; + + @override + @JsonKey(name: 'prev') + final String? prev; + + @override + @JsonKey(name: 'sort') + final List? sort; + + Map toJson() => _$QueryModerationConfigsRequestToJson(this); + + static QueryModerationConfigsRequest fromJson(Map json) => + _$QueryModerationConfigsRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/query_moderation_configs_request.freezed.dart b/packages/stream_chat/lib/open_api/model/query_moderation_configs_request.freezed.dart new file mode 100644 index 0000000000..9a81feabcf --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_moderation_configs_request.freezed.dart @@ -0,0 +1,119 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'query_moderation_configs_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$QueryModerationConfigsRequest { + Map? get filter; + int? get limit; + String? get next; + String? get prev; + List? get sort; + + /// Create a copy of QueryModerationConfigsRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $QueryModerationConfigsRequestCopyWith get copyWith => + _$QueryModerationConfigsRequestCopyWithImpl( + this as QueryModerationConfigsRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is QueryModerationConfigsRequest && + const DeepCollectionEquality().equals(other.filter, filter) && + (identical(other.limit, limit) || other.limit == limit) && + (identical(other.next, next) || other.next == next) && + (identical(other.prev, prev) || other.prev == prev) && + const DeepCollectionEquality().equals(other.sort, sort)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(filter), + limit, + next, + prev, + const DeepCollectionEquality().hash(sort), + ); + + @override + String toString() { + return 'QueryModerationConfigsRequest(filter: $filter, limit: $limit, next: $next, prev: $prev, sort: $sort)'; + } +} + +/// @nodoc +abstract mixin class $QueryModerationConfigsRequestCopyWith<$Res> { + factory $QueryModerationConfigsRequestCopyWith( + QueryModerationConfigsRequest value, + $Res Function(QueryModerationConfigsRequest) _then, + ) = _$QueryModerationConfigsRequestCopyWithImpl; + @useResult + $Res call({ + Map? filter, + int? limit, + String? next, + String? prev, + List? sort, + }); +} + +/// @nodoc +class _$QueryModerationConfigsRequestCopyWithImpl<$Res> implements $QueryModerationConfigsRequestCopyWith<$Res> { + _$QueryModerationConfigsRequestCopyWithImpl(this._self, this._then); + + final QueryModerationConfigsRequest _self; + final $Res Function(QueryModerationConfigsRequest) _then; + + /// Create a copy of QueryModerationConfigsRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? filter = freezed, + Object? limit = freezed, + Object? next = freezed, + Object? prev = freezed, + Object? sort = freezed, + }) { + return _then( + QueryModerationConfigsRequest( + filter: freezed == filter + ? _self.filter + : filter // ignore: cast_nullable_to_non_nullable + as Map?, + limit: freezed == limit + ? _self.limit + : limit // ignore: cast_nullable_to_non_nullable + as int?, + next: freezed == next + ? _self.next + : next // ignore: cast_nullable_to_non_nullable + as String?, + prev: freezed == prev + ? _self.prev + : prev // ignore: cast_nullable_to_non_nullable + as String?, + sort: freezed == sort + ? _self.sort + : sort // ignore: cast_nullable_to_non_nullable + as List?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/query_moderation_configs_request.g.dart b/packages/stream_chat/lib/open_api/model/query_moderation_configs_request.g.dart new file mode 100644 index 0000000000..996e6657c7 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_moderation_configs_request.g.dart @@ -0,0 +1,27 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'query_moderation_configs_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +QueryModerationConfigsRequest _$QueryModerationConfigsRequestFromJson( + Map json, +) => QueryModerationConfigsRequest( + filter: json['filter'] as Map?, + limit: (json['limit'] as num?)?.toInt(), + next: json['next'] as String?, + prev: json['prev'] as String?, + sort: (json['sort'] as List?)?.map((e) => SortParamRequest.fromJson(e as Map)).toList(), +); + +Map _$QueryModerationConfigsRequestToJson( + QueryModerationConfigsRequest instance, +) => { + 'filter': instance.filter, + 'limit': instance.limit, + 'next': instance.next, + 'prev': instance.prev, + 'sort': instance.sort?.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/query_moderation_configs_response.dart b/packages/stream_chat/lib/open_api/model/query_moderation_configs_response.dart new file mode 100644 index 0000000000..372025d2a8 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_moderation_configs_response.dart @@ -0,0 +1,47 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'query_moderation_configs_response.g.dart'; +part 'query_moderation_configs_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class QueryModerationConfigsResponse with _$QueryModerationConfigsResponse { + const QueryModerationConfigsResponse({ + required this.configs, + required this.duration, + this.next, + this.prev, + }); + + @override + @JsonKey(name: 'configs') + final List configs; + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'next') + final String? next; + + @override + @JsonKey(name: 'prev') + final String? prev; + + Map toJson() => _$QueryModerationConfigsResponseToJson(this); + + static QueryModerationConfigsResponse fromJson(Map json) => + _$QueryModerationConfigsResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/query_moderation_configs_response.freezed.dart b/packages/stream_chat/lib/open_api/model/query_moderation_configs_response.freezed.dart new file mode 100644 index 0000000000..61ebf46d0b --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_moderation_configs_response.freezed.dart @@ -0,0 +1,110 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'query_moderation_configs_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$QueryModerationConfigsResponse { + List get configs; + String get duration; + String? get next; + String? get prev; + + /// Create a copy of QueryModerationConfigsResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $QueryModerationConfigsResponseCopyWith get copyWith => + _$QueryModerationConfigsResponseCopyWithImpl( + this as QueryModerationConfigsResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is QueryModerationConfigsResponse && + const DeepCollectionEquality().equals(other.configs, configs) && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.next, next) || other.next == next) && + (identical(other.prev, prev) || other.prev == prev)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(configs), + duration, + next, + prev, + ); + + @override + String toString() { + return 'QueryModerationConfigsResponse(configs: $configs, duration: $duration, next: $next, prev: $prev)'; + } +} + +/// @nodoc +abstract mixin class $QueryModerationConfigsResponseCopyWith<$Res> { + factory $QueryModerationConfigsResponseCopyWith( + QueryModerationConfigsResponse value, + $Res Function(QueryModerationConfigsResponse) _then, + ) = _$QueryModerationConfigsResponseCopyWithImpl; + @useResult + $Res call({ + List configs, + String duration, + String? next, + String? prev, + }); +} + +/// @nodoc +class _$QueryModerationConfigsResponseCopyWithImpl<$Res> implements $QueryModerationConfigsResponseCopyWith<$Res> { + _$QueryModerationConfigsResponseCopyWithImpl(this._self, this._then); + + final QueryModerationConfigsResponse _self; + final $Res Function(QueryModerationConfigsResponse) _then; + + /// Create a copy of QueryModerationConfigsResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? configs = null, + Object? duration = null, + Object? next = freezed, + Object? prev = freezed, + }) { + return _then( + QueryModerationConfigsResponse( + configs: null == configs + ? _self.configs + : configs // ignore: cast_nullable_to_non_nullable + as List, + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + next: freezed == next + ? _self.next + : next // ignore: cast_nullable_to_non_nullable + as String?, + prev: freezed == prev + ? _self.prev + : prev // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/query_moderation_configs_response.g.dart b/packages/stream_chat/lib/open_api/model/query_moderation_configs_response.g.dart new file mode 100644 index 0000000000..c07b1ecf2a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_moderation_configs_response.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'query_moderation_configs_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +QueryModerationConfigsResponse _$QueryModerationConfigsResponseFromJson( + Map json, +) => QueryModerationConfigsResponse( + configs: (json['configs'] as List).map((e) => ConfigResponse.fromJson(e as Map)).toList(), + duration: json['duration'] as String, + next: json['next'] as String?, + prev: json['prev'] as String?, +); + +Map _$QueryModerationConfigsResponseToJson( + QueryModerationConfigsResponse instance, +) => { + 'configs': instance.configs.map((e) => e.toJson()).toList(), + 'duration': instance.duration, + 'next': instance.next, + 'prev': instance.prev, +}; diff --git a/packages/stream_chat/lib/open_api/model/query_poll_votes_request.dart b/packages/stream_chat/lib/open_api/model/query_poll_votes_request.dart new file mode 100644 index 0000000000..ccd5f91267 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_poll_votes_request.dart @@ -0,0 +1,51 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'query_poll_votes_request.g.dart'; +part 'query_poll_votes_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class QueryPollVotesRequest with _$QueryPollVotesRequest { + const QueryPollVotesRequest({ + this.filter, + this.limit, + this.next, + this.prev, + this.sort, + }); + + @override + @JsonKey(name: 'filter') + final Map? filter; + + @override + @JsonKey(name: 'limit') + final int? limit; + + @override + @JsonKey(name: 'next') + final String? next; + + @override + @JsonKey(name: 'prev') + final String? prev; + + @override + @JsonKey(name: 'sort') + final List? sort; + + Map toJson() => _$QueryPollVotesRequestToJson(this); + + static QueryPollVotesRequest fromJson(Map json) => _$QueryPollVotesRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/query_poll_votes_request.freezed.dart b/packages/stream_chat/lib/open_api/model/query_poll_votes_request.freezed.dart new file mode 100644 index 0000000000..a1327932fc --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_poll_votes_request.freezed.dart @@ -0,0 +1,119 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'query_poll_votes_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$QueryPollVotesRequest { + Map? get filter; + int? get limit; + String? get next; + String? get prev; + List? get sort; + + /// Create a copy of QueryPollVotesRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $QueryPollVotesRequestCopyWith get copyWith => + _$QueryPollVotesRequestCopyWithImpl( + this as QueryPollVotesRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is QueryPollVotesRequest && + const DeepCollectionEquality().equals(other.filter, filter) && + (identical(other.limit, limit) || other.limit == limit) && + (identical(other.next, next) || other.next == next) && + (identical(other.prev, prev) || other.prev == prev) && + const DeepCollectionEquality().equals(other.sort, sort)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(filter), + limit, + next, + prev, + const DeepCollectionEquality().hash(sort), + ); + + @override + String toString() { + return 'QueryPollVotesRequest(filter: $filter, limit: $limit, next: $next, prev: $prev, sort: $sort)'; + } +} + +/// @nodoc +abstract mixin class $QueryPollVotesRequestCopyWith<$Res> { + factory $QueryPollVotesRequestCopyWith( + QueryPollVotesRequest value, + $Res Function(QueryPollVotesRequest) _then, + ) = _$QueryPollVotesRequestCopyWithImpl; + @useResult + $Res call({ + Map? filter, + int? limit, + String? next, + String? prev, + List? sort, + }); +} + +/// @nodoc +class _$QueryPollVotesRequestCopyWithImpl<$Res> implements $QueryPollVotesRequestCopyWith<$Res> { + _$QueryPollVotesRequestCopyWithImpl(this._self, this._then); + + final QueryPollVotesRequest _self; + final $Res Function(QueryPollVotesRequest) _then; + + /// Create a copy of QueryPollVotesRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? filter = freezed, + Object? limit = freezed, + Object? next = freezed, + Object? prev = freezed, + Object? sort = freezed, + }) { + return _then( + QueryPollVotesRequest( + filter: freezed == filter + ? _self.filter + : filter // ignore: cast_nullable_to_non_nullable + as Map?, + limit: freezed == limit + ? _self.limit + : limit // ignore: cast_nullable_to_non_nullable + as int?, + next: freezed == next + ? _self.next + : next // ignore: cast_nullable_to_non_nullable + as String?, + prev: freezed == prev + ? _self.prev + : prev // ignore: cast_nullable_to_non_nullable + as String?, + sort: freezed == sort + ? _self.sort + : sort // ignore: cast_nullable_to_non_nullable + as List?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/query_poll_votes_request.g.dart b/packages/stream_chat/lib/open_api/model/query_poll_votes_request.g.dart new file mode 100644 index 0000000000..aee70dc802 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_poll_votes_request.g.dart @@ -0,0 +1,27 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'query_poll_votes_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +QueryPollVotesRequest _$QueryPollVotesRequestFromJson( + Map json, +) => QueryPollVotesRequest( + filter: json['filter'] as Map?, + limit: (json['limit'] as num?)?.toInt(), + next: json['next'] as String?, + prev: json['prev'] as String?, + sort: (json['sort'] as List?)?.map((e) => SortParamRequest.fromJson(e as Map)).toList(), +); + +Map _$QueryPollVotesRequestToJson( + QueryPollVotesRequest instance, +) => { + 'filter': instance.filter, + 'limit': instance.limit, + 'next': instance.next, + 'prev': instance.prev, + 'sort': instance.sort?.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/query_polls_request.dart b/packages/stream_chat/lib/open_api/model/query_polls_request.dart new file mode 100644 index 0000000000..52c3a7981c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_polls_request.dart @@ -0,0 +1,51 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'query_polls_request.g.dart'; +part 'query_polls_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class QueryPollsRequest with _$QueryPollsRequest { + const QueryPollsRequest({ + this.filter, + this.limit, + this.next, + this.prev, + this.sort, + }); + + @override + @JsonKey(name: 'filter') + final Map? filter; + + @override + @JsonKey(name: 'limit') + final int? limit; + + @override + @JsonKey(name: 'next') + final String? next; + + @override + @JsonKey(name: 'prev') + final String? prev; + + @override + @JsonKey(name: 'sort') + final List? sort; + + Map toJson() => _$QueryPollsRequestToJson(this); + + static QueryPollsRequest fromJson(Map json) => _$QueryPollsRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/query_polls_request.freezed.dart b/packages/stream_chat/lib/open_api/model/query_polls_request.freezed.dart new file mode 100644 index 0000000000..d05a32225b --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_polls_request.freezed.dart @@ -0,0 +1,118 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'query_polls_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$QueryPollsRequest { + Map? get filter; + int? get limit; + String? get next; + String? get prev; + List? get sort; + + /// Create a copy of QueryPollsRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $QueryPollsRequestCopyWith get copyWith => _$QueryPollsRequestCopyWithImpl( + this as QueryPollsRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is QueryPollsRequest && + const DeepCollectionEquality().equals(other.filter, filter) && + (identical(other.limit, limit) || other.limit == limit) && + (identical(other.next, next) || other.next == next) && + (identical(other.prev, prev) || other.prev == prev) && + const DeepCollectionEquality().equals(other.sort, sort)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(filter), + limit, + next, + prev, + const DeepCollectionEquality().hash(sort), + ); + + @override + String toString() { + return 'QueryPollsRequest(filter: $filter, limit: $limit, next: $next, prev: $prev, sort: $sort)'; + } +} + +/// @nodoc +abstract mixin class $QueryPollsRequestCopyWith<$Res> { + factory $QueryPollsRequestCopyWith( + QueryPollsRequest value, + $Res Function(QueryPollsRequest) _then, + ) = _$QueryPollsRequestCopyWithImpl; + @useResult + $Res call({ + Map? filter, + int? limit, + String? next, + String? prev, + List? sort, + }); +} + +/// @nodoc +class _$QueryPollsRequestCopyWithImpl<$Res> implements $QueryPollsRequestCopyWith<$Res> { + _$QueryPollsRequestCopyWithImpl(this._self, this._then); + + final QueryPollsRequest _self; + final $Res Function(QueryPollsRequest) _then; + + /// Create a copy of QueryPollsRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? filter = freezed, + Object? limit = freezed, + Object? next = freezed, + Object? prev = freezed, + Object? sort = freezed, + }) { + return _then( + QueryPollsRequest( + filter: freezed == filter + ? _self.filter + : filter // ignore: cast_nullable_to_non_nullable + as Map?, + limit: freezed == limit + ? _self.limit + : limit // ignore: cast_nullable_to_non_nullable + as int?, + next: freezed == next + ? _self.next + : next // ignore: cast_nullable_to_non_nullable + as String?, + prev: freezed == prev + ? _self.prev + : prev // ignore: cast_nullable_to_non_nullable + as String?, + sort: freezed == sort + ? _self.sort + : sort // ignore: cast_nullable_to_non_nullable + as List?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/query_polls_request.g.dart b/packages/stream_chat/lib/open_api/model/query_polls_request.g.dart new file mode 100644 index 0000000000..e48f474764 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_polls_request.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'query_polls_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +QueryPollsRequest _$QueryPollsRequestFromJson(Map json) => QueryPollsRequest( + filter: json['filter'] as Map?, + limit: (json['limit'] as num?)?.toInt(), + next: json['next'] as String?, + prev: json['prev'] as String?, + sort: (json['sort'] as List?)?.map((e) => SortParamRequest.fromJson(e as Map)).toList(), +); + +Map _$QueryPollsRequestToJson(QueryPollsRequest instance) => { + 'filter': instance.filter, + 'limit': instance.limit, + 'next': instance.next, + 'prev': instance.prev, + 'sort': instance.sort?.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/query_polls_response.dart b/packages/stream_chat/lib/open_api/model/query_polls_response.dart new file mode 100644 index 0000000000..d545205a13 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_polls_response.dart @@ -0,0 +1,46 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'query_polls_response.g.dart'; +part 'query_polls_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class QueryPollsResponse with _$QueryPollsResponse { + const QueryPollsResponse({ + required this.duration, + this.next, + required this.polls, + this.prev, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'next') + final String? next; + + @override + @JsonKey(name: 'polls') + final List polls; + + @override + @JsonKey(name: 'prev') + final String? prev; + + Map toJson() => _$QueryPollsResponseToJson(this); + + static QueryPollsResponse fromJson(Map json) => _$QueryPollsResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/query_polls_response.freezed.dart b/packages/stream_chat/lib/open_api/model/query_polls_response.freezed.dart new file mode 100644 index 0000000000..66318d497f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_polls_response.freezed.dart @@ -0,0 +1,109 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'query_polls_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$QueryPollsResponse { + String get duration; + String? get next; + List get polls; + String? get prev; + + /// Create a copy of QueryPollsResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $QueryPollsResponseCopyWith get copyWith => _$QueryPollsResponseCopyWithImpl( + this as QueryPollsResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is QueryPollsResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.next, next) || other.next == next) && + const DeepCollectionEquality().equals(other.polls, polls) && + (identical(other.prev, prev) || other.prev == prev)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + duration, + next, + const DeepCollectionEquality().hash(polls), + prev, + ); + + @override + String toString() { + return 'QueryPollsResponse(duration: $duration, next: $next, polls: $polls, prev: $prev)'; + } +} + +/// @nodoc +abstract mixin class $QueryPollsResponseCopyWith<$Res> { + factory $QueryPollsResponseCopyWith( + QueryPollsResponse value, + $Res Function(QueryPollsResponse) _then, + ) = _$QueryPollsResponseCopyWithImpl; + @useResult + $Res call({ + String duration, + String? next, + List polls, + String? prev, + }); +} + +/// @nodoc +class _$QueryPollsResponseCopyWithImpl<$Res> implements $QueryPollsResponseCopyWith<$Res> { + _$QueryPollsResponseCopyWithImpl(this._self, this._then); + + final QueryPollsResponse _self; + final $Res Function(QueryPollsResponse) _then; + + /// Create a copy of QueryPollsResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? duration = null, + Object? next = freezed, + Object? polls = null, + Object? prev = freezed, + }) { + return _then( + QueryPollsResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + next: freezed == next + ? _self.next + : next // ignore: cast_nullable_to_non_nullable + as String?, + polls: null == polls + ? _self.polls + : polls // ignore: cast_nullable_to_non_nullable + as List, + prev: freezed == prev + ? _self.prev + : prev // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/query_polls_response.g.dart b/packages/stream_chat/lib/open_api/model/query_polls_response.g.dart new file mode 100644 index 0000000000..e0a47aa446 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_polls_response.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'query_polls_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +QueryPollsResponse _$QueryPollsResponseFromJson(Map json) => QueryPollsResponse( + duration: json['duration'] as String, + next: json['next'] as String?, + polls: (json['polls'] as List).map((e) => PollResponseData.fromJson(e as Map)).toList(), + prev: json['prev'] as String?, +); + +Map _$QueryPollsResponseToJson(QueryPollsResponse instance) => { + 'duration': instance.duration, + 'next': instance.next, + 'polls': instance.polls.map((e) => e.toJson()).toList(), + 'prev': instance.prev, +}; diff --git a/packages/stream_chat/lib/open_api/model/query_reactions_request.dart b/packages/stream_chat/lib/open_api/model/query_reactions_request.dart new file mode 100644 index 0000000000..8484877db2 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_reactions_request.dart @@ -0,0 +1,51 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'query_reactions_request.g.dart'; +part 'query_reactions_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class QueryReactionsRequest with _$QueryReactionsRequest { + const QueryReactionsRequest({ + this.filter, + this.limit, + this.next, + this.prev, + this.sort, + }); + + @override + @JsonKey(name: 'filter') + final Map? filter; + + @override + @JsonKey(name: 'limit') + final int? limit; + + @override + @JsonKey(name: 'next') + final String? next; + + @override + @JsonKey(name: 'prev') + final String? prev; + + @override + @JsonKey(name: 'sort') + final List? sort; + + Map toJson() => _$QueryReactionsRequestToJson(this); + + static QueryReactionsRequest fromJson(Map json) => _$QueryReactionsRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/query_reactions_request.freezed.dart b/packages/stream_chat/lib/open_api/model/query_reactions_request.freezed.dart new file mode 100644 index 0000000000..e2730f1b8c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_reactions_request.freezed.dart @@ -0,0 +1,119 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'query_reactions_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$QueryReactionsRequest { + Map? get filter; + int? get limit; + String? get next; + String? get prev; + List? get sort; + + /// Create a copy of QueryReactionsRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $QueryReactionsRequestCopyWith get copyWith => + _$QueryReactionsRequestCopyWithImpl( + this as QueryReactionsRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is QueryReactionsRequest && + const DeepCollectionEquality().equals(other.filter, filter) && + (identical(other.limit, limit) || other.limit == limit) && + (identical(other.next, next) || other.next == next) && + (identical(other.prev, prev) || other.prev == prev) && + const DeepCollectionEquality().equals(other.sort, sort)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(filter), + limit, + next, + prev, + const DeepCollectionEquality().hash(sort), + ); + + @override + String toString() { + return 'QueryReactionsRequest(filter: $filter, limit: $limit, next: $next, prev: $prev, sort: $sort)'; + } +} + +/// @nodoc +abstract mixin class $QueryReactionsRequestCopyWith<$Res> { + factory $QueryReactionsRequestCopyWith( + QueryReactionsRequest value, + $Res Function(QueryReactionsRequest) _then, + ) = _$QueryReactionsRequestCopyWithImpl; + @useResult + $Res call({ + Map? filter, + int? limit, + String? next, + String? prev, + List? sort, + }); +} + +/// @nodoc +class _$QueryReactionsRequestCopyWithImpl<$Res> implements $QueryReactionsRequestCopyWith<$Res> { + _$QueryReactionsRequestCopyWithImpl(this._self, this._then); + + final QueryReactionsRequest _self; + final $Res Function(QueryReactionsRequest) _then; + + /// Create a copy of QueryReactionsRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? filter = freezed, + Object? limit = freezed, + Object? next = freezed, + Object? prev = freezed, + Object? sort = freezed, + }) { + return _then( + QueryReactionsRequest( + filter: freezed == filter + ? _self.filter + : filter // ignore: cast_nullable_to_non_nullable + as Map?, + limit: freezed == limit + ? _self.limit + : limit // ignore: cast_nullable_to_non_nullable + as int?, + next: freezed == next + ? _self.next + : next // ignore: cast_nullable_to_non_nullable + as String?, + prev: freezed == prev + ? _self.prev + : prev // ignore: cast_nullable_to_non_nullable + as String?, + sort: freezed == sort + ? _self.sort + : sort // ignore: cast_nullable_to_non_nullable + as List?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/query_reactions_request.g.dart b/packages/stream_chat/lib/open_api/model/query_reactions_request.g.dart new file mode 100644 index 0000000000..22c77d5203 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_reactions_request.g.dart @@ -0,0 +1,27 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'query_reactions_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +QueryReactionsRequest _$QueryReactionsRequestFromJson( + Map json, +) => QueryReactionsRequest( + filter: json['filter'] as Map?, + limit: (json['limit'] as num?)?.toInt(), + next: json['next'] as String?, + prev: json['prev'] as String?, + sort: (json['sort'] as List?)?.map((e) => SortParamRequest.fromJson(e as Map)).toList(), +); + +Map _$QueryReactionsRequestToJson( + QueryReactionsRequest instance, +) => { + 'filter': instance.filter, + 'limit': instance.limit, + 'next': instance.next, + 'prev': instance.prev, + 'sort': instance.sort?.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/query_reactions_response.dart b/packages/stream_chat/lib/open_api/model/query_reactions_response.dart new file mode 100644 index 0000000000..93a78a1285 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_reactions_response.dart @@ -0,0 +1,46 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'query_reactions_response.g.dart'; +part 'query_reactions_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class QueryReactionsResponse with _$QueryReactionsResponse { + const QueryReactionsResponse({ + required this.duration, + this.next, + this.prev, + required this.reactions, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'next') + final String? next; + + @override + @JsonKey(name: 'prev') + final String? prev; + + @override + @JsonKey(name: 'reactions') + final List reactions; + + Map toJson() => _$QueryReactionsResponseToJson(this); + + static QueryReactionsResponse fromJson(Map json) => _$QueryReactionsResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/query_reactions_response.freezed.dart b/packages/stream_chat/lib/open_api/model/query_reactions_response.freezed.dart new file mode 100644 index 0000000000..81f3fed347 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_reactions_response.freezed.dart @@ -0,0 +1,110 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'query_reactions_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$QueryReactionsResponse { + String get duration; + String? get next; + String? get prev; + List get reactions; + + /// Create a copy of QueryReactionsResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $QueryReactionsResponseCopyWith get copyWith => + _$QueryReactionsResponseCopyWithImpl( + this as QueryReactionsResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is QueryReactionsResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.next, next) || other.next == next) && + (identical(other.prev, prev) || other.prev == prev) && + const DeepCollectionEquality().equals(other.reactions, reactions)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + duration, + next, + prev, + const DeepCollectionEquality().hash(reactions), + ); + + @override + String toString() { + return 'QueryReactionsResponse(duration: $duration, next: $next, prev: $prev, reactions: $reactions)'; + } +} + +/// @nodoc +abstract mixin class $QueryReactionsResponseCopyWith<$Res> { + factory $QueryReactionsResponseCopyWith( + QueryReactionsResponse value, + $Res Function(QueryReactionsResponse) _then, + ) = _$QueryReactionsResponseCopyWithImpl; + @useResult + $Res call({ + String duration, + String? next, + String? prev, + List reactions, + }); +} + +/// @nodoc +class _$QueryReactionsResponseCopyWithImpl<$Res> implements $QueryReactionsResponseCopyWith<$Res> { + _$QueryReactionsResponseCopyWithImpl(this._self, this._then); + + final QueryReactionsResponse _self; + final $Res Function(QueryReactionsResponse) _then; + + /// Create a copy of QueryReactionsResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? duration = null, + Object? next = freezed, + Object? prev = freezed, + Object? reactions = null, + }) { + return _then( + QueryReactionsResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + next: freezed == next + ? _self.next + : next // ignore: cast_nullable_to_non_nullable + as String?, + prev: freezed == prev + ? _self.prev + : prev // ignore: cast_nullable_to_non_nullable + as String?, + reactions: null == reactions + ? _self.reactions + : reactions // ignore: cast_nullable_to_non_nullable + as List, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/query_reactions_response.g.dart b/packages/stream_chat/lib/open_api/model/query_reactions_response.g.dart new file mode 100644 index 0000000000..521eb78fe9 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_reactions_response.g.dart @@ -0,0 +1,27 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'query_reactions_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +QueryReactionsResponse _$QueryReactionsResponseFromJson( + Map json, +) => QueryReactionsResponse( + duration: json['duration'] as String, + next: json['next'] as String?, + prev: json['prev'] as String?, + reactions: (json['reactions'] as List) + .map((e) => ReactionResponse.fromJson(e as Map)) + .toList(), +); + +Map _$QueryReactionsResponseToJson( + QueryReactionsResponse instance, +) => { + 'duration': instance.duration, + 'next': instance.next, + 'prev': instance.prev, + 'reactions': instance.reactions.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/query_reminders_request.dart b/packages/stream_chat/lib/open_api/model/query_reminders_request.dart new file mode 100644 index 0000000000..7c60d35e5d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_reminders_request.dart @@ -0,0 +1,51 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'query_reminders_request.g.dart'; +part 'query_reminders_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class QueryRemindersRequest with _$QueryRemindersRequest { + const QueryRemindersRequest({ + this.filter, + this.limit, + this.next, + this.prev, + this.sort, + }); + + @override + @JsonKey(name: 'filter') + final Map? filter; + + @override + @JsonKey(name: 'limit') + final int? limit; + + @override + @JsonKey(name: 'next') + final String? next; + + @override + @JsonKey(name: 'prev') + final String? prev; + + @override + @JsonKey(name: 'sort') + final List? sort; + + Map toJson() => _$QueryRemindersRequestToJson(this); + + static QueryRemindersRequest fromJson(Map json) => _$QueryRemindersRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/query_reminders_request.freezed.dart b/packages/stream_chat/lib/open_api/model/query_reminders_request.freezed.dart new file mode 100644 index 0000000000..53c7878360 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_reminders_request.freezed.dart @@ -0,0 +1,119 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'query_reminders_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$QueryRemindersRequest { + Map? get filter; + int? get limit; + String? get next; + String? get prev; + List? get sort; + + /// Create a copy of QueryRemindersRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $QueryRemindersRequestCopyWith get copyWith => + _$QueryRemindersRequestCopyWithImpl( + this as QueryRemindersRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is QueryRemindersRequest && + const DeepCollectionEquality().equals(other.filter, filter) && + (identical(other.limit, limit) || other.limit == limit) && + (identical(other.next, next) || other.next == next) && + (identical(other.prev, prev) || other.prev == prev) && + const DeepCollectionEquality().equals(other.sort, sort)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(filter), + limit, + next, + prev, + const DeepCollectionEquality().hash(sort), + ); + + @override + String toString() { + return 'QueryRemindersRequest(filter: $filter, limit: $limit, next: $next, prev: $prev, sort: $sort)'; + } +} + +/// @nodoc +abstract mixin class $QueryRemindersRequestCopyWith<$Res> { + factory $QueryRemindersRequestCopyWith( + QueryRemindersRequest value, + $Res Function(QueryRemindersRequest) _then, + ) = _$QueryRemindersRequestCopyWithImpl; + @useResult + $Res call({ + Map? filter, + int? limit, + String? next, + String? prev, + List? sort, + }); +} + +/// @nodoc +class _$QueryRemindersRequestCopyWithImpl<$Res> implements $QueryRemindersRequestCopyWith<$Res> { + _$QueryRemindersRequestCopyWithImpl(this._self, this._then); + + final QueryRemindersRequest _self; + final $Res Function(QueryRemindersRequest) _then; + + /// Create a copy of QueryRemindersRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? filter = freezed, + Object? limit = freezed, + Object? next = freezed, + Object? prev = freezed, + Object? sort = freezed, + }) { + return _then( + QueryRemindersRequest( + filter: freezed == filter + ? _self.filter + : filter // ignore: cast_nullable_to_non_nullable + as Map?, + limit: freezed == limit + ? _self.limit + : limit // ignore: cast_nullable_to_non_nullable + as int?, + next: freezed == next + ? _self.next + : next // ignore: cast_nullable_to_non_nullable + as String?, + prev: freezed == prev + ? _self.prev + : prev // ignore: cast_nullable_to_non_nullable + as String?, + sort: freezed == sort + ? _self.sort + : sort // ignore: cast_nullable_to_non_nullable + as List?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/query_reminders_request.g.dart b/packages/stream_chat/lib/open_api/model/query_reminders_request.g.dart new file mode 100644 index 0000000000..8c2e0d03fb --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_reminders_request.g.dart @@ -0,0 +1,27 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'query_reminders_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +QueryRemindersRequest _$QueryRemindersRequestFromJson( + Map json, +) => QueryRemindersRequest( + filter: json['filter'] as Map?, + limit: (json['limit'] as num?)?.toInt(), + next: json['next'] as String?, + prev: json['prev'] as String?, + sort: (json['sort'] as List?)?.map((e) => SortParamRequest.fromJson(e as Map)).toList(), +); + +Map _$QueryRemindersRequestToJson( + QueryRemindersRequest instance, +) => { + 'filter': instance.filter, + 'limit': instance.limit, + 'next': instance.next, + 'prev': instance.prev, + 'sort': instance.sort?.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/query_reminders_response.dart b/packages/stream_chat/lib/open_api/model/query_reminders_response.dart new file mode 100644 index 0000000000..83505b13f6 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_reminders_response.dart @@ -0,0 +1,46 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'query_reminders_response.g.dart'; +part 'query_reminders_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class QueryRemindersResponse with _$QueryRemindersResponse { + const QueryRemindersResponse({ + required this.duration, + this.next, + this.prev, + required this.reminders, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'next') + final String? next; + + @override + @JsonKey(name: 'prev') + final String? prev; + + @override + @JsonKey(name: 'reminders') + final List reminders; + + Map toJson() => _$QueryRemindersResponseToJson(this); + + static QueryRemindersResponse fromJson(Map json) => _$QueryRemindersResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/query_reminders_response.freezed.dart b/packages/stream_chat/lib/open_api/model/query_reminders_response.freezed.dart new file mode 100644 index 0000000000..7758591e1e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_reminders_response.freezed.dart @@ -0,0 +1,110 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'query_reminders_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$QueryRemindersResponse { + String get duration; + String? get next; + String? get prev; + List get reminders; + + /// Create a copy of QueryRemindersResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $QueryRemindersResponseCopyWith get copyWith => + _$QueryRemindersResponseCopyWithImpl( + this as QueryRemindersResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is QueryRemindersResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.next, next) || other.next == next) && + (identical(other.prev, prev) || other.prev == prev) && + const DeepCollectionEquality().equals(other.reminders, reminders)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + duration, + next, + prev, + const DeepCollectionEquality().hash(reminders), + ); + + @override + String toString() { + return 'QueryRemindersResponse(duration: $duration, next: $next, prev: $prev, reminders: $reminders)'; + } +} + +/// @nodoc +abstract mixin class $QueryRemindersResponseCopyWith<$Res> { + factory $QueryRemindersResponseCopyWith( + QueryRemindersResponse value, + $Res Function(QueryRemindersResponse) _then, + ) = _$QueryRemindersResponseCopyWithImpl; + @useResult + $Res call({ + String duration, + String? next, + String? prev, + List reminders, + }); +} + +/// @nodoc +class _$QueryRemindersResponseCopyWithImpl<$Res> implements $QueryRemindersResponseCopyWith<$Res> { + _$QueryRemindersResponseCopyWithImpl(this._self, this._then); + + final QueryRemindersResponse _self; + final $Res Function(QueryRemindersResponse) _then; + + /// Create a copy of QueryRemindersResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? duration = null, + Object? next = freezed, + Object? prev = freezed, + Object? reminders = null, + }) { + return _then( + QueryRemindersResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + next: freezed == next + ? _self.next + : next // ignore: cast_nullable_to_non_nullable + as String?, + prev: freezed == prev + ? _self.prev + : prev // ignore: cast_nullable_to_non_nullable + as String?, + reminders: null == reminders + ? _self.reminders + : reminders // ignore: cast_nullable_to_non_nullable + as List, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/query_reminders_response.g.dart b/packages/stream_chat/lib/open_api/model/query_reminders_response.g.dart new file mode 100644 index 0000000000..5dba43cc1f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_reminders_response.g.dart @@ -0,0 +1,27 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'query_reminders_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +QueryRemindersResponse _$QueryRemindersResponseFromJson( + Map json, +) => QueryRemindersResponse( + duration: json['duration'] as String, + next: json['next'] as String?, + prev: json['prev'] as String?, + reminders: (json['reminders'] as List) + .map((e) => ReminderResponseData.fromJson(e as Map)) + .toList(), +); + +Map _$QueryRemindersResponseToJson( + QueryRemindersResponse instance, +) => { + 'duration': instance.duration, + 'next': instance.next, + 'prev': instance.prev, + 'reminders': instance.reminders.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/query_review_queue_request.dart b/packages/stream_chat/lib/open_api/model/query_review_queue_request.dart new file mode 100644 index 0000000000..ec1dc7797b --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_review_queue_request.dart @@ -0,0 +1,76 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'query_review_queue_request.g.dart'; +part 'query_review_queue_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class QueryReviewQueueRequest with _$QueryReviewQueueRequest { + const QueryReviewQueueRequest({ + this.excludeDefaultActionConfig, + this.filter, + this.limit, + this.lockCount, + this.lockDuration, + this.lockItems, + this.next, + this.prev, + this.sort, + this.statsOnly, + }); + + @override + @JsonKey(name: 'exclude_default_action_config') + final bool? excludeDefaultActionConfig; + + @override + @JsonKey(name: 'filter') + final Map? filter; + + @override + @JsonKey(name: 'limit') + final int? limit; + + @override + @JsonKey(name: 'lock_count') + final int? lockCount; + + @override + @JsonKey(name: 'lock_duration') + final int? lockDuration; + + @override + @JsonKey(name: 'lock_items') + final bool? lockItems; + + @override + @JsonKey(name: 'next') + final String? next; + + @override + @JsonKey(name: 'prev') + final String? prev; + + @override + @JsonKey(name: 'sort') + final List? sort; + + @override + @JsonKey(name: 'stats_only') + final bool? statsOnly; + + Map toJson() => _$QueryReviewQueueRequestToJson(this); + + static QueryReviewQueueRequest fromJson(Map json) => _$QueryReviewQueueRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/query_review_queue_request.freezed.dart b/packages/stream_chat/lib/open_api/model/query_review_queue_request.freezed.dart new file mode 100644 index 0000000000..0f0ae21954 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_review_queue_request.freezed.dart @@ -0,0 +1,168 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'query_review_queue_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$QueryReviewQueueRequest { + bool? get excludeDefaultActionConfig; + Map? get filter; + int? get limit; + int? get lockCount; + int? get lockDuration; + bool? get lockItems; + String? get next; + String? get prev; + List? get sort; + bool? get statsOnly; + + /// Create a copy of QueryReviewQueueRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $QueryReviewQueueRequestCopyWith get copyWith => + _$QueryReviewQueueRequestCopyWithImpl( + this as QueryReviewQueueRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is QueryReviewQueueRequest && + (identical( + other.excludeDefaultActionConfig, + excludeDefaultActionConfig, + ) || + other.excludeDefaultActionConfig == excludeDefaultActionConfig) && + const DeepCollectionEquality().equals(other.filter, filter) && + (identical(other.limit, limit) || other.limit == limit) && + (identical(other.lockCount, lockCount) || other.lockCount == lockCount) && + (identical(other.lockDuration, lockDuration) || other.lockDuration == lockDuration) && + (identical(other.lockItems, lockItems) || other.lockItems == lockItems) && + (identical(other.next, next) || other.next == next) && + (identical(other.prev, prev) || other.prev == prev) && + const DeepCollectionEquality().equals(other.sort, sort) && + (identical(other.statsOnly, statsOnly) || other.statsOnly == statsOnly)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + excludeDefaultActionConfig, + const DeepCollectionEquality().hash(filter), + limit, + lockCount, + lockDuration, + lockItems, + next, + prev, + const DeepCollectionEquality().hash(sort), + statsOnly, + ); + + @override + String toString() { + return 'QueryReviewQueueRequest(excludeDefaultActionConfig: $excludeDefaultActionConfig, filter: $filter, limit: $limit, lockCount: $lockCount, lockDuration: $lockDuration, lockItems: $lockItems, next: $next, prev: $prev, sort: $sort, statsOnly: $statsOnly)'; + } +} + +/// @nodoc +abstract mixin class $QueryReviewQueueRequestCopyWith<$Res> { + factory $QueryReviewQueueRequestCopyWith( + QueryReviewQueueRequest value, + $Res Function(QueryReviewQueueRequest) _then, + ) = _$QueryReviewQueueRequestCopyWithImpl; + @useResult + $Res call({ + bool? excludeDefaultActionConfig, + Map? filter, + int? limit, + int? lockCount, + int? lockDuration, + bool? lockItems, + String? next, + String? prev, + List? sort, + bool? statsOnly, + }); +} + +/// @nodoc +class _$QueryReviewQueueRequestCopyWithImpl<$Res> implements $QueryReviewQueueRequestCopyWith<$Res> { + _$QueryReviewQueueRequestCopyWithImpl(this._self, this._then); + + final QueryReviewQueueRequest _self; + final $Res Function(QueryReviewQueueRequest) _then; + + /// Create a copy of QueryReviewQueueRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? excludeDefaultActionConfig = freezed, + Object? filter = freezed, + Object? limit = freezed, + Object? lockCount = freezed, + Object? lockDuration = freezed, + Object? lockItems = freezed, + Object? next = freezed, + Object? prev = freezed, + Object? sort = freezed, + Object? statsOnly = freezed, + }) { + return _then( + QueryReviewQueueRequest( + excludeDefaultActionConfig: freezed == excludeDefaultActionConfig + ? _self.excludeDefaultActionConfig + : excludeDefaultActionConfig // ignore: cast_nullable_to_non_nullable + as bool?, + filter: freezed == filter + ? _self.filter + : filter // ignore: cast_nullable_to_non_nullable + as Map?, + limit: freezed == limit + ? _self.limit + : limit // ignore: cast_nullable_to_non_nullable + as int?, + lockCount: freezed == lockCount + ? _self.lockCount + : lockCount // ignore: cast_nullable_to_non_nullable + as int?, + lockDuration: freezed == lockDuration + ? _self.lockDuration + : lockDuration // ignore: cast_nullable_to_non_nullable + as int?, + lockItems: freezed == lockItems + ? _self.lockItems + : lockItems // ignore: cast_nullable_to_non_nullable + as bool?, + next: freezed == next + ? _self.next + : next // ignore: cast_nullable_to_non_nullable + as String?, + prev: freezed == prev + ? _self.prev + : prev // ignore: cast_nullable_to_non_nullable + as String?, + sort: freezed == sort + ? _self.sort + : sort // ignore: cast_nullable_to_non_nullable + as List?, + statsOnly: freezed == statsOnly + ? _self.statsOnly + : statsOnly // ignore: cast_nullable_to_non_nullable + as bool?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/query_review_queue_request.g.dart b/packages/stream_chat/lib/open_api/model/query_review_queue_request.g.dart new file mode 100644 index 0000000000..078b72020f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_review_queue_request.g.dart @@ -0,0 +1,37 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'query_review_queue_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +QueryReviewQueueRequest _$QueryReviewQueueRequestFromJson( + Map json, +) => QueryReviewQueueRequest( + excludeDefaultActionConfig: json['exclude_default_action_config'] as bool?, + filter: json['filter'] as Map?, + limit: (json['limit'] as num?)?.toInt(), + lockCount: (json['lock_count'] as num?)?.toInt(), + lockDuration: (json['lock_duration'] as num?)?.toInt(), + lockItems: json['lock_items'] as bool?, + next: json['next'] as String?, + prev: json['prev'] as String?, + sort: (json['sort'] as List?)?.map((e) => SortParamRequest.fromJson(e as Map)).toList(), + statsOnly: json['stats_only'] as bool?, +); + +Map _$QueryReviewQueueRequestToJson( + QueryReviewQueueRequest instance, +) => { + 'exclude_default_action_config': instance.excludeDefaultActionConfig, + 'filter': instance.filter, + 'limit': instance.limit, + 'lock_count': instance.lockCount, + 'lock_duration': instance.lockDuration, + 'lock_items': instance.lockItems, + 'next': instance.next, + 'prev': instance.prev, + 'sort': instance.sort?.map((e) => e.toJson()).toList(), + 'stats_only': instance.statsOnly, +}; diff --git a/packages/stream_chat/lib/open_api/model/query_review_queue_response.dart b/packages/stream_chat/lib/open_api/model/query_review_queue_response.dart new file mode 100644 index 0000000000..d980dcb5b0 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_review_queue_response.dart @@ -0,0 +1,66 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'query_review_queue_response.g.dart'; +part 'query_review_queue_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class QueryReviewQueueResponse with _$QueryReviewQueueResponse { + const QueryReviewQueueResponse({ + required this.actionConfig, + this.defaultActionConfig, + required this.duration, + this.filterConfig, + required this.items, + this.next, + this.prev, + required this.stats, + }); + + @override + @JsonKey(name: 'action_config') + final Map> actionConfig; + + @override + @JsonKey(name: 'default_action_config') + final Map>? defaultActionConfig; + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'filter_config') + final FilterConfigResponse? filterConfig; + + @override + @JsonKey(name: 'items') + final List items; + + @override + @JsonKey(name: 'next') + final String? next; + + @override + @JsonKey(name: 'prev') + final String? prev; + + @override + @JsonKey(name: 'stats') + final Map stats; + + Map toJson() => _$QueryReviewQueueResponseToJson(this); + + static QueryReviewQueueResponse fromJson(Map json) => _$QueryReviewQueueResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/query_review_queue_response.freezed.dart b/packages/stream_chat/lib/open_api/model/query_review_queue_response.freezed.dart new file mode 100644 index 0000000000..2bd376df46 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_review_queue_response.freezed.dart @@ -0,0 +1,152 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'query_review_queue_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$QueryReviewQueueResponse { + Map> get actionConfig; + Map>? get defaultActionConfig; + String get duration; + FilterConfigResponse? get filterConfig; + List get items; + String? get next; + String? get prev; + Map get stats; + + /// Create a copy of QueryReviewQueueResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $QueryReviewQueueResponseCopyWith get copyWith => + _$QueryReviewQueueResponseCopyWithImpl( + this as QueryReviewQueueResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is QueryReviewQueueResponse && + const DeepCollectionEquality().equals( + other.actionConfig, + actionConfig, + ) && + const DeepCollectionEquality().equals( + other.defaultActionConfig, + defaultActionConfig, + ) && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.filterConfig, filterConfig) || other.filterConfig == filterConfig) && + const DeepCollectionEquality().equals(other.items, items) && + (identical(other.next, next) || other.next == next) && + (identical(other.prev, prev) || other.prev == prev) && + const DeepCollectionEquality().equals(other.stats, stats)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(actionConfig), + const DeepCollectionEquality().hash(defaultActionConfig), + duration, + filterConfig, + const DeepCollectionEquality().hash(items), + next, + prev, + const DeepCollectionEquality().hash(stats), + ); + + @override + String toString() { + return 'QueryReviewQueueResponse(actionConfig: $actionConfig, defaultActionConfig: $defaultActionConfig, duration: $duration, filterConfig: $filterConfig, items: $items, next: $next, prev: $prev, stats: $stats)'; + } +} + +/// @nodoc +abstract mixin class $QueryReviewQueueResponseCopyWith<$Res> { + factory $QueryReviewQueueResponseCopyWith( + QueryReviewQueueResponse value, + $Res Function(QueryReviewQueueResponse) _then, + ) = _$QueryReviewQueueResponseCopyWithImpl; + @useResult + $Res call({ + Map> actionConfig, + Map>? defaultActionConfig, + String duration, + FilterConfigResponse? filterConfig, + List items, + String? next, + String? prev, + Map stats, + }); +} + +/// @nodoc +class _$QueryReviewQueueResponseCopyWithImpl<$Res> implements $QueryReviewQueueResponseCopyWith<$Res> { + _$QueryReviewQueueResponseCopyWithImpl(this._self, this._then); + + final QueryReviewQueueResponse _self; + final $Res Function(QueryReviewQueueResponse) _then; + + /// Create a copy of QueryReviewQueueResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? actionConfig = null, + Object? defaultActionConfig = freezed, + Object? duration = null, + Object? filterConfig = freezed, + Object? items = null, + Object? next = freezed, + Object? prev = freezed, + Object? stats = null, + }) { + return _then( + QueryReviewQueueResponse( + actionConfig: null == actionConfig + ? _self.actionConfig + : actionConfig // ignore: cast_nullable_to_non_nullable + as Map>, + defaultActionConfig: freezed == defaultActionConfig + ? _self.defaultActionConfig + : defaultActionConfig // ignore: cast_nullable_to_non_nullable + as Map>?, + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + filterConfig: freezed == filterConfig + ? _self.filterConfig + : filterConfig // ignore: cast_nullable_to_non_nullable + as FilterConfigResponse?, + items: null == items + ? _self.items + : items // ignore: cast_nullable_to_non_nullable + as List, + next: freezed == next + ? _self.next + : next // ignore: cast_nullable_to_non_nullable + as String?, + prev: freezed == prev + ? _self.prev + : prev // ignore: cast_nullable_to_non_nullable + as String?, + stats: null == stats + ? _self.stats + : stats // ignore: cast_nullable_to_non_nullable + as Map, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/query_review_queue_response.g.dart b/packages/stream_chat/lib/open_api/model/query_review_queue_response.g.dart new file mode 100644 index 0000000000..c61a5bcafa --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_review_queue_response.g.dart @@ -0,0 +1,65 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'query_review_queue_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +QueryReviewQueueResponse _$QueryReviewQueueResponseFromJson( + Map json, +) => QueryReviewQueueResponse( + actionConfig: (json['action_config'] as Map).map( + (k, e) => MapEntry( + k, + (e as List) + .map( + (e) => ModerationActionConfigResponse.fromJson( + e as Map, + ), + ) + .toList(), + ), + ), + defaultActionConfig: (json['default_action_config'] as Map?)?.map( + (k, e) => MapEntry( + k, + (e as List) + .map( + (e) => ModerationActionConfigResponse.fromJson( + e as Map, + ), + ) + .toList(), + ), + ), + duration: json['duration'] as String, + filterConfig: json['filter_config'] == null + ? null + : FilterConfigResponse.fromJson( + json['filter_config'] as Map, + ), + items: (json['items'] as List) + .map((e) => ReviewQueueItemResponse.fromJson(e as Map)) + .toList(), + next: json['next'] as String?, + prev: json['prev'] as String?, + stats: json['stats'] as Map, +); + +Map _$QueryReviewQueueResponseToJson( + QueryReviewQueueResponse instance, +) => { + 'action_config': instance.actionConfig.map( + (k, e) => MapEntry(k, e.map((e) => e.toJson()).toList()), + ), + 'default_action_config': instance.defaultActionConfig?.map( + (k, e) => MapEntry(k, e.map((e) => e.toJson()).toList()), + ), + 'duration': instance.duration, + 'filter_config': instance.filterConfig?.toJson(), + 'items': instance.items.map((e) => e.toJson()).toList(), + 'next': instance.next, + 'prev': instance.prev, + 'stats': instance.stats, +}; diff --git a/packages/stream_chat/lib/open_api/model/query_threads_request.dart b/packages/stream_chat/lib/open_api/model/query_threads_request.dart new file mode 100644 index 0000000000..98ca0fb1bf --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_threads_request.dart @@ -0,0 +1,71 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'query_threads_request.g.dart'; +part 'query_threads_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class QueryThreadsRequest with _$QueryThreadsRequest { + const QueryThreadsRequest({ + this.filter, + this.limit, + this.memberLimit, + this.next, + this.participantLimit, + this.prev, + this.replyLimit, + this.sort, + this.watch, + }); + + @override + @JsonKey(name: 'filter') + final Map? filter; + + @override + @JsonKey(name: 'limit') + final int? limit; + + @override + @JsonKey(name: 'member_limit') + final int? memberLimit; + + @override + @JsonKey(name: 'next') + final String? next; + + @override + @JsonKey(name: 'participant_limit') + final int? participantLimit; + + @override + @JsonKey(name: 'prev') + final String? prev; + + @override + @JsonKey(name: 'reply_limit') + final int? replyLimit; + + @override + @JsonKey(name: 'sort') + final List? sort; + + @override + @JsonKey(name: 'watch') + final bool? watch; + + Map toJson() => _$QueryThreadsRequestToJson(this); + + static QueryThreadsRequest fromJson(Map json) => _$QueryThreadsRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/query_threads_request.freezed.dart b/packages/stream_chat/lib/open_api/model/query_threads_request.freezed.dart new file mode 100644 index 0000000000..fe24126124 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_threads_request.freezed.dart @@ -0,0 +1,155 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'query_threads_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$QueryThreadsRequest { + Map? get filter; + int? get limit; + int? get memberLimit; + String? get next; + int? get participantLimit; + String? get prev; + int? get replyLimit; + List? get sort; + bool? get watch; + + /// Create a copy of QueryThreadsRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $QueryThreadsRequestCopyWith get copyWith => + _$QueryThreadsRequestCopyWithImpl( + this as QueryThreadsRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is QueryThreadsRequest && + const DeepCollectionEquality().equals(other.filter, filter) && + (identical(other.limit, limit) || other.limit == limit) && + (identical(other.memberLimit, memberLimit) || other.memberLimit == memberLimit) && + (identical(other.next, next) || other.next == next) && + (identical(other.participantLimit, participantLimit) || other.participantLimit == participantLimit) && + (identical(other.prev, prev) || other.prev == prev) && + (identical(other.replyLimit, replyLimit) || other.replyLimit == replyLimit) && + const DeepCollectionEquality().equals(other.sort, sort) && + (identical(other.watch, watch) || other.watch == watch)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(filter), + limit, + memberLimit, + next, + participantLimit, + prev, + replyLimit, + const DeepCollectionEquality().hash(sort), + watch, + ); + + @override + String toString() { + return 'QueryThreadsRequest(filter: $filter, limit: $limit, memberLimit: $memberLimit, next: $next, participantLimit: $participantLimit, prev: $prev, replyLimit: $replyLimit, sort: $sort, watch: $watch)'; + } +} + +/// @nodoc +abstract mixin class $QueryThreadsRequestCopyWith<$Res> { + factory $QueryThreadsRequestCopyWith( + QueryThreadsRequest value, + $Res Function(QueryThreadsRequest) _then, + ) = _$QueryThreadsRequestCopyWithImpl; + @useResult + $Res call({ + Map? filter, + int? limit, + int? memberLimit, + String? next, + int? participantLimit, + String? prev, + int? replyLimit, + List? sort, + bool? watch, + }); +} + +/// @nodoc +class _$QueryThreadsRequestCopyWithImpl<$Res> implements $QueryThreadsRequestCopyWith<$Res> { + _$QueryThreadsRequestCopyWithImpl(this._self, this._then); + + final QueryThreadsRequest _self; + final $Res Function(QueryThreadsRequest) _then; + + /// Create a copy of QueryThreadsRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? filter = freezed, + Object? limit = freezed, + Object? memberLimit = freezed, + Object? next = freezed, + Object? participantLimit = freezed, + Object? prev = freezed, + Object? replyLimit = freezed, + Object? sort = freezed, + Object? watch = freezed, + }) { + return _then( + QueryThreadsRequest( + filter: freezed == filter + ? _self.filter + : filter // ignore: cast_nullable_to_non_nullable + as Map?, + limit: freezed == limit + ? _self.limit + : limit // ignore: cast_nullable_to_non_nullable + as int?, + memberLimit: freezed == memberLimit + ? _self.memberLimit + : memberLimit // ignore: cast_nullable_to_non_nullable + as int?, + next: freezed == next + ? _self.next + : next // ignore: cast_nullable_to_non_nullable + as String?, + participantLimit: freezed == participantLimit + ? _self.participantLimit + : participantLimit // ignore: cast_nullable_to_non_nullable + as int?, + prev: freezed == prev + ? _self.prev + : prev // ignore: cast_nullable_to_non_nullable + as String?, + replyLimit: freezed == replyLimit + ? _self.replyLimit + : replyLimit // ignore: cast_nullable_to_non_nullable + as int?, + sort: freezed == sort + ? _self.sort + : sort // ignore: cast_nullable_to_non_nullable + as List?, + watch: freezed == watch + ? _self.watch + : watch // ignore: cast_nullable_to_non_nullable + as bool?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/query_threads_request.g.dart b/packages/stream_chat/lib/open_api/model/query_threads_request.g.dart new file mode 100644 index 0000000000..7abd8c8652 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_threads_request.g.dart @@ -0,0 +1,33 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'query_threads_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +QueryThreadsRequest _$QueryThreadsRequestFromJson(Map json) => QueryThreadsRequest( + filter: json['filter'] as Map?, + limit: (json['limit'] as num?)?.toInt(), + memberLimit: (json['member_limit'] as num?)?.toInt(), + next: json['next'] as String?, + participantLimit: (json['participant_limit'] as num?)?.toInt(), + prev: json['prev'] as String?, + replyLimit: (json['reply_limit'] as num?)?.toInt(), + sort: (json['sort'] as List?)?.map((e) => SortParamRequest.fromJson(e as Map)).toList(), + watch: json['watch'] as bool?, +); + +Map _$QueryThreadsRequestToJson( + QueryThreadsRequest instance, +) => { + 'filter': instance.filter, + 'limit': instance.limit, + 'member_limit': instance.memberLimit, + 'next': instance.next, + 'participant_limit': instance.participantLimit, + 'prev': instance.prev, + 'reply_limit': instance.replyLimit, + 'sort': instance.sort?.map((e) => e.toJson()).toList(), + 'watch': instance.watch, +}; diff --git a/packages/stream_chat/lib/open_api/model/query_threads_response.dart b/packages/stream_chat/lib/open_api/model/query_threads_response.dart new file mode 100644 index 0000000000..4c8e85b738 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_threads_response.dart @@ -0,0 +1,46 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'query_threads_response.g.dart'; +part 'query_threads_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class QueryThreadsResponse with _$QueryThreadsResponse { + const QueryThreadsResponse({ + required this.duration, + this.next, + this.prev, + required this.threads, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'next') + final String? next; + + @override + @JsonKey(name: 'prev') + final String? prev; + + @override + @JsonKey(name: 'threads') + final List threads; + + Map toJson() => _$QueryThreadsResponseToJson(this); + + static QueryThreadsResponse fromJson(Map json) => _$QueryThreadsResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/query_threads_response.freezed.dart b/packages/stream_chat/lib/open_api/model/query_threads_response.freezed.dart new file mode 100644 index 0000000000..39c25e67ae --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_threads_response.freezed.dart @@ -0,0 +1,110 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'query_threads_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$QueryThreadsResponse { + String get duration; + String? get next; + String? get prev; + List get threads; + + /// Create a copy of QueryThreadsResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $QueryThreadsResponseCopyWith get copyWith => + _$QueryThreadsResponseCopyWithImpl( + this as QueryThreadsResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is QueryThreadsResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.next, next) || other.next == next) && + (identical(other.prev, prev) || other.prev == prev) && + const DeepCollectionEquality().equals(other.threads, threads)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + duration, + next, + prev, + const DeepCollectionEquality().hash(threads), + ); + + @override + String toString() { + return 'QueryThreadsResponse(duration: $duration, next: $next, prev: $prev, threads: $threads)'; + } +} + +/// @nodoc +abstract mixin class $QueryThreadsResponseCopyWith<$Res> { + factory $QueryThreadsResponseCopyWith( + QueryThreadsResponse value, + $Res Function(QueryThreadsResponse) _then, + ) = _$QueryThreadsResponseCopyWithImpl; + @useResult + $Res call({ + String duration, + String? next, + String? prev, + List threads, + }); +} + +/// @nodoc +class _$QueryThreadsResponseCopyWithImpl<$Res> implements $QueryThreadsResponseCopyWith<$Res> { + _$QueryThreadsResponseCopyWithImpl(this._self, this._then); + + final QueryThreadsResponse _self; + final $Res Function(QueryThreadsResponse) _then; + + /// Create a copy of QueryThreadsResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? duration = null, + Object? next = freezed, + Object? prev = freezed, + Object? threads = null, + }) { + return _then( + QueryThreadsResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + next: freezed == next + ? _self.next + : next // ignore: cast_nullable_to_non_nullable + as String?, + prev: freezed == prev + ? _self.prev + : prev // ignore: cast_nullable_to_non_nullable + as String?, + threads: null == threads + ? _self.threads + : threads // ignore: cast_nullable_to_non_nullable + as List, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/query_threads_response.g.dart b/packages/stream_chat/lib/open_api/model/query_threads_response.g.dart new file mode 100644 index 0000000000..a712332c59 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_threads_response.g.dart @@ -0,0 +1,27 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'query_threads_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +QueryThreadsResponse _$QueryThreadsResponseFromJson( + Map json, +) => QueryThreadsResponse( + duration: json['duration'] as String, + next: json['next'] as String?, + prev: json['prev'] as String?, + threads: (json['threads'] as List) + .map((e) => ThreadStateResponse.fromJson(e as Map)) + .toList(), +); + +Map _$QueryThreadsResponseToJson( + QueryThreadsResponse instance, +) => { + 'duration': instance.duration, + 'next': instance.next, + 'prev': instance.prev, + 'threads': instance.threads.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/query_users_payload.dart b/packages/stream_chat/lib/open_api/model/query_users_payload.dart new file mode 100644 index 0000000000..c91a822898 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_users_payload.dart @@ -0,0 +1,56 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'query_users_payload.g.dart'; +part 'query_users_payload.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class QueryUsersPayload with _$QueryUsersPayload { + const QueryUsersPayload({ + required this.filterConditions, + this.includeDeactivatedUsers, + this.limit, + this.offset, + this.presence, + this.sort, + }); + + @override + @JsonKey(name: 'filter_conditions') + final Map filterConditions; + + @override + @JsonKey(name: 'include_deactivated_users') + final bool? includeDeactivatedUsers; + + @override + @JsonKey(name: 'limit') + final int? limit; + + @override + @JsonKey(name: 'offset') + final int? offset; + + @override + @JsonKey(name: 'presence') + final bool? presence; + + @override + @JsonKey(name: 'sort') + final List? sort; + + Map toJson() => _$QueryUsersPayloadToJson(this); + + static QueryUsersPayload fromJson(Map json) => _$QueryUsersPayloadFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/query_users_payload.freezed.dart b/packages/stream_chat/lib/open_api/model/query_users_payload.freezed.dart new file mode 100644 index 0000000000..5c45ee1746 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_users_payload.freezed.dart @@ -0,0 +1,134 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'query_users_payload.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$QueryUsersPayload { + Map get filterConditions; + bool? get includeDeactivatedUsers; + int? get limit; + int? get offset; + bool? get presence; + List? get sort; + + /// Create a copy of QueryUsersPayload + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $QueryUsersPayloadCopyWith get copyWith => _$QueryUsersPayloadCopyWithImpl( + this as QueryUsersPayload, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is QueryUsersPayload && + const DeepCollectionEquality().equals( + other.filterConditions, + filterConditions, + ) && + (identical( + other.includeDeactivatedUsers, + includeDeactivatedUsers, + ) || + other.includeDeactivatedUsers == includeDeactivatedUsers) && + (identical(other.limit, limit) || other.limit == limit) && + (identical(other.offset, offset) || other.offset == offset) && + (identical(other.presence, presence) || other.presence == presence) && + const DeepCollectionEquality().equals(other.sort, sort)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(filterConditions), + includeDeactivatedUsers, + limit, + offset, + presence, + const DeepCollectionEquality().hash(sort), + ); + + @override + String toString() { + return 'QueryUsersPayload(filterConditions: $filterConditions, includeDeactivatedUsers: $includeDeactivatedUsers, limit: $limit, offset: $offset, presence: $presence, sort: $sort)'; + } +} + +/// @nodoc +abstract mixin class $QueryUsersPayloadCopyWith<$Res> { + factory $QueryUsersPayloadCopyWith( + QueryUsersPayload value, + $Res Function(QueryUsersPayload) _then, + ) = _$QueryUsersPayloadCopyWithImpl; + @useResult + $Res call({ + Map filterConditions, + bool? includeDeactivatedUsers, + int? limit, + int? offset, + bool? presence, + List? sort, + }); +} + +/// @nodoc +class _$QueryUsersPayloadCopyWithImpl<$Res> implements $QueryUsersPayloadCopyWith<$Res> { + _$QueryUsersPayloadCopyWithImpl(this._self, this._then); + + final QueryUsersPayload _self; + final $Res Function(QueryUsersPayload) _then; + + /// Create a copy of QueryUsersPayload + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? filterConditions = null, + Object? includeDeactivatedUsers = freezed, + Object? limit = freezed, + Object? offset = freezed, + Object? presence = freezed, + Object? sort = freezed, + }) { + return _then( + QueryUsersPayload( + filterConditions: null == filterConditions + ? _self.filterConditions + : filterConditions // ignore: cast_nullable_to_non_nullable + as Map, + includeDeactivatedUsers: freezed == includeDeactivatedUsers + ? _self.includeDeactivatedUsers + : includeDeactivatedUsers // ignore: cast_nullable_to_non_nullable + as bool?, + limit: freezed == limit + ? _self.limit + : limit // ignore: cast_nullable_to_non_nullable + as int?, + offset: freezed == offset + ? _self.offset + : offset // ignore: cast_nullable_to_non_nullable + as int?, + presence: freezed == presence + ? _self.presence + : presence // ignore: cast_nullable_to_non_nullable + as bool?, + sort: freezed == sort + ? _self.sort + : sort // ignore: cast_nullable_to_non_nullable + as List?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/query_users_payload.g.dart b/packages/stream_chat/lib/open_api/model/query_users_payload.g.dart new file mode 100644 index 0000000000..c79a9f41d6 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_users_payload.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'query_users_payload.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +QueryUsersPayload _$QueryUsersPayloadFromJson(Map json) => QueryUsersPayload( + filterConditions: json['filter_conditions'] as Map, + includeDeactivatedUsers: json['include_deactivated_users'] as bool?, + limit: (json['limit'] as num?)?.toInt(), + offset: (json['offset'] as num?)?.toInt(), + presence: json['presence'] as bool?, + sort: (json['sort'] as List?)?.map((e) => SortParamRequest.fromJson(e as Map)).toList(), +); + +Map _$QueryUsersPayloadToJson(QueryUsersPayload instance) => { + 'filter_conditions': instance.filterConditions, + 'include_deactivated_users': instance.includeDeactivatedUsers, + 'limit': instance.limit, + 'offset': instance.offset, + 'presence': instance.presence, + 'sort': instance.sort?.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/query_users_response.dart b/packages/stream_chat/lib/open_api/model/query_users_response.dart new file mode 100644 index 0000000000..2ee4cbd0d5 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_users_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'query_users_response.g.dart'; +part 'query_users_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class QueryUsersResponse with _$QueryUsersResponse { + const QueryUsersResponse({ + required this.duration, + required this.users, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'users') + final List users; + + Map toJson() => _$QueryUsersResponseToJson(this); + + static QueryUsersResponse fromJson(Map json) => _$QueryUsersResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/query_users_response.freezed.dart b/packages/stream_chat/lib/open_api/model/query_users_response.freezed.dart new file mode 100644 index 0000000000..64f04ae153 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_users_response.freezed.dart @@ -0,0 +1,85 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'query_users_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$QueryUsersResponse { + String get duration; + List get users; + + /// Create a copy of QueryUsersResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $QueryUsersResponseCopyWith get copyWith => _$QueryUsersResponseCopyWithImpl( + this as QueryUsersResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is QueryUsersResponse && + (identical(other.duration, duration) || other.duration == duration) && + const DeepCollectionEquality().equals(other.users, users)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + duration, + const DeepCollectionEquality().hash(users), + ); + + @override + String toString() { + return 'QueryUsersResponse(duration: $duration, users: $users)'; + } +} + +/// @nodoc +abstract mixin class $QueryUsersResponseCopyWith<$Res> { + factory $QueryUsersResponseCopyWith( + QueryUsersResponse value, + $Res Function(QueryUsersResponse) _then, + ) = _$QueryUsersResponseCopyWithImpl; + @useResult + $Res call({String duration, List users}); +} + +/// @nodoc +class _$QueryUsersResponseCopyWithImpl<$Res> implements $QueryUsersResponseCopyWith<$Res> { + _$QueryUsersResponseCopyWithImpl(this._self, this._then); + + final QueryUsersResponse _self; + final $Res Function(QueryUsersResponse) _then; + + /// Create a copy of QueryUsersResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? users = null}) { + return _then( + QueryUsersResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + users: null == users + ? _self.users + : users // ignore: cast_nullable_to_non_nullable + as List, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/query_users_response.g.dart b/packages/stream_chat/lib/open_api/model/query_users_response.g.dart new file mode 100644 index 0000000000..5d2fb4f5c5 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/query_users_response.g.dart @@ -0,0 +1,17 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'query_users_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +QueryUsersResponse _$QueryUsersResponseFromJson(Map json) => QueryUsersResponse( + duration: json['duration'] as String, + users: (json['users'] as List).map((e) => FullUserResponse.fromJson(e as Map)).toList(), +); + +Map _$QueryUsersResponseToJson(QueryUsersResponse instance) => { + 'duration': instance.duration, + 'users': instance.users.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/queue_response.dart b/packages/stream_chat/lib/open_api/model/queue_response.dart new file mode 100644 index 0000000000..18d607fbfc --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/queue_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'queue_response.g.dart'; +part 'queue_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class QueueResponse with _$QueueResponse { + const QueueResponse({ + required this.duration, + this.queue, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'queue') + final ModerationQueueResponse? queue; + + Map toJson() => _$QueueResponseToJson(this); + + static QueueResponse fromJson(Map json) => _$QueueResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/queue_response.freezed.dart b/packages/stream_chat/lib/open_api/model/queue_response.freezed.dart new file mode 100644 index 0000000000..48b47dc8e2 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/queue_response.freezed.dart @@ -0,0 +1,81 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'queue_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$QueueResponse { + String get duration; + ModerationQueueResponse? get queue; + + /// Create a copy of QueueResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $QueueResponseCopyWith get copyWith => _$QueueResponseCopyWithImpl( + this as QueueResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is QueueResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.queue, queue) || other.queue == queue)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration, queue); + + @override + String toString() { + return 'QueueResponse(duration: $duration, queue: $queue)'; + } +} + +/// @nodoc +abstract mixin class $QueueResponseCopyWith<$Res> { + factory $QueueResponseCopyWith( + QueueResponse value, + $Res Function(QueueResponse) _then, + ) = _$QueueResponseCopyWithImpl; + @useResult + $Res call({String duration, ModerationQueueResponse? queue}); +} + +/// @nodoc +class _$QueueResponseCopyWithImpl<$Res> implements $QueueResponseCopyWith<$Res> { + _$QueueResponseCopyWithImpl(this._self, this._then); + + final QueueResponse _self; + final $Res Function(QueueResponse) _then; + + /// Create a copy of QueueResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? queue = freezed}) { + return _then( + QueueResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + queue: freezed == queue + ? _self.queue + : queue // ignore: cast_nullable_to_non_nullable + as ModerationQueueResponse?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/queue_response.g.dart b/packages/stream_chat/lib/open_api/model/queue_response.g.dart new file mode 100644 index 0000000000..6fe7e8e1a5 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/queue_response.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'queue_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +QueueResponse _$QueueResponseFromJson(Map json) => QueueResponse( + duration: json['duration'] as String, + queue: json['queue'] == null + ? null + : ModerationQueueResponse.fromJson( + json['queue'] as Map, + ), +); + +Map _$QueueResponseToJson(QueueResponse instance) => { + 'duration': instance.duration, + 'queue': instance.queue?.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/reaction.dart b/packages/stream_chat/lib/open_api/model/reaction.dart new file mode 100644 index 0000000000..36f0787f54 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/reaction.dart @@ -0,0 +1,114 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'reaction.g.dart'; +part 'reaction.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class Reaction with _$Reaction { + const Reaction({ + required this.activityId, + this.childrenCounts, + required this.createdAt, + this.data, + this.deletedAt, + this.id, + required this.kind, + this.latestChildren, + this.moderation, + this.ownChildren, + this.parent, + this.score, + this.targetFeeds, + this.targetFeedsExtraData, + required this.updatedAt, + this.user, + required this.userId, + }); + + @override + @JsonKey(name: 'activity_id') + final String activityId; + + @override + @JsonKey(name: 'children_counts') + final Map? childrenCounts; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'data') + final Map? data; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'deleted_at') + final DateTime? deletedAt; + + @override + @JsonKey(name: 'id') + final String? id; + + @override + @JsonKey(name: 'kind') + final String kind; + + @override + @JsonKey(name: 'latest_children') + final Map>? latestChildren; + + @override + @JsonKey(name: 'moderation') + final Map? moderation; + + @override + @JsonKey(name: 'own_children') + final Map>? ownChildren; + + @override + @JsonKey(name: 'parent') + final String? parent; + + @override + @JsonKey(name: 'score') + final double? score; + + @override + @JsonKey(name: 'target_feeds') + final List? targetFeeds; + + @override + @JsonKey(name: 'target_feeds_extra_data') + final Map? targetFeedsExtraData; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'updated_at') + final DateTime updatedAt; + + @override + @JsonKey(name: 'user') + final User? user; + + @override + @JsonKey(name: 'user_id') + final String userId; + + Map toJson() => _$ReactionToJson(this); + + static Reaction fromJson(Map json) => _$ReactionFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/reaction.freezed.dart b/packages/stream_chat/lib/open_api/model/reaction.freezed.dart new file mode 100644 index 0000000000..8d688bdcc0 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/reaction.freezed.dart @@ -0,0 +1,238 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'reaction.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$Reaction { + String get activityId; + Map? get childrenCounts; + DateTime get createdAt; + Map? get data; + DateTime? get deletedAt; + String? get id; + String get kind; + Map>? get latestChildren; + Map? get moderation; + Map>? get ownChildren; + String? get parent; + double? get score; + List? get targetFeeds; + Map? get targetFeedsExtraData; + DateTime get updatedAt; + User? get user; + String get userId; + + /// Create a copy of Reaction + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ReactionCopyWith get copyWith => _$ReactionCopyWithImpl(this as Reaction, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is Reaction && + (identical(other.activityId, activityId) || other.activityId == activityId) && + const DeepCollectionEquality().equals( + other.childrenCounts, + childrenCounts, + ) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.data, data) && + (identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt) && + (identical(other.id, id) || other.id == id) && + (identical(other.kind, kind) || other.kind == kind) && + const DeepCollectionEquality().equals( + other.latestChildren, + latestChildren, + ) && + const DeepCollectionEquality().equals( + other.moderation, + moderation, + ) && + const DeepCollectionEquality().equals( + other.ownChildren, + ownChildren, + ) && + (identical(other.parent, parent) || other.parent == parent) && + (identical(other.score, score) || other.score == score) && + const DeepCollectionEquality().equals( + other.targetFeeds, + targetFeeds, + ) && + const DeepCollectionEquality().equals( + other.targetFeedsExtraData, + targetFeedsExtraData, + ) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt) && + (identical(other.user, user) || other.user == user) && + (identical(other.userId, userId) || other.userId == userId)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + activityId, + const DeepCollectionEquality().hash(childrenCounts), + createdAt, + const DeepCollectionEquality().hash(data), + deletedAt, + id, + kind, + const DeepCollectionEquality().hash(latestChildren), + const DeepCollectionEquality().hash(moderation), + const DeepCollectionEquality().hash(ownChildren), + parent, + score, + const DeepCollectionEquality().hash(targetFeeds), + const DeepCollectionEquality().hash(targetFeedsExtraData), + updatedAt, + user, + userId, + ); + + @override + String toString() { + return 'Reaction(activityId: $activityId, childrenCounts: $childrenCounts, createdAt: $createdAt, data: $data, deletedAt: $deletedAt, id: $id, kind: $kind, latestChildren: $latestChildren, moderation: $moderation, ownChildren: $ownChildren, parent: $parent, score: $score, targetFeeds: $targetFeeds, targetFeedsExtraData: $targetFeedsExtraData, updatedAt: $updatedAt, user: $user, userId: $userId)'; + } +} + +/// @nodoc +abstract mixin class $ReactionCopyWith<$Res> { + factory $ReactionCopyWith(Reaction value, $Res Function(Reaction) _then) = _$ReactionCopyWithImpl; + @useResult + $Res call({ + String activityId, + Map? childrenCounts, + DateTime createdAt, + Map? data, + DateTime? deletedAt, + String? id, + String kind, + Map>? latestChildren, + Map? moderation, + Map>? ownChildren, + String? parent, + double? score, + List? targetFeeds, + Map? targetFeedsExtraData, + DateTime updatedAt, + User? user, + String userId, + }); +} + +/// @nodoc +class _$ReactionCopyWithImpl<$Res> implements $ReactionCopyWith<$Res> { + _$ReactionCopyWithImpl(this._self, this._then); + + final Reaction _self; + final $Res Function(Reaction) _then; + + /// Create a copy of Reaction + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? activityId = null, + Object? childrenCounts = freezed, + Object? createdAt = null, + Object? data = freezed, + Object? deletedAt = freezed, + Object? id = freezed, + Object? kind = null, + Object? latestChildren = freezed, + Object? moderation = freezed, + Object? ownChildren = freezed, + Object? parent = freezed, + Object? score = freezed, + Object? targetFeeds = freezed, + Object? targetFeedsExtraData = freezed, + Object? updatedAt = null, + Object? user = freezed, + Object? userId = null, + }) { + return _then( + Reaction( + activityId: null == activityId + ? _self.activityId + : activityId // ignore: cast_nullable_to_non_nullable + as String, + childrenCounts: freezed == childrenCounts + ? _self.childrenCounts + : childrenCounts // ignore: cast_nullable_to_non_nullable + as Map?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + data: freezed == data + ? _self.data + : data // ignore: cast_nullable_to_non_nullable + as Map?, + deletedAt: freezed == deletedAt + ? _self.deletedAt + : deletedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + id: freezed == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String?, + kind: null == kind + ? _self.kind + : kind // ignore: cast_nullable_to_non_nullable + as String, + latestChildren: freezed == latestChildren + ? _self.latestChildren + : latestChildren // ignore: cast_nullable_to_non_nullable + as Map>?, + moderation: freezed == moderation + ? _self.moderation + : moderation // ignore: cast_nullable_to_non_nullable + as Map?, + ownChildren: freezed == ownChildren + ? _self.ownChildren + : ownChildren // ignore: cast_nullable_to_non_nullable + as Map>?, + parent: freezed == parent + ? _self.parent + : parent // ignore: cast_nullable_to_non_nullable + as String?, + score: freezed == score + ? _self.score + : score // ignore: cast_nullable_to_non_nullable + as double?, + targetFeeds: freezed == targetFeeds + ? _self.targetFeeds + : targetFeeds // ignore: cast_nullable_to_non_nullable + as List?, + targetFeedsExtraData: freezed == targetFeedsExtraData + ? _self.targetFeedsExtraData + : targetFeedsExtraData // ignore: cast_nullable_to_non_nullable + as Map?, + updatedAt: null == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as User?, + userId: null == userId + ? _self.userId + : userId // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/reaction.g.dart b/packages/stream_chat/lib/open_api/model/reaction.g.dart new file mode 100644 index 0000000000..34371c4fdb --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/reaction.g.dart @@ -0,0 +1,81 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'reaction.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +Reaction _$ReactionFromJson(Map json) => Reaction( + activityId: json['activity_id'] as String, + childrenCounts: json['children_counts'] as Map?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + data: json['data'] as Map?, + deletedAt: _$JsonConverterFromJson( + json['deleted_at'], + const StreamDateTimeConverter().fromJson, + ), + id: json['id'] as String?, + kind: json['kind'] as String, + latestChildren: (json['latest_children'] as Map?)?.map( + (k, e) => MapEntry( + k, + (e as List).map((e) => Reaction.fromJson(e as Map)).toList(), + ), + ), + moderation: json['moderation'] as Map?, + ownChildren: (json['own_children'] as Map?)?.map( + (k, e) => MapEntry( + k, + (e as List).map((e) => Reaction.fromJson(e as Map)).toList(), + ), + ), + parent: json['parent'] as String?, + score: (json['score'] as num?)?.toDouble(), + targetFeeds: (json['target_feeds'] as List?)?.map((e) => e as String).toList(), + targetFeedsExtraData: json['target_feeds_extra_data'] as Map?, + updatedAt: const StreamDateTimeConverter().fromJson( + json['updated_at'] as Object, + ), + user: json['user'] == null ? null : User.fromJson(json['user'] as Map), + userId: json['user_id'] as String, +); + +Map _$ReactionToJson(Reaction instance) => { + 'activity_id': instance.activityId, + 'children_counts': instance.childrenCounts, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'data': instance.data, + 'deleted_at': _$JsonConverterToJson( + instance.deletedAt, + const StreamDateTimeConverter().toJson, + ), + 'id': instance.id, + 'kind': instance.kind, + 'latest_children': instance.latestChildren?.map( + (k, e) => MapEntry(k, e.map((e) => e.toJson()).toList()), + ), + 'moderation': instance.moderation, + 'own_children': instance.ownChildren?.map( + (k, e) => MapEntry(k, e.map((e) => e.toJson()).toList()), + ), + 'parent': instance.parent, + 'score': instance.score, + 'target_feeds': instance.targetFeeds, + 'target_feeds_extra_data': instance.targetFeedsExtraData, + 'updated_at': const StreamDateTimeConverter().toJson(instance.updatedAt), + 'user': instance.user?.toJson(), + 'user_id': instance.userId, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/reaction_deleted_event.dart b/packages/stream_chat/lib/open_api/model/reaction_deleted_event.dart new file mode 100644 index 0000000000..d708e4352d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/reaction_deleted_event.dart @@ -0,0 +1,113 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'reaction_deleted_event.g.dart'; +part 'reaction_deleted_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ReactionDeletedEvent extends core.WsEvent with _$ReactionDeletedEvent { + const ReactionDeletedEvent({ + required this.channel, + this.channelCustom, + this.channelId, + this.channelMemberCount, + this.channelMessageCount, + this.channelType, + this.cid, + required this.createdAt, + required this.custom, + this.message, + this.messageId, + this.reaction, + this.receivedAt, + this.team, + this.threadParticipants, + required this.type, + this.user, + }); + + @override + @JsonKey(name: 'channel') + final ChannelResponse channel; + + @override + @JsonKey(name: 'channel_custom') + final Map? channelCustom; + + @override + @JsonKey(name: 'channel_id') + final String? channelId; + + @override + @JsonKey(name: 'channel_member_count') + final int? channelMemberCount; + + @override + @JsonKey(name: 'channel_message_count') + final int? channelMessageCount; + + @override + @JsonKey(name: 'channel_type') + final String? channelType; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'message') + final MessageResponse? message; + + @override + @JsonKey(name: 'message_id') + final String? messageId; + + @override + @JsonKey(name: 'reaction') + final ReactionResponse? reaction; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'team') + final String? team; + + @override + @JsonKey(name: 'thread_participants') + final List? threadParticipants; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'user') + final UserResponseCommonFields? user; + + Map toJson() => _$ReactionDeletedEventToJson(this); + + static ReactionDeletedEvent fromJson(Map json) => _$ReactionDeletedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/reaction_deleted_event.freezed.dart b/packages/stream_chat/lib/open_api/model/reaction_deleted_event.freezed.dart new file mode 100644 index 0000000000..d15e83b9d1 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/reaction_deleted_event.freezed.dart @@ -0,0 +1,235 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'reaction_deleted_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ReactionDeletedEvent { + ChannelResponse get channel; + Map? get channelCustom; + String? get channelId; + int? get channelMemberCount; + int? get channelMessageCount; + String? get channelType; + String? get cid; + DateTime get createdAt; + Map get custom; + MessageResponse? get message; + String? get messageId; + ReactionResponse? get reaction; + DateTime? get receivedAt; + String? get team; + List? get threadParticipants; + String get type; + UserResponseCommonFields? get user; + + /// Create a copy of ReactionDeletedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ReactionDeletedEventCopyWith get copyWith => + _$ReactionDeletedEventCopyWithImpl( + this as ReactionDeletedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ReactionDeletedEvent && + (identical(other.channel, channel) || other.channel == channel) && + const DeepCollectionEquality().equals( + other.channelCustom, + channelCustom, + ) && + (identical(other.channelId, channelId) || other.channelId == channelId) && + (identical(other.channelMemberCount, channelMemberCount) || + other.channelMemberCount == channelMemberCount) && + (identical(other.channelMessageCount, channelMessageCount) || + other.channelMessageCount == channelMessageCount) && + (identical(other.channelType, channelType) || other.channelType == channelType) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.message, message) || other.message == message) && + (identical(other.messageId, messageId) || other.messageId == messageId) && + (identical(other.reaction, reaction) || other.reaction == reaction) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.team, team) || other.team == team) && + const DeepCollectionEquality().equals( + other.threadParticipants, + threadParticipants, + ) && + (identical(other.type, type) || other.type == type) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channel, + const DeepCollectionEquality().hash(channelCustom), + channelId, + channelMemberCount, + channelMessageCount, + channelType, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + message, + messageId, + reaction, + receivedAt, + team, + const DeepCollectionEquality().hash(threadParticipants), + type, + user, + ); + + @override + String toString() { + return 'ReactionDeletedEvent(channel: $channel, channelCustom: $channelCustom, channelId: $channelId, channelMemberCount: $channelMemberCount, channelMessageCount: $channelMessageCount, channelType: $channelType, cid: $cid, createdAt: $createdAt, custom: $custom, message: $message, messageId: $messageId, reaction: $reaction, receivedAt: $receivedAt, team: $team, threadParticipants: $threadParticipants, type: $type, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $ReactionDeletedEventCopyWith<$Res> { + factory $ReactionDeletedEventCopyWith( + ReactionDeletedEvent value, + $Res Function(ReactionDeletedEvent) _then, + ) = _$ReactionDeletedEventCopyWithImpl; + @useResult + $Res call({ + ChannelResponse channel, + Map? channelCustom, + String? channelId, + int? channelMemberCount, + int? channelMessageCount, + String? channelType, + String? cid, + DateTime createdAt, + Map custom, + MessageResponse? message, + String? messageId, + ReactionResponse? reaction, + DateTime? receivedAt, + String? team, + List? threadParticipants, + String type, + UserResponseCommonFields? user, + }); +} + +/// @nodoc +class _$ReactionDeletedEventCopyWithImpl<$Res> implements $ReactionDeletedEventCopyWith<$Res> { + _$ReactionDeletedEventCopyWithImpl(this._self, this._then); + + final ReactionDeletedEvent _self; + final $Res Function(ReactionDeletedEvent) _then; + + /// Create a copy of ReactionDeletedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channel = null, + Object? channelCustom = freezed, + Object? channelId = freezed, + Object? channelMemberCount = freezed, + Object? channelMessageCount = freezed, + Object? channelType = freezed, + Object? cid = freezed, + Object? createdAt = null, + Object? custom = null, + Object? message = freezed, + Object? messageId = freezed, + Object? reaction = freezed, + Object? receivedAt = freezed, + Object? team = freezed, + Object? threadParticipants = freezed, + Object? type = null, + Object? user = freezed, + }) { + return _then( + ReactionDeletedEvent( + channel: null == channel + ? _self.channel + : channel // ignore: cast_nullable_to_non_nullable + as ChannelResponse, + channelCustom: freezed == channelCustom + ? _self.channelCustom + : channelCustom // ignore: cast_nullable_to_non_nullable + as Map?, + channelId: freezed == channelId + ? _self.channelId + : channelId // ignore: cast_nullable_to_non_nullable + as String?, + channelMemberCount: freezed == channelMemberCount + ? _self.channelMemberCount + : channelMemberCount // ignore: cast_nullable_to_non_nullable + as int?, + channelMessageCount: freezed == channelMessageCount + ? _self.channelMessageCount + : channelMessageCount // ignore: cast_nullable_to_non_nullable + as int?, + channelType: freezed == channelType + ? _self.channelType + : channelType // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + message: freezed == message + ? _self.message + : message // ignore: cast_nullable_to_non_nullable + as MessageResponse?, + messageId: freezed == messageId + ? _self.messageId + : messageId // ignore: cast_nullable_to_non_nullable + as String?, + reaction: freezed == reaction + ? _self.reaction + : reaction // ignore: cast_nullable_to_non_nullable + as ReactionResponse?, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + team: freezed == team + ? _self.team + : team // ignore: cast_nullable_to_non_nullable + as String?, + threadParticipants: freezed == threadParticipants + ? _self.threadParticipants + : threadParticipants // ignore: cast_nullable_to_non_nullable + as List?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponseCommonFields?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/reaction_deleted_event.g.dart b/packages/stream_chat/lib/open_api/model/reaction_deleted_event.g.dart new file mode 100644 index 0000000000..a014836d1f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/reaction_deleted_event.g.dart @@ -0,0 +1,71 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'reaction_deleted_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ReactionDeletedEvent _$ReactionDeletedEventFromJson( + Map json, +) => ReactionDeletedEvent( + channel: ChannelResponse.fromJson(json['channel'] as Map), + channelCustom: json['channel_custom'] as Map?, + channelId: json['channel_id'] as String?, + channelMemberCount: (json['channel_member_count'] as num?)?.toInt(), + channelMessageCount: (json['channel_message_count'] as num?)?.toInt(), + channelType: json['channel_type'] as String?, + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + message: json['message'] == null ? null : MessageResponse.fromJson(json['message'] as Map), + messageId: json['message_id'] as String?, + reaction: json['reaction'] == null ? null : ReactionResponse.fromJson(json['reaction'] as Map), + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + team: json['team'] as String?, + threadParticipants: (json['thread_participants'] as List?) + ?.map((e) => UserResponseCommonFields.fromJson(e as Map)) + .toList(), + type: json['type'] as String, + user: json['user'] == null ? null : UserResponseCommonFields.fromJson(json['user'] as Map), +); + +Map _$ReactionDeletedEventToJson( + ReactionDeletedEvent instance, +) => { + 'channel': instance.channel.toJson(), + 'channel_custom': instance.channelCustom, + 'channel_id': instance.channelId, + 'channel_member_count': instance.channelMemberCount, + 'channel_message_count': instance.channelMessageCount, + 'channel_type': instance.channelType, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'message': instance.message?.toJson(), + 'message_id': instance.messageId, + 'reaction': instance.reaction?.toJson(), + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'team': instance.team, + 'thread_participants': instance.threadParticipants?.map((e) => e.toJson()).toList(), + 'type': instance.type, + 'user': instance.user?.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/reaction_group_response.dart b/packages/stream_chat/lib/open_api/model/reaction_group_response.dart new file mode 100644 index 0000000000..ea8e8dfe76 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/reaction_group_response.dart @@ -0,0 +1,53 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'reaction_group_response.g.dart'; +part 'reaction_group_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ReactionGroupResponse with _$ReactionGroupResponse { + const ReactionGroupResponse({ + required this.count, + required this.firstReactionAt, + required this.lastReactionAt, + required this.latestReactionsBy, + required this.sumScores, + }); + + @override + @JsonKey(name: 'count') + final int count; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'first_reaction_at') + final DateTime firstReactionAt; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'last_reaction_at') + final DateTime lastReactionAt; + + @override + @JsonKey(name: 'latest_reactions_by') + final List latestReactionsBy; + + @override + @JsonKey(name: 'sum_scores') + final int sumScores; + + Map toJson() => _$ReactionGroupResponseToJson(this); + + static ReactionGroupResponse fromJson(Map json) => _$ReactionGroupResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/reaction_group_response.freezed.dart b/packages/stream_chat/lib/open_api/model/reaction_group_response.freezed.dart new file mode 100644 index 0000000000..2e7557fccf --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/reaction_group_response.freezed.dart @@ -0,0 +1,122 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'reaction_group_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ReactionGroupResponse { + int get count; + DateTime get firstReactionAt; + DateTime get lastReactionAt; + List get latestReactionsBy; + int get sumScores; + + /// Create a copy of ReactionGroupResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ReactionGroupResponseCopyWith get copyWith => + _$ReactionGroupResponseCopyWithImpl( + this as ReactionGroupResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ReactionGroupResponse && + (identical(other.count, count) || other.count == count) && + (identical(other.firstReactionAt, firstReactionAt) || other.firstReactionAt == firstReactionAt) && + (identical(other.lastReactionAt, lastReactionAt) || other.lastReactionAt == lastReactionAt) && + const DeepCollectionEquality().equals( + other.latestReactionsBy, + latestReactionsBy, + ) && + (identical(other.sumScores, sumScores) || other.sumScores == sumScores)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + count, + firstReactionAt, + lastReactionAt, + const DeepCollectionEquality().hash(latestReactionsBy), + sumScores, + ); + + @override + String toString() { + return 'ReactionGroupResponse(count: $count, firstReactionAt: $firstReactionAt, lastReactionAt: $lastReactionAt, latestReactionsBy: $latestReactionsBy, sumScores: $sumScores)'; + } +} + +/// @nodoc +abstract mixin class $ReactionGroupResponseCopyWith<$Res> { + factory $ReactionGroupResponseCopyWith( + ReactionGroupResponse value, + $Res Function(ReactionGroupResponse) _then, + ) = _$ReactionGroupResponseCopyWithImpl; + @useResult + $Res call({ + int count, + DateTime firstReactionAt, + DateTime lastReactionAt, + List latestReactionsBy, + int sumScores, + }); +} + +/// @nodoc +class _$ReactionGroupResponseCopyWithImpl<$Res> implements $ReactionGroupResponseCopyWith<$Res> { + _$ReactionGroupResponseCopyWithImpl(this._self, this._then); + + final ReactionGroupResponse _self; + final $Res Function(ReactionGroupResponse) _then; + + /// Create a copy of ReactionGroupResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? count = null, + Object? firstReactionAt = null, + Object? lastReactionAt = null, + Object? latestReactionsBy = null, + Object? sumScores = null, + }) { + return _then( + ReactionGroupResponse( + count: null == count + ? _self.count + : count // ignore: cast_nullable_to_non_nullable + as int, + firstReactionAt: null == firstReactionAt + ? _self.firstReactionAt + : firstReactionAt // ignore: cast_nullable_to_non_nullable + as DateTime, + lastReactionAt: null == lastReactionAt + ? _self.lastReactionAt + : lastReactionAt // ignore: cast_nullable_to_non_nullable + as DateTime, + latestReactionsBy: null == latestReactionsBy + ? _self.latestReactionsBy + : latestReactionsBy // ignore: cast_nullable_to_non_nullable + as List, + sumScores: null == sumScores + ? _self.sumScores + : sumScores // ignore: cast_nullable_to_non_nullable + as int, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/reaction_group_response.g.dart b/packages/stream_chat/lib/open_api/model/reaction_group_response.g.dart new file mode 100644 index 0000000000..a242089a16 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/reaction_group_response.g.dart @@ -0,0 +1,37 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'reaction_group_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ReactionGroupResponse _$ReactionGroupResponseFromJson( + Map json, +) => ReactionGroupResponse( + count: (json['count'] as num).toInt(), + firstReactionAt: const StreamDateTimeConverter().fromJson( + json['first_reaction_at'] as Object, + ), + lastReactionAt: const StreamDateTimeConverter().fromJson( + json['last_reaction_at'] as Object, + ), + latestReactionsBy: (json['latest_reactions_by'] as List) + .map((e) => ReactionGroupUserResponse.fromJson(e as Map)) + .toList(), + sumScores: (json['sum_scores'] as num).toInt(), +); + +Map _$ReactionGroupResponseToJson( + ReactionGroupResponse instance, +) => { + 'count': instance.count, + 'first_reaction_at': const StreamDateTimeConverter().toJson( + instance.firstReactionAt, + ), + 'last_reaction_at': const StreamDateTimeConverter().toJson( + instance.lastReactionAt, + ), + 'latest_reactions_by': instance.latestReactionsBy.map((e) => e.toJson()).toList(), + 'sum_scores': instance.sumScores, +}; diff --git a/packages/stream_chat/lib/open_api/model/reaction_group_user_response.dart b/packages/stream_chat/lib/open_api/model/reaction_group_user_response.dart new file mode 100644 index 0000000000..45fa5c49c3 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/reaction_group_user_response.dart @@ -0,0 +1,42 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'reaction_group_user_response.g.dart'; +part 'reaction_group_user_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ReactionGroupUserResponse with _$ReactionGroupUserResponse { + const ReactionGroupUserResponse({ + required this.createdAt, + this.user, + required this.userId, + }); + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'user') + final UserResponse? user; + + @override + @JsonKey(name: 'user_id') + final String userId; + + Map toJson() => _$ReactionGroupUserResponseToJson(this); + + static ReactionGroupUserResponse fromJson(Map json) => _$ReactionGroupUserResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/reaction_group_user_response.freezed.dart b/packages/stream_chat/lib/open_api/model/reaction_group_user_response.freezed.dart new file mode 100644 index 0000000000..102e66f8cf --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/reaction_group_user_response.freezed.dart @@ -0,0 +1,92 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'reaction_group_user_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ReactionGroupUserResponse { + DateTime get createdAt; + UserResponse? get user; + String get userId; + + /// Create a copy of ReactionGroupUserResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ReactionGroupUserResponseCopyWith get copyWith => + _$ReactionGroupUserResponseCopyWithImpl( + this as ReactionGroupUserResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ReactionGroupUserResponse && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.user, user) || other.user == user) && + (identical(other.userId, userId) || other.userId == userId)); + } + + @override + int get hashCode => Object.hash(runtimeType, createdAt, user, userId); + + @override + String toString() { + return 'ReactionGroupUserResponse(createdAt: $createdAt, user: $user, userId: $userId)'; + } +} + +/// @nodoc +abstract mixin class $ReactionGroupUserResponseCopyWith<$Res> { + factory $ReactionGroupUserResponseCopyWith( + ReactionGroupUserResponse value, + $Res Function(ReactionGroupUserResponse) _then, + ) = _$ReactionGroupUserResponseCopyWithImpl; + @useResult + $Res call({DateTime createdAt, UserResponse? user, String userId}); +} + +/// @nodoc +class _$ReactionGroupUserResponseCopyWithImpl<$Res> implements $ReactionGroupUserResponseCopyWith<$Res> { + _$ReactionGroupUserResponseCopyWithImpl(this._self, this._then); + + final ReactionGroupUserResponse _self; + final $Res Function(ReactionGroupUserResponse) _then; + + /// Create a copy of ReactionGroupUserResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? createdAt = null, + Object? user = freezed, + Object? userId = null, + }) { + return _then( + ReactionGroupUserResponse( + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponse?, + userId: null == userId + ? _self.userId + : userId // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/reaction_group_user_response.g.dart b/packages/stream_chat/lib/open_api/model/reaction_group_user_response.g.dart new file mode 100644 index 0000000000..cbf2307b5c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/reaction_group_user_response.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'reaction_group_user_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ReactionGroupUserResponse _$ReactionGroupUserResponseFromJson( + Map json, +) => ReactionGroupUserResponse( + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + user: json['user'] == null ? null : UserResponse.fromJson(json['user'] as Map), + userId: json['user_id'] as String, +); + +Map _$ReactionGroupUserResponseToJson( + ReactionGroupUserResponse instance, +) => { + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'user': instance.user?.toJson(), + 'user_id': instance.userId, +}; diff --git a/packages/stream_chat/lib/open_api/model/reaction_new_event.dart b/packages/stream_chat/lib/open_api/model/reaction_new_event.dart new file mode 100644 index 0000000000..927a881232 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/reaction_new_event.dart @@ -0,0 +1,113 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'reaction_new_event.g.dart'; +part 'reaction_new_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ReactionNewEvent extends core.WsEvent with _$ReactionNewEvent { + const ReactionNewEvent({ + required this.channel, + this.channelCustom, + this.channelId, + this.channelMemberCount, + this.channelMessageCount, + this.channelType, + this.cid, + required this.createdAt, + required this.custom, + this.message, + this.messageId, + this.reaction, + this.receivedAt, + this.team, + this.threadParticipants, + required this.type, + this.user, + }); + + @override + @JsonKey(name: 'channel') + final ChannelResponse channel; + + @override + @JsonKey(name: 'channel_custom') + final Map? channelCustom; + + @override + @JsonKey(name: 'channel_id') + final String? channelId; + + @override + @JsonKey(name: 'channel_member_count') + final int? channelMemberCount; + + @override + @JsonKey(name: 'channel_message_count') + final int? channelMessageCount; + + @override + @JsonKey(name: 'channel_type') + final String? channelType; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'message') + final MessageResponse? message; + + @override + @JsonKey(name: 'message_id') + final String? messageId; + + @override + @JsonKey(name: 'reaction') + final ReactionResponse? reaction; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'team') + final String? team; + + @override + @JsonKey(name: 'thread_participants') + final List? threadParticipants; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'user') + final UserResponseCommonFields? user; + + Map toJson() => _$ReactionNewEventToJson(this); + + static ReactionNewEvent fromJson(Map json) => _$ReactionNewEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/reaction_new_event.freezed.dart b/packages/stream_chat/lib/open_api/model/reaction_new_event.freezed.dart new file mode 100644 index 0000000000..05e87d67f9 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/reaction_new_event.freezed.dart @@ -0,0 +1,234 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'reaction_new_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ReactionNewEvent { + ChannelResponse get channel; + Map? get channelCustom; + String? get channelId; + int? get channelMemberCount; + int? get channelMessageCount; + String? get channelType; + String? get cid; + DateTime get createdAt; + Map get custom; + MessageResponse? get message; + String? get messageId; + ReactionResponse? get reaction; + DateTime? get receivedAt; + String? get team; + List? get threadParticipants; + String get type; + UserResponseCommonFields? get user; + + /// Create a copy of ReactionNewEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ReactionNewEventCopyWith get copyWith => _$ReactionNewEventCopyWithImpl( + this as ReactionNewEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ReactionNewEvent && + (identical(other.channel, channel) || other.channel == channel) && + const DeepCollectionEquality().equals( + other.channelCustom, + channelCustom, + ) && + (identical(other.channelId, channelId) || other.channelId == channelId) && + (identical(other.channelMemberCount, channelMemberCount) || + other.channelMemberCount == channelMemberCount) && + (identical(other.channelMessageCount, channelMessageCount) || + other.channelMessageCount == channelMessageCount) && + (identical(other.channelType, channelType) || other.channelType == channelType) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.message, message) || other.message == message) && + (identical(other.messageId, messageId) || other.messageId == messageId) && + (identical(other.reaction, reaction) || other.reaction == reaction) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.team, team) || other.team == team) && + const DeepCollectionEquality().equals( + other.threadParticipants, + threadParticipants, + ) && + (identical(other.type, type) || other.type == type) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channel, + const DeepCollectionEquality().hash(channelCustom), + channelId, + channelMemberCount, + channelMessageCount, + channelType, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + message, + messageId, + reaction, + receivedAt, + team, + const DeepCollectionEquality().hash(threadParticipants), + type, + user, + ); + + @override + String toString() { + return 'ReactionNewEvent(channel: $channel, channelCustom: $channelCustom, channelId: $channelId, channelMemberCount: $channelMemberCount, channelMessageCount: $channelMessageCount, channelType: $channelType, cid: $cid, createdAt: $createdAt, custom: $custom, message: $message, messageId: $messageId, reaction: $reaction, receivedAt: $receivedAt, team: $team, threadParticipants: $threadParticipants, type: $type, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $ReactionNewEventCopyWith<$Res> { + factory $ReactionNewEventCopyWith( + ReactionNewEvent value, + $Res Function(ReactionNewEvent) _then, + ) = _$ReactionNewEventCopyWithImpl; + @useResult + $Res call({ + ChannelResponse channel, + Map? channelCustom, + String? channelId, + int? channelMemberCount, + int? channelMessageCount, + String? channelType, + String? cid, + DateTime createdAt, + Map custom, + MessageResponse? message, + String? messageId, + ReactionResponse? reaction, + DateTime? receivedAt, + String? team, + List? threadParticipants, + String type, + UserResponseCommonFields? user, + }); +} + +/// @nodoc +class _$ReactionNewEventCopyWithImpl<$Res> implements $ReactionNewEventCopyWith<$Res> { + _$ReactionNewEventCopyWithImpl(this._self, this._then); + + final ReactionNewEvent _self; + final $Res Function(ReactionNewEvent) _then; + + /// Create a copy of ReactionNewEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channel = null, + Object? channelCustom = freezed, + Object? channelId = freezed, + Object? channelMemberCount = freezed, + Object? channelMessageCount = freezed, + Object? channelType = freezed, + Object? cid = freezed, + Object? createdAt = null, + Object? custom = null, + Object? message = freezed, + Object? messageId = freezed, + Object? reaction = freezed, + Object? receivedAt = freezed, + Object? team = freezed, + Object? threadParticipants = freezed, + Object? type = null, + Object? user = freezed, + }) { + return _then( + ReactionNewEvent( + channel: null == channel + ? _self.channel + : channel // ignore: cast_nullable_to_non_nullable + as ChannelResponse, + channelCustom: freezed == channelCustom + ? _self.channelCustom + : channelCustom // ignore: cast_nullable_to_non_nullable + as Map?, + channelId: freezed == channelId + ? _self.channelId + : channelId // ignore: cast_nullable_to_non_nullable + as String?, + channelMemberCount: freezed == channelMemberCount + ? _self.channelMemberCount + : channelMemberCount // ignore: cast_nullable_to_non_nullable + as int?, + channelMessageCount: freezed == channelMessageCount + ? _self.channelMessageCount + : channelMessageCount // ignore: cast_nullable_to_non_nullable + as int?, + channelType: freezed == channelType + ? _self.channelType + : channelType // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + message: freezed == message + ? _self.message + : message // ignore: cast_nullable_to_non_nullable + as MessageResponse?, + messageId: freezed == messageId + ? _self.messageId + : messageId // ignore: cast_nullable_to_non_nullable + as String?, + reaction: freezed == reaction + ? _self.reaction + : reaction // ignore: cast_nullable_to_non_nullable + as ReactionResponse?, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + team: freezed == team + ? _self.team + : team // ignore: cast_nullable_to_non_nullable + as String?, + threadParticipants: freezed == threadParticipants + ? _self.threadParticipants + : threadParticipants // ignore: cast_nullable_to_non_nullable + as List?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponseCommonFields?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/reaction_new_event.g.dart b/packages/stream_chat/lib/open_api/model/reaction_new_event.g.dart new file mode 100644 index 0000000000..c80b5c5ed3 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/reaction_new_event.g.dart @@ -0,0 +1,69 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'reaction_new_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ReactionNewEvent _$ReactionNewEventFromJson( + Map json, +) => ReactionNewEvent( + channel: ChannelResponse.fromJson(json['channel'] as Map), + channelCustom: json['channel_custom'] as Map?, + channelId: json['channel_id'] as String?, + channelMemberCount: (json['channel_member_count'] as num?)?.toInt(), + channelMessageCount: (json['channel_message_count'] as num?)?.toInt(), + channelType: json['channel_type'] as String?, + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + message: json['message'] == null ? null : MessageResponse.fromJson(json['message'] as Map), + messageId: json['message_id'] as String?, + reaction: json['reaction'] == null ? null : ReactionResponse.fromJson(json['reaction'] as Map), + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + team: json['team'] as String?, + threadParticipants: (json['thread_participants'] as List?) + ?.map((e) => UserResponseCommonFields.fromJson(e as Map)) + .toList(), + type: json['type'] as String, + user: json['user'] == null ? null : UserResponseCommonFields.fromJson(json['user'] as Map), +); + +Map _$ReactionNewEventToJson(ReactionNewEvent instance) => { + 'channel': instance.channel.toJson(), + 'channel_custom': instance.channelCustom, + 'channel_id': instance.channelId, + 'channel_member_count': instance.channelMemberCount, + 'channel_message_count': instance.channelMessageCount, + 'channel_type': instance.channelType, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'message': instance.message?.toJson(), + 'message_id': instance.messageId, + 'reaction': instance.reaction?.toJson(), + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'team': instance.team, + 'thread_participants': instance.threadParticipants?.map((e) => e.toJson()).toList(), + 'type': instance.type, + 'user': instance.user?.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/reaction_request.dart b/packages/stream_chat/lib/open_api/model/reaction_request.dart new file mode 100644 index 0000000000..67addc9a97 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/reaction_request.dart @@ -0,0 +1,53 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'reaction_request.g.dart'; +part 'reaction_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ReactionRequest with _$ReactionRequest { + const ReactionRequest({ + this.createdAt, + this.custom, + this.score, + required this.type, + this.updatedAt, + }); + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime? createdAt; + + @override + @JsonKey(name: 'custom') + final Map? custom; + + @override + @JsonKey(name: 'score') + final int? score; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'updated_at') + final DateTime? updatedAt; + + Map toJson() => _$ReactionRequestToJson(this); + + static ReactionRequest fromJson(Map json) => _$ReactionRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/reaction_request.freezed.dart b/packages/stream_chat/lib/open_api/model/reaction_request.freezed.dart new file mode 100644 index 0000000000..d3d84d4ac0 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/reaction_request.freezed.dart @@ -0,0 +1,118 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'reaction_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ReactionRequest { + DateTime? get createdAt; + Map? get custom; + int? get score; + String get type; + DateTime? get updatedAt; + + /// Create a copy of ReactionRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ReactionRequestCopyWith get copyWith => _$ReactionRequestCopyWithImpl( + this as ReactionRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ReactionRequest && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.score, score) || other.score == score) && + (identical(other.type, type) || other.type == type) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + createdAt, + const DeepCollectionEquality().hash(custom), + score, + type, + updatedAt, + ); + + @override + String toString() { + return 'ReactionRequest(createdAt: $createdAt, custom: $custom, score: $score, type: $type, updatedAt: $updatedAt)'; + } +} + +/// @nodoc +abstract mixin class $ReactionRequestCopyWith<$Res> { + factory $ReactionRequestCopyWith( + ReactionRequest value, + $Res Function(ReactionRequest) _then, + ) = _$ReactionRequestCopyWithImpl; + @useResult + $Res call({ + DateTime? createdAt, + Map? custom, + int? score, + String type, + DateTime? updatedAt, + }); +} + +/// @nodoc +class _$ReactionRequestCopyWithImpl<$Res> implements $ReactionRequestCopyWith<$Res> { + _$ReactionRequestCopyWithImpl(this._self, this._then); + + final ReactionRequest _self; + final $Res Function(ReactionRequest) _then; + + /// Create a copy of ReactionRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? createdAt = freezed, + Object? custom = freezed, + Object? score = freezed, + Object? type = null, + Object? updatedAt = freezed, + }) { + return _then( + ReactionRequest( + createdAt: freezed == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + custom: freezed == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map?, + score: freezed == score + ? _self.score + : score // ignore: cast_nullable_to_non_nullable + as int?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + updatedAt: freezed == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/reaction_request.g.dart b/packages/stream_chat/lib/open_api/model/reaction_request.g.dart new file mode 100644 index 0000000000..1807b8250c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/reaction_request.g.dart @@ -0,0 +1,45 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'reaction_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ReactionRequest _$ReactionRequestFromJson(Map json) => ReactionRequest( + createdAt: _$JsonConverterFromJson( + json['created_at'], + const StreamDateTimeConverter().fromJson, + ), + custom: json['custom'] as Map?, + score: (json['score'] as num?)?.toInt(), + type: json['type'] as String, + updatedAt: _$JsonConverterFromJson( + json['updated_at'], + const StreamDateTimeConverter().fromJson, + ), +); + +Map _$ReactionRequestToJson(ReactionRequest instance) => { + 'created_at': _$JsonConverterToJson( + instance.createdAt, + const StreamDateTimeConverter().toJson, + ), + 'custom': instance.custom, + 'score': instance.score, + 'type': instance.type, + 'updated_at': _$JsonConverterToJson( + instance.updatedAt, + const StreamDateTimeConverter().toJson, + ), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/reaction_response.dart b/packages/stream_chat/lib/open_api/model/reaction_response.dart new file mode 100644 index 0000000000..c35e77ae0e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/reaction_response.dart @@ -0,0 +1,68 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'reaction_response.g.dart'; +part 'reaction_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ReactionResponse with _$ReactionResponse { + const ReactionResponse({ + required this.createdAt, + required this.custom, + required this.messageId, + required this.score, + required this.type, + required this.updatedAt, + required this.user, + required this.userId, + }); + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'message_id') + final String messageId; + + @override + @JsonKey(name: 'score') + final int score; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'updated_at') + final DateTime updatedAt; + + @override + @JsonKey(name: 'user') + final UserResponse user; + + @override + @JsonKey(name: 'user_id') + final String userId; + + Map toJson() => _$ReactionResponseToJson(this); + + static ReactionResponse fromJson(Map json) => _$ReactionResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/reaction_response.freezed.dart b/packages/stream_chat/lib/open_api/model/reaction_response.freezed.dart new file mode 100644 index 0000000000..04dbe111f0 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/reaction_response.freezed.dart @@ -0,0 +1,145 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'reaction_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ReactionResponse { + DateTime get createdAt; + Map get custom; + String get messageId; + int get score; + String get type; + DateTime get updatedAt; + UserResponse get user; + String get userId; + + /// Create a copy of ReactionResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ReactionResponseCopyWith get copyWith => _$ReactionResponseCopyWithImpl( + this as ReactionResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ReactionResponse && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.messageId, messageId) || other.messageId == messageId) && + (identical(other.score, score) || other.score == score) && + (identical(other.type, type) || other.type == type) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt) && + (identical(other.user, user) || other.user == user) && + (identical(other.userId, userId) || other.userId == userId)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + createdAt, + const DeepCollectionEquality().hash(custom), + messageId, + score, + type, + updatedAt, + user, + userId, + ); + + @override + String toString() { + return 'ReactionResponse(createdAt: $createdAt, custom: $custom, messageId: $messageId, score: $score, type: $type, updatedAt: $updatedAt, user: $user, userId: $userId)'; + } +} + +/// @nodoc +abstract mixin class $ReactionResponseCopyWith<$Res> { + factory $ReactionResponseCopyWith( + ReactionResponse value, + $Res Function(ReactionResponse) _then, + ) = _$ReactionResponseCopyWithImpl; + @useResult + $Res call({ + DateTime createdAt, + Map custom, + String messageId, + int score, + String type, + DateTime updatedAt, + UserResponse user, + String userId, + }); +} + +/// @nodoc +class _$ReactionResponseCopyWithImpl<$Res> implements $ReactionResponseCopyWith<$Res> { + _$ReactionResponseCopyWithImpl(this._self, this._then); + + final ReactionResponse _self; + final $Res Function(ReactionResponse) _then; + + /// Create a copy of ReactionResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? createdAt = null, + Object? custom = null, + Object? messageId = null, + Object? score = null, + Object? type = null, + Object? updatedAt = null, + Object? user = null, + Object? userId = null, + }) { + return _then( + ReactionResponse( + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + messageId: null == messageId + ? _self.messageId + : messageId // ignore: cast_nullable_to_non_nullable + as String, + score: null == score + ? _self.score + : score // ignore: cast_nullable_to_non_nullable + as int, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + updatedAt: null == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + user: null == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponse, + userId: null == userId + ? _self.userId + : userId // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/reaction_response.g.dart b/packages/stream_chat/lib/open_api/model/reaction_response.g.dart new file mode 100644 index 0000000000..4b55c1dfb4 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/reaction_response.g.dart @@ -0,0 +1,33 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'reaction_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ReactionResponse _$ReactionResponseFromJson(Map json) => ReactionResponse( + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + messageId: json['message_id'] as String, + score: (json['score'] as num).toInt(), + type: json['type'] as String, + updatedAt: const StreamDateTimeConverter().fromJson( + json['updated_at'] as Object, + ), + user: UserResponse.fromJson(json['user'] as Map), + userId: json['user_id'] as String, +); + +Map _$ReactionResponseToJson(ReactionResponse instance) => { + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'message_id': instance.messageId, + 'score': instance.score, + 'type': instance.type, + 'updated_at': const StreamDateTimeConverter().toJson(instance.updatedAt), + 'user': instance.user.toJson(), + 'user_id': instance.userId, +}; diff --git a/packages/stream_chat/lib/open_api/model/reaction_updated_event.dart b/packages/stream_chat/lib/open_api/model/reaction_updated_event.dart new file mode 100644 index 0000000000..2b0113cc9f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/reaction_updated_event.dart @@ -0,0 +1,108 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'reaction_updated_event.g.dart'; +part 'reaction_updated_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ReactionUpdatedEvent extends core.WsEvent with _$ReactionUpdatedEvent { + const ReactionUpdatedEvent({ + required this.channel, + this.channelCustom, + this.channelId, + this.channelMemberCount, + this.channelMessageCount, + this.channelType, + this.cid, + required this.createdAt, + required this.custom, + required this.message, + required this.messageId, + this.reaction, + this.receivedAt, + this.team, + required this.type, + this.user, + }); + + @override + @JsonKey(name: 'channel') + final ChannelResponse channel; + + @override + @JsonKey(name: 'channel_custom') + final Map? channelCustom; + + @override + @JsonKey(name: 'channel_id') + final String? channelId; + + @override + @JsonKey(name: 'channel_member_count') + final int? channelMemberCount; + + @override + @JsonKey(name: 'channel_message_count') + final int? channelMessageCount; + + @override + @JsonKey(name: 'channel_type') + final String? channelType; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'message') + final MessageResponse message; + + @override + @JsonKey(name: 'message_id') + final String messageId; + + @override + @JsonKey(name: 'reaction') + final ReactionResponse? reaction; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'team') + final String? team; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'user') + final UserResponseCommonFields? user; + + Map toJson() => _$ReactionUpdatedEventToJson(this); + + static ReactionUpdatedEvent fromJson(Map json) => _$ReactionUpdatedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/reaction_updated_event.freezed.dart b/packages/stream_chat/lib/open_api/model/reaction_updated_event.freezed.dart new file mode 100644 index 0000000000..20b5e5f9f6 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/reaction_updated_event.freezed.dart @@ -0,0 +1,223 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'reaction_updated_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ReactionUpdatedEvent { + ChannelResponse get channel; + Map? get channelCustom; + String? get channelId; + int? get channelMemberCount; + int? get channelMessageCount; + String? get channelType; + String? get cid; + DateTime get createdAt; + Map get custom; + MessageResponse get message; + String get messageId; + ReactionResponse? get reaction; + DateTime? get receivedAt; + String? get team; + String get type; + UserResponseCommonFields? get user; + + /// Create a copy of ReactionUpdatedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ReactionUpdatedEventCopyWith get copyWith => + _$ReactionUpdatedEventCopyWithImpl( + this as ReactionUpdatedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ReactionUpdatedEvent && + (identical(other.channel, channel) || other.channel == channel) && + const DeepCollectionEquality().equals( + other.channelCustom, + channelCustom, + ) && + (identical(other.channelId, channelId) || other.channelId == channelId) && + (identical(other.channelMemberCount, channelMemberCount) || + other.channelMemberCount == channelMemberCount) && + (identical(other.channelMessageCount, channelMessageCount) || + other.channelMessageCount == channelMessageCount) && + (identical(other.channelType, channelType) || other.channelType == channelType) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.message, message) || other.message == message) && + (identical(other.messageId, messageId) || other.messageId == messageId) && + (identical(other.reaction, reaction) || other.reaction == reaction) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.team, team) || other.team == team) && + (identical(other.type, type) || other.type == type) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channel, + const DeepCollectionEquality().hash(channelCustom), + channelId, + channelMemberCount, + channelMessageCount, + channelType, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + message, + messageId, + reaction, + receivedAt, + team, + type, + user, + ); + + @override + String toString() { + return 'ReactionUpdatedEvent(channel: $channel, channelCustom: $channelCustom, channelId: $channelId, channelMemberCount: $channelMemberCount, channelMessageCount: $channelMessageCount, channelType: $channelType, cid: $cid, createdAt: $createdAt, custom: $custom, message: $message, messageId: $messageId, reaction: $reaction, receivedAt: $receivedAt, team: $team, type: $type, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $ReactionUpdatedEventCopyWith<$Res> { + factory $ReactionUpdatedEventCopyWith( + ReactionUpdatedEvent value, + $Res Function(ReactionUpdatedEvent) _then, + ) = _$ReactionUpdatedEventCopyWithImpl; + @useResult + $Res call({ + ChannelResponse channel, + Map? channelCustom, + String? channelId, + int? channelMemberCount, + int? channelMessageCount, + String? channelType, + String? cid, + DateTime createdAt, + Map custom, + MessageResponse message, + String messageId, + ReactionResponse? reaction, + DateTime? receivedAt, + String? team, + String type, + UserResponseCommonFields? user, + }); +} + +/// @nodoc +class _$ReactionUpdatedEventCopyWithImpl<$Res> implements $ReactionUpdatedEventCopyWith<$Res> { + _$ReactionUpdatedEventCopyWithImpl(this._self, this._then); + + final ReactionUpdatedEvent _self; + final $Res Function(ReactionUpdatedEvent) _then; + + /// Create a copy of ReactionUpdatedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channel = null, + Object? channelCustom = freezed, + Object? channelId = freezed, + Object? channelMemberCount = freezed, + Object? channelMessageCount = freezed, + Object? channelType = freezed, + Object? cid = freezed, + Object? createdAt = null, + Object? custom = null, + Object? message = null, + Object? messageId = null, + Object? reaction = freezed, + Object? receivedAt = freezed, + Object? team = freezed, + Object? type = null, + Object? user = freezed, + }) { + return _then( + ReactionUpdatedEvent( + channel: null == channel + ? _self.channel + : channel // ignore: cast_nullable_to_non_nullable + as ChannelResponse, + channelCustom: freezed == channelCustom + ? _self.channelCustom + : channelCustom // ignore: cast_nullable_to_non_nullable + as Map?, + channelId: freezed == channelId + ? _self.channelId + : channelId // ignore: cast_nullable_to_non_nullable + as String?, + channelMemberCount: freezed == channelMemberCount + ? _self.channelMemberCount + : channelMemberCount // ignore: cast_nullable_to_non_nullable + as int?, + channelMessageCount: freezed == channelMessageCount + ? _self.channelMessageCount + : channelMessageCount // ignore: cast_nullable_to_non_nullable + as int?, + channelType: freezed == channelType + ? _self.channelType + : channelType // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + message: null == message + ? _self.message + : message // ignore: cast_nullable_to_non_nullable + as MessageResponse, + messageId: null == messageId + ? _self.messageId + : messageId // ignore: cast_nullable_to_non_nullable + as String, + reaction: freezed == reaction + ? _self.reaction + : reaction // ignore: cast_nullable_to_non_nullable + as ReactionResponse?, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + team: freezed == team + ? _self.team + : team // ignore: cast_nullable_to_non_nullable + as String?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponseCommonFields?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/reaction_updated_event.g.dart b/packages/stream_chat/lib/open_api/model/reaction_updated_event.g.dart new file mode 100644 index 0000000000..49a0b175be --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/reaction_updated_event.g.dart @@ -0,0 +1,67 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'reaction_updated_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ReactionUpdatedEvent _$ReactionUpdatedEventFromJson( + Map json, +) => ReactionUpdatedEvent( + channel: ChannelResponse.fromJson(json['channel'] as Map), + channelCustom: json['channel_custom'] as Map?, + channelId: json['channel_id'] as String?, + channelMemberCount: (json['channel_member_count'] as num?)?.toInt(), + channelMessageCount: (json['channel_message_count'] as num?)?.toInt(), + channelType: json['channel_type'] as String?, + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + message: MessageResponse.fromJson(json['message'] as Map), + messageId: json['message_id'] as String, + reaction: json['reaction'] == null ? null : ReactionResponse.fromJson(json['reaction'] as Map), + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + team: json['team'] as String?, + type: json['type'] as String, + user: json['user'] == null ? null : UserResponseCommonFields.fromJson(json['user'] as Map), +); + +Map _$ReactionUpdatedEventToJson( + ReactionUpdatedEvent instance, +) => { + 'channel': instance.channel.toJson(), + 'channel_custom': instance.channelCustom, + 'channel_id': instance.channelId, + 'channel_member_count': instance.channelMemberCount, + 'channel_message_count': instance.channelMessageCount, + 'channel_type': instance.channelType, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'message': instance.message.toJson(), + 'message_id': instance.messageId, + 'reaction': instance.reaction?.toJson(), + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'team': instance.team, + 'type': instance.type, + 'user': instance.user?.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/read_receipts_response.dart b/packages/stream_chat/lib/open_api/model/read_receipts_response.dart new file mode 100644 index 0000000000..5ee15b3d00 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/read_receipts_response.dart @@ -0,0 +1,31 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'read_receipts_response.g.dart'; +part 'read_receipts_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ReadReceiptsResponse with _$ReadReceiptsResponse { + const ReadReceiptsResponse({ + required this.enabled, + }); + + @override + @JsonKey(name: 'enabled') + final bool enabled; + + Map toJson() => _$ReadReceiptsResponseToJson(this); + + static ReadReceiptsResponse fromJson(Map json) => _$ReadReceiptsResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/read_receipts_response.freezed.dart b/packages/stream_chat/lib/open_api/model/read_receipts_response.freezed.dart new file mode 100644 index 0000000000..07e82cc83e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/read_receipts_response.freezed.dart @@ -0,0 +1,76 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'read_receipts_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ReadReceiptsResponse { + bool get enabled; + + /// Create a copy of ReadReceiptsResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ReadReceiptsResponseCopyWith get copyWith => + _$ReadReceiptsResponseCopyWithImpl( + this as ReadReceiptsResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ReadReceiptsResponse && + (identical(other.enabled, enabled) || other.enabled == enabled)); + } + + @override + int get hashCode => Object.hash(runtimeType, enabled); + + @override + String toString() { + return 'ReadReceiptsResponse(enabled: $enabled)'; + } +} + +/// @nodoc +abstract mixin class $ReadReceiptsResponseCopyWith<$Res> { + factory $ReadReceiptsResponseCopyWith( + ReadReceiptsResponse value, + $Res Function(ReadReceiptsResponse) _then, + ) = _$ReadReceiptsResponseCopyWithImpl; + @useResult + $Res call({bool enabled}); +} + +/// @nodoc +class _$ReadReceiptsResponseCopyWithImpl<$Res> implements $ReadReceiptsResponseCopyWith<$Res> { + _$ReadReceiptsResponseCopyWithImpl(this._self, this._then); + + final ReadReceiptsResponse _self; + final $Res Function(ReadReceiptsResponse) _then; + + /// Create a copy of ReadReceiptsResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? enabled = null}) { + return _then( + ReadReceiptsResponse( + enabled: null == enabled + ? _self.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/read_receipts_response.g.dart b/packages/stream_chat/lib/open_api/model/read_receipts_response.g.dart new file mode 100644 index 0000000000..2d71b069e4 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/read_receipts_response.g.dart @@ -0,0 +1,15 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'read_receipts_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ReadReceiptsResponse _$ReadReceiptsResponseFromJson( + Map json, +) => ReadReceiptsResponse(enabled: json['enabled'] as bool); + +Map _$ReadReceiptsResponseToJson( + ReadReceiptsResponse instance, +) => {'enabled': instance.enabled}; diff --git a/packages/stream_chat/lib/open_api/model/read_state_response.dart b/packages/stream_chat/lib/open_api/model/read_state_response.dart new file mode 100644 index 0000000000..b2a7466cbc --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/read_state_response.dart @@ -0,0 +1,58 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'read_state_response.g.dart'; +part 'read_state_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ReadStateResponse with _$ReadStateResponse { + const ReadStateResponse({ + this.lastDeliveredAt, + this.lastDeliveredMessageId, + required this.lastRead, + this.lastReadMessageId, + required this.unreadMessages, + required this.user, + }); + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'last_delivered_at') + final DateTime? lastDeliveredAt; + + @override + @JsonKey(name: 'last_delivered_message_id') + final String? lastDeliveredMessageId; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'last_read') + final DateTime lastRead; + + @override + @JsonKey(name: 'last_read_message_id') + final String? lastReadMessageId; + + @override + @JsonKey(name: 'unread_messages') + final int unreadMessages; + + @override + @JsonKey(name: 'user') + final UserResponse user; + + Map toJson() => _$ReadStateResponseToJson(this); + + static ReadStateResponse fromJson(Map json) => _$ReadStateResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/read_state_response.freezed.dart b/packages/stream_chat/lib/open_api/model/read_state_response.freezed.dart new file mode 100644 index 0000000000..b0da54fa01 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/read_state_response.freezed.dart @@ -0,0 +1,128 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'read_state_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ReadStateResponse { + DateTime? get lastDeliveredAt; + String? get lastDeliveredMessageId; + DateTime get lastRead; + String? get lastReadMessageId; + int get unreadMessages; + UserResponse get user; + + /// Create a copy of ReadStateResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ReadStateResponseCopyWith get copyWith => _$ReadStateResponseCopyWithImpl( + this as ReadStateResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ReadStateResponse && + (identical(other.lastDeliveredAt, lastDeliveredAt) || other.lastDeliveredAt == lastDeliveredAt) && + (identical(other.lastDeliveredMessageId, lastDeliveredMessageId) || + other.lastDeliveredMessageId == lastDeliveredMessageId) && + (identical(other.lastRead, lastRead) || other.lastRead == lastRead) && + (identical(other.lastReadMessageId, lastReadMessageId) || other.lastReadMessageId == lastReadMessageId) && + (identical(other.unreadMessages, unreadMessages) || other.unreadMessages == unreadMessages) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + lastDeliveredAt, + lastDeliveredMessageId, + lastRead, + lastReadMessageId, + unreadMessages, + user, + ); + + @override + String toString() { + return 'ReadStateResponse(lastDeliveredAt: $lastDeliveredAt, lastDeliveredMessageId: $lastDeliveredMessageId, lastRead: $lastRead, lastReadMessageId: $lastReadMessageId, unreadMessages: $unreadMessages, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $ReadStateResponseCopyWith<$Res> { + factory $ReadStateResponseCopyWith( + ReadStateResponse value, + $Res Function(ReadStateResponse) _then, + ) = _$ReadStateResponseCopyWithImpl; + @useResult + $Res call({ + DateTime? lastDeliveredAt, + String? lastDeliveredMessageId, + DateTime lastRead, + String? lastReadMessageId, + int unreadMessages, + UserResponse user, + }); +} + +/// @nodoc +class _$ReadStateResponseCopyWithImpl<$Res> implements $ReadStateResponseCopyWith<$Res> { + _$ReadStateResponseCopyWithImpl(this._self, this._then); + + final ReadStateResponse _self; + final $Res Function(ReadStateResponse) _then; + + /// Create a copy of ReadStateResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? lastDeliveredAt = freezed, + Object? lastDeliveredMessageId = freezed, + Object? lastRead = null, + Object? lastReadMessageId = freezed, + Object? unreadMessages = null, + Object? user = null, + }) { + return _then( + ReadStateResponse( + lastDeliveredAt: freezed == lastDeliveredAt + ? _self.lastDeliveredAt + : lastDeliveredAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + lastDeliveredMessageId: freezed == lastDeliveredMessageId + ? _self.lastDeliveredMessageId + : lastDeliveredMessageId // ignore: cast_nullable_to_non_nullable + as String?, + lastRead: null == lastRead + ? _self.lastRead + : lastRead // ignore: cast_nullable_to_non_nullable + as DateTime, + lastReadMessageId: freezed == lastReadMessageId + ? _self.lastReadMessageId + : lastReadMessageId // ignore: cast_nullable_to_non_nullable + as String?, + unreadMessages: null == unreadMessages + ? _self.unreadMessages + : unreadMessages // ignore: cast_nullable_to_non_nullable + as int, + user: null == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponse, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/read_state_response.g.dart b/packages/stream_chat/lib/open_api/model/read_state_response.g.dart new file mode 100644 index 0000000000..3923be04ef --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/read_state_response.g.dart @@ -0,0 +1,43 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'read_state_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ReadStateResponse _$ReadStateResponseFromJson(Map json) => ReadStateResponse( + lastDeliveredAt: _$JsonConverterFromJson( + json['last_delivered_at'], + const StreamDateTimeConverter().fromJson, + ), + lastDeliveredMessageId: json['last_delivered_message_id'] as String?, + lastRead: const StreamDateTimeConverter().fromJson( + json['last_read'] as Object, + ), + lastReadMessageId: json['last_read_message_id'] as String?, + unreadMessages: (json['unread_messages'] as num).toInt(), + user: UserResponse.fromJson(json['user'] as Map), +); + +Map _$ReadStateResponseToJson(ReadStateResponse instance) => { + 'last_delivered_at': _$JsonConverterToJson( + instance.lastDeliveredAt, + const StreamDateTimeConverter().toJson, + ), + 'last_delivered_message_id': instance.lastDeliveredMessageId, + 'last_read': const StreamDateTimeConverter().toJson(instance.lastRead), + 'last_read_message_id': instance.lastReadMessageId, + 'unread_messages': instance.unreadMessages, + 'user': instance.user.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/reject_appeal_request_payload.dart b/packages/stream_chat/lib/open_api/model/reject_appeal_request_payload.dart new file mode 100644 index 0000000000..ed3902d8ed --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/reject_appeal_request_payload.dart @@ -0,0 +1,31 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'reject_appeal_request_payload.g.dart'; +part 'reject_appeal_request_payload.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class RejectAppealRequestPayload with _$RejectAppealRequestPayload { + const RejectAppealRequestPayload({ + required this.decisionReason, + }); + + @override + @JsonKey(name: 'decision_reason') + final String decisionReason; + + Map toJson() => _$RejectAppealRequestPayloadToJson(this); + + static RejectAppealRequestPayload fromJson(Map json) => _$RejectAppealRequestPayloadFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/reject_appeal_request_payload.freezed.dart b/packages/stream_chat/lib/open_api/model/reject_appeal_request_payload.freezed.dart new file mode 100644 index 0000000000..c003648ecf --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/reject_appeal_request_payload.freezed.dart @@ -0,0 +1,76 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'reject_appeal_request_payload.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$RejectAppealRequestPayload { + String get decisionReason; + + /// Create a copy of RejectAppealRequestPayload + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $RejectAppealRequestPayloadCopyWith get copyWith => + _$RejectAppealRequestPayloadCopyWithImpl( + this as RejectAppealRequestPayload, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is RejectAppealRequestPayload && + (identical(other.decisionReason, decisionReason) || other.decisionReason == decisionReason)); + } + + @override + int get hashCode => Object.hash(runtimeType, decisionReason); + + @override + String toString() { + return 'RejectAppealRequestPayload(decisionReason: $decisionReason)'; + } +} + +/// @nodoc +abstract mixin class $RejectAppealRequestPayloadCopyWith<$Res> { + factory $RejectAppealRequestPayloadCopyWith( + RejectAppealRequestPayload value, + $Res Function(RejectAppealRequestPayload) _then, + ) = _$RejectAppealRequestPayloadCopyWithImpl; + @useResult + $Res call({String decisionReason}); +} + +/// @nodoc +class _$RejectAppealRequestPayloadCopyWithImpl<$Res> implements $RejectAppealRequestPayloadCopyWith<$Res> { + _$RejectAppealRequestPayloadCopyWithImpl(this._self, this._then); + + final RejectAppealRequestPayload _self; + final $Res Function(RejectAppealRequestPayload) _then; + + /// Create a copy of RejectAppealRequestPayload + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? decisionReason = null}) { + return _then( + RejectAppealRequestPayload( + decisionReason: null == decisionReason + ? _self.decisionReason + : decisionReason // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/reject_appeal_request_payload.g.dart b/packages/stream_chat/lib/open_api/model/reject_appeal_request_payload.g.dart new file mode 100644 index 0000000000..e063fad3fa --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/reject_appeal_request_payload.g.dart @@ -0,0 +1,17 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'reject_appeal_request_payload.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +RejectAppealRequestPayload _$RejectAppealRequestPayloadFromJson( + Map json, +) => RejectAppealRequestPayload( + decisionReason: json['decision_reason'] as String, +); + +Map _$RejectAppealRequestPayloadToJson( + RejectAppealRequestPayload instance, +) => {'decision_reason': instance.decisionReason}; diff --git a/packages/stream_chat/lib/open_api/model/reminder_created_event.dart b/packages/stream_chat/lib/open_api/model/reminder_created_event.dart new file mode 100644 index 0000000000..91ae7776c3 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/reminder_created_event.dart @@ -0,0 +1,73 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'reminder_created_event.g.dart'; +part 'reminder_created_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ReminderCreatedEvent extends core.WsEvent with _$ReminderCreatedEvent { + const ReminderCreatedEvent({ + required this.cid, + required this.createdAt, + required this.custom, + required this.messageId, + this.parentId, + this.receivedAt, + required this.reminder, + required this.type, + required this.userId, + }); + + @override + @JsonKey(name: 'cid') + final String cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'message_id') + final String messageId; + + @override + @JsonKey(name: 'parent_id') + final String? parentId; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'reminder') + final ReminderResponseData reminder; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'user_id') + final String userId; + + Map toJson() => _$ReminderCreatedEventToJson(this); + + static ReminderCreatedEvent fromJson(Map json) => _$ReminderCreatedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/reminder_created_event.freezed.dart b/packages/stream_chat/lib/open_api/model/reminder_created_event.freezed.dart new file mode 100644 index 0000000000..0aaa8d6dea --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/reminder_created_event.freezed.dart @@ -0,0 +1,155 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'reminder_created_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ReminderCreatedEvent { + String get cid; + DateTime get createdAt; + Map get custom; + String get messageId; + String? get parentId; + DateTime? get receivedAt; + ReminderResponseData get reminder; + String get type; + String get userId; + + /// Create a copy of ReminderCreatedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ReminderCreatedEventCopyWith get copyWith => + _$ReminderCreatedEventCopyWithImpl( + this as ReminderCreatedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ReminderCreatedEvent && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.messageId, messageId) || other.messageId == messageId) && + (identical(other.parentId, parentId) || other.parentId == parentId) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.reminder, reminder) || other.reminder == reminder) && + (identical(other.type, type) || other.type == type) && + (identical(other.userId, userId) || other.userId == userId)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + messageId, + parentId, + receivedAt, + reminder, + type, + userId, + ); + + @override + String toString() { + return 'ReminderCreatedEvent(cid: $cid, createdAt: $createdAt, custom: $custom, messageId: $messageId, parentId: $parentId, receivedAt: $receivedAt, reminder: $reminder, type: $type, userId: $userId)'; + } +} + +/// @nodoc +abstract mixin class $ReminderCreatedEventCopyWith<$Res> { + factory $ReminderCreatedEventCopyWith( + ReminderCreatedEvent value, + $Res Function(ReminderCreatedEvent) _then, + ) = _$ReminderCreatedEventCopyWithImpl; + @useResult + $Res call({ + String cid, + DateTime createdAt, + Map custom, + String messageId, + String? parentId, + DateTime? receivedAt, + ReminderResponseData reminder, + String type, + String userId, + }); +} + +/// @nodoc +class _$ReminderCreatedEventCopyWithImpl<$Res> implements $ReminderCreatedEventCopyWith<$Res> { + _$ReminderCreatedEventCopyWithImpl(this._self, this._then); + + final ReminderCreatedEvent _self; + final $Res Function(ReminderCreatedEvent) _then; + + /// Create a copy of ReminderCreatedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? cid = null, + Object? createdAt = null, + Object? custom = null, + Object? messageId = null, + Object? parentId = freezed, + Object? receivedAt = freezed, + Object? reminder = null, + Object? type = null, + Object? userId = null, + }) { + return _then( + ReminderCreatedEvent( + cid: null == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + messageId: null == messageId + ? _self.messageId + : messageId // ignore: cast_nullable_to_non_nullable + as String, + parentId: freezed == parentId + ? _self.parentId + : parentId // ignore: cast_nullable_to_non_nullable + as String?, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + reminder: null == reminder + ? _self.reminder + : reminder // ignore: cast_nullable_to_non_nullable + as ReminderResponseData, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + userId: null == userId + ? _self.userId + : userId // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/reminder_created_event.g.dart b/packages/stream_chat/lib/open_api/model/reminder_created_event.g.dart new file mode 100644 index 0000000000..7c338f4bcf --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/reminder_created_event.g.dart @@ -0,0 +1,55 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'reminder_created_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ReminderCreatedEvent _$ReminderCreatedEventFromJson( + Map json, +) => ReminderCreatedEvent( + cid: json['cid'] as String, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + messageId: json['message_id'] as String, + parentId: json['parent_id'] as String?, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + reminder: ReminderResponseData.fromJson( + json['reminder'] as Map, + ), + type: json['type'] as String, + userId: json['user_id'] as String, +); + +Map _$ReminderCreatedEventToJson( + ReminderCreatedEvent instance, +) => { + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'message_id': instance.messageId, + 'parent_id': instance.parentId, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'reminder': instance.reminder.toJson(), + 'type': instance.type, + 'user_id': instance.userId, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/reminder_deleted_event.dart b/packages/stream_chat/lib/open_api/model/reminder_deleted_event.dart new file mode 100644 index 0000000000..3b01fc85d4 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/reminder_deleted_event.dart @@ -0,0 +1,73 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'reminder_deleted_event.g.dart'; +part 'reminder_deleted_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ReminderDeletedEvent extends core.WsEvent with _$ReminderDeletedEvent { + const ReminderDeletedEvent({ + required this.cid, + required this.createdAt, + required this.custom, + required this.messageId, + this.parentId, + this.receivedAt, + required this.reminder, + required this.type, + required this.userId, + }); + + @override + @JsonKey(name: 'cid') + final String cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'message_id') + final String messageId; + + @override + @JsonKey(name: 'parent_id') + final String? parentId; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'reminder') + final ReminderResponseData reminder; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'user_id') + final String userId; + + Map toJson() => _$ReminderDeletedEventToJson(this); + + static ReminderDeletedEvent fromJson(Map json) => _$ReminderDeletedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/reminder_deleted_event.freezed.dart b/packages/stream_chat/lib/open_api/model/reminder_deleted_event.freezed.dart new file mode 100644 index 0000000000..a31bfdc5ab --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/reminder_deleted_event.freezed.dart @@ -0,0 +1,155 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'reminder_deleted_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ReminderDeletedEvent { + String get cid; + DateTime get createdAt; + Map get custom; + String get messageId; + String? get parentId; + DateTime? get receivedAt; + ReminderResponseData get reminder; + String get type; + String get userId; + + /// Create a copy of ReminderDeletedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ReminderDeletedEventCopyWith get copyWith => + _$ReminderDeletedEventCopyWithImpl( + this as ReminderDeletedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ReminderDeletedEvent && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.messageId, messageId) || other.messageId == messageId) && + (identical(other.parentId, parentId) || other.parentId == parentId) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.reminder, reminder) || other.reminder == reminder) && + (identical(other.type, type) || other.type == type) && + (identical(other.userId, userId) || other.userId == userId)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + messageId, + parentId, + receivedAt, + reminder, + type, + userId, + ); + + @override + String toString() { + return 'ReminderDeletedEvent(cid: $cid, createdAt: $createdAt, custom: $custom, messageId: $messageId, parentId: $parentId, receivedAt: $receivedAt, reminder: $reminder, type: $type, userId: $userId)'; + } +} + +/// @nodoc +abstract mixin class $ReminderDeletedEventCopyWith<$Res> { + factory $ReminderDeletedEventCopyWith( + ReminderDeletedEvent value, + $Res Function(ReminderDeletedEvent) _then, + ) = _$ReminderDeletedEventCopyWithImpl; + @useResult + $Res call({ + String cid, + DateTime createdAt, + Map custom, + String messageId, + String? parentId, + DateTime? receivedAt, + ReminderResponseData reminder, + String type, + String userId, + }); +} + +/// @nodoc +class _$ReminderDeletedEventCopyWithImpl<$Res> implements $ReminderDeletedEventCopyWith<$Res> { + _$ReminderDeletedEventCopyWithImpl(this._self, this._then); + + final ReminderDeletedEvent _self; + final $Res Function(ReminderDeletedEvent) _then; + + /// Create a copy of ReminderDeletedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? cid = null, + Object? createdAt = null, + Object? custom = null, + Object? messageId = null, + Object? parentId = freezed, + Object? receivedAt = freezed, + Object? reminder = null, + Object? type = null, + Object? userId = null, + }) { + return _then( + ReminderDeletedEvent( + cid: null == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + messageId: null == messageId + ? _self.messageId + : messageId // ignore: cast_nullable_to_non_nullable + as String, + parentId: freezed == parentId + ? _self.parentId + : parentId // ignore: cast_nullable_to_non_nullable + as String?, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + reminder: null == reminder + ? _self.reminder + : reminder // ignore: cast_nullable_to_non_nullable + as ReminderResponseData, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + userId: null == userId + ? _self.userId + : userId // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/reminder_deleted_event.g.dart b/packages/stream_chat/lib/open_api/model/reminder_deleted_event.g.dart new file mode 100644 index 0000000000..4186b91d74 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/reminder_deleted_event.g.dart @@ -0,0 +1,55 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'reminder_deleted_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ReminderDeletedEvent _$ReminderDeletedEventFromJson( + Map json, +) => ReminderDeletedEvent( + cid: json['cid'] as String, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + messageId: json['message_id'] as String, + parentId: json['parent_id'] as String?, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + reminder: ReminderResponseData.fromJson( + json['reminder'] as Map, + ), + type: json['type'] as String, + userId: json['user_id'] as String, +); + +Map _$ReminderDeletedEventToJson( + ReminderDeletedEvent instance, +) => { + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'message_id': instance.messageId, + 'parent_id': instance.parentId, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'reminder': instance.reminder.toJson(), + 'type': instance.type, + 'user_id': instance.userId, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/reminder_notification_event.dart b/packages/stream_chat/lib/open_api/model/reminder_notification_event.dart new file mode 100644 index 0000000000..57a49a6a93 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/reminder_notification_event.dart @@ -0,0 +1,73 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'reminder_notification_event.g.dart'; +part 'reminder_notification_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ReminderNotificationEvent extends core.WsEvent with _$ReminderNotificationEvent { + const ReminderNotificationEvent({ + required this.cid, + required this.createdAt, + required this.custom, + required this.messageId, + this.parentId, + this.receivedAt, + required this.reminder, + required this.type, + required this.userId, + }); + + @override + @JsonKey(name: 'cid') + final String cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'message_id') + final String messageId; + + @override + @JsonKey(name: 'parent_id') + final String? parentId; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'reminder') + final ReminderResponseData reminder; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'user_id') + final String userId; + + Map toJson() => _$ReminderNotificationEventToJson(this); + + static ReminderNotificationEvent fromJson(Map json) => _$ReminderNotificationEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/reminder_notification_event.freezed.dart b/packages/stream_chat/lib/open_api/model/reminder_notification_event.freezed.dart new file mode 100644 index 0000000000..2917aa9843 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/reminder_notification_event.freezed.dart @@ -0,0 +1,155 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'reminder_notification_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ReminderNotificationEvent { + String get cid; + DateTime get createdAt; + Map get custom; + String get messageId; + String? get parentId; + DateTime? get receivedAt; + ReminderResponseData get reminder; + String get type; + String get userId; + + /// Create a copy of ReminderNotificationEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ReminderNotificationEventCopyWith get copyWith => + _$ReminderNotificationEventCopyWithImpl( + this as ReminderNotificationEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ReminderNotificationEvent && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.messageId, messageId) || other.messageId == messageId) && + (identical(other.parentId, parentId) || other.parentId == parentId) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.reminder, reminder) || other.reminder == reminder) && + (identical(other.type, type) || other.type == type) && + (identical(other.userId, userId) || other.userId == userId)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + messageId, + parentId, + receivedAt, + reminder, + type, + userId, + ); + + @override + String toString() { + return 'ReminderNotificationEvent(cid: $cid, createdAt: $createdAt, custom: $custom, messageId: $messageId, parentId: $parentId, receivedAt: $receivedAt, reminder: $reminder, type: $type, userId: $userId)'; + } +} + +/// @nodoc +abstract mixin class $ReminderNotificationEventCopyWith<$Res> { + factory $ReminderNotificationEventCopyWith( + ReminderNotificationEvent value, + $Res Function(ReminderNotificationEvent) _then, + ) = _$ReminderNotificationEventCopyWithImpl; + @useResult + $Res call({ + String cid, + DateTime createdAt, + Map custom, + String messageId, + String? parentId, + DateTime? receivedAt, + ReminderResponseData reminder, + String type, + String userId, + }); +} + +/// @nodoc +class _$ReminderNotificationEventCopyWithImpl<$Res> implements $ReminderNotificationEventCopyWith<$Res> { + _$ReminderNotificationEventCopyWithImpl(this._self, this._then); + + final ReminderNotificationEvent _self; + final $Res Function(ReminderNotificationEvent) _then; + + /// Create a copy of ReminderNotificationEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? cid = null, + Object? createdAt = null, + Object? custom = null, + Object? messageId = null, + Object? parentId = freezed, + Object? receivedAt = freezed, + Object? reminder = null, + Object? type = null, + Object? userId = null, + }) { + return _then( + ReminderNotificationEvent( + cid: null == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + messageId: null == messageId + ? _self.messageId + : messageId // ignore: cast_nullable_to_non_nullable + as String, + parentId: freezed == parentId + ? _self.parentId + : parentId // ignore: cast_nullable_to_non_nullable + as String?, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + reminder: null == reminder + ? _self.reminder + : reminder // ignore: cast_nullable_to_non_nullable + as ReminderResponseData, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + userId: null == userId + ? _self.userId + : userId // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/reminder_notification_event.g.dart b/packages/stream_chat/lib/open_api/model/reminder_notification_event.g.dart new file mode 100644 index 0000000000..39a2c71f92 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/reminder_notification_event.g.dart @@ -0,0 +1,55 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'reminder_notification_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ReminderNotificationEvent _$ReminderNotificationEventFromJson( + Map json, +) => ReminderNotificationEvent( + cid: json['cid'] as String, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + messageId: json['message_id'] as String, + parentId: json['parent_id'] as String?, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + reminder: ReminderResponseData.fromJson( + json['reminder'] as Map, + ), + type: json['type'] as String, + userId: json['user_id'] as String, +); + +Map _$ReminderNotificationEventToJson( + ReminderNotificationEvent instance, +) => { + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'message_id': instance.messageId, + 'parent_id': instance.parentId, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'reminder': instance.reminder.toJson(), + 'type': instance.type, + 'user_id': instance.userId, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/reminder_response_data.dart b/packages/stream_chat/lib/open_api/model/reminder_response_data.dart new file mode 100644 index 0000000000..ce17841493 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/reminder_response_data.dart @@ -0,0 +1,74 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'reminder_response_data.g.dart'; +part 'reminder_response_data.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ReminderResponseData with _$ReminderResponseData { + const ReminderResponseData({ + this.channel, + required this.channelCid, + required this.createdAt, + this.message, + required this.messageId, + this.remindAt, + required this.updatedAt, + this.user, + required this.userId, + }); + + @override + @JsonKey(name: 'channel') + final ChannelResponse? channel; + + @override + @JsonKey(name: 'channel_cid') + final String channelCid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'message') + final MessageResponse? message; + + @override + @JsonKey(name: 'message_id') + final String messageId; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'remind_at') + final DateTime? remindAt; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'updated_at') + final DateTime updatedAt; + + @override + @JsonKey(name: 'user') + final UserResponse? user; + + @override + @JsonKey(name: 'user_id') + final String userId; + + Map toJson() => _$ReminderResponseDataToJson(this); + + static ReminderResponseData fromJson(Map json) => _$ReminderResponseDataFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/reminder_response_data.freezed.dart b/packages/stream_chat/lib/open_api/model/reminder_response_data.freezed.dart new file mode 100644 index 0000000000..4b4c1bb0b2 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/reminder_response_data.freezed.dart @@ -0,0 +1,155 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'reminder_response_data.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ReminderResponseData { + ChannelResponse? get channel; + String get channelCid; + DateTime get createdAt; + MessageResponse? get message; + String get messageId; + DateTime? get remindAt; + DateTime get updatedAt; + UserResponse? get user; + String get userId; + + /// Create a copy of ReminderResponseData + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ReminderResponseDataCopyWith get copyWith => + _$ReminderResponseDataCopyWithImpl( + this as ReminderResponseData, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ReminderResponseData && + (identical(other.channel, channel) || other.channel == channel) && + (identical(other.channelCid, channelCid) || other.channelCid == channelCid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.message, message) || other.message == message) && + (identical(other.messageId, messageId) || other.messageId == messageId) && + (identical(other.remindAt, remindAt) || other.remindAt == remindAt) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt) && + (identical(other.user, user) || other.user == user) && + (identical(other.userId, userId) || other.userId == userId)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channel, + channelCid, + createdAt, + message, + messageId, + remindAt, + updatedAt, + user, + userId, + ); + + @override + String toString() { + return 'ReminderResponseData(channel: $channel, channelCid: $channelCid, createdAt: $createdAt, message: $message, messageId: $messageId, remindAt: $remindAt, updatedAt: $updatedAt, user: $user, userId: $userId)'; + } +} + +/// @nodoc +abstract mixin class $ReminderResponseDataCopyWith<$Res> { + factory $ReminderResponseDataCopyWith( + ReminderResponseData value, + $Res Function(ReminderResponseData) _then, + ) = _$ReminderResponseDataCopyWithImpl; + @useResult + $Res call({ + ChannelResponse? channel, + String channelCid, + DateTime createdAt, + MessageResponse? message, + String messageId, + DateTime? remindAt, + DateTime updatedAt, + UserResponse? user, + String userId, + }); +} + +/// @nodoc +class _$ReminderResponseDataCopyWithImpl<$Res> implements $ReminderResponseDataCopyWith<$Res> { + _$ReminderResponseDataCopyWithImpl(this._self, this._then); + + final ReminderResponseData _self; + final $Res Function(ReminderResponseData) _then; + + /// Create a copy of ReminderResponseData + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channel = freezed, + Object? channelCid = null, + Object? createdAt = null, + Object? message = freezed, + Object? messageId = null, + Object? remindAt = freezed, + Object? updatedAt = null, + Object? user = freezed, + Object? userId = null, + }) { + return _then( + ReminderResponseData( + channel: freezed == channel + ? _self.channel + : channel // ignore: cast_nullable_to_non_nullable + as ChannelResponse?, + channelCid: null == channelCid + ? _self.channelCid + : channelCid // ignore: cast_nullable_to_non_nullable + as String, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + message: freezed == message + ? _self.message + : message // ignore: cast_nullable_to_non_nullable + as MessageResponse?, + messageId: null == messageId + ? _self.messageId + : messageId // ignore: cast_nullable_to_non_nullable + as String, + remindAt: freezed == remindAt + ? _self.remindAt + : remindAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + updatedAt: null == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponse?, + userId: null == userId + ? _self.userId + : userId // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/reminder_response_data.g.dart b/packages/stream_chat/lib/open_api/model/reminder_response_data.g.dart new file mode 100644 index 0000000000..16ea4abd9a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/reminder_response_data.g.dart @@ -0,0 +1,55 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'reminder_response_data.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ReminderResponseData _$ReminderResponseDataFromJson( + Map json, +) => ReminderResponseData( + channel: json['channel'] == null ? null : ChannelResponse.fromJson(json['channel'] as Map), + channelCid: json['channel_cid'] as String, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + message: json['message'] == null ? null : MessageResponse.fromJson(json['message'] as Map), + messageId: json['message_id'] as String, + remindAt: _$JsonConverterFromJson( + json['remind_at'], + const StreamDateTimeConverter().fromJson, + ), + updatedAt: const StreamDateTimeConverter().fromJson( + json['updated_at'] as Object, + ), + user: json['user'] == null ? null : UserResponse.fromJson(json['user'] as Map), + userId: json['user_id'] as String, +); + +Map _$ReminderResponseDataToJson( + ReminderResponseData instance, +) => { + 'channel': instance.channel?.toJson(), + 'channel_cid': instance.channelCid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'message': instance.message?.toJson(), + 'message_id': instance.messageId, + 'remind_at': _$JsonConverterToJson( + instance.remindAt, + const StreamDateTimeConverter().toJson, + ), + 'updated_at': const StreamDateTimeConverter().toJson(instance.updatedAt), + 'user': instance.user?.toJson(), + 'user_id': instance.userId, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/reminder_updated_event.dart b/packages/stream_chat/lib/open_api/model/reminder_updated_event.dart new file mode 100644 index 0000000000..95008ddb6a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/reminder_updated_event.dart @@ -0,0 +1,73 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'reminder_updated_event.g.dart'; +part 'reminder_updated_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ReminderUpdatedEvent extends core.WsEvent with _$ReminderUpdatedEvent { + const ReminderUpdatedEvent({ + required this.cid, + required this.createdAt, + required this.custom, + required this.messageId, + this.parentId, + this.receivedAt, + required this.reminder, + required this.type, + required this.userId, + }); + + @override + @JsonKey(name: 'cid') + final String cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'message_id') + final String messageId; + + @override + @JsonKey(name: 'parent_id') + final String? parentId; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'reminder') + final ReminderResponseData reminder; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'user_id') + final String userId; + + Map toJson() => _$ReminderUpdatedEventToJson(this); + + static ReminderUpdatedEvent fromJson(Map json) => _$ReminderUpdatedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/reminder_updated_event.freezed.dart b/packages/stream_chat/lib/open_api/model/reminder_updated_event.freezed.dart new file mode 100644 index 0000000000..f21e3377b2 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/reminder_updated_event.freezed.dart @@ -0,0 +1,155 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'reminder_updated_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ReminderUpdatedEvent { + String get cid; + DateTime get createdAt; + Map get custom; + String get messageId; + String? get parentId; + DateTime? get receivedAt; + ReminderResponseData get reminder; + String get type; + String get userId; + + /// Create a copy of ReminderUpdatedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ReminderUpdatedEventCopyWith get copyWith => + _$ReminderUpdatedEventCopyWithImpl( + this as ReminderUpdatedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ReminderUpdatedEvent && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.messageId, messageId) || other.messageId == messageId) && + (identical(other.parentId, parentId) || other.parentId == parentId) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.reminder, reminder) || other.reminder == reminder) && + (identical(other.type, type) || other.type == type) && + (identical(other.userId, userId) || other.userId == userId)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + messageId, + parentId, + receivedAt, + reminder, + type, + userId, + ); + + @override + String toString() { + return 'ReminderUpdatedEvent(cid: $cid, createdAt: $createdAt, custom: $custom, messageId: $messageId, parentId: $parentId, receivedAt: $receivedAt, reminder: $reminder, type: $type, userId: $userId)'; + } +} + +/// @nodoc +abstract mixin class $ReminderUpdatedEventCopyWith<$Res> { + factory $ReminderUpdatedEventCopyWith( + ReminderUpdatedEvent value, + $Res Function(ReminderUpdatedEvent) _then, + ) = _$ReminderUpdatedEventCopyWithImpl; + @useResult + $Res call({ + String cid, + DateTime createdAt, + Map custom, + String messageId, + String? parentId, + DateTime? receivedAt, + ReminderResponseData reminder, + String type, + String userId, + }); +} + +/// @nodoc +class _$ReminderUpdatedEventCopyWithImpl<$Res> implements $ReminderUpdatedEventCopyWith<$Res> { + _$ReminderUpdatedEventCopyWithImpl(this._self, this._then); + + final ReminderUpdatedEvent _self; + final $Res Function(ReminderUpdatedEvent) _then; + + /// Create a copy of ReminderUpdatedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? cid = null, + Object? createdAt = null, + Object? custom = null, + Object? messageId = null, + Object? parentId = freezed, + Object? receivedAt = freezed, + Object? reminder = null, + Object? type = null, + Object? userId = null, + }) { + return _then( + ReminderUpdatedEvent( + cid: null == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + messageId: null == messageId + ? _self.messageId + : messageId // ignore: cast_nullable_to_non_nullable + as String, + parentId: freezed == parentId + ? _self.parentId + : parentId // ignore: cast_nullable_to_non_nullable + as String?, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + reminder: null == reminder + ? _self.reminder + : reminder // ignore: cast_nullable_to_non_nullable + as ReminderResponseData, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + userId: null == userId + ? _self.userId + : userId // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/reminder_updated_event.g.dart b/packages/stream_chat/lib/open_api/model/reminder_updated_event.g.dart new file mode 100644 index 0000000000..5c360695ec --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/reminder_updated_event.g.dart @@ -0,0 +1,55 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'reminder_updated_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ReminderUpdatedEvent _$ReminderUpdatedEventFromJson( + Map json, +) => ReminderUpdatedEvent( + cid: json['cid'] as String, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + messageId: json['message_id'] as String, + parentId: json['parent_id'] as String?, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + reminder: ReminderResponseData.fromJson( + json['reminder'] as Map, + ), + type: json['type'] as String, + userId: json['user_id'] as String, +); + +Map _$ReminderUpdatedEventToJson( + ReminderUpdatedEvent instance, +) => { + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'message_id': instance.messageId, + 'parent_id': instance.parentId, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'reminder': instance.reminder.toJson(), + 'type': instance.type, + 'user_id': instance.userId, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/remove_user_group_members_request.dart b/packages/stream_chat/lib/open_api/model/remove_user_group_members_request.dart new file mode 100644 index 0000000000..ef5a658ab1 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/remove_user_group_members_request.dart @@ -0,0 +1,37 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'remove_user_group_members_request.g.dart'; +part 'remove_user_group_members_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class RemoveUserGroupMembersRequest with _$RemoveUserGroupMembersRequest { + const RemoveUserGroupMembersRequest({ + required this.memberIds, + this.teamId, + }); + + @override + @JsonKey(name: 'member_ids') + final List memberIds; + + @override + @JsonKey(name: 'team_id') + final String? teamId; + + Map toJson() => _$RemoveUserGroupMembersRequestToJson(this); + + static RemoveUserGroupMembersRequest fromJson(Map json) => + _$RemoveUserGroupMembersRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/remove_user_group_members_request.freezed.dart b/packages/stream_chat/lib/open_api/model/remove_user_group_members_request.freezed.dart new file mode 100644 index 0000000000..b8c5f6a9c8 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/remove_user_group_members_request.freezed.dart @@ -0,0 +1,86 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'remove_user_group_members_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$RemoveUserGroupMembersRequest { + List get memberIds; + String? get teamId; + + /// Create a copy of RemoveUserGroupMembersRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $RemoveUserGroupMembersRequestCopyWith get copyWith => + _$RemoveUserGroupMembersRequestCopyWithImpl( + this as RemoveUserGroupMembersRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is RemoveUserGroupMembersRequest && + const DeepCollectionEquality().equals(other.memberIds, memberIds) && + (identical(other.teamId, teamId) || other.teamId == teamId)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(memberIds), + teamId, + ); + + @override + String toString() { + return 'RemoveUserGroupMembersRequest(memberIds: $memberIds, teamId: $teamId)'; + } +} + +/// @nodoc +abstract mixin class $RemoveUserGroupMembersRequestCopyWith<$Res> { + factory $RemoveUserGroupMembersRequestCopyWith( + RemoveUserGroupMembersRequest value, + $Res Function(RemoveUserGroupMembersRequest) _then, + ) = _$RemoveUserGroupMembersRequestCopyWithImpl; + @useResult + $Res call({List memberIds, String? teamId}); +} + +/// @nodoc +class _$RemoveUserGroupMembersRequestCopyWithImpl<$Res> implements $RemoveUserGroupMembersRequestCopyWith<$Res> { + _$RemoveUserGroupMembersRequestCopyWithImpl(this._self, this._then); + + final RemoveUserGroupMembersRequest _self; + final $Res Function(RemoveUserGroupMembersRequest) _then; + + /// Create a copy of RemoveUserGroupMembersRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? memberIds = null, Object? teamId = freezed}) { + return _then( + RemoveUserGroupMembersRequest( + memberIds: null == memberIds + ? _self.memberIds + : memberIds // ignore: cast_nullable_to_non_nullable + as List, + teamId: freezed == teamId + ? _self.teamId + : teamId // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/remove_user_group_members_request.g.dart b/packages/stream_chat/lib/open_api/model/remove_user_group_members_request.g.dart new file mode 100644 index 0000000000..872fcfab28 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/remove_user_group_members_request.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'remove_user_group_members_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +RemoveUserGroupMembersRequest _$RemoveUserGroupMembersRequestFromJson( + Map json, +) => RemoveUserGroupMembersRequest( + memberIds: (json['member_ids'] as List).map((e) => e as String).toList(), + teamId: json['team_id'] as String?, +); + +Map _$RemoveUserGroupMembersRequestToJson( + RemoveUserGroupMembersRequest instance, +) => { + 'member_ids': instance.memberIds, + 'team_id': instance.teamId, +}; diff --git a/packages/stream_chat/lib/open_api/model/remove_user_group_members_response.dart b/packages/stream_chat/lib/open_api/model/remove_user_group_members_response.dart new file mode 100644 index 0000000000..5a3fc4c8df --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/remove_user_group_members_response.dart @@ -0,0 +1,37 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'remove_user_group_members_response.g.dart'; +part 'remove_user_group_members_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class RemoveUserGroupMembersResponse with _$RemoveUserGroupMembersResponse { + const RemoveUserGroupMembersResponse({ + required this.duration, + this.userGroup, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'user_group') + final UserGroupResponse? userGroup; + + Map toJson() => _$RemoveUserGroupMembersResponseToJson(this); + + static RemoveUserGroupMembersResponse fromJson(Map json) => + _$RemoveUserGroupMembersResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/remove_user_group_members_response.freezed.dart b/packages/stream_chat/lib/open_api/model/remove_user_group_members_response.freezed.dart new file mode 100644 index 0000000000..217a97d479 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/remove_user_group_members_response.freezed.dart @@ -0,0 +1,82 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'remove_user_group_members_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$RemoveUserGroupMembersResponse { + String get duration; + UserGroupResponse? get userGroup; + + /// Create a copy of RemoveUserGroupMembersResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $RemoveUserGroupMembersResponseCopyWith get copyWith => + _$RemoveUserGroupMembersResponseCopyWithImpl( + this as RemoveUserGroupMembersResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is RemoveUserGroupMembersResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.userGroup, userGroup) || other.userGroup == userGroup)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration, userGroup); + + @override + String toString() { + return 'RemoveUserGroupMembersResponse(duration: $duration, userGroup: $userGroup)'; + } +} + +/// @nodoc +abstract mixin class $RemoveUserGroupMembersResponseCopyWith<$Res> { + factory $RemoveUserGroupMembersResponseCopyWith( + RemoveUserGroupMembersResponse value, + $Res Function(RemoveUserGroupMembersResponse) _then, + ) = _$RemoveUserGroupMembersResponseCopyWithImpl; + @useResult + $Res call({String duration, UserGroupResponse? userGroup}); +} + +/// @nodoc +class _$RemoveUserGroupMembersResponseCopyWithImpl<$Res> implements $RemoveUserGroupMembersResponseCopyWith<$Res> { + _$RemoveUserGroupMembersResponseCopyWithImpl(this._self, this._then); + + final RemoveUserGroupMembersResponse _self; + final $Res Function(RemoveUserGroupMembersResponse) _then; + + /// Create a copy of RemoveUserGroupMembersResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? userGroup = freezed}) { + return _then( + RemoveUserGroupMembersResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + userGroup: freezed == userGroup + ? _self.userGroup + : userGroup // ignore: cast_nullable_to_non_nullable + as UserGroupResponse?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/remove_user_group_members_response.g.dart b/packages/stream_chat/lib/open_api/model/remove_user_group_members_response.g.dart new file mode 100644 index 0000000000..53737bae1c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/remove_user_group_members_response.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'remove_user_group_members_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +RemoveUserGroupMembersResponse _$RemoveUserGroupMembersResponseFromJson( + Map json, +) => RemoveUserGroupMembersResponse( + duration: json['duration'] as String, + userGroup: json['user_group'] == null ? null : UserGroupResponse.fromJson(json['user_group'] as Map), +); + +Map _$RemoveUserGroupMembersResponseToJson( + RemoveUserGroupMembersResponse instance, +) => { + 'duration': instance.duration, + 'user_group': instance.userGroup?.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/restore_action_request_payload.dart b/packages/stream_chat/lib/open_api/model/restore_action_request_payload.dart new file mode 100644 index 0000000000..1b290a9839 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/restore_action_request_payload.dart @@ -0,0 +1,31 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'restore_action_request_payload.g.dart'; +part 'restore_action_request_payload.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class RestoreActionRequestPayload with _$RestoreActionRequestPayload { + const RestoreActionRequestPayload({ + this.decisionReason, + }); + + @override + @JsonKey(name: 'decision_reason') + final String? decisionReason; + + Map toJson() => _$RestoreActionRequestPayloadToJson(this); + + static RestoreActionRequestPayload fromJson(Map json) => _$RestoreActionRequestPayloadFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/restore_action_request_payload.freezed.dart b/packages/stream_chat/lib/open_api/model/restore_action_request_payload.freezed.dart new file mode 100644 index 0000000000..60349b03ef --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/restore_action_request_payload.freezed.dart @@ -0,0 +1,76 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'restore_action_request_payload.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$RestoreActionRequestPayload { + String? get decisionReason; + + /// Create a copy of RestoreActionRequestPayload + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $RestoreActionRequestPayloadCopyWith get copyWith => + _$RestoreActionRequestPayloadCopyWithImpl( + this as RestoreActionRequestPayload, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is RestoreActionRequestPayload && + (identical(other.decisionReason, decisionReason) || other.decisionReason == decisionReason)); + } + + @override + int get hashCode => Object.hash(runtimeType, decisionReason); + + @override + String toString() { + return 'RestoreActionRequestPayload(decisionReason: $decisionReason)'; + } +} + +/// @nodoc +abstract mixin class $RestoreActionRequestPayloadCopyWith<$Res> { + factory $RestoreActionRequestPayloadCopyWith( + RestoreActionRequestPayload value, + $Res Function(RestoreActionRequestPayload) _then, + ) = _$RestoreActionRequestPayloadCopyWithImpl; + @useResult + $Res call({String? decisionReason}); +} + +/// @nodoc +class _$RestoreActionRequestPayloadCopyWithImpl<$Res> implements $RestoreActionRequestPayloadCopyWith<$Res> { + _$RestoreActionRequestPayloadCopyWithImpl(this._self, this._then); + + final RestoreActionRequestPayload _self; + final $Res Function(RestoreActionRequestPayload) _then; + + /// Create a copy of RestoreActionRequestPayload + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? decisionReason = freezed}) { + return _then( + RestoreActionRequestPayload( + decisionReason: freezed == decisionReason + ? _self.decisionReason + : decisionReason // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/restore_action_request_payload.g.dart b/packages/stream_chat/lib/open_api/model/restore_action_request_payload.g.dart new file mode 100644 index 0000000000..eed7d62e4d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/restore_action_request_payload.g.dart @@ -0,0 +1,17 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'restore_action_request_payload.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +RestoreActionRequestPayload _$RestoreActionRequestPayloadFromJson( + Map json, +) => RestoreActionRequestPayload( + decisionReason: json['decision_reason'] as String?, +); + +Map _$RestoreActionRequestPayloadToJson( + RestoreActionRequestPayload instance, +) => {'decision_reason': instance.decisionReason}; diff --git a/packages/stream_chat/lib/open_api/model/review_queue_item_response.dart b/packages/stream_chat/lib/open_api/model/review_queue_item_response.dart new file mode 100644 index 0000000000..aeda349353 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/review_queue_item_response.dart @@ -0,0 +1,216 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'review_queue_item_response.g.dart'; +part 'review_queue_item_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ReviewQueueItemResponse with _$ReviewQueueItemResponse { + const ReviewQueueItemResponse({ + required this.actions, + this.activity, + required this.aiTextSeverity, + this.appeal, + this.assignedTo, + required this.bans, + this.call, + this.completedAt, + this.configKey, + required this.createdAt, + this.entityCreator, + this.entityCreatorId, + required this.entityId, + required this.entityType, + required this.escalated, + this.escalatedAt, + this.escalatedBy, + this.escalationMetadata, + this.feedsV2Activity, + this.feedsV2Reaction, + this.feedsV3Activity, + this.feedsV3Comment, + required this.flags, + required this.flagsCount, + required this.id, + required this.languages, + required this.latestModeratorAction, + this.message, + this.moderationPayload, + this.reaction, + required this.recommendedAction, + this.reviewedAt, + required this.reviewedBy, + required this.severity, + required this.status, + this.teams, + required this.updatedAt, + }); + + @override + @JsonKey(name: 'actions') + final List actions; + + @override + @JsonKey(name: 'activity') + final EnrichedActivity? activity; + + @override + @JsonKey(name: 'ai_text_severity') + final String aiTextSeverity; + + @override + @JsonKey(name: 'appeal') + final AppealItemResponse? appeal; + + @override + @JsonKey(name: 'assigned_to') + final UserResponse? assignedTo; + + @override + @JsonKey(name: 'bans') + final List bans; + + @override + @JsonKey(name: 'call') + final ModerationCallResponse? call; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'completed_at') + final DateTime? completedAt; + + @override + @JsonKey(name: 'config_key') + final String? configKey; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'entity_creator') + final EntityCreatorResponse? entityCreator; + + @override + @JsonKey(name: 'entity_creator_id') + final String? entityCreatorId; + + @override + @JsonKey(name: 'entity_id') + final String entityId; + + @override + @JsonKey(name: 'entity_type') + final String entityType; + + @override + @JsonKey(name: 'escalated') + final bool escalated; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'escalated_at') + final DateTime? escalatedAt; + + @override + @JsonKey(name: 'escalated_by') + final String? escalatedBy; + + @override + @JsonKey(name: 'escalation_metadata') + final EscalationMetadata? escalationMetadata; + + @override + @JsonKey(name: 'feeds_v2_activity') + final EnrichedActivity? feedsV2Activity; + + @override + @JsonKey(name: 'feeds_v2_reaction') + final Reaction? feedsV2Reaction; + + @override + @JsonKey(name: 'feeds_v3_activity') + final FeedsV3ActivityResponse? feedsV3Activity; + + @override + @JsonKey(name: 'feeds_v3_comment') + final FeedsV3CommentResponse? feedsV3Comment; + + @override + @JsonKey(name: 'flags') + final List flags; + + @override + @JsonKey(name: 'flags_count') + final int flagsCount; + + @override + @JsonKey(name: 'id') + final String id; + + @override + @JsonKey(name: 'languages') + final List languages; + + @override + @JsonKey(name: 'latest_moderator_action') + final String latestModeratorAction; + + @override + @JsonKey(name: 'message') + final ChatMessageResponse? message; + + @override + @JsonKey(name: 'moderation_payload') + final ModerationPayloadResponse? moderationPayload; + + @override + @JsonKey(name: 'reaction') + final Reaction? reaction; + + @override + @JsonKey(name: 'recommended_action') + final String recommendedAction; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'reviewed_at') + final DateTime? reviewedAt; + + @override + @JsonKey(name: 'reviewed_by') + final String reviewedBy; + + @override + @JsonKey(name: 'severity') + final int severity; + + @override + @JsonKey(name: 'status') + final String status; + + @override + @JsonKey(name: 'teams') + final List? teams; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'updated_at') + final DateTime updatedAt; + + Map toJson() => _$ReviewQueueItemResponseToJson(this); + + static ReviewQueueItemResponse fromJson(Map json) => _$ReviewQueueItemResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/review_queue_item_response.freezed.dart b/packages/stream_chat/lib/open_api/model/review_queue_item_response.freezed.dart new file mode 100644 index 0000000000..e31e8c7278 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/review_queue_item_response.freezed.dart @@ -0,0 +1,409 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'review_queue_item_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ReviewQueueItemResponse { + List get actions; + EnrichedActivity? get activity; + String get aiTextSeverity; + AppealItemResponse? get appeal; + UserResponse? get assignedTo; + List get bans; + ModerationCallResponse? get call; + DateTime? get completedAt; + String? get configKey; + DateTime get createdAt; + EntityCreatorResponse? get entityCreator; + String? get entityCreatorId; + String get entityId; + String get entityType; + bool get escalated; + DateTime? get escalatedAt; + String? get escalatedBy; + EscalationMetadata? get escalationMetadata; + EnrichedActivity? get feedsV2Activity; + Reaction? get feedsV2Reaction; + FeedsV3ActivityResponse? get feedsV3Activity; + FeedsV3CommentResponse? get feedsV3Comment; + List get flags; + int get flagsCount; + String get id; + List get languages; + String get latestModeratorAction; + ChatMessageResponse? get message; + ModerationPayloadResponse? get moderationPayload; + Reaction? get reaction; + String get recommendedAction; + DateTime? get reviewedAt; + String get reviewedBy; + int get severity; + String get status; + List? get teams; + DateTime get updatedAt; + + /// Create a copy of ReviewQueueItemResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ReviewQueueItemResponseCopyWith get copyWith => + _$ReviewQueueItemResponseCopyWithImpl( + this as ReviewQueueItemResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ReviewQueueItemResponse && + const DeepCollectionEquality().equals(other.actions, actions) && + (identical(other.activity, activity) || other.activity == activity) && + (identical(other.aiTextSeverity, aiTextSeverity) || other.aiTextSeverity == aiTextSeverity) && + (identical(other.appeal, appeal) || other.appeal == appeal) && + (identical(other.assignedTo, assignedTo) || other.assignedTo == assignedTo) && + const DeepCollectionEquality().equals(other.bans, bans) && + (identical(other.call, call) || other.call == call) && + (identical(other.completedAt, completedAt) || other.completedAt == completedAt) && + (identical(other.configKey, configKey) || other.configKey == configKey) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.entityCreator, entityCreator) || other.entityCreator == entityCreator) && + (identical(other.entityCreatorId, entityCreatorId) || other.entityCreatorId == entityCreatorId) && + (identical(other.entityId, entityId) || other.entityId == entityId) && + (identical(other.entityType, entityType) || other.entityType == entityType) && + (identical(other.escalated, escalated) || other.escalated == escalated) && + (identical(other.escalatedAt, escalatedAt) || other.escalatedAt == escalatedAt) && + (identical(other.escalatedBy, escalatedBy) || other.escalatedBy == escalatedBy) && + (identical(other.escalationMetadata, escalationMetadata) || + other.escalationMetadata == escalationMetadata) && + (identical(other.feedsV2Activity, feedsV2Activity) || other.feedsV2Activity == feedsV2Activity) && + (identical(other.feedsV2Reaction, feedsV2Reaction) || other.feedsV2Reaction == feedsV2Reaction) && + (identical(other.feedsV3Activity, feedsV3Activity) || other.feedsV3Activity == feedsV3Activity) && + (identical(other.feedsV3Comment, feedsV3Comment) || other.feedsV3Comment == feedsV3Comment) && + const DeepCollectionEquality().equals(other.flags, flags) && + (identical(other.flagsCount, flagsCount) || other.flagsCount == flagsCount) && + (identical(other.id, id) || other.id == id) && + const DeepCollectionEquality().equals(other.languages, languages) && + (identical(other.latestModeratorAction, latestModeratorAction) || + other.latestModeratorAction == latestModeratorAction) && + (identical(other.message, message) || other.message == message) && + (identical(other.moderationPayload, moderationPayload) || other.moderationPayload == moderationPayload) && + (identical(other.reaction, reaction) || other.reaction == reaction) && + (identical(other.recommendedAction, recommendedAction) || other.recommendedAction == recommendedAction) && + (identical(other.reviewedAt, reviewedAt) || other.reviewedAt == reviewedAt) && + (identical(other.reviewedBy, reviewedBy) || other.reviewedBy == reviewedBy) && + (identical(other.severity, severity) || other.severity == severity) && + (identical(other.status, status) || other.status == status) && + const DeepCollectionEquality().equals(other.teams, teams) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)); + } + + @override + int get hashCode => Object.hashAll([ + runtimeType, + const DeepCollectionEquality().hash(actions), + activity, + aiTextSeverity, + appeal, + assignedTo, + const DeepCollectionEquality().hash(bans), + call, + completedAt, + configKey, + createdAt, + entityCreator, + entityCreatorId, + entityId, + entityType, + escalated, + escalatedAt, + escalatedBy, + escalationMetadata, + feedsV2Activity, + feedsV2Reaction, + feedsV3Activity, + feedsV3Comment, + const DeepCollectionEquality().hash(flags), + flagsCount, + id, + const DeepCollectionEquality().hash(languages), + latestModeratorAction, + message, + moderationPayload, + reaction, + recommendedAction, + reviewedAt, + reviewedBy, + severity, + status, + const DeepCollectionEquality().hash(teams), + updatedAt, + ]); + + @override + String toString() { + return 'ReviewQueueItemResponse(actions: $actions, activity: $activity, aiTextSeverity: $aiTextSeverity, appeal: $appeal, assignedTo: $assignedTo, bans: $bans, call: $call, completedAt: $completedAt, configKey: $configKey, createdAt: $createdAt, entityCreator: $entityCreator, entityCreatorId: $entityCreatorId, entityId: $entityId, entityType: $entityType, escalated: $escalated, escalatedAt: $escalatedAt, escalatedBy: $escalatedBy, escalationMetadata: $escalationMetadata, feedsV2Activity: $feedsV2Activity, feedsV2Reaction: $feedsV2Reaction, feedsV3Activity: $feedsV3Activity, feedsV3Comment: $feedsV3Comment, flags: $flags, flagsCount: $flagsCount, id: $id, languages: $languages, latestModeratorAction: $latestModeratorAction, message: $message, moderationPayload: $moderationPayload, reaction: $reaction, recommendedAction: $recommendedAction, reviewedAt: $reviewedAt, reviewedBy: $reviewedBy, severity: $severity, status: $status, teams: $teams, updatedAt: $updatedAt)'; + } +} + +/// @nodoc +abstract mixin class $ReviewQueueItemResponseCopyWith<$Res> { + factory $ReviewQueueItemResponseCopyWith( + ReviewQueueItemResponse value, + $Res Function(ReviewQueueItemResponse) _then, + ) = _$ReviewQueueItemResponseCopyWithImpl; + @useResult + $Res call({ + List actions, + EnrichedActivity? activity, + String aiTextSeverity, + AppealItemResponse? appeal, + UserResponse? assignedTo, + List bans, + ModerationCallResponse? call, + DateTime? completedAt, + String? configKey, + DateTime createdAt, + EntityCreatorResponse? entityCreator, + String? entityCreatorId, + String entityId, + String entityType, + bool escalated, + DateTime? escalatedAt, + String? escalatedBy, + EscalationMetadata? escalationMetadata, + EnrichedActivity? feedsV2Activity, + Reaction? feedsV2Reaction, + FeedsV3ActivityResponse? feedsV3Activity, + FeedsV3CommentResponse? feedsV3Comment, + List flags, + int flagsCount, + String id, + List languages, + String latestModeratorAction, + ChatMessageResponse? message, + ModerationPayloadResponse? moderationPayload, + Reaction? reaction, + String recommendedAction, + DateTime? reviewedAt, + String reviewedBy, + int severity, + String status, + List? teams, + DateTime updatedAt, + }); +} + +/// @nodoc +class _$ReviewQueueItemResponseCopyWithImpl<$Res> implements $ReviewQueueItemResponseCopyWith<$Res> { + _$ReviewQueueItemResponseCopyWithImpl(this._self, this._then); + + final ReviewQueueItemResponse _self; + final $Res Function(ReviewQueueItemResponse) _then; + + /// Create a copy of ReviewQueueItemResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? actions = null, + Object? activity = freezed, + Object? aiTextSeverity = null, + Object? appeal = freezed, + Object? assignedTo = freezed, + Object? bans = null, + Object? call = freezed, + Object? completedAt = freezed, + Object? configKey = freezed, + Object? createdAt = null, + Object? entityCreator = freezed, + Object? entityCreatorId = freezed, + Object? entityId = null, + Object? entityType = null, + Object? escalated = null, + Object? escalatedAt = freezed, + Object? escalatedBy = freezed, + Object? escalationMetadata = freezed, + Object? feedsV2Activity = freezed, + Object? feedsV2Reaction = freezed, + Object? feedsV3Activity = freezed, + Object? feedsV3Comment = freezed, + Object? flags = null, + Object? flagsCount = null, + Object? id = null, + Object? languages = null, + Object? latestModeratorAction = null, + Object? message = freezed, + Object? moderationPayload = freezed, + Object? reaction = freezed, + Object? recommendedAction = null, + Object? reviewedAt = freezed, + Object? reviewedBy = null, + Object? severity = null, + Object? status = null, + Object? teams = freezed, + Object? updatedAt = null, + }) { + return _then( + ReviewQueueItemResponse( + actions: null == actions + ? _self.actions + : actions // ignore: cast_nullable_to_non_nullable + as List, + activity: freezed == activity + ? _self.activity + : activity // ignore: cast_nullable_to_non_nullable + as EnrichedActivity?, + aiTextSeverity: null == aiTextSeverity + ? _self.aiTextSeverity + : aiTextSeverity // ignore: cast_nullable_to_non_nullable + as String, + appeal: freezed == appeal + ? _self.appeal + : appeal // ignore: cast_nullable_to_non_nullable + as AppealItemResponse?, + assignedTo: freezed == assignedTo + ? _self.assignedTo + : assignedTo // ignore: cast_nullable_to_non_nullable + as UserResponse?, + bans: null == bans + ? _self.bans + : bans // ignore: cast_nullable_to_non_nullable + as List, + call: freezed == call + ? _self.call + : call // ignore: cast_nullable_to_non_nullable + as ModerationCallResponse?, + completedAt: freezed == completedAt + ? _self.completedAt + : completedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + configKey: freezed == configKey + ? _self.configKey + : configKey // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + entityCreator: freezed == entityCreator + ? _self.entityCreator + : entityCreator // ignore: cast_nullable_to_non_nullable + as EntityCreatorResponse?, + entityCreatorId: freezed == entityCreatorId + ? _self.entityCreatorId + : entityCreatorId // ignore: cast_nullable_to_non_nullable + as String?, + entityId: null == entityId + ? _self.entityId + : entityId // ignore: cast_nullable_to_non_nullable + as String, + entityType: null == entityType + ? _self.entityType + : entityType // ignore: cast_nullable_to_non_nullable + as String, + escalated: null == escalated + ? _self.escalated + : escalated // ignore: cast_nullable_to_non_nullable + as bool, + escalatedAt: freezed == escalatedAt + ? _self.escalatedAt + : escalatedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + escalatedBy: freezed == escalatedBy + ? _self.escalatedBy + : escalatedBy // ignore: cast_nullable_to_non_nullable + as String?, + escalationMetadata: freezed == escalationMetadata + ? _self.escalationMetadata + : escalationMetadata // ignore: cast_nullable_to_non_nullable + as EscalationMetadata?, + feedsV2Activity: freezed == feedsV2Activity + ? _self.feedsV2Activity + : feedsV2Activity // ignore: cast_nullable_to_non_nullable + as EnrichedActivity?, + feedsV2Reaction: freezed == feedsV2Reaction + ? _self.feedsV2Reaction + : feedsV2Reaction // ignore: cast_nullable_to_non_nullable + as Reaction?, + feedsV3Activity: freezed == feedsV3Activity + ? _self.feedsV3Activity + : feedsV3Activity // ignore: cast_nullable_to_non_nullable + as FeedsV3ActivityResponse?, + feedsV3Comment: freezed == feedsV3Comment + ? _self.feedsV3Comment + : feedsV3Comment // ignore: cast_nullable_to_non_nullable + as FeedsV3CommentResponse?, + flags: null == flags + ? _self.flags + : flags // ignore: cast_nullable_to_non_nullable + as List, + flagsCount: null == flagsCount + ? _self.flagsCount + : flagsCount // ignore: cast_nullable_to_non_nullable + as int, + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + languages: null == languages + ? _self.languages + : languages // ignore: cast_nullable_to_non_nullable + as List, + latestModeratorAction: null == latestModeratorAction + ? _self.latestModeratorAction + : latestModeratorAction // ignore: cast_nullable_to_non_nullable + as String, + message: freezed == message + ? _self.message + : message // ignore: cast_nullable_to_non_nullable + as ChatMessageResponse?, + moderationPayload: freezed == moderationPayload + ? _self.moderationPayload + : moderationPayload // ignore: cast_nullable_to_non_nullable + as ModerationPayloadResponse?, + reaction: freezed == reaction + ? _self.reaction + : reaction // ignore: cast_nullable_to_non_nullable + as Reaction?, + recommendedAction: null == recommendedAction + ? _self.recommendedAction + : recommendedAction // ignore: cast_nullable_to_non_nullable + as String, + reviewedAt: freezed == reviewedAt + ? _self.reviewedAt + : reviewedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + reviewedBy: null == reviewedBy + ? _self.reviewedBy + : reviewedBy // ignore: cast_nullable_to_non_nullable + as String, + severity: null == severity + ? _self.severity + : severity // ignore: cast_nullable_to_non_nullable + as int, + status: null == status + ? _self.status + : status // ignore: cast_nullable_to_non_nullable + as String, + teams: freezed == teams + ? _self.teams + : teams // ignore: cast_nullable_to_non_nullable + as List?, + updatedAt: null == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/review_queue_item_response.g.dart b/packages/stream_chat/lib/open_api/model/review_queue_item_response.g.dart new file mode 100644 index 0000000000..b8a8f19dba --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/review_queue_item_response.g.dart @@ -0,0 +1,153 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'review_queue_item_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ReviewQueueItemResponse _$ReviewQueueItemResponseFromJson( + Map json, +) => ReviewQueueItemResponse( + actions: (json['actions'] as List) + .map((e) => ActionLogResponse.fromJson(e as Map)) + .toList(), + activity: json['activity'] == null ? null : EnrichedActivity.fromJson(json['activity'] as Map), + aiTextSeverity: json['ai_text_severity'] as String, + appeal: json['appeal'] == null ? null : AppealItemResponse.fromJson(json['appeal'] as Map), + assignedTo: json['assigned_to'] == null ? null : UserResponse.fromJson(json['assigned_to'] as Map), + bans: (json['bans'] as List).map((e) => BanInfoResponse.fromJson(e as Map)).toList(), + call: json['call'] == null ? null : ModerationCallResponse.fromJson(json['call'] as Map), + completedAt: _$JsonConverterFromJson( + json['completed_at'], + const StreamDateTimeConverter().fromJson, + ), + configKey: json['config_key'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + entityCreator: json['entity_creator'] == null + ? null + : EntityCreatorResponse.fromJson( + json['entity_creator'] as Map, + ), + entityCreatorId: json['entity_creator_id'] as String?, + entityId: json['entity_id'] as String, + entityType: json['entity_type'] as String, + escalated: json['escalated'] as bool, + escalatedAt: _$JsonConverterFromJson( + json['escalated_at'], + const StreamDateTimeConverter().fromJson, + ), + escalatedBy: json['escalated_by'] as String?, + escalationMetadata: json['escalation_metadata'] == null + ? null + : EscalationMetadata.fromJson( + json['escalation_metadata'] as Map, + ), + feedsV2Activity: json['feeds_v2_activity'] == null + ? null + : EnrichedActivity.fromJson( + json['feeds_v2_activity'] as Map, + ), + feedsV2Reaction: json['feeds_v2_reaction'] == null + ? null + : Reaction.fromJson(json['feeds_v2_reaction'] as Map), + feedsV3Activity: json['feeds_v3_activity'] == null + ? null + : FeedsV3ActivityResponse.fromJson( + json['feeds_v3_activity'] as Map, + ), + feedsV3Comment: json['feeds_v3_comment'] == null + ? null + : FeedsV3CommentResponse.fromJson( + json['feeds_v3_comment'] as Map, + ), + flags: (json['flags'] as List) + .map((e) => ModerationFlagResponse.fromJson(e as Map)) + .toList(), + flagsCount: (json['flags_count'] as num).toInt(), + id: json['id'] as String, + languages: (json['languages'] as List).map((e) => e as String).toList(), + latestModeratorAction: json['latest_moderator_action'] as String, + message: json['message'] == null ? null : ChatMessageResponse.fromJson(json['message'] as Map), + moderationPayload: json['moderation_payload'] == null + ? null + : ModerationPayloadResponse.fromJson( + json['moderation_payload'] as Map, + ), + reaction: json['reaction'] == null ? null : Reaction.fromJson(json['reaction'] as Map), + recommendedAction: json['recommended_action'] as String, + reviewedAt: _$JsonConverterFromJson( + json['reviewed_at'], + const StreamDateTimeConverter().fromJson, + ), + reviewedBy: json['reviewed_by'] as String, + severity: (json['severity'] as num).toInt(), + status: json['status'] as String, + teams: (json['teams'] as List?)?.map((e) => e as String).toList(), + updatedAt: const StreamDateTimeConverter().fromJson( + json['updated_at'] as Object, + ), +); + +Map _$ReviewQueueItemResponseToJson( + ReviewQueueItemResponse instance, +) => { + 'actions': instance.actions.map((e) => e.toJson()).toList(), + 'activity': instance.activity?.toJson(), + 'ai_text_severity': instance.aiTextSeverity, + 'appeal': instance.appeal?.toJson(), + 'assigned_to': instance.assignedTo?.toJson(), + 'bans': instance.bans.map((e) => e.toJson()).toList(), + 'call': instance.call?.toJson(), + 'completed_at': _$JsonConverterToJson( + instance.completedAt, + const StreamDateTimeConverter().toJson, + ), + 'config_key': instance.configKey, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'entity_creator': instance.entityCreator?.toJson(), + 'entity_creator_id': instance.entityCreatorId, + 'entity_id': instance.entityId, + 'entity_type': instance.entityType, + 'escalated': instance.escalated, + 'escalated_at': _$JsonConverterToJson( + instance.escalatedAt, + const StreamDateTimeConverter().toJson, + ), + 'escalated_by': instance.escalatedBy, + 'escalation_metadata': instance.escalationMetadata?.toJson(), + 'feeds_v2_activity': instance.feedsV2Activity?.toJson(), + 'feeds_v2_reaction': instance.feedsV2Reaction?.toJson(), + 'feeds_v3_activity': instance.feedsV3Activity?.toJson(), + 'feeds_v3_comment': instance.feedsV3Comment?.toJson(), + 'flags': instance.flags.map((e) => e.toJson()).toList(), + 'flags_count': instance.flagsCount, + 'id': instance.id, + 'languages': instance.languages, + 'latest_moderator_action': instance.latestModeratorAction, + 'message': instance.message?.toJson(), + 'moderation_payload': instance.moderationPayload?.toJson(), + 'reaction': instance.reaction?.toJson(), + 'recommended_action': instance.recommendedAction, + 'reviewed_at': _$JsonConverterToJson( + instance.reviewedAt, + const StreamDateTimeConverter().toJson, + ), + 'reviewed_by': instance.reviewedBy, + 'severity': instance.severity, + 'status': instance.status, + 'teams': instance.teams, + 'updated_at': const StreamDateTimeConverter().toJson(instance.updatedAt), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/role.dart b/packages/stream_chat/lib/open_api/model/role.dart new file mode 100644 index 0000000000..9ce34e5f72 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/role.dart @@ -0,0 +1,53 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'role.g.dart'; +part 'role.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class Role with _$Role { + const Role({ + required this.createdAt, + required this.custom, + required this.name, + required this.scopes, + required this.updatedAt, + }); + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final bool custom; + + @override + @JsonKey(name: 'name') + final String name; + + @override + @JsonKey(name: 'scopes') + final List scopes; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'updated_at') + final DateTime updatedAt; + + Map toJson() => _$RoleToJson(this); + + static Role fromJson(Map json) => _$RoleFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/role.freezed.dart b/packages/stream_chat/lib/open_api/model/role.freezed.dart new file mode 100644 index 0000000000..b1dfab04f5 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/role.freezed.dart @@ -0,0 +1,112 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'role.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$Role { + DateTime get createdAt; + bool get custom; + String get name; + List get scopes; + DateTime get updatedAt; + + /// Create a copy of Role + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $RoleCopyWith get copyWith => _$RoleCopyWithImpl(this as Role, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is Role && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.custom, custom) || other.custom == custom) && + (identical(other.name, name) || other.name == name) && + const DeepCollectionEquality().equals(other.scopes, scopes) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + createdAt, + custom, + name, + const DeepCollectionEquality().hash(scopes), + updatedAt, + ); + + @override + String toString() { + return 'Role(createdAt: $createdAt, custom: $custom, name: $name, scopes: $scopes, updatedAt: $updatedAt)'; + } +} + +/// @nodoc +abstract mixin class $RoleCopyWith<$Res> { + factory $RoleCopyWith(Role value, $Res Function(Role) _then) = _$RoleCopyWithImpl; + @useResult + $Res call({ + DateTime createdAt, + bool custom, + String name, + List scopes, + DateTime updatedAt, + }); +} + +/// @nodoc +class _$RoleCopyWithImpl<$Res> implements $RoleCopyWith<$Res> { + _$RoleCopyWithImpl(this._self, this._then); + + final Role _self; + final $Res Function(Role) _then; + + /// Create a copy of Role + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? createdAt = null, + Object? custom = null, + Object? name = null, + Object? scopes = null, + Object? updatedAt = null, + }) { + return _then( + Role( + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as bool, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + scopes: null == scopes + ? _self.scopes + : scopes // ignore: cast_nullable_to_non_nullable + as List, + updatedAt: null == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/role.g.dart b/packages/stream_chat/lib/open_api/model/role.g.dart new file mode 100644 index 0000000000..2c65e72efe --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/role.g.dart @@ -0,0 +1,27 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'role.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +Role _$RoleFromJson(Map json) => Role( + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as bool, + name: json['name'] as String, + scopes: (json['scopes'] as List).map((e) => e as String).toList(), + updatedAt: const StreamDateTimeConverter().fromJson( + json['updated_at'] as Object, + ), +); + +Map _$RoleToJson(Role instance) => { + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'name': instance.name, + 'scopes': instance.scopes, + 'updated_at': const StreamDateTimeConverter().toJson(instance.updatedAt), +}; diff --git a/packages/stream_chat/lib/open_api/model/rule_builder_action.dart b/packages/stream_chat/lib/open_api/model/rule_builder_action.dart new file mode 100644 index 0000000000..2490623bec --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/rule_builder_action.dart @@ -0,0 +1,80 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'rule_builder_action.g.dart'; +part 'rule_builder_action.freezed.dart'; + +extension type const RuleBuilderActionType._(String _) implements String { + static const banUser = RuleBuilderActionType._('ban_user'); + static const blockContent = RuleBuilderActionType._('block_content'); + static const blur = RuleBuilderActionType._('blur'); + static const bounceContent = RuleBuilderActionType._('bounce_content'); + static const bounceFlagContent = RuleBuilderActionType._('bounce_flag_content'); + static const bounceRemoveContent = RuleBuilderActionType._('bounce_remove_content'); + static const callBlur = RuleBuilderActionType._('call_blur'); + static const callWarning = RuleBuilderActionType._('call_warning'); + static const endCall = RuleBuilderActionType._('end_call'); + static const flagContent = RuleBuilderActionType._('flag_content'); + static const flagUser = RuleBuilderActionType._('flag_user'); + static const kickUser = RuleBuilderActionType._('kick_user'); + static const muteAudio = RuleBuilderActionType._('mute_audio'); + static const muteVideo = RuleBuilderActionType._('mute_video'); + static const shadowContent = RuleBuilderActionType._('shadow_content'); + static const warning = RuleBuilderActionType._('warning'); + static const webhookOnly = RuleBuilderActionType._('webhook_only'); + + factory RuleBuilderActionType.fromJson(String json) => RuleBuilderActionType._(json); + + String toJson() => this; +} + +@freezed +@immutable +@JsonSerializable() +class RuleBuilderAction with _$RuleBuilderAction { + const RuleBuilderAction({ + this.banOptions, + this.callOptions, + this.flagUserOptions, + this.reason, + this.skipInbox, + this.type, + }); + + @override + @JsonKey(name: 'ban_options') + final BanOptions? banOptions; + + @override + @JsonKey(name: 'call_options') + final CallActionOptions? callOptions; + + @override + @JsonKey(name: 'flag_user_options') + final FlagUserOptions? flagUserOptions; + + @override + @JsonKey(name: 'reason') + final String? reason; + + @override + @JsonKey(name: 'skip_inbox') + final bool? skipInbox; + + @override + @JsonKey(name: 'type') + final RuleBuilderActionType? type; + + Map toJson() => _$RuleBuilderActionToJson(this); + + static RuleBuilderAction fromJson(Map json) => _$RuleBuilderActionFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/rule_builder_action.freezed.dart b/packages/stream_chat/lib/open_api/model/rule_builder_action.freezed.dart new file mode 100644 index 0000000000..d96fecfb9b --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/rule_builder_action.freezed.dart @@ -0,0 +1,127 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'rule_builder_action.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$RuleBuilderAction { + BanOptions? get banOptions; + CallActionOptions? get callOptions; + FlagUserOptions? get flagUserOptions; + String? get reason; + bool? get skipInbox; + RuleBuilderActionType? get type; + + /// Create a copy of RuleBuilderAction + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $RuleBuilderActionCopyWith get copyWith => _$RuleBuilderActionCopyWithImpl( + this as RuleBuilderAction, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is RuleBuilderAction && + (identical(other.banOptions, banOptions) || other.banOptions == banOptions) && + (identical(other.callOptions, callOptions) || other.callOptions == callOptions) && + (identical(other.flagUserOptions, flagUserOptions) || other.flagUserOptions == flagUserOptions) && + (identical(other.reason, reason) || other.reason == reason) && + (identical(other.skipInbox, skipInbox) || other.skipInbox == skipInbox) && + (identical(other.type, type) || other.type == type)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + banOptions, + callOptions, + flagUserOptions, + reason, + skipInbox, + type, + ); + + @override + String toString() { + return 'RuleBuilderAction(banOptions: $banOptions, callOptions: $callOptions, flagUserOptions: $flagUserOptions, reason: $reason, skipInbox: $skipInbox, type: $type)'; + } +} + +/// @nodoc +abstract mixin class $RuleBuilderActionCopyWith<$Res> { + factory $RuleBuilderActionCopyWith( + RuleBuilderAction value, + $Res Function(RuleBuilderAction) _then, + ) = _$RuleBuilderActionCopyWithImpl; + @useResult + $Res call({ + BanOptions? banOptions, + CallActionOptions? callOptions, + FlagUserOptions? flagUserOptions, + String? reason, + bool? skipInbox, + RuleBuilderActionType? type, + }); +} + +/// @nodoc +class _$RuleBuilderActionCopyWithImpl<$Res> implements $RuleBuilderActionCopyWith<$Res> { + _$RuleBuilderActionCopyWithImpl(this._self, this._then); + + final RuleBuilderAction _self; + final $Res Function(RuleBuilderAction) _then; + + /// Create a copy of RuleBuilderAction + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? banOptions = freezed, + Object? callOptions = freezed, + Object? flagUserOptions = freezed, + Object? reason = freezed, + Object? skipInbox = freezed, + Object? type = freezed, + }) { + return _then( + RuleBuilderAction( + banOptions: freezed == banOptions + ? _self.banOptions + : banOptions // ignore: cast_nullable_to_non_nullable + as BanOptions?, + callOptions: freezed == callOptions + ? _self.callOptions + : callOptions // ignore: cast_nullable_to_non_nullable + as CallActionOptions?, + flagUserOptions: freezed == flagUserOptions + ? _self.flagUserOptions + : flagUserOptions // ignore: cast_nullable_to_non_nullable + as FlagUserOptions?, + reason: freezed == reason + ? _self.reason + : reason // ignore: cast_nullable_to_non_nullable + as String?, + skipInbox: freezed == skipInbox + ? _self.skipInbox + : skipInbox // ignore: cast_nullable_to_non_nullable + as bool?, + type: freezed == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as RuleBuilderActionType?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/rule_builder_action.g.dart b/packages/stream_chat/lib/open_api/model/rule_builder_action.g.dart new file mode 100644 index 0000000000..ff629c4ad8 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/rule_builder_action.g.dart @@ -0,0 +1,33 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'rule_builder_action.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +RuleBuilderAction _$RuleBuilderActionFromJson(Map json) => RuleBuilderAction( + banOptions: json['ban_options'] == null ? null : BanOptions.fromJson(json['ban_options'] as Map), + callOptions: json['call_options'] == null + ? null + : CallActionOptions.fromJson( + json['call_options'] as Map, + ), + flagUserOptions: json['flag_user_options'] == null + ? null + : FlagUserOptions.fromJson( + json['flag_user_options'] as Map, + ), + reason: json['reason'] as String?, + skipInbox: json['skip_inbox'] as bool?, + type: json['type'] == null ? null : RuleBuilderActionType.fromJson(json['type'] as String), +); + +Map _$RuleBuilderActionToJson(RuleBuilderAction instance) => { + 'ban_options': instance.banOptions?.toJson(), + 'call_options': instance.callOptions?.toJson(), + 'flag_user_options': instance.flagUserOptions?.toJson(), + 'reason': instance.reason, + 'skip_inbox': instance.skipInbox, + 'type': instance.type?.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/rule_builder_condition.dart b/packages/stream_chat/lib/open_api/model/rule_builder_condition.dart new file mode 100644 index 0000000000..ca13ec771e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/rule_builder_condition.dart @@ -0,0 +1,176 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'rule_builder_condition.g.dart'; +part 'rule_builder_condition.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class RuleBuilderCondition with _$RuleBuilderCondition { + const RuleBuilderCondition({ + this.callCustomPropertyParams, + this.callTypeRuleParams, + this.callViolationCountParams, + this.channelMessageCountRuleParams, + this.closedCaptionRuleParams, + this.confidence, + this.contentCountRuleParams, + this.contentCustomPropertyCountParams, + this.contentCustomPropertyParams, + this.contentFlagCountRuleParams, + this.floodIdenticalParams, + this.floodSimilarParams, + this.imageContentParams, + this.imageRuleParams, + this.ipContentCountRuleParams, + this.ipFlagCountRuleParams, + this.keyframeOcrRuleParams, + this.keyframeRuleParams, + this.ocrContentParams, + this.textContentParams, + this.textRuleParams, + this.type, + this.userCreatedWithinParams, + this.userCustomPropertyParams, + this.userFlagCountRuleParams, + this.userIdenticalContentCountParams, + this.userRoleParams, + this.userRuleParams, + this.videoContentParams, + this.videoRuleParams, + }); + + @override + @JsonKey(name: 'call_custom_property_params') + final CallCustomPropertyParameters? callCustomPropertyParams; + + @override + @JsonKey(name: 'call_type_rule_params') + final CallTypeRuleParameters? callTypeRuleParams; + + @override + @JsonKey(name: 'call_violation_count_params') + final CallViolationCountParameters? callViolationCountParams; + + @override + @JsonKey(name: 'channel_message_count_rule_params') + final ChannelMessageCountRuleParameters? channelMessageCountRuleParams; + + @override + @JsonKey(name: 'closed_caption_rule_params') + final ClosedCaptionRuleParameters? closedCaptionRuleParams; + + @override + @JsonKey(name: 'confidence') + final double? confidence; + + @override + @JsonKey(name: 'content_count_rule_params') + final ContentCountRuleParameters? contentCountRuleParams; + + @override + @JsonKey(name: 'content_custom_property_count_params') + final ContentCustomPropertyCountParameters? contentCustomPropertyCountParams; + + @override + @JsonKey(name: 'content_custom_property_params') + final ContentCustomPropertyParameters? contentCustomPropertyParams; + + @override + @JsonKey(name: 'content_flag_count_rule_params') + final FlagCountRuleParameters? contentFlagCountRuleParams; + + @override + @JsonKey(name: 'flood_identical_params') + final FloodIdenticalRuleParameters? floodIdenticalParams; + + @override + @JsonKey(name: 'flood_similar_params') + final FloodSimilarRuleParameters? floodSimilarParams; + + @override + @JsonKey(name: 'image_content_params') + final ImageContentParameters? imageContentParams; + + @override + @JsonKey(name: 'image_rule_params') + final ImageRuleParameters? imageRuleParams; + + @override + @JsonKey(name: 'ip_content_count_rule_params') + final IPContentCountRuleParameters? ipContentCountRuleParams; + + @override + @JsonKey(name: 'ip_flag_count_rule_params') + final IPFlagCountRuleParameters? ipFlagCountRuleParams; + + @override + @JsonKey(name: 'keyframe_ocr_rule_params') + final KeyframeOCRRuleParameters? keyframeOcrRuleParams; + + @override + @JsonKey(name: 'keyframe_rule_params') + final KeyframeRuleParameters? keyframeRuleParams; + + @override + @JsonKey(name: 'ocr_content_params') + final OCRContentParameters? ocrContentParams; + + @override + @JsonKey(name: 'text_content_params') + final TextContentParameters? textContentParams; + + @override + @JsonKey(name: 'text_rule_params') + final TextRuleParameters? textRuleParams; + + @override + @JsonKey(name: 'type') + final String? type; + + @override + @JsonKey(name: 'user_created_within_params') + final UserCreatedWithinParameters? userCreatedWithinParams; + + @override + @JsonKey(name: 'user_custom_property_params') + final UserCustomPropertyParameters? userCustomPropertyParams; + + @override + @JsonKey(name: 'user_flag_count_rule_params') + final FlagCountRuleParameters? userFlagCountRuleParams; + + @override + @JsonKey(name: 'user_identical_content_count_params') + final UserIdenticalContentCountParameters? userIdenticalContentCountParams; + + @override + @JsonKey(name: 'user_role_params') + final UserRoleParameters? userRoleParams; + + @override + @JsonKey(name: 'user_rule_params') + final UserRuleParameters? userRuleParams; + + @override + @JsonKey(name: 'video_content_params') + final VideoContentParameters? videoContentParams; + + @override + @JsonKey(name: 'video_rule_params') + final VideoRuleParameters? videoRuleParams; + + Map toJson() => _$RuleBuilderConditionToJson(this); + + static RuleBuilderCondition fromJson(Map json) => _$RuleBuilderConditionFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/rule_builder_condition.freezed.dart b/packages/stream_chat/lib/open_api/model/rule_builder_condition.freezed.dart new file mode 100644 index 0000000000..b0a5c6b0d9 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/rule_builder_condition.freezed.dart @@ -0,0 +1,401 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'rule_builder_condition.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$RuleBuilderCondition { + CallCustomPropertyParameters? get callCustomPropertyParams; + CallTypeRuleParameters? get callTypeRuleParams; + CallViolationCountParameters? get callViolationCountParams; + ChannelMessageCountRuleParameters? get channelMessageCountRuleParams; + ClosedCaptionRuleParameters? get closedCaptionRuleParams; + double? get confidence; + ContentCountRuleParameters? get contentCountRuleParams; + ContentCustomPropertyCountParameters? get contentCustomPropertyCountParams; + ContentCustomPropertyParameters? get contentCustomPropertyParams; + FlagCountRuleParameters? get contentFlagCountRuleParams; + FloodIdenticalRuleParameters? get floodIdenticalParams; + FloodSimilarRuleParameters? get floodSimilarParams; + ImageContentParameters? get imageContentParams; + ImageRuleParameters? get imageRuleParams; + IPContentCountRuleParameters? get ipContentCountRuleParams; + IPFlagCountRuleParameters? get ipFlagCountRuleParams; + KeyframeOCRRuleParameters? get keyframeOcrRuleParams; + KeyframeRuleParameters? get keyframeRuleParams; + OCRContentParameters? get ocrContentParams; + TextContentParameters? get textContentParams; + TextRuleParameters? get textRuleParams; + String? get type; + UserCreatedWithinParameters? get userCreatedWithinParams; + UserCustomPropertyParameters? get userCustomPropertyParams; + FlagCountRuleParameters? get userFlagCountRuleParams; + UserIdenticalContentCountParameters? get userIdenticalContentCountParams; + UserRoleParameters? get userRoleParams; + UserRuleParameters? get userRuleParams; + VideoContentParameters? get videoContentParams; + VideoRuleParameters? get videoRuleParams; + + /// Create a copy of RuleBuilderCondition + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $RuleBuilderConditionCopyWith get copyWith => + _$RuleBuilderConditionCopyWithImpl( + this as RuleBuilderCondition, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is RuleBuilderCondition && + (identical( + other.callCustomPropertyParams, + callCustomPropertyParams, + ) || + other.callCustomPropertyParams == callCustomPropertyParams) && + (identical(other.callTypeRuleParams, callTypeRuleParams) || + other.callTypeRuleParams == callTypeRuleParams) && + (identical( + other.callViolationCountParams, + callViolationCountParams, + ) || + other.callViolationCountParams == callViolationCountParams) && + (identical( + other.channelMessageCountRuleParams, + channelMessageCountRuleParams, + ) || + other.channelMessageCountRuleParams == channelMessageCountRuleParams) && + (identical( + other.closedCaptionRuleParams, + closedCaptionRuleParams, + ) || + other.closedCaptionRuleParams == closedCaptionRuleParams) && + (identical(other.confidence, confidence) || other.confidence == confidence) && + (identical(other.contentCountRuleParams, contentCountRuleParams) || + other.contentCountRuleParams == contentCountRuleParams) && + (identical( + other.contentCustomPropertyCountParams, + contentCustomPropertyCountParams, + ) || + other.contentCustomPropertyCountParams == contentCustomPropertyCountParams) && + (identical( + other.contentCustomPropertyParams, + contentCustomPropertyParams, + ) || + other.contentCustomPropertyParams == contentCustomPropertyParams) && + (identical( + other.contentFlagCountRuleParams, + contentFlagCountRuleParams, + ) || + other.contentFlagCountRuleParams == contentFlagCountRuleParams) && + (identical(other.floodIdenticalParams, floodIdenticalParams) || + other.floodIdenticalParams == floodIdenticalParams) && + (identical(other.floodSimilarParams, floodSimilarParams) || + other.floodSimilarParams == floodSimilarParams) && + (identical(other.imageContentParams, imageContentParams) || + other.imageContentParams == imageContentParams) && + (identical(other.imageRuleParams, imageRuleParams) || other.imageRuleParams == imageRuleParams) && + (identical( + other.ipContentCountRuleParams, + ipContentCountRuleParams, + ) || + other.ipContentCountRuleParams == ipContentCountRuleParams) && + (identical(other.ipFlagCountRuleParams, ipFlagCountRuleParams) || + other.ipFlagCountRuleParams == ipFlagCountRuleParams) && + (identical(other.keyframeOcrRuleParams, keyframeOcrRuleParams) || + other.keyframeOcrRuleParams == keyframeOcrRuleParams) && + (identical(other.keyframeRuleParams, keyframeRuleParams) || + other.keyframeRuleParams == keyframeRuleParams) && + (identical(other.ocrContentParams, ocrContentParams) || other.ocrContentParams == ocrContentParams) && + (identical(other.textContentParams, textContentParams) || other.textContentParams == textContentParams) && + (identical(other.textRuleParams, textRuleParams) || other.textRuleParams == textRuleParams) && + (identical(other.type, type) || other.type == type) && + (identical( + other.userCreatedWithinParams, + userCreatedWithinParams, + ) || + other.userCreatedWithinParams == userCreatedWithinParams) && + (identical( + other.userCustomPropertyParams, + userCustomPropertyParams, + ) || + other.userCustomPropertyParams == userCustomPropertyParams) && + (identical( + other.userFlagCountRuleParams, + userFlagCountRuleParams, + ) || + other.userFlagCountRuleParams == userFlagCountRuleParams) && + (identical( + other.userIdenticalContentCountParams, + userIdenticalContentCountParams, + ) || + other.userIdenticalContentCountParams == userIdenticalContentCountParams) && + (identical(other.userRoleParams, userRoleParams) || other.userRoleParams == userRoleParams) && + (identical(other.userRuleParams, userRuleParams) || other.userRuleParams == userRuleParams) && + (identical(other.videoContentParams, videoContentParams) || + other.videoContentParams == videoContentParams) && + (identical(other.videoRuleParams, videoRuleParams) || other.videoRuleParams == videoRuleParams)); + } + + @override + int get hashCode => Object.hashAll([ + runtimeType, + callCustomPropertyParams, + callTypeRuleParams, + callViolationCountParams, + channelMessageCountRuleParams, + closedCaptionRuleParams, + confidence, + contentCountRuleParams, + contentCustomPropertyCountParams, + contentCustomPropertyParams, + contentFlagCountRuleParams, + floodIdenticalParams, + floodSimilarParams, + imageContentParams, + imageRuleParams, + ipContentCountRuleParams, + ipFlagCountRuleParams, + keyframeOcrRuleParams, + keyframeRuleParams, + ocrContentParams, + textContentParams, + textRuleParams, + type, + userCreatedWithinParams, + userCustomPropertyParams, + userFlagCountRuleParams, + userIdenticalContentCountParams, + userRoleParams, + userRuleParams, + videoContentParams, + videoRuleParams, + ]); + + @override + String toString() { + return 'RuleBuilderCondition(callCustomPropertyParams: $callCustomPropertyParams, callTypeRuleParams: $callTypeRuleParams, callViolationCountParams: $callViolationCountParams, channelMessageCountRuleParams: $channelMessageCountRuleParams, closedCaptionRuleParams: $closedCaptionRuleParams, confidence: $confidence, contentCountRuleParams: $contentCountRuleParams, contentCustomPropertyCountParams: $contentCustomPropertyCountParams, contentCustomPropertyParams: $contentCustomPropertyParams, contentFlagCountRuleParams: $contentFlagCountRuleParams, floodIdenticalParams: $floodIdenticalParams, floodSimilarParams: $floodSimilarParams, imageContentParams: $imageContentParams, imageRuleParams: $imageRuleParams, ipContentCountRuleParams: $ipContentCountRuleParams, ipFlagCountRuleParams: $ipFlagCountRuleParams, keyframeOcrRuleParams: $keyframeOcrRuleParams, keyframeRuleParams: $keyframeRuleParams, ocrContentParams: $ocrContentParams, textContentParams: $textContentParams, textRuleParams: $textRuleParams, type: $type, userCreatedWithinParams: $userCreatedWithinParams, userCustomPropertyParams: $userCustomPropertyParams, userFlagCountRuleParams: $userFlagCountRuleParams, userIdenticalContentCountParams: $userIdenticalContentCountParams, userRoleParams: $userRoleParams, userRuleParams: $userRuleParams, videoContentParams: $videoContentParams, videoRuleParams: $videoRuleParams)'; + } +} + +/// @nodoc +abstract mixin class $RuleBuilderConditionCopyWith<$Res> { + factory $RuleBuilderConditionCopyWith( + RuleBuilderCondition value, + $Res Function(RuleBuilderCondition) _then, + ) = _$RuleBuilderConditionCopyWithImpl; + @useResult + $Res call({ + CallCustomPropertyParameters? callCustomPropertyParams, + CallTypeRuleParameters? callTypeRuleParams, + CallViolationCountParameters? callViolationCountParams, + ChannelMessageCountRuleParameters? channelMessageCountRuleParams, + ClosedCaptionRuleParameters? closedCaptionRuleParams, + double? confidence, + ContentCountRuleParameters? contentCountRuleParams, + ContentCustomPropertyCountParameters? contentCustomPropertyCountParams, + ContentCustomPropertyParameters? contentCustomPropertyParams, + FlagCountRuleParameters? contentFlagCountRuleParams, + FloodIdenticalRuleParameters? floodIdenticalParams, + FloodSimilarRuleParameters? floodSimilarParams, + ImageContentParameters? imageContentParams, + ImageRuleParameters? imageRuleParams, + IPContentCountRuleParameters? ipContentCountRuleParams, + IPFlagCountRuleParameters? ipFlagCountRuleParams, + KeyframeOCRRuleParameters? keyframeOcrRuleParams, + KeyframeRuleParameters? keyframeRuleParams, + OCRContentParameters? ocrContentParams, + TextContentParameters? textContentParams, + TextRuleParameters? textRuleParams, + String? type, + UserCreatedWithinParameters? userCreatedWithinParams, + UserCustomPropertyParameters? userCustomPropertyParams, + FlagCountRuleParameters? userFlagCountRuleParams, + UserIdenticalContentCountParameters? userIdenticalContentCountParams, + UserRoleParameters? userRoleParams, + UserRuleParameters? userRuleParams, + VideoContentParameters? videoContentParams, + VideoRuleParameters? videoRuleParams, + }); +} + +/// @nodoc +class _$RuleBuilderConditionCopyWithImpl<$Res> implements $RuleBuilderConditionCopyWith<$Res> { + _$RuleBuilderConditionCopyWithImpl(this._self, this._then); + + final RuleBuilderCondition _self; + final $Res Function(RuleBuilderCondition) _then; + + /// Create a copy of RuleBuilderCondition + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? callCustomPropertyParams = freezed, + Object? callTypeRuleParams = freezed, + Object? callViolationCountParams = freezed, + Object? channelMessageCountRuleParams = freezed, + Object? closedCaptionRuleParams = freezed, + Object? confidence = freezed, + Object? contentCountRuleParams = freezed, + Object? contentCustomPropertyCountParams = freezed, + Object? contentCustomPropertyParams = freezed, + Object? contentFlagCountRuleParams = freezed, + Object? floodIdenticalParams = freezed, + Object? floodSimilarParams = freezed, + Object? imageContentParams = freezed, + Object? imageRuleParams = freezed, + Object? ipContentCountRuleParams = freezed, + Object? ipFlagCountRuleParams = freezed, + Object? keyframeOcrRuleParams = freezed, + Object? keyframeRuleParams = freezed, + Object? ocrContentParams = freezed, + Object? textContentParams = freezed, + Object? textRuleParams = freezed, + Object? type = freezed, + Object? userCreatedWithinParams = freezed, + Object? userCustomPropertyParams = freezed, + Object? userFlagCountRuleParams = freezed, + Object? userIdenticalContentCountParams = freezed, + Object? userRoleParams = freezed, + Object? userRuleParams = freezed, + Object? videoContentParams = freezed, + Object? videoRuleParams = freezed, + }) { + return _then( + RuleBuilderCondition( + callCustomPropertyParams: freezed == callCustomPropertyParams + ? _self.callCustomPropertyParams + : callCustomPropertyParams // ignore: cast_nullable_to_non_nullable + as CallCustomPropertyParameters?, + callTypeRuleParams: freezed == callTypeRuleParams + ? _self.callTypeRuleParams + : callTypeRuleParams // ignore: cast_nullable_to_non_nullable + as CallTypeRuleParameters?, + callViolationCountParams: freezed == callViolationCountParams + ? _self.callViolationCountParams + : callViolationCountParams // ignore: cast_nullable_to_non_nullable + as CallViolationCountParameters?, + channelMessageCountRuleParams: freezed == channelMessageCountRuleParams + ? _self.channelMessageCountRuleParams + : channelMessageCountRuleParams // ignore: cast_nullable_to_non_nullable + as ChannelMessageCountRuleParameters?, + closedCaptionRuleParams: freezed == closedCaptionRuleParams + ? _self.closedCaptionRuleParams + : closedCaptionRuleParams // ignore: cast_nullable_to_non_nullable + as ClosedCaptionRuleParameters?, + confidence: freezed == confidence + ? _self.confidence + : confidence // ignore: cast_nullable_to_non_nullable + as double?, + contentCountRuleParams: freezed == contentCountRuleParams + ? _self.contentCountRuleParams + : contentCountRuleParams // ignore: cast_nullable_to_non_nullable + as ContentCountRuleParameters?, + contentCustomPropertyCountParams: freezed == contentCustomPropertyCountParams + ? _self.contentCustomPropertyCountParams + : contentCustomPropertyCountParams // ignore: cast_nullable_to_non_nullable + as ContentCustomPropertyCountParameters?, + contentCustomPropertyParams: freezed == contentCustomPropertyParams + ? _self.contentCustomPropertyParams + : contentCustomPropertyParams // ignore: cast_nullable_to_non_nullable + as ContentCustomPropertyParameters?, + contentFlagCountRuleParams: freezed == contentFlagCountRuleParams + ? _self.contentFlagCountRuleParams + : contentFlagCountRuleParams // ignore: cast_nullable_to_non_nullable + as FlagCountRuleParameters?, + floodIdenticalParams: freezed == floodIdenticalParams + ? _self.floodIdenticalParams + : floodIdenticalParams // ignore: cast_nullable_to_non_nullable + as FloodIdenticalRuleParameters?, + floodSimilarParams: freezed == floodSimilarParams + ? _self.floodSimilarParams + : floodSimilarParams // ignore: cast_nullable_to_non_nullable + as FloodSimilarRuleParameters?, + imageContentParams: freezed == imageContentParams + ? _self.imageContentParams + : imageContentParams // ignore: cast_nullable_to_non_nullable + as ImageContentParameters?, + imageRuleParams: freezed == imageRuleParams + ? _self.imageRuleParams + : imageRuleParams // ignore: cast_nullable_to_non_nullable + as ImageRuleParameters?, + ipContentCountRuleParams: freezed == ipContentCountRuleParams + ? _self.ipContentCountRuleParams + : ipContentCountRuleParams // ignore: cast_nullable_to_non_nullable + as IPContentCountRuleParameters?, + ipFlagCountRuleParams: freezed == ipFlagCountRuleParams + ? _self.ipFlagCountRuleParams + : ipFlagCountRuleParams // ignore: cast_nullable_to_non_nullable + as IPFlagCountRuleParameters?, + keyframeOcrRuleParams: freezed == keyframeOcrRuleParams + ? _self.keyframeOcrRuleParams + : keyframeOcrRuleParams // ignore: cast_nullable_to_non_nullable + as KeyframeOCRRuleParameters?, + keyframeRuleParams: freezed == keyframeRuleParams + ? _self.keyframeRuleParams + : keyframeRuleParams // ignore: cast_nullable_to_non_nullable + as KeyframeRuleParameters?, + ocrContentParams: freezed == ocrContentParams + ? _self.ocrContentParams + : ocrContentParams // ignore: cast_nullable_to_non_nullable + as OCRContentParameters?, + textContentParams: freezed == textContentParams + ? _self.textContentParams + : textContentParams // ignore: cast_nullable_to_non_nullable + as TextContentParameters?, + textRuleParams: freezed == textRuleParams + ? _self.textRuleParams + : textRuleParams // ignore: cast_nullable_to_non_nullable + as TextRuleParameters?, + type: freezed == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String?, + userCreatedWithinParams: freezed == userCreatedWithinParams + ? _self.userCreatedWithinParams + : userCreatedWithinParams // ignore: cast_nullable_to_non_nullable + as UserCreatedWithinParameters?, + userCustomPropertyParams: freezed == userCustomPropertyParams + ? _self.userCustomPropertyParams + : userCustomPropertyParams // ignore: cast_nullable_to_non_nullable + as UserCustomPropertyParameters?, + userFlagCountRuleParams: freezed == userFlagCountRuleParams + ? _self.userFlagCountRuleParams + : userFlagCountRuleParams // ignore: cast_nullable_to_non_nullable + as FlagCountRuleParameters?, + userIdenticalContentCountParams: freezed == userIdenticalContentCountParams + ? _self.userIdenticalContentCountParams + : userIdenticalContentCountParams // ignore: cast_nullable_to_non_nullable + as UserIdenticalContentCountParameters?, + userRoleParams: freezed == userRoleParams + ? _self.userRoleParams + : userRoleParams // ignore: cast_nullable_to_non_nullable + as UserRoleParameters?, + userRuleParams: freezed == userRuleParams + ? _self.userRuleParams + : userRuleParams // ignore: cast_nullable_to_non_nullable + as UserRuleParameters?, + videoContentParams: freezed == videoContentParams + ? _self.videoContentParams + : videoContentParams // ignore: cast_nullable_to_non_nullable + as VideoContentParameters?, + videoRuleParams: freezed == videoRuleParams + ? _self.videoRuleParams + : videoRuleParams // ignore: cast_nullable_to_non_nullable + as VideoRuleParameters?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/rule_builder_condition.g.dart b/packages/stream_chat/lib/open_api/model/rule_builder_condition.g.dart new file mode 100644 index 0000000000..0db5824253 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/rule_builder_condition.g.dart @@ -0,0 +1,189 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'rule_builder_condition.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +RuleBuilderCondition _$RuleBuilderConditionFromJson( + Map json, +) => RuleBuilderCondition( + callCustomPropertyParams: json['call_custom_property_params'] == null + ? null + : CallCustomPropertyParameters.fromJson( + json['call_custom_property_params'] as Map, + ), + callTypeRuleParams: json['call_type_rule_params'] == null + ? null + : CallTypeRuleParameters.fromJson( + json['call_type_rule_params'] as Map, + ), + callViolationCountParams: json['call_violation_count_params'] == null + ? null + : CallViolationCountParameters.fromJson( + json['call_violation_count_params'] as Map, + ), + channelMessageCountRuleParams: json['channel_message_count_rule_params'] == null + ? null + : ChannelMessageCountRuleParameters.fromJson( + json['channel_message_count_rule_params'] as Map, + ), + closedCaptionRuleParams: json['closed_caption_rule_params'] == null + ? null + : ClosedCaptionRuleParameters.fromJson( + json['closed_caption_rule_params'] as Map, + ), + confidence: (json['confidence'] as num?)?.toDouble(), + contentCountRuleParams: json['content_count_rule_params'] == null + ? null + : ContentCountRuleParameters.fromJson( + json['content_count_rule_params'] as Map, + ), + contentCustomPropertyCountParams: json['content_custom_property_count_params'] == null + ? null + : ContentCustomPropertyCountParameters.fromJson( + json['content_custom_property_count_params'] as Map, + ), + contentCustomPropertyParams: json['content_custom_property_params'] == null + ? null + : ContentCustomPropertyParameters.fromJson( + json['content_custom_property_params'] as Map, + ), + contentFlagCountRuleParams: json['content_flag_count_rule_params'] == null + ? null + : FlagCountRuleParameters.fromJson( + json['content_flag_count_rule_params'] as Map, + ), + floodIdenticalParams: json['flood_identical_params'] == null + ? null + : FloodIdenticalRuleParameters.fromJson( + json['flood_identical_params'] as Map, + ), + floodSimilarParams: json['flood_similar_params'] == null + ? null + : FloodSimilarRuleParameters.fromJson( + json['flood_similar_params'] as Map, + ), + imageContentParams: json['image_content_params'] == null + ? null + : ImageContentParameters.fromJson( + json['image_content_params'] as Map, + ), + imageRuleParams: json['image_rule_params'] == null + ? null + : ImageRuleParameters.fromJson( + json['image_rule_params'] as Map, + ), + ipContentCountRuleParams: json['ip_content_count_rule_params'] == null + ? null + : IPContentCountRuleParameters.fromJson( + json['ip_content_count_rule_params'] as Map, + ), + ipFlagCountRuleParams: json['ip_flag_count_rule_params'] == null + ? null + : IPFlagCountRuleParameters.fromJson( + json['ip_flag_count_rule_params'] as Map, + ), + keyframeOcrRuleParams: json['keyframe_ocr_rule_params'] == null + ? null + : KeyframeOCRRuleParameters.fromJson( + json['keyframe_ocr_rule_params'] as Map, + ), + keyframeRuleParams: json['keyframe_rule_params'] == null + ? null + : KeyframeRuleParameters.fromJson( + json['keyframe_rule_params'] as Map, + ), + ocrContentParams: json['ocr_content_params'] == null + ? null + : OCRContentParameters.fromJson( + json['ocr_content_params'] as Map, + ), + textContentParams: json['text_content_params'] == null + ? null + : TextContentParameters.fromJson( + json['text_content_params'] as Map, + ), + textRuleParams: json['text_rule_params'] == null + ? null + : TextRuleParameters.fromJson( + json['text_rule_params'] as Map, + ), + type: json['type'] as String?, + userCreatedWithinParams: json['user_created_within_params'] == null + ? null + : UserCreatedWithinParameters.fromJson( + json['user_created_within_params'] as Map, + ), + userCustomPropertyParams: json['user_custom_property_params'] == null + ? null + : UserCustomPropertyParameters.fromJson( + json['user_custom_property_params'] as Map, + ), + userFlagCountRuleParams: json['user_flag_count_rule_params'] == null + ? null + : FlagCountRuleParameters.fromJson( + json['user_flag_count_rule_params'] as Map, + ), + userIdenticalContentCountParams: json['user_identical_content_count_params'] == null + ? null + : UserIdenticalContentCountParameters.fromJson( + json['user_identical_content_count_params'] as Map, + ), + userRoleParams: json['user_role_params'] == null + ? null + : UserRoleParameters.fromJson( + json['user_role_params'] as Map, + ), + userRuleParams: json['user_rule_params'] == null + ? null + : UserRuleParameters.fromJson( + json['user_rule_params'] as Map, + ), + videoContentParams: json['video_content_params'] == null + ? null + : VideoContentParameters.fromJson( + json['video_content_params'] as Map, + ), + videoRuleParams: json['video_rule_params'] == null + ? null + : VideoRuleParameters.fromJson( + json['video_rule_params'] as Map, + ), +); + +Map _$RuleBuilderConditionToJson( + RuleBuilderCondition instance, +) => { + 'call_custom_property_params': instance.callCustomPropertyParams?.toJson(), + 'call_type_rule_params': instance.callTypeRuleParams?.toJson(), + 'call_violation_count_params': instance.callViolationCountParams?.toJson(), + 'channel_message_count_rule_params': instance.channelMessageCountRuleParams?.toJson(), + 'closed_caption_rule_params': instance.closedCaptionRuleParams?.toJson(), + 'confidence': instance.confidence, + 'content_count_rule_params': instance.contentCountRuleParams?.toJson(), + 'content_custom_property_count_params': instance.contentCustomPropertyCountParams?.toJson(), + 'content_custom_property_params': instance.contentCustomPropertyParams?.toJson(), + 'content_flag_count_rule_params': instance.contentFlagCountRuleParams?.toJson(), + 'flood_identical_params': instance.floodIdenticalParams?.toJson(), + 'flood_similar_params': instance.floodSimilarParams?.toJson(), + 'image_content_params': instance.imageContentParams?.toJson(), + 'image_rule_params': instance.imageRuleParams?.toJson(), + 'ip_content_count_rule_params': instance.ipContentCountRuleParams?.toJson(), + 'ip_flag_count_rule_params': instance.ipFlagCountRuleParams?.toJson(), + 'keyframe_ocr_rule_params': instance.keyframeOcrRuleParams?.toJson(), + 'keyframe_rule_params': instance.keyframeRuleParams?.toJson(), + 'ocr_content_params': instance.ocrContentParams?.toJson(), + 'text_content_params': instance.textContentParams?.toJson(), + 'text_rule_params': instance.textRuleParams?.toJson(), + 'type': instance.type, + 'user_created_within_params': instance.userCreatedWithinParams?.toJson(), + 'user_custom_property_params': instance.userCustomPropertyParams?.toJson(), + 'user_flag_count_rule_params': instance.userFlagCountRuleParams?.toJson(), + 'user_identical_content_count_params': instance.userIdenticalContentCountParams?.toJson(), + 'user_role_params': instance.userRoleParams?.toJson(), + 'user_rule_params': instance.userRuleParams?.toJson(), + 'video_content_params': instance.videoContentParams?.toJson(), + 'video_rule_params': instance.videoRuleParams?.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/rule_builder_condition_group.dart b/packages/stream_chat/lib/open_api/model/rule_builder_condition_group.dart new file mode 100644 index 0000000000..fc6ff03ed4 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/rule_builder_condition_group.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'rule_builder_condition_group.g.dart'; +part 'rule_builder_condition_group.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class RuleBuilderConditionGroup with _$RuleBuilderConditionGroup { + const RuleBuilderConditionGroup({ + this.conditions, + this.logic, + }); + + @override + @JsonKey(name: 'conditions') + final List? conditions; + + @override + @JsonKey(name: 'logic') + final String? logic; + + Map toJson() => _$RuleBuilderConditionGroupToJson(this); + + static RuleBuilderConditionGroup fromJson(Map json) => _$RuleBuilderConditionGroupFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/rule_builder_condition_group.freezed.dart b/packages/stream_chat/lib/open_api/model/rule_builder_condition_group.freezed.dart new file mode 100644 index 0000000000..14ab43eb16 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/rule_builder_condition_group.freezed.dart @@ -0,0 +1,89 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'rule_builder_condition_group.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$RuleBuilderConditionGroup { + List? get conditions; + String? get logic; + + /// Create a copy of RuleBuilderConditionGroup + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $RuleBuilderConditionGroupCopyWith get copyWith => + _$RuleBuilderConditionGroupCopyWithImpl( + this as RuleBuilderConditionGroup, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is RuleBuilderConditionGroup && + const DeepCollectionEquality().equals( + other.conditions, + conditions, + ) && + (identical(other.logic, logic) || other.logic == logic)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(conditions), + logic, + ); + + @override + String toString() { + return 'RuleBuilderConditionGroup(conditions: $conditions, logic: $logic)'; + } +} + +/// @nodoc +abstract mixin class $RuleBuilderConditionGroupCopyWith<$Res> { + factory $RuleBuilderConditionGroupCopyWith( + RuleBuilderConditionGroup value, + $Res Function(RuleBuilderConditionGroup) _then, + ) = _$RuleBuilderConditionGroupCopyWithImpl; + @useResult + $Res call({List? conditions, String? logic}); +} + +/// @nodoc +class _$RuleBuilderConditionGroupCopyWithImpl<$Res> implements $RuleBuilderConditionGroupCopyWith<$Res> { + _$RuleBuilderConditionGroupCopyWithImpl(this._self, this._then); + + final RuleBuilderConditionGroup _self; + final $Res Function(RuleBuilderConditionGroup) _then; + + /// Create a copy of RuleBuilderConditionGroup + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? conditions = freezed, Object? logic = freezed}) { + return _then( + RuleBuilderConditionGroup( + conditions: freezed == conditions + ? _self.conditions + : conditions // ignore: cast_nullable_to_non_nullable + as List?, + logic: freezed == logic + ? _self.logic + : logic // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/rule_builder_condition_group.g.dart b/packages/stream_chat/lib/open_api/model/rule_builder_condition_group.g.dart new file mode 100644 index 0000000000..2fa889f920 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/rule_builder_condition_group.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'rule_builder_condition_group.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +RuleBuilderConditionGroup _$RuleBuilderConditionGroupFromJson( + Map json, +) => RuleBuilderConditionGroup( + conditions: (json['conditions'] as List?) + ?.map((e) => RuleBuilderCondition.fromJson(e as Map)) + .toList(), + logic: json['logic'] as String?, +); + +Map _$RuleBuilderConditionGroupToJson( + RuleBuilderConditionGroup instance, +) => { + 'conditions': instance.conditions?.map((e) => e.toJson()).toList(), + 'logic': instance.logic, +}; diff --git a/packages/stream_chat/lib/open_api/model/rule_builder_config.dart b/packages/stream_chat/lib/open_api/model/rule_builder_config.dart new file mode 100644 index 0000000000..16e2444928 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/rule_builder_config.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'rule_builder_config.g.dart'; +part 'rule_builder_config.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class RuleBuilderConfig with _$RuleBuilderConfig { + const RuleBuilderConfig({ + this.async, + this.rules, + }); + + @override + @JsonKey(name: 'async') + final bool? async; + + @override + @JsonKey(name: 'rules') + final List? rules; + + Map toJson() => _$RuleBuilderConfigToJson(this); + + static RuleBuilderConfig fromJson(Map json) => _$RuleBuilderConfigFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/rule_builder_config.freezed.dart b/packages/stream_chat/lib/open_api/model/rule_builder_config.freezed.dart new file mode 100644 index 0000000000..d6c4ddd937 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/rule_builder_config.freezed.dart @@ -0,0 +1,85 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'rule_builder_config.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$RuleBuilderConfig { + bool? get async; + List? get rules; + + /// Create a copy of RuleBuilderConfig + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $RuleBuilderConfigCopyWith get copyWith => _$RuleBuilderConfigCopyWithImpl( + this as RuleBuilderConfig, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is RuleBuilderConfig && + (identical(other.async, async) || other.async == async) && + const DeepCollectionEquality().equals(other.rules, rules)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + async, + const DeepCollectionEquality().hash(rules), + ); + + @override + String toString() { + return 'RuleBuilderConfig(async: $async, rules: $rules)'; + } +} + +/// @nodoc +abstract mixin class $RuleBuilderConfigCopyWith<$Res> { + factory $RuleBuilderConfigCopyWith( + RuleBuilderConfig value, + $Res Function(RuleBuilderConfig) _then, + ) = _$RuleBuilderConfigCopyWithImpl; + @useResult + $Res call({bool? async, List? rules}); +} + +/// @nodoc +class _$RuleBuilderConfigCopyWithImpl<$Res> implements $RuleBuilderConfigCopyWith<$Res> { + _$RuleBuilderConfigCopyWithImpl(this._self, this._then); + + final RuleBuilderConfig _self; + final $Res Function(RuleBuilderConfig) _then; + + /// Create a copy of RuleBuilderConfig + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? async = freezed, Object? rules = freezed}) { + return _then( + RuleBuilderConfig( + async: freezed == async + ? _self.async + : async // ignore: cast_nullable_to_non_nullable + as bool?, + rules: freezed == rules + ? _self.rules + : rules // ignore: cast_nullable_to_non_nullable + as List?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/rule_builder_config.g.dart b/packages/stream_chat/lib/open_api/model/rule_builder_config.g.dart new file mode 100644 index 0000000000..6a2308bd13 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/rule_builder_config.g.dart @@ -0,0 +1,17 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'rule_builder_config.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +RuleBuilderConfig _$RuleBuilderConfigFromJson(Map json) => RuleBuilderConfig( + async: json['async'] as bool?, + rules: (json['rules'] as List?)?.map((e) => RuleBuilderRule.fromJson(e as Map)).toList(), +); + +Map _$RuleBuilderConfigToJson(RuleBuilderConfig instance) => { + 'async': instance.async, + 'rules': instance.rules?.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/rule_builder_rule.dart b/packages/stream_chat/lib/open_api/model/rule_builder_rule.dart new file mode 100644 index 0000000000..75297c1e88 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/rule_builder_rule.dart @@ -0,0 +1,66 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'rule_builder_rule.g.dart'; +part 'rule_builder_rule.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class RuleBuilderRule with _$RuleBuilderRule { + const RuleBuilderRule({ + this.action, + this.actionSequences, + this.conditions, + this.cooldownPeriod, + this.groups, + this.id, + this.logic, + required this.ruleType, + }); + + @override + @JsonKey(name: 'action') + final RuleBuilderAction? action; + + @override + @JsonKey(name: 'action_sequences') + final List? actionSequences; + + @override + @JsonKey(name: 'conditions') + final List? conditions; + + @override + @JsonKey(name: 'cooldown_period') + final String? cooldownPeriod; + + @override + @JsonKey(name: 'groups') + final List? groups; + + @override + @JsonKey(name: 'id') + final String? id; + + @override + @JsonKey(name: 'logic') + final String? logic; + + @override + @JsonKey(name: 'rule_type') + final String ruleType; + + Map toJson() => _$RuleBuilderRuleToJson(this); + + static RuleBuilderRule fromJson(Map json) => _$RuleBuilderRuleFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/rule_builder_rule.freezed.dart b/packages/stream_chat/lib/open_api/model/rule_builder_rule.freezed.dart new file mode 100644 index 0000000000..407ff1d01a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/rule_builder_rule.freezed.dart @@ -0,0 +1,151 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'rule_builder_rule.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$RuleBuilderRule { + RuleBuilderAction? get action; + List? get actionSequences; + List? get conditions; + String? get cooldownPeriod; + List? get groups; + String? get id; + String? get logic; + String get ruleType; + + /// Create a copy of RuleBuilderRule + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $RuleBuilderRuleCopyWith get copyWith => _$RuleBuilderRuleCopyWithImpl( + this as RuleBuilderRule, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is RuleBuilderRule && + (identical(other.action, action) || other.action == action) && + const DeepCollectionEquality().equals( + other.actionSequences, + actionSequences, + ) && + const DeepCollectionEquality().equals( + other.conditions, + conditions, + ) && + (identical(other.cooldownPeriod, cooldownPeriod) || other.cooldownPeriod == cooldownPeriod) && + const DeepCollectionEquality().equals(other.groups, groups) && + (identical(other.id, id) || other.id == id) && + (identical(other.logic, logic) || other.logic == logic) && + (identical(other.ruleType, ruleType) || other.ruleType == ruleType)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + action, + const DeepCollectionEquality().hash(actionSequences), + const DeepCollectionEquality().hash(conditions), + cooldownPeriod, + const DeepCollectionEquality().hash(groups), + id, + logic, + ruleType, + ); + + @override + String toString() { + return 'RuleBuilderRule(action: $action, actionSequences: $actionSequences, conditions: $conditions, cooldownPeriod: $cooldownPeriod, groups: $groups, id: $id, logic: $logic, ruleType: $ruleType)'; + } +} + +/// @nodoc +abstract mixin class $RuleBuilderRuleCopyWith<$Res> { + factory $RuleBuilderRuleCopyWith( + RuleBuilderRule value, + $Res Function(RuleBuilderRule) _then, + ) = _$RuleBuilderRuleCopyWithImpl; + @useResult + $Res call({ + RuleBuilderAction? action, + List? actionSequences, + List? conditions, + String? cooldownPeriod, + List? groups, + String? id, + String? logic, + String ruleType, + }); +} + +/// @nodoc +class _$RuleBuilderRuleCopyWithImpl<$Res> implements $RuleBuilderRuleCopyWith<$Res> { + _$RuleBuilderRuleCopyWithImpl(this._self, this._then); + + final RuleBuilderRule _self; + final $Res Function(RuleBuilderRule) _then; + + /// Create a copy of RuleBuilderRule + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? action = freezed, + Object? actionSequences = freezed, + Object? conditions = freezed, + Object? cooldownPeriod = freezed, + Object? groups = freezed, + Object? id = freezed, + Object? logic = freezed, + Object? ruleType = null, + }) { + return _then( + RuleBuilderRule( + action: freezed == action + ? _self.action + : action // ignore: cast_nullable_to_non_nullable + as RuleBuilderAction?, + actionSequences: freezed == actionSequences + ? _self.actionSequences + : actionSequences // ignore: cast_nullable_to_non_nullable + as List?, + conditions: freezed == conditions + ? _self.conditions + : conditions // ignore: cast_nullable_to_non_nullable + as List?, + cooldownPeriod: freezed == cooldownPeriod + ? _self.cooldownPeriod + : cooldownPeriod // ignore: cast_nullable_to_non_nullable + as String?, + groups: freezed == groups + ? _self.groups + : groups // ignore: cast_nullable_to_non_nullable + as List?, + id: freezed == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String?, + logic: freezed == logic + ? _self.logic + : logic // ignore: cast_nullable_to_non_nullable + as String?, + ruleType: null == ruleType + ? _self.ruleType + : ruleType // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/rule_builder_rule.g.dart b/packages/stream_chat/lib/open_api/model/rule_builder_rule.g.dart new file mode 100644 index 0000000000..ea77fe24c8 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/rule_builder_rule.g.dart @@ -0,0 +1,41 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'rule_builder_rule.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +RuleBuilderRule _$RuleBuilderRuleFromJson(Map json) => RuleBuilderRule( + action: json['action'] == null ? null : RuleBuilderAction.fromJson(json['action'] as Map), + actionSequences: (json['action_sequences'] as List?) + ?.map( + (e) => CallRuleActionSequence.fromJson(e as Map), + ) + .toList(), + conditions: (json['conditions'] as List?) + ?.map((e) => RuleBuilderCondition.fromJson(e as Map)) + .toList(), + cooldownPeriod: json['cooldown_period'] as String?, + groups: (json['groups'] as List?) + ?.map( + (e) => RuleBuilderConditionGroup.fromJson(e as Map), + ) + .toList(), + id: json['id'] as String?, + logic: json['logic'] as String?, + ruleType: json['rule_type'] as String, +); + +Map _$RuleBuilderRuleToJson( + RuleBuilderRule instance, +) => { + 'action': instance.action?.toJson(), + 'action_sequences': instance.actionSequences?.map((e) => e.toJson()).toList(), + 'conditions': instance.conditions?.map((e) => e.toJson()).toList(), + 'cooldown_period': instance.cooldownPeriod, + 'groups': instance.groups?.map((e) => e.toJson()).toList(), + 'id': instance.id, + 'logic': instance.logic, + 'rule_type': instance.ruleType, +}; diff --git a/packages/stream_chat/lib/open_api/model/search_payload.dart b/packages/stream_chat/lib/open_api/model/search_payload.dart new file mode 100644 index 0000000000..aa6fd41520 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/search_payload.dart @@ -0,0 +1,76 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'search_payload.g.dart'; +part 'search_payload.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class SearchPayload with _$SearchPayload { + const SearchPayload({ + required this.filterConditions, + this.forceDefaultSearch, + this.forceSqlV2Backend, + this.limit, + this.messageFilterConditions, + this.messageOptions, + this.next, + this.offset, + this.query, + this.sort, + }); + + @override + @JsonKey(name: 'filter_conditions') + final Map filterConditions; + + @override + @JsonKey(name: 'force_default_search') + final bool? forceDefaultSearch; + + @override + @JsonKey(name: 'force_sql_v2_backend') + final bool? forceSqlV2Backend; + + @override + @JsonKey(name: 'limit') + final int? limit; + + @override + @JsonKey(name: 'message_filter_conditions') + final Map? messageFilterConditions; + + @override + @JsonKey(name: 'message_options') + final MessageOptions? messageOptions; + + @override + @JsonKey(name: 'next') + final String? next; + + @override + @JsonKey(name: 'offset') + final int? offset; + + @override + @JsonKey(name: 'query') + final String? query; + + @override + @JsonKey(name: 'sort') + final List? sort; + + Map toJson() => _$SearchPayloadToJson(this); + + static SearchPayload fromJson(Map json) => _$SearchPayloadFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/search_payload.freezed.dart b/packages/stream_chat/lib/open_api/model/search_payload.freezed.dart new file mode 100644 index 0000000000..b477d1f071 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/search_payload.freezed.dart @@ -0,0 +1,170 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'search_payload.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$SearchPayload { + Map get filterConditions; + bool? get forceDefaultSearch; + bool? get forceSqlV2Backend; + int? get limit; + Map? get messageFilterConditions; + MessageOptions? get messageOptions; + String? get next; + int? get offset; + String? get query; + List? get sort; + + /// Create a copy of SearchPayload + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $SearchPayloadCopyWith get copyWith => _$SearchPayloadCopyWithImpl( + this as SearchPayload, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is SearchPayload && + const DeepCollectionEquality().equals( + other.filterConditions, + filterConditions, + ) && + (identical(other.forceDefaultSearch, forceDefaultSearch) || + other.forceDefaultSearch == forceDefaultSearch) && + (identical(other.forceSqlV2Backend, forceSqlV2Backend) || other.forceSqlV2Backend == forceSqlV2Backend) && + (identical(other.limit, limit) || other.limit == limit) && + const DeepCollectionEquality().equals( + other.messageFilterConditions, + messageFilterConditions, + ) && + (identical(other.messageOptions, messageOptions) || other.messageOptions == messageOptions) && + (identical(other.next, next) || other.next == next) && + (identical(other.offset, offset) || other.offset == offset) && + (identical(other.query, query) || other.query == query) && + const DeepCollectionEquality().equals(other.sort, sort)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(filterConditions), + forceDefaultSearch, + forceSqlV2Backend, + limit, + const DeepCollectionEquality().hash(messageFilterConditions), + messageOptions, + next, + offset, + query, + const DeepCollectionEquality().hash(sort), + ); + + @override + String toString() { + return 'SearchPayload(filterConditions: $filterConditions, forceDefaultSearch: $forceDefaultSearch, forceSqlV2Backend: $forceSqlV2Backend, limit: $limit, messageFilterConditions: $messageFilterConditions, messageOptions: $messageOptions, next: $next, offset: $offset, query: $query, sort: $sort)'; + } +} + +/// @nodoc +abstract mixin class $SearchPayloadCopyWith<$Res> { + factory $SearchPayloadCopyWith( + SearchPayload value, + $Res Function(SearchPayload) _then, + ) = _$SearchPayloadCopyWithImpl; + @useResult + $Res call({ + Map filterConditions, + bool? forceDefaultSearch, + bool? forceSqlV2Backend, + int? limit, + Map? messageFilterConditions, + MessageOptions? messageOptions, + String? next, + int? offset, + String? query, + List? sort, + }); +} + +/// @nodoc +class _$SearchPayloadCopyWithImpl<$Res> implements $SearchPayloadCopyWith<$Res> { + _$SearchPayloadCopyWithImpl(this._self, this._then); + + final SearchPayload _self; + final $Res Function(SearchPayload) _then; + + /// Create a copy of SearchPayload + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? filterConditions = null, + Object? forceDefaultSearch = freezed, + Object? forceSqlV2Backend = freezed, + Object? limit = freezed, + Object? messageFilterConditions = freezed, + Object? messageOptions = freezed, + Object? next = freezed, + Object? offset = freezed, + Object? query = freezed, + Object? sort = freezed, + }) { + return _then( + SearchPayload( + filterConditions: null == filterConditions + ? _self.filterConditions + : filterConditions // ignore: cast_nullable_to_non_nullable + as Map, + forceDefaultSearch: freezed == forceDefaultSearch + ? _self.forceDefaultSearch + : forceDefaultSearch // ignore: cast_nullable_to_non_nullable + as bool?, + forceSqlV2Backend: freezed == forceSqlV2Backend + ? _self.forceSqlV2Backend + : forceSqlV2Backend // ignore: cast_nullable_to_non_nullable + as bool?, + limit: freezed == limit + ? _self.limit + : limit // ignore: cast_nullable_to_non_nullable + as int?, + messageFilterConditions: freezed == messageFilterConditions + ? _self.messageFilterConditions + : messageFilterConditions // ignore: cast_nullable_to_non_nullable + as Map?, + messageOptions: freezed == messageOptions + ? _self.messageOptions + : messageOptions // ignore: cast_nullable_to_non_nullable + as MessageOptions?, + next: freezed == next + ? _self.next + : next // ignore: cast_nullable_to_non_nullable + as String?, + offset: freezed == offset + ? _self.offset + : offset // ignore: cast_nullable_to_non_nullable + as int?, + query: freezed == query + ? _self.query + : query // ignore: cast_nullable_to_non_nullable + as String?, + sort: freezed == sort + ? _self.sort + : sort // ignore: cast_nullable_to_non_nullable + as List?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/search_payload.g.dart b/packages/stream_chat/lib/open_api/model/search_payload.g.dart new file mode 100644 index 0000000000..72cfaca75d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/search_payload.g.dart @@ -0,0 +1,37 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'search_payload.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +SearchPayload _$SearchPayloadFromJson(Map json) => SearchPayload( + filterConditions: json['filter_conditions'] as Map, + forceDefaultSearch: json['force_default_search'] as bool?, + forceSqlV2Backend: json['force_sql_v2_backend'] as bool?, + limit: (json['limit'] as num?)?.toInt(), + messageFilterConditions: json['message_filter_conditions'] as Map?, + messageOptions: json['message_options'] == null + ? null + : MessageOptions.fromJson( + json['message_options'] as Map, + ), + next: json['next'] as String?, + offset: (json['offset'] as num?)?.toInt(), + query: json['query'] as String?, + sort: (json['sort'] as List?)?.map((e) => SortParamRequest.fromJson(e as Map)).toList(), +); + +Map _$SearchPayloadToJson(SearchPayload instance) => { + 'filter_conditions': instance.filterConditions, + 'force_default_search': instance.forceDefaultSearch, + 'force_sql_v2_backend': instance.forceSqlV2Backend, + 'limit': instance.limit, + 'message_filter_conditions': instance.messageFilterConditions, + 'message_options': instance.messageOptions?.toJson(), + 'next': instance.next, + 'offset': instance.offset, + 'query': instance.query, + 'sort': instance.sort?.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/search_response.dart b/packages/stream_chat/lib/open_api/model/search_response.dart new file mode 100644 index 0000000000..1b7bc9205b --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/search_response.dart @@ -0,0 +1,51 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'search_response.g.dart'; +part 'search_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class SearchResponse with _$SearchResponse { + const SearchResponse({ + required this.duration, + this.next, + this.previous, + required this.results, + this.resultsWarning, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'next') + final String? next; + + @override + @JsonKey(name: 'previous') + final String? previous; + + @override + @JsonKey(name: 'results') + final List results; + + @override + @JsonKey(name: 'results_warning') + final SearchWarning? resultsWarning; + + Map toJson() => _$SearchResponseToJson(this); + + static SearchResponse fromJson(Map json) => _$SearchResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/search_response.freezed.dart b/packages/stream_chat/lib/open_api/model/search_response.freezed.dart new file mode 100644 index 0000000000..9e6ddc1547 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/search_response.freezed.dart @@ -0,0 +1,118 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'search_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$SearchResponse { + String get duration; + String? get next; + String? get previous; + List get results; + SearchWarning? get resultsWarning; + + /// Create a copy of SearchResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $SearchResponseCopyWith get copyWith => _$SearchResponseCopyWithImpl( + this as SearchResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is SearchResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.next, next) || other.next == next) && + (identical(other.previous, previous) || other.previous == previous) && + const DeepCollectionEquality().equals(other.results, results) && + (identical(other.resultsWarning, resultsWarning) || other.resultsWarning == resultsWarning)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + duration, + next, + previous, + const DeepCollectionEquality().hash(results), + resultsWarning, + ); + + @override + String toString() { + return 'SearchResponse(duration: $duration, next: $next, previous: $previous, results: $results, resultsWarning: $resultsWarning)'; + } +} + +/// @nodoc +abstract mixin class $SearchResponseCopyWith<$Res> { + factory $SearchResponseCopyWith( + SearchResponse value, + $Res Function(SearchResponse) _then, + ) = _$SearchResponseCopyWithImpl; + @useResult + $Res call({ + String duration, + String? next, + String? previous, + List results, + SearchWarning? resultsWarning, + }); +} + +/// @nodoc +class _$SearchResponseCopyWithImpl<$Res> implements $SearchResponseCopyWith<$Res> { + _$SearchResponseCopyWithImpl(this._self, this._then); + + final SearchResponse _self; + final $Res Function(SearchResponse) _then; + + /// Create a copy of SearchResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? duration = null, + Object? next = freezed, + Object? previous = freezed, + Object? results = null, + Object? resultsWarning = freezed, + }) { + return _then( + SearchResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + next: freezed == next + ? _self.next + : next // ignore: cast_nullable_to_non_nullable + as String?, + previous: freezed == previous + ? _self.previous + : previous // ignore: cast_nullable_to_non_nullable + as String?, + results: null == results + ? _self.results + : results // ignore: cast_nullable_to_non_nullable + as List, + resultsWarning: freezed == resultsWarning + ? _self.resultsWarning + : resultsWarning // ignore: cast_nullable_to_non_nullable + as SearchWarning?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/search_response.g.dart b/packages/stream_chat/lib/open_api/model/search_response.g.dart new file mode 100644 index 0000000000..167c18da4d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/search_response.g.dart @@ -0,0 +1,27 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'search_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +SearchResponse _$SearchResponseFromJson(Map json) => SearchResponse( + duration: json['duration'] as String, + next: json['next'] as String?, + previous: json['previous'] as String?, + results: (json['results'] as List).map((e) => SearchResult.fromJson(e as Map)).toList(), + resultsWarning: json['results_warning'] == null + ? null + : SearchWarning.fromJson( + json['results_warning'] as Map, + ), +); + +Map _$SearchResponseToJson(SearchResponse instance) => { + 'duration': instance.duration, + 'next': instance.next, + 'previous': instance.previous, + 'results': instance.results.map((e) => e.toJson()).toList(), + 'results_warning': instance.resultsWarning?.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/search_result.dart b/packages/stream_chat/lib/open_api/model/search_result.dart new file mode 100644 index 0000000000..dd5134f246 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/search_result.dart @@ -0,0 +1,31 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'search_result.g.dart'; +part 'search_result.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class SearchResult with _$SearchResult { + const SearchResult({ + this.message, + }); + + @override + @JsonKey(name: 'message') + final SearchResultMessage? message; + + Map toJson() => _$SearchResultToJson(this); + + static SearchResult fromJson(Map json) => _$SearchResultFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/search_result.freezed.dart b/packages/stream_chat/lib/open_api/model/search_result.freezed.dart new file mode 100644 index 0000000000..9b1b9b54c0 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/search_result.freezed.dart @@ -0,0 +1,75 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'search_result.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$SearchResult { + SearchResultMessage? get message; + + /// Create a copy of SearchResult + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $SearchResultCopyWith get copyWith => _$SearchResultCopyWithImpl( + this as SearchResult, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is SearchResult && + (identical(other.message, message) || other.message == message)); + } + + @override + int get hashCode => Object.hash(runtimeType, message); + + @override + String toString() { + return 'SearchResult(message: $message)'; + } +} + +/// @nodoc +abstract mixin class $SearchResultCopyWith<$Res> { + factory $SearchResultCopyWith( + SearchResult value, + $Res Function(SearchResult) _then, + ) = _$SearchResultCopyWithImpl; + @useResult + $Res call({SearchResultMessage? message}); +} + +/// @nodoc +class _$SearchResultCopyWithImpl<$Res> implements $SearchResultCopyWith<$Res> { + _$SearchResultCopyWithImpl(this._self, this._then); + + final SearchResult _self; + final $Res Function(SearchResult) _then; + + /// Create a copy of SearchResult + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? message = freezed}) { + return _then( + SearchResult( + message: freezed == message + ? _self.message + : message // ignore: cast_nullable_to_non_nullable + as SearchResultMessage?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/search_result.g.dart b/packages/stream_chat/lib/open_api/model/search_result.g.dart new file mode 100644 index 0000000000..2cff3344b8 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/search_result.g.dart @@ -0,0 +1,15 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'search_result.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +SearchResult _$SearchResultFromJson(Map json) => SearchResult( + message: json['message'] == null ? null : SearchResultMessage.fromJson(json['message'] as Map), +); + +Map _$SearchResultToJson(SearchResult instance) => { + 'message': instance.message?.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/search_result_message.dart b/packages/stream_chat/lib/open_api/model/search_result_message.dart new file mode 100644 index 0000000000..e15f72bb7b --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/search_result_message.dart @@ -0,0 +1,287 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'search_result_message.g.dart'; +part 'search_result_message.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class SearchResultMessage with _$SearchResultMessage { + const SearchResultMessage({ + required this.attachments, + this.channel, + required this.cid, + this.command, + required this.createdAt, + required this.custom, + this.deletedAt, + this.deletedForMe, + required this.deletedReplyCount, + this.draft, + required this.html, + this.i18n, + required this.id, + this.imageLabels, + required this.latestReactions, + this.member, + required this.mentionedChannel, + this.mentionedChannelMembers, + this.mentionedGroupIds, + this.mentionedGroups, + required this.mentionedHere, + this.mentionedRoles, + required this.mentionedUsers, + this.messageTextUpdatedAt, + this.mml, + this.moderation, + required this.ownReactions, + this.parentId, + this.pinExpires, + required this.pinned, + this.pinnedAt, + this.pinnedBy, + this.poll, + this.pollId, + this.quotedMessage, + this.quotedMessageId, + required this.reactionCounts, + this.reactionGroups, + required this.reactionScores, + this.reminder, + required this.replyCount, + required this.restrictedVisibility, + required this.shadowed, + this.sharedLocation, + this.showInChannel, + required this.silent, + required this.text, + this.threadParticipants, + required this.type, + required this.updatedAt, + required this.user, + }); + + @override + @JsonKey(name: 'attachments') + final List attachments; + + @override + @JsonKey(name: 'channel') + final ChannelResponse? channel; + + @override + @JsonKey(name: 'cid') + final String cid; + + @override + @JsonKey(name: 'command') + final String? command; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'deleted_at') + final DateTime? deletedAt; + + @override + @JsonKey(name: 'deleted_for_me') + final bool? deletedForMe; + + @override + @JsonKey(name: 'deleted_reply_count') + final int deletedReplyCount; + + @override + @JsonKey(name: 'draft') + final DraftResponse? draft; + + @override + @JsonKey(name: 'html') + final String html; + + @override + @JsonKey(name: 'i18n') + final Map? i18n; + + @override + @JsonKey(name: 'id') + final String id; + + @override + @JsonKey(name: 'image_labels') + final Map>? imageLabels; + + @override + @JsonKey(name: 'latest_reactions') + final List latestReactions; + + @override + @JsonKey(name: 'member') + final ChannelMemberPartialResponse? member; + + @override + @JsonKey(name: 'mentioned_channel') + final bool mentionedChannel; + + @override + @JsonKey(name: 'mentioned_channel_members') + final Map? mentionedChannelMembers; + + @override + @JsonKey(name: 'mentioned_group_ids') + final List? mentionedGroupIds; + + @override + @JsonKey(name: 'mentioned_groups') + final List? mentionedGroups; + + @override + @JsonKey(name: 'mentioned_here') + final bool mentionedHere; + + @override + @JsonKey(name: 'mentioned_roles') + final List? mentionedRoles; + + @override + @JsonKey(name: 'mentioned_users') + final List mentionedUsers; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'message_text_updated_at') + final DateTime? messageTextUpdatedAt; + + @override + @JsonKey(name: 'mml') + final String? mml; + + @override + @JsonKey(name: 'moderation') + final ModerationV2Response? moderation; + + @override + @JsonKey(name: 'own_reactions') + final List ownReactions; + + @override + @JsonKey(name: 'parent_id') + final String? parentId; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'pin_expires') + final DateTime? pinExpires; + + @override + @JsonKey(name: 'pinned') + final bool pinned; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'pinned_at') + final DateTime? pinnedAt; + + @override + @JsonKey(name: 'pinned_by') + final UserResponse? pinnedBy; + + @override + @JsonKey(name: 'poll') + final PollResponseData? poll; + + @override + @JsonKey(name: 'poll_id') + final String? pollId; + + @override + @JsonKey(name: 'quoted_message') + final MessageResponse? quotedMessage; + + @override + @JsonKey(name: 'quoted_message_id') + final String? quotedMessageId; + + @override + @JsonKey(name: 'reaction_counts') + final Map reactionCounts; + + @override + @JsonKey(name: 'reaction_groups') + final Map? reactionGroups; + + @override + @JsonKey(name: 'reaction_scores') + final Map reactionScores; + + @override + @JsonKey(name: 'reminder') + final ReminderResponseData? reminder; + + @override + @JsonKey(name: 'reply_count') + final int replyCount; + + @override + @JsonKey(name: 'restricted_visibility') + final List restrictedVisibility; + + @override + @JsonKey(name: 'shadowed') + final bool shadowed; + + @override + @JsonKey(name: 'shared_location') + final SharedLocationResponseData? sharedLocation; + + @override + @JsonKey(name: 'show_in_channel') + final bool? showInChannel; + + @override + @JsonKey(name: 'silent') + final bool silent; + + @override + @JsonKey(name: 'text') + final String text; + + @override + @JsonKey(name: 'thread_participants') + final List? threadParticipants; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'updated_at') + final DateTime updatedAt; + + @override + @JsonKey(name: 'user') + final UserResponse user; + + Map toJson() => _$SearchResultMessageToJson(this); + + static SearchResultMessage fromJson(Map json) => _$SearchResultMessageFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/search_result_message.freezed.dart b/packages/stream_chat/lib/open_api/model/search_result_message.freezed.dart new file mode 100644 index 0000000000..66c746e0fe --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/search_result_message.freezed.dart @@ -0,0 +1,576 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'search_result_message.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$SearchResultMessage { + List get attachments; + ChannelResponse? get channel; + String get cid; + String? get command; + DateTime get createdAt; + Map get custom; + DateTime? get deletedAt; + bool? get deletedForMe; + int get deletedReplyCount; + DraftResponse? get draft; + String get html; + Map? get i18n; + String get id; + Map>? get imageLabels; + List get latestReactions; + ChannelMemberPartialResponse? get member; + bool get mentionedChannel; + Map? get mentionedChannelMembers; + List? get mentionedGroupIds; + List? get mentionedGroups; + bool get mentionedHere; + List? get mentionedRoles; + List get mentionedUsers; + DateTime? get messageTextUpdatedAt; + String? get mml; + ModerationV2Response? get moderation; + List get ownReactions; + String? get parentId; + DateTime? get pinExpires; + bool get pinned; + DateTime? get pinnedAt; + UserResponse? get pinnedBy; + PollResponseData? get poll; + String? get pollId; + MessageResponse? get quotedMessage; + String? get quotedMessageId; + Map get reactionCounts; + Map? get reactionGroups; + Map get reactionScores; + ReminderResponseData? get reminder; + int get replyCount; + List get restrictedVisibility; + bool get shadowed; + SharedLocationResponseData? get sharedLocation; + bool? get showInChannel; + bool get silent; + String get text; + List? get threadParticipants; + String get type; + DateTime get updatedAt; + UserResponse get user; + + /// Create a copy of SearchResultMessage + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $SearchResultMessageCopyWith get copyWith => + _$SearchResultMessageCopyWithImpl( + this as SearchResultMessage, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is SearchResultMessage && + const DeepCollectionEquality().equals( + other.attachments, + attachments, + ) && + (identical(other.channel, channel) || other.channel == channel) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.command, command) || other.command == command) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt) && + (identical(other.deletedForMe, deletedForMe) || other.deletedForMe == deletedForMe) && + (identical(other.deletedReplyCount, deletedReplyCount) || other.deletedReplyCount == deletedReplyCount) && + (identical(other.draft, draft) || other.draft == draft) && + (identical(other.html, html) || other.html == html) && + const DeepCollectionEquality().equals(other.i18n, i18n) && + (identical(other.id, id) || other.id == id) && + const DeepCollectionEquality().equals( + other.imageLabels, + imageLabels, + ) && + const DeepCollectionEquality().equals( + other.latestReactions, + latestReactions, + ) && + (identical(other.member, member) || other.member == member) && + (identical(other.mentionedChannel, mentionedChannel) || other.mentionedChannel == mentionedChannel) && + const DeepCollectionEquality().equals( + other.mentionedChannelMembers, + mentionedChannelMembers, + ) && + const DeepCollectionEquality().equals( + other.mentionedGroupIds, + mentionedGroupIds, + ) && + const DeepCollectionEquality().equals( + other.mentionedGroups, + mentionedGroups, + ) && + (identical(other.mentionedHere, mentionedHere) || other.mentionedHere == mentionedHere) && + const DeepCollectionEquality().equals( + other.mentionedRoles, + mentionedRoles, + ) && + const DeepCollectionEquality().equals( + other.mentionedUsers, + mentionedUsers, + ) && + (identical(other.messageTextUpdatedAt, messageTextUpdatedAt) || + other.messageTextUpdatedAt == messageTextUpdatedAt) && + (identical(other.mml, mml) || other.mml == mml) && + (identical(other.moderation, moderation) || other.moderation == moderation) && + const DeepCollectionEquality().equals( + other.ownReactions, + ownReactions, + ) && + (identical(other.parentId, parentId) || other.parentId == parentId) && + (identical(other.pinExpires, pinExpires) || other.pinExpires == pinExpires) && + (identical(other.pinned, pinned) || other.pinned == pinned) && + (identical(other.pinnedAt, pinnedAt) || other.pinnedAt == pinnedAt) && + (identical(other.pinnedBy, pinnedBy) || other.pinnedBy == pinnedBy) && + (identical(other.poll, poll) || other.poll == poll) && + (identical(other.pollId, pollId) || other.pollId == pollId) && + (identical(other.quotedMessage, quotedMessage) || other.quotedMessage == quotedMessage) && + (identical(other.quotedMessageId, quotedMessageId) || other.quotedMessageId == quotedMessageId) && + const DeepCollectionEquality().equals( + other.reactionCounts, + reactionCounts, + ) && + const DeepCollectionEquality().equals( + other.reactionGroups, + reactionGroups, + ) && + const DeepCollectionEquality().equals( + other.reactionScores, + reactionScores, + ) && + (identical(other.reminder, reminder) || other.reminder == reminder) && + (identical(other.replyCount, replyCount) || other.replyCount == replyCount) && + const DeepCollectionEquality().equals( + other.restrictedVisibility, + restrictedVisibility, + ) && + (identical(other.shadowed, shadowed) || other.shadowed == shadowed) && + (identical(other.sharedLocation, sharedLocation) || other.sharedLocation == sharedLocation) && + (identical(other.showInChannel, showInChannel) || other.showInChannel == showInChannel) && + (identical(other.silent, silent) || other.silent == silent) && + (identical(other.text, text) || other.text == text) && + const DeepCollectionEquality().equals( + other.threadParticipants, + threadParticipants, + ) && + (identical(other.type, type) || other.type == type) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hashAll([ + runtimeType, + const DeepCollectionEquality().hash(attachments), + channel, + cid, + command, + createdAt, + const DeepCollectionEquality().hash(custom), + deletedAt, + deletedForMe, + deletedReplyCount, + draft, + html, + const DeepCollectionEquality().hash(i18n), + id, + const DeepCollectionEquality().hash(imageLabels), + const DeepCollectionEquality().hash(latestReactions), + member, + mentionedChannel, + const DeepCollectionEquality().hash(mentionedChannelMembers), + const DeepCollectionEquality().hash(mentionedGroupIds), + const DeepCollectionEquality().hash(mentionedGroups), + mentionedHere, + const DeepCollectionEquality().hash(mentionedRoles), + const DeepCollectionEquality().hash(mentionedUsers), + messageTextUpdatedAt, + mml, + moderation, + const DeepCollectionEquality().hash(ownReactions), + parentId, + pinExpires, + pinned, + pinnedAt, + pinnedBy, + poll, + pollId, + quotedMessage, + quotedMessageId, + const DeepCollectionEquality().hash(reactionCounts), + const DeepCollectionEquality().hash(reactionGroups), + const DeepCollectionEquality().hash(reactionScores), + reminder, + replyCount, + const DeepCollectionEquality().hash(restrictedVisibility), + shadowed, + sharedLocation, + showInChannel, + silent, + text, + const DeepCollectionEquality().hash(threadParticipants), + type, + updatedAt, + user, + ]); + + @override + String toString() { + return 'SearchResultMessage(attachments: $attachments, channel: $channel, cid: $cid, command: $command, createdAt: $createdAt, custom: $custom, deletedAt: $deletedAt, deletedForMe: $deletedForMe, deletedReplyCount: $deletedReplyCount, draft: $draft, html: $html, i18n: $i18n, id: $id, imageLabels: $imageLabels, latestReactions: $latestReactions, member: $member, mentionedChannel: $mentionedChannel, mentionedChannelMembers: $mentionedChannelMembers, mentionedGroupIds: $mentionedGroupIds, mentionedGroups: $mentionedGroups, mentionedHere: $mentionedHere, mentionedRoles: $mentionedRoles, mentionedUsers: $mentionedUsers, messageTextUpdatedAt: $messageTextUpdatedAt, mml: $mml, moderation: $moderation, ownReactions: $ownReactions, parentId: $parentId, pinExpires: $pinExpires, pinned: $pinned, pinnedAt: $pinnedAt, pinnedBy: $pinnedBy, poll: $poll, pollId: $pollId, quotedMessage: $quotedMessage, quotedMessageId: $quotedMessageId, reactionCounts: $reactionCounts, reactionGroups: $reactionGroups, reactionScores: $reactionScores, reminder: $reminder, replyCount: $replyCount, restrictedVisibility: $restrictedVisibility, shadowed: $shadowed, sharedLocation: $sharedLocation, showInChannel: $showInChannel, silent: $silent, text: $text, threadParticipants: $threadParticipants, type: $type, updatedAt: $updatedAt, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $SearchResultMessageCopyWith<$Res> { + factory $SearchResultMessageCopyWith( + SearchResultMessage value, + $Res Function(SearchResultMessage) _then, + ) = _$SearchResultMessageCopyWithImpl; + @useResult + $Res call({ + List attachments, + ChannelResponse? channel, + String cid, + String? command, + DateTime createdAt, + Map custom, + DateTime? deletedAt, + bool? deletedForMe, + int deletedReplyCount, + DraftResponse? draft, + String html, + Map? i18n, + String id, + Map>? imageLabels, + List latestReactions, + ChannelMemberPartialResponse? member, + bool mentionedChannel, + Map? mentionedChannelMembers, + List? mentionedGroupIds, + List? mentionedGroups, + bool mentionedHere, + List? mentionedRoles, + List mentionedUsers, + DateTime? messageTextUpdatedAt, + String? mml, + ModerationV2Response? moderation, + List ownReactions, + String? parentId, + DateTime? pinExpires, + bool pinned, + DateTime? pinnedAt, + UserResponse? pinnedBy, + PollResponseData? poll, + String? pollId, + MessageResponse? quotedMessage, + String? quotedMessageId, + Map reactionCounts, + Map? reactionGroups, + Map reactionScores, + ReminderResponseData? reminder, + int replyCount, + List restrictedVisibility, + bool shadowed, + SharedLocationResponseData? sharedLocation, + bool? showInChannel, + bool silent, + String text, + List? threadParticipants, + String type, + DateTime updatedAt, + UserResponse user, + }); +} + +/// @nodoc +class _$SearchResultMessageCopyWithImpl<$Res> implements $SearchResultMessageCopyWith<$Res> { + _$SearchResultMessageCopyWithImpl(this._self, this._then); + + final SearchResultMessage _self; + final $Res Function(SearchResultMessage) _then; + + /// Create a copy of SearchResultMessage + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? attachments = null, + Object? channel = freezed, + Object? cid = null, + Object? command = freezed, + Object? createdAt = null, + Object? custom = null, + Object? deletedAt = freezed, + Object? deletedForMe = freezed, + Object? deletedReplyCount = null, + Object? draft = freezed, + Object? html = null, + Object? i18n = freezed, + Object? id = null, + Object? imageLabels = freezed, + Object? latestReactions = null, + Object? member = freezed, + Object? mentionedChannel = null, + Object? mentionedChannelMembers = freezed, + Object? mentionedGroupIds = freezed, + Object? mentionedGroups = freezed, + Object? mentionedHere = null, + Object? mentionedRoles = freezed, + Object? mentionedUsers = null, + Object? messageTextUpdatedAt = freezed, + Object? mml = freezed, + Object? moderation = freezed, + Object? ownReactions = null, + Object? parentId = freezed, + Object? pinExpires = freezed, + Object? pinned = null, + Object? pinnedAt = freezed, + Object? pinnedBy = freezed, + Object? poll = freezed, + Object? pollId = freezed, + Object? quotedMessage = freezed, + Object? quotedMessageId = freezed, + Object? reactionCounts = null, + Object? reactionGroups = freezed, + Object? reactionScores = null, + Object? reminder = freezed, + Object? replyCount = null, + Object? restrictedVisibility = null, + Object? shadowed = null, + Object? sharedLocation = freezed, + Object? showInChannel = freezed, + Object? silent = null, + Object? text = null, + Object? threadParticipants = freezed, + Object? type = null, + Object? updatedAt = null, + Object? user = null, + }) { + return _then( + SearchResultMessage( + attachments: null == attachments + ? _self.attachments + : attachments // ignore: cast_nullable_to_non_nullable + as List, + channel: freezed == channel + ? _self.channel + : channel // ignore: cast_nullable_to_non_nullable + as ChannelResponse?, + cid: null == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String, + command: freezed == command + ? _self.command + : command // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + deletedAt: freezed == deletedAt + ? _self.deletedAt + : deletedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + deletedForMe: freezed == deletedForMe + ? _self.deletedForMe + : deletedForMe // ignore: cast_nullable_to_non_nullable + as bool?, + deletedReplyCount: null == deletedReplyCount + ? _self.deletedReplyCount + : deletedReplyCount // ignore: cast_nullable_to_non_nullable + as int, + draft: freezed == draft + ? _self.draft + : draft // ignore: cast_nullable_to_non_nullable + as DraftResponse?, + html: null == html + ? _self.html + : html // ignore: cast_nullable_to_non_nullable + as String, + i18n: freezed == i18n + ? _self.i18n + : i18n // ignore: cast_nullable_to_non_nullable + as Map?, + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + imageLabels: freezed == imageLabels + ? _self.imageLabels + : imageLabels // ignore: cast_nullable_to_non_nullable + as Map>?, + latestReactions: null == latestReactions + ? _self.latestReactions + : latestReactions // ignore: cast_nullable_to_non_nullable + as List, + member: freezed == member + ? _self.member + : member // ignore: cast_nullable_to_non_nullable + as ChannelMemberPartialResponse?, + mentionedChannel: null == mentionedChannel + ? _self.mentionedChannel + : mentionedChannel // ignore: cast_nullable_to_non_nullable + as bool, + mentionedChannelMembers: freezed == mentionedChannelMembers + ? _self.mentionedChannelMembers + : mentionedChannelMembers // ignore: cast_nullable_to_non_nullable + as Map?, + mentionedGroupIds: freezed == mentionedGroupIds + ? _self.mentionedGroupIds + : mentionedGroupIds // ignore: cast_nullable_to_non_nullable + as List?, + mentionedGroups: freezed == mentionedGroups + ? _self.mentionedGroups + : mentionedGroups // ignore: cast_nullable_to_non_nullable + as List?, + mentionedHere: null == mentionedHere + ? _self.mentionedHere + : mentionedHere // ignore: cast_nullable_to_non_nullable + as bool, + mentionedRoles: freezed == mentionedRoles + ? _self.mentionedRoles + : mentionedRoles // ignore: cast_nullable_to_non_nullable + as List?, + mentionedUsers: null == mentionedUsers + ? _self.mentionedUsers + : mentionedUsers // ignore: cast_nullable_to_non_nullable + as List, + messageTextUpdatedAt: freezed == messageTextUpdatedAt + ? _self.messageTextUpdatedAt + : messageTextUpdatedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + mml: freezed == mml + ? _self.mml + : mml // ignore: cast_nullable_to_non_nullable + as String?, + moderation: freezed == moderation + ? _self.moderation + : moderation // ignore: cast_nullable_to_non_nullable + as ModerationV2Response?, + ownReactions: null == ownReactions + ? _self.ownReactions + : ownReactions // ignore: cast_nullable_to_non_nullable + as List, + parentId: freezed == parentId + ? _self.parentId + : parentId // ignore: cast_nullable_to_non_nullable + as String?, + pinExpires: freezed == pinExpires + ? _self.pinExpires + : pinExpires // ignore: cast_nullable_to_non_nullable + as DateTime?, + pinned: null == pinned + ? _self.pinned + : pinned // ignore: cast_nullable_to_non_nullable + as bool, + pinnedAt: freezed == pinnedAt + ? _self.pinnedAt + : pinnedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + pinnedBy: freezed == pinnedBy + ? _self.pinnedBy + : pinnedBy // ignore: cast_nullable_to_non_nullable + as UserResponse?, + poll: freezed == poll + ? _self.poll + : poll // ignore: cast_nullable_to_non_nullable + as PollResponseData?, + pollId: freezed == pollId + ? _self.pollId + : pollId // ignore: cast_nullable_to_non_nullable + as String?, + quotedMessage: freezed == quotedMessage + ? _self.quotedMessage + : quotedMessage // ignore: cast_nullable_to_non_nullable + as MessageResponse?, + quotedMessageId: freezed == quotedMessageId + ? _self.quotedMessageId + : quotedMessageId // ignore: cast_nullable_to_non_nullable + as String?, + reactionCounts: null == reactionCounts + ? _self.reactionCounts + : reactionCounts // ignore: cast_nullable_to_non_nullable + as Map, + reactionGroups: freezed == reactionGroups + ? _self.reactionGroups + : reactionGroups // ignore: cast_nullable_to_non_nullable + as Map?, + reactionScores: null == reactionScores + ? _self.reactionScores + : reactionScores // ignore: cast_nullable_to_non_nullable + as Map, + reminder: freezed == reminder + ? _self.reminder + : reminder // ignore: cast_nullable_to_non_nullable + as ReminderResponseData?, + replyCount: null == replyCount + ? _self.replyCount + : replyCount // ignore: cast_nullable_to_non_nullable + as int, + restrictedVisibility: null == restrictedVisibility + ? _self.restrictedVisibility + : restrictedVisibility // ignore: cast_nullable_to_non_nullable + as List, + shadowed: null == shadowed + ? _self.shadowed + : shadowed // ignore: cast_nullable_to_non_nullable + as bool, + sharedLocation: freezed == sharedLocation + ? _self.sharedLocation + : sharedLocation // ignore: cast_nullable_to_non_nullable + as SharedLocationResponseData?, + showInChannel: freezed == showInChannel + ? _self.showInChannel + : showInChannel // ignore: cast_nullable_to_non_nullable + as bool?, + silent: null == silent + ? _self.silent + : silent // ignore: cast_nullable_to_non_nullable + as bool, + text: null == text + ? _self.text + : text // ignore: cast_nullable_to_non_nullable + as String, + threadParticipants: freezed == threadParticipants + ? _self.threadParticipants + : threadParticipants // ignore: cast_nullable_to_non_nullable + as List?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + updatedAt: null == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + user: null == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponse, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/search_result_message.g.dart b/packages/stream_chat/lib/open_api/model/search_result_message.g.dart new file mode 100644 index 0000000000..a1f691d705 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/search_result_message.g.dart @@ -0,0 +1,200 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'search_result_message.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +SearchResultMessage _$SearchResultMessageFromJson( + Map json, +) => SearchResultMessage( + attachments: (json['attachments'] as List) + .map((e) => Attachment.fromJson(e as Map)) + .toList(), + channel: json['channel'] == null ? null : ChannelResponse.fromJson(json['channel'] as Map), + cid: json['cid'] as String, + command: json['command'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + deletedAt: _$JsonConverterFromJson( + json['deleted_at'], + const StreamDateTimeConverter().fromJson, + ), + deletedForMe: json['deleted_for_me'] as bool?, + deletedReplyCount: (json['deleted_reply_count'] as num).toInt(), + draft: json['draft'] == null ? null : DraftResponse.fromJson(json['draft'] as Map), + html: json['html'] as String, + i18n: (json['i18n'] as Map?)?.map( + (k, e) => MapEntry(k, e as String), + ), + id: json['id'] as String, + imageLabels: (json['image_labels'] as Map?)?.map( + (k, e) => MapEntry(k, (e as List).map((e) => e as String).toList()), + ), + latestReactions: (json['latest_reactions'] as List) + .map((e) => ReactionResponse.fromJson(e as Map)) + .toList(), + member: json['member'] == null + ? null + : ChannelMemberPartialResponse.fromJson( + json['member'] as Map, + ), + mentionedChannel: json['mentioned_channel'] as bool, + mentionedChannelMembers: (json['mentioned_channel_members'] as Map?)?.map( + (k, e) => MapEntry( + k, + ChannelMemberPartialResponse.fromJson(e as Map), + ), + ), + mentionedGroupIds: (json['mentioned_group_ids'] as List?)?.map((e) => e as String).toList(), + mentionedGroups: (json['mentioned_groups'] as List?) + ?.map((e) => UserGroupResponse.fromJson(e as Map)) + .toList(), + mentionedHere: json['mentioned_here'] as bool, + mentionedRoles: (json['mentioned_roles'] as List?)?.map((e) => e as String).toList(), + mentionedUsers: (json['mentioned_users'] as List) + .map((e) => UserResponse.fromJson(e as Map)) + .toList(), + messageTextUpdatedAt: _$JsonConverterFromJson( + json['message_text_updated_at'], + const StreamDateTimeConverter().fromJson, + ), + mml: json['mml'] as String?, + moderation: json['moderation'] == null + ? null + : ModerationV2Response.fromJson( + json['moderation'] as Map, + ), + ownReactions: (json['own_reactions'] as List) + .map((e) => ReactionResponse.fromJson(e as Map)) + .toList(), + parentId: json['parent_id'] as String?, + pinExpires: _$JsonConverterFromJson( + json['pin_expires'], + const StreamDateTimeConverter().fromJson, + ), + pinned: json['pinned'] as bool, + pinnedAt: _$JsonConverterFromJson( + json['pinned_at'], + const StreamDateTimeConverter().fromJson, + ), + pinnedBy: json['pinned_by'] == null ? null : UserResponse.fromJson(json['pinned_by'] as Map), + poll: json['poll'] == null ? null : PollResponseData.fromJson(json['poll'] as Map), + pollId: json['poll_id'] as String?, + quotedMessage: json['quoted_message'] == null + ? null + : MessageResponse.fromJson( + json['quoted_message'] as Map, + ), + quotedMessageId: json['quoted_message_id'] as String?, + reactionCounts: Map.from(json['reaction_counts'] as Map), + reactionGroups: (json['reaction_groups'] as Map?)?.map( + (k, e) => MapEntry(k, ReactionGroupResponse.fromJson(e as Map)), + ), + reactionScores: Map.from(json['reaction_scores'] as Map), + reminder: json['reminder'] == null ? null : ReminderResponseData.fromJson(json['reminder'] as Map), + replyCount: (json['reply_count'] as num).toInt(), + restrictedVisibility: (json['restricted_visibility'] as List).map((e) => e as String).toList(), + shadowed: json['shadowed'] as bool, + sharedLocation: json['shared_location'] == null + ? null + : SharedLocationResponseData.fromJson( + json['shared_location'] as Map, + ), + showInChannel: json['show_in_channel'] as bool?, + silent: json['silent'] as bool, + text: json['text'] as String, + threadParticipants: (json['thread_participants'] as List?) + ?.map((e) => UserResponse.fromJson(e as Map)) + .toList(), + type: json['type'] as String, + updatedAt: const StreamDateTimeConverter().fromJson( + json['updated_at'] as Object, + ), + user: UserResponse.fromJson(json['user'] as Map), +); + +Map _$SearchResultMessageToJson( + SearchResultMessage instance, +) => { + 'attachments': instance.attachments.map((e) => e.toJson()).toList(), + 'channel': instance.channel?.toJson(), + 'cid': instance.cid, + 'command': instance.command, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'deleted_at': _$JsonConverterToJson( + instance.deletedAt, + const StreamDateTimeConverter().toJson, + ), + 'deleted_for_me': instance.deletedForMe, + 'deleted_reply_count': instance.deletedReplyCount, + 'draft': instance.draft?.toJson(), + 'html': instance.html, + 'i18n': instance.i18n, + 'id': instance.id, + 'image_labels': instance.imageLabels, + 'latest_reactions': instance.latestReactions.map((e) => e.toJson()).toList(), + 'member': instance.member?.toJson(), + 'mentioned_channel': instance.mentionedChannel, + 'mentioned_channel_members': instance.mentionedChannelMembers?.map( + (k, e) => MapEntry(k, e.toJson()), + ), + 'mentioned_group_ids': instance.mentionedGroupIds, + 'mentioned_groups': instance.mentionedGroups?.map((e) => e.toJson()).toList(), + 'mentioned_here': instance.mentionedHere, + 'mentioned_roles': instance.mentionedRoles, + 'mentioned_users': instance.mentionedUsers.map((e) => e.toJson()).toList(), + 'message_text_updated_at': _$JsonConverterToJson( + instance.messageTextUpdatedAt, + const StreamDateTimeConverter().toJson, + ), + 'mml': instance.mml, + 'moderation': instance.moderation?.toJson(), + 'own_reactions': instance.ownReactions.map((e) => e.toJson()).toList(), + 'parent_id': instance.parentId, + 'pin_expires': _$JsonConverterToJson( + instance.pinExpires, + const StreamDateTimeConverter().toJson, + ), + 'pinned': instance.pinned, + 'pinned_at': _$JsonConverterToJson( + instance.pinnedAt, + const StreamDateTimeConverter().toJson, + ), + 'pinned_by': instance.pinnedBy?.toJson(), + 'poll': instance.poll?.toJson(), + 'poll_id': instance.pollId, + 'quoted_message': instance.quotedMessage?.toJson(), + 'quoted_message_id': instance.quotedMessageId, + 'reaction_counts': instance.reactionCounts, + 'reaction_groups': instance.reactionGroups?.map( + (k, e) => MapEntry(k, e.toJson()), + ), + 'reaction_scores': instance.reactionScores, + 'reminder': instance.reminder?.toJson(), + 'reply_count': instance.replyCount, + 'restricted_visibility': instance.restrictedVisibility, + 'shadowed': instance.shadowed, + 'shared_location': instance.sharedLocation?.toJson(), + 'show_in_channel': instance.showInChannel, + 'silent': instance.silent, + 'text': instance.text, + 'thread_participants': instance.threadParticipants?.map((e) => e.toJson()).toList(), + 'type': instance.type, + 'updated_at': const StreamDateTimeConverter().toJson(instance.updatedAt), + 'user': instance.user.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/search_roles_response.dart b/packages/stream_chat/lib/open_api/model/search_roles_response.dart new file mode 100644 index 0000000000..df61c4df27 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/search_roles_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'search_roles_response.g.dart'; +part 'search_roles_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class SearchRolesResponse with _$SearchRolesResponse { + const SearchRolesResponse({ + required this.duration, + required this.roles, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'roles') + final List roles; + + Map toJson() => _$SearchRolesResponseToJson(this); + + static SearchRolesResponse fromJson(Map json) => _$SearchRolesResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/search_roles_response.freezed.dart b/packages/stream_chat/lib/open_api/model/search_roles_response.freezed.dart new file mode 100644 index 0000000000..369f530526 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/search_roles_response.freezed.dart @@ -0,0 +1,86 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'search_roles_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$SearchRolesResponse { + String get duration; + List get roles; + + /// Create a copy of SearchRolesResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $SearchRolesResponseCopyWith get copyWith => + _$SearchRolesResponseCopyWithImpl( + this as SearchRolesResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is SearchRolesResponse && + (identical(other.duration, duration) || other.duration == duration) && + const DeepCollectionEquality().equals(other.roles, roles)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + duration, + const DeepCollectionEquality().hash(roles), + ); + + @override + String toString() { + return 'SearchRolesResponse(duration: $duration, roles: $roles)'; + } +} + +/// @nodoc +abstract mixin class $SearchRolesResponseCopyWith<$Res> { + factory $SearchRolesResponseCopyWith( + SearchRolesResponse value, + $Res Function(SearchRolesResponse) _then, + ) = _$SearchRolesResponseCopyWithImpl; + @useResult + $Res call({String duration, List roles}); +} + +/// @nodoc +class _$SearchRolesResponseCopyWithImpl<$Res> implements $SearchRolesResponseCopyWith<$Res> { + _$SearchRolesResponseCopyWithImpl(this._self, this._then); + + final SearchRolesResponse _self; + final $Res Function(SearchRolesResponse) _then; + + /// Create a copy of SearchRolesResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? roles = null}) { + return _then( + SearchRolesResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + roles: null == roles + ? _self.roles + : roles // ignore: cast_nullable_to_non_nullable + as List, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/search_roles_response.g.dart b/packages/stream_chat/lib/open_api/model/search_roles_response.g.dart new file mode 100644 index 0000000000..4c167b82c9 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/search_roles_response.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'search_roles_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +SearchRolesResponse _$SearchRolesResponseFromJson(Map json) => SearchRolesResponse( + duration: json['duration'] as String, + roles: (json['roles'] as List).map((e) => Role.fromJson(e as Map)).toList(), +); + +Map _$SearchRolesResponseToJson( + SearchRolesResponse instance, +) => { + 'duration': instance.duration, + 'roles': instance.roles.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/search_user_groups_response.dart b/packages/stream_chat/lib/open_api/model/search_user_groups_response.dart new file mode 100644 index 0000000000..8f19ed4a24 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/search_user_groups_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'search_user_groups_response.g.dart'; +part 'search_user_groups_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class SearchUserGroupsResponse with _$SearchUserGroupsResponse { + const SearchUserGroupsResponse({ + required this.duration, + required this.userGroups, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'user_groups') + final List userGroups; + + Map toJson() => _$SearchUserGroupsResponseToJson(this); + + static SearchUserGroupsResponse fromJson(Map json) => _$SearchUserGroupsResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/search_user_groups_response.freezed.dart b/packages/stream_chat/lib/open_api/model/search_user_groups_response.freezed.dart new file mode 100644 index 0000000000..5ca558bc95 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/search_user_groups_response.freezed.dart @@ -0,0 +1,89 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'search_user_groups_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$SearchUserGroupsResponse { + String get duration; + List get userGroups; + + /// Create a copy of SearchUserGroupsResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $SearchUserGroupsResponseCopyWith get copyWith => + _$SearchUserGroupsResponseCopyWithImpl( + this as SearchUserGroupsResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is SearchUserGroupsResponse && + (identical(other.duration, duration) || other.duration == duration) && + const DeepCollectionEquality().equals( + other.userGroups, + userGroups, + )); + } + + @override + int get hashCode => Object.hash( + runtimeType, + duration, + const DeepCollectionEquality().hash(userGroups), + ); + + @override + String toString() { + return 'SearchUserGroupsResponse(duration: $duration, userGroups: $userGroups)'; + } +} + +/// @nodoc +abstract mixin class $SearchUserGroupsResponseCopyWith<$Res> { + factory $SearchUserGroupsResponseCopyWith( + SearchUserGroupsResponse value, + $Res Function(SearchUserGroupsResponse) _then, + ) = _$SearchUserGroupsResponseCopyWithImpl; + @useResult + $Res call({String duration, List userGroups}); +} + +/// @nodoc +class _$SearchUserGroupsResponseCopyWithImpl<$Res> implements $SearchUserGroupsResponseCopyWith<$Res> { + _$SearchUserGroupsResponseCopyWithImpl(this._self, this._then); + + final SearchUserGroupsResponse _self; + final $Res Function(SearchUserGroupsResponse) _then; + + /// Create a copy of SearchUserGroupsResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? userGroups = null}) { + return _then( + SearchUserGroupsResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + userGroups: null == userGroups + ? _self.userGroups + : userGroups // ignore: cast_nullable_to_non_nullable + as List, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/search_user_groups_response.g.dart b/packages/stream_chat/lib/open_api/model/search_user_groups_response.g.dart new file mode 100644 index 0000000000..b4b81d890b --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/search_user_groups_response.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'search_user_groups_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +SearchUserGroupsResponse _$SearchUserGroupsResponseFromJson( + Map json, +) => SearchUserGroupsResponse( + duration: json['duration'] as String, + userGroups: (json['user_groups'] as List) + .map((e) => UserGroupResponse.fromJson(e as Map)) + .toList(), +); + +Map _$SearchUserGroupsResponseToJson( + SearchUserGroupsResponse instance, +) => { + 'duration': instance.duration, + 'user_groups': instance.userGroups.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/search_warning.dart b/packages/stream_chat/lib/open_api/model/search_warning.dart new file mode 100644 index 0000000000..c126ab0783 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/search_warning.dart @@ -0,0 +1,46 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'search_warning.g.dart'; +part 'search_warning.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class SearchWarning with _$SearchWarning { + const SearchWarning({ + this.channelSearchCids, + this.channelSearchCount, + required this.warningCode, + required this.warningDescription, + }); + + @override + @JsonKey(name: 'channel_search_cids') + final List? channelSearchCids; + + @override + @JsonKey(name: 'channel_search_count') + final int? channelSearchCount; + + @override + @JsonKey(name: 'warning_code') + final int warningCode; + + @override + @JsonKey(name: 'warning_description') + final String warningDescription; + + Map toJson() => _$SearchWarningToJson(this); + + static SearchWarning fromJson(Map json) => _$SearchWarningFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/search_warning.freezed.dart b/packages/stream_chat/lib/open_api/model/search_warning.freezed.dart new file mode 100644 index 0000000000..0201cd158a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/search_warning.freezed.dart @@ -0,0 +1,114 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'search_warning.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$SearchWarning { + List? get channelSearchCids; + int? get channelSearchCount; + int get warningCode; + String get warningDescription; + + /// Create a copy of SearchWarning + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $SearchWarningCopyWith get copyWith => _$SearchWarningCopyWithImpl( + this as SearchWarning, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is SearchWarning && + const DeepCollectionEquality().equals( + other.channelSearchCids, + channelSearchCids, + ) && + (identical(other.channelSearchCount, channelSearchCount) || + other.channelSearchCount == channelSearchCount) && + (identical(other.warningCode, warningCode) || other.warningCode == warningCode) && + (identical(other.warningDescription, warningDescription) || + other.warningDescription == warningDescription)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(channelSearchCids), + channelSearchCount, + warningCode, + warningDescription, + ); + + @override + String toString() { + return 'SearchWarning(channelSearchCids: $channelSearchCids, channelSearchCount: $channelSearchCount, warningCode: $warningCode, warningDescription: $warningDescription)'; + } +} + +/// @nodoc +abstract mixin class $SearchWarningCopyWith<$Res> { + factory $SearchWarningCopyWith( + SearchWarning value, + $Res Function(SearchWarning) _then, + ) = _$SearchWarningCopyWithImpl; + @useResult + $Res call({ + List? channelSearchCids, + int? channelSearchCount, + int warningCode, + String warningDescription, + }); +} + +/// @nodoc +class _$SearchWarningCopyWithImpl<$Res> implements $SearchWarningCopyWith<$Res> { + _$SearchWarningCopyWithImpl(this._self, this._then); + + final SearchWarning _self; + final $Res Function(SearchWarning) _then; + + /// Create a copy of SearchWarning + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channelSearchCids = freezed, + Object? channelSearchCount = freezed, + Object? warningCode = null, + Object? warningDescription = null, + }) { + return _then( + SearchWarning( + channelSearchCids: freezed == channelSearchCids + ? _self.channelSearchCids + : channelSearchCids // ignore: cast_nullable_to_non_nullable + as List?, + channelSearchCount: freezed == channelSearchCount + ? _self.channelSearchCount + : channelSearchCount // ignore: cast_nullable_to_non_nullable + as int?, + warningCode: null == warningCode + ? _self.warningCode + : warningCode // ignore: cast_nullable_to_non_nullable + as int, + warningDescription: null == warningDescription + ? _self.warningDescription + : warningDescription // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/search_warning.g.dart b/packages/stream_chat/lib/open_api/model/search_warning.g.dart new file mode 100644 index 0000000000..97ff02c21f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/search_warning.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'search_warning.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +SearchWarning _$SearchWarningFromJson(Map json) => SearchWarning( + channelSearchCids: (json['channel_search_cids'] as List?)?.map((e) => e as String).toList(), + channelSearchCount: (json['channel_search_count'] as num?)?.toInt(), + warningCode: (json['warning_code'] as num).toInt(), + warningDescription: json['warning_description'] as String, +); + +Map _$SearchWarningToJson(SearchWarning instance) => { + 'channel_search_cids': instance.channelSearchCids, + 'channel_search_count': instance.channelSearchCount, + 'warning_code': instance.warningCode, + 'warning_description': instance.warningDescription, +}; diff --git a/packages/stream_chat/lib/open_api/model/send_event_request.dart b/packages/stream_chat/lib/open_api/model/send_event_request.dart new file mode 100644 index 0000000000..a74cbe92a1 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/send_event_request.dart @@ -0,0 +1,31 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'send_event_request.g.dart'; +part 'send_event_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class SendEventRequest with _$SendEventRequest { + const SendEventRequest({ + required this.event, + }); + + @override + @JsonKey(name: 'event') + final EventRequest event; + + Map toJson() => _$SendEventRequestToJson(this); + + static SendEventRequest fromJson(Map json) => _$SendEventRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/send_event_request.freezed.dart b/packages/stream_chat/lib/open_api/model/send_event_request.freezed.dart new file mode 100644 index 0000000000..b8361c7089 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/send_event_request.freezed.dart @@ -0,0 +1,75 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'send_event_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$SendEventRequest { + EventRequest get event; + + /// Create a copy of SendEventRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $SendEventRequestCopyWith get copyWith => _$SendEventRequestCopyWithImpl( + this as SendEventRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is SendEventRequest && + (identical(other.event, event) || other.event == event)); + } + + @override + int get hashCode => Object.hash(runtimeType, event); + + @override + String toString() { + return 'SendEventRequest(event: $event)'; + } +} + +/// @nodoc +abstract mixin class $SendEventRequestCopyWith<$Res> { + factory $SendEventRequestCopyWith( + SendEventRequest value, + $Res Function(SendEventRequest) _then, + ) = _$SendEventRequestCopyWithImpl; + @useResult + $Res call({EventRequest event}); +} + +/// @nodoc +class _$SendEventRequestCopyWithImpl<$Res> implements $SendEventRequestCopyWith<$Res> { + _$SendEventRequestCopyWithImpl(this._self, this._then); + + final SendEventRequest _self; + final $Res Function(SendEventRequest) _then; + + /// Create a copy of SendEventRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? event = null}) { + return _then( + SendEventRequest( + event: null == event + ? _self.event + : event // ignore: cast_nullable_to_non_nullable + as EventRequest, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/send_event_request.g.dart b/packages/stream_chat/lib/open_api/model/send_event_request.g.dart new file mode 100644 index 0000000000..2a226926f5 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/send_event_request.g.dart @@ -0,0 +1,15 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'send_event_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +SendEventRequest _$SendEventRequestFromJson(Map json) => SendEventRequest( + event: EventRequest.fromJson(json['event'] as Map), +); + +Map _$SendEventRequestToJson(SendEventRequest instance) => { + 'event': instance.event.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/send_message_request.dart b/packages/stream_chat/lib/open_api/model/send_message_request.dart new file mode 100644 index 0000000000..246296205d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/send_message_request.dart @@ -0,0 +1,56 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'send_message_request.g.dart'; +part 'send_message_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class SendMessageRequest with _$SendMessageRequest { + const SendMessageRequest({ + this.includeChannelContext, + this.includeMentionedMembers, + this.keepChannelHidden, + required this.message, + this.skipEnrichUrl, + this.skipPush, + }); + + @override + @JsonKey(name: 'include_channel_context') + final bool? includeChannelContext; + + @override + @JsonKey(name: 'include_mentioned_members') + final bool? includeMentionedMembers; + + @override + @JsonKey(name: 'keep_channel_hidden') + final bool? keepChannelHidden; + + @override + @JsonKey(name: 'message') + final MessageRequest message; + + @override + @JsonKey(name: 'skip_enrich_url') + final bool? skipEnrichUrl; + + @override + @JsonKey(name: 'skip_push') + final bool? skipPush; + + Map toJson() => _$SendMessageRequestToJson(this); + + static SendMessageRequest fromJson(Map json) => _$SendMessageRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/send_message_request.freezed.dart b/packages/stream_chat/lib/open_api/model/send_message_request.freezed.dart new file mode 100644 index 0000000000..a2ca5d59aa --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/send_message_request.freezed.dart @@ -0,0 +1,132 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'send_message_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$SendMessageRequest { + bool? get includeChannelContext; + bool? get includeMentionedMembers; + bool? get keepChannelHidden; + MessageRequest get message; + bool? get skipEnrichUrl; + bool? get skipPush; + + /// Create a copy of SendMessageRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $SendMessageRequestCopyWith get copyWith => _$SendMessageRequestCopyWithImpl( + this as SendMessageRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is SendMessageRequest && + (identical(other.includeChannelContext, includeChannelContext) || + other.includeChannelContext == includeChannelContext) && + (identical( + other.includeMentionedMembers, + includeMentionedMembers, + ) || + other.includeMentionedMembers == includeMentionedMembers) && + (identical(other.keepChannelHidden, keepChannelHidden) || other.keepChannelHidden == keepChannelHidden) && + (identical(other.message, message) || other.message == message) && + (identical(other.skipEnrichUrl, skipEnrichUrl) || other.skipEnrichUrl == skipEnrichUrl) && + (identical(other.skipPush, skipPush) || other.skipPush == skipPush)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + includeChannelContext, + includeMentionedMembers, + keepChannelHidden, + message, + skipEnrichUrl, + skipPush, + ); + + @override + String toString() { + return 'SendMessageRequest(includeChannelContext: $includeChannelContext, includeMentionedMembers: $includeMentionedMembers, keepChannelHidden: $keepChannelHidden, message: $message, skipEnrichUrl: $skipEnrichUrl, skipPush: $skipPush)'; + } +} + +/// @nodoc +abstract mixin class $SendMessageRequestCopyWith<$Res> { + factory $SendMessageRequestCopyWith( + SendMessageRequest value, + $Res Function(SendMessageRequest) _then, + ) = _$SendMessageRequestCopyWithImpl; + @useResult + $Res call({ + bool? includeChannelContext, + bool? includeMentionedMembers, + bool? keepChannelHidden, + MessageRequest message, + bool? skipEnrichUrl, + bool? skipPush, + }); +} + +/// @nodoc +class _$SendMessageRequestCopyWithImpl<$Res> implements $SendMessageRequestCopyWith<$Res> { + _$SendMessageRequestCopyWithImpl(this._self, this._then); + + final SendMessageRequest _self; + final $Res Function(SendMessageRequest) _then; + + /// Create a copy of SendMessageRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? includeChannelContext = freezed, + Object? includeMentionedMembers = freezed, + Object? keepChannelHidden = freezed, + Object? message = null, + Object? skipEnrichUrl = freezed, + Object? skipPush = freezed, + }) { + return _then( + SendMessageRequest( + includeChannelContext: freezed == includeChannelContext + ? _self.includeChannelContext + : includeChannelContext // ignore: cast_nullable_to_non_nullable + as bool?, + includeMentionedMembers: freezed == includeMentionedMembers + ? _self.includeMentionedMembers + : includeMentionedMembers // ignore: cast_nullable_to_non_nullable + as bool?, + keepChannelHidden: freezed == keepChannelHidden + ? _self.keepChannelHidden + : keepChannelHidden // ignore: cast_nullable_to_non_nullable + as bool?, + message: null == message + ? _self.message + : message // ignore: cast_nullable_to_non_nullable + as MessageRequest, + skipEnrichUrl: freezed == skipEnrichUrl + ? _self.skipEnrichUrl + : skipEnrichUrl // ignore: cast_nullable_to_non_nullable + as bool?, + skipPush: freezed == skipPush + ? _self.skipPush + : skipPush // ignore: cast_nullable_to_non_nullable + as bool?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/send_message_request.g.dart b/packages/stream_chat/lib/open_api/model/send_message_request.g.dart new file mode 100644 index 0000000000..11848d30b6 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/send_message_request.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'send_message_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +SendMessageRequest _$SendMessageRequestFromJson(Map json) => SendMessageRequest( + includeChannelContext: json['include_channel_context'] as bool?, + includeMentionedMembers: json['include_mentioned_members'] as bool?, + keepChannelHidden: json['keep_channel_hidden'] as bool?, + message: MessageRequest.fromJson(json['message'] as Map), + skipEnrichUrl: json['skip_enrich_url'] as bool?, + skipPush: json['skip_push'] as bool?, +); + +Map _$SendMessageRequestToJson(SendMessageRequest instance) => { + 'include_channel_context': instance.includeChannelContext, + 'include_mentioned_members': instance.includeMentionedMembers, + 'keep_channel_hidden': instance.keepChannelHidden, + 'message': instance.message.toJson(), + 'skip_enrich_url': instance.skipEnrichUrl, + 'skip_push': instance.skipPush, +}; diff --git a/packages/stream_chat/lib/open_api/model/send_message_response.dart b/packages/stream_chat/lib/open_api/model/send_message_response.dart new file mode 100644 index 0000000000..ef30ec1575 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/send_message_response.dart @@ -0,0 +1,46 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'send_message_response.g.dart'; +part 'send_message_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class SendMessageResponse with _$SendMessageResponse { + const SendMessageResponse({ + this.channelContext, + required this.duration, + this.mentionedMembers, + required this.message, + }); + + @override + @JsonKey(name: 'channel_context') + final ChannelContextResponse? channelContext; + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'mentioned_members') + final Map? mentionedMembers; + + @override + @JsonKey(name: 'message') + final MessageResponse message; + + Map toJson() => _$SendMessageResponseToJson(this); + + static SendMessageResponse fromJson(Map json) => _$SendMessageResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/send_message_response.freezed.dart b/packages/stream_chat/lib/open_api/model/send_message_response.freezed.dart new file mode 100644 index 0000000000..687f59dff5 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/send_message_response.freezed.dart @@ -0,0 +1,113 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'send_message_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$SendMessageResponse { + ChannelContextResponse? get channelContext; + String get duration; + Map? get mentionedMembers; + MessageResponse get message; + + /// Create a copy of SendMessageResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $SendMessageResponseCopyWith get copyWith => + _$SendMessageResponseCopyWithImpl( + this as SendMessageResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is SendMessageResponse && + (identical(other.channelContext, channelContext) || other.channelContext == channelContext) && + (identical(other.duration, duration) || other.duration == duration) && + const DeepCollectionEquality().equals( + other.mentionedMembers, + mentionedMembers, + ) && + (identical(other.message, message) || other.message == message)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channelContext, + duration, + const DeepCollectionEquality().hash(mentionedMembers), + message, + ); + + @override + String toString() { + return 'SendMessageResponse(channelContext: $channelContext, duration: $duration, mentionedMembers: $mentionedMembers, message: $message)'; + } +} + +/// @nodoc +abstract mixin class $SendMessageResponseCopyWith<$Res> { + factory $SendMessageResponseCopyWith( + SendMessageResponse value, + $Res Function(SendMessageResponse) _then, + ) = _$SendMessageResponseCopyWithImpl; + @useResult + $Res call({ + ChannelContextResponse? channelContext, + String duration, + Map? mentionedMembers, + MessageResponse message, + }); +} + +/// @nodoc +class _$SendMessageResponseCopyWithImpl<$Res> implements $SendMessageResponseCopyWith<$Res> { + _$SendMessageResponseCopyWithImpl(this._self, this._then); + + final SendMessageResponse _self; + final $Res Function(SendMessageResponse) _then; + + /// Create a copy of SendMessageResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channelContext = freezed, + Object? duration = null, + Object? mentionedMembers = freezed, + Object? message = null, + }) { + return _then( + SendMessageResponse( + channelContext: freezed == channelContext + ? _self.channelContext + : channelContext // ignore: cast_nullable_to_non_nullable + as ChannelContextResponse?, + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + mentionedMembers: freezed == mentionedMembers + ? _self.mentionedMembers + : mentionedMembers // ignore: cast_nullable_to_non_nullable + as Map?, + message: null == message + ? _self.message + : message // ignore: cast_nullable_to_non_nullable + as MessageResponse, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/send_message_response.g.dart b/packages/stream_chat/lib/open_api/model/send_message_response.g.dart new file mode 100644 index 0000000000..87ee861ea6 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/send_message_response.g.dart @@ -0,0 +1,29 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'send_message_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +SendMessageResponse _$SendMessageResponseFromJson(Map json) => SendMessageResponse( + channelContext: json['channel_context'] == null + ? null + : ChannelContextResponse.fromJson( + json['channel_context'] as Map, + ), + duration: json['duration'] as String, + mentionedMembers: (json['mentioned_members'] as Map?)?.map((k, e) => MapEntry(k, e as bool)), + message: MessageResponse.fromJson( + json['message'] as Map, + ), +); + +Map _$SendMessageResponseToJson( + SendMessageResponse instance, +) => { + 'channel_context': instance.channelContext?.toJson(), + 'duration': instance.duration, + 'mentioned_members': instance.mentionedMembers, + 'message': instance.message.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/send_reaction_request.dart b/packages/stream_chat/lib/open_api/model/send_reaction_request.dart new file mode 100644 index 0000000000..a6b17471e7 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/send_reaction_request.dart @@ -0,0 +1,41 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'send_reaction_request.g.dart'; +part 'send_reaction_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class SendReactionRequest with _$SendReactionRequest { + const SendReactionRequest({ + this.enforceUnique, + required this.reaction, + this.skipPush, + }); + + @override + @JsonKey(name: 'enforce_unique') + final bool? enforceUnique; + + @override + @JsonKey(name: 'reaction') + final ReactionRequest reaction; + + @override + @JsonKey(name: 'skip_push') + final bool? skipPush; + + Map toJson() => _$SendReactionRequestToJson(this); + + static SendReactionRequest fromJson(Map json) => _$SendReactionRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/send_reaction_request.freezed.dart b/packages/stream_chat/lib/open_api/model/send_reaction_request.freezed.dart new file mode 100644 index 0000000000..1b4c6b3a1c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/send_reaction_request.freezed.dart @@ -0,0 +1,92 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'send_reaction_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$SendReactionRequest { + bool? get enforceUnique; + ReactionRequest get reaction; + bool? get skipPush; + + /// Create a copy of SendReactionRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $SendReactionRequestCopyWith get copyWith => + _$SendReactionRequestCopyWithImpl( + this as SendReactionRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is SendReactionRequest && + (identical(other.enforceUnique, enforceUnique) || other.enforceUnique == enforceUnique) && + (identical(other.reaction, reaction) || other.reaction == reaction) && + (identical(other.skipPush, skipPush) || other.skipPush == skipPush)); + } + + @override + int get hashCode => Object.hash(runtimeType, enforceUnique, reaction, skipPush); + + @override + String toString() { + return 'SendReactionRequest(enforceUnique: $enforceUnique, reaction: $reaction, skipPush: $skipPush)'; + } +} + +/// @nodoc +abstract mixin class $SendReactionRequestCopyWith<$Res> { + factory $SendReactionRequestCopyWith( + SendReactionRequest value, + $Res Function(SendReactionRequest) _then, + ) = _$SendReactionRequestCopyWithImpl; + @useResult + $Res call({bool? enforceUnique, ReactionRequest reaction, bool? skipPush}); +} + +/// @nodoc +class _$SendReactionRequestCopyWithImpl<$Res> implements $SendReactionRequestCopyWith<$Res> { + _$SendReactionRequestCopyWithImpl(this._self, this._then); + + final SendReactionRequest _self; + final $Res Function(SendReactionRequest) _then; + + /// Create a copy of SendReactionRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? enforceUnique = freezed, + Object? reaction = null, + Object? skipPush = freezed, + }) { + return _then( + SendReactionRequest( + enforceUnique: freezed == enforceUnique + ? _self.enforceUnique + : enforceUnique // ignore: cast_nullable_to_non_nullable + as bool?, + reaction: null == reaction + ? _self.reaction + : reaction // ignore: cast_nullable_to_non_nullable + as ReactionRequest, + skipPush: freezed == skipPush + ? _self.skipPush + : skipPush // ignore: cast_nullable_to_non_nullable + as bool?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/send_reaction_request.g.dart b/packages/stream_chat/lib/open_api/model/send_reaction_request.g.dart new file mode 100644 index 0000000000..2d1c3f757a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/send_reaction_request.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'send_reaction_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +SendReactionRequest _$SendReactionRequestFromJson(Map json) => SendReactionRequest( + enforceUnique: json['enforce_unique'] as bool?, + reaction: ReactionRequest.fromJson( + json['reaction'] as Map, + ), + skipPush: json['skip_push'] as bool?, +); + +Map _$SendReactionRequestToJson( + SendReactionRequest instance, +) => { + 'enforce_unique': instance.enforceUnique, + 'reaction': instance.reaction.toJson(), + 'skip_push': instance.skipPush, +}; diff --git a/packages/stream_chat/lib/open_api/model/send_reaction_response.dart b/packages/stream_chat/lib/open_api/model/send_reaction_response.dart new file mode 100644 index 0000000000..d304d61ea9 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/send_reaction_response.dart @@ -0,0 +1,41 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'send_reaction_response.g.dart'; +part 'send_reaction_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class SendReactionResponse with _$SendReactionResponse { + const SendReactionResponse({ + required this.duration, + required this.message, + required this.reaction, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'message') + final MessageResponse message; + + @override + @JsonKey(name: 'reaction') + final ReactionResponse reaction; + + Map toJson() => _$SendReactionResponseToJson(this); + + static SendReactionResponse fromJson(Map json) => _$SendReactionResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/send_reaction_response.freezed.dart b/packages/stream_chat/lib/open_api/model/send_reaction_response.freezed.dart new file mode 100644 index 0000000000..49e3e32af3 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/send_reaction_response.freezed.dart @@ -0,0 +1,96 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'send_reaction_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$SendReactionResponse { + String get duration; + MessageResponse get message; + ReactionResponse get reaction; + + /// Create a copy of SendReactionResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $SendReactionResponseCopyWith get copyWith => + _$SendReactionResponseCopyWithImpl( + this as SendReactionResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is SendReactionResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.message, message) || other.message == message) && + (identical(other.reaction, reaction) || other.reaction == reaction)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration, message, reaction); + + @override + String toString() { + return 'SendReactionResponse(duration: $duration, message: $message, reaction: $reaction)'; + } +} + +/// @nodoc +abstract mixin class $SendReactionResponseCopyWith<$Res> { + factory $SendReactionResponseCopyWith( + SendReactionResponse value, + $Res Function(SendReactionResponse) _then, + ) = _$SendReactionResponseCopyWithImpl; + @useResult + $Res call({ + String duration, + MessageResponse message, + ReactionResponse reaction, + }); +} + +/// @nodoc +class _$SendReactionResponseCopyWithImpl<$Res> implements $SendReactionResponseCopyWith<$Res> { + _$SendReactionResponseCopyWithImpl(this._self, this._then); + + final SendReactionResponse _self; + final $Res Function(SendReactionResponse) _then; + + /// Create a copy of SendReactionResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? duration = null, + Object? message = null, + Object? reaction = null, + }) { + return _then( + SendReactionResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + message: null == message + ? _self.message + : message // ignore: cast_nullable_to_non_nullable + as MessageResponse, + reaction: null == reaction + ? _self.reaction + : reaction // ignore: cast_nullable_to_non_nullable + as ReactionResponse, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/send_reaction_response.g.dart b/packages/stream_chat/lib/open_api/model/send_reaction_response.g.dart new file mode 100644 index 0000000000..06f39d8531 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/send_reaction_response.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'send_reaction_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +SendReactionResponse _$SendReactionResponseFromJson( + Map json, +) => SendReactionResponse( + duration: json['duration'] as String, + message: MessageResponse.fromJson(json['message'] as Map), + reaction: ReactionResponse.fromJson(json['reaction'] as Map), +); + +Map _$SendReactionResponseToJson( + SendReactionResponse instance, +) => { + 'duration': instance.duration, + 'message': instance.message.toJson(), + 'reaction': instance.reaction.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/shadow_block_action_request_payload.dart b/packages/stream_chat/lib/open_api/model/shadow_block_action_request_payload.dart new file mode 100644 index 0000000000..56c8b47215 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/shadow_block_action_request_payload.dart @@ -0,0 +1,32 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'shadow_block_action_request_payload.g.dart'; +part 'shadow_block_action_request_payload.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ShadowBlockActionRequestPayload with _$ShadowBlockActionRequestPayload { + const ShadowBlockActionRequestPayload({ + this.reason, + }); + + @override + @JsonKey(name: 'reason') + final String? reason; + + Map toJson() => _$ShadowBlockActionRequestPayloadToJson(this); + + static ShadowBlockActionRequestPayload fromJson(Map json) => + _$ShadowBlockActionRequestPayloadFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/shadow_block_action_request_payload.freezed.dart b/packages/stream_chat/lib/open_api/model/shadow_block_action_request_payload.freezed.dart new file mode 100644 index 0000000000..33560488f7 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/shadow_block_action_request_payload.freezed.dart @@ -0,0 +1,76 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'shadow_block_action_request_payload.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ShadowBlockActionRequestPayload { + String? get reason; + + /// Create a copy of ShadowBlockActionRequestPayload + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ShadowBlockActionRequestPayloadCopyWith get copyWith => + _$ShadowBlockActionRequestPayloadCopyWithImpl( + this as ShadowBlockActionRequestPayload, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ShadowBlockActionRequestPayload && + (identical(other.reason, reason) || other.reason == reason)); + } + + @override + int get hashCode => Object.hash(runtimeType, reason); + + @override + String toString() { + return 'ShadowBlockActionRequestPayload(reason: $reason)'; + } +} + +/// @nodoc +abstract mixin class $ShadowBlockActionRequestPayloadCopyWith<$Res> { + factory $ShadowBlockActionRequestPayloadCopyWith( + ShadowBlockActionRequestPayload value, + $Res Function(ShadowBlockActionRequestPayload) _then, + ) = _$ShadowBlockActionRequestPayloadCopyWithImpl; + @useResult + $Res call({String? reason}); +} + +/// @nodoc +class _$ShadowBlockActionRequestPayloadCopyWithImpl<$Res> implements $ShadowBlockActionRequestPayloadCopyWith<$Res> { + _$ShadowBlockActionRequestPayloadCopyWithImpl(this._self, this._then); + + final ShadowBlockActionRequestPayload _self; + final $Res Function(ShadowBlockActionRequestPayload) _then; + + /// Create a copy of ShadowBlockActionRequestPayload + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? reason = freezed}) { + return _then( + ShadowBlockActionRequestPayload( + reason: freezed == reason + ? _self.reason + : reason // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/shadow_block_action_request_payload.g.dart b/packages/stream_chat/lib/open_api/model/shadow_block_action_request_payload.g.dart new file mode 100644 index 0000000000..f861ec4f47 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/shadow_block_action_request_payload.g.dart @@ -0,0 +1,15 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'shadow_block_action_request_payload.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ShadowBlockActionRequestPayload _$ShadowBlockActionRequestPayloadFromJson( + Map json, +) => ShadowBlockActionRequestPayload(reason: json['reason'] as String?); + +Map _$ShadowBlockActionRequestPayloadToJson( + ShadowBlockActionRequestPayload instance, +) => {'reason': instance.reason}; diff --git a/packages/stream_chat/lib/open_api/model/shared_location.dart b/packages/stream_chat/lib/open_api/model/shared_location.dart new file mode 100644 index 0000000000..c6d25979d5 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/shared_location.dart @@ -0,0 +1,47 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'shared_location.g.dart'; +part 'shared_location.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class SharedLocation with _$SharedLocation { + const SharedLocation({ + this.createdByDeviceId, + this.endAt, + required this.latitude, + required this.longitude, + }); + + @override + @JsonKey(name: 'created_by_device_id') + final String? createdByDeviceId; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'end_at') + final DateTime? endAt; + + @override + @JsonKey(name: 'latitude') + final double latitude; + + @override + @JsonKey(name: 'longitude') + final double longitude; + + Map toJson() => _$SharedLocationToJson(this); + + static SharedLocation fromJson(Map json) => _$SharedLocationFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/shared_location.freezed.dart b/packages/stream_chat/lib/open_api/model/shared_location.freezed.dart new file mode 100644 index 0000000000..c5a27b7a89 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/shared_location.freezed.dart @@ -0,0 +1,103 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'shared_location.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$SharedLocation { + String? get createdByDeviceId; + DateTime? get endAt; + double get latitude; + double get longitude; + + /// Create a copy of SharedLocation + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $SharedLocationCopyWith get copyWith => _$SharedLocationCopyWithImpl( + this as SharedLocation, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is SharedLocation && + (identical(other.createdByDeviceId, createdByDeviceId) || other.createdByDeviceId == createdByDeviceId) && + (identical(other.endAt, endAt) || other.endAt == endAt) && + (identical(other.latitude, latitude) || other.latitude == latitude) && + (identical(other.longitude, longitude) || other.longitude == longitude)); + } + + @override + int get hashCode => Object.hash(runtimeType, createdByDeviceId, endAt, latitude, longitude); + + @override + String toString() { + return 'SharedLocation(createdByDeviceId: $createdByDeviceId, endAt: $endAt, latitude: $latitude, longitude: $longitude)'; + } +} + +/// @nodoc +abstract mixin class $SharedLocationCopyWith<$Res> { + factory $SharedLocationCopyWith( + SharedLocation value, + $Res Function(SharedLocation) _then, + ) = _$SharedLocationCopyWithImpl; + @useResult + $Res call({ + String? createdByDeviceId, + DateTime? endAt, + double latitude, + double longitude, + }); +} + +/// @nodoc +class _$SharedLocationCopyWithImpl<$Res> implements $SharedLocationCopyWith<$Res> { + _$SharedLocationCopyWithImpl(this._self, this._then); + + final SharedLocation _self; + final $Res Function(SharedLocation) _then; + + /// Create a copy of SharedLocation + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? createdByDeviceId = freezed, + Object? endAt = freezed, + Object? latitude = null, + Object? longitude = null, + }) { + return _then( + SharedLocation( + createdByDeviceId: freezed == createdByDeviceId + ? _self.createdByDeviceId + : createdByDeviceId // ignore: cast_nullable_to_non_nullable + as String?, + endAt: freezed == endAt + ? _self.endAt + : endAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + latitude: null == latitude + ? _self.latitude + : latitude // ignore: cast_nullable_to_non_nullable + as double, + longitude: null == longitude + ? _self.longitude + : longitude // ignore: cast_nullable_to_non_nullable + as double, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/shared_location.g.dart b/packages/stream_chat/lib/open_api/model/shared_location.g.dart new file mode 100644 index 0000000000..72917aa82b --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/shared_location.g.dart @@ -0,0 +1,37 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'shared_location.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +SharedLocation _$SharedLocationFromJson(Map json) => SharedLocation( + createdByDeviceId: json['created_by_device_id'] as String?, + endAt: _$JsonConverterFromJson( + json['end_at'], + const StreamDateTimeConverter().fromJson, + ), + latitude: (json['latitude'] as num).toDouble(), + longitude: (json['longitude'] as num).toDouble(), +); + +Map _$SharedLocationToJson(SharedLocation instance) => { + 'created_by_device_id': instance.createdByDeviceId, + 'end_at': _$JsonConverterToJson( + instance.endAt, + const StreamDateTimeConverter().toJson, + ), + 'latitude': instance.latitude, + 'longitude': instance.longitude, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/shared_location_response.dart b/packages/stream_chat/lib/open_api/model/shared_location_response.dart new file mode 100644 index 0000000000..0e4bec09eb --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/shared_location_response.dart @@ -0,0 +1,89 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'shared_location_response.g.dart'; +part 'shared_location_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class SharedLocationResponse with _$SharedLocationResponse { + const SharedLocationResponse({ + this.channel, + required this.channelCid, + required this.createdAt, + required this.createdByDeviceId, + required this.duration, + this.endAt, + required this.latitude, + required this.longitude, + this.message, + required this.messageId, + required this.updatedAt, + required this.userId, + }); + + @override + @JsonKey(name: 'channel') + final ChannelResponse? channel; + + @override + @JsonKey(name: 'channel_cid') + final String channelCid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'created_by_device_id') + final String createdByDeviceId; + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'end_at') + final DateTime? endAt; + + @override + @JsonKey(name: 'latitude') + final double latitude; + + @override + @JsonKey(name: 'longitude') + final double longitude; + + @override + @JsonKey(name: 'message') + final MessageResponse? message; + + @override + @JsonKey(name: 'message_id') + final String messageId; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'updated_at') + final DateTime updatedAt; + + @override + @JsonKey(name: 'user_id') + final String userId; + + Map toJson() => _$SharedLocationResponseToJson(this); + + static SharedLocationResponse fromJson(Map json) => _$SharedLocationResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/shared_location_response.freezed.dart b/packages/stream_chat/lib/open_api/model/shared_location_response.freezed.dart new file mode 100644 index 0000000000..73513ea882 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/shared_location_response.freezed.dart @@ -0,0 +1,182 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'shared_location_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$SharedLocationResponse { + ChannelResponse? get channel; + String get channelCid; + DateTime get createdAt; + String get createdByDeviceId; + String get duration; + DateTime? get endAt; + double get latitude; + double get longitude; + MessageResponse? get message; + String get messageId; + DateTime get updatedAt; + String get userId; + + /// Create a copy of SharedLocationResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $SharedLocationResponseCopyWith get copyWith => + _$SharedLocationResponseCopyWithImpl( + this as SharedLocationResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is SharedLocationResponse && + (identical(other.channel, channel) || other.channel == channel) && + (identical(other.channelCid, channelCid) || other.channelCid == channelCid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.createdByDeviceId, createdByDeviceId) || other.createdByDeviceId == createdByDeviceId) && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.endAt, endAt) || other.endAt == endAt) && + (identical(other.latitude, latitude) || other.latitude == latitude) && + (identical(other.longitude, longitude) || other.longitude == longitude) && + (identical(other.message, message) || other.message == message) && + (identical(other.messageId, messageId) || other.messageId == messageId) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt) && + (identical(other.userId, userId) || other.userId == userId)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channel, + channelCid, + createdAt, + createdByDeviceId, + duration, + endAt, + latitude, + longitude, + message, + messageId, + updatedAt, + userId, + ); + + @override + String toString() { + return 'SharedLocationResponse(channel: $channel, channelCid: $channelCid, createdAt: $createdAt, createdByDeviceId: $createdByDeviceId, duration: $duration, endAt: $endAt, latitude: $latitude, longitude: $longitude, message: $message, messageId: $messageId, updatedAt: $updatedAt, userId: $userId)'; + } +} + +/// @nodoc +abstract mixin class $SharedLocationResponseCopyWith<$Res> { + factory $SharedLocationResponseCopyWith( + SharedLocationResponse value, + $Res Function(SharedLocationResponse) _then, + ) = _$SharedLocationResponseCopyWithImpl; + @useResult + $Res call({ + ChannelResponse? channel, + String channelCid, + DateTime createdAt, + String createdByDeviceId, + String duration, + DateTime? endAt, + double latitude, + double longitude, + MessageResponse? message, + String messageId, + DateTime updatedAt, + String userId, + }); +} + +/// @nodoc +class _$SharedLocationResponseCopyWithImpl<$Res> implements $SharedLocationResponseCopyWith<$Res> { + _$SharedLocationResponseCopyWithImpl(this._self, this._then); + + final SharedLocationResponse _self; + final $Res Function(SharedLocationResponse) _then; + + /// Create a copy of SharedLocationResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channel = freezed, + Object? channelCid = null, + Object? createdAt = null, + Object? createdByDeviceId = null, + Object? duration = null, + Object? endAt = freezed, + Object? latitude = null, + Object? longitude = null, + Object? message = freezed, + Object? messageId = null, + Object? updatedAt = null, + Object? userId = null, + }) { + return _then( + SharedLocationResponse( + channel: freezed == channel + ? _self.channel + : channel // ignore: cast_nullable_to_non_nullable + as ChannelResponse?, + channelCid: null == channelCid + ? _self.channelCid + : channelCid // ignore: cast_nullable_to_non_nullable + as String, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + createdByDeviceId: null == createdByDeviceId + ? _self.createdByDeviceId + : createdByDeviceId // ignore: cast_nullable_to_non_nullable + as String, + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + endAt: freezed == endAt + ? _self.endAt + : endAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + latitude: null == latitude + ? _self.latitude + : latitude // ignore: cast_nullable_to_non_nullable + as double, + longitude: null == longitude + ? _self.longitude + : longitude // ignore: cast_nullable_to_non_nullable + as double, + message: freezed == message + ? _self.message + : message // ignore: cast_nullable_to_non_nullable + as MessageResponse?, + messageId: null == messageId + ? _self.messageId + : messageId // ignore: cast_nullable_to_non_nullable + as String, + updatedAt: null == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + userId: null == userId + ? _self.userId + : userId // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/shared_location_response.g.dart b/packages/stream_chat/lib/open_api/model/shared_location_response.g.dart new file mode 100644 index 0000000000..a6876d80b6 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/shared_location_response.g.dart @@ -0,0 +1,61 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'shared_location_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +SharedLocationResponse _$SharedLocationResponseFromJson( + Map json, +) => SharedLocationResponse( + channel: json['channel'] == null ? null : ChannelResponse.fromJson(json['channel'] as Map), + channelCid: json['channel_cid'] as String, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + createdByDeviceId: json['created_by_device_id'] as String, + duration: json['duration'] as String, + endAt: _$JsonConverterFromJson( + json['end_at'], + const StreamDateTimeConverter().fromJson, + ), + latitude: (json['latitude'] as num).toDouble(), + longitude: (json['longitude'] as num).toDouble(), + message: json['message'] == null ? null : MessageResponse.fromJson(json['message'] as Map), + messageId: json['message_id'] as String, + updatedAt: const StreamDateTimeConverter().fromJson( + json['updated_at'] as Object, + ), + userId: json['user_id'] as String, +); + +Map _$SharedLocationResponseToJson( + SharedLocationResponse instance, +) => { + 'channel': instance.channel?.toJson(), + 'channel_cid': instance.channelCid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'created_by_device_id': instance.createdByDeviceId, + 'duration': instance.duration, + 'end_at': _$JsonConverterToJson( + instance.endAt, + const StreamDateTimeConverter().toJson, + ), + 'latitude': instance.latitude, + 'longitude': instance.longitude, + 'message': instance.message?.toJson(), + 'message_id': instance.messageId, + 'updated_at': const StreamDateTimeConverter().toJson(instance.updatedAt), + 'user_id': instance.userId, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/shared_location_response_data.dart b/packages/stream_chat/lib/open_api/model/shared_location_response_data.dart new file mode 100644 index 0000000000..ae3be3980d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/shared_location_response_data.dart @@ -0,0 +1,84 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'shared_location_response_data.g.dart'; +part 'shared_location_response_data.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class SharedLocationResponseData with _$SharedLocationResponseData { + const SharedLocationResponseData({ + this.channel, + required this.channelCid, + required this.createdAt, + required this.createdByDeviceId, + this.endAt, + required this.latitude, + required this.longitude, + this.message, + required this.messageId, + required this.updatedAt, + required this.userId, + }); + + @override + @JsonKey(name: 'channel') + final ChannelResponse? channel; + + @override + @JsonKey(name: 'channel_cid') + final String channelCid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'created_by_device_id') + final String createdByDeviceId; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'end_at') + final DateTime? endAt; + + @override + @JsonKey(name: 'latitude') + final double latitude; + + @override + @JsonKey(name: 'longitude') + final double longitude; + + @override + @JsonKey(name: 'message') + final MessageResponse? message; + + @override + @JsonKey(name: 'message_id') + final String messageId; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'updated_at') + final DateTime updatedAt; + + @override + @JsonKey(name: 'user_id') + final String userId; + + Map toJson() => _$SharedLocationResponseDataToJson(this); + + static SharedLocationResponseData fromJson(Map json) => _$SharedLocationResponseDataFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/shared_location_response_data.freezed.dart b/packages/stream_chat/lib/open_api/model/shared_location_response_data.freezed.dart new file mode 100644 index 0000000000..9f2a8496d7 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/shared_location_response_data.freezed.dart @@ -0,0 +1,173 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'shared_location_response_data.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$SharedLocationResponseData { + ChannelResponse? get channel; + String get channelCid; + DateTime get createdAt; + String get createdByDeviceId; + DateTime? get endAt; + double get latitude; + double get longitude; + MessageResponse? get message; + String get messageId; + DateTime get updatedAt; + String get userId; + + /// Create a copy of SharedLocationResponseData + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $SharedLocationResponseDataCopyWith get copyWith => + _$SharedLocationResponseDataCopyWithImpl( + this as SharedLocationResponseData, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is SharedLocationResponseData && + (identical(other.channel, channel) || other.channel == channel) && + (identical(other.channelCid, channelCid) || other.channelCid == channelCid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.createdByDeviceId, createdByDeviceId) || other.createdByDeviceId == createdByDeviceId) && + (identical(other.endAt, endAt) || other.endAt == endAt) && + (identical(other.latitude, latitude) || other.latitude == latitude) && + (identical(other.longitude, longitude) || other.longitude == longitude) && + (identical(other.message, message) || other.message == message) && + (identical(other.messageId, messageId) || other.messageId == messageId) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt) && + (identical(other.userId, userId) || other.userId == userId)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channel, + channelCid, + createdAt, + createdByDeviceId, + endAt, + latitude, + longitude, + message, + messageId, + updatedAt, + userId, + ); + + @override + String toString() { + return 'SharedLocationResponseData(channel: $channel, channelCid: $channelCid, createdAt: $createdAt, createdByDeviceId: $createdByDeviceId, endAt: $endAt, latitude: $latitude, longitude: $longitude, message: $message, messageId: $messageId, updatedAt: $updatedAt, userId: $userId)'; + } +} + +/// @nodoc +abstract mixin class $SharedLocationResponseDataCopyWith<$Res> { + factory $SharedLocationResponseDataCopyWith( + SharedLocationResponseData value, + $Res Function(SharedLocationResponseData) _then, + ) = _$SharedLocationResponseDataCopyWithImpl; + @useResult + $Res call({ + ChannelResponse? channel, + String channelCid, + DateTime createdAt, + String createdByDeviceId, + DateTime? endAt, + double latitude, + double longitude, + MessageResponse? message, + String messageId, + DateTime updatedAt, + String userId, + }); +} + +/// @nodoc +class _$SharedLocationResponseDataCopyWithImpl<$Res> implements $SharedLocationResponseDataCopyWith<$Res> { + _$SharedLocationResponseDataCopyWithImpl(this._self, this._then); + + final SharedLocationResponseData _self; + final $Res Function(SharedLocationResponseData) _then; + + /// Create a copy of SharedLocationResponseData + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channel = freezed, + Object? channelCid = null, + Object? createdAt = null, + Object? createdByDeviceId = null, + Object? endAt = freezed, + Object? latitude = null, + Object? longitude = null, + Object? message = freezed, + Object? messageId = null, + Object? updatedAt = null, + Object? userId = null, + }) { + return _then( + SharedLocationResponseData( + channel: freezed == channel + ? _self.channel + : channel // ignore: cast_nullable_to_non_nullable + as ChannelResponse?, + channelCid: null == channelCid + ? _self.channelCid + : channelCid // ignore: cast_nullable_to_non_nullable + as String, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + createdByDeviceId: null == createdByDeviceId + ? _self.createdByDeviceId + : createdByDeviceId // ignore: cast_nullable_to_non_nullable + as String, + endAt: freezed == endAt + ? _self.endAt + : endAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + latitude: null == latitude + ? _self.latitude + : latitude // ignore: cast_nullable_to_non_nullable + as double, + longitude: null == longitude + ? _self.longitude + : longitude // ignore: cast_nullable_to_non_nullable + as double, + message: freezed == message + ? _self.message + : message // ignore: cast_nullable_to_non_nullable + as MessageResponse?, + messageId: null == messageId + ? _self.messageId + : messageId // ignore: cast_nullable_to_non_nullable + as String, + updatedAt: null == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + userId: null == userId + ? _self.userId + : userId // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/shared_location_response_data.g.dart b/packages/stream_chat/lib/open_api/model/shared_location_response_data.g.dart new file mode 100644 index 0000000000..05e060dea1 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/shared_location_response_data.g.dart @@ -0,0 +1,59 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'shared_location_response_data.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +SharedLocationResponseData _$SharedLocationResponseDataFromJson( + Map json, +) => SharedLocationResponseData( + channel: json['channel'] == null ? null : ChannelResponse.fromJson(json['channel'] as Map), + channelCid: json['channel_cid'] as String, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + createdByDeviceId: json['created_by_device_id'] as String, + endAt: _$JsonConverterFromJson( + json['end_at'], + const StreamDateTimeConverter().fromJson, + ), + latitude: (json['latitude'] as num).toDouble(), + longitude: (json['longitude'] as num).toDouble(), + message: json['message'] == null ? null : MessageResponse.fromJson(json['message'] as Map), + messageId: json['message_id'] as String, + updatedAt: const StreamDateTimeConverter().fromJson( + json['updated_at'] as Object, + ), + userId: json['user_id'] as String, +); + +Map _$SharedLocationResponseDataToJson( + SharedLocationResponseData instance, +) => { + 'channel': instance.channel?.toJson(), + 'channel_cid': instance.channelCid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'created_by_device_id': instance.createdByDeviceId, + 'end_at': _$JsonConverterToJson( + instance.endAt, + const StreamDateTimeConverter().toJson, + ), + 'latitude': instance.latitude, + 'longitude': instance.longitude, + 'message': instance.message?.toJson(), + 'message_id': instance.messageId, + 'updated_at': const StreamDateTimeConverter().toJson(instance.updatedAt), + 'user_id': instance.userId, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/shared_locations_response.dart b/packages/stream_chat/lib/open_api/model/shared_locations_response.dart new file mode 100644 index 0000000000..421ed3d6d1 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/shared_locations_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'shared_locations_response.g.dart'; +part 'shared_locations_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class SharedLocationsResponse with _$SharedLocationsResponse { + const SharedLocationsResponse({ + required this.activeLiveLocations, + required this.duration, + }); + + @override + @JsonKey(name: 'active_live_locations') + final List activeLiveLocations; + + @override + @JsonKey(name: 'duration') + final String duration; + + Map toJson() => _$SharedLocationsResponseToJson(this); + + static SharedLocationsResponse fromJson(Map json) => _$SharedLocationsResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/shared_locations_response.freezed.dart b/packages/stream_chat/lib/open_api/model/shared_locations_response.freezed.dart new file mode 100644 index 0000000000..0006d9ce47 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/shared_locations_response.freezed.dart @@ -0,0 +1,92 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'shared_locations_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$SharedLocationsResponse { + List get activeLiveLocations; + String get duration; + + /// Create a copy of SharedLocationsResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $SharedLocationsResponseCopyWith get copyWith => + _$SharedLocationsResponseCopyWithImpl( + this as SharedLocationsResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is SharedLocationsResponse && + const DeepCollectionEquality().equals( + other.activeLiveLocations, + activeLiveLocations, + ) && + (identical(other.duration, duration) || other.duration == duration)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(activeLiveLocations), + duration, + ); + + @override + String toString() { + return 'SharedLocationsResponse(activeLiveLocations: $activeLiveLocations, duration: $duration)'; + } +} + +/// @nodoc +abstract mixin class $SharedLocationsResponseCopyWith<$Res> { + factory $SharedLocationsResponseCopyWith( + SharedLocationsResponse value, + $Res Function(SharedLocationsResponse) _then, + ) = _$SharedLocationsResponseCopyWithImpl; + @useResult + $Res call({ + List activeLiveLocations, + String duration, + }); +} + +/// @nodoc +class _$SharedLocationsResponseCopyWithImpl<$Res> implements $SharedLocationsResponseCopyWith<$Res> { + _$SharedLocationsResponseCopyWithImpl(this._self, this._then); + + final SharedLocationsResponse _self; + final $Res Function(SharedLocationsResponse) _then; + + /// Create a copy of SharedLocationsResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? activeLiveLocations = null, Object? duration = null}) { + return _then( + SharedLocationsResponse( + activeLiveLocations: null == activeLiveLocations + ? _self.activeLiveLocations + : activeLiveLocations // ignore: cast_nullable_to_non_nullable + as List, + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/shared_locations_response.g.dart b/packages/stream_chat/lib/open_api/model/shared_locations_response.g.dart new file mode 100644 index 0000000000..503e491674 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/shared_locations_response.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'shared_locations_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +SharedLocationsResponse _$SharedLocationsResponseFromJson( + Map json, +) => SharedLocationsResponse( + activeLiveLocations: (json['active_live_locations'] as List) + .map( + (e) => SharedLocationResponseData.fromJson(e as Map), + ) + .toList(), + duration: json['duration'] as String, +); + +Map _$SharedLocationsResponseToJson( + SharedLocationsResponse instance, +) => { + 'active_live_locations': instance.activeLiveLocations.map((e) => e.toJson()).toList(), + 'duration': instance.duration, +}; diff --git a/packages/stream_chat/lib/open_api/model/show_channel_response.dart b/packages/stream_chat/lib/open_api/model/show_channel_response.dart new file mode 100644 index 0000000000..376c73c0c9 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/show_channel_response.dart @@ -0,0 +1,31 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'show_channel_response.g.dart'; +part 'show_channel_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ShowChannelResponse with _$ShowChannelResponse { + const ShowChannelResponse({ + required this.duration, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + Map toJson() => _$ShowChannelResponseToJson(this); + + static ShowChannelResponse fromJson(Map json) => _$ShowChannelResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/show_channel_response.freezed.dart b/packages/stream_chat/lib/open_api/model/show_channel_response.freezed.dart new file mode 100644 index 0000000000..2b2700bab3 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/show_channel_response.freezed.dart @@ -0,0 +1,76 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'show_channel_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ShowChannelResponse { + String get duration; + + /// Create a copy of ShowChannelResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ShowChannelResponseCopyWith get copyWith => + _$ShowChannelResponseCopyWithImpl( + this as ShowChannelResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ShowChannelResponse && + (identical(other.duration, duration) || other.duration == duration)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration); + + @override + String toString() { + return 'ShowChannelResponse(duration: $duration)'; + } +} + +/// @nodoc +abstract mixin class $ShowChannelResponseCopyWith<$Res> { + factory $ShowChannelResponseCopyWith( + ShowChannelResponse value, + $Res Function(ShowChannelResponse) _then, + ) = _$ShowChannelResponseCopyWithImpl; + @useResult + $Res call({String duration}); +} + +/// @nodoc +class _$ShowChannelResponseCopyWithImpl<$Res> implements $ShowChannelResponseCopyWith<$Res> { + _$ShowChannelResponseCopyWithImpl(this._self, this._then); + + final ShowChannelResponse _self; + final $Res Function(ShowChannelResponse) _then; + + /// Create a copy of ShowChannelResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null}) { + return _then( + ShowChannelResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/show_channel_response.g.dart b/packages/stream_chat/lib/open_api/model/show_channel_response.g.dart new file mode 100644 index 0000000000..9e7a25fda8 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/show_channel_response.g.dart @@ -0,0 +1,14 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'show_channel_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ShowChannelResponse _$ShowChannelResponseFromJson(Map json) => + ShowChannelResponse(duration: json['duration'] as String); + +Map _$ShowChannelResponseToJson( + ShowChannelResponse instance, +) => {'duration': instance.duration}; diff --git a/packages/stream_chat/lib/open_api/model/sort_param_request.dart b/packages/stream_chat/lib/open_api/model/sort_param_request.dart new file mode 100644 index 0000000000..95a1bdf997 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/sort_param_request.dart @@ -0,0 +1,41 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'sort_param_request.g.dart'; +part 'sort_param_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class SortParamRequest with _$SortParamRequest { + const SortParamRequest({ + this.direction, + this.field, + this.type, + }); + + @override + @JsonKey(name: 'direction') + final int? direction; + + @override + @JsonKey(name: 'field') + final String? field; + + @override + @JsonKey(name: 'type') + final String? type; + + Map toJson() => _$SortParamRequestToJson(this); + + static SortParamRequest fromJson(Map json) => _$SortParamRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/sort_param_request.freezed.dart b/packages/stream_chat/lib/open_api/model/sort_param_request.freezed.dart new file mode 100644 index 0000000000..a1b9fda7b0 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/sort_param_request.freezed.dart @@ -0,0 +1,91 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'sort_param_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$SortParamRequest { + int? get direction; + String? get field; + String? get type; + + /// Create a copy of SortParamRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $SortParamRequestCopyWith get copyWith => _$SortParamRequestCopyWithImpl( + this as SortParamRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is SortParamRequest && + (identical(other.direction, direction) || other.direction == direction) && + (identical(other.field, field) || other.field == field) && + (identical(other.type, type) || other.type == type)); + } + + @override + int get hashCode => Object.hash(runtimeType, direction, field, type); + + @override + String toString() { + return 'SortParamRequest(direction: $direction, field: $field, type: $type)'; + } +} + +/// @nodoc +abstract mixin class $SortParamRequestCopyWith<$Res> { + factory $SortParamRequestCopyWith( + SortParamRequest value, + $Res Function(SortParamRequest) _then, + ) = _$SortParamRequestCopyWithImpl; + @useResult + $Res call({int? direction, String? field, String? type}); +} + +/// @nodoc +class _$SortParamRequestCopyWithImpl<$Res> implements $SortParamRequestCopyWith<$Res> { + _$SortParamRequestCopyWithImpl(this._self, this._then); + + final SortParamRequest _self; + final $Res Function(SortParamRequest) _then; + + /// Create a copy of SortParamRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? direction = freezed, + Object? field = freezed, + Object? type = freezed, + }) { + return _then( + SortParamRequest( + direction: freezed == direction + ? _self.direction + : direction // ignore: cast_nullable_to_non_nullable + as int?, + field: freezed == field + ? _self.field + : field // ignore: cast_nullable_to_non_nullable + as String?, + type: freezed == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/sort_param_request.g.dart b/packages/stream_chat/lib/open_api/model/sort_param_request.g.dart new file mode 100644 index 0000000000..4554cdfd79 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/sort_param_request.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'sort_param_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +SortParamRequest _$SortParamRequestFromJson(Map json) => SortParamRequest( + direction: (json['direction'] as num?)?.toInt(), + field: json['field'] as String?, + type: json['type'] as String?, +); + +Map _$SortParamRequestToJson(SortParamRequest instance) => { + 'direction': instance.direction, + 'field': instance.field, + 'type': instance.type, +}; diff --git a/packages/stream_chat/lib/open_api/model/submit_action_request.dart b/packages/stream_chat/lib/open_api/model/submit_action_request.dart new file mode 100644 index 0000000000..d34eac06ec --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/submit_action_request.dart @@ -0,0 +1,160 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'submit_action_request.g.dart'; +part 'submit_action_request.freezed.dart'; + +extension type const SubmitActionRequestActionType._(String _) implements String { + static const ban = SubmitActionRequestActionType._('ban'); + static const block = SubmitActionRequestActionType._('block'); + static const bypass = SubmitActionRequestActionType._('bypass'); + static const custom = SubmitActionRequestActionType._('custom'); + static const deEscalate = SubmitActionRequestActionType._('de_escalate'); + static const deleteActivity = SubmitActionRequestActionType._('delete_activity'); + static const deleteComment = SubmitActionRequestActionType._('delete_comment'); + static const deleteMessage = SubmitActionRequestActionType._('delete_message'); + static const deleteReaction = SubmitActionRequestActionType._('delete_reaction'); + static const deleteUser = SubmitActionRequestActionType._('delete_user'); + static const deleteUserMessages = SubmitActionRequestActionType._('delete_user_messages'); + static const endCall = SubmitActionRequestActionType._('end_call'); + static const escalate = SubmitActionRequestActionType._('escalate'); + static const flag = SubmitActionRequestActionType._('flag'); + static const kickUser = SubmitActionRequestActionType._('kick_user'); + static const markReviewed = SubmitActionRequestActionType._('mark_reviewed'); + static const rejectAppeal = SubmitActionRequestActionType._('reject_appeal'); + static const restore = SubmitActionRequestActionType._('restore'); + static const shadowBlock = SubmitActionRequestActionType._('shadow_block'); + static const unban = SubmitActionRequestActionType._('unban'); + static const unblock = SubmitActionRequestActionType._('unblock'); + static const unmask = SubmitActionRequestActionType._('unmask'); + + factory SubmitActionRequestActionType.fromJson(String json) => SubmitActionRequestActionType._(json); + + String toJson() => this; +} + +@freezed +@immutable +@JsonSerializable() +class SubmitActionRequest with _$SubmitActionRequest { + const SubmitActionRequest({ + required this.actionType, + this.appealId, + this.ban, + this.block, + this.bypass, + this.custom, + this.deleteActivity, + this.deleteComment, + this.deleteMessage, + this.deleteReaction, + this.deleteUser, + this.deleteUserMessages, + this.escalate, + this.flag, + this.itemId, + this.markReviewed, + this.rejectAppeal, + this.restore, + this.shadowBlock, + this.unban, + this.unblock, + }); + + @override + @JsonKey(name: 'action_type') + final SubmitActionRequestActionType actionType; + + @override + @JsonKey(name: 'appeal_id') + final String? appealId; + + @override + @JsonKey(name: 'ban') + final BanActionRequestPayload? ban; + + @override + @JsonKey(name: 'block') + final BlockActionRequestPayload? block; + + @override + @JsonKey(name: 'bypass') + final BypassActionRequest? bypass; + + @override + @JsonKey(name: 'custom') + final CustomActionRequestPayload? custom; + + @override + @JsonKey(name: 'delete_activity') + final DeleteActivityRequestPayload? deleteActivity; + + @override + @JsonKey(name: 'delete_comment') + final DeleteCommentRequestPayload? deleteComment; + + @override + @JsonKey(name: 'delete_message') + final DeleteMessageRequestPayload? deleteMessage; + + @override + @JsonKey(name: 'delete_reaction') + final DeleteReactionRequestPayload? deleteReaction; + + @override + @JsonKey(name: 'delete_user') + final DeleteUserRequestPayload? deleteUser; + + @override + @JsonKey(name: 'delete_user_messages') + final DeleteUserMessagesRequestPayload? deleteUserMessages; + + @override + @JsonKey(name: 'escalate') + final EscalatePayload? escalate; + + @override + @JsonKey(name: 'flag') + final FlagRequest? flag; + + @override + @JsonKey(name: 'item_id') + final String? itemId; + + @override + @JsonKey(name: 'mark_reviewed') + final MarkReviewedRequestPayload? markReviewed; + + @override + @JsonKey(name: 'reject_appeal') + final RejectAppealRequestPayload? rejectAppeal; + + @override + @JsonKey(name: 'restore') + final RestoreActionRequestPayload? restore; + + @override + @JsonKey(name: 'shadow_block') + final ShadowBlockActionRequestPayload? shadowBlock; + + @override + @JsonKey(name: 'unban') + final UnbanActionRequestPayload? unban; + + @override + @JsonKey(name: 'unblock') + final UnblockActionRequestPayload? unblock; + + Map toJson() => _$SubmitActionRequestToJson(this); + + static SubmitActionRequest fromJson(Map json) => _$SubmitActionRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/submit_action_request.freezed.dart b/packages/stream_chat/lib/open_api/model/submit_action_request.freezed.dart new file mode 100644 index 0000000000..05a9446ed0 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/submit_action_request.freezed.dart @@ -0,0 +1,264 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'submit_action_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$SubmitActionRequest { + SubmitActionRequestActionType get actionType; + String? get appealId; + BanActionRequestPayload? get ban; + BlockActionRequestPayload? get block; + BypassActionRequest? get bypass; + CustomActionRequestPayload? get custom; + DeleteActivityRequestPayload? get deleteActivity; + DeleteCommentRequestPayload? get deleteComment; + DeleteMessageRequestPayload? get deleteMessage; + DeleteReactionRequestPayload? get deleteReaction; + DeleteUserRequestPayload? get deleteUser; + DeleteUserMessagesRequestPayload? get deleteUserMessages; + EscalatePayload? get escalate; + FlagRequest? get flag; + String? get itemId; + MarkReviewedRequestPayload? get markReviewed; + RejectAppealRequestPayload? get rejectAppeal; + RestoreActionRequestPayload? get restore; + ShadowBlockActionRequestPayload? get shadowBlock; + UnbanActionRequestPayload? get unban; + UnblockActionRequestPayload? get unblock; + + /// Create a copy of SubmitActionRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $SubmitActionRequestCopyWith get copyWith => + _$SubmitActionRequestCopyWithImpl( + this as SubmitActionRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is SubmitActionRequest && + (identical(other.actionType, actionType) || other.actionType == actionType) && + (identical(other.appealId, appealId) || other.appealId == appealId) && + (identical(other.ban, ban) || other.ban == ban) && + (identical(other.block, block) || other.block == block) && + (identical(other.bypass, bypass) || other.bypass == bypass) && + (identical(other.custom, custom) || other.custom == custom) && + (identical(other.deleteActivity, deleteActivity) || other.deleteActivity == deleteActivity) && + (identical(other.deleteComment, deleteComment) || other.deleteComment == deleteComment) && + (identical(other.deleteMessage, deleteMessage) || other.deleteMessage == deleteMessage) && + (identical(other.deleteReaction, deleteReaction) || other.deleteReaction == deleteReaction) && + (identical(other.deleteUser, deleteUser) || other.deleteUser == deleteUser) && + (identical(other.deleteUserMessages, deleteUserMessages) || + other.deleteUserMessages == deleteUserMessages) && + (identical(other.escalate, escalate) || other.escalate == escalate) && + (identical(other.flag, flag) || other.flag == flag) && + (identical(other.itemId, itemId) || other.itemId == itemId) && + (identical(other.markReviewed, markReviewed) || other.markReviewed == markReviewed) && + (identical(other.rejectAppeal, rejectAppeal) || other.rejectAppeal == rejectAppeal) && + (identical(other.restore, restore) || other.restore == restore) && + (identical(other.shadowBlock, shadowBlock) || other.shadowBlock == shadowBlock) && + (identical(other.unban, unban) || other.unban == unban) && + (identical(other.unblock, unblock) || other.unblock == unblock)); + } + + @override + int get hashCode => Object.hashAll([ + runtimeType, + actionType, + appealId, + ban, + block, + bypass, + custom, + deleteActivity, + deleteComment, + deleteMessage, + deleteReaction, + deleteUser, + deleteUserMessages, + escalate, + flag, + itemId, + markReviewed, + rejectAppeal, + restore, + shadowBlock, + unban, + unblock, + ]); + + @override + String toString() { + return 'SubmitActionRequest(actionType: $actionType, appealId: $appealId, ban: $ban, block: $block, bypass: $bypass, custom: $custom, deleteActivity: $deleteActivity, deleteComment: $deleteComment, deleteMessage: $deleteMessage, deleteReaction: $deleteReaction, deleteUser: $deleteUser, deleteUserMessages: $deleteUserMessages, escalate: $escalate, flag: $flag, itemId: $itemId, markReviewed: $markReviewed, rejectAppeal: $rejectAppeal, restore: $restore, shadowBlock: $shadowBlock, unban: $unban, unblock: $unblock)'; + } +} + +/// @nodoc +abstract mixin class $SubmitActionRequestCopyWith<$Res> { + factory $SubmitActionRequestCopyWith( + SubmitActionRequest value, + $Res Function(SubmitActionRequest) _then, + ) = _$SubmitActionRequestCopyWithImpl; + @useResult + $Res call({ + SubmitActionRequestActionType actionType, + String? appealId, + BanActionRequestPayload? ban, + BlockActionRequestPayload? block, + BypassActionRequest? bypass, + CustomActionRequestPayload? custom, + DeleteActivityRequestPayload? deleteActivity, + DeleteCommentRequestPayload? deleteComment, + DeleteMessageRequestPayload? deleteMessage, + DeleteReactionRequestPayload? deleteReaction, + DeleteUserRequestPayload? deleteUser, + DeleteUserMessagesRequestPayload? deleteUserMessages, + EscalatePayload? escalate, + FlagRequest? flag, + String? itemId, + MarkReviewedRequestPayload? markReviewed, + RejectAppealRequestPayload? rejectAppeal, + RestoreActionRequestPayload? restore, + ShadowBlockActionRequestPayload? shadowBlock, + UnbanActionRequestPayload? unban, + UnblockActionRequestPayload? unblock, + }); +} + +/// @nodoc +class _$SubmitActionRequestCopyWithImpl<$Res> implements $SubmitActionRequestCopyWith<$Res> { + _$SubmitActionRequestCopyWithImpl(this._self, this._then); + + final SubmitActionRequest _self; + final $Res Function(SubmitActionRequest) _then; + + /// Create a copy of SubmitActionRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? actionType = null, + Object? appealId = freezed, + Object? ban = freezed, + Object? block = freezed, + Object? bypass = freezed, + Object? custom = freezed, + Object? deleteActivity = freezed, + Object? deleteComment = freezed, + Object? deleteMessage = freezed, + Object? deleteReaction = freezed, + Object? deleteUser = freezed, + Object? deleteUserMessages = freezed, + Object? escalate = freezed, + Object? flag = freezed, + Object? itemId = freezed, + Object? markReviewed = freezed, + Object? rejectAppeal = freezed, + Object? restore = freezed, + Object? shadowBlock = freezed, + Object? unban = freezed, + Object? unblock = freezed, + }) { + return _then( + SubmitActionRequest( + actionType: null == actionType + ? _self.actionType + : actionType // ignore: cast_nullable_to_non_nullable + as SubmitActionRequestActionType, + appealId: freezed == appealId + ? _self.appealId + : appealId // ignore: cast_nullable_to_non_nullable + as String?, + ban: freezed == ban + ? _self.ban + : ban // ignore: cast_nullable_to_non_nullable + as BanActionRequestPayload?, + block: freezed == block + ? _self.block + : block // ignore: cast_nullable_to_non_nullable + as BlockActionRequestPayload?, + bypass: freezed == bypass + ? _self.bypass + : bypass // ignore: cast_nullable_to_non_nullable + as BypassActionRequest?, + custom: freezed == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as CustomActionRequestPayload?, + deleteActivity: freezed == deleteActivity + ? _self.deleteActivity + : deleteActivity // ignore: cast_nullable_to_non_nullable + as DeleteActivityRequestPayload?, + deleteComment: freezed == deleteComment + ? _self.deleteComment + : deleteComment // ignore: cast_nullable_to_non_nullable + as DeleteCommentRequestPayload?, + deleteMessage: freezed == deleteMessage + ? _self.deleteMessage + : deleteMessage // ignore: cast_nullable_to_non_nullable + as DeleteMessageRequestPayload?, + deleteReaction: freezed == deleteReaction + ? _self.deleteReaction + : deleteReaction // ignore: cast_nullable_to_non_nullable + as DeleteReactionRequestPayload?, + deleteUser: freezed == deleteUser + ? _self.deleteUser + : deleteUser // ignore: cast_nullable_to_non_nullable + as DeleteUserRequestPayload?, + deleteUserMessages: freezed == deleteUserMessages + ? _self.deleteUserMessages + : deleteUserMessages // ignore: cast_nullable_to_non_nullable + as DeleteUserMessagesRequestPayload?, + escalate: freezed == escalate + ? _self.escalate + : escalate // ignore: cast_nullable_to_non_nullable + as EscalatePayload?, + flag: freezed == flag + ? _self.flag + : flag // ignore: cast_nullable_to_non_nullable + as FlagRequest?, + itemId: freezed == itemId + ? _self.itemId + : itemId // ignore: cast_nullable_to_non_nullable + as String?, + markReviewed: freezed == markReviewed + ? _self.markReviewed + : markReviewed // ignore: cast_nullable_to_non_nullable + as MarkReviewedRequestPayload?, + rejectAppeal: freezed == rejectAppeal + ? _self.rejectAppeal + : rejectAppeal // ignore: cast_nullable_to_non_nullable + as RejectAppealRequestPayload?, + restore: freezed == restore + ? _self.restore + : restore // ignore: cast_nullable_to_non_nullable + as RestoreActionRequestPayload?, + shadowBlock: freezed == shadowBlock + ? _self.shadowBlock + : shadowBlock // ignore: cast_nullable_to_non_nullable + as ShadowBlockActionRequestPayload?, + unban: freezed == unban + ? _self.unban + : unban // ignore: cast_nullable_to_non_nullable + as UnbanActionRequestPayload?, + unblock: freezed == unblock + ? _self.unblock + : unblock // ignore: cast_nullable_to_non_nullable + as UnblockActionRequestPayload?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/submit_action_request.g.dart b/packages/stream_chat/lib/open_api/model/submit_action_request.g.dart new file mode 100644 index 0000000000..14e1ed51cb --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/submit_action_request.g.dart @@ -0,0 +1,117 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'submit_action_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +SubmitActionRequest _$SubmitActionRequestFromJson( + Map json, +) => SubmitActionRequest( + actionType: SubmitActionRequestActionType.fromJson( + json['action_type'] as String, + ), + appealId: json['appeal_id'] as String?, + ban: json['ban'] == null ? null : BanActionRequestPayload.fromJson(json['ban'] as Map), + block: json['block'] == null + ? null + : BlockActionRequestPayload.fromJson( + json['block'] as Map, + ), + bypass: json['bypass'] == null ? null : BypassActionRequest.fromJson(json['bypass'] as Map), + custom: json['custom'] == null + ? null + : CustomActionRequestPayload.fromJson( + json['custom'] as Map, + ), + deleteActivity: json['delete_activity'] == null + ? null + : DeleteActivityRequestPayload.fromJson( + json['delete_activity'] as Map, + ), + deleteComment: json['delete_comment'] == null + ? null + : DeleteCommentRequestPayload.fromJson( + json['delete_comment'] as Map, + ), + deleteMessage: json['delete_message'] == null + ? null + : DeleteMessageRequestPayload.fromJson( + json['delete_message'] as Map, + ), + deleteReaction: json['delete_reaction'] == null + ? null + : DeleteReactionRequestPayload.fromJson( + json['delete_reaction'] as Map, + ), + deleteUser: json['delete_user'] == null + ? null + : DeleteUserRequestPayload.fromJson( + json['delete_user'] as Map, + ), + deleteUserMessages: json['delete_user_messages'] == null + ? null + : DeleteUserMessagesRequestPayload.fromJson( + json['delete_user_messages'] as Map, + ), + escalate: json['escalate'] == null ? null : EscalatePayload.fromJson(json['escalate'] as Map), + flag: json['flag'] == null ? null : FlagRequest.fromJson(json['flag'] as Map), + itemId: json['item_id'] as String?, + markReviewed: json['mark_reviewed'] == null + ? null + : MarkReviewedRequestPayload.fromJson( + json['mark_reviewed'] as Map, + ), + rejectAppeal: json['reject_appeal'] == null + ? null + : RejectAppealRequestPayload.fromJson( + json['reject_appeal'] as Map, + ), + restore: json['restore'] == null + ? null + : RestoreActionRequestPayload.fromJson( + json['restore'] as Map, + ), + shadowBlock: json['shadow_block'] == null + ? null + : ShadowBlockActionRequestPayload.fromJson( + json['shadow_block'] as Map, + ), + unban: json['unban'] == null + ? null + : UnbanActionRequestPayload.fromJson( + json['unban'] as Map, + ), + unblock: json['unblock'] == null + ? null + : UnblockActionRequestPayload.fromJson( + json['unblock'] as Map, + ), +); + +Map _$SubmitActionRequestToJson( + SubmitActionRequest instance, +) => { + 'action_type': instance.actionType.toJson(), + 'appeal_id': instance.appealId, + 'ban': instance.ban?.toJson(), + 'block': instance.block?.toJson(), + 'bypass': instance.bypass?.toJson(), + 'custom': instance.custom?.toJson(), + 'delete_activity': instance.deleteActivity?.toJson(), + 'delete_comment': instance.deleteComment?.toJson(), + 'delete_message': instance.deleteMessage?.toJson(), + 'delete_reaction': instance.deleteReaction?.toJson(), + 'delete_user': instance.deleteUser?.toJson(), + 'delete_user_messages': instance.deleteUserMessages?.toJson(), + 'escalate': instance.escalate?.toJson(), + 'flag': instance.flag?.toJson(), + 'item_id': instance.itemId, + 'mark_reviewed': instance.markReviewed?.toJson(), + 'reject_appeal': instance.rejectAppeal?.toJson(), + 'restore': instance.restore?.toJson(), + 'shadow_block': instance.shadowBlock?.toJson(), + 'unban': instance.unban?.toJson(), + 'unblock': instance.unblock?.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/submit_action_response.dart b/packages/stream_chat/lib/open_api/model/submit_action_response.dart new file mode 100644 index 0000000000..fd08baf917 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/submit_action_response.dart @@ -0,0 +1,46 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'submit_action_response.g.dart'; +part 'submit_action_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class SubmitActionResponse with _$SubmitActionResponse { + const SubmitActionResponse({ + this.appealItem, + this.autoRestoreWarning, + required this.duration, + this.item, + }); + + @override + @JsonKey(name: 'appeal_item') + final AppealItemResponse? appealItem; + + @override + @JsonKey(name: 'auto_restore_warning') + final String? autoRestoreWarning; + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'item') + final ReviewQueueItemResponse? item; + + Map toJson() => _$SubmitActionResponseToJson(this); + + static SubmitActionResponse fromJson(Map json) => _$SubmitActionResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/submit_action_response.freezed.dart b/packages/stream_chat/lib/open_api/model/submit_action_response.freezed.dart new file mode 100644 index 0000000000..40a4ffc935 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/submit_action_response.freezed.dart @@ -0,0 +1,105 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'submit_action_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$SubmitActionResponse { + AppealItemResponse? get appealItem; + String? get autoRestoreWarning; + String get duration; + ReviewQueueItemResponse? get item; + + /// Create a copy of SubmitActionResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $SubmitActionResponseCopyWith get copyWith => + _$SubmitActionResponseCopyWithImpl( + this as SubmitActionResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is SubmitActionResponse && + (identical(other.appealItem, appealItem) || other.appealItem == appealItem) && + (identical(other.autoRestoreWarning, autoRestoreWarning) || + other.autoRestoreWarning == autoRestoreWarning) && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.item, item) || other.item == item)); + } + + @override + int get hashCode => Object.hash(runtimeType, appealItem, autoRestoreWarning, duration, item); + + @override + String toString() { + return 'SubmitActionResponse(appealItem: $appealItem, autoRestoreWarning: $autoRestoreWarning, duration: $duration, item: $item)'; + } +} + +/// @nodoc +abstract mixin class $SubmitActionResponseCopyWith<$Res> { + factory $SubmitActionResponseCopyWith( + SubmitActionResponse value, + $Res Function(SubmitActionResponse) _then, + ) = _$SubmitActionResponseCopyWithImpl; + @useResult + $Res call({ + AppealItemResponse? appealItem, + String? autoRestoreWarning, + String duration, + ReviewQueueItemResponse? item, + }); +} + +/// @nodoc +class _$SubmitActionResponseCopyWithImpl<$Res> implements $SubmitActionResponseCopyWith<$Res> { + _$SubmitActionResponseCopyWithImpl(this._self, this._then); + + final SubmitActionResponse _self; + final $Res Function(SubmitActionResponse) _then; + + /// Create a copy of SubmitActionResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? appealItem = freezed, + Object? autoRestoreWarning = freezed, + Object? duration = null, + Object? item = freezed, + }) { + return _then( + SubmitActionResponse( + appealItem: freezed == appealItem + ? _self.appealItem + : appealItem // ignore: cast_nullable_to_non_nullable + as AppealItemResponse?, + autoRestoreWarning: freezed == autoRestoreWarning + ? _self.autoRestoreWarning + : autoRestoreWarning // ignore: cast_nullable_to_non_nullable + as String?, + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + item: freezed == item + ? _self.item + : item // ignore: cast_nullable_to_non_nullable + as ReviewQueueItemResponse?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/submit_action_response.g.dart b/packages/stream_chat/lib/open_api/model/submit_action_response.g.dart new file mode 100644 index 0000000000..53dc955fa0 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/submit_action_response.g.dart @@ -0,0 +1,29 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'submit_action_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +SubmitActionResponse _$SubmitActionResponseFromJson( + Map json, +) => SubmitActionResponse( + appealItem: json['appeal_item'] == null + ? null + : AppealItemResponse.fromJson( + json['appeal_item'] as Map, + ), + autoRestoreWarning: json['auto_restore_warning'] as String?, + duration: json['duration'] as String, + item: json['item'] == null ? null : ReviewQueueItemResponse.fromJson(json['item'] as Map), +); + +Map _$SubmitActionResponseToJson( + SubmitActionResponse instance, +) => { + 'appeal_item': instance.appealItem?.toJson(), + 'auto_restore_warning': instance.autoRestoreWarning, + 'duration': instance.duration, + 'item': instance.item?.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/sync_request.dart b/packages/stream_chat/lib/open_api/model/sync_request.dart new file mode 100644 index 0000000000..fa8558cda3 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/sync_request.dart @@ -0,0 +1,37 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'sync_request.g.dart'; +part 'sync_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class SyncRequest with _$SyncRequest { + const SyncRequest({ + required this.channelCids, + required this.lastSyncAt, + }); + + @override + @JsonKey(name: 'channel_cids') + final List channelCids; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'last_sync_at') + final DateTime lastSyncAt; + + Map toJson() => _$SyncRequestToJson(this); + + static SyncRequest fromJson(Map json) => _$SyncRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/sync_request.freezed.dart b/packages/stream_chat/lib/open_api/model/sync_request.freezed.dart new file mode 100644 index 0000000000..4063596ca5 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/sync_request.freezed.dart @@ -0,0 +1,86 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'sync_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$SyncRequest { + List get channelCids; + DateTime get lastSyncAt; + + /// Create a copy of SyncRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $SyncRequestCopyWith get copyWith => + _$SyncRequestCopyWithImpl(this as SyncRequest, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is SyncRequest && + const DeepCollectionEquality().equals( + other.channelCids, + channelCids, + ) && + (identical(other.lastSyncAt, lastSyncAt) || other.lastSyncAt == lastSyncAt)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(channelCids), + lastSyncAt, + ); + + @override + String toString() { + return 'SyncRequest(channelCids: $channelCids, lastSyncAt: $lastSyncAt)'; + } +} + +/// @nodoc +abstract mixin class $SyncRequestCopyWith<$Res> { + factory $SyncRequestCopyWith( + SyncRequest value, + $Res Function(SyncRequest) _then, + ) = _$SyncRequestCopyWithImpl; + @useResult + $Res call({List channelCids, DateTime lastSyncAt}); +} + +/// @nodoc +class _$SyncRequestCopyWithImpl<$Res> implements $SyncRequestCopyWith<$Res> { + _$SyncRequestCopyWithImpl(this._self, this._then); + + final SyncRequest _self; + final $Res Function(SyncRequest) _then; + + /// Create a copy of SyncRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? channelCids = null, Object? lastSyncAt = null}) { + return _then( + SyncRequest( + channelCids: null == channelCids + ? _self.channelCids + : channelCids // ignore: cast_nullable_to_non_nullable + as List, + lastSyncAt: null == lastSyncAt + ? _self.lastSyncAt + : lastSyncAt // ignore: cast_nullable_to_non_nullable + as DateTime, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/sync_request.g.dart b/packages/stream_chat/lib/open_api/model/sync_request.g.dart new file mode 100644 index 0000000000..a31d737403 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/sync_request.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'sync_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +SyncRequest _$SyncRequestFromJson(Map json) => SyncRequest( + channelCids: (json['channel_cids'] as List).map((e) => e as String).toList(), + lastSyncAt: const StreamDateTimeConverter().fromJson( + json['last_sync_at'] as Object, + ), +); + +Map _$SyncRequestToJson( + SyncRequest instance, +) => { + 'channel_cids': instance.channelCids, + 'last_sync_at': const StreamDateTimeConverter().toJson(instance.lastSyncAt), +}; diff --git a/packages/stream_chat/lib/open_api/model/sync_response.dart b/packages/stream_chat/lib/open_api/model/sync_response.dart new file mode 100644 index 0000000000..649756538b --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/sync_response.dart @@ -0,0 +1,41 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'sync_response.g.dart'; +part 'sync_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class SyncResponse with _$SyncResponse { + const SyncResponse({ + required this.duration, + required this.events, + this.inaccessibleCids, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'events', fromJson: wsEventListFromJson, toJson: wsEventListToJson) + final List events; + + @override + @JsonKey(name: 'inaccessible_cids') + final List? inaccessibleCids; + + Map toJson() => _$SyncResponseToJson(this); + + static SyncResponse fromJson(Map json) => _$SyncResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/sync_response.freezed.dart b/packages/stream_chat/lib/open_api/model/sync_response.freezed.dart new file mode 100644 index 0000000000..fb75d559f7 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/sync_response.freezed.dart @@ -0,0 +1,103 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'sync_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$SyncResponse { + String get duration; + List get events; + List? get inaccessibleCids; + + /// Create a copy of SyncResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $SyncResponseCopyWith get copyWith => _$SyncResponseCopyWithImpl( + this as SyncResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is SyncResponse && + (identical(other.duration, duration) || other.duration == duration) && + const DeepCollectionEquality().equals(other.events, events) && + const DeepCollectionEquality().equals( + other.inaccessibleCids, + inaccessibleCids, + )); + } + + @override + int get hashCode => Object.hash( + runtimeType, + duration, + const DeepCollectionEquality().hash(events), + const DeepCollectionEquality().hash(inaccessibleCids), + ); + + @override + String toString() { + return 'SyncResponse(duration: $duration, events: $events, inaccessibleCids: $inaccessibleCids)'; + } +} + +/// @nodoc +abstract mixin class $SyncResponseCopyWith<$Res> { + factory $SyncResponseCopyWith( + SyncResponse value, + $Res Function(SyncResponse) _then, + ) = _$SyncResponseCopyWithImpl; + @useResult + $Res call({ + String duration, + List> events, + List? inaccessibleCids, + }); +} + +/// @nodoc +class _$SyncResponseCopyWithImpl<$Res> implements $SyncResponseCopyWith<$Res> { + _$SyncResponseCopyWithImpl(this._self, this._then); + + final SyncResponse _self; + final $Res Function(SyncResponse) _then; + + /// Create a copy of SyncResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? duration = null, + Object? events = null, + Object? inaccessibleCids = freezed, + }) { + return _then( + SyncResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + events: null == events + ? _self.events + : events // ignore: cast_nullable_to_non_nullable + as List>, + inaccessibleCids: freezed == inaccessibleCids + ? _self.inaccessibleCids + : inaccessibleCids // ignore: cast_nullable_to_non_nullable + as List?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/sync_response.g.dart b/packages/stream_chat/lib/open_api/model/sync_response.g.dart new file mode 100644 index 0000000000..179c7971fa --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/sync_response.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'sync_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +SyncResponse _$SyncResponseFromJson(Map json) => SyncResponse( + duration: json['duration'] as String, + events: wsEventListFromJson(json['events'] as List), + inaccessibleCids: (json['inaccessible_cids'] as List?)?.map((e) => e as String).toList(), +); + +Map _$SyncResponseToJson(SyncResponse instance) => { + 'duration': instance.duration, + 'events': wsEventListToJson(instance.events), + 'inaccessible_cids': instance.inaccessibleCids, +}; diff --git a/packages/stream_chat/lib/open_api/model/text_content_parameters.dart b/packages/stream_chat/lib/open_api/model/text_content_parameters.dart new file mode 100644 index 0000000000..47c347ff00 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/text_content_parameters.dart @@ -0,0 +1,66 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'text_content_parameters.g.dart'; +part 'text_content_parameters.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class TextContentParameters with _$TextContentParameters { + const TextContentParameters({ + this.blocklistMatch, + this.containsUrl, + this.harmLabels, + this.labelOperator, + this.llmHarmLabels, + this.severity, + this.textLength, + this.textLengthOperator, + }); + + @override + @JsonKey(name: 'blocklist_match') + final List? blocklistMatch; + + @override + @JsonKey(name: 'contains_url') + final bool? containsUrl; + + @override + @JsonKey(name: 'harm_labels') + final List? harmLabels; + + @override + @JsonKey(name: 'label_operator') + final String? labelOperator; + + @override + @JsonKey(name: 'llm_harm_labels') + final Map? llmHarmLabels; + + @override + @JsonKey(name: 'severity') + final String? severity; + + @override + @JsonKey(name: 'text_length') + final int? textLength; + + @override + @JsonKey(name: 'text_length_operator') + final String? textLengthOperator; + + Map toJson() => _$TextContentParametersToJson(this); + + static TextContentParameters fromJson(Map json) => _$TextContentParametersFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/text_content_parameters.freezed.dart b/packages/stream_chat/lib/open_api/model/text_content_parameters.freezed.dart new file mode 100644 index 0000000000..c3c454e66c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/text_content_parameters.freezed.dart @@ -0,0 +1,156 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'text_content_parameters.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$TextContentParameters { + List? get blocklistMatch; + bool? get containsUrl; + List? get harmLabels; + String? get labelOperator; + Map? get llmHarmLabels; + String? get severity; + int? get textLength; + String? get textLengthOperator; + + /// Create a copy of TextContentParameters + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $TextContentParametersCopyWith get copyWith => + _$TextContentParametersCopyWithImpl( + this as TextContentParameters, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is TextContentParameters && + const DeepCollectionEquality().equals( + other.blocklistMatch, + blocklistMatch, + ) && + (identical(other.containsUrl, containsUrl) || other.containsUrl == containsUrl) && + const DeepCollectionEquality().equals( + other.harmLabels, + harmLabels, + ) && + (identical(other.labelOperator, labelOperator) || other.labelOperator == labelOperator) && + const DeepCollectionEquality().equals( + other.llmHarmLabels, + llmHarmLabels, + ) && + (identical(other.severity, severity) || other.severity == severity) && + (identical(other.textLength, textLength) || other.textLength == textLength) && + (identical(other.textLengthOperator, textLengthOperator) || + other.textLengthOperator == textLengthOperator)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(blocklistMatch), + containsUrl, + const DeepCollectionEquality().hash(harmLabels), + labelOperator, + const DeepCollectionEquality().hash(llmHarmLabels), + severity, + textLength, + textLengthOperator, + ); + + @override + String toString() { + return 'TextContentParameters(blocklistMatch: $blocklistMatch, containsUrl: $containsUrl, harmLabels: $harmLabels, labelOperator: $labelOperator, llmHarmLabels: $llmHarmLabels, severity: $severity, textLength: $textLength, textLengthOperator: $textLengthOperator)'; + } +} + +/// @nodoc +abstract mixin class $TextContentParametersCopyWith<$Res> { + factory $TextContentParametersCopyWith( + TextContentParameters value, + $Res Function(TextContentParameters) _then, + ) = _$TextContentParametersCopyWithImpl; + @useResult + $Res call({ + List? blocklistMatch, + bool? containsUrl, + List? harmLabels, + String? labelOperator, + Map? llmHarmLabels, + String? severity, + int? textLength, + String? textLengthOperator, + }); +} + +/// @nodoc +class _$TextContentParametersCopyWithImpl<$Res> implements $TextContentParametersCopyWith<$Res> { + _$TextContentParametersCopyWithImpl(this._self, this._then); + + final TextContentParameters _self; + final $Res Function(TextContentParameters) _then; + + /// Create a copy of TextContentParameters + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? blocklistMatch = freezed, + Object? containsUrl = freezed, + Object? harmLabels = freezed, + Object? labelOperator = freezed, + Object? llmHarmLabels = freezed, + Object? severity = freezed, + Object? textLength = freezed, + Object? textLengthOperator = freezed, + }) { + return _then( + TextContentParameters( + blocklistMatch: freezed == blocklistMatch + ? _self.blocklistMatch + : blocklistMatch // ignore: cast_nullable_to_non_nullable + as List?, + containsUrl: freezed == containsUrl + ? _self.containsUrl + : containsUrl // ignore: cast_nullable_to_non_nullable + as bool?, + harmLabels: freezed == harmLabels + ? _self.harmLabels + : harmLabels // ignore: cast_nullable_to_non_nullable + as List?, + labelOperator: freezed == labelOperator + ? _self.labelOperator + : labelOperator // ignore: cast_nullable_to_non_nullable + as String?, + llmHarmLabels: freezed == llmHarmLabels + ? _self.llmHarmLabels + : llmHarmLabels // ignore: cast_nullable_to_non_nullable + as Map?, + severity: freezed == severity + ? _self.severity + : severity // ignore: cast_nullable_to_non_nullable + as String?, + textLength: freezed == textLength + ? _self.textLength + : textLength // ignore: cast_nullable_to_non_nullable + as int?, + textLengthOperator: freezed == textLengthOperator + ? _self.textLengthOperator + : textLengthOperator // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/text_content_parameters.g.dart b/packages/stream_chat/lib/open_api/model/text_content_parameters.g.dart new file mode 100644 index 0000000000..92bf9f47da --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/text_content_parameters.g.dart @@ -0,0 +1,35 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'text_content_parameters.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +TextContentParameters _$TextContentParametersFromJson( + Map json, +) => TextContentParameters( + blocklistMatch: (json['blocklist_match'] as List?)?.map((e) => e as String).toList(), + containsUrl: json['contains_url'] as bool?, + harmLabels: (json['harm_labels'] as List?)?.map((e) => e as String).toList(), + labelOperator: json['label_operator'] as String?, + llmHarmLabels: (json['llm_harm_labels'] as Map?)?.map( + (k, e) => MapEntry(k, e as String), + ), + severity: json['severity'] as String?, + textLength: (json['text_length'] as num?)?.toInt(), + textLengthOperator: json['text_length_operator'] as String?, +); + +Map _$TextContentParametersToJson( + TextContentParameters instance, +) => { + 'blocklist_match': instance.blocklistMatch, + 'contains_url': instance.containsUrl, + 'harm_labels': instance.harmLabels, + 'label_operator': instance.labelOperator, + 'llm_harm_labels': instance.llmHarmLabels, + 'severity': instance.severity, + 'text_length': instance.textLength, + 'text_length_operator': instance.textLengthOperator, +}; diff --git a/packages/stream_chat/lib/open_api/model/text_rule_parameters.dart b/packages/stream_chat/lib/open_api/model/text_rule_parameters.dart new file mode 100644 index 0000000000..d04276675d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/text_rule_parameters.dart @@ -0,0 +1,71 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'text_rule_parameters.g.dart'; +part 'text_rule_parameters.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class TextRuleParameters with _$TextRuleParameters { + const TextRuleParameters({ + this.blocklistMatch, + this.containsUrl, + this.harmLabels, + this.llmHarmLabels, + this.semanticFilterMinThreshold, + this.semanticFilterNames, + this.severity, + this.threshold, + this.timeWindow, + }); + + @override + @JsonKey(name: 'blocklist_match') + final List? blocklistMatch; + + @override + @JsonKey(name: 'contains_url') + final bool? containsUrl; + + @override + @JsonKey(name: 'harm_labels') + final List? harmLabels; + + @override + @JsonKey(name: 'llm_harm_labels') + final Map? llmHarmLabels; + + @override + @JsonKey(name: 'semantic_filter_min_threshold') + final double? semanticFilterMinThreshold; + + @override + @JsonKey(name: 'semantic_filter_names') + final List? semanticFilterNames; + + @override + @JsonKey(name: 'severity') + final String? severity; + + @override + @JsonKey(name: 'threshold') + final int? threshold; + + @override + @JsonKey(name: 'time_window') + final String? timeWindow; + + Map toJson() => _$TextRuleParametersToJson(this); + + static TextRuleParameters fromJson(Map json) => _$TextRuleParametersFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/text_rule_parameters.freezed.dart b/packages/stream_chat/lib/open_api/model/text_rule_parameters.freezed.dart new file mode 100644 index 0000000000..5ea5f0db97 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/text_rule_parameters.freezed.dart @@ -0,0 +1,170 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'text_rule_parameters.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$TextRuleParameters { + List? get blocklistMatch; + bool? get containsUrl; + List? get harmLabels; + Map? get llmHarmLabels; + double? get semanticFilterMinThreshold; + List? get semanticFilterNames; + String? get severity; + int? get threshold; + String? get timeWindow; + + /// Create a copy of TextRuleParameters + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $TextRuleParametersCopyWith get copyWith => _$TextRuleParametersCopyWithImpl( + this as TextRuleParameters, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is TextRuleParameters && + const DeepCollectionEquality().equals( + other.blocklistMatch, + blocklistMatch, + ) && + (identical(other.containsUrl, containsUrl) || other.containsUrl == containsUrl) && + const DeepCollectionEquality().equals( + other.harmLabels, + harmLabels, + ) && + const DeepCollectionEquality().equals( + other.llmHarmLabels, + llmHarmLabels, + ) && + (identical( + other.semanticFilterMinThreshold, + semanticFilterMinThreshold, + ) || + other.semanticFilterMinThreshold == semanticFilterMinThreshold) && + const DeepCollectionEquality().equals( + other.semanticFilterNames, + semanticFilterNames, + ) && + (identical(other.severity, severity) || other.severity == severity) && + (identical(other.threshold, threshold) || other.threshold == threshold) && + (identical(other.timeWindow, timeWindow) || other.timeWindow == timeWindow)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(blocklistMatch), + containsUrl, + const DeepCollectionEquality().hash(harmLabels), + const DeepCollectionEquality().hash(llmHarmLabels), + semanticFilterMinThreshold, + const DeepCollectionEquality().hash(semanticFilterNames), + severity, + threshold, + timeWindow, + ); + + @override + String toString() { + return 'TextRuleParameters(blocklistMatch: $blocklistMatch, containsUrl: $containsUrl, harmLabels: $harmLabels, llmHarmLabels: $llmHarmLabels, semanticFilterMinThreshold: $semanticFilterMinThreshold, semanticFilterNames: $semanticFilterNames, severity: $severity, threshold: $threshold, timeWindow: $timeWindow)'; + } +} + +/// @nodoc +abstract mixin class $TextRuleParametersCopyWith<$Res> { + factory $TextRuleParametersCopyWith( + TextRuleParameters value, + $Res Function(TextRuleParameters) _then, + ) = _$TextRuleParametersCopyWithImpl; + @useResult + $Res call({ + List? blocklistMatch, + bool? containsUrl, + List? harmLabels, + Map? llmHarmLabels, + double? semanticFilterMinThreshold, + List? semanticFilterNames, + String? severity, + int? threshold, + String? timeWindow, + }); +} + +/// @nodoc +class _$TextRuleParametersCopyWithImpl<$Res> implements $TextRuleParametersCopyWith<$Res> { + _$TextRuleParametersCopyWithImpl(this._self, this._then); + + final TextRuleParameters _self; + final $Res Function(TextRuleParameters) _then; + + /// Create a copy of TextRuleParameters + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? blocklistMatch = freezed, + Object? containsUrl = freezed, + Object? harmLabels = freezed, + Object? llmHarmLabels = freezed, + Object? semanticFilterMinThreshold = freezed, + Object? semanticFilterNames = freezed, + Object? severity = freezed, + Object? threshold = freezed, + Object? timeWindow = freezed, + }) { + return _then( + TextRuleParameters( + blocklistMatch: freezed == blocklistMatch + ? _self.blocklistMatch + : blocklistMatch // ignore: cast_nullable_to_non_nullable + as List?, + containsUrl: freezed == containsUrl + ? _self.containsUrl + : containsUrl // ignore: cast_nullable_to_non_nullable + as bool?, + harmLabels: freezed == harmLabels + ? _self.harmLabels + : harmLabels // ignore: cast_nullable_to_non_nullable + as List?, + llmHarmLabels: freezed == llmHarmLabels + ? _self.llmHarmLabels + : llmHarmLabels // ignore: cast_nullable_to_non_nullable + as Map?, + semanticFilterMinThreshold: freezed == semanticFilterMinThreshold + ? _self.semanticFilterMinThreshold + : semanticFilterMinThreshold // ignore: cast_nullable_to_non_nullable + as double?, + semanticFilterNames: freezed == semanticFilterNames + ? _self.semanticFilterNames + : semanticFilterNames // ignore: cast_nullable_to_non_nullable + as List?, + severity: freezed == severity + ? _self.severity + : severity // ignore: cast_nullable_to_non_nullable + as String?, + threshold: freezed == threshold + ? _self.threshold + : threshold // ignore: cast_nullable_to_non_nullable + as int?, + timeWindow: freezed == timeWindow + ? _self.timeWindow + : timeWindow // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/text_rule_parameters.g.dart b/packages/stream_chat/lib/open_api/model/text_rule_parameters.g.dart new file mode 100644 index 0000000000..eee3718d57 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/text_rule_parameters.g.dart @@ -0,0 +1,33 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'text_rule_parameters.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +TextRuleParameters _$TextRuleParametersFromJson(Map json) => TextRuleParameters( + blocklistMatch: (json['blocklist_match'] as List?)?.map((e) => e as String).toList(), + containsUrl: json['contains_url'] as bool?, + harmLabels: (json['harm_labels'] as List?)?.map((e) => e as String).toList(), + llmHarmLabels: (json['llm_harm_labels'] as Map?)?.map( + (k, e) => MapEntry(k, e as String), + ), + semanticFilterMinThreshold: (json['semantic_filter_min_threshold'] as num?)?.toDouble(), + semanticFilterNames: (json['semantic_filter_names'] as List?)?.map((e) => e as String).toList(), + severity: json['severity'] as String?, + threshold: (json['threshold'] as num?)?.toInt(), + timeWindow: json['time_window'] as String?, +); + +Map _$TextRuleParametersToJson(TextRuleParameters instance) => { + 'blocklist_match': instance.blocklistMatch, + 'contains_url': instance.containsUrl, + 'harm_labels': instance.harmLabels, + 'llm_harm_labels': instance.llmHarmLabels, + 'semantic_filter_min_threshold': instance.semanticFilterMinThreshold, + 'semantic_filter_names': instance.semanticFilterNames, + 'severity': instance.severity, + 'threshold': instance.threshold, + 'time_window': instance.timeWindow, +}; diff --git a/packages/stream_chat/lib/open_api/model/thread_participant.dart b/packages/stream_chat/lib/open_api/model/thread_participant.dart new file mode 100644 index 0000000000..3b84372347 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/thread_participant.dart @@ -0,0 +1,75 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'thread_participant.g.dart'; +part 'thread_participant.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ThreadParticipant with _$ThreadParticipant { + const ThreadParticipant({ + required this.channelCid, + required this.createdAt, + required this.custom, + required this.lastReadAt, + this.lastThreadMessageAt, + this.leftThreadAt, + this.threadId, + this.user, + this.userId, + }); + + @override + @JsonKey(name: 'channel_cid') + final String channelCid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'last_read_at') + final DateTime lastReadAt; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'last_thread_message_at') + final DateTime? lastThreadMessageAt; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'left_thread_at') + final DateTime? leftThreadAt; + + @override + @JsonKey(name: 'thread_id') + final String? threadId; + + @override + @JsonKey(name: 'user') + final UserResponse? user; + + @override + @JsonKey(name: 'user_id') + final String? userId; + + Map toJson() => _$ThreadParticipantToJson(this); + + static ThreadParticipant fromJson(Map json) => _$ThreadParticipantFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/thread_participant.freezed.dart b/packages/stream_chat/lib/open_api/model/thread_participant.freezed.dart new file mode 100644 index 0000000000..07de74ad58 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/thread_participant.freezed.dart @@ -0,0 +1,155 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'thread_participant.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ThreadParticipant { + String get channelCid; + DateTime get createdAt; + Map get custom; + DateTime get lastReadAt; + DateTime? get lastThreadMessageAt; + DateTime? get leftThreadAt; + String? get threadId; + UserResponse? get user; + String? get userId; + + /// Create a copy of ThreadParticipant + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ThreadParticipantCopyWith get copyWith => _$ThreadParticipantCopyWithImpl( + this as ThreadParticipant, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ThreadParticipant && + (identical(other.channelCid, channelCid) || other.channelCid == channelCid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.lastReadAt, lastReadAt) || other.lastReadAt == lastReadAt) && + (identical(other.lastThreadMessageAt, lastThreadMessageAt) || + other.lastThreadMessageAt == lastThreadMessageAt) && + (identical(other.leftThreadAt, leftThreadAt) || other.leftThreadAt == leftThreadAt) && + (identical(other.threadId, threadId) || other.threadId == threadId) && + (identical(other.user, user) || other.user == user) && + (identical(other.userId, userId) || other.userId == userId)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channelCid, + createdAt, + const DeepCollectionEquality().hash(custom), + lastReadAt, + lastThreadMessageAt, + leftThreadAt, + threadId, + user, + userId, + ); + + @override + String toString() { + return 'ThreadParticipant(channelCid: $channelCid, createdAt: $createdAt, custom: $custom, lastReadAt: $lastReadAt, lastThreadMessageAt: $lastThreadMessageAt, leftThreadAt: $leftThreadAt, threadId: $threadId, user: $user, userId: $userId)'; + } +} + +/// @nodoc +abstract mixin class $ThreadParticipantCopyWith<$Res> { + factory $ThreadParticipantCopyWith( + ThreadParticipant value, + $Res Function(ThreadParticipant) _then, + ) = _$ThreadParticipantCopyWithImpl; + @useResult + $Res call({ + String channelCid, + DateTime createdAt, + Map custom, + DateTime lastReadAt, + DateTime? lastThreadMessageAt, + DateTime? leftThreadAt, + String? threadId, + UserResponse? user, + String? userId, + }); +} + +/// @nodoc +class _$ThreadParticipantCopyWithImpl<$Res> implements $ThreadParticipantCopyWith<$Res> { + _$ThreadParticipantCopyWithImpl(this._self, this._then); + + final ThreadParticipant _self; + final $Res Function(ThreadParticipant) _then; + + /// Create a copy of ThreadParticipant + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channelCid = null, + Object? createdAt = null, + Object? custom = null, + Object? lastReadAt = null, + Object? lastThreadMessageAt = freezed, + Object? leftThreadAt = freezed, + Object? threadId = freezed, + Object? user = freezed, + Object? userId = freezed, + }) { + return _then( + ThreadParticipant( + channelCid: null == channelCid + ? _self.channelCid + : channelCid // ignore: cast_nullable_to_non_nullable + as String, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + lastReadAt: null == lastReadAt + ? _self.lastReadAt + : lastReadAt // ignore: cast_nullable_to_non_nullable + as DateTime, + lastThreadMessageAt: freezed == lastThreadMessageAt + ? _self.lastThreadMessageAt + : lastThreadMessageAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + leftThreadAt: freezed == leftThreadAt + ? _self.leftThreadAt + : leftThreadAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + threadId: freezed == threadId + ? _self.threadId + : threadId // ignore: cast_nullable_to_non_nullable + as String?, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponse?, + userId: freezed == userId + ? _self.userId + : userId // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/thread_participant.g.dart b/packages/stream_chat/lib/open_api/model/thread_participant.g.dart new file mode 100644 index 0000000000..318f360ed5 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/thread_participant.g.dart @@ -0,0 +1,59 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'thread_participant.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ThreadParticipant _$ThreadParticipantFromJson(Map json) => ThreadParticipant( + channelCid: json['channel_cid'] as String, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + lastReadAt: const StreamDateTimeConverter().fromJson( + json['last_read_at'] as Object, + ), + lastThreadMessageAt: _$JsonConverterFromJson( + json['last_thread_message_at'], + const StreamDateTimeConverter().fromJson, + ), + leftThreadAt: _$JsonConverterFromJson( + json['left_thread_at'], + const StreamDateTimeConverter().fromJson, + ), + threadId: json['thread_id'] as String?, + user: json['user'] == null ? null : UserResponse.fromJson(json['user'] as Map), + userId: json['user_id'] as String?, +); + +Map _$ThreadParticipantToJson( + ThreadParticipant instance, +) => { + 'channel_cid': instance.channelCid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'last_read_at': const StreamDateTimeConverter().toJson(instance.lastReadAt), + 'last_thread_message_at': _$JsonConverterToJson( + instance.lastThreadMessageAt, + const StreamDateTimeConverter().toJson, + ), + 'left_thread_at': _$JsonConverterToJson( + instance.leftThreadAt, + const StreamDateTimeConverter().toJson, + ), + 'thread_id': instance.threadId, + 'user': instance.user?.toJson(), + 'user_id': instance.userId, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/thread_response.dart b/packages/stream_chat/lib/open_api/model/thread_response.dart new file mode 100644 index 0000000000..e6cf3b0f07 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/thread_response.dart @@ -0,0 +1,110 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'thread_response.g.dart'; +part 'thread_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ThreadResponse with _$ThreadResponse { + const ThreadResponse({ + required this.activeParticipantCount, + this.channel, + required this.channelCid, + required this.createdAt, + this.createdBy, + required this.createdByUserId, + required this.custom, + this.deletedAt, + this.lastMessageAt, + this.parentMessage, + required this.parentMessageId, + required this.participantCount, + required this.replyCount, + this.threadParticipants, + required this.title, + required this.updatedAt, + }); + + @override + @JsonKey(name: 'active_participant_count') + final int activeParticipantCount; + + @override + @JsonKey(name: 'channel') + final ChannelResponse? channel; + + @override + @JsonKey(name: 'channel_cid') + final String channelCid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'created_by') + final UserResponse? createdBy; + + @override + @JsonKey(name: 'created_by_user_id') + final String createdByUserId; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'deleted_at') + final DateTime? deletedAt; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'last_message_at') + final DateTime? lastMessageAt; + + @override + @JsonKey(name: 'parent_message') + final MessageResponse? parentMessage; + + @override + @JsonKey(name: 'parent_message_id') + final String parentMessageId; + + @override + @JsonKey(name: 'participant_count') + final int participantCount; + + @override + @JsonKey(name: 'reply_count') + final int replyCount; + + @override + @JsonKey(name: 'thread_participants') + final List? threadParticipants; + + @override + @JsonKey(name: 'title') + final String title; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'updated_at') + final DateTime updatedAt; + + Map toJson() => _$ThreadResponseToJson(this); + + static ThreadResponse fromJson(Map json) => _$ThreadResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/thread_response.freezed.dart b/packages/stream_chat/lib/open_api/model/thread_response.freezed.dart new file mode 100644 index 0000000000..2a64823586 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/thread_response.freezed.dart @@ -0,0 +1,221 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'thread_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ThreadResponse { + int get activeParticipantCount; + ChannelResponse? get channel; + String get channelCid; + DateTime get createdAt; + UserResponse? get createdBy; + String get createdByUserId; + Map get custom; + DateTime? get deletedAt; + DateTime? get lastMessageAt; + MessageResponse? get parentMessage; + String get parentMessageId; + int get participantCount; + int get replyCount; + List? get threadParticipants; + String get title; + DateTime get updatedAt; + + /// Create a copy of ThreadResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ThreadResponseCopyWith get copyWith => _$ThreadResponseCopyWithImpl( + this as ThreadResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ThreadResponse && + (identical(other.activeParticipantCount, activeParticipantCount) || + other.activeParticipantCount == activeParticipantCount) && + (identical(other.channel, channel) || other.channel == channel) && + (identical(other.channelCid, channelCid) || other.channelCid == channelCid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.createdBy, createdBy) || other.createdBy == createdBy) && + (identical(other.createdByUserId, createdByUserId) || other.createdByUserId == createdByUserId) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt) && + (identical(other.lastMessageAt, lastMessageAt) || other.lastMessageAt == lastMessageAt) && + (identical(other.parentMessage, parentMessage) || other.parentMessage == parentMessage) && + (identical(other.parentMessageId, parentMessageId) || other.parentMessageId == parentMessageId) && + (identical(other.participantCount, participantCount) || other.participantCount == participantCount) && + (identical(other.replyCount, replyCount) || other.replyCount == replyCount) && + const DeepCollectionEquality().equals( + other.threadParticipants, + threadParticipants, + ) && + (identical(other.title, title) || other.title == title) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + activeParticipantCount, + channel, + channelCid, + createdAt, + createdBy, + createdByUserId, + const DeepCollectionEquality().hash(custom), + deletedAt, + lastMessageAt, + parentMessage, + parentMessageId, + participantCount, + replyCount, + const DeepCollectionEquality().hash(threadParticipants), + title, + updatedAt, + ); + + @override + String toString() { + return 'ThreadResponse(activeParticipantCount: $activeParticipantCount, channel: $channel, channelCid: $channelCid, createdAt: $createdAt, createdBy: $createdBy, createdByUserId: $createdByUserId, custom: $custom, deletedAt: $deletedAt, lastMessageAt: $lastMessageAt, parentMessage: $parentMessage, parentMessageId: $parentMessageId, participantCount: $participantCount, replyCount: $replyCount, threadParticipants: $threadParticipants, title: $title, updatedAt: $updatedAt)'; + } +} + +/// @nodoc +abstract mixin class $ThreadResponseCopyWith<$Res> { + factory $ThreadResponseCopyWith( + ThreadResponse value, + $Res Function(ThreadResponse) _then, + ) = _$ThreadResponseCopyWithImpl; + @useResult + $Res call({ + int activeParticipantCount, + ChannelResponse? channel, + String channelCid, + DateTime createdAt, + UserResponse? createdBy, + String createdByUserId, + Map custom, + DateTime? deletedAt, + DateTime? lastMessageAt, + MessageResponse? parentMessage, + String parentMessageId, + int participantCount, + int replyCount, + List? threadParticipants, + String title, + DateTime updatedAt, + }); +} + +/// @nodoc +class _$ThreadResponseCopyWithImpl<$Res> implements $ThreadResponseCopyWith<$Res> { + _$ThreadResponseCopyWithImpl(this._self, this._then); + + final ThreadResponse _self; + final $Res Function(ThreadResponse) _then; + + /// Create a copy of ThreadResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? activeParticipantCount = null, + Object? channel = freezed, + Object? channelCid = null, + Object? createdAt = null, + Object? createdBy = freezed, + Object? createdByUserId = null, + Object? custom = null, + Object? deletedAt = freezed, + Object? lastMessageAt = freezed, + Object? parentMessage = freezed, + Object? parentMessageId = null, + Object? participantCount = null, + Object? replyCount = null, + Object? threadParticipants = freezed, + Object? title = null, + Object? updatedAt = null, + }) { + return _then( + ThreadResponse( + activeParticipantCount: null == activeParticipantCount + ? _self.activeParticipantCount + : activeParticipantCount // ignore: cast_nullable_to_non_nullable + as int, + channel: freezed == channel + ? _self.channel + : channel // ignore: cast_nullable_to_non_nullable + as ChannelResponse?, + channelCid: null == channelCid + ? _self.channelCid + : channelCid // ignore: cast_nullable_to_non_nullable + as String, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + createdBy: freezed == createdBy + ? _self.createdBy + : createdBy // ignore: cast_nullable_to_non_nullable + as UserResponse?, + createdByUserId: null == createdByUserId + ? _self.createdByUserId + : createdByUserId // ignore: cast_nullable_to_non_nullable + as String, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + deletedAt: freezed == deletedAt + ? _self.deletedAt + : deletedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + lastMessageAt: freezed == lastMessageAt + ? _self.lastMessageAt + : lastMessageAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + parentMessage: freezed == parentMessage + ? _self.parentMessage + : parentMessage // ignore: cast_nullable_to_non_nullable + as MessageResponse?, + parentMessageId: null == parentMessageId + ? _self.parentMessageId + : parentMessageId // ignore: cast_nullable_to_non_nullable + as String, + participantCount: null == participantCount + ? _self.participantCount + : participantCount // ignore: cast_nullable_to_non_nullable + as int, + replyCount: null == replyCount + ? _self.replyCount + : replyCount // ignore: cast_nullable_to_non_nullable + as int, + threadParticipants: freezed == threadParticipants + ? _self.threadParticipants + : threadParticipants // ignore: cast_nullable_to_non_nullable + as List?, + title: null == title + ? _self.title + : title // ignore: cast_nullable_to_non_nullable + as String, + updatedAt: null == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/thread_response.g.dart b/packages/stream_chat/lib/open_api/model/thread_response.g.dart new file mode 100644 index 0000000000..87ce78a5ad --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/thread_response.g.dart @@ -0,0 +1,77 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'thread_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ThreadResponse _$ThreadResponseFromJson(Map json) => ThreadResponse( + activeParticipantCount: (json['active_participant_count'] as num).toInt(), + channel: json['channel'] == null ? null : ChannelResponse.fromJson(json['channel'] as Map), + channelCid: json['channel_cid'] as String, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + createdBy: json['created_by'] == null ? null : UserResponse.fromJson(json['created_by'] as Map), + createdByUserId: json['created_by_user_id'] as String, + custom: json['custom'] as Map, + deletedAt: _$JsonConverterFromJson( + json['deleted_at'], + const StreamDateTimeConverter().fromJson, + ), + lastMessageAt: _$JsonConverterFromJson( + json['last_message_at'], + const StreamDateTimeConverter().fromJson, + ), + parentMessage: json['parent_message'] == null + ? null + : MessageResponse.fromJson( + json['parent_message'] as Map, + ), + parentMessageId: json['parent_message_id'] as String, + participantCount: (json['participant_count'] as num).toInt(), + replyCount: (json['reply_count'] as num).toInt(), + threadParticipants: (json['thread_participants'] as List?) + ?.map((e) => ThreadParticipant.fromJson(e as Map)) + .toList(), + title: json['title'] as String, + updatedAt: const StreamDateTimeConverter().fromJson( + json['updated_at'] as Object, + ), +); + +Map _$ThreadResponseToJson(ThreadResponse instance) => { + 'active_participant_count': instance.activeParticipantCount, + 'channel': instance.channel?.toJson(), + 'channel_cid': instance.channelCid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'created_by': instance.createdBy?.toJson(), + 'created_by_user_id': instance.createdByUserId, + 'custom': instance.custom, + 'deleted_at': _$JsonConverterToJson( + instance.deletedAt, + const StreamDateTimeConverter().toJson, + ), + 'last_message_at': _$JsonConverterToJson( + instance.lastMessageAt, + const StreamDateTimeConverter().toJson, + ), + 'parent_message': instance.parentMessage?.toJson(), + 'parent_message_id': instance.parentMessageId, + 'participant_count': instance.participantCount, + 'reply_count': instance.replyCount, + 'thread_participants': instance.threadParticipants?.map((e) => e.toJson()).toList(), + 'title': instance.title, + 'updated_at': const StreamDateTimeConverter().toJson(instance.updatedAt), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/thread_state_response.dart b/packages/stream_chat/lib/open_api/model/thread_state_response.dart new file mode 100644 index 0000000000..107b6372a0 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/thread_state_response.dart @@ -0,0 +1,125 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'thread_state_response.g.dart'; +part 'thread_state_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ThreadStateResponse with _$ThreadStateResponse { + const ThreadStateResponse({ + required this.activeParticipantCount, + this.channel, + required this.channelCid, + required this.createdAt, + this.createdBy, + required this.createdByUserId, + required this.custom, + this.deletedAt, + this.draft, + this.lastMessageAt, + required this.latestReplies, + this.parentMessage, + required this.parentMessageId, + required this.participantCount, + this.read, + required this.replyCount, + this.threadParticipants, + required this.title, + required this.updatedAt, + }); + + @override + @JsonKey(name: 'active_participant_count') + final int activeParticipantCount; + + @override + @JsonKey(name: 'channel') + final ChannelResponse? channel; + + @override + @JsonKey(name: 'channel_cid') + final String channelCid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'created_by') + final UserResponse? createdBy; + + @override + @JsonKey(name: 'created_by_user_id') + final String createdByUserId; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'deleted_at') + final DateTime? deletedAt; + + @override + @JsonKey(name: 'draft') + final DraftResponse? draft; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'last_message_at') + final DateTime? lastMessageAt; + + @override + @JsonKey(name: 'latest_replies') + final List latestReplies; + + @override + @JsonKey(name: 'parent_message') + final MessageResponse? parentMessage; + + @override + @JsonKey(name: 'parent_message_id') + final String parentMessageId; + + @override + @JsonKey(name: 'participant_count') + final int participantCount; + + @override + @JsonKey(name: 'read') + final List? read; + + @override + @JsonKey(name: 'reply_count') + final int replyCount; + + @override + @JsonKey(name: 'thread_participants') + final List? threadParticipants; + + @override + @JsonKey(name: 'title') + final String title; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'updated_at') + final DateTime updatedAt; + + Map toJson() => _$ThreadStateResponseToJson(this); + + static ThreadStateResponse fromJson(Map json) => _$ThreadStateResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/thread_state_response.freezed.dart b/packages/stream_chat/lib/open_api/model/thread_state_response.freezed.dart new file mode 100644 index 0000000000..2aec3c7084 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/thread_state_response.freezed.dart @@ -0,0 +1,252 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'thread_state_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ThreadStateResponse { + int get activeParticipantCount; + ChannelResponse? get channel; + String get channelCid; + DateTime get createdAt; + UserResponse? get createdBy; + String get createdByUserId; + Map get custom; + DateTime? get deletedAt; + DraftResponse? get draft; + DateTime? get lastMessageAt; + List get latestReplies; + MessageResponse? get parentMessage; + String get parentMessageId; + int get participantCount; + List? get read; + int get replyCount; + List? get threadParticipants; + String get title; + DateTime get updatedAt; + + /// Create a copy of ThreadStateResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ThreadStateResponseCopyWith get copyWith => + _$ThreadStateResponseCopyWithImpl( + this as ThreadStateResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ThreadStateResponse && + (identical(other.activeParticipantCount, activeParticipantCount) || + other.activeParticipantCount == activeParticipantCount) && + (identical(other.channel, channel) || other.channel == channel) && + (identical(other.channelCid, channelCid) || other.channelCid == channelCid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.createdBy, createdBy) || other.createdBy == createdBy) && + (identical(other.createdByUserId, createdByUserId) || other.createdByUserId == createdByUserId) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt) && + (identical(other.draft, draft) || other.draft == draft) && + (identical(other.lastMessageAt, lastMessageAt) || other.lastMessageAt == lastMessageAt) && + const DeepCollectionEquality().equals( + other.latestReplies, + latestReplies, + ) && + (identical(other.parentMessage, parentMessage) || other.parentMessage == parentMessage) && + (identical(other.parentMessageId, parentMessageId) || other.parentMessageId == parentMessageId) && + (identical(other.participantCount, participantCount) || other.participantCount == participantCount) && + const DeepCollectionEquality().equals(other.read, read) && + (identical(other.replyCount, replyCount) || other.replyCount == replyCount) && + const DeepCollectionEquality().equals( + other.threadParticipants, + threadParticipants, + ) && + (identical(other.title, title) || other.title == title) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)); + } + + @override + int get hashCode => Object.hashAll([ + runtimeType, + activeParticipantCount, + channel, + channelCid, + createdAt, + createdBy, + createdByUserId, + const DeepCollectionEquality().hash(custom), + deletedAt, + draft, + lastMessageAt, + const DeepCollectionEquality().hash(latestReplies), + parentMessage, + parentMessageId, + participantCount, + const DeepCollectionEquality().hash(read), + replyCount, + const DeepCollectionEquality().hash(threadParticipants), + title, + updatedAt, + ]); + + @override + String toString() { + return 'ThreadStateResponse(activeParticipantCount: $activeParticipantCount, channel: $channel, channelCid: $channelCid, createdAt: $createdAt, createdBy: $createdBy, createdByUserId: $createdByUserId, custom: $custom, deletedAt: $deletedAt, draft: $draft, lastMessageAt: $lastMessageAt, latestReplies: $latestReplies, parentMessage: $parentMessage, parentMessageId: $parentMessageId, participantCount: $participantCount, read: $read, replyCount: $replyCount, threadParticipants: $threadParticipants, title: $title, updatedAt: $updatedAt)'; + } +} + +/// @nodoc +abstract mixin class $ThreadStateResponseCopyWith<$Res> { + factory $ThreadStateResponseCopyWith( + ThreadStateResponse value, + $Res Function(ThreadStateResponse) _then, + ) = _$ThreadStateResponseCopyWithImpl; + @useResult + $Res call({ + int activeParticipantCount, + ChannelResponse? channel, + String channelCid, + DateTime createdAt, + UserResponse? createdBy, + String createdByUserId, + Map custom, + DateTime? deletedAt, + DraftResponse? draft, + DateTime? lastMessageAt, + List latestReplies, + MessageResponse? parentMessage, + String parentMessageId, + int participantCount, + List? read, + int replyCount, + List? threadParticipants, + String title, + DateTime updatedAt, + }); +} + +/// @nodoc +class _$ThreadStateResponseCopyWithImpl<$Res> implements $ThreadStateResponseCopyWith<$Res> { + _$ThreadStateResponseCopyWithImpl(this._self, this._then); + + final ThreadStateResponse _self; + final $Res Function(ThreadStateResponse) _then; + + /// Create a copy of ThreadStateResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? activeParticipantCount = null, + Object? channel = freezed, + Object? channelCid = null, + Object? createdAt = null, + Object? createdBy = freezed, + Object? createdByUserId = null, + Object? custom = null, + Object? deletedAt = freezed, + Object? draft = freezed, + Object? lastMessageAt = freezed, + Object? latestReplies = null, + Object? parentMessage = freezed, + Object? parentMessageId = null, + Object? participantCount = null, + Object? read = freezed, + Object? replyCount = null, + Object? threadParticipants = freezed, + Object? title = null, + Object? updatedAt = null, + }) { + return _then( + ThreadStateResponse( + activeParticipantCount: null == activeParticipantCount + ? _self.activeParticipantCount + : activeParticipantCount // ignore: cast_nullable_to_non_nullable + as int, + channel: freezed == channel + ? _self.channel + : channel // ignore: cast_nullable_to_non_nullable + as ChannelResponse?, + channelCid: null == channelCid + ? _self.channelCid + : channelCid // ignore: cast_nullable_to_non_nullable + as String, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + createdBy: freezed == createdBy + ? _self.createdBy + : createdBy // ignore: cast_nullable_to_non_nullable + as UserResponse?, + createdByUserId: null == createdByUserId + ? _self.createdByUserId + : createdByUserId // ignore: cast_nullable_to_non_nullable + as String, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + deletedAt: freezed == deletedAt + ? _self.deletedAt + : deletedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + draft: freezed == draft + ? _self.draft + : draft // ignore: cast_nullable_to_non_nullable + as DraftResponse?, + lastMessageAt: freezed == lastMessageAt + ? _self.lastMessageAt + : lastMessageAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + latestReplies: null == latestReplies + ? _self.latestReplies + : latestReplies // ignore: cast_nullable_to_non_nullable + as List, + parentMessage: freezed == parentMessage + ? _self.parentMessage + : parentMessage // ignore: cast_nullable_to_non_nullable + as MessageResponse?, + parentMessageId: null == parentMessageId + ? _self.parentMessageId + : parentMessageId // ignore: cast_nullable_to_non_nullable + as String, + participantCount: null == participantCount + ? _self.participantCount + : participantCount // ignore: cast_nullable_to_non_nullable + as int, + read: freezed == read + ? _self.read + : read // ignore: cast_nullable_to_non_nullable + as List?, + replyCount: null == replyCount + ? _self.replyCount + : replyCount // ignore: cast_nullable_to_non_nullable + as int, + threadParticipants: freezed == threadParticipants + ? _self.threadParticipants + : threadParticipants // ignore: cast_nullable_to_non_nullable + as List?, + title: null == title + ? _self.title + : title // ignore: cast_nullable_to_non_nullable + as String, + updatedAt: null == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/thread_state_response.g.dart b/packages/stream_chat/lib/open_api/model/thread_state_response.g.dart new file mode 100644 index 0000000000..8d042b9468 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/thread_state_response.g.dart @@ -0,0 +1,87 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'thread_state_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ThreadStateResponse _$ThreadStateResponseFromJson(Map json) => ThreadStateResponse( + activeParticipantCount: (json['active_participant_count'] as num).toInt(), + channel: json['channel'] == null ? null : ChannelResponse.fromJson(json['channel'] as Map), + channelCid: json['channel_cid'] as String, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + createdBy: json['created_by'] == null ? null : UserResponse.fromJson(json['created_by'] as Map), + createdByUserId: json['created_by_user_id'] as String, + custom: json['custom'] as Map, + deletedAt: _$JsonConverterFromJson( + json['deleted_at'], + const StreamDateTimeConverter().fromJson, + ), + draft: json['draft'] == null ? null : DraftResponse.fromJson(json['draft'] as Map), + lastMessageAt: _$JsonConverterFromJson( + json['last_message_at'], + const StreamDateTimeConverter().fromJson, + ), + latestReplies: (json['latest_replies'] as List) + .map((e) => MessageResponse.fromJson(e as Map)) + .toList(), + parentMessage: json['parent_message'] == null + ? null + : MessageResponse.fromJson( + json['parent_message'] as Map, + ), + parentMessageId: json['parent_message_id'] as String, + participantCount: (json['participant_count'] as num).toInt(), + read: (json['read'] as List?)?.map((e) => ReadStateResponse.fromJson(e as Map)).toList(), + replyCount: (json['reply_count'] as num).toInt(), + threadParticipants: (json['thread_participants'] as List?) + ?.map((e) => ThreadParticipant.fromJson(e as Map)) + .toList(), + title: json['title'] as String, + updatedAt: const StreamDateTimeConverter().fromJson( + json['updated_at'] as Object, + ), +); + +Map _$ThreadStateResponseToJson( + ThreadStateResponse instance, +) => { + 'active_participant_count': instance.activeParticipantCount, + 'channel': instance.channel?.toJson(), + 'channel_cid': instance.channelCid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'created_by': instance.createdBy?.toJson(), + 'created_by_user_id': instance.createdByUserId, + 'custom': instance.custom, + 'deleted_at': _$JsonConverterToJson( + instance.deletedAt, + const StreamDateTimeConverter().toJson, + ), + 'draft': instance.draft?.toJson(), + 'last_message_at': _$JsonConverterToJson( + instance.lastMessageAt, + const StreamDateTimeConverter().toJson, + ), + 'latest_replies': instance.latestReplies.map((e) => e.toJson()).toList(), + 'parent_message': instance.parentMessage?.toJson(), + 'parent_message_id': instance.parentMessageId, + 'participant_count': instance.participantCount, + 'read': instance.read?.map((e) => e.toJson()).toList(), + 'reply_count': instance.replyCount, + 'thread_participants': instance.threadParticipants?.map((e) => e.toJson()).toList(), + 'title': instance.title, + 'updated_at': const StreamDateTimeConverter().toJson(instance.updatedAt), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/thread_updated_event.dart b/packages/stream_chat/lib/open_api/model/thread_updated_event.dart new file mode 100644 index 0000000000..e975788203 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/thread_updated_event.dart @@ -0,0 +1,68 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'thread_updated_event.g.dart'; +part 'thread_updated_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class ThreadUpdatedEvent extends core.WsEvent with _$ThreadUpdatedEvent { + const ThreadUpdatedEvent({ + this.channelId, + this.channelType, + this.cid, + required this.createdAt, + required this.custom, + this.receivedAt, + this.thread, + required this.type, + }); + + @override + @JsonKey(name: 'channel_id') + final String? channelId; + + @override + @JsonKey(name: 'channel_type') + final String? channelType; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'thread') + final ThreadResponse? thread; + + @override + @JsonKey(name: 'type') + final String type; + + Map toJson() => _$ThreadUpdatedEventToJson(this); + + static ThreadUpdatedEvent fromJson(Map json) => _$ThreadUpdatedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/thread_updated_event.freezed.dart b/packages/stream_chat/lib/open_api/model/thread_updated_event.freezed.dart new file mode 100644 index 0000000000..aaa69d7d0a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/thread_updated_event.freezed.dart @@ -0,0 +1,145 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'thread_updated_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ThreadUpdatedEvent { + String? get channelId; + String? get channelType; + String? get cid; + DateTime get createdAt; + Map get custom; + DateTime? get receivedAt; + ThreadResponse? get thread; + String get type; + + /// Create a copy of ThreadUpdatedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ThreadUpdatedEventCopyWith get copyWith => _$ThreadUpdatedEventCopyWithImpl( + this as ThreadUpdatedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ThreadUpdatedEvent && + (identical(other.channelId, channelId) || other.channelId == channelId) && + (identical(other.channelType, channelType) || other.channelType == channelType) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.thread, thread) || other.thread == thread) && + (identical(other.type, type) || other.type == type)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channelId, + channelType, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + receivedAt, + thread, + type, + ); + + @override + String toString() { + return 'ThreadUpdatedEvent(channelId: $channelId, channelType: $channelType, cid: $cid, createdAt: $createdAt, custom: $custom, receivedAt: $receivedAt, thread: $thread, type: $type)'; + } +} + +/// @nodoc +abstract mixin class $ThreadUpdatedEventCopyWith<$Res> { + factory $ThreadUpdatedEventCopyWith( + ThreadUpdatedEvent value, + $Res Function(ThreadUpdatedEvent) _then, + ) = _$ThreadUpdatedEventCopyWithImpl; + @useResult + $Res call({ + String? channelId, + String? channelType, + String? cid, + DateTime createdAt, + Map custom, + DateTime? receivedAt, + ThreadResponse? thread, + String type, + }); +} + +/// @nodoc +class _$ThreadUpdatedEventCopyWithImpl<$Res> implements $ThreadUpdatedEventCopyWith<$Res> { + _$ThreadUpdatedEventCopyWithImpl(this._self, this._then); + + final ThreadUpdatedEvent _self; + final $Res Function(ThreadUpdatedEvent) _then; + + /// Create a copy of ThreadUpdatedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channelId = freezed, + Object? channelType = freezed, + Object? cid = freezed, + Object? createdAt = null, + Object? custom = null, + Object? receivedAt = freezed, + Object? thread = freezed, + Object? type = null, + }) { + return _then( + ThreadUpdatedEvent( + channelId: freezed == channelId + ? _self.channelId + : channelId // ignore: cast_nullable_to_non_nullable + as String?, + channelType: freezed == channelType + ? _self.channelType + : channelType // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + thread: freezed == thread + ? _self.thread + : thread // ignore: cast_nullable_to_non_nullable + as ThreadResponse?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/thread_updated_event.g.dart b/packages/stream_chat/lib/open_api/model/thread_updated_event.g.dart new file mode 100644 index 0000000000..4b5de90b1b --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/thread_updated_event.g.dart @@ -0,0 +1,47 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'thread_updated_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ThreadUpdatedEvent _$ThreadUpdatedEventFromJson(Map json) => ThreadUpdatedEvent( + channelId: json['channel_id'] as String?, + channelType: json['channel_type'] as String?, + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + thread: json['thread'] == null ? null : ThreadResponse.fromJson(json['thread'] as Map), + type: json['type'] as String, +); + +Map _$ThreadUpdatedEventToJson(ThreadUpdatedEvent instance) => { + 'channel_id': instance.channelId, + 'channel_type': instance.channelType, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'thread': instance.thread?.toJson(), + 'type': instance.type, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/thresholds.dart b/packages/stream_chat/lib/open_api/model/thresholds.dart new file mode 100644 index 0000000000..3420d68e9d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/thresholds.dart @@ -0,0 +1,41 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'thresholds.g.dart'; +part 'thresholds.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class Thresholds with _$Thresholds { + const Thresholds({ + this.explicit, + this.spam, + this.toxic, + }); + + @override + @JsonKey(name: 'explicit') + final LabelThresholds? explicit; + + @override + @JsonKey(name: 'spam') + final LabelThresholds? spam; + + @override + @JsonKey(name: 'toxic') + final LabelThresholds? toxic; + + Map toJson() => _$ThresholdsToJson(this); + + static Thresholds fromJson(Map json) => _$ThresholdsFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/thresholds.freezed.dart b/packages/stream_chat/lib/open_api/model/thresholds.freezed.dart new file mode 100644 index 0000000000..139c94cb7d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/thresholds.freezed.dart @@ -0,0 +1,92 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'thresholds.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$Thresholds { + LabelThresholds? get explicit; + LabelThresholds? get spam; + LabelThresholds? get toxic; + + /// Create a copy of Thresholds + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ThresholdsCopyWith get copyWith => _$ThresholdsCopyWithImpl(this as Thresholds, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is Thresholds && + (identical(other.explicit, explicit) || other.explicit == explicit) && + (identical(other.spam, spam) || other.spam == spam) && + (identical(other.toxic, toxic) || other.toxic == toxic)); + } + + @override + int get hashCode => Object.hash(runtimeType, explicit, spam, toxic); + + @override + String toString() { + return 'Thresholds(explicit: $explicit, spam: $spam, toxic: $toxic)'; + } +} + +/// @nodoc +abstract mixin class $ThresholdsCopyWith<$Res> { + factory $ThresholdsCopyWith( + Thresholds value, + $Res Function(Thresholds) _then, + ) = _$ThresholdsCopyWithImpl; + @useResult + $Res call({ + LabelThresholds? explicit, + LabelThresholds? spam, + LabelThresholds? toxic, + }); +} + +/// @nodoc +class _$ThresholdsCopyWithImpl<$Res> implements $ThresholdsCopyWith<$Res> { + _$ThresholdsCopyWithImpl(this._self, this._then); + + final Thresholds _self; + final $Res Function(Thresholds) _then; + + /// Create a copy of Thresholds + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? explicit = freezed, + Object? spam = freezed, + Object? toxic = freezed, + }) { + return _then( + Thresholds( + explicit: freezed == explicit + ? _self.explicit + : explicit // ignore: cast_nullable_to_non_nullable + as LabelThresholds?, + spam: freezed == spam + ? _self.spam + : spam // ignore: cast_nullable_to_non_nullable + as LabelThresholds?, + toxic: freezed == toxic + ? _self.toxic + : toxic // ignore: cast_nullable_to_non_nullable + as LabelThresholds?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/thresholds.g.dart b/packages/stream_chat/lib/open_api/model/thresholds.g.dart new file mode 100644 index 0000000000..ac8d52d2f5 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/thresholds.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'thresholds.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +Thresholds _$ThresholdsFromJson(Map json) => Thresholds( + explicit: json['explicit'] == null ? null : LabelThresholds.fromJson(json['explicit'] as Map), + spam: json['spam'] == null ? null : LabelThresholds.fromJson(json['spam'] as Map), + toxic: json['toxic'] == null ? null : LabelThresholds.fromJson(json['toxic'] as Map), +); + +Map _$ThresholdsToJson(Thresholds instance) => { + 'explicit': instance.explicit?.toJson(), + 'spam': instance.spam?.toJson(), + 'toxic': instance.toxic?.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/translate_message_request.dart b/packages/stream_chat/lib/open_api/model/translate_message_request.dart new file mode 100644 index 0000000000..b9d0497582 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/translate_message_request.dart @@ -0,0 +1,95 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'translate_message_request.g.dart'; +part 'translate_message_request.freezed.dart'; + +extension type const TranslateMessageRequestLanguage._(String _) implements String { + static const af = TranslateMessageRequestLanguage._('af'); + static const am = TranslateMessageRequestLanguage._('am'); + static const ar = TranslateMessageRequestLanguage._('ar'); + static const az = TranslateMessageRequestLanguage._('az'); + static const bg = TranslateMessageRequestLanguage._('bg'); + static const bn = TranslateMessageRequestLanguage._('bn'); + static const bs = TranslateMessageRequestLanguage._('bs'); + static const cs = TranslateMessageRequestLanguage._('cs'); + static const da = TranslateMessageRequestLanguage._('da'); + static const de = TranslateMessageRequestLanguage._('de'); + static const el = TranslateMessageRequestLanguage._('el'); + static const en = TranslateMessageRequestLanguage._('en'); + static const es = TranslateMessageRequestLanguage._('es'); + static const esMX = TranslateMessageRequestLanguage._('es-MX'); + static const et = TranslateMessageRequestLanguage._('et'); + static const fa = TranslateMessageRequestLanguage._('fa'); + static const faAF = TranslateMessageRequestLanguage._('fa-AF'); + static const fi = TranslateMessageRequestLanguage._('fi'); + static const fr = TranslateMessageRequestLanguage._('fr'); + static const frCA = TranslateMessageRequestLanguage._('fr-CA'); + static const ha = TranslateMessageRequestLanguage._('ha'); + static const he = TranslateMessageRequestLanguage._('he'); + static const hi = TranslateMessageRequestLanguage._('hi'); + static const hr = TranslateMessageRequestLanguage._('hr'); + static const ht = TranslateMessageRequestLanguage._('ht'); + static const hu = TranslateMessageRequestLanguage._('hu'); + static const id = TranslateMessageRequestLanguage._('id'); + static const it = TranslateMessageRequestLanguage._('it'); + static const ja = TranslateMessageRequestLanguage._('ja'); + static const ka = TranslateMessageRequestLanguage._('ka'); + static const ko = TranslateMessageRequestLanguage._('ko'); + static const lt = TranslateMessageRequestLanguage._('lt'); + static const lv = TranslateMessageRequestLanguage._('lv'); + static const ms = TranslateMessageRequestLanguage._('ms'); + static const nl = TranslateMessageRequestLanguage._('nl'); + static const no = TranslateMessageRequestLanguage._('no'); + static const pl = TranslateMessageRequestLanguage._('pl'); + static const ps = TranslateMessageRequestLanguage._('ps'); + static const pt = TranslateMessageRequestLanguage._('pt'); + static const ro = TranslateMessageRequestLanguage._('ro'); + static const ru = TranslateMessageRequestLanguage._('ru'); + static const sk = TranslateMessageRequestLanguage._('sk'); + static const sl = TranslateMessageRequestLanguage._('sl'); + static const so = TranslateMessageRequestLanguage._('so'); + static const sq = TranslateMessageRequestLanguage._('sq'); + static const sr = TranslateMessageRequestLanguage._('sr'); + static const sv = TranslateMessageRequestLanguage._('sv'); + static const sw = TranslateMessageRequestLanguage._('sw'); + static const ta = TranslateMessageRequestLanguage._('ta'); + static const th = TranslateMessageRequestLanguage._('th'); + static const tl = TranslateMessageRequestLanguage._('tl'); + static const tr = TranslateMessageRequestLanguage._('tr'); + static const uk = TranslateMessageRequestLanguage._('uk'); + static const ur = TranslateMessageRequestLanguage._('ur'); + static const vi = TranslateMessageRequestLanguage._('vi'); + static const zh = TranslateMessageRequestLanguage._('zh'); + static const zhTW = TranslateMessageRequestLanguage._('zh-TW'); + + factory TranslateMessageRequestLanguage.fromJson(String json) => TranslateMessageRequestLanguage._(json); + + String toJson() => this; +} + +@freezed +@immutable +@JsonSerializable() +class TranslateMessageRequest with _$TranslateMessageRequest { + const TranslateMessageRequest({ + required this.language, + }); + + @override + @JsonKey(name: 'language') + final TranslateMessageRequestLanguage language; + + Map toJson() => _$TranslateMessageRequestToJson(this); + + static TranslateMessageRequest fromJson(Map json) => _$TranslateMessageRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/translate_message_request.freezed.dart b/packages/stream_chat/lib/open_api/model/translate_message_request.freezed.dart new file mode 100644 index 0000000000..9c7aa9dc3c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/translate_message_request.freezed.dart @@ -0,0 +1,76 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'translate_message_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$TranslateMessageRequest { + TranslateMessageRequestLanguage get language; + + /// Create a copy of TranslateMessageRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $TranslateMessageRequestCopyWith get copyWith => + _$TranslateMessageRequestCopyWithImpl( + this as TranslateMessageRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is TranslateMessageRequest && + (identical(other.language, language) || other.language == language)); + } + + @override + int get hashCode => Object.hash(runtimeType, language); + + @override + String toString() { + return 'TranslateMessageRequest(language: $language)'; + } +} + +/// @nodoc +abstract mixin class $TranslateMessageRequestCopyWith<$Res> { + factory $TranslateMessageRequestCopyWith( + TranslateMessageRequest value, + $Res Function(TranslateMessageRequest) _then, + ) = _$TranslateMessageRequestCopyWithImpl; + @useResult + $Res call({TranslateMessageRequestLanguage language}); +} + +/// @nodoc +class _$TranslateMessageRequestCopyWithImpl<$Res> implements $TranslateMessageRequestCopyWith<$Res> { + _$TranslateMessageRequestCopyWithImpl(this._self, this._then); + + final TranslateMessageRequest _self; + final $Res Function(TranslateMessageRequest) _then; + + /// Create a copy of TranslateMessageRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? language = null}) { + return _then( + TranslateMessageRequest( + language: null == language + ? _self.language + : language // ignore: cast_nullable_to_non_nullable + as TranslateMessageRequestLanguage, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/translate_message_request.g.dart b/packages/stream_chat/lib/open_api/model/translate_message_request.g.dart new file mode 100644 index 0000000000..44137a0083 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/translate_message_request.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'translate_message_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +TranslateMessageRequest _$TranslateMessageRequestFromJson( + Map json, +) => TranslateMessageRequest( + language: TranslateMessageRequestLanguage.fromJson( + json['language'] as String, + ), +); + +Map _$TranslateMessageRequestToJson( + TranslateMessageRequest instance, +) => {'language': instance.language.toJson()}; diff --git a/packages/stream_chat/lib/open_api/model/truncate_channel_request.dart b/packages/stream_chat/lib/open_api/model/truncate_channel_request.dart new file mode 100644 index 0000000000..4cf38fc25d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/truncate_channel_request.dart @@ -0,0 +1,52 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'truncate_channel_request.g.dart'; +part 'truncate_channel_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class TruncateChannelRequest with _$TruncateChannelRequest { + const TruncateChannelRequest({ + this.hardDelete, + this.memberIds, + this.message, + this.skipPush, + this.truncatedAt, + }); + + @override + @JsonKey(name: 'hard_delete') + final bool? hardDelete; + + @override + @JsonKey(name: 'member_ids') + final List? memberIds; + + @override + @JsonKey(name: 'message') + final MessageRequest? message; + + @override + @JsonKey(name: 'skip_push') + final bool? skipPush; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'truncated_at') + final DateTime? truncatedAt; + + Map toJson() => _$TruncateChannelRequestToJson(this); + + static TruncateChannelRequest fromJson(Map json) => _$TruncateChannelRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/truncate_channel_request.freezed.dart b/packages/stream_chat/lib/open_api/model/truncate_channel_request.freezed.dart new file mode 100644 index 0000000000..14882992ac --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/truncate_channel_request.freezed.dart @@ -0,0 +1,119 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'truncate_channel_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$TruncateChannelRequest { + bool? get hardDelete; + List? get memberIds; + MessageRequest? get message; + bool? get skipPush; + DateTime? get truncatedAt; + + /// Create a copy of TruncateChannelRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $TruncateChannelRequestCopyWith get copyWith => + _$TruncateChannelRequestCopyWithImpl( + this as TruncateChannelRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is TruncateChannelRequest && + (identical(other.hardDelete, hardDelete) || other.hardDelete == hardDelete) && + const DeepCollectionEquality().equals(other.memberIds, memberIds) && + (identical(other.message, message) || other.message == message) && + (identical(other.skipPush, skipPush) || other.skipPush == skipPush) && + (identical(other.truncatedAt, truncatedAt) || other.truncatedAt == truncatedAt)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + hardDelete, + const DeepCollectionEquality().hash(memberIds), + message, + skipPush, + truncatedAt, + ); + + @override + String toString() { + return 'TruncateChannelRequest(hardDelete: $hardDelete, memberIds: $memberIds, message: $message, skipPush: $skipPush, truncatedAt: $truncatedAt)'; + } +} + +/// @nodoc +abstract mixin class $TruncateChannelRequestCopyWith<$Res> { + factory $TruncateChannelRequestCopyWith( + TruncateChannelRequest value, + $Res Function(TruncateChannelRequest) _then, + ) = _$TruncateChannelRequestCopyWithImpl; + @useResult + $Res call({ + bool? hardDelete, + List? memberIds, + MessageRequest? message, + bool? skipPush, + DateTime? truncatedAt, + }); +} + +/// @nodoc +class _$TruncateChannelRequestCopyWithImpl<$Res> implements $TruncateChannelRequestCopyWith<$Res> { + _$TruncateChannelRequestCopyWithImpl(this._self, this._then); + + final TruncateChannelRequest _self; + final $Res Function(TruncateChannelRequest) _then; + + /// Create a copy of TruncateChannelRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? hardDelete = freezed, + Object? memberIds = freezed, + Object? message = freezed, + Object? skipPush = freezed, + Object? truncatedAt = freezed, + }) { + return _then( + TruncateChannelRequest( + hardDelete: freezed == hardDelete + ? _self.hardDelete + : hardDelete // ignore: cast_nullable_to_non_nullable + as bool?, + memberIds: freezed == memberIds + ? _self.memberIds + : memberIds // ignore: cast_nullable_to_non_nullable + as List?, + message: freezed == message + ? _self.message + : message // ignore: cast_nullable_to_non_nullable + as MessageRequest?, + skipPush: freezed == skipPush + ? _self.skipPush + : skipPush // ignore: cast_nullable_to_non_nullable + as bool?, + truncatedAt: freezed == truncatedAt + ? _self.truncatedAt + : truncatedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/truncate_channel_request.g.dart b/packages/stream_chat/lib/open_api/model/truncate_channel_request.g.dart new file mode 100644 index 0000000000..533805658b --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/truncate_channel_request.g.dart @@ -0,0 +1,43 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'truncate_channel_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +TruncateChannelRequest _$TruncateChannelRequestFromJson( + Map json, +) => TruncateChannelRequest( + hardDelete: json['hard_delete'] as bool?, + memberIds: (json['member_ids'] as List?)?.map((e) => e as String).toList(), + message: json['message'] == null ? null : MessageRequest.fromJson(json['message'] as Map), + skipPush: json['skip_push'] as bool?, + truncatedAt: _$JsonConverterFromJson( + json['truncated_at'], + const StreamDateTimeConverter().fromJson, + ), +); + +Map _$TruncateChannelRequestToJson( + TruncateChannelRequest instance, +) => { + 'hard_delete': instance.hardDelete, + 'member_ids': instance.memberIds, + 'message': instance.message?.toJson(), + 'skip_push': instance.skipPush, + 'truncated_at': _$JsonConverterToJson( + instance.truncatedAt, + const StreamDateTimeConverter().toJson, + ), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/truncate_channel_response.dart b/packages/stream_chat/lib/open_api/model/truncate_channel_response.dart new file mode 100644 index 0000000000..325c91a1cf --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/truncate_channel_response.dart @@ -0,0 +1,41 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'truncate_channel_response.g.dart'; +part 'truncate_channel_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class TruncateChannelResponse with _$TruncateChannelResponse { + const TruncateChannelResponse({ + this.channel, + required this.duration, + this.message, + }); + + @override + @JsonKey(name: 'channel') + final ChannelResponse? channel; + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'message') + final MessageResponse? message; + + Map toJson() => _$TruncateChannelResponseToJson(this); + + static TruncateChannelResponse fromJson(Map json) => _$TruncateChannelResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/truncate_channel_response.freezed.dart b/packages/stream_chat/lib/open_api/model/truncate_channel_response.freezed.dart new file mode 100644 index 0000000000..9eabef1601 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/truncate_channel_response.freezed.dart @@ -0,0 +1,96 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'truncate_channel_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$TruncateChannelResponse { + ChannelResponse? get channel; + String get duration; + MessageResponse? get message; + + /// Create a copy of TruncateChannelResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $TruncateChannelResponseCopyWith get copyWith => + _$TruncateChannelResponseCopyWithImpl( + this as TruncateChannelResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is TruncateChannelResponse && + (identical(other.channel, channel) || other.channel == channel) && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.message, message) || other.message == message)); + } + + @override + int get hashCode => Object.hash(runtimeType, channel, duration, message); + + @override + String toString() { + return 'TruncateChannelResponse(channel: $channel, duration: $duration, message: $message)'; + } +} + +/// @nodoc +abstract mixin class $TruncateChannelResponseCopyWith<$Res> { + factory $TruncateChannelResponseCopyWith( + TruncateChannelResponse value, + $Res Function(TruncateChannelResponse) _then, + ) = _$TruncateChannelResponseCopyWithImpl; + @useResult + $Res call({ + ChannelResponse? channel, + String duration, + MessageResponse? message, + }); +} + +/// @nodoc +class _$TruncateChannelResponseCopyWithImpl<$Res> implements $TruncateChannelResponseCopyWith<$Res> { + _$TruncateChannelResponseCopyWithImpl(this._self, this._then); + + final TruncateChannelResponse _self; + final $Res Function(TruncateChannelResponse) _then; + + /// Create a copy of TruncateChannelResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channel = freezed, + Object? duration = null, + Object? message = freezed, + }) { + return _then( + TruncateChannelResponse( + channel: freezed == channel + ? _self.channel + : channel // ignore: cast_nullable_to_non_nullable + as ChannelResponse?, + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + message: freezed == message + ? _self.message + : message // ignore: cast_nullable_to_non_nullable + as MessageResponse?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/truncate_channel_response.g.dart b/packages/stream_chat/lib/open_api/model/truncate_channel_response.g.dart new file mode 100644 index 0000000000..65d1630366 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/truncate_channel_response.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'truncate_channel_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +TruncateChannelResponse _$TruncateChannelResponseFromJson( + Map json, +) => TruncateChannelResponse( + channel: json['channel'] == null ? null : ChannelResponse.fromJson(json['channel'] as Map), + duration: json['duration'] as String, + message: json['message'] == null ? null : MessageResponse.fromJson(json['message'] as Map), +); + +Map _$TruncateChannelResponseToJson( + TruncateChannelResponse instance, +) => { + 'channel': instance.channel?.toJson(), + 'duration': instance.duration, + 'message': instance.message?.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/typing_indicators_response.dart b/packages/stream_chat/lib/open_api/model/typing_indicators_response.dart new file mode 100644 index 0000000000..ece87a8fb9 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/typing_indicators_response.dart @@ -0,0 +1,31 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'typing_indicators_response.g.dart'; +part 'typing_indicators_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class TypingIndicatorsResponse with _$TypingIndicatorsResponse { + const TypingIndicatorsResponse({ + required this.enabled, + }); + + @override + @JsonKey(name: 'enabled') + final bool enabled; + + Map toJson() => _$TypingIndicatorsResponseToJson(this); + + static TypingIndicatorsResponse fromJson(Map json) => _$TypingIndicatorsResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/typing_indicators_response.freezed.dart b/packages/stream_chat/lib/open_api/model/typing_indicators_response.freezed.dart new file mode 100644 index 0000000000..41888005fd --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/typing_indicators_response.freezed.dart @@ -0,0 +1,76 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'typing_indicators_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$TypingIndicatorsResponse { + bool get enabled; + + /// Create a copy of TypingIndicatorsResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $TypingIndicatorsResponseCopyWith get copyWith => + _$TypingIndicatorsResponseCopyWithImpl( + this as TypingIndicatorsResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is TypingIndicatorsResponse && + (identical(other.enabled, enabled) || other.enabled == enabled)); + } + + @override + int get hashCode => Object.hash(runtimeType, enabled); + + @override + String toString() { + return 'TypingIndicatorsResponse(enabled: $enabled)'; + } +} + +/// @nodoc +abstract mixin class $TypingIndicatorsResponseCopyWith<$Res> { + factory $TypingIndicatorsResponseCopyWith( + TypingIndicatorsResponse value, + $Res Function(TypingIndicatorsResponse) _then, + ) = _$TypingIndicatorsResponseCopyWithImpl; + @useResult + $Res call({bool enabled}); +} + +/// @nodoc +class _$TypingIndicatorsResponseCopyWithImpl<$Res> implements $TypingIndicatorsResponseCopyWith<$Res> { + _$TypingIndicatorsResponseCopyWithImpl(this._self, this._then); + + final TypingIndicatorsResponse _self; + final $Res Function(TypingIndicatorsResponse) _then; + + /// Create a copy of TypingIndicatorsResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? enabled = null}) { + return _then( + TypingIndicatorsResponse( + enabled: null == enabled + ? _self.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/typing_indicators_response.g.dart b/packages/stream_chat/lib/open_api/model/typing_indicators_response.g.dart new file mode 100644 index 0000000000..81c3848885 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/typing_indicators_response.g.dart @@ -0,0 +1,15 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'typing_indicators_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +TypingIndicatorsResponse _$TypingIndicatorsResponseFromJson( + Map json, +) => TypingIndicatorsResponse(enabled: json['enabled'] as bool); + +Map _$TypingIndicatorsResponseToJson( + TypingIndicatorsResponse instance, +) => {'enabled': instance.enabled}; diff --git a/packages/stream_chat/lib/open_api/model/typing_start_event.dart b/packages/stream_chat/lib/open_api/model/typing_start_event.dart new file mode 100644 index 0000000000..da99a8410e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/typing_start_event.dart @@ -0,0 +1,73 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'typing_start_event.g.dart'; +part 'typing_start_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class TypingStartEvent extends core.WsEvent with _$TypingStartEvent { + const TypingStartEvent({ + this.channelId, + this.channelType, + this.cid, + required this.createdAt, + required this.custom, + this.parentId, + this.receivedAt, + required this.type, + this.user, + }); + + @override + @JsonKey(name: 'channel_id') + final String? channelId; + + @override + @JsonKey(name: 'channel_type') + final String? channelType; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'parent_id') + final String? parentId; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'user') + final UserResponseCommonFields? user; + + Map toJson() => _$TypingStartEventToJson(this); + + static TypingStartEvent fromJson(Map json) => _$TypingStartEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/typing_start_event.freezed.dart b/packages/stream_chat/lib/open_api/model/typing_start_event.freezed.dart new file mode 100644 index 0000000000..b763d083c2 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/typing_start_event.freezed.dart @@ -0,0 +1,154 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'typing_start_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$TypingStartEvent { + String? get channelId; + String? get channelType; + String? get cid; + DateTime get createdAt; + Map get custom; + String? get parentId; + DateTime? get receivedAt; + String get type; + UserResponseCommonFields? get user; + + /// Create a copy of TypingStartEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $TypingStartEventCopyWith get copyWith => _$TypingStartEventCopyWithImpl( + this as TypingStartEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is TypingStartEvent && + (identical(other.channelId, channelId) || other.channelId == channelId) && + (identical(other.channelType, channelType) || other.channelType == channelType) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.parentId, parentId) || other.parentId == parentId) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.type, type) || other.type == type) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channelId, + channelType, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + parentId, + receivedAt, + type, + user, + ); + + @override + String toString() { + return 'TypingStartEvent(channelId: $channelId, channelType: $channelType, cid: $cid, createdAt: $createdAt, custom: $custom, parentId: $parentId, receivedAt: $receivedAt, type: $type, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $TypingStartEventCopyWith<$Res> { + factory $TypingStartEventCopyWith( + TypingStartEvent value, + $Res Function(TypingStartEvent) _then, + ) = _$TypingStartEventCopyWithImpl; + @useResult + $Res call({ + String? channelId, + String? channelType, + String? cid, + DateTime createdAt, + Map custom, + String? parentId, + DateTime? receivedAt, + String type, + UserResponseCommonFields? user, + }); +} + +/// @nodoc +class _$TypingStartEventCopyWithImpl<$Res> implements $TypingStartEventCopyWith<$Res> { + _$TypingStartEventCopyWithImpl(this._self, this._then); + + final TypingStartEvent _self; + final $Res Function(TypingStartEvent) _then; + + /// Create a copy of TypingStartEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channelId = freezed, + Object? channelType = freezed, + Object? cid = freezed, + Object? createdAt = null, + Object? custom = null, + Object? parentId = freezed, + Object? receivedAt = freezed, + Object? type = null, + Object? user = freezed, + }) { + return _then( + TypingStartEvent( + channelId: freezed == channelId + ? _self.channelId + : channelId // ignore: cast_nullable_to_non_nullable + as String?, + channelType: freezed == channelType + ? _self.channelType + : channelType // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + parentId: freezed == parentId + ? _self.parentId + : parentId // ignore: cast_nullable_to_non_nullable + as String?, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponseCommonFields?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/typing_start_event.g.dart b/packages/stream_chat/lib/open_api/model/typing_start_event.g.dart new file mode 100644 index 0000000000..a211dd9d4d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/typing_start_event.g.dart @@ -0,0 +1,53 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'typing_start_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +TypingStartEvent _$TypingStartEventFromJson(Map json) => TypingStartEvent( + channelId: json['channel_id'] as String?, + channelType: json['channel_type'] as String?, + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + parentId: json['parent_id'] as String?, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + type: json['type'] as String, + user: json['user'] == null + ? null + : UserResponseCommonFields.fromJson( + json['user'] as Map, + ), +); + +Map _$TypingStartEventToJson(TypingStartEvent instance) => { + 'channel_id': instance.channelId, + 'channel_type': instance.channelType, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'parent_id': instance.parentId, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'type': instance.type, + 'user': instance.user?.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/typing_stop_event.dart b/packages/stream_chat/lib/open_api/model/typing_stop_event.dart new file mode 100644 index 0000000000..45aea6da01 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/typing_stop_event.dart @@ -0,0 +1,73 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'typing_stop_event.g.dart'; +part 'typing_stop_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class TypingStopEvent extends core.WsEvent with _$TypingStopEvent { + const TypingStopEvent({ + this.channelId, + this.channelType, + this.cid, + required this.createdAt, + required this.custom, + this.parentId, + this.receivedAt, + required this.type, + this.user, + }); + + @override + @JsonKey(name: 'channel_id') + final String? channelId; + + @override + @JsonKey(name: 'channel_type') + final String? channelType; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'parent_id') + final String? parentId; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'user') + final UserResponseCommonFields? user; + + Map toJson() => _$TypingStopEventToJson(this); + + static TypingStopEvent fromJson(Map json) => _$TypingStopEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/typing_stop_event.freezed.dart b/packages/stream_chat/lib/open_api/model/typing_stop_event.freezed.dart new file mode 100644 index 0000000000..b922ceffb5 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/typing_stop_event.freezed.dart @@ -0,0 +1,154 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'typing_stop_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$TypingStopEvent { + String? get channelId; + String? get channelType; + String? get cid; + DateTime get createdAt; + Map get custom; + String? get parentId; + DateTime? get receivedAt; + String get type; + UserResponseCommonFields? get user; + + /// Create a copy of TypingStopEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $TypingStopEventCopyWith get copyWith => _$TypingStopEventCopyWithImpl( + this as TypingStopEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is TypingStopEvent && + (identical(other.channelId, channelId) || other.channelId == channelId) && + (identical(other.channelType, channelType) || other.channelType == channelType) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.parentId, parentId) || other.parentId == parentId) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.type, type) || other.type == type) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channelId, + channelType, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + parentId, + receivedAt, + type, + user, + ); + + @override + String toString() { + return 'TypingStopEvent(channelId: $channelId, channelType: $channelType, cid: $cid, createdAt: $createdAt, custom: $custom, parentId: $parentId, receivedAt: $receivedAt, type: $type, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $TypingStopEventCopyWith<$Res> { + factory $TypingStopEventCopyWith( + TypingStopEvent value, + $Res Function(TypingStopEvent) _then, + ) = _$TypingStopEventCopyWithImpl; + @useResult + $Res call({ + String? channelId, + String? channelType, + String? cid, + DateTime createdAt, + Map custom, + String? parentId, + DateTime? receivedAt, + String type, + UserResponseCommonFields? user, + }); +} + +/// @nodoc +class _$TypingStopEventCopyWithImpl<$Res> implements $TypingStopEventCopyWith<$Res> { + _$TypingStopEventCopyWithImpl(this._self, this._then); + + final TypingStopEvent _self; + final $Res Function(TypingStopEvent) _then; + + /// Create a copy of TypingStopEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channelId = freezed, + Object? channelType = freezed, + Object? cid = freezed, + Object? createdAt = null, + Object? custom = null, + Object? parentId = freezed, + Object? receivedAt = freezed, + Object? type = null, + Object? user = freezed, + }) { + return _then( + TypingStopEvent( + channelId: freezed == channelId + ? _self.channelId + : channelId // ignore: cast_nullable_to_non_nullable + as String?, + channelType: freezed == channelType + ? _self.channelType + : channelType // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + parentId: freezed == parentId + ? _self.parentId + : parentId // ignore: cast_nullable_to_non_nullable + as String?, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponseCommonFields?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/typing_stop_event.g.dart b/packages/stream_chat/lib/open_api/model/typing_stop_event.g.dart new file mode 100644 index 0000000000..204c83ffdf --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/typing_stop_event.g.dart @@ -0,0 +1,53 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'typing_stop_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +TypingStopEvent _$TypingStopEventFromJson(Map json) => TypingStopEvent( + channelId: json['channel_id'] as String?, + channelType: json['channel_type'] as String?, + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + parentId: json['parent_id'] as String?, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + type: json['type'] as String, + user: json['user'] == null + ? null + : UserResponseCommonFields.fromJson( + json['user'] as Map, + ), +); + +Map _$TypingStopEventToJson(TypingStopEvent instance) => { + 'channel_id': instance.channelId, + 'channel_type': instance.channelType, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'parent_id': instance.parentId, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'type': instance.type, + 'user': instance.user?.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/unban_action_request_payload.dart b/packages/stream_chat/lib/open_api/model/unban_action_request_payload.dart new file mode 100644 index 0000000000..098e6d0326 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/unban_action_request_payload.dart @@ -0,0 +1,46 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'unban_action_request_payload.g.dart'; +part 'unban_action_request_payload.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UnbanActionRequestPayload with _$UnbanActionRequestPayload { + const UnbanActionRequestPayload({ + this.channelCid, + this.decisionReason, + this.removeFutureChannelsBan, + this.targetUserId, + }); + + @override + @JsonKey(name: 'channel_cid') + final String? channelCid; + + @override + @JsonKey(name: 'decision_reason') + final String? decisionReason; + + @override + @JsonKey(name: 'remove_future_channels_ban') + final bool? removeFutureChannelsBan; + + @override + @JsonKey(name: 'target_user_id') + final String? targetUserId; + + Map toJson() => _$UnbanActionRequestPayloadToJson(this); + + static UnbanActionRequestPayload fromJson(Map json) => _$UnbanActionRequestPayloadFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/unban_action_request_payload.freezed.dart b/packages/stream_chat/lib/open_api/model/unban_action_request_payload.freezed.dart new file mode 100644 index 0000000000..4312d3110f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/unban_action_request_payload.freezed.dart @@ -0,0 +1,114 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'unban_action_request_payload.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UnbanActionRequestPayload { + String? get channelCid; + String? get decisionReason; + bool? get removeFutureChannelsBan; + String? get targetUserId; + + /// Create a copy of UnbanActionRequestPayload + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UnbanActionRequestPayloadCopyWith get copyWith => + _$UnbanActionRequestPayloadCopyWithImpl( + this as UnbanActionRequestPayload, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UnbanActionRequestPayload && + (identical(other.channelCid, channelCid) || other.channelCid == channelCid) && + (identical(other.decisionReason, decisionReason) || other.decisionReason == decisionReason) && + (identical( + other.removeFutureChannelsBan, + removeFutureChannelsBan, + ) || + other.removeFutureChannelsBan == removeFutureChannelsBan) && + (identical(other.targetUserId, targetUserId) || other.targetUserId == targetUserId)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channelCid, + decisionReason, + removeFutureChannelsBan, + targetUserId, + ); + + @override + String toString() { + return 'UnbanActionRequestPayload(channelCid: $channelCid, decisionReason: $decisionReason, removeFutureChannelsBan: $removeFutureChannelsBan, targetUserId: $targetUserId)'; + } +} + +/// @nodoc +abstract mixin class $UnbanActionRequestPayloadCopyWith<$Res> { + factory $UnbanActionRequestPayloadCopyWith( + UnbanActionRequestPayload value, + $Res Function(UnbanActionRequestPayload) _then, + ) = _$UnbanActionRequestPayloadCopyWithImpl; + @useResult + $Res call({ + String? channelCid, + String? decisionReason, + bool? removeFutureChannelsBan, + String? targetUserId, + }); +} + +/// @nodoc +class _$UnbanActionRequestPayloadCopyWithImpl<$Res> implements $UnbanActionRequestPayloadCopyWith<$Res> { + _$UnbanActionRequestPayloadCopyWithImpl(this._self, this._then); + + final UnbanActionRequestPayload _self; + final $Res Function(UnbanActionRequestPayload) _then; + + /// Create a copy of UnbanActionRequestPayload + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channelCid = freezed, + Object? decisionReason = freezed, + Object? removeFutureChannelsBan = freezed, + Object? targetUserId = freezed, + }) { + return _then( + UnbanActionRequestPayload( + channelCid: freezed == channelCid + ? _self.channelCid + : channelCid // ignore: cast_nullable_to_non_nullable + as String?, + decisionReason: freezed == decisionReason + ? _self.decisionReason + : decisionReason // ignore: cast_nullable_to_non_nullable + as String?, + removeFutureChannelsBan: freezed == removeFutureChannelsBan + ? _self.removeFutureChannelsBan + : removeFutureChannelsBan // ignore: cast_nullable_to_non_nullable + as bool?, + targetUserId: freezed == targetUserId + ? _self.targetUserId + : targetUserId // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/unban_action_request_payload.g.dart b/packages/stream_chat/lib/open_api/model/unban_action_request_payload.g.dart new file mode 100644 index 0000000000..35cd905a90 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/unban_action_request_payload.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'unban_action_request_payload.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UnbanActionRequestPayload _$UnbanActionRequestPayloadFromJson( + Map json, +) => UnbanActionRequestPayload( + channelCid: json['channel_cid'] as String?, + decisionReason: json['decision_reason'] as String?, + removeFutureChannelsBan: json['remove_future_channels_ban'] as bool?, + targetUserId: json['target_user_id'] as String?, +); + +Map _$UnbanActionRequestPayloadToJson( + UnbanActionRequestPayload instance, +) => { + 'channel_cid': instance.channelCid, + 'decision_reason': instance.decisionReason, + 'remove_future_channels_ban': instance.removeFutureChannelsBan, + 'target_user_id': instance.targetUserId, +}; diff --git a/packages/stream_chat/lib/open_api/model/unblock_action_request_payload.dart b/packages/stream_chat/lib/open_api/model/unblock_action_request_payload.dart new file mode 100644 index 0000000000..fb39f834b2 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/unblock_action_request_payload.dart @@ -0,0 +1,31 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'unblock_action_request_payload.g.dart'; +part 'unblock_action_request_payload.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UnblockActionRequestPayload with _$UnblockActionRequestPayload { + const UnblockActionRequestPayload({ + this.decisionReason, + }); + + @override + @JsonKey(name: 'decision_reason') + final String? decisionReason; + + Map toJson() => _$UnblockActionRequestPayloadToJson(this); + + static UnblockActionRequestPayload fromJson(Map json) => _$UnblockActionRequestPayloadFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/unblock_action_request_payload.freezed.dart b/packages/stream_chat/lib/open_api/model/unblock_action_request_payload.freezed.dart new file mode 100644 index 0000000000..caec17dd6a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/unblock_action_request_payload.freezed.dart @@ -0,0 +1,76 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'unblock_action_request_payload.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UnblockActionRequestPayload { + String? get decisionReason; + + /// Create a copy of UnblockActionRequestPayload + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UnblockActionRequestPayloadCopyWith get copyWith => + _$UnblockActionRequestPayloadCopyWithImpl( + this as UnblockActionRequestPayload, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UnblockActionRequestPayload && + (identical(other.decisionReason, decisionReason) || other.decisionReason == decisionReason)); + } + + @override + int get hashCode => Object.hash(runtimeType, decisionReason); + + @override + String toString() { + return 'UnblockActionRequestPayload(decisionReason: $decisionReason)'; + } +} + +/// @nodoc +abstract mixin class $UnblockActionRequestPayloadCopyWith<$Res> { + factory $UnblockActionRequestPayloadCopyWith( + UnblockActionRequestPayload value, + $Res Function(UnblockActionRequestPayload) _then, + ) = _$UnblockActionRequestPayloadCopyWithImpl; + @useResult + $Res call({String? decisionReason}); +} + +/// @nodoc +class _$UnblockActionRequestPayloadCopyWithImpl<$Res> implements $UnblockActionRequestPayloadCopyWith<$Res> { + _$UnblockActionRequestPayloadCopyWithImpl(this._self, this._then); + + final UnblockActionRequestPayload _self; + final $Res Function(UnblockActionRequestPayload) _then; + + /// Create a copy of UnblockActionRequestPayload + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? decisionReason = freezed}) { + return _then( + UnblockActionRequestPayload( + decisionReason: freezed == decisionReason + ? _self.decisionReason + : decisionReason // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/unblock_action_request_payload.g.dart b/packages/stream_chat/lib/open_api/model/unblock_action_request_payload.g.dart new file mode 100644 index 0000000000..e17b925e32 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/unblock_action_request_payload.g.dart @@ -0,0 +1,17 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'unblock_action_request_payload.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UnblockActionRequestPayload _$UnblockActionRequestPayloadFromJson( + Map json, +) => UnblockActionRequestPayload( + decisionReason: json['decision_reason'] as String?, +); + +Map _$UnblockActionRequestPayloadToJson( + UnblockActionRequestPayload instance, +) => {'decision_reason': instance.decisionReason}; diff --git a/packages/stream_chat/lib/open_api/model/unblock_users_request.dart b/packages/stream_chat/lib/open_api/model/unblock_users_request.dart new file mode 100644 index 0000000000..41ab3e8415 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/unblock_users_request.dart @@ -0,0 +1,31 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'unblock_users_request.g.dart'; +part 'unblock_users_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UnblockUsersRequest with _$UnblockUsersRequest { + const UnblockUsersRequest({ + required this.blockedUserId, + }); + + @override + @JsonKey(name: 'blocked_user_id') + final String blockedUserId; + + Map toJson() => _$UnblockUsersRequestToJson(this); + + static UnblockUsersRequest fromJson(Map json) => _$UnblockUsersRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/unblock_users_request.freezed.dart b/packages/stream_chat/lib/open_api/model/unblock_users_request.freezed.dart new file mode 100644 index 0000000000..497d8d1902 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/unblock_users_request.freezed.dart @@ -0,0 +1,76 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'unblock_users_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UnblockUsersRequest { + String get blockedUserId; + + /// Create a copy of UnblockUsersRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UnblockUsersRequestCopyWith get copyWith => + _$UnblockUsersRequestCopyWithImpl( + this as UnblockUsersRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UnblockUsersRequest && + (identical(other.blockedUserId, blockedUserId) || other.blockedUserId == blockedUserId)); + } + + @override + int get hashCode => Object.hash(runtimeType, blockedUserId); + + @override + String toString() { + return 'UnblockUsersRequest(blockedUserId: $blockedUserId)'; + } +} + +/// @nodoc +abstract mixin class $UnblockUsersRequestCopyWith<$Res> { + factory $UnblockUsersRequestCopyWith( + UnblockUsersRequest value, + $Res Function(UnblockUsersRequest) _then, + ) = _$UnblockUsersRequestCopyWithImpl; + @useResult + $Res call({String blockedUserId}); +} + +/// @nodoc +class _$UnblockUsersRequestCopyWithImpl<$Res> implements $UnblockUsersRequestCopyWith<$Res> { + _$UnblockUsersRequestCopyWithImpl(this._self, this._then); + + final UnblockUsersRequest _self; + final $Res Function(UnblockUsersRequest) _then; + + /// Create a copy of UnblockUsersRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? blockedUserId = null}) { + return _then( + UnblockUsersRequest( + blockedUserId: null == blockedUserId + ? _self.blockedUserId + : blockedUserId // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/unblock_users_request.g.dart b/packages/stream_chat/lib/open_api/model/unblock_users_request.g.dart new file mode 100644 index 0000000000..4fe813bcfa --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/unblock_users_request.g.dart @@ -0,0 +1,14 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'unblock_users_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UnblockUsersRequest _$UnblockUsersRequestFromJson(Map json) => + UnblockUsersRequest(blockedUserId: json['blocked_user_id'] as String); + +Map _$UnblockUsersRequestToJson( + UnblockUsersRequest instance, +) => {'blocked_user_id': instance.blockedUserId}; diff --git a/packages/stream_chat/lib/open_api/model/unblock_users_response.dart b/packages/stream_chat/lib/open_api/model/unblock_users_response.dart new file mode 100644 index 0000000000..96985cd271 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/unblock_users_response.dart @@ -0,0 +1,31 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'unblock_users_response.g.dart'; +part 'unblock_users_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UnblockUsersResponse with _$UnblockUsersResponse { + const UnblockUsersResponse({ + required this.duration, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + Map toJson() => _$UnblockUsersResponseToJson(this); + + static UnblockUsersResponse fromJson(Map json) => _$UnblockUsersResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/unblock_users_response.freezed.dart b/packages/stream_chat/lib/open_api/model/unblock_users_response.freezed.dart new file mode 100644 index 0000000000..f19a40d4ec --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/unblock_users_response.freezed.dart @@ -0,0 +1,76 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'unblock_users_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UnblockUsersResponse { + String get duration; + + /// Create a copy of UnblockUsersResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UnblockUsersResponseCopyWith get copyWith => + _$UnblockUsersResponseCopyWithImpl( + this as UnblockUsersResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UnblockUsersResponse && + (identical(other.duration, duration) || other.duration == duration)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration); + + @override + String toString() { + return 'UnblockUsersResponse(duration: $duration)'; + } +} + +/// @nodoc +abstract mixin class $UnblockUsersResponseCopyWith<$Res> { + factory $UnblockUsersResponseCopyWith( + UnblockUsersResponse value, + $Res Function(UnblockUsersResponse) _then, + ) = _$UnblockUsersResponseCopyWithImpl; + @useResult + $Res call({String duration}); +} + +/// @nodoc +class _$UnblockUsersResponseCopyWithImpl<$Res> implements $UnblockUsersResponseCopyWith<$Res> { + _$UnblockUsersResponseCopyWithImpl(this._self, this._then); + + final UnblockUsersResponse _self; + final $Res Function(UnblockUsersResponse) _then; + + /// Create a copy of UnblockUsersResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null}) { + return _then( + UnblockUsersResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/unblock_users_response.g.dart b/packages/stream_chat/lib/open_api/model/unblock_users_response.g.dart new file mode 100644 index 0000000000..d89ebe9ec2 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/unblock_users_response.g.dart @@ -0,0 +1,15 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'unblock_users_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UnblockUsersResponse _$UnblockUsersResponseFromJson( + Map json, +) => UnblockUsersResponse(duration: json['duration'] as String); + +Map _$UnblockUsersResponseToJson( + UnblockUsersResponse instance, +) => {'duration': instance.duration}; diff --git a/packages/stream_chat/lib/open_api/model/unmute_channel_request.dart b/packages/stream_chat/lib/open_api/model/unmute_channel_request.dart new file mode 100644 index 0000000000..8707307575 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/unmute_channel_request.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'unmute_channel_request.g.dart'; +part 'unmute_channel_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UnmuteChannelRequest with _$UnmuteChannelRequest { + const UnmuteChannelRequest({ + this.channelCids, + this.expiration, + }); + + @override + @JsonKey(name: 'channel_cids') + final List? channelCids; + + @override + @JsonKey(name: 'expiration') + final int? expiration; + + Map toJson() => _$UnmuteChannelRequestToJson(this); + + static UnmuteChannelRequest fromJson(Map json) => _$UnmuteChannelRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/unmute_channel_request.freezed.dart b/packages/stream_chat/lib/open_api/model/unmute_channel_request.freezed.dart new file mode 100644 index 0000000000..64c1e12e87 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/unmute_channel_request.freezed.dart @@ -0,0 +1,89 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'unmute_channel_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UnmuteChannelRequest { + List? get channelCids; + int? get expiration; + + /// Create a copy of UnmuteChannelRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UnmuteChannelRequestCopyWith get copyWith => + _$UnmuteChannelRequestCopyWithImpl( + this as UnmuteChannelRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UnmuteChannelRequest && + const DeepCollectionEquality().equals( + other.channelCids, + channelCids, + ) && + (identical(other.expiration, expiration) || other.expiration == expiration)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(channelCids), + expiration, + ); + + @override + String toString() { + return 'UnmuteChannelRequest(channelCids: $channelCids, expiration: $expiration)'; + } +} + +/// @nodoc +abstract mixin class $UnmuteChannelRequestCopyWith<$Res> { + factory $UnmuteChannelRequestCopyWith( + UnmuteChannelRequest value, + $Res Function(UnmuteChannelRequest) _then, + ) = _$UnmuteChannelRequestCopyWithImpl; + @useResult + $Res call({List? channelCids, int? expiration}); +} + +/// @nodoc +class _$UnmuteChannelRequestCopyWithImpl<$Res> implements $UnmuteChannelRequestCopyWith<$Res> { + _$UnmuteChannelRequestCopyWithImpl(this._self, this._then); + + final UnmuteChannelRequest _self; + final $Res Function(UnmuteChannelRequest) _then; + + /// Create a copy of UnmuteChannelRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? channelCids = freezed, Object? expiration = freezed}) { + return _then( + UnmuteChannelRequest( + channelCids: freezed == channelCids + ? _self.channelCids + : channelCids // ignore: cast_nullable_to_non_nullable + as List?, + expiration: freezed == expiration + ? _self.expiration + : expiration // ignore: cast_nullable_to_non_nullable + as int?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/unmute_channel_request.g.dart b/packages/stream_chat/lib/open_api/model/unmute_channel_request.g.dart new file mode 100644 index 0000000000..f847744979 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/unmute_channel_request.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'unmute_channel_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UnmuteChannelRequest _$UnmuteChannelRequestFromJson( + Map json, +) => UnmuteChannelRequest( + channelCids: (json['channel_cids'] as List?)?.map((e) => e as String).toList(), + expiration: (json['expiration'] as num?)?.toInt(), +); + +Map _$UnmuteChannelRequestToJson( + UnmuteChannelRequest instance, +) => { + 'channel_cids': instance.channelCids, + 'expiration': instance.expiration, +}; diff --git a/packages/stream_chat/lib/open_api/model/unmute_request.dart b/packages/stream_chat/lib/open_api/model/unmute_request.dart new file mode 100644 index 0000000000..cae355383a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/unmute_request.dart @@ -0,0 +1,31 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'unmute_request.g.dart'; +part 'unmute_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UnmuteRequest with _$UnmuteRequest { + const UnmuteRequest({ + required this.targetIds, + }); + + @override + @JsonKey(name: 'target_ids') + final List targetIds; + + Map toJson() => _$UnmuteRequestToJson(this); + + static UnmuteRequest fromJson(Map json) => _$UnmuteRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/unmute_request.freezed.dart b/packages/stream_chat/lib/open_api/model/unmute_request.freezed.dart new file mode 100644 index 0000000000..2641872411 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/unmute_request.freezed.dart @@ -0,0 +1,75 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'unmute_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UnmuteRequest { + List get targetIds; + + /// Create a copy of UnmuteRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UnmuteRequestCopyWith get copyWith => _$UnmuteRequestCopyWithImpl( + this as UnmuteRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UnmuteRequest && + const DeepCollectionEquality().equals(other.targetIds, targetIds)); + } + + @override + int get hashCode => Object.hash(runtimeType, const DeepCollectionEquality().hash(targetIds)); + + @override + String toString() { + return 'UnmuteRequest(targetIds: $targetIds)'; + } +} + +/// @nodoc +abstract mixin class $UnmuteRequestCopyWith<$Res> { + factory $UnmuteRequestCopyWith( + UnmuteRequest value, + $Res Function(UnmuteRequest) _then, + ) = _$UnmuteRequestCopyWithImpl; + @useResult + $Res call({List targetIds}); +} + +/// @nodoc +class _$UnmuteRequestCopyWithImpl<$Res> implements $UnmuteRequestCopyWith<$Res> { + _$UnmuteRequestCopyWithImpl(this._self, this._then); + + final UnmuteRequest _self; + final $Res Function(UnmuteRequest) _then; + + /// Create a copy of UnmuteRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? targetIds = null}) { + return _then( + UnmuteRequest( + targetIds: null == targetIds + ? _self.targetIds + : targetIds // ignore: cast_nullable_to_non_nullable + as List, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/unmute_request.g.dart b/packages/stream_chat/lib/open_api/model/unmute_request.g.dart new file mode 100644 index 0000000000..a1d826e427 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/unmute_request.g.dart @@ -0,0 +1,15 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'unmute_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UnmuteRequest _$UnmuteRequestFromJson(Map json) => UnmuteRequest( + targetIds: (json['target_ids'] as List).map((e) => e as String).toList(), +); + +Map _$UnmuteRequestToJson(UnmuteRequest instance) => { + 'target_ids': instance.targetIds, +}; diff --git a/packages/stream_chat/lib/open_api/model/unmute_response.dart b/packages/stream_chat/lib/open_api/model/unmute_response.dart new file mode 100644 index 0000000000..a60349102e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/unmute_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'unmute_response.g.dart'; +part 'unmute_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UnmuteResponse with _$UnmuteResponse { + const UnmuteResponse({ + required this.duration, + this.nonExistingUsers, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'non_existing_users') + final List? nonExistingUsers; + + Map toJson() => _$UnmuteResponseToJson(this); + + static UnmuteResponse fromJson(Map json) => _$UnmuteResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/unmute_response.freezed.dart b/packages/stream_chat/lib/open_api/model/unmute_response.freezed.dart new file mode 100644 index 0000000000..1ef8b51090 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/unmute_response.freezed.dart @@ -0,0 +1,88 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'unmute_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UnmuteResponse { + String get duration; + List? get nonExistingUsers; + + /// Create a copy of UnmuteResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UnmuteResponseCopyWith get copyWith => _$UnmuteResponseCopyWithImpl( + this as UnmuteResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UnmuteResponse && + (identical(other.duration, duration) || other.duration == duration) && + const DeepCollectionEquality().equals( + other.nonExistingUsers, + nonExistingUsers, + )); + } + + @override + int get hashCode => Object.hash( + runtimeType, + duration, + const DeepCollectionEquality().hash(nonExistingUsers), + ); + + @override + String toString() { + return 'UnmuteResponse(duration: $duration, nonExistingUsers: $nonExistingUsers)'; + } +} + +/// @nodoc +abstract mixin class $UnmuteResponseCopyWith<$Res> { + factory $UnmuteResponseCopyWith( + UnmuteResponse value, + $Res Function(UnmuteResponse) _then, + ) = _$UnmuteResponseCopyWithImpl; + @useResult + $Res call({String duration, List? nonExistingUsers}); +} + +/// @nodoc +class _$UnmuteResponseCopyWithImpl<$Res> implements $UnmuteResponseCopyWith<$Res> { + _$UnmuteResponseCopyWithImpl(this._self, this._then); + + final UnmuteResponse _self; + final $Res Function(UnmuteResponse) _then; + + /// Create a copy of UnmuteResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? nonExistingUsers = freezed}) { + return _then( + UnmuteResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + nonExistingUsers: freezed == nonExistingUsers + ? _self.nonExistingUsers + : nonExistingUsers // ignore: cast_nullable_to_non_nullable + as List?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/unmute_response.g.dart b/packages/stream_chat/lib/open_api/model/unmute_response.g.dart new file mode 100644 index 0000000000..3c994f8334 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/unmute_response.g.dart @@ -0,0 +1,17 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'unmute_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UnmuteResponse _$UnmuteResponseFromJson(Map json) => UnmuteResponse( + duration: json['duration'] as String, + nonExistingUsers: (json['non_existing_users'] as List?)?.map((e) => e as String).toList(), +); + +Map _$UnmuteResponseToJson(UnmuteResponse instance) => { + 'duration': instance.duration, + 'non_existing_users': instance.nonExistingUsers, +}; diff --git a/packages/stream_chat/lib/open_api/model/unread_counts_channel.dart b/packages/stream_chat/lib/open_api/model/unread_counts_channel.dart new file mode 100644 index 0000000000..7f2f40b4f8 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/unread_counts_channel.dart @@ -0,0 +1,42 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'unread_counts_channel.g.dart'; +part 'unread_counts_channel.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UnreadCountsChannel with _$UnreadCountsChannel { + const UnreadCountsChannel({ + required this.channelId, + required this.lastRead, + required this.unreadCount, + }); + + @override + @JsonKey(name: 'channel_id') + final String channelId; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'last_read') + final DateTime lastRead; + + @override + @JsonKey(name: 'unread_count') + final int unreadCount; + + Map toJson() => _$UnreadCountsChannelToJson(this); + + static UnreadCountsChannel fromJson(Map json) => _$UnreadCountsChannelFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/unread_counts_channel.freezed.dart b/packages/stream_chat/lib/open_api/model/unread_counts_channel.freezed.dart new file mode 100644 index 0000000000..f580d39d3c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/unread_counts_channel.freezed.dart @@ -0,0 +1,92 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'unread_counts_channel.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UnreadCountsChannel { + String get channelId; + DateTime get lastRead; + int get unreadCount; + + /// Create a copy of UnreadCountsChannel + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UnreadCountsChannelCopyWith get copyWith => + _$UnreadCountsChannelCopyWithImpl( + this as UnreadCountsChannel, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UnreadCountsChannel && + (identical(other.channelId, channelId) || other.channelId == channelId) && + (identical(other.lastRead, lastRead) || other.lastRead == lastRead) && + (identical(other.unreadCount, unreadCount) || other.unreadCount == unreadCount)); + } + + @override + int get hashCode => Object.hash(runtimeType, channelId, lastRead, unreadCount); + + @override + String toString() { + return 'UnreadCountsChannel(channelId: $channelId, lastRead: $lastRead, unreadCount: $unreadCount)'; + } +} + +/// @nodoc +abstract mixin class $UnreadCountsChannelCopyWith<$Res> { + factory $UnreadCountsChannelCopyWith( + UnreadCountsChannel value, + $Res Function(UnreadCountsChannel) _then, + ) = _$UnreadCountsChannelCopyWithImpl; + @useResult + $Res call({String channelId, DateTime lastRead, int unreadCount}); +} + +/// @nodoc +class _$UnreadCountsChannelCopyWithImpl<$Res> implements $UnreadCountsChannelCopyWith<$Res> { + _$UnreadCountsChannelCopyWithImpl(this._self, this._then); + + final UnreadCountsChannel _self; + final $Res Function(UnreadCountsChannel) _then; + + /// Create a copy of UnreadCountsChannel + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channelId = null, + Object? lastRead = null, + Object? unreadCount = null, + }) { + return _then( + UnreadCountsChannel( + channelId: null == channelId + ? _self.channelId + : channelId // ignore: cast_nullable_to_non_nullable + as String, + lastRead: null == lastRead + ? _self.lastRead + : lastRead // ignore: cast_nullable_to_non_nullable + as DateTime, + unreadCount: null == unreadCount + ? _self.unreadCount + : unreadCount // ignore: cast_nullable_to_non_nullable + as int, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/unread_counts_channel.g.dart b/packages/stream_chat/lib/open_api/model/unread_counts_channel.g.dart new file mode 100644 index 0000000000..3d97accc7c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/unread_counts_channel.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'unread_counts_channel.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UnreadCountsChannel _$UnreadCountsChannelFromJson(Map json) => UnreadCountsChannel( + channelId: json['channel_id'] as String, + lastRead: const StreamDateTimeConverter().fromJson( + json['last_read'] as Object, + ), + unreadCount: (json['unread_count'] as num).toInt(), +); + +Map _$UnreadCountsChannelToJson( + UnreadCountsChannel instance, +) => { + 'channel_id': instance.channelId, + 'last_read': const StreamDateTimeConverter().toJson(instance.lastRead), + 'unread_count': instance.unreadCount, +}; diff --git a/packages/stream_chat/lib/open_api/model/unread_counts_channel_type.dart b/packages/stream_chat/lib/open_api/model/unread_counts_channel_type.dart new file mode 100644 index 0000000000..f0f0cf6e56 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/unread_counts_channel_type.dart @@ -0,0 +1,41 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'unread_counts_channel_type.g.dart'; +part 'unread_counts_channel_type.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UnreadCountsChannelType with _$UnreadCountsChannelType { + const UnreadCountsChannelType({ + required this.channelCount, + required this.channelType, + required this.unreadCount, + }); + + @override + @JsonKey(name: 'channel_count') + final int channelCount; + + @override + @JsonKey(name: 'channel_type') + final String channelType; + + @override + @JsonKey(name: 'unread_count') + final int unreadCount; + + Map toJson() => _$UnreadCountsChannelTypeToJson(this); + + static UnreadCountsChannelType fromJson(Map json) => _$UnreadCountsChannelTypeFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/unread_counts_channel_type.freezed.dart b/packages/stream_chat/lib/open_api/model/unread_counts_channel_type.freezed.dart new file mode 100644 index 0000000000..569e201d7d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/unread_counts_channel_type.freezed.dart @@ -0,0 +1,92 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'unread_counts_channel_type.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UnreadCountsChannelType { + int get channelCount; + String get channelType; + int get unreadCount; + + /// Create a copy of UnreadCountsChannelType + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UnreadCountsChannelTypeCopyWith get copyWith => + _$UnreadCountsChannelTypeCopyWithImpl( + this as UnreadCountsChannelType, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UnreadCountsChannelType && + (identical(other.channelCount, channelCount) || other.channelCount == channelCount) && + (identical(other.channelType, channelType) || other.channelType == channelType) && + (identical(other.unreadCount, unreadCount) || other.unreadCount == unreadCount)); + } + + @override + int get hashCode => Object.hash(runtimeType, channelCount, channelType, unreadCount); + + @override + String toString() { + return 'UnreadCountsChannelType(channelCount: $channelCount, channelType: $channelType, unreadCount: $unreadCount)'; + } +} + +/// @nodoc +abstract mixin class $UnreadCountsChannelTypeCopyWith<$Res> { + factory $UnreadCountsChannelTypeCopyWith( + UnreadCountsChannelType value, + $Res Function(UnreadCountsChannelType) _then, + ) = _$UnreadCountsChannelTypeCopyWithImpl; + @useResult + $Res call({int channelCount, String channelType, int unreadCount}); +} + +/// @nodoc +class _$UnreadCountsChannelTypeCopyWithImpl<$Res> implements $UnreadCountsChannelTypeCopyWith<$Res> { + _$UnreadCountsChannelTypeCopyWithImpl(this._self, this._then); + + final UnreadCountsChannelType _self; + final $Res Function(UnreadCountsChannelType) _then; + + /// Create a copy of UnreadCountsChannelType + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channelCount = null, + Object? channelType = null, + Object? unreadCount = null, + }) { + return _then( + UnreadCountsChannelType( + channelCount: null == channelCount + ? _self.channelCount + : channelCount // ignore: cast_nullable_to_non_nullable + as int, + channelType: null == channelType + ? _self.channelType + : channelType // ignore: cast_nullable_to_non_nullable + as String, + unreadCount: null == unreadCount + ? _self.unreadCount + : unreadCount // ignore: cast_nullable_to_non_nullable + as int, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/unread_counts_channel_type.g.dart b/packages/stream_chat/lib/open_api/model/unread_counts_channel_type.g.dart new file mode 100644 index 0000000000..9cf8cbd869 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/unread_counts_channel_type.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'unread_counts_channel_type.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UnreadCountsChannelType _$UnreadCountsChannelTypeFromJson( + Map json, +) => UnreadCountsChannelType( + channelCount: (json['channel_count'] as num).toInt(), + channelType: json['channel_type'] as String, + unreadCount: (json['unread_count'] as num).toInt(), +); + +Map _$UnreadCountsChannelTypeToJson( + UnreadCountsChannelType instance, +) => { + 'channel_count': instance.channelCount, + 'channel_type': instance.channelType, + 'unread_count': instance.unreadCount, +}; diff --git a/packages/stream_chat/lib/open_api/model/unread_counts_thread.dart b/packages/stream_chat/lib/open_api/model/unread_counts_thread.dart new file mode 100644 index 0000000000..4382d4f024 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/unread_counts_thread.dart @@ -0,0 +1,47 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'unread_counts_thread.g.dart'; +part 'unread_counts_thread.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UnreadCountsThread with _$UnreadCountsThread { + const UnreadCountsThread({ + required this.lastRead, + required this.lastReadMessageId, + required this.parentMessageId, + required this.unreadCount, + }); + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'last_read') + final DateTime lastRead; + + @override + @JsonKey(name: 'last_read_message_id') + final String lastReadMessageId; + + @override + @JsonKey(name: 'parent_message_id') + final String parentMessageId; + + @override + @JsonKey(name: 'unread_count') + final int unreadCount; + + Map toJson() => _$UnreadCountsThreadToJson(this); + + static UnreadCountsThread fromJson(Map json) => _$UnreadCountsThreadFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/unread_counts_thread.freezed.dart b/packages/stream_chat/lib/open_api/model/unread_counts_thread.freezed.dart new file mode 100644 index 0000000000..d6bac48d1f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/unread_counts_thread.freezed.dart @@ -0,0 +1,109 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'unread_counts_thread.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UnreadCountsThread { + DateTime get lastRead; + String get lastReadMessageId; + String get parentMessageId; + int get unreadCount; + + /// Create a copy of UnreadCountsThread + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UnreadCountsThreadCopyWith get copyWith => _$UnreadCountsThreadCopyWithImpl( + this as UnreadCountsThread, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UnreadCountsThread && + (identical(other.lastRead, lastRead) || other.lastRead == lastRead) && + (identical(other.lastReadMessageId, lastReadMessageId) || other.lastReadMessageId == lastReadMessageId) && + (identical(other.parentMessageId, parentMessageId) || other.parentMessageId == parentMessageId) && + (identical(other.unreadCount, unreadCount) || other.unreadCount == unreadCount)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + lastRead, + lastReadMessageId, + parentMessageId, + unreadCount, + ); + + @override + String toString() { + return 'UnreadCountsThread(lastRead: $lastRead, lastReadMessageId: $lastReadMessageId, parentMessageId: $parentMessageId, unreadCount: $unreadCount)'; + } +} + +/// @nodoc +abstract mixin class $UnreadCountsThreadCopyWith<$Res> { + factory $UnreadCountsThreadCopyWith( + UnreadCountsThread value, + $Res Function(UnreadCountsThread) _then, + ) = _$UnreadCountsThreadCopyWithImpl; + @useResult + $Res call({ + DateTime lastRead, + String lastReadMessageId, + String parentMessageId, + int unreadCount, + }); +} + +/// @nodoc +class _$UnreadCountsThreadCopyWithImpl<$Res> implements $UnreadCountsThreadCopyWith<$Res> { + _$UnreadCountsThreadCopyWithImpl(this._self, this._then); + + final UnreadCountsThread _self; + final $Res Function(UnreadCountsThread) _then; + + /// Create a copy of UnreadCountsThread + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? lastRead = null, + Object? lastReadMessageId = null, + Object? parentMessageId = null, + Object? unreadCount = null, + }) { + return _then( + UnreadCountsThread( + lastRead: null == lastRead + ? _self.lastRead + : lastRead // ignore: cast_nullable_to_non_nullable + as DateTime, + lastReadMessageId: null == lastReadMessageId + ? _self.lastReadMessageId + : lastReadMessageId // ignore: cast_nullable_to_non_nullable + as String, + parentMessageId: null == parentMessageId + ? _self.parentMessageId + : parentMessageId // ignore: cast_nullable_to_non_nullable + as String, + unreadCount: null == unreadCount + ? _self.unreadCount + : unreadCount // ignore: cast_nullable_to_non_nullable + as int, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/unread_counts_thread.g.dart b/packages/stream_chat/lib/open_api/model/unread_counts_thread.g.dart new file mode 100644 index 0000000000..727370061e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/unread_counts_thread.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'unread_counts_thread.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UnreadCountsThread _$UnreadCountsThreadFromJson(Map json) => UnreadCountsThread( + lastRead: const StreamDateTimeConverter().fromJson( + json['last_read'] as Object, + ), + lastReadMessageId: json['last_read_message_id'] as String, + parentMessageId: json['parent_message_id'] as String, + unreadCount: (json['unread_count'] as num).toInt(), +); + +Map _$UnreadCountsThreadToJson(UnreadCountsThread instance) => { + 'last_read': const StreamDateTimeConverter().toJson(instance.lastRead), + 'last_read_message_id': instance.lastReadMessageId, + 'parent_message_id': instance.parentMessageId, + 'unread_count': instance.unreadCount, +}; diff --git a/packages/stream_chat/lib/open_api/model/update_block_list_request.dart b/packages/stream_chat/lib/open_api/model/update_block_list_request.dart new file mode 100644 index 0000000000..464ea7a92b --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_block_list_request.dart @@ -0,0 +1,56 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'update_block_list_request.g.dart'; +part 'update_block_list_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UpdateBlockListRequest with _$UpdateBlockListRequest { + const UpdateBlockListRequest({ + this.isConfusableFoldingEnabled, + this.isLeetCheckEnabled, + this.isPluralCheckEnabled, + this.isSubstringMatchingEnabled, + this.team, + this.words, + }); + + @override + @JsonKey(name: 'is_confusable_folding_enabled') + final bool? isConfusableFoldingEnabled; + + @override + @JsonKey(name: 'is_leet_check_enabled') + final bool? isLeetCheckEnabled; + + @override + @JsonKey(name: 'is_plural_check_enabled') + final bool? isPluralCheckEnabled; + + @override + @JsonKey(name: 'is_substring_matching_enabled') + final bool? isSubstringMatchingEnabled; + + @override + @JsonKey(name: 'team') + final String? team; + + @override + @JsonKey(name: 'words') + final List? words; + + Map toJson() => _$UpdateBlockListRequestToJson(this); + + static UpdateBlockListRequest fromJson(Map json) => _$UpdateBlockListRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/update_block_list_request.freezed.dart b/packages/stream_chat/lib/open_api/model/update_block_list_request.freezed.dart new file mode 100644 index 0000000000..48fe4e83a8 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_block_list_request.freezed.dart @@ -0,0 +1,138 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'update_block_list_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpdateBlockListRequest { + bool? get isConfusableFoldingEnabled; + bool? get isLeetCheckEnabled; + bool? get isPluralCheckEnabled; + bool? get isSubstringMatchingEnabled; + String? get team; + List? get words; + + /// Create a copy of UpdateBlockListRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpdateBlockListRequestCopyWith get copyWith => + _$UpdateBlockListRequestCopyWithImpl( + this as UpdateBlockListRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpdateBlockListRequest && + (identical( + other.isConfusableFoldingEnabled, + isConfusableFoldingEnabled, + ) || + other.isConfusableFoldingEnabled == isConfusableFoldingEnabled) && + (identical(other.isLeetCheckEnabled, isLeetCheckEnabled) || + other.isLeetCheckEnabled == isLeetCheckEnabled) && + (identical(other.isPluralCheckEnabled, isPluralCheckEnabled) || + other.isPluralCheckEnabled == isPluralCheckEnabled) && + (identical( + other.isSubstringMatchingEnabled, + isSubstringMatchingEnabled, + ) || + other.isSubstringMatchingEnabled == isSubstringMatchingEnabled) && + (identical(other.team, team) || other.team == team) && + const DeepCollectionEquality().equals(other.words, words)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + isConfusableFoldingEnabled, + isLeetCheckEnabled, + isPluralCheckEnabled, + isSubstringMatchingEnabled, + team, + const DeepCollectionEquality().hash(words), + ); + + @override + String toString() { + return 'UpdateBlockListRequest(isConfusableFoldingEnabled: $isConfusableFoldingEnabled, isLeetCheckEnabled: $isLeetCheckEnabled, isPluralCheckEnabled: $isPluralCheckEnabled, isSubstringMatchingEnabled: $isSubstringMatchingEnabled, team: $team, words: $words)'; + } +} + +/// @nodoc +abstract mixin class $UpdateBlockListRequestCopyWith<$Res> { + factory $UpdateBlockListRequestCopyWith( + UpdateBlockListRequest value, + $Res Function(UpdateBlockListRequest) _then, + ) = _$UpdateBlockListRequestCopyWithImpl; + @useResult + $Res call({ + bool? isConfusableFoldingEnabled, + bool? isLeetCheckEnabled, + bool? isPluralCheckEnabled, + bool? isSubstringMatchingEnabled, + String? team, + List? words, + }); +} + +/// @nodoc +class _$UpdateBlockListRequestCopyWithImpl<$Res> implements $UpdateBlockListRequestCopyWith<$Res> { + _$UpdateBlockListRequestCopyWithImpl(this._self, this._then); + + final UpdateBlockListRequest _self; + final $Res Function(UpdateBlockListRequest) _then; + + /// Create a copy of UpdateBlockListRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? isConfusableFoldingEnabled = freezed, + Object? isLeetCheckEnabled = freezed, + Object? isPluralCheckEnabled = freezed, + Object? isSubstringMatchingEnabled = freezed, + Object? team = freezed, + Object? words = freezed, + }) { + return _then( + UpdateBlockListRequest( + isConfusableFoldingEnabled: freezed == isConfusableFoldingEnabled + ? _self.isConfusableFoldingEnabled + : isConfusableFoldingEnabled // ignore: cast_nullable_to_non_nullable + as bool?, + isLeetCheckEnabled: freezed == isLeetCheckEnabled + ? _self.isLeetCheckEnabled + : isLeetCheckEnabled // ignore: cast_nullable_to_non_nullable + as bool?, + isPluralCheckEnabled: freezed == isPluralCheckEnabled + ? _self.isPluralCheckEnabled + : isPluralCheckEnabled // ignore: cast_nullable_to_non_nullable + as bool?, + isSubstringMatchingEnabled: freezed == isSubstringMatchingEnabled + ? _self.isSubstringMatchingEnabled + : isSubstringMatchingEnabled // ignore: cast_nullable_to_non_nullable + as bool?, + team: freezed == team + ? _self.team + : team // ignore: cast_nullable_to_non_nullable + as String?, + words: freezed == words + ? _self.words + : words // ignore: cast_nullable_to_non_nullable + as List?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/update_block_list_request.g.dart b/packages/stream_chat/lib/open_api/model/update_block_list_request.g.dart new file mode 100644 index 0000000000..1c0946c61e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_block_list_request.g.dart @@ -0,0 +1,29 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'update_block_list_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UpdateBlockListRequest _$UpdateBlockListRequestFromJson( + Map json, +) => UpdateBlockListRequest( + isConfusableFoldingEnabled: json['is_confusable_folding_enabled'] as bool?, + isLeetCheckEnabled: json['is_leet_check_enabled'] as bool?, + isPluralCheckEnabled: json['is_plural_check_enabled'] as bool?, + isSubstringMatchingEnabled: json['is_substring_matching_enabled'] as bool?, + team: json['team'] as String?, + words: (json['words'] as List?)?.map((e) => e as String).toList(), +); + +Map _$UpdateBlockListRequestToJson( + UpdateBlockListRequest instance, +) => { + 'is_confusable_folding_enabled': instance.isConfusableFoldingEnabled, + 'is_leet_check_enabled': instance.isLeetCheckEnabled, + 'is_plural_check_enabled': instance.isPluralCheckEnabled, + 'is_substring_matching_enabled': instance.isSubstringMatchingEnabled, + 'team': instance.team, + 'words': instance.words, +}; diff --git a/packages/stream_chat/lib/open_api/model/update_block_list_response.dart b/packages/stream_chat/lib/open_api/model/update_block_list_response.dart new file mode 100644 index 0000000000..97d236b734 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_block_list_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'update_block_list_response.g.dart'; +part 'update_block_list_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UpdateBlockListResponse with _$UpdateBlockListResponse { + const UpdateBlockListResponse({ + this.blocklist, + required this.duration, + }); + + @override + @JsonKey(name: 'blocklist') + final BlockListResponse? blocklist; + + @override + @JsonKey(name: 'duration') + final String duration; + + Map toJson() => _$UpdateBlockListResponseToJson(this); + + static UpdateBlockListResponse fromJson(Map json) => _$UpdateBlockListResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/update_block_list_response.freezed.dart b/packages/stream_chat/lib/open_api/model/update_block_list_response.freezed.dart new file mode 100644 index 0000000000..eb29fd77fd --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_block_list_response.freezed.dart @@ -0,0 +1,82 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'update_block_list_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpdateBlockListResponse { + BlockListResponse? get blocklist; + String get duration; + + /// Create a copy of UpdateBlockListResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpdateBlockListResponseCopyWith get copyWith => + _$UpdateBlockListResponseCopyWithImpl( + this as UpdateBlockListResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpdateBlockListResponse && + (identical(other.blocklist, blocklist) || other.blocklist == blocklist) && + (identical(other.duration, duration) || other.duration == duration)); + } + + @override + int get hashCode => Object.hash(runtimeType, blocklist, duration); + + @override + String toString() { + return 'UpdateBlockListResponse(blocklist: $blocklist, duration: $duration)'; + } +} + +/// @nodoc +abstract mixin class $UpdateBlockListResponseCopyWith<$Res> { + factory $UpdateBlockListResponseCopyWith( + UpdateBlockListResponse value, + $Res Function(UpdateBlockListResponse) _then, + ) = _$UpdateBlockListResponseCopyWithImpl; + @useResult + $Res call({BlockListResponse? blocklist, String duration}); +} + +/// @nodoc +class _$UpdateBlockListResponseCopyWithImpl<$Res> implements $UpdateBlockListResponseCopyWith<$Res> { + _$UpdateBlockListResponseCopyWithImpl(this._self, this._then); + + final UpdateBlockListResponse _self; + final $Res Function(UpdateBlockListResponse) _then; + + /// Create a copy of UpdateBlockListResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? blocklist = freezed, Object? duration = null}) { + return _then( + UpdateBlockListResponse( + blocklist: freezed == blocklist + ? _self.blocklist + : blocklist // ignore: cast_nullable_to_non_nullable + as BlockListResponse?, + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/update_block_list_response.g.dart b/packages/stream_chat/lib/open_api/model/update_block_list_response.g.dart new file mode 100644 index 0000000000..c0eb05b853 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_block_list_response.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'update_block_list_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UpdateBlockListResponse _$UpdateBlockListResponseFromJson( + Map json, +) => UpdateBlockListResponse( + blocklist: json['blocklist'] == null ? null : BlockListResponse.fromJson(json['blocklist'] as Map), + duration: json['duration'] as String, +); + +Map _$UpdateBlockListResponseToJson( + UpdateBlockListResponse instance, +) => { + 'blocklist': instance.blocklist?.toJson(), + 'duration': instance.duration, +}; diff --git a/packages/stream_chat/lib/open_api/model/update_channel_partial_request.dart b/packages/stream_chat/lib/open_api/model/update_channel_partial_request.dart new file mode 100644 index 0000000000..487a1ab38a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_channel_partial_request.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'update_channel_partial_request.g.dart'; +part 'update_channel_partial_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UpdateChannelPartialRequest with _$UpdateChannelPartialRequest { + const UpdateChannelPartialRequest({ + this.set, + this.unset, + }); + + @override + @JsonKey(name: 'set') + final Map? set; + + @override + @JsonKey(name: 'unset') + final List? unset; + + Map toJson() => _$UpdateChannelPartialRequestToJson(this); + + static UpdateChannelPartialRequest fromJson(Map json) => _$UpdateChannelPartialRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/update_channel_partial_request.freezed.dart b/packages/stream_chat/lib/open_api/model/update_channel_partial_request.freezed.dart new file mode 100644 index 0000000000..e500bf463e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_channel_partial_request.freezed.dart @@ -0,0 +1,86 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'update_channel_partial_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpdateChannelPartialRequest { + Map? get set; + List? get unset; + + /// Create a copy of UpdateChannelPartialRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpdateChannelPartialRequestCopyWith get copyWith => + _$UpdateChannelPartialRequestCopyWithImpl( + this as UpdateChannelPartialRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpdateChannelPartialRequest && + const DeepCollectionEquality().equals(other.set, set) && + const DeepCollectionEquality().equals(other.unset, unset)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(set), + const DeepCollectionEquality().hash(unset), + ); + + @override + String toString() { + return 'UpdateChannelPartialRequest(set: $set, unset: $unset)'; + } +} + +/// @nodoc +abstract mixin class $UpdateChannelPartialRequestCopyWith<$Res> { + factory $UpdateChannelPartialRequestCopyWith( + UpdateChannelPartialRequest value, + $Res Function(UpdateChannelPartialRequest) _then, + ) = _$UpdateChannelPartialRequestCopyWithImpl; + @useResult + $Res call({Map? set, List? unset}); +} + +/// @nodoc +class _$UpdateChannelPartialRequestCopyWithImpl<$Res> implements $UpdateChannelPartialRequestCopyWith<$Res> { + _$UpdateChannelPartialRequestCopyWithImpl(this._self, this._then); + + final UpdateChannelPartialRequest _self; + final $Res Function(UpdateChannelPartialRequest) _then; + + /// Create a copy of UpdateChannelPartialRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? set = freezed, Object? unset = freezed}) { + return _then( + UpdateChannelPartialRequest( + set: freezed == set + ? _self.set + : set // ignore: cast_nullable_to_non_nullable + as Map?, + unset: freezed == unset + ? _self.unset + : unset // ignore: cast_nullable_to_non_nullable + as List?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/update_channel_partial_request.g.dart b/packages/stream_chat/lib/open_api/model/update_channel_partial_request.g.dart new file mode 100644 index 0000000000..cadcbce86d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_channel_partial_request.g.dart @@ -0,0 +1,18 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'update_channel_partial_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UpdateChannelPartialRequest _$UpdateChannelPartialRequestFromJson( + Map json, +) => UpdateChannelPartialRequest( + set: json['set'] as Map?, + unset: (json['unset'] as List?)?.map((e) => e as String).toList(), +); + +Map _$UpdateChannelPartialRequestToJson( + UpdateChannelPartialRequest instance, +) => {'set': instance.set, 'unset': instance.unset}; diff --git a/packages/stream_chat/lib/open_api/model/update_channel_partial_response.dart b/packages/stream_chat/lib/open_api/model/update_channel_partial_response.dart new file mode 100644 index 0000000000..e21b05b0d7 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_channel_partial_response.dart @@ -0,0 +1,42 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'update_channel_partial_response.g.dart'; +part 'update_channel_partial_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UpdateChannelPartialResponse with _$UpdateChannelPartialResponse { + const UpdateChannelPartialResponse({ + this.channel, + required this.duration, + required this.members, + }); + + @override + @JsonKey(name: 'channel') + final ChannelResponse? channel; + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'members') + final List members; + + Map toJson() => _$UpdateChannelPartialResponseToJson(this); + + static UpdateChannelPartialResponse fromJson(Map json) => + _$UpdateChannelPartialResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/update_channel_partial_response.freezed.dart b/packages/stream_chat/lib/open_api/model/update_channel_partial_response.freezed.dart new file mode 100644 index 0000000000..24e478e29c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_channel_partial_response.freezed.dart @@ -0,0 +1,101 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'update_channel_partial_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpdateChannelPartialResponse { + ChannelResponse? get channel; + String get duration; + List get members; + + /// Create a copy of UpdateChannelPartialResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpdateChannelPartialResponseCopyWith get copyWith => + _$UpdateChannelPartialResponseCopyWithImpl( + this as UpdateChannelPartialResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpdateChannelPartialResponse && + (identical(other.channel, channel) || other.channel == channel) && + (identical(other.duration, duration) || other.duration == duration) && + const DeepCollectionEquality().equals(other.members, members)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channel, + duration, + const DeepCollectionEquality().hash(members), + ); + + @override + String toString() { + return 'UpdateChannelPartialResponse(channel: $channel, duration: $duration, members: $members)'; + } +} + +/// @nodoc +abstract mixin class $UpdateChannelPartialResponseCopyWith<$Res> { + factory $UpdateChannelPartialResponseCopyWith( + UpdateChannelPartialResponse value, + $Res Function(UpdateChannelPartialResponse) _then, + ) = _$UpdateChannelPartialResponseCopyWithImpl; + @useResult + $Res call({ + ChannelResponse? channel, + String duration, + List members, + }); +} + +/// @nodoc +class _$UpdateChannelPartialResponseCopyWithImpl<$Res> implements $UpdateChannelPartialResponseCopyWith<$Res> { + _$UpdateChannelPartialResponseCopyWithImpl(this._self, this._then); + + final UpdateChannelPartialResponse _self; + final $Res Function(UpdateChannelPartialResponse) _then; + + /// Create a copy of UpdateChannelPartialResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channel = freezed, + Object? duration = null, + Object? members = null, + }) { + return _then( + UpdateChannelPartialResponse( + channel: freezed == channel + ? _self.channel + : channel // ignore: cast_nullable_to_non_nullable + as ChannelResponse?, + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + members: null == members + ? _self.members + : members // ignore: cast_nullable_to_non_nullable + as List, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/update_channel_partial_response.g.dart b/packages/stream_chat/lib/open_api/model/update_channel_partial_response.g.dart new file mode 100644 index 0000000000..2e716d891d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_channel_partial_response.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'update_channel_partial_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UpdateChannelPartialResponse _$UpdateChannelPartialResponseFromJson( + Map json, +) => UpdateChannelPartialResponse( + channel: json['channel'] == null ? null : ChannelResponse.fromJson(json['channel'] as Map), + duration: json['duration'] as String, + members: (json['members'] as List) + .map((e) => ChannelMemberResponse.fromJson(e as Map)) + .toList(), +); + +Map _$UpdateChannelPartialResponseToJson( + UpdateChannelPartialResponse instance, +) => { + 'channel': instance.channel?.toJson(), + 'duration': instance.duration, + 'members': instance.members.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/update_channel_request.dart b/packages/stream_chat/lib/open_api/model/update_channel_request.dart new file mode 100644 index 0000000000..cb83c5b085 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_channel_request.dart @@ -0,0 +1,92 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'update_channel_request.g.dart'; +part 'update_channel_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UpdateChannelRequest with _$UpdateChannelRequest { + const UpdateChannelRequest({ + this.acceptInvite, + this.addFilterTags, + this.addMembers, + this.cooldown, + this.data, + this.hideHistory, + this.hideHistoryBefore, + this.invites, + this.message, + this.rejectInvite, + this.removeFilterTags, + this.removeMembers, + this.skipPush, + }); + + @override + @JsonKey(name: 'accept_invite') + final bool? acceptInvite; + + @override + @JsonKey(name: 'add_filter_tags') + final List? addFilterTags; + + @override + @JsonKey(name: 'add_members') + final List? addMembers; + + @override + @JsonKey(name: 'cooldown') + final int? cooldown; + + @override + @JsonKey(name: 'data') + final ChannelInputRequest? data; + + @override + @JsonKey(name: 'hide_history') + final bool? hideHistory; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'hide_history_before') + final DateTime? hideHistoryBefore; + + @override + @JsonKey(name: 'invites') + final List? invites; + + @override + @JsonKey(name: 'message') + final MessageRequest? message; + + @override + @JsonKey(name: 'reject_invite') + final bool? rejectInvite; + + @override + @JsonKey(name: 'remove_filter_tags') + final List? removeFilterTags; + + @override + @JsonKey(name: 'remove_members') + final List? removeMembers; + + @override + @JsonKey(name: 'skip_push') + final bool? skipPush; + + Map toJson() => _$UpdateChannelRequestToJson(this); + + static UpdateChannelRequest fromJson(Map json) => _$UpdateChannelRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/update_channel_request.freezed.dart b/packages/stream_chat/lib/open_api/model/update_channel_request.freezed.dart new file mode 100644 index 0000000000..9d80bd18be --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_channel_request.freezed.dart @@ -0,0 +1,203 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'update_channel_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpdateChannelRequest { + bool? get acceptInvite; + List? get addFilterTags; + List? get addMembers; + int? get cooldown; + ChannelInputRequest? get data; + bool? get hideHistory; + DateTime? get hideHistoryBefore; + List? get invites; + MessageRequest? get message; + bool? get rejectInvite; + List? get removeFilterTags; + List? get removeMembers; + bool? get skipPush; + + /// Create a copy of UpdateChannelRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpdateChannelRequestCopyWith get copyWith => + _$UpdateChannelRequestCopyWithImpl( + this as UpdateChannelRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpdateChannelRequest && + (identical(other.acceptInvite, acceptInvite) || other.acceptInvite == acceptInvite) && + const DeepCollectionEquality().equals( + other.addFilterTags, + addFilterTags, + ) && + const DeepCollectionEquality().equals( + other.addMembers, + addMembers, + ) && + (identical(other.cooldown, cooldown) || other.cooldown == cooldown) && + (identical(other.data, data) || other.data == data) && + (identical(other.hideHistory, hideHistory) || other.hideHistory == hideHistory) && + (identical(other.hideHistoryBefore, hideHistoryBefore) || other.hideHistoryBefore == hideHistoryBefore) && + const DeepCollectionEquality().equals(other.invites, invites) && + (identical(other.message, message) || other.message == message) && + (identical(other.rejectInvite, rejectInvite) || other.rejectInvite == rejectInvite) && + const DeepCollectionEquality().equals( + other.removeFilterTags, + removeFilterTags, + ) && + const DeepCollectionEquality().equals( + other.removeMembers, + removeMembers, + ) && + (identical(other.skipPush, skipPush) || other.skipPush == skipPush)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + acceptInvite, + const DeepCollectionEquality().hash(addFilterTags), + const DeepCollectionEquality().hash(addMembers), + cooldown, + data, + hideHistory, + hideHistoryBefore, + const DeepCollectionEquality().hash(invites), + message, + rejectInvite, + const DeepCollectionEquality().hash(removeFilterTags), + const DeepCollectionEquality().hash(removeMembers), + skipPush, + ); + + @override + String toString() { + return 'UpdateChannelRequest(acceptInvite: $acceptInvite, addFilterTags: $addFilterTags, addMembers: $addMembers, cooldown: $cooldown, data: $data, hideHistory: $hideHistory, hideHistoryBefore: $hideHistoryBefore, invites: $invites, message: $message, rejectInvite: $rejectInvite, removeFilterTags: $removeFilterTags, removeMembers: $removeMembers, skipPush: $skipPush)'; + } +} + +/// @nodoc +abstract mixin class $UpdateChannelRequestCopyWith<$Res> { + factory $UpdateChannelRequestCopyWith( + UpdateChannelRequest value, + $Res Function(UpdateChannelRequest) _then, + ) = _$UpdateChannelRequestCopyWithImpl; + @useResult + $Res call({ + bool? acceptInvite, + List? addFilterTags, + List? addMembers, + int? cooldown, + ChannelInputRequest? data, + bool? hideHistory, + DateTime? hideHistoryBefore, + List? invites, + MessageRequest? message, + bool? rejectInvite, + List? removeFilterTags, + List? removeMembers, + bool? skipPush, + }); +} + +/// @nodoc +class _$UpdateChannelRequestCopyWithImpl<$Res> implements $UpdateChannelRequestCopyWith<$Res> { + _$UpdateChannelRequestCopyWithImpl(this._self, this._then); + + final UpdateChannelRequest _self; + final $Res Function(UpdateChannelRequest) _then; + + /// Create a copy of UpdateChannelRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? acceptInvite = freezed, + Object? addFilterTags = freezed, + Object? addMembers = freezed, + Object? cooldown = freezed, + Object? data = freezed, + Object? hideHistory = freezed, + Object? hideHistoryBefore = freezed, + Object? invites = freezed, + Object? message = freezed, + Object? rejectInvite = freezed, + Object? removeFilterTags = freezed, + Object? removeMembers = freezed, + Object? skipPush = freezed, + }) { + return _then( + UpdateChannelRequest( + acceptInvite: freezed == acceptInvite + ? _self.acceptInvite + : acceptInvite // ignore: cast_nullable_to_non_nullable + as bool?, + addFilterTags: freezed == addFilterTags + ? _self.addFilterTags + : addFilterTags // ignore: cast_nullable_to_non_nullable + as List?, + addMembers: freezed == addMembers + ? _self.addMembers + : addMembers // ignore: cast_nullable_to_non_nullable + as List?, + cooldown: freezed == cooldown + ? _self.cooldown + : cooldown // ignore: cast_nullable_to_non_nullable + as int?, + data: freezed == data + ? _self.data + : data // ignore: cast_nullable_to_non_nullable + as ChannelInputRequest?, + hideHistory: freezed == hideHistory + ? _self.hideHistory + : hideHistory // ignore: cast_nullable_to_non_nullable + as bool?, + hideHistoryBefore: freezed == hideHistoryBefore + ? _self.hideHistoryBefore + : hideHistoryBefore // ignore: cast_nullable_to_non_nullable + as DateTime?, + invites: freezed == invites + ? _self.invites + : invites // ignore: cast_nullable_to_non_nullable + as List?, + message: freezed == message + ? _self.message + : message // ignore: cast_nullable_to_non_nullable + as MessageRequest?, + rejectInvite: freezed == rejectInvite + ? _self.rejectInvite + : rejectInvite // ignore: cast_nullable_to_non_nullable + as bool?, + removeFilterTags: freezed == removeFilterTags + ? _self.removeFilterTags + : removeFilterTags // ignore: cast_nullable_to_non_nullable + as List?, + removeMembers: freezed == removeMembers + ? _self.removeMembers + : removeMembers // ignore: cast_nullable_to_non_nullable + as List?, + skipPush: freezed == skipPush + ? _self.skipPush + : skipPush // ignore: cast_nullable_to_non_nullable + as bool?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/update_channel_request.g.dart b/packages/stream_chat/lib/open_api/model/update_channel_request.g.dart new file mode 100644 index 0000000000..781b6bde9f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_channel_request.g.dart @@ -0,0 +1,63 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'update_channel_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UpdateChannelRequest _$UpdateChannelRequestFromJson( + Map json, +) => UpdateChannelRequest( + acceptInvite: json['accept_invite'] as bool?, + addFilterTags: (json['add_filter_tags'] as List?)?.map((e) => e as String).toList(), + addMembers: (json['add_members'] as List?) + ?.map((e) => ChannelMemberRequest.fromJson(e as Map)) + .toList(), + cooldown: (json['cooldown'] as num?)?.toInt(), + data: json['data'] == null ? null : ChannelInputRequest.fromJson(json['data'] as Map), + hideHistory: json['hide_history'] as bool?, + hideHistoryBefore: _$JsonConverterFromJson( + json['hide_history_before'], + const StreamDateTimeConverter().fromJson, + ), + invites: (json['invites'] as List?) + ?.map((e) => ChannelMemberRequest.fromJson(e as Map)) + .toList(), + message: json['message'] == null ? null : MessageRequest.fromJson(json['message'] as Map), + rejectInvite: json['reject_invite'] as bool?, + removeFilterTags: (json['remove_filter_tags'] as List?)?.map((e) => e as String).toList(), + removeMembers: (json['remove_members'] as List?)?.map((e) => e as String).toList(), + skipPush: json['skip_push'] as bool?, +); + +Map _$UpdateChannelRequestToJson( + UpdateChannelRequest instance, +) => { + 'accept_invite': instance.acceptInvite, + 'add_filter_tags': instance.addFilterTags, + 'add_members': instance.addMembers?.map((e) => e.toJson()).toList(), + 'cooldown': instance.cooldown, + 'data': instance.data?.toJson(), + 'hide_history': instance.hideHistory, + 'hide_history_before': _$JsonConverterToJson( + instance.hideHistoryBefore, + const StreamDateTimeConverter().toJson, + ), + 'invites': instance.invites?.map((e) => e.toJson()).toList(), + 'message': instance.message?.toJson(), + 'reject_invite': instance.rejectInvite, + 'remove_filter_tags': instance.removeFilterTags, + 'remove_members': instance.removeMembers, + 'skip_push': instance.skipPush, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/update_channel_response.dart b/packages/stream_chat/lib/open_api/model/update_channel_response.dart new file mode 100644 index 0000000000..81a99d9bc8 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_channel_response.dart @@ -0,0 +1,46 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'update_channel_response.g.dart'; +part 'update_channel_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UpdateChannelResponse with _$UpdateChannelResponse { + const UpdateChannelResponse({ + this.channel, + required this.duration, + required this.members, + this.message, + }); + + @override + @JsonKey(name: 'channel') + final ChannelResponse? channel; + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'members') + final List members; + + @override + @JsonKey(name: 'message') + final MessageResponse? message; + + Map toJson() => _$UpdateChannelResponseToJson(this); + + static UpdateChannelResponse fromJson(Map json) => _$UpdateChannelResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/update_channel_response.freezed.dart b/packages/stream_chat/lib/open_api/model/update_channel_response.freezed.dart new file mode 100644 index 0000000000..4583b561d3 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_channel_response.freezed.dart @@ -0,0 +1,110 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'update_channel_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpdateChannelResponse { + ChannelResponse? get channel; + String get duration; + List get members; + MessageResponse? get message; + + /// Create a copy of UpdateChannelResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpdateChannelResponseCopyWith get copyWith => + _$UpdateChannelResponseCopyWithImpl( + this as UpdateChannelResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpdateChannelResponse && + (identical(other.channel, channel) || other.channel == channel) && + (identical(other.duration, duration) || other.duration == duration) && + const DeepCollectionEquality().equals(other.members, members) && + (identical(other.message, message) || other.message == message)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channel, + duration, + const DeepCollectionEquality().hash(members), + message, + ); + + @override + String toString() { + return 'UpdateChannelResponse(channel: $channel, duration: $duration, members: $members, message: $message)'; + } +} + +/// @nodoc +abstract mixin class $UpdateChannelResponseCopyWith<$Res> { + factory $UpdateChannelResponseCopyWith( + UpdateChannelResponse value, + $Res Function(UpdateChannelResponse) _then, + ) = _$UpdateChannelResponseCopyWithImpl; + @useResult + $Res call({ + ChannelResponse? channel, + String duration, + List members, + MessageResponse? message, + }); +} + +/// @nodoc +class _$UpdateChannelResponseCopyWithImpl<$Res> implements $UpdateChannelResponseCopyWith<$Res> { + _$UpdateChannelResponseCopyWithImpl(this._self, this._then); + + final UpdateChannelResponse _self; + final $Res Function(UpdateChannelResponse) _then; + + /// Create a copy of UpdateChannelResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channel = freezed, + Object? duration = null, + Object? members = null, + Object? message = freezed, + }) { + return _then( + UpdateChannelResponse( + channel: freezed == channel + ? _self.channel + : channel // ignore: cast_nullable_to_non_nullable + as ChannelResponse?, + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + members: null == members + ? _self.members + : members // ignore: cast_nullable_to_non_nullable + as List, + message: freezed == message + ? _self.message + : message // ignore: cast_nullable_to_non_nullable + as MessageResponse?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/update_channel_response.g.dart b/packages/stream_chat/lib/open_api/model/update_channel_response.g.dart new file mode 100644 index 0000000000..96999f8661 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_channel_response.g.dart @@ -0,0 +1,27 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'update_channel_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UpdateChannelResponse _$UpdateChannelResponseFromJson( + Map json, +) => UpdateChannelResponse( + channel: json['channel'] == null ? null : ChannelResponse.fromJson(json['channel'] as Map), + duration: json['duration'] as String, + members: (json['members'] as List) + .map((e) => ChannelMemberResponse.fromJson(e as Map)) + .toList(), + message: json['message'] == null ? null : MessageResponse.fromJson(json['message'] as Map), +); + +Map _$UpdateChannelResponseToJson( + UpdateChannelResponse instance, +) => { + 'channel': instance.channel?.toJson(), + 'duration': instance.duration, + 'members': instance.members.map((e) => e.toJson()).toList(), + 'message': instance.message?.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/update_live_location_request.dart b/packages/stream_chat/lib/open_api/model/update_live_location_request.dart new file mode 100644 index 0000000000..fa57561656 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_live_location_request.dart @@ -0,0 +1,47 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'update_live_location_request.g.dart'; +part 'update_live_location_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UpdateLiveLocationRequest with _$UpdateLiveLocationRequest { + const UpdateLiveLocationRequest({ + this.endAt, + this.latitude, + this.longitude, + required this.messageId, + }); + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'end_at') + final DateTime? endAt; + + @override + @JsonKey(name: 'latitude') + final double? latitude; + + @override + @JsonKey(name: 'longitude') + final double? longitude; + + @override + @JsonKey(name: 'message_id') + final String messageId; + + Map toJson() => _$UpdateLiveLocationRequestToJson(this); + + static UpdateLiveLocationRequest fromJson(Map json) => _$UpdateLiveLocationRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/update_live_location_request.freezed.dart b/packages/stream_chat/lib/open_api/model/update_live_location_request.freezed.dart new file mode 100644 index 0000000000..fbc9e238e2 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_live_location_request.freezed.dart @@ -0,0 +1,104 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'update_live_location_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpdateLiveLocationRequest { + DateTime? get endAt; + double? get latitude; + double? get longitude; + String get messageId; + + /// Create a copy of UpdateLiveLocationRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpdateLiveLocationRequestCopyWith get copyWith => + _$UpdateLiveLocationRequestCopyWithImpl( + this as UpdateLiveLocationRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpdateLiveLocationRequest && + (identical(other.endAt, endAt) || other.endAt == endAt) && + (identical(other.latitude, latitude) || other.latitude == latitude) && + (identical(other.longitude, longitude) || other.longitude == longitude) && + (identical(other.messageId, messageId) || other.messageId == messageId)); + } + + @override + int get hashCode => Object.hash(runtimeType, endAt, latitude, longitude, messageId); + + @override + String toString() { + return 'UpdateLiveLocationRequest(endAt: $endAt, latitude: $latitude, longitude: $longitude, messageId: $messageId)'; + } +} + +/// @nodoc +abstract mixin class $UpdateLiveLocationRequestCopyWith<$Res> { + factory $UpdateLiveLocationRequestCopyWith( + UpdateLiveLocationRequest value, + $Res Function(UpdateLiveLocationRequest) _then, + ) = _$UpdateLiveLocationRequestCopyWithImpl; + @useResult + $Res call({ + DateTime? endAt, + double? latitude, + double? longitude, + String messageId, + }); +} + +/// @nodoc +class _$UpdateLiveLocationRequestCopyWithImpl<$Res> implements $UpdateLiveLocationRequestCopyWith<$Res> { + _$UpdateLiveLocationRequestCopyWithImpl(this._self, this._then); + + final UpdateLiveLocationRequest _self; + final $Res Function(UpdateLiveLocationRequest) _then; + + /// Create a copy of UpdateLiveLocationRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? endAt = freezed, + Object? latitude = freezed, + Object? longitude = freezed, + Object? messageId = null, + }) { + return _then( + UpdateLiveLocationRequest( + endAt: freezed == endAt + ? _self.endAt + : endAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + latitude: freezed == latitude + ? _self.latitude + : latitude // ignore: cast_nullable_to_non_nullable + as double?, + longitude: freezed == longitude + ? _self.longitude + : longitude // ignore: cast_nullable_to_non_nullable + as double?, + messageId: null == messageId + ? _self.messageId + : messageId // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/update_live_location_request.g.dart b/packages/stream_chat/lib/open_api/model/update_live_location_request.g.dart new file mode 100644 index 0000000000..bd21505ac6 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_live_location_request.g.dart @@ -0,0 +1,41 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'update_live_location_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UpdateLiveLocationRequest _$UpdateLiveLocationRequestFromJson( + Map json, +) => UpdateLiveLocationRequest( + endAt: _$JsonConverterFromJson( + json['end_at'], + const StreamDateTimeConverter().fromJson, + ), + latitude: (json['latitude'] as num?)?.toDouble(), + longitude: (json['longitude'] as num?)?.toDouble(), + messageId: json['message_id'] as String, +); + +Map _$UpdateLiveLocationRequestToJson( + UpdateLiveLocationRequest instance, +) => { + 'end_at': _$JsonConverterToJson( + instance.endAt, + const StreamDateTimeConverter().toJson, + ), + 'latitude': instance.latitude, + 'longitude': instance.longitude, + 'message_id': instance.messageId, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/update_member_partial_request.dart b/packages/stream_chat/lib/open_api/model/update_member_partial_request.dart new file mode 100644 index 0000000000..29bfae37ba --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_member_partial_request.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'update_member_partial_request.g.dart'; +part 'update_member_partial_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UpdateMemberPartialRequest with _$UpdateMemberPartialRequest { + const UpdateMemberPartialRequest({ + this.set, + this.unset, + }); + + @override + @JsonKey(name: 'set') + final Map? set; + + @override + @JsonKey(name: 'unset') + final List? unset; + + Map toJson() => _$UpdateMemberPartialRequestToJson(this); + + static UpdateMemberPartialRequest fromJson(Map json) => _$UpdateMemberPartialRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/update_member_partial_request.freezed.dart b/packages/stream_chat/lib/open_api/model/update_member_partial_request.freezed.dart new file mode 100644 index 0000000000..9cad3866b3 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_member_partial_request.freezed.dart @@ -0,0 +1,86 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'update_member_partial_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpdateMemberPartialRequest { + Map? get set; + List? get unset; + + /// Create a copy of UpdateMemberPartialRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpdateMemberPartialRequestCopyWith get copyWith => + _$UpdateMemberPartialRequestCopyWithImpl( + this as UpdateMemberPartialRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpdateMemberPartialRequest && + const DeepCollectionEquality().equals(other.set, set) && + const DeepCollectionEquality().equals(other.unset, unset)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(set), + const DeepCollectionEquality().hash(unset), + ); + + @override + String toString() { + return 'UpdateMemberPartialRequest(set: $set, unset: $unset)'; + } +} + +/// @nodoc +abstract mixin class $UpdateMemberPartialRequestCopyWith<$Res> { + factory $UpdateMemberPartialRequestCopyWith( + UpdateMemberPartialRequest value, + $Res Function(UpdateMemberPartialRequest) _then, + ) = _$UpdateMemberPartialRequestCopyWithImpl; + @useResult + $Res call({Map? set, List? unset}); +} + +/// @nodoc +class _$UpdateMemberPartialRequestCopyWithImpl<$Res> implements $UpdateMemberPartialRequestCopyWith<$Res> { + _$UpdateMemberPartialRequestCopyWithImpl(this._self, this._then); + + final UpdateMemberPartialRequest _self; + final $Res Function(UpdateMemberPartialRequest) _then; + + /// Create a copy of UpdateMemberPartialRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? set = freezed, Object? unset = freezed}) { + return _then( + UpdateMemberPartialRequest( + set: freezed == set + ? _self.set + : set // ignore: cast_nullable_to_non_nullable + as Map?, + unset: freezed == unset + ? _self.unset + : unset // ignore: cast_nullable_to_non_nullable + as List?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/update_member_partial_request.g.dart b/packages/stream_chat/lib/open_api/model/update_member_partial_request.g.dart new file mode 100644 index 0000000000..f1de0183ed --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_member_partial_request.g.dart @@ -0,0 +1,18 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'update_member_partial_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UpdateMemberPartialRequest _$UpdateMemberPartialRequestFromJson( + Map json, +) => UpdateMemberPartialRequest( + set: json['set'] as Map?, + unset: (json['unset'] as List?)?.map((e) => e as String).toList(), +); + +Map _$UpdateMemberPartialRequestToJson( + UpdateMemberPartialRequest instance, +) => {'set': instance.set, 'unset': instance.unset}; diff --git a/packages/stream_chat/lib/open_api/model/update_member_partial_response.dart b/packages/stream_chat/lib/open_api/model/update_member_partial_response.dart new file mode 100644 index 0000000000..12bff111af --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_member_partial_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'update_member_partial_response.g.dart'; +part 'update_member_partial_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UpdateMemberPartialResponse with _$UpdateMemberPartialResponse { + const UpdateMemberPartialResponse({ + this.channelMember, + required this.duration, + }); + + @override + @JsonKey(name: 'channel_member') + final ChannelMemberResponse? channelMember; + + @override + @JsonKey(name: 'duration') + final String duration; + + Map toJson() => _$UpdateMemberPartialResponseToJson(this); + + static UpdateMemberPartialResponse fromJson(Map json) => _$UpdateMemberPartialResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/update_member_partial_response.freezed.dart b/packages/stream_chat/lib/open_api/model/update_member_partial_response.freezed.dart new file mode 100644 index 0000000000..20ef244177 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_member_partial_response.freezed.dart @@ -0,0 +1,82 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'update_member_partial_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpdateMemberPartialResponse { + ChannelMemberResponse? get channelMember; + String get duration; + + /// Create a copy of UpdateMemberPartialResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpdateMemberPartialResponseCopyWith get copyWith => + _$UpdateMemberPartialResponseCopyWithImpl( + this as UpdateMemberPartialResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpdateMemberPartialResponse && + (identical(other.channelMember, channelMember) || other.channelMember == channelMember) && + (identical(other.duration, duration) || other.duration == duration)); + } + + @override + int get hashCode => Object.hash(runtimeType, channelMember, duration); + + @override + String toString() { + return 'UpdateMemberPartialResponse(channelMember: $channelMember, duration: $duration)'; + } +} + +/// @nodoc +abstract mixin class $UpdateMemberPartialResponseCopyWith<$Res> { + factory $UpdateMemberPartialResponseCopyWith( + UpdateMemberPartialResponse value, + $Res Function(UpdateMemberPartialResponse) _then, + ) = _$UpdateMemberPartialResponseCopyWithImpl; + @useResult + $Res call({ChannelMemberResponse? channelMember, String duration}); +} + +/// @nodoc +class _$UpdateMemberPartialResponseCopyWithImpl<$Res> implements $UpdateMemberPartialResponseCopyWith<$Res> { + _$UpdateMemberPartialResponseCopyWithImpl(this._self, this._then); + + final UpdateMemberPartialResponse _self; + final $Res Function(UpdateMemberPartialResponse) _then; + + /// Create a copy of UpdateMemberPartialResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? channelMember = freezed, Object? duration = null}) { + return _then( + UpdateMemberPartialResponse( + channelMember: freezed == channelMember + ? _self.channelMember + : channelMember // ignore: cast_nullable_to_non_nullable + as ChannelMemberResponse?, + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/update_member_partial_response.g.dart b/packages/stream_chat/lib/open_api/model/update_member_partial_response.g.dart new file mode 100644 index 0000000000..4dff71e141 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_member_partial_response.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'update_member_partial_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UpdateMemberPartialResponse _$UpdateMemberPartialResponseFromJson( + Map json, +) => UpdateMemberPartialResponse( + channelMember: json['channel_member'] == null + ? null + : ChannelMemberResponse.fromJson( + json['channel_member'] as Map, + ), + duration: json['duration'] as String, +); + +Map _$UpdateMemberPartialResponseToJson( + UpdateMemberPartialResponse instance, +) => { + 'channel_member': instance.channelMember?.toJson(), + 'duration': instance.duration, +}; diff --git a/packages/stream_chat/lib/open_api/model/update_message_partial_request.dart b/packages/stream_chat/lib/open_api/model/update_message_partial_request.dart new file mode 100644 index 0000000000..b30b64d3ab --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_message_partial_request.dart @@ -0,0 +1,46 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'update_message_partial_request.g.dart'; +part 'update_message_partial_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UpdateMessagePartialRequest with _$UpdateMessagePartialRequest { + const UpdateMessagePartialRequest({ + this.set, + this.skipEnrichUrl, + this.skipPush, + this.unset, + }); + + @override + @JsonKey(name: 'set') + final Map? set; + + @override + @JsonKey(name: 'skip_enrich_url') + final bool? skipEnrichUrl; + + @override + @JsonKey(name: 'skip_push') + final bool? skipPush; + + @override + @JsonKey(name: 'unset') + final List? unset; + + Map toJson() => _$UpdateMessagePartialRequestToJson(this); + + static UpdateMessagePartialRequest fromJson(Map json) => _$UpdateMessagePartialRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/update_message_partial_request.freezed.dart b/packages/stream_chat/lib/open_api/model/update_message_partial_request.freezed.dart new file mode 100644 index 0000000000..a0172b5f79 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_message_partial_request.freezed.dart @@ -0,0 +1,110 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'update_message_partial_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpdateMessagePartialRequest { + Map? get set; + bool? get skipEnrichUrl; + bool? get skipPush; + List? get unset; + + /// Create a copy of UpdateMessagePartialRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpdateMessagePartialRequestCopyWith get copyWith => + _$UpdateMessagePartialRequestCopyWithImpl( + this as UpdateMessagePartialRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpdateMessagePartialRequest && + const DeepCollectionEquality().equals(other.set, set) && + (identical(other.skipEnrichUrl, skipEnrichUrl) || other.skipEnrichUrl == skipEnrichUrl) && + (identical(other.skipPush, skipPush) || other.skipPush == skipPush) && + const DeepCollectionEquality().equals(other.unset, unset)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(set), + skipEnrichUrl, + skipPush, + const DeepCollectionEquality().hash(unset), + ); + + @override + String toString() { + return 'UpdateMessagePartialRequest(set: $set, skipEnrichUrl: $skipEnrichUrl, skipPush: $skipPush, unset: $unset)'; + } +} + +/// @nodoc +abstract mixin class $UpdateMessagePartialRequestCopyWith<$Res> { + factory $UpdateMessagePartialRequestCopyWith( + UpdateMessagePartialRequest value, + $Res Function(UpdateMessagePartialRequest) _then, + ) = _$UpdateMessagePartialRequestCopyWithImpl; + @useResult + $Res call({ + Map? set, + bool? skipEnrichUrl, + bool? skipPush, + List? unset, + }); +} + +/// @nodoc +class _$UpdateMessagePartialRequestCopyWithImpl<$Res> implements $UpdateMessagePartialRequestCopyWith<$Res> { + _$UpdateMessagePartialRequestCopyWithImpl(this._self, this._then); + + final UpdateMessagePartialRequest _self; + final $Res Function(UpdateMessagePartialRequest) _then; + + /// Create a copy of UpdateMessagePartialRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? set = freezed, + Object? skipEnrichUrl = freezed, + Object? skipPush = freezed, + Object? unset = freezed, + }) { + return _then( + UpdateMessagePartialRequest( + set: freezed == set + ? _self.set + : set // ignore: cast_nullable_to_non_nullable + as Map?, + skipEnrichUrl: freezed == skipEnrichUrl + ? _self.skipEnrichUrl + : skipEnrichUrl // ignore: cast_nullable_to_non_nullable + as bool?, + skipPush: freezed == skipPush + ? _self.skipPush + : skipPush // ignore: cast_nullable_to_non_nullable + as bool?, + unset: freezed == unset + ? _self.unset + : unset // ignore: cast_nullable_to_non_nullable + as List?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/update_message_partial_request.g.dart b/packages/stream_chat/lib/open_api/model/update_message_partial_request.g.dart new file mode 100644 index 0000000000..faf66d4440 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_message_partial_request.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'update_message_partial_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UpdateMessagePartialRequest _$UpdateMessagePartialRequestFromJson( + Map json, +) => UpdateMessagePartialRequest( + set: json['set'] as Map?, + skipEnrichUrl: json['skip_enrich_url'] as bool?, + skipPush: json['skip_push'] as bool?, + unset: (json['unset'] as List?)?.map((e) => e as String).toList(), +); + +Map _$UpdateMessagePartialRequestToJson( + UpdateMessagePartialRequest instance, +) => { + 'set': instance.set, + 'skip_enrich_url': instance.skipEnrichUrl, + 'skip_push': instance.skipPush, + 'unset': instance.unset, +}; diff --git a/packages/stream_chat/lib/open_api/model/update_message_partial_response.dart b/packages/stream_chat/lib/open_api/model/update_message_partial_response.dart new file mode 100644 index 0000000000..45d5741eb1 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_message_partial_response.dart @@ -0,0 +1,37 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'update_message_partial_response.g.dart'; +part 'update_message_partial_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UpdateMessagePartialResponse with _$UpdateMessagePartialResponse { + const UpdateMessagePartialResponse({ + required this.duration, + this.message, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'message') + final MessageResponse? message; + + Map toJson() => _$UpdateMessagePartialResponseToJson(this); + + static UpdateMessagePartialResponse fromJson(Map json) => + _$UpdateMessagePartialResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/update_message_partial_response.freezed.dart b/packages/stream_chat/lib/open_api/model/update_message_partial_response.freezed.dart new file mode 100644 index 0000000000..b42fe622af --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_message_partial_response.freezed.dart @@ -0,0 +1,82 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'update_message_partial_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpdateMessagePartialResponse { + String get duration; + MessageResponse? get message; + + /// Create a copy of UpdateMessagePartialResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpdateMessagePartialResponseCopyWith get copyWith => + _$UpdateMessagePartialResponseCopyWithImpl( + this as UpdateMessagePartialResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpdateMessagePartialResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.message, message) || other.message == message)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration, message); + + @override + String toString() { + return 'UpdateMessagePartialResponse(duration: $duration, message: $message)'; + } +} + +/// @nodoc +abstract mixin class $UpdateMessagePartialResponseCopyWith<$Res> { + factory $UpdateMessagePartialResponseCopyWith( + UpdateMessagePartialResponse value, + $Res Function(UpdateMessagePartialResponse) _then, + ) = _$UpdateMessagePartialResponseCopyWithImpl; + @useResult + $Res call({String duration, MessageResponse? message}); +} + +/// @nodoc +class _$UpdateMessagePartialResponseCopyWithImpl<$Res> implements $UpdateMessagePartialResponseCopyWith<$Res> { + _$UpdateMessagePartialResponseCopyWithImpl(this._self, this._then); + + final UpdateMessagePartialResponse _self; + final $Res Function(UpdateMessagePartialResponse) _then; + + /// Create a copy of UpdateMessagePartialResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? message = freezed}) { + return _then( + UpdateMessagePartialResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + message: freezed == message + ? _self.message + : message // ignore: cast_nullable_to_non_nullable + as MessageResponse?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/update_message_partial_response.g.dart b/packages/stream_chat/lib/open_api/model/update_message_partial_response.g.dart new file mode 100644 index 0000000000..7a4a5555f7 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_message_partial_response.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'update_message_partial_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UpdateMessagePartialResponse _$UpdateMessagePartialResponseFromJson( + Map json, +) => UpdateMessagePartialResponse( + duration: json['duration'] as String, + message: json['message'] == null ? null : MessageResponse.fromJson(json['message'] as Map), +); + +Map _$UpdateMessagePartialResponseToJson( + UpdateMessagePartialResponse instance, +) => { + 'duration': instance.duration, + 'message': instance.message?.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/update_message_request.dart b/packages/stream_chat/lib/open_api/model/update_message_request.dart new file mode 100644 index 0000000000..77a3333512 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_message_request.dart @@ -0,0 +1,41 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'update_message_request.g.dart'; +part 'update_message_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UpdateMessageRequest with _$UpdateMessageRequest { + const UpdateMessageRequest({ + required this.message, + this.skipEnrichUrl, + this.skipPush, + }); + + @override + @JsonKey(name: 'message') + final MessageRequest message; + + @override + @JsonKey(name: 'skip_enrich_url') + final bool? skipEnrichUrl; + + @override + @JsonKey(name: 'skip_push') + final bool? skipPush; + + Map toJson() => _$UpdateMessageRequestToJson(this); + + static UpdateMessageRequest fromJson(Map json) => _$UpdateMessageRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/update_message_request.freezed.dart b/packages/stream_chat/lib/open_api/model/update_message_request.freezed.dart new file mode 100644 index 0000000000..3d19774d52 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_message_request.freezed.dart @@ -0,0 +1,92 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'update_message_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpdateMessageRequest { + MessageRequest get message; + bool? get skipEnrichUrl; + bool? get skipPush; + + /// Create a copy of UpdateMessageRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpdateMessageRequestCopyWith get copyWith => + _$UpdateMessageRequestCopyWithImpl( + this as UpdateMessageRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpdateMessageRequest && + (identical(other.message, message) || other.message == message) && + (identical(other.skipEnrichUrl, skipEnrichUrl) || other.skipEnrichUrl == skipEnrichUrl) && + (identical(other.skipPush, skipPush) || other.skipPush == skipPush)); + } + + @override + int get hashCode => Object.hash(runtimeType, message, skipEnrichUrl, skipPush); + + @override + String toString() { + return 'UpdateMessageRequest(message: $message, skipEnrichUrl: $skipEnrichUrl, skipPush: $skipPush)'; + } +} + +/// @nodoc +abstract mixin class $UpdateMessageRequestCopyWith<$Res> { + factory $UpdateMessageRequestCopyWith( + UpdateMessageRequest value, + $Res Function(UpdateMessageRequest) _then, + ) = _$UpdateMessageRequestCopyWithImpl; + @useResult + $Res call({MessageRequest message, bool? skipEnrichUrl, bool? skipPush}); +} + +/// @nodoc +class _$UpdateMessageRequestCopyWithImpl<$Res> implements $UpdateMessageRequestCopyWith<$Res> { + _$UpdateMessageRequestCopyWithImpl(this._self, this._then); + + final UpdateMessageRequest _self; + final $Res Function(UpdateMessageRequest) _then; + + /// Create a copy of UpdateMessageRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? message = null, + Object? skipEnrichUrl = freezed, + Object? skipPush = freezed, + }) { + return _then( + UpdateMessageRequest( + message: null == message + ? _self.message + : message // ignore: cast_nullable_to_non_nullable + as MessageRequest, + skipEnrichUrl: freezed == skipEnrichUrl + ? _self.skipEnrichUrl + : skipEnrichUrl // ignore: cast_nullable_to_non_nullable + as bool?, + skipPush: freezed == skipPush + ? _self.skipPush + : skipPush // ignore: cast_nullable_to_non_nullable + as bool?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/update_message_request.g.dart b/packages/stream_chat/lib/open_api/model/update_message_request.g.dart new file mode 100644 index 0000000000..eb41b4e90a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_message_request.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'update_message_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UpdateMessageRequest _$UpdateMessageRequestFromJson( + Map json, +) => UpdateMessageRequest( + message: MessageRequest.fromJson(json['message'] as Map), + skipEnrichUrl: json['skip_enrich_url'] as bool?, + skipPush: json['skip_push'] as bool?, +); + +Map _$UpdateMessageRequestToJson( + UpdateMessageRequest instance, +) => { + 'message': instance.message.toJson(), + 'skip_enrich_url': instance.skipEnrichUrl, + 'skip_push': instance.skipPush, +}; diff --git a/packages/stream_chat/lib/open_api/model/update_message_response.dart b/packages/stream_chat/lib/open_api/model/update_message_response.dart new file mode 100644 index 0000000000..2e2f296571 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_message_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'update_message_response.g.dart'; +part 'update_message_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UpdateMessageResponse with _$UpdateMessageResponse { + const UpdateMessageResponse({ + required this.duration, + required this.message, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'message') + final MessageResponse message; + + Map toJson() => _$UpdateMessageResponseToJson(this); + + static UpdateMessageResponse fromJson(Map json) => _$UpdateMessageResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/update_message_response.freezed.dart b/packages/stream_chat/lib/open_api/model/update_message_response.freezed.dart new file mode 100644 index 0000000000..e0191e4d59 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_message_response.freezed.dart @@ -0,0 +1,82 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'update_message_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpdateMessageResponse { + String get duration; + MessageResponse get message; + + /// Create a copy of UpdateMessageResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpdateMessageResponseCopyWith get copyWith => + _$UpdateMessageResponseCopyWithImpl( + this as UpdateMessageResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpdateMessageResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.message, message) || other.message == message)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration, message); + + @override + String toString() { + return 'UpdateMessageResponse(duration: $duration, message: $message)'; + } +} + +/// @nodoc +abstract mixin class $UpdateMessageResponseCopyWith<$Res> { + factory $UpdateMessageResponseCopyWith( + UpdateMessageResponse value, + $Res Function(UpdateMessageResponse) _then, + ) = _$UpdateMessageResponseCopyWithImpl; + @useResult + $Res call({String duration, MessageResponse message}); +} + +/// @nodoc +class _$UpdateMessageResponseCopyWithImpl<$Res> implements $UpdateMessageResponseCopyWith<$Res> { + _$UpdateMessageResponseCopyWithImpl(this._self, this._then); + + final UpdateMessageResponse _self; + final $Res Function(UpdateMessageResponse) _then; + + /// Create a copy of UpdateMessageResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? message = null}) { + return _then( + UpdateMessageResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + message: null == message + ? _self.message + : message // ignore: cast_nullable_to_non_nullable + as MessageResponse, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/update_message_response.g.dart b/packages/stream_chat/lib/open_api/model/update_message_response.g.dart new file mode 100644 index 0000000000..54277077cc --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_message_response.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'update_message_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UpdateMessageResponse _$UpdateMessageResponseFromJson( + Map json, +) => UpdateMessageResponse( + duration: json['duration'] as String, + message: MessageResponse.fromJson(json['message'] as Map), +); + +Map _$UpdateMessageResponseToJson( + UpdateMessageResponse instance, +) => { + 'duration': instance.duration, + 'message': instance.message.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/update_poll_option_request.dart b/packages/stream_chat/lib/open_api/model/update_poll_option_request.dart new file mode 100644 index 0000000000..348300d7fe --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_poll_option_request.dart @@ -0,0 +1,41 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'update_poll_option_request.g.dart'; +part 'update_poll_option_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UpdatePollOptionRequest with _$UpdatePollOptionRequest { + const UpdatePollOptionRequest({ + this.custom, + required this.id, + required this.text, + }); + + @override + @JsonKey(name: 'custom') + final Map? custom; + + @override + @JsonKey(name: 'id') + final String id; + + @override + @JsonKey(name: 'text') + final String text; + + Map toJson() => _$UpdatePollOptionRequestToJson(this); + + static UpdatePollOptionRequest fromJson(Map json) => _$UpdatePollOptionRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/update_poll_option_request.freezed.dart b/packages/stream_chat/lib/open_api/model/update_poll_option_request.freezed.dart new file mode 100644 index 0000000000..81740e19dc --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_poll_option_request.freezed.dart @@ -0,0 +1,97 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'update_poll_option_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpdatePollOptionRequest { + Map? get custom; + String get id; + String get text; + + /// Create a copy of UpdatePollOptionRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpdatePollOptionRequestCopyWith get copyWith => + _$UpdatePollOptionRequestCopyWithImpl( + this as UpdatePollOptionRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpdatePollOptionRequest && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.id, id) || other.id == id) && + (identical(other.text, text) || other.text == text)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(custom), + id, + text, + ); + + @override + String toString() { + return 'UpdatePollOptionRequest(custom: $custom, id: $id, text: $text)'; + } +} + +/// @nodoc +abstract mixin class $UpdatePollOptionRequestCopyWith<$Res> { + factory $UpdatePollOptionRequestCopyWith( + UpdatePollOptionRequest value, + $Res Function(UpdatePollOptionRequest) _then, + ) = _$UpdatePollOptionRequestCopyWithImpl; + @useResult + $Res call({Map? custom, String id, String text}); +} + +/// @nodoc +class _$UpdatePollOptionRequestCopyWithImpl<$Res> implements $UpdatePollOptionRequestCopyWith<$Res> { + _$UpdatePollOptionRequestCopyWithImpl(this._self, this._then); + + final UpdatePollOptionRequest _self; + final $Res Function(UpdatePollOptionRequest) _then; + + /// Create a copy of UpdatePollOptionRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? custom = freezed, + Object? id = null, + Object? text = null, + }) { + return _then( + UpdatePollOptionRequest( + custom: freezed == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map?, + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + text: null == text + ? _self.text + : text // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/update_poll_option_request.g.dart b/packages/stream_chat/lib/open_api/model/update_poll_option_request.g.dart new file mode 100644 index 0000000000..57cd5380bf --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_poll_option_request.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'update_poll_option_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UpdatePollOptionRequest _$UpdatePollOptionRequestFromJson( + Map json, +) => UpdatePollOptionRequest( + custom: json['custom'] as Map?, + id: json['id'] as String, + text: json['text'] as String, +); + +Map _$UpdatePollOptionRequestToJson( + UpdatePollOptionRequest instance, +) => { + 'custom': instance.custom, + 'id': instance.id, + 'text': instance.text, +}; diff --git a/packages/stream_chat/lib/open_api/model/update_poll_partial_request.dart b/packages/stream_chat/lib/open_api/model/update_poll_partial_request.dart new file mode 100644 index 0000000000..0072c941c1 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_poll_partial_request.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'update_poll_partial_request.g.dart'; +part 'update_poll_partial_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UpdatePollPartialRequest with _$UpdatePollPartialRequest { + const UpdatePollPartialRequest({ + this.set, + this.unset, + }); + + @override + @JsonKey(name: 'set') + final Map? set; + + @override + @JsonKey(name: 'unset') + final List? unset; + + Map toJson() => _$UpdatePollPartialRequestToJson(this); + + static UpdatePollPartialRequest fromJson(Map json) => _$UpdatePollPartialRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/update_poll_partial_request.freezed.dart b/packages/stream_chat/lib/open_api/model/update_poll_partial_request.freezed.dart new file mode 100644 index 0000000000..e6ffea324e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_poll_partial_request.freezed.dart @@ -0,0 +1,86 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'update_poll_partial_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpdatePollPartialRequest { + Map? get set; + List? get unset; + + /// Create a copy of UpdatePollPartialRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpdatePollPartialRequestCopyWith get copyWith => + _$UpdatePollPartialRequestCopyWithImpl( + this as UpdatePollPartialRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpdatePollPartialRequest && + const DeepCollectionEquality().equals(other.set, set) && + const DeepCollectionEquality().equals(other.unset, unset)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(set), + const DeepCollectionEquality().hash(unset), + ); + + @override + String toString() { + return 'UpdatePollPartialRequest(set: $set, unset: $unset)'; + } +} + +/// @nodoc +abstract mixin class $UpdatePollPartialRequestCopyWith<$Res> { + factory $UpdatePollPartialRequestCopyWith( + UpdatePollPartialRequest value, + $Res Function(UpdatePollPartialRequest) _then, + ) = _$UpdatePollPartialRequestCopyWithImpl; + @useResult + $Res call({Map? set, List? unset}); +} + +/// @nodoc +class _$UpdatePollPartialRequestCopyWithImpl<$Res> implements $UpdatePollPartialRequestCopyWith<$Res> { + _$UpdatePollPartialRequestCopyWithImpl(this._self, this._then); + + final UpdatePollPartialRequest _self; + final $Res Function(UpdatePollPartialRequest) _then; + + /// Create a copy of UpdatePollPartialRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? set = freezed, Object? unset = freezed}) { + return _then( + UpdatePollPartialRequest( + set: freezed == set + ? _self.set + : set // ignore: cast_nullable_to_non_nullable + as Map?, + unset: freezed == unset + ? _self.unset + : unset // ignore: cast_nullable_to_non_nullable + as List?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/update_poll_partial_request.g.dart b/packages/stream_chat/lib/open_api/model/update_poll_partial_request.g.dart new file mode 100644 index 0000000000..cba62e04cc --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_poll_partial_request.g.dart @@ -0,0 +1,18 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'update_poll_partial_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UpdatePollPartialRequest _$UpdatePollPartialRequestFromJson( + Map json, +) => UpdatePollPartialRequest( + set: json['set'] as Map?, + unset: (json['unset'] as List?)?.map((e) => e as String).toList(), +); + +Map _$UpdatePollPartialRequestToJson( + UpdatePollPartialRequest instance, +) => {'set': instance.set, 'unset': instance.unset}; diff --git a/packages/stream_chat/lib/open_api/model/update_poll_request.dart b/packages/stream_chat/lib/open_api/model/update_poll_request.dart new file mode 100644 index 0000000000..bf9964d3cc --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_poll_request.dart @@ -0,0 +1,90 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'update_poll_request.g.dart'; +part 'update_poll_request.freezed.dart'; + +extension type const UpdatePollRequestVotingVisibility._(String _) implements String { + static const anonymous = UpdatePollRequestVotingVisibility._('anonymous'); + static const public = UpdatePollRequestVotingVisibility._('public'); + + factory UpdatePollRequestVotingVisibility.fromJson(String json) => UpdatePollRequestVotingVisibility._(json); + + String toJson() => this; +} + +@freezed +@immutable +@JsonSerializable() +class UpdatePollRequest with _$UpdatePollRequest { + const UpdatePollRequest({ + this.allowAnswers, + this.allowUserSuggestedOptions, + this.custom, + this.description, + this.enforceUniqueVote, + required this.id, + this.isClosed, + this.maxVotesAllowed, + required this.name, + this.options, + this.votingVisibility, + }); + + @override + @JsonKey(name: 'allow_answers') + final bool? allowAnswers; + + @override + @JsonKey(name: 'allow_user_suggested_options') + final bool? allowUserSuggestedOptions; + + @override + @JsonKey(name: 'custom') + final Map? custom; + + @override + @JsonKey(name: 'description') + final String? description; + + @override + @JsonKey(name: 'enforce_unique_vote') + final bool? enforceUniqueVote; + + @override + @JsonKey(name: 'id') + final String id; + + @override + @JsonKey(name: 'is_closed') + final bool? isClosed; + + @override + @JsonKey(name: 'max_votes_allowed') + final int? maxVotesAllowed; + + @override + @JsonKey(name: 'name') + final String name; + + @override + @JsonKey(name: 'options') + final List? options; + + @override + @JsonKey(name: 'voting_visibility') + final UpdatePollRequestVotingVisibility? votingVisibility; + + Map toJson() => _$UpdatePollRequestToJson(this); + + static UpdatePollRequest fromJson(Map json) => _$UpdatePollRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/update_poll_request.freezed.dart b/packages/stream_chat/lib/open_api/model/update_poll_request.freezed.dart new file mode 100644 index 0000000000..70f982f176 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_poll_request.freezed.dart @@ -0,0 +1,176 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'update_poll_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpdatePollRequest { + bool? get allowAnswers; + bool? get allowUserSuggestedOptions; + Map? get custom; + String? get description; + bool? get enforceUniqueVote; + String get id; + bool? get isClosed; + int? get maxVotesAllowed; + String get name; + List? get options; + UpdatePollRequestVotingVisibility? get votingVisibility; + + /// Create a copy of UpdatePollRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpdatePollRequestCopyWith get copyWith => _$UpdatePollRequestCopyWithImpl( + this as UpdatePollRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpdatePollRequest && + (identical(other.allowAnswers, allowAnswers) || other.allowAnswers == allowAnswers) && + (identical( + other.allowUserSuggestedOptions, + allowUserSuggestedOptions, + ) || + other.allowUserSuggestedOptions == allowUserSuggestedOptions) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.description, description) || other.description == description) && + (identical(other.enforceUniqueVote, enforceUniqueVote) || other.enforceUniqueVote == enforceUniqueVote) && + (identical(other.id, id) || other.id == id) && + (identical(other.isClosed, isClosed) || other.isClosed == isClosed) && + (identical(other.maxVotesAllowed, maxVotesAllowed) || other.maxVotesAllowed == maxVotesAllowed) && + (identical(other.name, name) || other.name == name) && + const DeepCollectionEquality().equals(other.options, options) && + (identical(other.votingVisibility, votingVisibility) || other.votingVisibility == votingVisibility)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + allowAnswers, + allowUserSuggestedOptions, + const DeepCollectionEquality().hash(custom), + description, + enforceUniqueVote, + id, + isClosed, + maxVotesAllowed, + name, + const DeepCollectionEquality().hash(options), + votingVisibility, + ); + + @override + String toString() { + return 'UpdatePollRequest(allowAnswers: $allowAnswers, allowUserSuggestedOptions: $allowUserSuggestedOptions, custom: $custom, description: $description, enforceUniqueVote: $enforceUniqueVote, id: $id, isClosed: $isClosed, maxVotesAllowed: $maxVotesAllowed, name: $name, options: $options, votingVisibility: $votingVisibility)'; + } +} + +/// @nodoc +abstract mixin class $UpdatePollRequestCopyWith<$Res> { + factory $UpdatePollRequestCopyWith( + UpdatePollRequest value, + $Res Function(UpdatePollRequest) _then, + ) = _$UpdatePollRequestCopyWithImpl; + @useResult + $Res call({ + bool? allowAnswers, + bool? allowUserSuggestedOptions, + Map? custom, + String? description, + bool? enforceUniqueVote, + String id, + bool? isClosed, + int? maxVotesAllowed, + String name, + List? options, + UpdatePollRequestVotingVisibility? votingVisibility, + }); +} + +/// @nodoc +class _$UpdatePollRequestCopyWithImpl<$Res> implements $UpdatePollRequestCopyWith<$Res> { + _$UpdatePollRequestCopyWithImpl(this._self, this._then); + + final UpdatePollRequest _self; + final $Res Function(UpdatePollRequest) _then; + + /// Create a copy of UpdatePollRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? allowAnswers = freezed, + Object? allowUserSuggestedOptions = freezed, + Object? custom = freezed, + Object? description = freezed, + Object? enforceUniqueVote = freezed, + Object? id = null, + Object? isClosed = freezed, + Object? maxVotesAllowed = freezed, + Object? name = null, + Object? options = freezed, + Object? votingVisibility = freezed, + }) { + return _then( + UpdatePollRequest( + allowAnswers: freezed == allowAnswers + ? _self.allowAnswers + : allowAnswers // ignore: cast_nullable_to_non_nullable + as bool?, + allowUserSuggestedOptions: freezed == allowUserSuggestedOptions + ? _self.allowUserSuggestedOptions + : allowUserSuggestedOptions // ignore: cast_nullable_to_non_nullable + as bool?, + custom: freezed == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map?, + description: freezed == description + ? _self.description + : description // ignore: cast_nullable_to_non_nullable + as String?, + enforceUniqueVote: freezed == enforceUniqueVote + ? _self.enforceUniqueVote + : enforceUniqueVote // ignore: cast_nullable_to_non_nullable + as bool?, + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + isClosed: freezed == isClosed + ? _self.isClosed + : isClosed // ignore: cast_nullable_to_non_nullable + as bool?, + maxVotesAllowed: freezed == maxVotesAllowed + ? _self.maxVotesAllowed + : maxVotesAllowed // ignore: cast_nullable_to_non_nullable + as int?, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + options: freezed == options + ? _self.options + : options // ignore: cast_nullable_to_non_nullable + as List?, + votingVisibility: freezed == votingVisibility + ? _self.votingVisibility + : votingVisibility // ignore: cast_nullable_to_non_nullable + as UpdatePollRequestVotingVisibility?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/update_poll_request.g.dart b/packages/stream_chat/lib/open_api/model/update_poll_request.g.dart new file mode 100644 index 0000000000..457e0103aa --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_poll_request.g.dart @@ -0,0 +1,41 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'update_poll_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UpdatePollRequest _$UpdatePollRequestFromJson(Map json) => UpdatePollRequest( + allowAnswers: json['allow_answers'] as bool?, + allowUserSuggestedOptions: json['allow_user_suggested_options'] as bool?, + custom: json['custom'] as Map?, + description: json['description'] as String?, + enforceUniqueVote: json['enforce_unique_vote'] as bool?, + id: json['id'] as String, + isClosed: json['is_closed'] as bool?, + maxVotesAllowed: (json['max_votes_allowed'] as num?)?.toInt(), + name: json['name'] as String, + options: (json['options'] as List?) + ?.map((e) => PollOptionRequest.fromJson(e as Map)) + .toList(), + votingVisibility: json['voting_visibility'] == null + ? null + : UpdatePollRequestVotingVisibility.fromJson( + json['voting_visibility'] as String, + ), +); + +Map _$UpdatePollRequestToJson(UpdatePollRequest instance) => { + 'allow_answers': instance.allowAnswers, + 'allow_user_suggested_options': instance.allowUserSuggestedOptions, + 'custom': instance.custom, + 'description': instance.description, + 'enforce_unique_vote': instance.enforceUniqueVote, + 'id': instance.id, + 'is_closed': instance.isClosed, + 'max_votes_allowed': instance.maxVotesAllowed, + 'name': instance.name, + 'options': instance.options?.map((e) => e.toJson()).toList(), + 'voting_visibility': instance.votingVisibility?.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/update_queue_request.dart b/packages/stream_chat/lib/open_api/model/update_queue_request.dart new file mode 100644 index 0000000000..7ba9bc55ab --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_queue_request.dart @@ -0,0 +1,46 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'update_queue_request.g.dart'; +part 'update_queue_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UpdateQueueRequest with _$UpdateQueueRequest { + const UpdateQueueRequest({ + this.description, + this.filters, + this.name, + this.sort, + }); + + @override + @JsonKey(name: 'description') + final String? description; + + @override + @JsonKey(name: 'filters') + final Map? filters; + + @override + @JsonKey(name: 'name') + final String? name; + + @override + @JsonKey(name: 'sort') + final List>? sort; + + Map toJson() => _$UpdateQueueRequestToJson(this); + + static UpdateQueueRequest fromJson(Map json) => _$UpdateQueueRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/update_queue_request.freezed.dart b/packages/stream_chat/lib/open_api/model/update_queue_request.freezed.dart new file mode 100644 index 0000000000..6f3c1d3284 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_queue_request.freezed.dart @@ -0,0 +1,109 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'update_queue_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpdateQueueRequest { + String? get description; + Map? get filters; + String? get name; + List>? get sort; + + /// Create a copy of UpdateQueueRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpdateQueueRequestCopyWith get copyWith => _$UpdateQueueRequestCopyWithImpl( + this as UpdateQueueRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpdateQueueRequest && + (identical(other.description, description) || other.description == description) && + const DeepCollectionEquality().equals(other.filters, filters) && + (identical(other.name, name) || other.name == name) && + const DeepCollectionEquality().equals(other.sort, sort)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + description, + const DeepCollectionEquality().hash(filters), + name, + const DeepCollectionEquality().hash(sort), + ); + + @override + String toString() { + return 'UpdateQueueRequest(description: $description, filters: $filters, name: $name, sort: $sort)'; + } +} + +/// @nodoc +abstract mixin class $UpdateQueueRequestCopyWith<$Res> { + factory $UpdateQueueRequestCopyWith( + UpdateQueueRequest value, + $Res Function(UpdateQueueRequest) _then, + ) = _$UpdateQueueRequestCopyWithImpl; + @useResult + $Res call({ + String? description, + Map? filters, + String? name, + List>? sort, + }); +} + +/// @nodoc +class _$UpdateQueueRequestCopyWithImpl<$Res> implements $UpdateQueueRequestCopyWith<$Res> { + _$UpdateQueueRequestCopyWithImpl(this._self, this._then); + + final UpdateQueueRequest _self; + final $Res Function(UpdateQueueRequest) _then; + + /// Create a copy of UpdateQueueRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? description = freezed, + Object? filters = freezed, + Object? name = freezed, + Object? sort = freezed, + }) { + return _then( + UpdateQueueRequest( + description: freezed == description + ? _self.description + : description // ignore: cast_nullable_to_non_nullable + as String?, + filters: freezed == filters + ? _self.filters + : filters // ignore: cast_nullable_to_non_nullable + as Map?, + name: freezed == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + sort: freezed == sort + ? _self.sort + : sort // ignore: cast_nullable_to_non_nullable + as List>?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/update_queue_request.g.dart b/packages/stream_chat/lib/open_api/model/update_queue_request.g.dart new file mode 100644 index 0000000000..b1bd821af3 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_queue_request.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'update_queue_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UpdateQueueRequest _$UpdateQueueRequestFromJson(Map json) => UpdateQueueRequest( + description: json['description'] as String?, + filters: json['filters'] as Map?, + name: json['name'] as String?, + sort: (json['sort'] as List?)?.map((e) => e as Map).toList(), +); + +Map _$UpdateQueueRequestToJson(UpdateQueueRequest instance) => { + 'description': instance.description, + 'filters': instance.filters, + 'name': instance.name, + 'sort': instance.sort, +}; diff --git a/packages/stream_chat/lib/open_api/model/update_reminder_request.dart b/packages/stream_chat/lib/open_api/model/update_reminder_request.dart new file mode 100644 index 0000000000..f362b16928 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_reminder_request.dart @@ -0,0 +1,32 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'update_reminder_request.g.dart'; +part 'update_reminder_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UpdateReminderRequest with _$UpdateReminderRequest { + const UpdateReminderRequest({ + this.remindAt, + }); + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'remind_at') + final DateTime? remindAt; + + Map toJson() => _$UpdateReminderRequestToJson(this); + + static UpdateReminderRequest fromJson(Map json) => _$UpdateReminderRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/update_reminder_request.freezed.dart b/packages/stream_chat/lib/open_api/model/update_reminder_request.freezed.dart new file mode 100644 index 0000000000..9cf38c02ef --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_reminder_request.freezed.dart @@ -0,0 +1,76 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'update_reminder_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpdateReminderRequest { + DateTime? get remindAt; + + /// Create a copy of UpdateReminderRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpdateReminderRequestCopyWith get copyWith => + _$UpdateReminderRequestCopyWithImpl( + this as UpdateReminderRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpdateReminderRequest && + (identical(other.remindAt, remindAt) || other.remindAt == remindAt)); + } + + @override + int get hashCode => Object.hash(runtimeType, remindAt); + + @override + String toString() { + return 'UpdateReminderRequest(remindAt: $remindAt)'; + } +} + +/// @nodoc +abstract mixin class $UpdateReminderRequestCopyWith<$Res> { + factory $UpdateReminderRequestCopyWith( + UpdateReminderRequest value, + $Res Function(UpdateReminderRequest) _then, + ) = _$UpdateReminderRequestCopyWithImpl; + @useResult + $Res call({DateTime? remindAt}); +} + +/// @nodoc +class _$UpdateReminderRequestCopyWithImpl<$Res> implements $UpdateReminderRequestCopyWith<$Res> { + _$UpdateReminderRequestCopyWithImpl(this._self, this._then); + + final UpdateReminderRequest _self; + final $Res Function(UpdateReminderRequest) _then; + + /// Create a copy of UpdateReminderRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? remindAt = freezed}) { + return _then( + UpdateReminderRequest( + remindAt: freezed == remindAt + ? _self.remindAt + : remindAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/update_reminder_request.g.dart b/packages/stream_chat/lib/open_api/model/update_reminder_request.g.dart new file mode 100644 index 0000000000..ed16046677 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_reminder_request.g.dart @@ -0,0 +1,35 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'update_reminder_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UpdateReminderRequest _$UpdateReminderRequestFromJson( + Map json, +) => UpdateReminderRequest( + remindAt: _$JsonConverterFromJson( + json['remind_at'], + const StreamDateTimeConverter().fromJson, + ), +); + +Map _$UpdateReminderRequestToJson( + UpdateReminderRequest instance, +) => { + 'remind_at': _$JsonConverterToJson( + instance.remindAt, + const StreamDateTimeConverter().toJson, + ), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/update_reminder_response.dart b/packages/stream_chat/lib/open_api/model/update_reminder_response.dart new file mode 100644 index 0000000000..8eb129d40d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_reminder_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'update_reminder_response.g.dart'; +part 'update_reminder_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UpdateReminderResponse with _$UpdateReminderResponse { + const UpdateReminderResponse({ + required this.duration, + required this.reminder, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'reminder') + final ReminderResponseData reminder; + + Map toJson() => _$UpdateReminderResponseToJson(this); + + static UpdateReminderResponse fromJson(Map json) => _$UpdateReminderResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/update_reminder_response.freezed.dart b/packages/stream_chat/lib/open_api/model/update_reminder_response.freezed.dart new file mode 100644 index 0000000000..4494f57182 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_reminder_response.freezed.dart @@ -0,0 +1,82 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'update_reminder_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpdateReminderResponse { + String get duration; + ReminderResponseData get reminder; + + /// Create a copy of UpdateReminderResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpdateReminderResponseCopyWith get copyWith => + _$UpdateReminderResponseCopyWithImpl( + this as UpdateReminderResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpdateReminderResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.reminder, reminder) || other.reminder == reminder)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration, reminder); + + @override + String toString() { + return 'UpdateReminderResponse(duration: $duration, reminder: $reminder)'; + } +} + +/// @nodoc +abstract mixin class $UpdateReminderResponseCopyWith<$Res> { + factory $UpdateReminderResponseCopyWith( + UpdateReminderResponse value, + $Res Function(UpdateReminderResponse) _then, + ) = _$UpdateReminderResponseCopyWithImpl; + @useResult + $Res call({String duration, ReminderResponseData reminder}); +} + +/// @nodoc +class _$UpdateReminderResponseCopyWithImpl<$Res> implements $UpdateReminderResponseCopyWith<$Res> { + _$UpdateReminderResponseCopyWithImpl(this._self, this._then); + + final UpdateReminderResponse _self; + final $Res Function(UpdateReminderResponse) _then; + + /// Create a copy of UpdateReminderResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? reminder = null}) { + return _then( + UpdateReminderResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + reminder: null == reminder + ? _self.reminder + : reminder // ignore: cast_nullable_to_non_nullable + as ReminderResponseData, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/update_reminder_response.g.dart b/packages/stream_chat/lib/open_api/model/update_reminder_response.g.dart new file mode 100644 index 0000000000..86df1ce290 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_reminder_response.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'update_reminder_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UpdateReminderResponse _$UpdateReminderResponseFromJson( + Map json, +) => UpdateReminderResponse( + duration: json['duration'] as String, + reminder: ReminderResponseData.fromJson( + json['reminder'] as Map, + ), +); + +Map _$UpdateReminderResponseToJson( + UpdateReminderResponse instance, +) => { + 'duration': instance.duration, + 'reminder': instance.reminder.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/update_thread_partial_request.dart b/packages/stream_chat/lib/open_api/model/update_thread_partial_request.dart new file mode 100644 index 0000000000..03c3a3a059 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_thread_partial_request.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'update_thread_partial_request.g.dart'; +part 'update_thread_partial_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UpdateThreadPartialRequest with _$UpdateThreadPartialRequest { + const UpdateThreadPartialRequest({ + this.set, + this.unset, + }); + + @override + @JsonKey(name: 'set') + final Map? set; + + @override + @JsonKey(name: 'unset') + final List? unset; + + Map toJson() => _$UpdateThreadPartialRequestToJson(this); + + static UpdateThreadPartialRequest fromJson(Map json) => _$UpdateThreadPartialRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/update_thread_partial_request.freezed.dart b/packages/stream_chat/lib/open_api/model/update_thread_partial_request.freezed.dart new file mode 100644 index 0000000000..be814b19f5 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_thread_partial_request.freezed.dart @@ -0,0 +1,86 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'update_thread_partial_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpdateThreadPartialRequest { + Map? get set; + List? get unset; + + /// Create a copy of UpdateThreadPartialRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpdateThreadPartialRequestCopyWith get copyWith => + _$UpdateThreadPartialRequestCopyWithImpl( + this as UpdateThreadPartialRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpdateThreadPartialRequest && + const DeepCollectionEquality().equals(other.set, set) && + const DeepCollectionEquality().equals(other.unset, unset)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(set), + const DeepCollectionEquality().hash(unset), + ); + + @override + String toString() { + return 'UpdateThreadPartialRequest(set: $set, unset: $unset)'; + } +} + +/// @nodoc +abstract mixin class $UpdateThreadPartialRequestCopyWith<$Res> { + factory $UpdateThreadPartialRequestCopyWith( + UpdateThreadPartialRequest value, + $Res Function(UpdateThreadPartialRequest) _then, + ) = _$UpdateThreadPartialRequestCopyWithImpl; + @useResult + $Res call({Map? set, List? unset}); +} + +/// @nodoc +class _$UpdateThreadPartialRequestCopyWithImpl<$Res> implements $UpdateThreadPartialRequestCopyWith<$Res> { + _$UpdateThreadPartialRequestCopyWithImpl(this._self, this._then); + + final UpdateThreadPartialRequest _self; + final $Res Function(UpdateThreadPartialRequest) _then; + + /// Create a copy of UpdateThreadPartialRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? set = freezed, Object? unset = freezed}) { + return _then( + UpdateThreadPartialRequest( + set: freezed == set + ? _self.set + : set // ignore: cast_nullable_to_non_nullable + as Map?, + unset: freezed == unset + ? _self.unset + : unset // ignore: cast_nullable_to_non_nullable + as List?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/update_thread_partial_request.g.dart b/packages/stream_chat/lib/open_api/model/update_thread_partial_request.g.dart new file mode 100644 index 0000000000..dd08c7c7c7 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_thread_partial_request.g.dart @@ -0,0 +1,18 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'update_thread_partial_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UpdateThreadPartialRequest _$UpdateThreadPartialRequestFromJson( + Map json, +) => UpdateThreadPartialRequest( + set: json['set'] as Map?, + unset: (json['unset'] as List?)?.map((e) => e as String).toList(), +); + +Map _$UpdateThreadPartialRequestToJson( + UpdateThreadPartialRequest instance, +) => {'set': instance.set, 'unset': instance.unset}; diff --git a/packages/stream_chat/lib/open_api/model/update_thread_partial_response.dart b/packages/stream_chat/lib/open_api/model/update_thread_partial_response.dart new file mode 100644 index 0000000000..bc346b7bce --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_thread_partial_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'update_thread_partial_response.g.dart'; +part 'update_thread_partial_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UpdateThreadPartialResponse with _$UpdateThreadPartialResponse { + const UpdateThreadPartialResponse({ + required this.duration, + required this.thread, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'thread') + final ThreadResponse thread; + + Map toJson() => _$UpdateThreadPartialResponseToJson(this); + + static UpdateThreadPartialResponse fromJson(Map json) => _$UpdateThreadPartialResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/update_thread_partial_response.freezed.dart b/packages/stream_chat/lib/open_api/model/update_thread_partial_response.freezed.dart new file mode 100644 index 0000000000..a6bee0f0ce --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_thread_partial_response.freezed.dart @@ -0,0 +1,82 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'update_thread_partial_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpdateThreadPartialResponse { + String get duration; + ThreadResponse get thread; + + /// Create a copy of UpdateThreadPartialResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpdateThreadPartialResponseCopyWith get copyWith => + _$UpdateThreadPartialResponseCopyWithImpl( + this as UpdateThreadPartialResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpdateThreadPartialResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.thread, thread) || other.thread == thread)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration, thread); + + @override + String toString() { + return 'UpdateThreadPartialResponse(duration: $duration, thread: $thread)'; + } +} + +/// @nodoc +abstract mixin class $UpdateThreadPartialResponseCopyWith<$Res> { + factory $UpdateThreadPartialResponseCopyWith( + UpdateThreadPartialResponse value, + $Res Function(UpdateThreadPartialResponse) _then, + ) = _$UpdateThreadPartialResponseCopyWithImpl; + @useResult + $Res call({String duration, ThreadResponse thread}); +} + +/// @nodoc +class _$UpdateThreadPartialResponseCopyWithImpl<$Res> implements $UpdateThreadPartialResponseCopyWith<$Res> { + _$UpdateThreadPartialResponseCopyWithImpl(this._self, this._then); + + final UpdateThreadPartialResponse _self; + final $Res Function(UpdateThreadPartialResponse) _then; + + /// Create a copy of UpdateThreadPartialResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? thread = null}) { + return _then( + UpdateThreadPartialResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + thread: null == thread + ? _self.thread + : thread // ignore: cast_nullable_to_non_nullable + as ThreadResponse, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/update_thread_partial_response.g.dart b/packages/stream_chat/lib/open_api/model/update_thread_partial_response.g.dart new file mode 100644 index 0000000000..1f8575a12d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_thread_partial_response.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'update_thread_partial_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UpdateThreadPartialResponse _$UpdateThreadPartialResponseFromJson( + Map json, +) => UpdateThreadPartialResponse( + duration: json['duration'] as String, + thread: ThreadResponse.fromJson(json['thread'] as Map), +); + +Map _$UpdateThreadPartialResponseToJson( + UpdateThreadPartialResponse instance, +) => { + 'duration': instance.duration, + 'thread': instance.thread.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/update_user_group_request.dart b/packages/stream_chat/lib/open_api/model/update_user_group_request.dart new file mode 100644 index 0000000000..9d4f920933 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_user_group_request.dart @@ -0,0 +1,41 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'update_user_group_request.g.dart'; +part 'update_user_group_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UpdateUserGroupRequest with _$UpdateUserGroupRequest { + const UpdateUserGroupRequest({ + this.description, + this.name, + this.teamId, + }); + + @override + @JsonKey(name: 'description') + final String? description; + + @override + @JsonKey(name: 'name') + final String? name; + + @override + @JsonKey(name: 'team_id') + final String? teamId; + + Map toJson() => _$UpdateUserGroupRequestToJson(this); + + static UpdateUserGroupRequest fromJson(Map json) => _$UpdateUserGroupRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/update_user_group_request.freezed.dart b/packages/stream_chat/lib/open_api/model/update_user_group_request.freezed.dart new file mode 100644 index 0000000000..3bf5a3e556 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_user_group_request.freezed.dart @@ -0,0 +1,92 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'update_user_group_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpdateUserGroupRequest { + String? get description; + String? get name; + String? get teamId; + + /// Create a copy of UpdateUserGroupRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpdateUserGroupRequestCopyWith get copyWith => + _$UpdateUserGroupRequestCopyWithImpl( + this as UpdateUserGroupRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpdateUserGroupRequest && + (identical(other.description, description) || other.description == description) && + (identical(other.name, name) || other.name == name) && + (identical(other.teamId, teamId) || other.teamId == teamId)); + } + + @override + int get hashCode => Object.hash(runtimeType, description, name, teamId); + + @override + String toString() { + return 'UpdateUserGroupRequest(description: $description, name: $name, teamId: $teamId)'; + } +} + +/// @nodoc +abstract mixin class $UpdateUserGroupRequestCopyWith<$Res> { + factory $UpdateUserGroupRequestCopyWith( + UpdateUserGroupRequest value, + $Res Function(UpdateUserGroupRequest) _then, + ) = _$UpdateUserGroupRequestCopyWithImpl; + @useResult + $Res call({String? description, String? name, String? teamId}); +} + +/// @nodoc +class _$UpdateUserGroupRequestCopyWithImpl<$Res> implements $UpdateUserGroupRequestCopyWith<$Res> { + _$UpdateUserGroupRequestCopyWithImpl(this._self, this._then); + + final UpdateUserGroupRequest _self; + final $Res Function(UpdateUserGroupRequest) _then; + + /// Create a copy of UpdateUserGroupRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? description = freezed, + Object? name = freezed, + Object? teamId = freezed, + }) { + return _then( + UpdateUserGroupRequest( + description: freezed == description + ? _self.description + : description // ignore: cast_nullable_to_non_nullable + as String?, + name: freezed == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + teamId: freezed == teamId + ? _self.teamId + : teamId // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/update_user_group_request.g.dart b/packages/stream_chat/lib/open_api/model/update_user_group_request.g.dart new file mode 100644 index 0000000000..b7d7f97442 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_user_group_request.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'update_user_group_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UpdateUserGroupRequest _$UpdateUserGroupRequestFromJson( + Map json, +) => UpdateUserGroupRequest( + description: json['description'] as String?, + name: json['name'] as String?, + teamId: json['team_id'] as String?, +); + +Map _$UpdateUserGroupRequestToJson( + UpdateUserGroupRequest instance, +) => { + 'description': instance.description, + 'name': instance.name, + 'team_id': instance.teamId, +}; diff --git a/packages/stream_chat/lib/open_api/model/update_user_group_response.dart b/packages/stream_chat/lib/open_api/model/update_user_group_response.dart new file mode 100644 index 0000000000..e5e9bba8da --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_user_group_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'update_user_group_response.g.dart'; +part 'update_user_group_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UpdateUserGroupResponse with _$UpdateUserGroupResponse { + const UpdateUserGroupResponse({ + required this.duration, + this.userGroup, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'user_group') + final UserGroupResponse? userGroup; + + Map toJson() => _$UpdateUserGroupResponseToJson(this); + + static UpdateUserGroupResponse fromJson(Map json) => _$UpdateUserGroupResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/update_user_group_response.freezed.dart b/packages/stream_chat/lib/open_api/model/update_user_group_response.freezed.dart new file mode 100644 index 0000000000..0ea8ec13b1 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_user_group_response.freezed.dart @@ -0,0 +1,82 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'update_user_group_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpdateUserGroupResponse { + String get duration; + UserGroupResponse? get userGroup; + + /// Create a copy of UpdateUserGroupResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpdateUserGroupResponseCopyWith get copyWith => + _$UpdateUserGroupResponseCopyWithImpl( + this as UpdateUserGroupResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpdateUserGroupResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.userGroup, userGroup) || other.userGroup == userGroup)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration, userGroup); + + @override + String toString() { + return 'UpdateUserGroupResponse(duration: $duration, userGroup: $userGroup)'; + } +} + +/// @nodoc +abstract mixin class $UpdateUserGroupResponseCopyWith<$Res> { + factory $UpdateUserGroupResponseCopyWith( + UpdateUserGroupResponse value, + $Res Function(UpdateUserGroupResponse) _then, + ) = _$UpdateUserGroupResponseCopyWithImpl; + @useResult + $Res call({String duration, UserGroupResponse? userGroup}); +} + +/// @nodoc +class _$UpdateUserGroupResponseCopyWithImpl<$Res> implements $UpdateUserGroupResponseCopyWith<$Res> { + _$UpdateUserGroupResponseCopyWithImpl(this._self, this._then); + + final UpdateUserGroupResponse _self; + final $Res Function(UpdateUserGroupResponse) _then; + + /// Create a copy of UpdateUserGroupResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? userGroup = freezed}) { + return _then( + UpdateUserGroupResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + userGroup: freezed == userGroup + ? _self.userGroup + : userGroup // ignore: cast_nullable_to_non_nullable + as UserGroupResponse?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/update_user_group_response.g.dart b/packages/stream_chat/lib/open_api/model/update_user_group_response.g.dart new file mode 100644 index 0000000000..7758e34ea5 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_user_group_response.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'update_user_group_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UpdateUserGroupResponse _$UpdateUserGroupResponseFromJson( + Map json, +) => UpdateUserGroupResponse( + duration: json['duration'] as String, + userGroup: json['user_group'] == null ? null : UserGroupResponse.fromJson(json['user_group'] as Map), +); + +Map _$UpdateUserGroupResponseToJson( + UpdateUserGroupResponse instance, +) => { + 'duration': instance.duration, + 'user_group': instance.userGroup?.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/update_user_partial_request.dart b/packages/stream_chat/lib/open_api/model/update_user_partial_request.dart new file mode 100644 index 0000000000..28acdfb9aa --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_user_partial_request.dart @@ -0,0 +1,41 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'update_user_partial_request.g.dart'; +part 'update_user_partial_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UpdateUserPartialRequest with _$UpdateUserPartialRequest { + const UpdateUserPartialRequest({ + required this.id, + this.set, + this.unset, + }); + + @override + @JsonKey(name: 'id') + final String id; + + @override + @JsonKey(name: 'set') + final Map? set; + + @override + @JsonKey(name: 'unset') + final List? unset; + + Map toJson() => _$UpdateUserPartialRequestToJson(this); + + static UpdateUserPartialRequest fromJson(Map json) => _$UpdateUserPartialRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/update_user_partial_request.freezed.dart b/packages/stream_chat/lib/open_api/model/update_user_partial_request.freezed.dart new file mode 100644 index 0000000000..4923b940f9 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_user_partial_request.freezed.dart @@ -0,0 +1,97 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'update_user_partial_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpdateUserPartialRequest { + String get id; + Map? get set; + List? get unset; + + /// Create a copy of UpdateUserPartialRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpdateUserPartialRequestCopyWith get copyWith => + _$UpdateUserPartialRequestCopyWithImpl( + this as UpdateUserPartialRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpdateUserPartialRequest && + (identical(other.id, id) || other.id == id) && + const DeepCollectionEquality().equals(other.set, set) && + const DeepCollectionEquality().equals(other.unset, unset)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + id, + const DeepCollectionEquality().hash(set), + const DeepCollectionEquality().hash(unset), + ); + + @override + String toString() { + return 'UpdateUserPartialRequest(id: $id, set: $set, unset: $unset)'; + } +} + +/// @nodoc +abstract mixin class $UpdateUserPartialRequestCopyWith<$Res> { + factory $UpdateUserPartialRequestCopyWith( + UpdateUserPartialRequest value, + $Res Function(UpdateUserPartialRequest) _then, + ) = _$UpdateUserPartialRequestCopyWithImpl; + @useResult + $Res call({String id, Map? set, List? unset}); +} + +/// @nodoc +class _$UpdateUserPartialRequestCopyWithImpl<$Res> implements $UpdateUserPartialRequestCopyWith<$Res> { + _$UpdateUserPartialRequestCopyWithImpl(this._self, this._then); + + final UpdateUserPartialRequest _self; + final $Res Function(UpdateUserPartialRequest) _then; + + /// Create a copy of UpdateUserPartialRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? set = freezed, + Object? unset = freezed, + }) { + return _then( + UpdateUserPartialRequest( + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + set: freezed == set + ? _self.set + : set // ignore: cast_nullable_to_non_nullable + as Map?, + unset: freezed == unset + ? _self.unset + : unset // ignore: cast_nullable_to_non_nullable + as List?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/update_user_partial_request.g.dart b/packages/stream_chat/lib/open_api/model/update_user_partial_request.g.dart new file mode 100644 index 0000000000..58e04a0937 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_user_partial_request.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'update_user_partial_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UpdateUserPartialRequest _$UpdateUserPartialRequestFromJson( + Map json, +) => UpdateUserPartialRequest( + id: json['id'] as String, + set: json['set'] as Map?, + unset: (json['unset'] as List?)?.map((e) => e as String).toList(), +); + +Map _$UpdateUserPartialRequestToJson( + UpdateUserPartialRequest instance, +) => { + 'id': instance.id, + 'set': instance.set, + 'unset': instance.unset, +}; diff --git a/packages/stream_chat/lib/open_api/model/update_users_partial_request.dart b/packages/stream_chat/lib/open_api/model/update_users_partial_request.dart new file mode 100644 index 0000000000..c21dfc5ec8 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_users_partial_request.dart @@ -0,0 +1,31 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'update_users_partial_request.g.dart'; +part 'update_users_partial_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UpdateUsersPartialRequest with _$UpdateUsersPartialRequest { + const UpdateUsersPartialRequest({ + required this.users, + }); + + @override + @JsonKey(name: 'users') + final List users; + + Map toJson() => _$UpdateUsersPartialRequestToJson(this); + + static UpdateUsersPartialRequest fromJson(Map json) => _$UpdateUsersPartialRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/update_users_partial_request.freezed.dart b/packages/stream_chat/lib/open_api/model/update_users_partial_request.freezed.dart new file mode 100644 index 0000000000..3b3f4cae2a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_users_partial_request.freezed.dart @@ -0,0 +1,76 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'update_users_partial_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpdateUsersPartialRequest { + List get users; + + /// Create a copy of UpdateUsersPartialRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpdateUsersPartialRequestCopyWith get copyWith => + _$UpdateUsersPartialRequestCopyWithImpl( + this as UpdateUsersPartialRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpdateUsersPartialRequest && + const DeepCollectionEquality().equals(other.users, users)); + } + + @override + int get hashCode => Object.hash(runtimeType, const DeepCollectionEquality().hash(users)); + + @override + String toString() { + return 'UpdateUsersPartialRequest(users: $users)'; + } +} + +/// @nodoc +abstract mixin class $UpdateUsersPartialRequestCopyWith<$Res> { + factory $UpdateUsersPartialRequestCopyWith( + UpdateUsersPartialRequest value, + $Res Function(UpdateUsersPartialRequest) _then, + ) = _$UpdateUsersPartialRequestCopyWithImpl; + @useResult + $Res call({List users}); +} + +/// @nodoc +class _$UpdateUsersPartialRequestCopyWithImpl<$Res> implements $UpdateUsersPartialRequestCopyWith<$Res> { + _$UpdateUsersPartialRequestCopyWithImpl(this._self, this._then); + + final UpdateUsersPartialRequest _self; + final $Res Function(UpdateUsersPartialRequest) _then; + + /// Create a copy of UpdateUsersPartialRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? users = null}) { + return _then( + UpdateUsersPartialRequest( + users: null == users + ? _self.users + : users // ignore: cast_nullable_to_non_nullable + as List, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/update_users_partial_request.g.dart b/packages/stream_chat/lib/open_api/model/update_users_partial_request.g.dart new file mode 100644 index 0000000000..36f8ca2ba5 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_users_partial_request.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'update_users_partial_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UpdateUsersPartialRequest _$UpdateUsersPartialRequestFromJson( + Map json, +) => UpdateUsersPartialRequest( + users: (json['users'] as List) + .map((e) => UpdateUserPartialRequest.fromJson(e as Map)) + .toList(), +); + +Map _$UpdateUsersPartialRequestToJson( + UpdateUsersPartialRequest instance, +) => {'users': instance.users.map((e) => e.toJson()).toList()}; diff --git a/packages/stream_chat/lib/open_api/model/update_users_request.dart b/packages/stream_chat/lib/open_api/model/update_users_request.dart new file mode 100644 index 0000000000..7d35964b79 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_users_request.dart @@ -0,0 +1,31 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'update_users_request.g.dart'; +part 'update_users_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UpdateUsersRequest with _$UpdateUsersRequest { + const UpdateUsersRequest({ + required this.users, + }); + + @override + @JsonKey(name: 'users') + final Map users; + + Map toJson() => _$UpdateUsersRequestToJson(this); + + static UpdateUsersRequest fromJson(Map json) => _$UpdateUsersRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/update_users_request.freezed.dart b/packages/stream_chat/lib/open_api/model/update_users_request.freezed.dart new file mode 100644 index 0000000000..5ca9e26ec9 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_users_request.freezed.dart @@ -0,0 +1,75 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'update_users_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpdateUsersRequest { + Map get users; + + /// Create a copy of UpdateUsersRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpdateUsersRequestCopyWith get copyWith => _$UpdateUsersRequestCopyWithImpl( + this as UpdateUsersRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpdateUsersRequest && + const DeepCollectionEquality().equals(other.users, users)); + } + + @override + int get hashCode => Object.hash(runtimeType, const DeepCollectionEquality().hash(users)); + + @override + String toString() { + return 'UpdateUsersRequest(users: $users)'; + } +} + +/// @nodoc +abstract mixin class $UpdateUsersRequestCopyWith<$Res> { + factory $UpdateUsersRequestCopyWith( + UpdateUsersRequest value, + $Res Function(UpdateUsersRequest) _then, + ) = _$UpdateUsersRequestCopyWithImpl; + @useResult + $Res call({Map users}); +} + +/// @nodoc +class _$UpdateUsersRequestCopyWithImpl<$Res> implements $UpdateUsersRequestCopyWith<$Res> { + _$UpdateUsersRequestCopyWithImpl(this._self, this._then); + + final UpdateUsersRequest _self; + final $Res Function(UpdateUsersRequest) _then; + + /// Create a copy of UpdateUsersRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? users = null}) { + return _then( + UpdateUsersRequest( + users: null == users + ? _self.users + : users // ignore: cast_nullable_to_non_nullable + as Map, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/update_users_request.g.dart b/packages/stream_chat/lib/open_api/model/update_users_request.g.dart new file mode 100644 index 0000000000..3c4300c5b3 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_users_request.g.dart @@ -0,0 +1,17 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'update_users_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UpdateUsersRequest _$UpdateUsersRequestFromJson(Map json) => UpdateUsersRequest( + users: (json['users'] as Map).map( + (k, e) => MapEntry(k, UserRequest.fromJson(e as Map)), + ), +); + +Map _$UpdateUsersRequestToJson(UpdateUsersRequest instance) => { + 'users': instance.users.map((k, e) => MapEntry(k, e.toJson())), +}; diff --git a/packages/stream_chat/lib/open_api/model/update_users_response.dart b/packages/stream_chat/lib/open_api/model/update_users_response.dart new file mode 100644 index 0000000000..ef00a2af63 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_users_response.dart @@ -0,0 +1,41 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'update_users_response.g.dart'; +part 'update_users_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UpdateUsersResponse with _$UpdateUsersResponse { + const UpdateUsersResponse({ + required this.duration, + required this.membershipDeletionTaskId, + required this.users, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'membership_deletion_task_id') + final String membershipDeletionTaskId; + + @override + @JsonKey(name: 'users') + final Map users; + + Map toJson() => _$UpdateUsersResponseToJson(this); + + static UpdateUsersResponse fromJson(Map json) => _$UpdateUsersResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/update_users_response.freezed.dart b/packages/stream_chat/lib/open_api/model/update_users_response.freezed.dart new file mode 100644 index 0000000000..083399943f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_users_response.freezed.dart @@ -0,0 +1,105 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'update_users_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpdateUsersResponse { + String get duration; + String get membershipDeletionTaskId; + Map get users; + + /// Create a copy of UpdateUsersResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpdateUsersResponseCopyWith get copyWith => + _$UpdateUsersResponseCopyWithImpl( + this as UpdateUsersResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpdateUsersResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical( + other.membershipDeletionTaskId, + membershipDeletionTaskId, + ) || + other.membershipDeletionTaskId == membershipDeletionTaskId) && + const DeepCollectionEquality().equals(other.users, users)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + duration, + membershipDeletionTaskId, + const DeepCollectionEquality().hash(users), + ); + + @override + String toString() { + return 'UpdateUsersResponse(duration: $duration, membershipDeletionTaskId: $membershipDeletionTaskId, users: $users)'; + } +} + +/// @nodoc +abstract mixin class $UpdateUsersResponseCopyWith<$Res> { + factory $UpdateUsersResponseCopyWith( + UpdateUsersResponse value, + $Res Function(UpdateUsersResponse) _then, + ) = _$UpdateUsersResponseCopyWithImpl; + @useResult + $Res call({ + String duration, + String membershipDeletionTaskId, + Map users, + }); +} + +/// @nodoc +class _$UpdateUsersResponseCopyWithImpl<$Res> implements $UpdateUsersResponseCopyWith<$Res> { + _$UpdateUsersResponseCopyWithImpl(this._self, this._then); + + final UpdateUsersResponse _self; + final $Res Function(UpdateUsersResponse) _then; + + /// Create a copy of UpdateUsersResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? duration = null, + Object? membershipDeletionTaskId = null, + Object? users = null, + }) { + return _then( + UpdateUsersResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + membershipDeletionTaskId: null == membershipDeletionTaskId + ? _self.membershipDeletionTaskId + : membershipDeletionTaskId // ignore: cast_nullable_to_non_nullable + as String, + users: null == users + ? _self.users + : users // ignore: cast_nullable_to_non_nullable + as Map, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/update_users_response.g.dart b/packages/stream_chat/lib/open_api/model/update_users_response.g.dart new file mode 100644 index 0000000000..59cdcd301b --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/update_users_response.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'update_users_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UpdateUsersResponse _$UpdateUsersResponseFromJson(Map json) => UpdateUsersResponse( + duration: json['duration'] as String, + membershipDeletionTaskId: json['membership_deletion_task_id'] as String, + users: (json['users'] as Map).map( + (k, e) => MapEntry(k, FullUserResponse.fromJson(e as Map)), + ), +); + +Map _$UpdateUsersResponseToJson( + UpdateUsersResponse instance, +) => { + 'duration': instance.duration, + 'membership_deletion_task_id': instance.membershipDeletionTaskId, + 'users': instance.users.map((k, e) => MapEntry(k, e.toJson())), +}; diff --git a/packages/stream_chat/lib/open_api/model/upload_channel_file_request.dart b/packages/stream_chat/lib/open_api/model/upload_channel_file_request.dart new file mode 100644 index 0000000000..05ee20de13 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/upload_channel_file_request.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'upload_channel_file_request.g.dart'; +part 'upload_channel_file_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UploadChannelFileRequest with _$UploadChannelFileRequest { + const UploadChannelFileRequest({ + this.file, + this.user, + }); + + @override + @JsonKey(name: 'file') + final String? file; + + @override + @JsonKey(name: 'user') + final OnlyUserID? user; + + Map toJson() => _$UploadChannelFileRequestToJson(this); + + static UploadChannelFileRequest fromJson(Map json) => _$UploadChannelFileRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/upload_channel_file_request.freezed.dart b/packages/stream_chat/lib/open_api/model/upload_channel_file_request.freezed.dart new file mode 100644 index 0000000000..2088ce4d02 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/upload_channel_file_request.freezed.dart @@ -0,0 +1,82 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'upload_channel_file_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UploadChannelFileRequest { + String? get file; + OnlyUserID? get user; + + /// Create a copy of UploadChannelFileRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UploadChannelFileRequestCopyWith get copyWith => + _$UploadChannelFileRequestCopyWithImpl( + this as UploadChannelFileRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UploadChannelFileRequest && + (identical(other.file, file) || other.file == file) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash(runtimeType, file, user); + + @override + String toString() { + return 'UploadChannelFileRequest(file: $file, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $UploadChannelFileRequestCopyWith<$Res> { + factory $UploadChannelFileRequestCopyWith( + UploadChannelFileRequest value, + $Res Function(UploadChannelFileRequest) _then, + ) = _$UploadChannelFileRequestCopyWithImpl; + @useResult + $Res call({String? file, OnlyUserID? user}); +} + +/// @nodoc +class _$UploadChannelFileRequestCopyWithImpl<$Res> implements $UploadChannelFileRequestCopyWith<$Res> { + _$UploadChannelFileRequestCopyWithImpl(this._self, this._then); + + final UploadChannelFileRequest _self; + final $Res Function(UploadChannelFileRequest) _then; + + /// Create a copy of UploadChannelFileRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? file = freezed, Object? user = freezed}) { + return _then( + UploadChannelFileRequest( + file: freezed == file + ? _self.file + : file // ignore: cast_nullable_to_non_nullable + as String?, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as OnlyUserID?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/upload_channel_file_request.g.dart b/packages/stream_chat/lib/open_api/model/upload_channel_file_request.g.dart new file mode 100644 index 0000000000..69895a0883 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/upload_channel_file_request.g.dart @@ -0,0 +1,18 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'upload_channel_file_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UploadChannelFileRequest _$UploadChannelFileRequestFromJson( + Map json, +) => UploadChannelFileRequest( + file: json['file'] as String?, + user: json['user'] == null ? null : OnlyUserID.fromJson(json['user'] as Map), +); + +Map _$UploadChannelFileRequestToJson( + UploadChannelFileRequest instance, +) => {'file': instance.file, 'user': instance.user?.toJson()}; diff --git a/packages/stream_chat/lib/open_api/model/upload_channel_file_response.dart b/packages/stream_chat/lib/open_api/model/upload_channel_file_response.dart new file mode 100644 index 0000000000..b435f40f35 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/upload_channel_file_response.dart @@ -0,0 +1,46 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'upload_channel_file_response.g.dart'; +part 'upload_channel_file_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UploadChannelFileResponse with _$UploadChannelFileResponse { + const UploadChannelFileResponse({ + required this.duration, + this.file, + this.moderationAction, + this.thumbUrl, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'file') + final String? file; + + @override + @JsonKey(name: 'moderation_action') + final String? moderationAction; + + @override + @JsonKey(name: 'thumb_url') + final String? thumbUrl; + + Map toJson() => _$UploadChannelFileResponseToJson(this); + + static UploadChannelFileResponse fromJson(Map json) => _$UploadChannelFileResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/upload_channel_file_response.freezed.dart b/packages/stream_chat/lib/open_api/model/upload_channel_file_response.freezed.dart new file mode 100644 index 0000000000..8727637093 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/upload_channel_file_response.freezed.dart @@ -0,0 +1,104 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'upload_channel_file_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UploadChannelFileResponse { + String get duration; + String? get file; + String? get moderationAction; + String? get thumbUrl; + + /// Create a copy of UploadChannelFileResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UploadChannelFileResponseCopyWith get copyWith => + _$UploadChannelFileResponseCopyWithImpl( + this as UploadChannelFileResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UploadChannelFileResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.file, file) || other.file == file) && + (identical(other.moderationAction, moderationAction) || other.moderationAction == moderationAction) && + (identical(other.thumbUrl, thumbUrl) || other.thumbUrl == thumbUrl)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration, file, moderationAction, thumbUrl); + + @override + String toString() { + return 'UploadChannelFileResponse(duration: $duration, file: $file, moderationAction: $moderationAction, thumbUrl: $thumbUrl)'; + } +} + +/// @nodoc +abstract mixin class $UploadChannelFileResponseCopyWith<$Res> { + factory $UploadChannelFileResponseCopyWith( + UploadChannelFileResponse value, + $Res Function(UploadChannelFileResponse) _then, + ) = _$UploadChannelFileResponseCopyWithImpl; + @useResult + $Res call({ + String duration, + String? file, + String? moderationAction, + String? thumbUrl, + }); +} + +/// @nodoc +class _$UploadChannelFileResponseCopyWithImpl<$Res> implements $UploadChannelFileResponseCopyWith<$Res> { + _$UploadChannelFileResponseCopyWithImpl(this._self, this._then); + + final UploadChannelFileResponse _self; + final $Res Function(UploadChannelFileResponse) _then; + + /// Create a copy of UploadChannelFileResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? duration = null, + Object? file = freezed, + Object? moderationAction = freezed, + Object? thumbUrl = freezed, + }) { + return _then( + UploadChannelFileResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + file: freezed == file + ? _self.file + : file // ignore: cast_nullable_to_non_nullable + as String?, + moderationAction: freezed == moderationAction + ? _self.moderationAction + : moderationAction // ignore: cast_nullable_to_non_nullable + as String?, + thumbUrl: freezed == thumbUrl + ? _self.thumbUrl + : thumbUrl // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/upload_channel_file_response.g.dart b/packages/stream_chat/lib/open_api/model/upload_channel_file_response.g.dart new file mode 100644 index 0000000000..855d53721a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/upload_channel_file_response.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'upload_channel_file_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UploadChannelFileResponse _$UploadChannelFileResponseFromJson( + Map json, +) => UploadChannelFileResponse( + duration: json['duration'] as String, + file: json['file'] as String?, + moderationAction: json['moderation_action'] as String?, + thumbUrl: json['thumb_url'] as String?, +); + +Map _$UploadChannelFileResponseToJson( + UploadChannelFileResponse instance, +) => { + 'duration': instance.duration, + 'file': instance.file, + 'moderation_action': instance.moderationAction, + 'thumb_url': instance.thumbUrl, +}; diff --git a/packages/stream_chat/lib/open_api/model/upload_channel_request.dart b/packages/stream_chat/lib/open_api/model/upload_channel_request.dart new file mode 100644 index 0000000000..4ee6bcc269 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/upload_channel_request.dart @@ -0,0 +1,41 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'upload_channel_request.g.dart'; +part 'upload_channel_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UploadChannelRequest with _$UploadChannelRequest { + const UploadChannelRequest({ + this.file, + this.uploadSizes, + this.user, + }); + + @override + @JsonKey(name: 'file') + final String? file; + + @override + @JsonKey(name: 'upload_sizes') + final List? uploadSizes; + + @override + @JsonKey(name: 'user') + final OnlyUserID? user; + + Map toJson() => _$UploadChannelRequestToJson(this); + + static UploadChannelRequest fromJson(Map json) => _$UploadChannelRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/upload_channel_request.freezed.dart b/packages/stream_chat/lib/open_api/model/upload_channel_request.freezed.dart new file mode 100644 index 0000000000..12ec4d6d7a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/upload_channel_request.freezed.dart @@ -0,0 +1,100 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'upload_channel_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UploadChannelRequest { + String? get file; + List? get uploadSizes; + OnlyUserID? get user; + + /// Create a copy of UploadChannelRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UploadChannelRequestCopyWith get copyWith => + _$UploadChannelRequestCopyWithImpl( + this as UploadChannelRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UploadChannelRequest && + (identical(other.file, file) || other.file == file) && + const DeepCollectionEquality().equals( + other.uploadSizes, + uploadSizes, + ) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + file, + const DeepCollectionEquality().hash(uploadSizes), + user, + ); + + @override + String toString() { + return 'UploadChannelRequest(file: $file, uploadSizes: $uploadSizes, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $UploadChannelRequestCopyWith<$Res> { + factory $UploadChannelRequestCopyWith( + UploadChannelRequest value, + $Res Function(UploadChannelRequest) _then, + ) = _$UploadChannelRequestCopyWithImpl; + @useResult + $Res call({String? file, List? uploadSizes, OnlyUserID? user}); +} + +/// @nodoc +class _$UploadChannelRequestCopyWithImpl<$Res> implements $UploadChannelRequestCopyWith<$Res> { + _$UploadChannelRequestCopyWithImpl(this._self, this._then); + + final UploadChannelRequest _self; + final $Res Function(UploadChannelRequest) _then; + + /// Create a copy of UploadChannelRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? file = freezed, + Object? uploadSizes = freezed, + Object? user = freezed, + }) { + return _then( + UploadChannelRequest( + file: freezed == file + ? _self.file + : file // ignore: cast_nullable_to_non_nullable + as String?, + uploadSizes: freezed == uploadSizes + ? _self.uploadSizes + : uploadSizes // ignore: cast_nullable_to_non_nullable + as List?, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as OnlyUserID?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/upload_channel_request.g.dart b/packages/stream_chat/lib/open_api/model/upload_channel_request.g.dart new file mode 100644 index 0000000000..1cbb79919b --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/upload_channel_request.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'upload_channel_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UploadChannelRequest _$UploadChannelRequestFromJson( + Map json, +) => UploadChannelRequest( + file: json['file'] as String?, + uploadSizes: (json['upload_sizes'] as List?) + ?.map((e) => ImageSize.fromJson(e as Map)) + .toList(), + user: json['user'] == null ? null : OnlyUserID.fromJson(json['user'] as Map), +); + +Map _$UploadChannelRequestToJson( + UploadChannelRequest instance, +) => { + 'file': instance.file, + 'upload_sizes': instance.uploadSizes?.map((e) => e.toJson()).toList(), + 'user': instance.user?.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/upload_channel_response.dart b/packages/stream_chat/lib/open_api/model/upload_channel_response.dart new file mode 100644 index 0000000000..fbb987166a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/upload_channel_response.dart @@ -0,0 +1,51 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'upload_channel_response.g.dart'; +part 'upload_channel_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UploadChannelResponse with _$UploadChannelResponse { + const UploadChannelResponse({ + required this.duration, + this.file, + this.moderationAction, + this.thumbUrl, + this.uploadSizes, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'file') + final String? file; + + @override + @JsonKey(name: 'moderation_action') + final String? moderationAction; + + @override + @JsonKey(name: 'thumb_url') + final String? thumbUrl; + + @override + @JsonKey(name: 'upload_sizes') + final List? uploadSizes; + + Map toJson() => _$UploadChannelResponseToJson(this); + + static UploadChannelResponse fromJson(Map json) => _$UploadChannelResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/upload_channel_response.freezed.dart b/packages/stream_chat/lib/open_api/model/upload_channel_response.freezed.dart new file mode 100644 index 0000000000..d08d8370af --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/upload_channel_response.freezed.dart @@ -0,0 +1,122 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'upload_channel_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UploadChannelResponse { + String get duration; + String? get file; + String? get moderationAction; + String? get thumbUrl; + List? get uploadSizes; + + /// Create a copy of UploadChannelResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UploadChannelResponseCopyWith get copyWith => + _$UploadChannelResponseCopyWithImpl( + this as UploadChannelResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UploadChannelResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.file, file) || other.file == file) && + (identical(other.moderationAction, moderationAction) || other.moderationAction == moderationAction) && + (identical(other.thumbUrl, thumbUrl) || other.thumbUrl == thumbUrl) && + const DeepCollectionEquality().equals( + other.uploadSizes, + uploadSizes, + )); + } + + @override + int get hashCode => Object.hash( + runtimeType, + duration, + file, + moderationAction, + thumbUrl, + const DeepCollectionEquality().hash(uploadSizes), + ); + + @override + String toString() { + return 'UploadChannelResponse(duration: $duration, file: $file, moderationAction: $moderationAction, thumbUrl: $thumbUrl, uploadSizes: $uploadSizes)'; + } +} + +/// @nodoc +abstract mixin class $UploadChannelResponseCopyWith<$Res> { + factory $UploadChannelResponseCopyWith( + UploadChannelResponse value, + $Res Function(UploadChannelResponse) _then, + ) = _$UploadChannelResponseCopyWithImpl; + @useResult + $Res call({ + String duration, + String? file, + String? moderationAction, + String? thumbUrl, + List? uploadSizes, + }); +} + +/// @nodoc +class _$UploadChannelResponseCopyWithImpl<$Res> implements $UploadChannelResponseCopyWith<$Res> { + _$UploadChannelResponseCopyWithImpl(this._self, this._then); + + final UploadChannelResponse _self; + final $Res Function(UploadChannelResponse) _then; + + /// Create a copy of UploadChannelResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? duration = null, + Object? file = freezed, + Object? moderationAction = freezed, + Object? thumbUrl = freezed, + Object? uploadSizes = freezed, + }) { + return _then( + UploadChannelResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + file: freezed == file + ? _self.file + : file // ignore: cast_nullable_to_non_nullable + as String?, + moderationAction: freezed == moderationAction + ? _self.moderationAction + : moderationAction // ignore: cast_nullable_to_non_nullable + as String?, + thumbUrl: freezed == thumbUrl + ? _self.thumbUrl + : thumbUrl // ignore: cast_nullable_to_non_nullable + as String?, + uploadSizes: freezed == uploadSizes + ? _self.uploadSizes + : uploadSizes // ignore: cast_nullable_to_non_nullable + as List?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/upload_channel_response.g.dart b/packages/stream_chat/lib/open_api/model/upload_channel_response.g.dart new file mode 100644 index 0000000000..f83f6f0cf0 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/upload_channel_response.g.dart @@ -0,0 +1,29 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'upload_channel_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UploadChannelResponse _$UploadChannelResponseFromJson( + Map json, +) => UploadChannelResponse( + duration: json['duration'] as String, + file: json['file'] as String?, + moderationAction: json['moderation_action'] as String?, + thumbUrl: json['thumb_url'] as String?, + uploadSizes: (json['upload_sizes'] as List?) + ?.map((e) => ImageSize.fromJson(e as Map)) + .toList(), +); + +Map _$UploadChannelResponseToJson( + UploadChannelResponse instance, +) => { + 'duration': instance.duration, + 'file': instance.file, + 'moderation_action': instance.moderationAction, + 'thumb_url': instance.thumbUrl, + 'upload_sizes': instance.uploadSizes?.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/upsert_action_config_item.dart b/packages/stream_chat/lib/open_api/model/upsert_action_config_item.dart new file mode 100644 index 0000000000..ac22eb0485 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/upsert_action_config_item.dart @@ -0,0 +1,66 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'upsert_action_config_item.g.dart'; +part 'upsert_action_config_item.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UpsertActionConfigItem with _$UpsertActionConfigItem { + const UpsertActionConfigItem({ + required this.action, + this.custom, + this.description, + required this.entityType, + this.icon, + this.id, + required this.order, + this.queueType, + }); + + @override + @JsonKey(name: 'action') + final String action; + + @override + @JsonKey(name: 'custom') + final Map? custom; + + @override + @JsonKey(name: 'description') + final String? description; + + @override + @JsonKey(name: 'entity_type') + final String entityType; + + @override + @JsonKey(name: 'icon') + final String? icon; + + @override + @JsonKey(name: 'id') + final String? id; + + @override + @JsonKey(name: 'order') + final int order; + + @override + @JsonKey(name: 'queue_type') + final String? queueType; + + Map toJson() => _$UpsertActionConfigItemToJson(this); + + static UpsertActionConfigItem fromJson(Map json) => _$UpsertActionConfigItemFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/upsert_action_config_item.freezed.dart b/packages/stream_chat/lib/open_api/model/upsert_action_config_item.freezed.dart new file mode 100644 index 0000000000..1d48f17fe7 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/upsert_action_config_item.freezed.dart @@ -0,0 +1,146 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'upsert_action_config_item.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpsertActionConfigItem { + String get action; + Map? get custom; + String? get description; + String get entityType; + String? get icon; + String? get id; + int get order; + String? get queueType; + + /// Create a copy of UpsertActionConfigItem + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpsertActionConfigItemCopyWith get copyWith => + _$UpsertActionConfigItemCopyWithImpl( + this as UpsertActionConfigItem, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpsertActionConfigItem && + (identical(other.action, action) || other.action == action) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.description, description) || other.description == description) && + (identical(other.entityType, entityType) || other.entityType == entityType) && + (identical(other.icon, icon) || other.icon == icon) && + (identical(other.id, id) || other.id == id) && + (identical(other.order, order) || other.order == order) && + (identical(other.queueType, queueType) || other.queueType == queueType)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + action, + const DeepCollectionEquality().hash(custom), + description, + entityType, + icon, + id, + order, + queueType, + ); + + @override + String toString() { + return 'UpsertActionConfigItem(action: $action, custom: $custom, description: $description, entityType: $entityType, icon: $icon, id: $id, order: $order, queueType: $queueType)'; + } +} + +/// @nodoc +abstract mixin class $UpsertActionConfigItemCopyWith<$Res> { + factory $UpsertActionConfigItemCopyWith( + UpsertActionConfigItem value, + $Res Function(UpsertActionConfigItem) _then, + ) = _$UpsertActionConfigItemCopyWithImpl; + @useResult + $Res call({ + String action, + Map? custom, + String? description, + String entityType, + String? icon, + String? id, + int order, + String? queueType, + }); +} + +/// @nodoc +class _$UpsertActionConfigItemCopyWithImpl<$Res> implements $UpsertActionConfigItemCopyWith<$Res> { + _$UpsertActionConfigItemCopyWithImpl(this._self, this._then); + + final UpsertActionConfigItem _self; + final $Res Function(UpsertActionConfigItem) _then; + + /// Create a copy of UpsertActionConfigItem + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? action = null, + Object? custom = freezed, + Object? description = freezed, + Object? entityType = null, + Object? icon = freezed, + Object? id = freezed, + Object? order = null, + Object? queueType = freezed, + }) { + return _then( + UpsertActionConfigItem( + action: null == action + ? _self.action + : action // ignore: cast_nullable_to_non_nullable + as String, + custom: freezed == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map?, + description: freezed == description + ? _self.description + : description // ignore: cast_nullable_to_non_nullable + as String?, + entityType: null == entityType + ? _self.entityType + : entityType // ignore: cast_nullable_to_non_nullable + as String, + icon: freezed == icon + ? _self.icon + : icon // ignore: cast_nullable_to_non_nullable + as String?, + id: freezed == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String?, + order: null == order + ? _self.order + : order // ignore: cast_nullable_to_non_nullable + as int, + queueType: freezed == queueType + ? _self.queueType + : queueType // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/upsert_action_config_item.g.dart b/packages/stream_chat/lib/open_api/model/upsert_action_config_item.g.dart new file mode 100644 index 0000000000..96440f74f7 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/upsert_action_config_item.g.dart @@ -0,0 +1,33 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'upsert_action_config_item.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UpsertActionConfigItem _$UpsertActionConfigItemFromJson( + Map json, +) => UpsertActionConfigItem( + action: json['action'] as String, + custom: json['custom'] as Map?, + description: json['description'] as String?, + entityType: json['entity_type'] as String, + icon: json['icon'] as String?, + id: json['id'] as String?, + order: (json['order'] as num).toInt(), + queueType: json['queue_type'] as String?, +); + +Map _$UpsertActionConfigItemToJson( + UpsertActionConfigItem instance, +) => { + 'action': instance.action, + 'custom': instance.custom, + 'description': instance.description, + 'entity_type': instance.entityType, + 'icon': instance.icon, + 'id': instance.id, + 'order': instance.order, + 'queue_type': instance.queueType, +}; diff --git a/packages/stream_chat/lib/open_api/model/upsert_action_config_request.dart b/packages/stream_chat/lib/open_api/model/upsert_action_config_request.dart new file mode 100644 index 0000000000..bafec88b0f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/upsert_action_config_request.dart @@ -0,0 +1,66 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'upsert_action_config_request.g.dart'; +part 'upsert_action_config_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UpsertActionConfigRequest with _$UpsertActionConfigRequest { + const UpsertActionConfigRequest({ + required this.action, + this.custom, + this.description, + required this.entityType, + this.icon, + this.id, + required this.order, + this.queueType, + }); + + @override + @JsonKey(name: 'action') + final String action; + + @override + @JsonKey(name: 'custom') + final Map? custom; + + @override + @JsonKey(name: 'description') + final String? description; + + @override + @JsonKey(name: 'entity_type') + final String entityType; + + @override + @JsonKey(name: 'icon') + final String? icon; + + @override + @JsonKey(name: 'id') + final String? id; + + @override + @JsonKey(name: 'order') + final int order; + + @override + @JsonKey(name: 'queue_type') + final String? queueType; + + Map toJson() => _$UpsertActionConfigRequestToJson(this); + + static UpsertActionConfigRequest fromJson(Map json) => _$UpsertActionConfigRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/upsert_action_config_request.freezed.dart b/packages/stream_chat/lib/open_api/model/upsert_action_config_request.freezed.dart new file mode 100644 index 0000000000..8ee212fa7f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/upsert_action_config_request.freezed.dart @@ -0,0 +1,146 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'upsert_action_config_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpsertActionConfigRequest { + String get action; + Map? get custom; + String? get description; + String get entityType; + String? get icon; + String? get id; + int get order; + String? get queueType; + + /// Create a copy of UpsertActionConfigRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpsertActionConfigRequestCopyWith get copyWith => + _$UpsertActionConfigRequestCopyWithImpl( + this as UpsertActionConfigRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpsertActionConfigRequest && + (identical(other.action, action) || other.action == action) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.description, description) || other.description == description) && + (identical(other.entityType, entityType) || other.entityType == entityType) && + (identical(other.icon, icon) || other.icon == icon) && + (identical(other.id, id) || other.id == id) && + (identical(other.order, order) || other.order == order) && + (identical(other.queueType, queueType) || other.queueType == queueType)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + action, + const DeepCollectionEquality().hash(custom), + description, + entityType, + icon, + id, + order, + queueType, + ); + + @override + String toString() { + return 'UpsertActionConfigRequest(action: $action, custom: $custom, description: $description, entityType: $entityType, icon: $icon, id: $id, order: $order, queueType: $queueType)'; + } +} + +/// @nodoc +abstract mixin class $UpsertActionConfigRequestCopyWith<$Res> { + factory $UpsertActionConfigRequestCopyWith( + UpsertActionConfigRequest value, + $Res Function(UpsertActionConfigRequest) _then, + ) = _$UpsertActionConfigRequestCopyWithImpl; + @useResult + $Res call({ + String action, + Map? custom, + String? description, + String entityType, + String? icon, + String? id, + int order, + String? queueType, + }); +} + +/// @nodoc +class _$UpsertActionConfigRequestCopyWithImpl<$Res> implements $UpsertActionConfigRequestCopyWith<$Res> { + _$UpsertActionConfigRequestCopyWithImpl(this._self, this._then); + + final UpsertActionConfigRequest _self; + final $Res Function(UpsertActionConfigRequest) _then; + + /// Create a copy of UpsertActionConfigRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? action = null, + Object? custom = freezed, + Object? description = freezed, + Object? entityType = null, + Object? icon = freezed, + Object? id = freezed, + Object? order = null, + Object? queueType = freezed, + }) { + return _then( + UpsertActionConfigRequest( + action: null == action + ? _self.action + : action // ignore: cast_nullable_to_non_nullable + as String, + custom: freezed == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map?, + description: freezed == description + ? _self.description + : description // ignore: cast_nullable_to_non_nullable + as String?, + entityType: null == entityType + ? _self.entityType + : entityType // ignore: cast_nullable_to_non_nullable + as String, + icon: freezed == icon + ? _self.icon + : icon // ignore: cast_nullable_to_non_nullable + as String?, + id: freezed == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String?, + order: null == order + ? _self.order + : order // ignore: cast_nullable_to_non_nullable + as int, + queueType: freezed == queueType + ? _self.queueType + : queueType // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/upsert_action_config_request.g.dart b/packages/stream_chat/lib/open_api/model/upsert_action_config_request.g.dart new file mode 100644 index 0000000000..05b9142a84 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/upsert_action_config_request.g.dart @@ -0,0 +1,33 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'upsert_action_config_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UpsertActionConfigRequest _$UpsertActionConfigRequestFromJson( + Map json, +) => UpsertActionConfigRequest( + action: json['action'] as String, + custom: json['custom'] as Map?, + description: json['description'] as String?, + entityType: json['entity_type'] as String, + icon: json['icon'] as String?, + id: json['id'] as String?, + order: (json['order'] as num).toInt(), + queueType: json['queue_type'] as String?, +); + +Map _$UpsertActionConfigRequestToJson( + UpsertActionConfigRequest instance, +) => { + 'action': instance.action, + 'custom': instance.custom, + 'description': instance.description, + 'entity_type': instance.entityType, + 'icon': instance.icon, + 'id': instance.id, + 'order': instance.order, + 'queue_type': instance.queueType, +}; diff --git a/packages/stream_chat/lib/open_api/model/upsert_action_config_response.dart b/packages/stream_chat/lib/open_api/model/upsert_action_config_response.dart new file mode 100644 index 0000000000..a413175ce6 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/upsert_action_config_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'upsert_action_config_response.g.dart'; +part 'upsert_action_config_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UpsertActionConfigResponse with _$UpsertActionConfigResponse { + const UpsertActionConfigResponse({ + this.actionConfig, + required this.duration, + }); + + @override + @JsonKey(name: 'action_config') + final ModerationActionConfigResponse? actionConfig; + + @override + @JsonKey(name: 'duration') + final String duration; + + Map toJson() => _$UpsertActionConfigResponseToJson(this); + + static UpsertActionConfigResponse fromJson(Map json) => _$UpsertActionConfigResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/upsert_action_config_response.freezed.dart b/packages/stream_chat/lib/open_api/model/upsert_action_config_response.freezed.dart new file mode 100644 index 0000000000..4acd006f4e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/upsert_action_config_response.freezed.dart @@ -0,0 +1,82 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'upsert_action_config_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpsertActionConfigResponse { + ModerationActionConfigResponse? get actionConfig; + String get duration; + + /// Create a copy of UpsertActionConfigResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpsertActionConfigResponseCopyWith get copyWith => + _$UpsertActionConfigResponseCopyWithImpl( + this as UpsertActionConfigResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpsertActionConfigResponse && + (identical(other.actionConfig, actionConfig) || other.actionConfig == actionConfig) && + (identical(other.duration, duration) || other.duration == duration)); + } + + @override + int get hashCode => Object.hash(runtimeType, actionConfig, duration); + + @override + String toString() { + return 'UpsertActionConfigResponse(actionConfig: $actionConfig, duration: $duration)'; + } +} + +/// @nodoc +abstract mixin class $UpsertActionConfigResponseCopyWith<$Res> { + factory $UpsertActionConfigResponseCopyWith( + UpsertActionConfigResponse value, + $Res Function(UpsertActionConfigResponse) _then, + ) = _$UpsertActionConfigResponseCopyWithImpl; + @useResult + $Res call({ModerationActionConfigResponse? actionConfig, String duration}); +} + +/// @nodoc +class _$UpsertActionConfigResponseCopyWithImpl<$Res> implements $UpsertActionConfigResponseCopyWith<$Res> { + _$UpsertActionConfigResponseCopyWithImpl(this._self, this._then); + + final UpsertActionConfigResponse _self; + final $Res Function(UpsertActionConfigResponse) _then; + + /// Create a copy of UpsertActionConfigResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? actionConfig = freezed, Object? duration = null}) { + return _then( + UpsertActionConfigResponse( + actionConfig: freezed == actionConfig + ? _self.actionConfig + : actionConfig // ignore: cast_nullable_to_non_nullable + as ModerationActionConfigResponse?, + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/upsert_action_config_response.g.dart b/packages/stream_chat/lib/open_api/model/upsert_action_config_response.g.dart new file mode 100644 index 0000000000..a2fe198c9b --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/upsert_action_config_response.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'upsert_action_config_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UpsertActionConfigResponse _$UpsertActionConfigResponseFromJson( + Map json, +) => UpsertActionConfigResponse( + actionConfig: json['action_config'] == null + ? null + : ModerationActionConfigResponse.fromJson( + json['action_config'] as Map, + ), + duration: json['duration'] as String, +); + +Map _$UpsertActionConfigResponseToJson( + UpsertActionConfigResponse instance, +) => { + 'action_config': instance.actionConfig?.toJson(), + 'duration': instance.duration, +}; diff --git a/packages/stream_chat/lib/open_api/model/upsert_config_request.dart b/packages/stream_chat/lib/open_api/model/upsert_config_request.dart new file mode 100644 index 0000000000..60ee45a915 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/upsert_config_request.dart @@ -0,0 +1,121 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'upsert_config_request.g.dart'; +part 'upsert_config_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UpsertConfigRequest with _$UpsertConfigRequest { + const UpsertConfigRequest({ + this.aiAudioConfig, + this.aiImageConfig, + this.aiTextConfig, + this.aiVideoConfig, + this.async, + this.automodPlatformCircumventionConfig, + this.automodSemanticFiltersConfig, + this.automodToxicityConfig, + this.awsRekognitionConfig, + this.blockListConfig, + this.bodyguardConfig, + this.floodConfig, + this.googleVisionConfig, + required this.key, + this.llmConfig, + this.ruleBuilderConfig, + this.team, + this.velocityFilterConfig, + this.videoCallRuleConfig, + }); + + @override + @JsonKey(name: 'ai_audio_config') + final AIAudioConfigRequest? aiAudioConfig; + + @override + @JsonKey(name: 'ai_image_config') + final AIImageConfig? aiImageConfig; + + @override + @JsonKey(name: 'ai_text_config') + final AITextConfig? aiTextConfig; + + @override + @JsonKey(name: 'ai_video_config') + final AIVideoConfig? aiVideoConfig; + + @override + @JsonKey(name: 'async') + final bool? async; + + @override + @JsonKey(name: 'automod_platform_circumvention_config') + final AutomodPlatformCircumventionConfig? automodPlatformCircumventionConfig; + + @override + @JsonKey(name: 'automod_semantic_filters_config') + final AutomodSemanticFiltersConfig? automodSemanticFiltersConfig; + + @override + @JsonKey(name: 'automod_toxicity_config') + final AutomodToxicityConfig? automodToxicityConfig; + + @override + @JsonKey(name: 'aws_rekognition_config') + final AIImageConfig? awsRekognitionConfig; + + @override + @JsonKey(name: 'block_list_config') + final BlockListConfig? blockListConfig; + + @override + @JsonKey(name: 'bodyguard_config') + final AITextConfig? bodyguardConfig; + + @override + @JsonKey(name: 'flood_config') + final FloodConfig? floodConfig; + + @override + @JsonKey(name: 'google_vision_config') + final GoogleVisionConfig? googleVisionConfig; + + @override + @JsonKey(name: 'key') + final String key; + + @override + @JsonKey(name: 'llm_config') + final LLMConfig? llmConfig; + + @override + @JsonKey(name: 'rule_builder_config') + final RuleBuilderConfig? ruleBuilderConfig; + + @override + @JsonKey(name: 'team') + final String? team; + + @override + @JsonKey(name: 'velocity_filter_config') + final VelocityFilterConfig? velocityFilterConfig; + + @override + @JsonKey(name: 'video_call_rule_config') + final VideoCallRuleConfig? videoCallRuleConfig; + + Map toJson() => _$UpsertConfigRequestToJson(this); + + static UpsertConfigRequest fromJson(Map json) => _$UpsertConfigRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/upsert_config_request.freezed.dart b/packages/stream_chat/lib/open_api/model/upsert_config_request.freezed.dart new file mode 100644 index 0000000000..be4db5bdb5 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/upsert_config_request.freezed.dart @@ -0,0 +1,258 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'upsert_config_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpsertConfigRequest { + AIAudioConfigRequest? get aiAudioConfig; + AIImageConfig? get aiImageConfig; + AITextConfig? get aiTextConfig; + AIVideoConfig? get aiVideoConfig; + bool? get async; + AutomodPlatformCircumventionConfig? get automodPlatformCircumventionConfig; + AutomodSemanticFiltersConfig? get automodSemanticFiltersConfig; + AutomodToxicityConfig? get automodToxicityConfig; + AIImageConfig? get awsRekognitionConfig; + BlockListConfig? get blockListConfig; + AITextConfig? get bodyguardConfig; + FloodConfig? get floodConfig; + GoogleVisionConfig? get googleVisionConfig; + String get key; + LLMConfig? get llmConfig; + RuleBuilderConfig? get ruleBuilderConfig; + String? get team; + VelocityFilterConfig? get velocityFilterConfig; + VideoCallRuleConfig? get videoCallRuleConfig; + + /// Create a copy of UpsertConfigRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpsertConfigRequestCopyWith get copyWith => + _$UpsertConfigRequestCopyWithImpl( + this as UpsertConfigRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpsertConfigRequest && + (identical(other.aiAudioConfig, aiAudioConfig) || other.aiAudioConfig == aiAudioConfig) && + (identical(other.aiImageConfig, aiImageConfig) || other.aiImageConfig == aiImageConfig) && + (identical(other.aiTextConfig, aiTextConfig) || other.aiTextConfig == aiTextConfig) && + (identical(other.aiVideoConfig, aiVideoConfig) || other.aiVideoConfig == aiVideoConfig) && + (identical(other.async, async) || other.async == async) && + (identical( + other.automodPlatformCircumventionConfig, + automodPlatformCircumventionConfig, + ) || + other.automodPlatformCircumventionConfig == automodPlatformCircumventionConfig) && + (identical( + other.automodSemanticFiltersConfig, + automodSemanticFiltersConfig, + ) || + other.automodSemanticFiltersConfig == automodSemanticFiltersConfig) && + (identical(other.automodToxicityConfig, automodToxicityConfig) || + other.automodToxicityConfig == automodToxicityConfig) && + (identical(other.awsRekognitionConfig, awsRekognitionConfig) || + other.awsRekognitionConfig == awsRekognitionConfig) && + (identical(other.blockListConfig, blockListConfig) || other.blockListConfig == blockListConfig) && + (identical(other.bodyguardConfig, bodyguardConfig) || other.bodyguardConfig == bodyguardConfig) && + (identical(other.floodConfig, floodConfig) || other.floodConfig == floodConfig) && + (identical(other.googleVisionConfig, googleVisionConfig) || + other.googleVisionConfig == googleVisionConfig) && + (identical(other.key, key) || other.key == key) && + (identical(other.llmConfig, llmConfig) || other.llmConfig == llmConfig) && + (identical(other.ruleBuilderConfig, ruleBuilderConfig) || other.ruleBuilderConfig == ruleBuilderConfig) && + (identical(other.team, team) || other.team == team) && + (identical(other.velocityFilterConfig, velocityFilterConfig) || + other.velocityFilterConfig == velocityFilterConfig) && + (identical(other.videoCallRuleConfig, videoCallRuleConfig) || + other.videoCallRuleConfig == videoCallRuleConfig)); + } + + @override + int get hashCode => Object.hashAll([ + runtimeType, + aiAudioConfig, + aiImageConfig, + aiTextConfig, + aiVideoConfig, + async, + automodPlatformCircumventionConfig, + automodSemanticFiltersConfig, + automodToxicityConfig, + awsRekognitionConfig, + blockListConfig, + bodyguardConfig, + floodConfig, + googleVisionConfig, + key, + llmConfig, + ruleBuilderConfig, + team, + velocityFilterConfig, + videoCallRuleConfig, + ]); + + @override + String toString() { + return 'UpsertConfigRequest(aiAudioConfig: $aiAudioConfig, aiImageConfig: $aiImageConfig, aiTextConfig: $aiTextConfig, aiVideoConfig: $aiVideoConfig, async: $async, automodPlatformCircumventionConfig: $automodPlatformCircumventionConfig, automodSemanticFiltersConfig: $automodSemanticFiltersConfig, automodToxicityConfig: $automodToxicityConfig, awsRekognitionConfig: $awsRekognitionConfig, blockListConfig: $blockListConfig, bodyguardConfig: $bodyguardConfig, floodConfig: $floodConfig, googleVisionConfig: $googleVisionConfig, key: $key, llmConfig: $llmConfig, ruleBuilderConfig: $ruleBuilderConfig, team: $team, velocityFilterConfig: $velocityFilterConfig, videoCallRuleConfig: $videoCallRuleConfig)'; + } +} + +/// @nodoc +abstract mixin class $UpsertConfigRequestCopyWith<$Res> { + factory $UpsertConfigRequestCopyWith( + UpsertConfigRequest value, + $Res Function(UpsertConfigRequest) _then, + ) = _$UpsertConfigRequestCopyWithImpl; + @useResult + $Res call({ + AIAudioConfigRequest? aiAudioConfig, + AIImageConfig? aiImageConfig, + AITextConfig? aiTextConfig, + AIVideoConfig? aiVideoConfig, + bool? async, + AutomodPlatformCircumventionConfig? automodPlatformCircumventionConfig, + AutomodSemanticFiltersConfig? automodSemanticFiltersConfig, + AutomodToxicityConfig? automodToxicityConfig, + AIImageConfig? awsRekognitionConfig, + BlockListConfig? blockListConfig, + AITextConfig? bodyguardConfig, + FloodConfig? floodConfig, + GoogleVisionConfig? googleVisionConfig, + String key, + LLMConfig? llmConfig, + RuleBuilderConfig? ruleBuilderConfig, + String? team, + VelocityFilterConfig? velocityFilterConfig, + VideoCallRuleConfig? videoCallRuleConfig, + }); +} + +/// @nodoc +class _$UpsertConfigRequestCopyWithImpl<$Res> implements $UpsertConfigRequestCopyWith<$Res> { + _$UpsertConfigRequestCopyWithImpl(this._self, this._then); + + final UpsertConfigRequest _self; + final $Res Function(UpsertConfigRequest) _then; + + /// Create a copy of UpsertConfigRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? aiAudioConfig = freezed, + Object? aiImageConfig = freezed, + Object? aiTextConfig = freezed, + Object? aiVideoConfig = freezed, + Object? async = freezed, + Object? automodPlatformCircumventionConfig = freezed, + Object? automodSemanticFiltersConfig = freezed, + Object? automodToxicityConfig = freezed, + Object? awsRekognitionConfig = freezed, + Object? blockListConfig = freezed, + Object? bodyguardConfig = freezed, + Object? floodConfig = freezed, + Object? googleVisionConfig = freezed, + Object? key = null, + Object? llmConfig = freezed, + Object? ruleBuilderConfig = freezed, + Object? team = freezed, + Object? velocityFilterConfig = freezed, + Object? videoCallRuleConfig = freezed, + }) { + return _then( + UpsertConfigRequest( + aiAudioConfig: freezed == aiAudioConfig + ? _self.aiAudioConfig + : aiAudioConfig // ignore: cast_nullable_to_non_nullable + as AIAudioConfigRequest?, + aiImageConfig: freezed == aiImageConfig + ? _self.aiImageConfig + : aiImageConfig // ignore: cast_nullable_to_non_nullable + as AIImageConfig?, + aiTextConfig: freezed == aiTextConfig + ? _self.aiTextConfig + : aiTextConfig // ignore: cast_nullable_to_non_nullable + as AITextConfig?, + aiVideoConfig: freezed == aiVideoConfig + ? _self.aiVideoConfig + : aiVideoConfig // ignore: cast_nullable_to_non_nullable + as AIVideoConfig?, + async: freezed == async + ? _self.async + : async // ignore: cast_nullable_to_non_nullable + as bool?, + automodPlatformCircumventionConfig: freezed == automodPlatformCircumventionConfig + ? _self.automodPlatformCircumventionConfig + : automodPlatformCircumventionConfig // ignore: cast_nullable_to_non_nullable + as AutomodPlatformCircumventionConfig?, + automodSemanticFiltersConfig: freezed == automodSemanticFiltersConfig + ? _self.automodSemanticFiltersConfig + : automodSemanticFiltersConfig // ignore: cast_nullable_to_non_nullable + as AutomodSemanticFiltersConfig?, + automodToxicityConfig: freezed == automodToxicityConfig + ? _self.automodToxicityConfig + : automodToxicityConfig // ignore: cast_nullable_to_non_nullable + as AutomodToxicityConfig?, + awsRekognitionConfig: freezed == awsRekognitionConfig + ? _self.awsRekognitionConfig + : awsRekognitionConfig // ignore: cast_nullable_to_non_nullable + as AIImageConfig?, + blockListConfig: freezed == blockListConfig + ? _self.blockListConfig + : blockListConfig // ignore: cast_nullable_to_non_nullable + as BlockListConfig?, + bodyguardConfig: freezed == bodyguardConfig + ? _self.bodyguardConfig + : bodyguardConfig // ignore: cast_nullable_to_non_nullable + as AITextConfig?, + floodConfig: freezed == floodConfig + ? _self.floodConfig + : floodConfig // ignore: cast_nullable_to_non_nullable + as FloodConfig?, + googleVisionConfig: freezed == googleVisionConfig + ? _self.googleVisionConfig + : googleVisionConfig // ignore: cast_nullable_to_non_nullable + as GoogleVisionConfig?, + key: null == key + ? _self.key + : key // ignore: cast_nullable_to_non_nullable + as String, + llmConfig: freezed == llmConfig + ? _self.llmConfig + : llmConfig // ignore: cast_nullable_to_non_nullable + as LLMConfig?, + ruleBuilderConfig: freezed == ruleBuilderConfig + ? _self.ruleBuilderConfig + : ruleBuilderConfig // ignore: cast_nullable_to_non_nullable + as RuleBuilderConfig?, + team: freezed == team + ? _self.team + : team // ignore: cast_nullable_to_non_nullable + as String?, + velocityFilterConfig: freezed == velocityFilterConfig + ? _self.velocityFilterConfig + : velocityFilterConfig // ignore: cast_nullable_to_non_nullable + as VelocityFilterConfig?, + videoCallRuleConfig: freezed == videoCallRuleConfig + ? _self.videoCallRuleConfig + : videoCallRuleConfig // ignore: cast_nullable_to_non_nullable + as VideoCallRuleConfig?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/upsert_config_request.g.dart b/packages/stream_chat/lib/open_api/model/upsert_config_request.g.dart new file mode 100644 index 0000000000..445afa12bf --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/upsert_config_request.g.dart @@ -0,0 +1,103 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'upsert_config_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UpsertConfigRequest _$UpsertConfigRequestFromJson( + Map json, +) => UpsertConfigRequest( + aiAudioConfig: json['ai_audio_config'] == null + ? null + : AIAudioConfigRequest.fromJson( + json['ai_audio_config'] as Map, + ), + aiImageConfig: json['ai_image_config'] == null + ? null + : AIImageConfig.fromJson(json['ai_image_config'] as Map), + aiTextConfig: json['ai_text_config'] == null + ? null + : AITextConfig.fromJson(json['ai_text_config'] as Map), + aiVideoConfig: json['ai_video_config'] == null + ? null + : AIVideoConfig.fromJson(json['ai_video_config'] as Map), + async: json['async'] as bool?, + automodPlatformCircumventionConfig: json['automod_platform_circumvention_config'] == null + ? null + : AutomodPlatformCircumventionConfig.fromJson( + json['automod_platform_circumvention_config'] as Map, + ), + automodSemanticFiltersConfig: json['automod_semantic_filters_config'] == null + ? null + : AutomodSemanticFiltersConfig.fromJson( + json['automod_semantic_filters_config'] as Map, + ), + automodToxicityConfig: json['automod_toxicity_config'] == null + ? null + : AutomodToxicityConfig.fromJson( + json['automod_toxicity_config'] as Map, + ), + awsRekognitionConfig: json['aws_rekognition_config'] == null + ? null + : AIImageConfig.fromJson( + json['aws_rekognition_config'] as Map, + ), + blockListConfig: json['block_list_config'] == null + ? null + : BlockListConfig.fromJson( + json['block_list_config'] as Map, + ), + bodyguardConfig: json['bodyguard_config'] == null + ? null + : AITextConfig.fromJson(json['bodyguard_config'] as Map), + floodConfig: json['flood_config'] == null ? null : FloodConfig.fromJson(json['flood_config'] as Map), + googleVisionConfig: json['google_vision_config'] == null + ? null + : GoogleVisionConfig.fromJson( + json['google_vision_config'] as Map, + ), + key: json['key'] as String, + llmConfig: json['llm_config'] == null ? null : LLMConfig.fromJson(json['llm_config'] as Map), + ruleBuilderConfig: json['rule_builder_config'] == null + ? null + : RuleBuilderConfig.fromJson( + json['rule_builder_config'] as Map, + ), + team: json['team'] as String?, + velocityFilterConfig: json['velocity_filter_config'] == null + ? null + : VelocityFilterConfig.fromJson( + json['velocity_filter_config'] as Map, + ), + videoCallRuleConfig: json['video_call_rule_config'] == null + ? null + : VideoCallRuleConfig.fromJson( + json['video_call_rule_config'] as Map, + ), +); + +Map _$UpsertConfigRequestToJson( + UpsertConfigRequest instance, +) => { + 'ai_audio_config': instance.aiAudioConfig?.toJson(), + 'ai_image_config': instance.aiImageConfig?.toJson(), + 'ai_text_config': instance.aiTextConfig?.toJson(), + 'ai_video_config': instance.aiVideoConfig?.toJson(), + 'async': instance.async, + 'automod_platform_circumvention_config': instance.automodPlatformCircumventionConfig?.toJson(), + 'automod_semantic_filters_config': instance.automodSemanticFiltersConfig?.toJson(), + 'automod_toxicity_config': instance.automodToxicityConfig?.toJson(), + 'aws_rekognition_config': instance.awsRekognitionConfig?.toJson(), + 'block_list_config': instance.blockListConfig?.toJson(), + 'bodyguard_config': instance.bodyguardConfig?.toJson(), + 'flood_config': instance.floodConfig?.toJson(), + 'google_vision_config': instance.googleVisionConfig?.toJson(), + 'key': instance.key, + 'llm_config': instance.llmConfig?.toJson(), + 'rule_builder_config': instance.ruleBuilderConfig?.toJson(), + 'team': instance.team, + 'velocity_filter_config': instance.velocityFilterConfig?.toJson(), + 'video_call_rule_config': instance.videoCallRuleConfig?.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/upsert_config_response.dart b/packages/stream_chat/lib/open_api/model/upsert_config_response.dart new file mode 100644 index 0000000000..64a933ddc2 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/upsert_config_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'upsert_config_response.g.dart'; +part 'upsert_config_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UpsertConfigResponse with _$UpsertConfigResponse { + const UpsertConfigResponse({ + this.config, + required this.duration, + }); + + @override + @JsonKey(name: 'config') + final ConfigResponse? config; + + @override + @JsonKey(name: 'duration') + final String duration; + + Map toJson() => _$UpsertConfigResponseToJson(this); + + static UpsertConfigResponse fromJson(Map json) => _$UpsertConfigResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/upsert_config_response.freezed.dart b/packages/stream_chat/lib/open_api/model/upsert_config_response.freezed.dart new file mode 100644 index 0000000000..5eacf5c209 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/upsert_config_response.freezed.dart @@ -0,0 +1,82 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'upsert_config_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpsertConfigResponse { + ConfigResponse? get config; + String get duration; + + /// Create a copy of UpsertConfigResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpsertConfigResponseCopyWith get copyWith => + _$UpsertConfigResponseCopyWithImpl( + this as UpsertConfigResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpsertConfigResponse && + (identical(other.config, config) || other.config == config) && + (identical(other.duration, duration) || other.duration == duration)); + } + + @override + int get hashCode => Object.hash(runtimeType, config, duration); + + @override + String toString() { + return 'UpsertConfigResponse(config: $config, duration: $duration)'; + } +} + +/// @nodoc +abstract mixin class $UpsertConfigResponseCopyWith<$Res> { + factory $UpsertConfigResponseCopyWith( + UpsertConfigResponse value, + $Res Function(UpsertConfigResponse) _then, + ) = _$UpsertConfigResponseCopyWithImpl; + @useResult + $Res call({ConfigResponse? config, String duration}); +} + +/// @nodoc +class _$UpsertConfigResponseCopyWithImpl<$Res> implements $UpsertConfigResponseCopyWith<$Res> { + _$UpsertConfigResponseCopyWithImpl(this._self, this._then); + + final UpsertConfigResponse _self; + final $Res Function(UpsertConfigResponse) _then; + + /// Create a copy of UpsertConfigResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? config = freezed, Object? duration = null}) { + return _then( + UpsertConfigResponse( + config: freezed == config + ? _self.config + : config // ignore: cast_nullable_to_non_nullable + as ConfigResponse?, + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/upsert_config_response.g.dart b/packages/stream_chat/lib/open_api/model/upsert_config_response.g.dart new file mode 100644 index 0000000000..b8c4cb24a0 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/upsert_config_response.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'upsert_config_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UpsertConfigResponse _$UpsertConfigResponseFromJson( + Map json, +) => UpsertConfigResponse( + config: json['config'] == null ? null : ConfigResponse.fromJson(json['config'] as Map), + duration: json['duration'] as String, +); + +Map _$UpsertConfigResponseToJson( + UpsertConfigResponse instance, +) => { + 'config': instance.config?.toJson(), + 'duration': instance.duration, +}; diff --git a/packages/stream_chat/lib/open_api/model/upsert_push_preferences_request.dart b/packages/stream_chat/lib/open_api/model/upsert_push_preferences_request.dart new file mode 100644 index 0000000000..b58878c1a1 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/upsert_push_preferences_request.dart @@ -0,0 +1,32 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'upsert_push_preferences_request.g.dart'; +part 'upsert_push_preferences_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UpsertPushPreferencesRequest with _$UpsertPushPreferencesRequest { + const UpsertPushPreferencesRequest({ + required this.preferences, + }); + + @override + @JsonKey(name: 'preferences') + final List preferences; + + Map toJson() => _$UpsertPushPreferencesRequestToJson(this); + + static UpsertPushPreferencesRequest fromJson(Map json) => + _$UpsertPushPreferencesRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/upsert_push_preferences_request.freezed.dart b/packages/stream_chat/lib/open_api/model/upsert_push_preferences_request.freezed.dart new file mode 100644 index 0000000000..351f785c67 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/upsert_push_preferences_request.freezed.dart @@ -0,0 +1,82 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'upsert_push_preferences_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpsertPushPreferencesRequest { + List get preferences; + + /// Create a copy of UpsertPushPreferencesRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpsertPushPreferencesRequestCopyWith get copyWith => + _$UpsertPushPreferencesRequestCopyWithImpl( + this as UpsertPushPreferencesRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpsertPushPreferencesRequest && + const DeepCollectionEquality().equals( + other.preferences, + preferences, + )); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(preferences), + ); + + @override + String toString() { + return 'UpsertPushPreferencesRequest(preferences: $preferences)'; + } +} + +/// @nodoc +abstract mixin class $UpsertPushPreferencesRequestCopyWith<$Res> { + factory $UpsertPushPreferencesRequestCopyWith( + UpsertPushPreferencesRequest value, + $Res Function(UpsertPushPreferencesRequest) _then, + ) = _$UpsertPushPreferencesRequestCopyWithImpl; + @useResult + $Res call({List preferences}); +} + +/// @nodoc +class _$UpsertPushPreferencesRequestCopyWithImpl<$Res> implements $UpsertPushPreferencesRequestCopyWith<$Res> { + _$UpsertPushPreferencesRequestCopyWithImpl(this._self, this._then); + + final UpsertPushPreferencesRequest _self; + final $Res Function(UpsertPushPreferencesRequest) _then; + + /// Create a copy of UpsertPushPreferencesRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? preferences = null}) { + return _then( + UpsertPushPreferencesRequest( + preferences: null == preferences + ? _self.preferences + : preferences // ignore: cast_nullable_to_non_nullable + as List, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/upsert_push_preferences_request.g.dart b/packages/stream_chat/lib/open_api/model/upsert_push_preferences_request.g.dart new file mode 100644 index 0000000000..a7dfeafb22 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/upsert_push_preferences_request.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'upsert_push_preferences_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UpsertPushPreferencesRequest _$UpsertPushPreferencesRequestFromJson( + Map json, +) => UpsertPushPreferencesRequest( + preferences: (json['preferences'] as List) + .map((e) => PushPreferenceInput.fromJson(e as Map)) + .toList(), +); + +Map _$UpsertPushPreferencesRequestToJson( + UpsertPushPreferencesRequest instance, +) => { + 'preferences': instance.preferences.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/upsert_push_preferences_response.dart b/packages/stream_chat/lib/open_api/model/upsert_push_preferences_response.dart new file mode 100644 index 0000000000..1d85bcea3a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/upsert_push_preferences_response.dart @@ -0,0 +1,42 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'upsert_push_preferences_response.g.dart'; +part 'upsert_push_preferences_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UpsertPushPreferencesResponse with _$UpsertPushPreferencesResponse { + const UpsertPushPreferencesResponse({ + required this.duration, + required this.userChannelPreferences, + required this.userPreferences, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'user_channel_preferences') + final Map> userChannelPreferences; + + @override + @JsonKey(name: 'user_preferences') + final Map userPreferences; + + Map toJson() => _$UpsertPushPreferencesResponseToJson(this); + + static UpsertPushPreferencesResponse fromJson(Map json) => + _$UpsertPushPreferencesResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/upsert_push_preferences_response.freezed.dart b/packages/stream_chat/lib/open_api/model/upsert_push_preferences_response.freezed.dart new file mode 100644 index 0000000000..69f611ba13 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/upsert_push_preferences_response.freezed.dart @@ -0,0 +1,107 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'upsert_push_preferences_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpsertPushPreferencesResponse { + String get duration; + Map> get userChannelPreferences; + Map get userPreferences; + + /// Create a copy of UpsertPushPreferencesResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpsertPushPreferencesResponseCopyWith get copyWith => + _$UpsertPushPreferencesResponseCopyWithImpl( + this as UpsertPushPreferencesResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpsertPushPreferencesResponse && + (identical(other.duration, duration) || other.duration == duration) && + const DeepCollectionEquality().equals( + other.userChannelPreferences, + userChannelPreferences, + ) && + const DeepCollectionEquality().equals( + other.userPreferences, + userPreferences, + )); + } + + @override + int get hashCode => Object.hash( + runtimeType, + duration, + const DeepCollectionEquality().hash(userChannelPreferences), + const DeepCollectionEquality().hash(userPreferences), + ); + + @override + String toString() { + return 'UpsertPushPreferencesResponse(duration: $duration, userChannelPreferences: $userChannelPreferences, userPreferences: $userPreferences)'; + } +} + +/// @nodoc +abstract mixin class $UpsertPushPreferencesResponseCopyWith<$Res> { + factory $UpsertPushPreferencesResponseCopyWith( + UpsertPushPreferencesResponse value, + $Res Function(UpsertPushPreferencesResponse) _then, + ) = _$UpsertPushPreferencesResponseCopyWithImpl; + @useResult + $Res call({ + String duration, + Map> userChannelPreferences, + Map userPreferences, + }); +} + +/// @nodoc +class _$UpsertPushPreferencesResponseCopyWithImpl<$Res> implements $UpsertPushPreferencesResponseCopyWith<$Res> { + _$UpsertPushPreferencesResponseCopyWithImpl(this._self, this._then); + + final UpsertPushPreferencesResponse _self; + final $Res Function(UpsertPushPreferencesResponse) _then; + + /// Create a copy of UpsertPushPreferencesResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? duration = null, + Object? userChannelPreferences = null, + Object? userPreferences = null, + }) { + return _then( + UpsertPushPreferencesResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + userChannelPreferences: null == userChannelPreferences + ? _self.userChannelPreferences + : userChannelPreferences // ignore: cast_nullable_to_non_nullable + as Map>, + userPreferences: null == userPreferences + ? _self.userPreferences + : userPreferences // ignore: cast_nullable_to_non_nullable + as Map, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/upsert_push_preferences_response.g.dart b/packages/stream_chat/lib/open_api/model/upsert_push_preferences_response.g.dart new file mode 100644 index 0000000000..dd1760479d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/upsert_push_preferences_response.g.dart @@ -0,0 +1,44 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'upsert_push_preferences_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UpsertPushPreferencesResponse _$UpsertPushPreferencesResponseFromJson( + Map json, +) => UpsertPushPreferencesResponse( + duration: json['duration'] as String, + userChannelPreferences: (json['user_channel_preferences'] as Map).map( + (k, e) => MapEntry( + k, + (e as Map).map( + (k, e) => MapEntry( + k, + ChannelPushPreferencesResponse.fromJson( + e as Map, + ), + ), + ), + ), + ), + userPreferences: (json['user_preferences'] as Map).map( + (k, e) => MapEntry( + k, + PushPreferencesResponse.fromJson(e as Map), + ), + ), +); + +Map _$UpsertPushPreferencesResponseToJson( + UpsertPushPreferencesResponse instance, +) => { + 'duration': instance.duration, + 'user_channel_preferences': instance.userChannelPreferences.map( + (k, e) => MapEntry(k, e.map((k, e) => MapEntry(k, e.toJson()))), + ), + 'user_preferences': instance.userPreferences.map( + (k, e) => MapEntry(k, e.toJson()), + ), +}; diff --git a/packages/stream_chat/lib/open_api/model/user.dart b/packages/stream_chat/lib/open_api/model/user.dart new file mode 100644 index 0000000000..f954b8ef81 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'user.g.dart'; +part 'user.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class User with _$User { + const User({ + this.data, + required this.id, + }); + + @override + @JsonKey(name: 'data') + final Map? data; + + @override + @JsonKey(name: 'id') + final String id; + + Map toJson() => _$UserToJson(this); + + static User fromJson(Map json) => _$UserFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/user.freezed.dart b/packages/stream_chat/lib/open_api/model/user.freezed.dart new file mode 100644 index 0000000000..f65d8df8e2 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user.freezed.dart @@ -0,0 +1,75 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'user.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$User { + Map? get data; + String get id; + + /// Create a copy of User + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UserCopyWith get copyWith => _$UserCopyWithImpl(this as User, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is User && + const DeepCollectionEquality().equals(other.data, data) && + (identical(other.id, id) || other.id == id)); + } + + @override + int get hashCode => Object.hash(runtimeType, const DeepCollectionEquality().hash(data), id); + + @override + String toString() { + return 'User(data: $data, id: $id)'; + } +} + +/// @nodoc +abstract mixin class $UserCopyWith<$Res> { + factory $UserCopyWith(User value, $Res Function(User) _then) = _$UserCopyWithImpl; + @useResult + $Res call({Map? data, String id}); +} + +/// @nodoc +class _$UserCopyWithImpl<$Res> implements $UserCopyWith<$Res> { + _$UserCopyWithImpl(this._self, this._then); + + final User _self; + final $Res Function(User) _then; + + /// Create a copy of User + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? data = freezed, Object? id = null}) { + return _then( + User( + data: freezed == data + ? _self.data + : data // ignore: cast_nullable_to_non_nullable + as Map?, + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/user.g.dart b/packages/stream_chat/lib/open_api/model/user.g.dart new file mode 100644 index 0000000000..062f967473 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user.g.dart @@ -0,0 +1,15 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'user.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +User _$UserFromJson(Map json) => + User(data: json['data'] as Map?, id: json['id'] as String); + +Map _$UserToJson(User instance) => { + 'data': instance.data, + 'id': instance.id, +}; diff --git a/packages/stream_chat/lib/open_api/model/user_banned_event.dart b/packages/stream_chat/lib/open_api/model/user_banned_event.dart new file mode 100644 index 0000000000..b689ad7961 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_banned_event.dart @@ -0,0 +1,119 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'user_banned_event.g.dart'; +part 'user_banned_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UserBannedEvent extends core.WsEvent with _$UserBannedEvent { + const UserBannedEvent({ + this.channelCustom, + this.channelId, + this.channelMemberCount, + this.channelMessageCount, + this.channelType, + this.cid, + required this.createdAt, + this.createdBy, + required this.custom, + this.expiration, + this.reason, + this.receivedAt, + this.reviewQueueItemId, + this.shadow, + this.team, + this.totalBans, + required this.type, + required this.user, + }); + + @override + @JsonKey(name: 'channel_custom') + final Map? channelCustom; + + @override + @JsonKey(name: 'channel_id') + final String? channelId; + + @override + @JsonKey(name: 'channel_member_count') + final int? channelMemberCount; + + @override + @JsonKey(name: 'channel_message_count') + final int? channelMessageCount; + + @override + @JsonKey(name: 'channel_type') + final String? channelType; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'created_by') + final UserResponseCommonFields? createdBy; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'expiration') + final DateTime? expiration; + + @override + @JsonKey(name: 'reason') + final String? reason; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'review_queue_item_id') + final String? reviewQueueItemId; + + @override + @JsonKey(name: 'shadow') + final bool? shadow; + + @override + @JsonKey(name: 'team') + final String? team; + + @override + @JsonKey(name: 'total_bans') + final int? totalBans; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'user') + final UserResponseCommonFields user; + + Map toJson() => _$UserBannedEventToJson(this); + + static UserBannedEvent fromJson(Map json) => _$UserBannedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/user_banned_event.freezed.dart b/packages/stream_chat/lib/open_api/model/user_banned_event.freezed.dart new file mode 100644 index 0000000000..f2b21db430 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_banned_event.freezed.dart @@ -0,0 +1,240 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'user_banned_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UserBannedEvent { + Map? get channelCustom; + String? get channelId; + int? get channelMemberCount; + int? get channelMessageCount; + String? get channelType; + String? get cid; + DateTime get createdAt; + UserResponseCommonFields? get createdBy; + Map get custom; + DateTime? get expiration; + String? get reason; + DateTime? get receivedAt; + String? get reviewQueueItemId; + bool? get shadow; + String? get team; + int? get totalBans; + String get type; + UserResponseCommonFields get user; + + /// Create a copy of UserBannedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UserBannedEventCopyWith get copyWith => _$UserBannedEventCopyWithImpl( + this as UserBannedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UserBannedEvent && + const DeepCollectionEquality().equals( + other.channelCustom, + channelCustom, + ) && + (identical(other.channelId, channelId) || other.channelId == channelId) && + (identical(other.channelMemberCount, channelMemberCount) || + other.channelMemberCount == channelMemberCount) && + (identical(other.channelMessageCount, channelMessageCount) || + other.channelMessageCount == channelMessageCount) && + (identical(other.channelType, channelType) || other.channelType == channelType) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.createdBy, createdBy) || other.createdBy == createdBy) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.expiration, expiration) || other.expiration == expiration) && + (identical(other.reason, reason) || other.reason == reason) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.reviewQueueItemId, reviewQueueItemId) || other.reviewQueueItemId == reviewQueueItemId) && + (identical(other.shadow, shadow) || other.shadow == shadow) && + (identical(other.team, team) || other.team == team) && + (identical(other.totalBans, totalBans) || other.totalBans == totalBans) && + (identical(other.type, type) || other.type == type) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(channelCustom), + channelId, + channelMemberCount, + channelMessageCount, + channelType, + cid, + createdAt, + createdBy, + const DeepCollectionEquality().hash(custom), + expiration, + reason, + receivedAt, + reviewQueueItemId, + shadow, + team, + totalBans, + type, + user, + ); + + @override + String toString() { + return 'UserBannedEvent(channelCustom: $channelCustom, channelId: $channelId, channelMemberCount: $channelMemberCount, channelMessageCount: $channelMessageCount, channelType: $channelType, cid: $cid, createdAt: $createdAt, createdBy: $createdBy, custom: $custom, expiration: $expiration, reason: $reason, receivedAt: $receivedAt, reviewQueueItemId: $reviewQueueItemId, shadow: $shadow, team: $team, totalBans: $totalBans, type: $type, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $UserBannedEventCopyWith<$Res> { + factory $UserBannedEventCopyWith( + UserBannedEvent value, + $Res Function(UserBannedEvent) _then, + ) = _$UserBannedEventCopyWithImpl; + @useResult + $Res call({ + Map? channelCustom, + String? channelId, + int? channelMemberCount, + int? channelMessageCount, + String? channelType, + String? cid, + DateTime createdAt, + UserResponseCommonFields? createdBy, + Map custom, + DateTime? expiration, + String? reason, + DateTime? receivedAt, + String? reviewQueueItemId, + bool? shadow, + String? team, + int? totalBans, + String type, + UserResponseCommonFields user, + }); +} + +/// @nodoc +class _$UserBannedEventCopyWithImpl<$Res> implements $UserBannedEventCopyWith<$Res> { + _$UserBannedEventCopyWithImpl(this._self, this._then); + + final UserBannedEvent _self; + final $Res Function(UserBannedEvent) _then; + + /// Create a copy of UserBannedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channelCustom = freezed, + Object? channelId = freezed, + Object? channelMemberCount = freezed, + Object? channelMessageCount = freezed, + Object? channelType = freezed, + Object? cid = freezed, + Object? createdAt = null, + Object? createdBy = freezed, + Object? custom = null, + Object? expiration = freezed, + Object? reason = freezed, + Object? receivedAt = freezed, + Object? reviewQueueItemId = freezed, + Object? shadow = freezed, + Object? team = freezed, + Object? totalBans = freezed, + Object? type = null, + Object? user = null, + }) { + return _then( + UserBannedEvent( + channelCustom: freezed == channelCustom + ? _self.channelCustom + : channelCustom // ignore: cast_nullable_to_non_nullable + as Map?, + channelId: freezed == channelId + ? _self.channelId + : channelId // ignore: cast_nullable_to_non_nullable + as String?, + channelMemberCount: freezed == channelMemberCount + ? _self.channelMemberCount + : channelMemberCount // ignore: cast_nullable_to_non_nullable + as int?, + channelMessageCount: freezed == channelMessageCount + ? _self.channelMessageCount + : channelMessageCount // ignore: cast_nullable_to_non_nullable + as int?, + channelType: freezed == channelType + ? _self.channelType + : channelType // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + createdBy: freezed == createdBy + ? _self.createdBy + : createdBy // ignore: cast_nullable_to_non_nullable + as UserResponseCommonFields?, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + expiration: freezed == expiration + ? _self.expiration + : expiration // ignore: cast_nullable_to_non_nullable + as DateTime?, + reason: freezed == reason + ? _self.reason + : reason // ignore: cast_nullable_to_non_nullable + as String?, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + reviewQueueItemId: freezed == reviewQueueItemId + ? _self.reviewQueueItemId + : reviewQueueItemId // ignore: cast_nullable_to_non_nullable + as String?, + shadow: freezed == shadow + ? _self.shadow + : shadow // ignore: cast_nullable_to_non_nullable + as bool?, + team: freezed == team + ? _self.team + : team // ignore: cast_nullable_to_non_nullable + as String?, + totalBans: freezed == totalBans + ? _self.totalBans + : totalBans // ignore: cast_nullable_to_non_nullable + as int?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + user: null == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponseCommonFields, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/user_banned_event.g.dart b/packages/stream_chat/lib/open_api/model/user_banned_event.g.dart new file mode 100644 index 0000000000..19e683efa5 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_banned_event.g.dart @@ -0,0 +1,79 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'user_banned_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UserBannedEvent _$UserBannedEventFromJson(Map json) => UserBannedEvent( + channelCustom: json['channel_custom'] as Map?, + channelId: json['channel_id'] as String?, + channelMemberCount: (json['channel_member_count'] as num?)?.toInt(), + channelMessageCount: (json['channel_message_count'] as num?)?.toInt(), + channelType: json['channel_type'] as String?, + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + createdBy: json['created_by'] == null + ? null + : UserResponseCommonFields.fromJson( + json['created_by'] as Map, + ), + custom: json['custom'] as Map, + expiration: _$JsonConverterFromJson( + json['expiration'], + const StreamDateTimeConverter().fromJson, + ), + reason: json['reason'] as String?, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + reviewQueueItemId: json['review_queue_item_id'] as String?, + shadow: json['shadow'] as bool?, + team: json['team'] as String?, + totalBans: (json['total_bans'] as num?)?.toInt(), + type: json['type'] as String, + user: UserResponseCommonFields.fromJson( + json['user'] as Map, + ), +); + +Map _$UserBannedEventToJson(UserBannedEvent instance) => { + 'channel_custom': instance.channelCustom, + 'channel_id': instance.channelId, + 'channel_member_count': instance.channelMemberCount, + 'channel_message_count': instance.channelMessageCount, + 'channel_type': instance.channelType, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'created_by': instance.createdBy?.toJson(), + 'custom': instance.custom, + 'expiration': _$JsonConverterToJson( + instance.expiration, + const StreamDateTimeConverter().toJson, + ), + 'reason': instance.reason, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'review_queue_item_id': instance.reviewQueueItemId, + 'shadow': instance.shadow, + 'team': instance.team, + 'total_bans': instance.totalBans, + 'type': instance.type, + 'user': instance.user.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/user_created_within_parameters.dart b/packages/stream_chat/lib/open_api/model/user_created_within_parameters.dart new file mode 100644 index 0000000000..24fc09c6e5 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_created_within_parameters.dart @@ -0,0 +1,31 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'user_created_within_parameters.g.dart'; +part 'user_created_within_parameters.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UserCreatedWithinParameters with _$UserCreatedWithinParameters { + const UserCreatedWithinParameters({ + this.maxAge, + }); + + @override + @JsonKey(name: 'max_age') + final String? maxAge; + + Map toJson() => _$UserCreatedWithinParametersToJson(this); + + static UserCreatedWithinParameters fromJson(Map json) => _$UserCreatedWithinParametersFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/user_created_within_parameters.freezed.dart b/packages/stream_chat/lib/open_api/model/user_created_within_parameters.freezed.dart new file mode 100644 index 0000000000..0265d67a32 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_created_within_parameters.freezed.dart @@ -0,0 +1,76 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'user_created_within_parameters.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UserCreatedWithinParameters { + String? get maxAge; + + /// Create a copy of UserCreatedWithinParameters + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UserCreatedWithinParametersCopyWith get copyWith => + _$UserCreatedWithinParametersCopyWithImpl( + this as UserCreatedWithinParameters, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UserCreatedWithinParameters && + (identical(other.maxAge, maxAge) || other.maxAge == maxAge)); + } + + @override + int get hashCode => Object.hash(runtimeType, maxAge); + + @override + String toString() { + return 'UserCreatedWithinParameters(maxAge: $maxAge)'; + } +} + +/// @nodoc +abstract mixin class $UserCreatedWithinParametersCopyWith<$Res> { + factory $UserCreatedWithinParametersCopyWith( + UserCreatedWithinParameters value, + $Res Function(UserCreatedWithinParameters) _then, + ) = _$UserCreatedWithinParametersCopyWithImpl; + @useResult + $Res call({String? maxAge}); +} + +/// @nodoc +class _$UserCreatedWithinParametersCopyWithImpl<$Res> implements $UserCreatedWithinParametersCopyWith<$Res> { + _$UserCreatedWithinParametersCopyWithImpl(this._self, this._then); + + final UserCreatedWithinParameters _self; + final $Res Function(UserCreatedWithinParameters) _then; + + /// Create a copy of UserCreatedWithinParameters + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? maxAge = freezed}) { + return _then( + UserCreatedWithinParameters( + maxAge: freezed == maxAge + ? _self.maxAge + : maxAge // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/user_created_within_parameters.g.dart b/packages/stream_chat/lib/open_api/model/user_created_within_parameters.g.dart new file mode 100644 index 0000000000..583d195147 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_created_within_parameters.g.dart @@ -0,0 +1,15 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'user_created_within_parameters.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UserCreatedWithinParameters _$UserCreatedWithinParametersFromJson( + Map json, +) => UserCreatedWithinParameters(maxAge: json['max_age'] as String?); + +Map _$UserCreatedWithinParametersToJson( + UserCreatedWithinParameters instance, +) => {'max_age': instance.maxAge}; diff --git a/packages/stream_chat/lib/open_api/model/user_custom_property_parameters.dart b/packages/stream_chat/lib/open_api/model/user_custom_property_parameters.dart new file mode 100644 index 0000000000..29cdd9b804 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_custom_property_parameters.dart @@ -0,0 +1,37 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'user_custom_property_parameters.g.dart'; +part 'user_custom_property_parameters.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UserCustomPropertyParameters with _$UserCustomPropertyParameters { + const UserCustomPropertyParameters({ + this.operator, + this.propertyKey, + }); + + @override + @JsonKey(name: 'operator') + final String? operator; + + @override + @JsonKey(name: 'property_key') + final String? propertyKey; + + Map toJson() => _$UserCustomPropertyParametersToJson(this); + + static UserCustomPropertyParameters fromJson(Map json) => + _$UserCustomPropertyParametersFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/user_custom_property_parameters.freezed.dart b/packages/stream_chat/lib/open_api/model/user_custom_property_parameters.freezed.dart new file mode 100644 index 0000000000..6c407da579 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_custom_property_parameters.freezed.dart @@ -0,0 +1,82 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'user_custom_property_parameters.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UserCustomPropertyParameters { + String? get operator; + String? get propertyKey; + + /// Create a copy of UserCustomPropertyParameters + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UserCustomPropertyParametersCopyWith get copyWith => + _$UserCustomPropertyParametersCopyWithImpl( + this as UserCustomPropertyParameters, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UserCustomPropertyParameters && + (identical(other.operator, operator) || other.operator == operator) && + (identical(other.propertyKey, propertyKey) || other.propertyKey == propertyKey)); + } + + @override + int get hashCode => Object.hash(runtimeType, operator, propertyKey); + + @override + String toString() { + return 'UserCustomPropertyParameters(operator: $operator, propertyKey: $propertyKey)'; + } +} + +/// @nodoc +abstract mixin class $UserCustomPropertyParametersCopyWith<$Res> { + factory $UserCustomPropertyParametersCopyWith( + UserCustomPropertyParameters value, + $Res Function(UserCustomPropertyParameters) _then, + ) = _$UserCustomPropertyParametersCopyWithImpl; + @useResult + $Res call({String? operator, String? propertyKey}); +} + +/// @nodoc +class _$UserCustomPropertyParametersCopyWithImpl<$Res> implements $UserCustomPropertyParametersCopyWith<$Res> { + _$UserCustomPropertyParametersCopyWithImpl(this._self, this._then); + + final UserCustomPropertyParameters _self; + final $Res Function(UserCustomPropertyParameters) _then; + + /// Create a copy of UserCustomPropertyParameters + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? operator = freezed, Object? propertyKey = freezed}) { + return _then( + UserCustomPropertyParameters( + operator: freezed == operator + ? _self.operator + : operator // ignore: cast_nullable_to_non_nullable + as String?, + propertyKey: freezed == propertyKey + ? _self.propertyKey + : propertyKey // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/user_custom_property_parameters.g.dart b/packages/stream_chat/lib/open_api/model/user_custom_property_parameters.g.dart new file mode 100644 index 0000000000..0150419bf8 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_custom_property_parameters.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'user_custom_property_parameters.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UserCustomPropertyParameters _$UserCustomPropertyParametersFromJson( + Map json, +) => UserCustomPropertyParameters( + operator: json['operator'] as String?, + propertyKey: json['property_key'] as String?, +); + +Map _$UserCustomPropertyParametersToJson( + UserCustomPropertyParameters instance, +) => { + 'operator': instance.operator, + 'property_key': instance.propertyKey, +}; diff --git a/packages/stream_chat/lib/open_api/model/user_deactivated_event.dart b/packages/stream_chat/lib/open_api/model/user_deactivated_event.dart new file mode 100644 index 0000000000..8f760470a9 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_deactivated_event.dart @@ -0,0 +1,58 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'user_deactivated_event.g.dart'; +part 'user_deactivated_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UserDeactivatedEvent extends core.WsEvent with _$UserDeactivatedEvent { + const UserDeactivatedEvent({ + required this.createdAt, + this.createdBy, + required this.custom, + this.receivedAt, + required this.type, + required this.user, + }); + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'created_by') + final UserResponseCommonFields? createdBy; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'user') + final UserResponseCommonFields user; + + Map toJson() => _$UserDeactivatedEventToJson(this); + + static UserDeactivatedEvent fromJson(Map json) => _$UserDeactivatedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/user_deactivated_event.freezed.dart b/packages/stream_chat/lib/open_api/model/user_deactivated_event.freezed.dart new file mode 100644 index 0000000000..c4fd3e5ee8 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_deactivated_event.freezed.dart @@ -0,0 +1,128 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'user_deactivated_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UserDeactivatedEvent { + DateTime get createdAt; + UserResponseCommonFields? get createdBy; + Map get custom; + DateTime? get receivedAt; + String get type; + UserResponseCommonFields get user; + + /// Create a copy of UserDeactivatedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UserDeactivatedEventCopyWith get copyWith => + _$UserDeactivatedEventCopyWithImpl( + this as UserDeactivatedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UserDeactivatedEvent && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.createdBy, createdBy) || other.createdBy == createdBy) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.type, type) || other.type == type) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + createdAt, + createdBy, + const DeepCollectionEquality().hash(custom), + receivedAt, + type, + user, + ); + + @override + String toString() { + return 'UserDeactivatedEvent(createdAt: $createdAt, createdBy: $createdBy, custom: $custom, receivedAt: $receivedAt, type: $type, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $UserDeactivatedEventCopyWith<$Res> { + factory $UserDeactivatedEventCopyWith( + UserDeactivatedEvent value, + $Res Function(UserDeactivatedEvent) _then, + ) = _$UserDeactivatedEventCopyWithImpl; + @useResult + $Res call({ + DateTime createdAt, + UserResponseCommonFields? createdBy, + Map custom, + DateTime? receivedAt, + String type, + UserResponseCommonFields user, + }); +} + +/// @nodoc +class _$UserDeactivatedEventCopyWithImpl<$Res> implements $UserDeactivatedEventCopyWith<$Res> { + _$UserDeactivatedEventCopyWithImpl(this._self, this._then); + + final UserDeactivatedEvent _self; + final $Res Function(UserDeactivatedEvent) _then; + + /// Create a copy of UserDeactivatedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? createdAt = null, + Object? createdBy = freezed, + Object? custom = null, + Object? receivedAt = freezed, + Object? type = null, + Object? user = null, + }) { + return _then( + UserDeactivatedEvent( + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + createdBy: freezed == createdBy + ? _self.createdBy + : createdBy // ignore: cast_nullable_to_non_nullable + as UserResponseCommonFields?, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + user: null == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponseCommonFields, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/user_deactivated_event.g.dart b/packages/stream_chat/lib/open_api/model/user_deactivated_event.g.dart new file mode 100644 index 0000000000..7170f99c20 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_deactivated_event.g.dart @@ -0,0 +1,51 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'user_deactivated_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UserDeactivatedEvent _$UserDeactivatedEventFromJson( + Map json, +) => UserDeactivatedEvent( + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + createdBy: json['created_by'] == null + ? null + : UserResponseCommonFields.fromJson( + json['created_by'] as Map, + ), + custom: json['custom'] as Map, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + type: json['type'] as String, + user: UserResponseCommonFields.fromJson(json['user'] as Map), +); + +Map _$UserDeactivatedEventToJson( + UserDeactivatedEvent instance, +) => { + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'created_by': instance.createdBy?.toJson(), + 'custom': instance.custom, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'type': instance.type, + 'user': instance.user.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/user_deleted_event.dart b/packages/stream_chat/lib/open_api/model/user_deleted_event.dart new file mode 100644 index 0000000000..23a4d823ed --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_deleted_event.dart @@ -0,0 +1,83 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'user_deleted_event.g.dart'; +part 'user_deleted_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UserDeletedEvent extends core.WsEvent with _$UserDeletedEvent { + const UserDeletedEvent({ + required this.createdAt, + required this.custom, + required this.deleteConversation, + required this.deleteConversationChannels, + required this.deleteMessages, + required this.deleteUser, + required this.hardDelete, + required this.markMessagesDeleted, + this.receivedAt, + required this.type, + required this.user, + }); + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'delete_conversation') + final String deleteConversation; + + @override + @JsonKey(name: 'delete_conversation_channels') + final bool deleteConversationChannels; + + @override + @JsonKey(name: 'delete_messages') + final String deleteMessages; + + @override + @JsonKey(name: 'delete_user') + final String deleteUser; + + @override + @JsonKey(name: 'hard_delete') + final bool hardDelete; + + @override + @JsonKey(name: 'mark_messages_deleted') + final bool markMessagesDeleted; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'user') + final UserResponseCommonFields user; + + Map toJson() => _$UserDeletedEventToJson(this); + + static UserDeletedEvent fromJson(Map json) => _$UserDeletedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/user_deleted_event.freezed.dart b/packages/stream_chat/lib/open_api/model/user_deleted_event.freezed.dart new file mode 100644 index 0000000000..402bb61c2b --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_deleted_event.freezed.dart @@ -0,0 +1,178 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'user_deleted_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UserDeletedEvent { + DateTime get createdAt; + Map get custom; + String get deleteConversation; + bool get deleteConversationChannels; + String get deleteMessages; + String get deleteUser; + bool get hardDelete; + bool get markMessagesDeleted; + DateTime? get receivedAt; + String get type; + UserResponseCommonFields get user; + + /// Create a copy of UserDeletedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UserDeletedEventCopyWith get copyWith => _$UserDeletedEventCopyWithImpl( + this as UserDeletedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UserDeletedEvent && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.deleteConversation, deleteConversation) || + other.deleteConversation == deleteConversation) && + (identical( + other.deleteConversationChannels, + deleteConversationChannels, + ) || + other.deleteConversationChannels == deleteConversationChannels) && + (identical(other.deleteMessages, deleteMessages) || other.deleteMessages == deleteMessages) && + (identical(other.deleteUser, deleteUser) || other.deleteUser == deleteUser) && + (identical(other.hardDelete, hardDelete) || other.hardDelete == hardDelete) && + (identical(other.markMessagesDeleted, markMessagesDeleted) || + other.markMessagesDeleted == markMessagesDeleted) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.type, type) || other.type == type) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + createdAt, + const DeepCollectionEquality().hash(custom), + deleteConversation, + deleteConversationChannels, + deleteMessages, + deleteUser, + hardDelete, + markMessagesDeleted, + receivedAt, + type, + user, + ); + + @override + String toString() { + return 'UserDeletedEvent(createdAt: $createdAt, custom: $custom, deleteConversation: $deleteConversation, deleteConversationChannels: $deleteConversationChannels, deleteMessages: $deleteMessages, deleteUser: $deleteUser, hardDelete: $hardDelete, markMessagesDeleted: $markMessagesDeleted, receivedAt: $receivedAt, type: $type, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $UserDeletedEventCopyWith<$Res> { + factory $UserDeletedEventCopyWith( + UserDeletedEvent value, + $Res Function(UserDeletedEvent) _then, + ) = _$UserDeletedEventCopyWithImpl; + @useResult + $Res call({ + DateTime createdAt, + Map custom, + String deleteConversation, + bool deleteConversationChannels, + String deleteMessages, + String deleteUser, + bool hardDelete, + bool markMessagesDeleted, + DateTime? receivedAt, + String type, + UserResponseCommonFields user, + }); +} + +/// @nodoc +class _$UserDeletedEventCopyWithImpl<$Res> implements $UserDeletedEventCopyWith<$Res> { + _$UserDeletedEventCopyWithImpl(this._self, this._then); + + final UserDeletedEvent _self; + final $Res Function(UserDeletedEvent) _then; + + /// Create a copy of UserDeletedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? createdAt = null, + Object? custom = null, + Object? deleteConversation = null, + Object? deleteConversationChannels = null, + Object? deleteMessages = null, + Object? deleteUser = null, + Object? hardDelete = null, + Object? markMessagesDeleted = null, + Object? receivedAt = freezed, + Object? type = null, + Object? user = null, + }) { + return _then( + UserDeletedEvent( + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + deleteConversation: null == deleteConversation + ? _self.deleteConversation + : deleteConversation // ignore: cast_nullable_to_non_nullable + as String, + deleteConversationChannels: null == deleteConversationChannels + ? _self.deleteConversationChannels + : deleteConversationChannels // ignore: cast_nullable_to_non_nullable + as bool, + deleteMessages: null == deleteMessages + ? _self.deleteMessages + : deleteMessages // ignore: cast_nullable_to_non_nullable + as String, + deleteUser: null == deleteUser + ? _self.deleteUser + : deleteUser // ignore: cast_nullable_to_non_nullable + as String, + hardDelete: null == hardDelete + ? _self.hardDelete + : hardDelete // ignore: cast_nullable_to_non_nullable + as bool, + markMessagesDeleted: null == markMessagesDeleted + ? _self.markMessagesDeleted + : markMessagesDeleted // ignore: cast_nullable_to_non_nullable + as bool, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + user: null == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponseCommonFields, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/user_deleted_event.g.dart b/packages/stream_chat/lib/open_api/model/user_deleted_event.g.dart new file mode 100644 index 0000000000..d6d42632fa --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_deleted_event.g.dart @@ -0,0 +1,55 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'user_deleted_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UserDeletedEvent _$UserDeletedEventFromJson(Map json) => UserDeletedEvent( + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + deleteConversation: json['delete_conversation'] as String, + deleteConversationChannels: json['delete_conversation_channels'] as bool, + deleteMessages: json['delete_messages'] as String, + deleteUser: json['delete_user'] as String, + hardDelete: json['hard_delete'] as bool, + markMessagesDeleted: json['mark_messages_deleted'] as bool, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + type: json['type'] as String, + user: UserResponseCommonFields.fromJson( + json['user'] as Map, + ), +); + +Map _$UserDeletedEventToJson(UserDeletedEvent instance) => { + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'delete_conversation': instance.deleteConversation, + 'delete_conversation_channels': instance.deleteConversationChannels, + 'delete_messages': instance.deleteMessages, + 'delete_user': instance.deleteUser, + 'hard_delete': instance.hardDelete, + 'mark_messages_deleted': instance.markMessagesDeleted, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'type': instance.type, + 'user': instance.user.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/user_group.dart b/packages/stream_chat/lib/open_api/model/user_group.dart new file mode 100644 index 0000000000..c883522cb4 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_group.dart @@ -0,0 +1,73 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'user_group.g.dart'; +part 'user_group.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UserGroup with _$UserGroup { + const UserGroup({ + required this.appPk, + required this.createdAt, + this.createdBy, + this.description, + required this.id, + this.members, + required this.name, + this.teamId, + required this.updatedAt, + }); + + @override + @JsonKey(name: 'app_pk') + final int appPk; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'created_by') + final String? createdBy; + + @override + @JsonKey(name: 'description') + final String? description; + + @override + @JsonKey(name: 'id') + final String id; + + @override + @JsonKey(name: 'members') + final List? members; + + @override + @JsonKey(name: 'name') + final String name; + + @override + @JsonKey(name: 'team_id') + final String? teamId; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'updated_at') + final DateTime updatedAt; + + Map toJson() => _$UserGroupToJson(this); + + static UserGroup fromJson(Map json) => _$UserGroupFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/user_group.freezed.dart b/packages/stream_chat/lib/open_api/model/user_group.freezed.dart new file mode 100644 index 0000000000..12baced523 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_group.freezed.dart @@ -0,0 +1,148 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'user_group.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UserGroup { + int get appPk; + DateTime get createdAt; + String? get createdBy; + String? get description; + String get id; + List? get members; + String get name; + String? get teamId; + DateTime get updatedAt; + + /// Create a copy of UserGroup + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UserGroupCopyWith get copyWith => _$UserGroupCopyWithImpl(this as UserGroup, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UserGroup && + (identical(other.appPk, appPk) || other.appPk == appPk) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.createdBy, createdBy) || other.createdBy == createdBy) && + (identical(other.description, description) || other.description == description) && + (identical(other.id, id) || other.id == id) && + const DeepCollectionEquality().equals(other.members, members) && + (identical(other.name, name) || other.name == name) && + (identical(other.teamId, teamId) || other.teamId == teamId) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + appPk, + createdAt, + createdBy, + description, + id, + const DeepCollectionEquality().hash(members), + name, + teamId, + updatedAt, + ); + + @override + String toString() { + return 'UserGroup(appPk: $appPk, createdAt: $createdAt, createdBy: $createdBy, description: $description, id: $id, members: $members, name: $name, teamId: $teamId, updatedAt: $updatedAt)'; + } +} + +/// @nodoc +abstract mixin class $UserGroupCopyWith<$Res> { + factory $UserGroupCopyWith(UserGroup value, $Res Function(UserGroup) _then) = _$UserGroupCopyWithImpl; + @useResult + $Res call({ + int appPk, + DateTime createdAt, + String? createdBy, + String? description, + String id, + List? members, + String name, + String? teamId, + DateTime updatedAt, + }); +} + +/// @nodoc +class _$UserGroupCopyWithImpl<$Res> implements $UserGroupCopyWith<$Res> { + _$UserGroupCopyWithImpl(this._self, this._then); + + final UserGroup _self; + final $Res Function(UserGroup) _then; + + /// Create a copy of UserGroup + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? appPk = null, + Object? createdAt = null, + Object? createdBy = freezed, + Object? description = freezed, + Object? id = null, + Object? members = freezed, + Object? name = null, + Object? teamId = freezed, + Object? updatedAt = null, + }) { + return _then( + UserGroup( + appPk: null == appPk + ? _self.appPk + : appPk // ignore: cast_nullable_to_non_nullable + as int, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + createdBy: freezed == createdBy + ? _self.createdBy + : createdBy // ignore: cast_nullable_to_non_nullable + as String?, + description: freezed == description + ? _self.description + : description // ignore: cast_nullable_to_non_nullable + as String?, + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + members: freezed == members + ? _self.members + : members // ignore: cast_nullable_to_non_nullable + as List?, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + teamId: freezed == teamId + ? _self.teamId + : teamId // ignore: cast_nullable_to_non_nullable + as String?, + updatedAt: null == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/user_group.g.dart b/packages/stream_chat/lib/open_api/model/user_group.g.dart new file mode 100644 index 0000000000..4f1091a429 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_group.g.dart @@ -0,0 +1,37 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'user_group.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UserGroup _$UserGroupFromJson(Map json) => UserGroup( + appPk: (json['app_pk'] as num).toInt(), + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + createdBy: json['created_by'] as String?, + description: json['description'] as String?, + id: json['id'] as String, + members: (json['members'] as List?) + ?.map((e) => UserGroupMember.fromJson(e as Map)) + .toList(), + name: json['name'] as String, + teamId: json['team_id'] as String?, + updatedAt: const StreamDateTimeConverter().fromJson( + json['updated_at'] as Object, + ), +); + +Map _$UserGroupToJson(UserGroup instance) => { + 'app_pk': instance.appPk, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'created_by': instance.createdBy, + 'description': instance.description, + 'id': instance.id, + 'members': instance.members?.map((e) => e.toJson()).toList(), + 'name': instance.name, + 'team_id': instance.teamId, + 'updated_at': const StreamDateTimeConverter().toJson(instance.updatedAt), +}; diff --git a/packages/stream_chat/lib/open_api/model/user_group_created_event.dart b/packages/stream_chat/lib/open_api/model/user_group_created_event.dart new file mode 100644 index 0000000000..13d10b762a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_group_created_event.dart @@ -0,0 +1,58 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'user_group_created_event.g.dart'; +part 'user_group_created_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UserGroupCreatedEvent extends core.WsEvent with _$UserGroupCreatedEvent { + const UserGroupCreatedEvent({ + required this.createdAt, + required this.custom, + this.receivedAt, + required this.type, + this.user, + this.userGroup, + }); + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'user') + final UserResponseCommonFields? user; + + @override + @JsonKey(name: 'user_group') + final UserGroup? userGroup; + + Map toJson() => _$UserGroupCreatedEventToJson(this); + + static UserGroupCreatedEvent fromJson(Map json) => _$UserGroupCreatedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/user_group_created_event.freezed.dart b/packages/stream_chat/lib/open_api/model/user_group_created_event.freezed.dart new file mode 100644 index 0000000000..57b069f3c2 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_group_created_event.freezed.dart @@ -0,0 +1,128 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'user_group_created_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UserGroupCreatedEvent { + DateTime get createdAt; + Map get custom; + DateTime? get receivedAt; + String get type; + UserResponseCommonFields? get user; + UserGroup? get userGroup; + + /// Create a copy of UserGroupCreatedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UserGroupCreatedEventCopyWith get copyWith => + _$UserGroupCreatedEventCopyWithImpl( + this as UserGroupCreatedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UserGroupCreatedEvent && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.type, type) || other.type == type) && + (identical(other.user, user) || other.user == user) && + (identical(other.userGroup, userGroup) || other.userGroup == userGroup)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + createdAt, + const DeepCollectionEquality().hash(custom), + receivedAt, + type, + user, + userGroup, + ); + + @override + String toString() { + return 'UserGroupCreatedEvent(createdAt: $createdAt, custom: $custom, receivedAt: $receivedAt, type: $type, user: $user, userGroup: $userGroup)'; + } +} + +/// @nodoc +abstract mixin class $UserGroupCreatedEventCopyWith<$Res> { + factory $UserGroupCreatedEventCopyWith( + UserGroupCreatedEvent value, + $Res Function(UserGroupCreatedEvent) _then, + ) = _$UserGroupCreatedEventCopyWithImpl; + @useResult + $Res call({ + DateTime createdAt, + Map custom, + DateTime? receivedAt, + String type, + UserResponseCommonFields? user, + UserGroup? userGroup, + }); +} + +/// @nodoc +class _$UserGroupCreatedEventCopyWithImpl<$Res> implements $UserGroupCreatedEventCopyWith<$Res> { + _$UserGroupCreatedEventCopyWithImpl(this._self, this._then); + + final UserGroupCreatedEvent _self; + final $Res Function(UserGroupCreatedEvent) _then; + + /// Create a copy of UserGroupCreatedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? createdAt = null, + Object? custom = null, + Object? receivedAt = freezed, + Object? type = null, + Object? user = freezed, + Object? userGroup = freezed, + }) { + return _then( + UserGroupCreatedEvent( + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponseCommonFields?, + userGroup: freezed == userGroup + ? _self.userGroup + : userGroup // ignore: cast_nullable_to_non_nullable + as UserGroup?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/user_group_created_event.g.dart b/packages/stream_chat/lib/open_api/model/user_group_created_event.g.dart new file mode 100644 index 0000000000..8d85b61ff1 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_group_created_event.g.dart @@ -0,0 +1,47 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'user_group_created_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UserGroupCreatedEvent _$UserGroupCreatedEventFromJson( + Map json, +) => UserGroupCreatedEvent( + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + type: json['type'] as String, + user: json['user'] == null ? null : UserResponseCommonFields.fromJson(json['user'] as Map), + userGroup: json['user_group'] == null ? null : UserGroup.fromJson(json['user_group'] as Map), +); + +Map _$UserGroupCreatedEventToJson( + UserGroupCreatedEvent instance, +) => { + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'type': instance.type, + 'user': instance.user?.toJson(), + 'user_group': instance.userGroup?.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/user_group_deleted_event.dart b/packages/stream_chat/lib/open_api/model/user_group_deleted_event.dart new file mode 100644 index 0000000000..bbb031f9b1 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_group_deleted_event.dart @@ -0,0 +1,58 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'user_group_deleted_event.g.dart'; +part 'user_group_deleted_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UserGroupDeletedEvent extends core.WsEvent with _$UserGroupDeletedEvent { + const UserGroupDeletedEvent({ + required this.createdAt, + required this.custom, + this.receivedAt, + required this.type, + this.user, + this.userGroup, + }); + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'user') + final UserResponseCommonFields? user; + + @override + @JsonKey(name: 'user_group') + final UserGroup? userGroup; + + Map toJson() => _$UserGroupDeletedEventToJson(this); + + static UserGroupDeletedEvent fromJson(Map json) => _$UserGroupDeletedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/user_group_deleted_event.freezed.dart b/packages/stream_chat/lib/open_api/model/user_group_deleted_event.freezed.dart new file mode 100644 index 0000000000..b9c4ed88f5 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_group_deleted_event.freezed.dart @@ -0,0 +1,128 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'user_group_deleted_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UserGroupDeletedEvent { + DateTime get createdAt; + Map get custom; + DateTime? get receivedAt; + String get type; + UserResponseCommonFields? get user; + UserGroup? get userGroup; + + /// Create a copy of UserGroupDeletedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UserGroupDeletedEventCopyWith get copyWith => + _$UserGroupDeletedEventCopyWithImpl( + this as UserGroupDeletedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UserGroupDeletedEvent && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.type, type) || other.type == type) && + (identical(other.user, user) || other.user == user) && + (identical(other.userGroup, userGroup) || other.userGroup == userGroup)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + createdAt, + const DeepCollectionEquality().hash(custom), + receivedAt, + type, + user, + userGroup, + ); + + @override + String toString() { + return 'UserGroupDeletedEvent(createdAt: $createdAt, custom: $custom, receivedAt: $receivedAt, type: $type, user: $user, userGroup: $userGroup)'; + } +} + +/// @nodoc +abstract mixin class $UserGroupDeletedEventCopyWith<$Res> { + factory $UserGroupDeletedEventCopyWith( + UserGroupDeletedEvent value, + $Res Function(UserGroupDeletedEvent) _then, + ) = _$UserGroupDeletedEventCopyWithImpl; + @useResult + $Res call({ + DateTime createdAt, + Map custom, + DateTime? receivedAt, + String type, + UserResponseCommonFields? user, + UserGroup? userGroup, + }); +} + +/// @nodoc +class _$UserGroupDeletedEventCopyWithImpl<$Res> implements $UserGroupDeletedEventCopyWith<$Res> { + _$UserGroupDeletedEventCopyWithImpl(this._self, this._then); + + final UserGroupDeletedEvent _self; + final $Res Function(UserGroupDeletedEvent) _then; + + /// Create a copy of UserGroupDeletedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? createdAt = null, + Object? custom = null, + Object? receivedAt = freezed, + Object? type = null, + Object? user = freezed, + Object? userGroup = freezed, + }) { + return _then( + UserGroupDeletedEvent( + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponseCommonFields?, + userGroup: freezed == userGroup + ? _self.userGroup + : userGroup // ignore: cast_nullable_to_non_nullable + as UserGroup?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/user_group_deleted_event.g.dart b/packages/stream_chat/lib/open_api/model/user_group_deleted_event.g.dart new file mode 100644 index 0000000000..df68af4017 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_group_deleted_event.g.dart @@ -0,0 +1,47 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'user_group_deleted_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UserGroupDeletedEvent _$UserGroupDeletedEventFromJson( + Map json, +) => UserGroupDeletedEvent( + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + type: json['type'] as String, + user: json['user'] == null ? null : UserResponseCommonFields.fromJson(json['user'] as Map), + userGroup: json['user_group'] == null ? null : UserGroup.fromJson(json['user_group'] as Map), +); + +Map _$UserGroupDeletedEventToJson( + UserGroupDeletedEvent instance, +) => { + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'type': instance.type, + 'user': instance.user?.toJson(), + 'user_group': instance.userGroup?.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/user_group_member.dart b/packages/stream_chat/lib/open_api/model/user_group_member.dart new file mode 100644 index 0000000000..f2eb961587 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_group_member.dart @@ -0,0 +1,52 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'user_group_member.g.dart'; +part 'user_group_member.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UserGroupMember with _$UserGroupMember { + const UserGroupMember({ + required this.appPk, + required this.createdAt, + required this.groupId, + required this.isAdmin, + required this.userId, + }); + + @override + @JsonKey(name: 'app_pk') + final int appPk; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'group_id') + final String groupId; + + @override + @JsonKey(name: 'is_admin') + final bool isAdmin; + + @override + @JsonKey(name: 'user_id') + final String userId; + + Map toJson() => _$UserGroupMemberToJson(this); + + static UserGroupMember fromJson(Map json) => _$UserGroupMemberFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/user_group_member.freezed.dart b/packages/stream_chat/lib/open_api/model/user_group_member.freezed.dart new file mode 100644 index 0000000000..899447156c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_group_member.freezed.dart @@ -0,0 +1,111 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'user_group_member.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UserGroupMember { + int get appPk; + DateTime get createdAt; + String get groupId; + bool get isAdmin; + String get userId; + + /// Create a copy of UserGroupMember + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UserGroupMemberCopyWith get copyWith => _$UserGroupMemberCopyWithImpl( + this as UserGroupMember, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UserGroupMember && + (identical(other.appPk, appPk) || other.appPk == appPk) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.groupId, groupId) || other.groupId == groupId) && + (identical(other.isAdmin, isAdmin) || other.isAdmin == isAdmin) && + (identical(other.userId, userId) || other.userId == userId)); + } + + @override + int get hashCode => Object.hash(runtimeType, appPk, createdAt, groupId, isAdmin, userId); + + @override + String toString() { + return 'UserGroupMember(appPk: $appPk, createdAt: $createdAt, groupId: $groupId, isAdmin: $isAdmin, userId: $userId)'; + } +} + +/// @nodoc +abstract mixin class $UserGroupMemberCopyWith<$Res> { + factory $UserGroupMemberCopyWith( + UserGroupMember value, + $Res Function(UserGroupMember) _then, + ) = _$UserGroupMemberCopyWithImpl; + @useResult + $Res call({ + int appPk, + DateTime createdAt, + String groupId, + bool isAdmin, + String userId, + }); +} + +/// @nodoc +class _$UserGroupMemberCopyWithImpl<$Res> implements $UserGroupMemberCopyWith<$Res> { + _$UserGroupMemberCopyWithImpl(this._self, this._then); + + final UserGroupMember _self; + final $Res Function(UserGroupMember) _then; + + /// Create a copy of UserGroupMember + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? appPk = null, + Object? createdAt = null, + Object? groupId = null, + Object? isAdmin = null, + Object? userId = null, + }) { + return _then( + UserGroupMember( + appPk: null == appPk + ? _self.appPk + : appPk // ignore: cast_nullable_to_non_nullable + as int, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + groupId: null == groupId + ? _self.groupId + : groupId // ignore: cast_nullable_to_non_nullable + as String, + isAdmin: null == isAdmin + ? _self.isAdmin + : isAdmin // ignore: cast_nullable_to_non_nullable + as bool, + userId: null == userId + ? _self.userId + : userId // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/user_group_member.g.dart b/packages/stream_chat/lib/open_api/model/user_group_member.g.dart new file mode 100644 index 0000000000..3b7d4b5422 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_group_member.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'user_group_member.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UserGroupMember _$UserGroupMemberFromJson(Map json) => UserGroupMember( + appPk: (json['app_pk'] as num).toInt(), + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + groupId: json['group_id'] as String, + isAdmin: json['is_admin'] as bool, + userId: json['user_id'] as String, +); + +Map _$UserGroupMemberToJson(UserGroupMember instance) => { + 'app_pk': instance.appPk, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'group_id': instance.groupId, + 'is_admin': instance.isAdmin, + 'user_id': instance.userId, +}; diff --git a/packages/stream_chat/lib/open_api/model/user_group_member_added_event.dart b/packages/stream_chat/lib/open_api/model/user_group_member_added_event.dart new file mode 100644 index 0000000000..13f31c45ae --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_group_member_added_event.dart @@ -0,0 +1,63 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'user_group_member_added_event.g.dart'; +part 'user_group_member_added_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UserGroupMemberAddedEvent extends core.WsEvent with _$UserGroupMemberAddedEvent { + const UserGroupMemberAddedEvent({ + required this.createdAt, + required this.custom, + required this.members, + this.receivedAt, + required this.type, + this.user, + this.userGroup, + }); + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'members') + final List members; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'user') + final UserResponseCommonFields? user; + + @override + @JsonKey(name: 'user_group') + final UserGroup? userGroup; + + Map toJson() => _$UserGroupMemberAddedEventToJson(this); + + static UserGroupMemberAddedEvent fromJson(Map json) => _$UserGroupMemberAddedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/user_group_member_added_event.freezed.dart b/packages/stream_chat/lib/open_api/model/user_group_member_added_event.freezed.dart new file mode 100644 index 0000000000..b0e0ebb496 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_group_member_added_event.freezed.dart @@ -0,0 +1,137 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'user_group_member_added_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UserGroupMemberAddedEvent { + DateTime get createdAt; + Map get custom; + List get members; + DateTime? get receivedAt; + String get type; + UserResponseCommonFields? get user; + UserGroup? get userGroup; + + /// Create a copy of UserGroupMemberAddedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UserGroupMemberAddedEventCopyWith get copyWith => + _$UserGroupMemberAddedEventCopyWithImpl( + this as UserGroupMemberAddedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UserGroupMemberAddedEvent && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + const DeepCollectionEquality().equals(other.members, members) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.type, type) || other.type == type) && + (identical(other.user, user) || other.user == user) && + (identical(other.userGroup, userGroup) || other.userGroup == userGroup)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + createdAt, + const DeepCollectionEquality().hash(custom), + const DeepCollectionEquality().hash(members), + receivedAt, + type, + user, + userGroup, + ); + + @override + String toString() { + return 'UserGroupMemberAddedEvent(createdAt: $createdAt, custom: $custom, members: $members, receivedAt: $receivedAt, type: $type, user: $user, userGroup: $userGroup)'; + } +} + +/// @nodoc +abstract mixin class $UserGroupMemberAddedEventCopyWith<$Res> { + factory $UserGroupMemberAddedEventCopyWith( + UserGroupMemberAddedEvent value, + $Res Function(UserGroupMemberAddedEvent) _then, + ) = _$UserGroupMemberAddedEventCopyWithImpl; + @useResult + $Res call({ + DateTime createdAt, + Map custom, + List members, + DateTime? receivedAt, + String type, + UserResponseCommonFields? user, + UserGroup? userGroup, + }); +} + +/// @nodoc +class _$UserGroupMemberAddedEventCopyWithImpl<$Res> implements $UserGroupMemberAddedEventCopyWith<$Res> { + _$UserGroupMemberAddedEventCopyWithImpl(this._self, this._then); + + final UserGroupMemberAddedEvent _self; + final $Res Function(UserGroupMemberAddedEvent) _then; + + /// Create a copy of UserGroupMemberAddedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? createdAt = null, + Object? custom = null, + Object? members = null, + Object? receivedAt = freezed, + Object? type = null, + Object? user = freezed, + Object? userGroup = freezed, + }) { + return _then( + UserGroupMemberAddedEvent( + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + members: null == members + ? _self.members + : members // ignore: cast_nullable_to_non_nullable + as List, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponseCommonFields?, + userGroup: freezed == userGroup + ? _self.userGroup + : userGroup // ignore: cast_nullable_to_non_nullable + as UserGroup?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/user_group_member_added_event.g.dart b/packages/stream_chat/lib/open_api/model/user_group_member_added_event.g.dart new file mode 100644 index 0000000000..06d12dbb16 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_group_member_added_event.g.dart @@ -0,0 +1,49 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'user_group_member_added_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UserGroupMemberAddedEvent _$UserGroupMemberAddedEventFromJson( + Map json, +) => UserGroupMemberAddedEvent( + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + members: (json['members'] as List).map((e) => e as String).toList(), + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + type: json['type'] as String, + user: json['user'] == null ? null : UserResponseCommonFields.fromJson(json['user'] as Map), + userGroup: json['user_group'] == null ? null : UserGroup.fromJson(json['user_group'] as Map), +); + +Map _$UserGroupMemberAddedEventToJson( + UserGroupMemberAddedEvent instance, +) => { + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'members': instance.members, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'type': instance.type, + 'user': instance.user?.toJson(), + 'user_group': instance.userGroup?.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/user_group_member_removed_event.dart b/packages/stream_chat/lib/open_api/model/user_group_member_removed_event.dart new file mode 100644 index 0000000000..4a19310c2a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_group_member_removed_event.dart @@ -0,0 +1,63 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'user_group_member_removed_event.g.dart'; +part 'user_group_member_removed_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UserGroupMemberRemovedEvent extends core.WsEvent with _$UserGroupMemberRemovedEvent { + const UserGroupMemberRemovedEvent({ + required this.createdAt, + required this.custom, + required this.members, + this.receivedAt, + required this.type, + this.user, + this.userGroup, + }); + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'members') + final List members; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'user') + final UserResponseCommonFields? user; + + @override + @JsonKey(name: 'user_group') + final UserGroup? userGroup; + + Map toJson() => _$UserGroupMemberRemovedEventToJson(this); + + static UserGroupMemberRemovedEvent fromJson(Map json) => _$UserGroupMemberRemovedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/user_group_member_removed_event.freezed.dart b/packages/stream_chat/lib/open_api/model/user_group_member_removed_event.freezed.dart new file mode 100644 index 0000000000..8b15630811 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_group_member_removed_event.freezed.dart @@ -0,0 +1,137 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'user_group_member_removed_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UserGroupMemberRemovedEvent { + DateTime get createdAt; + Map get custom; + List get members; + DateTime? get receivedAt; + String get type; + UserResponseCommonFields? get user; + UserGroup? get userGroup; + + /// Create a copy of UserGroupMemberRemovedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UserGroupMemberRemovedEventCopyWith get copyWith => + _$UserGroupMemberRemovedEventCopyWithImpl( + this as UserGroupMemberRemovedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UserGroupMemberRemovedEvent && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + const DeepCollectionEquality().equals(other.members, members) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.type, type) || other.type == type) && + (identical(other.user, user) || other.user == user) && + (identical(other.userGroup, userGroup) || other.userGroup == userGroup)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + createdAt, + const DeepCollectionEquality().hash(custom), + const DeepCollectionEquality().hash(members), + receivedAt, + type, + user, + userGroup, + ); + + @override + String toString() { + return 'UserGroupMemberRemovedEvent(createdAt: $createdAt, custom: $custom, members: $members, receivedAt: $receivedAt, type: $type, user: $user, userGroup: $userGroup)'; + } +} + +/// @nodoc +abstract mixin class $UserGroupMemberRemovedEventCopyWith<$Res> { + factory $UserGroupMemberRemovedEventCopyWith( + UserGroupMemberRemovedEvent value, + $Res Function(UserGroupMemberRemovedEvent) _then, + ) = _$UserGroupMemberRemovedEventCopyWithImpl; + @useResult + $Res call({ + DateTime createdAt, + Map custom, + List members, + DateTime? receivedAt, + String type, + UserResponseCommonFields? user, + UserGroup? userGroup, + }); +} + +/// @nodoc +class _$UserGroupMemberRemovedEventCopyWithImpl<$Res> implements $UserGroupMemberRemovedEventCopyWith<$Res> { + _$UserGroupMemberRemovedEventCopyWithImpl(this._self, this._then); + + final UserGroupMemberRemovedEvent _self; + final $Res Function(UserGroupMemberRemovedEvent) _then; + + /// Create a copy of UserGroupMemberRemovedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? createdAt = null, + Object? custom = null, + Object? members = null, + Object? receivedAt = freezed, + Object? type = null, + Object? user = freezed, + Object? userGroup = freezed, + }) { + return _then( + UserGroupMemberRemovedEvent( + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + members: null == members + ? _self.members + : members // ignore: cast_nullable_to_non_nullable + as List, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponseCommonFields?, + userGroup: freezed == userGroup + ? _self.userGroup + : userGroup // ignore: cast_nullable_to_non_nullable + as UserGroup?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/user_group_member_removed_event.g.dart b/packages/stream_chat/lib/open_api/model/user_group_member_removed_event.g.dart new file mode 100644 index 0000000000..0b60422c0a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_group_member_removed_event.g.dart @@ -0,0 +1,49 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'user_group_member_removed_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UserGroupMemberRemovedEvent _$UserGroupMemberRemovedEventFromJson( + Map json, +) => UserGroupMemberRemovedEvent( + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + members: (json['members'] as List).map((e) => e as String).toList(), + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + type: json['type'] as String, + user: json['user'] == null ? null : UserResponseCommonFields.fromJson(json['user'] as Map), + userGroup: json['user_group'] == null ? null : UserGroup.fromJson(json['user_group'] as Map), +); + +Map _$UserGroupMemberRemovedEventToJson( + UserGroupMemberRemovedEvent instance, +) => { + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'members': instance.members, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'type': instance.type, + 'user': instance.user?.toJson(), + 'user_group': instance.userGroup?.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/user_group_response.dart b/packages/stream_chat/lib/open_api/model/user_group_response.dart new file mode 100644 index 0000000000..702952f9a9 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_group_response.dart @@ -0,0 +1,68 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'user_group_response.g.dart'; +part 'user_group_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UserGroupResponse with _$UserGroupResponse { + const UserGroupResponse({ + required this.createdAt, + this.createdBy, + this.description, + required this.id, + this.members, + required this.name, + this.teamId, + required this.updatedAt, + }); + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'created_by') + final String? createdBy; + + @override + @JsonKey(name: 'description') + final String? description; + + @override + @JsonKey(name: 'id') + final String id; + + @override + @JsonKey(name: 'members') + final List? members; + + @override + @JsonKey(name: 'name') + final String name; + + @override + @JsonKey(name: 'team_id') + final String? teamId; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'updated_at') + final DateTime updatedAt; + + Map toJson() => _$UserGroupResponseToJson(this); + + static UserGroupResponse fromJson(Map json) => _$UserGroupResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/user_group_response.freezed.dart b/packages/stream_chat/lib/open_api/model/user_group_response.freezed.dart new file mode 100644 index 0000000000..dcc3084014 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_group_response.freezed.dart @@ -0,0 +1,145 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'user_group_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UserGroupResponse { + DateTime get createdAt; + String? get createdBy; + String? get description; + String get id; + List? get members; + String get name; + String? get teamId; + DateTime get updatedAt; + + /// Create a copy of UserGroupResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UserGroupResponseCopyWith get copyWith => _$UserGroupResponseCopyWithImpl( + this as UserGroupResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UserGroupResponse && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.createdBy, createdBy) || other.createdBy == createdBy) && + (identical(other.description, description) || other.description == description) && + (identical(other.id, id) || other.id == id) && + const DeepCollectionEquality().equals(other.members, members) && + (identical(other.name, name) || other.name == name) && + (identical(other.teamId, teamId) || other.teamId == teamId) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + createdAt, + createdBy, + description, + id, + const DeepCollectionEquality().hash(members), + name, + teamId, + updatedAt, + ); + + @override + String toString() { + return 'UserGroupResponse(createdAt: $createdAt, createdBy: $createdBy, description: $description, id: $id, members: $members, name: $name, teamId: $teamId, updatedAt: $updatedAt)'; + } +} + +/// @nodoc +abstract mixin class $UserGroupResponseCopyWith<$Res> { + factory $UserGroupResponseCopyWith( + UserGroupResponse value, + $Res Function(UserGroupResponse) _then, + ) = _$UserGroupResponseCopyWithImpl; + @useResult + $Res call({ + DateTime createdAt, + String? createdBy, + String? description, + String id, + List? members, + String name, + String? teamId, + DateTime updatedAt, + }); +} + +/// @nodoc +class _$UserGroupResponseCopyWithImpl<$Res> implements $UserGroupResponseCopyWith<$Res> { + _$UserGroupResponseCopyWithImpl(this._self, this._then); + + final UserGroupResponse _self; + final $Res Function(UserGroupResponse) _then; + + /// Create a copy of UserGroupResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? createdAt = null, + Object? createdBy = freezed, + Object? description = freezed, + Object? id = null, + Object? members = freezed, + Object? name = null, + Object? teamId = freezed, + Object? updatedAt = null, + }) { + return _then( + UserGroupResponse( + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + createdBy: freezed == createdBy + ? _self.createdBy + : createdBy // ignore: cast_nullable_to_non_nullable + as String?, + description: freezed == description + ? _self.description + : description // ignore: cast_nullable_to_non_nullable + as String?, + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + members: freezed == members + ? _self.members + : members // ignore: cast_nullable_to_non_nullable + as List?, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + teamId: freezed == teamId + ? _self.teamId + : teamId // ignore: cast_nullable_to_non_nullable + as String?, + updatedAt: null == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/user_group_response.g.dart b/packages/stream_chat/lib/open_api/model/user_group_response.g.dart new file mode 100644 index 0000000000..f104421870 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_group_response.g.dart @@ -0,0 +1,35 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'user_group_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UserGroupResponse _$UserGroupResponseFromJson(Map json) => UserGroupResponse( + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + createdBy: json['created_by'] as String?, + description: json['description'] as String?, + id: json['id'] as String, + members: (json['members'] as List?) + ?.map((e) => UserGroupMember.fromJson(e as Map)) + .toList(), + name: json['name'] as String, + teamId: json['team_id'] as String?, + updatedAt: const StreamDateTimeConverter().fromJson( + json['updated_at'] as Object, + ), +); + +Map _$UserGroupResponseToJson(UserGroupResponse instance) => { + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'created_by': instance.createdBy, + 'description': instance.description, + 'id': instance.id, + 'members': instance.members?.map((e) => e.toJson()).toList(), + 'name': instance.name, + 'team_id': instance.teamId, + 'updated_at': const StreamDateTimeConverter().toJson(instance.updatedAt), +}; diff --git a/packages/stream_chat/lib/open_api/model/user_group_updated_event.dart b/packages/stream_chat/lib/open_api/model/user_group_updated_event.dart new file mode 100644 index 0000000000..3d013952b2 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_group_updated_event.dart @@ -0,0 +1,58 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'user_group_updated_event.g.dart'; +part 'user_group_updated_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UserGroupUpdatedEvent extends core.WsEvent with _$UserGroupUpdatedEvent { + const UserGroupUpdatedEvent({ + required this.createdAt, + required this.custom, + this.receivedAt, + required this.type, + this.user, + this.userGroup, + }); + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'user') + final UserResponseCommonFields? user; + + @override + @JsonKey(name: 'user_group') + final UserGroup? userGroup; + + Map toJson() => _$UserGroupUpdatedEventToJson(this); + + static UserGroupUpdatedEvent fromJson(Map json) => _$UserGroupUpdatedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/user_group_updated_event.freezed.dart b/packages/stream_chat/lib/open_api/model/user_group_updated_event.freezed.dart new file mode 100644 index 0000000000..7885df4fc1 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_group_updated_event.freezed.dart @@ -0,0 +1,128 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'user_group_updated_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UserGroupUpdatedEvent { + DateTime get createdAt; + Map get custom; + DateTime? get receivedAt; + String get type; + UserResponseCommonFields? get user; + UserGroup? get userGroup; + + /// Create a copy of UserGroupUpdatedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UserGroupUpdatedEventCopyWith get copyWith => + _$UserGroupUpdatedEventCopyWithImpl( + this as UserGroupUpdatedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UserGroupUpdatedEvent && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.type, type) || other.type == type) && + (identical(other.user, user) || other.user == user) && + (identical(other.userGroup, userGroup) || other.userGroup == userGroup)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + createdAt, + const DeepCollectionEquality().hash(custom), + receivedAt, + type, + user, + userGroup, + ); + + @override + String toString() { + return 'UserGroupUpdatedEvent(createdAt: $createdAt, custom: $custom, receivedAt: $receivedAt, type: $type, user: $user, userGroup: $userGroup)'; + } +} + +/// @nodoc +abstract mixin class $UserGroupUpdatedEventCopyWith<$Res> { + factory $UserGroupUpdatedEventCopyWith( + UserGroupUpdatedEvent value, + $Res Function(UserGroupUpdatedEvent) _then, + ) = _$UserGroupUpdatedEventCopyWithImpl; + @useResult + $Res call({ + DateTime createdAt, + Map custom, + DateTime? receivedAt, + String type, + UserResponseCommonFields? user, + UserGroup? userGroup, + }); +} + +/// @nodoc +class _$UserGroupUpdatedEventCopyWithImpl<$Res> implements $UserGroupUpdatedEventCopyWith<$Res> { + _$UserGroupUpdatedEventCopyWithImpl(this._self, this._then); + + final UserGroupUpdatedEvent _self; + final $Res Function(UserGroupUpdatedEvent) _then; + + /// Create a copy of UserGroupUpdatedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? createdAt = null, + Object? custom = null, + Object? receivedAt = freezed, + Object? type = null, + Object? user = freezed, + Object? userGroup = freezed, + }) { + return _then( + UserGroupUpdatedEvent( + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponseCommonFields?, + userGroup: freezed == userGroup + ? _self.userGroup + : userGroup // ignore: cast_nullable_to_non_nullable + as UserGroup?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/user_group_updated_event.g.dart b/packages/stream_chat/lib/open_api/model/user_group_updated_event.g.dart new file mode 100644 index 0000000000..e846538734 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_group_updated_event.g.dart @@ -0,0 +1,47 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'user_group_updated_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UserGroupUpdatedEvent _$UserGroupUpdatedEventFromJson( + Map json, +) => UserGroupUpdatedEvent( + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + type: json['type'] as String, + user: json['user'] == null ? null : UserResponseCommonFields.fromJson(json['user'] as Map), + userGroup: json['user_group'] == null ? null : UserGroup.fromJson(json['user_group'] as Map), +); + +Map _$UserGroupUpdatedEventToJson( + UserGroupUpdatedEvent instance, +) => { + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'type': instance.type, + 'user': instance.user?.toJson(), + 'user_group': instance.userGroup?.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/user_identical_content_count_parameters.dart b/packages/stream_chat/lib/open_api/model/user_identical_content_count_parameters.dart new file mode 100644 index 0000000000..3bf4b58542 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_identical_content_count_parameters.dart @@ -0,0 +1,37 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'user_identical_content_count_parameters.g.dart'; +part 'user_identical_content_count_parameters.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UserIdenticalContentCountParameters with _$UserIdenticalContentCountParameters { + const UserIdenticalContentCountParameters({ + this.threshold, + this.timeWindow, + }); + + @override + @JsonKey(name: 'threshold') + final int? threshold; + + @override + @JsonKey(name: 'time_window') + final String? timeWindow; + + Map toJson() => _$UserIdenticalContentCountParametersToJson(this); + + static UserIdenticalContentCountParameters fromJson(Map json) => + _$UserIdenticalContentCountParametersFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/user_identical_content_count_parameters.freezed.dart b/packages/stream_chat/lib/open_api/model/user_identical_content_count_parameters.freezed.dart new file mode 100644 index 0000000000..be9cb8e8e7 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_identical_content_count_parameters.freezed.dart @@ -0,0 +1,83 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'user_identical_content_count_parameters.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UserIdenticalContentCountParameters { + int? get threshold; + String? get timeWindow; + + /// Create a copy of UserIdenticalContentCountParameters + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UserIdenticalContentCountParametersCopyWith get copyWith => + _$UserIdenticalContentCountParametersCopyWithImpl( + this as UserIdenticalContentCountParameters, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UserIdenticalContentCountParameters && + (identical(other.threshold, threshold) || other.threshold == threshold) && + (identical(other.timeWindow, timeWindow) || other.timeWindow == timeWindow)); + } + + @override + int get hashCode => Object.hash(runtimeType, threshold, timeWindow); + + @override + String toString() { + return 'UserIdenticalContentCountParameters(threshold: $threshold, timeWindow: $timeWindow)'; + } +} + +/// @nodoc +abstract mixin class $UserIdenticalContentCountParametersCopyWith<$Res> { + factory $UserIdenticalContentCountParametersCopyWith( + UserIdenticalContentCountParameters value, + $Res Function(UserIdenticalContentCountParameters) _then, + ) = _$UserIdenticalContentCountParametersCopyWithImpl; + @useResult + $Res call({int? threshold, String? timeWindow}); +} + +/// @nodoc +class _$UserIdenticalContentCountParametersCopyWithImpl<$Res> + implements $UserIdenticalContentCountParametersCopyWith<$Res> { + _$UserIdenticalContentCountParametersCopyWithImpl(this._self, this._then); + + final UserIdenticalContentCountParameters _self; + final $Res Function(UserIdenticalContentCountParameters) _then; + + /// Create a copy of UserIdenticalContentCountParameters + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? threshold = freezed, Object? timeWindow = freezed}) { + return _then( + UserIdenticalContentCountParameters( + threshold: freezed == threshold + ? _self.threshold + : threshold // ignore: cast_nullable_to_non_nullable + as int?, + timeWindow: freezed == timeWindow + ? _self.timeWindow + : timeWindow // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/user_identical_content_count_parameters.g.dart b/packages/stream_chat/lib/open_api/model/user_identical_content_count_parameters.g.dart new file mode 100644 index 0000000000..8bc69888b0 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_identical_content_count_parameters.g.dart @@ -0,0 +1,20 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'user_identical_content_count_parameters.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UserIdenticalContentCountParameters _$UserIdenticalContentCountParametersFromJson(Map json) => + UserIdenticalContentCountParameters( + threshold: (json['threshold'] as num?)?.toInt(), + timeWindow: json['time_window'] as String?, + ); + +Map _$UserIdenticalContentCountParametersToJson( + UserIdenticalContentCountParameters instance, +) => { + 'threshold': instance.threshold, + 'time_window': instance.timeWindow, +}; diff --git a/packages/stream_chat/lib/open_api/model/user_messages_deleted_event.dart b/packages/stream_chat/lib/open_api/model/user_messages_deleted_event.dart new file mode 100644 index 0000000000..19ccd50d1e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_messages_deleted_event.dart @@ -0,0 +1,93 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'user_messages_deleted_event.g.dart'; +part 'user_messages_deleted_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UserMessagesDeletedEvent extends core.WsEvent with _$UserMessagesDeletedEvent { + const UserMessagesDeletedEvent({ + this.channelCustom, + this.channelId, + this.channelMemberCount, + this.channelMessageCount, + this.channelType, + this.cid, + required this.createdAt, + required this.custom, + this.hardDelete, + this.receivedAt, + this.team, + required this.type, + required this.user, + }); + + @override + @JsonKey(name: 'channel_custom') + final Map? channelCustom; + + @override + @JsonKey(name: 'channel_id') + final String? channelId; + + @override + @JsonKey(name: 'channel_member_count') + final int? channelMemberCount; + + @override + @JsonKey(name: 'channel_message_count') + final int? channelMessageCount; + + @override + @JsonKey(name: 'channel_type') + final String? channelType; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @JsonKey(name: 'hard_delete') + final bool? hardDelete; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'team') + final String? team; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'user') + final UserResponseCommonFields user; + + Map toJson() => _$UserMessagesDeletedEventToJson(this); + + static UserMessagesDeletedEvent fromJson(Map json) => _$UserMessagesDeletedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/user_messages_deleted_event.freezed.dart b/packages/stream_chat/lib/open_api/model/user_messages_deleted_event.freezed.dart new file mode 100644 index 0000000000..74bbc3038e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_messages_deleted_event.freezed.dart @@ -0,0 +1,196 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'user_messages_deleted_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UserMessagesDeletedEvent { + Map? get channelCustom; + String? get channelId; + int? get channelMemberCount; + int? get channelMessageCount; + String? get channelType; + String? get cid; + DateTime get createdAt; + Map get custom; + bool? get hardDelete; + DateTime? get receivedAt; + String? get team; + String get type; + UserResponseCommonFields get user; + + /// Create a copy of UserMessagesDeletedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UserMessagesDeletedEventCopyWith get copyWith => + _$UserMessagesDeletedEventCopyWithImpl( + this as UserMessagesDeletedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UserMessagesDeletedEvent && + const DeepCollectionEquality().equals( + other.channelCustom, + channelCustom, + ) && + (identical(other.channelId, channelId) || other.channelId == channelId) && + (identical(other.channelMemberCount, channelMemberCount) || + other.channelMemberCount == channelMemberCount) && + (identical(other.channelMessageCount, channelMessageCount) || + other.channelMessageCount == channelMessageCount) && + (identical(other.channelType, channelType) || other.channelType == channelType) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.hardDelete, hardDelete) || other.hardDelete == hardDelete) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.team, team) || other.team == team) && + (identical(other.type, type) || other.type == type) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(channelCustom), + channelId, + channelMemberCount, + channelMessageCount, + channelType, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + hardDelete, + receivedAt, + team, + type, + user, + ); + + @override + String toString() { + return 'UserMessagesDeletedEvent(channelCustom: $channelCustom, channelId: $channelId, channelMemberCount: $channelMemberCount, channelMessageCount: $channelMessageCount, channelType: $channelType, cid: $cid, createdAt: $createdAt, custom: $custom, hardDelete: $hardDelete, receivedAt: $receivedAt, team: $team, type: $type, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $UserMessagesDeletedEventCopyWith<$Res> { + factory $UserMessagesDeletedEventCopyWith( + UserMessagesDeletedEvent value, + $Res Function(UserMessagesDeletedEvent) _then, + ) = _$UserMessagesDeletedEventCopyWithImpl; + @useResult + $Res call({ + Map? channelCustom, + String? channelId, + int? channelMemberCount, + int? channelMessageCount, + String? channelType, + String? cid, + DateTime createdAt, + Map custom, + bool? hardDelete, + DateTime? receivedAt, + String? team, + String type, + UserResponseCommonFields user, + }); +} + +/// @nodoc +class _$UserMessagesDeletedEventCopyWithImpl<$Res> implements $UserMessagesDeletedEventCopyWith<$Res> { + _$UserMessagesDeletedEventCopyWithImpl(this._self, this._then); + + final UserMessagesDeletedEvent _self; + final $Res Function(UserMessagesDeletedEvent) _then; + + /// Create a copy of UserMessagesDeletedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channelCustom = freezed, + Object? channelId = freezed, + Object? channelMemberCount = freezed, + Object? channelMessageCount = freezed, + Object? channelType = freezed, + Object? cid = freezed, + Object? createdAt = null, + Object? custom = null, + Object? hardDelete = freezed, + Object? receivedAt = freezed, + Object? team = freezed, + Object? type = null, + Object? user = null, + }) { + return _then( + UserMessagesDeletedEvent( + channelCustom: freezed == channelCustom + ? _self.channelCustom + : channelCustom // ignore: cast_nullable_to_non_nullable + as Map?, + channelId: freezed == channelId + ? _self.channelId + : channelId // ignore: cast_nullable_to_non_nullable + as String?, + channelMemberCount: freezed == channelMemberCount + ? _self.channelMemberCount + : channelMemberCount // ignore: cast_nullable_to_non_nullable + as int?, + channelMessageCount: freezed == channelMessageCount + ? _self.channelMessageCount + : channelMessageCount // ignore: cast_nullable_to_non_nullable + as int?, + channelType: freezed == channelType + ? _self.channelType + : channelType // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + hardDelete: freezed == hardDelete + ? _self.hardDelete + : hardDelete // ignore: cast_nullable_to_non_nullable + as bool?, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + team: freezed == team + ? _self.team + : team // ignore: cast_nullable_to_non_nullable + as String?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + user: null == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponseCommonFields, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/user_messages_deleted_event.g.dart b/packages/stream_chat/lib/open_api/model/user_messages_deleted_event.g.dart new file mode 100644 index 0000000000..1a692d585a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_messages_deleted_event.g.dart @@ -0,0 +1,61 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'user_messages_deleted_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UserMessagesDeletedEvent _$UserMessagesDeletedEventFromJson( + Map json, +) => UserMessagesDeletedEvent( + channelCustom: json['channel_custom'] as Map?, + channelId: json['channel_id'] as String?, + channelMemberCount: (json['channel_member_count'] as num?)?.toInt(), + channelMessageCount: (json['channel_message_count'] as num?)?.toInt(), + channelType: json['channel_type'] as String?, + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + hardDelete: json['hard_delete'] as bool?, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + team: json['team'] as String?, + type: json['type'] as String, + user: UserResponseCommonFields.fromJson(json['user'] as Map), +); + +Map _$UserMessagesDeletedEventToJson( + UserMessagesDeletedEvent instance, +) => { + 'channel_custom': instance.channelCustom, + 'channel_id': instance.channelId, + 'channel_member_count': instance.channelMemberCount, + 'channel_message_count': instance.channelMessageCount, + 'channel_type': instance.channelType, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'hard_delete': instance.hardDelete, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'team': instance.team, + 'type': instance.type, + 'user': instance.user.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/user_mute_response.dart b/packages/stream_chat/lib/open_api/model/user_mute_response.dart new file mode 100644 index 0000000000..45647197ba --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_mute_response.dart @@ -0,0 +1,54 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'user_mute_response.g.dart'; +part 'user_mute_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UserMuteResponse with _$UserMuteResponse { + const UserMuteResponse({ + required this.createdAt, + this.expires, + this.target, + required this.updatedAt, + this.user, + }); + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'expires') + final DateTime? expires; + + @override + @JsonKey(name: 'target') + final UserResponse? target; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'updated_at') + final DateTime updatedAt; + + @override + @JsonKey(name: 'user') + final UserResponse? user; + + Map toJson() => _$UserMuteResponseToJson(this); + + static UserMuteResponse fromJson(Map json) => _$UserMuteResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/user_mute_response.freezed.dart b/packages/stream_chat/lib/open_api/model/user_mute_response.freezed.dart new file mode 100644 index 0000000000..49697c6d35 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_mute_response.freezed.dart @@ -0,0 +1,111 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'user_mute_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UserMuteResponse { + DateTime get createdAt; + DateTime? get expires; + UserResponse? get target; + DateTime get updatedAt; + UserResponse? get user; + + /// Create a copy of UserMuteResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UserMuteResponseCopyWith get copyWith => _$UserMuteResponseCopyWithImpl( + this as UserMuteResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UserMuteResponse && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.expires, expires) || other.expires == expires) && + (identical(other.target, target) || other.target == target) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash(runtimeType, createdAt, expires, target, updatedAt, user); + + @override + String toString() { + return 'UserMuteResponse(createdAt: $createdAt, expires: $expires, target: $target, updatedAt: $updatedAt, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $UserMuteResponseCopyWith<$Res> { + factory $UserMuteResponseCopyWith( + UserMuteResponse value, + $Res Function(UserMuteResponse) _then, + ) = _$UserMuteResponseCopyWithImpl; + @useResult + $Res call({ + DateTime createdAt, + DateTime? expires, + UserResponse? target, + DateTime updatedAt, + UserResponse? user, + }); +} + +/// @nodoc +class _$UserMuteResponseCopyWithImpl<$Res> implements $UserMuteResponseCopyWith<$Res> { + _$UserMuteResponseCopyWithImpl(this._self, this._then); + + final UserMuteResponse _self; + final $Res Function(UserMuteResponse) _then; + + /// Create a copy of UserMuteResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? createdAt = null, + Object? expires = freezed, + Object? target = freezed, + Object? updatedAt = null, + Object? user = freezed, + }) { + return _then( + UserMuteResponse( + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + expires: freezed == expires + ? _self.expires + : expires // ignore: cast_nullable_to_non_nullable + as DateTime?, + target: freezed == target + ? _self.target + : target // ignore: cast_nullable_to_non_nullable + as UserResponse?, + updatedAt: null == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponse?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/user_mute_response.g.dart b/packages/stream_chat/lib/open_api/model/user_mute_response.g.dart new file mode 100644 index 0000000000..d7768dc646 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_mute_response.g.dart @@ -0,0 +1,43 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'user_mute_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UserMuteResponse _$UserMuteResponseFromJson(Map json) => UserMuteResponse( + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + expires: _$JsonConverterFromJson( + json['expires'], + const StreamDateTimeConverter().fromJson, + ), + target: json['target'] == null ? null : UserResponse.fromJson(json['target'] as Map), + updatedAt: const StreamDateTimeConverter().fromJson( + json['updated_at'] as Object, + ), + user: json['user'] == null ? null : UserResponse.fromJson(json['user'] as Map), +); + +Map _$UserMuteResponseToJson(UserMuteResponse instance) => { + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'expires': _$JsonConverterToJson( + instance.expires, + const StreamDateTimeConverter().toJson, + ), + 'target': instance.target?.toJson(), + 'updated_at': const StreamDateTimeConverter().toJson(instance.updatedAt), + 'user': instance.user?.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/user_muted_event.dart b/packages/stream_chat/lib/open_api/model/user_muted_event.dart new file mode 100644 index 0000000000..5cacf2368f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_muted_event.dart @@ -0,0 +1,63 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'user_muted_event.g.dart'; +part 'user_muted_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UserMutedEvent extends core.WsEvent with _$UserMutedEvent { + const UserMutedEvent({ + required this.createdAt, + required this.custom, + this.receivedAt, + this.targetUser, + this.targetUsers, + required this.type, + required this.user, + }); + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'target_user') + final UserResponseCommonFields? targetUser; + + @override + @JsonKey(name: 'target_users') + final List? targetUsers; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'user') + final UserResponseCommonFields user; + + Map toJson() => _$UserMutedEventToJson(this); + + static UserMutedEvent fromJson(Map json) => _$UserMutedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/user_muted_event.freezed.dart b/packages/stream_chat/lib/open_api/model/user_muted_event.freezed.dart new file mode 100644 index 0000000000..7649df6803 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_muted_event.freezed.dart @@ -0,0 +1,139 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'user_muted_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UserMutedEvent { + DateTime get createdAt; + Map get custom; + DateTime? get receivedAt; + UserResponseCommonFields? get targetUser; + List? get targetUsers; + String get type; + UserResponseCommonFields get user; + + /// Create a copy of UserMutedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UserMutedEventCopyWith get copyWith => _$UserMutedEventCopyWithImpl( + this as UserMutedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UserMutedEvent && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.targetUser, targetUser) || other.targetUser == targetUser) && + const DeepCollectionEquality().equals( + other.targetUsers, + targetUsers, + ) && + (identical(other.type, type) || other.type == type) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + createdAt, + const DeepCollectionEquality().hash(custom), + receivedAt, + targetUser, + const DeepCollectionEquality().hash(targetUsers), + type, + user, + ); + + @override + String toString() { + return 'UserMutedEvent(createdAt: $createdAt, custom: $custom, receivedAt: $receivedAt, targetUser: $targetUser, targetUsers: $targetUsers, type: $type, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $UserMutedEventCopyWith<$Res> { + factory $UserMutedEventCopyWith( + UserMutedEvent value, + $Res Function(UserMutedEvent) _then, + ) = _$UserMutedEventCopyWithImpl; + @useResult + $Res call({ + DateTime createdAt, + Map custom, + DateTime? receivedAt, + UserResponseCommonFields? targetUser, + List? targetUsers, + String type, + UserResponseCommonFields user, + }); +} + +/// @nodoc +class _$UserMutedEventCopyWithImpl<$Res> implements $UserMutedEventCopyWith<$Res> { + _$UserMutedEventCopyWithImpl(this._self, this._then); + + final UserMutedEvent _self; + final $Res Function(UserMutedEvent) _then; + + /// Create a copy of UserMutedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? createdAt = null, + Object? custom = null, + Object? receivedAt = freezed, + Object? targetUser = freezed, + Object? targetUsers = freezed, + Object? type = null, + Object? user = null, + }) { + return _then( + UserMutedEvent( + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + targetUser: freezed == targetUser + ? _self.targetUser + : targetUser // ignore: cast_nullable_to_non_nullable + as UserResponseCommonFields?, + targetUsers: freezed == targetUsers + ? _self.targetUsers + : targetUsers // ignore: cast_nullable_to_non_nullable + as List?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + user: null == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponseCommonFields, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/user_muted_event.g.dart b/packages/stream_chat/lib/open_api/model/user_muted_event.g.dart new file mode 100644 index 0000000000..7d3417529b --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_muted_event.g.dart @@ -0,0 +1,53 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'user_muted_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UserMutedEvent _$UserMutedEventFromJson( + Map json, +) => UserMutedEvent( + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + targetUser: json['target_user'] == null + ? null + : UserResponseCommonFields.fromJson( + json['target_user'] as Map, + ), + targetUsers: (json['target_users'] as List?) + ?.map((e) => UserResponseCommonFields.fromJson(e as Map)) + .toList(), + type: json['type'] as String, + user: UserResponseCommonFields.fromJson(json['user'] as Map), +); + +Map _$UserMutedEventToJson(UserMutedEvent instance) => { + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'target_user': instance.targetUser?.toJson(), + 'target_users': instance.targetUsers?.map((e) => e.toJson()).toList(), + 'type': instance.type, + 'user': instance.user.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/user_presence_changed_event.dart b/packages/stream_chat/lib/open_api/model/user_presence_changed_event.dart new file mode 100644 index 0000000000..fd1789382a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_presence_changed_event.dart @@ -0,0 +1,53 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'user_presence_changed_event.g.dart'; +part 'user_presence_changed_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UserPresenceChangedEvent extends core.WsEvent with _$UserPresenceChangedEvent { + const UserPresenceChangedEvent({ + required this.createdAt, + required this.custom, + this.receivedAt, + required this.type, + required this.user, + }); + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'user') + final UserResponseCommonFields user; + + Map toJson() => _$UserPresenceChangedEventToJson(this); + + static UserPresenceChangedEvent fromJson(Map json) => _$UserPresenceChangedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/user_presence_changed_event.freezed.dart b/packages/stream_chat/lib/open_api/model/user_presence_changed_event.freezed.dart new file mode 100644 index 0000000000..277984309f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_presence_changed_event.freezed.dart @@ -0,0 +1,119 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'user_presence_changed_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UserPresenceChangedEvent { + DateTime get createdAt; + Map get custom; + DateTime? get receivedAt; + String get type; + UserResponseCommonFields get user; + + /// Create a copy of UserPresenceChangedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UserPresenceChangedEventCopyWith get copyWith => + _$UserPresenceChangedEventCopyWithImpl( + this as UserPresenceChangedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UserPresenceChangedEvent && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.type, type) || other.type == type) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + createdAt, + const DeepCollectionEquality().hash(custom), + receivedAt, + type, + user, + ); + + @override + String toString() { + return 'UserPresenceChangedEvent(createdAt: $createdAt, custom: $custom, receivedAt: $receivedAt, type: $type, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $UserPresenceChangedEventCopyWith<$Res> { + factory $UserPresenceChangedEventCopyWith( + UserPresenceChangedEvent value, + $Res Function(UserPresenceChangedEvent) _then, + ) = _$UserPresenceChangedEventCopyWithImpl; + @useResult + $Res call({ + DateTime createdAt, + Map custom, + DateTime? receivedAt, + String type, + UserResponseCommonFields user, + }); +} + +/// @nodoc +class _$UserPresenceChangedEventCopyWithImpl<$Res> implements $UserPresenceChangedEventCopyWith<$Res> { + _$UserPresenceChangedEventCopyWithImpl(this._self, this._then); + + final UserPresenceChangedEvent _self; + final $Res Function(UserPresenceChangedEvent) _then; + + /// Create a copy of UserPresenceChangedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? createdAt = null, + Object? custom = null, + Object? receivedAt = freezed, + Object? type = null, + Object? user = null, + }) { + return _then( + UserPresenceChangedEvent( + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + user: null == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponseCommonFields, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/user_presence_changed_event.g.dart b/packages/stream_chat/lib/open_api/model/user_presence_changed_event.g.dart new file mode 100644 index 0000000000..56eaf4cefa --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_presence_changed_event.g.dart @@ -0,0 +1,45 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'user_presence_changed_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UserPresenceChangedEvent _$UserPresenceChangedEventFromJson( + Map json, +) => UserPresenceChangedEvent( + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + type: json['type'] as String, + user: UserResponseCommonFields.fromJson(json['user'] as Map), +); + +Map _$UserPresenceChangedEventToJson( + UserPresenceChangedEvent instance, +) => { + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'type': instance.type, + 'user': instance.user.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/user_reactivated_event.dart b/packages/stream_chat/lib/open_api/model/user_reactivated_event.dart new file mode 100644 index 0000000000..3e7650102c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_reactivated_event.dart @@ -0,0 +1,58 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'user_reactivated_event.g.dart'; +part 'user_reactivated_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UserReactivatedEvent extends core.WsEvent with _$UserReactivatedEvent { + const UserReactivatedEvent({ + required this.createdAt, + this.createdBy, + required this.custom, + this.receivedAt, + required this.type, + required this.user, + }); + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'created_by') + final UserResponseCommonFields? createdBy; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'user') + final UserResponseCommonFields user; + + Map toJson() => _$UserReactivatedEventToJson(this); + + static UserReactivatedEvent fromJson(Map json) => _$UserReactivatedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/user_reactivated_event.freezed.dart b/packages/stream_chat/lib/open_api/model/user_reactivated_event.freezed.dart new file mode 100644 index 0000000000..f2793fc708 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_reactivated_event.freezed.dart @@ -0,0 +1,128 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'user_reactivated_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UserReactivatedEvent { + DateTime get createdAt; + UserResponseCommonFields? get createdBy; + Map get custom; + DateTime? get receivedAt; + String get type; + UserResponseCommonFields get user; + + /// Create a copy of UserReactivatedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UserReactivatedEventCopyWith get copyWith => + _$UserReactivatedEventCopyWithImpl( + this as UserReactivatedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UserReactivatedEvent && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.createdBy, createdBy) || other.createdBy == createdBy) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.type, type) || other.type == type) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + createdAt, + createdBy, + const DeepCollectionEquality().hash(custom), + receivedAt, + type, + user, + ); + + @override + String toString() { + return 'UserReactivatedEvent(createdAt: $createdAt, createdBy: $createdBy, custom: $custom, receivedAt: $receivedAt, type: $type, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $UserReactivatedEventCopyWith<$Res> { + factory $UserReactivatedEventCopyWith( + UserReactivatedEvent value, + $Res Function(UserReactivatedEvent) _then, + ) = _$UserReactivatedEventCopyWithImpl; + @useResult + $Res call({ + DateTime createdAt, + UserResponseCommonFields? createdBy, + Map custom, + DateTime? receivedAt, + String type, + UserResponseCommonFields user, + }); +} + +/// @nodoc +class _$UserReactivatedEventCopyWithImpl<$Res> implements $UserReactivatedEventCopyWith<$Res> { + _$UserReactivatedEventCopyWithImpl(this._self, this._then); + + final UserReactivatedEvent _self; + final $Res Function(UserReactivatedEvent) _then; + + /// Create a copy of UserReactivatedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? createdAt = null, + Object? createdBy = freezed, + Object? custom = null, + Object? receivedAt = freezed, + Object? type = null, + Object? user = null, + }) { + return _then( + UserReactivatedEvent( + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + createdBy: freezed == createdBy + ? _self.createdBy + : createdBy // ignore: cast_nullable_to_non_nullable + as UserResponseCommonFields?, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + user: null == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponseCommonFields, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/user_reactivated_event.g.dart b/packages/stream_chat/lib/open_api/model/user_reactivated_event.g.dart new file mode 100644 index 0000000000..f6181e93d7 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_reactivated_event.g.dart @@ -0,0 +1,51 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'user_reactivated_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UserReactivatedEvent _$UserReactivatedEventFromJson( + Map json, +) => UserReactivatedEvent( + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + createdBy: json['created_by'] == null + ? null + : UserResponseCommonFields.fromJson( + json['created_by'] as Map, + ), + custom: json['custom'] as Map, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + type: json['type'] as String, + user: UserResponseCommonFields.fromJson(json['user'] as Map), +); + +Map _$UserReactivatedEventToJson( + UserReactivatedEvent instance, +) => { + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'created_by': instance.createdBy?.toJson(), + 'custom': instance.custom, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'type': instance.type, + 'user': instance.user.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/user_request.dart b/packages/stream_chat/lib/open_api/model/user_request.dart new file mode 100644 index 0000000000..7e21db05d2 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_request.dart @@ -0,0 +1,61 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'user_request.g.dart'; +part 'user_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UserRequest with _$UserRequest { + const UserRequest({ + this.custom, + required this.id, + this.image, + this.invisible, + this.language, + this.name, + this.privacySettings, + }); + + @override + @JsonKey(name: 'custom') + final Map? custom; + + @override + @JsonKey(name: 'id') + final String id; + + @override + @JsonKey(name: 'image') + final String? image; + + @override + @JsonKey(name: 'invisible') + final bool? invisible; + + @override + @JsonKey(name: 'language') + final String? language; + + @override + @JsonKey(name: 'name') + final String? name; + + @override + @JsonKey(name: 'privacy_settings') + final PrivacySettingsResponse? privacySettings; + + Map toJson() => _$UserRequestToJson(this); + + static UserRequest fromJson(Map json) => _$UserRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/user_request.freezed.dart b/packages/stream_chat/lib/open_api/model/user_request.freezed.dart new file mode 100644 index 0000000000..62cb0ec785 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_request.freezed.dart @@ -0,0 +1,134 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'user_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UserRequest { + Map? get custom; + String get id; + String? get image; + bool? get invisible; + String? get language; + String? get name; + PrivacySettingsResponse? get privacySettings; + + /// Create a copy of UserRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UserRequestCopyWith get copyWith => + _$UserRequestCopyWithImpl(this as UserRequest, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UserRequest && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.id, id) || other.id == id) && + (identical(other.image, image) || other.image == image) && + (identical(other.invisible, invisible) || other.invisible == invisible) && + (identical(other.language, language) || other.language == language) && + (identical(other.name, name) || other.name == name) && + (identical(other.privacySettings, privacySettings) || other.privacySettings == privacySettings)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(custom), + id, + image, + invisible, + language, + name, + privacySettings, + ); + + @override + String toString() { + return 'UserRequest(custom: $custom, id: $id, image: $image, invisible: $invisible, language: $language, name: $name, privacySettings: $privacySettings)'; + } +} + +/// @nodoc +abstract mixin class $UserRequestCopyWith<$Res> { + factory $UserRequestCopyWith( + UserRequest value, + $Res Function(UserRequest) _then, + ) = _$UserRequestCopyWithImpl; + @useResult + $Res call({ + Map? custom, + String id, + String? image, + bool? invisible, + String? language, + String? name, + PrivacySettingsResponse? privacySettings, + }); +} + +/// @nodoc +class _$UserRequestCopyWithImpl<$Res> implements $UserRequestCopyWith<$Res> { + _$UserRequestCopyWithImpl(this._self, this._then); + + final UserRequest _self; + final $Res Function(UserRequest) _then; + + /// Create a copy of UserRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? custom = freezed, + Object? id = null, + Object? image = freezed, + Object? invisible = freezed, + Object? language = freezed, + Object? name = freezed, + Object? privacySettings = freezed, + }) { + return _then( + UserRequest( + custom: freezed == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map?, + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + image: freezed == image + ? _self.image + : image // ignore: cast_nullable_to_non_nullable + as String?, + invisible: freezed == invisible + ? _self.invisible + : invisible // ignore: cast_nullable_to_non_nullable + as bool?, + language: freezed == language + ? _self.language + : language // ignore: cast_nullable_to_non_nullable + as String?, + name: freezed == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + privacySettings: freezed == privacySettings + ? _self.privacySettings + : privacySettings // ignore: cast_nullable_to_non_nullable + as PrivacySettingsResponse?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/user_request.g.dart b/packages/stream_chat/lib/open_api/model/user_request.g.dart new file mode 100644 index 0000000000..d2fa9b6a80 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_request.g.dart @@ -0,0 +1,31 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'user_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UserRequest _$UserRequestFromJson(Map json) => UserRequest( + custom: json['custom'] as Map?, + id: json['id'] as String, + image: json['image'] as String?, + invisible: json['invisible'] as bool?, + language: json['language'] as String?, + name: json['name'] as String?, + privacySettings: json['privacy_settings'] == null + ? null + : PrivacySettingsResponse.fromJson( + json['privacy_settings'] as Map, + ), +); + +Map _$UserRequestToJson(UserRequest instance) => { + 'custom': instance.custom, + 'id': instance.id, + 'image': instance.image, + 'invisible': instance.invisible, + 'language': instance.language, + 'name': instance.name, + 'privacy_settings': instance.privacySettings?.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/user_response.dart b/packages/stream_chat/lib/open_api/model/user_response.dart new file mode 100644 index 0000000000..2767df949a --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_response.dart @@ -0,0 +1,122 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'user_response.g.dart'; +part 'user_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UserResponse with _$UserResponse { + const UserResponse({ + this.avgResponseTime, + required this.banned, + required this.blockedUserIds, + required this.createdAt, + required this.custom, + this.deactivatedAt, + this.deletedAt, + required this.id, + this.image, + required this.language, + this.lastActive, + this.name, + required this.online, + this.revokeTokensIssuedBefore, + required this.role, + required this.teams, + this.teamsRole, + required this.updatedAt, + }); + + @override + @JsonKey(name: 'avg_response_time') + final int? avgResponseTime; + + @override + @JsonKey(name: 'banned') + final bool banned; + + @override + @JsonKey(name: 'blocked_user_ids') + final List blockedUserIds; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'deactivated_at') + final DateTime? deactivatedAt; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'deleted_at') + final DateTime? deletedAt; + + @override + @JsonKey(name: 'id') + final String id; + + @override + @JsonKey(name: 'image') + final String? image; + + @override + @JsonKey(name: 'language') + final String language; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'last_active') + final DateTime? lastActive; + + @override + @JsonKey(name: 'name') + final String? name; + + @override + @JsonKey(name: 'online') + final bool online; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'revoke_tokens_issued_before') + final DateTime? revokeTokensIssuedBefore; + + @override + @JsonKey(name: 'role') + final String role; + + @override + @JsonKey(name: 'teams') + final List teams; + + @override + @JsonKey(name: 'teams_role') + final Map? teamsRole; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'updated_at') + final DateTime updatedAt; + + Map toJson() => _$UserResponseToJson(this); + + static UserResponse fromJson(Map json) => _$UserResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/user_response.freezed.dart b/packages/stream_chat/lib/open_api/model/user_response.freezed.dart new file mode 100644 index 0000000000..da09a7d534 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_response.freezed.dart @@ -0,0 +1,242 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'user_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UserResponse { + int? get avgResponseTime; + bool get banned; + List get blockedUserIds; + DateTime get createdAt; + Map get custom; + DateTime? get deactivatedAt; + DateTime? get deletedAt; + String get id; + String? get image; + String get language; + DateTime? get lastActive; + String? get name; + bool get online; + DateTime? get revokeTokensIssuedBefore; + String get role; + List get teams; + Map? get teamsRole; + DateTime get updatedAt; + + /// Create a copy of UserResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UserResponseCopyWith get copyWith => _$UserResponseCopyWithImpl( + this as UserResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UserResponse && + (identical(other.avgResponseTime, avgResponseTime) || other.avgResponseTime == avgResponseTime) && + (identical(other.banned, banned) || other.banned == banned) && + const DeepCollectionEquality().equals( + other.blockedUserIds, + blockedUserIds, + ) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.deactivatedAt, deactivatedAt) || other.deactivatedAt == deactivatedAt) && + (identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt) && + (identical(other.id, id) || other.id == id) && + (identical(other.image, image) || other.image == image) && + (identical(other.language, language) || other.language == language) && + (identical(other.lastActive, lastActive) || other.lastActive == lastActive) && + (identical(other.name, name) || other.name == name) && + (identical(other.online, online) || other.online == online) && + (identical( + other.revokeTokensIssuedBefore, + revokeTokensIssuedBefore, + ) || + other.revokeTokensIssuedBefore == revokeTokensIssuedBefore) && + (identical(other.role, role) || other.role == role) && + const DeepCollectionEquality().equals(other.teams, teams) && + const DeepCollectionEquality().equals(other.teamsRole, teamsRole) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + avgResponseTime, + banned, + const DeepCollectionEquality().hash(blockedUserIds), + createdAt, + const DeepCollectionEquality().hash(custom), + deactivatedAt, + deletedAt, + id, + image, + language, + lastActive, + name, + online, + revokeTokensIssuedBefore, + role, + const DeepCollectionEquality().hash(teams), + const DeepCollectionEquality().hash(teamsRole), + updatedAt, + ); + + @override + String toString() { + return 'UserResponse(avgResponseTime: $avgResponseTime, banned: $banned, blockedUserIds: $blockedUserIds, createdAt: $createdAt, custom: $custom, deactivatedAt: $deactivatedAt, deletedAt: $deletedAt, id: $id, image: $image, language: $language, lastActive: $lastActive, name: $name, online: $online, revokeTokensIssuedBefore: $revokeTokensIssuedBefore, role: $role, teams: $teams, teamsRole: $teamsRole, updatedAt: $updatedAt)'; + } +} + +/// @nodoc +abstract mixin class $UserResponseCopyWith<$Res> { + factory $UserResponseCopyWith( + UserResponse value, + $Res Function(UserResponse) _then, + ) = _$UserResponseCopyWithImpl; + @useResult + $Res call({ + int? avgResponseTime, + bool banned, + List blockedUserIds, + DateTime createdAt, + Map custom, + DateTime? deactivatedAt, + DateTime? deletedAt, + String id, + String? image, + String language, + DateTime? lastActive, + String? name, + bool online, + DateTime? revokeTokensIssuedBefore, + String role, + List teams, + Map? teamsRole, + DateTime updatedAt, + }); +} + +/// @nodoc +class _$UserResponseCopyWithImpl<$Res> implements $UserResponseCopyWith<$Res> { + _$UserResponseCopyWithImpl(this._self, this._then); + + final UserResponse _self; + final $Res Function(UserResponse) _then; + + /// Create a copy of UserResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? avgResponseTime = freezed, + Object? banned = null, + Object? blockedUserIds = null, + Object? createdAt = null, + Object? custom = null, + Object? deactivatedAt = freezed, + Object? deletedAt = freezed, + Object? id = null, + Object? image = freezed, + Object? language = null, + Object? lastActive = freezed, + Object? name = freezed, + Object? online = null, + Object? revokeTokensIssuedBefore = freezed, + Object? role = null, + Object? teams = null, + Object? teamsRole = freezed, + Object? updatedAt = null, + }) { + return _then( + UserResponse( + avgResponseTime: freezed == avgResponseTime + ? _self.avgResponseTime + : avgResponseTime // ignore: cast_nullable_to_non_nullable + as int?, + banned: null == banned + ? _self.banned + : banned // ignore: cast_nullable_to_non_nullable + as bool, + blockedUserIds: null == blockedUserIds + ? _self.blockedUserIds + : blockedUserIds // ignore: cast_nullable_to_non_nullable + as List, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + deactivatedAt: freezed == deactivatedAt + ? _self.deactivatedAt + : deactivatedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + deletedAt: freezed == deletedAt + ? _self.deletedAt + : deletedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + image: freezed == image + ? _self.image + : image // ignore: cast_nullable_to_non_nullable + as String?, + language: null == language + ? _self.language + : language // ignore: cast_nullable_to_non_nullable + as String, + lastActive: freezed == lastActive + ? _self.lastActive + : lastActive // ignore: cast_nullable_to_non_nullable + as DateTime?, + name: freezed == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + online: null == online + ? _self.online + : online // ignore: cast_nullable_to_non_nullable + as bool, + revokeTokensIssuedBefore: freezed == revokeTokensIssuedBefore + ? _self.revokeTokensIssuedBefore + : revokeTokensIssuedBefore // ignore: cast_nullable_to_non_nullable + as DateTime?, + role: null == role + ? _self.role + : role // ignore: cast_nullable_to_non_nullable + as String, + teams: null == teams + ? _self.teams + : teams // ignore: cast_nullable_to_non_nullable + as List, + teamsRole: freezed == teamsRole + ? _self.teamsRole + : teamsRole // ignore: cast_nullable_to_non_nullable + as Map?, + updatedAt: null == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/user_response.g.dart b/packages/stream_chat/lib/open_api/model/user_response.g.dart new file mode 100644 index 0000000000..55c0695ba6 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_response.g.dart @@ -0,0 +1,89 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'user_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UserResponse _$UserResponseFromJson(Map json) => UserResponse( + avgResponseTime: (json['avg_response_time'] as num?)?.toInt(), + banned: json['banned'] as bool, + blockedUserIds: (json['blocked_user_ids'] as List).map((e) => e as String).toList(), + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + deactivatedAt: _$JsonConverterFromJson( + json['deactivated_at'], + const StreamDateTimeConverter().fromJson, + ), + deletedAt: _$JsonConverterFromJson( + json['deleted_at'], + const StreamDateTimeConverter().fromJson, + ), + id: json['id'] as String, + image: json['image'] as String?, + language: json['language'] as String, + lastActive: _$JsonConverterFromJson( + json['last_active'], + const StreamDateTimeConverter().fromJson, + ), + name: json['name'] as String?, + online: json['online'] as bool, + revokeTokensIssuedBefore: _$JsonConverterFromJson( + json['revoke_tokens_issued_before'], + const StreamDateTimeConverter().fromJson, + ), + role: json['role'] as String, + teams: (json['teams'] as List).map((e) => e as String).toList(), + teamsRole: (json['teams_role'] as Map?)?.map( + (k, e) => MapEntry(k, e as String), + ), + updatedAt: const StreamDateTimeConverter().fromJson( + json['updated_at'] as Object, + ), +); + +Map _$UserResponseToJson(UserResponse instance) => { + 'avg_response_time': instance.avgResponseTime, + 'banned': instance.banned, + 'blocked_user_ids': instance.blockedUserIds, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'deactivated_at': _$JsonConverterToJson( + instance.deactivatedAt, + const StreamDateTimeConverter().toJson, + ), + 'deleted_at': _$JsonConverterToJson( + instance.deletedAt, + const StreamDateTimeConverter().toJson, + ), + 'id': instance.id, + 'image': instance.image, + 'language': instance.language, + 'last_active': _$JsonConverterToJson( + instance.lastActive, + const StreamDateTimeConverter().toJson, + ), + 'name': instance.name, + 'online': instance.online, + 'revoke_tokens_issued_before': _$JsonConverterToJson( + instance.revokeTokensIssuedBefore, + const StreamDateTimeConverter().toJson, + ), + 'role': instance.role, + 'teams': instance.teams, + 'teams_role': instance.teamsRole, + 'updated_at': const StreamDateTimeConverter().toJson(instance.updatedAt), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/user_response_common_fields.dart b/packages/stream_chat/lib/open_api/model/user_response_common_fields.dart new file mode 100644 index 0000000000..f68930889c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_response_common_fields.dart @@ -0,0 +1,122 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'user_response_common_fields.g.dart'; +part 'user_response_common_fields.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UserResponseCommonFields with _$UserResponseCommonFields { + const UserResponseCommonFields({ + this.avgResponseTime, + required this.banned, + required this.blockedUserIds, + required this.createdAt, + required this.custom, + this.deactivatedAt, + this.deletedAt, + required this.id, + this.image, + required this.language, + this.lastActive, + this.name, + required this.online, + this.revokeTokensIssuedBefore, + required this.role, + required this.teams, + this.teamsRole, + required this.updatedAt, + }); + + @override + @JsonKey(name: 'avg_response_time') + final int? avgResponseTime; + + @override + @JsonKey(name: 'banned') + final bool banned; + + @override + @JsonKey(name: 'blocked_user_ids') + final List blockedUserIds; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'deactivated_at') + final DateTime? deactivatedAt; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'deleted_at') + final DateTime? deletedAt; + + @override + @JsonKey(name: 'id') + final String id; + + @override + @JsonKey(name: 'image') + final String? image; + + @override + @JsonKey(name: 'language') + final String language; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'last_active') + final DateTime? lastActive; + + @override + @JsonKey(name: 'name') + final String? name; + + @override + @JsonKey(name: 'online') + final bool online; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'revoke_tokens_issued_before') + final DateTime? revokeTokensIssuedBefore; + + @override + @JsonKey(name: 'role') + final String role; + + @override + @JsonKey(name: 'teams') + final List teams; + + @override + @JsonKey(name: 'teams_role') + final Map? teamsRole; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'updated_at') + final DateTime updatedAt; + + Map toJson() => _$UserResponseCommonFieldsToJson(this); + + static UserResponseCommonFields fromJson(Map json) => _$UserResponseCommonFieldsFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/user_response_common_fields.freezed.dart b/packages/stream_chat/lib/open_api/model/user_response_common_fields.freezed.dart new file mode 100644 index 0000000000..c1ff34cef1 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_response_common_fields.freezed.dart @@ -0,0 +1,243 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'user_response_common_fields.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UserResponseCommonFields { + int? get avgResponseTime; + bool get banned; + List get blockedUserIds; + DateTime get createdAt; + Map get custom; + DateTime? get deactivatedAt; + DateTime? get deletedAt; + String get id; + String? get image; + String get language; + DateTime? get lastActive; + String? get name; + bool get online; + DateTime? get revokeTokensIssuedBefore; + String get role; + List get teams; + Map? get teamsRole; + DateTime get updatedAt; + + /// Create a copy of UserResponseCommonFields + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UserResponseCommonFieldsCopyWith get copyWith => + _$UserResponseCommonFieldsCopyWithImpl( + this as UserResponseCommonFields, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UserResponseCommonFields && + (identical(other.avgResponseTime, avgResponseTime) || other.avgResponseTime == avgResponseTime) && + (identical(other.banned, banned) || other.banned == banned) && + const DeepCollectionEquality().equals( + other.blockedUserIds, + blockedUserIds, + ) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.deactivatedAt, deactivatedAt) || other.deactivatedAt == deactivatedAt) && + (identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt) && + (identical(other.id, id) || other.id == id) && + (identical(other.image, image) || other.image == image) && + (identical(other.language, language) || other.language == language) && + (identical(other.lastActive, lastActive) || other.lastActive == lastActive) && + (identical(other.name, name) || other.name == name) && + (identical(other.online, online) || other.online == online) && + (identical( + other.revokeTokensIssuedBefore, + revokeTokensIssuedBefore, + ) || + other.revokeTokensIssuedBefore == revokeTokensIssuedBefore) && + (identical(other.role, role) || other.role == role) && + const DeepCollectionEquality().equals(other.teams, teams) && + const DeepCollectionEquality().equals(other.teamsRole, teamsRole) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + avgResponseTime, + banned, + const DeepCollectionEquality().hash(blockedUserIds), + createdAt, + const DeepCollectionEquality().hash(custom), + deactivatedAt, + deletedAt, + id, + image, + language, + lastActive, + name, + online, + revokeTokensIssuedBefore, + role, + const DeepCollectionEquality().hash(teams), + const DeepCollectionEquality().hash(teamsRole), + updatedAt, + ); + + @override + String toString() { + return 'UserResponseCommonFields(avgResponseTime: $avgResponseTime, banned: $banned, blockedUserIds: $blockedUserIds, createdAt: $createdAt, custom: $custom, deactivatedAt: $deactivatedAt, deletedAt: $deletedAt, id: $id, image: $image, language: $language, lastActive: $lastActive, name: $name, online: $online, revokeTokensIssuedBefore: $revokeTokensIssuedBefore, role: $role, teams: $teams, teamsRole: $teamsRole, updatedAt: $updatedAt)'; + } +} + +/// @nodoc +abstract mixin class $UserResponseCommonFieldsCopyWith<$Res> { + factory $UserResponseCommonFieldsCopyWith( + UserResponseCommonFields value, + $Res Function(UserResponseCommonFields) _then, + ) = _$UserResponseCommonFieldsCopyWithImpl; + @useResult + $Res call({ + int? avgResponseTime, + bool banned, + List blockedUserIds, + DateTime createdAt, + Map custom, + DateTime? deactivatedAt, + DateTime? deletedAt, + String id, + String? image, + String language, + DateTime? lastActive, + String? name, + bool online, + DateTime? revokeTokensIssuedBefore, + String role, + List teams, + Map? teamsRole, + DateTime updatedAt, + }); +} + +/// @nodoc +class _$UserResponseCommonFieldsCopyWithImpl<$Res> implements $UserResponseCommonFieldsCopyWith<$Res> { + _$UserResponseCommonFieldsCopyWithImpl(this._self, this._then); + + final UserResponseCommonFields _self; + final $Res Function(UserResponseCommonFields) _then; + + /// Create a copy of UserResponseCommonFields + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? avgResponseTime = freezed, + Object? banned = null, + Object? blockedUserIds = null, + Object? createdAt = null, + Object? custom = null, + Object? deactivatedAt = freezed, + Object? deletedAt = freezed, + Object? id = null, + Object? image = freezed, + Object? language = null, + Object? lastActive = freezed, + Object? name = freezed, + Object? online = null, + Object? revokeTokensIssuedBefore = freezed, + Object? role = null, + Object? teams = null, + Object? teamsRole = freezed, + Object? updatedAt = null, + }) { + return _then( + UserResponseCommonFields( + avgResponseTime: freezed == avgResponseTime + ? _self.avgResponseTime + : avgResponseTime // ignore: cast_nullable_to_non_nullable + as int?, + banned: null == banned + ? _self.banned + : banned // ignore: cast_nullable_to_non_nullable + as bool, + blockedUserIds: null == blockedUserIds + ? _self.blockedUserIds + : blockedUserIds // ignore: cast_nullable_to_non_nullable + as List, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + deactivatedAt: freezed == deactivatedAt + ? _self.deactivatedAt + : deactivatedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + deletedAt: freezed == deletedAt + ? _self.deletedAt + : deletedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + image: freezed == image + ? _self.image + : image // ignore: cast_nullable_to_non_nullable + as String?, + language: null == language + ? _self.language + : language // ignore: cast_nullable_to_non_nullable + as String, + lastActive: freezed == lastActive + ? _self.lastActive + : lastActive // ignore: cast_nullable_to_non_nullable + as DateTime?, + name: freezed == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + online: null == online + ? _self.online + : online // ignore: cast_nullable_to_non_nullable + as bool, + revokeTokensIssuedBefore: freezed == revokeTokensIssuedBefore + ? _self.revokeTokensIssuedBefore + : revokeTokensIssuedBefore // ignore: cast_nullable_to_non_nullable + as DateTime?, + role: null == role + ? _self.role + : role // ignore: cast_nullable_to_non_nullable + as String, + teams: null == teams + ? _self.teams + : teams // ignore: cast_nullable_to_non_nullable + as List, + teamsRole: freezed == teamsRole + ? _self.teamsRole + : teamsRole // ignore: cast_nullable_to_non_nullable + as Map?, + updatedAt: null == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/user_response_common_fields.g.dart b/packages/stream_chat/lib/open_api/model/user_response_common_fields.g.dart new file mode 100644 index 0000000000..4fdc7cd44f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_response_common_fields.g.dart @@ -0,0 +1,93 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'user_response_common_fields.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UserResponseCommonFields _$UserResponseCommonFieldsFromJson( + Map json, +) => UserResponseCommonFields( + avgResponseTime: (json['avg_response_time'] as num?)?.toInt(), + banned: json['banned'] as bool, + blockedUserIds: (json['blocked_user_ids'] as List).map((e) => e as String).toList(), + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + deactivatedAt: _$JsonConverterFromJson( + json['deactivated_at'], + const StreamDateTimeConverter().fromJson, + ), + deletedAt: _$JsonConverterFromJson( + json['deleted_at'], + const StreamDateTimeConverter().fromJson, + ), + id: json['id'] as String, + image: json['image'] as String?, + language: json['language'] as String, + lastActive: _$JsonConverterFromJson( + json['last_active'], + const StreamDateTimeConverter().fromJson, + ), + name: json['name'] as String?, + online: json['online'] as bool, + revokeTokensIssuedBefore: _$JsonConverterFromJson( + json['revoke_tokens_issued_before'], + const StreamDateTimeConverter().fromJson, + ), + role: json['role'] as String, + teams: (json['teams'] as List).map((e) => e as String).toList(), + teamsRole: (json['teams_role'] as Map?)?.map( + (k, e) => MapEntry(k, e as String), + ), + updatedAt: const StreamDateTimeConverter().fromJson( + json['updated_at'] as Object, + ), +); + +Map _$UserResponseCommonFieldsToJson( + UserResponseCommonFields instance, +) => { + 'avg_response_time': instance.avgResponseTime, + 'banned': instance.banned, + 'blocked_user_ids': instance.blockedUserIds, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'deactivated_at': _$JsonConverterToJson( + instance.deactivatedAt, + const StreamDateTimeConverter().toJson, + ), + 'deleted_at': _$JsonConverterToJson( + instance.deletedAt, + const StreamDateTimeConverter().toJson, + ), + 'id': instance.id, + 'image': instance.image, + 'language': instance.language, + 'last_active': _$JsonConverterToJson( + instance.lastActive, + const StreamDateTimeConverter().toJson, + ), + 'name': instance.name, + 'online': instance.online, + 'revoke_tokens_issued_before': _$JsonConverterToJson( + instance.revokeTokensIssuedBefore, + const StreamDateTimeConverter().toJson, + ), + 'role': instance.role, + 'teams': instance.teams, + 'teams_role': instance.teamsRole, + 'updated_at': const StreamDateTimeConverter().toJson(instance.updatedAt), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/user_response_privacy_fields.dart b/packages/stream_chat/lib/open_api/model/user_response_privacy_fields.dart new file mode 100644 index 0000000000..88e7a6f04c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_response_privacy_fields.dart @@ -0,0 +1,132 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'user_response_privacy_fields.g.dart'; +part 'user_response_privacy_fields.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UserResponsePrivacyFields with _$UserResponsePrivacyFields { + const UserResponsePrivacyFields({ + this.avgResponseTime, + required this.banned, + required this.blockedUserIds, + required this.createdAt, + required this.custom, + this.deactivatedAt, + this.deletedAt, + required this.id, + this.image, + this.invisible, + required this.language, + this.lastActive, + this.name, + required this.online, + this.privacySettings, + this.revokeTokensIssuedBefore, + required this.role, + required this.teams, + this.teamsRole, + required this.updatedAt, + }); + + @override + @JsonKey(name: 'avg_response_time') + final int? avgResponseTime; + + @override + @JsonKey(name: 'banned') + final bool banned; + + @override + @JsonKey(name: 'blocked_user_ids') + final List blockedUserIds; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'deactivated_at') + final DateTime? deactivatedAt; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'deleted_at') + final DateTime? deletedAt; + + @override + @JsonKey(name: 'id') + final String id; + + @override + @JsonKey(name: 'image') + final String? image; + + @override + @JsonKey(name: 'invisible') + final bool? invisible; + + @override + @JsonKey(name: 'language') + final String language; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'last_active') + final DateTime? lastActive; + + @override + @JsonKey(name: 'name') + final String? name; + + @override + @JsonKey(name: 'online') + final bool online; + + @override + @JsonKey(name: 'privacy_settings') + final PrivacySettingsResponse? privacySettings; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'revoke_tokens_issued_before') + final DateTime? revokeTokensIssuedBefore; + + @override + @JsonKey(name: 'role') + final String role; + + @override + @JsonKey(name: 'teams') + final List teams; + + @override + @JsonKey(name: 'teams_role') + final Map? teamsRole; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'updated_at') + final DateTime updatedAt; + + Map toJson() => _$UserResponsePrivacyFieldsToJson(this); + + static UserResponsePrivacyFields fromJson(Map json) => _$UserResponsePrivacyFieldsFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/user_response_privacy_fields.freezed.dart b/packages/stream_chat/lib/open_api/model/user_response_privacy_fields.freezed.dart new file mode 100644 index 0000000000..e8ff94efc8 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_response_privacy_fields.freezed.dart @@ -0,0 +1,261 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'user_response_privacy_fields.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UserResponsePrivacyFields { + int? get avgResponseTime; + bool get banned; + List get blockedUserIds; + DateTime get createdAt; + Map get custom; + DateTime? get deactivatedAt; + DateTime? get deletedAt; + String get id; + String? get image; + bool? get invisible; + String get language; + DateTime? get lastActive; + String? get name; + bool get online; + PrivacySettingsResponse? get privacySettings; + DateTime? get revokeTokensIssuedBefore; + String get role; + List get teams; + Map? get teamsRole; + DateTime get updatedAt; + + /// Create a copy of UserResponsePrivacyFields + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UserResponsePrivacyFieldsCopyWith get copyWith => + _$UserResponsePrivacyFieldsCopyWithImpl( + this as UserResponsePrivacyFields, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UserResponsePrivacyFields && + (identical(other.avgResponseTime, avgResponseTime) || other.avgResponseTime == avgResponseTime) && + (identical(other.banned, banned) || other.banned == banned) && + const DeepCollectionEquality().equals( + other.blockedUserIds, + blockedUserIds, + ) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.deactivatedAt, deactivatedAt) || other.deactivatedAt == deactivatedAt) && + (identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt) && + (identical(other.id, id) || other.id == id) && + (identical(other.image, image) || other.image == image) && + (identical(other.invisible, invisible) || other.invisible == invisible) && + (identical(other.language, language) || other.language == language) && + (identical(other.lastActive, lastActive) || other.lastActive == lastActive) && + (identical(other.name, name) || other.name == name) && + (identical(other.online, online) || other.online == online) && + (identical(other.privacySettings, privacySettings) || other.privacySettings == privacySettings) && + (identical( + other.revokeTokensIssuedBefore, + revokeTokensIssuedBefore, + ) || + other.revokeTokensIssuedBefore == revokeTokensIssuedBefore) && + (identical(other.role, role) || other.role == role) && + const DeepCollectionEquality().equals(other.teams, teams) && + const DeepCollectionEquality().equals(other.teamsRole, teamsRole) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)); + } + + @override + int get hashCode => Object.hashAll([ + runtimeType, + avgResponseTime, + banned, + const DeepCollectionEquality().hash(blockedUserIds), + createdAt, + const DeepCollectionEquality().hash(custom), + deactivatedAt, + deletedAt, + id, + image, + invisible, + language, + lastActive, + name, + online, + privacySettings, + revokeTokensIssuedBefore, + role, + const DeepCollectionEquality().hash(teams), + const DeepCollectionEquality().hash(teamsRole), + updatedAt, + ]); + + @override + String toString() { + return 'UserResponsePrivacyFields(avgResponseTime: $avgResponseTime, banned: $banned, blockedUserIds: $blockedUserIds, createdAt: $createdAt, custom: $custom, deactivatedAt: $deactivatedAt, deletedAt: $deletedAt, id: $id, image: $image, invisible: $invisible, language: $language, lastActive: $lastActive, name: $name, online: $online, privacySettings: $privacySettings, revokeTokensIssuedBefore: $revokeTokensIssuedBefore, role: $role, teams: $teams, teamsRole: $teamsRole, updatedAt: $updatedAt)'; + } +} + +/// @nodoc +abstract mixin class $UserResponsePrivacyFieldsCopyWith<$Res> { + factory $UserResponsePrivacyFieldsCopyWith( + UserResponsePrivacyFields value, + $Res Function(UserResponsePrivacyFields) _then, + ) = _$UserResponsePrivacyFieldsCopyWithImpl; + @useResult + $Res call({ + int? avgResponseTime, + bool banned, + List blockedUserIds, + DateTime createdAt, + Map custom, + DateTime? deactivatedAt, + DateTime? deletedAt, + String id, + String? image, + bool? invisible, + String language, + DateTime? lastActive, + String? name, + bool online, + PrivacySettingsResponse? privacySettings, + DateTime? revokeTokensIssuedBefore, + String role, + List teams, + Map? teamsRole, + DateTime updatedAt, + }); +} + +/// @nodoc +class _$UserResponsePrivacyFieldsCopyWithImpl<$Res> implements $UserResponsePrivacyFieldsCopyWith<$Res> { + _$UserResponsePrivacyFieldsCopyWithImpl(this._self, this._then); + + final UserResponsePrivacyFields _self; + final $Res Function(UserResponsePrivacyFields) _then; + + /// Create a copy of UserResponsePrivacyFields + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? avgResponseTime = freezed, + Object? banned = null, + Object? blockedUserIds = null, + Object? createdAt = null, + Object? custom = null, + Object? deactivatedAt = freezed, + Object? deletedAt = freezed, + Object? id = null, + Object? image = freezed, + Object? invisible = freezed, + Object? language = null, + Object? lastActive = freezed, + Object? name = freezed, + Object? online = null, + Object? privacySettings = freezed, + Object? revokeTokensIssuedBefore = freezed, + Object? role = null, + Object? teams = null, + Object? teamsRole = freezed, + Object? updatedAt = null, + }) { + return _then( + UserResponsePrivacyFields( + avgResponseTime: freezed == avgResponseTime + ? _self.avgResponseTime + : avgResponseTime // ignore: cast_nullable_to_non_nullable + as int?, + banned: null == banned + ? _self.banned + : banned // ignore: cast_nullable_to_non_nullable + as bool, + blockedUserIds: null == blockedUserIds + ? _self.blockedUserIds + : blockedUserIds // ignore: cast_nullable_to_non_nullable + as List, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + deactivatedAt: freezed == deactivatedAt + ? _self.deactivatedAt + : deactivatedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + deletedAt: freezed == deletedAt + ? _self.deletedAt + : deletedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + image: freezed == image + ? _self.image + : image // ignore: cast_nullable_to_non_nullable + as String?, + invisible: freezed == invisible + ? _self.invisible + : invisible // ignore: cast_nullable_to_non_nullable + as bool?, + language: null == language + ? _self.language + : language // ignore: cast_nullable_to_non_nullable + as String, + lastActive: freezed == lastActive + ? _self.lastActive + : lastActive // ignore: cast_nullable_to_non_nullable + as DateTime?, + name: freezed == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + online: null == online + ? _self.online + : online // ignore: cast_nullable_to_non_nullable + as bool, + privacySettings: freezed == privacySettings + ? _self.privacySettings + : privacySettings // ignore: cast_nullable_to_non_nullable + as PrivacySettingsResponse?, + revokeTokensIssuedBefore: freezed == revokeTokensIssuedBefore + ? _self.revokeTokensIssuedBefore + : revokeTokensIssuedBefore // ignore: cast_nullable_to_non_nullable + as DateTime?, + role: null == role + ? _self.role + : role // ignore: cast_nullable_to_non_nullable + as String, + teams: null == teams + ? _self.teams + : teams // ignore: cast_nullable_to_non_nullable + as List, + teamsRole: freezed == teamsRole + ? _self.teamsRole + : teamsRole // ignore: cast_nullable_to_non_nullable + as Map?, + updatedAt: null == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/user_response_privacy_fields.g.dart b/packages/stream_chat/lib/open_api/model/user_response_privacy_fields.g.dart new file mode 100644 index 0000000000..cb03486484 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_response_privacy_fields.g.dart @@ -0,0 +1,101 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'user_response_privacy_fields.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UserResponsePrivacyFields _$UserResponsePrivacyFieldsFromJson( + Map json, +) => UserResponsePrivacyFields( + avgResponseTime: (json['avg_response_time'] as num?)?.toInt(), + banned: json['banned'] as bool, + blockedUserIds: (json['blocked_user_ids'] as List).map((e) => e as String).toList(), + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + deactivatedAt: _$JsonConverterFromJson( + json['deactivated_at'], + const StreamDateTimeConverter().fromJson, + ), + deletedAt: _$JsonConverterFromJson( + json['deleted_at'], + const StreamDateTimeConverter().fromJson, + ), + id: json['id'] as String, + image: json['image'] as String?, + invisible: json['invisible'] as bool?, + language: json['language'] as String, + lastActive: _$JsonConverterFromJson( + json['last_active'], + const StreamDateTimeConverter().fromJson, + ), + name: json['name'] as String?, + online: json['online'] as bool, + privacySettings: json['privacy_settings'] == null + ? null + : PrivacySettingsResponse.fromJson( + json['privacy_settings'] as Map, + ), + revokeTokensIssuedBefore: _$JsonConverterFromJson( + json['revoke_tokens_issued_before'], + const StreamDateTimeConverter().fromJson, + ), + role: json['role'] as String, + teams: (json['teams'] as List).map((e) => e as String).toList(), + teamsRole: (json['teams_role'] as Map?)?.map( + (k, e) => MapEntry(k, e as String), + ), + updatedAt: const StreamDateTimeConverter().fromJson( + json['updated_at'] as Object, + ), +); + +Map _$UserResponsePrivacyFieldsToJson( + UserResponsePrivacyFields instance, +) => { + 'avg_response_time': instance.avgResponseTime, + 'banned': instance.banned, + 'blocked_user_ids': instance.blockedUserIds, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'deactivated_at': _$JsonConverterToJson( + instance.deactivatedAt, + const StreamDateTimeConverter().toJson, + ), + 'deleted_at': _$JsonConverterToJson( + instance.deletedAt, + const StreamDateTimeConverter().toJson, + ), + 'id': instance.id, + 'image': instance.image, + 'invisible': instance.invisible, + 'language': instance.language, + 'last_active': _$JsonConverterToJson( + instance.lastActive, + const StreamDateTimeConverter().toJson, + ), + 'name': instance.name, + 'online': instance.online, + 'privacy_settings': instance.privacySettings?.toJson(), + 'revoke_tokens_issued_before': _$JsonConverterToJson( + instance.revokeTokensIssuedBefore, + const StreamDateTimeConverter().toJson, + ), + 'role': instance.role, + 'teams': instance.teams, + 'teams_role': instance.teamsRole, + 'updated_at': const StreamDateTimeConverter().toJson(instance.updatedAt), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/user_role_parameters.dart b/packages/stream_chat/lib/open_api/model/user_role_parameters.dart new file mode 100644 index 0000000000..e21b4a48cd --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_role_parameters.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'user_role_parameters.g.dart'; +part 'user_role_parameters.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UserRoleParameters with _$UserRoleParameters { + const UserRoleParameters({ + this.operator, + this.role, + }); + + @override + @JsonKey(name: 'operator') + final String? operator; + + @override + @JsonKey(name: 'role') + final String? role; + + Map toJson() => _$UserRoleParametersToJson(this); + + static UserRoleParameters fromJson(Map json) => _$UserRoleParametersFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/user_role_parameters.freezed.dart b/packages/stream_chat/lib/open_api/model/user_role_parameters.freezed.dart new file mode 100644 index 0000000000..af628a76b4 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_role_parameters.freezed.dart @@ -0,0 +1,81 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'user_role_parameters.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UserRoleParameters { + String? get operator; + String? get role; + + /// Create a copy of UserRoleParameters + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UserRoleParametersCopyWith get copyWith => _$UserRoleParametersCopyWithImpl( + this as UserRoleParameters, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UserRoleParameters && + (identical(other.operator, operator) || other.operator == operator) && + (identical(other.role, role) || other.role == role)); + } + + @override + int get hashCode => Object.hash(runtimeType, operator, role); + + @override + String toString() { + return 'UserRoleParameters(operator: $operator, role: $role)'; + } +} + +/// @nodoc +abstract mixin class $UserRoleParametersCopyWith<$Res> { + factory $UserRoleParametersCopyWith( + UserRoleParameters value, + $Res Function(UserRoleParameters) _then, + ) = _$UserRoleParametersCopyWithImpl; + @useResult + $Res call({String? operator, String? role}); +} + +/// @nodoc +class _$UserRoleParametersCopyWithImpl<$Res> implements $UserRoleParametersCopyWith<$Res> { + _$UserRoleParametersCopyWithImpl(this._self, this._then); + + final UserRoleParameters _self; + final $Res Function(UserRoleParameters) _then; + + /// Create a copy of UserRoleParameters + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? operator = freezed, Object? role = freezed}) { + return _then( + UserRoleParameters( + operator: freezed == operator + ? _self.operator + : operator // ignore: cast_nullable_to_non_nullable + as String?, + role: freezed == role + ? _self.role + : role // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/user_role_parameters.g.dart b/packages/stream_chat/lib/open_api/model/user_role_parameters.g.dart new file mode 100644 index 0000000000..fb33dcf293 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_role_parameters.g.dart @@ -0,0 +1,17 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'user_role_parameters.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UserRoleParameters _$UserRoleParametersFromJson(Map json) => UserRoleParameters( + operator: json['operator'] as String?, + role: json['role'] as String?, +); + +Map _$UserRoleParametersToJson(UserRoleParameters instance) => { + 'operator': instance.operator, + 'role': instance.role, +}; diff --git a/packages/stream_chat/lib/open_api/model/user_rule_parameters.dart b/packages/stream_chat/lib/open_api/model/user_rule_parameters.dart new file mode 100644 index 0000000000..8a8f3029a5 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_rule_parameters.dart @@ -0,0 +1,31 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'user_rule_parameters.g.dart'; +part 'user_rule_parameters.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UserRuleParameters with _$UserRuleParameters { + const UserRuleParameters({ + this.maxAge, + }); + + @override + @JsonKey(name: 'max_age') + final String? maxAge; + + Map toJson() => _$UserRuleParametersToJson(this); + + static UserRuleParameters fromJson(Map json) => _$UserRuleParametersFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/user_rule_parameters.freezed.dart b/packages/stream_chat/lib/open_api/model/user_rule_parameters.freezed.dart new file mode 100644 index 0000000000..2d80f1b83f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_rule_parameters.freezed.dart @@ -0,0 +1,75 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'user_rule_parameters.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UserRuleParameters { + String? get maxAge; + + /// Create a copy of UserRuleParameters + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UserRuleParametersCopyWith get copyWith => _$UserRuleParametersCopyWithImpl( + this as UserRuleParameters, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UserRuleParameters && + (identical(other.maxAge, maxAge) || other.maxAge == maxAge)); + } + + @override + int get hashCode => Object.hash(runtimeType, maxAge); + + @override + String toString() { + return 'UserRuleParameters(maxAge: $maxAge)'; + } +} + +/// @nodoc +abstract mixin class $UserRuleParametersCopyWith<$Res> { + factory $UserRuleParametersCopyWith( + UserRuleParameters value, + $Res Function(UserRuleParameters) _then, + ) = _$UserRuleParametersCopyWithImpl; + @useResult + $Res call({String? maxAge}); +} + +/// @nodoc +class _$UserRuleParametersCopyWithImpl<$Res> implements $UserRuleParametersCopyWith<$Res> { + _$UserRuleParametersCopyWithImpl(this._self, this._then); + + final UserRuleParameters _self; + final $Res Function(UserRuleParameters) _then; + + /// Create a copy of UserRuleParameters + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? maxAge = freezed}) { + return _then( + UserRuleParameters( + maxAge: freezed == maxAge + ? _self.maxAge + : maxAge // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/user_rule_parameters.g.dart b/packages/stream_chat/lib/open_api/model/user_rule_parameters.g.dart new file mode 100644 index 0000000000..ea3eccb671 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_rule_parameters.g.dart @@ -0,0 +1,14 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'user_rule_parameters.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UserRuleParameters _$UserRuleParametersFromJson(Map json) => + UserRuleParameters(maxAge: json['max_age'] as String?); + +Map _$UserRuleParametersToJson(UserRuleParameters instance) => { + 'max_age': instance.maxAge, +}; diff --git a/packages/stream_chat/lib/open_api/model/user_unbanned_event.dart b/packages/stream_chat/lib/open_api/model/user_unbanned_event.dart new file mode 100644 index 0000000000..f908f4b496 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_unbanned_event.dart @@ -0,0 +1,98 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'user_unbanned_event.g.dart'; +part 'user_unbanned_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UserUnbannedEvent extends core.WsEvent with _$UserUnbannedEvent { + const UserUnbannedEvent({ + this.channelCustom, + this.channelId, + this.channelMemberCount, + this.channelMessageCount, + this.channelType, + this.cid, + required this.createdAt, + this.createdBy, + required this.custom, + this.receivedAt, + this.shadow, + this.team, + required this.type, + required this.user, + }); + + @override + @JsonKey(name: 'channel_custom') + final Map? channelCustom; + + @override + @JsonKey(name: 'channel_id') + final String? channelId; + + @override + @JsonKey(name: 'channel_member_count') + final int? channelMemberCount; + + @override + @JsonKey(name: 'channel_message_count') + final int? channelMessageCount; + + @override + @JsonKey(name: 'channel_type') + final String? channelType; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'created_by') + final UserResponseCommonFields? createdBy; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'shadow') + final bool? shadow; + + @override + @JsonKey(name: 'team') + final String? team; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'user') + final UserResponseCommonFields user; + + Map toJson() => _$UserUnbannedEventToJson(this); + + static UserUnbannedEvent fromJson(Map json) => _$UserUnbannedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/user_unbanned_event.freezed.dart b/packages/stream_chat/lib/open_api/model/user_unbanned_event.freezed.dart new file mode 100644 index 0000000000..db8c733686 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_unbanned_event.freezed.dart @@ -0,0 +1,204 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'user_unbanned_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UserUnbannedEvent { + Map? get channelCustom; + String? get channelId; + int? get channelMemberCount; + int? get channelMessageCount; + String? get channelType; + String? get cid; + DateTime get createdAt; + UserResponseCommonFields? get createdBy; + Map get custom; + DateTime? get receivedAt; + bool? get shadow; + String? get team; + String get type; + UserResponseCommonFields get user; + + /// Create a copy of UserUnbannedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UserUnbannedEventCopyWith get copyWith => _$UserUnbannedEventCopyWithImpl( + this as UserUnbannedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UserUnbannedEvent && + const DeepCollectionEquality().equals( + other.channelCustom, + channelCustom, + ) && + (identical(other.channelId, channelId) || other.channelId == channelId) && + (identical(other.channelMemberCount, channelMemberCount) || + other.channelMemberCount == channelMemberCount) && + (identical(other.channelMessageCount, channelMessageCount) || + other.channelMessageCount == channelMessageCount) && + (identical(other.channelType, channelType) || other.channelType == channelType) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.createdBy, createdBy) || other.createdBy == createdBy) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.shadow, shadow) || other.shadow == shadow) && + (identical(other.team, team) || other.team == team) && + (identical(other.type, type) || other.type == type) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(channelCustom), + channelId, + channelMemberCount, + channelMessageCount, + channelType, + cid, + createdAt, + createdBy, + const DeepCollectionEquality().hash(custom), + receivedAt, + shadow, + team, + type, + user, + ); + + @override + String toString() { + return 'UserUnbannedEvent(channelCustom: $channelCustom, channelId: $channelId, channelMemberCount: $channelMemberCount, channelMessageCount: $channelMessageCount, channelType: $channelType, cid: $cid, createdAt: $createdAt, createdBy: $createdBy, custom: $custom, receivedAt: $receivedAt, shadow: $shadow, team: $team, type: $type, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $UserUnbannedEventCopyWith<$Res> { + factory $UserUnbannedEventCopyWith( + UserUnbannedEvent value, + $Res Function(UserUnbannedEvent) _then, + ) = _$UserUnbannedEventCopyWithImpl; + @useResult + $Res call({ + Map? channelCustom, + String? channelId, + int? channelMemberCount, + int? channelMessageCount, + String? channelType, + String? cid, + DateTime createdAt, + UserResponseCommonFields? createdBy, + Map custom, + DateTime? receivedAt, + bool? shadow, + String? team, + String type, + UserResponseCommonFields user, + }); +} + +/// @nodoc +class _$UserUnbannedEventCopyWithImpl<$Res> implements $UserUnbannedEventCopyWith<$Res> { + _$UserUnbannedEventCopyWithImpl(this._self, this._then); + + final UserUnbannedEvent _self; + final $Res Function(UserUnbannedEvent) _then; + + /// Create a copy of UserUnbannedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channelCustom = freezed, + Object? channelId = freezed, + Object? channelMemberCount = freezed, + Object? channelMessageCount = freezed, + Object? channelType = freezed, + Object? cid = freezed, + Object? createdAt = null, + Object? createdBy = freezed, + Object? custom = null, + Object? receivedAt = freezed, + Object? shadow = freezed, + Object? team = freezed, + Object? type = null, + Object? user = null, + }) { + return _then( + UserUnbannedEvent( + channelCustom: freezed == channelCustom + ? _self.channelCustom + : channelCustom // ignore: cast_nullable_to_non_nullable + as Map?, + channelId: freezed == channelId + ? _self.channelId + : channelId // ignore: cast_nullable_to_non_nullable + as String?, + channelMemberCount: freezed == channelMemberCount + ? _self.channelMemberCount + : channelMemberCount // ignore: cast_nullable_to_non_nullable + as int?, + channelMessageCount: freezed == channelMessageCount + ? _self.channelMessageCount + : channelMessageCount // ignore: cast_nullable_to_non_nullable + as int?, + channelType: freezed == channelType + ? _self.channelType + : channelType // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + createdBy: freezed == createdBy + ? _self.createdBy + : createdBy // ignore: cast_nullable_to_non_nullable + as UserResponseCommonFields?, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + shadow: freezed == shadow + ? _self.shadow + : shadow // ignore: cast_nullable_to_non_nullable + as bool?, + team: freezed == team + ? _self.team + : team // ignore: cast_nullable_to_non_nullable + as String?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + user: null == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponseCommonFields, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/user_unbanned_event.g.dart b/packages/stream_chat/lib/open_api/model/user_unbanned_event.g.dart new file mode 100644 index 0000000000..16b306dc2d --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_unbanned_event.g.dart @@ -0,0 +1,65 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'user_unbanned_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UserUnbannedEvent _$UserUnbannedEventFromJson(Map json) => UserUnbannedEvent( + channelCustom: json['channel_custom'] as Map?, + channelId: json['channel_id'] as String?, + channelMemberCount: (json['channel_member_count'] as num?)?.toInt(), + channelMessageCount: (json['channel_message_count'] as num?)?.toInt(), + channelType: json['channel_type'] as String?, + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + createdBy: json['created_by'] == null + ? null + : UserResponseCommonFields.fromJson( + json['created_by'] as Map, + ), + custom: json['custom'] as Map, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + shadow: json['shadow'] as bool?, + team: json['team'] as String?, + type: json['type'] as String, + user: UserResponseCommonFields.fromJson( + json['user'] as Map, + ), +); + +Map _$UserUnbannedEventToJson(UserUnbannedEvent instance) => { + 'channel_custom': instance.channelCustom, + 'channel_id': instance.channelId, + 'channel_member_count': instance.channelMemberCount, + 'channel_message_count': instance.channelMessageCount, + 'channel_type': instance.channelType, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'created_by': instance.createdBy?.toJson(), + 'custom': instance.custom, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'shadow': instance.shadow, + 'team': instance.team, + 'type': instance.type, + 'user': instance.user.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/user_updated_event.dart b/packages/stream_chat/lib/open_api/model/user_updated_event.dart new file mode 100644 index 0000000000..35d66c2a85 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_updated_event.dart @@ -0,0 +1,53 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'user_updated_event.g.dart'; +part 'user_updated_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UserUpdatedEvent extends core.WsEvent with _$UserUpdatedEvent { + const UserUpdatedEvent({ + required this.createdAt, + required this.custom, + this.receivedAt, + required this.type, + required this.user, + }); + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'user') + final UserResponsePrivacyFields user; + + Map toJson() => _$UserUpdatedEventToJson(this); + + static UserUpdatedEvent fromJson(Map json) => _$UserUpdatedEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/user_updated_event.freezed.dart b/packages/stream_chat/lib/open_api/model/user_updated_event.freezed.dart new file mode 100644 index 0000000000..d2fa81a1e8 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_updated_event.freezed.dart @@ -0,0 +1,118 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'user_updated_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UserUpdatedEvent { + DateTime get createdAt; + Map get custom; + DateTime? get receivedAt; + String get type; + UserResponsePrivacyFields get user; + + /// Create a copy of UserUpdatedEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UserUpdatedEventCopyWith get copyWith => _$UserUpdatedEventCopyWithImpl( + this as UserUpdatedEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UserUpdatedEvent && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.type, type) || other.type == type) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + createdAt, + const DeepCollectionEquality().hash(custom), + receivedAt, + type, + user, + ); + + @override + String toString() { + return 'UserUpdatedEvent(createdAt: $createdAt, custom: $custom, receivedAt: $receivedAt, type: $type, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $UserUpdatedEventCopyWith<$Res> { + factory $UserUpdatedEventCopyWith( + UserUpdatedEvent value, + $Res Function(UserUpdatedEvent) _then, + ) = _$UserUpdatedEventCopyWithImpl; + @useResult + $Res call({ + DateTime createdAt, + Map custom, + DateTime? receivedAt, + String type, + UserResponsePrivacyFields user, + }); +} + +/// @nodoc +class _$UserUpdatedEventCopyWithImpl<$Res> implements $UserUpdatedEventCopyWith<$Res> { + _$UserUpdatedEventCopyWithImpl(this._self, this._then); + + final UserUpdatedEvent _self; + final $Res Function(UserUpdatedEvent) _then; + + /// Create a copy of UserUpdatedEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? createdAt = null, + Object? custom = null, + Object? receivedAt = freezed, + Object? type = null, + Object? user = null, + }) { + return _then( + UserUpdatedEvent( + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + user: null == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponsePrivacyFields, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/user_updated_event.g.dart b/packages/stream_chat/lib/open_api/model/user_updated_event.g.dart new file mode 100644 index 0000000000..2b445cdf00 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_updated_event.g.dart @@ -0,0 +1,43 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'user_updated_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UserUpdatedEvent _$UserUpdatedEventFromJson(Map json) => UserUpdatedEvent( + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + type: json['type'] as String, + user: UserResponsePrivacyFields.fromJson( + json['user'] as Map, + ), +); + +Map _$UserUpdatedEventToJson(UserUpdatedEvent instance) => { + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'type': instance.type, + 'user': instance.user.toJson(), +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/user_watching_start_event.dart b/packages/stream_chat/lib/open_api/model/user_watching_start_event.dart new file mode 100644 index 0000000000..2332210e1c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_watching_start_event.dart @@ -0,0 +1,73 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'user_watching_start_event.g.dart'; +part 'user_watching_start_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UserWatchingStartEvent extends core.WsEvent with _$UserWatchingStartEvent { + const UserWatchingStartEvent({ + this.channelId, + this.channelType, + this.cid, + required this.createdAt, + required this.custom, + this.receivedAt, + required this.type, + required this.user, + required this.watcherCount, + }); + + @override + @JsonKey(name: 'channel_id') + final String? channelId; + + @override + @JsonKey(name: 'channel_type') + final String? channelType; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'user') + final UserResponseCommonFields user; + + @override + @JsonKey(name: 'watcher_count') + final int watcherCount; + + Map toJson() => _$UserWatchingStartEventToJson(this); + + static UserWatchingStartEvent fromJson(Map json) => _$UserWatchingStartEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/user_watching_start_event.freezed.dart b/packages/stream_chat/lib/open_api/model/user_watching_start_event.freezed.dart new file mode 100644 index 0000000000..0e01bb286f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_watching_start_event.freezed.dart @@ -0,0 +1,155 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'user_watching_start_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UserWatchingStartEvent { + String? get channelId; + String? get channelType; + String? get cid; + DateTime get createdAt; + Map get custom; + DateTime? get receivedAt; + String get type; + UserResponseCommonFields get user; + int get watcherCount; + + /// Create a copy of UserWatchingStartEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UserWatchingStartEventCopyWith get copyWith => + _$UserWatchingStartEventCopyWithImpl( + this as UserWatchingStartEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UserWatchingStartEvent && + (identical(other.channelId, channelId) || other.channelId == channelId) && + (identical(other.channelType, channelType) || other.channelType == channelType) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.type, type) || other.type == type) && + (identical(other.user, user) || other.user == user) && + (identical(other.watcherCount, watcherCount) || other.watcherCount == watcherCount)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channelId, + channelType, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + receivedAt, + type, + user, + watcherCount, + ); + + @override + String toString() { + return 'UserWatchingStartEvent(channelId: $channelId, channelType: $channelType, cid: $cid, createdAt: $createdAt, custom: $custom, receivedAt: $receivedAt, type: $type, user: $user, watcherCount: $watcherCount)'; + } +} + +/// @nodoc +abstract mixin class $UserWatchingStartEventCopyWith<$Res> { + factory $UserWatchingStartEventCopyWith( + UserWatchingStartEvent value, + $Res Function(UserWatchingStartEvent) _then, + ) = _$UserWatchingStartEventCopyWithImpl; + @useResult + $Res call({ + String? channelId, + String? channelType, + String? cid, + DateTime createdAt, + Map custom, + DateTime? receivedAt, + String type, + UserResponseCommonFields user, + int watcherCount, + }); +} + +/// @nodoc +class _$UserWatchingStartEventCopyWithImpl<$Res> implements $UserWatchingStartEventCopyWith<$Res> { + _$UserWatchingStartEventCopyWithImpl(this._self, this._then); + + final UserWatchingStartEvent _self; + final $Res Function(UserWatchingStartEvent) _then; + + /// Create a copy of UserWatchingStartEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channelId = freezed, + Object? channelType = freezed, + Object? cid = freezed, + Object? createdAt = null, + Object? custom = null, + Object? receivedAt = freezed, + Object? type = null, + Object? user = null, + Object? watcherCount = null, + }) { + return _then( + UserWatchingStartEvent( + channelId: freezed == channelId + ? _self.channelId + : channelId // ignore: cast_nullable_to_non_nullable + as String?, + channelType: freezed == channelType + ? _self.channelType + : channelType // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + user: null == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponseCommonFields, + watcherCount: null == watcherCount + ? _self.watcherCount + : watcherCount // ignore: cast_nullable_to_non_nullable + as int, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/user_watching_start_event.g.dart b/packages/stream_chat/lib/open_api/model/user_watching_start_event.g.dart new file mode 100644 index 0000000000..e3a0e285d0 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_watching_start_event.g.dart @@ -0,0 +1,53 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'user_watching_start_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UserWatchingStartEvent _$UserWatchingStartEventFromJson( + Map json, +) => UserWatchingStartEvent( + channelId: json['channel_id'] as String?, + channelType: json['channel_type'] as String?, + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + type: json['type'] as String, + user: UserResponseCommonFields.fromJson(json['user'] as Map), + watcherCount: (json['watcher_count'] as num).toInt(), +); + +Map _$UserWatchingStartEventToJson( + UserWatchingStartEvent instance, +) => { + 'channel_id': instance.channelId, + 'channel_type': instance.channelType, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'type': instance.type, + 'user': instance.user.toJson(), + 'watcher_count': instance.watcherCount, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/user_watching_stop_event.dart b/packages/stream_chat/lib/open_api/model/user_watching_stop_event.dart new file mode 100644 index 0000000000..c0683d091b --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_watching_stop_event.dart @@ -0,0 +1,73 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'user_watching_stop_event.g.dart'; +part 'user_watching_stop_event.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UserWatchingStopEvent extends core.WsEvent with _$UserWatchingStopEvent { + const UserWatchingStopEvent({ + this.channelId, + this.channelType, + this.cid, + required this.createdAt, + required this.custom, + this.receivedAt, + required this.type, + required this.user, + required this.watcherCount, + }); + + @override + @JsonKey(name: 'channel_id') + final String? channelId; + + @override + @JsonKey(name: 'channel_type') + final String? channelType; + + @override + @JsonKey(name: 'cid') + final String? cid; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at') + final DateTime createdAt; + + @override + @JsonKey(name: 'custom') + final Map custom; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'received_at') + final DateTime? receivedAt; + + @override + @JsonKey(name: 'type') + final String type; + + @override + @JsonKey(name: 'user') + final UserResponseCommonFields user; + + @override + @JsonKey(name: 'watcher_count') + final int watcherCount; + + Map toJson() => _$UserWatchingStopEventToJson(this); + + static UserWatchingStopEvent fromJson(Map json) => _$UserWatchingStopEventFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/user_watching_stop_event.freezed.dart b/packages/stream_chat/lib/open_api/model/user_watching_stop_event.freezed.dart new file mode 100644 index 0000000000..acb73f7709 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_watching_stop_event.freezed.dart @@ -0,0 +1,155 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'user_watching_stop_event.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UserWatchingStopEvent { + String? get channelId; + String? get channelType; + String? get cid; + DateTime get createdAt; + Map get custom; + DateTime? get receivedAt; + String get type; + UserResponseCommonFields get user; + int get watcherCount; + + /// Create a copy of UserWatchingStopEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UserWatchingStopEventCopyWith get copyWith => + _$UserWatchingStopEventCopyWithImpl( + this as UserWatchingStopEvent, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UserWatchingStopEvent && + (identical(other.channelId, channelId) || other.channelId == channelId) && + (identical(other.channelType, channelType) || other.channelType == channelType) && + (identical(other.cid, cid) || other.cid == cid) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && + (identical(other.type, type) || other.type == type) && + (identical(other.user, user) || other.user == user) && + (identical(other.watcherCount, watcherCount) || other.watcherCount == watcherCount)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + channelId, + channelType, + cid, + createdAt, + const DeepCollectionEquality().hash(custom), + receivedAt, + type, + user, + watcherCount, + ); + + @override + String toString() { + return 'UserWatchingStopEvent(channelId: $channelId, channelType: $channelType, cid: $cid, createdAt: $createdAt, custom: $custom, receivedAt: $receivedAt, type: $type, user: $user, watcherCount: $watcherCount)'; + } +} + +/// @nodoc +abstract mixin class $UserWatchingStopEventCopyWith<$Res> { + factory $UserWatchingStopEventCopyWith( + UserWatchingStopEvent value, + $Res Function(UserWatchingStopEvent) _then, + ) = _$UserWatchingStopEventCopyWithImpl; + @useResult + $Res call({ + String? channelId, + String? channelType, + String? cid, + DateTime createdAt, + Map custom, + DateTime? receivedAt, + String type, + UserResponseCommonFields user, + int watcherCount, + }); +} + +/// @nodoc +class _$UserWatchingStopEventCopyWithImpl<$Res> implements $UserWatchingStopEventCopyWith<$Res> { + _$UserWatchingStopEventCopyWithImpl(this._self, this._then); + + final UserWatchingStopEvent _self; + final $Res Function(UserWatchingStopEvent) _then; + + /// Create a copy of UserWatchingStopEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channelId = freezed, + Object? channelType = freezed, + Object? cid = freezed, + Object? createdAt = null, + Object? custom = null, + Object? receivedAt = freezed, + Object? type = null, + Object? user = null, + Object? watcherCount = null, + }) { + return _then( + UserWatchingStopEvent( + channelId: freezed == channelId + ? _self.channelId + : channelId // ignore: cast_nullable_to_non_nullable + as String?, + channelType: freezed == channelType + ? _self.channelType + : channelType // ignore: cast_nullable_to_non_nullable + as String?, + cid: freezed == cid + ? _self.cid + : cid // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + receivedAt: freezed == receivedAt + ? _self.receivedAt + : receivedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + user: null == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserResponseCommonFields, + watcherCount: null == watcherCount + ? _self.watcherCount + : watcherCount // ignore: cast_nullable_to_non_nullable + as int, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/user_watching_stop_event.g.dart b/packages/stream_chat/lib/open_api/model/user_watching_stop_event.g.dart new file mode 100644 index 0000000000..6cdc2ffc6b --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_watching_stop_event.g.dart @@ -0,0 +1,53 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'user_watching_stop_event.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UserWatchingStopEvent _$UserWatchingStopEventFromJson( + Map json, +) => UserWatchingStopEvent( + channelId: json['channel_id'] as String?, + channelType: json['channel_type'] as String?, + cid: json['cid'] as String?, + createdAt: const StreamDateTimeConverter().fromJson( + json['created_at'] as Object, + ), + custom: json['custom'] as Map, + receivedAt: _$JsonConverterFromJson( + json['received_at'], + const StreamDateTimeConverter().fromJson, + ), + type: json['type'] as String, + user: UserResponseCommonFields.fromJson(json['user'] as Map), + watcherCount: (json['watcher_count'] as num).toInt(), +); + +Map _$UserWatchingStopEventToJson( + UserWatchingStopEvent instance, +) => { + 'channel_id': instance.channelId, + 'channel_type': instance.channelType, + 'cid': instance.cid, + 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'custom': instance.custom, + 'received_at': _$JsonConverterToJson( + instance.receivedAt, + const StreamDateTimeConverter().toJson, + ), + 'type': instance.type, + 'user': instance.user.toJson(), + 'watcher_count': instance.watcherCount, +}; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/velocity_filter_config.dart b/packages/stream_chat/lib/open_api/model/velocity_filter_config.dart new file mode 100644 index 0000000000..7725e8441b --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/velocity_filter_config.dart @@ -0,0 +1,61 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'velocity_filter_config.g.dart'; +part 'velocity_filter_config.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class VelocityFilterConfig with _$VelocityFilterConfig { + const VelocityFilterConfig({ + required this.advancedFilters, + this.async, + required this.cascadingActions, + required this.cidsPerUser, + required this.enabled, + required this.firstMessageOnly, + required this.rules, + }); + + @override + @JsonKey(name: 'advanced_filters') + final bool advancedFilters; + + @override + @JsonKey(name: 'async') + final bool? async; + + @override + @JsonKey(name: 'cascading_actions') + final bool cascadingActions; + + @override + @JsonKey(name: 'cids_per_user') + final int cidsPerUser; + + @override + @JsonKey(name: 'enabled') + final bool enabled; + + @override + @JsonKey(name: 'first_message_only') + final bool firstMessageOnly; + + @override + @JsonKey(name: 'rules') + final List rules; + + Map toJson() => _$VelocityFilterConfigToJson(this); + + static VelocityFilterConfig fromJson(Map json) => _$VelocityFilterConfigFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/velocity_filter_config.freezed.dart b/packages/stream_chat/lib/open_api/model/velocity_filter_config.freezed.dart new file mode 100644 index 0000000000..d390f15754 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/velocity_filter_config.freezed.dart @@ -0,0 +1,137 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'velocity_filter_config.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$VelocityFilterConfig { + bool get advancedFilters; + bool? get async; + bool get cascadingActions; + int get cidsPerUser; + bool get enabled; + bool get firstMessageOnly; + List get rules; + + /// Create a copy of VelocityFilterConfig + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $VelocityFilterConfigCopyWith get copyWith => + _$VelocityFilterConfigCopyWithImpl( + this as VelocityFilterConfig, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is VelocityFilterConfig && + (identical(other.advancedFilters, advancedFilters) || other.advancedFilters == advancedFilters) && + (identical(other.async, async) || other.async == async) && + (identical(other.cascadingActions, cascadingActions) || other.cascadingActions == cascadingActions) && + (identical(other.cidsPerUser, cidsPerUser) || other.cidsPerUser == cidsPerUser) && + (identical(other.enabled, enabled) || other.enabled == enabled) && + (identical(other.firstMessageOnly, firstMessageOnly) || other.firstMessageOnly == firstMessageOnly) && + const DeepCollectionEquality().equals(other.rules, rules)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + advancedFilters, + async, + cascadingActions, + cidsPerUser, + enabled, + firstMessageOnly, + const DeepCollectionEquality().hash(rules), + ); + + @override + String toString() { + return 'VelocityFilterConfig(advancedFilters: $advancedFilters, async: $async, cascadingActions: $cascadingActions, cidsPerUser: $cidsPerUser, enabled: $enabled, firstMessageOnly: $firstMessageOnly, rules: $rules)'; + } +} + +/// @nodoc +abstract mixin class $VelocityFilterConfigCopyWith<$Res> { + factory $VelocityFilterConfigCopyWith( + VelocityFilterConfig value, + $Res Function(VelocityFilterConfig) _then, + ) = _$VelocityFilterConfigCopyWithImpl; + @useResult + $Res call({ + bool advancedFilters, + bool? async, + bool cascadingActions, + int cidsPerUser, + bool enabled, + bool firstMessageOnly, + List rules, + }); +} + +/// @nodoc +class _$VelocityFilterConfigCopyWithImpl<$Res> implements $VelocityFilterConfigCopyWith<$Res> { + _$VelocityFilterConfigCopyWithImpl(this._self, this._then); + + final VelocityFilterConfig _self; + final $Res Function(VelocityFilterConfig) _then; + + /// Create a copy of VelocityFilterConfig + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? advancedFilters = null, + Object? async = freezed, + Object? cascadingActions = null, + Object? cidsPerUser = null, + Object? enabled = null, + Object? firstMessageOnly = null, + Object? rules = null, + }) { + return _then( + VelocityFilterConfig( + advancedFilters: null == advancedFilters + ? _self.advancedFilters + : advancedFilters // ignore: cast_nullable_to_non_nullable + as bool, + async: freezed == async + ? _self.async + : async // ignore: cast_nullable_to_non_nullable + as bool?, + cascadingActions: null == cascadingActions + ? _self.cascadingActions + : cascadingActions // ignore: cast_nullable_to_non_nullable + as bool, + cidsPerUser: null == cidsPerUser + ? _self.cidsPerUser + : cidsPerUser // ignore: cast_nullable_to_non_nullable + as int, + enabled: null == enabled + ? _self.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool, + firstMessageOnly: null == firstMessageOnly + ? _self.firstMessageOnly + : firstMessageOnly // ignore: cast_nullable_to_non_nullable + as bool, + rules: null == rules + ? _self.rules + : rules // ignore: cast_nullable_to_non_nullable + as List, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/velocity_filter_config.g.dart b/packages/stream_chat/lib/open_api/model/velocity_filter_config.g.dart new file mode 100644 index 0000000000..e8ddb32285 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/velocity_filter_config.g.dart @@ -0,0 +1,33 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'velocity_filter_config.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +VelocityFilterConfig _$VelocityFilterConfigFromJson( + Map json, +) => VelocityFilterConfig( + advancedFilters: json['advanced_filters'] as bool, + async: json['async'] as bool?, + cascadingActions: json['cascading_actions'] as bool, + cidsPerUser: (json['cids_per_user'] as num).toInt(), + enabled: json['enabled'] as bool, + firstMessageOnly: json['first_message_only'] as bool, + rules: (json['rules'] as List) + .map((e) => VelocityFilterConfigRule.fromJson(e as Map)) + .toList(), +); + +Map _$VelocityFilterConfigToJson( + VelocityFilterConfig instance, +) => { + 'advanced_filters': instance.advancedFilters, + 'async': instance.async, + 'cascading_actions': instance.cascadingActions, + 'cids_per_user': instance.cidsPerUser, + 'enabled': instance.enabled, + 'first_message_only': instance.firstMessageOnly, + 'rules': instance.rules.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/velocity_filter_config_rule.dart b/packages/stream_chat/lib/open_api/model/velocity_filter_config_rule.dart new file mode 100644 index 0000000000..c7bb4851bd --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/velocity_filter_config_rule.dart @@ -0,0 +1,119 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'velocity_filter_config_rule.g.dart'; +part 'velocity_filter_config_rule.freezed.dart'; + +extension type const VelocityFilterConfigRuleAction._(String _) implements String { + static const ban = VelocityFilterConfigRuleAction._('ban'); + static const flag = VelocityFilterConfigRuleAction._('flag'); + static const remove = VelocityFilterConfigRuleAction._('remove'); + static const shadow = VelocityFilterConfigRuleAction._('shadow'); + + factory VelocityFilterConfigRuleAction.fromJson(String json) => VelocityFilterConfigRuleAction._(json); + + String toJson() => this; +} + +extension type const VelocityFilterConfigRuleCascadingAction._(String _) implements String { + static const ban = VelocityFilterConfigRuleCascadingAction._('ban'); + static const flag = VelocityFilterConfigRuleCascadingAction._('flag'); + static const remove = VelocityFilterConfigRuleCascadingAction._('remove'); + static const shadow = VelocityFilterConfigRuleCascadingAction._('shadow'); + + factory VelocityFilterConfigRuleCascadingAction.fromJson(String json) => + VelocityFilterConfigRuleCascadingAction._(json); + + String toJson() => this; +} + +@freezed +@immutable +@JsonSerializable() +class VelocityFilterConfigRule with _$VelocityFilterConfigRule { + const VelocityFilterConfigRule({ + required this.action, + required this.banDuration, + required this.cascadingAction, + required this.cascadingThreshold, + required this.checkMessageContext, + required this.fastSpamThreshold, + required this.fastSpamTtl, + required this.ipBan, + required this.probationPeriod, + required this.shadowBan, + this.slowSpamBanDuration, + required this.slowSpamThreshold, + required this.slowSpamTtl, + required this.urlOnly, + }); + + @override + @JsonKey(name: 'action') + final VelocityFilterConfigRuleAction action; + + @override + @JsonKey(name: 'ban_duration') + final int banDuration; + + @override + @JsonKey(name: 'cascading_action') + final VelocityFilterConfigRuleCascadingAction cascadingAction; + + @override + @JsonKey(name: 'cascading_threshold') + final int cascadingThreshold; + + @override + @JsonKey(name: 'check_message_context') + final bool checkMessageContext; + + @override + @JsonKey(name: 'fast_spam_threshold') + final int fastSpamThreshold; + + @override + @JsonKey(name: 'fast_spam_ttl') + final int fastSpamTtl; + + @override + @JsonKey(name: 'ip_ban') + final bool ipBan; + + @override + @JsonKey(name: 'probation_period') + final int probationPeriod; + + @override + @JsonKey(name: 'shadow_ban') + final bool shadowBan; + + @override + @JsonKey(name: 'slow_spam_ban_duration') + final int? slowSpamBanDuration; + + @override + @JsonKey(name: 'slow_spam_threshold') + final int slowSpamThreshold; + + @override + @JsonKey(name: 'slow_spam_ttl') + final int slowSpamTtl; + + @override + @JsonKey(name: 'url_only') + final bool urlOnly; + + Map toJson() => _$VelocityFilterConfigRuleToJson(this); + + static VelocityFilterConfigRule fromJson(Map json) => _$VelocityFilterConfigRuleFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/velocity_filter_config_rule.freezed.dart b/packages/stream_chat/lib/open_api/model/velocity_filter_config_rule.freezed.dart new file mode 100644 index 0000000000..1e5ed057f0 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/velocity_filter_config_rule.freezed.dart @@ -0,0 +1,203 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'velocity_filter_config_rule.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$VelocityFilterConfigRule { + VelocityFilterConfigRuleAction get action; + int get banDuration; + VelocityFilterConfigRuleCascadingAction get cascadingAction; + int get cascadingThreshold; + bool get checkMessageContext; + int get fastSpamThreshold; + int get fastSpamTtl; + bool get ipBan; + int get probationPeriod; + bool get shadowBan; + int? get slowSpamBanDuration; + int get slowSpamThreshold; + int get slowSpamTtl; + bool get urlOnly; + + /// Create a copy of VelocityFilterConfigRule + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $VelocityFilterConfigRuleCopyWith get copyWith => + _$VelocityFilterConfigRuleCopyWithImpl( + this as VelocityFilterConfigRule, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is VelocityFilterConfigRule && + (identical(other.action, action) || other.action == action) && + (identical(other.banDuration, banDuration) || other.banDuration == banDuration) && + (identical(other.cascadingAction, cascadingAction) || other.cascadingAction == cascadingAction) && + (identical(other.cascadingThreshold, cascadingThreshold) || + other.cascadingThreshold == cascadingThreshold) && + (identical(other.checkMessageContext, checkMessageContext) || + other.checkMessageContext == checkMessageContext) && + (identical(other.fastSpamThreshold, fastSpamThreshold) || other.fastSpamThreshold == fastSpamThreshold) && + (identical(other.fastSpamTtl, fastSpamTtl) || other.fastSpamTtl == fastSpamTtl) && + (identical(other.ipBan, ipBan) || other.ipBan == ipBan) && + (identical(other.probationPeriod, probationPeriod) || other.probationPeriod == probationPeriod) && + (identical(other.shadowBan, shadowBan) || other.shadowBan == shadowBan) && + (identical(other.slowSpamBanDuration, slowSpamBanDuration) || + other.slowSpamBanDuration == slowSpamBanDuration) && + (identical(other.slowSpamThreshold, slowSpamThreshold) || other.slowSpamThreshold == slowSpamThreshold) && + (identical(other.slowSpamTtl, slowSpamTtl) || other.slowSpamTtl == slowSpamTtl) && + (identical(other.urlOnly, urlOnly) || other.urlOnly == urlOnly)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + action, + banDuration, + cascadingAction, + cascadingThreshold, + checkMessageContext, + fastSpamThreshold, + fastSpamTtl, + ipBan, + probationPeriod, + shadowBan, + slowSpamBanDuration, + slowSpamThreshold, + slowSpamTtl, + urlOnly, + ); + + @override + String toString() { + return 'VelocityFilterConfigRule(action: $action, banDuration: $banDuration, cascadingAction: $cascadingAction, cascadingThreshold: $cascadingThreshold, checkMessageContext: $checkMessageContext, fastSpamThreshold: $fastSpamThreshold, fastSpamTtl: $fastSpamTtl, ipBan: $ipBan, probationPeriod: $probationPeriod, shadowBan: $shadowBan, slowSpamBanDuration: $slowSpamBanDuration, slowSpamThreshold: $slowSpamThreshold, slowSpamTtl: $slowSpamTtl, urlOnly: $urlOnly)'; + } +} + +/// @nodoc +abstract mixin class $VelocityFilterConfigRuleCopyWith<$Res> { + factory $VelocityFilterConfigRuleCopyWith( + VelocityFilterConfigRule value, + $Res Function(VelocityFilterConfigRule) _then, + ) = _$VelocityFilterConfigRuleCopyWithImpl; + @useResult + $Res call({ + VelocityFilterConfigRuleAction action, + int banDuration, + VelocityFilterConfigRuleCascadingAction cascadingAction, + int cascadingThreshold, + bool checkMessageContext, + int fastSpamThreshold, + int fastSpamTtl, + bool ipBan, + int probationPeriod, + bool shadowBan, + int? slowSpamBanDuration, + int slowSpamThreshold, + int slowSpamTtl, + bool urlOnly, + }); +} + +/// @nodoc +class _$VelocityFilterConfigRuleCopyWithImpl<$Res> implements $VelocityFilterConfigRuleCopyWith<$Res> { + _$VelocityFilterConfigRuleCopyWithImpl(this._self, this._then); + + final VelocityFilterConfigRule _self; + final $Res Function(VelocityFilterConfigRule) _then; + + /// Create a copy of VelocityFilterConfigRule + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? action = null, + Object? banDuration = null, + Object? cascadingAction = null, + Object? cascadingThreshold = null, + Object? checkMessageContext = null, + Object? fastSpamThreshold = null, + Object? fastSpamTtl = null, + Object? ipBan = null, + Object? probationPeriod = null, + Object? shadowBan = null, + Object? slowSpamBanDuration = freezed, + Object? slowSpamThreshold = null, + Object? slowSpamTtl = null, + Object? urlOnly = null, + }) { + return _then( + VelocityFilterConfigRule( + action: null == action + ? _self.action + : action // ignore: cast_nullable_to_non_nullable + as VelocityFilterConfigRuleAction, + banDuration: null == banDuration + ? _self.banDuration + : banDuration // ignore: cast_nullable_to_non_nullable + as int, + cascadingAction: null == cascadingAction + ? _self.cascadingAction + : cascadingAction // ignore: cast_nullable_to_non_nullable + as VelocityFilterConfigRuleCascadingAction, + cascadingThreshold: null == cascadingThreshold + ? _self.cascadingThreshold + : cascadingThreshold // ignore: cast_nullable_to_non_nullable + as int, + checkMessageContext: null == checkMessageContext + ? _self.checkMessageContext + : checkMessageContext // ignore: cast_nullable_to_non_nullable + as bool, + fastSpamThreshold: null == fastSpamThreshold + ? _self.fastSpamThreshold + : fastSpamThreshold // ignore: cast_nullable_to_non_nullable + as int, + fastSpamTtl: null == fastSpamTtl + ? _self.fastSpamTtl + : fastSpamTtl // ignore: cast_nullable_to_non_nullable + as int, + ipBan: null == ipBan + ? _self.ipBan + : ipBan // ignore: cast_nullable_to_non_nullable + as bool, + probationPeriod: null == probationPeriod + ? _self.probationPeriod + : probationPeriod // ignore: cast_nullable_to_non_nullable + as int, + shadowBan: null == shadowBan + ? _self.shadowBan + : shadowBan // ignore: cast_nullable_to_non_nullable + as bool, + slowSpamBanDuration: freezed == slowSpamBanDuration + ? _self.slowSpamBanDuration + : slowSpamBanDuration // ignore: cast_nullable_to_non_nullable + as int?, + slowSpamThreshold: null == slowSpamThreshold + ? _self.slowSpamThreshold + : slowSpamThreshold // ignore: cast_nullable_to_non_nullable + as int, + slowSpamTtl: null == slowSpamTtl + ? _self.slowSpamTtl + : slowSpamTtl // ignore: cast_nullable_to_non_nullable + as int, + urlOnly: null == urlOnly + ? _self.urlOnly + : urlOnly // ignore: cast_nullable_to_non_nullable + as bool, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/velocity_filter_config_rule.g.dart b/packages/stream_chat/lib/open_api/model/velocity_filter_config_rule.g.dart new file mode 100644 index 0000000000..5dabd11534 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/velocity_filter_config_rule.g.dart @@ -0,0 +1,47 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'velocity_filter_config_rule.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +VelocityFilterConfigRule _$VelocityFilterConfigRuleFromJson( + Map json, +) => VelocityFilterConfigRule( + action: VelocityFilterConfigRuleAction.fromJson(json['action'] as String), + banDuration: (json['ban_duration'] as num).toInt(), + cascadingAction: VelocityFilterConfigRuleCascadingAction.fromJson( + json['cascading_action'] as String, + ), + cascadingThreshold: (json['cascading_threshold'] as num).toInt(), + checkMessageContext: json['check_message_context'] as bool, + fastSpamThreshold: (json['fast_spam_threshold'] as num).toInt(), + fastSpamTtl: (json['fast_spam_ttl'] as num).toInt(), + ipBan: json['ip_ban'] as bool, + probationPeriod: (json['probation_period'] as num).toInt(), + shadowBan: json['shadow_ban'] as bool, + slowSpamBanDuration: (json['slow_spam_ban_duration'] as num?)?.toInt(), + slowSpamThreshold: (json['slow_spam_threshold'] as num).toInt(), + slowSpamTtl: (json['slow_spam_ttl'] as num).toInt(), + urlOnly: json['url_only'] as bool, +); + +Map _$VelocityFilterConfigRuleToJson( + VelocityFilterConfigRule instance, +) => { + 'action': instance.action.toJson(), + 'ban_duration': instance.banDuration, + 'cascading_action': instance.cascadingAction.toJson(), + 'cascading_threshold': instance.cascadingThreshold, + 'check_message_context': instance.checkMessageContext, + 'fast_spam_threshold': instance.fastSpamThreshold, + 'fast_spam_ttl': instance.fastSpamTtl, + 'ip_ban': instance.ipBan, + 'probation_period': instance.probationPeriod, + 'shadow_ban': instance.shadowBan, + 'slow_spam_ban_duration': instance.slowSpamBanDuration, + 'slow_spam_threshold': instance.slowSpamThreshold, + 'slow_spam_ttl': instance.slowSpamTtl, + 'url_only': instance.urlOnly, +}; diff --git a/packages/stream_chat/lib/open_api/model/video_call_rule_config.dart b/packages/stream_chat/lib/open_api/model/video_call_rule_config.dart new file mode 100644 index 0000000000..0732ca385f --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/video_call_rule_config.dart @@ -0,0 +1,41 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'video_call_rule_config.g.dart'; +part 'video_call_rule_config.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class VideoCallRuleConfig with _$VideoCallRuleConfig { + const VideoCallRuleConfig({ + required this.flagAllLabels, + required this.flaggedLabels, + required this.rules, + }); + + @override + @JsonKey(name: 'flag_all_labels') + final bool flagAllLabels; + + @override + @JsonKey(name: 'flagged_labels') + final List flaggedLabels; + + @override + @JsonKey(name: 'rules') + final List rules; + + Map toJson() => _$VideoCallRuleConfigToJson(this); + + static VideoCallRuleConfig fromJson(Map json) => _$VideoCallRuleConfigFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/video_call_rule_config.freezed.dart b/packages/stream_chat/lib/open_api/model/video_call_rule_config.freezed.dart new file mode 100644 index 0000000000..39c055b425 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/video_call_rule_config.freezed.dart @@ -0,0 +1,104 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'video_call_rule_config.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$VideoCallRuleConfig { + bool get flagAllLabels; + List get flaggedLabels; + List get rules; + + /// Create a copy of VideoCallRuleConfig + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $VideoCallRuleConfigCopyWith get copyWith => + _$VideoCallRuleConfigCopyWithImpl( + this as VideoCallRuleConfig, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is VideoCallRuleConfig && + (identical(other.flagAllLabels, flagAllLabels) || other.flagAllLabels == flagAllLabels) && + const DeepCollectionEquality().equals( + other.flaggedLabels, + flaggedLabels, + ) && + const DeepCollectionEquality().equals(other.rules, rules)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + flagAllLabels, + const DeepCollectionEquality().hash(flaggedLabels), + const DeepCollectionEquality().hash(rules), + ); + + @override + String toString() { + return 'VideoCallRuleConfig(flagAllLabels: $flagAllLabels, flaggedLabels: $flaggedLabels, rules: $rules)'; + } +} + +/// @nodoc +abstract mixin class $VideoCallRuleConfigCopyWith<$Res> { + factory $VideoCallRuleConfigCopyWith( + VideoCallRuleConfig value, + $Res Function(VideoCallRuleConfig) _then, + ) = _$VideoCallRuleConfigCopyWithImpl; + @useResult + $Res call({ + bool flagAllLabels, + List flaggedLabels, + List rules, + }); +} + +/// @nodoc +class _$VideoCallRuleConfigCopyWithImpl<$Res> implements $VideoCallRuleConfigCopyWith<$Res> { + _$VideoCallRuleConfigCopyWithImpl(this._self, this._then); + + final VideoCallRuleConfig _self; + final $Res Function(VideoCallRuleConfig) _then; + + /// Create a copy of VideoCallRuleConfig + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? flagAllLabels = null, + Object? flaggedLabels = null, + Object? rules = null, + }) { + return _then( + VideoCallRuleConfig( + flagAllLabels: null == flagAllLabels + ? _self.flagAllLabels + : flagAllLabels // ignore: cast_nullable_to_non_nullable + as bool, + flaggedLabels: null == flaggedLabels + ? _self.flaggedLabels + : flaggedLabels // ignore: cast_nullable_to_non_nullable + as List, + rules: null == rules + ? _self.rules + : rules // ignore: cast_nullable_to_non_nullable + as List, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/video_call_rule_config.g.dart b/packages/stream_chat/lib/open_api/model/video_call_rule_config.g.dart new file mode 100644 index 0000000000..d704484bef --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/video_call_rule_config.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'video_call_rule_config.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +VideoCallRuleConfig _$VideoCallRuleConfigFromJson(Map json) => VideoCallRuleConfig( + flagAllLabels: json['flag_all_labels'] as bool, + flaggedLabels: (json['flagged_labels'] as List).map((e) => e as String).toList(), + rules: (json['rules'] as List).map((e) => HarmConfig.fromJson(e as Map)).toList(), +); + +Map _$VideoCallRuleConfigToJson( + VideoCallRuleConfig instance, +) => { + 'flag_all_labels': instance.flagAllLabels, + 'flagged_labels': instance.flaggedLabels, + 'rules': instance.rules.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/video_content_parameters.dart b/packages/stream_chat/lib/open_api/model/video_content_parameters.dart new file mode 100644 index 0000000000..956ace86e2 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/video_content_parameters.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'video_content_parameters.g.dart'; +part 'video_content_parameters.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class VideoContentParameters with _$VideoContentParameters { + const VideoContentParameters({ + this.harmLabels, + this.labelOperator, + }); + + @override + @JsonKey(name: 'harm_labels') + final List? harmLabels; + + @override + @JsonKey(name: 'label_operator') + final String? labelOperator; + + Map toJson() => _$VideoContentParametersToJson(this); + + static VideoContentParameters fromJson(Map json) => _$VideoContentParametersFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/video_content_parameters.freezed.dart b/packages/stream_chat/lib/open_api/model/video_content_parameters.freezed.dart new file mode 100644 index 0000000000..eab53ae747 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/video_content_parameters.freezed.dart @@ -0,0 +1,89 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'video_content_parameters.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$VideoContentParameters { + List? get harmLabels; + String? get labelOperator; + + /// Create a copy of VideoContentParameters + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $VideoContentParametersCopyWith get copyWith => + _$VideoContentParametersCopyWithImpl( + this as VideoContentParameters, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is VideoContentParameters && + const DeepCollectionEquality().equals( + other.harmLabels, + harmLabels, + ) && + (identical(other.labelOperator, labelOperator) || other.labelOperator == labelOperator)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(harmLabels), + labelOperator, + ); + + @override + String toString() { + return 'VideoContentParameters(harmLabels: $harmLabels, labelOperator: $labelOperator)'; + } +} + +/// @nodoc +abstract mixin class $VideoContentParametersCopyWith<$Res> { + factory $VideoContentParametersCopyWith( + VideoContentParameters value, + $Res Function(VideoContentParameters) _then, + ) = _$VideoContentParametersCopyWithImpl; + @useResult + $Res call({List? harmLabels, String? labelOperator}); +} + +/// @nodoc +class _$VideoContentParametersCopyWithImpl<$Res> implements $VideoContentParametersCopyWith<$Res> { + _$VideoContentParametersCopyWithImpl(this._self, this._then); + + final VideoContentParameters _self; + final $Res Function(VideoContentParameters) _then; + + /// Create a copy of VideoContentParameters + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? harmLabels = freezed, Object? labelOperator = freezed}) { + return _then( + VideoContentParameters( + harmLabels: freezed == harmLabels + ? _self.harmLabels + : harmLabels // ignore: cast_nullable_to_non_nullable + as List?, + labelOperator: freezed == labelOperator + ? _self.labelOperator + : labelOperator // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/video_content_parameters.g.dart b/packages/stream_chat/lib/open_api/model/video_content_parameters.g.dart new file mode 100644 index 0000000000..1fee59bb93 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/video_content_parameters.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'video_content_parameters.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +VideoContentParameters _$VideoContentParametersFromJson( + Map json, +) => VideoContentParameters( + harmLabels: (json['harm_labels'] as List?)?.map((e) => e as String).toList(), + labelOperator: json['label_operator'] as String?, +); + +Map _$VideoContentParametersToJson( + VideoContentParameters instance, +) => { + 'harm_labels': instance.harmLabels, + 'label_operator': instance.labelOperator, +}; diff --git a/packages/stream_chat/lib/open_api/model/video_rule_parameters.dart b/packages/stream_chat/lib/open_api/model/video_rule_parameters.dart new file mode 100644 index 0000000000..6e17455360 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/video_rule_parameters.dart @@ -0,0 +1,41 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'video_rule_parameters.g.dart'; +part 'video_rule_parameters.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class VideoRuleParameters with _$VideoRuleParameters { + const VideoRuleParameters({ + this.harmLabels, + this.threshold, + this.timeWindow, + }); + + @override + @JsonKey(name: 'harm_labels') + final List? harmLabels; + + @override + @JsonKey(name: 'threshold') + final int? threshold; + + @override + @JsonKey(name: 'time_window') + final String? timeWindow; + + Map toJson() => _$VideoRuleParametersToJson(this); + + static VideoRuleParameters fromJson(Map json) => _$VideoRuleParametersFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/video_rule_parameters.freezed.dart b/packages/stream_chat/lib/open_api/model/video_rule_parameters.freezed.dart new file mode 100644 index 0000000000..7620b743b1 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/video_rule_parameters.freezed.dart @@ -0,0 +1,100 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'video_rule_parameters.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$VideoRuleParameters { + List? get harmLabels; + int? get threshold; + String? get timeWindow; + + /// Create a copy of VideoRuleParameters + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $VideoRuleParametersCopyWith get copyWith => + _$VideoRuleParametersCopyWithImpl( + this as VideoRuleParameters, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is VideoRuleParameters && + const DeepCollectionEquality().equals( + other.harmLabels, + harmLabels, + ) && + (identical(other.threshold, threshold) || other.threshold == threshold) && + (identical(other.timeWindow, timeWindow) || other.timeWindow == timeWindow)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(harmLabels), + threshold, + timeWindow, + ); + + @override + String toString() { + return 'VideoRuleParameters(harmLabels: $harmLabels, threshold: $threshold, timeWindow: $timeWindow)'; + } +} + +/// @nodoc +abstract mixin class $VideoRuleParametersCopyWith<$Res> { + factory $VideoRuleParametersCopyWith( + VideoRuleParameters value, + $Res Function(VideoRuleParameters) _then, + ) = _$VideoRuleParametersCopyWithImpl; + @useResult + $Res call({List? harmLabels, int? threshold, String? timeWindow}); +} + +/// @nodoc +class _$VideoRuleParametersCopyWithImpl<$Res> implements $VideoRuleParametersCopyWith<$Res> { + _$VideoRuleParametersCopyWithImpl(this._self, this._then); + + final VideoRuleParameters _self; + final $Res Function(VideoRuleParameters) _then; + + /// Create a copy of VideoRuleParameters + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? harmLabels = freezed, + Object? threshold = freezed, + Object? timeWindow = freezed, + }) { + return _then( + VideoRuleParameters( + harmLabels: freezed == harmLabels + ? _self.harmLabels + : harmLabels // ignore: cast_nullable_to_non_nullable + as List?, + threshold: freezed == threshold + ? _self.threshold + : threshold // ignore: cast_nullable_to_non_nullable + as int?, + timeWindow: freezed == timeWindow + ? _self.timeWindow + : timeWindow // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/video_rule_parameters.g.dart b/packages/stream_chat/lib/open_api/model/video_rule_parameters.g.dart new file mode 100644 index 0000000000..f2e25a00d9 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/video_rule_parameters.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'video_rule_parameters.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +VideoRuleParameters _$VideoRuleParametersFromJson(Map json) => VideoRuleParameters( + harmLabels: (json['harm_labels'] as List?)?.map((e) => e as String).toList(), + threshold: (json['threshold'] as num?)?.toInt(), + timeWindow: json['time_window'] as String?, +); + +Map _$VideoRuleParametersToJson( + VideoRuleParameters instance, +) => { + 'harm_labels': instance.harmLabels, + 'threshold': instance.threshold, + 'time_window': instance.timeWindow, +}; diff --git a/packages/stream_chat/lib/open_api/model/vote_data.dart b/packages/stream_chat/lib/open_api/model/vote_data.dart new file mode 100644 index 0000000000..fcf452db15 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/vote_data.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'vote_data.g.dart'; +part 'vote_data.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class VoteData with _$VoteData { + const VoteData({ + this.answerText, + this.optionId, + }); + + @override + @JsonKey(name: 'answer_text') + final String? answerText; + + @override + @JsonKey(name: 'option_id') + final String? optionId; + + Map toJson() => _$VoteDataToJson(this); + + static VoteData fromJson(Map json) => _$VoteDataFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/vote_data.freezed.dart b/packages/stream_chat/lib/open_api/model/vote_data.freezed.dart new file mode 100644 index 0000000000..a8a5698e6c --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/vote_data.freezed.dart @@ -0,0 +1,75 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'vote_data.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$VoteData { + String? get answerText; + String? get optionId; + + /// Create a copy of VoteData + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $VoteDataCopyWith get copyWith => _$VoteDataCopyWithImpl(this as VoteData, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is VoteData && + (identical(other.answerText, answerText) || other.answerText == answerText) && + (identical(other.optionId, optionId) || other.optionId == optionId)); + } + + @override + int get hashCode => Object.hash(runtimeType, answerText, optionId); + + @override + String toString() { + return 'VoteData(answerText: $answerText, optionId: $optionId)'; + } +} + +/// @nodoc +abstract mixin class $VoteDataCopyWith<$Res> { + factory $VoteDataCopyWith(VoteData value, $Res Function(VoteData) _then) = _$VoteDataCopyWithImpl; + @useResult + $Res call({String? answerText, String? optionId}); +} + +/// @nodoc +class _$VoteDataCopyWithImpl<$Res> implements $VoteDataCopyWith<$Res> { + _$VoteDataCopyWithImpl(this._self, this._then); + + final VoteData _self; + final $Res Function(VoteData) _then; + + /// Create a copy of VoteData + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? answerText = freezed, Object? optionId = freezed}) { + return _then( + VoteData( + answerText: freezed == answerText + ? _self.answerText + : answerText // ignore: cast_nullable_to_non_nullable + as String?, + optionId: freezed == optionId + ? _self.optionId + : optionId // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/vote_data.g.dart b/packages/stream_chat/lib/open_api/model/vote_data.g.dart new file mode 100644 index 0000000000..9b8938feae --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/vote_data.g.dart @@ -0,0 +1,17 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'vote_data.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +VoteData _$VoteDataFromJson(Map json) => VoteData( + answerText: json['answer_text'] as String?, + optionId: json['option_id'] as String?, +); + +Map _$VoteDataToJson(VoteData instance) => { + 'answer_text': instance.answerText, + 'option_id': instance.optionId, +}; diff --git a/packages/stream_chat/lib/open_api/model/wrapped_unread_counts_response.dart b/packages/stream_chat/lib/open_api/model/wrapped_unread_counts_response.dart new file mode 100644 index 0000000000..0d3c151209 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/wrapped_unread_counts_response.dart @@ -0,0 +1,61 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'wrapped_unread_counts_response.g.dart'; +part 'wrapped_unread_counts_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class WrappedUnreadCountsResponse with _$WrappedUnreadCountsResponse { + const WrappedUnreadCountsResponse({ + required this.channelType, + required this.channels, + required this.duration, + required this.threads, + required this.totalUnreadCount, + this.totalUnreadCountByTeam, + required this.totalUnreadThreadsCount, + }); + + @override + @JsonKey(name: 'channel_type') + final List channelType; + + @override + @JsonKey(name: 'channels') + final List channels; + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'threads') + final List threads; + + @override + @JsonKey(name: 'total_unread_count') + final int totalUnreadCount; + + @override + @JsonKey(name: 'total_unread_count_by_team') + final Map? totalUnreadCountByTeam; + + @override + @JsonKey(name: 'total_unread_threads_count') + final int totalUnreadThreadsCount; + + Map toJson() => _$WrappedUnreadCountsResponseToJson(this); + + static WrappedUnreadCountsResponse fromJson(Map json) => _$WrappedUnreadCountsResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/wrapped_unread_counts_response.freezed.dart b/packages/stream_chat/lib/open_api/model/wrapped_unread_counts_response.freezed.dart new file mode 100644 index 0000000000..3838624bce --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/wrapped_unread_counts_response.freezed.dart @@ -0,0 +1,147 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'wrapped_unread_counts_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$WrappedUnreadCountsResponse { + List get channelType; + List get channels; + String get duration; + List get threads; + int get totalUnreadCount; + Map? get totalUnreadCountByTeam; + int get totalUnreadThreadsCount; + + /// Create a copy of WrappedUnreadCountsResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $WrappedUnreadCountsResponseCopyWith get copyWith => + _$WrappedUnreadCountsResponseCopyWithImpl( + this as WrappedUnreadCountsResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is WrappedUnreadCountsResponse && + const DeepCollectionEquality().equals( + other.channelType, + channelType, + ) && + const DeepCollectionEquality().equals(other.channels, channels) && + (identical(other.duration, duration) || other.duration == duration) && + const DeepCollectionEquality().equals(other.threads, threads) && + (identical(other.totalUnreadCount, totalUnreadCount) || other.totalUnreadCount == totalUnreadCount) && + const DeepCollectionEquality().equals( + other.totalUnreadCountByTeam, + totalUnreadCountByTeam, + ) && + (identical( + other.totalUnreadThreadsCount, + totalUnreadThreadsCount, + ) || + other.totalUnreadThreadsCount == totalUnreadThreadsCount)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(channelType), + const DeepCollectionEquality().hash(channels), + duration, + const DeepCollectionEquality().hash(threads), + totalUnreadCount, + const DeepCollectionEquality().hash(totalUnreadCountByTeam), + totalUnreadThreadsCount, + ); + + @override + String toString() { + return 'WrappedUnreadCountsResponse(channelType: $channelType, channels: $channels, duration: $duration, threads: $threads, totalUnreadCount: $totalUnreadCount, totalUnreadCountByTeam: $totalUnreadCountByTeam, totalUnreadThreadsCount: $totalUnreadThreadsCount)'; + } +} + +/// @nodoc +abstract mixin class $WrappedUnreadCountsResponseCopyWith<$Res> { + factory $WrappedUnreadCountsResponseCopyWith( + WrappedUnreadCountsResponse value, + $Res Function(WrappedUnreadCountsResponse) _then, + ) = _$WrappedUnreadCountsResponseCopyWithImpl; + @useResult + $Res call({ + List channelType, + List channels, + String duration, + List threads, + int totalUnreadCount, + Map? totalUnreadCountByTeam, + int totalUnreadThreadsCount, + }); +} + +/// @nodoc +class _$WrappedUnreadCountsResponseCopyWithImpl<$Res> implements $WrappedUnreadCountsResponseCopyWith<$Res> { + _$WrappedUnreadCountsResponseCopyWithImpl(this._self, this._then); + + final WrappedUnreadCountsResponse _self; + final $Res Function(WrappedUnreadCountsResponse) _then; + + /// Create a copy of WrappedUnreadCountsResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? channelType = null, + Object? channels = null, + Object? duration = null, + Object? threads = null, + Object? totalUnreadCount = null, + Object? totalUnreadCountByTeam = freezed, + Object? totalUnreadThreadsCount = null, + }) { + return _then( + WrappedUnreadCountsResponse( + channelType: null == channelType + ? _self.channelType + : channelType // ignore: cast_nullable_to_non_nullable + as List, + channels: null == channels + ? _self.channels + : channels // ignore: cast_nullable_to_non_nullable + as List, + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + threads: null == threads + ? _self.threads + : threads // ignore: cast_nullable_to_non_nullable + as List, + totalUnreadCount: null == totalUnreadCount + ? _self.totalUnreadCount + : totalUnreadCount // ignore: cast_nullable_to_non_nullable + as int, + totalUnreadCountByTeam: freezed == totalUnreadCountByTeam + ? _self.totalUnreadCountByTeam + : totalUnreadCountByTeam // ignore: cast_nullable_to_non_nullable + as Map?, + totalUnreadThreadsCount: null == totalUnreadThreadsCount + ? _self.totalUnreadThreadsCount + : totalUnreadThreadsCount // ignore: cast_nullable_to_non_nullable + as int, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/wrapped_unread_counts_response.g.dart b/packages/stream_chat/lib/open_api/model/wrapped_unread_counts_response.g.dart new file mode 100644 index 0000000000..5eb9528e56 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/wrapped_unread_counts_response.g.dart @@ -0,0 +1,39 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'wrapped_unread_counts_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +WrappedUnreadCountsResponse _$WrappedUnreadCountsResponseFromJson( + Map json, +) => WrappedUnreadCountsResponse( + channelType: (json['channel_type'] as List) + .map((e) => UnreadCountsChannelType.fromJson(e as Map)) + .toList(), + channels: (json['channels'] as List) + .map((e) => UnreadCountsChannel.fromJson(e as Map)) + .toList(), + duration: json['duration'] as String, + threads: (json['threads'] as List) + .map((e) => UnreadCountsThread.fromJson(e as Map)) + .toList(), + totalUnreadCount: (json['total_unread_count'] as num).toInt(), + totalUnreadCountByTeam: (json['total_unread_count_by_team'] as Map?)?.map( + (k, e) => MapEntry(k, (e as num).toInt()), + ), + totalUnreadThreadsCount: (json['total_unread_threads_count'] as num).toInt(), +); + +Map _$WrappedUnreadCountsResponseToJson( + WrappedUnreadCountsResponse instance, +) => { + 'channel_type': instance.channelType.map((e) => e.toJson()).toList(), + 'channels': instance.channels.map((e) => e.toJson()).toList(), + 'duration': instance.duration, + 'threads': instance.threads.map((e) => e.toJson()).toList(), + 'total_unread_count': instance.totalUnreadCount, + 'total_unread_count_by_team': instance.totalUnreadCountByTeam, + 'total_unread_threads_count': instance.totalUnreadThreadsCount, +}; diff --git a/packages/stream_chat/lib/open_api/model/ws_auth_message.dart b/packages/stream_chat/lib/open_api/model/ws_auth_message.dart new file mode 100644 index 0000000000..e239c32835 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ws_auth_message.dart @@ -0,0 +1,51 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'ws_auth_message.g.dart'; +part 'ws_auth_message.freezed.dart'; + +extension type const WSAuthMessageProducts._(String _) implements String { + static const chat = WSAuthMessageProducts._('chat'); + static const feeds = WSAuthMessageProducts._('feeds'); + static const video = WSAuthMessageProducts._('video'); + + factory WSAuthMessageProducts.fromJson(String json) => WSAuthMessageProducts._(json); + + String toJson() => this; +} + +@freezed +@immutable +@JsonSerializable() +class WSAuthMessage with _$WSAuthMessage { + const WSAuthMessage({ + this.memberCustomInclude, + this.products, + required this.token, + }); + + @override + @JsonKey(name: 'member_custom_include') + final List? memberCustomInclude; + + @override + @JsonKey(name: 'products') + final List? products; + + @override + @JsonKey(name: 'token') + final String token; + + Map toJson() => _$WSAuthMessageToJson(this); + + static WSAuthMessage fromJson(Map json) => _$WSAuthMessageFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/ws_auth_message.freezed.dart b/packages/stream_chat/lib/open_api/model/ws_auth_message.freezed.dart new file mode 100644 index 0000000000..248bf0f950 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ws_auth_message.freezed.dart @@ -0,0 +1,103 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'ws_auth_message.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$WSAuthMessage { + List? get memberCustomInclude; + List? get products; + String get token; + + /// Create a copy of WSAuthMessage + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $WSAuthMessageCopyWith get copyWith => _$WSAuthMessageCopyWithImpl( + this as WSAuthMessage, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is WSAuthMessage && + const DeepCollectionEquality().equals( + other.memberCustomInclude, + memberCustomInclude, + ) && + const DeepCollectionEquality().equals(other.products, products) && + (identical(other.token, token) || other.token == token)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(memberCustomInclude), + const DeepCollectionEquality().hash(products), + token, + ); + + @override + String toString() { + return 'WSAuthMessage(memberCustomInclude: $memberCustomInclude, products: $products, token: $token)'; + } +} + +/// @nodoc +abstract mixin class $WSAuthMessageCopyWith<$Res> { + factory $WSAuthMessageCopyWith( + WSAuthMessage value, + $Res Function(WSAuthMessage) _then, + ) = _$WSAuthMessageCopyWithImpl; + @useResult + $Res call({ + List? memberCustomInclude, + List? products, + String token, + }); +} + +/// @nodoc +class _$WSAuthMessageCopyWithImpl<$Res> implements $WSAuthMessageCopyWith<$Res> { + _$WSAuthMessageCopyWithImpl(this._self, this._then); + + final WSAuthMessage _self; + final $Res Function(WSAuthMessage) _then; + + /// Create a copy of WSAuthMessage + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? memberCustomInclude = freezed, + Object? products = freezed, + Object? token = null, + }) { + return _then( + WSAuthMessage( + memberCustomInclude: freezed == memberCustomInclude + ? _self.memberCustomInclude + : memberCustomInclude // ignore: cast_nullable_to_non_nullable + as List?, + products: freezed == products + ? _self.products + : products // ignore: cast_nullable_to_non_nullable + as List?, + token: null == token + ? _self.token + : token // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/ws_auth_message.g.dart b/packages/stream_chat/lib/open_api/model/ws_auth_message.g.dart new file mode 100644 index 0000000000..e75af69cd1 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ws_auth_message.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'ws_auth_message.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +WSAuthMessage _$WSAuthMessageFromJson(Map json) => WSAuthMessage( + memberCustomInclude: (json['member_custom_include'] as List?)?.map((e) => e as String).toList(), + products: (json['products'] as List?)?.map((e) => WSAuthMessageProducts.fromJson(e as String)).toList(), + token: json['token'] as String, +); + +Map _$WSAuthMessageToJson(WSAuthMessage instance) => { + 'member_custom_include': instance.memberCustomInclude, + 'products': instance.products?.map((e) => e.toJson()).toList(), + 'token': instance.token, +}; diff --git a/packages/stream_chat/lib/open_api/model/ws_client_event.dart b/packages/stream_chat/lib/open_api/model/ws_client_event.dart new file mode 100644 index 0000000000..28cae40eb5 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ws_client_event.dart @@ -0,0 +1,657 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs + +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +abstract class WSClientEvent { + const WSClientEvent(this.wrapped); + + final T wrapped; + String get type; + + static WSClientEvent fromJson(Map json) { + final eventType = json['type']; + + if (eventType == null || eventType is! String) { + throw ArgumentError('Invalid or missing "type" field in JSON: $json'); + } + + return switch (eventType) { + "*" => _CustomEvent(CustomEvent.fromJson(json)), + "ai_indicator.clear" => _AIIndicatorClearEvent(AIIndicatorClearEvent.fromJson(json)), + "ai_indicator.stop" => _AIIndicatorStopEvent(AIIndicatorStopEvent.fromJson(json)), + "ai_indicator.update" => _AIIndicatorUpdateEvent(AIIndicatorUpdateEvent.fromJson(json)), + "app.updated" => _AppUpdatedEvent(AppUpdatedEvent.fromJson(json)), + "channel.created" => _ChannelCreatedEvent(ChannelCreatedEvent.fromJson(json)), + "channel.deleted" => _ChannelDeletedEvent(ChannelDeletedEvent.fromJson(json)), + "channel.frozen" => _ChannelFrozenEvent(ChannelFrozenEvent.fromJson(json)), + "channel.hidden" => _ChannelHiddenEvent(ChannelHiddenEvent.fromJson(json)), + "channel.kicked" => _ChannelKickedEvent(ChannelKickedEvent.fromJson(json)), + "channel.max_streak_changed" => _MaxStreakChangedEvent(MaxStreakChangedEvent.fromJson(json)), + "channel.truncated" => _ChannelTruncatedEvent(ChannelTruncatedEvent.fromJson(json)), + "channel.unfrozen" => _ChannelUnFrozenEvent(ChannelUnFrozenEvent.fromJson(json)), + "channel.updated" => _ChannelUpdatedEvent(ChannelUpdatedEvent.fromJson(json)), + "channel.visible" => _ChannelVisibleEvent(ChannelVisibleEvent.fromJson(json)), + "draft.deleted" => _DraftDeletedEvent(DraftDeletedEvent.fromJson(json)), + "draft.updated" => _DraftUpdatedEvent(DraftUpdatedEvent.fromJson(json)), + "member.added" => _MemberAddedEvent(MemberAddedEvent.fromJson(json)), + "member.removed" => _MemberRemovedEvent(MemberRemovedEvent.fromJson(json)), + "member.updated" => _MemberUpdatedEvent(MemberUpdatedEvent.fromJson(json)), + "message.deleted" => _MessageDeletedEvent(MessageDeletedEvent.fromJson(json)), + "message.delivered" => _MessageDeliveredEvent(MessageDeliveredEvent.fromJson(json)), + "message.new" => _MessageNewEvent(MessageNewEvent.fromJson(json)), + "message.pending" => _PendingMessageEvent(PendingMessageEvent.fromJson(json)), + "message.read" => _MessageReadEvent(MessageReadEvent.fromJson(json)), + "message.undeleted" => _MessageUndeletedEvent(MessageUndeletedEvent.fromJson(json)), + "message.updated" => _MessageUpdatedEvent(MessageUpdatedEvent.fromJson(json)), + "moderation.custom_action" => _ModerationCustomActionEvent(ModerationCustomActionEvent.fromJson(json)), + "moderation.flagged" => _ModerationFlaggedEvent(ModerationFlaggedEvent.fromJson(json)), + "moderation.mark_reviewed" => _ModerationMarkReviewedEvent(ModerationMarkReviewedEvent.fromJson(json)), + "notification.added_to_channel" => _NotificationAddedToChannelEvent( + NotificationAddedToChannelEvent.fromJson(json), + ), + "notification.channel_deleted" => _NotificationChannelDeletedEvent( + NotificationChannelDeletedEvent.fromJson(json), + ), + "notification.channel_mutes_updated" => _NotificationChannelMutesUpdatedEvent( + NotificationChannelMutesUpdatedEvent.fromJson(json), + ), + "notification.channel_truncated" => _NotificationChannelTruncatedEvent( + NotificationChannelTruncatedEvent.fromJson(json), + ), + "notification.invite_accepted" => _NotificationInviteAcceptedEvent( + NotificationInviteAcceptedEvent.fromJson(json), + ), + "notification.invite_rejected" => _NotificationInviteRejectedEvent( + NotificationInviteRejectedEvent.fromJson(json), + ), + "notification.invited" => _NotificationInvitedEvent(NotificationInvitedEvent.fromJson(json)), + "notification.mark_read" => _NotificationMarkReadEvent(NotificationMarkReadEvent.fromJson(json)), + "notification.mark_unread" => _NotificationMarkUnreadEvent(NotificationMarkUnreadEvent.fromJson(json)), + "notification.message_new" => _NotificationNewMessageEvent(NotificationNewMessageEvent.fromJson(json)), + "notification.mutes_updated" => _NotificationMutesUpdatedEvent(NotificationMutesUpdatedEvent.fromJson(json)), + "notification.reminder_due" => _ReminderNotificationEvent(ReminderNotificationEvent.fromJson(json)), + "notification.removed_from_channel" => _NotificationRemovedFromChannelEvent( + NotificationRemovedFromChannelEvent.fromJson(json), + ), + "notification.thread_message_new" => _NotificationThreadMessageNewEvent( + NotificationThreadMessageNewEvent.fromJson(json), + ), + "poll.closed" => _PollClosedEvent(PollClosedEvent.fromJson(json)), + "poll.deleted" => _PollDeletedEvent(PollDeletedEvent.fromJson(json)), + "poll.updated" => _PollUpdatedEvent(PollUpdatedEvent.fromJson(json)), + "poll.vote_casted" => _PollVoteCastedEvent(PollVoteCastedEvent.fromJson(json)), + "poll.vote_changed" => _PollVoteChangedEvent(PollVoteChangedEvent.fromJson(json)), + "poll.vote_removed" => _PollVoteRemovedEvent(PollVoteRemovedEvent.fromJson(json)), + "reaction.deleted" => _ReactionDeletedEvent(ReactionDeletedEvent.fromJson(json)), + "reaction.new" => _ReactionNewEvent(ReactionNewEvent.fromJson(json)), + "reaction.updated" => _ReactionUpdatedEvent(ReactionUpdatedEvent.fromJson(json)), + "reminder.created" => _ReminderCreatedEvent(ReminderCreatedEvent.fromJson(json)), + "reminder.deleted" => _ReminderDeletedEvent(ReminderDeletedEvent.fromJson(json)), + "reminder.updated" => _ReminderUpdatedEvent(ReminderUpdatedEvent.fromJson(json)), + "thread.updated" => _ThreadUpdatedEvent(ThreadUpdatedEvent.fromJson(json)), + "typing.start" => _TypingStartEvent(TypingStartEvent.fromJson(json)), + "typing.stop" => _TypingStopEvent(TypingStopEvent.fromJson(json)), + "user.banned" => _UserBannedEvent(UserBannedEvent.fromJson(json)), + "user.deactivated" => _UserDeactivatedEvent(UserDeactivatedEvent.fromJson(json)), + "user.deleted" => _UserDeletedEvent(UserDeletedEvent.fromJson(json)), + "user.messages.deleted" => _UserMessagesDeletedEvent(UserMessagesDeletedEvent.fromJson(json)), + "user.muted" => _UserMutedEvent(UserMutedEvent.fromJson(json)), + "user.presence.changed" => _UserPresenceChangedEvent(UserPresenceChangedEvent.fromJson(json)), + "user.reactivated" => _UserReactivatedEvent(UserReactivatedEvent.fromJson(json)), + "user.unbanned" => _UserUnbannedEvent(UserUnbannedEvent.fromJson(json)), + "user.updated" => _UserUpdatedEvent(UserUpdatedEvent.fromJson(json)), + "user.watching.start" => _UserWatchingStartEvent(UserWatchingStartEvent.fromJson(json)), + "user.watching.stop" => _UserWatchingStopEvent(UserWatchingStopEvent.fromJson(json)), + "user_group.created" => _UserGroupCreatedEvent(UserGroupCreatedEvent.fromJson(json)), + "user_group.deleted" => _UserGroupDeletedEvent(UserGroupDeletedEvent.fromJson(json)), + "user_group.member_added" => _UserGroupMemberAddedEvent(UserGroupMemberAddedEvent.fromJson(json)), + "user_group.member_removed" => _UserGroupMemberRemovedEvent(UserGroupMemberRemovedEvent.fromJson(json)), + "user_group.updated" => _UserGroupUpdatedEvent(UserGroupUpdatedEvent.fromJson(json)), + _ => _UnknownWSClientEvent(UnknownWSClientEvent(eventType, json)), + }; + } +} + +class _CustomEvent extends WSClientEvent { + const _CustomEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _AIIndicatorClearEvent extends WSClientEvent { + const _AIIndicatorClearEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _AIIndicatorStopEvent extends WSClientEvent { + const _AIIndicatorStopEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _AIIndicatorUpdateEvent extends WSClientEvent { + const _AIIndicatorUpdateEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _AppUpdatedEvent extends WSClientEvent { + const _AppUpdatedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _ChannelCreatedEvent extends WSClientEvent { + const _ChannelCreatedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _ChannelDeletedEvent extends WSClientEvent { + const _ChannelDeletedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _ChannelFrozenEvent extends WSClientEvent { + const _ChannelFrozenEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _ChannelHiddenEvent extends WSClientEvent { + const _ChannelHiddenEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _ChannelKickedEvent extends WSClientEvent { + const _ChannelKickedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _MaxStreakChangedEvent extends WSClientEvent { + const _MaxStreakChangedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _ChannelTruncatedEvent extends WSClientEvent { + const _ChannelTruncatedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _ChannelUnFrozenEvent extends WSClientEvent { + const _ChannelUnFrozenEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _ChannelUpdatedEvent extends WSClientEvent { + const _ChannelUpdatedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _ChannelVisibleEvent extends WSClientEvent { + const _ChannelVisibleEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _DraftDeletedEvent extends WSClientEvent { + const _DraftDeletedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _DraftUpdatedEvent extends WSClientEvent { + const _DraftUpdatedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _MemberAddedEvent extends WSClientEvent { + const _MemberAddedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _MemberRemovedEvent extends WSClientEvent { + const _MemberRemovedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _MemberUpdatedEvent extends WSClientEvent { + const _MemberUpdatedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _MessageDeletedEvent extends WSClientEvent { + const _MessageDeletedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _MessageDeliveredEvent extends WSClientEvent { + const _MessageDeliveredEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _MessageNewEvent extends WSClientEvent { + const _MessageNewEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _PendingMessageEvent extends WSClientEvent { + const _PendingMessageEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _MessageReadEvent extends WSClientEvent { + const _MessageReadEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _MessageUndeletedEvent extends WSClientEvent { + const _MessageUndeletedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _MessageUpdatedEvent extends WSClientEvent { + const _MessageUpdatedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _ModerationCustomActionEvent extends WSClientEvent { + const _ModerationCustomActionEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _ModerationFlaggedEvent extends WSClientEvent { + const _ModerationFlaggedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _ModerationMarkReviewedEvent extends WSClientEvent { + const _ModerationMarkReviewedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _NotificationAddedToChannelEvent extends WSClientEvent { + const _NotificationAddedToChannelEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _NotificationChannelDeletedEvent extends WSClientEvent { + const _NotificationChannelDeletedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _NotificationChannelMutesUpdatedEvent extends WSClientEvent { + const _NotificationChannelMutesUpdatedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _NotificationChannelTruncatedEvent extends WSClientEvent { + const _NotificationChannelTruncatedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _NotificationInviteAcceptedEvent extends WSClientEvent { + const _NotificationInviteAcceptedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _NotificationInviteRejectedEvent extends WSClientEvent { + const _NotificationInviteRejectedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _NotificationInvitedEvent extends WSClientEvent { + const _NotificationInvitedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _NotificationMarkReadEvent extends WSClientEvent { + const _NotificationMarkReadEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _NotificationMarkUnreadEvent extends WSClientEvent { + const _NotificationMarkUnreadEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _NotificationNewMessageEvent extends WSClientEvent { + const _NotificationNewMessageEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _NotificationMutesUpdatedEvent extends WSClientEvent { + const _NotificationMutesUpdatedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _ReminderNotificationEvent extends WSClientEvent { + const _ReminderNotificationEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _NotificationRemovedFromChannelEvent extends WSClientEvent { + const _NotificationRemovedFromChannelEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _NotificationThreadMessageNewEvent extends WSClientEvent { + const _NotificationThreadMessageNewEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _PollClosedEvent extends WSClientEvent { + const _PollClosedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _PollDeletedEvent extends WSClientEvent { + const _PollDeletedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _PollUpdatedEvent extends WSClientEvent { + const _PollUpdatedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _PollVoteCastedEvent extends WSClientEvent { + const _PollVoteCastedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _PollVoteChangedEvent extends WSClientEvent { + const _PollVoteChangedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _PollVoteRemovedEvent extends WSClientEvent { + const _PollVoteRemovedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _ReactionDeletedEvent extends WSClientEvent { + const _ReactionDeletedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _ReactionNewEvent extends WSClientEvent { + const _ReactionNewEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _ReactionUpdatedEvent extends WSClientEvent { + const _ReactionUpdatedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _ReminderCreatedEvent extends WSClientEvent { + const _ReminderCreatedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _ReminderDeletedEvent extends WSClientEvent { + const _ReminderDeletedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _ReminderUpdatedEvent extends WSClientEvent { + const _ReminderUpdatedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _ThreadUpdatedEvent extends WSClientEvent { + const _ThreadUpdatedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _TypingStartEvent extends WSClientEvent { + const _TypingStartEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _TypingStopEvent extends WSClientEvent { + const _TypingStopEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _UserBannedEvent extends WSClientEvent { + const _UserBannedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _UserDeactivatedEvent extends WSClientEvent { + const _UserDeactivatedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _UserDeletedEvent extends WSClientEvent { + const _UserDeletedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _UserMessagesDeletedEvent extends WSClientEvent { + const _UserMessagesDeletedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _UserMutedEvent extends WSClientEvent { + const _UserMutedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _UserPresenceChangedEvent extends WSClientEvent { + const _UserPresenceChangedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _UserReactivatedEvent extends WSClientEvent { + const _UserReactivatedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _UserUnbannedEvent extends WSClientEvent { + const _UserUnbannedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _UserUpdatedEvent extends WSClientEvent { + const _UserUpdatedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _UserWatchingStartEvent extends WSClientEvent { + const _UserWatchingStartEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _UserWatchingStopEvent extends WSClientEvent { + const _UserWatchingStopEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _UserGroupCreatedEvent extends WSClientEvent { + const _UserGroupCreatedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _UserGroupDeletedEvent extends WSClientEvent { + const _UserGroupDeletedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _UserGroupMemberAddedEvent extends WSClientEvent { + const _UserGroupMemberAddedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _UserGroupMemberRemovedEvent extends WSClientEvent { + const _UserGroupMemberRemovedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _UserGroupUpdatedEvent extends WSClientEvent { + const _UserGroupUpdatedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _UnknownWSClientEvent extends WSClientEvent { + const _UnknownWSClientEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class UnknownWSClientEvent extends core.WsEvent { + const UnknownWSClientEvent(this.type, this.rawJson); + + final String type; + final Map rawJson; +} diff --git a/packages/stream_chat/lib/open_api/model/ws_event.dart b/packages/stream_chat/lib/open_api/model/ws_event.dart new file mode 100644 index 0000000000..9840ded7a4 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ws_event.dart @@ -0,0 +1,666 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs + +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +abstract class WSEvent { + const WSEvent(this.wrapped); + + final T wrapped; + String get type; + + static WSEvent fromJson(Map json) { + final eventType = json['type']; + + if (eventType == null || eventType is! String) { + throw ArgumentError('Invalid or missing "type" field in JSON: $json'); + } + + return switch (eventType) { + "*" => _CustomEvent(CustomEvent.fromJson(json)), + "ai_indicator.clear" => _AIIndicatorClearEvent(AIIndicatorClearEvent.fromJson(json)), + "ai_indicator.stop" => _AIIndicatorStopEvent(AIIndicatorStopEvent.fromJson(json)), + "ai_indicator.update" => _AIIndicatorUpdateEvent(AIIndicatorUpdateEvent.fromJson(json)), + "app.updated" => _AppUpdatedEvent(AppUpdatedEvent.fromJson(json)), + "channel.created" => _ChannelCreatedEvent(ChannelCreatedEvent.fromJson(json)), + "channel.deleted" => _ChannelDeletedEvent(ChannelDeletedEvent.fromJson(json)), + "channel.frozen" => _ChannelFrozenEvent(ChannelFrozenEvent.fromJson(json)), + "channel.hidden" => _ChannelHiddenEvent(ChannelHiddenEvent.fromJson(json)), + "channel.kicked" => _ChannelKickedEvent(ChannelKickedEvent.fromJson(json)), + "channel.max_streak_changed" => _MaxStreakChangedEvent(MaxStreakChangedEvent.fromJson(json)), + "channel.truncated" => _ChannelTruncatedEvent(ChannelTruncatedEvent.fromJson(json)), + "channel.unfrozen" => _ChannelUnFrozenEvent(ChannelUnFrozenEvent.fromJson(json)), + "channel.updated" => _ChannelUpdatedEvent(ChannelUpdatedEvent.fromJson(json)), + "channel.visible" => _ChannelVisibleEvent(ChannelVisibleEvent.fromJson(json)), + "draft.deleted" => _DraftDeletedEvent(DraftDeletedEvent.fromJson(json)), + "draft.updated" => _DraftUpdatedEvent(DraftUpdatedEvent.fromJson(json)), + "member.added" => _MemberAddedEvent(MemberAddedEvent.fromJson(json)), + "member.removed" => _MemberRemovedEvent(MemberRemovedEvent.fromJson(json)), + "member.updated" => _MemberUpdatedEvent(MemberUpdatedEvent.fromJson(json)), + "message.deleted" => _MessageDeletedEvent(MessageDeletedEvent.fromJson(json)), + "message.delivered" => _MessageDeliveredEvent(MessageDeliveredEvent.fromJson(json)), + "message.new" => _MessageNewEvent(MessageNewEvent.fromJson(json)), + "message.pending" => _PendingMessageEvent(PendingMessageEvent.fromJson(json)), + "message.read" => _MessageReadEvent(MessageReadEvent.fromJson(json)), + "message.undeleted" => _MessageUndeletedEvent(MessageUndeletedEvent.fromJson(json)), + "message.updated" => _MessageUpdatedEvent(MessageUpdatedEvent.fromJson(json)), + "moderation.custom_action" => _ModerationCustomActionEvent(ModerationCustomActionEvent.fromJson(json)), + "moderation.flagged" => _ModerationFlaggedEvent(ModerationFlaggedEvent.fromJson(json)), + "moderation.mark_reviewed" => _ModerationMarkReviewedEvent(ModerationMarkReviewedEvent.fromJson(json)), + "notification.added_to_channel" => _NotificationAddedToChannelEvent( + NotificationAddedToChannelEvent.fromJson(json), + ), + "notification.channel_deleted" => _NotificationChannelDeletedEvent( + NotificationChannelDeletedEvent.fromJson(json), + ), + "notification.channel_mutes_updated" => _NotificationChannelMutesUpdatedEvent( + NotificationChannelMutesUpdatedEvent.fromJson(json), + ), + "notification.channel_truncated" => _NotificationChannelTruncatedEvent( + NotificationChannelTruncatedEvent.fromJson(json), + ), + "notification.invite_accepted" => _NotificationInviteAcceptedEvent( + NotificationInviteAcceptedEvent.fromJson(json), + ), + "notification.invite_rejected" => _NotificationInviteRejectedEvent( + NotificationInviteRejectedEvent.fromJson(json), + ), + "notification.invited" => _NotificationInvitedEvent(NotificationInvitedEvent.fromJson(json)), + "notification.mark_read" => _NotificationMarkReadEvent(NotificationMarkReadEvent.fromJson(json)), + "notification.mark_unread" => _NotificationMarkUnreadEvent(NotificationMarkUnreadEvent.fromJson(json)), + "notification.message_new" => _NotificationNewMessageEvent(NotificationNewMessageEvent.fromJson(json)), + "notification.mutes_updated" => _NotificationMutesUpdatedEvent(NotificationMutesUpdatedEvent.fromJson(json)), + "notification.reminder_due" => _ReminderNotificationEvent(ReminderNotificationEvent.fromJson(json)), + "notification.removed_from_channel" => _NotificationRemovedFromChannelEvent( + NotificationRemovedFromChannelEvent.fromJson(json), + ), + "notification.thread_message_new" => _NotificationThreadMessageNewEvent( + NotificationThreadMessageNewEvent.fromJson(json), + ), + "poll.closed" => _PollClosedEvent(PollClosedEvent.fromJson(json)), + "poll.deleted" => _PollDeletedEvent(PollDeletedEvent.fromJson(json)), + "poll.updated" => _PollUpdatedEvent(PollUpdatedEvent.fromJson(json)), + "poll.vote_casted" => _PollVoteCastedEvent(PollVoteCastedEvent.fromJson(json)), + "poll.vote_changed" => _PollVoteChangedEvent(PollVoteChangedEvent.fromJson(json)), + "poll.vote_removed" => _PollVoteRemovedEvent(PollVoteRemovedEvent.fromJson(json)), + "reaction.deleted" => _ReactionDeletedEvent(ReactionDeletedEvent.fromJson(json)), + "reaction.new" => _ReactionNewEvent(ReactionNewEvent.fromJson(json)), + "reaction.updated" => _ReactionUpdatedEvent(ReactionUpdatedEvent.fromJson(json)), + "reminder.created" => _ReminderCreatedEvent(ReminderCreatedEvent.fromJson(json)), + "reminder.deleted" => _ReminderDeletedEvent(ReminderDeletedEvent.fromJson(json)), + "reminder.updated" => _ReminderUpdatedEvent(ReminderUpdatedEvent.fromJson(json)), + "thread.updated" => _ThreadUpdatedEvent(ThreadUpdatedEvent.fromJson(json)), + "typing.start" => _TypingStartEvent(TypingStartEvent.fromJson(json)), + "typing.stop" => _TypingStopEvent(TypingStopEvent.fromJson(json)), + "user.banned" => _UserBannedEvent(UserBannedEvent.fromJson(json)), + "user.deactivated" => _UserDeactivatedEvent(UserDeactivatedEvent.fromJson(json)), + "user.deleted" => _UserDeletedEvent(UserDeletedEvent.fromJson(json)), + "user.messages.deleted" => _UserMessagesDeletedEvent(UserMessagesDeletedEvent.fromJson(json)), + "user.muted" => _UserMutedEvent(UserMutedEvent.fromJson(json)), + "user.presence.changed" => _UserPresenceChangedEvent(UserPresenceChangedEvent.fromJson(json)), + "user.reactivated" => _UserReactivatedEvent(UserReactivatedEvent.fromJson(json)), + "user.unbanned" => _UserUnbannedEvent(UserUnbannedEvent.fromJson(json)), + "user.updated" => _UserUpdatedEvent(UserUpdatedEvent.fromJson(json)), + "user.watching.start" => _UserWatchingStartEvent(UserWatchingStartEvent.fromJson(json)), + "user.watching.stop" => _UserWatchingStopEvent(UserWatchingStopEvent.fromJson(json)), + "user_group.created" => _UserGroupCreatedEvent(UserGroupCreatedEvent.fromJson(json)), + "user_group.deleted" => _UserGroupDeletedEvent(UserGroupDeletedEvent.fromJson(json)), + "user_group.member_added" => _UserGroupMemberAddedEvent(UserGroupMemberAddedEvent.fromJson(json)), + "user_group.member_removed" => _UserGroupMemberRemovedEvent(UserGroupMemberRemovedEvent.fromJson(json)), + "user_group.updated" => _UserGroupUpdatedEvent(UserGroupUpdatedEvent.fromJson(json)), + _ => _UnknownWSEvent(UnknownWSEvent(eventType, json)), + }; + } +} + +class _CustomEvent extends WSEvent { + const _CustomEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _AIIndicatorClearEvent extends WSEvent { + const _AIIndicatorClearEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _AIIndicatorStopEvent extends WSEvent { + const _AIIndicatorStopEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _AIIndicatorUpdateEvent extends WSEvent { + const _AIIndicatorUpdateEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _AppUpdatedEvent extends WSEvent { + const _AppUpdatedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _ChannelCreatedEvent extends WSEvent { + const _ChannelCreatedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _ChannelDeletedEvent extends WSEvent { + const _ChannelDeletedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _ChannelFrozenEvent extends WSEvent { + const _ChannelFrozenEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _ChannelHiddenEvent extends WSEvent { + const _ChannelHiddenEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _ChannelKickedEvent extends WSEvent { + const _ChannelKickedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _MaxStreakChangedEvent extends WSEvent { + const _MaxStreakChangedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _ChannelTruncatedEvent extends WSEvent { + const _ChannelTruncatedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _ChannelUnFrozenEvent extends WSEvent { + const _ChannelUnFrozenEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _ChannelUpdatedEvent extends WSEvent { + const _ChannelUpdatedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _ChannelVisibleEvent extends WSEvent { + const _ChannelVisibleEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _DraftDeletedEvent extends WSEvent { + const _DraftDeletedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _DraftUpdatedEvent extends WSEvent { + const _DraftUpdatedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _MemberAddedEvent extends WSEvent { + const _MemberAddedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _MemberRemovedEvent extends WSEvent { + const _MemberRemovedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _MemberUpdatedEvent extends WSEvent { + const _MemberUpdatedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _MessageDeletedEvent extends WSEvent { + const _MessageDeletedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _MessageDeliveredEvent extends WSEvent { + const _MessageDeliveredEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _MessageNewEvent extends WSEvent { + const _MessageNewEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _PendingMessageEvent extends WSEvent { + const _PendingMessageEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _MessageReadEvent extends WSEvent { + const _MessageReadEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _MessageUndeletedEvent extends WSEvent { + const _MessageUndeletedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _MessageUpdatedEvent extends WSEvent { + const _MessageUpdatedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _ModerationCustomActionEvent extends WSEvent { + const _ModerationCustomActionEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _ModerationFlaggedEvent extends WSEvent { + const _ModerationFlaggedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _ModerationMarkReviewedEvent extends WSEvent { + const _ModerationMarkReviewedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _NotificationAddedToChannelEvent extends WSEvent { + const _NotificationAddedToChannelEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _NotificationChannelDeletedEvent extends WSEvent { + const _NotificationChannelDeletedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _NotificationChannelMutesUpdatedEvent extends WSEvent { + const _NotificationChannelMutesUpdatedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _NotificationChannelTruncatedEvent extends WSEvent { + const _NotificationChannelTruncatedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _NotificationInviteAcceptedEvent extends WSEvent { + const _NotificationInviteAcceptedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _NotificationInviteRejectedEvent extends WSEvent { + const _NotificationInviteRejectedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _NotificationInvitedEvent extends WSEvent { + const _NotificationInvitedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _NotificationMarkReadEvent extends WSEvent { + const _NotificationMarkReadEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _NotificationMarkUnreadEvent extends WSEvent { + const _NotificationMarkUnreadEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _NotificationNewMessageEvent extends WSEvent { + const _NotificationNewMessageEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _NotificationMutesUpdatedEvent extends WSEvent { + const _NotificationMutesUpdatedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _ReminderNotificationEvent extends WSEvent { + const _ReminderNotificationEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _NotificationRemovedFromChannelEvent extends WSEvent { + const _NotificationRemovedFromChannelEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _NotificationThreadMessageNewEvent extends WSEvent { + const _NotificationThreadMessageNewEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _PollClosedEvent extends WSEvent { + const _PollClosedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _PollDeletedEvent extends WSEvent { + const _PollDeletedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _PollUpdatedEvent extends WSEvent { + const _PollUpdatedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _PollVoteCastedEvent extends WSEvent { + const _PollVoteCastedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _PollVoteChangedEvent extends WSEvent { + const _PollVoteChangedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _PollVoteRemovedEvent extends WSEvent { + const _PollVoteRemovedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _ReactionDeletedEvent extends WSEvent { + const _ReactionDeletedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _ReactionNewEvent extends WSEvent { + const _ReactionNewEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _ReactionUpdatedEvent extends WSEvent { + const _ReactionUpdatedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _ReminderCreatedEvent extends WSEvent { + const _ReminderCreatedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _ReminderDeletedEvent extends WSEvent { + const _ReminderDeletedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _ReminderUpdatedEvent extends WSEvent { + const _ReminderUpdatedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _ThreadUpdatedEvent extends WSEvent { + const _ThreadUpdatedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _TypingStartEvent extends WSEvent { + const _TypingStartEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _TypingStopEvent extends WSEvent { + const _TypingStopEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _UserBannedEvent extends WSEvent { + const _UserBannedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _UserDeactivatedEvent extends WSEvent { + const _UserDeactivatedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _UserDeletedEvent extends WSEvent { + const _UserDeletedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _UserMessagesDeletedEvent extends WSEvent { + const _UserMessagesDeletedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _UserMutedEvent extends WSEvent { + const _UserMutedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _UserPresenceChangedEvent extends WSEvent { + const _UserPresenceChangedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _UserReactivatedEvent extends WSEvent { + const _UserReactivatedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _UserUnbannedEvent extends WSEvent { + const _UserUnbannedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _UserUpdatedEvent extends WSEvent { + const _UserUpdatedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _UserWatchingStartEvent extends WSEvent { + const _UserWatchingStartEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _UserWatchingStopEvent extends WSEvent { + const _UserWatchingStopEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _UserGroupCreatedEvent extends WSEvent { + const _UserGroupCreatedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _UserGroupDeletedEvent extends WSEvent { + const _UserGroupDeletedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _UserGroupMemberAddedEvent extends WSEvent { + const _UserGroupMemberAddedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _UserGroupMemberRemovedEvent extends WSEvent { + const _UserGroupMemberRemovedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _UserGroupUpdatedEvent extends WSEvent { + const _UserGroupUpdatedEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class _UnknownWSEvent extends WSEvent { + const _UnknownWSEvent(super.wrapped); + + @override + String get type => wrapped.type; +} + +class UnknownWSEvent extends core.WsEvent { + const UnknownWSEvent(this.type, this.rawJson); + + final String type; + final Map rawJson; +} + +WSEvent wsEventFromJson(Map json) => WSEvent.fromJson(json); + +Map wsEventToJson(WSEvent event) => (event.wrapped as dynamic).toJson() as Map; + +List wsEventListFromJson(List json) => + json.map((e) => wsEventFromJson(e as Map)).toList(); + +List> wsEventListToJson(List events) => events.map(wsEventToJson).toList(); diff --git a/packages/stream_chat/lib/open_api/models.dart b/packages/stream_chat/lib/open_api/models.dart new file mode 100644 index 0000000000..83fd46cc00 --- /dev/null +++ b/packages/stream_chat/lib/open_api/models.dart @@ -0,0 +1,497 @@ +// ignore_for_file: directives_ordering + +export 'package:stream_core/stream_core.dart' show StreamApiError, StreamDateTimeConverter, WsEvent; + +export 'model/ai_audio_config_request.dart'; +export 'model/ai_audio_config_response.dart'; +export 'model/ai_image_config.dart'; +export 'model/ai_image_label_definition.dart'; +export 'model/ai_indicator_clear_event.dart'; +export 'model/ai_indicator_stop_event.dart'; +export 'model/ai_indicator_update_event.dart'; +export 'model/ai_text_config.dart'; +export 'model/ai_video_config.dart'; +export 'model/aws_rekognition_rule.dart'; +export 'model/action.dart'; +export 'model/action_log_response.dart'; +export 'model/action_sequence.dart'; +export 'model/add_user_group_members_request.dart'; +export 'model/add_user_group_members_response.dart'; +export 'model/app_event_response.dart'; +export 'model/app_response_fields.dart'; +export 'model/app_updated_event.dart'; +export 'model/appeal_item_response.dart'; +export 'model/appeal_request.dart'; +export 'model/appeal_response.dart'; +export 'model/attachment.dart'; +export 'model/automod_details_response.dart'; +export 'model/automod_platform_circumvention_config.dart'; +export 'model/automod_rule.dart'; +export 'model/automod_semantic_filters_config.dart'; +export 'model/automod_semantic_filters_rule.dart'; +export 'model/automod_toxicity_config.dart'; +export 'model/ban_action_request_payload.dart'; +export 'model/ban_info_response.dart'; +export 'model/ban_options.dart'; +export 'model/ban_request.dart'; +export 'model/ban_response.dart'; +export 'model/block_action_request_payload.dart'; +export 'model/block_list_config.dart'; +export 'model/block_list_options.dart'; +export 'model/block_list_response.dart'; +export 'model/block_list_rule.dart'; +export 'model/block_users_request.dart'; +export 'model/block_users_response.dart'; +export 'model/blocked_user_response.dart'; +export 'model/bodyguard_profile_summary.dart'; +export 'model/bodyguard_rule.dart'; +export 'model/bodyguard_severity_rule.dart'; +export 'model/bulk_action_appeals_request.dart'; +export 'model/bulk_action_appeals_response.dart'; +export 'model/bulk_appeal_error.dart'; +export 'model/bulk_appeal_result.dart'; +export 'model/bulk_delete_action_config_request.dart'; +export 'model/bulk_delete_action_config_response.dart'; +export 'model/bulk_upsert_action_config_request.dart'; +export 'model/bulk_upsert_action_config_response.dart'; +export 'model/bypass_action_request.dart'; +export 'model/call_action_options.dart'; +export 'model/call_custom_property_parameters.dart'; +export 'model/call_rule_action_sequence.dart'; +export 'model/call_type_rule_parameters.dart'; +export 'model/call_violation_count_parameters.dart'; +export 'model/cast_poll_vote_request.dart'; +export 'model/channel_config_overrides.dart'; +export 'model/channel_config_with_info.dart'; +export 'model/channel_context_response.dart'; +export 'model/channel_created_event.dart'; +export 'model/channel_deleted_event.dart'; +export 'model/channel_frozen_event.dart'; +export 'model/channel_get_or_create_request.dart'; +export 'model/channel_hidden_event.dart'; +export 'model/channel_input.dart'; +export 'model/channel_input_request.dart'; +export 'model/channel_kicked_event.dart'; +export 'model/channel_member_partial_response.dart'; +export 'model/channel_member_request.dart'; +export 'model/channel_member_response.dart'; +export 'model/channel_message_count_rule_parameters.dart'; +export 'model/channel_metadata.dart'; +export 'model/channel_mute.dart'; +export 'model/channel_own_capability.dart'; +export 'model/channel_push_preferences_response.dart'; +export 'model/channel_response.dart'; +export 'model/channel_state_response.dart'; +export 'model/channel_state_response_fields.dart'; +export 'model/channel_truncated_event.dart'; +export 'model/channel_un_frozen_event.dart'; +export 'model/channel_updated_event.dart'; +export 'model/channel_visible_event.dart'; +export 'model/chat_draft_payload_response.dart'; +export 'model/chat_draft_response.dart'; +export 'model/chat_message_response.dart'; +export 'model/chat_moderation_v2_response.dart'; +export 'model/chat_preferences.dart'; +export 'model/chat_preferences_input.dart'; +export 'model/chat_preferences_response.dart'; +export 'model/chat_reaction_group_response.dart'; +export 'model/chat_reaction_group_user_response.dart'; +export 'model/chat_reaction_response.dart'; +export 'model/chat_reminder_response_data.dart'; +export 'model/chat_shared_location_response_data.dart'; +export 'model/closed_caption_rule_parameters.dart'; +export 'model/command.dart'; +export 'model/config_overrides_request.dart'; +export 'model/config_response.dart'; +export 'model/content_count_rule_parameters.dart'; +export 'model/content_custom_property_count_parameters.dart'; +export 'model/content_custom_property_parameters.dart'; +export 'model/create_block_list_request.dart'; +export 'model/create_block_list_response.dart'; +export 'model/create_device_request.dart'; +export 'model/create_draft_request.dart'; +export 'model/create_draft_response.dart'; +export 'model/create_guest_request.dart'; +export 'model/create_guest_response.dart'; +export 'model/create_poll_option_request.dart'; +export 'model/create_poll_request.dart'; +export 'model/create_queue_request.dart'; +export 'model/create_reminder_request.dart'; +export 'model/create_user_group_request.dart'; +export 'model/create_user_group_response.dart'; +export 'model/custom_action_request_payload.dart'; +export 'model/custom_event.dart'; +export 'model/data.dart'; +export 'model/delete_action_config_response.dart'; +export 'model/delete_activity_request_payload.dart'; +export 'model/delete_channel_response.dart'; +export 'model/delete_channels_request.dart'; +export 'model/delete_channels_response.dart'; +export 'model/delete_channels_result_response.dart'; +export 'model/delete_comment_request_payload.dart'; +export 'model/delete_message_request_payload.dart'; +export 'model/delete_message_response.dart'; +export 'model/delete_moderation_config_response.dart'; +export 'model/delete_reaction_request_payload.dart'; +export 'model/delete_reaction_response.dart'; +export 'model/delete_reminder_response.dart'; +export 'model/delete_user_messages_request_payload.dart'; +export 'model/delete_user_request_payload.dart'; +export 'model/delivered_message_payload.dart'; +export 'model/delivery_receipts_response.dart'; +export 'model/device_response.dart'; +export 'model/draft_deleted_event.dart'; +export 'model/draft_payload_response.dart'; +export 'model/draft_response.dart'; +export 'model/draft_updated_event.dart'; +export 'model/duration_response.dart'; +export 'model/enriched_activity.dart'; +export 'model/enriched_reaction.dart'; +export 'model/entity_creator_response.dart'; +export 'model/escalate_payload.dart'; +export 'model/escalation_metadata.dart'; +export 'model/event_request.dart'; +export 'model/event_response.dart'; +export 'model/feeds_activity_location.dart'; +export 'model/feeds_bookmark_response.dart'; +export 'model/feeds_enriched_collection_response.dart'; +export 'model/feeds_feed_response.dart'; +export 'model/feeds_notification_comment.dart'; +export 'model/feeds_notification_context.dart'; +export 'model/feeds_notification_parent_activity.dart'; +export 'model/feeds_notification_target.dart'; +export 'model/feeds_notification_trigger.dart'; +export 'model/feeds_preferences.dart'; +export 'model/feeds_preferences_response.dart'; +export 'model/feeds_reaction_group_response.dart'; +export 'model/feeds_reaction_response.dart'; +export 'model/feeds_share_response.dart'; +export 'model/feeds_v3_activity_response.dart'; +export 'model/feeds_v3_comment_response.dart'; +export 'model/field.dart'; +export 'model/file_upload_config.dart'; +export 'model/file_upload_request.dart'; +export 'model/file_upload_response.dart'; +export 'model/filter_config_response.dart'; +export 'model/flag_count_rule_parameters.dart'; +export 'model/flag_details_response.dart'; +export 'model/flag_feedback_response.dart'; +export 'model/flag_item_response.dart'; +export 'model/flag_message_details_response.dart'; +export 'model/flag_request.dart'; +export 'model/flag_user_options.dart'; +export 'model/flood_config.dart'; +export 'model/flood_identical_config.dart'; +export 'model/flood_identical_rule_parameters.dart'; +export 'model/flood_similar_config.dart'; +export 'model/flood_similar_rule_parameters.dart'; +export 'model/full_user_response.dart'; +export 'model/future_channel_ban_response.dart'; +export 'model/get_action_config_response.dart'; +export 'model/get_appeal_response.dart'; +export 'model/get_application_response.dart'; +export 'model/get_blocked_users_response.dart'; +export 'model/get_config_response.dart'; +export 'model/get_draft_response.dart'; +export 'model/get_many_messages_response.dart'; +export 'model/get_message_response.dart'; +export 'model/get_og_response.dart'; +export 'model/get_pinned_messages_response.dart'; +export 'model/get_reactions_response.dart'; +export 'model/get_replies_response.dart'; +export 'model/get_thread_response.dart'; +export 'model/get_user_group_response.dart'; +export 'model/google_vision_config.dart'; +export 'model/grouped_channels_bucket.dart'; +export 'model/grouped_channels_group_request.dart'; +export 'model/grouped_query_channels_request.dart'; +export 'model/grouped_query_channels_response.dart'; +export 'model/harm_config.dart'; +export 'model/hide_channel_request.dart'; +export 'model/hide_channel_response.dart'; +export 'model/ip_content_count_rule_parameters.dart'; +export 'model/ip_flag_count_rule_parameters.dart'; +export 'model/image_content_parameters.dart'; +export 'model/image_data.dart'; +export 'model/image_rule_parameters.dart'; +export 'model/image_size.dart'; +export 'model/image_upload_request.dart'; +export 'model/image_upload_response.dart'; +export 'model/images.dart'; +export 'model/import_block_list_request.dart'; +export 'model/import_block_list_response.dart'; +export 'model/keyframe_ocr_rule_parameters.dart'; +export 'model/keyframe_rule_parameters.dart'; +export 'model/llm_config.dart'; +export 'model/llm_rule.dart'; +export 'model/label_response.dart'; +export 'model/label_thresholds.dart'; +export 'model/list_block_list_response.dart'; +export 'model/list_devices_response.dart'; +export 'model/list_queues_response.dart'; +export 'model/list_user_groups_response.dart'; +export 'model/mark_channels_read_request.dart'; +export 'model/mark_delivered_request.dart'; +export 'model/mark_delivered_response.dart'; +export 'model/mark_read_request.dart'; +export 'model/mark_read_response.dart'; +export 'model/mark_read_response_event.dart'; +export 'model/mark_reviewed_request_payload.dart'; +export 'model/mark_unread_request.dart'; +export 'model/max_streak_changed_event.dart'; +export 'model/member_added_event.dart'; +export 'model/member_removed_event.dart'; +export 'model/member_updated_event.dart'; +export 'model/member_user_request.dart'; +export 'model/members_response.dart'; +export 'model/message_action_request.dart'; +export 'model/message_action_response.dart'; +export 'model/message_change_set.dart'; +export 'model/message_deleted_event.dart'; +export 'model/message_delivered_event.dart'; +export 'model/message_flag_response.dart'; +export 'model/message_moderation_result.dart'; +export 'model/message_new_event.dart'; +export 'model/message_options.dart'; +export 'model/message_pagination_params.dart'; +export 'model/message_read_event.dart'; +export 'model/message_request.dart'; +export 'model/message_response.dart'; +export 'model/message_undeleted_event.dart'; +export 'model/message_update.dart'; +export 'model/message_updated_event.dart'; +export 'model/message_with_channel_response.dart'; +export 'model/moderation_action_config_response.dart'; +export 'model/moderation_ban_response.dart'; +export 'model/moderation_call_response.dart'; +export 'model/moderation_custom_action_event.dart'; +export 'model/moderation_flag_response.dart'; +export 'model/moderation_flagged_event.dart'; +export 'model/moderation_mark_reviewed_event.dart'; +export 'model/moderation_payload.dart'; +export 'model/moderation_payload_response.dart'; +export 'model/moderation_queue_response.dart'; +export 'model/moderation_response.dart'; +export 'model/moderation_v2_response.dart'; +export 'model/mute_channel_request.dart'; +export 'model/mute_channel_response.dart'; +export 'model/mute_request.dart'; +export 'model/mute_response.dart'; +export 'model/notification_added_to_channel_event.dart'; +export 'model/notification_channel_deleted_event.dart'; +export 'model/notification_channel_mutes_updated_event.dart'; +export 'model/notification_channel_truncated_event.dart'; +export 'model/notification_invite_accepted_event.dart'; +export 'model/notification_invite_rejected_event.dart'; +export 'model/notification_invited_event.dart'; +export 'model/notification_mark_read_event.dart'; +export 'model/notification_mark_unread_event.dart'; +export 'model/notification_mutes_updated_event.dart'; +export 'model/notification_new_message_event.dart'; +export 'model/notification_removed_from_channel_event.dart'; +export 'model/notification_thread_message_new_event.dart'; +export 'model/ocr_content_parameters.dart'; +export 'model/ocr_rule.dart'; +export 'model/only_user_id.dart'; +export 'model/own_user_response.dart'; +export 'model/pagination_params.dart'; +export 'model/parsed_predefined_filter_response.dart'; +export 'model/pending_message_event.dart'; +export 'model/pending_message_response.dart'; +export 'model/poll_closed_event.dart'; +export 'model/poll_deleted_event.dart'; +export 'model/poll_option_input.dart'; +export 'model/poll_option_request.dart'; +export 'model/poll_option_response.dart'; +export 'model/poll_option_response_data.dart'; +export 'model/poll_response.dart'; +export 'model/poll_response_data.dart'; +export 'model/poll_updated_event.dart'; +export 'model/poll_vote_casted_event.dart'; +export 'model/poll_vote_changed_event.dart'; +export 'model/poll_vote_removed_event.dart'; +export 'model/poll_vote_response.dart'; +export 'model/poll_vote_response_data.dart'; +export 'model/poll_votes_response.dart'; +export 'model/privacy_settings_response.dart'; +export 'model/push_preference_input.dart'; +export 'model/push_preferences_response.dart'; +export 'model/query_appeals_request.dart'; +export 'model/query_appeals_response.dart'; +export 'model/query_banned_users_payload.dart'; +export 'model/query_banned_users_response.dart'; +export 'model/query_channels_request.dart'; +export 'model/query_channels_response.dart'; +export 'model/query_drafts_request.dart'; +export 'model/query_drafts_response.dart'; +export 'model/query_future_channel_bans_payload.dart'; +export 'model/query_future_channel_bans_response.dart'; +export 'model/query_members_payload.dart'; +export 'model/query_message_flags_payload.dart'; +export 'model/query_message_flags_response.dart'; +export 'model/query_moderation_configs_request.dart'; +export 'model/query_moderation_configs_response.dart'; +export 'model/query_poll_votes_request.dart'; +export 'model/query_polls_request.dart'; +export 'model/query_polls_response.dart'; +export 'model/query_reactions_request.dart'; +export 'model/query_reactions_response.dart'; +export 'model/query_reminders_request.dart'; +export 'model/query_reminders_response.dart'; +export 'model/query_review_queue_request.dart'; +export 'model/query_review_queue_response.dart'; +export 'model/query_threads_request.dart'; +export 'model/query_threads_response.dart'; +export 'model/query_users_payload.dart'; +export 'model/query_users_response.dart'; +export 'model/queue_response.dart'; +export 'model/reaction.dart'; +export 'model/reaction_deleted_event.dart'; +export 'model/reaction_group_response.dart'; +export 'model/reaction_group_user_response.dart'; +export 'model/reaction_new_event.dart'; +export 'model/reaction_request.dart'; +export 'model/reaction_response.dart'; +export 'model/reaction_updated_event.dart'; +export 'model/read_receipts_response.dart'; +export 'model/read_state_response.dart'; +export 'model/reject_appeal_request_payload.dart'; +export 'model/reminder_created_event.dart'; +export 'model/reminder_deleted_event.dart'; +export 'model/reminder_notification_event.dart'; +export 'model/reminder_response_data.dart'; +export 'model/reminder_updated_event.dart'; +export 'model/remove_user_group_members_request.dart'; +export 'model/remove_user_group_members_response.dart'; +export 'model/restore_action_request_payload.dart'; +export 'model/review_queue_item_response.dart'; +export 'model/role.dart'; +export 'model/rule_builder_action.dart'; +export 'model/rule_builder_condition.dart'; +export 'model/rule_builder_condition_group.dart'; +export 'model/rule_builder_config.dart'; +export 'model/rule_builder_rule.dart'; +export 'model/search_payload.dart'; +export 'model/search_response.dart'; +export 'model/search_result.dart'; +export 'model/search_result_message.dart'; +export 'model/search_roles_response.dart'; +export 'model/search_user_groups_response.dart'; +export 'model/search_warning.dart'; +export 'model/send_event_request.dart'; +export 'model/send_message_request.dart'; +export 'model/send_message_response.dart'; +export 'model/send_reaction_request.dart'; +export 'model/send_reaction_response.dart'; +export 'model/shadow_block_action_request_payload.dart'; +export 'model/shared_location.dart'; +export 'model/shared_location_response.dart'; +export 'model/shared_location_response_data.dart'; +export 'model/shared_locations_response.dart'; +export 'model/show_channel_response.dart'; +export 'model/sort_param_request.dart'; +export 'model/submit_action_request.dart'; +export 'model/submit_action_response.dart'; +export 'model/sync_request.dart'; +export 'model/sync_response.dart'; +export 'model/text_content_parameters.dart'; +export 'model/text_rule_parameters.dart'; +export 'model/thread_participant.dart'; +export 'model/thread_response.dart'; +export 'model/thread_state_response.dart'; +export 'model/thread_updated_event.dart'; +export 'model/thresholds.dart'; +export 'model/translate_message_request.dart'; +export 'model/truncate_channel_request.dart'; +export 'model/truncate_channel_response.dart'; +export 'model/typing_indicators_response.dart'; +export 'model/typing_start_event.dart'; +export 'model/typing_stop_event.dart'; +export 'model/unban_action_request_payload.dart'; +export 'model/unblock_action_request_payload.dart'; +export 'model/unblock_users_request.dart'; +export 'model/unblock_users_response.dart'; +export 'model/unmute_channel_request.dart'; +export 'model/unmute_request.dart'; +export 'model/unmute_response.dart'; +export 'model/unread_counts_channel.dart'; +export 'model/unread_counts_channel_type.dart'; +export 'model/unread_counts_thread.dart'; +export 'model/update_block_list_request.dart'; +export 'model/update_block_list_response.dart'; +export 'model/update_channel_partial_request.dart'; +export 'model/update_channel_partial_response.dart'; +export 'model/update_channel_request.dart'; +export 'model/update_channel_response.dart'; +export 'model/update_live_location_request.dart'; +export 'model/update_member_partial_request.dart'; +export 'model/update_member_partial_response.dart'; +export 'model/update_message_partial_request.dart'; +export 'model/update_message_partial_response.dart'; +export 'model/update_message_request.dart'; +export 'model/update_message_response.dart'; +export 'model/update_poll_option_request.dart'; +export 'model/update_poll_partial_request.dart'; +export 'model/update_poll_request.dart'; +export 'model/update_queue_request.dart'; +export 'model/update_reminder_request.dart'; +export 'model/update_reminder_response.dart'; +export 'model/update_thread_partial_request.dart'; +export 'model/update_thread_partial_response.dart'; +export 'model/update_user_group_request.dart'; +export 'model/update_user_group_response.dart'; +export 'model/update_user_partial_request.dart'; +export 'model/update_users_partial_request.dart'; +export 'model/update_users_request.dart'; +export 'model/update_users_response.dart'; +export 'model/upload_channel_file_request.dart'; +export 'model/upload_channel_file_response.dart'; +export 'model/upload_channel_request.dart'; +export 'model/upload_channel_response.dart'; +export 'model/upsert_action_config_item.dart'; +export 'model/upsert_action_config_request.dart'; +export 'model/upsert_action_config_response.dart'; +export 'model/upsert_config_request.dart'; +export 'model/upsert_config_response.dart'; +export 'model/upsert_push_preferences_request.dart'; +export 'model/upsert_push_preferences_response.dart'; +export 'model/user.dart'; +export 'model/user_banned_event.dart'; +export 'model/user_created_within_parameters.dart'; +export 'model/user_custom_property_parameters.dart'; +export 'model/user_deactivated_event.dart'; +export 'model/user_deleted_event.dart'; +export 'model/user_group.dart'; +export 'model/user_group_created_event.dart'; +export 'model/user_group_deleted_event.dart'; +export 'model/user_group_member.dart'; +export 'model/user_group_member_added_event.dart'; +export 'model/user_group_member_removed_event.dart'; +export 'model/user_group_response.dart'; +export 'model/user_group_updated_event.dart'; +export 'model/user_identical_content_count_parameters.dart'; +export 'model/user_messages_deleted_event.dart'; +export 'model/user_mute_response.dart'; +export 'model/user_muted_event.dart'; +export 'model/user_presence_changed_event.dart'; +export 'model/user_reactivated_event.dart'; +export 'model/user_request.dart'; +export 'model/user_response.dart'; +export 'model/user_response_common_fields.dart'; +export 'model/user_response_privacy_fields.dart'; +export 'model/user_role_parameters.dart'; +export 'model/user_rule_parameters.dart'; +export 'model/user_unbanned_event.dart'; +export 'model/user_updated_event.dart'; +export 'model/user_watching_start_event.dart'; +export 'model/user_watching_stop_event.dart'; +export 'model/velocity_filter_config.dart'; +export 'model/velocity_filter_config_rule.dart'; +export 'model/video_call_rule_config.dart'; +export 'model/video_content_parameters.dart'; +export 'model/video_rule_parameters.dart'; +export 'model/vote_data.dart'; +export 'model/ws_auth_message.dart'; +export 'model/ws_client_event.dart'; +export 'model/ws_event.dart'; +export 'model/wrapped_unread_counts_response.dart'; diff --git a/packages/stream_chat/lib/src/core/models/attachment_file.freezed.dart b/packages/stream_chat/lib/src/core/models/attachment_file.freezed.dart index cc6513e467..d2324958e7 100644 --- a/packages/stream_chat/lib/src/core/models/attachment_file.freezed.dart +++ b/packages/stream_chat/lib/src/core/models/attachment_file.freezed.dart @@ -9,297 +9,285 @@ part of 'attachment_file.dart'; // FreezedGenerator // ************************************************************************** -// dart format off T _$identity(T value) => value; -UploadState _$UploadStateFromJson( - Map json -) { - switch (json['runtimeType']) { - case 'preparing': - return Preparing.fromJson( - json - ); - case 'inProgress': - return InProgress.fromJson( - json - ); - case 'success': - return Success.fromJson( - json - ); - case 'failed': - return Failed.fromJson( - json - ); - - default: - throw CheckedFromJsonException( - json, - 'runtimeType', - 'UploadState', - 'Invalid union type "${json['runtimeType']}"!' -); - } - +UploadState _$UploadStateFromJson(Map json) { + switch (json['runtimeType']) { + case 'preparing': + return Preparing.fromJson(json); + case 'inProgress': + return InProgress.fromJson(json); + case 'success': + return Success.fromJson(json); + case 'failed': + return Failed.fromJson(json); + + default: + throw CheckedFromJsonException( + json, + 'runtimeType', + 'UploadState', + 'Invalid union type "${json['runtimeType']}"!', + ); + } } /// @nodoc mixin _$UploadState { - - - /// Serializes this UploadState to a JSON map. Map toJson(); + @override + bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType && other is UploadState); + } -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is UploadState); -} - -@JsonKey(includeFromJson: false, includeToJson: false) -@override -int get hashCode => runtimeType.hashCode; - -@override -String toString() { - return 'UploadState()'; -} - + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => runtimeType.hashCode; + @override + String toString() { + return 'UploadState()'; + } } /// @nodoc -class $UploadStateCopyWith<$Res> { -$UploadStateCopyWith(UploadState _, $Res Function(UploadState) __); +class $UploadStateCopyWith<$Res> { + $UploadStateCopyWith(UploadState _, $Res Function(UploadState) __); } - - /// @nodoc @JsonSerializable() - class Preparing extends UploadState { - const Preparing({final String? $type}): $type = $type ?? 'preparing',super._(); + const Preparing({final String? $type}) : $type = $type ?? 'preparing', super._(); factory Preparing.fromJson(Map json) => _$PreparingFromJson(json); + @JsonKey(name: 'runtimeType') + final String $type; + @override + Map toJson() { + return _$PreparingToJson(this); + } -@JsonKey(name: 'runtimeType') -final String $type; - + @override + bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType && other is Preparing); + } + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => runtimeType.hashCode; -@override -Map toJson() { - return _$PreparingToJson(this, ); + @override + String toString() { + return 'UploadState.preparing()'; + } } -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is Preparing); -} - -@JsonKey(includeFromJson: false, includeToJson: false) -@override -int get hashCode => runtimeType.hashCode; - -@override -String toString() { - return 'UploadState.preparing()'; +/// @nodoc +class $PreparingCopyWith<$Res> implements $UploadStateCopyWith<$Res> { + $PreparingCopyWith(Preparing _, $Res Function(Preparing) __); } +/// @nodoc +class _$PreparingCopyWithImpl<$Res> implements $PreparingCopyWith<$Res> { + _$PreparingCopyWithImpl(this._self, this._then); + final Preparing _self; + final $Res Function(Preparing) _then; } - - - /// @nodoc @JsonSerializable() - class InProgress extends UploadState { - const InProgress({required this.uploaded, required this.total, final String? $type}): $type = $type ?? 'inProgress',super._(); + const InProgress({ + required this.uploaded, + required this.total, + final String? $type, + }) : $type = $type ?? 'inProgress', + super._(); factory InProgress.fromJson(Map json) => _$InProgressFromJson(json); - final int uploaded; - final int total; - -@JsonKey(name: 'runtimeType') -final String $type; - - -/// Create a copy of UploadState -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$InProgressCopyWith get copyWith => _$InProgressCopyWithImpl(this, _$identity); - -@override -Map toJson() { - return _$InProgressToJson(this, ); -} - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is InProgress&&(identical(other.uploaded, uploaded) || other.uploaded == uploaded)&&(identical(other.total, total) || other.total == total)); -} - -@JsonKey(includeFromJson: false, includeToJson: false) -@override -int get hashCode => Object.hash(runtimeType,uploaded,total); - -@override -String toString() { - return 'UploadState.inProgress(uploaded: $uploaded, total: $total)'; -} - - + final int uploaded; + final int total; + + @JsonKey(name: 'runtimeType') + final String $type; + + /// Create a copy of UploadState + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $InProgressCopyWith get copyWith => _$InProgressCopyWithImpl(this, _$identity); + + @override + Map toJson() { + return _$InProgressToJson(this); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is InProgress && + (identical(other.uploaded, uploaded) || other.uploaded == uploaded) && + (identical(other.total, total) || other.total == total)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, uploaded, total); + + @override + String toString() { + return 'UploadState.inProgress(uploaded: $uploaded, total: $total)'; + } } /// @nodoc abstract mixin class $InProgressCopyWith<$Res> implements $UploadStateCopyWith<$Res> { - factory $InProgressCopyWith(InProgress value, $Res Function(InProgress) _then) = _$InProgressCopyWithImpl; -@useResult -$Res call({ - int uploaded, int total -}); - - - - + factory $InProgressCopyWith( + InProgress value, + $Res Function(InProgress) _then, + ) = _$InProgressCopyWithImpl; + @useResult + $Res call({int uploaded, int total}); } + /// @nodoc -class _$InProgressCopyWithImpl<$Res> - implements $InProgressCopyWith<$Res> { +class _$InProgressCopyWithImpl<$Res> implements $InProgressCopyWith<$Res> { _$InProgressCopyWithImpl(this._self, this._then); final InProgress _self; final $Res Function(InProgress) _then; -/// Create a copy of UploadState -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') $Res call({Object? uploaded = null,Object? total = null,}) { - return _then(InProgress( -uploaded: null == uploaded ? _self.uploaded : uploaded // ignore: cast_nullable_to_non_nullable -as int,total: null == total ? _self.total : total // ignore: cast_nullable_to_non_nullable -as int, - )); -} - - + /// Create a copy of UploadState + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + $Res call({Object? uploaded = null, Object? total = null}) { + return _then( + InProgress( + uploaded: null == uploaded + ? _self.uploaded + : uploaded // ignore: cast_nullable_to_non_nullable + as int, + total: null == total + ? _self.total + : total // ignore: cast_nullable_to_non_nullable + as int, + ), + ); + } } /// @nodoc @JsonSerializable() - class Success extends UploadState { - const Success({final String? $type}): $type = $type ?? 'success',super._(); + const Success({final String? $type}) : $type = $type ?? 'success', super._(); factory Success.fromJson(Map json) => _$SuccessFromJson(json); + @JsonKey(name: 'runtimeType') + final String $type; + @override + Map toJson() { + return _$SuccessToJson(this); + } -@JsonKey(name: 'runtimeType') -final String $type; + @override + bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType && other is Success); + } + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => runtimeType.hashCode; - -@override -Map toJson() { - return _$SuccessToJson(this, ); -} - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is Success); + @override + String toString() { + return 'UploadState.success()'; + } } -@JsonKey(includeFromJson: false, includeToJson: false) -@override -int get hashCode => runtimeType.hashCode; - -@override -String toString() { - return 'UploadState.success()'; +/// @nodoc +class $SuccessCopyWith<$Res> implements $UploadStateCopyWith<$Res> { + $SuccessCopyWith(Success _, $Res Function(Success) __); } +/// @nodoc +class _$SuccessCopyWithImpl<$Res> implements $SuccessCopyWith<$Res> { + _$SuccessCopyWithImpl(this._self, this._then); + final Success _self; + final $Res Function(Success) _then; } - - - /// @nodoc @JsonSerializable() - class Failed extends UploadState { - const Failed({required this.error, final String? $type}): $type = $type ?? 'failed',super._(); + const Failed({required this.error, final String? $type}) : $type = $type ?? 'failed', super._(); factory Failed.fromJson(Map json) => _$FailedFromJson(json); - final String error; - -@JsonKey(name: 'runtimeType') -final String $type; - - -/// Create a copy of UploadState -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$FailedCopyWith get copyWith => _$FailedCopyWithImpl(this, _$identity); - -@override -Map toJson() { - return _$FailedToJson(this, ); -} - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is Failed&&(identical(other.error, error) || other.error == error)); -} - -@JsonKey(includeFromJson: false, includeToJson: false) -@override -int get hashCode => Object.hash(runtimeType,error); - -@override -String toString() { - return 'UploadState.failed(error: $error)'; -} - - + final String error; + + @JsonKey(name: 'runtimeType') + final String $type; + + /// Create a copy of UploadState + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $FailedCopyWith get copyWith => _$FailedCopyWithImpl(this, _$identity); + + @override + Map toJson() { + return _$FailedToJson(this); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is Failed && + (identical(other.error, error) || other.error == error)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, error); + + @override + String toString() { + return 'UploadState.failed(error: $error)'; + } } /// @nodoc abstract mixin class $FailedCopyWith<$Res> implements $UploadStateCopyWith<$Res> { factory $FailedCopyWith(Failed value, $Res Function(Failed) _then) = _$FailedCopyWithImpl; -@useResult -$Res call({ - String error -}); - - - - + @useResult + $Res call({String error}); } + /// @nodoc -class _$FailedCopyWithImpl<$Res> - implements $FailedCopyWith<$Res> { +class _$FailedCopyWithImpl<$Res> implements $FailedCopyWith<$Res> { _$FailedCopyWithImpl(this._self, this._then); final Failed _self; final $Res Function(Failed) _then; -/// Create a copy of UploadState -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') $Res call({Object? error = null,}) { - return _then(Failed( -error: null == error ? _self.error : error // ignore: cast_nullable_to_non_nullable -as String, - )); + /// Create a copy of UploadState + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + $Res call({Object? error = null}) { + return _then( + Failed( + error: null == error + ? _self.error + : error // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } } - - -} - -// dart format on diff --git a/packages/stream_chat/lib/src/core/models/message_delete_scope.freezed.dart b/packages/stream_chat/lib/src/core/models/message_delete_scope.freezed.dart index b9a2f3f44d..64c1e6c6c9 100644 --- a/packages/stream_chat/lib/src/core/models/message_delete_scope.freezed.dart +++ b/packages/stream_chat/lib/src/core/models/message_delete_scope.freezed.dart @@ -9,175 +9,163 @@ part of 'message_delete_scope.dart'; // FreezedGenerator // ************************************************************************** -// dart format off T _$identity(T value) => value; -MessageDeleteScope _$MessageDeleteScopeFromJson( - Map json -) { - switch (json['runtimeType']) { - case 'deleteForMe': - return DeleteForMe.fromJson( - json - ); - case 'deleteForAll': - return DeleteForAll.fromJson( - json - ); - - default: - throw CheckedFromJsonException( - json, - 'runtimeType', - 'MessageDeleteScope', - 'Invalid union type "${json['runtimeType']}"!' -); - } - +MessageDeleteScope _$MessageDeleteScopeFromJson(Map json) { + switch (json['runtimeType']) { + case 'deleteForMe': + return DeleteForMe.fromJson(json); + case 'deleteForAll': + return DeleteForAll.fromJson(json); + + default: + throw CheckedFromJsonException( + json, + 'runtimeType', + 'MessageDeleteScope', + 'Invalid union type "${json['runtimeType']}"!', + ); + } } /// @nodoc mixin _$MessageDeleteScope { - - - /// Serializes this MessageDeleteScope to a JSON map. Map toJson(); + @override + bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType && other is MessageDeleteScope); + } -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is MessageDeleteScope); -} - -@JsonKey(includeFromJson: false, includeToJson: false) -@override -int get hashCode => runtimeType.hashCode; - -@override -String toString() { - return 'MessageDeleteScope()'; -} - + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => runtimeType.hashCode; + @override + String toString() { + return 'MessageDeleteScope()'; + } } /// @nodoc -class $MessageDeleteScopeCopyWith<$Res> { -$MessageDeleteScopeCopyWith(MessageDeleteScope _, $Res Function(MessageDeleteScope) __); +class $MessageDeleteScopeCopyWith<$Res> { + $MessageDeleteScopeCopyWith( + MessageDeleteScope _, + $Res Function(MessageDeleteScope) __, + ); } - - /// @nodoc @JsonSerializable() - class DeleteForMe implements MessageDeleteScope { - const DeleteForMe({final String? $type}): $type = $type ?? 'deleteForMe'; + const DeleteForMe({final String? $type}) : $type = $type ?? 'deleteForMe'; factory DeleteForMe.fromJson(Map json) => _$DeleteForMeFromJson(json); + @JsonKey(name: 'runtimeType') + final String $type; + @override + Map toJson() { + return _$DeleteForMeToJson(this); + } -@JsonKey(name: 'runtimeType') -final String $type; - + @override + bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType && other is DeleteForMe); + } + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => runtimeType.hashCode; -@override -Map toJson() { - return _$DeleteForMeToJson(this, ); -} - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is DeleteForMe); + @override + String toString() { + return 'MessageDeleteScope.deleteForMe()'; + } } -@JsonKey(includeFromJson: false, includeToJson: false) -@override -int get hashCode => runtimeType.hashCode; - -@override -String toString() { - return 'MessageDeleteScope.deleteForMe()'; +/// @nodoc +class $DeleteForMeCopyWith<$Res> implements $MessageDeleteScopeCopyWith<$Res> { + $DeleteForMeCopyWith(DeleteForMe _, $Res Function(DeleteForMe) __); } +/// @nodoc +class _$DeleteForMeCopyWithImpl<$Res> implements $DeleteForMeCopyWith<$Res> { + _$DeleteForMeCopyWithImpl(this._self, this._then); + final DeleteForMe _self; + final $Res Function(DeleteForMe) _then; } - - - /// @nodoc @JsonSerializable() - class DeleteForAll implements MessageDeleteScope { - const DeleteForAll({this.hard = false, final String? $type}): $type = $type ?? 'deleteForAll'; + const DeleteForAll({this.hard = false, final String? $type}) : $type = $type ?? 'deleteForAll'; factory DeleteForAll.fromJson(Map json) => _$DeleteForAllFromJson(json); -@JsonKey() final bool hard; + @JsonKey() + final bool hard; -@JsonKey(name: 'runtimeType') -final String $type; + @JsonKey(name: 'runtimeType') + final String $type; + /// Create a copy of MessageDeleteScope + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $DeleteForAllCopyWith get copyWith => _$DeleteForAllCopyWithImpl(this, _$identity); -/// Create a copy of MessageDeleteScope -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$DeleteForAllCopyWith get copyWith => _$DeleteForAllCopyWithImpl(this, _$identity); - -@override -Map toJson() { - return _$DeleteForAllToJson(this, ); -} + @override + Map toJson() { + return _$DeleteForAllToJson(this); + } -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is DeleteForAll&&(identical(other.hard, hard) || other.hard == hard)); -} - -@JsonKey(includeFromJson: false, includeToJson: false) -@override -int get hashCode => Object.hash(runtimeType,hard); - -@override -String toString() { - return 'MessageDeleteScope.deleteForAll(hard: $hard)'; -} + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is DeleteForAll && + (identical(other.hard, hard) || other.hard == hard)); + } + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, hard); + @override + String toString() { + return 'MessageDeleteScope.deleteForAll(hard: $hard)'; + } } /// @nodoc abstract mixin class $DeleteForAllCopyWith<$Res> implements $MessageDeleteScopeCopyWith<$Res> { - factory $DeleteForAllCopyWith(DeleteForAll value, $Res Function(DeleteForAll) _then) = _$DeleteForAllCopyWithImpl; -@useResult -$Res call({ - bool hard -}); - - - - + factory $DeleteForAllCopyWith( + DeleteForAll value, + $Res Function(DeleteForAll) _then, + ) = _$DeleteForAllCopyWithImpl; + @useResult + $Res call({bool hard}); } + /// @nodoc -class _$DeleteForAllCopyWithImpl<$Res> - implements $DeleteForAllCopyWith<$Res> { +class _$DeleteForAllCopyWithImpl<$Res> implements $DeleteForAllCopyWith<$Res> { _$DeleteForAllCopyWithImpl(this._self, this._then); final DeleteForAll _self; final $Res Function(DeleteForAll) _then; -/// Create a copy of MessageDeleteScope -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') $Res call({Object? hard = null,}) { - return _then(DeleteForAll( -hard: null == hard ? _self.hard : hard // ignore: cast_nullable_to_non_nullable -as bool, - )); + /// Create a copy of MessageDeleteScope + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + $Res call({Object? hard = null}) { + return _then( + DeleteForAll( + hard: null == hard + ? _self.hard + : hard // ignore: cast_nullable_to_non_nullable + as bool, + ), + ); + } } - - -} - -// dart format on diff --git a/packages/stream_chat/lib/src/core/models/message_state.freezed.dart b/packages/stream_chat/lib/src/core/models/message_state.freezed.dart index 61cc289c39..68a19282f2 100644 --- a/packages/stream_chat/lib/src/core/models/message_state.freezed.dart +++ b/packages/stream_chat/lib/src/core/models/message_state.freezed.dart @@ -9,1189 +9,1207 @@ part of 'message_state.dart'; // FreezedGenerator // ************************************************************************** -// dart format off T _$identity(T value) => value; -MessageState _$MessageStateFromJson( - Map json -) { - switch (json['runtimeType']) { - case 'initial': - return MessageInitial.fromJson( - json - ); - case 'outgoing': - return MessageOutgoing.fromJson( - json - ); - case 'completed': - return MessageCompleted.fromJson( - json - ); - case 'failed': - return MessageFailed.fromJson( - json - ); - - default: - throw CheckedFromJsonException( - json, - 'runtimeType', - 'MessageState', - 'Invalid union type "${json['runtimeType']}"!' -); - } - +MessageState _$MessageStateFromJson(Map json) { + switch (json['runtimeType']) { + case 'initial': + return MessageInitial.fromJson(json); + case 'outgoing': + return MessageOutgoing.fromJson(json); + case 'completed': + return MessageCompleted.fromJson(json); + case 'failed': + return MessageFailed.fromJson(json); + + default: + throw CheckedFromJsonException( + json, + 'runtimeType', + 'MessageState', + 'Invalid union type "${json['runtimeType']}"!', + ); + } } /// @nodoc mixin _$MessageState { - - - /// Serializes this MessageState to a JSON map. Map toJson(); + @override + bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType && other is MessageState); + } -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is MessageState); -} - -@JsonKey(includeFromJson: false, includeToJson: false) -@override -int get hashCode => runtimeType.hashCode; - -@override -String toString() { - return 'MessageState()'; -} - + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => runtimeType.hashCode; + @override + String toString() { + return 'MessageState()'; + } } /// @nodoc -class $MessageStateCopyWith<$Res> { -$MessageStateCopyWith(MessageState _, $Res Function(MessageState) __); +class $MessageStateCopyWith<$Res> { + $MessageStateCopyWith(MessageState _, $Res Function(MessageState) __); } - - /// @nodoc @JsonSerializable() - class MessageInitial implements MessageState { - const MessageInitial({final String? $type}): $type = $type ?? 'initial'; + const MessageInitial({final String? $type}) : $type = $type ?? 'initial'; factory MessageInitial.fromJson(Map json) => _$MessageInitialFromJson(json); + @JsonKey(name: 'runtimeType') + final String $type; + @override + Map toJson() { + return _$MessageInitialToJson(this); + } -@JsonKey(name: 'runtimeType') -final String $type; - + @override + bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType && other is MessageInitial); + } + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => runtimeType.hashCode; -@override -Map toJson() { - return _$MessageInitialToJson(this, ); + @override + String toString() { + return 'MessageState.initial()'; + } } -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is MessageInitial); -} - -@JsonKey(includeFromJson: false, includeToJson: false) -@override -int get hashCode => runtimeType.hashCode; - -@override -String toString() { - return 'MessageState.initial()'; +/// @nodoc +class $MessageInitialCopyWith<$Res> implements $MessageStateCopyWith<$Res> { + $MessageInitialCopyWith(MessageInitial _, $Res Function(MessageInitial) __); } +/// @nodoc +class _$MessageInitialCopyWithImpl<$Res> implements $MessageInitialCopyWith<$Res> { + _$MessageInitialCopyWithImpl(this._self, this._then); + final MessageInitial _self; + final $Res Function(MessageInitial) _then; } - - - /// @nodoc @JsonSerializable() - class MessageOutgoing implements MessageState { - const MessageOutgoing({required this.state, final String? $type}): $type = $type ?? 'outgoing'; + const MessageOutgoing({required this.state, final String? $type}) : $type = $type ?? 'outgoing'; factory MessageOutgoing.fromJson(Map json) => _$MessageOutgoingFromJson(json); - final OutgoingState state; - -@JsonKey(name: 'runtimeType') -final String $type; - - -/// Create a copy of MessageState -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$MessageOutgoingCopyWith get copyWith => _$MessageOutgoingCopyWithImpl(this, _$identity); + final OutgoingState state; -@override -Map toJson() { - return _$MessageOutgoingToJson(this, ); -} + @JsonKey(name: 'runtimeType') + final String $type; -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is MessageOutgoing&&(identical(other.state, state) || other.state == state)); -} + /// Create a copy of MessageState + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $MessageOutgoingCopyWith get copyWith => + _$MessageOutgoingCopyWithImpl(this, _$identity); -@JsonKey(includeFromJson: false, includeToJson: false) -@override -int get hashCode => Object.hash(runtimeType,state); + @override + Map toJson() { + return _$MessageOutgoingToJson(this); + } -@override -String toString() { - return 'MessageState.outgoing(state: $state)'; -} + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is MessageOutgoing && + (identical(other.state, state) || other.state == state)); + } + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, state); + @override + String toString() { + return 'MessageState.outgoing(state: $state)'; + } } /// @nodoc abstract mixin class $MessageOutgoingCopyWith<$Res> implements $MessageStateCopyWith<$Res> { - factory $MessageOutgoingCopyWith(MessageOutgoing value, $Res Function(MessageOutgoing) _then) = _$MessageOutgoingCopyWithImpl; -@useResult -$Res call({ - OutgoingState state -}); - - -$OutgoingStateCopyWith<$Res> get state; + factory $MessageOutgoingCopyWith( + MessageOutgoing value, + $Res Function(MessageOutgoing) _then, + ) = _$MessageOutgoingCopyWithImpl; + @useResult + $Res call({OutgoingState state}); + $OutgoingStateCopyWith<$Res> get state; } + /// @nodoc -class _$MessageOutgoingCopyWithImpl<$Res> - implements $MessageOutgoingCopyWith<$Res> { +class _$MessageOutgoingCopyWithImpl<$Res> implements $MessageOutgoingCopyWith<$Res> { _$MessageOutgoingCopyWithImpl(this._self, this._then); final MessageOutgoing _self; final $Res Function(MessageOutgoing) _then; -/// Create a copy of MessageState -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') $Res call({Object? state = null,}) { - return _then(MessageOutgoing( -state: null == state ? _self.state : state // ignore: cast_nullable_to_non_nullable -as OutgoingState, - )); -} - -/// Create a copy of MessageState -/// with the given fields replaced by the non-null parameter values. -@override -@pragma('vm:prefer-inline') -$OutgoingStateCopyWith<$Res> get state { - - return $OutgoingStateCopyWith<$Res>(_self.state, (value) { - return _then(_self.copyWith(state: value)); - }); -} + /// Create a copy of MessageState + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + $Res call({Object? state = null}) { + return _then( + MessageOutgoing( + state: null == state + ? _self.state + : state // ignore: cast_nullable_to_non_nullable + as OutgoingState, + ), + ); + } + + /// Create a copy of MessageState + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $OutgoingStateCopyWith<$Res> get state { + return $OutgoingStateCopyWith<$Res>(_self.state, (value) { + return _then(_self.copyWith(state: value)); + }); + } } /// @nodoc @JsonSerializable() - class MessageCompleted implements MessageState { - const MessageCompleted({required this.state, final String? $type}): $type = $type ?? 'completed'; + const MessageCompleted({required this.state, final String? $type}) : $type = $type ?? 'completed'; factory MessageCompleted.fromJson(Map json) => _$MessageCompletedFromJson(json); - final CompletedState state; - -@JsonKey(name: 'runtimeType') -final String $type; + final CompletedState state; + @JsonKey(name: 'runtimeType') + final String $type; -/// Create a copy of MessageState -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$MessageCompletedCopyWith get copyWith => _$MessageCompletedCopyWithImpl(this, _$identity); - -@override -Map toJson() { - return _$MessageCompletedToJson(this, ); -} - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is MessageCompleted&&(identical(other.state, state) || other.state == state)); -} + /// Create a copy of MessageState + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $MessageCompletedCopyWith get copyWith => + _$MessageCompletedCopyWithImpl(this, _$identity); -@JsonKey(includeFromJson: false, includeToJson: false) -@override -int get hashCode => Object.hash(runtimeType,state); + @override + Map toJson() { + return _$MessageCompletedToJson(this); + } -@override -String toString() { - return 'MessageState.completed(state: $state)'; -} + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is MessageCompleted && + (identical(other.state, state) || other.state == state)); + } + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, state); + @override + String toString() { + return 'MessageState.completed(state: $state)'; + } } /// @nodoc abstract mixin class $MessageCompletedCopyWith<$Res> implements $MessageStateCopyWith<$Res> { - factory $MessageCompletedCopyWith(MessageCompleted value, $Res Function(MessageCompleted) _then) = _$MessageCompletedCopyWithImpl; -@useResult -$Res call({ - CompletedState state -}); - - -$CompletedStateCopyWith<$Res> get state; + factory $MessageCompletedCopyWith( + MessageCompleted value, + $Res Function(MessageCompleted) _then, + ) = _$MessageCompletedCopyWithImpl; + @useResult + $Res call({CompletedState state}); + $CompletedStateCopyWith<$Res> get state; } + /// @nodoc -class _$MessageCompletedCopyWithImpl<$Res> - implements $MessageCompletedCopyWith<$Res> { +class _$MessageCompletedCopyWithImpl<$Res> implements $MessageCompletedCopyWith<$Res> { _$MessageCompletedCopyWithImpl(this._self, this._then); final MessageCompleted _self; final $Res Function(MessageCompleted) _then; -/// Create a copy of MessageState -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') $Res call({Object? state = null,}) { - return _then(MessageCompleted( -state: null == state ? _self.state : state // ignore: cast_nullable_to_non_nullable -as CompletedState, - )); -} - -/// Create a copy of MessageState -/// with the given fields replaced by the non-null parameter values. -@override -@pragma('vm:prefer-inline') -$CompletedStateCopyWith<$Res> get state { - - return $CompletedStateCopyWith<$Res>(_self.state, (value) { - return _then(_self.copyWith(state: value)); - }); -} + /// Create a copy of MessageState + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + $Res call({Object? state = null}) { + return _then( + MessageCompleted( + state: null == state + ? _self.state + : state // ignore: cast_nullable_to_non_nullable + as CompletedState, + ), + ); + } + + /// Create a copy of MessageState + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $CompletedStateCopyWith<$Res> get state { + return $CompletedStateCopyWith<$Res>(_self.state, (value) { + return _then(_self.copyWith(state: value)); + }); + } } /// @nodoc @JsonSerializable() - class MessageFailed implements MessageState { - const MessageFailed({required this.state, this.reason, final String? $type}): $type = $type ?? 'failed'; + const MessageFailed({required this.state, this.reason, final String? $type}) : $type = $type ?? 'failed'; factory MessageFailed.fromJson(Map json) => _$MessageFailedFromJson(json); - final FailedState state; - final Object? reason; - -@JsonKey(name: 'runtimeType') -final String $type; - - -/// Create a copy of MessageState -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$MessageFailedCopyWith get copyWith => _$MessageFailedCopyWithImpl(this, _$identity); - -@override -Map toJson() { - return _$MessageFailedToJson(this, ); -} - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is MessageFailed&&(identical(other.state, state) || other.state == state)&&const DeepCollectionEquality().equals(other.reason, reason)); -} - -@JsonKey(includeFromJson: false, includeToJson: false) -@override -int get hashCode => Object.hash(runtimeType,state,const DeepCollectionEquality().hash(reason)); - -@override -String toString() { - return 'MessageState.failed(state: $state, reason: $reason)'; -} - - + final FailedState state; + final Object? reason; + + @JsonKey(name: 'runtimeType') + final String $type; + + /// Create a copy of MessageState + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $MessageFailedCopyWith get copyWith => _$MessageFailedCopyWithImpl(this, _$identity); + + @override + Map toJson() { + return _$MessageFailedToJson(this); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is MessageFailed && + (identical(other.state, state) || other.state == state) && + const DeepCollectionEquality().equals(other.reason, reason)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, + state, + const DeepCollectionEquality().hash(reason), + ); + + @override + String toString() { + return 'MessageState.failed(state: $state, reason: $reason)'; + } } /// @nodoc abstract mixin class $MessageFailedCopyWith<$Res> implements $MessageStateCopyWith<$Res> { - factory $MessageFailedCopyWith(MessageFailed value, $Res Function(MessageFailed) _then) = _$MessageFailedCopyWithImpl; -@useResult -$Res call({ - FailedState state, Object? reason -}); - - -$FailedStateCopyWith<$Res> get state; + factory $MessageFailedCopyWith( + MessageFailed value, + $Res Function(MessageFailed) _then, + ) = _$MessageFailedCopyWithImpl; + @useResult + $Res call({FailedState state, Object? reason}); + $FailedStateCopyWith<$Res> get state; } + /// @nodoc -class _$MessageFailedCopyWithImpl<$Res> - implements $MessageFailedCopyWith<$Res> { +class _$MessageFailedCopyWithImpl<$Res> implements $MessageFailedCopyWith<$Res> { _$MessageFailedCopyWithImpl(this._self, this._then); final MessageFailed _self; final $Res Function(MessageFailed) _then; -/// Create a copy of MessageState -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') $Res call({Object? state = null,Object? reason = freezed,}) { - return _then(MessageFailed( -state: null == state ? _self.state : state // ignore: cast_nullable_to_non_nullable -as FailedState,reason: freezed == reason ? _self.reason : reason , - )); -} - -/// Create a copy of MessageState -/// with the given fields replaced by the non-null parameter values. -@override -@pragma('vm:prefer-inline') -$FailedStateCopyWith<$Res> get state { - - return $FailedStateCopyWith<$Res>(_self.state, (value) { - return _then(_self.copyWith(state: value)); - }); -} -} - -OutgoingState _$OutgoingStateFromJson( - Map json -) { - switch (json['runtimeType']) { - case 'sending': - return Sending.fromJson( - json - ); - case 'updating': - return Updating.fromJson( - json - ); - case 'deleting': - return Deleting.fromJson( - json - ); - - default: - throw CheckedFromJsonException( - json, - 'runtimeType', - 'OutgoingState', - 'Invalid union type "${json['runtimeType']}"!' -); - } - + /// Create a copy of MessageState + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + $Res call({Object? state = null, Object? reason = freezed}) { + return _then( + MessageFailed( + state: null == state + ? _self.state + : state // ignore: cast_nullable_to_non_nullable + as FailedState, + reason: freezed == reason ? _self.reason : reason, + ), + ); + } + + /// Create a copy of MessageState + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $FailedStateCopyWith<$Res> get state { + return $FailedStateCopyWith<$Res>(_self.state, (value) { + return _then(_self.copyWith(state: value)); + }); + } +} + +OutgoingState _$OutgoingStateFromJson(Map json) { + switch (json['runtimeType']) { + case 'sending': + return Sending.fromJson(json); + case 'updating': + return Updating.fromJson(json); + case 'deleting': + return Deleting.fromJson(json); + + default: + throw CheckedFromJsonException( + json, + 'runtimeType', + 'OutgoingState', + 'Invalid union type "${json['runtimeType']}"!', + ); + } } /// @nodoc mixin _$OutgoingState { - - - /// Serializes this OutgoingState to a JSON map. Map toJson(); + @override + bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType && other is OutgoingState); + } -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is OutgoingState); -} - -@JsonKey(includeFromJson: false, includeToJson: false) -@override -int get hashCode => runtimeType.hashCode; - -@override -String toString() { - return 'OutgoingState()'; -} - + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => runtimeType.hashCode; + @override + String toString() { + return 'OutgoingState()'; + } } /// @nodoc -class $OutgoingStateCopyWith<$Res> { -$OutgoingStateCopyWith(OutgoingState _, $Res Function(OutgoingState) __); +class $OutgoingStateCopyWith<$Res> { + $OutgoingStateCopyWith(OutgoingState _, $Res Function(OutgoingState) __); } - - /// @nodoc @JsonSerializable() - class Sending implements OutgoingState { - const Sending({final String? $type}): $type = $type ?? 'sending'; + const Sending({final String? $type}) : $type = $type ?? 'sending'; factory Sending.fromJson(Map json) => _$SendingFromJson(json); + @JsonKey(name: 'runtimeType') + final String $type; + @override + Map toJson() { + return _$SendingToJson(this); + } -@JsonKey(name: 'runtimeType') -final String $type; - - + @override + bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType && other is Sending); + } -@override -Map toJson() { - return _$SendingToJson(this, ); -} + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => runtimeType.hashCode; -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is Sending); + @override + String toString() { + return 'OutgoingState.sending()'; + } } -@JsonKey(includeFromJson: false, includeToJson: false) -@override -int get hashCode => runtimeType.hashCode; - -@override -String toString() { - return 'OutgoingState.sending()'; +/// @nodoc +class $SendingCopyWith<$Res> implements $OutgoingStateCopyWith<$Res> { + $SendingCopyWith(Sending _, $Res Function(Sending) __); } +/// @nodoc +class _$SendingCopyWithImpl<$Res> implements $SendingCopyWith<$Res> { + _$SendingCopyWithImpl(this._self, this._then); + final Sending _self; + final $Res Function(Sending) _then; } - - - /// @nodoc @JsonSerializable() - class Updating implements OutgoingState { - const Updating({final String? $type}): $type = $type ?? 'updating'; + const Updating({final String? $type}) : $type = $type ?? 'updating'; factory Updating.fromJson(Map json) => _$UpdatingFromJson(json); + @JsonKey(name: 'runtimeType') + final String $type; + @override + Map toJson() { + return _$UpdatingToJson(this); + } -@JsonKey(name: 'runtimeType') -final String $type; + @override + bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType && other is Updating); + } + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => runtimeType.hashCode; - -@override -Map toJson() { - return _$UpdatingToJson(this, ); -} - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is Updating); + @override + String toString() { + return 'OutgoingState.updating()'; + } } -@JsonKey(includeFromJson: false, includeToJson: false) -@override -int get hashCode => runtimeType.hashCode; - -@override -String toString() { - return 'OutgoingState.updating()'; +/// @nodoc +class $UpdatingCopyWith<$Res> implements $OutgoingStateCopyWith<$Res> { + $UpdatingCopyWith(Updating _, $Res Function(Updating) __); } +/// @nodoc +class _$UpdatingCopyWithImpl<$Res> implements $UpdatingCopyWith<$Res> { + _$UpdatingCopyWithImpl(this._self, this._then); + final Updating _self; + final $Res Function(Updating) _then; } - - - /// @nodoc @JsonSerializable() - class Deleting implements OutgoingState { - const Deleting({this.scope = MessageDeleteScope.softDeleteForAll, final String? $type}): $type = $type ?? 'deleting'; + const Deleting({ + this.scope = MessageDeleteScope.softDeleteForAll, + final String? $type, + }) : $type = $type ?? 'deleting'; factory Deleting.fromJson(Map json) => _$DeletingFromJson(json); -@JsonKey() final MessageDeleteScope scope; - -@JsonKey(name: 'runtimeType') -final String $type; + @JsonKey() + final MessageDeleteScope scope; + @JsonKey(name: 'runtimeType') + final String $type; -/// Create a copy of OutgoingState -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$DeletingCopyWith get copyWith => _$DeletingCopyWithImpl(this, _$identity); + /// Create a copy of OutgoingState + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $DeletingCopyWith get copyWith => _$DeletingCopyWithImpl(this, _$identity); -@override -Map toJson() { - return _$DeletingToJson(this, ); -} - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is Deleting&&(identical(other.scope, scope) || other.scope == scope)); -} - -@JsonKey(includeFromJson: false, includeToJson: false) -@override -int get hashCode => Object.hash(runtimeType,scope); + @override + Map toJson() { + return _$DeletingToJson(this); + } -@override -String toString() { - return 'OutgoingState.deleting(scope: $scope)'; -} + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is Deleting && + (identical(other.scope, scope) || other.scope == scope)); + } + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, scope); + @override + String toString() { + return 'OutgoingState.deleting(scope: $scope)'; + } } /// @nodoc abstract mixin class $DeletingCopyWith<$Res> implements $OutgoingStateCopyWith<$Res> { factory $DeletingCopyWith(Deleting value, $Res Function(Deleting) _then) = _$DeletingCopyWithImpl; -@useResult -$Res call({ - MessageDeleteScope scope -}); - - -$MessageDeleteScopeCopyWith<$Res> get scope; + @useResult + $Res call({MessageDeleteScope scope}); + $MessageDeleteScopeCopyWith<$Res> get scope; } + /// @nodoc -class _$DeletingCopyWithImpl<$Res> - implements $DeletingCopyWith<$Res> { +class _$DeletingCopyWithImpl<$Res> implements $DeletingCopyWith<$Res> { _$DeletingCopyWithImpl(this._self, this._then); final Deleting _self; final $Res Function(Deleting) _then; -/// Create a copy of OutgoingState -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') $Res call({Object? scope = null,}) { - return _then(Deleting( -scope: null == scope ? _self.scope : scope // ignore: cast_nullable_to_non_nullable -as MessageDeleteScope, - )); -} - -/// Create a copy of OutgoingState -/// with the given fields replaced by the non-null parameter values. -@override -@pragma('vm:prefer-inline') -$MessageDeleteScopeCopyWith<$Res> get scope { - - return $MessageDeleteScopeCopyWith<$Res>(_self.scope, (value) { - return _then(_self.copyWith(scope: value)); - }); -} -} - -CompletedState _$CompletedStateFromJson( - Map json -) { - switch (json['runtimeType']) { - case 'sent': - return Sent.fromJson( - json - ); - case 'updated': - return Updated.fromJson( - json - ); - case 'deleted': - return Deleted.fromJson( - json - ); - - default: - throw CheckedFromJsonException( - json, - 'runtimeType', - 'CompletedState', - 'Invalid union type "${json['runtimeType']}"!' -); - } - + /// Create a copy of OutgoingState + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + $Res call({Object? scope = null}) { + return _then( + Deleting( + scope: null == scope + ? _self.scope + : scope // ignore: cast_nullable_to_non_nullable + as MessageDeleteScope, + ), + ); + } + + /// Create a copy of OutgoingState + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $MessageDeleteScopeCopyWith<$Res> get scope { + return $MessageDeleteScopeCopyWith<$Res>(_self.scope, (value) { + return _then(_self.copyWith(scope: value)); + }); + } +} + +CompletedState _$CompletedStateFromJson(Map json) { + switch (json['runtimeType']) { + case 'sent': + return Sent.fromJson(json); + case 'updated': + return Updated.fromJson(json); + case 'deleted': + return Deleted.fromJson(json); + + default: + throw CheckedFromJsonException( + json, + 'runtimeType', + 'CompletedState', + 'Invalid union type "${json['runtimeType']}"!', + ); + } } /// @nodoc mixin _$CompletedState { - - - /// Serializes this CompletedState to a JSON map. Map toJson(); + @override + bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType && other is CompletedState); + } -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is CompletedState); -} - -@JsonKey(includeFromJson: false, includeToJson: false) -@override -int get hashCode => runtimeType.hashCode; - -@override -String toString() { - return 'CompletedState()'; -} - + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => runtimeType.hashCode; + @override + String toString() { + return 'CompletedState()'; + } } /// @nodoc -class $CompletedStateCopyWith<$Res> { -$CompletedStateCopyWith(CompletedState _, $Res Function(CompletedState) __); +class $CompletedStateCopyWith<$Res> { + $CompletedStateCopyWith(CompletedState _, $Res Function(CompletedState) __); } - - /// @nodoc @JsonSerializable() - class Sent implements CompletedState { - const Sent({final String? $type}): $type = $type ?? 'sent'; + const Sent({final String? $type}) : $type = $type ?? 'sent'; factory Sent.fromJson(Map json) => _$SentFromJson(json); + @JsonKey(name: 'runtimeType') + final String $type; + @override + Map toJson() { + return _$SentToJson(this); + } -@JsonKey(name: 'runtimeType') -final String $type; - - + @override + bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType && other is Sent); + } -@override -Map toJson() { - return _$SentToJson(this, ); -} + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => runtimeType.hashCode; -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is Sent); + @override + String toString() { + return 'CompletedState.sent()'; + } } -@JsonKey(includeFromJson: false, includeToJson: false) -@override -int get hashCode => runtimeType.hashCode; - -@override -String toString() { - return 'CompletedState.sent()'; +/// @nodoc +class $SentCopyWith<$Res> implements $CompletedStateCopyWith<$Res> { + $SentCopyWith(Sent _, $Res Function(Sent) __); } +/// @nodoc +class _$SentCopyWithImpl<$Res> implements $SentCopyWith<$Res> { + _$SentCopyWithImpl(this._self, this._then); + final Sent _self; + final $Res Function(Sent) _then; } - - - /// @nodoc @JsonSerializable() - class Updated implements CompletedState { - const Updated({final String? $type}): $type = $type ?? 'updated'; + const Updated({final String? $type}) : $type = $type ?? 'updated'; factory Updated.fromJson(Map json) => _$UpdatedFromJson(json); + @JsonKey(name: 'runtimeType') + final String $type; + @override + Map toJson() { + return _$UpdatedToJson(this); + } -@JsonKey(name: 'runtimeType') -final String $type; + @override + bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType && other is Updated); + } + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => runtimeType.hashCode; - -@override -Map toJson() { - return _$UpdatedToJson(this, ); -} - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is Updated); + @override + String toString() { + return 'CompletedState.updated()'; + } } -@JsonKey(includeFromJson: false, includeToJson: false) -@override -int get hashCode => runtimeType.hashCode; - -@override -String toString() { - return 'CompletedState.updated()'; +/// @nodoc +class $UpdatedCopyWith<$Res> implements $CompletedStateCopyWith<$Res> { + $UpdatedCopyWith(Updated _, $Res Function(Updated) __); } +/// @nodoc +class _$UpdatedCopyWithImpl<$Res> implements $UpdatedCopyWith<$Res> { + _$UpdatedCopyWithImpl(this._self, this._then); + final Updated _self; + final $Res Function(Updated) _then; } - - - /// @nodoc @JsonSerializable() - class Deleted implements CompletedState { - const Deleted({this.scope = MessageDeleteScope.softDeleteForAll, final String? $type}): $type = $type ?? 'deleted'; + const Deleted({ + this.scope = MessageDeleteScope.softDeleteForAll, + final String? $type, + }) : $type = $type ?? 'deleted'; factory Deleted.fromJson(Map json) => _$DeletedFromJson(json); -@JsonKey() final MessageDeleteScope scope; + @JsonKey() + final MessageDeleteScope scope; -@JsonKey(name: 'runtimeType') -final String $type; + @JsonKey(name: 'runtimeType') + final String $type; + /// Create a copy of CompletedState + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $DeletedCopyWith get copyWith => _$DeletedCopyWithImpl(this, _$identity); -/// Create a copy of CompletedState -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$DeletedCopyWith get copyWith => _$DeletedCopyWithImpl(this, _$identity); + @override + Map toJson() { + return _$DeletedToJson(this); + } -@override -Map toJson() { - return _$DeletedToJson(this, ); -} - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is Deleted&&(identical(other.scope, scope) || other.scope == scope)); -} - -@JsonKey(includeFromJson: false, includeToJson: false) -@override -int get hashCode => Object.hash(runtimeType,scope); - -@override -String toString() { - return 'CompletedState.deleted(scope: $scope)'; -} + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is Deleted && + (identical(other.scope, scope) || other.scope == scope)); + } + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, scope); + @override + String toString() { + return 'CompletedState.deleted(scope: $scope)'; + } } /// @nodoc abstract mixin class $DeletedCopyWith<$Res> implements $CompletedStateCopyWith<$Res> { factory $DeletedCopyWith(Deleted value, $Res Function(Deleted) _then) = _$DeletedCopyWithImpl; -@useResult -$Res call({ - MessageDeleteScope scope -}); - - -$MessageDeleteScopeCopyWith<$Res> get scope; + @useResult + $Res call({MessageDeleteScope scope}); + $MessageDeleteScopeCopyWith<$Res> get scope; } + /// @nodoc -class _$DeletedCopyWithImpl<$Res> - implements $DeletedCopyWith<$Res> { +class _$DeletedCopyWithImpl<$Res> implements $DeletedCopyWith<$Res> { _$DeletedCopyWithImpl(this._self, this._then); final Deleted _self; final $Res Function(Deleted) _then; -/// Create a copy of CompletedState -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') $Res call({Object? scope = null,}) { - return _then(Deleted( -scope: null == scope ? _self.scope : scope // ignore: cast_nullable_to_non_nullable -as MessageDeleteScope, - )); -} - -/// Create a copy of CompletedState -/// with the given fields replaced by the non-null parameter values. -@override -@pragma('vm:prefer-inline') -$MessageDeleteScopeCopyWith<$Res> get scope { - - return $MessageDeleteScopeCopyWith<$Res>(_self.scope, (value) { - return _then(_self.copyWith(scope: value)); - }); -} -} - -FailedState _$FailedStateFromJson( - Map json -) { - switch (json['runtimeType']) { - case 'sendingFailed': - return SendingFailed.fromJson( - json - ); - case 'updatingFailed': - return UpdatingFailed.fromJson( - json - ); - case 'partialUpdatingFailed': - return PartialUpdatingFailed.fromJson( - json - ); - case 'deletingFailed': - return DeletingFailed.fromJson( - json - ); - - default: - throw CheckedFromJsonException( - json, - 'runtimeType', - 'FailedState', - 'Invalid union type "${json['runtimeType']}"!' -); - } - + /// Create a copy of CompletedState + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + $Res call({Object? scope = null}) { + return _then( + Deleted( + scope: null == scope + ? _self.scope + : scope // ignore: cast_nullable_to_non_nullable + as MessageDeleteScope, + ), + ); + } + + /// Create a copy of CompletedState + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $MessageDeleteScopeCopyWith<$Res> get scope { + return $MessageDeleteScopeCopyWith<$Res>(_self.scope, (value) { + return _then(_self.copyWith(scope: value)); + }); + } +} + +FailedState _$FailedStateFromJson(Map json) { + switch (json['runtimeType']) { + case 'sendingFailed': + return SendingFailed.fromJson(json); + case 'updatingFailed': + return UpdatingFailed.fromJson(json); + case 'partialUpdatingFailed': + return PartialUpdatingFailed.fromJson(json); + case 'deletingFailed': + return DeletingFailed.fromJson(json); + + default: + throw CheckedFromJsonException( + json, + 'runtimeType', + 'FailedState', + 'Invalid union type "${json['runtimeType']}"!', + ); + } } /// @nodoc mixin _$FailedState { - - - /// Serializes this FailedState to a JSON map. Map toJson(); + @override + bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType && other is FailedState); + } -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is FailedState); -} - -@JsonKey(includeFromJson: false, includeToJson: false) -@override -int get hashCode => runtimeType.hashCode; - -@override -String toString() { - return 'FailedState()'; -} - + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => runtimeType.hashCode; + @override + String toString() { + return 'FailedState()'; + } } /// @nodoc -class $FailedStateCopyWith<$Res> { -$FailedStateCopyWith(FailedState _, $Res Function(FailedState) __); +class $FailedStateCopyWith<$Res> { + $FailedStateCopyWith(FailedState _, $Res Function(FailedState) __); } - - /// @nodoc @JsonSerializable() - class SendingFailed implements FailedState { - const SendingFailed({this.skipPush = false, this.skipEnrichUrl = false, final String? $type}): $type = $type ?? 'sendingFailed'; + const SendingFailed({ + this.skipPush = false, + this.skipEnrichUrl = false, + final String? $type, + }) : $type = $type ?? 'sendingFailed'; factory SendingFailed.fromJson(Map json) => _$SendingFailedFromJson(json); -@JsonKey() final bool skipPush; -@JsonKey() final bool skipEnrichUrl; - -@JsonKey(name: 'runtimeType') -final String $type; - - -/// Create a copy of FailedState -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$SendingFailedCopyWith get copyWith => _$SendingFailedCopyWithImpl(this, _$identity); + @JsonKey() + final bool skipPush; + @JsonKey() + final bool skipEnrichUrl; -@override -Map toJson() { - return _$SendingFailedToJson(this, ); -} + @JsonKey(name: 'runtimeType') + final String $type; -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is SendingFailed&&(identical(other.skipPush, skipPush) || other.skipPush == skipPush)&&(identical(other.skipEnrichUrl, skipEnrichUrl) || other.skipEnrichUrl == skipEnrichUrl)); -} + /// Create a copy of FailedState + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $SendingFailedCopyWith get copyWith => _$SendingFailedCopyWithImpl(this, _$identity); -@JsonKey(includeFromJson: false, includeToJson: false) -@override -int get hashCode => Object.hash(runtimeType,skipPush,skipEnrichUrl); + @override + Map toJson() { + return _$SendingFailedToJson(this); + } -@override -String toString() { - return 'FailedState.sendingFailed(skipPush: $skipPush, skipEnrichUrl: $skipEnrichUrl)'; -} + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is SendingFailed && + (identical(other.skipPush, skipPush) || other.skipPush == skipPush) && + (identical(other.skipEnrichUrl, skipEnrichUrl) || other.skipEnrichUrl == skipEnrichUrl)); + } + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, skipPush, skipEnrichUrl); + @override + String toString() { + return 'FailedState.sendingFailed(skipPush: $skipPush, skipEnrichUrl: $skipEnrichUrl)'; + } } /// @nodoc abstract mixin class $SendingFailedCopyWith<$Res> implements $FailedStateCopyWith<$Res> { - factory $SendingFailedCopyWith(SendingFailed value, $Res Function(SendingFailed) _then) = _$SendingFailedCopyWithImpl; -@useResult -$Res call({ - bool skipPush, bool skipEnrichUrl -}); - - - - + factory $SendingFailedCopyWith( + SendingFailed value, + $Res Function(SendingFailed) _then, + ) = _$SendingFailedCopyWithImpl; + @useResult + $Res call({bool skipPush, bool skipEnrichUrl}); } + /// @nodoc -class _$SendingFailedCopyWithImpl<$Res> - implements $SendingFailedCopyWith<$Res> { +class _$SendingFailedCopyWithImpl<$Res> implements $SendingFailedCopyWith<$Res> { _$SendingFailedCopyWithImpl(this._self, this._then); final SendingFailed _self; final $Res Function(SendingFailed) _then; -/// Create a copy of FailedState -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') $Res call({Object? skipPush = null,Object? skipEnrichUrl = null,}) { - return _then(SendingFailed( -skipPush: null == skipPush ? _self.skipPush : skipPush // ignore: cast_nullable_to_non_nullable -as bool,skipEnrichUrl: null == skipEnrichUrl ? _self.skipEnrichUrl : skipEnrichUrl // ignore: cast_nullable_to_non_nullable -as bool, - )); -} - - + /// Create a copy of FailedState + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + $Res call({Object? skipPush = null, Object? skipEnrichUrl = null}) { + return _then( + SendingFailed( + skipPush: null == skipPush + ? _self.skipPush + : skipPush // ignore: cast_nullable_to_non_nullable + as bool, + skipEnrichUrl: null == skipEnrichUrl + ? _self.skipEnrichUrl + : skipEnrichUrl // ignore: cast_nullable_to_non_nullable + as bool, + ), + ); + } } /// @nodoc @JsonSerializable() - class UpdatingFailed implements FailedState { - const UpdatingFailed({this.skipPush = false, this.skipEnrichUrl = false, final String? $type}): $type = $type ?? 'updatingFailed'; + const UpdatingFailed({ + this.skipPush = false, + this.skipEnrichUrl = false, + final String? $type, + }) : $type = $type ?? 'updatingFailed'; factory UpdatingFailed.fromJson(Map json) => _$UpdatingFailedFromJson(json); -@JsonKey() final bool skipPush; -@JsonKey() final bool skipEnrichUrl; - -@JsonKey(name: 'runtimeType') -final String $type; - - -/// Create a copy of FailedState -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$UpdatingFailedCopyWith get copyWith => _$UpdatingFailedCopyWithImpl(this, _$identity); - -@override -Map toJson() { - return _$UpdatingFailedToJson(this, ); -} - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is UpdatingFailed&&(identical(other.skipPush, skipPush) || other.skipPush == skipPush)&&(identical(other.skipEnrichUrl, skipEnrichUrl) || other.skipEnrichUrl == skipEnrichUrl)); -} - -@JsonKey(includeFromJson: false, includeToJson: false) -@override -int get hashCode => Object.hash(runtimeType,skipPush,skipEnrichUrl); - -@override -String toString() { - return 'FailedState.updatingFailed(skipPush: $skipPush, skipEnrichUrl: $skipEnrichUrl)'; -} - - + @JsonKey() + final bool skipPush; + @JsonKey() + final bool skipEnrichUrl; + + @JsonKey(name: 'runtimeType') + final String $type; + + /// Create a copy of FailedState + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpdatingFailedCopyWith get copyWith => + _$UpdatingFailedCopyWithImpl(this, _$identity); + + @override + Map toJson() { + return _$UpdatingFailedToJson(this); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpdatingFailed && + (identical(other.skipPush, skipPush) || other.skipPush == skipPush) && + (identical(other.skipEnrichUrl, skipEnrichUrl) || other.skipEnrichUrl == skipEnrichUrl)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, skipPush, skipEnrichUrl); + + @override + String toString() { + return 'FailedState.updatingFailed(skipPush: $skipPush, skipEnrichUrl: $skipEnrichUrl)'; + } } /// @nodoc abstract mixin class $UpdatingFailedCopyWith<$Res> implements $FailedStateCopyWith<$Res> { - factory $UpdatingFailedCopyWith(UpdatingFailed value, $Res Function(UpdatingFailed) _then) = _$UpdatingFailedCopyWithImpl; -@useResult -$Res call({ - bool skipPush, bool skipEnrichUrl -}); - - - - + factory $UpdatingFailedCopyWith( + UpdatingFailed value, + $Res Function(UpdatingFailed) _then, + ) = _$UpdatingFailedCopyWithImpl; + @useResult + $Res call({bool skipPush, bool skipEnrichUrl}); } + /// @nodoc -class _$UpdatingFailedCopyWithImpl<$Res> - implements $UpdatingFailedCopyWith<$Res> { +class _$UpdatingFailedCopyWithImpl<$Res> implements $UpdatingFailedCopyWith<$Res> { _$UpdatingFailedCopyWithImpl(this._self, this._then); final UpdatingFailed _self; final $Res Function(UpdatingFailed) _then; -/// Create a copy of FailedState -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') $Res call({Object? skipPush = null,Object? skipEnrichUrl = null,}) { - return _then(UpdatingFailed( -skipPush: null == skipPush ? _self.skipPush : skipPush // ignore: cast_nullable_to_non_nullable -as bool,skipEnrichUrl: null == skipEnrichUrl ? _self.skipEnrichUrl : skipEnrichUrl // ignore: cast_nullable_to_non_nullable -as bool, - )); -} - - + /// Create a copy of FailedState + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + $Res call({Object? skipPush = null, Object? skipEnrichUrl = null}) { + return _then( + UpdatingFailed( + skipPush: null == skipPush + ? _self.skipPush + : skipPush // ignore: cast_nullable_to_non_nullable + as bool, + skipEnrichUrl: null == skipEnrichUrl + ? _self.skipEnrichUrl + : skipEnrichUrl // ignore: cast_nullable_to_non_nullable + as bool, + ), + ); + } } /// @nodoc @JsonSerializable() - class PartialUpdatingFailed implements FailedState { - const PartialUpdatingFailed({final Map? set, final List? unset, this.skipEnrichUrl = false, final String? $type}): _set = set,_unset = unset,$type = $type ?? 'partialUpdatingFailed'; + const PartialUpdatingFailed({ + final Map? set, + final List? unset, + this.skipEnrichUrl = false, + final String? $type, + }) : _set = set, + _unset = unset, + $type = $type ?? 'partialUpdatingFailed'; factory PartialUpdatingFailed.fromJson(Map json) => _$PartialUpdatingFailedFromJson(json); - final Map? _set; - Map? get set { - final value = _set; - if (value == null) return null; - if (_set is EqualUnmodifiableMapView) return _set; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(value); -} - - final List? _unset; - List? get unset { - final value = _unset; - if (value == null) return null; - if (_unset is EqualUnmodifiableListView) return _unset; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); -} - -@JsonKey() final bool skipEnrichUrl; - -@JsonKey(name: 'runtimeType') -final String $type; - - -/// Create a copy of FailedState -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$PartialUpdatingFailedCopyWith get copyWith => _$PartialUpdatingFailedCopyWithImpl(this, _$identity); - -@override -Map toJson() { - return _$PartialUpdatingFailedToJson(this, ); -} - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is PartialUpdatingFailed&&const DeepCollectionEquality().equals(other._set, _set)&&const DeepCollectionEquality().equals(other._unset, _unset)&&(identical(other.skipEnrichUrl, skipEnrichUrl) || other.skipEnrichUrl == skipEnrichUrl)); -} - -@JsonKey(includeFromJson: false, includeToJson: false) -@override -int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_set),const DeepCollectionEquality().hash(_unset),skipEnrichUrl); - -@override -String toString() { - return 'FailedState.partialUpdatingFailed(set: $set, unset: $unset, skipEnrichUrl: $skipEnrichUrl)'; -} - - + final Map? _set; + Map? get set { + final value = _set; + if (value == null) return null; + if (_set is EqualUnmodifiableMapView) return _set; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + final List? _unset; + List? get unset { + final value = _unset; + if (value == null) return null; + if (_unset is EqualUnmodifiableListView) return _unset; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + @JsonKey() + final bool skipEnrichUrl; + + @JsonKey(name: 'runtimeType') + final String $type; + + /// Create a copy of FailedState + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $PartialUpdatingFailedCopyWith get copyWith => + _$PartialUpdatingFailedCopyWithImpl( + this, + _$identity, + ); + + @override + Map toJson() { + return _$PartialUpdatingFailedToJson(this); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is PartialUpdatingFailed && + const DeepCollectionEquality().equals(other._set, _set) && + const DeepCollectionEquality().equals(other._unset, _unset) && + (identical(other.skipEnrichUrl, skipEnrichUrl) || other.skipEnrichUrl == skipEnrichUrl)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(_set), + const DeepCollectionEquality().hash(_unset), + skipEnrichUrl, + ); + + @override + String toString() { + return 'FailedState.partialUpdatingFailed(set: $set, unset: $unset, skipEnrichUrl: $skipEnrichUrl)'; + } } /// @nodoc abstract mixin class $PartialUpdatingFailedCopyWith<$Res> implements $FailedStateCopyWith<$Res> { - factory $PartialUpdatingFailedCopyWith(PartialUpdatingFailed value, $Res Function(PartialUpdatingFailed) _then) = _$PartialUpdatingFailedCopyWithImpl; -@useResult -$Res call({ - Map? set, List? unset, bool skipEnrichUrl -}); - - - - + factory $PartialUpdatingFailedCopyWith( + PartialUpdatingFailed value, + $Res Function(PartialUpdatingFailed) _then, + ) = _$PartialUpdatingFailedCopyWithImpl; + @useResult + $Res call({ + Map? set, + List? unset, + bool skipEnrichUrl, + }); } + /// @nodoc -class _$PartialUpdatingFailedCopyWithImpl<$Res> - implements $PartialUpdatingFailedCopyWith<$Res> { +class _$PartialUpdatingFailedCopyWithImpl<$Res> implements $PartialUpdatingFailedCopyWith<$Res> { _$PartialUpdatingFailedCopyWithImpl(this._self, this._then); final PartialUpdatingFailed _self; final $Res Function(PartialUpdatingFailed) _then; -/// Create a copy of FailedState -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') $Res call({Object? set = freezed,Object? unset = freezed,Object? skipEnrichUrl = null,}) { - return _then(PartialUpdatingFailed( -set: freezed == set ? _self._set : set // ignore: cast_nullable_to_non_nullable -as Map?,unset: freezed == unset ? _self._unset : unset // ignore: cast_nullable_to_non_nullable -as List?,skipEnrichUrl: null == skipEnrichUrl ? _self.skipEnrichUrl : skipEnrichUrl // ignore: cast_nullable_to_non_nullable -as bool, - )); -} - - + /// Create a copy of FailedState + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + $Res call({ + Object? set = freezed, + Object? unset = freezed, + Object? skipEnrichUrl = null, + }) { + return _then( + PartialUpdatingFailed( + set: freezed == set + ? _self._set + : set // ignore: cast_nullable_to_non_nullable + as Map?, + unset: freezed == unset + ? _self._unset + : unset // ignore: cast_nullable_to_non_nullable + as List?, + skipEnrichUrl: null == skipEnrichUrl + ? _self.skipEnrichUrl + : skipEnrichUrl // ignore: cast_nullable_to_non_nullable + as bool, + ), + ); + } } /// @nodoc @JsonSerializable() - class DeletingFailed implements FailedState { - const DeletingFailed({this.scope = MessageDeleteScope.softDeleteForAll, final String? $type}): $type = $type ?? 'deletingFailed'; + const DeletingFailed({ + this.scope = MessageDeleteScope.softDeleteForAll, + final String? $type, + }) : $type = $type ?? 'deletingFailed'; factory DeletingFailed.fromJson(Map json) => _$DeletingFailedFromJson(json); -@JsonKey() final MessageDeleteScope scope; - -@JsonKey(name: 'runtimeType') -final String $type; - - -/// Create a copy of FailedState -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$DeletingFailedCopyWith get copyWith => _$DeletingFailedCopyWithImpl(this, _$identity); + @JsonKey() + final MessageDeleteScope scope; -@override -Map toJson() { - return _$DeletingFailedToJson(this, ); -} + @JsonKey(name: 'runtimeType') + final String $type; -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is DeletingFailed&&(identical(other.scope, scope) || other.scope == scope)); -} + /// Create a copy of FailedState + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $DeletingFailedCopyWith get copyWith => + _$DeletingFailedCopyWithImpl(this, _$identity); -@JsonKey(includeFromJson: false, includeToJson: false) -@override -int get hashCode => Object.hash(runtimeType,scope); + @override + Map toJson() { + return _$DeletingFailedToJson(this); + } -@override -String toString() { - return 'FailedState.deletingFailed(scope: $scope)'; -} + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is DeletingFailed && + (identical(other.scope, scope) || other.scope == scope)); + } + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, scope); + @override + String toString() { + return 'FailedState.deletingFailed(scope: $scope)'; + } } /// @nodoc abstract mixin class $DeletingFailedCopyWith<$Res> implements $FailedStateCopyWith<$Res> { - factory $DeletingFailedCopyWith(DeletingFailed value, $Res Function(DeletingFailed) _then) = _$DeletingFailedCopyWithImpl; -@useResult -$Res call({ - MessageDeleteScope scope -}); - - -$MessageDeleteScopeCopyWith<$Res> get scope; + factory $DeletingFailedCopyWith( + DeletingFailed value, + $Res Function(DeletingFailed) _then, + ) = _$DeletingFailedCopyWithImpl; + @useResult + $Res call({MessageDeleteScope scope}); + $MessageDeleteScopeCopyWith<$Res> get scope; } + /// @nodoc -class _$DeletingFailedCopyWithImpl<$Res> - implements $DeletingFailedCopyWith<$Res> { +class _$DeletingFailedCopyWithImpl<$Res> implements $DeletingFailedCopyWith<$Res> { _$DeletingFailedCopyWithImpl(this._self, this._then); final DeletingFailed _self; final $Res Function(DeletingFailed) _then; -/// Create a copy of FailedState -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') $Res call({Object? scope = null,}) { - return _then(DeletingFailed( -scope: null == scope ? _self.scope : scope // ignore: cast_nullable_to_non_nullable -as MessageDeleteScope, - )); + /// Create a copy of FailedState + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + $Res call({Object? scope = null}) { + return _then( + DeletingFailed( + scope: null == scope + ? _self.scope + : scope // ignore: cast_nullable_to_non_nullable + as MessageDeleteScope, + ), + ); + } + + /// Create a copy of FailedState + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $MessageDeleteScopeCopyWith<$Res> get scope { + return $MessageDeleteScopeCopyWith<$Res>(_self.scope, (value) { + return _then(_self.copyWith(scope: value)); + }); + } } - -/// Create a copy of FailedState -/// with the given fields replaced by the non-null parameter values. -@override -@pragma('vm:prefer-inline') -$MessageDeleteScopeCopyWith<$Res> get scope { - - return $MessageDeleteScopeCopyWith<$Res>(_self.scope, (value) { - return _then(_self.copyWith(scope: value)); - }); -} -} - -// dart format on diff --git a/packages/stream_chat/lib/src/core/models/poll_voting_mode.freezed.dart b/packages/stream_chat/lib/src/core/models/poll_voting_mode.freezed.dart index 2c37258667..8e9c09c16f 100644 --- a/packages/stream_chat/lib/src/core/models/poll_voting_mode.freezed.dart +++ b/packages/stream_chat/lib/src/core/models/poll_voting_mode.freezed.dart @@ -9,199 +9,183 @@ part of 'poll_voting_mode.dart'; // FreezedGenerator // ************************************************************************** -// dart format off T _$identity(T value) => value; + /// @nodoc mixin _$PollVotingMode { + @override + bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType && other is PollVotingMode); + } + @override + int get hashCode => runtimeType.hashCode; - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is PollVotingMode); -} - - -@override -int get hashCode => runtimeType.hashCode; - -@override -String toString() { - return 'PollVotingMode()'; -} - - + @override + String toString() { + return 'PollVotingMode()'; + } } /// @nodoc -class $PollVotingModeCopyWith<$Res> { -$PollVotingModeCopyWith(PollVotingMode _, $Res Function(PollVotingMode) __); +class $PollVotingModeCopyWith<$Res> { + $PollVotingModeCopyWith(PollVotingMode _, $Res Function(PollVotingMode) __); } - - /// @nodoc - class VotingDisabled implements PollVotingMode { const VotingDisabled(); - - - + @override + bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType && other is VotingDisabled); + } + @override + int get hashCode => runtimeType.hashCode; - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is VotingDisabled); + @override + String toString() { + return 'PollVotingMode.disabled()'; + } } - -@override -int get hashCode => runtimeType.hashCode; - -@override -String toString() { - return 'PollVotingMode.disabled()'; +/// @nodoc +class $VotingDisabledCopyWith<$Res> implements $PollVotingModeCopyWith<$Res> { + $VotingDisabledCopyWith(VotingDisabled _, $Res Function(VotingDisabled) __); } +/// @nodoc +class _$VotingDisabledCopyWithImpl<$Res> implements $VotingDisabledCopyWith<$Res> { + _$VotingDisabledCopyWithImpl(this._self, this._then); + final VotingDisabled _self; + final $Res Function(VotingDisabled) _then; } - - - /// @nodoc - class VotingUnique implements PollVotingMode { const VotingUnique(); - - - - + @override + bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType && other is VotingUnique); + } + @override + int get hashCode => runtimeType.hashCode; -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is VotingUnique); + @override + String toString() { + return 'PollVotingMode.unique()'; + } } - -@override -int get hashCode => runtimeType.hashCode; - -@override -String toString() { - return 'PollVotingMode.unique()'; +/// @nodoc +class $VotingUniqueCopyWith<$Res> implements $PollVotingModeCopyWith<$Res> { + $VotingUniqueCopyWith(VotingUnique _, $Res Function(VotingUnique) __); } +/// @nodoc +class _$VotingUniqueCopyWithImpl<$Res> implements $VotingUniqueCopyWith<$Res> { + _$VotingUniqueCopyWithImpl(this._self, this._then); + final VotingUnique _self; + final $Res Function(VotingUnique) _then; } - - - /// @nodoc - class VotingLimited implements PollVotingMode { const VotingLimited({required this.count}); - - - final int count; - -/// Create a copy of PollVotingMode -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$VotingLimitedCopyWith get copyWith => _$VotingLimitedCopyWithImpl(this, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is VotingLimited&&(identical(other.count, count) || other.count == count)); -} + final int count; -@override -int get hashCode => Object.hash(runtimeType,count); + /// Create a copy of PollVotingMode + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $VotingLimitedCopyWith get copyWith => _$VotingLimitedCopyWithImpl(this, _$identity); -@override -String toString() { - return 'PollVotingMode.limited(count: $count)'; -} + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is VotingLimited && + (identical(other.count, count) || other.count == count)); + } + @override + int get hashCode => Object.hash(runtimeType, count); + @override + String toString() { + return 'PollVotingMode.limited(count: $count)'; + } } /// @nodoc abstract mixin class $VotingLimitedCopyWith<$Res> implements $PollVotingModeCopyWith<$Res> { - factory $VotingLimitedCopyWith(VotingLimited value, $Res Function(VotingLimited) _then) = _$VotingLimitedCopyWithImpl; -@useResult -$Res call({ - int count -}); - - - - + factory $VotingLimitedCopyWith( + VotingLimited value, + $Res Function(VotingLimited) _then, + ) = _$VotingLimitedCopyWithImpl; + @useResult + $Res call({int count}); } + /// @nodoc -class _$VotingLimitedCopyWithImpl<$Res> - implements $VotingLimitedCopyWith<$Res> { +class _$VotingLimitedCopyWithImpl<$Res> implements $VotingLimitedCopyWith<$Res> { _$VotingLimitedCopyWithImpl(this._self, this._then); final VotingLimited _self; final $Res Function(VotingLimited) _then; -/// Create a copy of PollVotingMode -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') $Res call({Object? count = null,}) { - return _then(VotingLimited( -count: null == count ? _self.count : count // ignore: cast_nullable_to_non_nullable -as int, - )); -} - - + /// Create a copy of PollVotingMode + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + $Res call({Object? count = null}) { + return _then( + VotingLimited( + count: null == count + ? _self.count + : count // ignore: cast_nullable_to_non_nullable + as int, + ), + ); + } } /// @nodoc - class VotingAll implements PollVotingMode { const VotingAll(); - + @override + bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType && other is VotingAll); + } + @override + int get hashCode => runtimeType.hashCode; - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is VotingAll); + @override + String toString() { + return 'PollVotingMode.all()'; + } } - -@override -int get hashCode => runtimeType.hashCode; - -@override -String toString() { - return 'PollVotingMode.all()'; +/// @nodoc +class $VotingAllCopyWith<$Res> implements $PollVotingModeCopyWith<$Res> { + $VotingAllCopyWith(VotingAll _, $Res Function(VotingAll) __); } +/// @nodoc +class _$VotingAllCopyWithImpl<$Res> implements $VotingAllCopyWith<$Res> { + _$VotingAllCopyWithImpl(this._self, this._then); + final VotingAll _self; + final $Res Function(VotingAll) _then; } - - - - -// dart format on diff --git a/packages/stream_chat/pubspec.yaml b/packages/stream_chat/pubspec.yaml index fa3a266a99..771679805e 100644 --- a/packages/stream_chat/pubspec.yaml +++ b/packages/stream_chat/pubspec.yaml @@ -29,12 +29,26 @@ dependencies: freezed_annotation: ^3.0.0 http_parser: ^4.1.2 jose: ^0.3.5+1 - json_annotation: ^4.11.0 + json_annotation: ^4.12.0 logging: ^1.3.0 meta: ^1.9.1 mime: ^2.0.0 rate_limiter: ^1.1.0 + retrofit: ^4.9.2 rxdart: ^0.28.0 + stream_core: + # The ignore below silences `invalid_dependency` because we occasionally + # pin stream_core to a git ref to iterate on it alongside this + # SDK between its releases. + # + # **Note:** Before publishing stream_chat, this MUST be swapped + # back to a pub version constraint — git deps are not allowed on pub.dev + # and will block the release. + # ignore: invalid_dependency + git: + url: https://github.com/GetStream/stream-core-flutter.git + ref: 505432f213af8911d54ab3c855d6ad6fbe492fc9 + path: packages/stream_core synchronized: ^3.4.0 uuid: ^4.5.3 web_socket_channel: ^3.0.3 @@ -44,4 +58,5 @@ dev_dependencies: freezed: ^3.0.0 json_serializable: ^6.13.2 mocktail: ^1.0.5 + retrofit_generator: ^10.2.6 test: ^1.31.1 diff --git a/packages/stream_chat_flutter/example/pubspec.yaml b/packages/stream_chat_flutter/example/pubspec.yaml index cab1e79ac8..10023e856e 100644 --- a/packages/stream_chat_flutter/example/pubspec.yaml +++ b/packages/stream_chat_flutter/example/pubspec.yaml @@ -40,6 +40,11 @@ dependency_overrides: path: ../../stream_chat_localizations stream_chat_persistence: path: ../../stream_chat_persistence + stream_core: + git: + url: https://github.com/GetStream/stream-core-flutter.git + ref: 505432f213af8911d54ab3c855d6ad6fbe492fc9 + path: packages/stream_core flutter: uses-material-design: true diff --git a/packages/stream_chat_flutter/pubspec.yaml b/packages/stream_chat_flutter/pubspec.yaml index bba0f2a0f3..a4b189c6cc 100644 --- a/packages/stream_chat_flutter/pubspec.yaml +++ b/packages/stream_chat_flutter/pubspec.yaml @@ -104,4 +104,13 @@ platforms: linux: macos: web: - windows: \ No newline at end of file + windows: + +# `stream_core_flutter` depends on a published `stream_core`, which clashes with +# the git pin in `stream_chat`. Override it here until `stream_core` is released. +dependency_overrides: + stream_core: + git: + url: https://github.com/GetStream/stream-core-flutter.git + ref: 505432f213af8911d54ab3c855d6ad6fbe492fc9 + path: packages/stream_core diff --git a/packages/stream_chat_localizations/example/pubspec.yaml b/packages/stream_chat_localizations/example/pubspec.yaml index c15e6065a7..51e47dc811 100644 --- a/packages/stream_chat_localizations/example/pubspec.yaml +++ b/packages/stream_chat_localizations/example/pubspec.yaml @@ -36,6 +36,11 @@ dependency_overrides: path: ../../stream_chat_flutter_core stream_chat_localizations: path: .. + stream_core: + git: + url: https://github.com/GetStream/stream-core-flutter.git + ref: 505432f213af8911d54ab3c855d6ad6fbe492fc9 + path: packages/stream_core flutter: uses-material-design: true \ No newline at end of file diff --git a/packages/stream_chat_localizations/pubspec.yaml b/packages/stream_chat_localizations/pubspec.yaml index a184f54636..c120f541b3 100644 --- a/packages/stream_chat_localizations/pubspec.yaml +++ b/packages/stream_chat_localizations/pubspec.yaml @@ -33,3 +33,12 @@ dev_dependencies: clock: ^1.1.2 flutter_test: sdk: flutter + +# `stream_core_flutter` depends on a published `stream_core`, which clashes with +# the git pin in `stream_chat`. Override it here until `stream_core` is released. +dependency_overrides: + stream_core: + git: + url: https://github.com/GetStream/stream-core-flutter.git + ref: 505432f213af8911d54ab3c855d6ad6fbe492fc9 + path: packages/stream_core diff --git a/sample_app/pubspec.yaml b/sample_app/pubspec.yaml index 696ef9ab16..5c18296ba6 100644 --- a/sample_app/pubspec.yaml +++ b/sample_app/pubspec.yaml @@ -65,3 +65,12 @@ flutter: assets: - assets/ - pubspec.lock + +# `stream_core_flutter` depends on a published `stream_core`, which clashes with +# the git pin in `stream_chat`. Override it here until `stream_core` is released. +dependency_overrides: + stream_core: + git: + url: https://github.com/GetStream/stream-core-flutter.git + ref: 505432f213af8911d54ab3c855d6ad6fbe492fc9 + path: packages/stream_core diff --git a/scripts/generate.sh b/scripts/generate.sh new file mode 100755 index 0000000000..b1e0a5e2d9 --- /dev/null +++ b/scripts/generate.sh @@ -0,0 +1,404 @@ +#!/usr/bin/env bash +set -euo pipefail + +# ============================================================ +# Usage: +# CHAT_BACKEND_DIR=/absolute/path/to/chat melos run gen:openapi +# (or) export CHAT_BACKEND_DIR=... then: melos run gen:openapi +# +# CHAT_BACKEND_DIR points at a checkout of the backend monolith +# (GetStream/chat), which hosts the OpenAPI spec + code generator. +# +# The spec can come from three places. Both protocol modes pin generation to a +# released API version and skip generating a spec: +# +# PROTOCOL_REF=openapi-v237.2.0 CHAT_BACKEND_DIR=/path/to/chat melos run gen:openapi +# Downloads that ref's spec from GetStream/protocol. No checkout needed, and +# the ref is named in the command, so it cannot drift. There is no default. +# PROTOCOL_REF=latest resolves protocol's newest openapi release for you; +# the resolved tag is what gets stamped, never the word 'latest'. +# +# PROTOCOL_DIR=/path/to/protocol CHAT_BACKEND_DIR=/path/to/chat melos run gen:openapi +# Uses a local protocol checkout — for iterating on an unreleased spec. +# +# CHAT_BACKEND_DIR=/path/to/chat melos run gen:openapi +# Builds a fresh 'dev' spec from the monolith. +# +# CHAT_BACKEND_DIR is required either way: the client generator lives in the +# backend monolith, and protocol ships specs only. +# +# Requires: go, dart (curl for PROTOCOL_REF) +# Melos sets MELOS_ROOT_PATH when invoked via `melos run` +# ============================================================ + +# ---------- config (env-required) ---------- +: "${CHAT_BACKEND_DIR:?❌ CHAT_BACKEND_DIR not set. +Please run with: + CHAT_BACKEND_DIR=/path/to/chat melos run gen:openapi +or export it in your shell/profile.}" + +# ---------- config (env-optional) ---------- +PROTOCOL_DIR="${PROTOCOL_DIR:-}" +PROTOCOL_REF="${PROTOCOL_REF:-}" + +# ---------- paths ---------- +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +REPO_ROOT="${MELOS_ROOT_PATH:-$(cd "${SCRIPT_DIR}/.." && pwd)}" + +PKG_DIR="${REPO_ROOT}/packages/stream_chat" +OUTPUT_DIR="${PKG_DIR}/lib/open_api" +RENAMED_MODELS="${REPO_ROOT}/scripts/renamed-models.json" # optional +RENAME_TOOL="${REPO_ROOT}/tools/rename_openapi_models.dart" + +PRODUCTS="chat,common,moderation" +API_VERSION="v2" +SPEC_BASENAME="chat-clientside-api" +SPEC_DIR_REL="releases/${API_VERSION}" # backend output +PROTOCOL_SPEC_DIR_REL="openapi/${API_VERSION}" # protocol input + +# ---------- helpers ---------- +section() { echo ""; echo "$*"; echo ""; } +# The API version the spec was generated from ('dev' for locally built specs) +spec_version() { + case "$1" in + *.json) python3 -c "import json,sys; print(json.load(open(sys.argv[1]))['info']['version'])" "$1" ;; + *) awk '/^info:/ { in_info = 1; next } + in_info && /^ version:/ { print $2; exit } + in_info && /^[^ ]/ { exit }' "$1" ;; + esac +} +# A stable identifier for a checkout: its nearest tag when it has one, else a +# short sha, suffixed with -dirty when the tree carries uncommitted changes. +git_stamp() { + local dir="$1" rev + git -C "$dir" rev-parse --git-dir >/dev/null 2>&1 || { echo "unknown"; return; } + rev="$(git -C "$dir" describe --tags --always 2>/dev/null)" + [[ -n "$rev" ]] || rev="$(git -C "$dir" rev-parse --short=9 HEAD)" + [[ -n "$(git -C "$dir" status --porcelain 2>/dev/null)" ]] && rev="${rev}-dirty" + echo "$rev" +} + +# ---------- validation ---------- +[[ -d "$CHAT_BACKEND_DIR" ]] || { echo "❌ CHAT_BACKEND_DIR not found: $CHAT_BACKEND_DIR"; exit 1; } +command -v go >/dev/null || { echo "❌ 'go' is required in PATH"; exit 1; } +command -v dart >/dev/null || { echo "❌ 'dart' is required in PATH"; exit 1; } +command -v python3 >/dev/null || { echo "❌ 'python3' is required in PATH"; exit 1; } + +# Optional renamed-models flag +RENAMED_MODELS_FLAG=() +if [[ -f "$RENAMED_MODELS" ]]; then + RENAMED_MODELS_FLAG=(-renamed-models "$RENAMED_MODELS") + echo "ℹ️ Using renamed-models.json: $RENAMED_MODELS" +fi + +# The spec to generate the client from, resolved by [1/3]. SPEC_FILE is what the +# generator reads, SPEC_ORIGIN the spec it came from — they differ when renames +# are applied to a copy. +SPEC_FILE="" +SPEC_ORIGIN="" +SPEC_API_VERSION="" +SPEC_SOURCE_STAMP="" +SPEC_CHECKSUM="" +SPEC_SOURCE="backend ($CHAT_BACKEND_DIR)" +if [[ -n "$PROTOCOL_DIR" && -n "$PROTOCOL_REF" ]]; then + echo "❌ Set PROTOCOL_DIR or PROTOCOL_REF, not both — they name two different specs." + exit 1 +elif [[ -n "$PROTOCOL_DIR" ]]; then + [[ -d "$PROTOCOL_DIR" ]] || { echo "❌ PROTOCOL_DIR not found: $PROTOCOL_DIR"; exit 1; } + SPEC_SOURCE="protocol ($PROTOCOL_DIR)" +elif [[ -n "$PROTOCOL_REF" ]]; then + SPEC_SOURCE="protocol @ $PROTOCOL_REF (downloaded)" +fi + +echo "" +echo "📂 Repo: $REPO_ROOT" +echo "📦 Package: $PKG_DIR" +echo "🗂 Output: $OUTPUT_DIR" +echo "📜 Spec source: $SPEC_SOURCE" +echo "💬 CHAT_BACKEND_DIR: $CHAT_BACKEND_DIR" +echo "" + +# ---------- [1/3] Resolve spec & generate client ---------- +section "➡️ [1/3] Resolving OpenAPI spec and generating Dart client…" + +# Compares a spec against the sha256 protocol publishes beside it. Verifying +# rather than trusting: an edited or truncated spec would otherwise reach the +# generator and be stamped with a checksum describing different bytes. +verify_checksum() { + local spec="$1" sidecar="$2" actual + [[ -f "$sidecar" ]] || return 0 + + # Sets SPEC_CHECKSUM for the stamp as a side effect. + SPEC_CHECKSUM="$(awk '{ print $1; exit }' "$sidecar")" + if command -v shasum >/dev/null; then + actual="$(shasum -a 256 "$spec" | awk '{ print $1 }')" + elif command -v sha256sum >/dev/null; then + actual="$(sha256sum "$spec" | awk '{ print $1 }')" + else + echo "⚠️ Neither shasum nor sha256sum found — skipping spec verification" + return 0 + fi + [[ "$actual" == "$SPEC_CHECKSUM" ]] || { + echo "❌ Spec checksum mismatch for $spec" + echo " expected $SPEC_CHECKSUM (from the .sha256 sidecar)" + echo " actual $actual" + exit 1 + } +} + +PROTOCOL_JSON="" # set by both protocol modes; renames are applied to it below + +if [[ -n "$PROTOCOL_DIR" ]]; then + # Use the released spec from a protocol checkout as-is. + PROTOCOL_SPEC="${PROTOCOL_DIR}/${PROTOCOL_SPEC_DIR_REL}/${SPEC_BASENAME}" + for ext in yaml json; do + [[ -f "${PROTOCOL_SPEC}.${ext}" ]] || { + echo "❌ Spec not found: ${PROTOCOL_SPEC}.${ext}" + echo " Is $PROTOCOL_DIR a checkout of GetStream/protocol?" + exit 1 + } + done + + PROTOCOL_JSON="${PROTOCOL_SPEC}.json" + SPEC_ORIGIN="$PROTOCOL_JSON" + SPEC_SOURCE_STAMP="protocol @ $(git_stamp "$PROTOCOL_DIR")" + verify_checksum "$PROTOCOL_JSON" "${PROTOCOL_JSON}.sha256" + +elif [[ -n "$PROTOCOL_REF" ]]; then + # Fetch the released spec straight from protocol at an explicit ref. More + # reproducible than a checkout, which silently uses whatever it sits at — + # which is why there is no default ref. + command -v curl >/dev/null || { echo "❌ 'curl' is required for PROTOCOL_REF"; exit 1; } + + # `latest` resolves to protocol's newest openapi release, so you do not have + # to go and find the tag. What gets stamped is the resolved tag, never + # 'latest' — the record has to say which spec this actually was. + if [[ "$PROTOCOL_REF" == "latest" ]]; then + PROTOCOL_REF="$( + curl -fsSL --retry 2 "https://api.github.com/repos/GetStream/protocol/tags?per_page=100" | + grep -oE '"name": *"openapi-v[0-9.]+"' | grep -oE 'openapi-v[0-9.]+' | sort -V | tail -1 + )" || true + + [[ -n "$PROTOCOL_REF" ]] || { + echo "❌ Could not resolve the latest openapi release from GetStream/protocol." + echo " Pass an explicit tag instead: PROTOCOL_REF=openapi-vX.Y.Z" + exit 1 + } + echo "• Resolved PROTOCOL_REF=latest to $PROTOCOL_REF" + fi + + SPEC_TMP_DIR="$(mktemp -d)" + trap 'rm -rf "$SPEC_TMP_DIR"' EXIT + + PROTOCOL_URL="https://raw.githubusercontent.com/GetStream/protocol/${PROTOCOL_REF}/${PROTOCOL_SPEC_DIR_REL}/${SPEC_BASENAME}.json" + PROTOCOL_JSON="${SPEC_TMP_DIR}/${SPEC_BASENAME}.json" + + echo "• Downloading $PROTOCOL_URL" + curl -fsSL --retry 2 -o "$PROTOCOL_JSON" "$PROTOCOL_URL" || { + echo "❌ Could not download the spec. Is '$PROTOCOL_REF' a valid tag, branch or sha?" + exit 1 + } + # The sidecar is advisory here — a ref without one still generates, it just + # cannot be verified. + curl -fsSL --retry 2 -o "${PROTOCOL_JSON}.sha256" "${PROTOCOL_URL}.sha256" 2>/dev/null || true + + SPEC_ORIGIN="$PROTOCOL_URL" + SPEC_SOURCE_STAMP="protocol @ ${PROTOCOL_REF}" + verify_checksum "$PROTOCOL_JSON" "${PROTOCOL_JSON}.sha256" + +else + # Generate a fresh spec (YAML + JSON) from the backend monolith + ( + set -o pipefail + cd "$CHAT_BACKEND_DIR/projects/chat-manager" + + go run . openapi generate-spec \ + -products "$PRODUCTS" \ + -version "$API_VERSION" \ + --clientside \ + --encode-time-as-unix-timestamp \ + -output "$CHAT_BACKEND_DIR/$SPEC_DIR_REL/$SPEC_BASENAME" \ + ${RENAMED_MODELS_FLAG[@]+"${RENAMED_MODELS_FLAG[@]}"} + ) + + SPEC_FILE="${CHAT_BACKEND_DIR}/${SPEC_DIR_REL}/${SPEC_BASENAME}.yaml" + SPEC_ORIGIN="$SPEC_FILE" + SPEC_API_VERSION="$(spec_version "$SPEC_ORIGIN")" + SPEC_SOURCE_STAMP="backend @ $(git_stamp "$CHAT_BACKEND_DIR")" + echo "• Generated spec $SPEC_ORIGIN (API $SPEC_API_VERSION, $SPEC_SOURCE_STAMP)" +fi + +# Both protocol modes land here with a published spec, which is generated +# without -renamed-models — so the renames are applied to a copy instead. +if [[ -n "$PROTOCOL_JSON" ]]; then + SPEC_API_VERSION="$(spec_version "$PROTOCOL_JSON")" + echo "• Using spec $SPEC_ORIGIN (API $SPEC_API_VERSION, $SPEC_SOURCE_STAMP)" + + SPEC_FILE="$PROTOCOL_JSON" + if [[ -f "$RENAMED_MODELS" ]]; then + [[ -n "${SPEC_TMP_DIR:-}" ]] || { SPEC_TMP_DIR="$(mktemp -d)"; trap 'rm -rf "$SPEC_TMP_DIR"' EXIT; } + + SPEC_FILE="${SPEC_TMP_DIR}/${SPEC_BASENAME}.renamed.json" + dart "$RENAME_TOOL" "$PROTOCOL_JSON" "$RENAMED_MODELS" "$SPEC_FILE" + fi +fi + +# Clean target & ensure parent exists +rm -rf "$OUTPUT_DIR" +mkdir -p "$OUTPUT_DIR" + +# Generate the Dart client into the package's lib/open_api directory +( + set -o pipefail + cd "$CHAT_BACKEND_DIR/projects/chat-manager" + + go run . openapi generate-client \ + --language dart \ + --spec "$SPEC_FILE" \ + --output "$OUTPUT_DIR" +) + +# Teach json_serializable and freezed how to handle the WSEvent discriminator. +# +# `EventResponse.event` and `SyncResponse.events` are typed as the WSEvent union, +# which the generator emits with a static `fromJson`, no `toJson`, and no @JsonKey +# converters — json_serializable cannot serialize it, and freezed writes the +# `WsEvent` type argument without the `core.` prefix. +# +# TEMPORARY: remove this once model.tpl emits the converters and models-barrel.tpl +# re-exports WsEvent. +patch_ws_event_models() { + python3 - "$OUTPUT_DIR" <<'PY' +import pathlib +import sys + +output = pathlib.Path(sys.argv[1]) + +# Expose stream_core's WsEvent so freezed's unprefixed reference resolves. +barrel = output / 'models.dart' +barrel.write_text( + barrel.read_text().replace( + 'show StreamApiError, StreamDateTimeConverter;', + 'show StreamApiError, StreamDateTimeConverter, WsEvent;', + ) +) + +# Converters json_serializable can point at, next to the union itself. +union = output / 'model/ws_event.dart' +union.write_text(union.read_text().rstrip() + ''' + +WSEvent wsEventFromJson(Map json) => WSEvent.fromJson(json); + +Map wsEventToJson(WSEvent event) => + (event.wrapped as dynamic).toJson() as Map; + +List wsEventListFromJson(List json) => + json.map((e) => wsEventFromJson(e as Map)).toList(); + +List> wsEventListToJson(List events) => + events.map(wsEventToJson).toList(); +''') + +for model, field, converters in [ + ('event_response', 'event', 'wsEventFromJson, toJson: wsEventToJson'), + ('sync_response', 'events', 'wsEventListFromJson, toJson: wsEventListToJson'), +]: + path = output / f'model/{model}.dart' + before = f"@JsonKey(name: '{field}')" + after = f"@JsonKey(name: '{field}', fromJson: {converters})" + text = path.read_text() + if before not in text: + sys.exit(f'{path}: expected {before} — has the generator been fixed upstream?') + path.write_text(text.replace(before, after)) + +print('• Patched the WSEvent discriminator in EventResponse and SyncResponse') +PY +} +patch_ws_event_models + +# Record what produced this tree, in the barrel a reader opens first. +# +# The generator stamps no version of its own, so the closest thing to a +# template version is the commit of the monolith that holds the templates. The +# spec carries two of its own: `info.version` is the backend build it was cut +# from, and protocol publishes a sha256 beside each spec that identifies the +# exact bytes even when the checkout sits between tags. +# +# Deliberately free of timestamps — regenerating from unchanged inputs must +# produce no diff. +stamp_provenance() { + local barrel="$OUTPUT_DIR/api.dart" + local marker='// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT.' + + grep -qF -- "$marker" "$barrel" || { + echo "❌ Generator header not found in $barrel — has the template changed?" + exit 1 + } + + local checksum_line="" + [[ -n "$SPEC_CHECKSUM" ]] && checksum_line="// Checksum: ${SPEC_CHECKSUM}" + + awk -v marker="$marker" \ + -v spec="// Spec: ${SPEC_BASENAME} (API ${SPEC_API_VERSION})" \ + -v source="// Source: ${SPEC_SOURCE_STAMP}" \ + -v checksum="$checksum_line" \ + -v generator="// Generator: GetStream/chat @ $(git_stamp "$CHAT_BACKEND_DIR")" ' + { print } + $0 == marker { + print "//" + print spec + print source + if (checksum != "") print checksum + print generator + } + ' "$barrel" > "${barrel}.tmp" && mv "${barrel}.tmp" "$barrel" + + echo "• Stamped ${SPEC_BASENAME} (API ${SPEC_API_VERSION}) from ${SPEC_SOURCE_STAMP}" +} +stamp_provenance + +section "✅ Finished generating client at: $OUTPUT_DIR" + +# ---------- [2/3] build_runner (package only) ---------- +section "➡️ [2/3] Running build_runner in stream_chat…" + +# A failure still leaves outputs behind, so format them before bailing out +BUILD_RUNNER_OK=1 +( + cd "$PKG_DIR" + dart run build_runner build +) || BUILD_RUNNER_OK=0 + +if [[ $BUILD_RUNNER_OK -eq 1 ]]; then + section "✅ build_runner completed" +else + section "❌ build_runner failed — see the errors above" +fi + +# ---------- [3/3] Format the package ---------- +section "➡️ [3/3] Formatting stream_chat…" + +( + cd "$PKG_DIR" + # build_runner formats every output it writes — including the pre-existing + # ones — at the dart_style default width, so the whole package needs a pass + # at the width configured for this repo. Keep logs, ignore exit code. + dart format . || true +) + +# The stamp goes in before build_runner and the format pass rewrite the tree; a +# formatter that drops it would leave a run looking successful but unprovenanced. +grep -q 'Generator: GetStream/chat @' "$OUTPUT_DIR/api.dart" || { + echo "❌ The provenance stamp did not survive formatting — see stamp_provenance" + exit 1 +} + +section "✅ Formatting completed" + +# ---------- summary ---------- +[[ $BUILD_RUNNER_OK -eq 1 ]] || { echo "❌ Generation finished with build_runner errors"; exit 1; } + +section "🎉 All done!" +echo "• Spec: $SPEC_ORIGIN" +echo "• Client: $OUTPUT_DIR" +echo "" diff --git a/scripts/renamed-models.json b/scripts/renamed-models.json new file mode 100644 index 0000000000..e8cafa5256 --- /dev/null +++ b/scripts/renamed-models.json @@ -0,0 +1,3 @@ +{ + "Response": "DurationResponse" +} diff --git a/tools/rename_openapi_models.dart b/tools/rename_openapi_models.dart new file mode 100644 index 0000000000..c7d4a22100 --- /dev/null +++ b/tools/rename_openapi_models.dart @@ -0,0 +1,80 @@ +import 'dart:convert' show JsonEncoder, jsonDecode; +import 'dart:io' show File, exit, stderr; + +/// Applies the renames in a `renamed-models.json` file to an OpenAPI spec. +/// +/// The backend spec generator does this natively via its `-renamed-models` +/// flag, but specs published by the protocol repo are generated without it, +/// so the renames have to be applied to the spec before generating a client. +/// +/// Usage: dart tools/rename_openapi_models.dart +void main(List args) { + if (args.length != 3) { + stderr.writeln( + 'Usage: dart tools/rename_openapi_models.dart ', + ); + exit(64); + } + + final [specPath, renamesPath, outputPath] = args; + + final spec = jsonDecode(File(specPath).readAsStringSync()) as Map; + final renames = (jsonDecode(File(renamesPath).readAsStringSync()) as Map).cast(); + + final components = spec['components'] as Map?; + final schemas = components?['schemas'] as Map?; + if (schemas == null) { + stderr.writeln('No components.schemas found in $specPath'); + exit(1); + } + + final applied = {}; + for (final MapEntry(key: from, value: to) in renames.entries) { + if (!schemas.containsKey(from)) continue; + if (schemas.containsKey(to)) { + stderr.writeln('Cannot rename $from to $to: $to already exists in the spec'); + exit(1); + } + + schemas[to] = schemas.remove(from); + applied[from] = to; + } + + final refs = renameRefs(spec, applied); + + File(outputPath).writeAsStringSync(const JsonEncoder.withIndent(' ').convert(spec)); + + for (final MapEntry(key: from, value: to) in applied.entries) { + print('• Renamed $from -> $to'); + } + print('• Rewrote $refs \$ref(s)'); +} + +/// Rewrites every `$ref` in [node] pointing at a renamed schema, returning the +/// number of references rewritten. +int renameRefs(Object? node, Map renames) { + var count = 0; + switch (node) { + case final Map map: + for (final key in map.keys.toList()) { + final value = map[key]; + if (key == r'$ref' && value is String) { + const prefix = '#/components/schemas/'; + if (!value.startsWith(prefix)) continue; + + final target = renames[value.substring(prefix.length)]; + if (target == null) continue; + + map[key] = '$prefix$target'; + count++; + } else { + count += renameRefs(value, renames); + } + } + case final List list: + for (final item in list) { + count += renameRefs(item, renames); + } + } + return count; +} From 7db92d89564c478805c0c8084b293b34626cef9c Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Tue, 15 Sep 2026 16:38:47 +0200 Subject: [PATCH 02/36] docs(repo): plan the migration of stream_chat onto stream_core (#2955) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs(repo): plan the migration of stream_chat onto stream_core Adds `core-migration/`, a ten-phase plan for moving the low-level client's foundation — HTTP, errors, token/auth, WebSocket, uploads, query DSL, logger, platform, utils — onto `stream_core`, the way `stream_feeds` already is. Chat currently carries a second implementation of six of those, several as near-verbatim forks that have drifted. Three findings shape the order. Nothing is blocked: `stream_core` is a hosted `^0.5.0` and 0.5.0 ships both the sealed error layer and the upload task API. The WebSocket is not coupled to v2, because core supports `onAuthenticate: null` for a connection that sends nothing after open. And the error-code question is settled — the backend registry has no code 23 or 24, so `StreamErrorCode` needs no additions. Corrects the two docs that said otherwise, and notes in `openapi-migration/` that its group 01 no longer owns the error layer. Co-Authored-By: Claude Opus 5 (1M context) * ci(repo): re-enable the pana jobs for stream_chat_flutter and localizations Both were disabled while `stream_core` was a git dependency: pana resolves each package standalone, without the overrides melos generates, so a package pulling both a git `stream_core` and a hosted one failed version solving before pana could score it. `stream_core` is hosted `^0.5.0` now, so that solve cannot fail. Verified by resolving each package standalone with no overrides: both succeed and pull `stream_core 0.5.0` from pub.dev. Co-Authored-By: Claude Opus 5 (1M context) * docs(repo): map each phase to the PR that lands it The phase numbering and the stack order do not line up. Phase 01 splits across two PRs, phase 03 across two more, and one PR carries phases 04, 05 and 06 — so a reader opening a phase doc sees a status describing the finished stack rather than the rung they are on. At the first rung, phase 01 reads as partly landed while both of its files are still present. Reconciling every doc to every rung is not possible when docs and code interleave across a stack. Saying which PR a phase lands in is, so this adds that table and states plainly what the status column means. Appended rather than edited into the existing prose: eleven commits rewrite this file, and an in-place edit at the bottom of the stack conflicts with every one of them. Co-Authored-By: Claude Opus 5 (1M context) * docs(repo): correct stale claims in the core-migration plan - The `CurrentPlatform.name` shim cannot be an extension: `name` is a static. - Show the interceptor pipeline as it is assembled, with tags, an unconditional `ConnectionIdInterceptor` and `LoggingInterceptor` after `ApiErrorInterceptor`. - Warn that core's health-check ping writes `client_id` where chat writes `connection_id`. - `stream_chat_dio_error.dart` outlives phase 01; its consumer is phase 05. - A log tag namespaces records, it does not own `StreamLogger`'s configuration. - `pana.yml` runs five jobs, none of them gated off. - A resolved `stream_core` is not the same as a fixed `client.tpl`. Co-Authored-By: Claude Opus 5 (1M context) * docs(repo): point the plans at the phase that actually owns the work `01-utilities.md` derived the deletion of `stream_chat_dio_error.dart` to phase 05, then told the reader it lands in 03 — which never mentions the file. `openapi-migration/01-foundation.md` said at the top that the error layer and `Result` moved to `core-migration/03-errors.md`, then scoped, decided, risked and defined-done the same work below. The `stream_core` release it treated as a blocker is hosted `^0.5.0` today, and the pana jobs it wanted re-enabled already run. Co-Authored-By: Claude Opus 5 (1M context) * docs(repo): make 01's pointer to the error phase true instead of moving it `01-utilities.md` deferred `stream_chat_dio_error.dart` to 03 and said so twice, but `03-errors.md` never named the file, so "tracked there, not here" pointed at nothing. Name it in 03's definition of done. Co-Authored-By: Claude Opus 5 (1M context) * docs(repo): plan the migration of stream_chat onto stream_core Adds `core-migration/`, a ten-phase plan for moving the low-level client's foundation — HTTP, errors, token/auth, WebSocket, uploads, query DSL, logger, platform, utils — onto `stream_core`, the way `stream_feeds` already is. Chat currently carries a second implementation of six of those, several as near-verbatim forks that have drifted. Three findings shape the order. Nothing is blocked: `stream_core` is a hosted `^0.5.0` and 0.5.0 ships both the sealed error layer and the upload task API. The WebSocket is not coupled to v2, because core supports `onAuthenticate: null` for a connection that sends nothing after open. And the error-code question is settled — the backend registry has no code 23 or 24, so `StreamErrorCode` needs no additions. Corrects the two docs that said otherwise, and notes in `openapi-migration/` that its group 01 no longer owns the error layer. Co-Authored-By: Claude Opus 5 (1M context) * ci(repo): re-enable the pana jobs for stream_chat_flutter and localizations Both were disabled while `stream_core` was a git dependency: pana resolves each package standalone, without the overrides melos generates, so a package pulling both a git `stream_core` and a hosted one failed version solving before pana could score it. `stream_core` is hosted `^0.5.0` now, so that solve cannot fail. Verified by resolving each package standalone with no overrides: both succeed and pull `stream_core 0.5.0` from pub.dev. Co-Authored-By: Claude Opus 5 (1M context) * docs(repo): map each phase to the PR that lands it The phase numbering and the stack order do not line up. Phase 01 splits across two PRs, phase 03 across two more, and one PR carries phases 04, 05 and 06 — so a reader opening a phase doc sees a status describing the finished stack rather than the rung they are on. At the first rung, phase 01 reads as partly landed while both of its files are still present. Reconciling every doc to every rung is not possible when docs and code interleave across a stack. Saying which PR a phase lands in is, so this adds that table and states plainly what the status column means. Appended rather than edited into the existing prose: eleven commits rewrite this file, and an in-place edit at the bottom of the stack conflicts with every one of them. Co-Authored-By: Claude Opus 5 (1M context) * docs(repo): correct stale claims in the core-migration plan - The `CurrentPlatform.name` shim cannot be an extension: `name` is a static. - Show the interceptor pipeline as it is assembled, with tags, an unconditional `ConnectionIdInterceptor` and `LoggingInterceptor` after `ApiErrorInterceptor`. - Warn that core's health-check ping writes `client_id` where chat writes `connection_id`. - `stream_chat_dio_error.dart` outlives phase 01; its consumer is phase 05. - A log tag namespaces records, it does not own `StreamLogger`'s configuration. - `pana.yml` runs five jobs, none of them gated off. - A resolved `stream_core` is not the same as a fixed `client.tpl`. Co-Authored-By: Claude Opus 5 (1M context) * docs(repo): point the plans at the phase that actually owns the work `01-utilities.md` derived the deletion of `stream_chat_dio_error.dart` to phase 05, then told the reader it lands in 03 — which never mentions the file. `openapi-migration/01-foundation.md` said at the top that the error layer and `Result` moved to `core-migration/03-errors.md`, then scoped, decided, risked and defined-done the same work below. The `stream_core` release it treated as a blocker is hosted `^0.5.0` today, and the pana jobs it wanted re-enabled already run. Co-Authored-By: Claude Opus 5 (1M context) * docs(repo): make 01's pointer to the error phase true instead of moving it `01-utilities.md` deferred `stream_chat_dio_error.dart` to 03 and said so twice, but `03-errors.md` never named the file, so "tracked there, not here" pointed at nothing. Name it in 03's definition of done. Co-Authored-By: Claude Opus 5 (1M context) --------- Co-authored-by: Claude Opus 5 (1M context) --- .claude/skills/openapi-codegen/SKILL.md | 27 +- .github/workflows/pana.yml | 18 -- core-migration/01-utilities.md | 140 ++++++++++ core-migration/02-platform-and-environment.md | 96 +++++++ core-migration/03-errors.md | 187 +++++++++++++ core-migration/04-token-and-auth.md | 119 +++++++++ core-migration/05-http-client.md | 154 +++++++++++ core-migration/06-logger.md | 129 +++++++++ core-migration/07-websocket.md | 252 ++++++++++++++++++ core-migration/08-query-dsl.md | 185 +++++++++++++ core-migration/09-uploads.md | 146 ++++++++++ core-migration/10-cleanup.md | 148 ++++++++++ core-migration/README.md | 213 +++++++++++++++ openapi-migration/01-foundation.md | 86 ++---- openapi-migration/README.md | 15 +- 15 files changed, 1812 insertions(+), 103 deletions(-) create mode 100644 core-migration/01-utilities.md create mode 100644 core-migration/02-platform-and-environment.md create mode 100644 core-migration/03-errors.md create mode 100644 core-migration/04-token-and-auth.md create mode 100644 core-migration/05-http-client.md create mode 100644 core-migration/06-logger.md create mode 100644 core-migration/07-websocket.md create mode 100644 core-migration/08-query-dsl.md create mode 100644 core-migration/09-uploads.md create mode 100644 core-migration/10-cleanup.md create mode 100644 core-migration/README.md diff --git a/.claude/skills/openapi-codegen/SKILL.md b/.claude/skills/openapi-codegen/SKILL.md index 8af3dfd575..953a7a77be 100644 --- a/.claude/skills/openapi-codegen/SKILL.md +++ b/.claude/skills/openapi-codegen/SKILL.md @@ -3,8 +3,8 @@ name: openapi-codegen description: > Regenerate `stream_chat`'s OpenAPI client into `lib/open_api/`, and fix the generator when its output is wrong. Use when the spec or the generator changed and you need new endpoints or fields, when `melos run gen:openapi` - fails, when generated code does not compile, or when handling the `stream_core` git pin and the release blocker - it creates. For migrating call sites onto the generated client, use the `openapi-migration` skill instead. + fails, when generated code does not compile, or when changing the `stream_core` constraint the generated output + depends on. For migrating call sites onto the generated client, use the `openapi-migration` skill instead. allowed-tools: - Bash - Read @@ -142,22 +142,25 @@ Don't propose "make `fromJson` a factory" — `WSEvent` is generic, so a fact `_CustomEvent extends WSEvent` where `WSEvent` is expected. The upstream shape is converters emitted by `model.tpl` / `discriminator.tpl` plus a `WsEvent` re-export from `models-barrel.tpl`. -## Dependencies and the release blocker +## Dependencies `stream_chat` depends on `retrofit`, `retrofit_generator`, `json_annotation ^4.12.0` and `stream_core`. -**`stream_core` is pinned to a git ref in 8 places** — `melos.yaml`, `packages/stream_chat/pubspec.yaml`, and 6 -`dependency_overrides` blocks (`sample_app`, `docs/docs_screenshots`, `packages/stream_chat_flutter` and its -example, `packages/stream_chat_localizations` and its example). `stream_core_flutter` declares a *published* -`stream_core` and pub refuses git-vs-hosted for one package, so every consumer of both needs the override. +`stream_core` is a **hosted** dependency: `^0.5.0`, declared in `melos.yaml` and +`packages/stream_chat/pubspec.yaml`, with no `dependency_overrides` entry anywhere. 0.5.0 ships +`StreamDateTimeConverter` and the sealed error layer, so **no core release is blocking**. Change +the constraint in `melos.yaml` only, then `melos bootstrap` — never in a package manifest. -Bump all 8 together. Pub honors the override's ref over the declared one, so a partial bump silently compiles -against a different core commit than the pubspec claims. To find them all: +That is the dependency side only. The generator is still a prerequisite on its own: `client.tpl` +emits `runSafely`, and regenerating before the template change above lands reintroduces the old +error mapping no matter which core version resolves. + +If core ever goes back to a git ref for cross-repo work, it has to be pinned in every package that pulls both +`stream_chat` and `stream_core_flutter`, because pub refuses git-vs-hosted for one package and honors an override's +ref over the declared one. Find them all with: ```bash grep -rn "stream_core:" --include=pubspec.yaml packages docs sample_app melos.yaml ``` -**`stream_chat` cannot be published while that git dep exists**, and the generator's output needs -`StreamDateTimeConverter`, which is not in the last published `stream_core`. So a `stream_core` release is a -prerequisite for any `stream_chat` release — and it collapses all 8 pins to one hosted constraint. +A git dep under `dependencies` blocks publishing, so it must be back on a hosted constraint before release. diff --git a/.github/workflows/pana.yml b/.github/workflows/pana.yml index 1d5c5eb1fe..5b614782f3 100644 --- a/.github/workflows/pana.yml +++ b/.github/workflows/pana.yml @@ -50,16 +50,7 @@ jobs: working_directory: packages/stream_chat_flutter_core min_score: 100 - # Disabled while `stream_core` is a git dependency. pana resolves each package - # standalone, without the dependency_overrides melos generates, so any package - # pulling both `stream_chat` (git stream_core) and `stream_core_flutter` - # (hosted stream_core) fails version solving before pana can score it. The - # other packages still run — `stream_chat` alone resolves fine. - # - # Re-enable both jobs once stream_core is published; see - # openapi-migration/01-foundation.md. stream_chat_flutter: - if: false runs-on: ubuntu-latest steps: - name: 📚 Git Checkout @@ -70,16 +61,7 @@ jobs: working_directory: packages/stream_chat_flutter min_score: 100 - # Disabled while `stream_core` is a git dependency. pana resolves each package - # standalone, without the dependency_overrides melos generates, so any package - # pulling both `stream_chat` (git stream_core) and `stream_core_flutter` - # (hosted stream_core) fails version solving before pana can score it. The - # other packages still run — `stream_chat` alone resolves fine. - # - # Re-enable both jobs once stream_core is published; see - # openapi-migration/01-foundation.md. stream_chat_localizations: - if: false runs-on: ubuntu-latest steps: - name: 📚 Git Checkout diff --git a/core-migration/01-utilities.md b/core-migration/01-utilities.md new file mode 100644 index 0000000000..06002746c7 --- /dev/null +++ b/core-migration/01-utilities.md @@ -0,0 +1,140 @@ +# 01 — Utilities + +**Goal:** prove the pattern on files that touch no behaviour and almost no public surface. + +**Size:** 47 chat LOC deleted so far. No upstream core work. + +## Scope + +| Delete | Adopt | Status | +| --- | --- | --- | +| `lib/src/core/util/in_flight_cache.dart` (47) | `stream_core` `utils/in_flight_cache.dart` (32) | **done** | +| `lib/src/core/util/list_extensions.dart` (270) | `stream_core` `utils/list_extensions.dart` (656) | **deferred** — needs a performance comparison first | +| `lib/src/core/http/stream_chat_dio_error.dart` (19) | `stream_core` `StreamDioException` | **moved to [03](03-errors.md)** — blocked on the error layer | + +### `in_flight_cache` — done + +The two implementations were semantically identical: same `run(K, Future Function())` +signature, same `Future.sync(work)`, same `whenComplete(() => _inFlight.remove(key)).ignore()`. +Core's test file is our test file — same six cases, same names — so deleting ours lost no +coverage. + +`InFlightCache` was never exported from `lib/stream_chat.dart`, and its only consumer is +`client.dart`'s `_queryChannelsCache`. `client.dart` imports it with a `show` clause rather than +pulling core's barrel in wholesale, which would collide with `User`, `Filter`, `TokenManager` and +`SystemEnvironment` in that file: + +```dart +import 'package:stream_core/stream_core.dart' show InFlightCache; +``` + +That `show`-clause pattern is the one to reuse for every subsequent phase — a bare +`import 'package:stream_core/stream_core.dart';` inside `lib/src` will not compile in most of +this package. + +### `stream_chat_dio_error` — moved to phase 03, not deferred + +This cannot land here, and the reason is worth recording because it looked cheap: + +`StreamChatDioError.error` is typed `StreamChatNetworkError`, and core's `StreamDioException` +requires a `StreamException`. `StreamChatNetworkError` extends `StreamChatError implements +Exception` — it is **not** a `StreamException`, so there is nothing to hand core's constructor. +Wrapping it in a `StreamClientException(cause:)` would compile but would break +`stream_http_client.dart:102` (`if (exception is StreamChatDioError) return exception.error;`), +which is how the typed error reaches `_parseError` and then the caller. That would smear phase +03's break into this phase with none of phase 03's benefit. + +Both its producers are phase-03/04 code anyway: `auth_interceptor.dart:30` constructs it (deleted +in [04](04-token-and-auth.md)) and `stream_http_client.dart:102` unwraps it (deleted in +[05](05-http-client.md)). It goes when the payload type does. + +### `list_extensions` — deferred pending a performance comparison + +**Deferred deliberately, not forgotten.** Core's `merge` is a keyed-map-merge-then-sort +(O(n log n)); ours is a two-pointer merge (O(n)) and the file's own header calls it "a runtime +optimization". `channel_client_state.dart` (2,154 LOC) calls these helpers on **every** message, +member and read update, so this is the hottest path in the SDK and "same result for sorted +inputs" is not "same cost". + +Before adopting, benchmark both implementations on realistic shapes — a 1k+ sorted message list +with incremental upserts, a large member list, and the read-state map — and either confirm the +difference is immaterial at these sizes or take the two-pointer algorithm upstream so core is +fast for everyone. Do not swap on the strength of the TODO alone. + +The file's own header already specifies the migration: + +> `TODO(perf-migration)`: once `stream_chat` adopts `stream_core`, delete this file and import +> equivalents from `package:stream_core/src/utils/list_extensions.dart`. The signatures below +> mirror `stream_core`'s so the migration is a one-line import swap. The two-pointer `merge` here +> is a runtime optimization; `stream_core` does keyed-map-merge-and-sort. Both produce the same +> result for sorted inputs. + +Extension names do not match, and ours are public: + +| Ours | Core | +| --- | --- | +| `SortedListX on List` | `SortedListExtensions` (+ `ListExtensions`) | +| `IterableMergeX on Iterable` | `IterableExtensions` | +| `ListX on List` | `ListExtensions` | + +Core's split is different, not just renamed: `upsert` / `batchReplace` / `partition` sit on +`ListExtensions` while `updateWhere` / `insertUnique` / `sortedInsert` / `sortedUpsert` / `merge` +/ `removeNested` / `updateNested` sit on `SortedListExtensions`. Map each call site to the right +one; a blanket rename will not compile. + +Ours has `sortedUpsertAt`, `mergeSorted`, `mergeFrom` and `updateIf`; core has `sumOf`, +`removeNested`, `updateNested` and `partition`. Confirm every method we call has a home before +deleting, and take the missing ones upstream rather than keeping a two-method file behind. + +### `stream_chat_dio_error` + +`StreamChatDioError` is thrown by `AuthInterceptor.onRequest`'s reject path only, and it exists to +carry a `StreamChatNetworkError` through dio. Its payload type belongs to phase +[03](03-errors.md), its thrower to phase [04](04-token-and-auth.md) and its only consumer, +`StreamHttpClient`, to phase [05](05-http-client.md) — so the file cannot be deleted here. This +phase leaves it alone; the switch to core's `StreamDioException` and the deletion land with the +error layer. + +## Decisions to make + +Both remaining decisions belong to `list_extensions`, and both wait on the benchmark: + +- **Adopt core's `merge`, or upstream ours?** If the two-pointer merge measurably wins at chat's + list sizes, core should have it — that makes every product faster and removes the reason to keep + a fork. If the difference is noise, adopt core's and delete ours. +- **Deprecated forwarders, or a clean break?** `list_extensions.dart` is exported at + `stream_chat.dart:85` and the extension names differ, so the renames are visible. A Dart + `extension` cannot be aliased by a `typedef`, so a soft landing means keeping our extension + names as thin forwarders for one release. Decide whether that is worth it for list helpers most + consumers never call directly — if not, this becomes a `refactor(llc)!:` with a migration entry + and the phase is no longer non-breaking. + +## Risks + +- **`merge` is on the SDK's hottest path** — see the deferral note above. This is the whole reason + the file is still here. +- Core's split is different, not just renamed, so a blanket rename will not compile: `upsert` / + `batchReplace` / `partition` live on `ListExtensions` while `updateWhere` / `insertUnique` / + `sortedInsert` / `sortedUpsert` / `merge` / `removeNested` / `updateNested` live on + `SortedListExtensions`. + +## Upstream `stream_core` work + +None so far. Possible outcomes of the benchmark: the two-pointer `merge`, and any of +`sortedUpsertAt` / `mergeSorted` / `mergeFrom` / `updateIf` that core has no home for. + +## Definition of done + +- [x] `in_flight_cache.dart` deleted; `client.dart` imports core's with a `show` clause. +- [x] Our `in_flight_cache_test.dart` deleted, with core's confirmed to cover the same six cases. +- [x] `dart analyze --fatal-infos` clean on `stream_chat`; `dart format` clean. +- [x] `stream_chat` tests green (1687 passing); `stream_chat_persistence` tests green (302 + passing) and analyze clean. +- [ ] `merge` benchmarked on realistic shapes, with numbers recorded here. +- [ ] `list_extensions.dart` resolved — adopted, or ours upstreamed — and the export at + `stream_chat.dart:85` updated accordingly. +- [ ] `stream_chat_dio_error.dart` handled in [03](03-errors.md) (tracked there, not here). +- [ ] `melos run analyze && melos run test:all` before the phase closes. +- [ ] If the extension renames ship as a break: `refactor(llc)!:` title, `🛑️ Breaking` CHANGELOG + entry, `migrations/v11-migration.md` Symbol Map rows. +- [ ] Decisions recorded here, status box updated in `README.md`. diff --git a/core-migration/02-platform-and-environment.md b/core-migration/02-platform-and-environment.md new file mode 100644 index 0000000000..052043aa1f --- /dev/null +++ b/core-migration/02-platform-and-environment.md @@ -0,0 +1,96 @@ +# 02 — Platform detector & system environment + +**Goal:** delete two forks that collide with core by name, so later phases can import core's +`api/` and `platform/` barrels without a prefix. + +**Size:** ~220 chat LOC deleted. Two upstream core additions. One public rename. + +## Scope + +| Delete | Adopt | +| --- | --- | +| `lib/src/core/platform_detector/` — `platform_detector.dart` (~97) + `_stub` / `_web` / `_io` | `stream_core` `platform/current_platform.dart` + `platform/detector/` | +| `lib/src/core/http/system_environment_manager.dart` (111) | `stream_core` `api/system_environment_manager.dart` (156) + `api/system_environment.dart` | + +### Platform detector + +Both packages define `CurrentPlatform` **and** `PlatformType`, so `stream_chat.dart` must stop +exporting ours in the same PR — there is no coexistence. + +| Ours | Core | +| --- | --- | +| `enum PlatformType` — 7 values, no payload | `enum PlatformType` — same 7 values, each carrying `operatingSystem` | +| `CurrentPlatform.name` (a `switch`) | `CurrentPlatform.operatingSystem` | +| `is*` getters | same `is*` getters, plus `isMobile` / `isDesktop` | +| `@visibleForTesting static PlatformType? debugCurrentPlatformOverride` | **absent** — upstream it | +| conditional import: `_stub` / `_web` (on `dart.library.js_interop`) / `_io` | `detector/platform_detector` (web default) / `platform_detector_io` — **no explicit `js_interop` branch** | + +The `js_interop` branch is not cosmetic: it is how `#2940` (wasm support) works. Core reaching web +via a non-io fallback is not the same guarantee. Take both gaps upstream before starting, or this +phase regresses wasm and loses the test seam our tests depend on. + +### System environment + +Near-verbatim fork: same class name, same `XStreamClientHeaderExtension` extension name, and a +byte-identical `xStreamClientHeader` body including the `_SdkIdentifier` precedence trick. The +only real difference is where the SDK identity comes from — ours hardcodes it in the constructor, +core takes `required SystemEnvironment environment` and snapshots the SDK-owned fields so +`updateEnvironment` cannot overwrite them. + +Construct core's with chat's baseline: + +```dart +SystemEnvironmentManager( + environment: SystemEnvironment( + sdkName: 'stream-chat', + sdkIdentifier: 'dart', // core promotes 'dart' -> 'flutter' one-way + sdkVersion: PACKAGE_VERSION, + osName: CurrentPlatform.operatingSystem, + ), +) +``` + +**Fix the static while you are here.** `client.dart:168` is +`static final _systemEnvironmentManager = SystemEnvironmentManager();` — a static, so two +`StreamChatClient`s in one process cannot have different app names or versions, and the second +client silently inherits the first's environment. Make it an instance field. That is a bug fix, +not a break. + +## Decisions to make + +- `CurrentPlatform.name` → `.operatingSystem` has to be a clean rename. A deprecated `name` for + one release is not on the table: `name` is a static, and an extension can only add statics + under its own declaration name, so a chat-side shim could not answer `CurrentPlatform.name`. + It is exported, but a platform-name string is rarely load-bearing in app code. +- Whether `debugCurrentPlatformOverride` goes upstream as-is (an `@visibleForTesting` static with + an assert gate) or as something core's style guide prefers — core's `STYLE_GUIDE.md` has an + "Avoid `@visibleForTesting`" section, so expect pushback and have a second shape ready. + +## Risks + +- **Wasm.** If core's web detection is adopted without the `js_interop` branch, `#2940` regresses + silently — nothing fails to compile, the platform is just wrong at runtime. Verify with the + wasm build, not with tests. +- Chat's tests set `debugCurrentPlatformOverride`; without an equivalent they need reworking, and + reworking them to not need it is the better outcome but is more work than this phase implies. + +## Upstream `stream_core` work + +- `CurrentPlatform.debugCurrentPlatformOverride` (or an equivalent test seam). +- An explicit `dart.library.js_interop` web branch in the platform detector's conditional import. + +Both are small and belong in one core PR. + +## Definition of done + +- [ ] `lib/src/core/platform_detector/` deleted; `stream_chat.dart` no longer exports it. +- [ ] `system_environment_manager.dart` deleted; core's is constructed with the chat baseline. +- [ ] `_systemEnvironmentManager` is an instance field, and a test asserts two clients can hold + different environments. +- [ ] Wasm build verified (`flutter build web --wasm` on the sample app), not just tests. +- [ ] Chat's platform-dependent tests pass without a chat-owned override. +- [ ] `melos bootstrap && melos run analyze && melos run test:dart && melos run test:flutter`. +- [ ] `refactor(llc)!:` title, `🛑️ Breaking` CHANGELOG entry and `migrations/v11-migration.md` + Symbol Map rows for `CurrentPlatform.name` → `.operatingSystem`, `PlatformType` and + `SystemEnvironmentManager`. +- [ ] Decisions recorded here, status box ticked in `README.md`. diff --git a/core-migration/03-errors.md b/core-migration/03-errors.md new file mode 100644 index 0000000000..823dc40e31 --- /dev/null +++ b/core-migration/03-errors.md @@ -0,0 +1,187 @@ +# 03 — Errors & the `Result` surface + +**Goal:** replace our error class tree with core's sealed `StreamException` family, and make +`Result` available to consumers. Everything after this phase assumes both. + +**Size:** ~410 chat LOC deleted against ~900 core LOC adopted. The largest break in the plan. +**No upstream core work needed** — see [Error codes](#error-codes). + +> This phase owns the error/`Result` slice that `openapi-migration/01-foundation.md` previously +> claimed. That file now points here. Nothing else about the openapi track changes. + +## Scope + +| Delete | Adopt | +| --- | --- | +| `lib/src/core/error/stream_chat_error.dart` (230) — `StreamChatError`, `StreamChatNetworkError`, `StreamChatNetworkErrorType`, `StreamWebSocketError` | `stream_core` `errors/stream_exception.dart` — `sealed StreamException` → `StreamApiException`, `StreamNetworkException`, `StreamAuthenticationException`, `StreamClientException` | +| `lib/src/core/error/chat_error_code.dart` (158) — `ChatErrorCode` (25 values), `_errorCodeWithDescription`, `chatErrorCodeFromCode`, `ChatErrorCodeX` | `stream_core` `errors/stream_error_code.dart` — `StreamErrorCode`, an `extension type const StreamErrorCode(int) implements int` with ~40 constants, plus `StreamErrorCodePredicates` | +| `ErrorResponse` decoding in `StreamHttpClient._parseError` | `stream_core` `errors/stream_api_error.dart` — `StreamApiError` | + +All four core kinds are `base`, so chat may extend a kind if a case genuinely needs it and can +never add a fifth top-level kind. `stream-core-flutter/ERROR_LAYER.md` is normative and nothing in +this repo references it — read it first. + +### Alias the root, the way feeds does — decided + +```dart +/// An alias of [StreamException], so code written against either name catches +/// the same failures. +typedef StreamChatException = StreamException; +``` + +`stream_feeds` declares exactly this (`typedef StreamFeedsException = StreamException;`, +`stream_feeds/lib/src/feeds_client.dart:56`) and documents its public API in terms of the alias — +"`connect()` throws a `StreamFeedsException`". Chat follows the same shape: + +- **Product-branded name, shared type.** `on StreamChatException` and `on StreamException` catch + the same thing, so an integrator reading chat's docs never has to learn that the error family + lives in another package, while someone working across two Stream SDKs writes one handler. +- **It is a `typedef`, not a subclass.** Nothing to construct, nothing to keep in step with core, + and the sealed hierarchy stays exhaustive — a `switch` over `StreamChatException` still gets + the four `base` kinds and nothing else. +- **It gives the old name somewhere to land.** `StreamChatError` was our root; aliasing the new + root under a recognisably chat-shaped name is the smallest possible conceptual move for a + consumer, and `@Deprecated('Use StreamChatException') typedef StreamChatError = StreamException;` + is a legitimate one-line soft landing for the rename (unlike `StreamChatNetworkError`, which was + a *kind* and maps to `StreamApiException`, not to the root). + +Export it from `lib/stream_chat.dart` alongside the allowlist below. Prefer it in chat's own +dartdoc so the public docs read in chat's vocabulary; the four kinds keep their core names, since +those are what a `switch` matches on and renaming them would break the shared-handler property. + +Feeds adds **nothing else** to the hierarchy — zero classes in `stream_feeds/lib` extend or +implement a `StreamException`. Match that: the alias is the whole product-side error surface +unless a specific case proves otherwise. + +### Install `ApiErrorInterceptor` + +It is **not installed anywhere in chat today.** That is why a call through the generated client +currently hands back a `Failure` carrying a raw `DioException`: `DefaultApi` goes straight to +`_dio.fetch` and bypasses `StreamHttpClient._parseError`, which only its own verb wrappers call. + +Install it **last** in the pipeline (it must see every rejection on the way out) and the guarantee +holds: `runApiSafely` — already used by `default_api.dart:783` — maps a `DioException` through +`toStreamException()`, passes a `StreamException` through unchanged, and wraps everything else, +*including a `TypeError` from an undecodable response body*, in a `StreamClientException` with the +original as `cause`. + +### The `Result` surface + +Re-export from `lib/stream_chat.dart` with a `show` allowlist: + +```dart +export 'package:stream_core/stream_core.dart' + show + Result, Success, Failure, + StreamException, StreamApiException, StreamNetworkException, + StreamAuthenticationException, StreamClientException, + StreamApiError, StreamErrorCode; +``` + +Plus the `StreamChatException` alias above, from wherever it is declared. + +**Resolve the `Success` collision first.** Chat's `UploadState` is a `@freezed sealed` union whose +success variant is a class named `Success`, and it is exported. Either rename it (breaking, and +phase [09](09-uploads.md) touches `UploadState` anyway) or do not export core's `Success` and +document `Result` pattern-matching through `switch` on the sealed type instead. + +### Keep the hand-written API layer throwing + +`StreamHttpClient`'s verb wrappers keep throwing — they just throw a `StreamException` now instead +of a `StreamChatNetworkError`. This is deliberate and it is what keeps this plan independent of +`openapi-migration`: each of that plan's 12 feature groups converts its own methods to +`Future>` when it migrates, and until then nothing above the api layer changes shape. + +The break is already promised in `migrations/v11-migration.md`'s Symbol Map, so this phase +delivers what that guide advertises rather than adding a new row. + +### Error codes + +**Resolved against the backend, not left as a question.** `~/GolandProjects/chat` +`monolith/errors/errors.go:37-75` is the registry. It contains **no code 23 and no code 24**, and +`requestTimeout = 48`. + +| Ours | Verdict | +| --- | --- | +| `requestTimeout` = **23** | **Wrong.** The wire code is 48, which core already has as `StreamErrorCode.requestTimeout`. Anyone matching on 23 has never matched a real response. | +| `maximumHeaderSizeExceeded` = **24** | **Not a wire code.** Drop it; no upstream ask. | +| `undefinedToken` = **1000** | Client-invented, not a wire code. Drop it. | +| everything else | Present in `StreamErrorCode` with the same value. | + +So `StreamErrorCode` needs no additions and phase 03 has zero upstream dependencies. Record the 23 +→ 48 correction as its own CHANGELOG line: it is a silent behaviour change for any consumer +matching the old constant. + +### `isRetriable` stays ours + +It exists on both `StreamChatNetworkError` and `StreamWebSocketError` (`data == null`) and drives +`RetryQueue` via `RetryPolicy.shouldRetry`. Core has nothing equivalent — its +`DisconnectionSource.isReconnectable` is transport-level policy for the socket, not for a request. +Re-express ours as a chat-side extension over the core kinds. `ERROR_LAYER.md` is explicit that +retryability is the caller's policy, so this is the intended shape, not a workaround. + +### Two lossy conversions to document + +- `StreamChatNetworkErrorType` mirrors `DioExceptionType` with 9 values. + `StreamNetworkException` has `isCancelled` / `isTimeout` / `closeCode`, so `sendTimeout`, + `receiveTimeout` and `connectionTimeout` all collapse into one `isTimeout`. +- `StreamWebSocketError` has no analogue; core surfaces socket failures through + `DisconnectionSource.serverInitiated(error:)`. **Keep it alive through this phase** — the WS + layer still throws it until phase [07](07-websocket.md), and `client.dart:459` catches it by + type during `connectUser`. + + **Be explicit that this is a carry-forward, not an oversight.** `StreamWebSocketError` outlives + this phase and stays fully live through phases 04–06: `websocket.dart` constructs it + (`_handleStreamError`, `websocket.dart:392`), `connectUser` catches it by type to decide whether + to retry the initial connect, and it keeps its own `isRetriable`. So for as long as 04–06 take, + the SDK has *two* error families in flight — the sealed `StreamException` everywhere else, and + this one type on the socket path. That is intended and bounded; it becomes dead code only when + 07 replaces the transport, and 07's definition of done is what deletes it. Do not try to + half-migrate it here. + +## Decisions to make + +- The `Success` collision: rename `UploadState.success`'s class, or don't export core's `Success`. +- Whether `StreamChatNetworkError` is **deprecated** or **deleted** in v11. It must survive this + phase because every unmigrated endpoint still throws it, and it becomes dead code only when + `openapi-migration` group 12 lands. Deprecating it now and deleting it there is the honest + sequencing. +- Whether `ChatErrorCode` ships as a deprecated forwarder onto `StreamErrorCode` (possible for the + ~22 codes whose values match) or is deleted outright. The three bad codes cannot forward. + +## Risks + +- **This is the break with the widest blast radius.** `StreamChatNetworkError` is caught by type + in `retry_queue.dart`, `app_settings_manager.dart`, `websocket.dart:392` and across + `channel.dart` / `channel_client_state.dart`'s optimistic-update rollbacks. Every one of those + sites changes. +- Consumers catch `StreamChatNetworkError` in app code. This is the single most-visible v11 change + and the migration guide's Error Handling section has to be exactly right. + +## Upstream `stream_core` work + +None. + +## Definition of done + +- [ ] `core/error/` deleted except whatever `StreamWebSocketError` needs to survive until 07. +- [ ] `core/http/stream_chat_dio_error.dart` deleted — its payload becomes a `StreamException` + here, so core's `StreamDioException` carries it from this phase on. Deferred from + [01](01-utilities.md). +- [ ] `ApiErrorInterceptor` installed last in the pipeline. +- [ ] A test asserts a failed call yields a `Failure` carrying a `StreamApiException` with a + parsed `.apiError`, and that a malformed response body yields a `StreamClientException` + rather than a bare `TypeError`. +- [ ] `Result` and the core error types are exported via the `show` allowlist; the `Success` + collision is resolved. +- [ ] `isRetriable` re-expressed chat-side; `RetryQueue` and `RetryPolicy` behave identically — + a test pins that a 5xx retries and a 4xx does not. +- [ ] The 23 → 48 `requestTimeout` correction has its own CHANGELOG line. +- [ ] `melos bootstrap && melos run analyze && melos run test:dart && melos run test:flutter`. + Note `analysis_options.yaml` excludes `**/*.g.dart` and `**/*.freezed.dart` repo-wide, so + `default_api.g.dart` and ~490 generated `.freezed.dart` files are never analyzed — + exercising them in a test is what compiles them. +- [ ] `migrations/v11-migration.md` Error Handling section matches what shipped, including the two + lossy conversions. +- [ ] `refactor(llc)!:` title, `🛑️ Breaking` CHANGELOG entries. +- [ ] Decisions recorded here, status box ticked in `README.md`. diff --git a/core-migration/04-token-and-auth.md b/core-migration/04-token-and-auth.md new file mode 100644 index 0000000000..7c6302e5ec --- /dev/null +++ b/core-migration/04-token-and-auth.md @@ -0,0 +1,119 @@ +# 04 — Token & auth + +**Goal:** adopt core's token model and auth interceptor. Ours works; core's fixes three real bugs +ours has and adds expiry awareness ours cannot express. + +**Size:** ~225 chat LOC deleted against ~500 core LOC. Breaking, with a clean rename map. + +## Scope + +| Delete | Adopt | +| --- | --- | +| `lib/src/core/http/token.dart` (81) — `Token`, `AuthType`, `GuestTokenProvider` | `stream_core` `user/user_token.dart` — `UserToken`, `AuthType`, `UserTokenLoader` | +| `lib/src/core/http/token_manager.dart` (79) — `TokenManager`, `TokenProvider` typedef | `stream_core` `user/token_manager.dart` (247) + `user/token_provider.dart` (135) | +| `lib/src/core/http/interceptor/auth_interceptor.dart` (64) | `stream_core` `api/interceptors/auth_interceptor.dart` (118) | + +### Why core's is better, concretely + +Ours is a `QueuedInterceptor`, so every request serialises behind every other. Core's is a plain +`Interceptor` — token *loads* are serialised inside `TokenManager` (via `InFlightCache` keyed on a +generation counter) instead of requests, which was a deliberate 0.5.0 change. + +On the refresh path, ours checks `code == ChatErrorCode.tokenExpired.code`, refreshes and refetches. +Core's does that **and**: + +- guards against a retry loop with an `extra['stream_core.auth_token_retried']` marker, +- refuses to refresh across a user switch (`signedFor == tokenManager.userId`), +- skips refresh entirely for a static provider, where a re-fetch would return the same token, +- re-clones `FormData` before the retry, because the first attempt consumed its streams, +- logs every non-refresh decision under its tag. + +Ours has none of those. The `FormData` one is a live bug on any retried file upload. + +`UserToken` also parses `exp` via `jose` and exposes `isExpired({leeway})`, which is what lets the +interceptor act before the server refuses rather than only after. + +### Rename map + +| Ours | Core | +| --- | --- | +| `Token` | `UserToken` | +| `Token.fromRawValue(String)` | `UserToken(String rawJwt)` | +| `Token.anonymous` | `UserToken.anonymous()` | +| `TokenProvider = Future Function(String userId)` — a **typedef** | `abstract interface class TokenProvider` — `TokenProvider.static(UserToken)` / `TokenProvider.dynamic(UserTokenLoader)` | +| `TokenManager.loadToken({refresh})` | `TokenManager.getToken()` / `expireToken()` / `peekToken()` | +| `TokenManager.isStatic` | `TokenManager.usesStaticProvider` | +| `TokenManager.setTokenOrProvider` | `TokenManager.setTokenProvider(userId, tokenProvider:)` | +| `Token.development` | keep chat-side — build the dev JWT and wrap it in `TokenProvider.static` | + +`TokenProvider` going from a typedef to an interface is the break consumers actually feel: a +closure no longer satisfies the parameter. `TokenProvider.dynamic(myLoader)` is the one-line fix, +and it is a good `dart fix` transform candidate for phase [10](10-cleanup.md). + +### Guest auth + +`GuestTokenProvider = Future Function(User)` maps onto core's +`TokenManager.setTokenProvider(id, TokenProvider.static(token))` **after** the exchange, because +the server assigns the guest's real id. `TokenManager.unconfigured()` + `setTokenProvider` exists +precisely for this. + +`stream_feeds`' `_connectGuestUser` / `_exchangeForGuestIdentity` +(`stream_feeds/lib/src/client/feeds_client_impl.dart`) is the worked example, including the +`InFlightCache` keyed on the requested id so overlapping callers share one exchange rather than +racing to create two guests. + +Note core's `_authenticateUser` refuses to refresh a static provider and throws +`StreamAuthenticationException` instead — correct for guests, since a re-exchange yields a +*different* guest. Chat needs the same reasoning wherever it re-authenticates. + +### Anonymous + +Core collapses anonymous and guest into `User.anonymousUserId` + `TokenProvider.static( +UserToken.anonymous())` at construction. Chat has its own anonymous handling in `connectUser` / +`connectAnonymousUser`; reconcile the two rather than layering them, and note core's +`ConnectionIdInterceptor` is deliberately **skipped** for anonymous users. + +## Decisions to make + +- Whether `Token` survives as a deprecated forwarder. `UserToken`'s constructor parses the JWT and + throws on a malformed one, where `Token.fromRawValue` did not — so a forwarder is not + behaviour-preserving for bad input. Probably a clean break with a migration entry. +- Whether chat keeps `GuestTokenProvider` as a public convenience over + `TokenProvider`+`setTokenProvider`, or drops it and documents the two-step. +- Whether `TokenManager` is still constructor-injected into `StreamChatClient` or built internally. + Core's requires a `userId` at construction, which chat does not have until `connectUser` — so + `TokenManager.unconfigured()` at construction and `setTokenProvider` on connect is the shape. + +## Risks + +- **Every auth path is a connect path.** `connectUser`, `connectAnonymousUser`, guest connect and + token refresh all change together, and a mistake here presents as "cannot log in" rather than as + a test failure. Phase [07](07-websocket.md) then rewrites `connectUser` again — sequence these + two deliberately and do not interleave them. +- Core's interceptor refuses a refresh across a user switch. If chat currently relies on a refresh + surviving a `disconnectUser` → `connectUser` with a different id, that stops working — which is + the correct behaviour, but it is a behaviour change. +- `UserToken` validates that a loaded token's `userId` matches the one it loaded for and rejects a + mismatch. Any consumer whose token endpoint returns a token for a different user will now fail + loudly where it previously succeeded. + +## Upstream `stream_core` work + +None. + +## Definition of done + +- [ ] `token.dart`, `token_manager.dart` and our `auth_interceptor.dart` are deleted. +- [ ] `StreamChatClient` holds core's `TokenManager`, configured on connect. +- [ ] Tests cover: static token, dynamic provider, expired-token refresh (exactly one retry), + refresh refused across a user switch, refresh skipped for a static provider, and a retried + **multipart** request succeeding — that last one is the `FormData` re-clone. +- [ ] Guest connect adopts the server-assigned id, and two overlapping guest connects produce one + exchange. +- [ ] Anonymous connect sends no `connection_id` and no `Authorization` refresh attempt. +- [ ] `melos bootstrap && melos run analyze && melos run test:dart && melos run test:flutter`. +- [ ] Verified by hand in `sample_app`: cold login, a token that expires mid-session, and a + logout → login as a different user. +- [ ] `refactor(llc)!:` title, `🛑️ Breaking` CHANGELOG entries, `migrations/v11-migration.md` + Symbol Map rows for the whole rename map plus a feature section for `TokenProvider`. +- [ ] Decisions recorded here, status box ticked in `README.md`. diff --git a/core-migration/05-http-client.md b/core-migration/05-http-client.md new file mode 100644 index 0000000000..9971fb9187 --- /dev/null +++ b/core-migration/05-http-client.md @@ -0,0 +1,154 @@ +# 05 — HTTP client & interceptor pipeline + +**Goal:** replace `StreamHttpClient` with core's `StreamCoreHttpClient` and assemble the +interceptor pipeline once, in the order feeds already runs in production. + +**Size:** ~600 chat LOC deleted (288 client + ~310 interceptors) against ~150 core LOC. Breaking +on two public types. + +## Scope + +| Delete | Adopt | +| --- | --- | +| `lib/src/core/http/stream_http_client.dart` (288) | `stream_core` `api/stream_core_http_client.dart` (26) | +| `lib/src/core/http/interceptor/additional_headers_interceptor.dart` (22) | `stream_core` `api/interceptors/headers_interceptor.dart` (21) | +| `lib/src/core/http/interceptor/connection_id_interceptor.dart` (19) | `stream_core` `api/interceptors/connection_id_interceptor.dart` (26) | +| `lib/src/core/http/interceptor/logging_interceptor.dart` (344) | `stream_core` `api/interceptors/logging_interceptor.dart` (388) | +| — | `stream_core` `api/interceptors/api_key_interceptor.dart` (new to chat) | + +Core's `StreamCoreHttpClient` is an `extension type const ... implements Dio`, so it **is** a Dio +— no wrapper, no verb methods, no error parsing. That is the whole difference: ours is a facade +with eight verb wrappers that catch `DioException` and throw; core's hands you the Dio and lets +`ApiErrorInterceptor` + `runApiSafely` do the classification. + +### The `@internal` verb facade — the load-bearing decision + +Everything in phases 04–09 assumes the 13 hand-written `*_api.dart` files are untouched. Keeping a +thin `@internal` facade over the Dio — same signatures, now throwing `StreamException` after phase +[03](03-errors.md) — is what makes that true, and it is what keeps this plan independent of +`openapi-migration` progress. Without it, every phase after 03 acquires a dependency on an +out-of-scope plan. + +**Verified before writing this file, and the risk is small:** + +``` +115 call sites across 13 files in lib/src/core/api/ + 54 client.post 19 client.delete 6 client.patch + 23 client.get 8 client.postFile 5 client.put + 0 client.fetch 0 client.request +``` + +So the facade needs exactly **six** methods, not eight. `fetch` has one caller in the whole +package — `auth_interceptor.dart:64`, which phase [04](04-token-and-auth.md) deletes — and +`request` has none. + +`postFile` is the only non-trivial one: it wraps its `MultipartFile` in +`FormData.fromMap({'file': file})` and delegates to `post`, carrying `onSendProgress` / +`onReceiveProgress` / `cancelToken`. Preserve it as-is; phase [09](09-uploads.md) decides its +future. + +The facade is deleted when `openapi-migration` finishes. It also settles that plan's open question +about where `DefaultApi` is constructed — built once in `StreamChatApi` and injected, which +sidesteps the `invalid_use_of_visible_for_testing_member` problem it describes. + +### Pipeline assembly + +Assemble once, in `StreamChatApi`, in feeds' verified order — the order is load-bearing: + +```dart +StreamCoreHttpClient( + options: BaseOptions( + baseUrl: ..., // chat's default stays chat's default + connectTimeout: ..., + receiveTimeout: ..., + headers: customHeaders, // as Dio *defaults*, so SDK interceptors always win + ), +)..interceptors.addAll([ + ApiKeyInterceptor(apiKey), + HeadersInterceptor(systemEnvironmentManager), + AuthInterceptor(client, tokenManager, tag: 'SCh:HttpAuth'), + ConnectionIdInterceptor(connectionIdGetter), + const ApiErrorInterceptor(), + LoggingInterceptor(requestHeader: true, tag: 'SCh:Http'), +]); +``` + +Passing user headers as `BaseOptions.headers` rather than through an interceptor is deliberate in +feeds: Dio's header map is case-insensitive, so a user-supplied `authorization` in the wrong case +would otherwise clobber ours. As defaults, the interceptors always win. + +`ConnectionIdInterceptor` takes a `ConnectionIdGetter` (`String? Function()`). Feed it from our +`ConnectionIdManager`, which stays — see the README's "What stays ours": connection-id is threaded +into request *semantics* at `client.dart:774`, `:907` and `:1071`, not just into headers. + +Install it unconditionally rather than behind a `user.type` check. The pipeline is built once, at +construction, and the same client later moves between anonymous, guest and authenticated +identities — a construction-time check would leave an authenticated connection without a +`connection_id`. The getter answers `null` until there is a connection id to send, which is the +only gate needed. + +`ApiErrorInterceptor` comes last of the interceptors that *produce* errors, not last overall: +`LoggingInterceptor` sits after it so the log line carries the converted `StreamApiException` +rather than the raw `DioException`. + +### Two things to settle on the wire + +- **`api_key` placement.** Core's `ApiKeyInterceptor` sets it as a **header**; chat sets it as a + **query parameter** in `StreamHttpClient`'s constructor. Verify the server accepts the header + form for chat endpoints before switching. If it doesn't, keep the query parameter and don't use + core's interceptor — that is a legitimate outcome, not a failure. +- **`StreamChatClient.additionalHeaders` is a static mutable global** read by + `AdditionalHeadersInterceptor`. Core has no such concept and shouldn't. Replace it with + per-client headers on `BaseOptions`, and deprecate the static — two clients in one process + currently share it, which is a bug. + +### `LoggingInterceptor` + +A near-verbatim fork — same class name, same `InterceptStep` enum, same `LogPrint` typedef, same +pretty-printer — and **publicly exported** (`stream_chat.dart:34`). Adopting core's is breaking in +two ways: `logPrint` becomes optional, and output routes through `StreamLogger` instead of a +`Logger`. Sequence this with phase [06](06-logger.md) so consumers see one logging change, not +two. + +## Decisions to make + +- Whether the facade is a class (`@internal class StreamChatHttpClient`) or a set of extension + methods on `Dio`. An extension reads better at call sites and cannot be constructed wrongly; a + class is easier to delete later. +- `api_key` header vs query parameter, from the check above. +- Whether `StreamHttpClient` and `StreamHttpClientOptions` are deprecated forwarders or deleted. + `StreamHttpClient` appears in the public signature of `AttachmentFileUploaderProvider` + (`AttachmentFileUploader Function(StreamHttpClient)`), so its removal is also a phase-09 change + — deprecate here, delete there. + +## Risks + +- **`AttachmentFileUploaderProvider` is a documented public pluggability point** wired at + `client.dart:102`. Its parameter type changes the moment `StreamHttpClient` goes. Anyone with a + custom uploader breaks. Coordinate the retype with phase [09](09-uploads.md) rather than doing + it twice. +- Interceptor order mistakes fail *sometimes* — a misplaced `ApiErrorInterceptor` still works + until something rejects. Assert the order in a test rather than trusting the code reads right. +- `dio` version skew: chat declares `^5.11.0`, core `^5.8.0+1`. Compatible today; worth pinning + attention on when either moves. + +## Upstream `stream_core` work + +None, unless the `api_key` check concludes chat needs a query-parameter variant of +`ApiKeyInterceptor` — in which case that is a small, obviously-correct core addition. + +## Definition of done + +- [ ] **Every one of the 115 call sites in the 13 `*_api.dart` files is unchanged.** That is the + test of whether the facade held. A diff touching them means the facade is wrong. +- [ ] `stream_http_client.dart` and our three forked interceptors are deleted. +- [ ] The pipeline is assembled in exactly one place, and a test asserts the interceptor order — + including that `ApiErrorInterceptor` precedes `LoggingInterceptor`. +- [ ] `api_key` placement verified against the live API, with the result recorded here. +- [ ] `additionalHeaders` static deprecated; a test asserts two clients can carry different + headers. +- [ ] One real request run against a live app key, not only against mocks. +- [ ] `melos bootstrap && melos run analyze && melos run test:dart && melos run test:flutter`. +- [ ] `refactor(llc)!:` title, `🛑️ Breaking` CHANGELOG entries, `migrations/v11-migration.md` + rows for `StreamHttpClient`, `LoggingInterceptor` and `additionalHeaders`. +- [ ] Decisions recorded here, status box ticked in `README.md`. diff --git a/core-migration/06-logger.md b/core-migration/06-logger.md new file mode 100644 index 0000000000..fdf362bd78 --- /dev/null +++ b/core-migration/06-logger.md @@ -0,0 +1,129 @@ +# 06 — Logger + +**Goal:** log through core's `StreamLogger` so the whole SDK — including the core code phases +04–07 pull in — writes to one place. + +**Size:** no chat LOC deleted (chat has no logger abstraction); ~670 core LOC adopted. Breaking on +a public re-export. + +## Scope + +Chat has no logger of its own. It uses `package:logging` directly and **re-exports it**: + +```dart +export 'package:logging/logging.dart' show Logger, Level, LogRecord; // stream_chat.dart:15 +``` + +`Logger.detached` instances are built per subsystem in `client.dart:275,303,342` (with emoji +names — 📡 🕸️ 🔌 🧾), and `StreamChatClient(logger:)`, `RetryQueue(logger:)`, +`WebSocket(logger:)` and `StreamHttpClient(logger:)` all take a `Logger?`. + +Core ships a family instead: + +| Type | Role | +| --- | --- | +| `StreamLogger(String tag)` | `v` / `d` / `i` / `w` / `e` / `log`; resolves handler and filter at write time | +| `StreamLogMessage = String Function()` | lazy — the message is never built if it won't be logged | +| `StreamLogHandler` | `.console()`, `.composite()`, `.filtered()`, `.from(callback)`, `silent`. **Subclass this to bridge.** | +| `StreamLogFilter` | `.always()`, `.minPriority(p)`, `.prefix({tag: priority})` — longest matching prefix wins | +| `StreamLogPriority` | `verbose` … `none`, comparable, with emoji and label | +| `StreamLogConfig` | `{priority, handler, filter}` | +| `StreamLogger.configure(StreamLogConfig?)` | called once by the client; installs nothing when given nothing | + +**Half of this arrives whether we plan for it or not.** Core's `AuthInterceptor` (phase 04) and +every core WS class (phase 07) already log through `StreamLogger`. Without this phase, chat's logs +split across two systems with no way to see both. + +### Bridge, don't break + +Ship a `StreamLogHandler` subclass that forwards a `StreamLogRecord` to a user-supplied `Logger`, +so `StreamChatClient(logger:)` keeps working through a deprecation cycle: + +```dart +// sketch — a handler that keeps package:logging consumers working +class _LoggingBridgeHandler extends StreamLogHandler { + const _LoggingBridgeHandler(this._logger); + final Logger _logger; + + @override + void handle(StreamLogRecord record) => _logger.log( + _levelFor(record.priority), + record.message, + record.error, + record.stackTrace, + ); +} +``` + +That way `logger:` becomes "route core's records into my `Logger`" rather than "the SDK ignores +you", and the `package:logging` re-export can stay for one release before phase +[10](10-cleanup.md) drops it. + +### Claim a tag prefix + +`StreamLogger`'s handler, priority and filter are **process-global write-only statics**, and +`StreamLogRecord`'s sequence number is a static counter. Two Stream SDKs in one app settle on +whichever client was constructed last. + +A tag prefix does not fix that — it decides which records a *given* filter passes, not who owns +the handler. So the prefix is half the answer and the other half is a rule: **`StreamLogger` is +configured by the last `StreamChatClient` constructed, and chat never configures it implicitly.** +`logConfig` defaults to `const StreamLogConfig()`, which is the same configuration the previous +client would have installed, so a second client is a no-op unless the caller passed one — and a +caller who passes one is asking for it. Say that on `StreamChatClient.logConfig`, and leave +process-wide arbitration to whoever owns the process. + +The prefix `StreamLogFilter.prefix` filters on: + +| SDK | Prefix | +| --- | --- | +| `stream_core` | `SC:` | +| `stream_feeds` | `SF:` | +| `stream_chat` | **pick one and use it everywhere** — e.g. `SCh:` | + +Core's constructors take `tag:` parameters (`StreamWebSocketClient(tag: ...)`, +`AuthInterceptor(tag: ...)`, `LoggingInterceptor(tag: ...)`, `ConnectionRecoveryHandler(tag: ...)`) +precisely so a product can namespace them — feeds passes `SF:Ws`, `SF:Http`, `SF:HttpAuth`, +`SF:WsRecovery`. Pass chat's equivalents everywhere phases 04, 05 and 07 construct a core type. + +## Decisions to make + +- **The chat prefix.** `SCh:` is unambiguous but ugly; `CH:` is cleaner but collides with nothing + today and everything tomorrow. Pick it here and write it down — retagging later invalidates + every consumer's log filter. +- Whether `StreamChatClient(logger:)` keeps its `Logger?` type behind the bridge, or changes to + `StreamLogConfig?` immediately with `logger:` deprecated alongside. The bridge is friendlier; two + parameters for one concern is uglier. +- Whether to keep the per-subsystem emoji naming. Core's tags serve the same purpose and filter + better; the emoji do read nicely in a console. + +## Risks + +- **Anyone wiring `Logger.root.onRecord` sees their logs stop** unless the bridge is in place. + That is the visible break, and it is silent — no compile error, just no output. +- Global logger state means a chat client constructed after a feeds client overwrites the feeds + configuration. Nothing in this plan fixes that; the tag prefix only makes the result legible. + Worth raising upstream if it bites. +- `StreamLogger.configure` should be called **once**, from the client constructor, and not at all + when the consumer passed no config — installing a default handler where there was none turns a + silent SDK noisy. + +## Upstream `stream_core` work + +None required. Worth raising, not blocking: the process-global handler means two Stream SDKs +cannot log independently in one app. + +## Definition of done + +- [ ] `StreamLogger.configure` is called once from `StreamChatClient`, and not at all when no + config was supplied — a test asserts the no-config case installs nothing. +- [ ] Every core type chat constructs is passed a chat-prefixed `tag:`. +- [ ] The `package:logging` bridge handler exists, and a test asserts a record logged by core's + `AuthInterceptor` reaches a consumer-supplied `Logger`. +- [ ] `logger:` parameters are deprecated with a message naming the replacement. +- [ ] Lazy messages are used (`() => '...'`), not eagerly-built strings. +- [ ] `melos bootstrap && melos run analyze && melos run test:dart && melos run test:flutter`. +- [ ] `refactor(llc)!:` title, `🛑️ Breaking` CHANGELOG entry, `migrations/v11-migration.md` + Symbol Map rows for the `package:logging` re-export and each `logger:` parameter. +- [ ] Decisions recorded here — **especially the tag prefix** — and status box ticked in + `README.md`. diff --git a/core-migration/07-websocket.md b/core-migration/07-websocket.md new file mode 100644 index 0000000000..7c70e8312b --- /dev/null +++ b/core-migration/07-websocket.md @@ -0,0 +1,252 @@ +# 07 — WebSocket transport + +**Goal:** replace our 560-line WebSocket monolith with core's decomposed engine, health monitor, +retry strategy, reconnection policies and connection state machine — **on the existing v1 +protocol**, with v1 event shapes and chat's `Event` model untouched. + +**Size:** ~790 chat LOC deleted against ~1,940 core LOC adopted. The most behaviourally sensitive +phase in the plan. + +## Why this is possible without WS v2 + +Both `openapi-migration/README.md` and the `openapi-migration` skill list "move the WebSocket to +v2" as a non-goal, and both treat adopting core's WS as part of that project. The reasoning was +that the handshakes differ in kind: **chat authenticates in the connect URL** (`_buildUri` builds a +`json=` payload carrying api_key, user details and token), while **core's authenticator sends a +`WsAuthMessageRequest` frame after open** — and with v1 there is no frame to send. + +That reasoning is wrong about core, which supports exactly this case: + +- `web_socket_authentication_handler.dart:34` — "`authenticator` may be null, for a connection + that needs nothing sent." The handler's `authenticate()` "does nothing when there is no + authenticator." +- `stream_web_socket_client.dart:357-360`, in `_handleHealthCheckEvent` — "Still authenticating + counts too: with **no authenticator** we never send anything, so this pong is the only sign we + get that the connection works." The state machine transitions + `Authenticating → Connected(healthCheck:)` purely off a decoded event carrying + `healthCheckInfo`. + +So: `onAuthenticate: null`, the token rides in `optionsBuilder`'s URL, and the decoded +`connection.ok` event drives the transition. `optionsBuilder` is a `WebSocketOptions Function()` +called **per attempt**, so a refreshed token is picked up on reconnect — which is exactly what +`_reconnect(refreshToken: true)` does today. + +**Moving to v2 remains out of scope.** This phase adopts the machinery, not the protocol. + +## Scope + +| Delete | Adopt | +| --- | --- | +| `lib/src/ws/websocket.dart` (560) — `_initWebSocketChannel`, `_subscribeToWebSocketChannel`, `_onDataReceived`, `_onConnectionError`, `_onConnectionClosed` | `StreamWebSocketEngine` + a chat `WebSocketMessageCodec` | +| `_buildUri` | `optionsBuilder: () => WebSocketOptions(url:, queryParameters: {...})` | +| `_startHealthCheck`, `_startReconnectionMonitor`, `healthCheckInterval`, `reconnectionMonitorInterval`, `reconnectionMonitorTimeout` | `WebSocketHealthMonitor` | +| `lib/src/ws/timer_helper.dart` (39) — `TimerHelper` | (subsumed) | +| `_getReconnectInterval(attempt)`, `maxReconnectAttempts` | `RetryStrategy` / `DefaultRetryStrategy` | +| `_needsToReconnect`, `pauseReconnect`, `resumeReconnect` | `AutomaticReconnectionPolicy` family + `CompositeReconnectionPolicy` | +| `_reconnect`, `client.maybeReconnect()` | `ConnectionRecoveryHandler` | +| `lib/src/ws/connection_status.dart` (11) — `enum ConnectionStatus` | `sealed WebSocketConnectionState` + `sealed DisconnectionSource` | +| `StreamWebSocketError` (deferred from phase 03) | `DisconnectionSource.serverInitiated(error:)` | + +`lib/src/ws/connect_user_details.dart` maps onto core's `ConnectUserDetailsRequest`, which has +`invisible` and `language` already — those are chat's fields, in core. + +## Order within the phase + +### 1. `Event extends WsEvent` — do this first, on its own + +`Event` is a plain `class Event {` today (`core/models/event.dart:10`), so this is purely +additive: extend `WsEvent` and override two getters. + +```dart +class Event extends WsEvent { + // error: non-null only for connection.error + @override + Object? get error => ...; + + // healthCheckInfo: non-null for health.check and connection.ok + @override + HealthCheckInfo? get healthCheckInfo => ...; +} +``` + +This is the prerequisite for everything else in the phase: it is what lets chat events flow +through core's `EventEmitter` and what drives `Authenticating → Connected`. Land it +before touching the transport, and nothing observable changes. + +`HealthCheckInfo` carries `connectionId` and `participantCount` — the latter is a video field; +ignore it. + +### 2. The codec + +```dart +class ChatWsCodec implements WebSocketMessageCodec { + // encode: json.encode(message.toJson()) + // decode: Event.fromJson(json.decode(...)) — everything is an Event +} +``` + +`FeedsWsCodec` (`stream_feeds/lib/src/ws/feeds_ws_event.dart`) is the template, but chat's is +simpler: feeds has to unwrap a generated union and patch in three events the spec omits, whereas +every chat frame is already an `Event`. What the codec must guarantee is that `connection.ok`, +`health.check` and `connection.error` produce events whose `healthCheckInfo` / `error` are +populated — that is step 1's job, checked here. + +**A decode failure logs and drops the frame; it never disconnects.** That is core's deliberate +rule (`ERROR_LAYER.md`), and it matches what `_onDataReceived` effectively does today. + +**The encode side is not a straight `json.encode(message.toJson())`.** The only `WsRequest` chat +sends is the health-check ping, and the two sides disagree on one key: core's +`HealthCheckPingEvent.toJson()` writes `{'type': 'health.check', 'client_id': …}`, while chat +serializes an `Event` and writes `connection_id`. Confirm which the chat gateway accepts before +adopting the codec, and map the key in `ChatWsCodec.encode` if it is `connection_id`. A test +asserting the exact encoded JSON is the guard — a wrong key here is silent until health checks +stop being acknowledged. + +### 3. Client, health, recovery + +```dart +StreamWebSocketClient( + tag: ':Ws', + messageCodec: const ChatWsCodec(), + onAuthenticate: null, // v1 sends nothing after open + optionsBuilder: () => WebSocketOptions( + url: ..., + queryParameters: {'json': ..., 'api_key': ..., 'authorization': ...}, + ), +) +``` + +Then `ConnectionRecoveryHandler(client:, retryStrategy:, networkStateProvider:, +lifecycleStateProvider:, policies:)`. + +`ConnectionRecoveryHandler` **only recovers a connection that was once `Connected`** — a first +`connect()` that fails is never retried by it. Chat's `connectUser` catches +`StreamWebSocketError.isRetriable` at `client.dart:459` and retries the initial connect itself; +that behaviour has to stay somewhere, and it is not in core. + +### 4. Rewrite `connectUser` around state observation + +This is the real work. Today: + +- `connectUser` awaits `Future _ws.connect()` and reads `OwnUser` off the returned event, +- it reaches into `_ws.connectionCompleter` directly at `client.dart:418` and `:895`, +- `_setConnectionId(event.connectionId)` at `:572` seeds the connection id, +- `ClientState` is seeded from the same event. + +Core's `connect()` returns when the socket **opens** and reports the outcome only through +`connectionState`. There is no `connectionCompleter` and no returned event. Rebuild it as feeds +does (`feeds_client_impl.dart` `_connectUser`): + +```dart +_ws.connect().ignore(); +final state = await Future.any([ + connectionState.waitFor(), + connectionState.waitFor(), +]); +// Disconnected(:final source) -> map through the sealed DisconnectionSource and rethrow +// with Error.throwWithStackTrace; only ServerInitiated and AuthenticationFailed carry a trace. +``` + +- **connection id** comes from `Connected(:final healthCheck).connectionId`. +- **`OwnUser`** comes from the decoded `connection.ok` event off the `events` emitter — subscribe + *before* connecting, or the event is missed. +- `ConnectionIdInterceptor`'s getter reads the same place: + `if (_ws.connectionState.value case Connected(:final healthCheck)) return healthCheck.connectionId;` + +### 5. Keep `ConnectionStatus` alive as a derived view + +`ConnectionStatus` is publicly exported and used in **36 places** across +`stream_chat_flutter_core` and `stream_chat_flutter`. Do not break both Flutter layers in the same +PR as the transport rewrite. Keep `wsConnectionStatus` as a deprecated getter deriving from +`WebSocketConnectionState`: + +| `WebSocketConnectionState` | `ConnectionStatus` | +| --- | --- | +| `Initialized`, `Disconnected`, `Disconnecting` | `disconnected` | +| `Connecting`, `Authenticating` | `connecting` | +| `Connected` | `connected` | + +Expose the sealed state alongside it, and migrate the Flutter layers in a follow-up. + +### 6. Move reconnection out of the Flutter layer + +`stream_chat_flutter_core/lib/src/stream_chat_core.dart` (410 LOC) hand-rolls exactly core's +policy family: `StreamChatCoreState with WidgetsBindingObserver`, a `_ChatLifecycleManager`, +`_subscribeToConnectivityChange` over `Connectivity().onConnectivityChanged`, +`didChangeAppLifecycleState`, and `onConnectivityChanged → client.maybeReconnect()`. + +Core's equivalents are `InternetAvailabilityReconnectionPolicy(NetworkStateEmitter)` and +`BackgroundStateReconnectionPolicy(LifecycleStateEmitter)`, composed by +`ConnectionRecoveryHandler`. Core ships the `NetworkStateProvider` / `LifecycleStateProvider` +**interfaces only**. + +Implement both in `stream_chat_flutter_core` (see the README for why not `stream_core_flutter`) +and inject them into the handler. Note `stream_chat_flutter_core.dart:3` re-exports all of +`connectivity_plus` — keep the re-export, but this is itself a public change in that package. + +## Decisions to make + +- Where the **initial**-connect retry lives now that `ConnectionRecoveryHandler` won't do it. + Options: keep chat's loop in `connectUser`, or drive `RetryStrategy` manually there. +- Whether `WebSocket` (the class) is deleted or kept as a deprecated shell. It is not exported + from `stream_chat.dart`, so deletion is likely free — verify. +- Whether the sealed `WebSocketConnectionState` is exposed publicly in this phase or the next. + Exposing it means consumers can finally ask *why* a disconnect happened, which is the main win + for them. +- Whether `keepConnectionAliveInBackground` (a `ConnectionRecoveryHandler` flag) becomes a public + chat option. Today backgrounding behaviour is hard-coded in the Flutter layer. + +## Risks + +- **The highest-risk phase in the plan, and unit tests will not catch the failures.** Reconnection + bugs present as "messages stop arriving after the phone was in a tunnel", which no test suite + reproduces. Budget hand-verification (below). +- **`connectUser`'s contract changes shape internally** while its public signature stays. Any + behaviour that depended on the handshake `Event` being returned synchronously with the connect + future has to be re-derived from the emitter, and a subscription registered too late silently + misses `connection.ok`. +- **Ping cadence is not configurable.** `WebSocketHealthMonitor`'s `pingInterval` (25s) and + `timeoutThreshold` (3s) are constructed with defaults *inside* `StreamWebSocketClient` — there + is no knob. Chat's current `healthCheckInterval` differs. Upstream ask. +- **The error frame may be lost.** `ERROR_LAYER.md` mandates draining pending frames before + reacting to a close, because the server sends the error text frame *before* the close frame, and + the close code carries almost no signal (auth, token and permission failures all close 1000). + `StreamWebSocketEngine._onDone` closes immediately. Verify empirically whether chat's refusal + reasons survive; if they don't, that is an upstream fix, not a chat workaround. +- **`RetryQueue` must keep draining.** It listens for `EventType.connectionRecovered`. Confirm + that event is still emitted at the same moment relative to the new state machine, or queued + messages silently stop retrying. + +## Upstream `stream_core` work + +- Injectable `WebSocketHealthMonitor` cadence (`pingInterval`, `timeoutThreshold`) through + `StreamWebSocketClient`. +- Drain pending frames in `StreamWebSocketEngine` before reacting to a close, per `ERROR_LAYER.md`. + +## Definition of done + +- [ ] `Event extends WsEvent`, landed separately and ahead of the rest. +- [ ] `websocket.dart` and `timer_helper.dart` deleted. +- [ ] `ChatWsCodec` covers `connection.ok`, `health.check` and `connection.error`; a malformed + frame is logged and dropped without disconnecting. +- [ ] `connectUser` is rebuilt on `connectionState` observation, still returns `OwnUser`, and + still surfaces a failed connect as a thrown `StreamException` with a useful message. +- [ ] Initial-connect retry behaviour preserved, with its new home recorded here. +- [ ] `wsConnectionStatus` still works, deprecated, deriving from the sealed state; neither + Flutter package needed changes in this PR. +- [ ] `NetworkStateProvider` / `LifecycleStateProvider` implemented in `stream_chat_flutter_core` + and injected; `stream_chat_core.dart`'s hand-rolled lifecycle/connectivity code deleted. +- [ ] `RetryQueue` still drains on reconnect — asserted by a test, not assumed. +- [ ] **Test harness:** stub `WebSocketChannel.ready` / `stream` / `sink` off a **broadcast** + controller (broadcast specifically so the engine can re-listen after a disconnect) and + auto-reply `health.check`. `stream_feeds_test/helpers/web_socket_mocks.dart` and + `testers/base_tester.dart` are the template — they run the *real* core stack with only the + transport swapped, which is the level this phase needs. +- [ ] **Hand-verified in `sample_app`**, all six: cold connect; token expiry mid-session; + airplane mode off and on; backgrounding past the ping interval and returning; + server-initiated close; and a queued failed message draining after reconnect. +- [ ] `melos bootstrap && melos run analyze && melos run test:dart && melos run test:flutter`. +- [ ] `refactor(llc)!:` title, `🛑️ Breaking` CHANGELOG entries, `migrations/v11-migration.md` + Symbol Map rows for `ConnectionStatus` and `StreamWebSocketError`, plus a feature section on + the new connection state. +- [ ] Decisions recorded here, status box ticked in `README.md`. diff --git a/core-migration/08-query-dsl.md b/core-migration/08-query-dsl.md new file mode 100644 index 0000000000..46f5535604 --- /dev/null +++ b/core-migration/08-query-dsl.md @@ -0,0 +1,185 @@ +# 08 — Query DSL: filter, sort, comparable field + +**Goal:** adopt core's typed `Filter` / `Sort` / `ComparableField` so a chat query can be +evaluated client-side as well as sent to the server. + +**Size:** ~600 chat LOC deleted against ~1,420 core LOC. The widest public break after phase +[03](03-errors.md), and the one hard upstream block in the plan. + +## Scope + +| Delete | Adopt | +| --- | --- | +| `lib/src/core/models/filter.dart` (241) — `Filter`, `FilterOperator` | `stream_core` `query/filter/` — `sealed Filter`, `FilterField`, `FilterOperator` | +| `lib/src/core/api/sort_order.dart` (183) — `SortOrder`, `SortOption`, `NullOrdering` | `stream_core` `query/sort.dart` — `Sort`, `SortField`, `SortDirection`, `NullOrdering` | +| `lib/src/core/models/comparable_field.dart` (~85) | `stream_core` `utils/comparable_field.dart` (90) | +| `lib/src/core/models/location_coordinates.dart` | `stream_core` `query/filter/location/location_coordinate.dart` | +| `lib/src/core/models/predefined_filter.dart` (84) | reworked onto `FilterField` registries | + +`Filter` and `FilterOperator` are exported (`stream_chat.dart:52`) and appear in every +`queryChannels` / `queryUsers` / `queryMembers` signature. This is the phase consumers notice most +after the error layer. + +## The shape change that matters + +Ours is one class with stringly-typed addressing: + +```dart +class Filter extends Equatable { + final String? operator; // '$eq', '$in', ... + final String? key; // 'members', 'last_message_at', ... + final Object value; +} +``` + +Core's is a sealed hierarchy — 13 final subclasses across 5 sealed families (`ComparisonOperator`, +`ListOperator`, `ExistsOperator`, `EvaluationOperator`, `LogicalOperator`) — and it addresses +fields through a typed registry: + +```dart +class FilterField { + const FilterField(String remote, FilterFieldValueGetter value); +} +``` + +**The field carries a local value extractor**, which is the whole point: the same declaration +drives both the server query (`toJson()`) and client-side evaluation (`Filter.matches(T)`). So +every chat filterable field has to be declared once, typed: + +```dart +// sketch +class ChannelFilterField extends FilterField { + static final createdAt = ChannelFilterField('created_at', (c) => c.createdAt); + static final memberCount = ChannelFilterField('member_count', (c) => c.memberCount); + // ... +} +``` + +`stream_feeds/lib/src/state/query/` is the template — one file per queryable type, each declaring +`XQuery`, `typedef XFilter = Filter`, `XFilterField`, `XSort`, `XSortField` and a +`defaultSort`. + +That registry is the bulk of this phase's work, and it is also the payoff: client-side filtering is +something chat cannot do at all today. + +## The hard upstream block + +**Core lacks three operators chat exposes publicly:** + +| Ours | Wire | In core? | +| --- | --- | --- | +| `Filter.notEqual` | `$ne` | **no** | +| `Filter.notIn` | `$nin` | **no** | +| `Filter.nor` | `$nor` | **no** | + +Verified in `lib/src/core/models/filter.dart:17,35,53` and `:132,138`. These are in public use and +cannot be dropped. **This is the one genuine hard block in the whole plan** — land them in core +first, including `matches()` semantics for each (negation of the positive operator, with the +PostgreSQL-ish null handling core's `filter_operation_utils.dart` already establishes). + +Core has one we lack — `pathExists` `$path_exists` — which comes for free. + +## Escape hatches + +Ours has three with no core equivalent: + +| Ours | Options | +| --- | --- | +| `Filter.custom({value, operator, key})` | Keep chat-side as a `Filter` subclass, or drop | +| `Filter.raw({value})` | Same | +| `Filter.empty()` | Feeds' convention is a **nullable** filter meaning "everything", plus `extension MatchesExtensions { bool matches(Filter? f) => f == null || f.matches(this); }` — adopt that instead | + +`Filter.custom` and `Filter.raw` exist so consumers can query a field the SDK doesn't model. Under +a typed registry that is exactly the case `FilterField` can't express, so at least one of them +should survive — decide which, and note that a custom filter cannot support `matches()`. + +## Sort + +| Ours | Core | +| --- | --- | +| `typedef SortOrder = List>` | `Sort` + `extension CompositeComparator on Iterable>` | +| `SortOption.asc(String field)` / `.desc(String field)`, `static const ASC = 1 / DESC = -1` | `Sort.asc(SortField)` / `.desc(SortField)`, `enum SortDirection { asc(1), desc(-1) }` | +| field is a `String`, resolved at runtime via `ComparableFieldProvider.getComparableField(sortKey)` | field is a typed `SortField{remote, comparator}` | +| `SortOption.fromJson` (drops the comparator) | `createFactory: false` — no `fromJson` | + +`NullOrdering` and `CompositeComparator` exist in **both** packages by the same names → collision, +so our `sort_order.dart` must stop being exported in the same PR. + +**Per-field null-ordering defaults stay chat-side.** Ours are server parity, not preference: +`ChannelSortKey.pinnedAt` and `lastMessageAt` force `nullsLast` in *both* directions, where core's +defaults are the plain `asc → nullsLast` / `desc → nullsFirst`. Supply the right `nullOrdering` +from a thin chat-side factory per field. Cheaper than an upstream ask and it doesn't wait on a core +release. + +**`SortOption.fromJson` has no core equivalent.** Find out who calls it — if anything deserialises +a stored sort (a persisted channel-list configuration, for instance), that needs a chat-side +resolver mapping a remote name back to a `SortField`. + +## `ComparableField` is a semantic fork, not a rename + +| | Ours | Core | +| --- | --- | --- | +| Strings | routed through `normalizeStringForSort` (`core/util/string_sort_normalizer.dart`, 95 LOC — folds diacritics and ligatures: `Ł→l`, `Ø→o`, `Æ→ae`, case-insensitive) | plain `String.compareTo` | +| Incomparable types | returns **`0`** | **throws `ArgumentError`** | +| `ComparableFieldProvider` | ours, and 48 models implement it | absent | + +Adopting core's as-is silently changes channel and user name ordering (server parity lost) *and* +turns a benign `0` into a runtime throw. Neither is acceptable. Upstream a pluggable string +comparator — or `normalizeStringForSort` itself, which is generically useful — before adopting. + +The incomparable-types divergence is worth arguing upstream too: a throw is defensible in a +strict library, but it converts a cosmetic ordering glitch into a crash in a list view. + +## Decisions to make + +- Which escape hatches survive, and in what form. +- Whether `ComparableFieldProvider` survives. 48 models implement it; core has no such interface. + Under a typed `SortField` registry it may be unnecessary — but removing it touches every model. +- Whether `Filter` keeps a chat-side `typedef` per queryable type (`typedef ChannelFilter = + Filter`) as feeds does. It reads much better in public signatures. +- Whether `predefined_filter.dart` is rebuilt on the registry or dropped. +- Whether client-side `matches()` gets *used* anywhere in this phase, or is just enabled. Enabling + it is the cheap half; using it (e.g. deciding whether a new channel belongs in a filtered list, + the way feeds' handlers do) is a behaviour improvement that deserves its own change. + +## Risks + +- **Every query signature in the public API changes**, and `Filter` is one of the most-used types + in consumer code. The `dart fix` transforms from phase [10](10-cleanup.md) matter more here than + anywhere else — consider landing the kit before this phase rather than after. +- **Silent ordering regressions.** If `normalizeStringForSort` is lost, channel lists reorder for + any user with an accented name, and nothing fails. Golden-test it. +- **`toJson()` drift.** Core builds the same three JSON shapes ours does (`{$op: [...]}`, + `{key: {$op: value}}`, `{key: value}`), but "the same shapes" is not "the same output". Diff + every existing filter's serialisation before and after. +- The registry is mechanical but large — one entry per filterable field across channels, users, + members, messages, threads, drafts, polls and reminders. + +## Upstream `stream_core` work + +- **`Filter` `$ne` / `$nin` / `$nor`**, with `matches()` semantics. **Hard block.** +- A pluggable string comparator on `ComparableField` (or `normalizeStringForSort` upstreamed). +- Worth arguing: returning `0` rather than throwing for incomparable types. + +## Definition of done + +- [ ] Core ships `$ne` / `$nin` / `$nor` and chat is on that release. +- [ ] `filter.dart`, `sort_order.dart`, our `comparable_field.dart` and + `location_coordinates.dart` are deleted; `stream_chat.dart` exports core's via the + allowlist. +- [ ] A `FilterField` / `SortField` registry exists for every queryable type, with local + extractors. +- [ ] **Serialisation diff:** every filter and sort the SDK can build round-trips through + `toJson()` to byte-identical output against the pre-migration implementation. +- [ ] **A golden ordering test** over a list of accented and ligatured names proves + `normalizeStringForSort` behaviour survives. +- [ ] Per-field `NullOrdering` defaults preserved — asserted for `pinnedAt` and `lastMessageAt` in + both directions. +- [ ] Nothing throws where the old `ComparableField` returned `0` — asserted. +- [ ] `SortOption.fromJson` callers accounted for. +- [ ] `melos bootstrap && melos run analyze && melos run test:dart && melos run test:flutter`, + plus `stream_chat_persistence` tests if any stored query shape changed. +- [ ] `refactor(llc)!:` title, `🛑️ Breaking` CHANGELOG entries, `migrations/v11-migration.md` + Symbol Map rows and a feature section with before/after query examples — this is the section + consumers will actually read. +- [ ] Decisions recorded here, status box ticked in `README.md`. diff --git a/core-migration/09-uploads.md b/core-migration/09-uploads.md new file mode 100644 index 0000000000..4646ac298b --- /dev/null +++ b/core-migration/09-uploads.md @@ -0,0 +1,146 @@ +# 09 — Uploads & CDN + +**Goal:** use core's upload machinery — `StreamAttachmentUploader`, `AttachmentUploadTask`, +`AttachmentUploadBatch` — for progress, cancellation and batching, without retyping the models +Drift persists. + +**Size:** ~520 chat LOC in scope against ~1,400 core LOC. Gated on one decision, not on volume. + +> **Coordinate with [`openapi-migration/12-uploads-cdn.md`](../openapi-migration/12-uploads-cdn.md) +> before either starts.** That group owns the *endpoints*; this phase owns the *machine*. They +> overlap on `CdnClient` and on who writes the multipart calls, and they must not both do it. + +## Scope + +| Chat today | Core | +| --- | --- | +| `abstract AttachmentFileUploader` — **8 methods**: `sendImage` / `sendFile` / `deleteImage` / `deleteFile` (channel-scoped, each taking `Map? extraData`) and `uploadImage` / `uploadFile` / `removeImage` / `removeFile` (CDN-scoped) | `abstract interface CdnClient` — **4 methods**, CDN-scoped only, no `extraData` | +| `StreamAttachmentFileUploader` — thin `client.postFile` / `client.delete` wrappers | `StreamAttachmentUploader(cdn: CdnClient)` — returns running `AttachmentUploadTask`s | +| `AttachmentFileUploaderProvider = AttachmentFileUploader Function(StreamHttpClient)` — public pluggability, wired at `client.dart:102` | — | +| `@freezed sealed UploadState` — `Preparing` / `InProgress(uploaded, total)` / `Success` / `Failed(error: String)`, JSON-serialisable, **stored on the `Attachment` model** | `sealed AttachmentUploadState` — `UploadQueued` / `UploadPreparing` / `UploadInProgress(UploadProgress)` / `UploadSuccess` / `UploadFailed(StreamException)` / `UploadCancelled`, **stored on the task** | +| `AttachmentFile` — `@JsonSerializable`, nullable `path`, sync `size`, persisted to Drift | `AttachmentFile` — wraps `XFile`, non-nullable `path`, `Future size`, not serialisable | + +## The gating decision: channel-scoped uploads + +Half of chat's uploads are channel-scoped (`/chat/channels/{type}/{id}/file`) and carry +`extraData`. Core's `CdnClient` has no such concept. Two ways forward: + +**Option A — chat keeps its own uploader interface, uses core only for the task machinery.** +Keep `AttachmentFileUploader`'s 8 methods (retyped to return `Result`), implement a chat-side +`CdnClient` for the CDN-scoped half, and drive both through `StreamAttachmentUploader` for +progress/cancel/batch. No core release needed, no upstream negotiation, and the public +pluggability point survives in recognisable form. + +**Option B — core grows channel-scoped operations.** Cleaner long-term if video and feeds ever +need scoped uploads; today they don't, so it is chat-shaped API in a product-agnostic package — +exactly the leak the README's non-goals warn about. + +**Recommend A.** It is cheaper, it does not block on a core release, and `CdnClient` is explicitly +a pluggable seam — using it for the part that fits and not for the part that doesn't is the +intended use. Record the decision here before starting. + +## What core buys us either way + +`AttachmentUploadTask` gives chat things it has no way to express today: + +- `state` as a `StateEmitter` — observable progress with + `UploadProgress{sentBytes, totalBytes, fraction}`, and the task rescales dio's multipart byte + counts back onto the file's own length (dio reports the envelope, not the file). +- `result` as a `Future>` — **failures and cancellations arrive as + values, never thrown**. A cancelled upload settles as + `Result.failure(StreamNetworkException(isCancelled: true))`. +- `cancel()` per task. +- `uploadBatch(..., maxConcurrent: 3, eagerError: false)` → `AttachmentUploadBatch` with a sealed + `BatchUploadResult` (`BatchUploadCompleted` / `BatchUploadStoppedOnError` / `BatchUploadCancelled`) + and byte-weighted aggregate progress. + +Feeds' `utils/uploader.dart` shows the request-glue pattern: an `abstract interface +HasAttachments`, one batch across *all* of a request's attachments so `maxConcurrent` bounds +globally, then redistributing uploaded URLs back onto the request and leaving failures in place +for a retry. + +## Keep the models, add the API + +**Do not retype `AttachmentFile` or move `UploadState` off `Attachment`.** Core 0.5.0 deliberately +*removed* `StreamAttachment.uploadState` and moved state to the task — a good design for feeds, +and wrong for chat, because: + +- `AttachmentFile` is `@JsonSerializable` and persisted by `stream_chat_persistence` (Drift). + `path` nullable → non-nullable and `size` sync → `Future` are both breaking, and the schema + depends on the serialisable form. +- `UploadState` on `Attachment` is how the UI renders a half-uploaded attachment across an app + restart. Task state is in-memory and does not survive one. +- A model retype here is simultaneously a `stream_chat` break, a `ChatPersistenceClient` interface + break, and a Drift schema migration. Three for the price of one, for no user-visible gain. + +So expose the task-based API **additively**: `StreamAttachmentUploader` drives the upload and its +task state is *mirrored onto* `Attachment.uploadState` for persistence and rendering. That keeps +the existing surface working and adds progress and cancellation on top. + +## Multipart stays hand-written + +The spec declares uploads as `multipart/form-data`, but the generated `uploadFile` / +`uploadChannelFile` take a JSON `@Body()` with no progress and no cancellation — unusable. Feeds +hit the same wall and hand-wrote `CdnApi` +(`stream_feeds/lib/src/cdn/cdn_api.dart`) as a retrofit interface using `@MultiPart()`, +`@SendProgress()` and `@CancelRequest()` over the generated *response* models. + +Do the same. `openapi-migration/12-uploads-cdn.md` already reaches this conclusion; this is the +phase that acts on it. A generator fix is worth filing upstream (see the `openapi-codegen` skill) +but is not a prerequisite. + +## Decisions to make + +- **Option A or B**, above. Nothing else in the phase can be scoped until this is settled. +- Whether `AttachmentFileUploaderProvider` is retyped (`AttachmentFileUploader Function(Dio)` once + phase [05](05-http-client.md) removes `StreamHttpClient`) or replaced by a `CdnClient` injection + point à la `FeedsConfig.cdnClient`. Either way it is a break for anyone with a custom uploader, + and phase 05 already deprecates the type in its signature. +- Whether `UploadState` gains a `cancelled` variant to mirror `UploadCancelled`. Today a cancelled + upload has nowhere to land, which is why cancellation is invisible in the UI. +- Whether progress and cancellation become public API in this phase or stay internal until the UI + uses them. + +## Risks + +- **The highest-traffic path in the SDK.** Every image, file, video and voice recording goes + through it, and a regression is immediately visible to every user. +- **Cancellation semantics differ.** Core's task settles a cancelled upload as a `Failure` + carrying `isCancelled: true`; chat currently treats cancellation as a thrown + `DioException`/`StreamChatNetworkError` with `isRequestCancelledError`. Every call site that + distinguishes cancel-from-error changes. +- **Persistence.** If anything about `Attachment` or `AttachmentFile` serialisation shifts, + `stream_chat_persistence`'s Drift schema needs a migration — the reason the keep-the-models + decision above is firm. +- Byte-count rescaling: if the task's rescaling and chat's existing progress reporting disagree, + progress bars jump. Verify against a large file, not a small one. + +## Upstream `stream_core` work + +None under Option A. Under Option B: channel-scoped `CdnClient` operations with `extraData`. + +Worth filing regardless: the generator emitting JSON bodies for `multipart/form-data` operations. + +## Definition of done + +- [ ] Option A/B decided and recorded, with the reason. +- [ ] A chat `CdnClient` implementation exists over a hand-written multipart retrofit interface + with `@MultiPart()` / `@SendProgress()` / `@CancelRequest()`. +- [ ] Uploads run through `StreamAttachmentUploader`; task state is mirrored onto + `Attachment.uploadState`. +- [ ] `AttachmentFile` and the Drift schema are **unchanged** — asserted by + `stream_chat_persistence`'s tests passing without a migration. +- [ ] Progress reported correctly for a large file (>10 MB) — the rescaling check, verified against + real byte counts rather than a mock. +- [ ] A cancelled upload mid-flight settles as a cancellation, not an error, everywhere it is + observed. +- [ ] A batch upload with one failing member behaves per the chosen `eagerError` setting, and the + survivors keep their URLs. +- [ ] `melos bootstrap && melos run analyze && melos run test:dart && melos run test:flutter`, + plus `stream_chat_persistence` tests. +- [ ] Hand-verified in `sample_app`: multi-attachment send, cancel mid-upload, upload failure and + retry, and an app restart with a half-uploaded attachment. +- [ ] `refactor(llc)!:` title, `🛑️ Breaking` CHANGELOG entries, `migrations/v11-migration.md` + Symbol Map rows plus a File Upload feature section — the guide already promises one. +- [ ] Decisions recorded here, status box ticked in `README.md`, and + `openapi-migration/12-uploads-cdn.md` updated to point at what this phase settled. diff --git a/core-migration/10-cleanup.md b/core-migration/10-cleanup.md new file mode 100644 index 0000000000..8d8515511c --- /dev/null +++ b/core-migration/10-cleanup.md @@ -0,0 +1,148 @@ +# 10 — Cleanup: dependencies, barrel, deprecation kit + +**Goal:** collect the debts the earlier phases deliberately left behind — dependencies that are +now transitive, a barrel that grew narrower, and the deprecations that need a `dart fix` path. + +**Size:** no new behaviour. This is the phase that makes the upgrade tolerable for consumers. + +## Scope + +### Dependencies + +`stream_core` re-exports all of `dio` and depends on the transport packages itself, so several of +chat's direct dependencies become redundant as phases 04–07 land. Drop them from +`packages/stream_chat/pubspec.yaml` — **by editing `melos.yaml`'s `command.bootstrap.dependencies` +block and running `melos bootstrap`**, never the package manifest directly. + +| Dependency | Retired by | Note | +| --- | --- | --- | +| `dio: ^5.11.0` | 05 | Core re-exports all of dio and declares `^5.8.0+1`. Watch the skew when either moves. | +| `web_socket_channel: ^3.0.3` | 07 | Core owns the engine. | +| `jose: ^0.3.5+1` | 04 | Only `Token` parsed JWTs; `UserToken` does it in core. | +| `logging: ^1.3.0` | 06 | Only after the bridge's deprecation cycle expires — not in the same release. | +| `equatable: ^2.0.8` | — | Verify: our models may still use it directly. | +| `diacritic: ^0.1.6` | 08 | Only if `normalizeStringForSort` moved upstream. | + +`rate_limiter` **stays** — `RetryQueue` uses its `backOff`, and `RetryPolicy` / `RetryQueue` are +staying chat-side. `synchronized`, `collection`, `mime`, `http_parser`, `rxdart`, `meta`, +`freezed_annotation`, `json_annotation`, `retrofit`, `uuid` and `async` are unaffected. + +Run `melos run lint:pub` (or a `pub deps` pass) to confirm nothing was dropped that is still +imported — a package that resolves transitively today will break the day core drops it. + +### Barrel + +`lib/stream_chat.dart` re-exports five packages wholesale-or-narrowed: + +```dart +export 'package:async/async.dart'; // wholesale +export 'package:dio/dio.dart' show DioException, DioExceptionType, RequestOptions, CancelToken, + Interceptor, InterceptorsWrapper, MultipartFile, Options, ProgressCallback; +export 'package:logging/logging.dart' show Logger, Level, LogRecord; +export 'package:rate_limiter/rate_limiter.dart'; // wholesale +export 'package:uuid/uuid.dart'; // wholesale +``` + +Three of those are wholesale re-exports of packages whose types are almost certainly incidental to +chat's API. Removing a re-export is breaking for anyone who relied on it transitively, so this is +the right phase for it — one break, one migration entry, alongside everything else. + +- `package:async` — check whether any public signature actually mentions an `async` type. +- `package:rate_limiter` — `RetryPolicy` is public, so some of this may be load-bearing. Narrow to + a `show` list rather than dropping. +- `package:uuid` — almost certainly incidental. +- `package:dio` — already narrowed, but reconcile it with core's wholesale dio re-export so + consumers don't get two dio surfaces with different shapes. +- `package:logging` — drops with phase 06's deprecation cycle. + +End state: every package re-export in the barrel is a `show` allowlist, consistent with the +decision in the README and with `filter.dart show Filter, FilterOperator` already in the file. + +### The deprecation kit + +**This is the most valuable part of the phase, and it does not exist in chat today.** There is no +`packages/stream_chat/lib/fix_data.yaml` and no `test_fixes/`. `lib/stream_chat.dart` exposes +**202 public top-level declarations**, and this plan renames dozens of them. + +`stream_feeds` solves it with two artifacts: + +- **`lib/src/generated_typedefs.dart`** — `@Deprecated` `typedef` aliases from every old name to + its new one, so old code keeps compiling with a warning that names the replacement. +- **`lib/fix_data.yaml`** — 58 data-driven `dart fix` transforms, so `dart fix --apply` performs + the rename mechanically in consumer code. + +Build both here, covering every rename from phases 01–09. The highest-value transforms: + +| From | To | Phase | +| --- | --- | --- | +| `CurrentPlatform.name` | `.operatingSystem` | 02 | +| `StreamChatNetworkError` | `StreamApiException` | 03 | +| `ChatErrorCode` | `StreamErrorCode` | 03 | +| `Token` | `UserToken` | 04 | +| `TokenProvider` (closure) | `TokenProvider.dynamic(...)` | 04 | +| `tokenManager.loadToken()` | `.getToken()` | 04 | +| `StreamHttpClient` | (removed) | 05 | +| `ConnectionStatus` | `WebSocketConnectionState` | 07 | +| `SortOption.asc('field')` | `Sort.asc(XSortField.field)` | 08 | + +Note the last one cannot be a pure `dart fix` rename — a string becomes a typed field reference. +Those get a `@Deprecated` forwarder and a migration-guide example instead; don't force a transform +that can't be correct. + +**Wire `test_fixes/` and exercise it.** Feeds ships `fix_data.yaml` with **no** `test_fixes/` +directory, so its transforms are never verified — `melos run test:fixes` is gated on +`dirExists: test_fixes` and silently skips. Do not copy that gap: + +1. Add `packages/stream_chat/test_fixes/` with a `.dart` file and a `.dart.expect` golden per + transform group. +2. Add a `test:fixes` script to `melos.yaml` running `dart fix --compare-to-golden`. +3. Wire it into CI alongside `analyze`. + +An unverified transform is worse than none: it runs on consumer code and gets it wrong. + +## Decisions to make + +- Which of the three wholesale package re-exports are dropped versus narrowed, based on the + public-signature audit. +- Whether the deprecation kit lands **here** or **before phase 08**. Phase 08 renames the + most-used types in consumer code (`Filter`, `SortOption`), so having transforms ready when it + lands is worth more than having them collected neatly at the end. Strong argument for splitting + the kit out early and appending to it per phase. +- How long the deprecation cycle is. Every `@Deprecated` here has to name the release that removes + it, and v11 is the release that *earns* the right to remove v10 deprecations — don't let the two + sets blur. + +## Risks + +- **Dropping a re-export is invisible until a consumer upgrades.** Nothing in this repo fails; an + app that used `Uuid` via `package:stream_chat` just stops compiling. The migration guide entry + is the only mitigation. +- **A wrong `dart fix` transform edits consumer code incorrectly** — worse than no transform. + Hence the golden tests. +- Deprecated forwarders that are never removed become permanent API. Name the removal release in + every `@Deprecated` message. + +## Upstream `stream_core` work + +None. + +## Definition of done + +- [ ] Redundant dependencies removed via `melos.yaml`, and `melos bootstrap` reproduces a clean + resolve. Nothing still-imported was dropped. +- [ ] Every package re-export in `lib/stream_chat.dart` is a `show` allowlist, or is gone. +- [ ] `packages/stream_chat/lib/fix_data.yaml` covers every mechanical rename from phases 01–09. +- [ ] `@Deprecated` forwarders exist for the renames that cannot be transformed, each naming its + removal release. +- [ ] `packages/stream_chat/test_fixes/` exists with a golden per transform group, and + `melos run test:fixes` passes and **runs in CI** — verified by making a transform wrong on + purpose and watching CI fail. +- [ ] `dart fix --apply` run against `sample_app` pinned to the previous version, producing + compiling code. +- [ ] `migrations/v11-migration.md` is complete: every Symbol Map row filled, every feature + section written, the Migration Checklist accurate, and the "For AI Agents" section reflecting + the final shape. +- [ ] The five pana jobs in `.github/workflows/pana.yml` are green (they were re-enabled when + this directory was created; confirm they still pass). +- [ ] `melos bootstrap && melos run lint:all && melos run test:all`. +- [ ] Every phase's status box ticked in `README.md`. diff --git a/core-migration/README.md b/core-migration/README.md new file mode 100644 index 0000000000..f6898b606b --- /dev/null +++ b/core-migration/README.md @@ -0,0 +1,213 @@ +# Migrating `stream_chat` onto `stream_core` + +The plan for moving the low-level client's **foundation** — HTTP, errors, token/auth, WebSocket +transport, uploads, query DSL, logger, platform detection, utils — off its hand-written +implementations and onto `stream_core`, the shared package `stream_feeds` is already built on. + +One file per phase, in the order they should land. Each carries a goal, the exact types in scope +with their core counterparts, the decisions that phase has to make, its risks, the upstream +`stream_core` work it needs, and a definition of done. + +| | Phase | Chat LOC | Core LOC | Breaking | Status | +| --- | --- | --- | --- | --- | --- | +| [01](01-utilities.md) | Utilities — in-flight cache, list extensions | ~340 | ~200 | decision | ◐ | +| [02](02-platform-and-environment.md) | Platform detector & system environment | ~220 | ~300 | yes (rename) | ☐ | +| [03](03-errors.md) | Errors & the `Result` surface | ~410 | ~900 | **yes** | ☐ | +| [04](04-token-and-auth.md) | Token & auth | ~225 | ~500 | **yes** | ☐ | +| [05](05-http-client.md) | HTTP client & interceptor pipeline | ~600 | ~150 | yes | ☐ | +| [06](06-logger.md) | Logger | — | ~670 | **yes** | ☐ | +| [07](07-websocket.md) | WebSocket transport | ~790 | ~1,940 | **yes** | ☐ | +| [08](08-query-dsl.md) | Query DSL — filter, sort, comparable field | ~600 | ~1,420 | **yes** | ☐ | +| [09](09-uploads.md) | Uploads & CDN | ~520 | ~1,400 | yes | ☐ | +| [10](10-cleanup.md) | Cleanup — deps, barrel, deprecation kit | — | — | no | ☐ | + +Status key: ☐ not started · ◐ partly landed · ☑ done. + +**Net:** ~4.0k LOC of hand-written `lib/src` deleted (of ~29.0k), replaced by ~5.5k LOC of core +that is already written and tested. Six direct dependencies become transitive. + +**In progress:** phase 01's `InFlightCache` has landed. `list_extensions` is held back pending a +performance comparison — core's `merge` is a keyed-map-merge-then-sort where ours is a two-pointer +merge, and it runs on every message, member and read update. `stream_chat_dio_error` moved into +phase [03](03-errors.md), which is where its payload type becomes a `StreamException`. + +## Scope + +**In scope: the foundation `stream_core` owns.** Every subsystem where chat has a second +implementation of something core already ships. + +**Out of scope: the endpoint and DTO migration.** That is [`openapi-migration/`](../openapi-migration/README.md) +— 12 feature groups moving 109 hand-written methods onto the generated client. The two tracks are +independent by design; phase [05](05-http-client.md) is what keeps them so, and phase +[03](03-errors.md) owns the error/`Result` slice that `openapi-migration/01-foundation.md` +previously claimed. + +**Out of scope: architectural parity with `stream_feeds`.** Feeds is repositories + `*Data` models ++ `StateNotifier` state objects + a `StateUpdateEvent` domain bus. `StreamChatClient`, `Channel`, +`ChannelClientState`, `ChatPersistenceClient`, `Event` and all 48 public models **stay as they +are**. Adopting feeds' layout would be a ~15k-LOC rewrite plus a Drift schema migration, and it +buys nothing this plan is after. + +**Out of scope: moving the WebSocket to v2.** Phase [07](07-websocket.md) adopts core's WS +*machinery* on the existing **v1** protocol and v1 event shapes. See that file for why this is +possible; it is the finding that un-deferred the phase. + +## Goals + +1. **One implementation of each foundation concern**, so a fix to token refresh or reconnection + lands once for every Stream product rather than once per SDK. +2. **Errors from `stream_core`**, so a Flutter integrator handling a Stream error handles it the + same way in chat, feeds and video. +3. **Stop the drift.** Six of these subsystems are near-verbatim forks of core, and they have + already diverged in ways that are bugs on our side — core's `AuthInterceptor` has a + retry-loop guard, a user-switch guard and a `FormData` re-clone that ours lacks. +4. **An upgrade path that is boring**, because every break appends to + `migrations/v11-migration.md` and ships a `dart fix` transform as it lands. + +## Non-goals + +- Rewriting our public models. Chat's `User`, `Event`, `AttachmentFile` and the rest are richer + than core's lowest-common-denominator versions or are persisted to Drift. See + [Decisions inherited by every phase](#decisions-inherited-by-every-phase). +- Exporting `stream_core` wholesale from `lib/stream_chat.dart`. Feeds does; we cannot. +- Moving chat-specific machinery into core. `RetryPolicy` / `RetryQueue`, `PaginationParams`, + `ConnectionIdManager`, `EventType` and `Serializer` stay here. + +## Order, and why + +**01–03 are strictly sequential. Once [03](03-errors.md) lands, 04–09 can each proceed on their +own.** [10](10-cleanup.md) is last by definition. + +The order runs cheapest-and-invisible → breaking-but-isolated → breaking-and-entangled, so the +pattern is proven on surfaces nobody sees before it reaches the WebSocket and the query DSL: + +- **01** touches no public signature and one of its two files already carries a TODO asking for + exactly this. It is the pattern-proving slice. +- **02** is the first rename, on a surface almost nobody imports. +- **03** is the keystone: the sealed `StreamException` family replaces our error tree, and + everything downstream assumes it. +- **04–06** are each self-contained, and each is one clear break with one clear migration entry. +- **07** and **08** are the two substantial phases. 07 rewrites `connectUser` around state + observation; 08 requires declaring every filterable field as a typed `FilterField`. +- **09** is gated on a decision (whether core grows channel-scoped CDN ops) rather than on volume, + and it has to agree with `openapi-migration/12-uploads-cdn.md` before either starts. + +## Decisions inherited by every phase + +Decided once here, not re-argued per phase. + +### The barrel is a `show` allowlist + +`stream_feeds` opens its barrel with `export 'package:stream_core/stream_core.dart';`. **We +cannot.** Exporting core wholesale from `lib/stream_chat.dart` collides on `AttachmentFile`, +`Filter`, `FilterOperator`, `NullOrdering`, `ComparableField`, `CurrentPlatform`, `PlatformType`, +`SystemEnvironment`, `SystemEnvironmentManager`, `XStreamClientHeaderExtension`, `TokenManager`, +`AuthType`, `User`, `LoggingInterceptor`, `InterceptStep`, `LogPrint`, `AuthInterceptor`, +`ConnectionIdInterceptor`, `InFlightCache`, and `Success` — the last being chat's +`UploadState.success` variant class against core's `Result` `Success`. Core also re-exports all +of dio, while our barrel deliberately re-exports a *narrowed* dio. + +Narrowing is already the precedent in that file: `filter.dart show Filter, FilterOperator` +(`stream_chat.dart:52`) and `device_api.dart show PushProvider`. + +### What stays ours + +| Type | Why | +| --- | --- | +| `User` / `OwnUser` | Ours is far richer and `implements ComparableFieldProvider`. Record the decision in `openapi-migration/09-users.md`. | +| `AttachmentFile` | Ours is `@JsonSerializable` and persisted to Drift; core's wraps `XFile` with async `size` and non-nullable `path`. | +| `ConnectionIdManager` | Connection-id is threaded into request *semantics*, not just headers — `client.dart:774` and `:907` early-return on `hasConnectionId`, `:1071` uses it to pick a query parameter. It cannot collapse into core's `ConnectionIdGetter` closure whatever core ships. Keep the manager; feed core's interceptor from it. | +| `Event`, `EventType`, `event_resolvers.dart`, `EventController` | Chat's event vocabulary. Phase 07 makes `Event extend WsEvent`; it does not replace it. | +| `RetryPolicy`, `RetryQueue` | Request-level message retry. Core has none, and `RetryQueue` closes over `Channel`, `client.retryPolicy` and `EventType.connectionRecovered`. | +| `PaginationParams` | Core has no pagination type at all. | +| `Serializer`, `message_rules.dart`, `AppSettingsManager` | Chat domain. | + +### Where the Flutter-side providers live + +`NetworkStateProvider` and `LifecycleStateProvider` are **interfaces only** in core; it ships no +implementations. Implement them in **`stream_chat_flutter_core`**, which already has the +`connectivity_plus` + `WidgetsBindingObserver` code that phase 07 replaces. + +Not in `stream_core_flutter`: that package is a design system with zero client coupling — no WS, +HTTP or token types anywhere in its public API — and putting transport providers there destroys +the property. It is the eventual right home; it is not this plan's job to move it there. + +### Upstream core work is batched, not blocking + +Each phase names the `stream_core` changes it needs, and those should be grouped into as few core +releases as possible. Only one is a hard block on API we already ship publicly: `Filter`'s +`$ne` / `$nin` / `$nor` operators, for phase [08](08-query-dsl.md). + +Cross-repo workflow is in [`STYLE_GUIDE.md`](../STYLE_GUIDE.md) (§Dependency management): a path +dependency while both repos change together, back to a hosted constraint in `melos.yaml` before +release. Never edit a package's `pubspec.yaml` constraints directly. + +## Prerequisites + +**None. This can start today**, which contradicts what the two existing docs say. Verified against +the tree rather than the docs: + +- `melos.yaml:108` declares `stream_core: ^0.5.0` **hosted**. There are zero `stream_core` entries + in any `dependency_overrides` block — the five that exist are path overrides for sibling chat + packages. `packages/stream_chat/.dart_tool/package_config.json` resolves `stream_core` to + `~/.pub-cache/hosted/pub.dev/stream_core-0.5.0`. The 8-place git pin the `openapi-codegen` skill + describes has been collapsed. +- `stream_core` 0.5.0 shipped both the sealed error layer (core #168) and the + `AttachmentUploadTask` API (core #170), so nothing in phases 03 or 09 waits on a core release. +- `lib/open_api/api/default_api.dart:783` already calls `runApiSafely`, not `runSafely`. +- The two `if: false` jobs in `.github/workflows/pana.yml` were justified by a git-vs-hosted + `stream_core` solve that can no longer happen: probing each package standalone, without the + `dependency_overrides` melos generates, both resolve and pull `stream_core 0.5.0` hosted from + pub.dev. **Re-enabled** in the same PR that creates this directory. Note that this verified the + *resolve*, not the score — those jobs gate on `min_score: 100`, so confirming they actually pass + needs a CI run (carried in phase [10](10-cleanup.md)'s definition of done). + +## How to execute a phase + +Read this README, then the phase file, then `stream-core-flutter/ERROR_LAYER.md` if the phase +touches errors or the WebSocket — it is normative and nothing in this repo references it. + +`stream_feeds` is the worked example for every phase. The files worth reading before you start: + +| For | Read | +| --- | --- | +| Client assembly, interceptor order, connect/disconnect/dispose lifecycle, guest exchange | `stream_feeds/lib/src/client/feeds_client_impl.dart` | +| The WS codec and the events the spec doesn't define | `stream_feeds/lib/src/ws/feeds_ws_event.dart`, `ws/events/events.dart` | +| A `CdnClient` implementation and a hand-written multipart retrofit interface | `stream_feeds/lib/src/cdn/` | +| `FilterField` / `SortField` registries with local value extractors | `stream_feeds/lib/src/state/query/` | +| Testing a real client with only the transport mocked | `stream_feeds_test/helpers/`, `testers/base_tester.dart` | +| The rename soft-landing kit | `stream_feeds/lib/src/generated_typedefs.dart`, `lib/fix_data.yaml` | + +Consumer-facing changes go in `migrations/v11-migration.md` **in the same PR that makes them** — +the guide is written as the work happens, not reconstructed at release. One phase per PR, titled +`refactor(llc)!:` when it breaks. Close the loop by ticking the phase's definition of done and its +status box in the table above. + +--- + +## Which PR lands which phase + +**The status column above describes the finished stack, not the PR you are reading it in.** The +work ships as six stacked PRs and the phase numbering does not line up with them: a phase can +split across two PRs, and one PR can carry three phases. So a phase marked ☑ may describe code +that lands above the rung you are looking at — at the first rung, none of phase 01 is present yet. + +| Phase | Lands in | +| --- | --- | +| 01 Utilities | in-flight cache in **#2956**; list extensions in **#2959** | +| 02 Platform & environment | `SystemEnvironment` in **#2956**; platform detector in **#2960** | +| 03 Errors | error layer in **#2956**; old tree deleted, sealed family in **#2960** | +| 04 Token & auth | **#2956** | +| 05 HTTP client & interceptors | **#2956**, partially — see the phase doc | +| 06 Logger | **#2956** | +| 07 WebSocket | parked; nothing lands | +| 08 Query DSL | `Sort` in **#2957**; `Filter` in **#2958**; `LocationCoordinate` and the sort normalizer in **#2959** | +| 09 Uploads · 10 Cleanup | not started | + +Two consequences worth knowing before reading a phase doc against the code: + +- **A phase doc is accurate about the stack, not about its own PR.** Checking a ☑ against the rung + you are on will mislead you; check it against the tip. +- **`stream_chat_dio_error` (01) and the precondition-throw reclassification (03) never landed at + all.** They are tracked in [DEFERRED.md](DEFERRED.md), which is the authority on what is still + outstanding. diff --git a/openapi-migration/01-foundation.md b/openapi-migration/01-foundation.md index c3dab42fd2..5e92f81a27 100644 --- a/openapi-migration/01-foundation.md +++ b/openapi-migration/01-foundation.md @@ -1,63 +1,19 @@ # 01 — Foundation +> **The error layer and the `Result` surface are now owned by +> [`core-migration/03-errors.md`](../core-migration/03-errors.md)**, which covers them as part of adopting +> `stream_core` wholesale. Track that phase rather than re-deriving the work here. This group covers the +> `DefaultApi` wiring and the `User` shape decision. + **Goal:** land everything that every feature group depends on, so no group has to invent it. Nothing user-visible migrates in this phase. -Feature groups can run in parallel once this is done. Until it is, they will each reinvent the same four things +Feature groups can run in parallel once this is done. Until it is, they will each reinvent the same two things differently. ## Scope -### 1. The `Result` surface - -Public API methods return `Future>` instead of throwing, matching `stream_feeds`. - -- Re-export from `lib/stream_chat.dart` with a `show` allowlist: - `show Result, Success, Failure, StreamException, StreamApiException, StreamNetworkException, - StreamAuthenticationException, StreamClientException, StreamApiError, StreamErrorCode`. -- **Not** a wholesale `export 'package:stream_core/stream_core.dart';` — core re-exports all of dio plus its own - `AttachmentFile`, which collides by name with the `AttachmentFile` our barrel already exports. - -### 2. Errors come from `stream_core` - -`stream_core`'s error layer is a sealed `StreamException` family, so `Failure.error` is always one of four things -and never a transport type: - -```text -StreamApiException statusCode, code (StreamErrorCode), moreInfo, unrecoverable, retryAfter, apiError -StreamNetworkException isCancelled, isTimeout, closeCode -StreamAuthenticationException -StreamClientException our own bug, or a body that would not decode (original kept as `cause`) -``` - -Two pieces make that guarantee, and both are prerequisites rather than things this repo writes: - -- **`runApiSafely`** (core) is what the generated client's call adapter must use. It maps a `DioException` through - `toStreamException()`, keeps a `StreamException` as raised, and wraps everything else — including the `TypeError` - from an undecodable response body — in a `StreamClientException`. The older `runSafely` did none of this. -- **`ApiErrorInterceptor`** on the Dio behind `DefaultApi`, as before. - -There is no error-translation layer. Do not map to `StreamChatNetworkError` — that is the hand-written layer this -migration exists to delete. - -**`ChatErrorCode` is superseded.** Core ships `StreamErrorCode`, an `extension type const StreamErrorCode(int) -implements int` with named constants. Drop our 25-entry enum rather than re-expressing it; check `StreamErrorCode` -before adding a constant anywhere. - -Core carried `isRetriable` and a `RetryPolicy` at one point and no longer does, so retry classification stays -ours for now. Check `stream_core` before writing one — this is the kind of thing that lands there. - -This resolves what was previously an open question here (`StreamDioException` versus `HttpClientException`): both -are gone. `client_exception.dart` was deleted in core's error-layer rework, and the answer is the sealed -`StreamException` — flat, dio-free, and the direct analogue of iOS's `ClientError` and Android's -`Error.NetworkError`. - -**Sequencing.** The error layer lives on core's `feat/error-layer` branch and is not on `main` yet, so our pinned -ref (`f83b5d4`) does not have it. Order: core's branch merges → core releases → we move the pin (and the pin -collapses to a hosted constraint) → the generator's `client.tpl` switches `runSafely` → `runApiSafely` → we -regenerate. Until the template changes, a regenerated client still hands back raw `DioException`s. - -### 3. Where `DefaultApi` is constructed +### 1. Where `DefaultApi` is constructed `DefaultApi(Dio)` needs a Dio. `StreamHttpClient.httpClient` is `@visibleForTesting` and `StreamHttpClient` is publicly exported, so `DefaultApi(client.httpClient)` fails `melos run analyze` with @@ -66,7 +22,7 @@ publicly exported, so `DefaultApi(client.httpClient)` fails `melos run analyze` - an `@internal` accessor on `StreamHttpClient`, or - build `DefaultApi` once in `StreamChatApi` and inject it into each `*_api.dart`. -### 4. Freeze the `User` shape decision +### 2. Freeze the `User` shape decision `User` and `OwnUser` are embedded in nearly every response in the SDK, so the keep-vs-adopt decision cannot wait for group 09 — a poll vote, a channel member and a message all carry a user. Decide it here, write it down, and @@ -75,30 +31,24 @@ let group 09 merely execute it. The same applies, in a smaller way, to the channel shape embedded in threads (group 07) versus the channels group (group 11). +## Prerequisites + +- **The generator's `client.tpl` calls `runApiSafely`, not `runSafely`.** Until it does, a regenerated client + hands back raw `DioException`s instead of the sealed `StreamException` family that + [`core-migration/03-errors.md`](../core-migration/03-errors.md) lands — see the `openapi-codegen` skill. + ## Decisions to make -- Which of the four items above are one PR and which are separate. The `Result` surface is mechanical but touches - every public signature; the interceptor and `DefaultApi` wiring are small and internal. -- Whether `StreamChatNetworkError` is deprecated or deleted in v11. It must survive the transition because every - unmigrated endpoint still throws it, but it becomes dead code once the last group lands. +- Whether the `DefaultApi` wiring and the `User` shape decision land as one PR or two. The wiring is small and + internal; the `User` decision is the one every later group reads. ## Risks -- The `Result` surface is the single largest breaking change in v11 and cannot be done per-feature without leaving - the public API in two styles at once. Sequence it deliberately. -- `stream_chat` cannot be published while `stream_core` is a git dependency, and the generated client needs - `StreamDateTimeConverter`, which is not in the last published `stream_core`. **A `stream_core` release is a - prerequisite for shipping any of this** — see the `openapi-codegen` skill. +- The `User` shape is frozen here but executed in [09](09-users.md), and every group in between assumes it. + Reversing it late means re-touching every group that has already landed. ## Definition of done -- [ ] Re-enable the `stream_chat_flutter` and `stream_chat_localizations` jobs in `.github/workflows/pana.yml`, - disabled because pana resolves each package standalone and cannot solve git-vs-hosted `stream_core`. -- [ ] `Result` and the core error types are exported from `lib/stream_chat.dart` via a `show` allowlist. -- [ ] `ApiErrorInterceptor` is installed on the Dio backing `DefaultApi`, and the call adapter uses - `runApiSafely`; a test asserts a failed call yields a `Failure` carrying a `StreamApiException` with a - parsed `.apiError`, and a malformed body yields a `StreamClientException`. - [ ] `DefaultApi` construction is settled in one place, with no `invalid_use_of_visible_for_testing_member`. - [ ] The `User` / `OwnUser` decision is written into `09-users.md`. -- [ ] `migrations/v11-migration.md` Error Handling section matches what actually shipped. - [ ] `melos run analyze` clean, `melos run test:dart` green. diff --git a/openapi-migration/README.md b/openapi-migration/README.md index cd78452dba..36dbd9ab6d 100644 --- a/openapi-migration/README.md +++ b/openapi-migration/README.md @@ -6,9 +6,13 @@ The plan for moving the low-level client off its hand-written HTTP layer and ont One file per feature group, in the order they should land. Each carries a goal, the exact hand-written methods and generated operations in scope, the decisions that group has to make, its risks, and a definition of done. +> **Related plan:** [`core-migration/`](../core-migration/README.md) moves the low-level client's *foundation* +> (HTTP, errors, token/auth, WebSocket, uploads, query DSL, logger) onto `stream_core`. It owns the error layer and +> the `Result` surface that group 01 below previously claimed. The two tracks are otherwise independent. + | | Group | Hand-written | Generated ops | Status | | --- | --- | --- | --- | --- | -| [01](01-foundation.md) | Foundation — `Result`, errors, wiring | — | — | ☐ | +| [01](01-foundation.md) | Foundation — `DefaultApi` wiring, `User` shape | — | — | ☐ | | [02](02-devices-and-push-preferences.md) | Devices & Push Preferences | 4 | 4 | ☐ | | [03](03-user-groups.md) | User Groups | 8 | 8 | ☐ | | [04](04-roles-guest-and-app.md) | Roles, Guest & App Settings | 4 | 5 | ☐ | @@ -51,8 +55,9 @@ one group. Verified mechanically — see [Keeping this plan honest](#keeping-thi maintaining two shapes forever) or consistency with our other products. Not for cosmetics. - **Every break ships four artifacts**: `refactor(llc)!:` title, `🛑️ Breaking` CHANGELOG entry, a Symbol Map row plus feature section in `migrations/v11-migration.md`, and the reason in the PR body. -- **Decide once, at the right level.** Cross-cutting shapes — `User`, errors, `Result` — are decided in - [01-foundation](01-foundation.md), not re-argued per group. +- **Decide once, at the right level.** The `User` shape is decided in [01-foundation](01-foundation.md), not + re-argued per group. Errors and `Result` are decided in + [`core-migration/03-errors.md`](../core-migration/03-errors.md). ## Order, and why @@ -72,9 +77,9 @@ surfaces before it reaches `Message` and `ChannelState`: ## Prerequisites -- **A `stream_core` release.** `stream_chat` cannot be published while `stream_core` is a git dependency, and the - generated client needs `StreamDateTimeConverter`, which is not in the last published version. - **The generated client committed and building** — it is, in `lib/open_api/`. +- **The generator's `client.tpl` calling `runApiSafely`, not `runSafely`** — see + [01-foundation](01-foundation.md#prerequisites). ## How to execute a group From afd6883823b2b17ab5fe3a5999c682f133bde61b Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Tue, 15 Sep 2026 16:38:48 +0200 Subject: [PATCH 03/36] refactor(llc, ui, persistence)!: adopt stream_core's foundation (#2956) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor(llc): adopt stream_core's InFlightCache Ours was a fork with the same `run` signature, the same `Future.sync(work)` and the same `whenComplete(...).ignore()` cleanup, down to the doc prose — and core's test file covers the same six cases, so deleting ours loses no coverage. `client.dart` imports it with a `show` clause rather than core's barrel, which would collide with `User`, `Filter`, `TokenManager` and `SystemEnvironment` in that file. Co-Authored-By: Claude Opus 5 (1M context) * refactor(llc): adopt stream_core's SystemEnvironment and its manager Both were forks. `SystemEnvironment` was identical — same constructor, same eight fields, same nullability — so it is re-exported from `stream_chat.dart` through a `show` allowlist and existing usage keeps compiling. `SystemEnvironmentManager` shared the class name, the extension name and a byte-identical `xStreamClientHeader` body, and was never exported. Core's manager is the better one: it takes the SDK baseline as a constructor argument and snapshots the SDK-owned fields rather than holding a reference, because `SystemEnvironment` is not final and a subtype could drift the values an update is meant to lock. It also rejects an unrecognized `sdkIdentifier` rather than only comparing precedence. Chat's manager tests are deleted rather than ported: core covers the manager with 13 cases and the header extension with 9, a superset of ours. What this package still owns is the baseline, so one test pins that. `_systemEnvironmentManager` stays static. Making it per-instance also breaks the public `defaultUserAgent` static that reads it, so that moves to the phase retiring `additionalHeaders` alongside it. Co-Authored-By: Claude Opus 5 (1M context) * refactor(llc)!: rename UploadState's variant classes `UploadState`'s freezed variants were named `Preparing`, `InProgress`, `Success` and `Failed` — four strikingly generic names in the public surface. `Success` was contended three ways: this union, `PagedValue`'s success variant in `stream_chat_flutter_core`, and `Result`'s in `stream_core`. There are already 13 `hide Success` import clauses in this repo working around the first two, and exporting `Result` needs the name free. They become `UploadStatePreparing`, `UploadStateInProgress`, `UploadStateSuccess` and `UploadStateFailed`. Deliberately not `UploadPreparing` / `UploadSuccess` / …, tempting as the symmetry is: those are `stream_core`'s `AttachmentUploadState` variant names, and adopting the upload task API puts that union in scope alongside this one, which stays on `Attachment` for persistence. Matching core's names now would just move the collision. Co-Authored-By: Claude Opus 5 (1M context) * refactor(llc, ui)!: adopt stream_core's error layer A failed request now reports one of `stream_core`'s four sealed `StreamException` kinds instead of a `StreamChatNetworkError`, so a Stream error is handled the same way here as in our other SDKs. `typedef StreamChatException = StreamException` gives the family a chat-shaped name, mirroring `StreamFeedsException`; the kinds keep theirs, since those are what a `switch` matches on. `StreamHttpClient._parseError` delegates to core's mapper, so all seven verb wrappers throw a `StreamChatException`. `ApiErrorInterceptor` is installed ahead of the logging interceptor, which is also what the generated client needs: it goes straight to `_dio.fetch` and never reaches those wrappers. `ChatErrorCode` is deleted. The backend registry has no code 23 or 24, so `requestTimeout` (23) never matched a real response — the wire code is 48, which core already has — and `maximumHeaderSizeExceeded` (24) and `undefinedToken` (1000) were never wire codes at all. Retry classification stays ours, since retryability is policy the caller owns, but it now follows core's table: a request that never reached the server, a 5xx, a 429 and a 408 retry; another 4xx, a cancelled request, broken credentials and anything marked unrecoverable do not. Previously only failures without a parseable error body retried, so a 500 or a 429 did not — failed messages will now retry where they used to give up. `PagedValue.error` and every `errorBuilder` carry the new type, so the break lands once rather than leaving the old error as the UI currency. The list controllers' catch-and-rewrap collapses: what they catch is already the right type, and anything else becomes a `StreamClientException` keeping the original as its cause. Two "no internet vs slow connection" switches now key off the failure kind instead of a dio transport enum, which also fixes them covering only three of the timeout types. `StreamChatNetworkError` is deprecated rather than deleted, because endpoints the OpenAPI migration has not moved still flow through the hand-written verb facade. Nothing raises it, so an `on StreamChatNetworkError catch` clause still compiles and quietly stops matching — the migration guide says so in those words, since a deprecation warning does not convey it. `StreamChatError` stays and is not deprecated: it is still the base for the SDK's own precondition throws and for the UI's attachment-validation results. `core-migration/03-errors.md` records what has to happen before the file that declares it can go. Co-Authored-By: Claude Opus 5 (1M context) * refactor(llc)!: adopt stream_core's token layer `Token` becomes `UserToken`, `TokenProvider` becomes an interface rather than a `Future Function(String)` typedef, and our `AuthInterceptor` gives way to core's. The client holds a `TokenManager.unconfigured()` and configures it on connect, since core's primary constructor needs a user id that chat does not have until then. `_connectUser` now takes a single `required TokenProvider`, so all four entry points configure the manager the same way. It previously took `Token?` *and* `TokenProvider?` and asserted at runtime that exactly one was set. Core's interceptor fixes three bugs ours had: no guard against a refresh loop, no guard against refreshing across a user switch, and no `FormData` re-clone — so a retried file upload replayed streams the first attempt had consumed. It also skips refreshing a static provider, where a re-fetch returns the same token, and `UserToken` parses `exp`, which is what lets a refresh happen before the server refuses rather than only after. Anonymous connections now identify as `!anon` instead of a client-generated random id. This is forced rather than chosen: `StaticTokenProvider` validates that a token's id matches the id it is registered under, and `UserToken.anonymous()` is always `!anon`. It is also right — the backend defines `AnonUserID = "!anon"` and pins it so a client cannot claim another identity, and its subscription store already counts each `!anon` client separately, so sharing the id is expected. Still worth one live anonymous connect before release; `core-migration/04-token-and-auth.md` says why source alone cannot settle it. `StreamChatClient.devToken` is removed rather than retyped. It minted a `devtoken`-signed JWT, which only an app with development tokens enabled accepts, so shipping a minter in the SDK invites it into production. Tests build their own with `testUserToken`, the way `stream_feeds_test` keeps `generateTestUserToken`. Our token tests are deleted rather than ported: core covers `AuthInterceptor`, `TokenManager`, `UserToken` and `TokenProvider` with 83 cases against our ~30. `TokenManager` joins the barrel allowlist — it appears in the exported signatures of `StreamHttpClient` and `StreamChatApi` but was never nameable. Co-Authored-By: Claude Opus 5 (1M context) * refactor(llc, persistence)!: log through stream_core, and adopt its interceptors `package:logging` leaves the repo. The SDK writes through `stream_core`'s `StreamLogger`, so `logLevel` and `logHandlerFunction` collapse into one `logConfig`, `client.logger` is a `StreamLogger`, and `detachedLogger`, `defaultLogHandler` and `LogHandlerFunction` are gone along with the `package:logging` re-export and dependency. An earlier attempt bridged instead — a handler forwarding core's records into chat's `Logger` — and that was the wrong call: it left two logging systems alive, which is the problem this was meant to solve, and it was code whose only purpose was to be deleted later. v11 already breaks the error and token layers, so this costs a consumer one more entry in a guide they are reading anyway. It also could not wait. An unconfigured `StreamLogger` is silent, so every record from the HTTP client and the token manager was going nowhere, and adopting core's WebSocket would have taken chat's connection logging with it. The default is unchanged: `const StreamLogConfig()` is warnings and errors to the console, which is what this package already documented. Tags follow core's shape — a class takes `{String tag = '...'}` and builds its own logger, rather than being handed one. The per-channel identity that used to live in a logger's *name* is now in the tag, appended rather than nested (`SCh:RetryQueue:messaging:general`), so filtering by subsystem still works. `stream_chat_persistence` moved too; it had its own detached logger, default handler and emoji map. Alongside it, three forked interceptors become one. Core owns the user-agent header and the connection id, and its `LoggingInterceptor` replaces our 344-line copy; what stays is the part core has no concept of, applying `StreamChatClient.additionalHeaders`. The pipeline reads as a list of null-aware elements over `let`, so an absent dependency drops its interceptor rather than guarding it, and `ApiErrorInterceptor` sits ahead of logging so what gets logged is the mapped failure. `api_key` stays a query parameter rather than moving to core's header-setting `ApiKeyInterceptor`: the server appears to accept both, and changing a working wire contract buys nothing. Every call site in the 13 hand-written `*_api.dart` files is untouched, which is what keeps the rest of this migration independent of the OpenAPI one. Co-Authored-By: Claude Opus 5 (1M context) * docs(repo): track the core migration's deferred and upstream work Two indexes cutting across the phase files, because decisions were surviving only as sentences buried in them. `DEFERRED.md` lists everything consciously postponed, grouped by what would unblock it: waiting on a `stream_core` release, needing a live check that source cannot settle, or waiting on a later phase. It also carries the shape of the `StreamChatConfig` that absorbs several of the rows, sequenced into the cleanup phase rather than done piecemeal. `UPSTREAM.md` covers the other direction — what chat has that every product needs. The retry table is the clearest case: `ERROR_LAYER.md` specifies it, chat now implements it, and feeds independently re-derived a partial version. It also records that core ships `HeadersInterceptor` and `ConnectionIdInterceptor` with no tests, which is why chat's kept theirs. Co-Authored-By: Claude Opus 5 (1M context) * docs(repo): correct what the filter operators need from core The plan called `$ne`, `$nin` and `$nor` a hard upstream block in four places. Checked against the other SDKs, only one of them is. Android deprecates `ne` — "inefficient and causes performance issues, it will not be supported in the future" — and every `nin` overload, and the JS SDK never declared either in its `QueryFilter` type. So `stream_core` is right not to have them, and chat should follow Android and deprecate rather than push them upstream. `$nor` is a different case: declared in JS beside `$and` and `$or`, present and undeprecated in Swift and Android. It is a logical operator, so it belongs next to core's `AndOperator` and `OrOperator`, and it is the only real ask. Records the evidence so nobody re-derives it, and notes that Swift still exposes the deprecated pair — which reads as an oversight there rather than a signal. Co-Authored-By: Claude Opus 5 (1M context) * fix(ui): restore jni in the example's generated plugin lists `generated_plugins.cmake` is written by `flutter pub get`, and both the linux and windows copies were committed without `jni` in `FLUTTER_FFI_PLUGIN_LIST`. CI regenerates them during bootstrap, so the working tree came out dirty and the formatting check — which fails on any modified tracked file — went red. Restores what v11 has. Co-Authored-By: Claude Opus 5 (1M context) * fix(ui): keep SDK failures loud when a send fails The silence predicate was retyped from `StreamChatNetworkError` to `StreamChatException`, which is the sealed root — so it also suppressed `StreamClientException`, the kind that means the SDK itself failed. A genuine bug during send stopped reaching `FlutterError.reportError`. Narrows it to the two kinds the comment was describing: a refusal the server sent, and a connection that failed. Both leave the message in a failed state for the retry queue, so both are expected in release. Co-Authored-By: Claude Opus 5 (1M context) * docs(repo): warn that catching a subtype narrows what you catch The guide's two `catch` examples both read only `.message`, which lives on the sealed root. A real v10 clause reads `.code` or `.statusCode`, and the Symbol Map maps those onto `StreamApiException` — a subtype. Nothing showed the bridge, so the obvious edit is `on StreamChatNetworkError catch` → `on StreamApiException catch`, which compiles and silently stops handling timeouts, cancellation, auth failures and undecodable responses. That is the same silent break the guide's own warning box claims deleting the old types prevents, so it needed saying. Adds a worked before/after, and notes why the sealed root needs no default arm while `Result.fold` does — `Failure.error` is typed `Object`. Both compile-checked, and the exhaustiveness claim verified by removing a case and watching the analyzer reject it. Also gives `TokenProvider.dynamic` its loader signature, and records that `UserToken` throws on a malformed JWT and on a user-id mismatch. Neither is a compile error; both present as "cannot log in". Co-Authored-By: Claude Opus 5 (1M context) * test(llc, ui): assert the exception a failing request produces The API-error tests asserted inside a `catch` block, so a request that returned instead of throwing passed without checking anything. The reaction controller's generic-exception test checked the message but not the type. Also documents `ChannelDeliveryReporter`'s `tag` parameter, which replaced the `logger` the constructor doc still described. Co-Authored-By: Claude Opus 5 (1M context) * fix(llc): keep the retry paths reachable after the error swap `_parseError` reports a `StreamException` now, so five `is StreamChatNetworkError` guards stopped matching and their branches became unreachable. `sendMessage`, `updateMessage`, `partialUpdateMessage` and `_deleteMessage` no longer queued a failed write, so a transient failure waited for the next connection-recovered sweep instead of retrying with backoff. `sync` no longer flushed persistence on the 400 the server answers for a stale `lastSyncAt` or an oversized state, leaving that `lastSyncAt` in place for every later sync to fail on. The sync branch had a test, but it threw a hand-built `StreamChatNetworkError.raw` no pipeline can produce any more, so it stayed green over dead code. It now throws what a rejected request reports. Co-Authored-By: Claude Opus 5 (1M context) * test(llc): pin that the Stream client header is still installed `X-Stream-Client` moved from chat's own interceptor to `stream_core`'s `HeadersInterceptor` in this branch, and it was the one interceptor whose installation nothing asserted. A miswired `systemEnvironmentManager` would drop the header silently and cost SDK attribution. Co-Authored-By: Claude Opus 5 (1M context) * style(llc): keep the logger field with the other fields `_logger` had landed between a setter and a getter in `WebSocket`, and between two methods in `ChannelDeliveryReporter`. `ErrorResponse`'s dartdoc also still pointed at `StreamChatNetworkError`, which nothing raises any more. Co-Authored-By: Claude Opus 5 (1M context) * docs(repo): correct what the changelogs and phase docs claim The default channel error state is `stream_chat_flutter`'s, so its entry moves out of `stream_chat_flutter_core`'s changelog. `🚀 Changed` was an invented heading sitting beside `🔄 Changed` in the same release; both fold into one. Two phase-doc claims were wrong: `AppSettingsManager` was not detached and did reach `Logger.root`, and the controllers' error wrap was rewritten rather than deleted — it keeps the original as `cause`. Co-Authored-By: Claude Opus 5 (1M context) * fix(llc)!: stop logging the user token with the connect URI The WebSocket connect URI carries the token twice — as `authorization`, and as `user_token` inside the `json` payload — and both `[connect]` and `[reconnect]` logged it whole at `info`. Raising the priority to `info` is what the SDK documents for development, so anyone debugging a connection wrote a usable token to the console and to whatever handler the app had installed, which for an app forwarding records to a crash reporter means off the device. Co-Authored-By: Claude Opus 5 (1M context) * refactor(llc, persistence): log lifecycle at info, everything else below it 101 of the 127 log sites in these two packages were `info`, including a health check every 20 seconds, a reconnect check every 10, a line per WebSocket frame, one per keystroke, and — in persistence — the name of every call it makes. `info` now carries only what a developer wants to see once: the client created and disposed, the user set and disconnected, the connection opening, established and closing. Per-operation records are `debug` and per-event ones are `verbose`, so raising the priority to chase a problem no longer buries it. Co-Authored-By: Claude Opus 5 (1M context) * fix(core): say what failed instead of stringifying the error A throwable the SDK does not recognise was wrapped as `StreamClientException(message: error.toString())`, which put the stringified error where a message belongs and left the same text in `cause` a second time. The message now names the load — `Failed to load more channels` — and the throwable survives untouched as `cause`, which is the field that exists to hold it. Co-Authored-By: Claude Opus 5 (1M context) * fix(ui): say what failed in the photo gallery too `StreamPhotoGalleryController` is the tenth `PagedValueNotifier` and the one outside `stream_chat_flutter_core`, so it was missed when the other nine stopped stringifying the throwable into the message. Co-Authored-By: Claude Opus 5 (1M context) * test(llc): name these tests after what they check Eight tests claimed to add a message to the retry queue; none looked at the queue, and four of them threw a 403, which is not retriable at all. They assert the message reaches a failed state, and the four that use a 408 or a 500 also assert the verdict — so that is what they now say. `StreamChatException` aliasing `StreamException` was pinned by `hasLength(4)` on a four-element literal, which holds whatever the alias does. It now compares the two types. Co-Authored-By: Claude Opus 5 (1M context) * docs(repo): keep this rung's plan docs to what this rung changes `08-query-dsl.md` was rewritten here, but its subject is Sort and Filter, which land two and three rungs up — and both rewrite the file wholesale, so nothing this rung wrote survives to the tip. It goes back to what the plan said; #2958 records the same decision with a better citation. The status table said 03, 04 and 08 were unfinished, while the section below it says the column describes the finished stack rather than the PR you are reading it in. The table now says what the tip says. Co-Authored-By: Claude Opus 5 (1M context) * docs(repo): correct what the README claims this rung leaves behind The collision list still named seven types this branch deletes — `TokenManager`, `AuthType`, `AuthInterceptor`, `ConnectionIdInterceptor`, `LoggingInterceptor`, `InterceptStep` and `LogPrint`. Chat declares none of them any more, so a wholesale export no longer collides on any of them, and the paragraph below that says the list shortens each phase should have said so. Two lines pointed past this rung: the hard-block sentence carried phase 08's narrowed conclusion while the phase doc no longer does, and the parked note promised findings that `07-websocket.md` does not hold yet. Co-Authored-By: Claude Opus 5 (1M context) * docs(repo): match the wrap this phase actually ships The paragraph still showed `StreamClientException(message: error.toString())`, which is what it was until the message started naming the load instead. Co-Authored-By: Claude Opus 5 (1M context) * refactor(llc)!: stop exporting the logging interceptor's types `LoggingInterceptor`, `InterceptStep` and `LogPrint` were public because the barrel exported the whole interceptor file. Nothing needs them now: the interceptor is installed by default and writes through the configured `StreamLogHandler`, so routing its output is a `logConfig` concern. Also drop a comment in `stream_http_client.dart` that described the implementation it replaced, and stop naming `stream_core` in the persistence changelog, which its consumers never depend on directly. Co-Authored-By: Claude Opus 5 (1M context) * refactor(llc)!: delete StreamChatNetworkError rather than deprecate it The plan deferred this to `openapi-migration` group 12, reasoning that endpoints that group had not moved still flowed through the hand-written verb facade. That reasoning does not survive this phase: the facade throws a `StreamChatException` now, so nothing raises the type whichever endpoint you call. Keeping it declared bought source compatibility for a type that no longer works — `on StreamChatNetworkError catch` would still compile and silently match nothing, which this plan's own risk section calls the one break a consumer can ship without noticing. Deleting it makes that a compile error. `StreamChatNetworkErrorType` goes with it. `ErrorResponse` stays: it is still `StreamWebSocketError`'s payload. Co-Authored-By: Claude Opus 5 (1M context) * docs(repo): keep one account of why stream_chat_dio_error waits The fuller section added here left the original in place, so the file argued the same point twice, a few dozen lines apart. Co-Authored-By: Claude Opus 5 (1M context) * docs(llc): describe logConfig's reach, not the package behind it `logConfig` is public, and which package implements the logger is not something a caller can act on. What they need is that the setting is process-wide and the last client constructed wins, which the entry now leads with. Co-Authored-By: Claude Opus 5 (1M context) * refactor(llc): log the channel event handler through StreamLogger v11 landed `ChannelEventHandler` after this rung replaced `package:logging`, so its contained-error report still called `Logger.warning`. Route it through `StreamLogger` like the rest of the client. `MockStreamChatClient` carries the real logger rather than a stub, because a `StreamLogger` writes to a global handler: a test that wants the records installs one, as `retry_queue_test` already does, and the three suites that merely reach the reporting path need no setup at all. --------- Co-authored-by: Claude Opus 5 (1M context) --- core-migration/01-utilities.md | 9 - core-migration/02-platform-and-environment.md | 171 ++++--- core-migration/03-errors.md | 199 ++++++-- core-migration/04-token-and-auth.md | 68 ++- core-migration/05-http-client.md | 113 +++-- core-migration/06-logger.md | 158 ++++-- core-migration/DEFERRED.md | 77 +++ core-migration/README.md | 68 ++- core-migration/UPSTREAM.md | 68 +++ melos.yaml | 1 - migrations/v11-migration.md | 127 ++++- packages/stream_chat/CHANGELOG.md | 29 ++ packages/stream_chat/example/lib/main.dart | 2 +- .../lib/src/client/channel/channel.dart | 38 +- .../client/channel/channel_client_state.dart | 10 +- .../client/channel/channel_event_handler.dart | 6 +- .../src/client/channel_delivery_reporter.dart | 35 +- .../stream_chat/lib/src/client/client.dart | 217 ++++----- .../lib/src/client/retry_policy.dart | 2 +- .../lib/src/client/retry_queue.dart | 23 +- .../lib/src/core/api/responses.dart | 3 +- .../lib/src/core/api/stream_chat_api.dart | 6 +- .../lib/src/core/error/chat_error_code.dart | 158 ------ .../stream_chat/lib/src/core/error/error.dart | 2 +- .../lib/src/core/error/stream_chat_error.dart | 163 +------ .../src/core/error/stream_chat_exception.dart | 64 +++ .../src/core/http/app_settings_manager.dart | 11 +- .../additional_headers_interceptor.dart | 21 +- .../http/interceptor/auth_interceptor.dart | 72 --- .../connection_id_interceptor.dart | 24 - .../http/interceptor/logging_interceptor.dart | 344 ------------- .../src/core/http/stream_chat_dio_error.dart | 21 - .../lib/src/core/http/stream_http_client.dart | 61 +-- .../core/http/system_environment_manager.dart | 111 ----- .../stream_chat/lib/src/core/http/token.dart | 81 ---- .../lib/src/core/http/token_manager.dart | 79 --- .../lib/src/core/models/attachment_file.dart | 96 ++-- .../core/models/attachment_file.freezed.dart | 124 ++--- .../src/core/models/attachment_file.g.dart | 27 +- .../lib/src/core/util/in_flight_cache.dart | 39 -- .../lib/src/system_environment.dart | 57 --- .../stream_chat/lib/src/ws/websocket.dart | 99 ++-- packages/stream_chat/lib/stream_chat.dart | 32 +- packages/stream_chat/pubspec.yaml | 1 - .../channel_capability_check_test.dart | 13 - .../channel/channel_client_state_test.dart | 40 -- .../channel/channel_event_handler_test.dart | 22 +- .../channel/channel_read_helper_test.dart | 13 - .../channel/channel_state_mutations_test.dart | 1 - .../test/src/client/channel/channel_test.dart | 343 ++++++------- .../channel_delivery_reporter_test.dart | 10 - .../test/src/client/client_test.dart | 83 ++-- .../test/src/client/retry_queue_test.dart | 27 +- .../src/client/system_environment_test.dart | 16 + .../core/error/stream_chat_error_test.dart | 223 --------- .../error/stream_chat_exception_test.dart | 145 ++++++ .../additional_headers_interceptor_test.dart | 84 ++-- .../interceptor/auth_interceptor_test.dart | 223 --------- .../connection_id_interceptor_test.dart | 13 +- .../core/http/stream_chat_dio_error_test.dart | 20 - .../core/http/stream_http_client_test.dart | 294 +++++------ .../http/system_environment_manager_test.dart | 252 ---------- .../src/core/http/token_manager_test.dart | 139 ------ .../test/src/core/http/token_test.dart | 56 --- .../src/core/util/in_flight_cache_test.dart | 110 ----- .../src/core/util/message_rules_test.dart | 10 - packages/stream_chat/test/src/fakes.dart | 21 +- packages/stream_chat/test/src/mocks.dart | 14 +- packages/stream_chat/test/src/utils.dart | 24 + .../test/src/ws/websocket_test.dart | 48 +- packages/stream_chat_flutter/CHANGELOG.md | 10 + .../stream_chat_flutter/example/lib/main.dart | 2 +- .../example/lib/split_view.dart | 2 +- .../example/lib/tutorial_part_1.dart | 2 +- .../example/lib/tutorial_part_2.dart | 2 +- .../example/lib/tutorial_part_3.dart | 2 +- .../example/lib/tutorial_part_4.dart | 2 +- .../example/lib/tutorial_part_5.dart | 2 +- .../example/lib/tutorial_part_6.dart | 2 +- .../stream_message_composer.dart | 8 +- .../stream_channel_list_view.dart | 2 +- .../stream_member_grid_view.dart | 2 +- .../stream_member_list_view.dart | 2 +- .../stream_message_search_list_view.dart | 2 +- .../photo_gallery/stream_photo_gallery.dart | 2 +- .../stream_photo_gallery_controller.dart | 10 +- .../stream_poll_vote_list_view.dart | 2 +- .../stream_reaction_list_view.dart | 2 +- .../stream_thread_list_view.dart | 2 +- .../stream_user_grid_view.dart | 2 +- .../stream_user_list_view.dart | 2 +- .../lib/src/utils/extensions.dart | 4 +- .../lib/src/utils/network_error_text.dart | 17 +- ...tream_chat_default_channel_error_test.dart | 16 +- .../stream_chat_flutter_core/CHANGELOG.md | 6 + .../lib/src/paged_value_notifier.dart | 18 +- .../lib/src/paged_value_notifier.freezed.dart | 299 ++++++------ .../lib/src/paged_value_scroll_view.dart | 6 +- .../lib/src/search_debounce_mixin.dart | 2 +- .../lib/src/stream_channel.dart | 10 +- .../src/stream_channel_list_controller.dart | 8 +- .../lib/src/stream_draft_list_controller.dart | 8 +- .../src/stream_member_list_controller.dart | 8 +- ...ream_message_reminder_list_controller.dart | 8 +- ...stream_message_search_list_controller.dart | 8 +- .../src/stream_poll_controller.freezed.dart | 459 +++++++++--------- .../src/stream_poll_vote_list_controller.dart | 8 +- .../src/stream_reaction_list_controller.dart | 8 +- .../src/stream_thread_list_controller.dart | 8 +- .../lib/src/stream_user_list_controller.dart | 8 +- .../stream_chat_flutter_core/test/mocks.dart | 4 +- .../stream_channel_list_controller_test.dart | 9 +- .../test/stream_channel_test.dart | 30 +- .../stream_draft_list_controller_test.dart | 18 +- ...message_reminder_list_controller_test.dart | 8 +- .../stream_reaction_list_controller_test.dart | 35 +- .../example/lib/add_new_lang.dart | 2 +- .../example/lib/main.dart | 2 +- .../example/lib/override_lang.dart | 2 +- packages/stream_chat_persistence/CHANGELOG.md | 10 + .../example/lib/main.dart | 1 - .../src/stream_chat_persistence_client.dart | 126 ++--- packages/stream_chat_persistence/pubspec.yaml | 1 - .../stream_chat_persistence_client_test.dart | 12 +- sample_app/benchmark/main_benchmark.dart | 2 +- sample_app/lib/auth/auth_controller.dart | 52 +- 126 files changed, 2669 insertions(+), 3979 deletions(-) create mode 100644 core-migration/DEFERRED.md create mode 100644 core-migration/UPSTREAM.md delete mode 100644 packages/stream_chat/lib/src/core/error/chat_error_code.dart create mode 100644 packages/stream_chat/lib/src/core/error/stream_chat_exception.dart delete mode 100644 packages/stream_chat/lib/src/core/http/interceptor/auth_interceptor.dart delete mode 100644 packages/stream_chat/lib/src/core/http/interceptor/connection_id_interceptor.dart delete mode 100644 packages/stream_chat/lib/src/core/http/interceptor/logging_interceptor.dart delete mode 100644 packages/stream_chat/lib/src/core/http/stream_chat_dio_error.dart delete mode 100644 packages/stream_chat/lib/src/core/http/system_environment_manager.dart delete mode 100644 packages/stream_chat/lib/src/core/http/token.dart delete mode 100644 packages/stream_chat/lib/src/core/http/token_manager.dart delete mode 100644 packages/stream_chat/lib/src/core/util/in_flight_cache.dart delete mode 100644 packages/stream_chat/lib/src/system_environment.dart create mode 100644 packages/stream_chat/test/src/client/system_environment_test.dart create mode 100644 packages/stream_chat/test/src/core/error/stream_chat_exception_test.dart delete mode 100644 packages/stream_chat/test/src/core/http/interceptor/auth_interceptor_test.dart delete mode 100644 packages/stream_chat/test/src/core/http/stream_chat_dio_error_test.dart delete mode 100644 packages/stream_chat/test/src/core/http/system_environment_manager_test.dart delete mode 100644 packages/stream_chat/test/src/core/http/token_manager_test.dart delete mode 100644 packages/stream_chat/test/src/core/http/token_test.dart delete mode 100644 packages/stream_chat/test/src/core/util/in_flight_cache_test.dart diff --git a/core-migration/01-utilities.md b/core-migration/01-utilities.md index 06002746c7..641e8fd7d7 100644 --- a/core-migration/01-utilities.md +++ b/core-migration/01-utilities.md @@ -86,15 +86,6 @@ Ours has `sortedUpsertAt`, `mergeSorted`, `mergeFrom` and `updateIf`; core has ` `removeNested`, `updateNested` and `partition`. Confirm every method we call has a home before deleting, and take the missing ones upstream rather than keeping a two-method file behind. -### `stream_chat_dio_error` - -`StreamChatDioError` is thrown by `AuthInterceptor.onRequest`'s reject path only, and it exists to -carry a `StreamChatNetworkError` through dio. Its payload type belongs to phase -[03](03-errors.md), its thrower to phase [04](04-token-and-auth.md) and its only consumer, -`StreamHttpClient`, to phase [05](05-http-client.md) — so the file cannot be deleted here. This -phase leaves it alone; the switch to core's `StreamDioException` and the deletion land with the -error layer. - ## Decisions to make Both remaining decisions belong to `list_extensions`, and both wait on the benchmark: diff --git a/core-migration/02-platform-and-environment.md b/core-migration/02-platform-and-environment.md index 052043aa1f..45d5e5cf25 100644 --- a/core-migration/02-platform-and-environment.md +++ b/core-migration/02-platform-and-environment.md @@ -3,94 +3,153 @@ **Goal:** delete two forks that collide with core by name, so later phases can import core's `api/` and `platform/` barrels without a prefix. -**Size:** ~220 chat LOC deleted. Two upstream core additions. One public rename. +**Size:** ~330 chat LOC deleted. One public type swap, one public rename. + +> **Read the resolved package, not the sibling repo.** The first pass at this phase claimed two +> upstream core additions were needed. Both were wrong, because they were derived from +> `stream-core-flutter/packages/stream_core` (unreleased `main`) rather than from +> `~/.pub-cache/hosted/pub.dev/stream_core-0.5.0`, which is what `stream_chat` actually resolves. +> Always diff against the pub-cache copy. ## Scope -| Delete | Adopt | -| --- | --- | -| `lib/src/core/platform_detector/` — `platform_detector.dart` (~97) + `_stub` / `_web` / `_io` | `stream_core` `platform/current_platform.dart` + `platform/detector/` | -| `lib/src/core/http/system_environment_manager.dart` (111) | `stream_core` `api/system_environment_manager.dart` (156) + `api/system_environment.dart` | +| Delete | Adopt | Status | +| --- | --- | --- | +| `lib/src/system_environment.dart` (57) | `stream_core` `api/system_environment.dart` | **done** | +| `lib/src/core/http/system_environment_manager.dart` (111) | `stream_core` `api/system_environment_manager.dart` | **done** | +| `lib/src/core/platform_detector/` — `platform_detector.dart` (~97) + `_stub` / `_web` / `_io` | `stream_core` `platform/current_platform.dart` + `platform/detector/` | **blocked on a `stream_core` release** | -### Platform detector +### Platform detector — blocked on a `stream_core` release Both packages define `CurrentPlatform` **and** `PlatformType`, so `stream_chat.dart` must stop exporting ours in the same PR — there is no coexistence. -| Ours | Core | +| Ours | Published core 0.5.0 | | --- | --- | -| `enum PlatformType` — 7 values, no payload | `enum PlatformType` — same 7 values, each carrying `operatingSystem` | +| `enum PlatformType` — 7 values, no payload | same 7 values, each carrying `operatingSystem` — **identical strings** (`android`, `ios`, `web`, `macos`, `windows`, `linux`, `fuchsia`), so nothing on the wire changes | | `CurrentPlatform.name` (a `switch`) | `CurrentPlatform.operatingSystem` | -| `is*` getters | same `is*` getters, plus `isMobile` / `isDesktop` | -| `@visibleForTesting static PlatformType? debugCurrentPlatformOverride` | **absent** — upstream it | -| conditional import: `_stub` / `_web` (on `dart.library.js_interop`) / `_io` | `detector/platform_detector` (web default) / `platform_detector_io` — **no explicit `js_interop` branch** | - -The `js_interop` branch is not cosmetic: it is how `#2940` (wasm support) works. Core reaching web -via a non-io fallback is not the same guarantee. Take both gaps upstream before starting, or this -phase regresses wasm and loses the test seam our tests depend on. - -### System environment - -Near-verbatim fork: same class name, same `XStreamClientHeaderExtension` extension name, and a -byte-identical `xStreamClientHeader` body including the `_SdkIdentifier` precedence trick. The -only real difference is where the SDK identity comes from — ours hardcodes it in the constructor, -core takes `required SystemEnvironment environment` and snapshots the SDK-owned fields so -`updateEnvironment` cannot overwrite them. - -Construct core's with chat's baseline: +| 7 `is*` getters + `isFlutterTest` | same, plus `isMobile` / `isDesktop` | +| `@visibleForTesting static PlatformType? debugCurrentPlatformOverride`, honoured by an assert-gated `type` | **not in 0.5.0** — present on core's `main`, unreleased | +| conditional import: `_stub` (throws) / `_web` on `dart.library.js_interop` / `_io` | `detector/platform_detector` (web) / `platform_detector_io` on `dart.library.io` | + +Two corrections to the original write-up: + +- **Wasm needs nothing.** Core has no throwing stub at all: its conditional import defaults to the + *web* detector and switches to io only when `dart.library.io` is available, so a wasm build lands + on `PlatformType.web` by construction. Chat needed the explicit `js_interop` branch (`#2940`) + only because *its* default was a stub that threw. Core's shape is strictly safer. +- **`debugCurrentPlatformOverride` needs a release, not a PR.** Core's `main` already has it, with + the same assert-gated `type` implementation ours uses — the published 0.5.0 does not. It is not + optional: `stream_chat_flutter/test/src/message_widget/stream_message_text_test.dart` sets it in + 8 places, and no shim outside core can substitute (the override has to be read by + `CurrentPlatform.type` itself). + +So this half waits for the next `stream_core` release. Everything else about it is a mechanical +rename, already verified: `stream_core_flutter` does **not** re-export `stream_core`, so +`stream_chat_flutter` sees `CurrentPlatform` only through this barrel and there is no ambiguity to +resolve. Only two non-test `.name` call sites exist — chat's own manager, and +`stream_chat_flutter_core/lib/src/stream_chat_core.dart:215`. + +### System environment — done + +Both types were near-verbatim forks. `SystemEnvironment` was **identical**: same constructor, +same 8 fields, same nullability, no equality on either side — so swapping it is source-compatible +for anyone constructing or reading one, and only a type-identity change for anyone doing `is` or +`implements`. `SystemEnvironmentManager` shared the class name, the +`XStreamClientHeaderExtension` name and a byte-identical `xStreamClientHeader` body including the +`_SdkIdentifier` precedence trick. + +Core's manager is the better one: it takes `required SystemEnvironment environment` and +*snapshots* the SDK-owned fields, rather than holding a reference — deliberately, because +`SystemEnvironment` is not `final`, so a subtype could return a different value on every getter +read and drift the values an update is meant to be locked to. It also rejects an unrecognized +`sdkIdentifier` outright, where ours only compared precedence. + +That last difference is **not** observable, which is why the swap is not a behavioural break. +Ours resolved an update as `incoming.precedence < current.precedence ? current : incoming`; core +rejects anything with a negative precedence first. The two disagree only when the *current* +identifier is itself unrecognized — unreachable, since the baseline is always `dart` and an +update can only ever store a value that already passed the check. Every reachable transition +(unrecognized against `dart` or `flutter`, and the `dart` ⇄ `flutter` pair in both directions) +yields the same result under both rules. + +Constructed with chat's baseline in `client.dart`: ```dart SystemEnvironmentManager( environment: SystemEnvironment( sdkName: 'stream-chat', - sdkIdentifier: 'dart', // core promotes 'dart' -> 'flutter' one-way + sdkIdentifier: 'dart', // core promotes 'dart' -> 'flutter' one-way sdkVersion: PACKAGE_VERSION, - osName: CurrentPlatform.operatingSystem, + osName: CurrentPlatform.name, // becomes `.operatingSystem` with the platform half ), ) ``` -**Fix the static while you are here.** `client.dart:168` is -`static final _systemEnvironmentManager = SystemEnvironmentManager();` — a static, so two -`StreamChatClient`s in one process cannot have different app names or versions, and the second -client silently inherits the first's environment. Make it an instance field. That is a bug fix, -not a break. +`SystemEnvironmentManager` was never exported, so it swapped silently. `SystemEnvironment` is +exported and is now core's, re-exported through the `show` allowlist this phase starts: + +```dart +export 'package:stream_core/stream_core.dart' show SystemEnvironment; +``` + +`XStreamClientHeaderExtension` is deliberately **not** added to that allowlist: ours was never +public either (it lived in the unexported manager file), and exporting core's would widen the +public surface for no reason. + +**The static stays, and moves to [05](05-http-client.md).** The original write-up called +`static final _systemEnvironmentManager` a free bug fix. It is not: `client.dart:201` is +`static String defaultUserAgent = _systemEnvironmentManager.userAgent;` — a **public** static +reading it, so making the manager per-instance breaks `defaultUserAgent` too. That belongs with +`additionalHeaders`, the sibling public static phase 05 already retires. + +Chat's manager tests were deleted rather than ported: core covers the manager with 13 cases and +`xStreamClientHeader` with 9, a superset of ours. What chat still owns is the *baseline*, so +`test/src/client/system_environment_test.dart` pins that one thing — +`StreamChatClient.defaultUserAgent` reporting `stream-chat-dart-v|os=`. ## Decisions to make +Only the platform half has open questions: + - `CurrentPlatform.name` → `.operatingSystem` has to be a clean rename. A deprecated `name` for one release is not on the table: `name` is a static, and an extension can only add statics under its own declaration name, so a chat-side shim could not answer `CurrentPlatform.name`. - It is exported, but a platform-name string is rarely load-bearing in app code. -- Whether `debugCurrentPlatformOverride` goes upstream as-is (an `@visibleForTesting` static with - an assert gate) or as something core's style guide prefers — core's `STYLE_GUIDE.md` has an - "Avoid `@visibleForTesting`" section, so expect pushback and have a second shape ready. + It is exported, but a platform-name string is rarely load-bearing in app code, and the returned + values are identical. +- Whether `stream_chat_flutter`'s 8 uses of `debugCurrentPlatformOverride` are ported to core's + override or reworked not to need one. Porting is a one-line change per site once core is + released; reworking is better but is its own piece of work. ## Risks -- **Wasm.** If core's web detection is adopted without the `js_interop` branch, `#2940` regresses - silently — nothing fails to compile, the platform is just wrong at runtime. Verify with the - wasm build, not with tests. -- Chat's tests set `debugCurrentPlatformOverride`; without an equivalent they need reworking, and - reworking them to not need it is the better outcome but is more work than this phase implies. +- Nothing outstanding for the system-environment half — the swap is source-compatible and the + header output is unchanged. +- For the platform half: the values are identical, so the risk is not behavioural but timing — + it cannot land until core releases, and attempting it early leaves + `stream_chat_flutter`'s tests uncompilable. ## Upstream `stream_core` work -- `CurrentPlatform.debugCurrentPlatformOverride` (or an equivalent test seam). -- An explicit `dart.library.js_interop` web branch in the platform detector's conditional import. - -Both are small and belong in one core PR. +**A `stream_core` release** containing `debugCurrentPlatformOverride` (already on `main`). No core +code changes needed. ## Definition of done -- [ ] `lib/src/core/platform_detector/` deleted; `stream_chat.dart` no longer exports it. -- [ ] `system_environment_manager.dart` deleted; core's is constructed with the chat baseline. -- [ ] `_systemEnvironmentManager` is an instance field, and a test asserts two clients can hold - different environments. -- [ ] Wasm build verified (`flutter build web --wasm` on the sample app), not just tests. -- [ ] Chat's platform-dependent tests pass without a chat-owned override. -- [ ] `melos bootstrap && melos run analyze && melos run test:dart && melos run test:flutter`. -- [ ] `refactor(llc)!:` title, `🛑️ Breaking` CHANGELOG entry and `migrations/v11-migration.md` - Symbol Map rows for `CurrentPlatform.name` → `.operatingSystem`, `PlatformType` and - `SystemEnvironmentManager`. -- [ ] Decisions recorded here, status box ticked in `README.md`. +- [x] `lib/src/system_environment.dart` and `lib/src/core/http/system_environment_manager.dart` + deleted; core's manager is constructed with the chat baseline. +- [x] `SystemEnvironment` re-exported from core through a `show` allowlist; + `XStreamClientHeaderExtension` deliberately not exported. +- [x] `test/src/client/system_environment_test.dart` pins the chat baseline user agent. +- [x] `melos run analyze` clean across all packages; `stream_chat` 1673 tests green, + `stream_chat_persistence` 302 green, `stream_chat_flutter_core` 362 green, + `stream_chat_flutter` 1302 green (11 golden failures pre-existing on a clean tree — + verified by stashing). +- [x] CHANGELOG entry under `🔄 Changed` for the `SystemEnvironment` type swap. +- [ ] `lib/src/core/platform_detector/` deleted; `stream_chat.dart` exports core's + `CurrentPlatform` / `PlatformType` — **after the core release**. +- [ ] `CurrentPlatform.name` → `.operatingSystem` at both non-test call sites. +- [ ] Wasm build verified (`flutter build web --wasm` on the sample app) once the platform half + lands — core's shape should make this a formality, but confirm rather than assume. +- [ ] `migrations/v11-migration.md` Symbol Map row for `CurrentPlatform.name`. +- [ ] Decisions recorded here, status box updated in `README.md`. diff --git a/core-migration/03-errors.md b/core-migration/03-errors.md index 823dc40e31..6be872370b 100644 --- a/core-migration/03-errors.md +++ b/core-migration/03-errors.md @@ -39,15 +39,20 @@ typedef StreamChatException = StreamException; - **It is a `typedef`, not a subclass.** Nothing to construct, nothing to keep in step with core, and the sealed hierarchy stays exhaustive — a `switch` over `StreamChatException` still gets the four `base` kinds and nothing else. -- **It gives the old name somewhere to land.** `StreamChatError` was our root; aliasing the new - root under a recognisably chat-shaped name is the smallest possible conceptual move for a - consumer, and `@Deprecated('Use StreamChatException') typedef StreamChatError = StreamException;` - is a legitimate one-line soft landing for the rename (unlike `StreamChatNetworkError`, which was - a *kind* and maps to `StreamApiException`, not to the root). +- **It reads in chat's vocabulary.** Chat's own code and dartdoc use `StreamChatException` + throughout — `_parseError`'s return type, `RetryPolicy.shouldRetry`'s parameter, the + `isRetriable` extension — so nothing in the SDK's surface makes a reader go looking in another + package. The four kinds keep their core names, since those are what a `switch` matches on and + renaming them would break the shared-handler property. -Export it from `lib/stream_chat.dart` alongside the allowlist below. Prefer it in chat's own -dartdoc so the public docs read in chat's vocabulary; the four kinds keep their core names, since -those are what a `switch` matches on and renaming them would break the shared-handler property. +**`StreamChatError` is *not* aliased onto it.** An earlier draft of this file suggested +`@Deprecated typedef StreamChatError = StreamException;`, which turned out to be wrong: that class +is still a live base for things unrelated to request failures — +`stream_chat_flutter`'s `AttachmentLimitReachedError`, `AttachmentTooLargeError` and +`AttachmentBlockedError` extend it, and the SDK's own precondition throws raise it. It stays as it +is; `StreamChatNetworkError` is the one that goes. + +Export the alias from `lib/stream_chat.dart` alongside the allowlist below. Feeds adds **nothing else** to the hierarchy — zero classes in `stream_feeds/lib` extend or implement a `StreamException`. Match that: the alias is the whole product-side error surface @@ -139,24 +144,87 @@ retryability is the caller's policy, so this is the intended shape, not a workar 07 replaces the transport, and 07's definition of done is what deletes it. Do not try to half-migrate it here. -## Decisions to make - -- The `Success` collision: rename `UploadState.success`'s class, or don't export core's `Success`. -- Whether `StreamChatNetworkError` is **deprecated** or **deleted** in v11. It must survive this - phase because every unmigrated endpoint still throws it, and it becomes dead code only when - `openapi-migration` group 12 lands. Deprecating it now and deleting it there is the honest - sequencing. -- Whether `ChatErrorCode` ships as a deprecated forwarder onto `StreamErrorCode` (possible for the - ~22 codes whose values match) or is deleted outright. The three bad codes cannot forward. +## Decisions taken + +1. **Retry policy adopts core's table** (`ERROR_LAYER.md` §Retrying) rather than preserving v10 + behaviour. Today's predicate is `isRetriable => data == null` — it retries only when the + response carried *no* parseable Stream error payload, so a 500 or a 429 never retries a failed + message. The new predicate retries network failures (unless cancelled), 5xx, 429 and 408, and + never other 4xx, auth failures, client failures, or anything flagged `unrecoverable`. **This + changes runtime behaviour** and gets its own CHANGELOG line. +2. **`StreamChatNetworkError` is deleted, not deprecated.** An earlier draft deferred it to + `openapi-migration` group 12, on the grounds that endpoints that group has not moved still flow + through the hand-written verb facade. That reasoning does not survive this phase: the facade + throws a `StreamChatException` now, so nothing raises the type whichever endpoint you call. + Keeping it declared would buy source compatibility for a type that no longer works — an + `on StreamChatNetworkError catch` would still *compile* and silently match nothing, which is + the one break a consumer can ship without noticing. Deleting it makes that a compile error + instead. `StreamChatNetworkErrorType` goes with it. +3. **`ChatErrorCode` is deleted**, as `migrations/v11-migration.md` already promises. An `enum` + cannot alias an extension type, so a deprecated forwarder is not available, and three of its + entries are not real wire codes anyway (see below). +4. **The whole `PagedValue` / `errorBuilder` chain is retyped in this phase**, so the break lands + once across all three packages rather than leaving `StreamChatError` alive as the UI currency. + See [Downstream](#downstream-the-flutter-packages). + +### The `Success` collision, and the name to avoid + +Chat's `UploadState` union exports four strikingly generic names — `Preparing`, `InProgress`, +`Success`, `Failed` — and `Success` is contended three ways: chat's `UploadState.success` variant, +`stream_chat_flutter_core`'s `PagedValue.success` variant (`Success`), and core's +`Result` `Success`. There are already **13 `hide Success` import clauses** in this repo working +around the first two. + +Rename chat's four variants to `UploadStatePreparing`, `UploadStateInProgress`, +`UploadStateSuccess`, `UploadStateFailed`. + +**Do not name them `UploadPreparing` / `UploadInProgress` / `UploadSuccess` / `UploadFailed`,** +tempting as the symmetry is: those are exactly core's `AttachmentUploadState` variant names, and +phase [09](09-uploads.md) puts core's union in scope *alongside* chat's — which stays on +`Attachment` for Drift. Matching core's names now just moves the collision into phase 09. + +## Downstream: the Flutter packages + +The original scope note undercounted this badly. `StreamChatError` is not confined to the LLC — +it is woven through `stream_chat_flutter_core`'s **public** API: + +| Surface | Where | Public | +| --- | --- | --- | +| `PagedValue.error(StreamChatError)`, plus the generated `when` / `map` / `maybeWhen` signatures | `paged_value_notifier.dart` | yes — backs every list controller | +| `errorBuilder: Widget Function(BuildContext, StreamChatError)` | `paged_value_scroll_view.dart` (×2) | yes — widget API | +| `on StreamChatError catch` followed by `StreamChatError(error.toString())` | 11 controllers, two sites each | internal | + +Real totals for this phase: **205 `lib` references and 230 `test` references across three +packages**, not one. `stream_chat_persistence` has zero and is untouched. + +All of it is retyped to `StreamException` here. The controllers already wrapped non-chat errors as +`StreamChatError(error.toString())`, so those sites become `on StreamChatException catch` with the +wrap rewritten as `StreamClientException(message: 'Failed to load channels', cause: error)` — the +message names the load, and the original throwable survives as `cause`, which the old wrap +discarded by stringifying it. ## Risks -- **This is the break with the widest blast radius.** `StreamChatNetworkError` is caught by type - in `retry_queue.dart`, `app_settings_manager.dart`, `websocket.dart:392` and across - `channel.dart` / `channel_client_state.dart`'s optimistic-update rollbacks. Every one of those - sites changes. -- Consumers catch `StreamChatNetworkError` in app code. This is the single most-visible v11 change - and the migration guide's Error Handling section has to be exactly right. +- **The widest blast radius in the plan**, and it now spans three packages. Inside the LLC, + `StreamChatNetworkError` is caught by type in `retry_queue.dart`, `app_settings_manager.dart`, + `websocket.dart:392` and across `channel.dart` / `channel_client_state.dart`'s optimistic-update + rollbacks. +- **The silent-catch trap, avoided by deleting rather than deprecating.** Had the type stayed + declared, `on StreamChatNetworkError catch` would keep compiling and quietly match nothing — the + one break a consumer can ship without noticing. It is gone, so the same clause fails to compile + and the consumer is sent to the migration guide. +- **`StreamException` has no `stackTrace`, by design** — `ERROR_LAYER.md`: "a trace records the + raise, not the failure." `StreamChatNetworkError` has one, plus + `toString({bool printStackTrace})`. Traces now come from the carrier (`Failure.stackTrace`) or + from the language at the throw site. +- **`RetryPolicy.shouldRetry` is public** and typed + `FutureOr Function(StreamChatClient, int, StreamChatError?)`. Its third parameter becomes + `StreamException?`, and `retry_queue.dart:85`'s `is! StreamChatError` guard changes with it. +- `StreamApiException.code` is **nullable** (null when no Stream payload reached us, e.g. a proxy's + bare status), where `StreamChatNetworkError.code` was a non-null `int`. Every code read needs a + null path. +- Consumers catch these in app code. The migration guide's Error Handling section has to be exactly + right, and it is already written — extend it, don't contradict it. ## Upstream `stream_core` work @@ -164,24 +232,67 @@ None. ## Definition of done -- [ ] `core/error/` deleted except whatever `StreamWebSocketError` needs to survive until 07. -- [ ] `core/http/stream_chat_dio_error.dart` deleted — its payload becomes a `StreamException` - here, so core's `StreamDioException` carries it from this phase on. Deferred from - [01](01-utilities.md). -- [ ] `ApiErrorInterceptor` installed last in the pipeline. -- [ ] A test asserts a failed call yields a `Failure` carrying a `StreamApiException` with a - parsed `.apiError`, and that a malformed response body yields a `StreamClientException` - rather than a bare `TypeError`. -- [ ] `Result` and the core error types are exported via the `show` allowlist; the `Success` - collision is resolved. -- [ ] `isRetriable` re-expressed chat-side; `RetryQueue` and `RetryPolicy` behave identically — - a test pins that a 5xx retries and a 4xx does not. -- [ ] The 23 → 48 `requestTimeout` correction has its own CHANGELOG line. -- [ ] `melos bootstrap && melos run analyze && melos run test:dart && melos run test:flutter`. - Note `analysis_options.yaml` excludes `**/*.g.dart` and `**/*.freezed.dart` repo-wide, so - `default_api.g.dart` and ~490 generated `.freezed.dart` files are never analyzed — - exercising them in a test is what compiles them. -- [ ] `migrations/v11-migration.md` Error Handling section matches what shipped, including the two - lossy conversions. -- [ ] `refactor(llc)!:` title, `🛑️ Breaking` CHANGELOG entries. -- [ ] Decisions recorded here, status box ticked in `README.md`. +- [x] `chat_error_code.dart` and `stream_chat_dio_error.dart` deleted; `StreamChatNetworkError` + and `StreamChatNetworkErrorType` deleted; `StreamChatError` and `StreamWebSocketError` kept + (the WS layer still raises the latter until phase 07, and the UI package's + attachment-validation errors subclass the former). +- [x] `ApiErrorInterceptor` installed, before the logging interceptor so a rejection is mapped + before it is logged. `_parseError` delegates to `DioExceptionMapping.toStreamException()`, + so all seven verb wrappers throw a `StreamChatException`. +- [x] `Result` and the core error kinds exported via the `show` allowlist, plus the + `StreamChatException` alias. The `Success` collision is resolved by renaming `UploadState`'s + variants. +- [x] `isRetriable` re-expressed chat-side over the sealed kinds, per `ERROR_LAYER.md` §Retrying, + with a test per row of that table. +- [x] The 23 → 48 `requestTimeout` correction has its own CHANGELOG line. +- [x] `melos run analyze` clean across every package; `melos run format` clean. `stream_chat` + 1672 tests green, `stream_chat_flutter_core` 362, `stream_chat_flutter` 1302 (the 11 macOS + golden failures are pre-existing — verified against a clean tree). +- [x] `migrations/v11-migration.md`: Symbol Map rows for every retyped symbol, plus new sections + for endpoints that still throw, the silent-catch trap, and the retry change. +- [x] `🛑️ Breaking` CHANGELOG entries in all three packages. +- [ ] A test asserting a **malformed response body** yields a `StreamClientException` rather than a + bare `TypeError`. `runApiSafely` guarantees it, but nothing in this package exercises that + path yet — it needs a call through the generated client, which arrives with + `openapi-migration` group 02. +- [ ] Status box updated in `README.md`. + +### When `stream_chat_error.dart` goes + +The file held three things with three different lifetimes, so it empties in stages rather than +being deleted here: + +| In the file | Last users | Goes when | +| --- | --- | --- | +| `StreamChatNetworkError`, `StreamChatNetworkErrorType` | none — nothing raised them once the verb facade threw `StreamChatException` | **this phase** | +| `StreamWebSocketError` | `websocket.dart` raises it, `client.dart:459` catches it | phase [07](07-websocket.md), where `DisconnectionSource.serverInitiated(error:)` replaces it | +| `StreamChatError` (the base) | 23 SDK precondition throws; `stream_chat_flutter`'s attachment-validation subtypes | two more pieces of work, below | + +So the file is deletable once **three** things are true — two of them already scheduled, and one +that is not: + +1. Phase 07 removes `StreamWebSocketError`. +2. The 23 precondition throws are reclassified (see below). +3. **The attachment-validation errors stop being errors.** `StreamAttachmentValidator`'s own + dartdoc says it best: "Both return `null` on success and a typed `StreamChatError` subtype on + failure — neither ever throws." `AttachmentLimitReachedError`, `AttachmentTooLargeError` and + `AttachmentBlockedError` are *returned values* that `StreamMessageComposer` pattern-matches to + choose localized copy. They carry data (`maxCount`, `maxSize`, `fileExtension`) and are never + raised, so they belong in a sealed result type of their own in `stream_chat_flutter` — not in + an exception hierarchy in the low-level client. That is a UI-package change and does not need + this plan. + +Until then `StreamChatError` stays, undeprecated. Deprecating it now would put a warning on every +one of those legitimate uses. + +### Carried out of this phase + +- **The SDK's own precondition throws are untouched.** 23 sites still raise + `StreamChatError` — "Chat persistence client is not set", "Connection already in progress", + "Message not found", "Failed to upload one or more attachments". These are a different axis from + request failures, and `ERROR_LAYER.md` splits them further: a condition a correct program can hit + becomes a `StreamException`, while genuine misuse should raise `StateError`/`ArgumentError` and + never be wrapped. Reclassifying them one by one is worth its own change; doing it by sed would + get it wrong. +- **`StreamWebSocketError`** goes in phase [07](07-websocket.md), where + `DisconnectionSource.serverInitiated(error:)` replaces it. diff --git a/core-migration/04-token-and-auth.md b/core-migration/04-token-and-auth.md index 7c6302e5ec..8383fd1709 100644 --- a/core-migration/04-token-and-auth.md +++ b/core-migration/04-token-and-auth.md @@ -44,7 +44,7 @@ interceptor act before the server refuses rather than only after. | `TokenManager.loadToken({refresh})` | `TokenManager.getToken()` / `expireToken()` / `peekToken()` | | `TokenManager.isStatic` | `TokenManager.usesStaticProvider` | | `TokenManager.setTokenOrProvider` | `TokenManager.setTokenProvider(userId, tokenProvider:)` | -| `Token.development` | keep chat-side — build the dev JWT and wrap it in `TokenProvider.static` | +| `Token.development` / `StreamChatClient.devToken` | **removed** — a `devtoken`-signed JWT only works on an app with development tokens enabled, so shipping a minter in the SDK invites it into production. Tests build their own via `testUserToken` in `test/src/utils.dart`. | `TokenProvider` going from a typedef to an interface is the break consumers actually feel: a closure no longer satisfies the parameter. `TokenProvider.dynamic(myLoader)` is the one-line fix, @@ -73,16 +73,17 @@ UserToken.anonymous())` at construction. Chat has its own anonymous handling in `connectAnonymousUser`; reconcile the two rather than layering them, and note core's `ConnectionIdInterceptor` is deliberately **skipped** for anonymous users. -## Decisions to make +## Decisions taken -- Whether `Token` survives as a deprecated forwarder. `UserToken`'s constructor parses the JWT and - throws on a malformed one, where `Token.fromRawValue` did not — so a forwarder is not - behaviour-preserving for bad input. Probably a clean break with a migration entry. -- Whether chat keeps `GuestTokenProvider` as a public convenience over - `TokenProvider`+`setTokenProvider`, or drops it and documents the two-step. -- Whether `TokenManager` is still constructor-injected into `StreamChatClient` or built internally. - Core's requires a `userId` at construction, which chat does not have until `connectUser` — so - `TokenManager.unconfigured()` at construction and `setTokenProvider` on connect is the shape. +- **`Token` is deleted, not forwarded.** `UserToken`'s constructor parses the JWT and throws on a + malformed one where `Token.fromRawValue` did not, so a forwarder would not be + behaviour-preserving for bad input. +- **`GuestTokenProvider` is dropped.** It was already dead: nothing outside `token.dart` + referenced it, and its only user was the equally unused `Token.guest`. +- **The manager is built internally**, as `TokenManager.unconfigured()`, and configured by + `setTokenProvider` on connect — core's primary constructor needs a `userId`, which chat does not + have until `connectUser`. +- **`devToken` is removed outright** rather than retyped. See the rename map above. ## Risks @@ -103,17 +104,40 @@ None. ## Definition of done -- [ ] `token.dart`, `token_manager.dart` and our `auth_interceptor.dart` are deleted. -- [ ] `StreamChatClient` holds core's `TokenManager`, configured on connect. -- [ ] Tests cover: static token, dynamic provider, expired-token refresh (exactly one retry), - refresh refused across a user switch, refresh skipped for a static provider, and a retried - **multipart** request succeeding — that last one is the `FormData` re-clone. -- [ ] Guest connect adopts the server-assigned id, and two overlapping guest connects produce one - exchange. -- [ ] Anonymous connect sends no `connection_id` and no `Authorization` refresh attempt. -- [ ] `melos bootstrap && melos run analyze && melos run test:dart && melos run test:flutter`. +- [x] `token.dart`, `token_manager.dart` and our `auth_interceptor.dart` are deleted; + `StreamChatClient` holds `TokenManager.unconfigured()` and configures it on connect. +- [x] `_connectUser` takes a single `required TokenProvider`, so every entry point — regular, + provider, anonymous, guest — configures the manager the same way. +- [x] Our token tests are deleted rather than ported: core covers `AuthInterceptor` (25 cases), + `TokenManager` (36), `UserToken` (12) and `TokenProvider` (10) — 83 against our ~30. +- [x] `TokenManager` added to the barrel allowlist. It appears in the exported signatures of + `StreamHttpClient` and `StreamChatApi` but was never nameable — a pre-existing wart. +- [x] `StreamChatClient.devToken` removed; the JWT builder lives in `test/src/utils.dart` as + `testUserToken`, the way `stream_feeds_test` keeps `generateTestUserToken`. +- [x] `melos run analyze` and `melos run format` clean; `stream_chat` 1664 tests green. +- [x] `🛑️ Breaking` CHANGELOG entries and `migrations/v11-migration.md` Symbol Map rows for the + whole rename map, plus a section on the anonymous id. +- [ ] **Verify a live anonymous connect against a real app key.** Adopting core's token layer + changes the anonymous `user_id` from a random value to `!anon` (see below). The source + evidence says it is safe; only a live connect proves it. - [ ] Verified by hand in `sample_app`: cold login, a token that expires mid-session, and a logout → login as a different user. -- [ ] `refactor(llc)!:` title, `🛑️ Breaking` CHANGELOG entries, `migrations/v11-migration.md` - Symbol Map rows for the whole rename map plus a feature section for `TokenProvider`. -- [ ] Decisions recorded here, status box ticked in `README.md`. +- [ ] Status box updated in `README.md`. + +### The anonymous id changed, deliberately + +`Token.anonymous({userId})` used a caller-supplied or **random** id; +`UserToken.anonymous()` is always `User.anonymousUserId` (`!anon`), and +`StaticTokenProvider` validates that a token's id matches the one it is registered under — so the +old behaviour is not expressible on core's layer. + +Adopting `!anon` is the right call rather than a compromise: `monolith/types/user.go:27` defines +`AnonUserID = "!anon"`, and `monolith/auth/auth.go:179` enforces it on anon JWT claims +*specifically so* "customers [cannot] create anon tokens that can be used to impersonate other +users or a server". Chat's random id was the outlier. + +Why it still needs a live check: that enforcement only runs when a raw anon JWT is present, and +chat's anonymous token has an empty `rawValue`, so the claims path is never exercised. What the +server does with the `user_id` **query parameter** on an anonymous request is not settled from +source — `types.NewAnonymousUser(...)` suggests it builds its own user and ignores the client's, +but that is inference. diff --git a/core-migration/05-http-client.md b/core-migration/05-http-client.md index 9971fb9187..d6a94d01db 100644 --- a/core-migration/05-http-client.md +++ b/core-migration/05-http-client.md @@ -32,9 +32,9 @@ out-of-scope plan. **Verified before writing this file, and the risk is small:** ``` -115 call sites across 13 files in lib/src/core/api/ - 54 client.post 19 client.delete 6 client.patch - 23 client.get 8 client.postFile 5 client.put +107 call sites across 13 files in lib/src/core/api/ + 54 client.post 15 client.delete 6 client.patch + 23 client.get 4 client.postFile 5 client.put 0 client.fetch 0 client.request ``` @@ -91,16 +91,13 @@ only gate needed. `LoggingInterceptor` sits after it so the log line carries the converted `StreamApiException` rather than the raw `DioException`. -### Two things to settle on the wire +### The two statics -- **`api_key` placement.** Core's `ApiKeyInterceptor` sets it as a **header**; chat sets it as a - **query parameter** in `StreamHttpClient`'s constructor. Verify the server accepts the header - form for chat endpoints before switching. If it doesn't, keep the query parameter and don't use - core's interceptor — that is a legitimate outcome, not a failure. -- **`StreamChatClient.additionalHeaders` is a static mutable global** read by - `AdditionalHeadersInterceptor`. Core has no such concept and shouldn't. Replace it with - per-client headers on `BaseOptions`, and deprecate the static — two clients in one process - currently share it, which is a bug. +`StreamChatClient.additionalHeaders` and `defaultUserAgent` are both public mutable statics, so two +clients in one process share them. Retiring them needs a per-client `headers` parameter on +`StreamChatClient` to replace the former, and `defaultUserAgent` reads the static +`_systemEnvironmentManager`, so the two have to move together. That is an API addition rather than +an adoption, which is why they outlived this phase. ### `LoggingInterceptor` @@ -110,16 +107,17 @@ two ways: `logPrint` becomes optional, and output routes through `StreamLogger` `Logger`. Sequence this with phase [06](06-logger.md) so consumers see one logging change, not two. -## Decisions to make +## Decisions taken -- Whether the facade is a class (`@internal class StreamChatHttpClient`) or a set of extension - methods on `Dio`. An extension reads better at call sites and cannot be constructed wrongly; a - class is easier to delete later. -- `api_key` header vs query parameter, from the check above. -- Whether `StreamHttpClient` and `StreamHttpClientOptions` are deprecated forwarders or deleted. - `StreamHttpClient` appears in the public signature of `AttachmentFileUploaderProvider` - (`AttachmentFileUploader Function(StreamHttpClient)`), so its removal is also a phase-09 change - — deprecate here, delete there. +- **`StreamHttpClient` stays, as the facade itself.** It was going to be replaced by a separate + `@internal` wrapper, which turned out to be the same object under a new name: its verb wrappers + *are* the facade, and it already owns option assembly. Core's `StreamCoreHttpClient` became the + default `Dio` it builds instead. Making it `@internal` waits on + `AttachmentFileUploaderProvider`, the only public signature naming it — phase + [09](09-uploads.md). +- **`api_key` stays a query parameter**, so core's `ApiKeyInterceptor` is the one pipeline piece + chat does not adopt. See below. +- **Six verbs, not eight.** `fetch` and `request` had no callers in the api layer. ## Risks @@ -137,18 +135,65 @@ two. None, unless the `api_key` check concludes chat needs a query-parameter variant of `ApiKeyInterceptor` — in which case that is a small, obviously-correct core addition. +## What landed, and what did not + +**The verb facade held, which was the whole bet.** `git diff` over `lib/src/core/api/` is +**empty**: all 107 call sites across the 13 `*_api.dart` files are untouched, so phases 04–09 stay +independent of `openapi-migration`. (An earlier count said 115; that double-counted +`attachment_file_uploader.dart`.) + +**Three interceptors became one.** Ours were forks of core's: + +| Was | Now | +| --- | --- | +| `AdditionalHeadersInterceptor` (22) — user agent *and* the `additionalHeaders` static | core's `HeadersInterceptor` for the user agent; ours keeps only the static | +| `ConnectionIdInterceptor` (19) | core's, fed a closure over our `ConnectionIdManager` | +| `LoggingInterceptor` (**344**) | core's, re-exported from the barrel | + +The pipeline is assembled with null-aware elements and `let`, so an absent dependency drops its +interceptor instead of guarding it: + +```dart +const AdditionalHeadersInterceptor(), +?systemEnvironmentManager?.let(HeadersInterceptor.new), +?tokenManager?.let((it) => AuthInterceptor(httpClient, it, tag: '$streamChatLogTag:HttpAuth')), +?connectionIdManager?.let((it) => ConnectionIdInterceptor(() => it.connectionId)), +const ApiErrorInterceptor(), +``` + +`Standard.let` is core's. `ApiErrorInterceptor` sits before the logging interceptor so what gets +logged is the mapped failure rather than the raw transport one. + +**`api_key` stays a query parameter.** Core's `ApiKeyInterceptor` sets a header, and the backend +appears to accept both — its own test harness sets a header +(`monolith/server/servercontext/dummy_auth.go:57`) while a WS test refers to the query parameter. +Changing a working wire contract for no benefit is not worth it, so core's interceptor is the one +piece of the pipeline chat does not adopt. + +**Not landed: the two public statics.** `StreamChatClient.additionalHeaders` and `defaultUserAgent` +both survive. Retiring them needs a per-client `headers` parameter on `StreamChatClient` to replace +the former, and that is an API *addition* rather than an adoption — and `defaultUserAgent` reads +the static `_systemEnvironmentManager`, so it has to move at the same time. +[`UPSTREAM.md`](UPSTREAM.md) records why the interceptor that reads the static should be deleted +rather than moved to core. + ## Definition of done -- [ ] **Every one of the 115 call sites in the 13 `*_api.dart` files is unchanged.** That is the - test of whether the facade held. A diff touching them means the facade is wrong. -- [ ] `stream_http_client.dart` and our three forked interceptors are deleted. -- [ ] The pipeline is assembled in exactly one place, and a test asserts the interceptor order — - including that `ApiErrorInterceptor` precedes `LoggingInterceptor`. -- [ ] `api_key` placement verified against the live API, with the result recorded here. -- [ ] `additionalHeaders` static deprecated; a test asserts two clients can carry different - headers. -- [ ] One real request run against a live app key, not only against mocks. -- [ ] `melos bootstrap && melos run analyze && melos run test:dart && melos run test:flutter`. -- [ ] `refactor(llc)!:` title, `🛑️ Breaking` CHANGELOG entries, `migrations/v11-migration.md` - rows for `StreamHttpClient`, `LoggingInterceptor` and `additionalHeaders`. -- [ ] Decisions recorded here, status box ticked in `README.md`. +- [x] **Every call site in the 13 `*_api.dart` files is unchanged** — an empty diff over that + directory, which is the test of whether the facade held. +- [x] Our `connection_id_interceptor.dart` and `logging_interceptor.dart` are deleted; + `additional_headers_interceptor.dart` keeps only the job core has no concept of. +- [x] The pipeline is assembled in one place, with `ApiErrorInterceptor` ahead of logging. +- [x] `api_key` placement decided and recorded above. +- [x] Interceptor coverage kept: the connection-id test is retargeted at core's type through our + closure, and a `HeadersInterceptor` group is added — core ships both interceptors with **no** + tests of its own ([`UPSTREAM.md`](UPSTREAM.md)). +- [x] `melos run analyze` and `melos run format` clean; `stream_chat` 1670 tests green. +- [x] `🛑️ Breaking` CHANGELOG entry for `LoggingInterceptor`. +- [ ] `StreamHttpClient` itself is still ours — it *is* the verb facade. It becomes `@internal` + when `AttachmentFileUploaderProvider` is retyped in [09](09-uploads.md), which is the only + public signature naming it. +- [ ] `additionalHeaders` / `defaultUserAgent` statics retired — needs the per-client `headers` + parameter described above. +- [ ] One real request against a live app key, not only against mocks. +- [ ] Status box updated in `README.md`. diff --git a/core-migration/06-logger.md b/core-migration/06-logger.md index fdf362bd78..b3ab20b55b 100644 --- a/core-migration/06-logger.md +++ b/core-migration/06-logger.md @@ -3,8 +3,8 @@ **Goal:** log through core's `StreamLogger` so the whole SDK — including the core code phases 04–07 pull in — writes to one place. -**Size:** no chat LOC deleted (chat has no logger abstraction); ~670 core LOC adopted. Breaking on -a public re-export. +**Size:** ~120 chat LOC deleted across two packages, 84 call sites rewritten, ~670 core LOC +adopted. `package:logging` leaves the repo entirely. ## Scope @@ -34,31 +34,6 @@ Core ships a family instead: every core WS class (phase 07) already log through `StreamLogger`. Without this phase, chat's logs split across two systems with no way to see both. -### Bridge, don't break - -Ship a `StreamLogHandler` subclass that forwards a `StreamLogRecord` to a user-supplied `Logger`, -so `StreamChatClient(logger:)` keeps working through a deprecation cycle: - -```dart -// sketch — a handler that keeps package:logging consumers working -class _LoggingBridgeHandler extends StreamLogHandler { - const _LoggingBridgeHandler(this._logger); - final Logger _logger; - - @override - void handle(StreamLogRecord record) => _logger.log( - _levelFor(record.priority), - record.message, - record.error, - record.stackTrace, - ); -} -``` - -That way `logger:` becomes "route core's records into my `Logger`" rather than "the SDK ignores -you", and the `package:logging` re-export can stay for one release before phase -[10](10-cleanup.md) drops it. - ### Claim a tag prefix `StreamLogger`'s handler, priority and filter are **process-global write-only statics**, and @@ -86,21 +61,23 @@ Core's constructors take `tag:` parameters (`StreamWebSocketClient(tag: ...)`, precisely so a product can namespace them — feeds passes `SF:Ws`, `SF:Http`, `SF:HttpAuth`, `SF:WsRecovery`. Pass chat's equivalents everywhere phases 04, 05 and 07 construct a core type. -## Decisions to make +## Decisions taken -- **The chat prefix.** `SCh:` is unambiguous but ugly; `CH:` is cleaner but collides with nothing - today and everything tomorrow. Pick it here and write it down — retagging later invalidates - every consumer's log filter. -- Whether `StreamChatClient(logger:)` keeps its `Logger?` type behind the bridge, or changes to - `StreamLogConfig?` immediately with `logger:` deprecated alongside. The bridge is friendlier; two - parameters for one concern is uglier. -- Whether to keep the per-subsystem emoji naming. Core's tags serve the same purpose and filter - better; the emoji do read nicely in a console. +- **The prefix is `SCh`**, declared once as `streamChatLogTag`. Not `SC` (core's) and not `CH` + (collides with nothing today and everything later). Retagging invalidates every consumer's log + filter, so this is worth fixing in one place. +- **`logLevel` and `logHandlerFunction` become one `logConfig`.** An earlier pass kept their types + with a bridge behind them; that was reversed — see [What landed](#what-landed). +- **The per-subsystem emoji naming stays for chat's own loggers.** Core types get `SCh:`-prefixed + string tags, because that is what `StreamLogFilter.prefix` matches on; the emoji still read + better in a console for chat's own records. ## Risks -- **Anyone wiring `Logger.root.onRecord` sees their logs stop** unless the bridge is in place. - That is the visible break, and it is silent — no compile error, just no output. +- **Anyone wiring `Logger.root.onRecord` sees their logs stop.** Almost every chat logger was + detached, so it never reached `Logger.root` anyway; `AppSettingsManager` was the one exception, + holding a plain `Logger('AppSettingsManager')` whose records did. Anyone who passed + `logHandlerFunction` gets a compile error rather than silence, which is the outcome to want. - Global logger state means a chat client constructed after a feeds client overwrites the feeds configuration. Nothing in this plan fixes that; the tag prefix only makes the result legible. Worth raising upstream if it bites. @@ -113,17 +90,98 @@ precisely so a product can namespace them — feeds passes `SF:Ws`, `SF:Http`, ` None required. Worth raising, not blocking: the process-global handler means two Stream SDKs cannot log independently in one app. +## What landed + +**The whole thing: `package:logging` is gone from every package in the repo.** An earlier pass +shipped a bridge instead — a `StreamLogHandler` forwarding core's records into chat's `Logger` — +which was the wrong call and is deleted. It left two logging systems alive, which is the problem +this phase exists to solve, and it was code whose only purpose was to be deleted later. + +**Why it was urgent either way.** An unconfigured `StreamLogger` uses `StreamLogHandler.silent` +with `minPriority(.none)` — it drops *everything*. Every record from the HTTP client, the token +manager and (after [07](07-websocket.md)) the whole WebSocket stack was going nowhere. That makes +06 a prerequisite for **07** as much as for 05: adopting core's WS without it would have made +chat's connection logging silent. + +**What replaced it:** + +| Was | Now | +| --- | --- | +| `logLevel: Level`, `logHandlerFunction: LogHandlerFunction` | `logConfig: StreamLogConfig` | +| `client.logger` (a `Logger`) | `client.logger` (a `StreamLogger`) | +| `detachedLogger(name)`, `defaultLogHandler`, `LogHandlerFunction`, `_levelEmojiMapper` | gone — `StreamLogHandler.console()` is the default | +| `export 'package:logging/logging.dart' show Logger, Level, LogRecord;` | core's `StreamLogger`, `StreamLogConfig`, `StreamLogHandler`, `StreamLogFilter`, `StreamLogPriority`, `StreamLogRecord` | +| `Logger?` injected into `WebSocket`, `RetryQueue`, `ChannelDeliveryReporter`, `StreamHttpClient`, `StreamChatApi` | each owns a `StreamLogger`, built from a `tag` parameter | + +**The default is unchanged.** `const StreamLogConfig()` is `priority: warning` with +`StreamLogHandler.console()` — exactly what chat documented before ("write all messages with level +Warn or Error to stdout"). Nobody who never touched logging sees a difference. + +**Tags are parameters, not constants.** Core's pattern: a class takes `{String tag = 'SC:WsClient'}` +and builds `StreamLogger(tag)`; the product passes its own at the construction site. Chat's +infrastructure classes follow it, so a tag can be overridden. `StreamChatClient.logger` and +`Channel` hold a `const StreamLogger(...)` instead, matching feeds' `const StreamLogger('SF:Client')` +— they *are* the site. + +**Prefix: `SCh`.** Not `SC` — that is `stream_core`'s, and the handler is process-global, so the +prefix is the only thing keeping two SDKs' records apart. Feeds uses `SF`. + +`stream_chat_persistence` moved too: it had its own `Logger.detached('💽')`, its own +`_defaultLogHandler` and its own emoji map, and its constructor no longer takes logging parameters +at all. + +### Which classes take a `tag`, and which do not + +Core's rule: a class takes `{String tag = '...'}` when it both logs with that tag *and* derives +children's tags from it (`'$tag:Engine'`, `'$tag:Health'`). Chat follows it for infrastructure — +`WebSocket`, `RetryQueue`, `ChannelDeliveryReporter`, `AppSettingsManager`. + +Two deliberate exceptions: + +- **`StreamChatClient.logger` and `Channel`** hold a `StreamLogger` directly, matching feeds' + `const StreamLogger('SF:Client')`. They are the construction site, so there is nothing above them + to pass a tag down. +- **`ChannelClientState` takes no tag**, because it logs nothing — it would be a knob whose only + job is to be forwarded. It passes the queue `'SCh:RetryQueue:${channel.cid}'`, which is where the + channel identity chat used to put in the logger *name* now lives. + +Per-instance identity is appended, not nested: `SCh:RetryQueue:messaging:general`, not +`SCh:Channel:messaging:general:RetryQueue`. Nesting reads like a hierarchy but makes +`StreamLogFilter.prefix` on `SCh:RetryQueue` stop matching, and filtering by subsystem is more +useful than filtering by channel. + +## What this cost, for the record + +`package:logging` was woven through chat's **public** API, which is why an earlier pass tried to +avoid touching it: + +| Surface | Kind | +| --- | --- | +| `StreamChatClient(logLevel: Level, logHandlerFunction: LogHandlerFunction)` | constructor params | +| `client.logger`, `client.detachedLogger(name)` | both return a `Logger` | +| `StreamChatClient.defaultLogHandler(LogRecord)` | static | +| `typedef LogHandlerFunction = void Function(LogRecord)` | typedef | +| `export 'package:logging/logging.dart' show Logger, Level, LogRecord;` | barrel re-export | +| `Logger?` parameters on `StreamHttpClient`, `StreamChatApi`, `WebSocket`, `RetryQueue`, `ChannelDeliveryReporter` | internal, but public types | + +It came to four things, and only the first was mechanical: + +1. **84 internal call sites** across 7 files moved from `logger.info('x')` to `logger.i(() => 'x')`. +2. **The public API changed shape** — the table above. +3. **The `package:logging` re-export and dependency went**, from `melos.yaml` and both manifests. +4. **The bridge was deleted**, along with its tests. + +Doing it in v11 rather than after was the right call: v11 already breaks the error layer, the token +layer and the query DSL, so this costs a consumer one more entry in a guide they are already +reading. Shipping the bridge and breaking logging in v12 would have spent the same budget twice. + ## Definition of done -- [ ] `StreamLogger.configure` is called once from `StreamChatClient`, and not at all when no - config was supplied — a test asserts the no-config case installs nothing. -- [ ] Every core type chat constructs is passed a chat-prefixed `tag:`. -- [ ] The `package:logging` bridge handler exists, and a test asserts a record logged by core's - `AuthInterceptor` reaches a consumer-supplied `Logger`. -- [ ] `logger:` parameters are deprecated with a message naming the replacement. -- [ ] Lazy messages are used (`() => '...'`), not eagerly-built strings. -- [ ] `melos bootstrap && melos run analyze && melos run test:dart && melos run test:flutter`. -- [ ] `refactor(llc)!:` title, `🛑️ Breaking` CHANGELOG entry, `migrations/v11-migration.md` - Symbol Map rows for the `package:logging` re-export and each `logger:` parameter. -- [ ] Decisions recorded here — **especially the tag prefix** — and status box ticked in - `README.md`. +- [x] `StreamLogger.configure` is called once from `StreamChatClient`, with the priority taken + from `logConfig.priority`. +- [x] Every core type chat constructs is passed a `SCh:`-prefixed tag. +- [x] Lazy messages (`() => '...'`) throughout the logger call sites. +- [x] `melos run analyze` and `melos run format` clean; `stream_chat` 1670 tests green. +- [ ] `logLevel` / `logHandlerFunction` / `logger` / `detachedLogger` deprecated — deferred with + the rest of the removal above, since deprecating them needs the replacement to exist. +- [ ] Status box updated in `README.md`. diff --git a/core-migration/DEFERRED.md b/core-migration/DEFERRED.md new file mode 100644 index 0000000000..3d72a8bb3a --- /dev/null +++ b/core-migration/DEFERRED.md @@ -0,0 +1,77 @@ +# Deferred work + +Everything the migration has consciously postponed, in one place. Each phase file explains its +rows in context; this is the index, so nothing survives only as a sentence buried in a phase doc. + +A row leaves this file when it lands, not when it is decided. + +## Blocked on something outside the repo + +| | What | Blocked on | Phase | +| --- | --- | --- | --- | +| ☐ | Adopt core's `CurrentPlatform` / `PlatformType`, renaming `.name` → `.operatingSystem` | A **`stream_core` release** carrying `debugCurrentPlatformOverride`. It is on core's `main`; 0.5.0 does not have it, and `stream_chat_flutter`'s tests set it in 8 places. | [02](02-platform-and-environment.md) | +| ☐ | Adopt core's `Filter` / `Sort` / `ComparableField` | Core gaining `$nor`. `$ne` and `$nin` are *not* upstream asks — every other SDK has deprecated or dropped them. | [08](08-query-dsl.md) | +| ☐ | A test proving a malformed response body surfaces as `StreamClientException` rather than a bare `TypeError` | A call through the generated client — nothing in this package exercises `runApiSafely` yet. Arrives with `openapi-migration` group 02. | [03](03-errors.md) | + +## Needs a live check, not more code + +| | What | Why source cannot settle it | Phase | +| --- | --- | --- | --- | +| ☐ | One anonymous connect against a real app key | Anonymous requests now send `user_id=!anon` instead of a random id. Three backend paths say it is safe, but the enforcement in `auth.go:179` only runs for a raw anon JWT, which chat never sends — so what the server does with the *query parameter* is inference. | [04](04-token-and-auth.md) | +| ☐ | `sample_app` by hand: cold login, mid-session token expiry, logout → login as a different user | Core's interceptor refuses to refresh across a user switch. Correct, but it is a behaviour change on the path where failure means "cannot log in". | [04](04-token-and-auth.md) | +| ☐ | One real request against a live app key | `api_key` stays a query parameter rather than moving to core's header-setting `ApiKeyInterceptor`; mocks cannot tell us the server agrees. | [05](05-http-client.md) | +| ☐ | Benchmark `merge` on realistic lists (1k+ sorted messages, a large member list, the read map) | Decides whether chat adopts core's keyed-map-merge or core adopts chat's two-pointer merge. It runs on every message, member and read update. | [01](01-utilities.md) | +| ☐ | `flutter build web --wasm` on the sample app | Core's detector has no throwing stub, so this should be a formality — but the wasm fix (`#2940`) exists because chat's *did*, so confirm rather than assume. | [02](02-platform-and-environment.md) | + +## Waiting on a decision or a later phase + +| | What | Waiting on | Phase | +| --- | --- | --- | --- | +| ☐ | **A `StreamChatConfig`**, mirroring `FeedsConfig` | Deliberately last, as a cleanup step once the adoption is done. It subsumes several rows below, so doing it early would mean doing them twice. See [below](#the-streamchatconfig-that-absorbs-several-of-these). | [10](10-cleanup.md) | +| ☐ | Retire `StreamChatClient.additionalHeaders` and `defaultUserAgent` | Both are public mutable statics, so two clients in one process share them. Replacing the first needs a per-client `headers` option; the second reads the static `_systemEnvironmentManager`, so they move together. | [10](10-cleanup.md) | +| ☐ | Take `StreamHttpClientOptions` directly instead of `baseURL` / `connectTimeout` / `receiveTimeout` | Folds into the config above rather than being a separate break. | [10](10-cleanup.md) | +| ☐ | Mark `StreamHttpClient` `@internal` | `AttachmentFileUploaderProvider` is the only public signature naming it, and retyping that is phase 09's call. | [09](09-uploads.md) | +| ☐ | Reclassify the SDK's own precondition throws | 23 sites still raise `StreamChatError`. `ERROR_LAYER.md` splits them further than a sweep can: a condition a correct program can hit becomes a `StreamException`, while genuine misuse should raise `StateError` / `ArgumentError` and never be wrapped. Doing it by sed would get it wrong. | [03](03-errors.md) | +| ☐ | Delete `stream_chat_error.dart` | Three things first: phase 07 removes `StreamWebSocketError`, the precondition throws above are reclassified, and the UI's attachment-validation subtypes stop being errors — they are *returned values*, never thrown. `StreamChatNetworkError` is already gone. | [03](03-errors.md) | +| ☐ | Decide the fate of `Filter.custom` / `Filter.raw` / `Filter.empty` | Core has no equivalent. At least one should survive: a typed `FilterField` registry cannot express a field the SDK does not model. | [08](08-query-dsl.md) | +| ☐ | Decide whether core grows channel-scoped `CdnClient` operations, or chat keeps its broader uploader interface | Half of chat's uploads are channel-scoped and core's `CdnClient` has only four CDN-scoped methods. Must agree with `openapi-migration/12-uploads-cdn.md` before either starts. | [09](09-uploads.md) | + +## Landed, listed so nobody re-raises it + +| | What | Where | +| --- | --- | --- | +| ☑ | Remove chat's own logger and `package:logging` | Done in [06](06-logger.md): the SDK writes through `StreamLogger`, `logConfig` replaces `logLevel` + `logHandlerFunction`, and no package in the repo imports `package:logging` any more. | +| ☑ | Delete `StreamChatClient.devToken` | [04](04-token-and-auth.md) | + +## The `StreamChatConfig` that absorbs several of these + +Sequenced into [10](10-cleanup.md) rather than done now, because it is an API redesign and the +adoption keeps changing what belongs in it. `FeedsConfig` is the shape to follow — nullable fields, +`const`-constructible, with test seams kept as separate `@visibleForTesting` parameters rather than +config: + +```dart +StreamChatClient( + apiKey, { + StreamChatConfig config = const StreamChatConfig(), + // @visibleForTesting seams stay out of config, as in stream_feeds. + StreamChatApi? chatApi, + WebSocket? ws, +}); + +class StreamChatConfig { + const StreamChatConfig({ + this.logConfig, // already a constructor param today + this.httpOptions, // replaces baseURL / connectTimeout / receiveTimeout + this.customHeaders, // retires the `additionalHeaders` static + this.retryPolicy, + this.attachmentFileUploaderProvider, // the `cdnClient` analogue + this.recoverStateOnReconnect, + this.isLocalUnreadCountEnabled, + }); +} +``` + +The constructor currently carries fourteen parameters, several of them test seams sitting beside +real configuration. Grouping them is one break instead of several, and it is what kills the two +public statics. diff --git a/core-migration/README.md b/core-migration/README.md index f6898b606b..14882addcd 100644 --- a/core-migration/README.md +++ b/core-migration/README.md @@ -8,28 +8,35 @@ One file per phase, in the order they should land. Each carries a goal, the exac with their core counterparts, the decisions that phase has to make, its risks, the upstream `stream_core` work it needs, and a definition of done. +Two indexes cut across the phases: + +- [`DEFERRED.md`](DEFERRED.md) — everything consciously postponed, and what unblocks each item. +- [`UPSTREAM.md`](UPSTREAM.md) — what should move the *other* way, chat → core. + | | Phase | Chat LOC | Core LOC | Breaking | Status | | --- | --- | --- | --- | --- | --- | -| [01](01-utilities.md) | Utilities — in-flight cache, list extensions | ~340 | ~200 | decision | ◐ | -| [02](02-platform-and-environment.md) | Platform detector & system environment | ~220 | ~300 | yes (rename) | ☐ | -| [03](03-errors.md) | Errors & the `Result` surface | ~410 | ~900 | **yes** | ☐ | -| [04](04-token-and-auth.md) | Token & auth | ~225 | ~500 | **yes** | ☐ | -| [05](05-http-client.md) | HTTP client & interceptor pipeline | ~600 | ~150 | yes | ☐ | -| [06](06-logger.md) | Logger | — | ~670 | **yes** | ☐ | -| [07](07-websocket.md) | WebSocket transport | ~790 | ~1,940 | **yes** | ☐ | -| [08](08-query-dsl.md) | Query DSL — filter, sort, comparable field | ~600 | ~1,420 | **yes** | ☐ | +| [01](01-utilities.md) | Utilities — in-flight cache, list extensions | ~340 | ~200 | yes | ☑ | +| [02](02-platform-and-environment.md) | Platform detector & system environment | ~330 | ~300 | yes (rename) | ☑ | +| [03](03-errors.md) | Errors & the `Result` surface | ~410 | ~900 | **yes** | ☑ | +| [04](04-token-and-auth.md) | Token & auth | ~225 | ~500 | **yes** | ☑ | +| [05](05-http-client.md) | HTTP client & interceptor pipeline | ~600 | ~150 | yes | ◐ | +| [06](06-logger.md) | Logger | ~120 | ~670 | **yes** | ☑ | +| [07](07-websocket.md) | WebSocket transport | ~790 | ~1,940 | **yes** | ⏸ | +| [08](08-query-dsl.md) | Query DSL — filter, sort, comparable field | ~600 | ~1,420 | **yes** | ☑ | | [09](09-uploads.md) | Uploads & CDN | ~520 | ~1,400 | yes | ☐ | | [10](10-cleanup.md) | Cleanup — deps, barrel, deprecation kit | — | — | no | ☐ | -Status key: ☐ not started · ◐ partly landed · ☑ done. +Status key: ☐ not started · ◐ partly landed · ☑ done · ⏸ parked. + +**07 is parked.** Nothing after it depends on it, so 08–10 proceed as planned. **Net:** ~4.0k LOC of hand-written `lib/src` deleted (of ~29.0k), replaced by ~5.5k LOC of core that is already written and tested. Six direct dependencies become transitive. -**In progress:** phase 01's `InFlightCache` has landed. `list_extensions` is held back pending a -performance comparison — core's `merge` is a keyed-map-merge-then-sort where ours is a two-pointer -merge, and it runs on every message, member and read update. `stream_chat_dio_error` moved into -phase [03](03-errors.md), which is where its payload type becomes a `StreamException`. +**In progress.** Phases 01–06 have each landed their core adoption; what is left in them is +indexed in [`DEFERRED.md`](DEFERRED.md), which says what unblocks each item. Notably 06 removed +chat's own logger outright rather than bridging it, so no package in the repo imports +`package:logging` any more. ## Scope @@ -99,16 +106,21 @@ Decided once here, not re-argued per phase. ### The barrel is a `show` allowlist `stream_feeds` opens its barrel with `export 'package:stream_core/stream_core.dart';`. **We -cannot.** Exporting core wholesale from `lib/stream_chat.dart` collides on `AttachmentFile`, -`Filter`, `FilterOperator`, `NullOrdering`, `ComparableField`, `CurrentPlatform`, `PlatformType`, -`SystemEnvironment`, `SystemEnvironmentManager`, `XStreamClientHeaderExtension`, `TokenManager`, -`AuthType`, `User`, `LoggingInterceptor`, `InterceptStep`, `LogPrint`, `AuthInterceptor`, -`ConnectionIdInterceptor`, `InFlightCache`, and `Success` — the last being chat's -`UploadState.success` variant class against core's `Result` `Success`. Core also re-exports all -of dio, while our barrel deliberately re-exports a *narrowed* dio. - -Narrowing is already the precedent in that file: `filter.dart show Filter, FilterOperator` -(`stream_chat.dart:52`) and `device_api.dart show PushProvider`. +cannot.** Exporting core wholesale from `lib/stream_chat.dart` still collides on `AttachmentFile`, +`Filter`, `FilterOperator`, `NullOrdering`, `ComparableField`, `CurrentPlatform`, `PlatformType` +and `User`. Core also re-exports all of dio, while our barrel deliberately re-exports a *narrowed* +dio — and `package:async`, which our barrel also re-exports, declares a `Result` of its own. + +Each landed phase shortens that list, since an adopted type stops being a duplicate. +`InFlightCache`, `SystemEnvironment`, `SystemEnvironmentManager` and +`XStreamClientHeaderExtension` are off it, as are `TokenManager`, `AuthType`, `AuthInterceptor`, +`ConnectionIdInterceptor`, `LoggingInterceptor`, `InterceptStep` and `LogPrint` — chat declares +none of them any more. `Success` went with the rename of `UploadState`'s variants. The allowlist +is the mechanism throughout — grow it phase by phase rather than switching to a wholesale export +at the end. + +Narrowing is already the precedent in that file: `filter.dart show Filter, FilterOperator` and +`device_api.dart show PushProvider`. ### What stays ours @@ -134,10 +146,20 @@ the property. It is the eventual right home; it is not this plan's job to move i ### Upstream core work is batched, not blocking +Tracked in [`UPSTREAM.md`](UPSTREAM.md), which also covers the reverse direction — things chat has +that every product needs, and things chat's use has shown core to be missing or wrong about. + Each phase names the `stream_core` changes it needs, and those should be grouped into as few core releases as possible. Only one is a hard block on API we already ship publicly: `Filter`'s `$ne` / `$nin` / `$nor` operators, for phase [08](08-query-dsl.md). +**Diff against the resolved package, not the sibling repo.** Two of this plan's original upstream +asks turned out to be already satisfied, because they had been derived from +`stream-core-flutter`'s unreleased `main` rather than from +`~/.pub-cache/hosted/pub.dev/stream_core-0.5.0`, which is what `stream_chat` actually resolves. +The distinction also changes the *kind* of ask: something already on core's `main` needs a +release, not a PR. + Cross-repo workflow is in [`STYLE_GUIDE.md`](../STYLE_GUIDE.md) (§Dependency management): a path dependency while both repos change together, back to a hosted constraint in `melos.yaml` before release. Never edit a package's `pubspec.yaml` constraints directly. diff --git a/core-migration/UPSTREAM.md b/core-migration/UPSTREAM.md new file mode 100644 index 0000000000..f4bd301f6a --- /dev/null +++ b/core-migration/UPSTREAM.md @@ -0,0 +1,68 @@ +# What should move the other way: chat → `stream_core` + +The rest of this plan moves chat *onto* core. This file tracks the opposite direction — things chat +has that every Stream product needs, and things core has that chat's use has shown to be wrong or +missing. + +Worth keeping because the migration surfaces these continuously: you only find out that a helper is +generic when a second product needs it, and this is the pass where chat reads core closely enough +to notice. Each row says what the evidence is, so nobody has to re-derive it. + +Status: ☐ not raised · ◐ raised upstream · ☑ landed in core + +| | What | Why it belongs in core | Blocked on | +| --- | --- | --- | --- | +| ☐ | **The retry table** — `isRetriable` over the sealed exception kinds | `ERROR_LAYER.md` §Retrying *specifies* this table, and core owns the doc. Chat now implements it ([03](03-errors.md)); feeds independently re-derived a partial version in `capabilities_repository.dart`'s `shouldRetry`. Two products deriving the same table from the same spec is the definition of a core concern. | Nothing. Strongest candidate here. | +| ☐ | **`normalizeStringForSort`** (`core/util/string_sort_normalizer.dart`, 95 LOC) | Folds diacritics and ligatures (`Ł→l`, `Ø→o`, `Æ→ae`) so client-side name sorts match the server's collation. Nothing about it is chat-specific — any product sorting user names needs the same folding, and core's `ComparableField` currently uses a plain `String.compareTo`. | [08](08-query-dsl.md) needs it either way; upstreaming is the better half of that decision. | +| ☐ | **`Filter` `$nor`** | A *logical* operator, so it sits beside core's existing `AndOperator` / `OrOperator`. Chat, Swift and JS all expose it and none has deprecated it; core is the only one missing it. | Nothing. Small and obviously correct. | +| ☐ | **The two-pointer `merge`** (`core/util/list_extensions.dart`) | If the benchmark [01](01-utilities.md) is parked on shows it beats core's keyed-map-merge-then-sort at real list sizes, core should take *ours* rather than chat taking core's — every product merges paginated lists. | The benchmark. | +| ☐ | **`HeadersInterceptor` and `ConnectionIdInterceptor` tests** | Core ships both interceptors with **no tests**. Chat had tests for its forks, so this phase kept them chat-side (`additional_headers_interceptor_test.dart`, `connection_id_interceptor_test.dart`) pointed at core's types — they belong next to the code they cover. | Nothing. Port them up. | +| ☐ | **A hand-written multipart CDN interface** | Feeds hand-wrote `CdnApi` because the generator emits a JSON `@Body()` for `multipart/form-data` operations, with no progress or cancellation. Chat will hand-write the same thing in [09](09-uploads.md). Two identical hand-written retrofit interfaces is a smell — either core owns one, or the generator is fixed. | Prefer the generator fix; see the `openapi-codegen` skill. | +| ☐ | **`_ResultCallAdapter`** | Three lines wrapping `runApiSafely`, and feeds already declares it **twice** (generated `default_api.dart` and hand-written `cdn_api.dart`). Chat's generated client has a third. Core owns `runApiSafely`; it may as well own the adapter. | Nothing. Trivial. | +| ☐ | **`ComparableField` returning `0` for incomparable types** | Core throws `ArgumentError`; chat returns `0`. A throw turns a cosmetic ordering glitch into a crash inside a list view. Argue chat's behaviour is the right default rather than working around it. | Argument, not code. | +| ◐ | **`CurrentPlatform.debugCurrentPlatformOverride`** | Already on core's `main` — chat just cannot use it until there is a release. Recorded here so nobody re-raises it as missing. | A `stream_core` release. | + +## Deliberately *not* moving + +Recording these so the question does not get asked twice. + +**`AdditionalHeadersInterceptor` — don't move it, delete it.** After [05](05-http-client.md) it does one +thing: read `StreamChatClient.additionalHeaders`, a static mutable global. The mechanism is generic, +but core already answers this concern differently — feeds threads `config.customHeaders` into +`BaseOptions.headers` as Dio *defaults*, deliberately, so the SDK's own interceptors always win over +a user-supplied header whose casing differs. An interceptor exists here only because our static can +be reassigned after the client is built. The end state is a per-client `headers` option and no +interceptor, which also retires the `defaultUserAgent` static beside it. Moving it to core would +enshrine the shape we want to get rid of. + +**`ConnectionIdManager`.** The type is 27 trivial lines, so moving it would be easy and pointless. +The reason it stays is not the storage but the *semantics*: `client.dart:774` and `:907` early-return +on `hasConnectionId` and `:1071` uses it to pick a query parameter, so chat asks questions of it that +core's `ConnectionIdGetter` closure cannot express. + +**`RetryPolicy` / `RetryQueue`.** The retry *table* belongs upstream (above); the queue does not. It +takes a `Channel`, reads `client.retryPolicy`, calls `channel.state.retryFailedMessages()` and +listens for `EventType.connectionRecovered` — chat domain in every direction. + +**`$ne` and `$nin`.** Core is *right* not to have them. Android deprecates both — `ne` with +"the notEquals filter is inefficient and causes performance issues. It will not be supported in the +future", `nin` with "this filter will stop to be supported in the future" — and the JS SDK, which +is the reference client, does not declare either in its `QueryFilter` type at all. Chat should +follow Android and deprecate them rather than push them upstream. (Swift still exposes both +undeprecated, which looks like an oversight there rather than a signal.) + +**`Event`, `EventType`, `event_resolvers.dart`, `Serializer`, `message_rules.dart`.** Chat's domain +vocabulary. `ERROR_LAYER.md`'s rule generalizes well here: a thing belongs in core when a second +product would react to it the same way. Nothing outside chat reacts to `message.deleted`. + +## How to raise one + +Core is a separate repo with its own release cadence, so batch these: a row here is rarely urgent on +its own, and each release chat has to wait for costs more than the change itself. The two worth +pushing first are the ones this plan is actually blocked on — `Filter`'s `$nor`, and a release +carrying `debugCurrentPlatformOverride`. + +Cross-repo workflow is in [`STYLE_GUIDE.md`](../STYLE_GUIDE.md) (§Dependency management): a path +dependency while both repos change together, back to a hosted constraint in `melos.yaml` before +release. And read core against `~/.pub-cache/hosted/pub.dev/stream_core-/`, not the sibling +checkout — this plan has already been wrong twice by reading unreleased `main`. diff --git a/melos.yaml b/melos.yaml index 7ccc2a1b37..e2b493761e 100644 --- a/melos.yaml +++ b/melos.yaml @@ -76,7 +76,6 @@ command: json_annotation: ^4.12.0 just_audio: ^0.10.5 latlong2: ^0.9.1 - logging: ^1.3.0 lottie: ^3.3.3 markdown: ^7.3.0 marionette_flutter: ^0.6.0 diff --git a/migrations/v11-migration.md b/migrations/v11-migration.md index 9fc606b020..81cb111569 100644 --- a/migrations/v11-migration.md +++ b/migrations/v11-migration.md @@ -72,7 +72,24 @@ search-and-replace you can apply directly. `Kind` is one of `renamed`, `removed` | `StreamChatNetworkError` | `StreamApiException` (`stream_core`) | `retyped` | Thrown-then-caught becomes `Failure.error`; a sealed family, so `switch` is exhaustive | | `StreamChatNetworkError.code` / `.message` / `.statusCode` | `StreamApiException.code` / `.message` / `.statusCode` | `moved` | `code` is now a `StreamErrorCode` | | `StreamChatNetworkError.isRequestCancelledError` | `StreamNetworkException.isCancelled` | `moved` | | -| `ChatErrorCode` | `StreamErrorCode` (`stream_core`) | `removed` | Extension type over `int` with named constants | +| `StreamChatNetworkError.stackTrace` | `Failure.stackTrace`, or the language at the throw site | `removed` | A `StreamException` carries `message` and `cause` and no trace: a trace records the raise, not the failure | +| `StreamChatNetworkError.type` (`StreamChatNetworkErrorType`) | `StreamNetworkException.isTimeout` / `.isCancelled` | `retyped` | Lossy: `connectionTimeout`, `sendTimeout` and `receiveTimeout` all become `isTimeout` | +| `ChatErrorCode` | `StreamErrorCode` (`stream_core`) | `removed` | Extension type over `int` with named constants. `requestTimeout` was `23`, which the API never returns; the real code is `48` | +| `RetryPolicy.shouldRetry`'s `StreamChatError?` | `StreamChatException?` | `retyped` | | +| `UploadState`'s `Preparing` / `InProgress` / `Success` / `Failed` | `UploadStatePreparing` / `UploadStateInProgress` / `UploadStateSuccess` / `UploadStateFailed` | `renamed` | Frees `Success` for `Result` | +| `PagedValue.error(StreamChatError)` (`stream_chat_flutter_core`) | `PagedValue.error(StreamChatException)` | `retyped` | | +| `errorBuilder: Function(BuildContext, StreamChatError)` (scroll views) | `Function(BuildContext, StreamChatException)` | `retyped` | | +| `Token` | `UserToken` (`stream_core`) | `renamed` | `Token.fromRawValue(x)` → `UserToken(x)`; parses `exp`, so expiry is known | +| `TokenProvider` (typedef `Future Function(String)`) | `TokenProvider` (interface, `stream_core`) | `retyped` | A closure no longer satisfies it. Wrap it: `TokenProvider.dynamic(loader)`, where `typedef UserTokenLoader = Future Function(String userId)` — so the loader returns a `UserToken`, not a `String`, and must be async | +| — | `UserToken(rawJwt)` | `added` | **Throws on a malformed JWT**, where `Token.fromRawValue` accepted anything. It also rejects a token whose `user_id` claim does not match the id it was loaded for. Both present as "cannot log in" rather than as a compile error | +| `TokenManager.loadToken()` / `.isStatic` / `.setTokenOrProvider()` | `.getToken()` / `.usesStaticProvider` / `.setTokenProvider()` | `renamed` | `loadToken(refresh: true)` becomes `expireToken()` then `getToken()` | +| `StreamChatClient.devToken(userId)` | — | `removed` | Generate tokens on your backend | +| `StreamChatClient(logLevel:, logHandlerFunction:)` | `StreamChatClient(logConfig: StreamLogConfig(...))` | `retyped` | Default is unchanged: warnings and errors to the console | +| `StreamChatClient.logger` (a `Logger`) | `StreamChatClient.logger` (a `StreamLogger`) | `retyped` | Messages are lazy: `logger.i(() => '…')` | +| `StreamChatClient.detachedLogger` / `.defaultLogHandler` / `LogHandlerFunction` | — | `removed` | Supply a `StreamLogHandler`; `StreamLogHandler.console()` is the default | +| `export 'package:logging'` (`Logger`, `Level`, `LogRecord`) | `StreamLogger`, `StreamLogConfig`, `StreamLogHandler`, `StreamLogFilter`, `StreamLogPriority`, `StreamLogRecord` | `removed` | `package:logging` is no longer a dependency | +| `LoggingInterceptor` / `InterceptStep` / `LogPrint` | — | `removed` | The interceptor is installed by default and writes through your `StreamLogHandler`; route its output with `logConfig` | +| `StreamChatPersistenceClient(logLevel:, logHandlerFunction:)` | — | `removed` | Logging is configured once, on the client | | _(more added per feature as PRs land)_ | | | | --- @@ -113,6 +130,112 @@ underlying error: final response = (await client.getDevices()).getOrThrow(); ``` +### Endpoints that still throw + +`Result` arrives feature by feature. Until a given endpoint has migrated it still **throws** — but it throws a +`StreamChatException` now, not a `StreamChatNetworkError`. So during the v11 betas both of these are live, and both +report the same four kinds: + +```dart +// A migrated endpoint returns a Result. +final result = await client.getDevices(); + +// One that has not yet still throws — the type is what changed. +try { + await channel.sendMessage(message); +} on StreamChatException catch (error) { + print(error.message); +} +``` + +`StreamChatException` is an alias of `stream_core`'s `StreamException`, so either name catches the same failures. + +**Reading `.code` or `.statusCode` means catching a subtype — and that narrows what you catch.** The +tempting one-for-one swap silently stops handling most failures: + +```dart +// ✗ compiles, and no longer catches timeouts, cancellation, auth failures or +// a response the SDK could not decode. +} on StreamApiException catch (e) { + if (e.statusCode == 429) backOff(); +} + +// ✓ catch the root, then match. `StreamChatException` is sealed, so this +// `switch` is exhaustive with no default arm. +} on StreamChatException catch (e) { + switch (e) { + case StreamApiException(:final statusCode) when statusCode == 429: backOff(); + case StreamNetworkException(isTimeout: true): retryLater(); + case StreamAuthenticationException(): reauthenticate(); + case StreamClientException(): rethrow; // an SDK bug, not yours + case StreamApiException(): showError(e.message); + case StreamNetworkException(): showOffline(); + } +} +``` + +Note this differs from the `Result.fold` example further down: `Failure.error` is typed `Object`, so +a `switch` on it *does* need a default arm. Only the caught root is sealed. + +> **`StreamChatNetworkError` is gone, not deprecated.** Nothing throws it any more, so leaving the name declared +> would let `on StreamChatNetworkError catch (e)` keep compiling while silently matching nothing — a break you +> could ship without noticing. Deleting it makes the same clause fail to compile, so the analyzer points at every +> site you need to change. + +### Logging + +One `logConfig` replaces the two logging parameters, and records are `stream_core`'s: + +**Before:** +```dart +final client = StreamChatClient( + apiKey, + logLevel: Level.INFO, + logHandlerFunction: (LogRecord record) => myTracker.log(record.message), +); +``` + +**After:** +```dart +class MyHandler extends StreamLogHandler { + const MyHandler(); + + @override + void handle(StreamLogRecord record) => myTracker.log(record.message); +} + +final client = StreamChatClient( + apiKey, + logConfig: const StreamLogConfig( + priority: StreamLogPriority.info, + handler: MyHandler(), + ), +); +``` + +Leave `logConfig` out and nothing changes from before: warnings and errors go to the console. + +Records carry a `tag` naming the subsystem — `SCh:Ws`, `SCh:Http`, `SCh:RetryQueue` — and +`StreamLogFilter.prefix` filters on it, so you can turn one subsystem up without the rest. The +handler is process-global across Stream SDKs, which is why the tags are prefixed per product. + +`StreamChatPersistenceClient` no longer takes logging parameters at all; it writes through the same +logger. + +### Anonymous connections identify as `!anon` + +`connectAnonymousUser` previously sent a client-generated random `user_id`; it now sends `!anon`, which is the id +the backend reserves for anonymous access and what our other SDKs send. `client.state.currentUser.id` reflects it. +If you keyed anything off that random id, it is no longer random. + +### Retry behaviour changed + +If you rely on the SDK's automatic retry of failed messages, it now retries more: a request that never reached the +server, a 5xx, a 429 and a 408. It still never retries another 4xx, a cancelled request, broken credentials, or +anything the server marked `unrecoverable`. Previously only failures *without* a parseable error body retried, so a +500 and a 429 did not. A custom `RetryPolicy.shouldRetry` overrides this, and `error.isRetriable` gives you the +default decision. + ### The error type changed too `Failure.error` is statically typed `Object`, and at runtime it is always a `StreamException` from `stream_core` — @@ -146,7 +269,7 @@ counterpart: `code` is now a `StreamErrorCode` (an extension type over `int`, wi `StreamApiException` exposes `isTokenExpired`, `isTokenNotYetValid`, `isTokenSignatureInvalid`, `isApiKeyInvalid` and `isRateLimited` directly, so the common checks need no code of your own. -`ChatErrorCode` is removed — use `StreamErrorCode`. +`ChatErrorCode` is removed — use `StreamErrorCode`. One value differed from the API: `requestTimeout` was `23`, a code the backend never returns, so anything matching on it never matched. The real code is `48`. `Result` and the `StreamException` family are exported from `package:stream_chat/stream_chat.dart`. diff --git a/packages/stream_chat/CHANGELOG.md b/packages/stream_chat/CHANGELOG.md index 447f004b46..a12747948e 100644 --- a/packages/stream_chat/CHANGELOG.md +++ b/packages/stream_chat/CHANGELOG.md @@ -1,8 +1,37 @@ ## Upcoming Beta +🛑️ Breaking + +- Logging moves to `stream_core`. `logLevel` and `logHandlerFunction` become one `logConfig`, `client.logger` is a `StreamLogger`, and `detachedLogger`, `defaultLogHandler` and `LogHandlerFunction` are removed along with the `package:logging` re-export. The default is unchanged: warnings and errors to the console. Supply a `StreamLogHandler` to route records into your own facility. +- `LoggingInterceptor`, `InterceptStep` and `LogPrint` are no longer exported. The interceptor is installed by default and writes through the configured `StreamLogHandler`, so routing its output is a `logConfig` concern now. +- The token layer is now `stream_core`'s. `Token` becomes `UserToken`, and `TokenProvider` becomes an interface rather than a `Future Function(String)` typedef — pass `TokenProvider.dynamic(myLoader)` where you passed a closure, and note a loader now returns a `UserToken`. `TokenManager.loadToken` becomes `getToken`, `isStatic` becomes `usesStaticProvider`, and `setTokenOrProvider` becomes `setTokenProvider`. +- Anonymous connections now identify as `!anon` rather than a client-generated random id, matching every other Stream SDK. The backend pins that id so a client cannot claim to be another user. +- `StreamChatClient.devToken` is removed. It minted a `devtoken`-signed JWT, which only an app with development tokens enabled accepts; generate tokens on your backend, or build one in your own test helper. +- A failed request now throws one of `stream_core`'s sealed `StreamException` kinds — `StreamApiException`, `StreamNetworkException`, `StreamAuthenticationException` or `StreamClientException` — instead of a `StreamChatNetworkError`. `StreamChatException` aliases the root, so `on StreamChatException catch` handles them all. See the [v11 migration guide](https://github.com/GetStream/stream-chat-flutter/blob/master/migrations/v11-migration.md#error-handling). +- `ChatErrorCode` is removed in favour of `StreamErrorCode`. One value was wrong: `requestTimeout` was `23`, which the API never returns; the real code is `48`. +- `RetryPolicy.shouldRetry` receives a `StreamChatException?` instead of a `StreamChatError?`. +- `UploadState`'s variant classes are renamed to `UploadStatePreparing`, `UploadStateInProgress`, `UploadStateSuccess` and `UploadStateFailed`, freeing the names `Success` and `Failed`. +- `Result` from `package:async` is no longer re-exported; the re-exported `Result` is `stream_core`'s. +- `StreamChatNetworkError` and `StreamChatNetworkErrorType` are removed. Nothing throws them any more, so keeping them would let an `on StreamChatNetworkError catch` clause compile while matching nothing. + +🔄 Changed + +- Failed messages now retry on server errors. The retry policy follows `stream_core`'s table: retry a request that never reached the server, a 5xx, a 429 and a 408; never another 4xx, a cancelled request, broken credentials, or anything the server marked unrecoverable. Previously only failures without a parseable error body retried, so a 500 or a 429 did not. +- `SystemEnvironment` is now `stream_core`'s type, re-exported from this package. Its constructor and fields are unchanged, so existing usage keeps working. +- Most SDK logging moved off `info`. It now carries only client and connection lifecycle — client created and disposed, user set and disconnected, connection opening, established and closing — and per-operation, per-event and per-timer records are `debug` or `verbose`. Raising the priority to `info` to debug a problem no longer buries it under a health check every 20 seconds and a line per WebSocket frame. + +✅ Added + +- Log records from the HTTP and token layers now reach the configured handler. + +🔒 Security + +- The WebSocket connect and reconnect URIs are logged with the user token redacted. They carried it in full, so an app that raised the log priority wrote a usable token to the console and to any handler it had installed. + 🔄 Internal / Non-breaking - Added the OpenAPI-generated v2 client under `lib/open_api/`, along with the `melos run gen:openapi` tooling that produces it. No API uses it yet. +- Replaced the internal `InFlightCache` and `SystemEnvironmentManager` with `stream_core`'s equivalents. ## Upcoming diff --git a/packages/stream_chat/example/lib/main.dart b/packages/stream_chat/example/lib/main.dart index f85f4d99b3..4bb67c7b69 100644 --- a/packages/stream_chat/example/lib/main.dart +++ b/packages/stream_chat/example/lib/main.dart @@ -6,7 +6,7 @@ Future main() async { /// by passing the apikey obtained from your project dashboard. final client = StreamChatClient( 'b67pax5b2wdq', - logLevel: Level.INFO, + logConfig: const StreamLogConfig(priority: StreamLogPriority.info), ); /// Set the current user. In a production scenario, this should be done using diff --git a/packages/stream_chat/lib/src/client/channel/channel.dart b/packages/stream_chat/lib/src/client/channel/channel.dart index 8a0b26cc80..45e7e0ef64 100644 --- a/packages/stream_chat/lib/src/client/channel/channel.dart +++ b/packages/stream_chat/lib/src/client/channel/channel.dart @@ -80,7 +80,7 @@ class Channel { if (name != null) 'name': name, if (image != null) 'image': image, } { - _client.logger.info('New Channel instance created, not yet initialized'); + _logger.d(() => 'New Channel instance created, not yet initialized'); } /// Create a channel client instance from a [ChannelState] object. @@ -96,6 +96,8 @@ class Channel { _initState(channelState); // Initialize the state immediately. } + late final _logger = StreamLogger('SCh:Channel:$cid'); + /// This client state ChannelClientState? state; @@ -626,14 +628,14 @@ class Channel { }); if (attachments.isEmpty) { - client.logger.info('No attachments available to upload'); + _logger.d(() => 'No attachments available to upload'); if (message.attachments.every((it) => it.uploadState.isSuccess)) { _messageAttachmentsUploadCompleter.remove(messageId)?.complete(message); } return Future.value(); } - client.logger.info('Found ${attachments.length} attachments'); + _logger.d(() => 'Found ${attachments.length} attachments'); void updateAttachment(Attachment attachment, {bool remove = false}) { final index = message!.attachments.indexWhere( @@ -657,7 +659,7 @@ class Channel { return Future.wait( attachments.map((it) { - client.logger.info('Uploading ${it.id} attachment...'); + _logger.d(() => 'Uploading ${it.id} attachment...'); final throttledUpdateAttachment = updateAttachment.throttled( const Duration(milliseconds: 500), @@ -692,7 +694,7 @@ class Channel { _cancelableAttachmentUploadRequest[it.id] = cancelToken; return future .then((response) { - client.logger.info('Attachment ${it.id} uploaded successfully...'); + _logger.d(() => 'Attachment ${it.id} uploaded successfully...'); // If the response is SendFileResponse, then we might also be getting // thumbUrl in case of video. So we need to update the attachment with @@ -715,15 +717,15 @@ class Channel { } }) .catchError((e, stk) { - if (e is StreamChatNetworkError && e.type == .cancel) { - client.logger.info('Attachment ${it.id} upload cancelled'); + if (e is StreamNetworkException && e.isCancelled) { + _logger.d(() => 'Attachment ${it.id} upload cancelled'); // remove attachment from message if cancelled. updateAttachment(it, remove: true); return; } - client.logger.severe('error uploading the attachment', e, stk); + _logger.e(() => 'error uploading the attachment', error: e, stackTrace: stk); updateAttachment( it.copyWith(uploadState: UploadState.failed(error: e.toString())), ); @@ -807,7 +809,7 @@ class Channel { // Validate the final message before sending it to the server. if (MessageRules.canUpload(message) != true) { - client.logger.warning('Message is not valid for sending, removing it'); + _logger.w(() => 'Message is not valid for sending, removing it'); // Remove the message from state as it is invalid. state!.deleteMessage(message, hardDelete: true); @@ -847,7 +849,7 @@ class Channel { state?.updateMessage(failedMessage); // If the error is retriable, add it to the retry queue. - if (e is StreamChatNetworkError && e.isRetriable) { + if (e is StreamChatException && e.isRetriable) { state?.scheduleRetry(failedMessage); } @@ -936,7 +938,7 @@ class Channel { state?.updateMessage(failedMessage); // If the error is retriable, add it to the retry queue. - if (e is StreamChatNetworkError && e.isRetriable) { + if (e is StreamChatException && e.isRetriable) { state?.scheduleRetry(failedMessage); } @@ -1003,7 +1005,7 @@ class Channel { state?.updateMessage(failedMessage); // If the error is retriable, add it to the retry queue. - if (e is StreamChatNetworkError && e.isRetriable) { + if (e is StreamChatException && e.isRetriable) { state?.scheduleRetry(failedMessage); } @@ -1098,7 +1100,7 @@ class Channel { state?.deleteMessage(failedMessage, hardDelete: scope.hard); // If the error is retriable, add it to the retry queue. - if (e is StreamChatNetworkError && e.isRetriable) { + if (e is StreamChatException && e.isRetriable) { state?.scheduleRetry(failedMessage); } @@ -1139,7 +1141,7 @@ class Channel { try { await Future.wait(deleteFutures); } catch (e, stk) { - _client.logger.warning('Error deleting message attachments', e, stk); + _logger.w(() => 'Error deleting message attachments', error: e, stackTrace: stk); } } @@ -1998,7 +2000,7 @@ class Channel { _initializedCompleter.safeComplete(true); if (cid case final cid?) client.state.addChannels({cid: this}); - _client.logger.info('Channel ${channelState.channel?.cid} initialized'); + _logger.d(() => 'Channel ${channelState.channel?.cid} initialized'); } /// Loads the initial channel state and watches for changes. @@ -2417,7 +2419,7 @@ class Channel { Future keyStroke([String? parentId]) async { if (!_canSendTypingEvents) return; - client.logger.info('KeyStroke received'); + _logger.v(() => 'KeyStroke received'); return _keyStrokeHandler(parentId); } @@ -2425,7 +2427,7 @@ class Channel { Future startTyping([String? parentId]) async { if (!_canSendTypingEvents) return; - client.logger.info('start typing'); + _logger.d(() => 'start typing'); await sendEvent( Event( type: EventType.typingStart, @@ -2438,7 +2440,7 @@ class Channel { Future stopTyping([String? parentId]) async { if (!_canSendTypingEvents) return; - client.logger.info('stop typing'); + _logger.d(() => 'stop typing'); await sendEvent( Event( type: EventType.typingStop, diff --git a/packages/stream_chat/lib/src/client/channel/channel_client_state.dart b/packages/stream_chat/lib/src/client/channel/channel_client_state.dart index dc2e822b2e..e0cb0e3b59 100644 --- a/packages/stream_chat/lib/src/client/channel/channel_client_state.dart +++ b/packages/stream_chat/lib/src/client/channel/channel_client_state.dart @@ -7,7 +7,6 @@ import 'package:rxdart/rxdart.dart'; import '../../../stream_chat.dart'; import '../../core/util/message_merging.dart'; import '../../core/util/message_predicates.dart'; -import '../../core/util/utils.dart'; import '../live_location_expiration_scheduler.dart'; import '../retry_queue.dart'; import 'channel_event_handler.dart'; @@ -20,12 +19,9 @@ class ChannelClientState { this._channel, ChannelState channelState, ) { - _retryQueue = RetryQueue( - channel: _channel, - logger: _client.detachedLogger( - '🔄 (${generateHash([_channel.cid])})', - ), - ); + // Tagged with the channel, so a record says which queue reported it while + // staying under the `SCh:RetryQueue` prefix for filtering. + _retryQueue = RetryQueue(channel: _channel, tag: 'SCh:RetryQueue:${_channel.cid}'); _channelStateController = BehaviorSubject.seeded(channelState); // Update the persistence storage with the seeded channel state. diff --git a/packages/stream_chat/lib/src/client/channel/channel_event_handler.dart b/packages/stream_chat/lib/src/client/channel/channel_event_handler.dart index ee0da5ce3e..190f3deb71 100644 --- a/packages/stream_chat/lib/src/client/channel/channel_event_handler.dart +++ b/packages/stream_chat/lib/src/client/channel/channel_event_handler.dart @@ -47,7 +47,11 @@ class ChannelEventHandler { try { region(); } catch (error, stackTrace) { - _client.logger.warning('Error handling ${event.type} event in $stage', error, stackTrace); + _client.logger.w( + () => 'Error handling ${event.type} event in $stage', + error: error, + stackTrace: stackTrace, + ); } } diff --git a/packages/stream_chat/lib/src/client/channel_delivery_reporter.dart b/packages/stream_chat/lib/src/client/channel_delivery_reporter.dart index 3c9217d9c6..fe379390e1 100644 --- a/packages/stream_chat/lib/src/client/channel_delivery_reporter.dart +++ b/packages/stream_chat/lib/src/client/channel_delivery_reporter.dart @@ -1,5 +1,5 @@ -import 'package:logging/logging.dart'; import 'package:rate_limiter/rate_limiter.dart'; +import 'package:stream_core/stream_core.dart' show StreamLogger; import 'package:synchronized/synchronized.dart'; import '../core/models/message.dart'; @@ -28,14 +28,14 @@ class ChannelDeliveryReporter { /// /// The [throttleDuration] controls how frequently delivery receipts are sent. /// - /// The optional [logger] logs warnings and errors during operation. + /// The [tag] names this reporter in the log records it writes. ChannelDeliveryReporter({ - this._logger, required this.onMarkChannelsDelivered, this._throttleDuration = const Duration(seconds: 1), - }); + String tag = 'SCh:Delivery', + }) : _logger = StreamLogger(tag); - final Logger? _logger; + final StreamLogger _logger; final Duration _throttleDuration; /// The callback invoked to send delivery receipts. @@ -67,9 +67,10 @@ class ChannelDeliveryReporter { // Only submit for delivery if the message can be marked as delivered. if (!MessageRules.canMarkAsDelivered(lastMessage, channel)) continue; - _logger?.fine( - 'Submitted channel $channelCid for delivery ' - '(message: ${lastMessage.id})', + _logger.d( + () => + 'Submitted channel $channelCid for delivery ' + '(message: ${lastMessage.id})', ); // Update the latest message for the channel @@ -112,9 +113,10 @@ class ChannelDeliveryReporter { // If the message can still be marked as delivered, keep it if (MessageRules.canMarkAsDelivered(message, channel)) continue; - _logger?.fine( - 'Reconciled delivery for channel $channelCid ' - '(message: ${message.id}), removing from candidates', + _logger.d( + () => + 'Reconciled delivery for channel $channelCid ' + '(message: ${message.id}), removing from candidates', ); // Otherwise, remove it from the candidates @@ -137,9 +139,10 @@ class ChannelDeliveryReporter { final message = _deliveryCandidates.remove(channelCid); - _logger?.fine( - 'Canceled delivery for channel $channelCid ' - '(message: ${message?.id})', + _logger.d( + () => + 'Canceled delivery for channel $channelCid ' + '(message: ${message?.id})', ); } }); @@ -161,7 +164,7 @@ class ChannelDeliveryReporter { if (messageDeliveries.isEmpty) return; - _logger?.info('Marking ${messageDeliveries.length} channels as delivered'); + _logger.d(() => 'Marking ${messageDeliveries.length} channels as delivered'); try { await onMarkChannelsDelivered(messageDeliveries); @@ -186,7 +189,7 @@ class ChannelDeliveryReporter { } }); } catch (e, stk) { - _logger?.warning('Failed to mark channels as delivered', e, stk); + _logger.w(() => 'Failed to mark channels as delivered', error: e, stackTrace: stk); } } diff --git a/packages/stream_chat/lib/src/client/client.dart b/packages/stream_chat/lib/src/client/client.dart index b979af801b..2054945477 100644 --- a/packages/stream_chat/lib/src/client/client.dart +++ b/packages/stream_chat/lib/src/client/client.dart @@ -2,9 +2,19 @@ import 'dart:async'; import 'package:collection/collection.dart'; import 'package:dio/dio.dart'; -import 'package:logging/logging.dart'; import 'package:meta/meta.dart'; import 'package:rxdart/rxdart.dart'; +import 'package:stream_core/stream_core.dart' + show + InFlightCache, + StreamApiException, + StreamLogConfig, + StreamLogger, + SystemEnvironment, + SystemEnvironmentManager, + TokenManager, + TokenProvider, + UserToken; import 'package:synchronized/synchronized.dart'; import '../../version.dart'; @@ -17,9 +27,6 @@ import '../core/error/error.dart'; import '../core/http/app_settings_manager.dart'; import '../core/http/connection_id_manager.dart'; import '../core/http/stream_http_client.dart'; -import '../core/http/system_environment_manager.dart'; -import '../core/http/token.dart'; -import '../core/http/token_manager.dart'; import '../core/models/app_settings.dart'; import '../core/models/attachment_file.dart'; import '../core/models/banned_user.dart'; @@ -43,15 +50,14 @@ import '../core/models/reaction.dart'; import '../core/models/role.dart'; import '../core/models/thread.dart'; import '../core/models/user.dart'; +import '../core/platform_detector/platform_detector.dart'; import '../core/util/event_controller.dart'; import '../core/util/extension.dart'; import '../core/util/immutable_collection_subjects.dart'; -import '../core/util/in_flight_cache.dart'; import '../core/util/list_extensions.dart'; import '../core/util/utils.dart'; import '../db/chat_persistence_client.dart'; import '../event_type.dart'; -import '../system_environment.dart'; import '../ws/connection_status.dart'; import '../ws/websocket.dart'; import 'channel/channel.dart'; @@ -61,16 +67,6 @@ import 'live_location_expiration_scheduler.dart'; import 'query_channels_result.dart'; import 'retry_policy.dart'; -/// Handler function used for logging records. Function requires a single -/// [LogRecord] as the only parameter. -typedef LogHandlerFunction = void Function(LogRecord record); - -final _levelEmojiMapper = { - Level.INFO: 'ℹ️', - Level.WARNING: '⚠️', - Level.SEVERE: '🚨', -}; - /// The official Dart client for Stream Chat, /// a service for building chat applications. /// This library can be used on any Dart project and on both mobile and web apps @@ -90,8 +86,7 @@ class StreamChatClient { /// application. StreamChatClient( String apiKey, { - this.logLevel = Level.WARNING, - this.logHandlerFunction = StreamChatClient.defaultLogHandler, + this.logConfig = const StreamLogConfig(), RetryPolicy? retryPolicy, String? baseURL, String? baseWsUrl, @@ -105,7 +100,9 @@ class StreamChatClient { this._recoverStateOnReconnect = true, this.isLocalUnreadCountEnabled = false, }) { - logger.info('Initiating new StreamChatClient'); + StreamLogger.configure(logConfig); + + logger.i(() => 'Initiating new StreamChatClient'); final options = StreamHttpClientOptions( baseUrl: baseURL, @@ -122,7 +119,6 @@ class StreamChatClient { connectionIdManager: _connectionIdManager, systemEnvironmentManager: _systemEnvironmentManager, attachmentFileUploaderProvider: attachmentFileUploaderProvider, - logger: detachedLogger('🕸️'), interceptors: chatApiInterceptors, httpClientAdapter: httpClientAdapter, ); @@ -135,15 +131,12 @@ class StreamChatClient { tokenManager: _tokenManager, systemEnvironmentManager: _systemEnvironmentManager, handler: handleEvent, - logger: detachedLogger('🔌'), ); _retryPolicy = retryPolicy ?? RetryPolicy( - shouldRetry: (_, __, error) { - return error is StreamChatNetworkError && error.isRetriable; - }, + shouldRetry: (_, __, error) => error?.isRetriable ?? false, ); _connectionStatusSubscription = wsConnectionStatusStream.pairwise().listen( @@ -162,10 +155,17 @@ class StreamChatClient { /// This client state late ClientState state; - final _tokenManager = TokenManager(); + final _tokenManager = TokenManager.unconfigured(); final _connectionIdManager = ConnectionIdManager(); late final _appSettingsManager = AppSettingsManager(_chatApi.general); - static final _systemEnvironmentManager = SystemEnvironmentManager(); + static final _systemEnvironmentManager = SystemEnvironmentManager( + environment: SystemEnvironment( + sdkName: 'stream-chat', + sdkIdentifier: 'dart', + sdkVersion: PACKAGE_VERSION, + osName: CurrentPlatform.name, + ), + ); /// Updates the system environment information used by the client. /// @@ -257,41 +257,30 @@ class StreamChatClient { set recoverStateOnReconnect(bool value) => _recoverStateOnReconnect = value; bool _recoverStateOnReconnect; - /// By default the Chat client will write all messages with level Warn or - /// Error to stdout. + /// How the whole SDK logs. /// - /// During development you might want to enable more logging information, - /// you can change the default log level when constructing the client. + /// By default records of `warning` priority and above go to the console. + /// Raise the priority during development, or supply a + /// [StreamLogHandler] to route records into your own facility — an error + /// tracker, say — instead of printing them: /// /// ```dart - /// final client = StreamChatClient("stream-chat-api-key", - /// logLevel: Level.INFO); + /// final client = StreamChatClient( + /// 'stream-chat-api-key', + /// logConfig: StreamLogConfig( + /// priority: StreamLogPriority.info, + /// handler: MyCrashReporterHandler(), + /// ), + /// ); /// ``` - final Level logLevel; + /// + /// Logging is configured process-wide, so the last Stream client constructed + /// decides this for every Stream SDK in the app. Records from this one are + /// tagged `SCh:`. + final StreamLogConfig logConfig; /// Client specific logger instance. - /// Refer to the class [Logger] to learn more about the specific - /// implementation. - late final Logger logger = detachedLogger('📡'); - - /// A function that has a parameter of type [LogRecord]. - /// This is called on every new log record. - /// By default the client will use the handler returned by - /// [_getDefaultLogHandler]. - /// Setting it you can handle the log messages directly instead of have them - /// written to stdout, - /// this is very convenient if you use an error tracking tool or if you want - /// to centralize your logs into one facility. - /// - /// ```dart - /// myLogHandlerFunction = (LogRecord record) { - /// // do something with the record (ie. send it to Sentry or Fabric) - /// } - /// - /// final client = StreamChatClient("stream-chat-api-key", - /// logHandlerFunction: myLogHandlerFunction); - ///``` - final LogHandlerFunction logHandlerFunction; + final StreamLogger logger = const StreamLogger('SCh:Client'); StreamSubscription>? _connectionStatusSubscription; @@ -300,7 +289,6 @@ class StreamChatClient { /// Collects and batches delivery receipts to acknowledge message delivery /// to senders across multiple channels. late final channelDeliveryReporter = ChannelDeliveryReporter( - logger: detachedLogger('🧾'), onMarkChannelsDelivered: markChannelsDelivered, ); @@ -327,22 +315,6 @@ class StreamChatClient { return _ws.connectionStatusStream.distinct(); } - /// Default log handler function for the [StreamChatClient] logger. - static void defaultLogHandler(LogRecord record) { - print( - '${record.time} ' - '${_levelEmojiMapper[record.level] ?? record.level.name} ' - '${record.loggerName} ${record.message} ', - ); - if (record.error != null) print(record.error); - if (record.stackTrace != null) print(record.stackTrace); - } - - /// Default logger for the [StreamChatClient]. - Logger detachedLogger(String name) => Logger.detached(name) - ..level = logLevel - ..onRecord.listen(logHandlerFunction); - /// Connects the current user, this triggers a connection to the API. /// It returns a [Future] that resolves when the connection is setup. /// Pass [connectWebSocket]: false, if you want to connect to websocket @@ -353,7 +325,7 @@ class StreamChatClient { bool connectWebSocket = true, }) => _connectUser( user, - token: Token.fromRawValue(token), + tokenProvider: .static(UserToken(token)), connectWebSocket: connectWebSocket, ); @@ -365,7 +337,7 @@ class StreamChatClient { bool connectWebSocket = true, }) => _connectUser( user, - provider: tokenProvider, + tokenProvider: tokenProvider, connectWebSocket: connectWebSocket, ); @@ -375,11 +347,11 @@ class StreamChatClient { Future connectAnonymousUser({ bool connectWebSocket = true, }) async { - final token = Token.anonymous(); + final token = UserToken.anonymous(); final user = OwnUser(id: token.userId); return _connectUser( user, - token: token, + tokenProvider: .static(token), connectWebSocket: connectWebSocket, ); } @@ -390,29 +362,30 @@ class StreamChatClient { User user, { bool connectWebSocket = true, }) async { - final userId = user.id; - final anonymousToken = Token.anonymous(userId: userId); - - // setting anonymous token so that getGuestUser works - _tokenManager.setTokenOrProvider(userId, token: anonymousToken); + // The exchange itself is authenticated anonymously: the guest has no token + // yet, and the server assigns the identity it answers with. + final anonymousToken = UserToken.anonymous(); + _tokenManager.setTokenProvider( + anonymousToken.userId, + tokenProvider: .static(anonymousToken), + ); final guestUser = await _chatApi.guest.getGuestUser(user); // resetting tokenManager after successful request _tokenManager.reset(); - final guestUserToken = Token.fromRawValue(guestUser.accessToken); + final guestUserToken = UserToken(guestUser.accessToken); return _connectUser( guestUser.user, - token: guestUserToken, + tokenProvider: .static(guestUserToken), connectWebSocket: connectWebSocket, ); } Future _connectUser( User user, { - Token? token, - TokenProvider? provider, + required TokenProvider tokenProvider, bool connectWebSocket = true, }) async { if (_ws.connectionCompleter?.isCompleted == false) { @@ -422,13 +395,9 @@ class StreamChatClient { ); } - logger.info('setting user : ${user.id}'); + logger.i(() => 'setting user : ${user.id}'); - await _tokenManager.setTokenOrProvider( - user.id, - token: token, - provider: provider, - ); + _tokenManager.setTokenProvider(user.id, tokenProvider: tokenProvider); final ownUser = OwnUser.fromUser(user); state.currentUser = ownUser; @@ -460,7 +429,7 @@ class StreamChatClient { final event = await chatPersistenceClient?.getConnectionInfo(); if (event != null) return ownUser.merge(event.me); } - logger.severe('error connecting user : ${ownUser.id}', e, stk); + logger.e(() => 'error connecting user : ${ownUser.id}', error: e, stackTrace: stk); rethrow; } } @@ -491,7 +460,7 @@ class StreamChatClient { final client = chatPersistenceClient; // If the persistence client is never connected, we don't need to close it. if (client == null || !client.isConnected) { - logger.info('Chat persistence client is not connected'); + logger.d(() => 'Chat persistence client is not connected'); return; } @@ -513,7 +482,7 @@ class StreamChatClient { final user = state.currentUser!; - logger.info('Opening web-socket connection for ${user.id}'); + logger.i(() => 'Opening web-socket connection for ${user.id}'); if (wsConnectionStatus == ConnectionStatus.connecting) { throw StreamChatError('Connection already in progress for ${user.id}'); @@ -534,7 +503,7 @@ class StreamChatClient { return user.merge(event.me); } catch (e, stk) { - logger.severe('error connecting ws', e, stk); + logger.e(() => 'error connecting ws', error: e, stackTrace: stk); rethrow; } } @@ -545,7 +514,7 @@ class StreamChatClient { /// This will not trigger default auto-retry mechanism for reconnection. /// You need to call [openConnection] to reconnect to [_ws]. void closeConnection() { - logger.info('Closing web-socket connection for ${state.currentUser?.id}'); + logger.i(() => 'Closing web-socket connection for ${state.currentUser?.id}'); // Stop listening to events state.cancelEventSubscription(); @@ -628,7 +597,7 @@ class StreamChatClient { ); } } catch (e, stk) { - logger.warning('Error recovering state on reconnect', e, stk); + logger.w(() => 'Error recovering state on reconnect', error: e, stackTrace: stk); } } @@ -668,12 +637,12 @@ class StreamChatClient { final syncAt = lastSyncAt ?? await chatPersistenceClient?.getLastSyncAt(); if (syncAt == null) { - logger.info('Fresh sync start: lastSyncAt initialized to now.'); + logger.d(() => 'Fresh sync start: lastSyncAt initialized to now.'); return chatPersistenceClient?.updateLastSyncAt(DateTime.now()); } try { - logger.info('Syncing events since $syncAt for channels: $channels'); + logger.d(() => 'Syncing events since $syncAt for channels: $channels'); final res = await _chatApi.general.sync(channels, syncAt); final events = res.events.sorted( @@ -681,7 +650,7 @@ class StreamChatClient { ); for (final event in events) { - logger.fine('Syncing event: ${event.type}'); + logger.d(() => 'Syncing event: ${event.type}'); handleEvent(event); } @@ -692,22 +661,23 @@ class StreamChatClient { // old or the channel list is too long or too many events need to be // synced. In this case, we should just flush the persistence client // and start over. - if (error is StreamChatNetworkError && error.statusCode == 400) { - logger.warning( - 'Failed to sync events due to stale or oversized state. ' - 'Resetting the persistence client to enable a fresh start.', + if (error is StreamApiException && error.statusCode == 400) { + logger.w( + () => + 'Failed to sync events due to stale or oversized state. ' + 'Resetting the persistence client to enable a fresh start.', ); try { await chatPersistenceClient?.flush(); return await chatPersistenceClient?.updateLastSyncAt(DateTime.now()); } catch (resetError, resetStk) { - logger.warning('Error resetting the persistence client', resetError, resetStk); + logger.w(() => 'Error resetting the persistence client', error: resetError, stackTrace: resetStk); return; } } - logger.warning('Error syncing events', error, stk); + logger.w(() => 'Error syncing events', error: error, stackTrace: stk); } }); } @@ -805,7 +775,7 @@ class StreamChatClient { if (offlineResult.channels.isNotEmpty) yield offlineResult; } catch (e, stk) { - logger.warning('Error querying channels offline', e, stk); + logger.w(() => 'Error querying channels offline', error: e, stackTrace: stk); // Continue to online query even if offline fails } @@ -832,14 +802,14 @@ class StreamChatClient { ).timeout( const Duration(seconds: 30), onTimeout: () { - logger.warning('Online channel query timed out'); + logger.w(() => 'Online channel query timed out'); throw TimeoutException('Channel query timed out'); }, ), ); yield result; } catch (e, stk) { - logger.severe('Error querying channels online', e, stk); + logger.e(() => 'Error querying channels online', error: e, stackTrace: stk); // Only rethrow if we have no channels to show the user if (offlineResult == null || offlineResult.channels.isEmpty) rethrow; } @@ -893,7 +863,7 @@ class StreamChatClient { }) async { if (waitForConnect) { if (_ws.connectionCompleter?.isCompleted == false) { - logger.info('awaiting connection completer'); + logger.d(() => 'awaiting connection completer'); await _ws.connectionCompleter?.future; } if (wsConnectionStatus != ConnectionStatus.connected) { @@ -909,7 +879,7 @@ class StreamChatClient { watch = false; } - logger.info('Query channel start'); + logger.d(() => 'Query channel start'); final res = await _chatApi.channel.queryChannels( filter: filter, sort: sort, @@ -926,11 +896,13 @@ class StreamChatClient { ); if (res.channels.isEmpty && paginationParams.offset == 0) { - logger.warning(''' + logger.w( + () => ''' We could not find any channel for this query. Please make sure to take a look at the Flutter tutorial: https://getstream.io/chat/flutter/tutorial If your application already has users and channels, you might need to adjust your query channel as explained in the docs https://getstream.io/chat/docs/query_channels/?language=dart - '''); + ''', + ); return QueryChannelsResult( channels: const [], predefinedFilter: res.predefinedFilter, @@ -943,7 +915,7 @@ class StreamChatClient { this.state.updateUsers(users); - logger.info('Got ${res.channels.length} channels from api'); + logger.d(() => 'Got ${res.channels.length} channels from api'); final updateData = _mapChannelStateToChannel(channels); // Submit delivery report for the channels fetched in this query. @@ -1024,7 +996,7 @@ class StreamChatClient { (QueryChannelsResponse()..channels = const []); if (res.channels.isEmpty) { - logger.info('No channels found in offline storage for the given query'); + logger.d(() => 'No channels found in offline storage for the given query'); return QueryChannelsResult( channels: const [], predefinedFilter: res.predefinedFilter, @@ -1352,9 +1324,6 @@ class StreamChatClient { return res; } - /// Get a development token - Token devToken(String userId) => Token.development(userId); - /// Returns a channel client with the given type, id and custom data. Channel channel( String type, { @@ -1837,7 +1806,7 @@ class StreamChatClient { return response; } catch (e, stk) { - logger.severe('Error blocking user', e, stk); + logger.e(() => 'Error blocking user', error: e, stackTrace: stk); rethrow; } } @@ -1858,7 +1827,7 @@ class StreamChatClient { return response; } catch (e, stk) { - logger.severe('Error unblocking user', e, stk); + logger.e(() => 'Error unblocking user', error: e, stackTrace: stk); rethrow; } } @@ -1876,7 +1845,7 @@ class StreamChatClient { return response; } catch (e, stk) { - logger.severe('Error querying blocked users', e, stk); + logger.e(() => 'Error querying blocked users', error: e, stackTrace: stk); rethrow; } } @@ -2176,7 +2145,7 @@ class StreamChatClient { return response; } catch (e, stk) { - logger.severe('Error getting active live locations', e, stk); + logger.e(() => 'Error getting active live locations', error: e, stackTrace: stk); rethrow; } } @@ -2556,7 +2525,7 @@ class StreamChatClient { /// If [flushChatPersistence] is true the client deletes all offline /// user's data. Future disconnectUser({bool flushChatPersistence = false}) async { - logger.info('Disconnecting user : ${state.currentUser?.id}'); + logger.i(() => 'Disconnecting user : ${state.currentUser?.id}'); // Cancelling delivery reporter. channelDeliveryReporter.cancel(); @@ -2581,7 +2550,7 @@ class StreamChatClient { /// Call this function to dispose the client Future dispose() async { - logger.info('Disposing StreamChatClient'); + logger.i(() => 'Disposing StreamChatClient'); await disconnectUser(); await _ws.dispose(); diff --git a/packages/stream_chat/lib/src/client/retry_policy.dart b/packages/stream_chat/lib/src/client/retry_policy.dart index a609b532b8..e7db36b5f7 100644 --- a/packages/stream_chat/lib/src/client/retry_policy.dart +++ b/packages/stream_chat/lib/src/client/retry_policy.dart @@ -50,7 +50,7 @@ class RetryPolicy { final FutureOr Function( StreamChatClient client, int attempt, - StreamChatError? error, + StreamChatException? error, ) shouldRetry; } diff --git a/packages/stream_chat/lib/src/client/retry_queue.dart b/packages/stream_chat/lib/src/client/retry_queue.dart index 8b05181f3c..a1f3319762 100644 --- a/packages/stream_chat/lib/src/client/retry_queue.dart +++ b/packages/stream_chat/lib/src/client/retry_queue.dart @@ -9,21 +9,22 @@ class RetryQueue { /// Instantiate a new RetryQueue object. RetryQueue({ required this.channel, - this.logger, - }) : client = channel.client { + String tag = 'SCh:RetryQueue', + }) : client = channel.client, + logger = StreamLogger(tag) { _retryPolicy = client.retryPolicy; _listenConnectionRecovered(); } + /// Writes this queue's records. + final StreamLogger logger; + /// The channel of this queue. final Channel channel; /// The client associated with this [channel]. final StreamChatClient client; - /// The logger associated to this queue. - final Logger? logger; - late final RetryPolicy _retryPolicy; final _compositeSubscription = CompositeSubscription(); @@ -36,7 +37,7 @@ class RetryQueue { .distinct() .listen((event) { if (event.online == true) { - logger?.info('Connection recovered, retrying failed messages'); + logger.i(() => 'Connection recovered, retrying failed messages'); channel.state?.retryFailedMessages(); } }) @@ -56,7 +57,7 @@ class RetryQueue { // If there are no messages to add, return. if (messagesToAdd.isEmpty) return; - logger?.info('Adding ${messagesToAdd.length} messages to the queue'); + logger.d(() => 'Adding ${messagesToAdd.length} messages to the queue'); _messageQueue.addAll(messagesToAdd); _processQueue(); @@ -68,9 +69,9 @@ class RetryQueue { if (_isProcessing) return; _isProcessing = true; - logger?.info('Started retrying failed messages'); + logger.d(() => 'Started retrying failed messages'); while (_messageQueue.isNotEmpty) { - logger?.info('${_messageQueue.length} messages remaining in the queue'); + logger.v(() => '${_messageQueue.length} messages remaining in the queue'); final message = _messageQueue.first; final retryPolicy = _retryPolicy; @@ -82,12 +83,12 @@ class RetryQueue { maxDelay: retryPolicy.maxDelay, maxAttempts: retryPolicy.maxRetryAttempts, retryIf: (error, attempt) { - if (error is! StreamChatError) return false; + if (error is! StreamChatException) return false; return retryPolicy.shouldRetry(client, attempt, error); }, ); } catch (error) { - logger?.severe('Error while retrying message ${message.id}', error); + logger.e(() => 'Error while retrying message ${message.id}', error: error); // If we are unable to successfully retry the message, update the state // with the failed state. channel.state?.updateMessage(message); diff --git a/packages/stream_chat/lib/src/core/api/responses.dart b/packages/stream_chat/lib/src/core/api/responses.dart index 5506159487..5e59324681 100644 --- a/packages/stream_chat/lib/src/core/api/responses.dart +++ b/packages/stream_chat/lib/src/core/api/responses.dart @@ -1,6 +1,5 @@ import 'package:json_annotation/json_annotation.dart'; import '../../client/client.dart'; -import '../error/error.dart'; import '../models/app_settings.dart'; import '../models/banned_user.dart'; import '../models/channel_model.dart'; @@ -32,7 +31,7 @@ class _BaseResponse { String? duration; } -/// Model response for [StreamChatNetworkError] data +/// Model response for the error payload a Stream server sends. @JsonSerializable() class ErrorResponse extends _BaseResponse { /// The http error code diff --git a/packages/stream_chat/lib/src/core/api/stream_chat_api.dart b/packages/stream_chat/lib/src/core/api/stream_chat_api.dart index ea2d0311b4..232e538126 100644 --- a/packages/stream_chat/lib/src/core/api/stream_chat_api.dart +++ b/packages/stream_chat/lib/src/core/api/stream_chat_api.dart @@ -1,10 +1,8 @@ import 'package:dio/dio.dart'; -import 'package:logging/logging.dart'; +import 'package:stream_core/stream_core.dart' show SystemEnvironmentManager, TokenManager; import '../http/connection_id_manager.dart'; import '../http/stream_http_client.dart'; -import '../http/system_environment_manager.dart'; -import '../http/token_manager.dart'; import 'attachment_file_uploader.dart'; import 'channel_api.dart'; import 'device_api.dart'; @@ -32,7 +30,6 @@ class StreamChatApi { ConnectionIdManager? connectionIdManager, SystemEnvironmentManager? systemEnvironmentManager, AttachmentFileUploaderProvider attachmentFileUploaderProvider = StreamAttachmentFileUploader.new, - Logger? logger, Iterable? interceptors, HttpClientAdapter? httpClientAdapter, }) : _fileUploaderProvider = attachmentFileUploaderProvider, @@ -44,7 +41,6 @@ class StreamChatApi { tokenManager: tokenManager, connectionIdManager: connectionIdManager, systemEnvironmentManager: systemEnvironmentManager, - logger: logger, interceptors: interceptors, httpClientAdapter: httpClientAdapter, ); diff --git a/packages/stream_chat/lib/src/core/error/chat_error_code.dart b/packages/stream_chat/lib/src/core/error/chat_error_code.dart deleted file mode 100644 index b35c010da2..0000000000 --- a/packages/stream_chat/lib/src/core/error/chat_error_code.dart +++ /dev/null @@ -1,158 +0,0 @@ -// ignore_for_file: lines_longer_than_80_chars - -import 'package:collection/collection.dart'; - -/// Complete list of errors that are returned by the API -/// together with the description and API code. -enum ChatErrorCode { - // Client errors - - /// Unauthenticated, token not defined - undefinedToken, - - // Bad Request - - /// Wrong data/parameter is sent to the API - inputError, - - /// Duplicate username is sent while enforce_unique_usernames is enabled - duplicateUsername, - - /// Message is too long - messageTooLong, - - /// Event is not supported - eventNotSupported, - - /// The feature is currently disabled - /// on the dashboard (i.e. Reactions & Replies) - channelFeatureNotSupported, - - /// Multiple Levels Reply is not supported - /// the API only supports 1 level deep reply threads - multipleNestling, - - /// Custom Command handler returned an error - customCommandEndpointCall, - - /// App config does not have custom_action_handler_url - customCommandEndpointMissing, - - // Unauthorised - - /// Unauthenticated, problem with authentication - authenticationError, - - /// Unauthenticated, token expired - tokenExpired, - - /// Unauthenticated, token date incorrect - tokenBeforeIssuedAt, - - /// Unauthenticated, token not valid yet - tokenNotValid, - - /// Unauthenticated, token signature invalid - tokenSignatureInvalid, - - /// Access Key invalid - accessKeyError, - - // Forbidden - - /// Unauthorised / forbidden to make request - notAllowed, - - /// App suspended - appSuspended, - - /// User tried to post a message during the cooldown period - cooldownError, - - // Miscellaneous - - /// Resource not found - doesNotExist, - - /// Request timed out - requestTimeout, - - /// Payload too big - payloadTooBig, - - /// Too many requests in a certain time frame - rateLimitError, - - /// Request headers are too large - maximumHeaderSizeExceeded, - - /// Something goes wrong in the system - internalSystemError, - - /// No access to requested channels - noAccessToChannels, -} - -const _errorCodeWithDescription = { - ChatErrorCode.undefinedToken: MapEntry(1000, 'Unauthorised, token not defined'), - ChatErrorCode.inputError: MapEntry(4, 'Wrong data/parameter is sent to the API'), - ChatErrorCode.duplicateUsername: MapEntry( - 6, - 'Duplicate username is sent while enforce_unique_usernames is enabled', - ), - ChatErrorCode.messageTooLong: MapEntry(20, 'Message is too long'), - ChatErrorCode.eventNotSupported: MapEntry(18, 'Event is not supported'), - ChatErrorCode.channelFeatureNotSupported: MapEntry( - 19, - 'The feature is currently disabled on the dashboard (i.e. Reactions & Replies)', - ), - ChatErrorCode.multipleNestling: MapEntry( - 21, - 'Multiple Levels Reply is not supported - the API only supports 1 level deep reply threads', - ), - ChatErrorCode.customCommandEndpointCall: MapEntry(45, 'Custom Command handler returned an error'), - ChatErrorCode.customCommandEndpointMissing: MapEntry(44, 'App config does not have custom_action_handler_url'), - ChatErrorCode.authenticationError: MapEntry(5, 'Unauthenticated, problem with authentication'), - ChatErrorCode.tokenExpired: MapEntry(40, 'Unauthenticated, token expired'), - ChatErrorCode.tokenBeforeIssuedAt: MapEntry(42, 'Unauthenticated, token date incorrect'), - ChatErrorCode.tokenNotValid: MapEntry(41, 'Unauthenticated, token not valid yet'), - ChatErrorCode.tokenSignatureInvalid: MapEntry(43, 'Unauthenticated, token signature invalid'), - ChatErrorCode.accessKeyError: MapEntry(2, 'Access Key invalid'), - ChatErrorCode.notAllowed: MapEntry(17, 'Unauthorised / forbidden to make request'), - ChatErrorCode.appSuspended: MapEntry(99, 'App suspended'), - ChatErrorCode.cooldownError: MapEntry(60, 'User tried to post a message during the cooldown period'), - ChatErrorCode.doesNotExist: MapEntry(16, 'Resource not found'), - ChatErrorCode.requestTimeout: MapEntry(23, 'Request timed out'), - ChatErrorCode.payloadTooBig: MapEntry(22, 'Payload too big'), - ChatErrorCode.rateLimitError: MapEntry(9, 'Too many requests in a certain time frame'), - ChatErrorCode.maximumHeaderSizeExceeded: MapEntry(24, 'Request headers are too large'), - ChatErrorCode.internalSystemError: MapEntry(-1, 'Something goes wrong in the system'), - ChatErrorCode.noAccessToChannels: MapEntry(70, 'No access to requested channels'), -}; - -const _authenticationErrors = [ - ChatErrorCode.undefinedToken, - ChatErrorCode.authenticationError, - ChatErrorCode.tokenExpired, - ChatErrorCode.tokenBeforeIssuedAt, - ChatErrorCode.tokenNotValid, - ChatErrorCode.tokenSignatureInvalid, - ChatErrorCode.accessKeyError, - ChatErrorCode.noAccessToChannels, -]; - -/// -ChatErrorCode? chatErrorCodeFromCode(int code) => - _errorCodeWithDescription.keys.firstWhereOrNull((key) => _errorCodeWithDescription[key]!.key == code); - -/// -extension ChatErrorCodeX on ChatErrorCode { - /// - String get message => _errorCodeWithDescription[this]!.value; - - /// - int get code => _errorCodeWithDescription[this]!.key; - - /// - bool get isAuthenticationError => _authenticationErrors.contains(this); -} diff --git a/packages/stream_chat/lib/src/core/error/error.dart b/packages/stream_chat/lib/src/core/error/error.dart index ac4a1e0d4d..3e466b9122 100644 --- a/packages/stream_chat/lib/src/core/error/error.dart +++ b/packages/stream_chat/lib/src/core/error/error.dart @@ -1,2 +1,2 @@ -export 'chat_error_code.dart'; export 'stream_chat_error.dart'; +export 'stream_chat_exception.dart'; diff --git a/packages/stream_chat/lib/src/core/error/stream_chat_error.dart b/packages/stream_chat/lib/src/core/error/stream_chat_error.dart index 4f5c6ff257..f7c4530c4f 100644 --- a/packages/stream_chat/lib/src/core/error/stream_chat_error.dart +++ b/packages/stream_chat/lib/src/core/error/stream_chat_error.dart @@ -1,5 +1,3 @@ -import 'dart:convert'; - import 'package:equatable/equatable.dart'; import 'package:web_socket_channel/web_socket_channel.dart'; @@ -9,8 +7,8 @@ import '../../../stream_chat.dart'; /// /// See also: /// -/// * [StreamChatNetworkError], raised by failed HTTP requests. /// * [StreamWebSocketError], raised on the realtime connection. +/// * [StreamChatException], raised by failed HTTP requests. class StreamChatError extends Equatable implements Exception { /// Creates a new [StreamChatError] with the given [message]. const StreamChatError(this.message); @@ -54,11 +52,11 @@ class StreamWebSocketError extends StreamChatError { /// The Stream error code, if one was provided. int? get code => data?.code; - /// The [ChatErrorCode] for this error, or null if unrecognised. - ChatErrorCode? get errorCode { + /// The [StreamErrorCode] for this error, or null if the server sent none. + StreamErrorCode? get errorCode { final code = this.code; if (code == null) return null; - return chatErrorCodeFromCode(code); + return StreamErrorCode(code); } /// Whether the operation can be retried. @@ -75,156 +73,3 @@ class StreamWebSocketError extends StreamChatError { return 'StreamWebSocketError($params)'; } } - -/// An error raised when a network request to Stream fails. -class StreamChatNetworkError extends StreamChatError { - /// Creates a [StreamChatNetworkError] for a known [errorCode]. - StreamChatNetworkError( - ChatErrorCode errorCode, { - int? statusCode, - this.data, - StackTrace? stacktrace, - @Deprecated('Set type to StreamChatNetworkErrorType.cancel instead') this._isRequestCancelledError, - this.type = .unknown, - }) : code = errorCode.code, - statusCode = statusCode ?? data?.statusCode, - stackTrace = stacktrace ?? StackTrace.current, - super(errorCode.message); - - /// Creates a [StreamChatNetworkError] from raw values. - StreamChatNetworkError.raw({ - required this.code, - required String message, - this.statusCode, - this.data, - StackTrace? stacktrace, - @Deprecated('Set type to StreamChatNetworkErrorType.cancel instead') this._isRequestCancelledError, - this.type = .unknown, - }) : stackTrace = stacktrace ?? StackTrace.current, - super(message); - - /// Creates a [StreamChatNetworkError] from a [DioException]. - factory StreamChatNetworkError.fromDioException(DioException exception) { - final response = exception.response; - ErrorResponse? errorResponse; - final data = response?.data; - if (data is Map) { - errorResponse = ErrorResponse.fromJson(data); - } else if (data is String) { - // Edge/proxy responses (e.g. Cloudflare 5xx, gateway 504) may return - // a plain-text body like 'upstream request timeout'. Guard the - // decode so a non-JSON body doesn't mask the original DioException; - // the surrounding factory falls back to statusMessage / message. - try { - final decoded = jsonDecode(data); - if (decoded is Map) { - errorResponse = ErrorResponse.fromJson(decoded); - } - } on FormatException { - // Leave errorResponse null; handled by fallback below. - } - } - return StreamChatNetworkError.raw( - code: errorResponse?.code ?? -1, - message: errorResponse?.message ?? response?.statusMessage ?? exception.message ?? '', - statusCode: errorResponse?.statusCode ?? response?.statusCode, - data: errorResponse, - stacktrace: exception.stackTrace, - type: _networkErrorTypeFromDio(exception.type), - ); - } - - /// The Stream error code. See [ChatErrorCode]. - final int code; - - /// The HTTP status code of the response, if any. - final int? statusCode; - - /// The structured error returned by the server, if any. - final ErrorResponse? data; - - /// The kind of transport failure that caused this error. - /// - /// Defaults to [StreamChatNetworkErrorType.unknown] when it can't be - /// determined. - final StreamChatNetworkErrorType type; - - /// The optional stack trace attached to the error. - final StackTrace? stackTrace; - - /// Whether the request was cancelled before it completed. - @Deprecated('Use type == StreamChatNetworkErrorType.cancel instead') - bool get isRequestCancelledError => _isRequestCancelledError ?? type == .cancel; - final bool? _isRequestCancelledError; - - /// The [ChatErrorCode] for this error, or null if unrecognised. - ChatErrorCode? get errorCode => chatErrorCodeFromCode(code); - - /// Whether the operation can be retried. - bool get isRetriable => data == null; - - @override - List get props => [...super.props, code, statusCode, type]; - - @override - String toString({bool printStackTrace = false}) { - var params = 'code: $code, message: $message'; - if (type != .unknown) params += ', type: ${type.name}'; - if (statusCode != null) params += ', statusCode: $statusCode'; - if (data != null) params += ', data: $data'; - var msg = 'StreamChatNetworkError($params)'; - - if (printStackTrace && stackTrace != null) { - msg += '\n$stackTrace'; - } - return msg; - } -} - -/// The kind of transport failure that caused a [StreamChatNetworkError]. -/// -/// Lets callers tell a lost connection apart from a timeout, a cancellation, -/// or a server response — for example, to show a tailored error message. -enum StreamChatNetworkErrorType { - /// The server could not be reached (e.g. no internet connection). - connectionError, - - /// Opening the connection timed out. - connectionTimeout, - - /// Sending the request timed out. - sendTimeout, - - /// Receiving the response timed out. - receiveTimeout, - - /// Transforming the response (e.g. background JSON decoding) timed out. - transformTimeout, - - /// The server responded with a non-success status. - badResponse, - - /// The request was cancelled before it completed. - cancel, - - /// The connection's certificate could not be validated. - badCertificate, - - /// The failure could not be attributed to a specific transport cause. - unknown, -} - -StreamChatNetworkErrorType _networkErrorTypeFromDio(DioExceptionType type) { - return switch (type) { - DioExceptionType.connectionError => StreamChatNetworkErrorType.connectionError, - DioExceptionType.connectionTimeout => StreamChatNetworkErrorType.connectionTimeout, - DioExceptionType.sendTimeout => StreamChatNetworkErrorType.sendTimeout, - DioExceptionType.receiveTimeout => StreamChatNetworkErrorType.receiveTimeout, - DioExceptionType.transformTimeout => StreamChatNetworkErrorType.transformTimeout, - DioExceptionType.badResponse => StreamChatNetworkErrorType.badResponse, - DioExceptionType.cancel => StreamChatNetworkErrorType.cancel, - DioExceptionType.badCertificate => StreamChatNetworkErrorType.badCertificate, - // DioExceptionType.unknown and any future dio types map to unknown. - _ => StreamChatNetworkErrorType.unknown, - }; -} diff --git a/packages/stream_chat/lib/src/core/error/stream_chat_exception.dart b/packages/stream_chat/lib/src/core/error/stream_chat_exception.dart new file mode 100644 index 0000000000..3e928c7171 --- /dev/null +++ b/packages/stream_chat/lib/src/core/error/stream_chat_exception.dart @@ -0,0 +1,64 @@ +import 'package:stream_core/stream_core.dart'; + +/// An alias of [StreamException], so code written against either name catches +/// the same failures. +/// +/// Every failure the SDK reports is one of four kinds: +/// +/// - [StreamApiException] — the server answered, and the answer was an error. +/// - [StreamNetworkException] — the server was never heard from, so the +/// outcome of the request is unknown. +/// - [StreamAuthenticationException] — credentials could not be produced or +/// sent. +/// - [StreamClientException] — the SDK itself failed. +/// +/// The root is sealed, so a `switch` over the four kinds is exhaustive. +typedef StreamChatException = StreamException; + +/// Whether a failed operation is worth attempting again. +extension StreamChatExceptionRetries on StreamChatException { + /// Whether retrying the operation could succeed. + /// + /// Answers from the failure alone, which is necessary but not sufficient: a + /// write is only safe to retry through an idempotent path, because a + /// [StreamNetworkException] leaves the outcome unknown — the server may have + /// performed the operation before the connection failed. Sending a message + /// is idempotent here, since the id is client-generated. + /// + /// A `true` says nothing about *when*. Honour + /// [StreamApiException.retryAfter] where the server named a wait, and back + /// off otherwise. + bool get isRetriable => switch (this) { + // The server said retrying will not help, and it is authoritative. + StreamApiException(unrecoverable: true) => false, + + // About the moment rather than the request: the wait heals it. + StreamApiException(isRateLimited: true) => true, + + // Clock skew on the token's `nbf`/`iat` claims heals on its own, and a + // fresh token minted by the same skewed clock would not help. + StreamApiException(isTokenNotYetValid: true) => true, + + // A refused token that reached here is one a refresh already failed to + // fix, so resending cannot help either. + StreamApiException(isTokenExpired: true) => false, + + // 5xx is the server failing to answer rather than a verdict on the + // request, and 408 says the request did not complete in time. Every other + // 4xx is a verdict: the same request earns the same answer. + StreamApiException(:final statusCode) => statusCode >= 500 || statusCode == 408, + + // The caller stopped it, so there is nothing to retry. + StreamNetworkException(isCancelled: true) => false, + + // The request never reached a verdict. Prefer a connectivity signal over + // blind backoff where one is available. + StreamNetworkException() => true, + + // Credentials have to be fixed before the operation is worth attempting. + StreamAuthenticationException() => false, + + // A bug does not heal on resend. + StreamClientException() => false, + }; +} diff --git a/packages/stream_chat/lib/src/core/http/app_settings_manager.dart b/packages/stream_chat/lib/src/core/http/app_settings_manager.dart index c96595dd68..1169bd2f93 100644 --- a/packages/stream_chat/lib/src/core/http/app_settings_manager.dart +++ b/packages/stream_chat/lib/src/core/http/app_settings_manager.dart @@ -1,5 +1,5 @@ -import 'package:logging/logging.dart'; import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' show StreamLogger; import '../api/general_api.dart'; import '../models/app_settings.dart'; @@ -17,10 +17,13 @@ import '../models/app_settings.dart'; @internal class AppSettingsManager { /// {@macro appSettingsManager} - AppSettingsManager(this._api); + AppSettingsManager( + this._api, { + String tag = 'SCh:AppSettings', + }) : _logger = StreamLogger(tag); final GeneralApi _api; - late final _logger = Logger('AppSettingsManager'); + final StreamLogger _logger; /// The cached [AppSettings]. /// @@ -40,7 +43,7 @@ class AppSettingsManager { final response = await _api.getAppSettings(); _appSettings = response.app; } catch (e, stk) { - _logger.warning('Failed to load app settings', e, stk); + _logger.w(() => 'Failed to load app settings', error: e, stackTrace: stk); } } diff --git a/packages/stream_chat/lib/src/core/http/interceptor/additional_headers_interceptor.dart b/packages/stream_chat/lib/src/core/http/interceptor/additional_headers_interceptor.dart index c80045f4fe..3e1007f725 100644 --- a/packages/stream_chat/lib/src/core/http/interceptor/additional_headers_interceptor.dart +++ b/packages/stream_chat/lib/src/core/http/interceptor/additional_headers_interceptor.dart @@ -1,27 +1,24 @@ import 'package:dio/dio.dart'; import '../../../../stream_chat.dart'; -import '../system_environment_manager.dart'; -/// Interceptor that sets additional headers for all requests. +/// Interceptor that applies [StreamChatClient.additionalHeaders] to every +/// request. +/// +/// The `X-Stream-Client` header is `stream_core`'s `HeadersInterceptor`; this +/// carries only the headers an integrator adds, which is a chat-only concept. +/// It is read on every request rather than captured once, so a change made +/// after the client was built still applies. class AdditionalHeadersInterceptor extends Interceptor { /// Initialize a new [AdditionalHeadersInterceptor]. - const AdditionalHeadersInterceptor([this._systemEnvironmentManager]); - - final SystemEnvironmentManager? _systemEnvironmentManager; + const AdditionalHeadersInterceptor(); @override Future onRequest( RequestOptions options, RequestInterceptorHandler handler, ) async { - final userAgent = _systemEnvironmentManager?.userAgent; - - options.headers = { - ...options.headers, - ...StreamChatClient.additionalHeaders, - if (userAgent != null) 'X-Stream-Client': userAgent, - }; + options.headers.addAll(StreamChatClient.additionalHeaders); return handler.next(options); } } diff --git a/packages/stream_chat/lib/src/core/http/interceptor/auth_interceptor.dart b/packages/stream_chat/lib/src/core/http/interceptor/auth_interceptor.dart deleted file mode 100644 index 105dba4a70..0000000000 --- a/packages/stream_chat/lib/src/core/http/interceptor/auth_interceptor.dart +++ /dev/null @@ -1,72 +0,0 @@ -import 'package:dio/dio.dart'; -import '../../api/responses.dart'; -import '../../error/error.dart'; -import '../stream_chat_dio_error.dart'; -import '../stream_http_client.dart'; -import '../token.dart'; -import '../token_manager.dart'; - -/// Authentication interceptor that refreshes the token if -/// an auth error is received -class AuthInterceptor extends QueuedInterceptor { - /// Initialize a new auth interceptor - AuthInterceptor(this._client, this._tokenManager); - - final StreamHttpClient _client; - - /// The token manager used in the client - final TokenManager _tokenManager; - - @override - Future onRequest( - RequestOptions options, - RequestInterceptorHandler handler, - ) async { - late Token token; - try { - token = await _tokenManager.loadToken(); - } catch (_) { - final error = StreamChatNetworkError(ChatErrorCode.undefinedToken); - final dioError = StreamChatDioError( - error: error, - requestOptions: options, - stackTrace: StackTrace.current, - ); - return handler.reject(dioError, true); - } - final params = {'user_id': token.userId}; - final headers = { - 'Authorization': token.rawValue, - 'stream-auth-type': token.authType.name, - }; - options - ..queryParameters.addAll(params) - ..headers.addAll(headers); - return handler.next(options); - } - - @override - void onError( - DioException exception, - ErrorInterceptorHandler handler, - ) async { - final data = exception.response?.data; - if (data == null || data is! Map) { - return handler.next(exception); - } - - final error = ErrorResponse.fromJson(data); - if (error.code == ChatErrorCode.tokenExpired.code) { - if (_tokenManager.isStatic) return handler.next(exception); - await _tokenManager.loadToken(refresh: true); - try { - final options = exception.requestOptions; - final response = await _client.fetch(options); - return handler.resolve(response); - } on DioException catch (exception) { - return handler.next(exception); - } - } - return handler.next(exception); - } -} diff --git a/packages/stream_chat/lib/src/core/http/interceptor/connection_id_interceptor.dart b/packages/stream_chat/lib/src/core/http/interceptor/connection_id_interceptor.dart deleted file mode 100644 index cdd892d5a8..0000000000 --- a/packages/stream_chat/lib/src/core/http/interceptor/connection_id_interceptor.dart +++ /dev/null @@ -1,24 +0,0 @@ -import 'package:dio/dio.dart'; -import '../connection_id_manager.dart'; - -/// Interceptor that injects the connection id in the request params -class ConnectionIdInterceptor extends Interceptor { - /// - ConnectionIdInterceptor(this.connectionIdManager); - - /// - final ConnectionIdManager connectionIdManager; - - @override - void onRequest( - RequestOptions options, - RequestInterceptorHandler handler, - ) async { - if (connectionIdManager.hasConnectionId) { - options.queryParameters.addAll({ - 'connection_id': connectionIdManager.connectionId, - }); - } - handler.next(options); - } -} diff --git a/packages/stream_chat/lib/src/core/http/interceptor/logging_interceptor.dart b/packages/stream_chat/lib/src/core/http/interceptor/logging_interceptor.dart deleted file mode 100644 index 258489471e..0000000000 --- a/packages/stream_chat/lib/src/core/http/interceptor/logging_interceptor.dart +++ /dev/null @@ -1,344 +0,0 @@ -// ignore_for_file: lines_longer_than_80_chars -// coverage:ignore-file - -import 'dart:math' as math; - -import 'package:dio/dio.dart'; - -/// Step where we're logging -enum InterceptStep { - /// Request - request, - - /// Response - response, - - /// Error - error, -} - -/// Function used to print the log -typedef LogPrint = void Function(InterceptStep step, Object object); - -void _defaultLogPrint(InterceptStep step, Object object) => print(object); - -/// Interceptor dedicated to logging -class LoggingInterceptor extends Interceptor { - /// Initialize a new logging interceptor - LoggingInterceptor({ - this.request = true, - this.requestHeader = false, - this.requestBody = true, - this.responseHeader = false, - this.responseBody = true, - this.error = true, - this.maxWidth = 120, - this.compact = true, - this.logPrint = _defaultLogPrint, - }); - - /// Print request [Options] - final bool request; - - /// Print request header [Options.headers] - final bool requestHeader; - - /// Print request data [Options.data] - final bool requestBody; - - /// Print [Response.data] - final bool responseBody; - - /// Print [Response.headers] - final bool responseHeader; - - /// Print error message - final bool error; - - /// InitialTab count to logPrint json response - static const int initialTab = 1; - - /// 1 tab length - static const String tabStep = ' '; - - /// Print compact json response - final bool compact; - - /// Width size per logPrint - final int maxWidth; - - /// Log printer; defaults logPrint log to console. - /// In flutter, you'd better use debugPrint. - /// you can also write log in a file. - void Function(InterceptStep step, Object object) logPrint; - - @override - void onRequest(RequestOptions options, RequestInterceptorHandler handler) { - if (request) { - _printRequestHeader(_logPrintRequest, options); - } - if (requestHeader) { - _printMapAsTable( - _logPrintRequest, - options.queryParameters, - header: 'Query Parameters', - ); - final requestHeaders = {...options.headers}; - requestHeaders['contentType'] = options.contentType?.toString(); - requestHeaders['responseType'] = options.responseType.toString(); - requestHeaders['followRedirects'] = options.followRedirects; - requestHeaders['connectTimeout'] = options.connectTimeout?.toString(); - requestHeaders['receiveTimeout'] = options.receiveTimeout?.toString(); - _printMapAsTable(_logPrintRequest, requestHeaders, header: 'Headers'); - _printMapAsTable(_logPrintRequest, options.extra, header: 'Extras'); - } - if (requestBody && options.method != 'GET') { - final dynamic data = options.data; - if (data != null) { - if (data is Map) { - _printMapAsTable( - _logPrintRequest, - options.data as Map?, - header: 'Body', - ); - } else if (data is FormData) { - final formDataMap = {} - ..addEntries(data.fields) - ..addEntries(data.files); - _printMapAsTable( - _logPrintRequest, - formDataMap, - header: 'Form data | ${data.boundary}', - ); - } else { - _printBlock(_logPrintRequest, data.toString()); - } - } - } - super.onRequest(options, handler); - } - - @override - void onError(DioException exception, ErrorInterceptorHandler handler) { - if (error) { - if (exception.type == DioExceptionType.badResponse) { - final uri = exception.response?.requestOptions.uri; - _printBoxed( - _logPrintError, - header: 'DioException ║ Status: ${exception.response?.statusCode} ${exception.response?.statusMessage}', - text: uri.toString(), - ); - if (exception.response != null && exception.response?.data != null) { - _logPrintError('╔ ${exception.type.toString()}'); - _printResponse(_logPrintError, exception.response!); - } - _printLine(_logPrintError, '╚'); - _logPrintError(''); - } else { - _printBoxed( - _logPrintError, - header: 'DioException ║ ${exception.type}', - text: exception.message, - ); - _printRequestHeader(_logPrintError, exception.requestOptions); - } - } - super.onError(exception, handler); - } - - @override - void onResponse(Response response, ResponseInterceptorHandler handler) { - _printResponseHeader(_logPrintResponse, response); - if (responseHeader) { - final responseHeaders = {}; - response.headers.forEach((k, list) => responseHeaders[k] = list.toString()); - _printMapAsTable(_logPrintResponse, responseHeaders, header: 'Headers'); - } - - if (responseBody) { - _logPrintResponse('╔ Body'); - _logPrintResponse('║'); - _printResponse(_logPrintResponse, response); - _logPrintResponse('║'); - _printLine(_logPrintResponse, '╚'); - } - super.onResponse(response, handler); - } - - void _printBoxed( - void Function(Object) logPrint, { - String? header, - String? text, - }) { - logPrint(''); - logPrint('╔╣ $header'); - logPrint('║ $text'); - _printLine(logPrint, '╚'); - } - - void _printResponse(void Function(Object) logPrint, Response response) { - if (response.data != null) { - if (response.data is Map) { - _printPrettyMap(logPrint, response.data as Map); - } else if (response.data is List) { - logPrint('║${_indent()}['); - _printList(logPrint, response.data as List); - logPrint('║${_indent()}['); - } else { - _printBlock(logPrint, response.data.toString()); - } - } - } - - void _printResponseHeader(void Function(Object) logPrint, Response response) { - final uri = response.requestOptions.uri; - final method = response.requestOptions.method; - _printBoxed( - logPrint, - header: 'Response ║ $method ║ Status: ${response.statusCode} ${response.statusMessage}', - text: uri.toString(), - ); - } - - void _printRequestHeader( - void Function(Object) logPrint, - RequestOptions options, - ) { - final uri = options.uri; - final method = options.method; - _printBoxed(logPrint, header: 'Request ║ $method ', text: uri.toString()); - } - - void _printLine( - void Function(Object) logPrint, [ - String pre = '', - String suf = '╝', - ]) => logPrint('$pre${'═' * maxWidth}$suf'); - - void _printKV(void Function(Object) logPrint, String? key, Object? v) { - final pre = '╟ $key: '; - final msg = v.toString(); - - if (pre.length + msg.length > maxWidth) { - logPrint(pre); - _printBlock(logPrint, msg); - } else { - logPrint('$pre$msg'); - } - } - - void _printBlock(void Function(Object) logPrint, String msg) { - final lines = (msg.length / maxWidth).ceil(); - for (var i = 0; i < lines; ++i) { - logPrint( - (i >= 0 ? '║ ' : '') + - msg.substring( - i * maxWidth, - math.min(i * maxWidth + maxWidth, msg.length), - ), - ); - } - } - - String _indent([int tabCount = initialTab]) => tabStep * tabCount; - - void _printPrettyMap( - void Function(Object) logPrint, - Map data, { - int tabs = initialTab, - bool isListItem = false, - bool isLast = false, - }) { - var _tabs = tabs; - final isRoot = _tabs == initialTab; - final initialIndent = _indent(_tabs); - _tabs++; - - if (isRoot || isListItem) logPrint('║$initialIndent{'); - - data.keys.toList().asMap().forEach((index, dynamic key) { - final isLast = index == data.length - 1; - dynamic value = data[key]; - if (value is String) { - value = '"${value.toString().replaceAll(RegExp(r'(\r|\n)+'), " ")}"'; - } - if (value is Map) { - if (compact) { - logPrint('║${_indent(_tabs)} $key: $value${!isLast ? ',' : ''}'); - } else { - logPrint('║${_indent(_tabs)} $key: {'); - _printPrettyMap(logPrint, value, tabs: _tabs); - } - } else if (value is List) { - if (compact) { - logPrint('║${_indent(_tabs)} $key: ${value.toString()}'); - } else { - logPrint('║${_indent(_tabs)} $key: ['); - _printList(logPrint, value, tabs: _tabs); - logPrint('║${_indent(_tabs)} ]${isLast ? '' : ','}'); - } - } else { - final msg = value.toString().replaceAll('\n', ''); - final indent = _indent(_tabs); - final linWidth = maxWidth - indent.length; - if (msg.length + indent.length > linWidth) { - final lines = (msg.length / linWidth).ceil(); - for (var i = 0; i < lines; ++i) { - logPrint( - '║${_indent(_tabs)} ${msg.substring( - i * linWidth, - math.min(i * linWidth + linWidth, msg.length), - )}', - ); - } - } else { - logPrint('║${_indent(_tabs)} $key: $msg${!isLast ? ',' : ''}'); - } - } - }); - - logPrint('║$initialIndent}${isListItem && !isLast ? ',' : ''}'); - } - - void _printList( - void Function(Object) logPrint, - List list, { - int tabs = initialTab, - }) { - list.asMap().forEach((i, dynamic e) { - final isLast = i == list.length - 1; - if (e is Map) { - if (compact) { - logPrint('║${_indent(tabs)} $e${!isLast ? ',' : ''}'); - } else { - _printPrettyMap( - logPrint, - e, - tabs: tabs + 1, - isListItem: true, - isLast: isLast, - ); - } - } else { - logPrint('║${_indent(tabs + 2)} $e${isLast ? '' : ','}'); - } - }); - } - - void _printMapAsTable( - void Function(Object) logPrint, - Map? map, { - String? header, - }) { - if (map == null || map.isEmpty) return; - logPrint('╔ $header '); - map.forEach((dynamic key, dynamic value) => _printKV(logPrint, key.toString(), value)); - _printLine(logPrint, '╚'); - } - - void _logPrintRequest(Object object) => logPrint(InterceptStep.request, object); - - void _logPrintResponse(Object object) => logPrint(InterceptStep.response, object); - - void _logPrintError(Object object) => logPrint(InterceptStep.error, object); -} diff --git a/packages/stream_chat/lib/src/core/http/stream_chat_dio_error.dart b/packages/stream_chat/lib/src/core/http/stream_chat_dio_error.dart deleted file mode 100644 index 63d7358def..0000000000 --- a/packages/stream_chat/lib/src/core/http/stream_chat_dio_error.dart +++ /dev/null @@ -1,21 +0,0 @@ -import 'package:dio/dio.dart'; -import '../error/error.dart'; - -/// Error class specific to StreamChat and Dio -class StreamChatDioError extends DioException { - /// Initialize a stream chat dio error - StreamChatDioError({ - required this.error, - required super.requestOptions, - super.response, - super.type, - StackTrace? stackTrace, - super.message, - }) : super( - error: error, - stackTrace: stackTrace ?? StackTrace.current, - ); - - @override - final StreamChatNetworkError error; -} diff --git a/packages/stream_chat/lib/src/core/http/stream_http_client.dart b/packages/stream_chat/lib/src/core/http/stream_http_client.dart index 369481bd5e..1cc4361c42 100644 --- a/packages/stream_chat/lib/src/core/http/stream_http_client.dart +++ b/packages/stream_chat/lib/src/core/http/stream_http_client.dart @@ -1,17 +1,22 @@ import 'dart:async'; import 'package:dio/dio.dart'; -import 'package:logging/logging.dart'; import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' + show + ApiErrorInterceptor, + AuthInterceptor, + ConnectionIdInterceptor, + DioExceptionMapping, + HeadersInterceptor, + LoggingInterceptor, + Standard, + StreamCoreHttpClient, + SystemEnvironmentManager, + TokenManager; import '../error/error.dart'; import 'connection_id_manager.dart'; import 'interceptor/additional_headers_interceptor.dart'; -import 'interceptor/auth_interceptor.dart'; -import 'interceptor/connection_id_interceptor.dart'; -import 'interceptor/logging_interceptor.dart'; -import 'stream_chat_dio_error.dart'; -import 'system_environment_manager.dart'; -import 'token_manager.dart'; part 'stream_http_client_options.dart'; @@ -26,11 +31,10 @@ class StreamHttpClient { TokenManager? tokenManager, ConnectionIdManager? connectionIdManager, SystemEnvironmentManager? systemEnvironmentManager, - Logger? logger, Iterable? interceptors, HttpClientAdapter? httpClientAdapter, }) : _options = options ?? const StreamHttpClientOptions(), - httpClient = dio ?? Dio() { + httpClient = dio ?? StreamCoreHttpClient() { httpClient ..options.baseUrl = _options.baseUrl ..options.receiveTimeout = _options.receiveTimeout @@ -45,28 +49,12 @@ class StreamHttpClient { ..._options.headers, } ..interceptors.addAll([ - AdditionalHeadersInterceptor(systemEnvironmentManager), - if (tokenManager != null) AuthInterceptor(this, tokenManager), - if (connectionIdManager != null) ConnectionIdInterceptor(connectionIdManager), - ...interceptors ?? - [ - // Add a default logging interceptor if no interceptors are - // provided. - if (logger != null && logger.level != Level.OFF) - LoggingInterceptor( - requestHeader: true, - logPrint: (step, message) { - switch (step) { - case InterceptStep.request: - return logger.info(message); - case InterceptStep.response: - return logger.info(message); - case InterceptStep.error: - return logger.severe(message); - } - }, - ), - ], + const AdditionalHeadersInterceptor(), + ?systemEnvironmentManager?.let(HeadersInterceptor.new), + ?tokenManager?.let((it) => AuthInterceptor(httpClient, it, tag: 'SCh:HttpAuth')), + ?connectionIdManager?.let((it) => ConnectionIdInterceptor(() => it.connectionId)), + const ApiErrorInterceptor(), + ...interceptors ?? [LoggingInterceptor(requestHeader: true, tag: 'SCh:Http')], ]); if (httpClientAdapter != null) { httpClient.httpClientAdapter = httpClientAdapter; @@ -97,12 +85,11 @@ class StreamHttpClient { /// calling [close] will throw an exception. void close({bool force = false}) => httpClient.close(force: force); - StreamChatNetworkError _parseError(DioException exception) { - // locally thrown dio error - if (exception is StreamChatDioError) return exception.error; - // real network request dio error - return StreamChatNetworkError.fromDioException(exception); - } + // Every failure leaving this client is one of the four `StreamException` + // kinds. `ApiErrorInterceptor` has usually mapped it already, and + // `toStreamException` unwraps that; a rejection raised past the pipeline is + // classified here instead. + StreamChatException _parseError(DioException exception) => exception.toStreamException(); /// Handy method to make http GET request with error parsing. Future> get( diff --git a/packages/stream_chat/lib/src/core/http/system_environment_manager.dart b/packages/stream_chat/lib/src/core/http/system_environment_manager.dart deleted file mode 100644 index c73107052c..0000000000 --- a/packages/stream_chat/lib/src/core/http/system_environment_manager.dart +++ /dev/null @@ -1,111 +0,0 @@ -// ignore_for_file: use_setters_to_change_properties - -import '../../../version.dart'; -import '../../system_environment.dart'; -import '../platform_detector/platform_detector.dart'; - -/// {@template systemEnvironmentManager} -/// A manager class to handle the current [SystemEnvironment]. -/// {@endtemplate} -class SystemEnvironmentManager { - /// {@macro systemEnvironmentManager} - SystemEnvironmentManager({ - SystemEnvironment? environment, - }) : _environment = SystemEnvironment( - sdkName: _sdkName, - sdkIdentifier: _SdkIdentifier.dart, - sdkVersion: PACKAGE_VERSION, - osName: CurrentPlatform.name, - ) { - if (environment != null) updateEnvironment(environment); - } - - static const _sdkName = 'stream-chat'; - - /// Returns the Stream client user agent string based on the current - /// [environment] value. - String get userAgent => _environment.xStreamClientHeader; - - /// The current [SystemEnvironment]. - SystemEnvironment get environment => _environment; - SystemEnvironment _environment; - - /// Updates the current [SystemEnvironment]. - void updateEnvironment(SystemEnvironment environment) { - _environment = _sanitize(environment); - } - - /// Sanitizes the passed [SystemEnvironment] - /// Ignores custom values for: - /// - sdkName - /// - sdkVersion - /// - osName - /// Allows only the dart -> flutter promotion for: - /// - sdkIdentifier (any other value, including a flutter -> dart - /// demotion, is ignored) - /// Allows overriding of: - /// - appName - /// - appVersion - /// - osVersion - /// - deviceModel - SystemEnvironment _sanitize(SystemEnvironment environment) { - final incoming = _SdkIdentifier(environment.sdkIdentifier); - final current = _SdkIdentifier(_environment.sdkIdentifier); - final sdkIdentifier = incoming.precedence < current.precedence ? current : incoming; - final osName = _environment.osName; - return SystemEnvironment( - sdkName: _sdkName, - sdkIdentifier: sdkIdentifier, - sdkVersion: PACKAGE_VERSION, - appName: environment.appName, - appVersion: environment.appVersion, - osName: osName, - osVersion: environment.osVersion, - deviceModel: environment.deviceModel, - ); - } -} - -/// Extension on [SystemEnvironment] to build a Stream client header string. -extension XStreamClientHeaderExtension on SystemEnvironment { - /// Builds a Stream client header string for API requests. - /// - /// The header follows the format: - /// `{sdk}-{identifier}-v{version} - /// |app={appName} - /// |app_version={appVersion} - /// |os={osName} {osVersion} - /// |device_model={deviceModel}` - /// - /// Only non-null values are included in the header. - String get xStreamClientHeader { - final clientInfo = '$sdkName-$sdkIdentifier-v$sdkVersion'; - - return [ - clientInfo, - if (appName case final name?) 'app=$name', - if (appVersion case final version?) 'app_version=$version', - switch ((osName, osVersion)) { - (final name?, final version?) => 'os=$name $version', - (final name?, null) => 'os=$name', - _ => null, - }, - if (deviceModel case final model?) 'device_model=$model', - ].nonNulls.join('|'); - } -} - -/// Known SDK identifiers ranked by precedence. A proposed update is only -/// accepted when its precedence is greater than or equal to the current -/// identifier's, which makes the dart -> flutter transition one-way and -/// causes unknown identifiers to fall back to the current value. -extension type const _SdkIdentifier(String value) implements String { - static const dart = _SdkIdentifier('dart'); - static const flutter = _SdkIdentifier('flutter'); - - int get precedence => switch (this) { - dart => 0, - flutter => 1, - _ => -1, - }; -} diff --git a/packages/stream_chat/lib/src/core/http/token.dart b/packages/stream_chat/lib/src/core/http/token.dart deleted file mode 100644 index e1c2c11a96..0000000000 --- a/packages/stream_chat/lib/src/core/http/token.dart +++ /dev/null @@ -1,81 +0,0 @@ -import 'dart:convert'; - -import 'package:equatable/equatable.dart'; -import 'package:jose/jose.dart'; -import '../models/user.dart'; -import '../util/utils.dart'; - -/// A function which can be used to request a Stream Chat API token from your -/// own backend server -typedef GuestTokenProvider = Future Function(User user); - -/// Authentication type -enum AuthType { - /// JWT token - jwt, - - /// Anonymous user - anonymous, -} - -/// Token designed to store the JWT and the user it is related to. -class Token extends Equatable { - const Token._({ - required this.rawValue, - required this.userId, - required this.authType, - }); - - /// The token that can be used when user is unknown. - /// Is used by `anonymous` token provider. - factory Token.anonymous({String? userId}) => Token._( - rawValue: '', - userId: userId ?? randomId(), - authType: AuthType.anonymous, - ); - - /// Creates a [Token] instance from the provided [rawValue] if it's valid. - factory Token.fromRawValue(String rawValue) { - final jwtBody = JsonWebToken.unverified(rawValue); - final userId = jwtBody.claims.getTyped('user_id'); - assert( - userId != null, - 'Invalid `token`, It should contain `user_id`', - ); - return Token._( - rawValue: rawValue, - userId: userId!.toString(), - authType: AuthType.jwt, - ); - } - - /// The token which can be used during the development. - /// Is used by `development(userId:)` token provider. - factory Token.development(String userId) { - const devSignature = 'devtoken'; - const header = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9'; - final payload = json.encode({'user_id': userId}); - final payloadBytes = utf8.encode(payload); - final payloadB64 = base64.encode(payloadBytes); - final jwt = '$header.$payloadB64.$devSignature'; - return Token._(rawValue: jwt, userId: userId, authType: AuthType.jwt); - } - - /// The token which designed to be used for guest users. - static Future guest(User user, GuestTokenProvider provider) async { - final rawToken = await provider(user); - return Token.fromRawValue(rawToken); - } - - /// Authentication type of this token - final AuthType authType; - - /// String value of the token - final String rawValue; - - /// User id associated with this token - final String userId; - - @override - List get props => [authType, rawValue, userId]; -} diff --git a/packages/stream_chat/lib/src/core/http/token_manager.dart b/packages/stream_chat/lib/src/core/http/token_manager.dart deleted file mode 100644 index f3e855dddd..0000000000 --- a/packages/stream_chat/lib/src/core/http/token_manager.dart +++ /dev/null @@ -1,79 +0,0 @@ -import 'token.dart'; - -/// A function which can be used to request a Stream Chat API token from your -/// own backend server. -/// Function requires a single [userId]. -typedef TokenProvider = Future Function(String userId); - -/// Handles common token operations -class TokenManager { - /// Initialize a new token manager - TokenManager({ - this._userId, - this._token, - this._tokenProvider, - }); - - String? _type; - Token? _token; - - TokenProvider? _tokenProvider; - - String? _userId; - - /// User id to which this TokenManager is configured to - String? get userId => _userId; - - /// True if it's a static token - bool get isStatic => _type == 'static'; - - /// Set a token or a token provider - Future setTokenOrProvider( - String userId, { - Token? token, - TokenProvider? provider, - }) async { - assert(() { - if (token == null && provider == null) { - throw AssertionError('Provide at-least token or provider'); - } - if (token != null && provider != null) { - throw AssertionError("Can't set both token and provider"); - } - return true; - }(), ''); - - _userId = userId; - - if (token != null) { - _type = 'static'; - _token = token; - } - if (provider != null) { - _type = 'provider'; - _tokenProvider = provider; - } - - return loadToken(); - } - - /// Returns the token refreshing the existing one if [refresh] is true - Future loadToken({bool refresh = false}) async { - assert( - _userId != null && _type != null, - 'Please call `setTokenOrProvider` before calling `loadToken`', - ); - if (refresh || _token == null) { - final rawValue = await _tokenProvider!(_userId!); - _token = Token.fromRawValue(rawValue); - } - return _token!; - } - - /// Resets the token manager - void reset() { - _userId = null; - _token = null; - _tokenProvider = null; - } -} diff --git a/packages/stream_chat/lib/src/core/models/attachment_file.dart b/packages/stream_chat/lib/src/core/models/attachment_file.dart index 5ea65a9c10..e62415a782 100644 --- a/packages/stream_chat/lib/src/core/models/attachment_file.dart +++ b/packages/stream_chat/lib/src/core/models/attachment_file.dart @@ -122,34 +122,34 @@ sealed class UploadState with _$UploadState { const UploadState._(); /// Preparing state of the union - const factory UploadState.preparing() = Preparing; + const factory UploadState.preparing() = UploadStatePreparing; /// InProgress state of the union const factory UploadState.inProgress({ required int uploaded, required int total, - }) = InProgress; + }) = UploadStateInProgress; /// Success state of the union - const factory UploadState.success() = Success; + const factory UploadState.success() = UploadStateSuccess; /// Failed state of the union - const factory UploadState.failed({required String error}) = Failed; + const factory UploadState.failed({required String error}) = UploadStateFailed; /// Creates a new instance from a json factory UploadState.fromJson(Map json) => _$UploadStateFromJson(json); - /// Returns true if state is [Preparing] - bool get isPreparing => this is Preparing; + /// Returns true if state is [UploadStatePreparing] + bool get isPreparing => this is UploadStatePreparing; - /// Returns true if state is [InProgress] - bool get isInProgress => this is InProgress; + /// Returns true if state is [UploadStateInProgress] + bool get isInProgress => this is UploadStateInProgress; - /// Returns true if state is [Success] - bool get isSuccess => this is Success; + /// Returns true if state is [UploadStateSuccess] + bool get isSuccess => this is UploadStateSuccess; - /// Returns true if state is [Failed] - bool get isFailed => this is Failed; + /// Returns true if state is [UploadStateFailed] + bool get isFailed => this is UploadStateFailed; } // coverage:ignore-start @@ -166,10 +166,10 @@ extension UploadStatePatternMatching on UploadState { }) { final uploadState = this; return switch (uploadState) { - Preparing() => preparing(), - InProgress() => inProgress(uploadState.uploaded, uploadState.total), - Success() => success(), - Failed() => failed(uploadState.error), + UploadStatePreparing() => preparing(), + UploadStateInProgress() => inProgress(uploadState.uploaded, uploadState.total), + UploadStateSuccess() => success(), + UploadStateFailed() => failed(uploadState.error), }; } @@ -183,10 +183,10 @@ extension UploadStatePatternMatching on UploadState { }) { final uploadState = this; return switch (uploadState) { - Preparing() => preparing?.call(), - InProgress() => inProgress?.call(uploadState.uploaded, uploadState.total), - Success() => success?.call(), - Failed() => failed?.call(uploadState.error), + UploadStatePreparing() => preparing?.call(), + UploadStateInProgress() => inProgress?.call(uploadState.uploaded, uploadState.total), + UploadStateSuccess() => success?.call(), + UploadStateFailed() => failed?.call(uploadState.error), }; } @@ -201,10 +201,10 @@ extension UploadStatePatternMatching on UploadState { }) { final uploadState = this; final result = switch (uploadState) { - Preparing() => preparing?.call(), - InProgress() => inProgress?.call(uploadState.uploaded, uploadState.total), - Success() => success?.call(), - Failed() => failed?.call(uploadState.error), + UploadStatePreparing() => preparing?.call(), + UploadStateInProgress() => inProgress?.call(uploadState.uploaded, uploadState.total), + UploadStateSuccess() => success?.call(), + UploadStateFailed() => failed?.call(uploadState.error), }; return result ?? orElse(); @@ -213,52 +213,52 @@ extension UploadStatePatternMatching on UploadState { /// @nodoc @optionalTypeArgs TResult map({ - required TResult Function(Preparing value) preparing, - required TResult Function(InProgress value) inProgress, - required TResult Function(Success value) success, - required TResult Function(Failed value) failed, + required TResult Function(UploadStatePreparing value) preparing, + required TResult Function(UploadStateInProgress value) inProgress, + required TResult Function(UploadStateSuccess value) success, + required TResult Function(UploadStateFailed value) failed, }) { final uploadState = this; return switch (uploadState) { - Preparing() => preparing(uploadState), - InProgress() => inProgress(uploadState), - Success() => success(uploadState), - Failed() => failed(uploadState), + UploadStatePreparing() => preparing(uploadState), + UploadStateInProgress() => inProgress(uploadState), + UploadStateSuccess() => success(uploadState), + UploadStateFailed() => failed(uploadState), }; } /// @nodoc @optionalTypeArgs TResult? mapOrNull({ - TResult? Function(Preparing value)? preparing, - TResult? Function(InProgress value)? inProgress, - TResult? Function(Success value)? success, - TResult? Function(Failed value)? failed, + TResult? Function(UploadStatePreparing value)? preparing, + TResult? Function(UploadStateInProgress value)? inProgress, + TResult? Function(UploadStateSuccess value)? success, + TResult? Function(UploadStateFailed value)? failed, }) { final uploadState = this; return switch (uploadState) { - Preparing() => preparing?.call(uploadState), - InProgress() => inProgress?.call(uploadState), - Success() => success?.call(uploadState), - Failed() => failed?.call(uploadState), + UploadStatePreparing() => preparing?.call(uploadState), + UploadStateInProgress() => inProgress?.call(uploadState), + UploadStateSuccess() => success?.call(uploadState), + UploadStateFailed() => failed?.call(uploadState), }; } /// @nodoc @optionalTypeArgs TResult maybeMap({ - TResult Function(Preparing value)? preparing, - TResult Function(InProgress value)? inProgress, - TResult Function(Success value)? success, - TResult Function(Failed value)? failed, + TResult Function(UploadStatePreparing value)? preparing, + TResult Function(UploadStateInProgress value)? inProgress, + TResult Function(UploadStateSuccess value)? success, + TResult Function(UploadStateFailed value)? failed, required TResult orElse(), }) { final uploadState = this; final result = switch (uploadState) { - Preparing() => preparing?.call(uploadState), - InProgress() => inProgress?.call(uploadState), - Success() => success?.call(uploadState), - Failed() => failed?.call(uploadState), + UploadStatePreparing() => preparing?.call(uploadState), + UploadStateInProgress() => inProgress?.call(uploadState), + UploadStateSuccess() => success?.call(uploadState), + UploadStateFailed() => failed?.call(uploadState), }; return result ?? orElse(); diff --git a/packages/stream_chat/lib/src/core/models/attachment_file.freezed.dart b/packages/stream_chat/lib/src/core/models/attachment_file.freezed.dart index d2324958e7..5d5f697266 100644 --- a/packages/stream_chat/lib/src/core/models/attachment_file.freezed.dart +++ b/packages/stream_chat/lib/src/core/models/attachment_file.freezed.dart @@ -13,13 +13,13 @@ T _$identity(T value) => value; UploadState _$UploadStateFromJson(Map json) { switch (json['runtimeType']) { case 'preparing': - return Preparing.fromJson(json); + return UploadStatePreparing.fromJson(json); case 'inProgress': - return InProgress.fromJson(json); + return UploadStateInProgress.fromJson(json); case 'success': - return Success.fromJson(json); + return UploadStateSuccess.fromJson(json); case 'failed': - return Failed.fromJson(json); + return UploadStateFailed.fromJson(json); default: throw CheckedFromJsonException( @@ -58,21 +58,21 @@ class $UploadStateCopyWith<$Res> { /// @nodoc @JsonSerializable() -class Preparing extends UploadState { - const Preparing({final String? $type}) : $type = $type ?? 'preparing', super._(); - factory Preparing.fromJson(Map json) => _$PreparingFromJson(json); +class UploadStatePreparing extends UploadState { + const UploadStatePreparing({final String? $type}) : $type = $type ?? 'preparing', super._(); + factory UploadStatePreparing.fromJson(Map json) => _$UploadStatePreparingFromJson(json); @JsonKey(name: 'runtimeType') final String $type; @override Map toJson() { - return _$PreparingToJson(this); + return _$UploadStatePreparingToJson(this); } @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType && other is Preparing); + return identical(this, other) || (other.runtimeType == runtimeType && other is UploadStatePreparing); } @JsonKey(includeFromJson: false, includeToJson: false) @@ -86,28 +86,31 @@ class Preparing extends UploadState { } /// @nodoc -class $PreparingCopyWith<$Res> implements $UploadStateCopyWith<$Res> { - $PreparingCopyWith(Preparing _, $Res Function(Preparing) __); +class $UploadStatePreparingCopyWith<$Res> implements $UploadStateCopyWith<$Res> { + $UploadStatePreparingCopyWith( + UploadStatePreparing _, + $Res Function(UploadStatePreparing) __, + ); } /// @nodoc -class _$PreparingCopyWithImpl<$Res> implements $PreparingCopyWith<$Res> { - _$PreparingCopyWithImpl(this._self, this._then); +class _$UploadStatePreparingCopyWithImpl<$Res> implements $UploadStatePreparingCopyWith<$Res> { + _$UploadStatePreparingCopyWithImpl(this._self, this._then); - final Preparing _self; - final $Res Function(Preparing) _then; + final UploadStatePreparing _self; + final $Res Function(UploadStatePreparing) _then; } /// @nodoc @JsonSerializable() -class InProgress extends UploadState { - const InProgress({ +class UploadStateInProgress extends UploadState { + const UploadStateInProgress({ required this.uploaded, required this.total, final String? $type, }) : $type = $type ?? 'inProgress', super._(); - factory InProgress.fromJson(Map json) => _$InProgressFromJson(json); + factory UploadStateInProgress.fromJson(Map json) => _$UploadStateInProgressFromJson(json); final int uploaded; final int total; @@ -119,18 +122,22 @@ class InProgress extends UploadState { /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @pragma('vm:prefer-inline') - $InProgressCopyWith get copyWith => _$InProgressCopyWithImpl(this, _$identity); + $UploadStateInProgressCopyWith get copyWith => + _$UploadStateInProgressCopyWithImpl( + this, + _$identity, + ); @override Map toJson() { - return _$InProgressToJson(this); + return _$UploadStateInProgressToJson(this); } @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is InProgress && + other is UploadStateInProgress && (identical(other.uploaded, uploaded) || other.uploaded == uploaded) && (identical(other.total, total) || other.total == total)); } @@ -146,28 +153,28 @@ class InProgress extends UploadState { } /// @nodoc -abstract mixin class $InProgressCopyWith<$Res> implements $UploadStateCopyWith<$Res> { - factory $InProgressCopyWith( - InProgress value, - $Res Function(InProgress) _then, - ) = _$InProgressCopyWithImpl; +abstract mixin class $UploadStateInProgressCopyWith<$Res> implements $UploadStateCopyWith<$Res> { + factory $UploadStateInProgressCopyWith( + UploadStateInProgress value, + $Res Function(UploadStateInProgress) _then, + ) = _$UploadStateInProgressCopyWithImpl; @useResult $Res call({int uploaded, int total}); } /// @nodoc -class _$InProgressCopyWithImpl<$Res> implements $InProgressCopyWith<$Res> { - _$InProgressCopyWithImpl(this._self, this._then); +class _$UploadStateInProgressCopyWithImpl<$Res> implements $UploadStateInProgressCopyWith<$Res> { + _$UploadStateInProgressCopyWithImpl(this._self, this._then); - final InProgress _self; - final $Res Function(InProgress) _then; + final UploadStateInProgress _self; + final $Res Function(UploadStateInProgress) _then; /// Create a copy of UploadState /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') $Res call({Object? uploaded = null, Object? total = null}) { return _then( - InProgress( + UploadStateInProgress( uploaded: null == uploaded ? _self.uploaded : uploaded // ignore: cast_nullable_to_non_nullable @@ -183,21 +190,21 @@ class _$InProgressCopyWithImpl<$Res> implements $InProgressCopyWith<$Res> { /// @nodoc @JsonSerializable() -class Success extends UploadState { - const Success({final String? $type}) : $type = $type ?? 'success', super._(); - factory Success.fromJson(Map json) => _$SuccessFromJson(json); +class UploadStateSuccess extends UploadState { + const UploadStateSuccess({final String? $type}) : $type = $type ?? 'success', super._(); + factory UploadStateSuccess.fromJson(Map json) => _$UploadStateSuccessFromJson(json); @JsonKey(name: 'runtimeType') final String $type; @override Map toJson() { - return _$SuccessToJson(this); + return _$UploadStateSuccessToJson(this); } @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType && other is Success); + return identical(this, other) || (other.runtimeType == runtimeType && other is UploadStateSuccess); } @JsonKey(includeFromJson: false, includeToJson: false) @@ -211,23 +218,26 @@ class Success extends UploadState { } /// @nodoc -class $SuccessCopyWith<$Res> implements $UploadStateCopyWith<$Res> { - $SuccessCopyWith(Success _, $Res Function(Success) __); +class $UploadStateSuccessCopyWith<$Res> implements $UploadStateCopyWith<$Res> { + $UploadStateSuccessCopyWith( + UploadStateSuccess _, + $Res Function(UploadStateSuccess) __, + ); } /// @nodoc -class _$SuccessCopyWithImpl<$Res> implements $SuccessCopyWith<$Res> { - _$SuccessCopyWithImpl(this._self, this._then); +class _$UploadStateSuccessCopyWithImpl<$Res> implements $UploadStateSuccessCopyWith<$Res> { + _$UploadStateSuccessCopyWithImpl(this._self, this._then); - final Success _self; - final $Res Function(Success) _then; + final UploadStateSuccess _self; + final $Res Function(UploadStateSuccess) _then; } /// @nodoc @JsonSerializable() -class Failed extends UploadState { - const Failed({required this.error, final String? $type}) : $type = $type ?? 'failed', super._(); - factory Failed.fromJson(Map json) => _$FailedFromJson(json); +class UploadStateFailed extends UploadState { + const UploadStateFailed({required this.error, final String? $type}) : $type = $type ?? 'failed', super._(); + factory UploadStateFailed.fromJson(Map json) => _$UploadStateFailedFromJson(json); final String error; @@ -238,18 +248,19 @@ class Failed extends UploadState { /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @pragma('vm:prefer-inline') - $FailedCopyWith get copyWith => _$FailedCopyWithImpl(this, _$identity); + $UploadStateFailedCopyWith get copyWith => + _$UploadStateFailedCopyWithImpl(this, _$identity); @override Map toJson() { - return _$FailedToJson(this); + return _$UploadStateFailedToJson(this); } @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is Failed && + other is UploadStateFailed && (identical(other.error, error) || other.error == error)); } @@ -264,25 +275,28 @@ class Failed extends UploadState { } /// @nodoc -abstract mixin class $FailedCopyWith<$Res> implements $UploadStateCopyWith<$Res> { - factory $FailedCopyWith(Failed value, $Res Function(Failed) _then) = _$FailedCopyWithImpl; +abstract mixin class $UploadStateFailedCopyWith<$Res> implements $UploadStateCopyWith<$Res> { + factory $UploadStateFailedCopyWith( + UploadStateFailed value, + $Res Function(UploadStateFailed) _then, + ) = _$UploadStateFailedCopyWithImpl; @useResult $Res call({String error}); } /// @nodoc -class _$FailedCopyWithImpl<$Res> implements $FailedCopyWith<$Res> { - _$FailedCopyWithImpl(this._self, this._then); +class _$UploadStateFailedCopyWithImpl<$Res> implements $UploadStateFailedCopyWith<$Res> { + _$UploadStateFailedCopyWithImpl(this._self, this._then); - final Failed _self; - final $Res Function(Failed) _then; + final UploadStateFailed _self; + final $Res Function(UploadStateFailed) _then; /// Create a copy of UploadState /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') $Res call({Object? error = null}) { return _then( - Failed( + UploadStateFailed( error: null == error ? _self.error : error // ignore: cast_nullable_to_non_nullable diff --git a/packages/stream_chat/lib/src/core/models/attachment_file.g.dart b/packages/stream_chat/lib/src/core/models/attachment_file.g.dart index e4bb85e8f8..31bd29c33b 100644 --- a/packages/stream_chat/lib/src/core/models/attachment_file.g.dart +++ b/packages/stream_chat/lib/src/core/models/attachment_file.g.dart @@ -18,36 +18,43 @@ Map _$AttachmentFileToJson(AttachmentFile instance) => json) => Preparing($type: json['runtimeType'] as String?); +UploadStatePreparing _$UploadStatePreparingFromJson( + Map json, +) => UploadStatePreparing($type: json['runtimeType'] as String?); -Map _$PreparingToJson(Preparing instance) => { - 'runtimeType': instance.$type, -}; +Map _$UploadStatePreparingToJson( + UploadStatePreparing instance, +) => {'runtimeType': instance.$type}; -InProgress _$InProgressFromJson(Map json) => InProgress( +UploadStateInProgress _$UploadStateInProgressFromJson( + Map json, +) => UploadStateInProgress( uploaded: (json['uploaded'] as num).toInt(), total: (json['total'] as num).toInt(), $type: json['runtimeType'] as String?, ); -Map _$InProgressToJson(InProgress instance) => { +Map _$UploadStateInProgressToJson( + UploadStateInProgress instance, +) => { 'uploaded': instance.uploaded, 'total': instance.total, 'runtimeType': instance.$type, }; -Success _$SuccessFromJson(Map json) => Success($type: json['runtimeType'] as String?); +UploadStateSuccess _$UploadStateSuccessFromJson(Map json) => + UploadStateSuccess($type: json['runtimeType'] as String?); -Map _$SuccessToJson(Success instance) => { +Map _$UploadStateSuccessToJson(UploadStateSuccess instance) => { 'runtimeType': instance.$type, }; -Failed _$FailedFromJson(Map json) => Failed( +UploadStateFailed _$UploadStateFailedFromJson(Map json) => UploadStateFailed( error: json['error'] as String, $type: json['runtimeType'] as String?, ); -Map _$FailedToJson(Failed instance) => { +Map _$UploadStateFailedToJson(UploadStateFailed instance) => { 'error': instance.error, 'runtimeType': instance.$type, }; diff --git a/packages/stream_chat/lib/src/core/util/in_flight_cache.dart b/packages/stream_chat/lib/src/core/util/in_flight_cache.dart deleted file mode 100644 index 5dcfb9b28e..0000000000 --- a/packages/stream_chat/lib/src/core/util/in_flight_cache.dart +++ /dev/null @@ -1,39 +0,0 @@ -import 'dart:async'; - -/// Coalesces concurrent identical async calls by sharing a single in-flight -/// [Future] keyed by [K]. -/// -/// When [run] is called and no [Future] is in flight for [key], the [work] -/// closure runs and its [Future] is cached. Concurrent callers passing the -/// same [key] receive the cached [Future] and share its eventual outcome — -/// both success and failure. Sequential callers arriving after the [Future] -/// settles see an empty cache and start fresh. -/// -/// Sharing failures is intentional: falling through to a fresh call on -/// error would defeat the dedup precisely when it matters most (e.g., a -/// rate-limit storm), turning one rejected request into N. -/// -/// Mirrors the `DistinctChatApi` / `DistinctCall` design used across the -/// Android Stream Chat SDK. -class InFlightCache { - final _inFlight = >{}; - - /// Returns the in-flight [Future] for [key] if one exists, otherwise runs - /// [work], caches its [Future], and frees the slot when it settles. - Future run(K key, Future Function() work) { - if (_inFlight[key] case final existing?) return existing; - - // [Future.sync] runs [work] synchronously on the current microtask and - // wraps any synchronous throw in a rejected [Future] — so concurrent - // callers in the same tick share the same single invocation. - final future = Future.sync(work); - _inFlight[key] = future; - - // The cleanup chain runs regardless of outcome. The trailing [ignore] - // silences unhandled-error reporting on the chained future since - // [whenComplete] forwards the original error rather than handling it. - future.whenComplete(() => _inFlight.remove(key)).ignore(); - - return future; - } -} diff --git a/packages/stream_chat/lib/src/system_environment.dart b/packages/stream_chat/lib/src/system_environment.dart deleted file mode 100644 index 87c733b5de..0000000000 --- a/packages/stream_chat/lib/src/system_environment.dart +++ /dev/null @@ -1,57 +0,0 @@ -/// {@template streamChatSystemEnvironment} -/// A class that represents the environment in which the Stream Chat SDK is -/// running. -/// -/// This class provides information about the SDK, application, and device -/// used for tracking and debugging purposes. -/// {@endtemplate} -class SystemEnvironment { - /// {@macro streamChatSystemEnvironment} - const SystemEnvironment({ - required this.sdkName, - required this.sdkIdentifier, - required this.sdkVersion, - this.appName, - this.appVersion, - this.osName, - this.osVersion, - this.deviceModel, - }); - - /// The name of the SDK. - final String sdkName; - - /// The identifier of the SDK platform. - /// - /// This is used to distinguish between different implementations - /// (e.g., 'dart', 'flutter', etc.). - final String sdkIdentifier; - - /// The version of the SDK. - final String sdkVersion; - - /// The name of the application. - /// - /// This is null by default and could be set by the application. - final String? appName; - - /// The version of the application. - /// - /// This is null by default and could be set by the application. - final String? appVersion; - - /// The name of the operating system. - /// - /// This is null by default and could be set by the application. - final String? osName; - - /// The version of the operating system. - /// - /// This is null by default and could be set by the application. - final String? osVersion; - - /// The device model information. - /// - /// This is null by default and could be set by the application. - final String? deviceModel; -} diff --git a/packages/stream_chat/lib/src/ws/websocket.dart b/packages/stream_chat/lib/src/ws/websocket.dart index 37a29c6deb..3531f4a505 100644 --- a/packages/stream_chat/lib/src/ws/websocket.dart +++ b/packages/stream_chat/lib/src/ws/websocket.dart @@ -2,15 +2,14 @@ import 'dart:async'; import 'dart:convert'; import 'dart:math' as math; -import 'package:logging/logging.dart'; import 'package:meta/meta.dart'; import 'package:rxdart/rxdart.dart'; +import 'package:stream_core/stream_core.dart' + show StreamErrorCode, StreamLogger, SystemEnvironmentManager, TokenManager; import 'package:web_socket_channel/status.dart' as status; import 'package:web_socket_channel/web_socket_channel.dart'; import '../core/error/error.dart'; -import '../core/http/system_environment_manager.dart'; -import '../core/http/token_manager.dart'; import '../core/models/event.dart'; import '../core/models/own_user.dart'; import '../core/util/extension.dart'; @@ -41,14 +40,16 @@ class WebSocket with TimerHelper { required this.tokenManager, this.systemEnvironmentManager, this.handler, - this._logger, this.webSocketChannelProvider, this.reconnectionMonitorInterval = 10, this.healthCheckInterval = 20, this.reconnectionMonitorTimeout = 40, this.maxReconnectAttempts = 6, this.queryParameters = const {}, - }); + String tag = 'SCh:Ws', + }) : _logger = StreamLogger(tag); + + final StreamLogger _logger; /// final String apiKey; @@ -75,8 +76,6 @@ class WebSocket with TimerHelper { /// connection final EventHandler? handler; - final Logger? _logger; - /// Connection function /// Used only for testing purpose @visibleForTesting @@ -130,7 +129,7 @@ class WebSocket with TimerHelper { } void _initWebSocketChannel(Uri uri) { - _logger?.info('Initiating connection with $baseUrl'); + _logger.d(() => 'Initiating connection with $baseUrl'); if (_webSocketChannel != null) { _closeWebSocketChannel(); } @@ -143,7 +142,7 @@ class WebSocket with TimerHelper { } void _closeWebSocketChannel() { - _logger?.info('Closing connection with $baseUrl'); + _logger.d(() => 'Closing connection with $baseUrl'); if (_webSocketChannel != null) { _unsubscribeFromWebSocketChannel(); _webSocketChannel?.sink.close(status.normalClosure, 'Closing connection'); @@ -152,7 +151,7 @@ class WebSocket with TimerHelper { } void _subscribeToWebSocketChannel() { - _logger?.info('Started listening to $baseUrl'); + _logger.d(() => 'Started listening to $baseUrl'); if (_webSocketChannelSubscription != null) { _unsubscribeFromWebSocketChannel(); } @@ -164,7 +163,7 @@ class WebSocket with TimerHelper { } void _unsubscribeFromWebSocketChannel() { - _logger?.info('Stopped listening to $baseUrl'); + _logger.d(() => 'Stopped listening to $baseUrl'); if (_webSocketChannelSubscription != null) { _webSocketChannelSubscription?.cancel(); _webSocketChannelSubscription = null; @@ -176,7 +175,8 @@ class WebSocket with TimerHelper { bool includeUserDetails = true, }) async { final userDetails = ConnectUserDetails.fromOwnUser(_user!); - final token = await tokenManager.loadToken(refresh: refreshToken); + if (refreshToken) tokenManager.expireToken(); + final token = await tokenManager.getToken(); final params = { 'user_id': userDetails.id, 'user_details': includeUserDetails ? userDetails : {'id': userDetails.id}, @@ -207,7 +207,7 @@ class WebSocket with TimerHelper { _ => throw const FormatException('Invalid address format'), }; - _logger?.info('[buildUri] #ws; scheme: $scheme, host: $host, port: $port'); + _logger.d(() => '[buildUri] #ws; scheme: $scheme, host: $host, port: $port'); return Uri( scheme: scheme, @@ -251,7 +251,7 @@ class WebSocket with TimerHelper { final uri = await _buildUri( includeUserDetails: includeUserDetails, ); - _logger?.info('[connect] #ws; uri: $uri'); + _logger.d(() => '[connect] #ws; uri: ${uri.withoutCredentials}'); _initWebSocketChannel(uri); } catch (e, stk) { _onConnectionError(e, stk); @@ -272,14 +272,14 @@ class WebSocket with TimerHelper { /// Call [resumeReconnect] before re-establishing the connection. void pauseReconnect() { if (!_reconnectEnabled) return; - _logger?.info('Pausing reconnection'); + _logger.d(() => 'Pausing reconnection'); _reconnectEnabled = false; } /// Re-enables automatic reconnection after a previous [pauseReconnect]. void resumeReconnect() { if (_reconnectEnabled) return; - _logger?.info('Resuming reconnection'); + _logger.d(() => 'Resuming reconnection'); _reconnectEnabled = true; } @@ -292,15 +292,15 @@ class WebSocket with TimerHelper { _closeWebSocketChannel(); if (!_reconnectEnabled) { - _logger?.info('Reconnect skipped: paused'); + _logger.d(() => 'Reconnect skipped: paused'); _connectionStatus = ConnectionStatus.disconnected; return; } - _logger?.info('Retrying connection : $_reconnectAttempt'); + _logger.i(() => 'Retrying connection : $_reconnectAttempt'); if (_reconnectAttempt >= maxReconnectAttempts) { - _logger?.severe('Max reconnect attempts reached: $maxReconnectAttempts'); + _logger.e(() => 'Max reconnect attempts reached: $maxReconnectAttempts'); return disconnect(); } @@ -326,7 +326,7 @@ class WebSocket with TimerHelper { refreshToken: refreshToken, includeUserDetails: false, ); - _logger?.info('[reconnect] #ws; uri: $uri'); + _logger.d(() => '[reconnect] #ws; uri: ${uri.withoutCredentials}'); try { _initWebSocketChannel(uri); } catch (e, stk) { @@ -349,7 +349,7 @@ class WebSocket with TimerHelper { } void _startMonitoringEvents() { - _logger?.info('Starting monitoring events'); + _logger.d(() => 'Starting monitoring events'); // cancel all previous timers cancelAllTimers(); @@ -358,7 +358,7 @@ class WebSocket with TimerHelper { } void _stopMonitoringEvents() { - _logger?.info('Stopped monitoring events'); + _logger.d(() => 'Stopped monitoring events'); // reset lastEvent _lastEventAt = null; @@ -370,7 +370,7 @@ class WebSocket with TimerHelper { _connectionId = event.connectionId; _connectionStatus = ConnectionStatus.connected; - _logger?.info('Connection successful: $_connectionId'); + _logger.i(() => 'Connection successful: $_connectionId'); // notify user that connection is completed final completer = connectionCompleter; @@ -383,7 +383,7 @@ class WebSocket with TimerHelper { } void _handleHealthCheckEvent(Event event) { - _logger?.info('HealthCheck received : ${event.connectionId}'); + _logger.v(() => 'HealthCheck received : ${event.connectionId}'); _connectionId = event.connectionId; _connectionStatus = ConnectionStatus.connected; @@ -394,13 +394,13 @@ class WebSocket with TimerHelper { _resetRequestFlags(); final error = StreamWebSocketError.fromStreamError(errorResponse); - final isTokenExpired = error.errorCode == ChatErrorCode.tokenExpired; - if (isTokenExpired && !tokenManager.isStatic) { - _logger?.warning('Connection failed, token expired'); + final isTokenExpired = error.errorCode == StreamErrorCode.tokenExpired; + if (isTokenExpired && !tokenManager.usesStaticProvider) { + _logger.w(() => 'Connection failed, token expired'); return _reconnect(refreshToken: true); } - _logger?.severe('Connection failed', error); + _logger.e(() => 'Connection failed', error: error); final completer = connectionCompleter; // complete with error if not yet completed @@ -426,14 +426,16 @@ class WebSocket with TimerHelper { try { event = Event.fromJson(jsonData); } catch (e, stk) { - _logger?.warning('Error parsing an event: $e'); - _logger?.warning('Stack trace: $stk'); + _logger.w(() => 'Error parsing an event: $e'); + _logger.w(() => 'Stack trace: $stk'); } if (event == null) return; _lastEventAt = DateTime.now(); - _logger?.info('Event received: ${event.type}'); + // Read outside the closure: promotion does not reach inside one. + final type = event.type; + _logger.v(() => 'Event received: $type'); if (event.type == EventType.healthCheck) { if (event.me != null) { @@ -447,7 +449,7 @@ class WebSocket with TimerHelper { } void _onConnectionError(error, [stacktrace]) { - _logger?.warning('[onConnectionError] #ws; error occurred', error, stacktrace); + _logger.w(() => '[onConnectionError] #ws; error occurred', error: error, stackTrace: stacktrace); StreamWebSocketError wsError; if (error is WebSocketChannelException) { @@ -472,7 +474,7 @@ class WebSocket with TimerHelper { bool _manuallyClosed = false; void _onConnectionClosed() { - _logger?.warning('Connection closed : $connectionId'); + _logger.w(() => 'Connection closed : $connectionId'); // resetting connect, reconnect request flag _resetRequestFlags(); @@ -502,12 +504,12 @@ class WebSocket with TimerHelper { } void _startReconnectionMonitor() { - _logger?.info('Starting reconnection monitor'); + _logger.d(() => 'Starting reconnection monitor'); setPeriodicTimer( Duration(seconds: reconnectionMonitorInterval), (_) { final needsToReconnect = _needsToReconnect; - _logger?.info('Needs to reconnect : $needsToReconnect'); + _logger.v(() => 'Needs to reconnect : $needsToReconnect'); if (needsToReconnect) _reconnect(); }, immediate: true, @@ -515,11 +517,11 @@ class WebSocket with TimerHelper { } void _startHealthCheck() { - _logger?.info('Starting health check monitor'); + _logger.d(() => 'Starting health check monitor'); setPeriodicTimer( Duration(seconds: healthCheckInterval), (_) { - _logger?.info('Sending Event: ${EventType.healthCheck}'); + _logger.v(() => 'Sending Event: ${EventType.healthCheck}'); final event = Event( type: EventType.healthCheck, connectionId: connectionId, @@ -535,7 +537,7 @@ class WebSocket with TimerHelper { if (connectionStatus == ConnectionStatus.disconnected) return; _connectionStatus = ConnectionStatus.disconnected; - _logger?.info('Disconnecting web-socket connection'); + _logger.i(() => 'Disconnecting web-socket connection'); _manuallyClosed = true; _resetRequestFlags(resetAttempts: true); @@ -550,7 +552,7 @@ class WebSocket with TimerHelper { /// Disposes the web-socket connection and releases resources Future dispose() async { - _logger?.info('Disposing web-socket connection'); + _logger.d(() => 'Disposing web-socket connection'); _stopMonitoringEvents(); _unsubscribeFromWebSocketChannel(); @@ -558,3 +560,22 @@ class WebSocket with TimerHelper { _connectionStatusController.close(); } } + +// The connect URI carries the user token twice — as `authorization`, and as +// `user_token` inside the `json` payload — so neither reaches a log. +extension on Uri { + Uri get withoutCredentials { + const redacted = ''; + final params = {...queryParameters}; + + if (params.containsKey('authorization')) params['authorization'] = redacted; + + if (params['json'] case final payload?) { + if (jsonDecode(payload) case final Map decoded when decoded.containsKey('user_token')) { + params['json'] = jsonEncode({...decoded, 'user_token': redacted}); + } + } + + return replace(queryParameters: params); + } +} diff --git a/packages/stream_chat/lib/stream_chat.dart b/packages/stream_chat/lib/stream_chat.dart index 9f4a057352..059802e0ed 100644 --- a/packages/stream_chat/lib/stream_chat.dart +++ b/packages/stream_chat/lib/stream_chat.dart @@ -1,6 +1,6 @@ library stream_chat; -export 'package:async/async.dart'; +export 'package:async/async.dart' hide Result; export 'package:dio/dio.dart' show DioException, @@ -12,8 +12,34 @@ export 'package:dio/dio.dart' MultipartFile, Options, ProgressCallback; -export 'package:logging/logging.dart' show Logger, Level, LogRecord; export 'package:rate_limiter/rate_limiter.dart'; +// Re-exported with a `show` allowlist rather than wholesale: `stream_core` +// also declares names this barrel defines — `AttachmentFile`, `Filter`, +// `User` — so a blanket export would not compile. +export 'package:stream_core/stream_core.dart' + show + Failure, + Result, + StreamApiError, + StreamApiException, + StreamAuthenticationException, + StreamClientException, + StreamErrorCode, + StreamException, + StreamLogConfig, + StreamLogFilter, + StreamLogHandler, + StreamLogPriority, + StreamLogRecord, + StreamLogger, + StreamNetworkException, + Success, + SystemEnvironment, + TokenManager, + TokenProvider, + UserToken, + UserTokenLoader; + export 'package:uuid/uuid.dart'; export 'src/client/channel/channel.dart'; @@ -31,7 +57,6 @@ export 'src/core/api/responses.dart'; export 'src/core/api/sort_order.dart'; export 'src/core/api/stream_chat_api.dart'; export 'src/core/error/error.dart'; -export 'src/core/http/interceptor/logging_interceptor.dart'; export 'src/core/http/stream_http_client.dart'; export 'src/core/models/action.dart'; export 'src/core/models/app_settings.dart'; @@ -86,5 +111,4 @@ export 'src/core/util/list_extensions.dart'; export 'src/core/util/message_rules.dart'; export 'src/db/chat_persistence_client.dart'; export 'src/event_type.dart'; -export 'src/system_environment.dart'; export 'src/ws/connection_status.dart'; diff --git a/packages/stream_chat/pubspec.yaml b/packages/stream_chat/pubspec.yaml index 7d17fc4711..8fe374d314 100644 --- a/packages/stream_chat/pubspec.yaml +++ b/packages/stream_chat/pubspec.yaml @@ -30,7 +30,6 @@ dependencies: http_parser: ^4.1.2 jose: ^0.3.5+1 json_annotation: ^4.12.0 - logging: ^1.3.0 meta: ^1.9.1 mime: ^2.0.0 rate_limiter: ^1.1.0 diff --git a/packages/stream_chat/test/src/client/channel/channel_capability_check_test.dart b/packages/stream_chat/test/src/client/channel/channel_capability_check_test.dart index cf02992e4e..2082aefc5e 100644 --- a/packages/stream_chat/test/src/client/channel/channel_capability_check_test.dart +++ b/packages/stream_chat/test/src/client/channel/channel_capability_check_test.dart @@ -14,12 +14,6 @@ void main() { late final client = MockStreamChatClient(); setUpAll(() { - // detached loggers - when(() => client.detachedLogger(any())).thenAnswer((invocation) { - final name = invocation.positionalArguments.first; - return _createLogger(name); - }); - final retryPolicy = RetryPolicy( shouldRetry: (_, __, ___) => false, delayFactor: Duration.zero, @@ -31,7 +25,6 @@ void main() { when(() => client.state).thenReturn(clientState); // client logger - when(() => client.logger).thenReturn(_createLogger('mock-client-logger')); }); /// Parameterized test for channel capability extension properties @@ -401,10 +394,4 @@ ChannelState _generateChannelState( return ChannelState(channel: channel); } -Logger _createLogger(String name) { - final logger = Logger.detached(name)..level = Level.ALL; - logger.onRecord.listen(print); - return logger; -} - // endregion diff --git a/packages/stream_chat/test/src/client/channel/channel_client_state_test.dart b/packages/stream_chat/test/src/client/channel/channel_client_state_test.dart index be6c042cb1..bc32ea53c5 100644 --- a/packages/stream_chat/test/src/client/channel/channel_client_state_test.dart +++ b/packages/stream_chat/test/src/client/channel/channel_client_state_test.dart @@ -17,12 +17,6 @@ void main() { registerFallbackValue(FakeAttachmentFile()); registerFallbackValue(FakeEvent()); - // detached loggers - when(() => client.detachedLogger(any())).thenAnswer((invocation) { - final name = invocation.positionalArguments.first; - return _createLogger(name); - }); - final retryPolicy = RetryPolicy( shouldRetry: (_, __, ___) => false, delayFactor: Duration.zero, @@ -34,7 +28,6 @@ void main() { when(() => client.state).thenReturn(clientState); // client logger - when(() => client.logger).thenReturn(_createLogger('mock-client-logger')); // mock channel delivery reporter when( @@ -5108,15 +5101,10 @@ void main() { late final client = MockStreamChatClient(); setUpAll(() { - when(() => client.detachedLogger(any())).thenAnswer((invocation) { - final name = invocation.positionalArguments.first; - return _createLogger(name); - }); when(() => client.retryPolicy).thenReturn( RetryPolicy(shouldRetry: (_, __, ___) => false, delayFactor: Duration.zero), ); when(() => client.state).thenReturn(FakeClientState(currentUser: currentUser)); - when(() => client.logger).thenReturn(_createLogger('mock-client-logger')); when( () => client.channelDeliveryReporter.submitForDelivery(any()), ).thenAnswer((_) async {}); @@ -5177,15 +5165,10 @@ void main() { 'disabled', () async { final disabledClient = MockStreamChatClient(); - when(() => disabledClient.detachedLogger(any())).thenAnswer((invocation) { - final name = invocation.positionalArguments.first; - return _createLogger(name); - }); when(() => disabledClient.retryPolicy).thenReturn( RetryPolicy(shouldRetry: (_, __, ___) => false), ); when(() => disabledClient.state).thenReturn(FakeClientState(currentUser: currentUser)); - when(() => disabledClient.logger).thenReturn(_createLogger('mock-client-logger')); when( () => disabledClient.channelDeliveryReporter.submitForDelivery(any()), ).thenAnswer((_) async {}); @@ -5524,10 +5507,6 @@ void main() { late final client = MockStreamChatClient(); setUpAll(() { - when(() => client.detachedLogger(any())).thenAnswer((invocation) { - final name = invocation.positionalArguments.first; - return _createLogger(name); - }); when(() => client.retryPolicy).thenReturn( RetryPolicy( shouldRetry: (_, __, ___) => false, @@ -5535,7 +5514,6 @@ void main() { ), ); when(() => client.state).thenReturn(FakeClientState()); - when(() => client.logger).thenReturn(_createLogger('mock-client-logger')); when( () => client.channelDeliveryReporter.submitForDelivery(any()), ).thenAnswer((_) async {}); @@ -5695,10 +5673,6 @@ void main() { late final client = MockStreamChatClient(); setUpAll(() { - when(() => client.detachedLogger(any())).thenAnswer((invocation) { - final name = invocation.positionalArguments.first; - return _createLogger(name); - }); when(() => client.retryPolicy).thenReturn( RetryPolicy( shouldRetry: (_, __, ___) => false, @@ -5706,7 +5680,6 @@ void main() { ), ); when(() => client.state).thenReturn(FakeClientState()); - when(() => client.logger).thenReturn(_createLogger('mock-client-logger')); when( () => client.channelDeliveryReporter.submitForDelivery(any()), ).thenAnswer((_) async {}); @@ -5835,13 +5808,6 @@ void main() { registerFallbackValue(FakeMessage()); registerFallbackValue([]); - when(() => client.detachedLogger(any())).thenAnswer((invocation) { - final name = invocation.positionalArguments.first; - return _createLogger(name); - }); - - when(() => client.logger).thenReturn(_createLogger('mock-client-logger')); - final clientState = FakeClientState(); when(() => client.state).thenReturn(clientState); @@ -6233,10 +6199,4 @@ ChannelState _generateChannelState( return ChannelState(channel: channel); } -Logger _createLogger(String name) { - final logger = Logger.detached(name)..level = Level.ALL; - logger.onRecord.listen(print); - return logger; -} - // endregion diff --git a/packages/stream_chat/test/src/client/channel/channel_event_handler_test.dart b/packages/stream_chat/test/src/client/channel/channel_event_handler_test.dart index 7247d46aae..6feebc9f2d 100644 --- a/packages/stream_chat/test/src/client/channel/channel_event_handler_test.dart +++ b/packages/stream_chat/test/src/client/channel/channel_event_handler_test.dart @@ -39,7 +39,7 @@ void main() { late MockStreamChatClient client; late MockChannelStateMutations mutations; late ChannelEventHandler handler; - late List logRecords; + late List logRecords; // Matches the default current user of [FakeClientState]. const currentUserId = 'test-user-id'; @@ -70,12 +70,13 @@ void main() { client = MockStreamChatClient(); mutations = MockChannelStateMutations(); + // A `StreamLogger` writes to the global handler rather than to a stream of + // its own, so what the handler reports is observed through that handler. logRecords = []; - final logger = Logger.detached('mock-client-logger')..level = Level.ALL; - logger.onRecord.listen(logRecords.add); + StreamLogger.handler = _CapturingHandler(logRecords.add); + StreamLogger.priority = StreamLogPriority.verbose; when(() => channel.client).thenReturn(client); - when(() => client.logger).thenReturn(logger); when(() => client.state).thenReturn(FakeClientState()); when(() => client.channelDeliveryReporter.reconcileDelivery(any())).thenAnswer((_) async {}); @@ -90,6 +91,8 @@ void main() { handler = ChannelEventHandler(channel: channel, mutations: mutations); }); + tearDown(StreamLogger.reset); + group('dispatch', () { test('does nothing for an unknown event without payloads', () { handler.handleEvent(Event(type: 'unknown.event')); @@ -970,7 +973,7 @@ void main() { ); expect(logRecords, hasLength(1)); - expect(logRecords.single.level, Level.WARNING); + expect(logRecords.single.priority, StreamLogPriority.warning); expect(logRecords.single.message, contains(EventType.memberAdded)); expect(logRecords.single.error, isA()); }); @@ -989,3 +992,12 @@ void main() { }); }); } + +class _CapturingHandler extends StreamLogHandler { + const _CapturingHandler(this._onRecord); + + final void Function(StreamLogRecord) _onRecord; + + @override + void handle(StreamLogRecord record) => _onRecord(record); +} diff --git a/packages/stream_chat/test/src/client/channel/channel_read_helper_test.dart b/packages/stream_chat/test/src/client/channel/channel_read_helper_test.dart index ecda0d62d5..4d427345f8 100644 --- a/packages/stream_chat/test/src/client/channel/channel_read_helper_test.dart +++ b/packages/stream_chat/test/src/client/channel/channel_read_helper_test.dart @@ -15,12 +15,6 @@ void main() { final distantPast = DateTime.fromMillisecondsSinceEpoch(0, isUtc: true); setUpAll(() { - // detached loggers - when(() => client.detachedLogger(any())).thenAnswer((invocation) { - final name = invocation.positionalArguments.first; - return _createLogger(name); - }); - final retryPolicy = RetryPolicy( shouldRetry: (_, __, ___) => false, delayFactor: Duration.zero, @@ -32,7 +26,6 @@ void main() { when(() => client.state).thenReturn(clientState); // client logger - when(() => client.logger).thenReturn(_createLogger('mock-client-logger')); }); test('userReadOf should return read for specific user', () { @@ -310,10 +303,4 @@ ChannelState _generateChannelState( return ChannelState(channel: channel); } -Logger _createLogger(String name) { - final logger = Logger.detached(name)..level = Level.ALL; - logger.onRecord.listen(print); - return logger; -} - // endregion diff --git a/packages/stream_chat/test/src/client/channel/channel_state_mutations_test.dart b/packages/stream_chat/test/src/client/channel/channel_state_mutations_test.dart index 7b279af40e..a73b7fe8a2 100644 --- a/packages/stream_chat/test/src/client/channel/channel_state_mutations_test.dart +++ b/packages/stream_chat/test/src/client/channel/channel_state_mutations_test.dart @@ -36,7 +36,6 @@ void main() { client = MockStreamChatClient(); state = MockChannelClientState(); - when(() => client.logger).thenReturn(MockLogger()); when(() => client.state).thenReturn(FakeClientState()); // A real channel (without an attached state) so that the capability and diff --git a/packages/stream_chat/test/src/client/channel/channel_test.dart b/packages/stream_chat/test/src/client/channel/channel_test.dart index d7f3b27a86..836b10a589 100644 --- a/packages/stream_chat/test/src/client/channel/channel_test.dart +++ b/packages/stream_chat/test/src/client/channel/channel_test.dart @@ -7,6 +7,7 @@ import 'package:test/test.dart'; import '../../fakes.dart'; import '../../matchers.dart'; import '../../mocks.dart'; +import '../../utils.dart'; void main() { ChannelState _generateChannelState( @@ -33,12 +34,6 @@ void main() { return state; } - Logger _createLogger(String name) { - final logger = Logger.detached(name)..level = Level.ALL; - logger.onRecord.listen(print); - return logger; - } - group('Non-Initialized Channel', () { late final client = MockStreamChatClient(); const channelId = 'test-channel-id'; @@ -46,15 +41,6 @@ void main() { late Channel channel; setUpAll(() { - // detached loggers - when(() => client.detachedLogger(any())).thenAnswer((invocation) { - final name = invocation.positionalArguments.first; - return _createLogger(name); - }); - - // client logger - when(() => client.logger).thenReturn(_createLogger('mock-client-logger')); - // fake clientState final clientState = FakeClientState(); when(() => client.state).thenReturn(clientState); @@ -127,19 +113,19 @@ void main() { membersPagination: any(named: 'membersPagination'), watchersPagination: any(named: 'watchersPagination'), ), - ).thenThrow(StreamChatNetworkError(ChatErrorCode.inputError)); + ).thenThrow(apiException(code: StreamErrorCode.inputError, statusCode: 400)); // A failed watch() also completes `initialized` with the error. Attach // the expectation up-front so that error has a listener the moment it // occurs and isn't reported as an unhandled async error. final initializedFailure = expectLater( channel.initialized, - throwsA(isA()), + throwsA(isA()), ); await expectLater( channel.watch(), - throwsA(isA()), + throwsA(isA()), ); await initializedFailure; @@ -164,12 +150,6 @@ void main() { registerFallbackValue([]); registerFallbackValue(FakeAttachmentFile()); - // detached loggers - when(() => client.detachedLogger(any())).thenAnswer((invocation) { - final name = invocation.positionalArguments.first; - return _createLogger(name); - }); - final retryPolicy = RetryPolicy( shouldRetry: (_, __, ___) => false, delayFactor: Duration.zero, @@ -186,9 +166,6 @@ void main() { final channelState = _generateChannelState(channelId, channelType); when(() => client.chatPersistenceClient.getChannelStateByCid(channelCid)).thenAnswer((_) async => channelState); when(() => client.chatPersistenceClient.updateMessages(channelCid, any())).thenAnswer((_) => Future.value()); - - // client logger - when(() => client.logger).thenReturn(_createLogger('mock-client-logger')); }); // Setting up a initialized channel @@ -215,12 +192,6 @@ void main() { registerFallbackValue(FakeAttachmentFile()); registerFallbackValue(FakeEvent()); - // detached loggers - when(() => client.detachedLogger(any())).thenAnswer((invocation) { - final name = invocation.positionalArguments.first; - return _createLogger(name); - }); - final retryPolicy = RetryPolicy( shouldRetry: (_, __, ___) => false, delayFactor: Duration.zero, @@ -231,9 +202,6 @@ void main() { final clientState = FakeClientState(); when(() => client.state).thenReturn(clientState); - // client logger - when(() => client.logger).thenReturn(_createLogger('mock-client-logger')); - // mock channel delivery reporter when( () => client.channelDeliveryReporter.submitForDelivery(any()), @@ -332,7 +300,7 @@ void main() { }); test( - 'should handle StreamChatNetworkError by adding message to retry queue with skipPush: true, skipEnrichUrl: false', + 'should mark the message failed when the server refuses it with skipPush: true, skipEnrichUrl: false', () async { final message = Message( id: 'test-message-id', @@ -347,7 +315,7 @@ void main() { channelType, skipPush: true, ), - ).thenThrow(StreamChatNetworkError(ChatErrorCode.notAllowed)); + ).thenThrow(apiException(code: StreamErrorCode.notAllowed, statusCode: 403)); expectLater( // skipping first seed message list -> [] messages @@ -379,16 +347,16 @@ void main() { skipPush: true, ); } catch (e) { - expect(e, isA()); + expect(e, isA()); - final networkError = e as StreamChatNetworkError; - expect(networkError.code, equals(ChatErrorCode.notAllowed.code)); + final networkError = e as StreamApiException; + expect(networkError.code, equals(StreamErrorCode.notAllowed)); } }, ); test( - 'should handle StreamChatNetworkError by adding message to retry queue with skipPush: true, skipEnrichUrl: true', + 'should mark the message failed when the server refuses it with skipPush: true, skipEnrichUrl: true', () async { final message = Message( id: 'test-message-id-2', @@ -404,7 +372,7 @@ void main() { skipPush: true, skipEnrichUrl: true, ), - ).thenThrow(StreamChatNetworkError(ChatErrorCode.notAllowed)); + ).thenThrow(apiException(code: StreamErrorCode.notAllowed, statusCode: 403)); expectLater( // skipping first seed message list -> [] messages @@ -437,16 +405,16 @@ void main() { skipEnrichUrl: true, ); } catch (e) { - expect(e, isA()); + expect(e, isA()); - final networkError = e as StreamChatNetworkError; - expect(networkError.code, equals(ChatErrorCode.notAllowed.code)); + final networkError = e as StreamApiException; + expect(networkError.code, equals(StreamErrorCode.notAllowed)); } }, ); test( - 'should handle StreamChatNetworkError by adding message to retry queue with skipPush: false, skipEnrichUrl: true', + 'should mark the message failed when the server refuses it with skipPush: false, skipEnrichUrl: true', () async { final message = Message( id: 'test-message-id-3', @@ -461,7 +429,7 @@ void main() { channelType, skipEnrichUrl: true, ), - ).thenThrow(StreamChatNetworkError(ChatErrorCode.notAllowed)); + ).thenThrow(apiException(code: StreamErrorCode.notAllowed, statusCode: 403)); expectLater( // skipping first seed message list -> [] messages @@ -493,16 +461,16 @@ void main() { skipEnrichUrl: true, ); } catch (e) { - expect(e, isA()); + expect(e, isA()); - final networkError = e as StreamChatNetworkError; - expect(networkError.code, equals(ChatErrorCode.notAllowed.code)); + final networkError = e as StreamApiException; + expect(networkError.code, equals(StreamErrorCode.notAllowed)); } }, ); test( - 'should handle StreamChatNetworkError by adding message to retry queue with skipPush: false, skipEnrichUrl: false', + 'should mark the message failed when the server refuses it with skipPush: false, skipEnrichUrl: false', () async { final message = Message( id: 'test-message-id-4', @@ -516,7 +484,7 @@ void main() { channelId, channelType, ), - ).thenThrow(StreamChatNetworkError(ChatErrorCode.notAllowed)); + ).thenThrow(apiException(code: StreamErrorCode.notAllowed, statusCode: 403)); expectLater( // skipping first seed message list -> [] messages @@ -547,14 +515,69 @@ void main() { message, ); } catch (e) { - expect(e, isA()); + expect(e, isA()); - final networkError = e as StreamChatNetworkError; - expect(networkError.code, equals(ChatErrorCode.notAllowed.code)); + final networkError = e as StreamApiException; + expect(networkError.code, equals(StreamErrorCode.notAllowed)); } }, ); + test('should re-send the message through the retry queue when the failure is retriable', () async { + final message = Message( + id: 'test-message-id', + text: 'Hello world!', + user: client.state.currentUser, + ); + + when( + () => client.sendMessage( + any(that: isSameMessageAs(message)), + channelId, + channelType, + ), + ).thenThrow(apiException(code: StreamErrorCode.internalError, statusCode: 500)); + + await expectLater(channel.sendMessage(message), throwsA(isA())); + await pumpEventQueue(); + + // Once for the original send, once for the queue's retry attempt. + verify( + () => client.sendMessage( + any(that: isSameMessageAs(message)), + channelId, + channelType, + ), + ).called(2); + }); + + test('should not re-send the message when the failure is not retriable', () async { + final message = Message( + id: 'test-message-id', + text: 'Hello world!', + user: client.state.currentUser, + ); + + when( + () => client.sendMessage( + any(that: isSameMessageAs(message)), + channelId, + channelType, + ), + ).thenThrow(apiException(code: StreamErrorCode.inputError, statusCode: 400)); + + await expectLater(channel.sendMessage(message), throwsA(isA())); + await pumpEventQueue(); + + verify( + () => client.sendMessage( + any(that: isSameMessageAs(message)), + channelId, + channelType, + ), + ).called(1); + }); + test('should update message state even when non-retriable error occurs', () async { final message = Message( id: 'test-message-id', @@ -569,14 +592,7 @@ void main() { channelType, ), ).thenThrow( - StreamChatNetworkError.raw( - code: ChatErrorCode.inputError.code, - message: 'Input error', - data: ErrorResponse() - ..code = ChatErrorCode.inputError.code - ..message = 'Input error' - ..statusCode = 400, - ), + apiException(code: StreamErrorCode.inputError, statusCode: 400, message: 'Input error'), ); expectLater( @@ -606,7 +622,7 @@ void main() { try { await channel.sendMessage(message); } catch (e) { - expect(e, isA()); + expect(e, isA()); } }); @@ -823,11 +839,7 @@ void main() { extraData: any(named: 'extraData'), ), ).thenAnswer( - (_) async => throw StreamChatNetworkError.raw( - code: 0, - message: 'Request cancelled', - type: StreamChatNetworkErrorType.cancel, - ), + (_) async => throw const StreamNetworkException(message: 'Request cancelled', isCancelled: true), ); expect( @@ -877,11 +889,7 @@ void main() { extraData: any(named: 'extraData'), ), ).thenAnswer( - (_) async => throw StreamChatNetworkError.raw( - code: 0, - message: 'Request cancelled', - type: StreamChatNetworkErrorType.cancel, - ), + (_) async => throw const StreamNetworkException(message: 'Request cancelled', isCancelled: true), ); when( @@ -954,11 +962,7 @@ void main() { extraData: any(named: 'extraData'), ), ).thenAnswer( - (_) async => throw StreamChatNetworkError.raw( - code: 0, - message: 'Request cancelled', - type: StreamChatNetworkErrorType.cancel, - ), + (_) async => throw const StreamNetworkException(message: 'Request cancelled', isCancelled: true), ); when( @@ -1026,11 +1030,7 @@ void main() { extraData: any(named: 'extraData'), ), ).thenAnswer( - (_) async => throw StreamChatNetworkError.raw( - code: 0, - message: 'Request cancelled', - type: StreamChatNetworkErrorType.cancel, - ), + (_) async => throw const StreamNetworkException(message: 'Request cancelled', isCancelled: true), ); when( @@ -1634,7 +1634,7 @@ void main() { ).called(1); }); - test('should update message state even when error is not StreamChatNetworkError', () async { + test('should update message state even when the error is not a StreamChatException', () async { final message = Message( id: 'test-message-id-error-1', state: MessageState.sent, @@ -1679,7 +1679,7 @@ void main() { }); test( - 'should add message to retry queue when retriable StreamChatNetworkError occurs with skipPush: false, skipEnrichUrl: true', + 'should mark the message failed and report the failure as retriable with skipPush: false, skipEnrichUrl: true', () async { final message = Message( id: 'test-message-id-retry-1', @@ -1693,10 +1693,7 @@ void main() { skipEnrichUrl: true, ), ).thenThrow( - StreamChatNetworkError.raw( - code: ChatErrorCode.requestTimeout.code, - message: 'Request timed out', - ), + apiException(code: StreamErrorCode.requestTimeout, statusCode: 408, message: 'Request timed out'), ); expectLater( @@ -1726,17 +1723,17 @@ void main() { try { await channel.updateMessage(message, skipEnrichUrl: true); } catch (e) { - expect(e, isA()); + expect(e, isA()); - final networkError = e as StreamChatNetworkError; - expect(networkError.code, equals(ChatErrorCode.requestTimeout.code)); + final networkError = e as StreamApiException; + expect(networkError.code, equals(StreamErrorCode.requestTimeout)); expect(networkError.isRetriable, isTrue); } }, ); test( - 'should add message to retry queue when retriable StreamChatNetworkError occurs with skipPush: true, skipEnrichUrl: false', + 'should mark the message failed and report the failure as retriable with skipPush: true, skipEnrichUrl: false', () async { final message = Message( id: 'test-message-id-retry-2', @@ -1750,10 +1747,7 @@ void main() { skipPush: true, ), ).thenThrow( - StreamChatNetworkError.raw( - code: ChatErrorCode.internalSystemError.code, - message: 'Internal system error', - ), + apiException(code: StreamErrorCode.internalError, statusCode: 500, message: 'Internal system error'), ); expectLater( @@ -1783,16 +1777,16 @@ void main() { try { await channel.updateMessage(message, skipPush: true); } catch (e) { - expect(e, isA()); + expect(e, isA()); - final networkError = e as StreamChatNetworkError; - expect(networkError.code, equals(ChatErrorCode.internalSystemError.code)); + final networkError = e as StreamApiException; + expect(networkError.code, equals(StreamErrorCode.internalError)); expect(networkError.isRetriable, isTrue); } }, ); - test('should handle non-retriable StreamChatNetworkError with skipPush: true, skipEnrichUrl: true', () async { + test('should handle a non-retriable failure with skipPush: true, skipEnrichUrl: true', () async { final message = Message( id: 'test-message-id-error-2', state: MessageState.sent, @@ -1804,7 +1798,7 @@ void main() { skipPush: true, skipEnrichUrl: true, ), - ).thenThrow(StreamChatNetworkError(ChatErrorCode.notAllowed)); + ).thenThrow(apiException(code: StreamErrorCode.notAllowed, statusCode: 403)); expectLater( // skipping first seed message list -> [] messages @@ -1837,14 +1831,14 @@ void main() { skipEnrichUrl: true, ); } catch (e) { - expect(e, isA()); + expect(e, isA()); - final networkError = e as StreamChatNetworkError; - expect(networkError.code, equals(ChatErrorCode.notAllowed.code)); + final networkError = e as StreamApiException; + expect(networkError.code, equals(StreamErrorCode.notAllowed)); } }); - test('should handle non-retriable StreamChatNetworkError with skipPush: false, skipEnrichUrl: false', () async { + test('should handle a non-retriable failure with skipPush: false, skipEnrichUrl: false', () async { final message = Message( id: 'test-message-id-error-3', state: MessageState.sent, @@ -1854,7 +1848,7 @@ void main() { () => client.updateMessage( any(that: isSameMessageAs(message)), ), - ).thenThrow(StreamChatNetworkError(ChatErrorCode.notAllowed)); + ).thenThrow(apiException(code: StreamErrorCode.notAllowed, statusCode: 403)); expectLater( // skipping first seed message list -> [] messages @@ -1883,10 +1877,10 @@ void main() { try { await channel.updateMessage(message); } catch (e) { - expect(e, isA()); + expect(e, isA()); - final networkError = e as StreamChatNetworkError; - expect(networkError.code, equals(ChatErrorCode.notAllowed.code)); + final networkError = e as StreamApiException; + expect(networkError.code, equals(StreamErrorCode.notAllowed)); } }); }); @@ -2004,7 +1998,7 @@ void main() { }); group('`.partialUpdateMessage` error handling', () { - test('should update message state even when error is not StreamChatNetworkError', () async { + test('should update message state even when the error is not a StreamChatException', () async { final message = Message( id: 'test-message-id-error-partial-1', state: MessageState.sent, @@ -2065,7 +2059,7 @@ void main() { }); test( - 'should add message to retry queue when retriable StreamChatNetworkError occurs with skipEnrichUrl: true', + 'should mark the message failed and report the failure as retriable with skipEnrichUrl: true', () async { final message = Message( id: 'test-message-id-retry-partial-1', @@ -2087,10 +2081,7 @@ void main() { skipEnrichUrl: true, ), ).thenThrow( - StreamChatNetworkError.raw( - code: ChatErrorCode.requestTimeout.code, - message: 'Request timed out', - ), + apiException(code: StreamErrorCode.requestTimeout, statusCode: 408, message: 'Request timed out'), ); expectLater( @@ -2130,17 +2121,17 @@ void main() { skipEnrichUrl: true, ); } catch (e) { - expect(e, isA()); + expect(e, isA()); - final networkError = e as StreamChatNetworkError; - expect(networkError.code, equals(ChatErrorCode.requestTimeout.code)); + final networkError = e as StreamApiException; + expect(networkError.code, equals(StreamErrorCode.requestTimeout)); expect(networkError.isRetriable, isTrue); } }, ); test( - 'should add message to retry queue when retriable StreamChatNetworkError occurs with skipEnrichUrl: false', + 'should mark the message failed and report the failure as retriable with skipEnrichUrl: false', () async { final message = Message( id: 'test-message-id-retry-partial-2', @@ -2161,10 +2152,7 @@ void main() { unset: unset, ), ).thenThrow( - StreamChatNetworkError.raw( - code: ChatErrorCode.internalSystemError.code, - message: 'Internal system error', - ), + apiException(code: StreamErrorCode.internalError, statusCode: 500, message: 'Internal system error'), ); expectLater( @@ -2203,16 +2191,16 @@ void main() { unset: unset, ); } catch (e) { - expect(e, isA()); + expect(e, isA()); - final networkError = e as StreamChatNetworkError; - expect(networkError.code, equals(ChatErrorCode.internalSystemError.code)); + final networkError = e as StreamApiException; + expect(networkError.code, equals(StreamErrorCode.internalError)); expect(networkError.isRetriable, isTrue); } }, ); - test('should handle non-retriable StreamChatNetworkError with skipEnrichUrl: true', () async { + test('should handle a non-retriable failure with skipEnrichUrl: true', () async { final message = Message( id: 'test-message-id-error-partial-2', state: MessageState.sent, @@ -2231,7 +2219,7 @@ void main() { unset: unset, skipEnrichUrl: true, ), - ).thenThrow(StreamChatNetworkError(ChatErrorCode.notAllowed)); + ).thenThrow(apiException(code: StreamErrorCode.notAllowed, statusCode: 403)); expectLater( // skipping first seed message list -> [] messages @@ -2270,14 +2258,14 @@ void main() { skipEnrichUrl: true, ); } catch (e) { - expect(e, isA()); + expect(e, isA()); - final networkError = e as StreamChatNetworkError; - expect(networkError.code, equals(ChatErrorCode.notAllowed.code)); + final networkError = e as StreamApiException; + expect(networkError.code, equals(StreamErrorCode.notAllowed)); } }); - test('should handle non-retriable StreamChatNetworkError with skipEnrichUrl: false', () async { + test('should handle a non-retriable failure with skipEnrichUrl: false', () async { final message = Message( id: 'test-message-id-error-partial-3', state: MessageState.sent, @@ -2295,7 +2283,7 @@ void main() { set: set, unset: unset, ), - ).thenThrow(StreamChatNetworkError(ChatErrorCode.notAllowed)); + ).thenThrow(apiException(code: StreamErrorCode.notAllowed, statusCode: 403)); expectLater( // skipping first seed message list -> [] messages @@ -2333,10 +2321,10 @@ void main() { unset: unset, ); } catch (e) { - expect(e, isA()); + expect(e, isA()); - final networkError = e as StreamChatNetworkError; - expect(networkError.code, equals(ChatErrorCode.notAllowed.code)); + final networkError = e as StreamApiException; + expect(networkError.code, equals(StreamErrorCode.notAllowed)); } }); }); @@ -2981,7 +2969,7 @@ void main() { when( () => client.sendReaction(message.id, reaction), - ).thenThrow(StreamChatNetworkError(ChatErrorCode.inputError)); + ).thenThrow(apiException(code: StreamErrorCode.inputError, statusCode: 400)); expectLater( // skipping first seed message list -> [] messages @@ -3017,7 +3005,7 @@ void main() { try { await channel.sendReaction(message, reaction); } catch (e) { - expect(e, isA()); + expect(e, isA()); } verify(() => client.sendReaction(message.id, reaction)).called(1); @@ -3185,7 +3173,7 @@ void main() { when( () => client.sendReaction(message.id, reaction), - ).thenThrow(StreamChatNetworkError(ChatErrorCode.inputError)); + ).thenThrow(apiException(code: StreamErrorCode.inputError, statusCode: 400)); expectLater( // skipping first seed message list -> [] messages @@ -3223,7 +3211,7 @@ void main() { try { await channel.sendReaction(message, reaction); } catch (e) { - expect(e, isA()); + expect(e, isA()); } verify(() => client.sendReaction(message.id, reaction)).called(1); @@ -3392,7 +3380,7 @@ void main() { when( () => client.deleteReaction(messageId, type), - ).thenThrow(StreamChatNetworkError(ChatErrorCode.inputError)); + ).thenThrow(apiException(code: StreamErrorCode.inputError, statusCode: 400)); expectLater( // skipping first seed message list -> [] messages @@ -3422,7 +3410,7 @@ void main() { try { await channel.deleteReaction(message, reaction); } catch (e) { - expect(e, isA()); + expect(e, isA()); } verify(() => client.deleteReaction(messageId, type)).called(1); @@ -3518,7 +3506,7 @@ void main() { when( () => client.deleteReaction(messageId, type), - ).thenThrow(StreamChatNetworkError(ChatErrorCode.inputError)); + ).thenThrow(apiException(code: StreamErrorCode.inputError, statusCode: 400)); expectLater( // skipping first seed message list -> [] messages @@ -3550,7 +3538,7 @@ void main() { try { await channel.deleteReaction(message, reaction); } catch (e) { - expect(e, isA()); + expect(e, isA()); } verify(() => client.deleteReaction(messageId, type)).called(1); @@ -4006,7 +3994,7 @@ void main() { ), ).thenAnswer((_) async { if (++attempts == 1) { - throw StreamChatNetworkError(ChatErrorCode.inputError); + throw apiException(code: StreamErrorCode.inputError, statusCode: 400); } return _generateChannelState(channelId, channelType); }); @@ -4015,11 +4003,11 @@ void main() { // Attach the expectation before watch() so the error is handled. final firstInit = expectLater( freshChannel.initialized, - throwsA(isA()), + throwsA(isA()), ); await expectLater( freshChannel.watch(), - throwsA(isA()), + throwsA(isA()), ); await firstInit; expect(freshChannel.state, isNull); @@ -4042,12 +4030,12 @@ void main() { membersPagination: any(named: 'membersPagination'), watchersPagination: any(named: 'watchersPagination'), ), - ).thenThrow(StreamChatNetworkError(ChatErrorCode.inputError)); + ).thenThrow(apiException(code: StreamErrorCode.inputError, statusCode: 400)); try { await channel.watch(); } catch (e) { - expect(e, isA()); + expect(e, isA()); } verify( @@ -4240,12 +4228,12 @@ void main() { membersPagination: any(named: 'membersPagination'), watchersPagination: any(named: 'watchersPagination'), ), - ).thenThrow(StreamChatNetworkError(ChatErrorCode.inputError)); + ).thenThrow(apiException(code: StreamErrorCode.inputError, statusCode: 400)); try { await channel.query(); } catch (e) { - expect(e, isA()); + expect(e, isA()); } verify( @@ -4953,12 +4941,6 @@ void main() { const channelType = 'test-channel-type'; setUpAll(() { - // detached loggers - when(() => client.detachedLogger(any())).thenAnswer((invocation) { - final name = invocation.positionalArguments.first; - return _createLogger(name); - }); - final retryPolicy = RetryPolicy( shouldRetry: (_, __, ___) => false, delayFactor: Duration.zero, @@ -4969,9 +4951,6 @@ void main() { final clientState = FakeClientState(); when(() => client.state).thenReturn(clientState); - // client logger - when(() => client.logger).thenReturn(_createLogger('mock-client-logger')); - // mock channel delivery reporter when( () => client.channelDeliveryReporter.submitForDelivery(any()), @@ -5671,12 +5650,6 @@ void main() { const channelType = 'test-channel-type'; setUpAll(() { - // detached loggers - when(() => client.detachedLogger(any())).thenAnswer((invocation) { - final name = invocation.positionalArguments.first; - return _createLogger(name); - }); - final retryPolicy = RetryPolicy( shouldRetry: (_, __, ___) => false, delayFactor: Duration.zero, @@ -5686,9 +5659,6 @@ void main() { // fake clientState final clientState = FakeClientState(); when(() => client.state).thenReturn(clientState); - - // client logger - when(() => client.logger).thenReturn(_createLogger('mock-client-logger')); }); test('should return filterTags from channel state', () { @@ -5741,12 +5711,6 @@ void main() { registerFallbackValue(FakeAttachmentFile()); registerFallbackValue(FakeEvent()); - // detached loggers - when(() => client.detachedLogger(any())).thenAnswer((invocation) { - final name = invocation.positionalArguments.first; - return _createLogger(name); - }); - final retryPolicy = RetryPolicy( shouldRetry: (_, __, ___) => false, delayFactor: Duration.zero, @@ -5756,9 +5720,6 @@ void main() { // fake clientState final clientState = FakeClientState(); when(() => client.state).thenReturn(clientState); - - // client logger - when(() => client.logger).thenReturn(_createLogger('mock-client-logger')); }); test( @@ -6064,12 +6025,6 @@ void main() { late final client = MockStreamChatClient(); setUpAll(() { - // detached loggers - when(() => client.detachedLogger(any())).thenAnswer((invocation) { - final name = invocation.positionalArguments.first; - return _createLogger(name); - }); - final retryPolicy = RetryPolicy( shouldRetry: (_, __, ___) => false, delayFactor: Duration.zero, @@ -6079,9 +6034,6 @@ void main() { // fake clientState final clientState = FakeClientState(); when(() => client.state).thenReturn(clientState); - - // client logger - when(() => client.logger).thenReturn(_createLogger('mock-client-logger')); }); test( @@ -6370,20 +6322,11 @@ void main() { registerFallbackValue([]); registerFallbackValue(FakeAttachmentFile()); - when(() => client.detachedLogger(any())).thenAnswer((invocation) { - final name = invocation.positionalArguments.first; - return _createLogger(name); - }); - - when(() => client.logger).thenReturn(_createLogger('mock-client-logger')); - final clientState = FakeClientState(); when(() => client.state).thenReturn(clientState); final retryPolicy = RetryPolicy( - shouldRetry: (_, __, error) { - return error is StreamChatNetworkError && error.isRetriable; - }, + shouldRetry: (_, __, error) => error?.isRetriable ?? false, ); when(() => client.retryPolicy).thenReturn(retryPolicy); }); diff --git a/packages/stream_chat/test/src/client/channel_delivery_reporter_test.dart b/packages/stream_chat/test/src/client/channel_delivery_reporter_test.dart index 7f0a529f3e..3b83e62658 100644 --- a/packages/stream_chat/test/src/client/channel_delivery_reporter_test.dart +++ b/packages/stream_chat/test/src/client/channel_delivery_reporter_test.dart @@ -509,12 +509,6 @@ void main() { // region Test Helpers -Logger _createLogger(String name) { - final logger = Logger.detached(name)..level = Level.ALL; - logger.onRecord.listen(print); - return logger; -} - StreamChatClient _createMockClient() { final client = MockStreamChatClient(); final clientState = FakeClientState( @@ -522,10 +516,6 @@ StreamChatClient _createMockClient() { ); when(() => client.state).thenReturn(clientState); - when(() => client.detachedLogger(any())).thenAnswer((invocation) { - return _createLogger(invocation.positionalArguments.first as String); - }); - when(() => client.logger).thenReturn(_createLogger('mock-client-logger')); when(() => client.retryPolicy).thenReturn( RetryPolicy(shouldRetry: (_, __, ___) => false), ); diff --git a/packages/stream_chat/test/src/client/client_test.dart b/packages/stream_chat/test/src/client/client_test.dart index d5dc7a52f6..7799e16803 100644 --- a/packages/stream_chat/test/src/client/client_test.dart +++ b/packages/stream_chat/test/src/client/client_test.dart @@ -3,7 +3,6 @@ import 'dart:async'; import 'package:mocktail/mocktail.dart'; -import 'package:stream_chat/src/core/http/token.dart'; import 'package:stream_chat/stream_chat.dart'; import 'package:test/test.dart'; @@ -35,7 +34,7 @@ void main() { test('`.connectUser` should work fine', () async { final user = User(id: 'test-user-id'); - final token = Token.development(user.id).rawValue; + final token = testUserToken(user.id).rawValue; expectLater( // skipping first seed status -> ConnectionStatus.disconnected @@ -53,9 +52,9 @@ void main() { test('`.connectUserWithProvider` should work fine', () async { final user = User(id: 'test-user-id'); - Future tokenProvider(String userId) async { + Future tokenProvider(String userId) async { expect(userId, user.id); - return Token.development(userId).rawValue; + return testUserToken(userId); } expectLater( @@ -67,7 +66,7 @@ void main() { ]), ); - final res = await client.connectUserWithProvider(user, tokenProvider); + final res = await client.connectUserWithProvider(user, TokenProvider.dynamic(tokenProvider)); expect(res, isNotNull); expect(res, isSameUserAs(user)); }); @@ -75,7 +74,7 @@ void main() { group('`.connectGuestUser`', () { test('should work fine', () async { final user = User(id: 'test-user-id'); - final token = Token.development(user.id).rawValue; + final token = testUserToken(user.id).rawValue; when(() => api.guest.getGuestUser(any(that: isSameUserAs(user)))).thenAnswer( (_) async => ConnectGuestUserResponse() @@ -106,7 +105,7 @@ void main() { when( () => api.guest.getGuestUser(any(that: isSameUserAs(user))), - ).thenThrow(StreamChatNetworkError(ChatErrorCode.inputError)); + ).thenThrow(apiException(code: StreamErrorCode.inputError, statusCode: 400)); expectLater( client.wsConnectionStatusStream, @@ -120,7 +119,7 @@ void main() { try { await client.connectGuestUser(user); } catch (e) { - expect(e, isA()); + expect(e, isA()); } verify( @@ -219,7 +218,7 @@ void main() { test('`.connectUser` should throw if `ws.connect` fails', () async { final user = User(id: 'test-user-id'); - final token = Token.development(user.id).rawValue; + final token = testUserToken(user.id).rawValue; try { await client.connectUser(user, token); @@ -232,13 +231,13 @@ void main() { '`.connectUserWithProvider` should throw if `ws.connect` fails', () async { final user = User(id: 'test-user-id'); - Future tokenProvider(String userId) async { + Future tokenProvider(String userId) async { expect(userId, user.id); - return Token.development(userId).rawValue; + return testUserToken(userId); } try { - await client.connectUserWithProvider(user, tokenProvider); + await client.connectUserWithProvider(user, TokenProvider.dynamic(tokenProvider)); } catch (e) { expect(e, isA()); } @@ -247,7 +246,7 @@ void main() { test('`.connectGuestUser` should throw if `ws.connect` fails', () async { final user = User(id: 'test-user-id'); - final token = Token.development(user.id).rawValue; + final token = testUserToken(user.id).rawValue; when(() => api.guest.getGuestUser(any(that: isSameUserAs(user)))).thenAnswer( (_) async => ConnectGuestUserResponse() @@ -298,7 +297,7 @@ void main() { test('`.connectUser` should succeed without connecting', () async { final user = User(id: 'test-user-id'); - final token = Token.development(user.id).rawValue; + final token = testUserToken(user.id).rawValue; final res = await client.connectUser( user, @@ -313,14 +312,14 @@ void main() { '`.connectUserWithProvider` should succeed without connecting', () async { final user = User(id: 'test-user-id'); - Future tokenProvider(String userId) async { + Future tokenProvider(String userId) async { expect(userId, user.id); - return Token.development(userId).rawValue; + return testUserToken(userId); } final res = await client.connectUserWithProvider( user, - tokenProvider, + TokenProvider.dynamic(tokenProvider), connectWebSocket: false, ); expect(res, isSameUserAs(user)); @@ -330,7 +329,7 @@ void main() { test('`.connectGuestUser` should succeed without connecting', () async { final user = User(id: 'test-user-id'); - final token = Token.development(user.id).rawValue; + final token = testUserToken(user.id).rawValue; when(() => api.guest.getGuestUser(any(that: isSameUserAs(user)))).thenAnswer( (_) async => ConnectGuestUserResponse() @@ -388,7 +387,7 @@ void main() { '''`.connectUser` should connect successfully if persistence contains event''', () async { final user = User(id: 'test-user-id'); - final token = Token.development(user.id).rawValue; + final token = testUserToken(user.id).rawValue; final event = Event( type: EventType.healthCheck, @@ -410,9 +409,9 @@ void main() { '''`.connectUserWithProvider` should connect successfully if persistence contains event''', () async { final user = User(id: 'test-user-id'); - Future tokenProvider(String userId) async { + Future tokenProvider(String userId) async { expect(userId, user.id); - return Token.development(userId).rawValue; + return testUserToken(userId); } final event = Event( @@ -422,7 +421,7 @@ void main() { ); when(persistence.getConnectionInfo).thenAnswer((_) async => event); - final res = await client.connectUserWithProvider(user, tokenProvider); + final res = await client.connectUserWithProvider(user, TokenProvider.dynamic(tokenProvider)); expect(res, isNotNull); expect(res, isSameUserAs(user)); @@ -435,7 +434,7 @@ void main() { '''`.connectGuestUser` should connect successfully if persistence contains event''', () async { final user = User(id: 'test-user-id'); - final token = Token.development(user.id).rawValue; + final token = testUserToken(user.id).rawValue; final event = Event( type: EventType.healthCheck, @@ -489,7 +488,7 @@ void main() { late final persistence = MockPersistenceClient(); final user = User(id: 'test-user-id'); - final token = Token.development(user.id).rawValue; + final token = testUserToken(user.id).rawValue; late StreamChatClient client; @@ -764,7 +763,7 @@ void main() { messageLimit: any(named: 'messageLimit'), paginationParams: any(named: 'paginationParams'), ), - ).thenThrow(StreamChatNetworkError(ChatErrorCode.inputError)); + ).thenThrow(apiException(code: StreamErrorCode.inputError, statusCode: 400)); when(() => persistence.getChannelThreads(any())).thenAnswer( (_) async => >{ @@ -1195,7 +1194,7 @@ void main() { late final api = FakeChatApi(); final user = User(id: userId); - final token = Token.development(user.id).rawValue; + final token = testUserToken(user.id).rawValue; late StreamChatClient client; @@ -1328,11 +1327,11 @@ void main() { messageLimit: any(named: 'messageLimit'), paginationParams: any(named: 'paginationParams'), ), - ).thenThrow(StreamChatNetworkError(ChatErrorCode.inputError)); + ).thenThrow(apiException(code: StreamErrorCode.inputError, statusCode: 400)); expectLater( client.queryChannels(), - emitsError(isA()), + emitsError(isA()), ); // Hack as `teardown` gets called even @@ -1523,7 +1522,7 @@ void main() { ), ).thenAnswer((_) async { await delay(100); - throw StreamChatNetworkError(ChatErrorCode.inputError); + throw apiException(code: StreamErrorCode.inputError, statusCode: 400); }); final errors = await Future.wait( @@ -1540,7 +1539,7 @@ void main() { // Every caller surfaces the same error type. expect(errors, hasLength(5)); for (final error in errors) { - expect(error, isA()); + expect(error, isA()); } // But only ONE HTTP request was made — the rest piggybacked. @@ -2324,16 +2323,6 @@ void main() { verifyNoMoreInteractions(api.roles); }); - test('`.devToken`', () async { - const userId = 'test-user-id'; - - final token = client.devToken(userId); - - expect(token, isNotNull); - expect(token.userId, userId); - expect(token.authType, AuthType.jwt); - }); - group('`.channel`', () { test('should return back a new channel instance', () { const channelType = 'test-channel-type'; @@ -5091,7 +5080,7 @@ void main() { late final api = FakeChatApi(); final user = User(id: 'test-user-id'); - final token = Token.development(user.id).rawValue; + final token = testUserToken(user.id).rawValue; late StreamChatClient client; @@ -5253,9 +5242,11 @@ void main() { ); client.chatPersistenceClient = fakeClient; + // What `/sync` answers when `lastSyncAt` is too old, or the channel + // list or event count is oversized. when(() => api.general.sync(cids, lastSyncAt)).thenThrow( - StreamChatNetworkError.raw( - code: 4, + apiException( + code: StreamErrorCode.inputError, statusCode: 400, message: 'Too many events', ), @@ -5273,7 +5264,7 @@ void main() { group('recoverStateOnReconnect', () { const apiKey = 'test-api-key'; final user = User(id: 'test-user-id'); - final token = Token.development(user.id).rawValue; + final token = testUserToken(user.id).rawValue; late FakeChatApi api; late FakeWebSocket ws; @@ -5497,7 +5488,7 @@ void main() { group('dispose during reconnect recovery', () { const apiKey = 'test-api-key'; final user = User(id: 'test-user-id'); - final token = Token.development(user.id).rawValue; + final token = testUserToken(user.id).rawValue; late FakeChatApi api; late FakeWebSocket ws; @@ -5579,7 +5570,7 @@ void main() { client = StreamChatClient('test-api-key', ws: ws); final user = User(id: 'test-user-id'); - final token = Token.development(user.id).rawValue; + final token = testUserToken(user.id).rawValue; await client.connectUser(user, token); await delay(300); diff --git a/packages/stream_chat/test/src/client/retry_queue_test.dart b/packages/stream_chat/test/src/client/retry_queue_test.dart index 59e2e51f47..993848ca19 100644 --- a/packages/stream_chat/test/src/client/retry_queue_test.dart +++ b/packages/stream_chat/test/src/client/retry_queue_test.dart @@ -7,30 +7,34 @@ import '../mocks.dart'; void main() { late final channel = MockRetryQueueChannel(); - late final logger = MockLogger(); late RetryQueue retryQueue; + late List records; setUpAll(() { final retryPolicy = RetryPolicy( - shouldRetry: (_, __, error) { - return error is StreamChatNetworkError && error.isRetriable; - }, + shouldRetry: (_, __, error) => error?.isRetriable ?? false, ); when(() => channel.client.retryPolicy).thenReturn(retryPolicy); }); setUp(() { - retryQueue = RetryQueue(channel: channel, logger: logger); + // The queue owns its logger, so what it reports is observed through the + // handler rather than through an injected mock. + records = []; + StreamLogger.handler = _CapturingHandler(records.add); + StreamLogger.priority = StreamLogPriority.verbose; + retryQueue = RetryQueue(channel: channel); }); tearDown(() { retryQueue.dispose(); + StreamLogger.reset(); }); group('`.add`', () { test('should return if message list is empty', () { expect(() => retryQueue.add([]), returnsNormally); - verifyNever(() => logger.info(any())); + expect(records, isEmpty); }); test('should throw if message state is not failed', () { @@ -54,7 +58,7 @@ void main() { retryQueue.add([message]); expect(() => retryQueue.add([message]), returnsNormally); // Called only for the first message - verify(() => logger.info('Adding 1 messages to the queue')).called(1); + expect(records.where((it) => it.message == 'Adding 1 messages to the queue'), hasLength(1)); }); test('`.add` should add failed request to the queue', () async { @@ -71,3 +75,12 @@ void main() { }); }); } + +class _CapturingHandler extends StreamLogHandler { + const _CapturingHandler(this._onRecord); + + final void Function(StreamLogRecord) _onRecord; + + @override + void handle(StreamLogRecord record) => _onRecord(record); +} diff --git a/packages/stream_chat/test/src/client/system_environment_test.dart b/packages/stream_chat/test/src/client/system_environment_test.dart new file mode 100644 index 0000000000..10729be07a --- /dev/null +++ b/packages/stream_chat/test/src/client/system_environment_test.dart @@ -0,0 +1,16 @@ +import 'package:stream_chat/src/client/client.dart'; +import 'package:stream_chat/src/core/platform_detector/platform_detector.dart'; +import 'package:stream_chat/version.dart'; +import 'package:test/test.dart'; + +void main() { + // The manager itself is `stream_core`'s and is covered there. What this + // package owns is the baseline it is constructed with, which is what ends up + // in the `X-Stream-Client` header on every request. + test('reports the chat SDK baseline in the default user agent', () { + expect( + StreamChatClient.defaultUserAgent, + 'stream-chat-dart-v$PACKAGE_VERSION|os=${CurrentPlatform.name}', + ); + }); +} diff --git a/packages/stream_chat/test/src/core/error/stream_chat_error_test.dart b/packages/stream_chat/test/src/core/error/stream_chat_error_test.dart index 20f302b107..195723d95c 100644 --- a/packages/stream_chat/test/src/core/error/stream_chat_error_test.dart +++ b/packages/stream_chat/test/src/core/error/stream_chat_error_test.dart @@ -1,13 +1,7 @@ -import 'package:dio/dio.dart'; import 'package:stream_chat/src/core/api/responses.dart'; import 'package:stream_chat/src/core/error/error.dart'; import 'package:test/test.dart'; -DioException _dioException(DioExceptionType type) => DioException( - requestOptions: RequestOptions(path: 'test-path'), - type: type, -); - void main() { group('StreamChatError', () { test('should match if message is same', () { @@ -59,221 +53,4 @@ void main() { expect(error.toString(), 'StreamWebSocketError(message: boom)'); }); }); - - group('StreamChatNetworkError', () { - test('.raw', () { - const code = 333; - const message = 'test-error-message'; - final error = StreamChatNetworkError.raw(code: code, message: message); - expect(error, isNotNull); - expect(error.code, code); - expect(error.message, message); - }); - - test('.fromDioException', () { - const code = 333; - const statusCode = 666; - const message = 'test-error-message'; - final options = RequestOptions(path: 'test-path'); - final data = ErrorResponse() - ..code = code - ..statusCode = statusCode - ..message = message; - final dioError = DioException( - requestOptions: options, - response: Response( - requestOptions: options, - statusCode: data.statusCode, - data: data.toJson(), - ), - ); - final error = StreamChatNetworkError.fromDioException(dioError); - expect(error, isNotNull); - expect(error.code, code); - expect(error.message, message); - expect(error.statusCode, statusCode); - expect(error.data?.code, data.code); - expect(error.data?.statusCode, data.statusCode); - expect(error.data?.message, data.message); - }); - - test('.fromDioException with String data', () { - const code = 333; - const statusCode = 666; - const message = 'test-error-message'; - final options = RequestOptions(path: 'test-path'); - const data = - ''' - { - "code": $code, - "StatusCode": $statusCode, - "message": "$message" - }'''; - final dioError = DioException( - requestOptions: options, - response: Response( - requestOptions: options, - statusCode: statusCode, - data: data, - ), - ); - final error = StreamChatNetworkError.fromDioException(dioError); - expect(error, isNotNull); - expect(error.code, code); - expect(error.message, message); - expect(error.statusCode, statusCode); - expect(error.data?.code, code); - expect(error.data?.statusCode, statusCode); - expect(error.data?.message, message); - }); - - test('.fromDioException with non-JSON String data falls back to ' - 'statusMessage', () { - const statusCode = 504; - const statusMessage = 'Gateway Timeout'; - const body = 'upstream request timeout'; - final options = RequestOptions(path: 'test-path'); - final dioError = DioException( - requestOptions: options, - response: Response( - requestOptions: options, - statusCode: statusCode, - statusMessage: statusMessage, - data: body, - ), - ); - final error = StreamChatNetworkError.fromDioException(dioError); - expect(error, isNotNull); - expect(error.code, -1); - expect(error.message, statusMessage); - expect(error.statusCode, statusCode); - expect(error.data, isNull); - }); - - test('.fromDioException with null data and existing response message', () { - const statusCode = 666; - const message = 'test-error-message'; - final options = RequestOptions(path: 'test-path'); - final dioError = DioException( - requestOptions: options, - response: Response( - requestOptions: options, - statusCode: statusCode, - statusMessage: message, - ), - ); - final error = StreamChatNetworkError.fromDioException(dioError); - expect(error, isNotNull); - expect(error.code, -1); - expect(error.message, message); - expect(error.statusCode, statusCode); - expect(error.data, isNull); - }); - - test('.fromDioException with null data and existing exception message', () { - const statusCode = 666; - const message = 'test-error-message'; - final options = RequestOptions(path: 'test-path'); - final dioError = DioException( - requestOptions: options, - message: message, - response: Response( - requestOptions: options, - statusCode: statusCode, - ), - ); - final error = StreamChatNetworkError.fromDioException(dioError); - expect(error, isNotNull); - expect(error.code, -1); - expect(error.message, message); - expect(error.statusCode, statusCode); - expect(error.data, isNull); - }); - - test('should match if message, code and statusCode is same', () { - const code = 333; - const statusCode = 666; - const message = 'test-error-message'; - final error = StreamChatNetworkError.raw( - code: code, - statusCode: statusCode, - message: message, - ); - final error2 = StreamChatNetworkError.raw( - code: code, - statusCode: statusCode, - message: message, - ); - - expect(error, error2); - }); - - test('`.retriable` should return true if data is not present', () { - const errorCode = ChatErrorCode.tokenExpired; - final error = StreamChatNetworkError(errorCode); - - expect(error.isRetriable, isTrue); - }); - - test('`.toString`', () { - const errorCode = ChatErrorCode.tokenExpired; - final error = StreamChatNetworkError(errorCode); - expect( - error.toString(), - 'StreamChatNetworkError(' - 'code: ${errorCode.code}, ' - 'message: ${errorCode.message})', - ); - }); - - test('`.toString` includes the transport type when known', () { - final error = StreamChatNetworkError.fromDioException( - DioException( - requestOptions: RequestOptions(path: '/'), - type: DioExceptionType.connectionError, - ), - ); - - expect(error.toString(), contains('type: connectionError')); - }); - - group('.type from .fromDioException maps dio types 1:1', () { - const cases = { - DioExceptionType.connectionError: StreamChatNetworkErrorType.connectionError, - DioExceptionType.connectionTimeout: StreamChatNetworkErrorType.connectionTimeout, - DioExceptionType.sendTimeout: StreamChatNetworkErrorType.sendTimeout, - DioExceptionType.receiveTimeout: StreamChatNetworkErrorType.receiveTimeout, - DioExceptionType.transformTimeout: StreamChatNetworkErrorType.transformTimeout, - DioExceptionType.badResponse: StreamChatNetworkErrorType.badResponse, - DioExceptionType.cancel: StreamChatNetworkErrorType.cancel, - DioExceptionType.badCertificate: StreamChatNetworkErrorType.badCertificate, - DioExceptionType.unknown: StreamChatNetworkErrorType.unknown, - }; - - for (final MapEntry(key: dioType, value: expected) in cases.entries) { - test('$dioType -> $expected', () { - final error = StreamChatNetworkError.fromDioException( - _dioException(dioType), - ); - expect(error.type, expected); - }); - } - }); - - test('.type defaults to unknown for non-network errors', () { - final error = StreamChatNetworkError(ChatErrorCode.internalSystemError); - expect(error.type, StreamChatNetworkErrorType.unknown); - }); - - test('.type is part of equality', () { - final error = StreamChatNetworkError.raw(code: 1, message: 'msg'); - final error2 = StreamChatNetworkError.raw( - code: 1, - message: 'msg', - type: StreamChatNetworkErrorType.connectionTimeout, - ); - - expect(error, isNot(error2)); - }); - }); } diff --git a/packages/stream_chat/test/src/core/error/stream_chat_exception_test.dart b/packages/stream_chat/test/src/core/error/stream_chat_exception_test.dart new file mode 100644 index 0000000000..5a00ed7780 --- /dev/null +++ b/packages/stream_chat/test/src/core/error/stream_chat_exception_test.dart @@ -0,0 +1,145 @@ +import 'package:stream_chat/src/core/error/error.dart'; +import 'package:stream_core/stream_core.dart' + show + StreamApiError, + StreamApiException, + StreamAuthenticationException, + StreamClientException, + StreamErrorCode, + StreamException, + StreamNetworkException; +import 'package:test/test.dart'; + +void main() { + group('StreamChatException', () { + test('is the same type as StreamException, so either name catches the same failures', () { + expect(StreamChatException, StreamException); + }); + + test('catches every kind of Stream failure', () { + const failures = [ + StreamApiException(message: 'refused', statusCode: 400), + StreamNetworkException(message: 'offline'), + StreamAuthenticationException(message: 'no token'), + StreamClientException(message: 'our bug'), + ]; + + expect(failures, everyElement(isA())); + }); + }); + + group('isRetriable', () { + test('honours the server declaring the failure unrecoverable', () { + const error = StreamApiException( + message: 'permission denied', + statusCode: 500, + unrecoverable: true, + ); + + // Outranks the 5xx status, which on its own would retry. + expect(error.isRetriable, isFalse); + }); + + test('retries a rate limit', () { + const error = StreamApiException( + message: 'too many requests', + statusCode: 429, + code: StreamErrorCode.rateLimited, + ); + + expect(error.isRetriable, isTrue); + }); + + test('retries a token that is not valid yet, since clock skew heals', () { + const notYetValid = StreamApiException( + message: 'not valid yet', + statusCode: 401, + code: StreamErrorCode.tokenNotValidYet, + ); + const usedBeforeIssued = StreamApiException( + message: 'used before issued at', + statusCode: 401, + code: StreamErrorCode.tokenUsedBeforeIssuedAt, + ); + + expect(notYetValid.isRetriable, isTrue); + expect(usedBeforeIssued.isRetriable, isTrue); + }); + + test('does not retry an expired token, which a refresh already failed to fix', () { + const error = StreamApiException( + message: 'token expired', + statusCode: 401, + code: StreamErrorCode.tokenExpired, + ); + + expect(error.isRetriable, isFalse); + }); + + test('retries a server that failed to answer', () { + const internal = StreamApiException(message: 'internal error', statusCode: 500); + const badGateway = StreamApiException(message: 'bad gateway', statusCode: 502); + + expect(internal.isRetriable, isTrue); + expect(badGateway.isRetriable, isTrue); + }); + + test('retries a request that did not complete in time', () { + const error = StreamApiException( + message: 'request timeout', + statusCode: 408, + code: StreamErrorCode.requestTimeout, + ); + + expect(error.isRetriable, isTrue); + }); + + test('does not retry any other verdict on the request', () { + const badRequest = StreamApiException(message: 'input error', statusCode: 400); + const forbidden = StreamApiException(message: 'not allowed', statusCode: 403); + const notFound = StreamApiException(message: 'not found', statusCode: 404); + + expect(badRequest.isRetriable, isFalse); + expect(forbidden.isRetriable, isFalse); + expect(notFound.isRetriable, isFalse); + }); + + test('retries a request that never reached a verdict', () { + const offline = StreamNetworkException(message: 'no connection'); + const timedOut = StreamNetworkException(message: 'timed out', isTimeout: true); + + expect(offline.isRetriable, isTrue); + expect(timedOut.isRetriable, isTrue); + }); + + test('does not retry what the caller cancelled', () { + const error = StreamNetworkException(message: 'cancelled', isCancelled: true); + + expect(error.isRetriable, isFalse); + }); + + test('does not retry broken credentials or an SDK bug', () { + const auth = StreamAuthenticationException(message: 'no token'); + const client = StreamClientException(message: 'undecodable body'); + + expect(auth.isRetriable, isFalse); + expect(client.isRetriable, isFalse); + }); + + test('reads unrecoverable off the server error payload', () { + final error = StreamApiException.fromApiError( + const StreamApiError( + code: StreamErrorCode.notAllowed, + details: [], + duration: '0ms', + message: 'permission denied', + moreInfo: '', + statusCode: 500, + unrecoverable: true, + ), + ); + + expect(error.isRetriable, isFalse); + }); + }); +} diff --git a/packages/stream_chat/test/src/core/http/interceptor/additional_headers_interceptor_test.dart b/packages/stream_chat/test/src/core/http/interceptor/additional_headers_interceptor_test.dart index d4dc322f4f..8dfa0d2a21 100644 --- a/packages/stream_chat/test/src/core/http/interceptor/additional_headers_interceptor_test.dart +++ b/packages/stream_chat/test/src/core/http/interceptor/additional_headers_interceptor_test.dart @@ -2,68 +2,72 @@ import 'package:dio/dio.dart'; import 'package:stream_chat/src/core/http/interceptor/additional_headers_interceptor.dart'; -import 'package:stream_chat/src/core/http/system_environment_manager.dart'; import 'package:stream_chat/stream_chat.dart'; +import 'package:stream_core/stream_core.dart' show HeadersInterceptor, SystemEnvironmentManager; import 'package:test/test.dart'; void main() { - group('AdditionalHeadersInterceptor tests', () { - group('without SystemEnvironmentManager', () { - late AdditionalHeadersInterceptor additionalHeadersInterceptor; + Future> headersAfter(Interceptor interceptor) async { + final options = RequestOptions(path: 'test-path'); + final handler = RequestInterceptorHandler(); - setUp(() { - additionalHeadersInterceptor = const AdditionalHeadersInterceptor(); - }); + interceptor.onRequest(options, handler); - test('should add additional headers in the request', () async { - StreamChatClient.additionalHeaders = {'test-header': 'test-value'}; - addTearDown(() => StreamChatClient.additionalHeaders = {}); + final updatedOptions = (await handler.future).data as RequestOptions; + return updatedOptions.headers; + } - final options = RequestOptions(path: 'test-path'); - final handler = RequestInterceptorHandler(); + group('AdditionalHeadersInterceptor', () { + test('applies the headers an integrator added', () async { + StreamChatClient.additionalHeaders = {'test-header': 'test-value'}; + addTearDown(() => StreamChatClient.additionalHeaders = {}); - await additionalHeadersInterceptor.onRequest(options, handler); + final headers = await headersAfter(const AdditionalHeadersInterceptor()); - final updatedOptions = (await handler.future).data as RequestOptions; - final updateHeaders = updatedOptions.headers; - - expect(updateHeaders.containsKey('test-header'), isTrue); - expect(updateHeaders['test-header'], 'test-value'); - expect(updateHeaders.containsKey('X-Stream-Client'), isFalse); - }); + expect(headers['test-header'], 'test-value'); + // The user agent is `HeadersInterceptor`'s job, not this one's. + expect(headers.containsKey('X-Stream-Client'), isFalse); }); - group('with SystemEnvironmentManager', () { - late AdditionalHeadersInterceptor additionalHeadersInterceptor; + test('reads the headers on every request, not once', () async { + const interceptor = AdditionalHeadersInterceptor(); + addTearDown(() => StreamChatClient.additionalHeaders = {}); - setUp(() { - additionalHeadersInterceptor = AdditionalHeadersInterceptor( - FakeSystemEnvironmentManager(), - ); - }); + StreamChatClient.additionalHeaders = {'test-header': 'first'}; + expect((await headersAfter(interceptor))['test-header'], 'first'); - test('should add user agent header when available', () async { - StreamChatClient.additionalHeaders = {'test-header': 'test-value'}; - addTearDown(() => StreamChatClient.additionalHeaders = {}); + StreamChatClient.additionalHeaders = {'test-header': 'second'}; + expect((await headersAfter(interceptor))['test-header'], 'second'); + }); - final options = RequestOptions(path: 'test-path'); - final handler = RequestInterceptorHandler(); + test('adds nothing when none were added', () async { + final headers = await headersAfter(const AdditionalHeadersInterceptor()); - await additionalHeadersInterceptor.onRequest(options, handler); + expect(headers.containsKey('test-header'), isFalse); + }); + }); - final updatedOptions = (await handler.future).data as RequestOptions; - final updateHeaders = updatedOptions.headers; + // `HeadersInterceptor` is `stream_core`'s, but `stream_core` has no test for + // it, and this is the environment manager this SDK hands it. + group('HeadersInterceptor', () { + test('reports the SDK identity in the Stream client header', () async { + final headers = await headersAfter(HeadersInterceptor(FakeSystemEnvironmentManager())); - expect(updateHeaders.containsKey('test-header'), isTrue); - expect(updateHeaders['test-header'], 'test-value'); - expect(updateHeaders.containsKey('X-Stream-Client'), isTrue); - expect(updateHeaders['X-Stream-Client'], 'test-user-agent'); - }); + expect(headers['X-Stream-Client'], 'test-user-agent'); }); }); } class FakeSystemEnvironmentManager extends SystemEnvironmentManager { + FakeSystemEnvironmentManager() + : super( + environment: const SystemEnvironment( + sdkName: 'stream-chat', + sdkIdentifier: 'dart', + sdkVersion: '0.0.0', + ), + ); + @override String get userAgent => 'test-user-agent'; } diff --git a/packages/stream_chat/test/src/core/http/interceptor/auth_interceptor_test.dart b/packages/stream_chat/test/src/core/http/interceptor/auth_interceptor_test.dart deleted file mode 100644 index cc92b01a8f..0000000000 --- a/packages/stream_chat/test/src/core/http/interceptor/auth_interceptor_test.dart +++ /dev/null @@ -1,223 +0,0 @@ -// ignore_for_file: invalid_use_of_protected_member - -import 'package:dio/dio.dart'; -import 'package:mocktail/mocktail.dart'; -import 'package:stream_chat/src/core/http/interceptor/auth_interceptor.dart'; -import 'package:stream_chat/src/core/http/stream_chat_dio_error.dart'; -import 'package:stream_chat/src/core/http/token.dart'; -import 'package:stream_chat/src/core/http/token_manager.dart'; -import 'package:stream_chat/stream_chat.dart'; -import 'package:test/test.dart'; - -import '../../../mocks.dart'; - -void main() { - late StreamHttpClient client; - late TokenManager tokenManager; - late AuthInterceptor authInterceptor; - - setUp(() { - client = MockHttpClient(); - tokenManager = MockTokenManager(); - authInterceptor = AuthInterceptor(client, tokenManager); - }); - - test( - '`onRequest` should add userId, authToken, authType in the request', - () async { - final options = RequestOptions(path: 'test-path'); - final handler = RequestInterceptorHandler(); - - final headers = options.headers; - final queryParams = options.queryParameters; - expect(headers.containsKey('Authorization'), isFalse); - expect(headers.containsKey('stream-auth-type'), isFalse); - expect(queryParams.containsKey('user_id'), isFalse); - - final token = Token.development('test-user-id'); - when(() => tokenManager.loadToken(refresh: any(named: 'refresh'))).thenAnswer((_) async => token); - - authInterceptor.onRequest(options, handler); - - final updatedOptions = (await handler.future).data as RequestOptions; - final updateHeaders = updatedOptions.headers; - final updatedQueryParams = updatedOptions.queryParameters; - - expect(updateHeaders.containsKey('Authorization'), isTrue); - expect(updateHeaders['Authorization'], token.rawValue); - expect(updateHeaders.containsKey('stream-auth-type'), isTrue); - expect(updateHeaders['stream-auth-type'], token.authType.name); - expect(updatedQueryParams.containsKey('user_id'), isTrue); - expect(updatedQueryParams['user_id'], token.userId); - - verify(() => tokenManager.loadToken(refresh: any(named: 'refresh'))).called(1); - verifyNoMoreInteractions(tokenManager); - }, - ); - - test( - '`onRequest` should reject with error if `tokenManager.loadToken` throws', - () async { - final options = RequestOptions(path: 'test-path'); - final handler = RequestInterceptorHandler(); - - authInterceptor.onRequest(options, handler); - - try { - await handler.future; - } catch (e) { - // need to cast it as the type is private in dio - var error = (e as dynamic).data; - expect(error, isA()); - error = (error as StreamChatDioError).error; - expect(error.code, ChatErrorCode.undefinedToken.code); - expect(error.message, ChatErrorCode.undefinedToken.message); - } - }, - ); - - test('`onError` should retry the request with refreshed token', () async { - const path = 'test-request-path'; - final options = RequestOptions(path: path); - const code = ChatErrorCode.tokenExpired; - final errorResponse = ErrorResponse() - ..code = code.code - ..message = code.message; - final response = Response( - requestOptions: options, - data: errorResponse.toJson(), - ); - final err = DioException(requestOptions: options, response: response); - final handler = ErrorInterceptorHandler(); - - when(() => tokenManager.isStatic).thenReturn(false); - - final token = Token.development('test-user-id'); - when(() => tokenManager.loadToken(refresh: true)).thenAnswer((_) async => token); - - when(() => client.fetch(options)).thenAnswer( - (_) async => Response( - requestOptions: options, - statusCode: 200, - ), - ); - - authInterceptor.onError(err, handler); - - final res = await handler.future; - - var data = res.data; - expect(data, isA()); - data = data as Response; - expect(data, isNotNull); - expect(data.statusCode, 200); - expect(data.requestOptions.path, path); - - verify(() => tokenManager.isStatic).called(1); - - verify(() => tokenManager.loadToken(refresh: true)).called(1); - verifyNoMoreInteractions(tokenManager); - - verify(() => client.fetch(options)).called(1); - verifyNoMoreInteractions(client); - }); - - test( - '`onError` should reject with error if retried request throws', - () async { - const path = 'test-request-path'; - final options = RequestOptions(path: path); - const code = ChatErrorCode.tokenExpired; - final errorResponse = ErrorResponse() - ..code = code.code - ..message = code.message; - final response = Response( - requestOptions: options, - data: errorResponse.toJson(), - ); - final err = DioException(requestOptions: options, response: response); - final handler = ErrorInterceptorHandler(); - - when(() => tokenManager.isStatic).thenReturn(false); - - final token = Token.development('test-user-id'); - when(() => tokenManager.loadToken(refresh: true)).thenAnswer((_) async => token); - - when(() => client.fetch(options)).thenThrow(err); - - authInterceptor.onError(err, handler); - - try { - await handler.future; - } catch (e) { - // need to cast it as the type is private in dio - final error = (e as dynamic).data; - expect(error, isA()); - } - - verify(() => tokenManager.isStatic).called(1); - - verify(() => tokenManager.loadToken(refresh: true)).called(1); - verifyNoMoreInteractions(tokenManager); - - verify(() => client.fetch(options)).called(1); - verifyNoMoreInteractions(client); - }, - ); - - test( - '`onError` should reject with error if `tokenManager.isStatic` is true', - () async { - const path = 'test-request-path'; - final options = RequestOptions(path: path); - const code = ChatErrorCode.tokenExpired; - final errorResponse = ErrorResponse() - ..code = code.code - ..message = code.message; - final response = Response( - requestOptions: options, - data: errorResponse.toJson(), - ); - final err = DioException(requestOptions: options, response: response); - final handler = ErrorInterceptorHandler(); - - when(() => tokenManager.isStatic).thenReturn(true); - - authInterceptor.onError(err, handler); - - try { - await handler.future; - } catch (e) { - // need to cast it as the type is private in dio - final error = (e as dynamic).data; - expect(error, isA()); - final response = StreamChatNetworkError.fromDioException(error); - expect(response.errorCode, code); - } - - verify(() => tokenManager.isStatic).called(1); - verifyNoMoreInteractions(tokenManager); - }, - ); - - test( - '`onError` should reject with error if error is not a `tokenExpired error`', - () async { - const path = 'test-request-path'; - final options = RequestOptions(path: path); - final response = Response(requestOptions: options); - final err = DioException(requestOptions: options, response: response); - final handler = ErrorInterceptorHandler(); - - authInterceptor.onError(err, handler); - - try { - await handler.future; - } catch (e) { - // need to cast it as the type is private in dio - final error = (e as dynamic).data; - expect(error, isA()); - } - }, - ); -} diff --git a/packages/stream_chat/test/src/core/http/interceptor/connection_id_interceptor_test.dart b/packages/stream_chat/test/src/core/http/interceptor/connection_id_interceptor_test.dart index 92d3918515..8924646f84 100644 --- a/packages/stream_chat/test/src/core/http/interceptor/connection_id_interceptor_test.dart +++ b/packages/stream_chat/test/src/core/http/interceptor/connection_id_interceptor_test.dart @@ -3,7 +3,7 @@ import 'package:dio/dio.dart'; import 'package:mocktail/mocktail.dart'; import 'package:stream_chat/src/core/http/connection_id_manager.dart'; -import 'package:stream_chat/src/core/http/interceptor/connection_id_interceptor.dart'; +import 'package:stream_core/stream_core.dart' show ConnectionIdInterceptor; import 'package:test/test.dart'; import '../../../mocks.dart'; @@ -14,7 +14,8 @@ void main() { setUp(() { connectionIdManager = MockConnectionIdManager(); - connectionIdInterceptor = ConnectionIdInterceptor(connectionIdManager); + // Wired the way `StreamHttpClient` wires it: a closure over our manager. + connectionIdInterceptor = ConnectionIdInterceptor(() => connectionIdManager.connectionId); }); test( @@ -27,7 +28,6 @@ void main() { expect(queryParams.containsKey('connection_id'), isFalse); const connectionId = 'test-connection-id'; - when(() => connectionIdManager.hasConnectionId).thenReturn(true); when(() => connectionIdManager.connectionId).thenReturn(connectionId); connectionIdInterceptor.onRequest(options, handler); @@ -38,14 +38,13 @@ void main() { expect(updatedQueryParams.containsKey('connection_id'), isTrue); expect(updatedQueryParams['connection_id'], connectionId); - verify(() => connectionIdManager.hasConnectionId).called(1); verify(() => connectionIdManager.connectionId).called(1); verifyNoMoreInteractions(connectionIdManager); }, ); test( - '`onRequest` should not add connectionId if `hasConnectionId` is false', + '`onRequest` should not add connectionId when there is none', () async { final options = RequestOptions(path: 'test-path'); final handler = RequestInterceptorHandler(); @@ -53,7 +52,7 @@ void main() { final queryParams = options.queryParameters; expect(queryParams.containsKey('connection_id'), isFalse); - when(() => connectionIdManager.hasConnectionId).thenReturn(false); + when(() => connectionIdManager.connectionId).thenReturn(null); connectionIdInterceptor.onRequest(options, handler); @@ -62,7 +61,7 @@ void main() { expect(updatedQueryParams.containsKey('connection_id'), isFalse); - verify(() => connectionIdManager.hasConnectionId).called(1); + verify(() => connectionIdManager.connectionId).called(1); verifyNoMoreInteractions(connectionIdManager); }, ); diff --git a/packages/stream_chat/test/src/core/http/stream_chat_dio_error_test.dart b/packages/stream_chat/test/src/core/http/stream_chat_dio_error_test.dart deleted file mode 100644 index e29148bf4a..0000000000 --- a/packages/stream_chat/test/src/core/http/stream_chat_dio_error_test.dart +++ /dev/null @@ -1,20 +0,0 @@ -import 'package:dio/dio.dart'; -import 'package:stream_chat/src/core/error/error.dart'; -import 'package:stream_chat/src/core/http/stream_chat_dio_error.dart'; -import 'package:test/test.dart'; - -void main() { - test('should create a new instance of StreamChatDioError', () { - final error = StreamChatNetworkError(ChatErrorCode.inputError); - final options = RequestOptions(path: 'test-path'); - final dioError = StreamChatDioError( - error: error, - requestOptions: options, - ); - - expect(dioError, isA()); - expect(dioError, isNotNull); - expect(dioError.error, error); - expect(dioError.requestOptions, options); - }); -} diff --git a/packages/stream_chat/test/src/core/http/stream_http_client_test.dart b/packages/stream_chat/test/src/core/http/stream_http_client_test.dart index 936af1670b..c263af9485 100644 --- a/packages/stream_chat/test/src/core/http/stream_http_client_test.dart +++ b/packages/stream_chat/test/src/core/http/stream_http_client_test.dart @@ -1,19 +1,30 @@ import 'package:dio/dio.dart'; -import 'package:logging/logging.dart'; import 'package:mocktail/mocktail.dart'; import 'package:stream_chat/src/core/api/responses.dart'; -import 'package:stream_chat/src/core/error/error.dart'; import 'package:stream_chat/src/core/http/connection_id_manager.dart'; import 'package:stream_chat/src/core/http/interceptor/additional_headers_interceptor.dart'; -import 'package:stream_chat/src/core/http/interceptor/auth_interceptor.dart'; -import 'package:stream_chat/src/core/http/interceptor/connection_id_interceptor.dart'; -import 'package:stream_chat/src/core/http/interceptor/logging_interceptor.dart'; -import 'package:stream_chat/src/core/http/stream_chat_dio_error.dart'; import 'package:stream_chat/src/core/http/stream_http_client.dart'; -import 'package:stream_chat/src/core/http/token_manager.dart'; +import 'package:stream_core/stream_core.dart' + show + AuthInterceptor, + StreamLogHandler, + StreamLogPriority, + StreamLogRecord, + StreamLogger, + ConnectionIdInterceptor, + HeadersInterceptor, + LoggingInterceptor, + StreamApiException, + StreamDioException, + StreamErrorCode, + StreamNetworkException, + SystemEnvironment, + SystemEnvironmentManager, + TokenManager; import 'package:test/test.dart'; import '../../mocks.dart'; +import '../../utils.dart'; void main() { Response successResponse(String path) => Response( @@ -23,30 +34,29 @@ void main() { DioException throwableError( String path, { - StreamChatNetworkError? error, + StreamApiException? error, bool streamChatDioError = false, }) { if (streamChatDioError) assert(error != null, ''); final options = RequestOptions(path: path); + if (streamChatDioError) { + // A rejection raised inside the pipeline, already classified. + return StreamDioException(exception: error!, requestOptions: options); + } + + // A real answer from the server, carrying an error payload to decode. final data = ErrorResponse() ..code = error?.code ..statusCode = error?.statusCode ..message = error?.message; - DioException? dioError; - if (streamChatDioError) { - dioError = StreamChatDioError(error: error!, requestOptions: options); - } else { - dioError = DioException( - error: error, + return DioException( + requestOptions: options, + response: Response( requestOptions: options, - response: Response( - requestOptions: options, - statusCode: data.statusCode, - data: data.toJson(), - ), - ); - } - return dioError; + statusCode: data.statusCode, + data: data.toJson(), + ), + ); } test('UserAgentInterceptor should be added', () { @@ -56,9 +66,26 @@ void main() { expect(client.httpClient.interceptors.whereType().length, 1); }); + test('HeadersInterceptor should be added if systemEnvironmentManager is provided', () { + const apiKey = 'api-key'; + final client = StreamHttpClient( + apiKey, + systemEnvironmentManager: SystemEnvironmentManager( + environment: const SystemEnvironment( + sdkName: 'stream-chat', + sdkIdentifier: 'dart', + sdkVersion: '0.0.0', + ), + ), + ); + + // It is what carries `X-Stream-Client`, so losing it costs SDK attribution. + expect(client.httpClient.interceptors.whereType().length, 1); + }); + test('AuthInterceptor should be added if tokenManager is provided', () { const apiKey = 'api-key'; - final client = StreamHttpClient(apiKey, tokenManager: TokenManager()); + final client = StreamHttpClient(apiKey, tokenManager: TokenManager.unconfigured()); expect(client.httpClient.interceptors.whereType().length, 1); }); @@ -80,87 +107,58 @@ void main() { ); group('loggingInterceptor', () { - test('should be added if logger is provided', () { - const apiKey = 'api-key'; - final client = StreamHttpClient( - apiKey, - logger: Logger('test-logger'), - ); + test('is added by default', () { + final client = StreamHttpClient('api-key'); - expect( - client.httpClient.interceptors.whereType().length, - 1, - ); + expect(client.httpClient.interceptors.whereType().length, 1); }); - test('should not be added if logger.level is OFF', () { - const apiKey = 'api-key'; + test('is not added if `interceptors` are provided', () { final client = StreamHttpClient( - apiKey, - logger: Logger.detached('test-logger')..level = Level.OFF, - ); - - expect( - client.httpClient.interceptors.whereType().length, - 0, - ); - }); - - test('should not be added if `interceptors` are provided', () { - const apiKey = 'api-key'; - final client = StreamHttpClient( - apiKey, - logger: Logger.detached('test-logger'), + 'api-key', interceptors: [ // Sample Interceptor. InterceptorsWrapper(), ], ); - expect( - client.httpClient.interceptors.whereType().length, - 0, - ); + expect(client.httpClient.interceptors.whereType().length, 0); }); - test('should log requests', () async { - const apiKey = 'api-key'; - final logger = MockLogger(); - final client = StreamHttpClient(apiKey, logger: logger); + test('writes what it logs to the configured handler', () async { + final records = []; + StreamLogger.handler = _CapturingHandler(records.add); + StreamLogger.priority = StreamLogPriority.verbose; + addTearDown(StreamLogger.reset); - try { - await client.get('path'); - } catch (_) {} - - verify(() => logger.info(any())).called(greaterThan(0)); - }); - - test('should log error', () async { - const apiKey = 'api-key'; - final logger = MockLogger(); - final client = StreamHttpClient(apiKey, logger: logger); + final client = StreamHttpClient('api-key'); try { await client.get('path'); } catch (_) {} - verify(() => logger.severe(any())).called(greaterThan(0)); + // The request is logged, and so is the failure to reach the server. + expect(records.map((it) => it.tag), everyElement('SCh:Http')); + expect(records.any((it) => it.priority == StreamLogPriority.debug), isTrue); + expect(records.any((it) => it.priority == StreamLogPriority.warning), isTrue); }); }); test('`.close` should close the dio client', () async { final client = StreamHttpClient('api-key')..close(force: true); - try { - await client.get('path'); - } on StreamChatNetworkError catch (e) { - expect(e, isA()); - expect( - e.message, - "The connection errored: Dio can't establish a new connection" - ' after it was closed. This indicates an error which most likely' - ' cannot be solved by the library.', - ); - } + + // A closed client never reaches the server, so the request fails without + // a verdict. + await expectLater( + client.get('path'), + throwsA( + isA().having( + (it) => it.message, + 'message', + contains("Dio can't establish a new connection after it was closed"), + ), + ), + ); }); test('`.get` should return response successfully', () async { @@ -190,14 +188,14 @@ void main() { verifyNoMoreInteractions(dio); }); - test('`.get` should throw an instance of `StreamChatNetworkError`', () async { + test('`.get` should throw an instance of `StreamApiException`', () async { final dio = MockDio(); final client = StreamHttpClient('api-key', dio: dio); const path = 'test-get-api-path'; final error = throwableError( path, - error: StreamChatNetworkError(ChatErrorCode.internalSystemError), + error: apiException(code: StreamErrorCode.internalError, statusCode: 500), ); when( () => dio.get( @@ -206,12 +204,17 @@ void main() { ), ).thenThrow(error); - try { - await client.get(path); - } catch (e) { - expect(e, isA()); - expect(e, StreamChatNetworkError.fromDioException(error)); - } + // Matched on the facts the mapper read off the response rather than on + // object identity: the exception also carries the DioException as its + // cause, which equality would compare. + await expectLater( + client.get(path), + throwsA( + isA() + .having((it) => it.statusCode, 'statusCode', 500) + .having((it) => it.code, 'code', StreamErrorCode.internalError), + ), + ); verify( () => dio.get( @@ -250,7 +253,7 @@ void main() { }); test( - '`.post` should throw an instance of `StreamChatNetworkError`', + '`.post` should throw an instance of `StreamApiException`', () async { final dio = MockDio(); final client = StreamHttpClient('api-key', dio: dio); @@ -258,7 +261,7 @@ void main() { const path = 'test-post-api-path'; final error = throwableError( path, - error: StreamChatNetworkError(ChatErrorCode.internalSystemError), + error: apiException(code: StreamErrorCode.internalError, statusCode: 500), ); when( () => dio.post( @@ -267,12 +270,14 @@ void main() { ), ).thenThrow(error); - try { - await client.post(path); - } catch (e) { - expect(e, isA()); - expect(e, StreamChatNetworkError.fromDioException(error)); - } + await expectLater( + client.post(path), + throwsA( + isA() + .having((it) => it.statusCode, 'statusCode', 500) + .having((it) => it.code, 'code', StreamErrorCode.internalError), + ), + ); verify( () => dio.post( @@ -312,7 +317,7 @@ void main() { }); test( - '`.delete` should throw an instance of `StreamChatNetworkError`', + '`.delete` should throw an instance of `StreamApiException`', () async { final dio = MockDio(); final client = StreamHttpClient('api-key', dio: dio); @@ -320,7 +325,7 @@ void main() { const path = 'test-delete-api-path'; final error = throwableError( path, - error: StreamChatNetworkError(ChatErrorCode.internalSystemError), + error: apiException(code: StreamErrorCode.internalError, statusCode: 500), ); when( () => dio.delete( @@ -329,12 +334,14 @@ void main() { ), ).thenThrow(error); - try { - await client.delete(path); - } catch (e) { - expect(e, isA()); - expect(e, StreamChatNetworkError.fromDioException(error)); - } + await expectLater( + client.delete(path), + throwsA( + isA() + .having((it) => it.statusCode, 'statusCode', 500) + .having((it) => it.code, 'code', StreamErrorCode.internalError), + ), + ); verify( () => dio.delete( @@ -374,7 +381,7 @@ void main() { }); test( - '`.patch` should throw an instance of `StreamChatNetworkError`', + '`.patch` should throw an instance of `StreamApiException`', () async { final dio = MockDio(); final client = StreamHttpClient('api-key', dio: dio); @@ -382,7 +389,7 @@ void main() { const path = 'test-patch-api-path'; final error = throwableError( path, - error: StreamChatNetworkError(ChatErrorCode.internalSystemError), + error: apiException(code: StreamErrorCode.internalError, statusCode: 500), ); when( () => dio.patch( @@ -391,12 +398,14 @@ void main() { ), ).thenThrow(error); - try { - await client.patch(path); - } catch (e) { - expect(e, isA()); - expect(e, StreamChatNetworkError.fromDioException(error)); - } + await expectLater( + client.patch(path), + throwsA( + isA() + .having((it) => it.statusCode, 'statusCode', 500) + .having((it) => it.code, 'code', StreamErrorCode.internalError), + ), + ); verify( () => dio.patch( @@ -436,7 +445,7 @@ void main() { }); test( - '`.put` should throw an instance of `StreamChatNetworkError`', + '`.put` should throw an instance of `StreamApiException`', () async { final dio = MockDio(); final client = StreamHttpClient('api-key', dio: dio); @@ -444,7 +453,7 @@ void main() { const path = 'test-put-api-path'; final error = throwableError( path, - error: StreamChatNetworkError(ChatErrorCode.internalSystemError), + error: apiException(code: StreamErrorCode.internalError, statusCode: 500), ); when( () => dio.put( @@ -453,12 +462,14 @@ void main() { ), ).thenThrow(error); - try { - await client.put(path); - } catch (e) { - expect(e, isA()); - expect(e, StreamChatNetworkError.fromDioException(error)); - } + await expectLater( + client.put(path), + throwsA( + isA() + .having((it) => it.statusCode, 'statusCode', 500) + .having((it) => it.code, 'code', StreamErrorCode.internalError), + ), + ); verify( () => dio.put( @@ -502,7 +513,7 @@ void main() { }); test( - '`.postFile` should throw an instance of `StreamChatNetworkError`', + '`.postFile` should throw an instance of `StreamApiException`', () async { final dio = MockDio(); final client = StreamHttpClient('api-key', dio: dio); @@ -512,7 +523,7 @@ void main() { final error = throwableError( path, - error: StreamChatNetworkError(ChatErrorCode.internalSystemError), + error: apiException(code: StreamErrorCode.internalError, statusCode: 500), ); when( () => dio.post( @@ -522,12 +533,14 @@ void main() { ), ).thenThrow(error); - try { - await client.postFile(path, file); - } catch (e) { - expect(e, isA()); - expect(e, StreamChatNetworkError.fromDioException(error)); - } + await expectLater( + client.postFile(path, file), + throwsA( + isA() + .having((it) => it.statusCode, 'statusCode', 500) + .having((it) => it.code, 'code', StreamErrorCode.internalError), + ), + ); verify( () => dio.post( @@ -568,7 +581,7 @@ void main() { }); test( - '`.request` should throw an instance of `StreamChatNetworkError`', + '`.request` should throw an instance of `StreamApiException`', () async { final dio = MockDio(); final client = StreamHttpClient('api-key', dio: dio); @@ -577,7 +590,7 @@ void main() { final error = throwableError( path, streamChatDioError: true, - error: StreamChatNetworkError(ChatErrorCode.internalSystemError), + error: apiException(code: StreamErrorCode.internalError, statusCode: 500), ); when( () => dio.request( @@ -586,12 +599,10 @@ void main() { ), ).thenThrow(error); - try { - await client.request(path); - } catch (e) { - expect(e, isA()); - expect(e, error.error); - } + await expectLater( + client.request(path), + throwsA(isA().having((it) => it, 'error', error.error)), + ); verify( () => dio.request( @@ -603,3 +614,12 @@ void main() { }, ); } + +class _CapturingHandler extends StreamLogHandler { + const _CapturingHandler(this._onRecord); + + final void Function(StreamLogRecord) _onRecord; + + @override + void handle(StreamLogRecord record) => _onRecord(record); +} diff --git a/packages/stream_chat/test/src/core/http/system_environment_manager_test.dart b/packages/stream_chat/test/src/core/http/system_environment_manager_test.dart deleted file mode 100644 index 252f4a85c9..0000000000 --- a/packages/stream_chat/test/src/core/http/system_environment_manager_test.dart +++ /dev/null @@ -1,252 +0,0 @@ -// ignore_for_file: avoid_redundant_argument_values, lines_longer_than_80_chars - -import 'package:stream_chat/src/core/http/system_environment_manager.dart'; -import 'package:stream_chat/src/core/platform_detector/platform_detector.dart'; -import 'package:stream_chat/src/system_environment.dart'; -import 'package:stream_chat/version.dart'; -import 'package:test/test.dart'; - -void main() { - group('SystemEnvironmentManager', () { - late SystemEnvironmentManager manager; - - setUp(() { - manager = SystemEnvironmentManager(); - }); - - test('initializes with default Stream environment', () { - expect(manager.environment.sdkName, equals('stream-chat')); - expect(manager.environment.sdkIdentifier, equals('dart')); - expect(manager.environment.sdkVersion, equals(PACKAGE_VERSION)); - }); - - test('sanitizes environment passed to constructor', () { - const customEnv = SystemEnvironment( - sdkName: 'custom-sdk', - sdkIdentifier: 'flutter', - sdkVersion: '1.0.0', - appName: 'test-app', - ); - - manager = SystemEnvironmentManager(environment: customEnv); - - // Immutable fields are forced to internal values. - expect(manager.environment.sdkName, equals('stream-chat')); - expect(manager.environment.sdkVersion, equals(PACKAGE_VERSION)); - expect(manager.environment.osName, equals(CurrentPlatform.name)); - // Whitelisted sdkIdentifier is accepted. - expect(manager.environment.sdkIdentifier, equals('flutter')); - // App fields are passed through. - expect(manager.environment.appName, equals('test-app')); - }); - - test('sanitizes environment on update', () { - const newEnv = SystemEnvironment( - sdkName: 'stream-chat-android', - sdkIdentifier: 'android', - sdkVersion: '99.0.0', - appName: 'test-app', - appVersion: '2.0.0', - osName: 'spoofed-os', - osVersion: '14', - deviceModel: 'Pixel 7', - ); - - manager.updateEnvironment(newEnv); - - // Immutable fields are forced to internal values. - expect(manager.environment.sdkName, equals('stream-chat')); - expect(manager.environment.sdkVersion, equals(PACKAGE_VERSION)); - expect(manager.environment.osName, equals(CurrentPlatform.name)); - // Unknown sdkIdentifier falls back to the current value. - expect(manager.environment.sdkIdentifier, equals('dart')); - // App/device/os-version fields are passed through. - expect(manager.environment.appName, equals('test-app')); - expect(manager.environment.appVersion, equals('2.0.0')); - expect(manager.environment.osVersion, equals('14')); - expect(manager.environment.deviceModel, equals('Pixel 7')); - }); - - test('allows promoting sdkIdentifier from dart to flutter', () { - manager.updateEnvironment( - const SystemEnvironment( - sdkName: 'stream-chat', - sdkIdentifier: 'flutter', - sdkVersion: PACKAGE_VERSION, - ), - ); - - expect(manager.environment.sdkIdentifier, equals('flutter')); - }); - - test('ignores demotion of sdkIdentifier from flutter to dart', () { - manager - ..updateEnvironment( - const SystemEnvironment( - sdkName: 'stream-chat', - sdkIdentifier: 'flutter', - sdkVersion: PACKAGE_VERSION, - ), - ) - ..updateEnvironment( - const SystemEnvironment( - sdkName: 'stream-chat', - sdkIdentifier: 'dart', - sdkVersion: PACKAGE_VERSION, - ), - ); - - expect(manager.environment.sdkIdentifier, equals('flutter')); - }); - - test('userAgent returns proper header string', () { - expect( - manager.userAgent, - equals( - 'stream-chat-dart-v$PACKAGE_VERSION|os=${CurrentPlatform.name}', - ), - ); - }); - }); - - group('XStreamClientHeaderExtension', () { - test('generates minimal header with required fields only', () { - const env = SystemEnvironment( - sdkName: 'stream-chat', - sdkIdentifier: 'dart', - sdkVersion: '1.0.0', - ); - - expect( - env.xStreamClientHeader, - equals('stream-chat-dart-v1.0.0'), - ); - }); - - test('includes app name when available', () { - const env = SystemEnvironment( - sdkName: 'stream-chat', - sdkIdentifier: 'dart', - sdkVersion: '1.0.0', - appName: 'test-app', - ); - - expect( - env.xStreamClientHeader, - equals('stream-chat-dart-v1.0.0|app=test-app'), - ); - }); - - test('includes app version when available', () { - const env = SystemEnvironment( - sdkName: 'stream-chat', - sdkIdentifier: 'dart', - sdkVersion: '1.0.0', - appVersion: '2.0.0', - ); - - expect( - env.xStreamClientHeader, - equals('stream-chat-dart-v1.0.0|app_version=2.0.0'), - ); - }); - - test('includes OS information with name and version', () { - const env = SystemEnvironment( - sdkName: 'stream-chat', - sdkIdentifier: 'dart', - sdkVersion: '1.0.0', - osName: 'iOS', - osVersion: '16.0', - ); - - expect( - env.xStreamClientHeader, - equals('stream-chat-dart-v1.0.0|os=iOS 16.0'), - ); - }); - - test('includes OS name only when version is null', () { - const env = SystemEnvironment( - sdkName: 'stream-chat', - sdkIdentifier: 'dart', - sdkVersion: '1.0.0', - osName: 'Android', - ); - - expect( - env.xStreamClientHeader, - equals('stream-chat-dart-v1.0.0|os=Android'), - ); - }); - - test('includes device model when available', () { - const env = SystemEnvironment( - sdkName: 'stream-chat', - sdkIdentifier: 'dart', - sdkVersion: '1.0.0', - deviceModel: 'iPhone 14', - ); - - expect( - env.xStreamClientHeader, - equals('stream-chat-dart-v1.0.0|device_model=iPhone 14'), - ); - }); - - test('includes all information when available', () { - const env = SystemEnvironment( - sdkName: 'stream-chat', - sdkIdentifier: 'dart', - sdkVersion: '1.0.0', - appName: 'test-app', - appVersion: '2.0.0', - osName: 'iOS', - osVersion: '16.0', - deviceModel: 'iPhone 14', - ); - - expect( - env.xStreamClientHeader, - equals( - 'stream-chat-dart-v1.0.0|app=test-app|app_version=2.0.0|os=iOS 16.0|device_model=iPhone 14', - ), - ); - }); - - test('excludes OS section when both osName and osVersion are null', () { - const env = SystemEnvironment( - sdkName: 'stream-chat', - sdkIdentifier: 'dart', - sdkVersion: '1.0.0', - appName: 'test-app', - ); - - expect( - env.xStreamClientHeader, - equals('stream-chat-dart-v1.0.0|app=test-app'), - ); - expect(env.xStreamClientHeader.contains('os='), isFalse); - }); - - test('skips null values in header generation', () { - const env = SystemEnvironment( - sdkName: 'stream-chat', - sdkIdentifier: 'dart', - sdkVersion: '1.0.0', - appName: null, - appVersion: '2.0.0', - osName: null, - osVersion: null, - deviceModel: 'iPhone 14', - ); - - expect( - env.xStreamClientHeader, - equals( - 'stream-chat-dart-v1.0.0|app_version=2.0.0|device_model=iPhone 14', - ), - ); - }); - }); -} diff --git a/packages/stream_chat/test/src/core/http/token_manager_test.dart b/packages/stream_chat/test/src/core/http/token_manager_test.dart deleted file mode 100644 index 626fd676b4..0000000000 --- a/packages/stream_chat/test/src/core/http/token_manager_test.dart +++ /dev/null @@ -1,139 +0,0 @@ -import 'package:stream_chat/src/core/http/token.dart'; -import 'package:stream_chat/src/core/http/token_manager.dart'; -import 'package:test/test.dart'; - -void main() { - late TokenManager tokenManager; - - setUp(() { - tokenManager = TokenManager(); - }); - - tearDown(() { - tokenManager.reset(); - }); - - test('`setTokenOrProvider` should set token', () async { - expect(tokenManager.userId, isNull); - - const userId = 'test-user-id'; - final token = Token.development(userId); - final returnedToken = await tokenManager.setTokenOrProvider( - userId, - token: token, - ); - - expect(returnedToken, token); - expect(tokenManager.userId, userId); - expect(tokenManager.isStatic, isTrue); - }); - - test('`setTokenOrProvider` should set tokenProvider', () async { - expect(tokenManager.userId, isNull); - - const userId = 'test-user-id'; - Future tokenProvider(String userId) async => Token.development(userId).rawValue; - final returnedToken = await tokenManager.setTokenOrProvider( - userId, - provider: tokenProvider, - ); - - expect(returnedToken, isNotNull); - expect(tokenManager.userId, userId); - expect(tokenManager.isStatic, isFalse); - }); - - test( - '''`setTokenOrProvider` should throw if both token and provider is not provided''', - () async { - expect(tokenManager.userId, isNull); - - const userId = 'test-user-id'; - try { - await tokenManager.setTokenOrProvider(userId); - } catch (e) { - expect(e, isA()); - } - }, - ); - - test( - '`setTokenOrProvider` should throw if both token and provider is provided', - () async { - expect(tokenManager.userId, isNull); - - const userId = 'test-user-id'; - final token = Token.development(userId); - Future tokenProvider(String userId) async => Token.development(userId).rawValue; - try { - await tokenManager.setTokenOrProvider( - userId, - token: token, - provider: tokenProvider, - ); - } catch (e) { - expect(e, isA()); - } - }, - ); - - test( - '`.loadToken` should return token set via `setToken`', - () async { - const userId = 'test-user-id'; - final token = Token.development(userId); - await tokenManager.setTokenOrProvider(userId, token: token); - - final returnedToken = await tokenManager.loadToken(); - expect(returnedToken, token); - }, - ); - - test( - '`.loadToken` should return token set via `setProvider`', - () async { - const userId = 'test-user-id'; - final token = Token.development(userId); - Future tokenProvider(String userId) async => token.rawValue; - await tokenManager.setTokenOrProvider(userId, provider: tokenProvider); - - final returnedToken = await tokenManager.loadToken(); - expect(returnedToken, token); - }, - ); - - test( - '`.loadToken` should return refreshed token set via `setProvider`', - () async { - const userId = 'test-user-id'; - final token = Token.development(userId); - final refreshToken = Token.development(userId); - - var refresh = false; - - Future tokenProvider(String userId) async { - if (refresh) return refreshToken.rawValue; - return token.rawValue; - } - - await tokenManager.setTokenOrProvider(userId, provider: tokenProvider); - - final returnedToken = await tokenManager.loadToken(); - expect(returnedToken, token); - - refresh = true; - final returnedRefreshToken = await tokenManager.loadToken(refresh: true); - expect(returnedRefreshToken, refreshToken); - }, - ); - - test('`.reset` should reset the tokenManager', () async { - const userId = 'test-user-id'; - final token = Token.development(userId); - await tokenManager.setTokenOrProvider(userId, token: token); - expect(tokenManager.userId, userId); - - tokenManager.reset(); - expect(tokenManager.userId, isNull); - }); -} diff --git a/packages/stream_chat/test/src/core/http/token_test.dart b/packages/stream_chat/test/src/core/http/token_test.dart deleted file mode 100644 index 543ffda6ba..0000000000 --- a/packages/stream_chat/test/src/core/http/token_test.dart +++ /dev/null @@ -1,56 +0,0 @@ -import 'package:stream_chat/src/core/http/token.dart'; -import 'package:stream_chat/stream_chat.dart'; -import 'package:test/test.dart'; - -void main() { - test('`.anonymous` should create anonymous token with passed userId', () { - const userId = 'test-user-id'; - final token = Token.anonymous(userId: userId); - expect(token, isNotNull); - expect(token.userId, userId); - expect(token.rawValue, isEmpty); - expect(token.authType, AuthType.anonymous); - expect(token.authType.name, AuthType.anonymous.name); - }); - - test('`.fromRawValue` should create token from rawValue', () { - const userId = 'test-user-id'; - final devToken = Token.development(userId); - final token = Token.fromRawValue(devToken.rawValue); - expect(token, devToken); - }); - - test('`.fromRawValue` should throw if does not contain `user_id`', () { - const badToken = 'bad-token-without-a-user-id'; - try { - Token.fromRawValue(badToken); - } catch (e) { - expect(e, isA()); - } - }); - - test('`.development` should create a dev-token with provided user-id', () { - const userId = 'test-user-id'; - final token = Token.development(userId); - expect(token, isNotNull); - expect(token.userId, userId); - expect(token.rawValue, isNotEmpty); - expect(token.authType, AuthType.jwt); - expect(token.authType.name, AuthType.jwt.name); - }); - - test( - '`.guest` should create a guest-token with provided user and provider', - () async { - final user = User(id: 'test-user-id'); - Future provider(User user) async => Token.development(user.id).rawValue; - - final token = await Token.guest(user, provider); - expect(token, isNotNull); - expect(token.userId, user.id); - expect(token.rawValue, isNotEmpty); - expect(token.authType, AuthType.jwt); - expect(token.authType.name, AuthType.jwt.name); - }, - ); -} diff --git a/packages/stream_chat/test/src/core/util/in_flight_cache_test.dart b/packages/stream_chat/test/src/core/util/in_flight_cache_test.dart deleted file mode 100644 index 76fbcef433..0000000000 --- a/packages/stream_chat/test/src/core/util/in_flight_cache_test.dart +++ /dev/null @@ -1,110 +0,0 @@ -import 'package:stream_chat/src/core/util/in_flight_cache.dart'; -import 'package:test/test.dart'; - -void main() { - group('InFlightCache', () { - test('coalesces concurrent identical calls into a single invocation', () async { - final cache = InFlightCache(); - var invocations = 0; - - Future work() async { - invocations++; - await Future.delayed(const Duration(milliseconds: 50)); - return 42; - } - - // Fire 5 concurrent calls for the same key in the same tick. - final results = await Future.wait( - List.generate(5, (_) => cache.run('key', work)), - ); - - expect(invocations, 1); - expect(results, everyElement(42)); - }); - - test('different keys do not share', () async { - final cache = InFlightCache(); - var invocations = 0; - - Future work() async { - invocations++; - await Future.delayed(const Duration(milliseconds: 50)); - return invocations; - } - - await Future.wait([cache.run('a', work), cache.run('b', work)]); - - expect(invocations, 2); - }); - - test('frees the slot once the future settles', () async { - final cache = InFlightCache(); - var invocations = 0; - - Future work() async => ++invocations; - - final first = await cache.run('key', work); - final second = await cache.run('key', work); - - // Sequential calls each invoke the work — only concurrent callers share. - expect(invocations, 2); - expect(first, 1); - expect(second, 2); - }); - - test('concurrent calls share the same error', () async { - final cache = InFlightCache(); - var invocations = 0; - - Future work() async { - invocations++; - await Future.delayed(const Duration(milliseconds: 50)); - throw StateError('boom'); - } - - final errors = await Future.wait( - List.generate(5, (_) async { - try { - await cache.run('key', work); - return null; - } catch (e) { - return e; - } - }), - ); - - expect(invocations, 1); - expect(errors, hasLength(5)); - for (final error in errors) { - expect(error, isA()); - } - }); - - test('a sequential call after a failed call invokes work again', () async { - final cache = InFlightCache(); - var invocations = 0; - - Future work() async { - invocations++; - if (invocations == 1) throw StateError('boom'); - return invocations; - } - - await expectLater(cache.run('key', work), throwsStateError); - final second = await cache.run('key', work); - - expect(invocations, 2); - expect(second, 2); - }); - - test('synchronous throws inside work are wrapped as rejected futures', () async { - final cache = InFlightCache(); - - Future work() { - throw StateError('sync throw'); - } - - await expectLater(cache.run('key', work), throwsStateError); - }); - }); -} diff --git a/packages/stream_chat/test/src/core/util/message_rules_test.dart b/packages/stream_chat/test/src/core/util/message_rules_test.dart index 115f35ec21..848adf0ea1 100644 --- a/packages/stream_chat/test/src/core/util/message_rules_test.dart +++ b/packages/stream_chat/test/src/core/util/message_rules_test.dart @@ -688,12 +688,6 @@ void main() { // region Test Helpers -Logger _createLogger(String name) { - final logger = Logger.detached(name)..level = Level.ALL; - logger.onRecord.listen(print); - return logger; -} - StreamChatClient _createMockClient({ OwnUser? currentUser, bool isLocalUnreadCountEnabled = false, @@ -702,10 +696,6 @@ StreamChatClient _createMockClient({ final clientState = FakeClientState(currentUser: currentUser); when(() => client.state).thenReturn(clientState); - when(() => client.detachedLogger(any())).thenAnswer((invocation) { - return _createLogger(invocation.positionalArguments.first as String); - }); - when(() => client.logger).thenReturn(_createLogger('mock-client-logger')); when(() => client.retryPolicy).thenReturn( RetryPolicy(shouldRetry: (_, __, ___) => false), ); diff --git a/packages/stream_chat/test/src/fakes.dart b/packages/stream_chat/test/src/fakes.dart index 3a919eb879..04b90ab5a8 100644 --- a/packages/stream_chat/test/src/fakes.dart +++ b/packages/stream_chat/test/src/fakes.dart @@ -12,31 +12,32 @@ import 'package:stream_chat/src/core/api/polls_api.dart'; import 'package:stream_chat/src/core/api/roles_api.dart'; import 'package:stream_chat/src/core/api/user_api.dart'; import 'package:stream_chat/src/core/api/user_groups_api.dart'; -import 'package:stream_chat/src/core/http/token.dart'; -import 'package:stream_chat/src/core/http/token_manager.dart'; import 'package:stream_chat/src/ws/websocket.dart'; import 'package:stream_chat/stream_chat.dart'; import 'mocks.dart'; +import 'utils.dart'; class FakeTokenManager extends Fake implements TokenManager { - final token = Token.development('test-user-id'); + final token = testUserToken('test-user-id'); @override - bool get isStatic => true; + bool get usesStaticProvider => true; @override String? get userId => token.userId; @override - Future loadToken({bool refresh = false}) async => token; + UserToken? peekToken() => token; @override - Future setTokenOrProvider( - String userId, { - Token? token, - TokenProvider? provider, - }) async => this.token; + Future getToken() async => token; + + @override + void setTokenProvider(String userId, {required TokenProvider tokenProvider}) {} + + @override + void expireToken() {} @override void reset() {} diff --git a/packages/stream_chat/test/src/mocks.dart b/packages/stream_chat/test/src/mocks.dart index e248766ac3..d34cfd3942 100644 --- a/packages/stream_chat/test/src/mocks.dart +++ b/packages/stream_chat/test/src/mocks.dart @@ -1,5 +1,4 @@ import 'package:dio/dio.dart'; -import 'package:logging/logging.dart'; import 'package:mocktail/mocktail.dart'; import 'package:stream_chat/src/client/channel/channel.dart'; import 'package:stream_chat/src/client/channel_delivery_reporter.dart'; @@ -17,13 +16,13 @@ import 'package:stream_chat/src/core/api/user_api.dart'; import 'package:stream_chat/src/core/api/user_groups_api.dart'; import 'package:stream_chat/src/core/http/connection_id_manager.dart'; import 'package:stream_chat/src/core/http/stream_http_client.dart'; -import 'package:stream_chat/src/core/http/token_manager.dart'; import 'package:stream_chat/src/core/models/channel_config.dart'; import 'package:stream_chat/src/core/models/event.dart'; import 'package:stream_chat/src/core/util/event_controller.dart'; import 'package:stream_chat/src/db/chat_persistence_client.dart'; import 'package:stream_chat/src/event_type.dart'; import 'package:stream_chat/src/ws/websocket.dart'; +import 'package:stream_core/stream_core.dart' show StreamLogger, TokenManager; import 'package:web_socket_channel/web_socket_channel.dart'; class MockWebSocketChannel extends Mock implements WebSocketChannel {} @@ -42,11 +41,6 @@ class MockDio extends Mock implements Dio { Interceptors get interceptors => _interceptors ??= Interceptors(); } -class MockLogger extends Mock implements Logger { - @override - Level get level => Level.ALL; -} - class MockHttpClient extends Mock implements StreamHttpClient {} class MockTokenManager extends Mock implements TokenManager {} @@ -102,6 +96,12 @@ class MockStreamChatClient extends Mock implements StreamChatClient { @override bool get persistenceEnabled => false; + // The real logger rather than a stub: it writes to `StreamLogger`'s global + // handler, so a test that wants the records installs a handler instead of + // reaching for this field. + @override + final StreamLogger logger = const StreamLogger('SCh:Client'); + // A plain settable field (not a `when(...)` stub) so tests can flip it // with a direct assignment, e.g. `client.isLocalUnreadCountEnabled = true`. // Stubbing it via `when()` in this constructor would be re-entrant: this diff --git a/packages/stream_chat/test/src/utils.dart b/packages/stream_chat/test/src/utils.dart index dd3030d94c..00f99785aa 100644 --- a/packages/stream_chat/test/src/utils.dart +++ b/packages/stream_chat/test/src/utils.dart @@ -1,6 +1,8 @@ import 'dart:convert'; import 'dart:io'; +import 'package:stream_chat/stream_chat.dart'; + String fixture(String name) { final dir = currentDirectory.path; return File('$dir/test/fixtures/$name').readAsStringSync(); @@ -29,3 +31,25 @@ extension IntX on num { // Top level util function to delay the code execution Future delay(num milliseconds) => Future.delayed(Duration(milliseconds: milliseconds.toInt())); + +/// Builds the [StreamApiException] a rejected request reports. +/// +/// Defaults describe a request the server refused as malformed, which is the +/// shape most tests want when they only need "the API said no". +StreamApiException apiException({ + StreamErrorCode code = StreamErrorCode.inputError, + int statusCode = 400, + String message = 'The request was rejected', +}) => StreamApiException(message: message, statusCode: statusCode, code: code); + +/// Builds a [UserToken] for [userId], for tests that need a well-formed one. +/// +/// Carries the `devtoken` signature rather than one produced with an app +/// secret, so it parses locally but only a development-tokens app would +/// accept it. +UserToken testUserToken(String userId) { + const header = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9'; + const signature = 'devtoken'; + final payload = base64.encode(utf8.encode(json.encode({'user_id': userId}))); + return UserToken('$header.$payload.$signature'); +} diff --git a/packages/stream_chat/test/src/ws/websocket_test.dart b/packages/stream_chat/test/src/ws/websocket_test.dart index 29f4d246f3..933c94f044 100644 --- a/packages/stream_chat/test/src/ws/websocket_test.dart +++ b/packages/stream_chat/test/src/ws/websocket_test.dart @@ -2,7 +2,6 @@ import 'dart:async'; import 'dart:convert'; import 'package:mocktail/mocktail.dart'; -import 'package:stream_chat/src/core/http/token_manager.dart'; import 'package:stream_chat/src/ws/websocket.dart'; import 'package:stream_chat/stream_chat.dart'; import 'package:test/test.dart'; @@ -540,4 +539,51 @@ void main() { addTearDown(timer.cancel); }); + + test('logs the connect URI with the user token redacted', () async { + final records = []; + StreamLogger.handler = _CapturingHandler(records.add); + StreamLogger.priority = StreamLogPriority.verbose; + addTearDown(StreamLogger.reset); + + final connectedWith = []; + final socket = WebSocket( + apiKey: 'api-key', + baseUrl: 'ws://:8800', + tokenManager: tokenManager, + webSocketChannelProvider: (uri, {protocols}) { + connectedWith.add(uri); + return webSocketChannel; + }, + ); + addTearDown(socket.disconnect); + + final user = OwnUser(id: 'test-user'); + final timer = Timer(const Duration(milliseconds: 300), () { + webSocketSink.add( + json.encode(Event(type: EventType.healthCheck, connectionId: 'test-connection-id', me: user)), + ); + }); + addTearDown(timer.cancel); + + await socket.connect(user); + + final rawToken = (await tokenManager.getToken()).rawValue; + // Compared decoded, so a token that leaked percent-encoded is still caught. + final logged = records.map((it) => Uri.decodeFull(it.message)); + + // The connection itself still carries the token; only the record is redacted. + expect(Uri.decodeFull(connectedWith.single.toString()), contains(rawToken)); + expect(logged, contains(startsWith('[connect] #ws; uri:'))); + expect(logged, everyElement(isNot(contains(rawToken)))); + }); +} + +class _CapturingHandler extends StreamLogHandler { + const _CapturingHandler(this._onRecord); + + final void Function(StreamLogRecord) _onRecord; + + @override + void handle(StreamLogRecord record) => _onRecord(record); } diff --git a/packages/stream_chat_flutter/CHANGELOG.md b/packages/stream_chat_flutter/CHANGELOG.md index 2d3d9b635e..c6d0ff89c5 100644 --- a/packages/stream_chat_flutter/CHANGELOG.md +++ b/packages/stream_chat_flutter/CHANGELOG.md @@ -1,3 +1,13 @@ +## Upcoming Beta + +🛑️ Breaking + +- `errorBuilder` on the paged scroll views (`StreamChannelListView`, `StreamUserListView`, `StreamMemberListView`, `StreamThreadListView`, `StreamPollVoteListView`, `StreamReactionListView`, `StreamMessageSearchListView`, `StreamPhotoGallery` and the grid variants) now receives a `StreamChatException` instead of a `StreamChatError`. + +🔄 Changed + +- The default channel error state keys its copy off the failure kind rather than a transport enum, so "slow connection" now covers every timeout and "no internet" covers every other failure to reach the server. + ## Upcoming ✅ Added diff --git a/packages/stream_chat_flutter/example/lib/main.dart b/packages/stream_chat_flutter/example/lib/main.dart index de8201564d..b36dd62fb4 100644 --- a/packages/stream_chat_flutter/example/lib/main.dart +++ b/packages/stream_chat_flutter/example/lib/main.dart @@ -16,7 +16,7 @@ Future main() async { /// from your project dashboard. final client = StreamChatClient( 's2dxdhpxd94g', - logLevel: Level.OFF, + logConfig: const StreamLogConfig(priority: StreamLogPriority.none), ); /// Set the current user and connect the websocket. In a production diff --git a/packages/stream_chat_flutter/example/lib/split_view.dart b/packages/stream_chat_flutter/example/lib/split_view.dart index 02ff86c320..f6cb40293b 100644 --- a/packages/stream_chat_flutter/example/lib/split_view.dart +++ b/packages/stream_chat_flutter/example/lib/split_view.dart @@ -5,7 +5,7 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart'; Future main() async { final client = StreamChatClient( 's2dxdhpxd94g', - logLevel: Level.INFO, + logConfig: const StreamLogConfig(priority: StreamLogPriority.info), ); await client.connectUser( diff --git a/packages/stream_chat_flutter/example/lib/tutorial_part_1.dart b/packages/stream_chat_flutter/example/lib/tutorial_part_1.dart index c3984888a9..96dffef5cd 100644 --- a/packages/stream_chat_flutter/example/lib/tutorial_part_1.dart +++ b/packages/stream_chat_flutter/example/lib/tutorial_part_1.dart @@ -34,7 +34,7 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart'; Future main() async { final client = StreamChatClient( 'b67pax5b2wdq', - logLevel: Level.INFO, + logConfig: const StreamLogConfig(priority: StreamLogPriority.info), ); await client.connectUser( diff --git a/packages/stream_chat_flutter/example/lib/tutorial_part_2.dart b/packages/stream_chat_flutter/example/lib/tutorial_part_2.dart index 2d41e0938a..78a29a7178 100644 --- a/packages/stream_chat_flutter/example/lib/tutorial_part_2.dart +++ b/packages/stream_chat_flutter/example/lib/tutorial_part_2.dart @@ -32,7 +32,7 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart'; Future main() async { final client = StreamChatClient( 'b67pax5b2wdq', - logLevel: Level.INFO, + logConfig: const StreamLogConfig(priority: StreamLogPriority.info), ); await client.connectUser( diff --git a/packages/stream_chat_flutter/example/lib/tutorial_part_3.dart b/packages/stream_chat_flutter/example/lib/tutorial_part_3.dart index 312ce5c72b..571f3a5be1 100644 --- a/packages/stream_chat_flutter/example/lib/tutorial_part_3.dart +++ b/packages/stream_chat_flutter/example/lib/tutorial_part_3.dart @@ -33,7 +33,7 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart'; Future main() async { final client = StreamChatClient( 'b67pax5b2wdq', - logLevel: Level.INFO, + logConfig: const StreamLogConfig(priority: StreamLogPriority.info), ); await client.connectUser( diff --git a/packages/stream_chat_flutter/example/lib/tutorial_part_4.dart b/packages/stream_chat_flutter/example/lib/tutorial_part_4.dart index 02855ef59e..22db678bc1 100644 --- a/packages/stream_chat_flutter/example/lib/tutorial_part_4.dart +++ b/packages/stream_chat_flutter/example/lib/tutorial_part_4.dart @@ -19,7 +19,7 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart'; Future main() async { final client = StreamChatClient( 'b67pax5b2wdq', - logLevel: Level.INFO, + logConfig: const StreamLogConfig(priority: StreamLogPriority.info), ); await client.connectUser( diff --git a/packages/stream_chat_flutter/example/lib/tutorial_part_5.dart b/packages/stream_chat_flutter/example/lib/tutorial_part_5.dart index d66d0c2f60..b786a53ce5 100644 --- a/packages/stream_chat_flutter/example/lib/tutorial_part_5.dart +++ b/packages/stream_chat_flutter/example/lib/tutorial_part_5.dart @@ -24,7 +24,7 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart'; Future main() async { final client = StreamChatClient( 'b67pax5b2wdq', - logLevel: Level.INFO, + logConfig: const StreamLogConfig(priority: StreamLogPriority.info), ); await client.connectUser( diff --git a/packages/stream_chat_flutter/example/lib/tutorial_part_6.dart b/packages/stream_chat_flutter/example/lib/tutorial_part_6.dart index 7557edc252..42dda0f50a 100644 --- a/packages/stream_chat_flutter/example/lib/tutorial_part_6.dart +++ b/packages/stream_chat_flutter/example/lib/tutorial_part_6.dart @@ -27,7 +27,7 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart'; Future main() async { final client = StreamChatClient( 'b67pax5b2wdq', - logLevel: Level.INFO, + logConfig: const StreamLogConfig(priority: StreamLogPriority.info), ); await client.connectUser( diff --git a/packages/stream_chat_flutter/lib/src/message_input/stream_message_composer.dart b/packages/stream_chat_flutter/lib/src/message_input/stream_message_composer.dart index 83eb01f77b..1e85baeb71 100644 --- a/packages/stream_chat_flutter/lib/src/message_input/stream_message_composer.dart +++ b/packages/stream_chat_flutter/lib/src/message_input/stream_message_composer.dart @@ -1569,15 +1569,17 @@ class DefaultStreamMessageComposerState extends State items: mediaList, nextPageKey: nextKey, ); - } on StreamChatError catch (error) { + } on StreamChatException catch (error) { value = PagedValue.error(error); } catch (error) { - final chatError = StreamChatError(error.toString()); + final chatError = StreamClientException(message: 'Failed to load media', cause: error); value = PagedValue.error(chatError); } } @@ -59,7 +59,7 @@ class StreamPhotoGalleryController extends PagedValueNotifier final assets = await _getRecentAssetPathList(); if (assets == null) { - const chatError = StreamChatError('No media found'); + const chatError = StreamClientException(message: 'No media found'); value = previousValue.copyWith(error: chatError); return; } @@ -76,10 +76,10 @@ class StreamPhotoGalleryController extends PagedValueNotifier items: newItems, nextPageKey: nextKey, ); - } on StreamChatError catch (error) { + } on StreamChatException catch (error) { value = previousValue.copyWith(error: error); } catch (error) { - final chatError = StreamChatError(error.toString()); + final chatError = StreamClientException(message: 'Failed to load more media', cause: error); value = previousValue.copyWith(error: chatError); } } diff --git a/packages/stream_chat_flutter/lib/src/scroll_view/poll_vote_scroll_view/stream_poll_vote_list_view.dart b/packages/stream_chat_flutter/lib/src/scroll_view/poll_vote_scroll_view/stream_poll_vote_list_view.dart index cc6de10644..2d7452fd4f 100644 --- a/packages/stream_chat_flutter/lib/src/scroll_view/poll_vote_scroll_view/stream_poll_vote_list_view.dart +++ b/packages/stream_chat_flutter/lib/src/scroll_view/poll_vote_scroll_view/stream_poll_vote_list_view.dart @@ -92,7 +92,7 @@ class StreamPollVoteListView extends StatelessWidget { final WidgetBuilder? loadingBuilder; /// A builder that is called to build the error state of the list. - final Widget Function(BuildContext, StreamChatError)? errorBuilder; + final Widget Function(BuildContext, StreamChatException)? errorBuilder; /// Called when the list items are tapped. final void Function(PollVote)? onPollVoteTap; diff --git a/packages/stream_chat_flutter/lib/src/scroll_view/reaction_scroll_view/stream_reaction_list_view.dart b/packages/stream_chat_flutter/lib/src/scroll_view/reaction_scroll_view/stream_reaction_list_view.dart index 61ca18000b..25d87125e4 100644 --- a/packages/stream_chat_flutter/lib/src/scroll_view/reaction_scroll_view/stream_reaction_list_view.dart +++ b/packages/stream_chat_flutter/lib/src/scroll_view/reaction_scroll_view/stream_reaction_list_view.dart @@ -78,7 +78,7 @@ class StreamReactionListView extends StatelessWidget { final WidgetBuilder? loadingBuilder; /// A builder that is called to build the error state of the list. - final Widget Function(BuildContext, StreamChatError)? errorBuilder; + final Widget Function(BuildContext, StreamChatException)? errorBuilder; /// The index to take into account when triggering [controller.loadMore]. final int loadMoreTriggerIndex; diff --git a/packages/stream_chat_flutter/lib/src/scroll_view/thread_scroll_view/stream_thread_list_view.dart b/packages/stream_chat_flutter/lib/src/scroll_view/thread_scroll_view/stream_thread_list_view.dart index b2a17b9f03..a208e63dff 100644 --- a/packages/stream_chat_flutter/lib/src/scroll_view/thread_scroll_view/stream_thread_list_view.dart +++ b/packages/stream_chat_flutter/lib/src/scroll_view/thread_scroll_view/stream_thread_list_view.dart @@ -92,7 +92,7 @@ class StreamThreadListView extends StatelessWidget { final WidgetBuilder? loadingBuilder; /// A builder that is called to build the error state of the list. - final Widget Function(BuildContext, StreamChatError)? errorBuilder; + final Widget Function(BuildContext, StreamChatException)? errorBuilder; /// Called when the user taps a thread. final void Function(Thread)? onThreadTap; diff --git a/packages/stream_chat_flutter/lib/src/scroll_view/user_scroll_view/stream_user_grid_view.dart b/packages/stream_chat_flutter/lib/src/scroll_view/user_scroll_view/stream_user_grid_view.dart index 8f9ec78f34..21cb453e0b 100644 --- a/packages/stream_chat_flutter/lib/src/scroll_view/user_scroll_view/stream_user_grid_view.dart +++ b/packages/stream_chat_flutter/lib/src/scroll_view/user_scroll_view/stream_user_grid_view.dart @@ -87,7 +87,7 @@ class StreamUserGridView extends StatelessWidget { final WidgetBuilder? loadingBuilder; /// A builder that is called to build the error state of the grid. - final Widget Function(BuildContext, StreamChatError)? errorBuilder; + final Widget Function(BuildContext, StreamChatException)? errorBuilder; /// Called when the user taps this grid tile. final void Function(User)? onUserTap; diff --git a/packages/stream_chat_flutter/lib/src/scroll_view/user_scroll_view/stream_user_list_view.dart b/packages/stream_chat_flutter/lib/src/scroll_view/user_scroll_view/stream_user_list_view.dart index 6bbf99dd41..450884f689 100644 --- a/packages/stream_chat_flutter/lib/src/scroll_view/user_scroll_view/stream_user_list_view.dart +++ b/packages/stream_chat_flutter/lib/src/scroll_view/user_scroll_view/stream_user_list_view.dart @@ -84,7 +84,7 @@ class StreamUserListView extends StatelessWidget { final WidgetBuilder? loadingBuilder; /// A builder that is called to build the error state of the list. - final Widget Function(BuildContext, StreamChatError)? errorBuilder; + final Widget Function(BuildContext, StreamChatException)? errorBuilder; /// Called when the user taps this list tile. final void Function(User)? onUserTap; diff --git a/packages/stream_chat_flutter/lib/src/utils/extensions.dart b/packages/stream_chat_flutter/lib/src/utils/extensions.dart index a3cc755e77..9588b76ceb 100644 --- a/packages/stream_chat_flutter/lib/src/utils/extensions.dart +++ b/packages/stream_chat_flutter/lib/src/utils/extensions.dart @@ -702,7 +702,7 @@ extension AttachmentPlaylistExtension on Iterable { return [ ...map((it) { final uri = switch (it.uploadState) { - Preparing() || InProgress() || Failed() => () { + UploadStatePreparing() || UploadStateInProgress() || UploadStateFailed() => () { if (CurrentPlatform.isWeb) { final bytes = it.file?.bytes; final mimeType = it.file?.mediaType?.mimeType; @@ -716,7 +716,7 @@ extension AttachmentPlaylistExtension on Iterable { return Uri.file(path, windows: CurrentPlatform.isWindows); }(), - Success() => () { + UploadStateSuccess() => () { final url = it.assetUrl; if (url == null) return null; diff --git a/packages/stream_chat_flutter/lib/src/utils/network_error_text.dart b/packages/stream_chat_flutter/lib/src/utils/network_error_text.dart index 1362a9a277..545d9fc8e2 100644 --- a/packages/stream_chat_flutter/lib/src/utils/network_error_text.dart +++ b/packages/stream_chat_flutter/lib/src/utils/network_error_text.dart @@ -3,11 +3,10 @@ import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; import 'extensions.dart'; -/// Resolves a title and description for [error] based on its transport-level -/// [StreamChatNetworkError.type]. +/// Resolves a title and description for [error]. /// -/// Connection failures map to the "no internet" copy and timeouts to the -/// "slow connection" copy. Everything else falls back to [fallbackTitle] / +/// A request that timed out maps to the "slow connection" copy and any other +/// failure to reach the server to the "no internet" copy. Everything else falls back to [fallbackTitle] / /// [fallbackDescription] when provided, otherwise to the generic localized copy. ({String title, String description}) resolveNetworkErrorText( BuildContext context, @@ -17,14 +16,14 @@ import 'extensions.dart'; }) { final translations = context.translations; return switch (error) { - StreamChatNetworkError(type: .connectionError) => ( - title: translations.connectionErrorTitle, - description: translations.connectionErrorDescription, - ), - StreamChatNetworkError(type: .connectionTimeout || .sendTimeout || .receiveTimeout) => ( + StreamNetworkException(isTimeout: true) => ( title: translations.slowConnectionErrorTitle, description: translations.slowConnectionErrorDescription, ), + StreamNetworkException() => ( + title: translations.connectionErrorTitle, + description: translations.connectionErrorDescription, + ), _ => ( title: fallbackTitle ?? translations.genericErrorTitle, description: fallbackDescription ?? translations.genericErrorDescription, diff --git a/packages/stream_chat_flutter/test/src/stream_chat_default_channel_error_test.dart b/packages/stream_chat_flutter/test/src/stream_chat_default_channel_error_test.dart index 14af2d544e..e65c41953d 100644 --- a/packages/stream_chat_flutter/test/src/stream_chat_default_channel_error_test.dart +++ b/packages/stream_chat_flutter/test/src/stream_chat_default_channel_error_test.dart @@ -16,12 +16,8 @@ void main() { when(() => clientState.currentUser).thenReturn(OwnUser(id: 'user-id')); }); - StreamChatNetworkError dioError(DioExceptionType type) => StreamChatNetworkError.fromDioException( - DioException( - requestOptions: RequestOptions(path: '/'), - type: type, - ), - ); + StreamNetworkException transportFailure({bool isTimeout = false}) => + StreamNetworkException(message: 'the request failed', isTimeout: isTimeout); // Pumps StreamChat and renders the default error state it installs for the // given [error], via DefaultStreamChannelBuilders.errorBuilderOf. @@ -45,7 +41,7 @@ void main() { group('default channel error builder installed by StreamChat', () { testWidgets('shows the no-internet copy for connection errors', (tester) async { - await pumpDefaultError(tester, dioError(DioExceptionType.connectionError)); + await pumpDefaultError(tester, transportFailure()); expect(find.byType(StreamScrollViewErrorWidget), findsOneWidget); expect(find.text('No Internet Connection'), findsOneWidget); @@ -54,7 +50,7 @@ void main() { }); testWidgets('shows the slow-connection copy for timeouts', (tester) async { - await pumpDefaultError(tester, dioError(DioExceptionType.receiveTimeout)); + await pumpDefaultError(tester, transportFailure(isTimeout: true)); expect(find.text('Slow Internet Connection'), findsOneWidget); expect( @@ -64,8 +60,8 @@ void main() { }); testWidgets('shows a generic message and never the raw error', (tester) async { - final error = StreamChatNetworkError.raw( - code: -1, + const error = StreamApiException( + code: StreamErrorCode.internalError, message: 'super secret internal failure', statusCode: 500, ); diff --git a/packages/stream_chat_flutter_core/CHANGELOG.md b/packages/stream_chat_flutter_core/CHANGELOG.md index baac1765f4..fcc4320e50 100644 --- a/packages/stream_chat_flutter_core/CHANGELOG.md +++ b/packages/stream_chat_flutter_core/CHANGELOG.md @@ -1,3 +1,9 @@ +## Upcoming Beta + +🛑️ Breaking + +- `PagedValue.error` and every `errorBuilder` now carry a `StreamChatException` instead of a `StreamChatError`, following the low-level client's error layer. A generic throwable is reported as a `StreamClientException` naming the load that failed, with the original kept as its `cause` rather than stringified into the message. + ## 10.4.0 🔄 Changed diff --git a/packages/stream_chat_flutter_core/lib/src/paged_value_notifier.dart b/packages/stream_chat_flutter_core/lib/src/paged_value_notifier.dart index 7da82ff364..30adcb2da9 100644 --- a/packages/stream_chat_flutter_core/lib/src/paged_value_notifier.dart +++ b/packages/stream_chat_flutter_core/lib/src/paged_value_notifier.dart @@ -1,6 +1,6 @@ import 'package:flutter/widgets.dart' hide Key; import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:stream_chat/stream_chat.dart' show StreamChatError; +import 'package:stream_chat/stream_chat.dart' show StreamChatException; part 'paged_value_notifier.freezed.dart'; @@ -133,7 +133,7 @@ sealed class PagedValue with _$PagedValue { Key? nextPageKey, /// The current error, if any. - StreamChatError? error, + StreamChatException? error, }) = Success; const PagedValue._(); @@ -142,7 +142,7 @@ sealed class PagedValue with _$PagedValue { const factory PagedValue.loading() = Loading; /// Represents the error state of the [PagedValue]. - const factory PagedValue.error(StreamChatError error) = Error; + const factory PagedValue.error(StreamChatException error) = Error; /// Returns `true` if the [PagedValue] is [Success]. bool get isSuccess => this is Success; @@ -184,11 +184,11 @@ extension PagedValuePatternMatching on PagedValue { TResult Function( List items, Key? nextPageKey, - StreamChatError? error, + StreamChatException? error, ) success, { required TResult Function() loading, - required TResult Function(StreamChatError error) error, + required TResult Function(StreamChatException error) error, }) { final pagedValue = this; return switch (pagedValue) { @@ -208,11 +208,11 @@ extension PagedValuePatternMatching on PagedValue { TResult Function( List items, Key? nextPageKey, - StreamChatError? error, + StreamChatException? error, )? success, { TResult? Function()? loading, - TResult? Function(StreamChatError error)? error, + TResult? Function(StreamChatException error)? error, }) { final pagedValue = this; return switch (pagedValue) { @@ -232,11 +232,11 @@ extension PagedValuePatternMatching on PagedValue { TResult Function( List items, Key? nextPageKey, - StreamChatError? error, + StreamChatException? error, )? success, { TResult Function()? loading, - TResult Function(StreamChatError error)? error, + TResult Function(StreamChatException error)? error, required TResult orElse(), }) { final pagedValue = this; diff --git a/packages/stream_chat_flutter_core/lib/src/paged_value_notifier.freezed.dart b/packages/stream_chat_flutter_core/lib/src/paged_value_notifier.freezed.dart index ac7377a96d..b9f31bd3c5 100644 --- a/packages/stream_chat_flutter_core/lib/src/paged_value_notifier.freezed.dart +++ b/packages/stream_chat_flutter_core/lib/src/paged_value_notifier.freezed.dart @@ -11,194 +11,213 @@ part of 'paged_value_notifier.dart'; // dart format off T _$identity(T value) => value; - /// @nodoc -mixin _$PagedValue { - @override - bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType && other is PagedValue); - } +mixin _$PagedValue { + + + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is PagedValue); +} + + +@override +int get hashCode => runtimeType.hashCode; + +@override +String toString() { + return 'PagedValue<$Key, $Value>()'; +} - @override - int get hashCode => runtimeType.hashCode; - @override - String toString() { - return 'PagedValue<$Key, $Value>()'; - } } /// @nodoc -class $PagedValueCopyWith { - $PagedValueCopyWith(PagedValue _, $Res Function(PagedValue) __); +class $PagedValueCopyWith { +$PagedValueCopyWith(PagedValue _, $Res Function(PagedValue) __); } + + /// @nodoc -class Success extends PagedValue { - const Success({required final List items, this.nextPageKey, this.error}) - : _items = items, - super._(); - - /// List with all items loaded so far. - final List _items; - - /// List with all items loaded so far. - List get items { - if (_items is EqualUnmodifiableListView) return _items; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(_items); - } - - /// The key for the next page to be fetched. - final Key? nextPageKey; - - /// The current error, if any. - final StreamChatError? error; - - /// Create a copy of PagedValue - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $SuccessCopyWith> get copyWith => - _$SuccessCopyWithImpl>(this, _$identity); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is Success && - const DeepCollectionEquality().equals(other._items, _items) && - const DeepCollectionEquality().equals(other.nextPageKey, nextPageKey) && - (identical(other.error, error) || other.error == error)); - } - - @override - int get hashCode => Object.hash(runtimeType, const DeepCollectionEquality().hash(_items), - const DeepCollectionEquality().hash(nextPageKey), error); - - @override - String toString() { - return 'PagedValue<$Key, $Value>(items: $items, nextPageKey: $nextPageKey, error: $error)'; - } + +class Success extends PagedValue { + const Success({required final List items, this.nextPageKey, this.error}): _items = items,super._(); + + +/// List with all items loaded so far. + final List _items; +/// List with all items loaded so far. + List get items { + if (_items is EqualUnmodifiableListView) return _items; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_items); +} + +/// The key for the next page to be fetched. + final Key? nextPageKey; +/// The current error, if any. + final StreamChatException? error; + +/// Create a copy of PagedValue +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$SuccessCopyWith> get copyWith => _$SuccessCopyWithImpl>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is Success&&const DeepCollectionEquality().equals(other._items, _items)&&const DeepCollectionEquality().equals(other.nextPageKey, nextPageKey)&&(identical(other.error, error) || other.error == error)); +} + + +@override +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_items),const DeepCollectionEquality().hash(nextPageKey),error); + +@override +String toString() { + return 'PagedValue<$Key, $Value>(items: $items, nextPageKey: $nextPageKey, error: $error)'; +} + + } /// @nodoc -abstract mixin class $SuccessCopyWith implements $PagedValueCopyWith { +abstract mixin class $SuccessCopyWith implements $PagedValueCopyWith { factory $SuccessCopyWith(Success value, $Res Function(Success) _then) = _$SuccessCopyWithImpl; - @useResult - $Res call({List items, Key? nextPageKey, StreamChatError? error}); -} +@useResult +$Res call({ + List items, Key? nextPageKey, StreamChatException? error +}); + + + +} /// @nodoc -class _$SuccessCopyWithImpl implements $SuccessCopyWith { +class _$SuccessCopyWithImpl + implements $SuccessCopyWith { _$SuccessCopyWithImpl(this._self, this._then); final Success _self; final $Res Function(Success) _then; - /// Create a copy of PagedValue - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - $Res call({ - Object? items = null, - Object? nextPageKey = freezed, - Object? error = freezed, - }) { - return _then(Success( - items: null == items - ? _self._items - : items // ignore: cast_nullable_to_non_nullable - as List, - nextPageKey: freezed == nextPageKey - ? _self.nextPageKey - : nextPageKey // ignore: cast_nullable_to_non_nullable - as Key?, - error: freezed == error - ? _self.error - : error // ignore: cast_nullable_to_non_nullable - as StreamChatError?, - )); - } +/// Create a copy of PagedValue +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? items = null,Object? nextPageKey = freezed,Object? error = freezed,}) { + return _then(Success( +items: null == items ? _self._items : items // ignore: cast_nullable_to_non_nullable +as List,nextPageKey: freezed == nextPageKey ? _self.nextPageKey : nextPageKey // ignore: cast_nullable_to_non_nullable +as Key?,error: freezed == error ? _self.error : error // ignore: cast_nullable_to_non_nullable +as StreamChatException?, + )); +} + + } /// @nodoc -class Loading extends PagedValue { - const Loading() : super._(); - @override - bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType && other is Loading); - } +class Loading extends PagedValue { + const Loading(): super._(); + + + - @override - int get hashCode => runtimeType.hashCode; - @override - String toString() { - return 'PagedValue<$Key, $Value>.loading()'; - } + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is Loading); } + +@override +int get hashCode => runtimeType.hashCode; + +@override +String toString() { + return 'PagedValue<$Key, $Value>.loading()'; +} + + +} + + + + /// @nodoc -class Error extends PagedValue { - const Error(this.error) : super._(); - final StreamChatError error; +class Error extends PagedValue { + const Error(this.error): super._(); + - /// Create a copy of PagedValue - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $ErrorCopyWith> get copyWith => - _$ErrorCopyWithImpl>(this, _$identity); + final StreamChatException error; - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is Error && - (identical(other.error, error) || other.error == error)); - } +/// Create a copy of PagedValue +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$ErrorCopyWith> get copyWith => _$ErrorCopyWithImpl>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is Error&&(identical(other.error, error) || other.error == error)); +} + + +@override +int get hashCode => Object.hash(runtimeType,error); + +@override +String toString() { + return 'PagedValue<$Key, $Value>.error(error: $error)'; +} - @override - int get hashCode => Object.hash(runtimeType, error); - @override - String toString() { - return 'PagedValue<$Key, $Value>.error(error: $error)'; - } } /// @nodoc -abstract mixin class $ErrorCopyWith implements $PagedValueCopyWith { +abstract mixin class $ErrorCopyWith implements $PagedValueCopyWith { factory $ErrorCopyWith(Error value, $Res Function(Error) _then) = _$ErrorCopyWithImpl; - @useResult - $Res call({StreamChatError error}); -} +@useResult +$Res call({ + StreamChatException error +}); + + + +} /// @nodoc -class _$ErrorCopyWithImpl implements $ErrorCopyWith { +class _$ErrorCopyWithImpl + implements $ErrorCopyWith { _$ErrorCopyWithImpl(this._self, this._then); final Error _self; final $Res Function(Error) _then; - /// Create a copy of PagedValue - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - $Res call({ - Object? error = null, - }) { - return _then(Error( - null == error - ? _self.error - : error // ignore: cast_nullable_to_non_nullable - as StreamChatError, - )); - } +/// Create a copy of PagedValue +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? error = null,}) { + return _then(Error( +null == error ? _self.error : error // ignore: cast_nullable_to_non_nullable +as StreamChatException, + )); +} + + } // dart format on diff --git a/packages/stream_chat_flutter_core/lib/src/paged_value_scroll_view.dart b/packages/stream_chat_flutter_core/lib/src/paged_value_scroll_view.dart index 813dbf712f..f51b674e29 100644 --- a/packages/stream_chat_flutter_core/lib/src/paged_value_scroll_view.dart +++ b/packages/stream_chat_flutter_core/lib/src/paged_value_scroll_view.dart @@ -17,7 +17,7 @@ typedef PagedValueScrollViewIndexedWidgetBuilder = typedef PagedValueScrollViewLoadMoreErrorBuilder = Widget Function( BuildContext context, - StreamChatError error, + StreamChatException error, ); /// A [ListView] that loads more pages when the user scrolls to the end of the @@ -79,7 +79,7 @@ class PagedValueListView extends StatefulWidget { final WidgetBuilder loadingBuilder; /// A builder that is called to build the error state of the list. - final Widget Function(BuildContext, StreamChatError) errorBuilder; + final Widget Function(BuildContext, StreamChatException) errorBuilder; /// The index to take into account when triggering [controller.loadMore]. final int loadMoreTriggerIndex; @@ -410,7 +410,7 @@ class PagedValueGridView extends StatefulWidget { final WidgetBuilder loadingBuilder; /// A builder that is called to build the error state of the list. - final Widget Function(BuildContext, StreamChatError) errorBuilder; + final Widget Function(BuildContext, StreamChatException) errorBuilder; /// The index to take into account when triggering [controller.loadMore]. final int loadMoreTriggerIndex; diff --git a/packages/stream_chat_flutter_core/lib/src/search_debounce_mixin.dart b/packages/stream_chat_flutter_core/lib/src/search_debounce_mixin.dart index 14915b0261..773cf94503 100644 --- a/packages/stream_chat_flutter_core/lib/src/search_debounce_mixin.dart +++ b/packages/stream_chat_flutter_core/lib/src/search_debounce_mixin.dart @@ -21,7 +21,7 @@ import 'search_debouncer.dart'; /// final response = await _fetch(); /// if (isStale(generation)) return; /// value = PagedValue(items: response.items); -/// } on StreamChatError catch (error) { +/// } on StreamChatException catch (error) { /// if (isStale(generation)) return; /// value = PagedValue.error(error); /// } diff --git a/packages/stream_chat_flutter_core/lib/src/stream_channel.dart b/packages/stream_chat_flutter_core/lib/src/stream_channel.dart index 4085138f58..66c483c2a7 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_channel.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_channel.dart @@ -1011,14 +1011,14 @@ class DefaultStreamChannelBuilders extends InheritedWidget { // translations, so copy/styling are hardcoded. Apps can override with // [StreamChannel.errorBuilder] for a themed, localized state. final (title, message) = switch (error) { - StreamChatNetworkError(type: .connectionError) => ( - 'No Internet Connection', - 'Please check your internet connection', - ), - StreamChatNetworkError(type: .connectionTimeout || .sendTimeout || .receiveTimeout) => ( + StreamNetworkException(isTimeout: true) => ( 'Slow Internet Connection', 'There seems to be a problem with your internet connection', ), + StreamNetworkException() => ( + 'No Internet Connection', + 'Please check your internet connection', + ), _ => ('Error', 'Oops, something went wrong'), }; diff --git a/packages/stream_chat_flutter_core/lib/src/stream_channel_list_controller.dart b/packages/stream_chat_flutter_core/lib/src/stream_channel_list_controller.dart index ee50327164..35cfe32be3 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_channel_list_controller.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_channel_list_controller.dart @@ -201,10 +201,10 @@ class StreamChannelListController extends PagedValueNotifier { // start listening to events if (disposed) return; _subscribeToChannelListEvents(); - } on StreamChatError catch (error) { + } on StreamChatException catch (error) { value = PagedValue.error(error); } catch (error) { - final chatError = StreamChatError(error.toString()); + final chatError = StreamClientException(message: 'Failed to load channels', cause: error); value = PagedValue.error(chatError); } } @@ -234,10 +234,10 @@ class StreamChannelListController extends PagedValueNotifier { nextPageKey: nextKey, ); } - } on StreamChatError catch (error) { + } on StreamChatException catch (error) { value = previousValue.copyWith(error: error); } catch (error) { - final chatError = StreamChatError(error.toString()); + final chatError = StreamClientException(message: 'Failed to load more channels', cause: error); value = previousValue.copyWith(error: chatError); } } diff --git a/packages/stream_chat_flutter_core/lib/src/stream_draft_list_controller.dart b/packages/stream_chat_flutter_core/lib/src/stream_draft_list_controller.dart index 4d4c3744b6..e95a06cbd0 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_draft_list_controller.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_draft_list_controller.dart @@ -124,10 +124,10 @@ class StreamDraftListController extends PagedValueNotifier { // Start listening to events if (disposed) return; _subscribeToDraftListEvents(); - } on StreamChatError catch (error) { + } on StreamChatException catch (error) { value = PagedValue.error(error); } catch (error) { - final chatError = StreamChatError(error.toString()); + final chatError = StreamClientException(message: 'Failed to load drafts', cause: error); value = PagedValue.error(chatError); } } @@ -152,10 +152,10 @@ class StreamDraftListController extends PagedValueNotifier { items: newItems, nextPageKey: nextKey, ); - } on StreamChatError catch (error) { + } on StreamChatException catch (error) { value = previousValue.copyWith(error: error); } catch (error) { - final chatError = StreamChatError(error.toString()); + final chatError = StreamClientException(message: 'Failed to load more drafts', cause: error); value = previousValue.copyWith(error: chatError); } } diff --git a/packages/stream_chat_flutter_core/lib/src/stream_member_list_controller.dart b/packages/stream_chat_flutter_core/lib/src/stream_member_list_controller.dart index d9d276057b..5e10b7164d 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_member_list_controller.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_member_list_controller.dart @@ -163,12 +163,12 @@ class StreamMemberListController extends PagedValueNotifier with Se items: members.where((it) => it.user != null).toList(), nextPageKey: nextKey, ); - } on StreamChatError catch (error) { + } on StreamChatException catch (error) { if (isStale(generation)) return; value = PagedValue.error(error); } catch (error) { if (isStale(generation)) return; - final chatError = StreamChatError(error.toString()); + final chatError = StreamClientException(message: 'Failed to load members', cause: error); value = PagedValue.error(chatError); } } @@ -196,12 +196,12 @@ class StreamMemberListController extends PagedValueNotifier with Se items: newItems.where((it) => it.user != null).toList(), nextPageKey: nextKey, ); - } on StreamChatError catch (error) { + } on StreamChatException catch (error) { if (isStale(generation)) return; value = previousValue.copyWith(error: error); } catch (error) { if (isStale(generation)) return; - final chatError = StreamChatError(error.toString()); + final chatError = StreamClientException(message: 'Failed to load more members', cause: error); value = previousValue.copyWith(error: chatError); } } diff --git a/packages/stream_chat_flutter_core/lib/src/stream_message_reminder_list_controller.dart b/packages/stream_chat_flutter_core/lib/src/stream_message_reminder_list_controller.dart index ab05f77920..dde63416fd 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_message_reminder_list_controller.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_message_reminder_list_controller.dart @@ -127,10 +127,10 @@ class StreamMessageReminderListController extends PagedValueNotifier(T value) => value; - /// @nodoc mixin _$PollValidationError { - @override - bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType && other is PollValidationError); - } - - @override - int get hashCode => runtimeType.hashCode; - - @override - String toString() { - return 'PollValidationError()'; - } + + + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is PollValidationError); +} + + +@override +int get hashCode => runtimeType.hashCode; + +@override +String toString() { + return 'PollValidationError()'; +} + + } /// @nodoc -class $PollValidationErrorCopyWith<$Res> { - $PollValidationErrorCopyWith(PollValidationError _, $Res Function(PollValidationError) __); +class $PollValidationErrorCopyWith<$Res> { +$PollValidationErrorCopyWith(PollValidationError _, $Res Function(PollValidationError) __); } + + /// @nodoc + class _PollValidationErrorDuplicateOptions implements PollValidationError { - const _PollValidationErrorDuplicateOptions(final List options) : _options = options; - - final List _options; - List get options { - if (_options is EqualUnmodifiableListView) return _options; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(_options); - } - - /// Create a copy of PollValidationError - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$PollValidationErrorDuplicateOptionsCopyWith<_PollValidationErrorDuplicateOptions> get copyWith => - __$PollValidationErrorDuplicateOptionsCopyWithImpl<_PollValidationErrorDuplicateOptions>(this, _$identity); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _PollValidationErrorDuplicateOptions && - const DeepCollectionEquality().equals(other._options, _options)); - } - - @override - int get hashCode => Object.hash(runtimeType, const DeepCollectionEquality().hash(_options)); - - @override - String toString() { - return 'PollValidationError.duplicateOptions(options: $options)'; - } + const _PollValidationErrorDuplicateOptions(final List options): _options = options; + + + final List _options; + List get options { + if (_options is EqualUnmodifiableListView) return _options; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_options); +} + + +/// Create a copy of PollValidationError +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$PollValidationErrorDuplicateOptionsCopyWith<_PollValidationErrorDuplicateOptions> get copyWith => __$PollValidationErrorDuplicateOptionsCopyWithImpl<_PollValidationErrorDuplicateOptions>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _PollValidationErrorDuplicateOptions&&const DeepCollectionEquality().equals(other._options, _options)); +} + + +@override +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_options)); + +@override +String toString() { + return 'PollValidationError.duplicateOptions(options: $options)'; +} + + } /// @nodoc abstract mixin class _$PollValidationErrorDuplicateOptionsCopyWith<$Res> implements $PollValidationErrorCopyWith<$Res> { - factory _$PollValidationErrorDuplicateOptionsCopyWith( - _PollValidationErrorDuplicateOptions value, $Res Function(_PollValidationErrorDuplicateOptions) _then) = - __$PollValidationErrorDuplicateOptionsCopyWithImpl; - @useResult - $Res call({List options}); -} + factory _$PollValidationErrorDuplicateOptionsCopyWith(_PollValidationErrorDuplicateOptions value, $Res Function(_PollValidationErrorDuplicateOptions) _then) = __$PollValidationErrorDuplicateOptionsCopyWithImpl; +@useResult +$Res call({ + List options +}); + + + +} /// @nodoc class __$PollValidationErrorDuplicateOptionsCopyWithImpl<$Res> implements _$PollValidationErrorDuplicateOptionsCopyWith<$Res> { @@ -86,207 +102,207 @@ class __$PollValidationErrorDuplicateOptionsCopyWithImpl<$Res> final _PollValidationErrorDuplicateOptions _self; final $Res Function(_PollValidationErrorDuplicateOptions) _then; - /// Create a copy of PollValidationError - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - $Res call({ - Object? options = null, - }) { - return _then(_PollValidationErrorDuplicateOptions( - null == options - ? _self._options - : options // ignore: cast_nullable_to_non_nullable - as List, - )); - } +/// Create a copy of PollValidationError +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? options = null,}) { + return _then(_PollValidationErrorDuplicateOptions( +null == options ? _self._options : options // ignore: cast_nullable_to_non_nullable +as List, + )); +} + + } /// @nodoc + class _PollValidationErrorNameRange implements PollValidationError { const _PollValidationErrorNameRange(this.name, {required this.range}); + + + final String name; + final Range range; + +/// Create a copy of PollValidationError +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$PollValidationErrorNameRangeCopyWith<_PollValidationErrorNameRange> get copyWith => __$PollValidationErrorNameRangeCopyWithImpl<_PollValidationErrorNameRange>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _PollValidationErrorNameRange&&(identical(other.name, name) || other.name == name)&&(identical(other.range, range) || other.range == range)); +} + + +@override +int get hashCode => Object.hash(runtimeType,name,range); + +@override +String toString() { + return 'PollValidationError.nameRange(name: $name, range: $range)'; +} + - final String name; - final Range range; - - /// Create a copy of PollValidationError - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$PollValidationErrorNameRangeCopyWith<_PollValidationErrorNameRange> get copyWith => - __$PollValidationErrorNameRangeCopyWithImpl<_PollValidationErrorNameRange>(this, _$identity); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _PollValidationErrorNameRange && - (identical(other.name, name) || other.name == name) && - (identical(other.range, range) || other.range == range)); - } - - @override - int get hashCode => Object.hash(runtimeType, name, range); - - @override - String toString() { - return 'PollValidationError.nameRange(name: $name, range: $range)'; - } } /// @nodoc abstract mixin class _$PollValidationErrorNameRangeCopyWith<$Res> implements $PollValidationErrorCopyWith<$Res> { - factory _$PollValidationErrorNameRangeCopyWith( - _PollValidationErrorNameRange value, $Res Function(_PollValidationErrorNameRange) _then) = - __$PollValidationErrorNameRangeCopyWithImpl; - @useResult - $Res call({String name, Range range}); -} + factory _$PollValidationErrorNameRangeCopyWith(_PollValidationErrorNameRange value, $Res Function(_PollValidationErrorNameRange) _then) = __$PollValidationErrorNameRangeCopyWithImpl; +@useResult +$Res call({ + String name, Range range +}); + + + +} /// @nodoc -class __$PollValidationErrorNameRangeCopyWithImpl<$Res> implements _$PollValidationErrorNameRangeCopyWith<$Res> { +class __$PollValidationErrorNameRangeCopyWithImpl<$Res> + implements _$PollValidationErrorNameRangeCopyWith<$Res> { __$PollValidationErrorNameRangeCopyWithImpl(this._self, this._then); final _PollValidationErrorNameRange _self; final $Res Function(_PollValidationErrorNameRange) _then; - /// Create a copy of PollValidationError - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - $Res call({ - Object? name = null, - Object? range = null, - }) { - return _then(_PollValidationErrorNameRange( - null == name - ? _self.name - : name // ignore: cast_nullable_to_non_nullable - as String, - range: null == range - ? _self.range - : range // ignore: cast_nullable_to_non_nullable - as Range, - )); - } +/// Create a copy of PollValidationError +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? name = null,Object? range = null,}) { + return _then(_PollValidationErrorNameRange( +null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable +as String,range: null == range ? _self.range : range // ignore: cast_nullable_to_non_nullable +as Range, + )); +} + + } /// @nodoc + class _PollValidationErrorOptionsRange implements PollValidationError { - const _PollValidationErrorOptionsRange(final List options, {required this.range}) : _options = options; - - final List _options; - List get options { - if (_options is EqualUnmodifiableListView) return _options; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(_options); - } - - final Range range; - - /// Create a copy of PollValidationError - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$PollValidationErrorOptionsRangeCopyWith<_PollValidationErrorOptionsRange> get copyWith => - __$PollValidationErrorOptionsRangeCopyWithImpl<_PollValidationErrorOptionsRange>(this, _$identity); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _PollValidationErrorOptionsRange && - const DeepCollectionEquality().equals(other._options, _options) && - (identical(other.range, range) || other.range == range)); - } - - @override - int get hashCode => Object.hash(runtimeType, const DeepCollectionEquality().hash(_options), range); - - @override - String toString() { - return 'PollValidationError.optionsRange(options: $options, range: $range)'; - } + const _PollValidationErrorOptionsRange(final List options, {required this.range}): _options = options; + + + final List _options; + List get options { + if (_options is EqualUnmodifiableListView) return _options; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_options); +} + + final Range range; + +/// Create a copy of PollValidationError +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$PollValidationErrorOptionsRangeCopyWith<_PollValidationErrorOptionsRange> get copyWith => __$PollValidationErrorOptionsRangeCopyWithImpl<_PollValidationErrorOptionsRange>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _PollValidationErrorOptionsRange&&const DeepCollectionEquality().equals(other._options, _options)&&(identical(other.range, range) || other.range == range)); +} + + +@override +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_options),range); + +@override +String toString() { + return 'PollValidationError.optionsRange(options: $options, range: $range)'; +} + + } /// @nodoc abstract mixin class _$PollValidationErrorOptionsRangeCopyWith<$Res> implements $PollValidationErrorCopyWith<$Res> { - factory _$PollValidationErrorOptionsRangeCopyWith( - _PollValidationErrorOptionsRange value, $Res Function(_PollValidationErrorOptionsRange) _then) = - __$PollValidationErrorOptionsRangeCopyWithImpl; - @useResult - $Res call({List options, Range range}); -} + factory _$PollValidationErrorOptionsRangeCopyWith(_PollValidationErrorOptionsRange value, $Res Function(_PollValidationErrorOptionsRange) _then) = __$PollValidationErrorOptionsRangeCopyWithImpl; +@useResult +$Res call({ + List options, Range range +}); + + + +} /// @nodoc -class __$PollValidationErrorOptionsRangeCopyWithImpl<$Res> implements _$PollValidationErrorOptionsRangeCopyWith<$Res> { +class __$PollValidationErrorOptionsRangeCopyWithImpl<$Res> + implements _$PollValidationErrorOptionsRangeCopyWith<$Res> { __$PollValidationErrorOptionsRangeCopyWithImpl(this._self, this._then); final _PollValidationErrorOptionsRange _self; final $Res Function(_PollValidationErrorOptionsRange) _then; - /// Create a copy of PollValidationError - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - $Res call({ - Object? options = null, - Object? range = null, - }) { - return _then(_PollValidationErrorOptionsRange( - null == options - ? _self._options - : options // ignore: cast_nullable_to_non_nullable - as List, - range: null == range - ? _self.range - : range // ignore: cast_nullable_to_non_nullable - as Range, - )); - } +/// Create a copy of PollValidationError +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? options = null,Object? range = null,}) { + return _then(_PollValidationErrorOptionsRange( +null == options ? _self._options : options // ignore: cast_nullable_to_non_nullable +as List,range: null == range ? _self.range : range // ignore: cast_nullable_to_non_nullable +as Range, + )); +} + + } /// @nodoc + class _PollValidationErrorMaxVotesAllowed implements PollValidationError { const _PollValidationErrorMaxVotesAllowed(this.maxVotesAllowed, {required this.range}); + + + final int maxVotesAllowed; + final Range range; + +/// Create a copy of PollValidationError +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$PollValidationErrorMaxVotesAllowedCopyWith<_PollValidationErrorMaxVotesAllowed> get copyWith => __$PollValidationErrorMaxVotesAllowedCopyWithImpl<_PollValidationErrorMaxVotesAllowed>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _PollValidationErrorMaxVotesAllowed&&(identical(other.maxVotesAllowed, maxVotesAllowed) || other.maxVotesAllowed == maxVotesAllowed)&&(identical(other.range, range) || other.range == range)); +} + + +@override +int get hashCode => Object.hash(runtimeType,maxVotesAllowed,range); + +@override +String toString() { + return 'PollValidationError.maxVotesAllowed(maxVotesAllowed: $maxVotesAllowed, range: $range)'; +} + - final int maxVotesAllowed; - final Range range; - - /// Create a copy of PollValidationError - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$PollValidationErrorMaxVotesAllowedCopyWith<_PollValidationErrorMaxVotesAllowed> get copyWith => - __$PollValidationErrorMaxVotesAllowedCopyWithImpl<_PollValidationErrorMaxVotesAllowed>(this, _$identity); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _PollValidationErrorMaxVotesAllowed && - (identical(other.maxVotesAllowed, maxVotesAllowed) || other.maxVotesAllowed == maxVotesAllowed) && - (identical(other.range, range) || other.range == range)); - } - - @override - int get hashCode => Object.hash(runtimeType, maxVotesAllowed, range); - - @override - String toString() { - return 'PollValidationError.maxVotesAllowed(maxVotesAllowed: $maxVotesAllowed, range: $range)'; - } } /// @nodoc abstract mixin class _$PollValidationErrorMaxVotesAllowedCopyWith<$Res> implements $PollValidationErrorCopyWith<$Res> { - factory _$PollValidationErrorMaxVotesAllowedCopyWith( - _PollValidationErrorMaxVotesAllowed value, $Res Function(_PollValidationErrorMaxVotesAllowed) _then) = - __$PollValidationErrorMaxVotesAllowedCopyWithImpl; - @useResult - $Res call({int maxVotesAllowed, Range range}); -} + factory _$PollValidationErrorMaxVotesAllowedCopyWith(_PollValidationErrorMaxVotesAllowed value, $Res Function(_PollValidationErrorMaxVotesAllowed) _then) = __$PollValidationErrorMaxVotesAllowedCopyWithImpl; +@useResult +$Res call({ + int maxVotesAllowed, Range range +}); + + + +} /// @nodoc class __$PollValidationErrorMaxVotesAllowedCopyWithImpl<$Res> implements _$PollValidationErrorMaxVotesAllowedCopyWith<$Res> { @@ -295,24 +311,17 @@ class __$PollValidationErrorMaxVotesAllowedCopyWithImpl<$Res> final _PollValidationErrorMaxVotesAllowed _self; final $Res Function(_PollValidationErrorMaxVotesAllowed) _then; - /// Create a copy of PollValidationError - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - $Res call({ - Object? maxVotesAllowed = null, - Object? range = null, - }) { - return _then(_PollValidationErrorMaxVotesAllowed( - null == maxVotesAllowed - ? _self.maxVotesAllowed - : maxVotesAllowed // ignore: cast_nullable_to_non_nullable - as int, - range: null == range - ? _self.range - : range // ignore: cast_nullable_to_non_nullable - as Range, - )); - } +/// Create a copy of PollValidationError +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? maxVotesAllowed = null,Object? range = null,}) { + return _then(_PollValidationErrorMaxVotesAllowed( +null == maxVotesAllowed ? _self.maxVotesAllowed : maxVotesAllowed // ignore: cast_nullable_to_non_nullable +as int,range: null == range ? _self.range : range // ignore: cast_nullable_to_non_nullable +as Range, + )); +} + + } // dart format on diff --git a/packages/stream_chat_flutter_core/lib/src/stream_poll_vote_list_controller.dart b/packages/stream_chat_flutter_core/lib/src/stream_poll_vote_list_controller.dart index 258d187cc3..ae1fd835d9 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_poll_vote_list_controller.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_poll_vote_list_controller.dart @@ -137,10 +137,10 @@ class StreamPollVoteListController extends PagedValueNotifier // start listening to events if (disposed) return; _subscribeToPollVoteEvents(); - } on StreamChatError catch (error) { + } on StreamChatException catch (error) { value = PagedValue.error(error); } catch (error) { - final chatError = StreamChatError(error.toString()); + final chatError = StreamClientException(message: 'Failed to load poll votes', cause: error); value = PagedValue.error(chatError); } } @@ -166,10 +166,10 @@ class StreamPollVoteListController extends PagedValueNotifier items: newItems, nextPageKey: nextKey, ); - } on StreamChatError catch (error) { + } on StreamChatException catch (error) { value = previousValue.copyWith(error: error); } catch (error) { - final chatError = StreamChatError(error.toString()); + final chatError = StreamClientException(message: 'Failed to load more poll votes', cause: error); value = previousValue.copyWith(error: chatError); } } diff --git a/packages/stream_chat_flutter_core/lib/src/stream_reaction_list_controller.dart b/packages/stream_chat_flutter_core/lib/src/stream_reaction_list_controller.dart index 366d8ff38e..d6a125f831 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_reaction_list_controller.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_reaction_list_controller.dart @@ -124,10 +124,10 @@ class StreamReactionListController extends PagedValueNotifier items: reactions, nextPageKey: nextKey, ); - } on StreamChatError catch (error) { + } on StreamChatException catch (error) { value = PagedValue.error(error); } catch (error) { - final chatError = StreamChatError(error.toString()); + final chatError = StreamClientException(message: 'Failed to load reactions', cause: error); value = PagedValue.error(chatError); } } @@ -153,10 +153,10 @@ class StreamReactionListController extends PagedValueNotifier items: newItems, nextPageKey: nextKey, ); - } on StreamChatError catch (error) { + } on StreamChatException catch (error) { value = previousValue.copyWith(error: error); } catch (error) { - final chatError = StreamChatError(error.toString()); + final chatError = StreamClientException(message: 'Failed to load more reactions', cause: error); value = previousValue.copyWith(error: chatError); } } diff --git a/packages/stream_chat_flutter_core/lib/src/stream_thread_list_controller.dart b/packages/stream_chat_flutter_core/lib/src/stream_thread_list_controller.dart index 1cb0ae8d85..8f7125948b 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_thread_list_controller.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_thread_list_controller.dart @@ -160,10 +160,10 @@ class StreamThreadListController extends PagedValueNotifier { // Start listening to events if (disposed) return; _subscribeToThreadListEvents(); - } on StreamChatError catch (error) { + } on StreamChatException catch (error) { value = PagedValue.error(error); } catch (error) { - final chatError = StreamChatError(error.toString()); + final chatError = StreamClientException(message: 'Failed to load threads', cause: error); value = PagedValue.error(chatError); } } @@ -189,10 +189,10 @@ class StreamThreadListController extends PagedValueNotifier { items: newItems, nextPageKey: nextKey, ); - } on StreamChatError catch (error) { + } on StreamChatException catch (error) { value = previousValue.copyWith(error: error); } catch (error) { - final chatError = StreamChatError(error.toString()); + final chatError = StreamClientException(message: 'Failed to load more threads', cause: error); value = previousValue.copyWith(error: chatError); } } diff --git a/packages/stream_chat_flutter_core/lib/src/stream_user_list_controller.dart b/packages/stream_chat_flutter_core/lib/src/stream_user_list_controller.dart index f4ee153712..3ed264c9f8 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_user_list_controller.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_user_list_controller.dart @@ -175,12 +175,12 @@ class StreamUserListController extends PagedValueNotifier with Search items: users, nextPageKey: nextKey, ); - } on StreamChatError catch (error) { + } on StreamChatException catch (error) { if (isStale(generation)) return; value = PagedValue.error(error); } catch (error) { if (isStale(generation)) return; - final chatError = StreamChatError(error.toString()); + final chatError = StreamClientException(message: 'Failed to load users', cause: error); value = PagedValue.error(chatError); } } @@ -209,12 +209,12 @@ class StreamUserListController extends PagedValueNotifier with Search items: newItems, nextPageKey: nextKey, ); - } on StreamChatError catch (error) { + } on StreamChatException catch (error) { if (isStale(generation)) return; value = previousValue.copyWith(error: error); } catch (error) { if (isStale(generation)) return; - final chatError = StreamChatError(error.toString()); + final chatError = StreamClientException(message: 'Failed to load more users', cause: error); value = previousValue.copyWith(error: chatError); } } diff --git a/packages/stream_chat_flutter_core/test/mocks.dart b/packages/stream_chat_flutter_core/test/mocks.dart index 0de611e5bb..378b4dd65e 100644 --- a/packages/stream_chat_flutter_core/test/mocks.dart +++ b/packages/stream_chat_flutter_core/test/mocks.dart @@ -3,8 +3,6 @@ import 'package:stream_chat/stream_chat.dart'; import 'package:stream_chat_flutter_core/src/stream_channel_list_controller.dart'; import 'package:stream_chat_flutter_core/src/stream_channel_list_event_handler.dart'; -class MockLogger extends Mock implements Logger {} - class MockStreamChannelListController extends Mock implements StreamChannelListController {} class MockStreamChannelListEventHandler extends Mock implements StreamChannelListEventHandler {} @@ -15,7 +13,7 @@ class MockClient extends Mock implements StreamChatClient { } @override - final Logger logger = MockLogger(); + final StreamLogger logger = const StreamLogger('SCh:Test'); ClientState? _state; diff --git a/packages/stream_chat_flutter_core/test/stream_channel_list_controller_test.dart b/packages/stream_chat_flutter_core/test/stream_channel_list_controller_test.dart index 685202b48a..638d09f6a9 100644 --- a/packages/stream_chat_flutter_core/test/stream_channel_list_controller_test.dart +++ b/packages/stream_chat_flutter_core/test/stream_channel_list_controller_test.dart @@ -151,10 +151,11 @@ void main() { await pumpEventQueue(); expect(controller.value, isA()); - expect( - (controller.value as Error).error.message, - contains('API unavailable'), - ); + + final error = (controller.value as Error).error; + // The message names the load; the throwable survives as `cause`. + expect(error.message, 'Failed to load channels'); + expect(error.cause, same(exception)); }); test('loadMore appends new channels and forwards inline filter', () async { diff --git a/packages/stream_chat_flutter_core/test/stream_channel_test.dart b/packages/stream_chat_flutter_core/test/stream_channel_test.dart index 15c29bb8a2..12402db3e7 100644 --- a/packages/stream_chat_flutter_core/test/stream_channel_test.dart +++ b/packages/stream_chat_flutter_core/test/stream_channel_test.dart @@ -382,12 +382,7 @@ void main() { (tester) async { final channel = NonInitializedMockChannel(); when(() => channel.cid).thenReturn('test:channel'); - final networkError = StreamChatNetworkError.fromDioException( - DioException( - requestOptions: RequestOptions(path: 'test'), - type: DioExceptionType.connectionError, - ), - ); + const networkError = StreamNetworkException(message: 'connection failed'); when(channel.watch).thenThrow(networkError); Object? capturedError; @@ -418,8 +413,8 @@ void main() { (tester) async { final channel = NonInitializedMockChannel(); when(() => channel.cid).thenReturn('test:channel'); - final rawError = StreamChatNetworkError.raw( - code: -1, + const rawError = StreamApiException( + code: StreamErrorCode.internalError, message: 'super secret internal failure', statusCode: 500, ); @@ -438,7 +433,7 @@ void main() { await tester.pumpAndSettle(); // The raw error string must not leak to the UI. - expect(find.textContaining('StreamChatNetworkError'), findsNothing); + expect(find.textContaining('StreamApiException'), findsNothing); expect(find.textContaining('super secret internal failure'), findsNothing); expect(find.text('Oops, something went wrong'), findsOneWidget); }, @@ -450,12 +445,7 @@ void main() { final channel = NonInitializedMockChannel(); when(() => channel.cid).thenReturn('test:channel'); when(channel.watch).thenThrow( - StreamChatNetworkError.fromDioException( - DioException( - requestOptions: RequestOptions(path: 'test'), - type: DioExceptionType.connectionError, - ), - ), + const StreamNetworkException(message: 'connection failed'), ); await tester.pumpWidget( @@ -486,7 +476,7 @@ void main() { when(channel.watch).thenAnswer((_) async { attempts++; if (attempts == 1) { - throw StreamChatNetworkError.raw(code: -1, message: 'boom'); + throw const StreamClientException(message: 'boom'); } return const ChannelState(); }); @@ -528,7 +518,7 @@ void main() { attempts++; if (attempts == 1) { return Future.error( - StreamChatNetworkError.raw(code: -1, message: 'boom'), + const StreamClientException(message: 'boom'), ); } secondWatch = Completer(); @@ -571,7 +561,7 @@ void main() { when(() => channel.cid).thenReturn('test:channel'); // Always fails, so the retry fails again. when(channel.watch).thenThrow( - StreamChatNetworkError.raw(code: -1, message: 'boom'), + const StreamClientException(message: 'boom'), ); await tester.pumpWidget( @@ -607,7 +597,7 @@ void main() { final channel = NonInitializedMockChannel(); when(() => channel.cid).thenReturn('test:channel'); when(channel.watch).thenThrow( - StreamChatNetworkError.raw(code: -1, message: 'boom'), + const StreamClientException(message: 'boom'), ); await tester.pumpWidget( @@ -637,7 +627,7 @@ void main() { final channel = NonInitializedMockChannel(); when(() => channel.cid).thenReturn('test:channel'); when(channel.watch).thenThrow( - StreamChatNetworkError.raw(code: -1, message: 'boom'), + const StreamClientException(message: 'boom'), ); await tester.pumpWidget( diff --git a/packages/stream_chat_flutter_core/test/stream_draft_list_controller_test.dart b/packages/stream_chat_flutter_core/test/stream_draft_list_controller_test.dart index 61aadde19d..fac4378266 100644 --- a/packages/stream_chat_flutter_core/test/stream_draft_list_controller_test.dart +++ b/packages/stream_chat_flutter_core/test/stream_draft_list_controller_test.dart @@ -125,10 +125,11 @@ void main() { await pumpEventQueue(); expect(controller.value, isA()); - expect( - (controller.value as Error).error.message, - contains('API unavailable'), - ); + + final error = (controller.value as Error).error; + // The message names the load; the throwable survives as `cause`. + expect(error.message, 'Failed to load drafts'); + expect(error.cause, same(exception)); }); }); @@ -213,11 +214,10 @@ void main() { expect(controller.value.isSuccess, isTrue); expect(controller.value.asSuccess.items, equals(existingDrafts)); - expect(controller.value.asSuccess.error, isNotNull); - expect( - controller.value.asSuccess.error!.message, - contains('Network error'), - ); + final error = controller.value.asSuccess.error; + // The message names the load; the throwable survives as `cause`. + expect(error?.message, 'Failed to load more drafts'); + expect(error?.cause, same(exception)); }); }); diff --git a/packages/stream_chat_flutter_core/test/stream_message_reminder_list_controller_test.dart b/packages/stream_chat_flutter_core/test/stream_message_reminder_list_controller_test.dart index cbbd5924b6..c603461b61 100644 --- a/packages/stream_chat_flutter_core/test/stream_message_reminder_list_controller_test.dart +++ b/packages/stream_chat_flutter_core/test/stream_message_reminder_list_controller_test.dart @@ -129,8 +129,8 @@ void main() { expect(controller.value.asSuccess.items, equals(reminders)); }); - test('handles StreamChatError exceptions properly', () async { - const chatError = StreamChatError('Network error'); + test('handles a Stream failure properly', () async { + const chatError = StreamNetworkException(message: 'Network error'); when( () => client.queryReminders( filter: any(named: 'filter'), @@ -195,10 +195,10 @@ void main() { expect(controller.value.asSuccess.nextPageKey, isNull); }); - test('loadMore handles StreamChatError exceptions properly', () async { + test('loadMore handles a Stream failure properly', () async { const nextKey = 'next_page_token'; final existingReminders = generateMessageReminders(); - const chatError = StreamChatError('Network error'); + const chatError = StreamNetworkException(message: 'Network error'); when( () => client.queryReminders( diff --git a/packages/stream_chat_flutter_core/test/stream_reaction_list_controller_test.dart b/packages/stream_chat_flutter_core/test/stream_reaction_list_controller_test.dart index 983d82b09b..b71ebed6c5 100644 --- a/packages/stream_chat_flutter_core/test/stream_reaction_list_controller_test.dart +++ b/packages/stream_chat_flutter_core/test/stream_reaction_list_controller_test.dart @@ -176,8 +176,8 @@ void main() { expect(controller.value.asSuccess.nextPageKey, isNull); }); - test('handles StreamChatError by transitioning to error state', () async { - const chatError = StreamChatError('Network error'); + test('handles a Stream failure by transitioning to error state', () async { + const chatError = StreamNetworkException(message: 'Network error'); when( () => client.queryReactions( @@ -200,7 +200,7 @@ void main() { expect((controller.value as Error).error, equals(chatError)); }); - test('wraps generic exceptions in StreamChatError', () async { + test('wraps generic exceptions in a StreamClientException', () async { final exception = Exception('API unavailable'); when( @@ -221,10 +221,13 @@ void main() { await pumpEventQueue(); expect(controller.value, isA()); - expect( - (controller.value as Error).error.message, - contains('API unavailable'), - ); + + final error = (controller.value as Error).error; + expect(error, isA()); + // The message names the load; the throwable itself survives as `cause` + // rather than being flattened into the message. + expect(error.message, 'Failed to load reactions'); + expect(error.cause, same(exception)); }); }); @@ -308,10 +311,10 @@ void main() { expect(capturedPagination?.next, equals(nextKey)); }); - test('loadMore preserves existing items on StreamChatError', () async { + test('loadMore preserves existing items on a Stream failure', () async { const nextKey = 'next_page_token'; final existingReactions = generateReactions(); - const chatError = StreamChatError('Network error'); + const chatError = StreamNetworkException(message: 'Network error'); when( () => client.queryReactions( @@ -367,11 +370,10 @@ void main() { expect(controller.value.isSuccess, isTrue); expect(controller.value.asSuccess.items, equals(existingReactions)); - expect(controller.value.asSuccess.error, isNotNull); - expect( - controller.value.asSuccess.error!.message, - contains('Network error'), - ); + final error = controller.value.asSuccess.error; + // The message names the load; the throwable survives as `cause`. + expect(error?.message, 'Failed to load more reactions'); + expect(error?.cause, same(exception)); }); }); @@ -535,7 +537,10 @@ void main() { test('value setter sorts items when sort is provided', () async { final now = DateTime.now(); - final older = generateReaction(userId: 'user_1', createdAt: now.subtract(const Duration(hours: 1))); + final older = generateReaction( + userId: 'user_1', + createdAt: now.subtract(const Duration(hours: 1)), + ); final newer = generateReaction(userId: 'user_2', createdAt: now); final response = QueryReactionsResponse() diff --git a/packages/stream_chat_localizations/example/lib/add_new_lang.dart b/packages/stream_chat_localizations/example/lib/add_new_lang.dart index 8b8b9c16d4..9f26388503 100644 --- a/packages/stream_chat_localizations/example/lib/add_new_lang.dart +++ b/packages/stream_chat_localizations/example/lib/add_new_lang.dart @@ -913,7 +913,7 @@ void main() async { /// from your project dashboard. final client = StreamChatClient( 's2dxdhpxd94g', - logLevel: Level.INFO, + logConfig: const StreamLogConfig(priority: StreamLogPriority.info), ); /// Set the current user and connect the websocket. In a production diff --git a/packages/stream_chat_localizations/example/lib/main.dart b/packages/stream_chat_localizations/example/lib/main.dart index d10937249e..b5a363fcd1 100644 --- a/packages/stream_chat_localizations/example/lib/main.dart +++ b/packages/stream_chat_localizations/example/lib/main.dart @@ -9,7 +9,7 @@ void main() async { /// from your project dashboard. final client = StreamChatClient( 's2dxdhpxd94g', - logLevel: Level.INFO, + logConfig: const StreamLogConfig(priority: StreamLogPriority.info), ); /// Set the current user and connect the websocket. In a production diff --git a/packages/stream_chat_localizations/example/lib/override_lang.dart b/packages/stream_chat_localizations/example/lib/override_lang.dart index 453966a361..e4e6f9e774 100644 --- a/packages/stream_chat_localizations/example/lib/override_lang.dart +++ b/packages/stream_chat_localizations/example/lib/override_lang.dart @@ -32,7 +32,7 @@ void main() async { /// from your project dashboard. final client = StreamChatClient( 's2dxdhpxd94g', - logLevel: Level.INFO, + logConfig: const StreamLogConfig(priority: StreamLogPriority.info), ); /// Set the current user and connect the websocket. In a production diff --git a/packages/stream_chat_persistence/CHANGELOG.md b/packages/stream_chat_persistence/CHANGELOG.md index 715d7fab5c..6c469ceac0 100644 --- a/packages/stream_chat_persistence/CHANGELOG.md +++ b/packages/stream_chat_persistence/CHANGELOG.md @@ -1,3 +1,13 @@ +## Upcoming Beta + +🛑️ Breaking + +- `StreamChatPersistenceClient` no longer takes `logLevel` or `logHandlerFunction`. Logging is configured once, on `StreamChatClient`, with `logConfig`. + +🔄 Changed + +- Every persistence call logged its own name at `info`; that call trace is `verbose` now. + ## 10.4.0 🔄 Changed diff --git a/packages/stream_chat_persistence/example/lib/main.dart b/packages/stream_chat_persistence/example/lib/main.dart index f82143fbbf..0676afa19a 100644 --- a/packages/stream_chat_persistence/example/lib/main.dart +++ b/packages/stream_chat_persistence/example/lib/main.dart @@ -11,7 +11,6 @@ Future main() async { /// Set the chatPersistenceClient for offline support client.chatPersistenceClient = StreamChatPersistenceClient( - logLevel: Level.INFO, connectionMode: ConnectionMode.background, ); diff --git a/packages/stream_chat_persistence/lib/src/stream_chat_persistence_client.dart b/packages/stream_chat_persistence/lib/src/stream_chat_persistence_client.dart index 8e1ba4c5f1..1982beb187 100644 --- a/packages/stream_chat_persistence/lib/src/stream_chat_persistence_client.dart +++ b/packages/stream_chat_persistence/lib/src/stream_chat_persistence_client.dart @@ -14,47 +14,27 @@ enum ConnectionMode { /// Signature for a function which provides instance of [DriftChatDatabase] typedef DatabaseProvider = DriftChatDatabase Function(String, ConnectionMode); -final _levelEmojiMapper = { - Level.INFO: 'ℹ️', - Level.WARNING: '⚠️', - Level.SEVERE: '🚨', -}; - /// A [DriftChatDatabase] based implementation of the [ChatPersistenceClient] class StreamChatPersistenceClient extends ChatPersistenceClient { /// Creates a new instance of the stream chat persistence client StreamChatPersistenceClient({ /// Connection mode on which the client will work this._connectionMode = ConnectionMode.regular, - Level logLevel = Level.WARNING, /// Whether to use an experimental storage implementation on the web /// that uses IndexedDB if the current browser supports it. /// Otherwise, falls back to the local storage based implementation. bool webUseExperimentalIndexedDb = false, - LogHandlerFunction? logHandlerFunction, - }) : _webUseIndexedDbIfSupported = webUseExperimentalIndexedDb, - _logger = Logger.detached('💽')..level = logLevel { - _logger.onRecord.listen(logHandlerFunction ?? _defaultLogHandler); - } + }) : _webUseIndexedDbIfSupported = webUseExperimentalIndexedDb; /// [DriftChatDatabase] instance used by this client. @visibleForTesting DriftChatDatabase? db; - final Logger _logger; + static const _logger = StreamLogger('SCh:Persistence'); final ConnectionMode _connectionMode; final bool _webUseIndexedDbIfSupported; - void _defaultLogHandler(LogRecord record) { - print( - '(${record.time}) ' - '${_levelEmojiMapper[record.level] ?? record.level.name} ' - '${record.loggerName} ${record.message}', - ); - if (record.stackTrace != null) print(record.stackTrace); - } - bool get _debugIsConnected { assert(() { if (!isConnected) { @@ -94,91 +74,91 @@ class StreamChatPersistenceClient extends ChatPersistenceClient { 'disconnect the previous instance before connecting again.', ); } - _logger.info('connect'); + _logger.v(() => 'connect'); db = databaseProvider?.call(userId, _connectionMode) ?? await _defaultDatabaseProvider(userId, _connectionMode); } @override Future getConnectionInfo() { assert(_debugIsConnected, ''); - _logger.info('getConnectionInfo'); + _logger.v(() => 'getConnectionInfo'); return db!.connectionEventDao.connectionEvent; } @override Future updateConnectionInfo(Event event) { assert(_debugIsConnected, ''); - _logger.info('updateConnectionInfo'); + _logger.v(() => 'updateConnectionInfo'); return db!.connectionEventDao.updateConnectionEvent(event); } @override Future updateLastSyncAt(DateTime lastSyncAt) { assert(_debugIsConnected, ''); - _logger.info('updateLastSyncAt'); + _logger.v(() => 'updateLastSyncAt'); return db!.connectionEventDao.updateLastSyncAt(lastSyncAt); } @override Future getLastSyncAt() { assert(_debugIsConnected, ''); - _logger.info('getLastSyncAt'); + _logger.v(() => 'getLastSyncAt'); return db!.connectionEventDao.lastSyncAt; } @override Future deleteChannels(List cids) { assert(_debugIsConnected, ''); - _logger.info('deleteChannels'); + _logger.v(() => 'deleteChannels'); return db!.channelDao.deleteChannelByCids(cids); } @override Future> getChannelCids() { assert(_debugIsConnected, ''); - _logger.info('getChannelCids'); + _logger.v(() => 'getChannelCids'); return db!.channelDao.cids; } @override Future deleteMessageByIds(List messageIds) { assert(_debugIsConnected, ''); - _logger.info('deleteMessageByIds'); + _logger.v(() => 'deleteMessageByIds'); return db!.messageDao.deleteMessageByIds(messageIds); } @override Future deletePinnedMessageByIds(List messageIds) { assert(_debugIsConnected, ''); - _logger.info('deletePinnedMessageByIds'); + _logger.v(() => 'deletePinnedMessageByIds'); return db!.pinnedMessageDao.deleteMessageByIds(messageIds); } @override Future deleteMessageByCids(List cids) { assert(_debugIsConnected, ''); - _logger.info('deleteMessageByCids'); + _logger.v(() => 'deleteMessageByCids'); return db!.messageDao.deleteMessageByCids(cids); } @override Future deletePinnedMessageByCids(List cids) { assert(_debugIsConnected, ''); - _logger.info('deletePinnedMessageByCids'); + _logger.v(() => 'deletePinnedMessageByCids'); return db!.pinnedMessageDao.deleteMessageByCids(cids); } @override Future> getMembersByCid(String cid) { assert(_debugIsConnected, ''); - _logger.info('getMembersByCid'); + _logger.v(() => 'getMembersByCid'); return db!.memberDao.getMembersByCid(cid); } @override Future getChannelByCid(String cid) { assert(_debugIsConnected, ''); - _logger.info('getChannelByCid'); + _logger.v(() => 'getChannelByCid'); return db!.channelDao.getChannelByCid(cid); } @@ -188,7 +168,7 @@ class StreamChatPersistenceClient extends ChatPersistenceClient { PaginationParams? messagePagination, }) { assert(_debugIsConnected, ''); - _logger.info('getMessagesByCid'); + _logger.v(() => 'getMessagesByCid'); return db!.messageDao.getMessagesByCid( cid, messagePagination: messagePagination, @@ -201,7 +181,7 @@ class StreamChatPersistenceClient extends ChatPersistenceClient { PaginationParams? messagePagination, }) { assert(_debugIsConnected, ''); - _logger.info('getPinnedMessagesByCid'); + _logger.v(() => 'getPinnedMessagesByCid'); return db!.pinnedMessageDao.getMessagesByCid( cid, messagePagination: messagePagination, @@ -216,7 +196,7 @@ class StreamChatPersistenceClient extends ChatPersistenceClient { DateTime? deletedAt, }) async { assert(_debugIsConnected, ''); - _logger.info('deleteMessagesFromUser'); + _logger.v(() => 'deleteMessagesFromUser'); // Delete from both messages and pinned_messages tables await Future.wait( @@ -240,7 +220,7 @@ class StreamChatPersistenceClient extends ChatPersistenceClient { String? parentId, }) { assert(_debugIsConnected, ''); - _logger.info('getDraftMessageByCid'); + _logger.v(() => 'getDraftMessageByCid'); return db!.draftMessageDao.getDraftMessageByCid( cid, parentId: parentId, @@ -250,28 +230,28 @@ class StreamChatPersistenceClient extends ChatPersistenceClient { @override Future> getLocationsByCid(String cid) async { assert(_debugIsConnected, ''); - _logger.info('getLocationsByCid'); + _logger.v(() => 'getLocationsByCid'); return db!.locationDao.getLocationsByCid(cid); } @override Future getLocationByMessageId(String messageId) async { assert(_debugIsConnected, ''); - _logger.info('getLocationByMessageId'); + _logger.v(() => 'getLocationByMessageId'); return db!.locationDao.getLocationByMessageId(messageId); } @override Future> getReadsByCid(String cid) async { assert(_debugIsConnected, ''); - _logger.info('getReadsByCid'); + _logger.v(() => 'getReadsByCid'); return db!.readDao.getReadsByCid(cid); } @override Future>> getChannelThreads(String cid) async { assert(_debugIsConnected, ''); - _logger.info('getChannelThreads'); + _logger.v(() => 'getChannelThreads'); final messages = await db!.messageDao.getThreadMessages(cid); final messageByParentIdDictionary = >{}; for (final message in messages) { @@ -291,7 +271,7 @@ class StreamChatPersistenceClient extends ChatPersistenceClient { PaginationParams? options, }) { assert(_debugIsConnected, ''); - _logger.info('getReplies'); + _logger.v(() => 'getReplies'); return db!.messageDao.getThreadMessagesByParentId( parentId, options: options, @@ -330,7 +310,7 @@ class StreamChatPersistenceClient extends ChatPersistenceClient { PaginationParams? paginationParams, }) async { assert(_debugIsConnected, ''); - _logger.info('queryChannelStates'); + _logger.v(() => 'queryChannelStates'); if (predefinedFilter != null) { final (channelModels, resolvedFilter, resolvedSort) = await db!.channelQueryDao .getChannelsAndSpecByPredefinedFilter( @@ -438,7 +418,7 @@ class StreamChatPersistenceClient extends ChatPersistenceClient { bool clearQueryCache = false, }) { assert(_debugIsConnected, ''); - _logger.info('saveChannelQueries'); + _logger.v(() => 'saveChannelQueries'); if (predefinedFilter != null) { return db!.channelQueryDao.updateChannelQueriesByPredefinedFilter( predefinedFilter, @@ -462,91 +442,91 @@ class StreamChatPersistenceClient extends ChatPersistenceClient { @override Future updateChannels(List channels) { assert(_debugIsConnected, ''); - _logger.info('updateChannels'); + _logger.v(() => 'updateChannels'); return db!.channelDao.updateChannels(channels); } @override Future updateDraftMessages(List draftMessages) { assert(_debugIsConnected, ''); - _logger.info('updateDraftMessages'); + _logger.v(() => 'updateDraftMessages'); return db!.draftMessageDao.updateDraftMessages(draftMessages); } @override Future updatePolls(List polls) { assert(_debugIsConnected, ''); - _logger.info('updatePolls'); + _logger.v(() => 'updatePolls'); return db!.pollDao.updatePolls(polls); } @override Future deletePollsByIds(List pollIds) { assert(_debugIsConnected, ''); - _logger.info('deletePollsByIds'); + _logger.v(() => 'deletePollsByIds'); return db!.pollDao.deletePollsByIds(pollIds); } @override Future bulkUpdateMembers(Map?> members) { assert(_debugIsConnected, ''); - _logger.info('bulkUpdateMembers'); + _logger.v(() => 'bulkUpdateMembers'); return db!.memberDao.bulkUpdateMembers(members); } @override Future bulkUpdateMessages(Map?> messages) { assert(_debugIsConnected, ''); - _logger.info('bulkUpdateMessages'); + _logger.v(() => 'bulkUpdateMessages'); return db!.messageDao.bulkUpdateMessages(messages); } @override Future bulkUpdatePinnedMessages(Map?> messages) { assert(_debugIsConnected, ''); - _logger.info('bulkUpdatePinnedMessages'); + _logger.v(() => 'bulkUpdatePinnedMessages'); return db!.pinnedMessageDao.bulkUpdateMessages(messages); } @override Future updatePollVotes(List pollVotes) { assert(_debugIsConnected, ''); - _logger.info('updatePollVotes'); + _logger.v(() => 'updatePollVotes'); return db!.pollVoteDao.updatePollVotes(pollVotes); } @override Future updatePinnedMessageReactions(List reactions) { assert(_debugIsConnected, ''); - _logger.info('updatePinnedMessageReactions'); + _logger.v(() => 'updatePinnedMessageReactions'); return db!.pinnedMessageReactionDao.updateReactions(reactions); } @override Future updateReactions(List reactions) { assert(_debugIsConnected, ''); - _logger.info('updateReactions'); + _logger.v(() => 'updateReactions'); return db!.reactionDao.updateReactions(reactions); } @override Future bulkUpdateReads(Map?> reads) { assert(_debugIsConnected, ''); - _logger.info('bulkUpdateReads'); + _logger.v(() => 'bulkUpdateReads'); return db!.readDao.bulkUpdateReads(reads); } @override Future updateUsers(List users) { assert(_debugIsConnected, ''); - _logger.info('updateUsers'); + _logger.v(() => 'updateUsers'); return db!.userDao.updateUsers(users); } @override Future updateLocations(List locations) async { assert(_debugIsConnected, ''); - _logger.info('updateLocations'); + _logger.v(() => 'updateLocations'); return db!.locationDao.updateLocations(locations); } @@ -555,35 +535,35 @@ class StreamChatPersistenceClient extends ChatPersistenceClient { List messageIds, ) { assert(_debugIsConnected, ''); - _logger.info('deletePinnedMessageReactionsByMessageId'); + _logger.v(() => 'deletePinnedMessageReactionsByMessageId'); return db!.pinnedMessageReactionDao.deleteReactionsByMessageIds(messageIds); } @override Future deleteReactionsByMessageId(List messageIds) { assert(_debugIsConnected, ''); - _logger.info('deleteReactionsByMessageId'); + _logger.v(() => 'deleteReactionsByMessageId'); return db!.reactionDao.deleteReactionsByMessageIds(messageIds); } @override Future deletePollVotesByPollIds(List pollIds) { assert(_debugIsConnected, ''); - _logger.info('deletePollVotesByPollIds'); + _logger.v(() => 'deletePollVotesByPollIds'); return db!.pollVoteDao.deletePollVotesByPollIds(pollIds); } @override Future deleteMembersByCids(List cids) { assert(_debugIsConnected, ''); - _logger.info('deleteMembersByCids'); + _logger.v(() => 'deleteMembersByCids'); return db!.memberDao.deleteMemberByCids(cids); } @override Future deleteDraftMessagesByCids(List cids) { assert(_debugIsConnected, ''); - _logger.info('deleteDraftMessagesByCids'); + _logger.v(() => 'deleteDraftMessagesByCids'); return db!.draftMessageDao.deleteDraftMessagesByCids(cids); } @@ -593,7 +573,7 @@ class StreamChatPersistenceClient extends ChatPersistenceClient { String? parentId, }) { assert(_debugIsConnected, ''); - _logger.info('deleteDraftMessageByCid'); + _logger.v(() => 'deleteDraftMessageByCid'); return db!.draftMessageDao.deleteDraftMessageByCid( cid, parentId: parentId, @@ -603,14 +583,14 @@ class StreamChatPersistenceClient extends ChatPersistenceClient { @override Future deleteLocationsByCid(String cid) { assert(_debugIsConnected, ''); - _logger.info('deleteLocationsByCid'); + _logger.v(() => 'deleteLocationsByCid'); return db!.locationDao.deleteLocationsByCid(cid); } @override Future deleteLocationsByMessageIds(List messageIds) { assert(_debugIsConnected, ''); - _logger.info('deleteLocationsByMessageIds'); + _logger.v(() => 'deleteLocationsByMessageIds'); return db!.locationDao.deleteLocationsByMessageIds(messageIds); } @@ -620,31 +600,31 @@ class StreamChatPersistenceClient extends ChatPersistenceClient { Map> threads, ) { assert(_debugIsConnected, ''); - _logger.info('updateChannelThreads'); + _logger.v(() => 'updateChannelThreads'); return db!.transaction(() => super.updateChannelThreads(cid, threads)); } @override Future updateChannelStates(List channelStates) { assert(_debugIsConnected, ''); - _logger.info('updateChannelStates'); + _logger.v(() => 'updateChannelStates'); return db!.transaction(() => super.updateChannelStates(channelStates)); } @override Future flush() { assert(_debugIsConnected, ''); - _logger.info('flush'); + _logger.v(() => 'flush'); return db!.flush(); } @override Future disconnect({bool flush = false}) async { - _logger.info('disconnect'); + _logger.v(() => 'disconnect'); if (isConnected) { - _logger.info('Disconnecting'); + _logger.v(() => 'Disconnecting'); if (flush) { - _logger.info('Flushing'); + _logger.v(() => 'Flushing'); await db!.flush(); } await db!.disconnect(); diff --git a/packages/stream_chat_persistence/pubspec.yaml b/packages/stream_chat_persistence/pubspec.yaml index b3f6dd69c0..927035e801 100644 --- a/packages/stream_chat_persistence/pubspec.yaml +++ b/packages/stream_chat_persistence/pubspec.yaml @@ -25,7 +25,6 @@ dependencies: drift: ^2.33.0 flutter: sdk: flutter - logging: ^1.3.0 meta: ^1.9.1 path: ^1.9.1 path_provider: ^2.1.5 diff --git a/packages/stream_chat_persistence/test/stream_chat_persistence_client_test.dart b/packages/stream_chat_persistence/test/stream_chat_persistence_client_test.dart index 5cc2f907f3..6defdc2c3c 100644 --- a/packages/stream_chat_persistence/test/stream_chat_persistence_client_test.dart +++ b/packages/stream_chat_persistence/test/stream_chat_persistence_client_test.dart @@ -17,7 +17,7 @@ void main() { group('connect', () { const userId = 'testUserId'; test('successfully connects with the Database', () async { - final client = StreamChatPersistenceClient(logLevel: Level.ALL); + final client = StreamChatPersistenceClient(); expect(client.isConnected, false); await client.connect(userId, databaseProvider: testDatabaseProvider); expect(client.isConnected, true); @@ -30,7 +30,7 @@ void main() { }); test('throws if already connected', () async { - final client = StreamChatPersistenceClient(logLevel: Level.ALL); + final client = StreamChatPersistenceClient(); expect(client.isConnected, false); await client.connect(userId, databaseProvider: testDatabaseProvider); expect(client.isConnected, true); @@ -49,7 +49,7 @@ void main() { test('disconnect', () async { const userId = 'testUserId'; - final client = StreamChatPersistenceClient(logLevel: Level.ALL); + final client = StreamChatPersistenceClient(); await client.connect(userId, databaseProvider: testDatabaseProvider); expect(client.isConnected, true); await client.disconnect(flush: true); @@ -58,7 +58,7 @@ void main() { test('flush', () async { const userId = 'testUserId'; - final client = StreamChatPersistenceClient(logLevel: Level.ALL); + final client = StreamChatPersistenceClient(); await client.connect(userId, databaseProvider: testDatabaseProvider); addTearDown(() async => client.disconnect()); @@ -88,7 +88,7 @@ void main() { }); test('client function throws stateError if db is not yet connected', () { - final client = StreamChatPersistenceClient(logLevel: Level.ALL); + final client = StreamChatPersistenceClient(); expect( // Running a function that requires db connection. () => client.getReplies('testParentId'), @@ -109,7 +109,7 @@ void main() { }); setUp(() async { - client = StreamChatPersistenceClient(logLevel: Level.ALL); + client = StreamChatPersistenceClient(); await client.connect(userId, databaseProvider: _mockDatabaseProvider); }); diff --git a/sample_app/benchmark/main_benchmark.dart b/sample_app/benchmark/main_benchmark.dart index 961179a6ea..e66e37700d 100644 --- a/sample_app/benchmark/main_benchmark.dart +++ b/sample_app/benchmark/main_benchmark.dart @@ -21,7 +21,7 @@ const _benchmarkChannelId = 'perf-test-5k'; Future main() async { WidgetsFlutterBinding.ensureInitialized(); - final client = StreamChatClient(_apiKey, logLevel: Level.OFF); + final client = StreamChatClient(_apiKey, logConfig: const StreamLogConfig(priority: StreamLogPriority.none)); await client.connectUser(User(id: _userId), _userToken); runApp(_BenchmarkApp(client: client)); diff --git a/sample_app/lib/auth/auth_controller.dart b/sample_app/lib/auth/auth_controller.dart index 8886e3981a..50747681d2 100644 --- a/sample_app/lib/auth/auth_controller.dart +++ b/sample_app/lib/auth/auth_controller.dart @@ -26,24 +26,31 @@ const _kAndroidPushProvider = PushProvider.firebase(name: 'firebase'); /// Shared across every client so reconnecting doesn't need a second /// SQLite connection. -final _chatPersistenceClient = StreamChatPersistenceClient( - logLevel: Level.SEVERE, -); +final _chatPersistenceClient = StreamChatPersistenceClient(); bool get isE2eTestRun => authController.debugConnectionOverride != null; -Future _sampleAppLogHandler(LogRecord record) async { - if (isE2eTestRun) return; - - if (kDebugMode) StreamChatClient.defaultLogHandler(record); +/// Prints records in debug builds and reports the ones carrying an error to +/// Crashlytics. +class _SampleAppLogHandler extends StreamLogHandler { + const _SampleAppLogHandler(); - // report errors to Firebase Crashlytics - if (record.error != null || record.stackTrace != null) { - await FirebaseCrashlytics.instance.recordError( - record.error, - record.stackTrace, - reason: record.message, - ); + @override + void handle(StreamLogRecord record) { + if (isE2eTestRun) return; + + if (kDebugMode) const StreamLogHandler.console().handle(record); + + // report errors to Firebase Crashlytics + if (record.error != null || record.stackTrace != null) { + FirebaseCrashlytics.instance + .recordError( + record.error, + record.stackTrace, + reason: record.message, + ) + .ignore(); + } } } @@ -65,16 +72,21 @@ StreamChatClient _buildStreamChatClient( String? baseUrl, StreamConnectionOverride? connectionOverride, }) { - final logLevel = connectionOverride != null ? Level.OFF : (kDebugMode ? Level.INFO : Level.SEVERE); + final priority = switch ((connectionOverride, kDebugMode)) { + // The e2e harness asserts on output, so keep the SDK quiet for it. + (final _?, _) => StreamLogPriority.none, + (_, true) => StreamLogPriority.info, + _ => StreamLogPriority.error, + }; return StreamChatClient( apiKey, - logLevel: logLevel, - logHandlerFunction: _sampleAppLogHandler, + logConfig: StreamLogConfig( + priority: priority, + handler: const _SampleAppLogHandler(), + ), retryPolicy: RetryPolicy( maxRetryAttempts: 3, - shouldRetry: (client, attempt, error) { - return error is StreamChatNetworkError && error.isRetriable; - }, + shouldRetry: (client, attempt, error) => error?.isRetriable ?? false, ), baseURL: connectionOverride?.baseURL ?? baseUrl, baseWsUrl: connectionOverride?.baseWsUrl, From 8cabacf355ef7523c325623c3ec81a95e2a7a7c6 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Tue, 15 Sep 2026 16:38:48 +0200 Subject: [PATCH 04/36] refactor(llc)!: adopt stream_core's Sort for every query (#2957) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor(llc)!: adopt stream_core's Sort for every query Replaces `SortOption` / `SortOrder` and the `ComparableField` machinery with `stream_core`'s `Sort` and `SortField`, giving each model its own sort type and field registry, as in `stream_feeds`. A field now carries the value it sorts on, so one declaration drives both the wire query and a client-side sort, and a field from the wrong model no longer compiles — `client.search(sort:)` previously took an untyped `SortOrder`, so a channel field passed the compiler and the server silently ignored it. The message sort is named `MessageSearchSort` because searching is the only message query the API sorts. Every registry was verified field by field against the backend's `mq.TableConfig`, which found `MessageReminderSortField.messageId` and `MessageSearchSortField.relevance` missing, and `PollVoteSortField.answerText` and a custom sort field on drafts rejected by the server. Default sorts move from `stream_chat_flutter_core`'s `defaultXListSort` constants onto the sort that owns them, so the ordering the API applies is reachable without the Flutter layer. Verified with `melos run analyze`, `melos run format`, and the stream_chat (1646), stream_chat_flutter_core (362) and stream_chat_persistence (305) suites. Co-Authored-By: Claude Opus 5 (1M context) * docs(repo): record what the filter investigation settled The upstream list and the filter half of phase 08 were written before the evidence and recommended five things that turned out to be wrong. Correcting them rather than deleting, so the same asks are not re-raised. Dropped from UPSTREAM, each with the reason: `$nor` (breaks a parity Swift and Android core keep), `_ResultCallAdapter` (core does not depend on retrofit), `Sort` value equality (cannot be written correctly — it compared the field's wire name and ignored the comparator, so two sorts ordered a list in opposite directions while comparing equal), and `SortDirection.fromJson` (json_serializable decodes enums through the generated value map, never a `fromJson` static). `normalizeStringForSort` landed, but as a utility rather than the `ComparableField` change proposed — `Filter` compares through the same code, so folding there would have made `$eq` case-insensitive locally. Phase 08's filter half is rewritten around three findings: the backend withdrew `$ne` and `$nin` from the published spec in GetStream/chat#15657, which is a better citation than Android's deprecation and carries per-field exceptions the plan did not have; a predefined filter is authored server-side and can contain operators core does not model, so its decode needs a raw fallback leaf the way sort fields have `custom`; and no chat SDK evaluates filters locally, so `matches()` is not the payoff the plan claimed. Co-Authored-By: Claude Opus 5 (1M context) * docs(repo): record the verified filter fields for phase 08 111 filterable fields extracted from each resource's `mq.TableConfig.Columns` with named operator sets resolved, so the registry and its per-field "Supported operators" lines are written from the backend rather than from the JS client or guesswork — the order that kept the sort half clean. It also surfaces the one capability the operator removals cost. `$nin` on `user.id` is the sanctioned "everyone except these people" query, index-safe and deliberately optimised, and core models neither `$nin` nor `$nor`. After the migration it is reachable only through `Filter.raw`, which is a decision to take before `UserFilterField` is written, not after. Co-Authored-By: Claude Opus 5 (1M context) * fix(persistence): bump the schema version for the sort converter change `channel_queries_metadata`'s `sort` column swapped `ChannelStateSortOrderConverter` for `ChannelSortConverter`, so the JSON stored in it changes shape. A cache written by an older build would be read back through the new converter without a version change. Moves to the `1100 +` band, which is where v11's schema numbering starts. Co-Authored-By: Claude Opus 5 (1M context) * fix(llc): keep nulls-last thread ordering and normalized channel names Two orderings regressed when sorting moved to `stream_core`'s typed fields, because the old code keyed its special cases off the field *string* and the new registries key off the model. `ThreadSort` lost nulls-last on `last_message_at`. The old `SortOption.desc` compared the raw field name, so a thread sort matched the same `'last_message_at'` case a channel sort did; `Sort.desc` defaults to nullsFirst. Since `ThreadSort.defaultSort` sorts that field descending and `lastMessageAt` is nullable, a thread with no replies moved from the end of the list to the front. Channel names stopped folding. `ComparableField` normalized every string it compared, and `getComparableField` resolved an unmodelled key through `extraData`, so sorting channels by name folded diacritics and ligatures — the behaviour #2601 added. With no `ChannelSortField.name`, the only route was `custom('name')`, which compares raw. Declares the field, matching what `MemberSortField.name` and `UserSortField.name` already do. Co-Authored-By: Claude Opus 5 (1M context) * fix(llc): make the shared default sort lists unmodifiable Each `defaultSort` is a `static final` growable list handed straight to a controller — `ChannelSort.defaultSort` reaches `_resolvedChannelStateSort`, and the rest reach their list controllers the same way. A caller that sorted or added to one changed the default for every controller in the process, which the `const` lists they replaced could not do. Co-Authored-By: Claude Opus 5 (1M context) * docs(repo): record that sort lists can no longer be const The Symbol Map never said so, and every v10 example wrote `const [SortOption.desc(...)]`, so a consumer meets this on the first line they touch. Core's `SortField` holds a value closure, which is not a constant expression, so the registry members are `static final` and the list cannot be `const`. It went unwritten because the phase doc claimed the opposite. Its `StreamSortField` section described a chat-side base class with a const constructor that was never built — `git grep` finds no such class — and while the plan recorded const-ness as preserved, nobody wrote the consumer note. Replaced with what shipped, including the correction that an explicit `nullOrdering:` wins over the per-field default rather than being ignored. Co-Authored-By: Claude Opus 5 (1M context) * docs(llc): correct the sort fields the changelog claims Three entries named fields that do not exist. `userId`, `attachments`, `attachmentsType` and `mentionedUsersId` are `MessageSearchFilterField`s, not sortable; `MemberSortField` has no `lastActive`; `UserSortField` has no `teams`. Corrected here rather than four PRs later, where it was landing before: a changelog is the highest-trust document a reader has, and these read as authoritative for the three PRs in between. Co-Authored-By: Claude Opus 5 (1M context) * test(llc): cover the thread and reminder sort field getters `ThreadSortField` and `MessageReminderSortField` were the only two registries with no ordering assertions, and they are the two codecov flags worst — 41% and 47%. That is not a coincidence: a `SortField` is a remote name plus a closure that reads a value off the model, and the existing tests pinned only the name. A getter reading the wrong property sorts plausibly while ordering by something else. It is also why the nulls-last regression on `ThreadSortField.lastMessageAt` reached review — nothing exercised it. The last test here pins that: a thread with no replies trails the list in both directions, and it fails if the `_orderingFor` default is removed. Verified by removing it. Co-Authored-By: Claude Opus 5 (1M context) * fix(llc): read the raw name for local name sorting `User.name` answers the id when a user has no name, so `UserSortField.name` and `MemberSortField.name` ordered unnamed users among the named ones while the API sorts them together by an empty `name` column. Co-Authored-By: Claude Opus 5 (1M context) * fix(llc)!: drop the custom sort field where the API rejects one `queryPolls` and `queryThreads` validate a sort against whole combinations of declared fields (`Poll.AllowedSortCombinations`, `ThreadWithLastReadAt.AllowedSortCombinations`), so a custom field fails the request. `PollSortField.custom` and `ThreadSortField.custom` are gone; the four registries whose resources leave sort validation open keep theirs. Also adds `PollSort.defaultSort`, matching the server's `created_at` ascending, and corrects the documented direction on the poll-vote and reaction defaults. Co-Authored-By: Claude Opus 5 (1M context) * fix(llc): restore the poll-vote default sort direction `PollVote.DefaultSort()` is `created_at` ascending, and v10's `defaultPollVoteListSort` matched it. Adopting core's `Sort` flipped it to descending, so a poll-vote list left unsorted came back reversed. Pins every default sort against the server's own in `sort_test.dart`, which is what would have caught it. Co-Authored-By: Claude Opus 5 (1M context) * docs(repo): say what the poll-vote default and answer_text actually do The changelog still announced a poll-vote default of newest-first, which the previous commit reverted — the default is `created_at` ascending, exactly what v10 shipped, so there is no change to announce. The migration guide explained the `answerText` removal through the backend's own `AllowedCustomSortColumns`, an identifier no SDK consumer can see. The contract is that the API rejects the sort. Co-Authored-By: Claude Opus 5 (1M context) * fix(core)!: stop typing a controller sort that is never null Every list controller with a default resolves `sort ?? XSort.defaultSort` in its constructor, so the property could not be null — but it was typed as if it could, leaving callers to null-check a field that never is. The setter kept the old meaning: assigning null sent no sort at all, while passing null to the constructor selected the default. It now selects the default too, which is what the changelog already claimed. Co-Authored-By: Claude Opus 5 (1M context) * docs(llc): document the sort contract, not the design behind it `XSortField.custom`'s doc described the other registries and its own cost rather than what the caller gets. `ThreadSort.defaultSort` said it sorted "minus the unread term" while the list it documents carries that term, and the nulls-last comment beside it claimed a parity with the channel case that does not hold — the API's thread date is never absent, so placing a dateless thread last is a local-sort choice. `_defaultSortFor` also returned an unmodifiable list on one branch and a fresh growable one on the other. Co-Authored-By: Claude Opus 5 (1M context) * revert(llc): drop the unmodifiable wrapper on the default sorts `List.unmodifiable` guarded a mutation nobody performs, and it costs a copy and a line of ceremony on every registry. Reverts 395351df. Co-Authored-By: Claude Opus 5 (1M context) * feat(llc): add an empty sort for querying without one A controller's `sort` is non-nullable where the model declares a default, so there was no way left to say "let the API order this" — the meaning v10's `sort: null` carried. `ChannelSort.empty` and its siblings say it explicitly. An empty sort also has to skip local sorting rather than run a no-op comparator: an empty list compares every pair as equal, and `List.sort` is not stable, so the page the server ordered would be permuted. Co-Authored-By: Claude Opus 5 (1M context) * docs(llc): drop the changelog line the empty sort replaced The bullet described a controller's null handling from the low-level client's changelog, and the setter no longer takes null. What a controller does with an unset sort is already stated in `stream_chat_flutter_core`'s. Co-Authored-By: Claude Opus 5 (1M context) * fix(persistence): order a cached channel query given no sort An empty or absent sort left the cached page in whatever order the cid lookup returned, so a controller that names no sort got the API's ordering online and an arbitrary one offline. A cached read has no server to defer to, so it applies `ChannelSort.defaultSort` — the ordering the query would have had. Co-Authored-By: Claude Opus 5 (1M context) * test(core): size the empty-sort pages past the insertion-sort threshold At five items the test passed with the guard removed: `List.sort` is a stable insertion sort at or below 32 items, so an all-equal comparator preserves the order there whether the sort runs or not. Fifty items reaches the unstable quicksort, which is the case the guard exists for — both tests now fail without it. Co-Authored-By: Claude Opus 5 (1M context) * fix(core): sort a loaded page with a stable sort `sorted` is `List.sort`, which is a dual-pivot quicksort above 32 elements and reorders elements the comparator calls equal. A sort with ties — members batch-added share a `created_at`, and the server breaks that tie on `user_id` where the local comparator cannot — therefore scrambled its tied rows on every page append, once the list grew past a page or two. `sortedByCompare` is `mergeSortBy`, which is stable. At these sizes the cost is microseconds: 4µs for 100 items, 57µs for 1000. Trims the sort docs and comments to what a caller cannot read off the code. Co-Authored-By: Claude Opus 5 (1M context) * refactor(core): drop the empty-sort short-circuit It existed because `sorted` permuted a page an empty sort compared as all equal. The sort is `sortedByCompare` now, which is stable, so an empty sort already leaves the page as it arrived — the branch restated what the sort does. `an empty sort leaves a page in the order it arrived in` still fails if the sort goes back to an unstable one, which is what the branch was really guarding. Co-Authored-By: Claude Opus 5 (1M context) * fix(core)!: order a stateless channel by the sort's null ordering The local sort intercepted a channel whose state was disposed and pinned it last, overriding the ordering every other null in the same sort obeys. A channel with state but a null value in the sorted field already went through `nullOrdering`; only a channel with no state at all was special-cased. It now passes straight to the comparator, so both nulls are placed the same way. Under `ChannelSort.defaultSort` — descending, nulls first — a disposed channel sorts to the top rather than the bottom. Co-Authored-By: Claude Opus 5 (1M context) * refactor(core): sort a loaded page with stream_core's `sortedWith` Every controller reached a stable sort through `sortedByCompare((it) => it, …)`, an identity key standing in for a method core did not have. It has one now, so each list sorts by the comparator alone — including the channel list, whose key extractor existed only to feed a null triage that is gone. `stream_chat_flutter_core` names `stream_core` directly rather than reaching it through `stream_chat`'s barrel: that barrel already exports this package's own `SortedListX`, which declares `sortedInsert`, `sortedUpsert` and `sortedUpsertAt` too, so re-exporting core's would leave every caller of those three with an ambiguous extension until the list extensions move over. Co-Authored-By: Claude Opus 5 (1M context) * fix(core): keep a disposed channel at the end of the list Reverts the ordering change in 7221c6b6. `last_updated` is never null on the server — Postgres computes `GREATEST(last_message_at, created_at)`, which ignores nulls, and `ChannelModel.lastUpdatedAt` mirrors that — so a null key here means only one thing: the channel was disposed. There is no API ordering to defer to, and a row about to disappear surfacing at the top of a descending list is worse than it sinking. The rule now lives in a named comparator rather than inline, so the sort reads as one line and the reason is stated where it applies. Co-Authored-By: Claude Opus 5 (1M context) * style(core): wrap the channel list sort call Co-Authored-By: Claude Opus 5 (1M context) * style(persistence): drop a stray blank line in the client test Co-Authored-By: Claude Opus 5 (1M context) * docs(repo): say that this phase is what pins core to an unreleased commit The plan's prerequisites still read "nothing in phase 08 waits on a core release" — true until this phase started depending on `sortedWith`, which no published `stream_core` carries. Records the unstable-sort fix in the changelog too: rows a sort called equal were reordered on every page append, which is a behaviour change a reader upgrading would want to see. Co-Authored-By: Claude Opus 5 (1M context) * test(llc): split the sort tests, and correct two more release-blocker claims `sort_test.dart` had grown to 818 lines across six groups doing the job files should do. It splits along the seam the groups already drew: what the registries declare and how a sort is built, against how a sort orders values. One group was still named for `StreamSortField`, a class that was never built. The skill doc and the upstream index still described `stream_core` as a hosted dependency with nothing blocking a release, which stopped being true when this phase pinned it for `sortedWith`. Co-Authored-By: Claude Opus 5 (1M context) * docs(repo): trim two changelog entries and name two groups by precondition `stream_chat`'s entry listed six `default*ListSort` constants that live in `stream_chat_flutter_core` and are already listed in its changelog, which is the per-method enumeration the changelog policy warns off. `single field` and `Composite Sorting` named the shape of a sort rather than the precondition the tests under them share. Co-Authored-By: Claude Opus 5 (1M context) * docs(llc): describe what a caller sees, not how the server stores it Two sort docs reached past the contract: one named the column a query sorts unnamed users by, the other named the two things a search can be backed by. Neither is something a caller can observe or act on. Co-Authored-By: Claude Opus 5 (1M context) * docs(repo): correct what the preset sort fallback actually mismatches on The recorded gap does not happen by the route the plan described. When the server flags a query as filtering on `last_message_at` it rewrites a sent `last_updated` to `last_message_at`, so sending `ChannelSort.defaultSort` and resolving `last_message_at` agree. The real gap is that `_touchesField` is looser than the condition it mirrors: the server needs every `last_message_at` node reachable through `$and` alone and one narrowing by value, while ours asks only whether the field appears. Filed in DEFERRED.md rather than fixed here — closing it inverts a test. Also: `_defaultSortFor` names `lastUpdated` itself instead of borrowing `ChannelSort.defaultSort`, which it matches only by coincidence; nothing sorts a thread list locally, so the plan should not say `ThreadSort.defaultSort` exists to; and `User.name`'s promotion out of `extraData` is recorded against the `User` shape decision it belongs to. Co-Authored-By: Claude Opus 5 (1M context) * docs(repo): name the function that outlives this rung, not its helper The private helper is renamed by the filter phase; `_defaultSortFor` is what carries the behaviour through. Co-Authored-By: Claude Opus 5 (1M context) * fix(llc): add the user sort field the plan said shipped, and correct two defaults it got wrong `08-query-dsl.md` records `teams` as one of the two fields added to the user registry, but it was never declared. The backend accepts it: it is in the user table's `Columns` with a `TargetName`, and `user` declares no `AllowedSortCombinations` to reject it. A team list has no ordering, so a local re-sort leaves the page as it arrived. The same doc's backend column was wrong in two rows. `PollVote.DefaultSort()` is `created_at` asc and `MessageReminder.DefaultSort()` is `remind_at` asc, where the table claimed neither had a default. The poll-vote row went further and proposed flipping ours to descending for consistency with reactions, on that false premise; reactions really are descending, poll votes really are ascending, and the code already matched the API. Also: the scope table claimed `ComparableField` folded into a `StreamSortField` the same file later says was never built, behind a link to a heading that does not exist; and the migration guide's custom-sort example used `Sort.desc`, which yields a `Sort` that no migrated signature accepts. Co-Authored-By: Claude Opus 5 (1M context) * refactor(llc): drop ThreadSort.defaultSort, which the client cannot honour It named the ordering a thread query already has when given no sort — unread, then last message, then parent message id — so sending it bought nothing but a wider code path on the server. Sorting by it locally is worse: a `Thread` carries no per-user unread state, so `ThreadSortField.hasUnread` reads nothing and the first term silently drops. The list comes out ordered by last message date, which is not what the server returns. Declaring the constant only invited a caller to reach for an ordering the client cannot deliver. `ThreadSortField.hasUnread` stays — the server can sort by it. Co-Authored-By: Claude Opus 5 (1M context) * docs(llc): drop the note explaining an absent member Why `ThreadSort` has no `defaultSort` belongs in the CHANGELOG and the phase doc, not as a comment on the empty space where it would have been. Co-Authored-By: Claude Opus 5 (1M context) * docs(llc): log the sort fields and defaults this phase actually added `UserSortField.teams` and `PollSort.defaultSort` shipped without an entry. The note that `ThreadSort` has no default now qualifies the bullet claiming every sort owns one, instead of standing alone under Changed where nothing changed. Co-Authored-By: Claude Opus 5 (1M context) * docs(llc): drop the changelog note about a default that never existed `ThreadSort` is new in v11, so no consumer had a `ThreadSort.defaultSort` to lose. Why it has none belongs in the phase doc, not in a release note. Co-Authored-By: Claude Opus 5 (1M context) * build(repo): pin stream_core to the ref v11 now needs, overriding its one source v11 picked up `StreamMessageAnnotation.separator`, which the `chat-integration/v11` ref this rung pinned predates, so the pin moves to core's `main`. That ref cannot carry the commit the old one did — `stream_core_flutter` depending on `stream_core` by path — because a path dependency would block publishing it. Its hosted constraint is a second source for a package this workspace takes from git, and pub allows only one, so each package seeing both overrides `stream_core` to the same ref. The overrides are scaffolding for the same window as the pins and come out when core publishes a release carrying these APIs. Co-Authored-By: Claude Opus 5 (1M context) --------- Co-authored-by: Claude Opus 5 (1M context) --- .claude/skills/openapi-codegen/SKILL.md | 12 +- analysis_options.yaml | 5 + core-migration/07-websocket.md | 165 ++++ core-migration/08-query-dsl.md | 822 +++++++++++++++++- core-migration/DEFERRED.md | 6 +- core-migration/README.md | 7 +- core-migration/UPSTREAM.md | 28 +- docs/docs_screenshots/pubspec.yaml | 10 +- .../test/src/golden_client_stubs.dart | 10 +- melos.yaml | 18 +- migrations/v11-migration.md | 19 + openapi-migration/01-foundation.md | 7 + packages/stream_chat/CHANGELOG.md | 18 + .../lib/src/client/channel/channel.dart | 8 +- .../stream_chat/lib/src/client/client.dart | 35 +- .../lib/src/core/api/channel_api.dart | 3 +- .../lib/src/core/api/general_api.dart | 6 +- .../lib/src/core/api/message_api.dart | 5 +- .../lib/src/core/api/moderation_api.dart | 2 +- .../lib/src/core/api/polls_api.dart | 5 +- .../lib/src/core/api/reminders_api.dart | 3 +- .../lib/src/core/api/sort_order.dart | 183 ---- .../lib/src/core/api/sort_order.g.dart | 14 - .../lib/src/core/api/threads_api.dart | 3 +- .../lib/src/core/api/user_api.dart | 3 +- .../lib/src/core/models/banned_user.dart | 50 +- .../lib/src/core/models/channel_state.dart | 210 ++++- .../lib/src/core/models/comparable_field.dart | 60 -- .../lib/src/core/models/draft.dart | 63 +- .../lib/src/core/models/member.dart | 108 ++- .../lib/src/core/models/message.dart | 116 ++- .../lib/src/core/models/message_reminder.dart | 84 +- .../stream_chat/lib/src/core/models/poll.dart | 99 ++- .../lib/src/core/models/poll_vote.dart | 84 +- .../src/core/models/predefined_filter.dart | 18 +- .../src/core/models/predefined_filter.g.dart | 6 +- .../lib/src/core/models/reaction.dart | 62 +- .../lib/src/core/models/thread.dart | 126 ++- .../stream_chat/lib/src/core/models/user.dart | 137 ++- .../lib/src/db/chat_persistence_client.dart | 9 +- packages/stream_chat/lib/stream_chat.dart | 6 +- packages/stream_chat/pubspec.yaml | 6 +- .../test/src/client/channel/channel_test.dart | 4 +- .../test/src/client/client_test.dart | 22 +- .../test/src/core/api/channel_api_test.dart | 6 +- .../test/src/core/api/general_api_test.dart | 10 +- .../test/src/core/api/polls_api_test.dart | 13 +- .../test/src/core/api/reminders_api_test.dart | 3 +- .../test/src/core/api/user_api_test.dart | 2 +- .../src/core/models/banned_user_test.dart | 55 +- .../src/core/models/channel_state_test.dart | 188 +--- .../core/models/comparable_field_test.dart | 265 ------ .../test/src/core/models/draft_test.dart | 35 +- .../test/src/core/models/member_test.dart | 187 ++-- .../core/models/message_reminder_test.dart | 79 +- .../test/src/core/models/message_test.dart | 142 +-- .../test/src/core/models/poll_test.dart | 192 +--- .../test/src/core/models/poll_vote_test.dart | 126 +-- .../core/models/predefined_filter_test.dart | 69 +- .../test/src/core/models/reaction_test.dart | 37 +- .../sort_comparison_test.dart} | 297 ++++--- .../src/core/models/sort_registry_test.dart | 433 +++++++++ .../test/src/core/models/thread_test.dart | 49 ++ .../test/src/core/models/user_test.dart | 163 +--- .../src/db/chat_persistence_client_test.dart | 3 +- packages/stream_chat/test/src/utils.dart | 31 + .../stream_chat_flutter/example/lib/main.dart | 2 +- .../example/lib/split_view.dart | 2 +- .../example/lib/tutorial_part_2.dart | 2 +- .../example/lib/tutorial_part_3.dart | 2 +- .../example/lib/tutorial_part_4.dart | 2 +- .../example/lib/tutorial_part_5.dart | 2 +- .../example/lib/tutorial_part_6.dart | 2 +- .../stream_chat_flutter/example/pubspec.yaml | 6 + .../stream_mention_autocomplete_options.dart | 2 +- .../detail/reaction_detail_sheet.dart | 2 +- packages/stream_chat_flutter/pubspec.yaml | 10 +- .../stream_chat_flutter_core/CHANGELOG.md | 6 + .../lib/src/stream_channel.dart | 2 +- .../src/stream_channel_list_controller.dart | 70 +- .../lib/src/stream_draft_list_controller.dart | 37 +- .../src/stream_member_list_controller.dart | 37 +- ...ream_message_reminder_list_controller.dart | 37 +- ...stream_message_search_list_controller.dart | 6 +- .../src/stream_poll_vote_list_controller.dart | 37 +- .../src/stream_reaction_list_controller.dart | 12 +- .../src/stream_thread_list_controller.dart | 9 +- .../lib/src/stream_user_list_controller.dart | 37 +- .../stream_chat_flutter_core/pubspec.yaml | 5 + .../stream_channel_list_controller_test.dart | 30 +- .../stream_draft_list_controller_test.dart | 81 +- .../stream_member_list_controller_test.dart | 24 + ...message_reminder_list_controller_test.dart | 27 + .../stream_reaction_list_controller_test.dart | 40 +- .../stream_user_list_controller_test.dart | 25 + .../example/pubspec.yaml | 6 + .../stream_chat_localizations/pubspec.yaml | 8 + packages/stream_chat_persistence/CHANGELOG.md | 5 + .../src/converter/channel_sort_converter.dart | 26 + .../lib/src/converter/converter.dart | 2 +- .../src/converter/sort_order_converter.dart | 26 - .../lib/src/dao/channel_query_dao.dart | 4 +- .../lib/src/db/drift_chat_database.dart | 2 +- .../lib/src/db/drift_chat_database.g.dart | 39 +- .../src/entity/channel_queries_metadata.dart | 2 +- .../src/stream_chat_persistence_client.dart | 28 +- .../channel_sort_converter_test.dart | 57 ++ .../converter/sort_order_converter_test.dart | 27 - .../test/src/dao/channel_query_dao_test.dart | 28 +- .../stream_chat_persistence_client_test.dart | 58 +- .../pages/channel_file_display_screen.dart | 2 +- .../pages/channel_media_display_screen.dart | 2 +- sample_app/lib/pages/new_chat_screen.dart | 2 +- .../lib/pages/new_group_chat_screen.dart | 2 +- .../lib/pages/pinned_messages_screen.dart | 2 +- sample_app/lib/widgets/add_members_sheet.dart | 2 +- sample_app/lib/widgets/channel_list.dart | 4 +- sample_app/pubspec.yaml | 8 + 118 files changed, 3621 insertions(+), 2329 deletions(-) delete mode 100644 packages/stream_chat/lib/src/core/api/sort_order.dart delete mode 100644 packages/stream_chat/lib/src/core/api/sort_order.g.dart delete mode 100644 packages/stream_chat/lib/src/core/models/comparable_field.dart delete mode 100644 packages/stream_chat/test/src/core/models/comparable_field_test.dart rename packages/stream_chat/test/src/core/{api/sort_order_test.dart => models/sort_comparison_test.dart} (51%) create mode 100644 packages/stream_chat/test/src/core/models/sort_registry_test.dart create mode 100644 packages/stream_chat_persistence/lib/src/converter/channel_sort_converter.dart delete mode 100644 packages/stream_chat_persistence/lib/src/converter/sort_order_converter.dart create mode 100644 packages/stream_chat_persistence/test/src/converter/channel_sort_converter_test.dart delete mode 100644 packages/stream_chat_persistence/test/src/converter/sort_order_converter_test.dart diff --git a/.claude/skills/openapi-codegen/SKILL.md b/.claude/skills/openapi-codegen/SKILL.md index 953a7a77be..e2c0ec9d81 100644 --- a/.claude/skills/openapi-codegen/SKILL.md +++ b/.claude/skills/openapi-codegen/SKILL.md @@ -146,10 +146,14 @@ emitted by `model.tpl` / `discriminator.tpl` plus a `WsEvent` re-export from `mo `stream_chat` depends on `retrofit`, `retrofit_generator`, `json_annotation ^4.12.0` and `stream_core`. -`stream_core` is a **hosted** dependency: `^0.5.0`, declared in `melos.yaml` and -`packages/stream_chat/pubspec.yaml`, with no `dependency_overrides` entry anywhere. 0.5.0 ships -`StreamDateTimeConverter` and the sealed error layer, so **no core release is blocking**. Change -the constraint in `melos.yaml` only, then `melos bootstrap` — never in a package manifest. +`stream_core` is pinned to a **git commit** on the v11 branch, not a hosted constraint: +`melos.yaml` names a SHA for both `stream_core` and `stream_core_flutter`, because the branch uses +core APIs no published version carries. `melos bootstrap` syncs that into each package manifest, +which is why you will see a `git:` block there, and it makes those packages unpublishable until a +hosted constraint is restored. 0.5.0 still ships `StreamDateTimeConverter` and the sealed error +layer, which is everything the generated output needs, so **no core release blocks the generated +client**. Change the constraint in `melos.yaml` only, then `melos bootstrap` — never in a package +manifest. That is the dependency side only. The generator is still a prerequisite on its own: `client.tpl` emits `runSafely`, and regenerating before the template change above lands reintroduces the old diff --git a/analysis_options.yaml b/analysis_options.yaml index 9e1bb75d0d..64dc584762 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,4 +1,9 @@ analyzer: + errors: + # `stream_core` comes from a git ref until it is published for v11, + # which makes these packages temporarily unpublishable. Remove this + # together with the git dependency in `melos.yaml`. + invalid_dependency: ignore exclude: - packages/*/lib/**/*.g.dart - packages/*/lib/scrollable_positioned_list/** diff --git a/core-migration/07-websocket.md b/core-migration/07-websocket.md index 7c70e8312b..f00787831e 100644 --- a/core-migration/07-websocket.md +++ b/core-migration/07-websocket.md @@ -1,5 +1,14 @@ # 07 — WebSocket transport +> **Parked.** A full attempt was written and reverted (`git reset` off +> `refactor/migrate-to-core`); nothing from this phase is in the tree. Everything below is kept +> because it is what the attempt established — read [Findings from the first +> attempt](#findings-from-the-first-attempt) before restarting, since most of the cost was in +> discovering those, not in the code. +> +> The phases after this one do not depend on it: `ConnectionIdManager` stays ours either way, and +> `Event` is untouched. Resume when the WS is worth a PR of its own. + **Goal:** replace our 560-line WebSocket monolith with core's decomposed engine, health monitor, retry strategy, reconnection policies and connection state machine — **on the existing v1 protocol**, with v1 event shapes and chat's `Event` model untouched. @@ -33,6 +42,31 @@ called **per attempt**, so a refreshed token is picked up on reconnect — which **Moving to v2 remains out of scope.** This phase adopts the machinery, not the protocol. +### Staying on v1 is the same call iOS made, and v2 is not ready for chat + +`stream-chat-swift` has migrated to `StreamCore` (`StreamCore+Extensions.swift`, the shared +`WebSocketClient`) and to v2 OpenAPI endpoints for messages, reminders and message actions — and +it still connects over v1 with `?json=` (`WebSocketConnectEndpoint.swift`, `WebSocketConnectPayload`). +`stream-core-swift` absorbed chat's handshake quirks into the shared client rather than letting +chat fork it: `healthCheckBeforeConnected` is documented "Compatibility reasons for chat which has +to set it to true", alongside an optional `connectRequest` and a `requiresAuth` flag. That is the +model this phase follows — stay on v1, push chat's needs into core where they generalize. + +Three things the server would have to change or core would have to grow before chat's WS could +move to `/api/v2/connect` (`lib/core/api/connect/routes.go`), all verified in +`~/GolandProjects/chat`: + +- **v2's connect does not enrich user mutes.** `chatState.EnrichUserMutes` is called in + `lib/chat/controller/v1/connect.go:118` and `longpoll.go:108`, and nowhere in + `lib/core/api/connect/controller/connect_v2.go`. `OwnUser.mutes` would come back empty. +- **v2 drops root-level custom user fields.** Its `user_details` payload + (`commonpayloads.ConnectUserDetailsRequest`) is decoded with `WithDecodeExtraFields(false)` and + reads `custom` as a nested object, while v1 flattens unknown root keys into custom. Chat's + `ConnectUserDetails.toJson` promotes `extraData` to the root, so those fields would be silently + discarded. +- **Core's `ConnectUserDetailsRequest` has no `privacySettings`.** The v2 Go payload accepts + `privacy_settings`; core's Dart mirror does not carry it. + ## Scope | Delete | Adopt | @@ -184,6 +218,137 @@ Implement both in `stream_chat_flutter_core` (see the README for why not `stream and inject them into the handler. Note `stream_chat_flutter_core.dart:3` re-exports all of `connectivity_plus` — keep the re-export, but this is itself a public change in that package. +## Findings from the first attempt + +The attempt reached a green `stream_chat` suite before being reverted. What it established, in the +order it would be rebuilt: + +**1. `Event extends WsEvent`** — additive, as planned. `healthCheckInfo` reports the connection id +on `health.check`, which covers both the acknowledgement that opens a connection and the pongs that +keep it alive. `error` stays `null` by inheritance. + +**2. `ChatWsCodec`** — simpler than feeds', which has to unwrap a generated union and patch in +three frames its spec omits. Chat's protocol puts every event in the same shape, so a frame decodes +straight to an `Event`; the one exception is a refusal, which becomes a `ConnectionErrorEvent`. + +The refusal frame is `{"type":"connection.error","created_at":…,"connection_id":"","error":{…}}` — +it *does* carry a type (`monolith/types/event_schema_registry.go:374`, +`event_video.go:533`), so dispatch on `type == 'connection.error'` and not on the presence of an +`error` key. It needs its own event because `Event` has no field for the payload and would drop it. + +That event carries `Object error` rather than a `StreamApiError`, deliberately. +`StreamApiError.fromJson` requires `code`, `message` and `StatusCode`, while chat's own +`ErrorResponse` had all three nullable — so a payload missing one would throw and we would lose the +refusal entirely, leaving only a close code that says nothing (auth, token and permission failures +all close with 1000). Instead the raw payload is carried, and `stream_core` wraps anything it does +not recognize in a `StreamClientException`; the frame still ends the connection either way. + +**3. `buildChatWsOptions`** — the connect URL, as a pure function, so it can be tested against +what goes on the wire without a socket. `stream_core`'s provider does +`Uri.parse(url).replace(queryParameters: …)`, so chat resolves the scheme (`http`/`ws` → `ws`, +`https`/`wss` → `wss`), host, port and `/connect` path itself and hands over the query map. + +### The constraint feeds does not have: a synchronous options builder + +`WebSocketOptionsBuilder` is `WebSocketOptions Function()` — **synchronous**, called once per +attempt. Chat's `_buildUri` was `async` because it awaited `tokenManager.getToken()`. + +Feeds has no such problem, and looking at why is what explains core's shape: its `optionsBuilder` +carries **no token at all** — just `api_key`, `stream-auth-type` and `X-Stream-Client`, all +synchronously available. The token goes out in `_authenticateUser`'s `WsAuthMessageRequest`, which +*is* async, so feeds refreshes on `previousError.isTokenExpired` and sends the fresh token **within +the same attempt**. Core's async authenticator exists precisely because v2 authenticates in a +frame. + +Chat authenticates in the URL — the token appears three times, in `json`'s `user_token`, in +`authorization` and via `stream-auth-type` — so it has to be readable synchronously at attempt +time. Consequences, decided: + +- **The token is cached, not fetched, in the builder.** `StreamChatClient` loads one before it + calls `connect()`, so a first attempt is always fresh. `TokenManager.onTokenUpdated` keeps the + cached copy current. +- **A refused token costs one extra attempt.** `onAuthenticate` still gets supplied — not to send + anything, since v1 sends nothing after open, but because it is the only async hook that receives + `previousError`. It expires and refetches there, which makes the *next* attempt's URL fresh + rather than the current one's. Chat used to do this in two attempts via + `_reconnect(refreshToken: true)`; core's recovery does it in three. +- **That cost is narrow.** It only applies when the server refuses a token the client believed + valid — clock skew, or a revocation. `UserToken.isExpired` covers the ordinary case before the + URL is ever built, which chat's old `Token` could not do. + +The alternative was keeping chat's own reconnect loop so it could await a fresh token before each +attempt, preserving two attempts exactly. Rejected: it would leave `ConnectionRecoveryHandler`, +`RetryStrategy` and the reconnection policies unadopted, and with them the 410 lines of lifecycle +and connectivity wiring in `stream_chat_flutter_core` that this phase exists to delete. + +### The ping frame is not a wire difference: use core's default + +Chat's old ping and core's default disagree on the key — chat serialized a whole `Event` +(`{"type":"health.check","connection_id":"…","created_at":"…","is_local":true}`), core sends +`{"type":"health.check","client_id":"…"}` — and it does not matter. The server never reads the +body. + +`Client.MonitorHealth` (`monolith/engine/websocket/client.go:607-620`) reads the next frame, +returns on `OpClose`, and otherwise calls `reader.Discard()`. Any frame at all is the keepalive; +the health check it replies with is built server-side from its own client id +(`coreevent.NewHealthCheckEvent(wsClientID)`). iOS relies on this directly: for +`webSocketClientType == .coordinator` it sends a raw WebSocket protocol ping +(`WebSocketClient.sendPing() → engine?.sendPing()`), no JSON at all. + +So `pingRequestBuilder` is left at its default and there is no chat-side ping type. The +"backgrounding past the ping interval" case in the definition of done still applies — it exercises +the monitor's cadence, not the frame. + +### Two traps in core's state emitter, both of which bit + +**`isActive` is not "connecting".** It means "anything but `Disconnected`", which includes +`Initialized` — where every fresh client starts. Guarding `_connectUser` with it made *every* first +connect throw "User already getting connected". The guard has to pattern-match +`Connecting() || Authenticating()`. + +**`waitFor` resolves on the *current* value.** `connectionState` is a state emitter, so it replays +what it holds to a new listener. `waitFor()` therefore fired immediately on any +client that had disconnected before, and `openConnection` reported "User initiated disconnection" +for a connection it had not attempted yet. Both outcomes have to be armed **before** `connect()`, +with the starting state dropped: + +```dart +final acknowledged = _ws.events.whereType().firstWhere((it) => it.type == EventType.healthCheck); +// `skip(1)` drops the state this attempt starts from. +final refused = _ws.connectionState.skip(1).firstWhere((it) => it is Disconnected); + +_ws.connect().ignore(); +final outcome = await Future.any([acknowledged, refused]); +``` + +The real client sets `Connecting` synchronously inside `connect()`, so arming after it happens to +work — which is exactly why this is worth writing down rather than relying on. + +### Three test-harness facts worth not rediscovering + +- **The fake has to be a real `StreamWebSocketClient`**, faked over `MutableEventEmitter` + and `MutableConnectionStateEmitter` (both exported from core). Driving those two emitters is the + whole harness; `connect()` sets `Connecting` then emits a `health.check`. +- **One subscription to `_ws.events`, not two.** A `firstWhere` inside `openConnection` alongside + the constructor's `listen(handleEvent)` gives no ordering guarantee between them, so + `openConnection` can return before `handleEvent` has run and `state.currentUser` is stale. Feed + the waiting completer *from* the single listener, after dispatching. +- **A more faithful fake surfaces a pre-existing write.** Every server health check carries a + connection id, so `_handleHealthCheckEvent` writes `updateConnectionInfo` to persistence roughly + every 25s — that is current behaviour (the old code passed `handler: handleEvent` to `WebSocket` + too), but the old fake bypassed `handleEvent` entirely, so no test ever saw it. Groups that + connect with persistence need it stubbed. Sourcing the connection id from + `connectionState.value case Connected(:final healthCheck)` the way feeds does would remove the + per-ping churn at the root. + +### `StreamWebSocketError` would go with this phase + +Phase [03](03-errors.md) deferred it here: `DisconnectionSource.serverInitiated(error:)` carries +the reason, so nothing would produce it. Its `data == null` retry test goes too — the offline +fallback in `connectUser` keys off the sealed retry table instead. That closes one of the four +preconditions for deleting `stream_chat_error.dart`, and closing it is now blocked on this phase +resuming. + ## Decisions to make - Where the **initial**-connect retry lives now that `ConnectionRecoveryHandler` won't do it. diff --git a/core-migration/08-query-dsl.md b/core-migration/08-query-dsl.md index 46f5535604..a9ffe1cccf 100644 --- a/core-migration/08-query-dsl.md +++ b/core-migration/08-query-dsl.md @@ -4,15 +4,16 @@ evaluated client-side as well as sent to the server. **Size:** ~600 chat LOC deleted against ~1,420 core LOC. The widest public break after phase -[03](03-errors.md), and the one hard upstream block in the plan. +[03](03-errors.md). **No upstream `stream_core` work** — and three operators chat should deprecate +rather than port. ## Scope | Delete | Adopt | | --- | --- | | `lib/src/core/models/filter.dart` (241) — `Filter`, `FilterOperator` | `stream_core` `query/filter/` — `sealed Filter`, `FilterField`, `FilterOperator` | -| `lib/src/core/api/sort_order.dart` (183) — `SortOrder`, `SortOption`, `NullOrdering` | `stream_core` `query/sort.dart` — `Sort`, `SortField`, `SortDirection`, `NullOrdering` | -| `lib/src/core/models/comparable_field.dart` (~85) | `stream_core` `utils/comparable_field.dart` (90) | +| `lib/src/core/api/sort_order.dart` (183) — `SortOption`, `NullOrdering`, `CompositeComparator` | `stream_core` `query/sort.dart` — `Sort`, `SortField`, `SortDirection`, `NullOrdering`, `CompositeComparator` | +| `lib/src/core/models/comparable_field.dart` (~85) — `ComparableField`, `ComparableFieldProvider` | folded into the per-model `SortField` subclasses — `ChannelSortField`, `MemberSortField`, … (see [below](#what-shipped-instead-of-a-chat-side-streamsortfield)) | | `lib/src/core/models/location_coordinates.dart` | `stream_core` `query/filter/location/location_coordinate.dart` | | `lib/src/core/models/predefined_filter.dart` (84) | reworked onto `FilterField` registries | @@ -62,22 +63,504 @@ class ChannelFilterField extends FilterField { That registry is the bulk of this phase's work, and it is also the payoff: client-side filtering is something chat cannot do at all today. -## The hard upstream block +## The filter half, decided -**Core lacks three operators chat exposes publicly:** +An earlier pass planned to deprecate `$ne`, `$nin` and `$nor` and upstream `$nor` to core. The +first is right for a stronger reason than the one recorded; the second is wrong. What follows +replaces it. -| Ours | Wire | In core? | +**Remove `$ne` and `$nin`, citing the backend.** [GetStream/chat#15657](https://github.com/GetStream/chat/pull/15657) +is merged: `FilterColumns()` stops publishing both to the OpenAPI spec for every product, because +each scans a whole table to exclude a few rows and times out at customer scale. The same removal +already ran on iOS (#3414), React (#2504), React Native (#2672) and JS LLC (#1363). That is a far +better citation than Android's deprecation messages, which is all the earlier pass had. + +It is **spec-only** — the query layer still accepts both — and the withdrawal is **per field, not +blanket**. `isPublishedOperator` keeps `$ne` on classifier boolean fields and `$ne`/`$nin` on +anti-join indexed ones, which for chat means `$ne` and `$nin` on `queryUsers.id`, and `$ne` on +`banned`, `shadow_banned` and `bypass_moderation`. Those exceptions have to be named wherever the +removal is documented. + +**Remove `$nor` too, and do not upstream it.** Neither StreamCore (Swift) nor stream-android-core +models it, and adding it to Dart core alone breaks a parity the three otherwise keep. It is not +deprecated anywhere and #15657 leaves it accepted, so the operator is not dead — but a chat client +does not need to *offer* it, and a preset that uses it is handled by the raw fallback below. + +## `PredefinedFilter` is what makes the decode interesting + +The server echoes the filter it resolved for a preset. That filter is authored server-side, and +since #15657 is spec-only it can legitimately contain `$ne`, `$nin` or `$nor` — operators core's +sealed `Filter` has no variant for. So the echo cannot always be represented by a typed filter, +and `Filter` being sealed means chat cannot add a variant to hold it. + +Typing the field `Map` was considered. It is honest and it deletes real code — +`_filterFromJson`, `_touchesField` (whose `Filter`-walking branches are already dead for a raw +value), and `FilterConverter`, which the existing `MapConverter` replaces byte-for-byte +on disk. It was rejected for asymmetry: `PredefinedFilter.sort` decodes into typed `ChannelSort` +objects, and a filter that stays a map next to it is an inconsistency, not a simplification. + +**So the decode mirrors the sort side, and stays total by having a fallback at each level:** + +| | unknown value | fallback | | --- | --- | --- | -| `Filter.notEqual` | `$ne` | **no** | -| `Filter.notIn` | `$nin` | **no** | -| `Filter.nor` | `$nor` | **no** | +| sort direction | not `-1` | `asc` | +| sort field | not declared | `XSortField.custom(remote)` (channel, member, user and message search — the resources whose sort validation stays open) | +| filter field | not declared | `XFilterField.custom(remote)` | +| **filter operator** | `$ne` / `$nin` / `$nor` / anything new | **`Filter.raw({that node})`** | + +That is what `Filter.raw` is for, and it is the only reason core needs it — see +[UPSTREAM.md](UPSTREAM.md). A preset using a withdrawn operator decodes into a tree that is typed +everywhere except that one leaf, rather than throwing or collapsing to a blob. + +**chat-android is the reference implementation, and shows why we need one thing it does not.** +Its `FilterObjectConverter` decodes a map by dispatching on the operator key — `$and`/`$or`/`$nor` +recurse, leaves map to `Filters.eq/ne/contains/gt/gte/lt/lte/in/nin/autocomplete/exists` — and +**throws `IllegalArgumentException`** on anything else. No fallback. Two things make that safe +there and unsafe here: + +- It is a Room `TypeConverter` on `ChatDatabase`, so it only ever reads back a filter Android + itself wrote. The input cannot contain an operator Android's own API cannot produce. Our + predefined filter is authored server-side by the app owner, so it can. +- Its field is a bare `fieldName: String`, so an unrecognised field is not a problem. Our + `FilterField` carries a value getter, which is why the field needs a `custom` fallback and + Android's does not. + +Worth noting while reading it as a reference: Android models no `$q` at all, so its operator set +is not a target to match. + +`Filter.fromJson` therefore depends on a per-model `FilterField` registry with a `fromRemote`, +exactly as `ChannelSortField.fromRemote` works. The registry is not optional scaffolding for +`matches()`; it is what makes the decode possible. + +## The filterable fields, verified + +Extracted from `mq.TableConfig.Columns` for each resource, resolving named operator sets +(`SupportedColumnOperators` is `$eq $ne $gt $gte $lt $lte $in $nin $exists`). 111 fields. This is +the registry to write, and the source for each field's **Supported operators:** line. + +Two things the table does not encode, both from +[GetStream/chat#15657](https://github.com/GetStream/chat/pull/15657): + +**`$ne` and `$nin` are withdrawn from the published spec**, so they are struck from every field +below *except* the index-safe exceptions. Those are `user` only, and they are real: + +```go +BooleanFields: {banned, shadow_banned, bypass_moderation} // $ne stays +AntiJoinIndexedFields: {id} // $ne and $nin stay +``` + +`DefaultChannelConfig` declares neither, so no channel field keeps them. + +**This is the one place removing an operator costs a capability.** `$nin` on `user.id` is how you +express "everyone except these people", which `classification_user.go` calls "the dominant +exclude-self people-search pattern" and optimises deliberately — the same comment notes `$nor` +over `id` is optimised for the same reason. Core models neither `$nin` nor `$nor`, so after the +migration that query is reachable only through `Filter.raw`. Decide before writing `UserFilterField` +whether that is acceptable or whether the registry should expose a purpose-built helper for it. + +
+111 fields — raw extraction; apply the two overlays above before reading a row + +The rows are `mq.TableConfig.Columns` verbatim, so they still carry `$ne` and `$nin` wherever the +backend's query layer accepts them. The published spec does not: strike both from every row except +`user.id` (`$ne`, `$nin`) and `user.banned` / `shadow_banned` / `bypass_moderation` (`$ne`). No +channel row keeps either. + +| resource | field | type | operators | +| --- | --- | --- | --- | +| channel | `id` | String | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | +| channel | `cid` | String | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | +| channel | `type` | String | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | +| channel | `last_message_at` | Date | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | +| channel | `last_updated` | Date | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | +| channel | `created_at` | Date | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | +| channel | `updated_at` | Date | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | +| channel | `member_count` | Number | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | +| channel | `message_count` | Number | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | +| channel | `frozen` | Boolean | `$eq` | +| channel | `team` | String | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | +| channel | `created_by_id` | String | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | +| channel | `disabled` | Boolean | `$eq` | +| channel | `hidden` | Boolean | `$eq` | +| channel | `blocked` | Boolean | `$eq` | +| channel | `archived` | Boolean | `$eq` | +| channel | `joined` | Boolean | `$eq` | +| channel | `invite` | String | `$eq` | +| channel | `name` | String | `$autocomplete` `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` `$q` | +| channel | `app_banned` | String | `$eq` | +| channel | `muted` | Boolean | `$eq` | +| channel | `member.user.name` | String | `$autocomplete` `$eq` `$ne` | +| channel | `members` | String | `$in` `$nin` | +| member | `id` | String | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | +| member | `user_id` | String | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | +| member | `created_at` | Date | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | +| member | `updated_at` | Date | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | +| member | `is_moderator` | Boolean | `$eq` `$ne` | +| member | `channel_role` | String | `$eq` `$in` | +| member | `banned` | Boolean | `$eq` | +| member | `name` | String | `$autocomplete` `$eq` `$in` `$ne` `$nin` `$q` | +| member | `user.email` | String | `$autocomplete` `$eq` `$in` `$ne` `$nin` `$q` | +| member | `user.nd_deactivated` | Boolean | `$eq` | +| member | `last_active` | Date | `$eq` `$gt` `$gte` `$lt` `$lte` `$ne` | +| member | `cid` | String | `$eq` | +| member | `invite` | String | `$eq` | +| member | `joined` | Boolean | `$eq` | +| member | `notifications_muted` | Boolean | `$eq` | +| user | `id` | String | `MergeSupportedOperators` | +| user | `name` | String | `$autocomplete` `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | +| user | `email` | String | `$eq` `$in` | +| user | `username` | String | `$autocomplete` `$eq` | +| user | `role` | String | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | +| user | `banned` | Boolean | `$eq` `$ne` | +| user | `shadow_banned` | Boolean | `$eq` `$ne` | +| user | `bypass_moderation` | Boolean | `$eq` `$ne` | +| user | `created_at` | Date | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | +| user | `updated_at` | Date | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | +| user | `last_active` | Date | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | +| user | `language` | String | `$eq` `$ne` | +| user | `teams` | String | `$contains` `$eq` `$in` | +| message | `id` | String | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | +| message | `cid` | String | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | +| message | `text` | String | `MergeSupportedOperators` | +| message | `relevance` | Number | `NoColumnOperators` | +| message | `type` | String | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | +| message | `parent_id` | String | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | +| message | `reply_count` | Number | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | +| message | `attachments` | Boolean | `$exists` | +| message | `attachments.type` | String | `$eq` `$in` | +| message | `mentioned_users.id` | String | `$contains` | +| message | `user.id` | String | `$eq` `$in` `$ne` `$nin` | +| message | `user_id` | String | `$eq` `$in` `$ne` `$nin` | +| message | `created_at` | Date | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | +| message | `updated_at` | Date | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | +| message | `pinned` | Boolean | `$eq` | +| message | `custom` | Object | `$eq` `$gt` `$gte` `$in` `$lt` `$lte` | +| draft | `channel_cid` | String | `$eq` `$in` | +| draft | `parent_id` | String | `$eq` `$exists` `$in` | +| draft | `created_at` | Date | `$eq` `$gt` `$gte` `$lt` `$lte` | +| reaction | `type` | String | `$eq` `$in` | +| reaction | `user_id` | String | `$eq` `$in` | +| reaction | `created_at` | Date | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | +| poll | `id` | String | `$eq` `$in` | +| poll | `name` | String | `$eq` `$in` | +| poll | `voting_visibility` | String | `$eq` | +| poll | `max_votes_allowed` | Number | `$eq` `$gt` `$gte` `$lt` `$lte` `$ne` | +| poll | `allow_answers` | Boolean | `$eq` | +| poll | `allow_user_suggested_options` | Boolean | `$eq` | +| poll | `is_closed` | Boolean | `$eq` | +| poll | `created_at` | Date | `$eq` `$gt` `$gte` `$lt` `$lte` | +| poll | `updated_at` | Date | `$eq` `$gt` `$gte` `$lt` `$lte` | +| poll | `created_by_id` | String | `$eq` `$in` | +| poll_vote | `id` | String | `$eq` `$in` | +| poll_vote | `poll_id` | String | `$eq` `$in` | +| poll_vote | `user_id` | String | `$eq` `$in` | +| poll_vote | `created_at` | Date | `$eq` `$gt` `$gte` `$lt` `$lte` | +| poll_vote | `updated_at` | Date | `$eq` `$gt` `$gte` `$lt` `$lte` | +| poll_vote | `option_id` | String | `$eq` `$exists` `$in` | +| poll_vote | `is_answer` | Boolean | `$eq` | +| reminder | `message_id` | String | `$eq` `$in` | +| reminder | `channel_cid` | String | `$eq` `$in` | +| reminder | `created_at` | Date | `$eq` `$gt` `$gte` `$lt` `$lte` | +| reminder | `remind_at` | Date | `$eq` `$exists` `$gt` `$gte` `$lt` `$lte` | +| thread | `channel_cid` | String | `$eq` `$in` | +| thread | `parent_message_id` | String | `$eq` `$in` | +| thread | `created_by_user_id` | String | `$eq` `$in` | +| thread | `last_message_at` | Date | `$eq` `$gt` `$gte` `$lt` `$lte` | +| thread | `created_at` | Date | `$eq` `$gt` `$gte` `$lt` `$lte` | +| thread | `updated_at` | Date | `$eq` `$gt` `$gte` `$lt` `$lte` | +| thread | `channel.disabled` | Boolean | `$eq` | +| thread | `channel.team` | String | `$eq` `$in` | +| thread | `participant_count` | Number | `$eq` `$gt` `$gte` `$lt` `$lte` | +| thread | `reply_count` | Number | `$eq` `$gt` `$gte` `$lt` `$lte` | +| thread | `active_participant_count` | Number | `$eq` `$gt` `$gte` `$lt` `$lte` | +| thread | `has_unread` | Boolean | `$eq` | +| ban | `user_id` | String | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | +| ban | `banned_by_id` | String | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | +| ban | `channel_cid` | String | `$eq` `$in` | +| ban | `created_at` | Date | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | +| ban | `reason` | String | `MergeSupportedOperators` | + +
+ +## What `matches()` is, and is not, for + +The earlier pass called client-side filtering "the payoff". No Stream chat SDK does it: + +- **chat-flutter** — `StreamChannelListEventHandler` never reads the query's filter. Membership is + decided from event type alone. +- **chat-android** — identical. `DefaultChatEventHandler` is handed the `FilterObject` and ignores + it; `FilterObject` has no `matches` at all. +- **chat-swift** — evaluates, but not generically: it re-attaches a per-key CoreData + `predicateMapper` and builds an `NSPredicate?`, and `compactMap(\.predicate)` **drops** nodes it + cannot wire. + +So adopting core's `Filter` does not oblige us to call `matches()`, and nothing will at first. + +One consequence to carry: `matches()` on a `Filter.raw` leaf returns `true`. That is correct under +`and` and wrong under `or` and `nor`, and it cannot be fixed — Swift's drop semantics needs the +third state its nullable predicate provides, which `bool matches(T)` does not have. Harmless while +nothing calls `matches()`. If list-membership correctness is ever taken on as a feature — a real +gap in both SDKs, where a channel joins a list it does not match — this is the first thing to +revisit. + +## The registries are verified against the backend + +Feeds' registries mirror the backend's `mq.TableConfig` per resource, so chat's were checked the +same way against `~/GolandProjects/chat/lib/core/mq//`. The gate is +`TableConfig.ToSortParameter` (`lib/core/mq/config.go:311`): a field resolves if the resource's +`ToSortParams` hook claims it, else if `Columns[field]` exists, else if the resource has a +`CustomFieldName` or lists the field in `AllowedCustomSortColumns` — otherwise the request is +rejected with *"sorting by %q is not allowed"*. + +`AllowedSortColumns` is **not** that gate; it feeds `SortableFields()` for the OpenAPI spec and the +index classifier, so it is the *documented and indexed* set. That is what the registries mirror, +plus anything in `Columns` that a controller handles explicitly. + +The endpoints were traced to their configs rather than guessed: message search resolves its sort +against `mq.GetTableConfig("message")` (`lib/chat/controller/v1/payload/search.go:58`), and +`queryBannedUsers` against `ban`. + +> **Superseded in part.** The gate described here is the one `ToSortParameter` applies. A later +> pass found a second, stricter one — `ValidateSort`'s `AllowedSortCombinations` — that rejects +> whole *combinations* rather than fields, and that this table does not account for. See +> [Re-verified against the right backend field](#re-verified-against-the-right-backend-field). + +| Resource | Backend `AllowedSortColumns` | Chat registry | | +| --- | --- | --- | --- | +| `channel` | `last_message_at` `last_updated` `created_at` `updated_at` `member_count` | + `pinned_at` `has_unread` `unread_count` | ✓ the three extras are claimed by `ToSortParams` / the denorm and DFX rewrites (`channel.go:1019`, `channel_denorm_gate.go:896`, `dfx_rewrite.go:570`) | +| `message` | `id` `updated_at` `created_at` | + `relevance` **added** | was missing one | +| `user` | — (no list; `Columns` + `CustomFieldName: custom`) | `id` `created_at` `updated_at` `name` `role` `banned` `last_active` | ✓ all in `Columns` | +| `poll` | `id` `name` `created_at` `updated_at` `is_closed` | same | ✓ exact | +| `poll_vote` | `id` `created_at` `updated_at`, custom `answer_text` | `id` `created_at` `updated_at` | ✓ `answer_text` was dropped — see the re-verification below | +| `member` | `created_at`, custom `name` | + `user_id` `channel_role` | ✓ both in `Columns`; the server also sorts by `updated_at`, `banned`, `last_active`, `is_moderator`, which chat does not expose | +| `draft` | `created_at` | same | ✓ exact — and `custom` was **removed**, see below | +| `thread` | `last_message_at` `created_at` `updated_at` `reply_count` `participant_count` `active_participant_count` `parent_message_id` `has_unread` | same 8 | ✓ exact | +| `reaction` | `created_at` | same | ✓ exact | +| `reminder` | `channel_cid` `remind_at` `created_at` `message_id` | + `message_id` **added** | was missing one | +| `ban` | — (`Columns`: `user_id` `banned_by_id` `channel_cid` `created_at` `reason`) | `created_at` | ✓ subset | + +### The two pinned null orderings are verified + +`ChannelSort` keeps `pinned_at` and `last_message_at` nulls-last in either direction, the only +place the SDK overrides a direction default. The rule lives on the sort rather than the field, and +is keyed on the **remote name** — which is what the API keys on, so a field built by hand for one +of those names is ordered the same way a declared one is. It also means the predefined-filter path +inherits it for free, since `ChannelSort.fromJson` is the parser. + +Both orderings were checked in the general channel sort path +(`lib/core/mq/channel/channel.go`, `ToSortParams`) and the denormalized one +(`channel_denorm.go`, `renderDenormSortSQL`): + +- **`pinned_at`** → `OrderNullsLast("pinned_at", direction)`, i.e. `NULLS LAST` either way + (`channel.go:1129`, `:1131`). +- **`last_message_at`** → `DESC NULLS LAST` explicitly on a descending sort; ascending is + nulls-last regardless, on Postgres by default and on CRDB because `null_ordered_last = true` is + set on every connection. + +The denorm path passes `nullsLast` unconditionally for `pinned_at` +(`formatOrderBy(cmAlias+".pinned_at", direction, true)`) with a comment saying it mirrors the +standard path "in both directions"; `last_message_at` passes `direction == -1`, so descending is +explicit and ascending relies on Postgres ordering a bare `ASC` nulls-last. A third path, +`channel_denorm_gate.go:352`, *declines* the optimization for a server-side-bound `pinned_at` sort +rather than serving a different order — so no path diverges. + +Without the override a local re-sort by `pinned_at` descending puts unpinned channels *first* — +core's descending default is `nullsFirst` — while the API returns them last. That is a visible +offline/online disagreement in the channel list. + +Also verified while checking: `pinned_at` is read from `it.membership?.pinnedAt`, and the API sorts +on the *connected caller's* member row (`member_pins` is keyed on `currentUser.ID`, +`channel.go:1035`), so the two agree — sorting on any other member's row would have been wrong. And +`ChannelModel.lastUpdatedAt` is `max(lastMessageAt, createdAt)`, matching +`GREATEST(last_message_at, channel_created_at)` including the null case, since Postgres `GREATEST` +ignores nulls. + +One thing to know if the `hasUnread` / `unreadCount` TODOs are ever finished: the API inverts +core's defaults for the unread sort — `readstate.count DESC NULLS LAST` and `ASC NULLS FIRST` +(`channel.go:1114-1119`). That is direction-dependent, so a single `nullOrdering` on the field +cannot express it. It does not matter today, because both fields read `null` locally and so order +nothing. + +**Android has no way to express this, and gets one direction wrong.** Neither +`stream-android-core` nor `stream-chat-android` models null ordering at all — both treat a null as +smaller than everything and let the direction flip it +(`Comparations.kt`: `first == null && second != null -> LESS_ON_COMPARISON * sortDirection.value`, +where `LESS_ON_COMPARISON = -1`, `ASC = 1`, `DESC = -1`): + +| | Android | API | `stream_core` default | chat-flutter | +| --- | --- | --- | --- | --- | +| any field, ascending | nulls first | nulls **last** (Postgres default) | nulls last ✓ | nulls last ✓ | +| any field, descending | nulls last | nulls **first** (Postgres default) | nulls first ✓ | nulls first ✓ | +| `pinned_at` / `last_message_at`, ascending | nulls first ✗ | nulls **last** | nulls last ✓ | nulls last ✓ | +| `pinned_at` / `last_message_at`, descending | nulls last ✓ | nulls last | nulls first ✗ | nulls last ✓ (field) | + +So Android's general defaults are inverted relative to the API, which cancels out into the right +answer for the two nulls-last fields sorted descending — the common case — and the wrong one +ascending. `stream_core`'s defaults match the API's general path, and chat's per-field +`nullOrdering` covers the two exceptions. That makes chat-flutter the only one of the three that +agrees with the API in both directions, which is the argument for keeping the field. + +### Cross-checked against `stream-chat-js` + +The JS client is the reference client, so its sort types were diffed against both the backend and +chat's registries — `src/types.ts` at [`18bc3cf`](https://github.com/GetStream/stream-chat-js/blob/18bc3cf7acbabdfd957f1e092821f68b81ea456e/src/types.ts). +It agreed on channels, drafts, polls and banned users exactly. Elsewhere: + +| | JS | Backend | Action | +| --- | --- | --- | --- | +| `SearchMessageSortBase` | `text` `type` `parent_id` `reply_count` `pinned` `user.id` `attachments` `attachments.type` `mentioned_users.id` beyond chat's four | all nine present in the `message` `Columns` map | **added all nine** | +| `MemberSort` | `updated_at` `last_active` beyond chat's four | both in `member`'s `Columns` | **added both** | +| `ThreadSortBase` | no `has_unread` | `AllowedSortColumns` has it | JS gap — chat keeps it | +| `ReminderSort` | has `updated_at`, no `message_id` | `Columns` are `message_id` `channel_cid` `created_at` `remind_at` — **no `updated_at`** | JS is wrong both ways; chat follows the backend | +| `VoteSortBase` | `is_closed` and `name`, no `answer_text` | `poll_vote` allows `id` `created_at` `updated_at` | JS looks copy-pasted from `PollSortBase`; chat follows the backend | +| `ReactionSortBase` | `Sort`, i.e. custom fields | `reaction` has **no** `CustomFieldName` and an empty custom list | JS is wrong; chat exposes no `custom` for reactions | +| `UserSort` | `Sort` — *any* response field, including `privacy_settings` and `push_notifications` | 13 `Columns` + custom | Too loose to copy. Added the two both sides agree on and chat's `User` can read: `language`, `teams` | + +`UserSort` is worth calling out: it is a structural type over the response model rather than a +curated allowlist, so it permits sorts the server rejects. `email`, `username`, `shadow_banned` +and `bypass_moderation` are all sortable server-side but absent from chat's `User`, so a field for +them would have no local value to read — left out rather than added as server-only. + +Nine of the fields added are server-side only, because the value they sort on is a list with no +ordering (`attachments`, `attachments.type`, `mentioned_users.id`, `teams`) or is scored per +request (`relevance`). Each says so in its dartdoc; sorting a list locally by one leaves it +untouched rather than throwing. + +Three things the check found: + +- **`MessageReminderSortField.message_id` was missing.** The backend allows it and uses it as the + reminder tiebreaker (`TiebreakerField: "message_id"`), so naming it is what makes a page boundary + reproducible. +- **`MessageSearchSortField.relevance` was missing.** `Columns["relevance"]` exists with + `TargetName: "scored.relevance"` and `mq.NoColumnOperators` — sort-only, never filterable — and + `client.search` / `channel.search` resolve their sort against the `message` config + (`payload/search.go:58`). It is absent from `AllowedSortColumns` because it is not an indexed + column, but `ToSortParameter` resolves it and the search controller handles it explicitly: + `GetSearchSort` *strips* a relevance sort when the request carries no text filter rather than + failing (`payload/search.go:93-103`), so exposing it is safe. It is also the sort a search most + obviously wants, and the Flutter SDK could not ask for it. + +- **`DraftSortField.custom` could never work.** Draft is the one resource with + `CustomFieldName: ""` *and* an empty `AllowedCustomSortColumns`, so any custom sort field is + rejected. The old `getComparableField` fell back to `message.extraData[sortKey]`, which sorted + locally and 400'd on the wire. Removed rather than ported. + +Every other resource that exposes `custom(key)` has a non-empty `CustomFieldName` server-side: +`channel.custom`, `channel_member.custom`, message's, poll's and user's `custom`. + +**Filters are not covered by this table.** The same `Columns` map carries a `SupportedOperators` +set per field, which is what feeds' per-field *"Supported operators:"* doc lines mirror. Verifying +chat's filterable fields and annotating them the same way is part of the filter half. + +### Why each model gets its own `Sort` subclass + +`ChannelSort`, `MemberSort` and friends exist to name the model's field type. `Sort.asc` takes a +`SortField`, which any `SortField` satisfies; `UserSort.asc` takes a `UserSortField`, so +a field belonging to another model does not compile and a caller is steered through the model's +registry. + +The registry itself stays **open** — `UserSortField(remote, localValue)` is public, as it is in +feeds. That is deliberate: a consumer can sort by a field the API has grown and the SDK has not +modelled yet, rather than waiting for a release. `custom(key)` remains for the common case of a +field held in the model's extra data, declared for the six models whose `mq.TableConfig` carries a +`CustomFieldName`. + +So the narrowing is a signpost, not a lock: it makes the declared fields the obvious path and +rules out cross-model mistakes, while leaving the escape hatch the API's own growth requires. A +field the API does not accept still fails at runtime with *"sorting by %q is not allowed"*, which +is why the [verification table](#the-registries-are-verified-against-the-backend) matters more +than the type system here. + +The wrappers used to be twelve lines each because they restated core's defaults: + +```dart +const UserSort.asc( + UserSortField super.field, { + super.nullOrdering = NullOrdering.nullsLast, // core's own default +}) : super.asc(); +``` + +A super-parameter **inherits the super constructor's default**, so the annotation was redundant. +Dropping it is behaviour-identical — confirmed by probe: `Sort.asc` still yields `nullsLast` and +`Sort.desc` still yields `nullsFirst` — and takes the wrappers from 147 lines to 87. + +```dart +const UserSort.asc(UserSortField super.field, {super.nullOrdering}) : super.asc(); +const UserSort.desc(UserSortField super.field, {super.nullOrdering}) : super.desc(); +``` + +`ChannelSort` stays longer than the rest because it resolves the field's own `nullOrdering`, which +is the one thing a wrapper can do that core cannot. + +**The wrappers are the cross-platform shape, so they stay.** Checked against the other two SDKs: -Verified in `lib/src/core/models/filter.dart:17,35,53` and `:132,138`. These are in public use and -cannot be dropped. **This is the one genuine hard block in the whole plan** — land them in core -first, including `matches()` semantics for each (negation of the positive operator, with the -PostgreSQL-ish null handling core's `filter_operation_utils.dart` already establishes). +| | `Sort` generic over | Wrapper class per model | Default sort lives on | +| --- | --- | --- | --- | +| Dart (`stream_core`) | the model — `Sort` | yes | the wrapper | +| Kotlin (`stream-android-core`) | the model — `Sort(field: SortField, …)` | yes — `class PollVotesSort : Sort` | the wrapper's companion — `PollVotesSort.Default` | +| Swift (`StreamCore`) | the **field** — `Sort`, via an associated type | **no** | `extension Sort where Field == …` | -Core has one we lack — `pathExists` `$path_exists` — which comes for free. +Only Swift avoids the wrapper, and only because associated types make the narrowing free. An +earlier draft here proposed porting Swift's shape to Dart — it works (the model type is recovered +from an extension's *on-type*; a bound infers `Object`), but it needs a non-generic `SortFieldBase` +that no other SDK has, and it would put Dart out of step with Kotlin, which is the closer analogue. +Dropped. + +Android goes further and closes its field set with a `sealed interface` whose members are +`data object`s — no escape hatch at all. Chat and feeds both keep theirs open. + +### The registries expose no value getter + +An earlier pass gave each `XSortField` a public `value` getter so the model tests could assert a +field's extraction in one line. That was testing surface masquerading as API: nothing in `lib` +read it, `stream_core` deliberately keeps `value` off `SortField` (it exposes one on `FilterField` +only because `Filter.matches(T)` needs it), and `STYLE_GUIDE.md` §"Avoid `@visibleForTesting`" +says to design for testability through the public API rather than exposing internals. + +It is gone. The observable contract of a sort field is the *ordering*, so that is what the tests +assert, through two helpers in `test/src/utils.dart`: + +```dart +expectOrders(MemberSortField.name, alice, zara); // asc, desc and self-comparison +expectOrdersNothing(MessageSearchSortField.relevance, msg); // a server-side-only field +``` + +`expectOrdersNothing` also documents the nine fields that cannot order a list locally, which an +extraction test could only have asserted as "returns null". + +### The default sorts were checked against the other SDKs + +Chat's six defaults were introduced in one pass — `83bba81c7`, *"Improve query sorts and provide +defaults"* (#2188, April 2025) — where the controllers previously had none. That pass was never +checked cross-SDK, so it was checked here. + +| Query | chat-flutter | chat-android | chat-swift | backend | +| --- | --- | --- | --- | --- | +| channel | `last_updated` desc | `last_updated` desc | sends none; local fallback `defaultSortingAt` desc | **`{last_updated: -1}`** (`channel_denorm_gate.go:341`, `fts_or_union_rewrite.go:296`) | +| draft | `created_at` desc | `created_at` desc | — | **`DraftMessage.DefaultSort()` = `created_at` desc** | +| member | `created_at` **asc** | caller must supply one | local fallback `memberCreatedAt` desc | no default; tiebreak `user_id` asc | +| user | `created_at` desc | none | local fallback `id` desc | — | +| reminder | `remind_at` **asc** | `QuerySortByField()` — empty | — | **`MessageReminder.DefaultSort()` = `remind_at` asc**; tiebreak `message_id` desc | +| poll vote | `created_at` **asc** | `null` — none | — | **`PollVote.DefaultSort()` = `created_at` asc**; tiebreak `id` desc | +| thread | **none** — see [below](#thread-is-the-one-resource-with-no-defaultsort) | `has_unread`, `last_message_at`, `parent_message_id` — all desc | — | **`ThreadWithLastReadAt.DefaultSort()` = those same three, desc** | +| reaction | `created_at` desc | — | — | **`ReactionResponse.DefaultSort()` = `created_at` desc** | + +Channel is confirmed against the authority and agrees with both other SDKs. Outcomes: + +- **Thread gets no `defaultSort`**, alone among the eight. See + [below](#thread-is-the-one-resource-with-no-defaultsort). +- **`ReactionSort.defaultSort` added.** The API defines it, so it is a fact rather than a choice; + `reaction_detail_sheet.dart` had been restating it inline. +- **Poll vote stays ascending**, because the API defines it that way. An earlier pass read the + backend column as "no default" and proposed flipping it to descending for consistency with + reactions — the two are the same UI shape. That premise was wrong: `PollVote.DefaultSort()` + returns `created_at` asc where `FeedsReaction`'s returns `created_at` desc, so the two genuinely + differ and the API's answer wins. The `id` desc tiebreak is real, and independent of this. +- **Reminder keeps ascending because the API does.** `MessageReminder.DefaultSort()` is + `remind_at` asc, which is also what a to-do list wants. Neither other SDK sends a default at all. +- **Member keeps ascending as a choice**, since the backend defines no default for it. + Oldest-member-first is *stable* as people join — new members append instead of pushing every row + down. ## Escape hatches @@ -97,7 +580,7 @@ should survive — decide which, and note that a custom filter cannot support `m | Ours | Core | | --- | --- | -| `typedef SortOrder = List>` | `Sort` + `extension CompositeComparator on Iterable>` | +| `typedef SortOrder = List>` | `List` etc. — no typedef; `extension CompositeComparator on Iterable>` | | `SortOption.asc(String field)` / `.desc(String field)`, `static const ASC = 1 / DESC = -1` | `Sort.asc(SortField)` / `.desc(SortField)`, `enum SortDirection { asc(1), desc(-1) }` | | field is a `String`, resolved at runtime via `ComparableFieldProvider.getComparableField(sortKey)` | field is a typed `SortField{remote, comparator}` | | `SortOption.fromJson` (drops the comparator) | `createFactory: false` — no `fromJson` | @@ -105,6 +588,17 @@ should survive — decide which, and note that a custom filter cannot support `m `NullOrdering` and `CompositeComparator` exist in **both** packages by the same names → collision, so our `sort_order.dart` must stop being exported in the same PR. +**No `SortOrder` typedef.** It was dropped rather than carried over, for three reasons. It named +the wrong concept — in SQL parlance a *sort order* is the direction, which this API now spells +`SortDirection`, while the thing being aliased is a list of criteria (the backend calls one a +`SortParam`, and the wire field is just `sort`). It existed to hide a nested generic, and with a +per-model `Sort` subclass there is no nesting left to hide: `List?` is three +characters *shorter* than `SortOrder?`. And a generic `SortOrder = List>` +would be **wider** than `List`, so `[Sort.desc(ChannelSortField.pinnedAt)]` would +compile and silently lose that field's nulls-last ordering — `sort_test.dart` pins that difference. +`stream_core`, `stream_core_flutter` and `stream_feeds` declare no collection typedefs between +them. + **Per-field null-ordering defaults stay chat-side.** Ours are server parity, not preference: `ChannelSortKey.pinnedAt` and `lastMessageAt` force `nullsLast` in *both* directions, where core's defaults are the plain `asc → nullsLast` / `desc → nullsFirst`. Supply the right `nullOrdering` @@ -115,20 +609,59 @@ release. a stored sort (a persisted channel-list configuration, for instance), that needs a chat-side resolver mapping a remote name back to a `SortField`. -## `ComparableField` is a semantic fork, not a rename +## What shipped instead of a chat-side `StreamSortField` + +**This section previously argued for a chat-side `StreamSortField` base class** — a `const` +private constructor, per-field `nullOrdering`, an overridden `value` method — whose whole purpose +was preserving `const` sort lists. None of it was built. `git grep "class StreamSortField"` returns +nothing. + +What shipped is `class ChannelSortField extends SortField` — core's base directly, +with a non-const constructor and `static final` members. There is no `SortOrder` typedef either; +signatures name `List` and friends. + +**So `const` sort lists are gone, and that is a consumer break.** Core's `SortField` takes a value +closure and a closure literal is not a constant expression, so every registry member is +`static final` and a caller cannot write `const [ChannelSort.desc(...)]`. Every v10 example and the +sample app wrote `const`. That is now a row in `migrations/v11-migration.md`'s Symbol Map; it was +missing for as long as this section claimed const-ness had been preserved, which is exactly how a +stale plan turns into a missing migration note. + +Per-field null ordering did survive, but on the `Sort` subclass rather than the field: +`ChannelSort.asc` / `.desc` resolve `nullOrdering ?? _orderingFor(field, …)`, pinning `pinned_at` +and `last_message_at` to nulls-last in either direction. An explicit `nullOrdering:` **wins** over +that default — the earlier claim that it is ignored was backwards. `ThreadSort` gained the same +treatment for `last_message_at` after a review caught that a thread with no replies had started +sorting to the top. + +## `ComparableField`: both divergences resolve chat-side | | Ours | Core | | --- | --- | --- | | Strings | routed through `normalizeStringForSort` (`core/util/string_sort_normalizer.dart`, 95 LOC — folds diacritics and ligatures: `Ł→l`, `Ø→o`, `Æ→ae`, case-insensitive) | plain `String.compareTo` | -| Incomparable types | returns **`0`** | **throws `ArgumentError`** | -| `ComparableFieldProvider` | ours, and 48 models implement it | absent | - -Adopting core's as-is silently changes channel and user name ordering (server parity lost) *and* -turns a benign `0` into a runtime throw. Neither is acceptable. Upstream a pluggable string -comparator — or `normalizeStringForSort` itself, which is generically useful — before adopting. - -The incomparable-types divergence is worth arguing upstream too: a throw is defensible in a -strict library, but it converts a cosmetic ordering glitch into a crash in a list view. +| Incomparable types | returns **`0`** | `ComparableField.compareTo` throws `ArgumentError` | +| `ComparableFieldProvider` | ours, and 14 files implement it | absent | + +An earlier draft made both of these upstream asks. Neither is: + +**The throw never reaches the sort path.** `SortComparator.call` wraps the comparison in +`runSafelySync(() => aValue.compareTo(bValue))` and takes `.getOrDefault(0)` — "If comparison +fails, treat as equal in sorting" (`query/sort.dart`). So core already degrades to `0` exactly +where ours does. `ArgumentError` only escapes if something calls `ComparableField.compareTo` +directly, which the sort layer never does. `StreamSortField` compares values itself and keeps the +`_ => 0` fallback explicitly, so the behaviour holds either way. + +**Normalization belongs in the value extractor.** `SortField(remote, localValue)` takes a +`SortFieldValueGetter`, so a chat name field declares +`SortField('name', (u) => normalizeStringForSort(u.name))` and server parity is preserved without +touching core. That is the same mechanism core-swift relies on — its `SortComparator(localValue:)` +compares with plain `Comparable`, so any normalization is the extractor's job there too. + +**`normalizeStringForSort` should move to core.** Chat folds inside each name field's value +getter — `UserSortField('name', (it) => it.name.let(normalizeStringForSort))` — which is correct +but has to be remembered field by field; see [`UPSTREAM.md`](UPSTREAM.md). In core it becomes the +default for every SDK and core's own `ComparableField` stops being wrong for names. Nothing in +this phase waits on it. ## Decisions to make @@ -147,8 +680,11 @@ strict library, but it converts a cosmetic ordering glitch into a crash in a lis - **Every query signature in the public API changes**, and `Filter` is one of the most-used types in consumer code. The `dart fix` transforms from phase [10](10-cleanup.md) matter more here than anywhere else — consider landing the kit before this phase rather than after. -- **Silent ordering regressions.** If `normalizeStringForSort` is lost, channel lists reorder for - any user with an accented name, and nothing fails. Golden-test it. +- **Silent ordering regressions.** If `normalizeStringForSort` is dropped from a `SortField`'s + value extractor, channel lists reorder for any user with an accented name and nothing fails. + Golden-test it. This is now a *review* risk rather than a blocked dependency: the normalization + is one call inside each string field's extractor, so it is easy to forget on a field-by-field + basis. - **`toJson()` drift.** Core builds the same three JSON shapes ours does (`{$op: [...]}`, `{key: {$op: value}}`, `{key: value}`), but "the same shapes" is not "the same output". Diff every existing filter's serialisation before and after. @@ -157,13 +693,21 @@ strict library, but it converts a cosmetic ordering glitch into a crash in a lis ## Upstream `stream_core` work -- **`Filter` `$ne` / `$nin` / `$nor`**, with `matches()` semantics. **Hard block.** -- A pluggable string comparator on `ComparableField` (or `normalizeStringForSort` upstreamed). -- Worth arguing: returning `0` rather than throwing for incomparable types. +**None. This phase is unblocked.** Both asks an earlier draft listed dissolved on inspection: +`$nor` is omitted by all three core SDKs deliberately, and the two `ComparableField` divergences +resolve chat-side (see above). `normalizeStringForSort` remains a standalone +[`UPSTREAM.md`](UPSTREAM.md) candidate, not a prerequisite. + +One thing to raise with the core owners, separately from this phase: feeds' query docs advertise +operators core does not have — `activities_query.dart:87` and `feeds_query.dart:137,146,155` all +list `.notEqual` under "**Supported operators:**", and there is no `notEqual` in +`FilterOperator`. Doc-only, but it is where someone would go looking for the operator set. ## Definition of done -- [ ] Core ships `$ne` / `$nin` / `$nor` and chat is on that release. +- [ ] `Filter.notEqual`, `Filter.notIn` and `Filter.nor` are `@Deprecated` — the first two + carrying Android's server-performance rationale, `nor` carrying the real reason (core does + not model it and it is not expressible in terms of what core does). - [ ] `filter.dart`, `sort_order.dart`, our `comparable_field.dart` and `location_coordinates.dart` are deleted; `stream_chat.dart` exports core's via the allowlist. @@ -175,10 +719,222 @@ strict library, but it converts a cosmetic ordering glitch into a crash in a lis `normalizeStringForSort` behaviour survives. - [ ] Per-field `NullOrdering` defaults preserved — asserted for `pinnedAt` and `lastMessageAt` in both directions. -- [ ] Nothing throws where the old `ComparableField` returned `0` — asserted. -- [ ] `SortOption.fromJson` callers accounted for. +- [ ] Nothing throws where the old `ComparableField` returned `0` — asserted (core's + `runSafelySync` should already cover it; the test is what proves it). +- [x] `SortOption.fromJson` callers accounted for — there are two, and both now go through + `ChannelSort.fromJson`: `PredefinedFilter.sort`, where the API echoes the sort it resolved + for a preset (found by `json_serializable` by convention, so no `@JsonKey` hook), and + `stream_chat_persistence`'s Drift converter for the same spec persisted for offline reads. + A bare `Sort.fromJson` would not have served either — see [UPSTREAM.md](UPSTREAM.md). - [ ] `melos bootstrap && melos run analyze && melos run test:dart && melos run test:flutter`, plus `stream_chat_persistence` tests if any stored query shape changed. + +### Re-verified against the right backend field + +An earlier pass in this phase checked each registry against `mq.TableConfig.AllowedSortColumns`. +That is the wrong source: it implements `querymeta.SortConfig.SortableFields()` and feeds query +tooling, and it is *not* what rejects a sort. Messages make the divergence obvious — +`AllowedSortColumns` lists three fields while ten work. The two things that actually decide are: + +1. **`Columns`** — `IsCustomField(f)` is literally `Columns[f] == nil` (`mq/config.go:376`), so an + unlisted field becomes a custom-JSON sort rather than an error. +2. **`Model.AllowedSortCombinations(app)`** — checked in `ValidateSort` (`mq/sql.go:652`). It + returns `(combos, skip)`. When `skip` is false the sort must match a listed combination + **exactly**, after `addTiebreakerToSortParams` has appended the tiebreaker tail. Resources with + no `Model` (channel, member, user, ban) never reach it. + +| Resource | What the server enforces | Ours | | +| --- | --- | --- | --- | +| Channel | no `Model`; `Columns` + a custom `SortAndPager` that special-cases `has_unread` (alias `unread_count`, `channel.go:1300`) and `pinned_at` | 8 | ✓ | +| Member | no `Model`; `Columns` (15) | 6 | ✓ subset | +| User | no `Model`; `Columns` (13) | 8 | ✓ subset | +| BannedUser | no `Model`; `Columns` = `user_id, banned_by_id, channel_cid, created_at, reason` | 1 | ✓ subset | +| Message | `skip = true` — no validation at all | 10 | ✓ | +| Draft | `{created_at}` | `created_at` | ✓ exact | +| Poll | `{id} {name} {created_at} {updated_at} {is_closed}` | same 5 | ✓ exact | +| Reaction | `{created_at}`, `skip = true` | `created_at` | ✓ | +| Thread | 8 combinations | 8 fields | ⚠ combinations | +| MessageReminder | `{channel_cid,message_id} {remind_at,message_id} {created_at}` | 4 fields | ⚠ combinations | +| PollVote | `{id} {created_at} {updated_at}` | our 3 == the 3 ✓ | `answer_text` dropped | + +### Cross-checked against iOS and Android + +Android's registry is not a typed list — it is `getComparableField` on eleven models +(`stream-chat-android-core/.../models/*.kt`), the same eleven we declare. iOS's is eight +`SortingKey` types under `Sources/StreamChat/Query/`. Both were compared field by field. + +The one change that came out of it: **`ChannelSortField.cid` added** (both SDKs have it, and it is +a real denorm column). Nothing was removed on their account — an earlier pass trimmed to a strict +intersection and it was wrong in three places, which is worth recording so it is not retried: + +- **Android's list is not evidence of API support.** `getComparableField` says what Android can + compare *in memory*; its message entry includes `html`, `command`, `silent` and + `updated_locally_at`, which are plainly not sortable server-side. +- **iOS is missing fields the server requires.** It has no `lastUpdated` for channels — which is + both `ChannelSort.defaultSort` and the server's own fallback — and no `messageId` for reminders, + which two of the three allowed reminder combinations require. +- **Both expose a field the server rejects.** Their message-reminder `updated_at` appears in no + allowed combination. + +So parity is a useful cross-check and a poor rule. The declared set is the backend-verified one. + +`MessageSearchSortField.pinned` is kept (JS and Android have it; iOS does not) with a documented +limit: `pinned` is the only column in the whole mq layer with an explicitly empty `ESTargetName` +(`message/message.go:430`), because the pinned *filter* is a custom ES bool query over +`pinned_at` / `pin_expires` rather than a mapped field. `elasticsearch.go:92` reads that value with +no empty-check, so an index-backed search has nothing to order on. Whether the client errors or +drops the sorter was not verified — there is no test covering it — so the dartdoc says the field +is unsupported there rather than predicting a behaviour. It is correct on the +database-backed path. Unlike `answer_text`, this fails on one backend rather than doing nothing on +all of them, which is a limitation to document rather than a reason to drop the field. + +**What is deliberately not declared.** Every combination-enforced resource is exact: our fields +are precisely those appearing in the server's allowed combinations, no more. Thread and draft each +have columns we omit — `channel_cid`, `created_by_user_id`, `channel.disabled`, `channel.team`, +and draft's `channel_cid` / `parent_id` — and omitting them is required, not cautious, since none +appears in any combination and the server would reject them. + +The four resources with no combination enforcement have real gaps, all readable off our models: +reaction `type` and `user_id` (its `AllowedSortCombinations` answers `skip = true`, so its +one-combination list enforces nothing); member `is_moderator` and `banned`; banned-user `user_id`, +`banned_by_id`, `channel_cid` and `reason`; and a long tail on channel. None is declared, on the +grounds that adding a sort field later is additive while removing one is breaking, so an +unrequested field is a liability in a `.0`. + +One is worth a backend question before anyone adds it: **`ChannelSortField.name`**. Sorting a +channel list alphabetically is the obvious ask, and `name` is a real denorm column — but it is +*not* in channel's `AllowedSortColumns`, the documented-and-indexed set, so it may be accepted and +unindexed on the SDK's hottest query. + +**`PollVoteSortField.answerText` was removed because it does not work.** `answer_text` is not a poll-vote column +(`id, poll_id, user_id, created_at, updated_at, option_id, is_answer`), so it takes the custom +path — and while `poll_vote.go:22` whitelists it via `AllowedCustomSortColumns`, the package never +sets `CustomFieldName`, so `ValidateSort`'s `config.CustomFieldName == ""` short-circuits to +`sorting by "answer_text" is not allowed`. It would fail the combination check immediately after +regardless, since custom fields get no exemption there. The backend config reads as unfinished +rather than deliberate, so confirm with the server team before removing the field — but as +deployed it errors. + +**Combination constraints are not modelled by any SDK, including ours.** For the five +`skip = false` resources the server accepts only whole listed combinations, so +`[ThreadSort.desc(createdAt), ThreadSort.desc(replyCount)]` compiles here and comes back as +`invalid sort parameter: …, allowed sort combinations: …`. A typed field registry prevents an +invalid *field*, not an invalid *combination*. Worth its own decision — the cheap version is +documenting the legal combinations on each `XSort` class; the expensive one is named constructors +per combination. Not in scope for the sort migration. + +**No sort field is restricted to server-side auth, and one is restricted to client-side.** The +whole chat codebase has exactly one auth-gated sort — `query_channels.go:379`, which rejects +`has_unread` / `unread_count` for a *secret-key* request ("not support server-side"), since there +is no user to compute unread against. So those two are client-only, which is why this SDK +declares them and a server SDK could not. Nothing is gated the other way: message search runs +`req.GetSearchSort()` into `NewSearchOptions` with no auth check, so every field the message table +addresses is reachable with an API key and a user token. + +That makes "server-side field" the wrong axis for deciding what to declare. The real one is +whether the value is readable off the model, and two message columns fail it while being perfectly +valid on the wire: `cid` (`Message` carries no channel id — search returns channel context beside +the message, not inside it) and `attachments` (declared `TypeBoolean` for filter coercion, but +sorting resolves to the raw `message.attachments` column, which is JSONB, so the server orders by +Postgres's structural jsonb collation and not by "has attachments"). Both would need +`(_) => null`, joining `relevance` as fields whose local re-sort silently no-ops. `relevance` +earns that; a second and third would just be lies with a wire payload attached, so neither is +declared. + +**Messages are sortable on exactly one endpoint, and the sort is message-only.** `/search` takes +*two* filters and *one* sort: `filter_conditions` binds to the channel table, +`message_filter_conditions` and `sort` both bind to the message table +(`payload/search.go:56-58`). `mq.GetTableConfig("message")` is referenced nowhere else in the +codebase, so there is no other message query to sort. Every other SDK scopes the name to that: +JS `SearchMessageSort`, Swift `MessageSearchSortingKey` (inside `MessageSearchQuery`), Android +only on `searchMessages`. Ours read broader than the capability, so this phase renamed it to +`MessageSearchSort` / `MessageSearchSortField`. Feeds is precedent for naming a sort after the +query rather than the model — `ActivityReactionsSort` and `CommentReactionsSort` are both +`Sort` — and it keeps `MessageSort` free for a general message query, and +leaves room for the `PinnedMessagesSort` that a pinned-messages endpoint would need. + +A wrong sort field on `/search` fails **silently**, which is why the typed registry earns its +keep here more than elsewhere. Nothing rejects it: payload validation checks only that the field +is non-empty and the direction is ±1 (`commonpayloads/sort.go:153`), and `ValidateSort` returns +before its checks because `Message.AllowedSortCombinations` answers `skip = true` +(`types/message.go:255`) — messages are the resource with *no* combination allowlist. The field +then falls through `IsCustomField`, which is just `Columns[field] == nil` +(`mq/config.go:376`), and is emitted as `message.custom->>''`. For a channel field like +`member_count` that key is null on every row, so the term contributes nothing and ordering falls +to the tiebreaker. The old untyped `SortOrder?` let exactly this through. + +**`StreamChannelListController` seeds `ChannelSort.defaultSort` unconditionally**, including when +a `predefinedFilter` is set — the same shape as before this phase, when it was a default parameter +value. The preset's own sort then replaces it in the response and `_resolveSort` adopts that, so +the ordering self-corrects after the first page. + +What the backend does with the two arguments, since it is asymmetric and not documented anywhere: +a `predefinedFilter` replaces `filter` **outright** (`query_channels.go:195`, +`req.Filters = interpolatedFilter`) — passing both is accepted with no validation and the caller's +filter is silently discarded. The sort is only overwritten when the preset *defines* one (`:224`); +a preset with no sort template leaves the caller's sort in force. + +That leaves one known gap, and it is not where it first looks. For a preset with **no** sort +template, the response carries no sort, so `PredefinedFilter.effectiveSort` falls through to +`_defaultSortFor` — a hand-written Dart mirror of the server's fallback in +`lib/core/mq/channel/channel.go` ("Set Default Sorting"): `last_updated` desc, or `last_message_at` +desc when the query is flagged as filtering on `last_message_at`. + +The obvious mismatch does **not** happen. When that flag is set, a single sent `last_updated` is +itself rewritten to `last_message_at` a few lines further down, so the server orders by +`last_message_at` — the same field the client resolved. Sending `ChannelSort.defaultSort` and +resolving `last_message_at` agree. + +The real gap is the mirror being **looser than what it mirrors**. The server sets the flag only +when *every* `last_message_at` node is reachable through `$and` alone **and** at least one narrows +by value — `$eq` / `$ne` / `$gt` / `$gte` / `$lt` / `$lte`, or `$exists: true` +(`DetectLastMessageAtFiltering`, `lib/core/mq/channel/modifiers.go`). `_defaultSortFor` asks only +whether `last_message_at` appears anywhere, under any operator, and walks into `$or` / `$nor`. +So a preset whose filter puts `last_message_at` under `$or`, or matches it with `$in` or +`$exists: false`, leaves the server on `last_updated` while the client answers `last_message_at` — +and `loadMore`'s offset then indexes into a list ordered differently from the one displayed. +Tightening the mirror is tracked in [DEFERRED.md](DEFERRED.md); a test currently pins the loose +`$or` behaviour, so closing it inverts that test. + +One alternative was tried and **rejected**: falling back to the sort we actually sent +(`resolved.sort ?? ` at both `effectiveSort` call sites) retires `_defaultSortFor` entirely, +but it also gives up the only sensible ordering an offline read has when a caller queries a preset +directly without a sort — there the sent sort is null, and the cache would be left unordered. +`_defaultSortFor` stays, and has to be re-checked whenever the server's fallback changes. + +Worth recording either way: because the client always sends a sort, a channel query never reaches +`sql.go:620`'s `config.Model.DefaultSort()` — which would be a nil dereference, as the channel +`TableConfig` declares no `Model`. + +### Thread is the one resource with no `defaultSort` + +Every other sort declares one. `ThreadSort` does not, because the ordering it would name is one +the client cannot deliver. + +A thread query given no sort is answered by `SelectThreadsForUser`, a narrower query whose +`ORDER BY` is hardcoded to +`has_unread DESC, thread.last_message_at DESC, thread.parent_message_id DESC` +(`threadstate/store.go:513`); `query_threads.go:110` branches on +`request.Filter != nil || request.Sort != nil` to pick it. Sending that same ordering explicitly +buys nothing but a wider code path. + +Locally it is worse than redundant. A `Thread` carries no per-user unread state, so +`ThreadSortField.hasUnread` reads nothing and the first term silently drops — a list sorted by the +"default" would come out ordered by last message date, which is *not* what the server returns. +Nothing in the SDK sorts a thread list anyway (`StreamThreadListController` only orders replies +within a thread), so declaring the constant would only invite a caller to reach for an ordering +that does not hold. `ThreadSortField.hasUnread` stays, since the server can sort by it. + +The persisted shape did not change, so no row needs rewriting — but `schemaVersion` still moves +from `1000 + 35` to the `1100 + N` band, and drift's `onUpgrade` drops and recreates every table +when it does. Cached channels, messages and reads are discarded on upgrade and refetched; that is +the v11 behaviour generally, not something this phase introduces. Verified against the +deleted serializer rather than assumed — `git show HEAD:…/core/api/sort_order.g.dart` shows +`_$SortOptionToJson` emitted exactly `field` and `direction`, and **not** `nullOrdering` despite +`SortOption` carrying it as a field. `ChannelSortConverter` +(`stream_chat_persistence/lib/src/converter/channel_sort_converter.dart`, renamed from +`ChannelStateSortOrderConverter`) writes those same two keys, which its test now pins as a +literal — rows outlive the SDK version that wrote them, so the shape may not drift by accident. - [ ] `refactor(llc)!:` title, `🛑️ Breaking` CHANGELOG entries, `migrations/v11-migration.md` Symbol Map rows and a feature section with before/after query examples — this is the section consumers will actually read. diff --git a/core-migration/DEFERRED.md b/core-migration/DEFERRED.md index 3d72a8bb3a..9e188e42b5 100644 --- a/core-migration/DEFERRED.md +++ b/core-migration/DEFERRED.md @@ -32,8 +32,11 @@ A row leaves this file when it lands, not when it is decided. | ☐ | Take `StreamHttpClientOptions` directly instead of `baseURL` / `connectTimeout` / `receiveTimeout` | Folds into the config above rather than being a separate break. | [10](10-cleanup.md) | | ☐ | Mark `StreamHttpClient` `@internal` | `AttachmentFileUploaderProvider` is the only public signature naming it, and retyping that is phase 09's call. | [09](09-uploads.md) | | ☐ | Reclassify the SDK's own precondition throws | 23 sites still raise `StreamChatError`. `ERROR_LAYER.md` splits them further than a sweep can: a condition a correct program can hit becomes a `StreamException`, while genuine misuse should raise `StateError` / `ArgumentError` and never be wrapped. Doing it by sed would get it wrong. | [03](03-errors.md) | -| ☐ | Delete `stream_chat_error.dart` | Three things first: phase 07 removes `StreamWebSocketError`, the precondition throws above are reclassified, and the UI's attachment-validation subtypes stop being errors — they are *returned values*, never thrown. `StreamChatNetworkError` is already gone. | [03](03-errors.md) | +| ☐ | Delete `stream_chat_error.dart` | Three things first: phase 07 (parked) removes `StreamWebSocketError`, the precondition throws above are reclassified, and the UI's attachment-validation subtypes stop being errors — they are *returned values*, never thrown. `StreamChatNetworkError` is already gone. | [03](03-errors.md) | | ☐ | Decide the fate of `Filter.custom` / `Filter.raw` / `Filter.empty` | Core has no equivalent. At least one should survive: a typed `FilterField` registry cannot express a field the SDK does not model. | [08](08-query-dsl.md) | +| ☐ | Move chat's WebSocket to `/api/v2/connect` | Three blockers, none of them chat-side: v2's handshake never calls `EnrichUserMutes` (`lib/chat/controller/v1/connect.go:118` only), it decodes `user_details` with `WithDecodeExtraFields(false)` so chat's root-promoted `extraData` is dropped, and core's `ConnectUserDetailsRequest` has no `privacySettings`. iOS is on core and v2 endpoints and still connects over v1. | [07](07-websocket.md) | +| ☐ | Narrow `PredefinedFilter._defaultSortFor` to the server's flag condition | It answers `last_message_at` whenever the filter mentions the field at all. The server flips its fallback only when *every* `last_message_at` node is reachable through `$and` alone and at least one narrows by value — `$eq` / `$ne` / `$gt` / `$gte` / `$lt` / `$lte`, or `$exists: true` (`DetectLastMessageAtFiltering`, `lib/core/mq/channel/modifiers.go`). So a preset putting `last_message_at` under `$or`, or matching it with `$in` or `$exists: false`, leaves the server on `last_updated` while the client answers `last_message_at`, and `loadMore`'s offset indexes into a differently ordered list. A test pins the loose `$or` behaviour today, so closing this inverts it. | [08](08-query-dsl.md) | +| ☐ | Decide whether id-like sort fields should opt out of string folding | `StreamSortField` folds **every** string value through `normalizeStringForSort`, which is what `ComparableField` did, so [08](08-query-dsl.md) kept it. It also means `UserSortField.id`, `MessageSearchSortField.id`, `MemberSortField.userId`, `MessageReminderSortField.channelCid` and `ThreadSortField.parentMessageId` compare case- and diacritic-insensitively — two ids differing only in case tie, so a composite sort's tie-breaker stops breaking ties. Pre-existing, and a `foldStrings: false` per field would fix it; changing it is a behaviour change beyond the migration. | [08](08-query-dsl.md) | | ☐ | Decide whether core grows channel-scoped `CdnClient` operations, or chat keeps its broader uploader interface | Half of chat's uploads are channel-scoped and core's `CdnClient` has only four CDN-scoped methods. Must agree with `openapi-migration/12-uploads-cdn.md` before either starts. | [09](09-uploads.md) | ## Landed, listed so nobody re-raises it @@ -42,6 +45,7 @@ A row leaves this file when it lands, not when it is decided. | --- | --- | --- | | ☑ | Remove chat's own logger and `package:logging` | Done in [06](06-logger.md): the SDK writes through `StreamLogger`, `logConfig` replaces `logLevel` + `logHandlerFunction`, and no package in the repo imports `package:logging` any more. | | ☑ | Delete `StreamChatClient.devToken` | [04](04-token-and-auth.md) | +| ☑ | Settle chat's keepalive frame | [07](07-websocket.md): no chat-side ping type. `MonitorHealth` (`client.go:607-620`) `Discard()`s every client frame, so the body is unread and core's default `pingRequestBuilder` is correct. iOS sends a raw protocol ping for the same reason. | ## The `StreamChatConfig` that absorbs several of these diff --git a/core-migration/README.md b/core-migration/README.md index 14882addcd..791e6109c3 100644 --- a/core-migration/README.md +++ b/core-migration/README.md @@ -166,8 +166,11 @@ release. Never edit a package's `pubspec.yaml` constraints directly. ## Prerequisites -**None. This can start today**, which contradicts what the two existing docs say. Verified against -the tree rather than the docs: +**None at the time this plan was written**, which contradicted what the two existing docs said. +That is still true of *starting*, but it has stopped being true of *shipping* as of phase +[08](08-query-dsl.md): `melos.yaml` pins both core packages to a commit no published version +contains, so nothing merges to `master` until core publishes. The evidence below is what was +checked when the plan was written: - `melos.yaml:108` declares `stream_core: ^0.5.0` **hosted**. There are zero `stream_core` entries in any `dependency_overrides` block — the five that exist are path overrides for sibling chat diff --git a/core-migration/UPSTREAM.md b/core-migration/UPSTREAM.md index f4bd301f6a..f0efffdaa2 100644 --- a/core-migration/UPSTREAM.md +++ b/core-migration/UPSTREAM.md @@ -8,19 +8,27 @@ Worth keeping because the migration surfaces these continuously: you only find o generic when a second product needs it, and this is the pass where chat reads core closely enough to notice. Each row says what the evidence is, so nobody has to re-derive it. -Status: ☐ not raised · ◐ raised upstream · ☑ landed in core +Status: ☐ not raised · ◐ raised upstream · ☑ landed in core · ✗ investigated and dropped + +Rows marked ✗ were recommended by an earlier pass and disproved by a later one. They are kept +rather than deleted so the same asks are not re-raised. | | What | Why it belongs in core | Blocked on | | --- | --- | --- | --- | | ☐ | **The retry table** — `isRetriable` over the sealed exception kinds | `ERROR_LAYER.md` §Retrying *specifies* this table, and core owns the doc. Chat now implements it ([03](03-errors.md)); feeds independently re-derived a partial version in `capabilities_repository.dart`'s `shouldRetry`. Two products deriving the same table from the same spec is the definition of a core concern. | Nothing. Strongest candidate here. | -| ☐ | **`normalizeStringForSort`** (`core/util/string_sort_normalizer.dart`, 95 LOC) | Folds diacritics and ligatures (`Ł→l`, `Ø→o`, `Æ→ae`) so client-side name sorts match the server's collation. Nothing about it is chat-specific — any product sorting user names needs the same folding, and core's `ComparableField` currently uses a plain `String.compareTo`. | [08](08-query-dsl.md) needs it either way; upstreaming is the better half of that decision. | -| ☐ | **`Filter` `$nor`** | A *logical* operator, so it sits beside core's existing `AndOperator` / `OrOperator`. Chat, Swift and JS all expose it and none has deprecated it; core is the only one missing it. | Nothing. Small and obviously correct. | +| ☑ | **`normalizeStringForSort`** | Landed in [core#181](https://github.com/GetStream/stream-core-flutter/pull/181) as a utility, ported with its tests. **Not** as a change to `ComparableField`, which the row originally proposed: `Filter` compares through the same code (`filter.dart:299,320`), so folding there would make `$eq`, `$gt` and `$lt` case- and diacritic-insensitive locally while the API stayed exact. | Landed; chat deletes its copy on the next core release. | +| ✗ | **`Filter` `$nor`** | **Dropped, and chat removes it too.** Neither StreamCore (Swift) nor stream-android-core models `$nor`, and adding it to Dart alone breaks a parity the three otherwise keep. The backend withdrew `$ne`/`$nin` from the published spec in [GetStream/chat#15657](https://github.com/GetStream/chat/pull/15657) and left `$nor` accepted-but-unpublished, so a preset can still contain it — which is what `Filter.raw` is for, not a modelled operator. | Closed. | | ☐ | **The two-pointer `merge`** (`core/util/list_extensions.dart`) | If the benchmark [01](01-utilities.md) is parked on shows it beats core's keyed-map-merge-then-sort at real list sizes, core should take *ours* rather than chat taking core's — every product merges paginated lists. | The benchmark. | | ☐ | **`HeadersInterceptor` and `ConnectionIdInterceptor` tests** | Core ships both interceptors with **no tests**. Chat had tests for its forks, so this phase kept them chat-side (`additional_headers_interceptor_test.dart`, `connection_id_interceptor_test.dart`) pointed at core's types — they belong next to the code they cover. | Nothing. Port them up. | | ☐ | **A hand-written multipart CDN interface** | Feeds hand-wrote `CdnApi` because the generator emits a JSON `@Body()` for `multipart/form-data` operations, with no progress or cancellation. Chat will hand-write the same thing in [09](09-uploads.md). Two identical hand-written retrofit interfaces is a smell — either core owns one, or the generator is fixed. | Prefer the generator fix; see the `openapi-codegen` skill. | -| ☐ | **`_ResultCallAdapter`** | Three lines wrapping `runApiSafely`, and feeds already declares it **twice** (generated `default_api.dart` and hand-written `cdn_api.dart`). Chat's generated client has a third. Core owns `runApiSafely`; it may as well own the adapter. | Nothing. Trivial. | -| ☐ | **`ComparableField` returning `0` for incomparable types** | Core throws `ArgumentError`; chat returns `0`. A throw turns a cosmetic ordering glitch into a crash inside a list view. Argue chat's behaviour is the right default rather than working around it. | Argument, not code. | -| ◐ | **`CurrentPlatform.debugCurrentPlatformOverride`** | Already on core's `main` — chat just cannot use it until there is a release. Recorded here so nobody re-raises it as missing. | A `stream_core` release. | +| ✗ | **`_ResultCallAdapter`** | **Not worth moving.** Core does not depend on `retrofit`, so this would add that dependency for every core consumer to save three lines that a *generator* emits and nobody hand-maintains. If anywhere, the fix belongs in the generator template. | Closed. | +| ✗ | **Value equality on `Sort`** | **Dropped: it cannot be written correctly.** Comparing `field.remote` ignores the comparator, so two sorts naming one wire field with different value getters compared equal and hashed equal while ordering a list in opposite directions (probed). Comparing the field itself is identity, since `SortField` has no `==`, and its comparator is a closure. Use `same()` or compare `toJson()` in tests. | Closed. | +| ✗ | **`SortDirection.fromJson`** | **Dropped: the generator would never call it.** `json_serializable` uses a `fromJson` static for class-typed fields, but decodes enums through `$enumDecode` against the generated map, taking its fallback from `@JsonKey(unknownValue:)` at each field site. A static would be reachable only by hand while generated code disagreed with it. The rule stays in chat as `ChannelSort._directionFromJson`. | Closed. | +| ☐ | **Drop the restated `nullOrdering` defaults in feeds' `XSort` classes** | All twelve declare `super.nullOrdering = NullOrdering.nullsLast/First`, which is exactly what `Sort.asc`/`Sort.desc` already default to. A super-parameter inherits the super constructor's default, so `{super.nullOrdering}` is behaviour-identical and saves ~130 of feeds' 219 lines. Verified by probe. | Nothing. | +| ☐ | **A const-constructible `SortField`** | `SortField(remote, closure)` can never be const — a closure literal is not a constant expression — so every registry member is `static final` and every `defaultSort` list is `final` too. Nothing is broken by that; it just means a caller cannot write a `const` sort list, and it cost [08](08-query-dsl.md) the list controllers' `const` default parameters. Const-ness needs the value lookup to be an overridden method rather than a constructor argument, which both chat and feeds would have to adopt together. | Would change `SortField`'s constructor, so it is a core-wide API decision, not a chat ask. | +| ☑ | **`CurrentPlatform.debugCurrentPlatformOverride`** | Landed on core's `main` in #178. | Landed; chat can use it on the next release. | + +| ☐ | **`Filter.raw`** | Open in [core#181](https://github.com/GetStream/stream-core-flutter/pull/181). `Filter` is `sealed`, so a gap has no downstream workaround, and chat needs one: a predefined filter is authored server-side and the query layer still accepts `$ne`/`$nin`/`$nor` ([#15657](https://github.com/GetStream/chat/pull/15657) is spec-only), so an echoed filter can carry an operator core does not model. `raw` is the fallback leaf that lets [08](08-query-dsl.md)'s `Filter.fromJson` stay total, the way `XSortField.custom` does for sort fields. Caveat: `matches` on a raw leaf returns `true`, which is right under `and` and wrong under `or` — Swift avoids this with a nullable predicate and `compactMap`, which a `bool matches(T)` cannot express. | Nothing. | ## Deliberately *not* moving @@ -58,9 +66,11 @@ product would react to it the same way. Nothing outside chat reacts to `message. ## How to raise one Core is a separate repo with its own release cadence, so batch these: a row here is rarely urgent on -its own, and each release chat has to wait for costs more than the change itself. The two worth -pushing first are the ones this plan is actually blocked on — `Filter`'s `$nor`, and a release -carrying `debugCurrentPlatformOverride`. +its own, and each release chat has to wait for costs more than the change itself. What is worth +pushing first is whatever this plan is actually blocked on, which is one thing: a release carrying +everything `melos.yaml` pins the branch to. As of phase [08](08-query-dsl.md) that is +`Filter.raw`, `normalizeStringForSort`, `debugCurrentPlatformOverride` and `sortedWith`. The rest +of the ☐ rows are improvements, not blockers, and can ride a later release. Cross-repo workflow is in [`STYLE_GUIDE.md`](../STYLE_GUIDE.md) (§Dependency management): a path dependency while both repos change together, back to a hosted constraint in `melos.yaml` before diff --git a/docs/docs_screenshots/pubspec.yaml b/docs/docs_screenshots/pubspec.yaml index 8a431b9233..09d32a3729 100644 --- a/docs/docs_screenshots/pubspec.yaml +++ b/docs/docs_screenshots/pubspec.yaml @@ -22,7 +22,7 @@ dependencies: stream_core_flutter: git: url: https://github.com/GetStream/stream-core-flutter.git - ref: b994522cf5cd495a24c65055cccffe3a5c8056da + ref: 04e0d1cb3a6893cf70cb6636a261deb11beff81c path: packages/stream_core_flutter dev_dependencies: @@ -39,3 +39,11 @@ dev_dependencies: flutter: uses-material-design: true + +dependency_overrides: + # Forces one source for `stream_core`; see `melos.yaml`. + stream_core: + git: + url: https://github.com/GetStream/stream-core-flutter.git + path: packages/stream_core + ref: 04e0d1cb3a6893cf70cb6636a261deb11beff81c diff --git a/docs/docs_screenshots/test/src/golden_client_stubs.dart b/docs/docs_screenshots/test/src/golden_client_stubs.dart index ca3702afa9..1ba1b63d93 100644 --- a/docs/docs_screenshots/test/src/golden_client_stubs.dart +++ b/docs/docs_screenshots/test/src/golden_client_stubs.dart @@ -10,11 +10,11 @@ void _ensureGoldenMocktailFallbacks() { registerFallbackValue(const Filter.empty()); registerFallbackValue(const ThreadOptions()); registerFallbackValue(const PaginationParams()); - registerFallbackValue(>[]); - registerFallbackValue(>[]); - registerFallbackValue(>[]); - registerFallbackValue(>[]); - registerFallbackValue(>[]); + registerFallbackValue(>[]); + registerFallbackValue(>[]); + registerFallbackValue(>[]); + registerFallbackValue(>[]); + registerFallbackValue(>[]); _registeredFallbacks = true; } diff --git a/melos.yaml b/melos.yaml index e2b493761e..ae206a15a1 100644 --- a/melos.yaml +++ b/melos.yaml @@ -105,12 +105,26 @@ command: stream_chat_persistence: ^10.4.0 streaming_shared_preferences: ^2.0.0 svg_icon_widget: ^0.0.1 - stream_core: ^0.5.0 + # Both core packages come from one pinned commit while v11 lands + # alongside stream-core-flutter. Pinned to a SHA rather than a branch: + # pub treats a branch ref and a resolved SHA as different sources, so a + # branch name fails to solve. + # + # `stream_core_flutter` declares a hosted `stream_core`, which keeps it + # publishable but names a second source for a package taken here from + # git — and pub allows a package only one. Every workspace package that + # sees both therefore overrides `stream_core` to this same ref. Restore + # hosted constraints before release and the overrides go with them. + stream_core: + git: + url: https://github.com/GetStream/stream-core-flutter.git + path: packages/stream_core + ref: 04e0d1cb3a6893cf70cb6636a261deb11beff81c stream_core_flutter: git: url: https://github.com/GetStream/stream-core-flutter.git - ref: b994522cf5cd495a24c65055cccffe3a5c8056da path: packages/stream_core_flutter + ref: 04e0d1cb3a6893cf70cb6636a261deb11beff81c stream_thumbnail: git: url: https://github.com/GetStream/stream-core-flutter.git diff --git a/migrations/v11-migration.md b/migrations/v11-migration.md index 81cb111569..a2fc03c914 100644 --- a/migrations/v11-migration.md +++ b/migrations/v11-migration.md @@ -90,6 +90,25 @@ search-and-replace you can apply directly. `Kind` is one of `renamed`, `removed` | `export 'package:logging'` (`Logger`, `Level`, `LogRecord`) | `StreamLogger`, `StreamLogConfig`, `StreamLogHandler`, `StreamLogFilter`, `StreamLogPriority`, `StreamLogRecord` | `removed` | `package:logging` is no longer a dependency | | `LoggingInterceptor` / `InterceptStep` / `LogPrint` | — | `removed` | The interceptor is installed by default and writes through your `StreamLogHandler`; route its output with `logConfig` | | `StreamChatPersistenceClient(logLevel:, logHandlerFunction:)` | — | `removed` | Logging is configured once, on the client | +| `SortOption.asc(field)` / `.desc(field)` | `ChannelSort.asc(field)` / `MemberSort.desc(field)` / … | `renamed` | One `Sort` subclass per model, as in `stream_feeds`. `nullOrdering` is still a named parameter | +| `SortOption.ASC` / `.DESC` | `SortDirection.asc` / `.desc` | `retyped` | An enum carrying `value` (`1` / `-1`) rather than a bare `int` | +| `const [SortOption.desc(f)]` | `[ChannelSort.desc(f)]` | `retyped` | **Drop the `const`.** A sort list can no longer be `const`: a `SortField` holds a closure that reads the value off the model, which is not a constant expression. Every v10 example wrote `const`, so expect this on the first line you touch | +| `ChannelSortKey` / `MessageSortKey` / `UserSortKey` / … (extension types over `String`) | `ChannelSortField` / `MessageSearchSortField` / `UserSortField` / … | `retyped` | Same member names. A field is no longer a `String`: read `field.remote` for the wire name. `MessageSortKey` is named for its one endpoint: searching | +| `SortOption.desc('my_custom_field')` | `ChannelSort.desc(ChannelSortField.custom('my_custom_field'))` | `retyped` | Declared on channel, member, user and message-search sorts only — poll, poll-vote, thread, draft, reaction and banned-user queries pin their sort to declared fields and reject a custom one | +| `SortOrder` | `List`, `List`, … | `removed` | The typedef is gone; signatures name the model's sort type | +| `SortOption.fromJson` | `ChannelSort.fromJson` | `moved` | `Sort` has no `fromJson`: the remote name has to resolve back to a declared field | +| `SortOption(comparator:)` | — | `removed` | Declare a field whose value projects onto something orderable, or sort the list yourself | +| `DraftSortKey`'s `extraData` fallback | — | `removed` | The server rejects a custom sort field on drafts | +| `PollVoteSortKey.answerText` | — | `removed` | The API rejects a sort on `answer_text` | +| _(new)_ | `ChannelSortField.cid` | `added` | Both iOS and Android sort channels by `cid` | +| _(new)_ | `MessageReminderSortField.messageId` | `added` | The server allows it and breaks reminder ties on it | +| _(new)_ | `MessageSearchSortField.relevance` | `added` | Sorts search results by match quality; the server drops it when the request has no text filter | +| `defaultChannelListSort` / `defaultMemberListSort` / `defaultUserListSort` / `defaultDraftListSort` / `defaultMessageReminderListSort` / `defaultPollVoteListSort` (`stream_chat_flutter_core`) | `ChannelSort.defaultSort` / `MemberSort.defaultSort` / … (`stream_chat`) | `moved` | The default belongs to the sort, as in `stream_feeds` and on Android. Now reachable without the Flutter layer | +| `StreamChannelListController(channelStateSort: null)` and the other controllers' `sort: null` | omit the argument, or pass `ChannelSort.empty` | `retyped` | A controller's `sort` is non-nullable where the model declares a default. Omitting it applies that default; `XSort.empty` queries with the ordering the API applies on its own and leaves the page in the order it arrived in | +| `ComparableField` / `ComparableFieldProvider` | — | `removed` | Never exported. A field now carries its own extractor, passed to `XSortField(remote, localValue)`; there is no public getter for the value it reads, so assert on the ordering a sort produces rather than on the value behind it | +| `getComparableField(String)` on `User`, `Message`, `Member`, `Draft`, `Thread`, `Poll`, `PollVote`, `Reaction`, `BannedUser`, `MessageReminder` and `ChannelState` | — | `removed` | The types it named were unexported, but the method was public on all eleven models. A field reads its own value now, so an override has nowhere to go | +| `NullOrdering` / `CompositeComparator` | `stream_core`'s, re-exported | `moved` | Same names and semantics | +| `client.search(sort:)` / `channel.search(sort:)` / `StreamMessageSearchListController.sort`, taking `SortOrder?` | `List?` | `retyped` | Was untyped, so a channel field compiled — and the server does not reject one, it reads it as a custom message field, which is null on every message, so the term silently did nothing | | _(more added per feature as PRs land)_ | | | | --- diff --git a/openapi-migration/01-foundation.md b/openapi-migration/01-foundation.md index 5e92f81a27..4f8e9a65ed 100644 --- a/openapi-migration/01-foundation.md +++ b/openapi-migration/01-foundation.md @@ -31,6 +31,13 @@ let group 09 merely execute it. The same applies, in a smaller way, to the channel shape embedded in threads (group 07) versus the channels group (group 11). +**Decide `name` and `image` with it.** Both arrive as root fields on the wire and are pushed into `extraData` by +`Serializer.moveToExtraDataFromRoot`; `User.name` is a getter over `extraData['name']` that falls back to `id`, +and the constructor writes the arguments back into `extraData` "for backwards compatibility". Promoting them to +real fields is a break worth making in v11 if it is made at all, and it belongs to this decision rather than to +whichever group happens to touch `User` first. Raised on +[#2957](https://github.com/GetStream/stream-chat-flutter/pull/2957). + ## Prerequisites - **The generator's `client.tpl` calls `runApiSafely`, not `runSafely`.** Until it does, a regenerated client diff --git a/packages/stream_chat/CHANGELOG.md b/packages/stream_chat/CHANGELOG.md index a12747948e..2b0568ecb9 100644 --- a/packages/stream_chat/CHANGELOG.md +++ b/packages/stream_chat/CHANGELOG.md @@ -12,6 +12,18 @@ - `RetryPolicy.shouldRetry` receives a `StreamChatException?` instead of a `StreamChatError?`. - `UploadState`'s variant classes are renamed to `UploadStatePreparing`, `UploadStateInProgress`, `UploadStateSuccess` and `UploadStateFailed`, freeing the names `Success` and `Failed`. - `Result` from `package:async` is no longer re-exported; the re-exported `Result` is `stream_core`'s. +- Sorting is now `stream_core`'s. `SortOption.desc(ChannelSortKey.lastUpdated)` becomes `ChannelSort.desc(ChannelSortField.lastUpdated)` — one `Sort` subclass and one field registry per model, with the same member names as the old `*SortKey`. +- `SortOrder` is removed. Signatures take `List`, `List` and so on. +- `NullOrdering`, `SortDirection` and the `compare` extension are `stream_core`'s, re-exported from this package. +- `ComparableField`, `ComparableFieldProvider` and `SortOption.fromJson` are removed. A stored sort is read back with `ChannelSort.fromJson`. +- `SortOption`'s `comparator` argument is removed. Declare a field whose value projects onto something orderable, or sort the list yourself. +- `PollVoteSortField.answerText` is removed: the API rejects a sort on `answer_text`. +- `ChannelSortField.cid` is added, matching the iOS and Android SDKs. +- `search(sort:)` on the client and channel, and `StreamMessageSearchListController.sort`, are typed `List` rather than an untyped `SortOrder`. Searching is the only message query the API sorts, so the type is named for it. +- `DraftSortField` has no `custom` field: the API rejects a custom sort field on drafts. +- A sort names its model's field type, so `MemberSort.asc` takes a `MemberSortField` and a field from another model does not compile. `XSortField.custom(key)` reads a field from the model's extra data, for the four models whose queries accept one. +- Added `ChannelSort.empty`, `MemberSort.empty` and one on every other sort — an empty sort, for querying with the ordering the API applies on its own. +- Default sorts moved onto the sort that owns them: `ChannelSort.defaultSort`, `MemberSort.defaultSort` and so on, reachable now without the Flutter layer. - `StreamChatNetworkError` and `StreamChatNetworkErrorType` are removed. Nothing throws them any more, so keeping them would let an `on StreamChatNetworkError catch` clause compile while matching nothing. 🔄 Changed @@ -23,6 +35,12 @@ ✅ Added - Log records from the HTTP and token layers now reach the configured handler. +- Added `MessageSearchSortField.relevance`, which sorts a message search by match quality. +- Added `MessageReminderSortField.messageId`, the field the API breaks reminder ties on. +- Added `ReactionSort.defaultSort` and `PollSort.defaultSort`, each the ordering the API already applies to that query. +- Added the message sort fields the JS client already exposed: `text`, `type`, `parentId`, `replyCount` and `pinned`. +- Added `MemberSortField.updatedAt`. +- Added `UserSortField.language` and `UserSortField.teams`. 🔒 Security diff --git a/packages/stream_chat/lib/src/client/channel/channel.dart b/packages/stream_chat/lib/src/client/channel/channel.dart index 45e7e0ef64..7330565e5b 100644 --- a/packages/stream_chat/lib/src/client/channel/channel.dart +++ b/packages/stream_chat/lib/src/client/channel/channel.dart @@ -1374,7 +1374,7 @@ class Channel { Future search({ String? query, Filter? messageFilters, - List? sort, + List? sort, PaginationParams? paginationParams, }) { _checkInitialized(); @@ -1541,7 +1541,7 @@ class Channel { Future queryPollVotes( String pollId, { Filter? filter, - SortOrder? sort, + List? sort, PaginationParams pagination = const PaginationParams(), }) { _checkInitialized(); @@ -2212,7 +2212,7 @@ class Channel { /// Query channel members. Future queryMembers({ Filter? filter, - SortOrder? sort, + List? sort, PaginationParams? pagination, }) => _client.queryMembers( type, @@ -2226,7 +2226,7 @@ class Channel { /// Query channel banned users. Future queryBannedUsers({ Filter? filter, - SortOrder? sort, + List? sort, PaginationParams? pagination, }) { _checkInitialized(); diff --git a/packages/stream_chat/lib/src/client/client.dart b/packages/stream_chat/lib/src/client/client.dart index 2054945477..b609bd6298 100644 --- a/packages/stream_chat/lib/src/client/client.dart +++ b/packages/stream_chat/lib/src/client/client.dart @@ -21,7 +21,6 @@ import '../../version.dart'; import '../core/api/attachment_file_uploader.dart'; import '../core/api/requests.dart'; import '../core/api/responses.dart'; -import '../core/api/sort_order.dart'; import '../core/api/stream_chat_api.dart'; import '../core/error/error.dart'; import '../core/http/app_settings_manager.dart'; @@ -694,7 +693,7 @@ class StreamChatClient { /// [PredefinedFilter] spec. Stream> queryChannels({ Filter? filter, - SortOrder? channelStateSort, + List? channelStateSort, String? predefinedFilter, Map? filterValues, Map? sortValues, @@ -729,7 +728,7 @@ class StreamChatClient { /// via [_queryChannelsCache]. Stream queryChannelsWithResult({ Filter? filter, - SortOrder? channelStateSort, + List? channelStateSort, String? predefinedFilter, Map? filterValues, Map? sortValues, @@ -818,7 +817,7 @@ class StreamChatClient { /// Requests channels with a given query from the API. Future> queryChannelsOnline({ Filter? filter, - SortOrder? sort, + List? sort, String? predefinedFilter, Map? filterValues, Map? sortValues, @@ -849,7 +848,7 @@ class StreamChatClient { Future _queryChannelsOnlineImpl({ Filter? filter, - SortOrder? sort, + List? sort, String? predefinedFilter, Map? filterValues, Map? sortValues, @@ -926,7 +925,7 @@ class StreamChatClient { final clearQueryCache = (paginationParams.offset ?? 0) == 0; Filter? resolvedFilter; - SortOrder? resolvedSort; + List? resolvedSort; if (res.predefinedFilter case final resolvedPredefinedFilter?) { resolvedFilter = resolvedPredefinedFilter.filter; resolvedSort = resolvedPredefinedFilter.effectiveSort; @@ -957,7 +956,7 @@ class StreamChatClient { String? predefinedFilter, Map? filterValues, Map? sortValues, - SortOrder? channelStateSort, + List? channelStateSort, int? messageLimit, PaginationParams paginationParams = const PaginationParams(), }) async { @@ -978,7 +977,7 @@ class StreamChatClient { String? predefinedFilter, Map? filterValues, Map? sortValues, - SortOrder? channelStateSort, + List? channelStateSort, int? messageLimit, PaginationParams paginationParams = const PaginationParams(), }) async { @@ -1036,7 +1035,7 @@ class StreamChatClient { Future queryUsers({ bool? presence, Filter? filter, - SortOrder? sort, + List? sort, PaginationParams? pagination, }) async { final response = await _chatApi.user.queryUsers( @@ -1052,7 +1051,7 @@ class StreamChatClient { /// Query banned users. Future queryBannedUsers({ required Filter filter, - SortOrder? sort, + List? sort, PaginationParams? pagination, }) => _chatApi.moderation.queryBannedUsers( filter: filter, @@ -1064,7 +1063,7 @@ class StreamChatClient { Future search( Filter filter, { String? query, - SortOrder? sort, + List? sort, PaginationParams? paginationParams, Filter? messageFilters, }) => _chatApi.general.searchMessages( @@ -1391,7 +1390,7 @@ class StreamChatClient { Filter? filter, String? channelId, List? members, - SortOrder? sort, + List? sort, PaginationParams? pagination, }) => _chatApi.general.queryMembers( channelType, @@ -1703,7 +1702,7 @@ class StreamChatClient { /// Queries Polls with the given [filter] and [sort] options. Future queryPolls({ Filter? filter, - SortOrder? sort, + List? sort, PaginationParams pagination = const PaginationParams(), }) => _chatApi.polls.queryPolls( filter: filter, @@ -1716,7 +1715,7 @@ class StreamChatClient { Future queryPollVotes( String pollId, { Filter? filter, - SortOrder? sort, + List? sort, PaginationParams pagination = const PaginationParams(), }) => _chatApi.polls.queryPollVotes( pollId, @@ -2002,7 +2001,7 @@ class StreamChatClient { Future queryReactions( String messageId, { Filter? filter, - SortOrder? sort, + List? sort, PaginationParams? pagination, }) => _chatApi.message.queryReactions( messageId, @@ -2126,7 +2125,7 @@ class StreamChatClient { /// Queries drafts for the current user. Future queryDrafts({ Filter? filter, - SortOrder? sort, + List? sort, PaginationParams? pagination, }) => _chatApi.message.queryDrafts( filter: filter, @@ -2254,7 +2253,7 @@ class StreamChatClient { /// Optionally, pass [filter] and [sort] to filter and sort the threads. Future queryThreads({ Filter? filter, - SortOrder? sort, + List? sort, ThreadOptions options = const ThreadOptions(), PaginationParams pagination = const PaginationParams(), }) => _chatApi.threads.queryThreads( @@ -2364,7 +2363,7 @@ class StreamChatClient { /// paginate the reminders. Future queryReminders({ Filter? filter, - SortOrder? sort, + List? sort, PaginationParams pagination = const PaginationParams(), }) { return _chatApi.reminders.queryReminders( diff --git a/packages/stream_chat/lib/src/core/api/channel_api.dart b/packages/stream_chat/lib/src/core/api/channel_api.dart index 65e7c47929..cb9c3f374b 100644 --- a/packages/stream_chat/lib/src/core/api/channel_api.dart +++ b/packages/stream_chat/lib/src/core/api/channel_api.dart @@ -8,7 +8,6 @@ import '../models/message.dart'; import '../models/message_delivery.dart'; import 'requests.dart'; import 'responses.dart'; -import 'sort_order.dart'; /// Defines the api dedicated to channel operations class ChannelApi { @@ -56,7 +55,7 @@ class ChannelApi { /// returns the materialized filter/sort on [QueryChannelsResponse]. Future queryChannels({ Filter? filter, - SortOrder? sort, + List? sort, String? predefinedFilter, Map? filterValues, Map? sortValues, diff --git a/packages/stream_chat/lib/src/core/api/general_api.dart b/packages/stream_chat/lib/src/core/api/general_api.dart index 36fa078ee8..c6ed739ba1 100644 --- a/packages/stream_chat/lib/src/core/api/general_api.dart +++ b/packages/stream_chat/lib/src/core/api/general_api.dart @@ -3,9 +3,9 @@ import 'dart:convert'; import '../http/stream_http_client.dart'; import '../models/filter.dart'; import '../models/member.dart'; +import '../models/message.dart'; import 'requests.dart'; import 'responses.dart'; -import 'sort_order.dart'; /// Defines the api dedicated to general operations class GeneralApi { @@ -33,7 +33,7 @@ class GeneralApi { Future searchMessages( Filter filter, { String? query, - SortOrder? sort, + List? sort, PaginationParams? pagination, Filter? messageFilters, }) async { @@ -75,7 +75,7 @@ class GeneralApi { Filter? filter, String? channelId, List? members, - SortOrder? sort, + List? sort, PaginationParams? pagination, }) async { final response = await _client.get( diff --git a/packages/stream_chat/lib/src/core/api/message_api.dart b/packages/stream_chat/lib/src/core/api/message_api.dart index f12fc30147..2ef5e86e31 100644 --- a/packages/stream_chat/lib/src/core/api/message_api.dart +++ b/packages/stream_chat/lib/src/core/api/message_api.dart @@ -8,7 +8,6 @@ import '../models/message.dart'; import '../models/reaction.dart'; import 'requests.dart'; import 'responses.dart'; -import 'sort_order.dart'; /// Defines the api dedicated to messages operations class MessageApi { @@ -98,7 +97,7 @@ class MessageApi { /// Returns a [QueryDraftsResponse] containing the list of draft. Future queryDrafts({ Filter? filter, - SortOrder? sort, + List? sort, PaginationParams? pagination, }) async { final response = await _client.post( @@ -265,7 +264,7 @@ class MessageApi { Future queryReactions( String messageId, { Filter? filter, - SortOrder? sort, + List? sort, PaginationParams? pagination, }) async { final response = await _client.post( diff --git a/packages/stream_chat/lib/src/core/api/moderation_api.dart b/packages/stream_chat/lib/src/core/api/moderation_api.dart index 2b289debb3..4a91c790ff 100644 --- a/packages/stream_chat/lib/src/core/api/moderation_api.dart +++ b/packages/stream_chat/lib/src/core/api/moderation_api.dart @@ -130,7 +130,7 @@ class ModerationApi { /// Queries banned users. Future queryBannedUsers({ Filter? filter, - SortOrder? sort, + List? sort, PaginationParams? pagination, }) async { final response = await _client.get( diff --git a/packages/stream_chat/lib/src/core/api/polls_api.dart b/packages/stream_chat/lib/src/core/api/polls_api.dart index 6c5e02ce28..fd06597173 100644 --- a/packages/stream_chat/lib/src/core/api/polls_api.dart +++ b/packages/stream_chat/lib/src/core/api/polls_api.dart @@ -7,7 +7,6 @@ import '../models/poll_option.dart'; import '../models/poll_vote.dart'; import 'requests.dart'; import 'responses.dart'; -import 'sort_order.dart'; /// Defines the api dedicated to polls operations class PollsApi { @@ -163,7 +162,7 @@ class PollsApi { /// parameters. Future queryPolls({ Filter? filter, - SortOrder? sort, + List? sort, PaginationParams pagination = const PaginationParams(), }) async { final response = await _client.post( @@ -182,7 +181,7 @@ class PollsApi { Future queryPollVotes( String pollId, { Filter? filter, - SortOrder? sort, + List? sort, PaginationParams pagination = const PaginationParams(), }) async { final response = await _client.post( diff --git a/packages/stream_chat/lib/src/core/api/reminders_api.dart b/packages/stream_chat/lib/src/core/api/reminders_api.dart index 554e7cff0c..27216f3ab8 100644 --- a/packages/stream_chat/lib/src/core/api/reminders_api.dart +++ b/packages/stream_chat/lib/src/core/api/reminders_api.dart @@ -5,7 +5,6 @@ import '../models/filter.dart'; import '../models/message_reminder.dart'; import 'requests.dart'; import 'responses.dart'; -import 'sort_order.dart'; /// Defines the api dedicated to message reminders operations class RemindersApi { @@ -23,7 +22,7 @@ class RemindersApi { /// Returns a [QueryRemindersResponse] containing the list of reminders. Future queryReminders({ Filter? filter, - SortOrder? sort, + List? sort, PaginationParams? pagination, }) async { final response = await _client.post( diff --git a/packages/stream_chat/lib/src/core/api/sort_order.dart b/packages/stream_chat/lib/src/core/api/sort_order.dart deleted file mode 100644 index 1a52707308..0000000000 --- a/packages/stream_chat/lib/src/core/api/sort_order.dart +++ /dev/null @@ -1,183 +0,0 @@ -// ignore_for_file: constant_identifier_names - -import 'package:json_annotation/json_annotation.dart'; -import '../models/channel_state.dart'; -import '../models/comparable_field.dart'; - -part 'sort_order.g.dart'; - -/// A list of [SortOption]s that define a sorting order for elements of type [T] -/// -/// When multiple sort options are provided, they are applied in sequence -/// until a non-equal comparison is found. -/// -/// Example: `Sort([pinnedAtSort, lastMessageAtSort])` -typedef SortOrder = List>; - -/// Defines how null values should be ordered in a sort operation. -enum NullOrdering { - /// Null values appear at the beginning of the sorted list, - /// regardless of sort direction (ASC or DESC). - nullsFirst, - - /// Null values appear at the end of the sorted list, - /// regardless of sort direction (ASC or DESC). - nullsLast, -} - -/// A sort specification for objects that implement [ComparableFieldProvider]. -/// -/// Defines a field to sort by and a direction (ascending or descending). -/// Can use a custom comparator or create a default one based on the field name. -/// -/// Example: -/// ```dart -/// // Sort channels by last message date in descending order -/// final sort = SortOption("last_message_at"); -/// ``` -/// -/// String comparisons are diacritic- and case-insensitive by default so client -/// ordering aligns with what the server returns for sorts like `name` (see -/// [ComparableField]). Pass a custom [Comparator] via the `comparator` -/// parameter to override this — e.g. to sort raw codepoints or apply a -/// locale-aware collator. -@JsonSerializable(createFactory: false, includeIfNull: false) -class SortOption { - /// Creates a SortOption for descending order sorting by the specified field. - /// - /// Example: - /// ```dart - /// // Sort channels by last message date in descending order - /// final sort = SortOption.desc("last_message_at"); - /// ``` - const SortOption.desc( - this.field, { - NullOrdering? nullOrdering, - this._comparator, - }) : direction = SortOption.DESC, - // The server orders pinned_at and last_message_at NULLS LAST whichever - // direction they are sorted in, so pinned and message-less channels - // stay at the end of the list. Every other field is ordered with a bare - // direction, which puts nulls first on a descending sort. - nullOrdering = - nullOrdering ?? - (field == ChannelSortKey.pinnedAt || field == ChannelSortKey.lastMessageAt - ? NullOrdering.nullsLast - : NullOrdering.nullsFirst); - - /// Creates a SortOption for ascending order sorting by the specified field. - /// - /// Example: - /// ```dart - /// // Sort channels by name in ascending order - /// final sort = SortOption.asc("name"); - /// ``` - const SortOption.asc( - this.field, { - NullOrdering? nullOrdering, - this._comparator, - }) : direction = SortOption.ASC, - // Every field the server sorts ascending orders nulls last, either - // explicitly or by inheriting the default. - nullOrdering = nullOrdering ?? NullOrdering.nullsLast; - - /// Creates a [SortOption] from its JSON-serialized representation. - /// - /// Reconstructs via [SortOption.desc] / [SortOption.asc] based on the - /// `direction` field; [nullOrdering] resolves to the default for the field - /// and any custom comparator is discarded (comparators are not serialized). - factory SortOption.fromJson(Map json) { - final field = json['field'] as String; - final direction = json['direction'] as int; - return direction == SortOption.DESC ? SortOption.desc(field) : SortOption.asc(field); - } - - /// Ascending order (1) - static const ASC = 1; - - /// Descending order (-1) - static const DESC = -1; - - /// The field name to sort by - final String field; - - /// The sort direction (ASC or DESC) - final int direction; - - /// The null ordering strategy to use when comparing null values. - /// - /// When not passed to the constructor, defaults to the ordering the server - /// applies for [field]: [NullOrdering.nullsLast] for - /// [ChannelSortKey.pinnedAt] and [ChannelSortKey.lastMessageAt] in either - /// direction, and for every field on an ascending sort; - /// [NullOrdering.nullsFirst] for any other field on a descending sort. - @JsonKey(includeToJson: false, includeFromJson: false) - final NullOrdering nullOrdering; - - /// Compares two objects of type T using the specified field and direction. - /// - /// Returns: - /// - 0 if both objects are equal - /// - 1 if the first object is greater than the second - /// - -1 if the first object is less than the second - /// - /// Handles null values according to the nullOrdering setting. - /// NULLS FIRST puts nulls at the beginning regardless of sort direction. - /// NULLS LAST puts nulls at the end regardless of sort direction. - /// - /// ```dart - /// final sortOption = SortOption("last_message_at"); - /// final sortedChannels = channels.sort(sortOption.compare); - /// ``` - int compare(T a, T b) => comparator(a, b); - - /// Returns a comparator function for sorting objects of type T. - @JsonKey(includeToJson: false, includeFromJson: false) - Comparator get comparator { - if (_comparator case final comparator?) { - return (a, b) => direction * comparator(a, b); - } - - return (a, b) { - final aValue = a.getComparableField(field); - final bValue = b.getComparableField(field); - - return _compareNullableFields(aValue, bValue); - }; - } - - final Comparator? _comparator; - - int _compareNullableFields(ComparableField? a, ComparableField? b) { - // Handle nulls first, independent of sort direction - if (a == null && b == null) return 0; - if (a == null) return nullOrdering == NullOrdering.nullsFirst ? -1 : 1; - if (b == null) return nullOrdering == NullOrdering.nullsFirst ? 1 : -1; - - // Apply direction only to non-null comparisons - return direction * a.compareTo(b); - } - - /// Converts this option to JSON. - Map toJson() => _$SortOptionToJson(this); -} - -/// Extension that allows a [SortOrder] to be used as a comparator function. -extension CompositeComparator on SortOrder { - /// Compares two objects using all sort options in sequence. - /// - /// Returns the first non-zero comparison result, or 0 if all comparisons - /// result in equality. - /// - /// ```dart - /// channels.sort(mySort.compare); - /// ``` - int compare(T a, T b) { - for (final sortOption in this) { - final comparison = sortOption.compare(a, b); - if (comparison != 0) return comparison; - } - - return 0; // All comparisons were equal - } -} diff --git a/packages/stream_chat/lib/src/core/api/sort_order.g.dart b/packages/stream_chat/lib/src/core/api/sort_order.g.dart deleted file mode 100644 index 0914bace61..0000000000 --- a/packages/stream_chat/lib/src/core/api/sort_order.g.dart +++ /dev/null @@ -1,14 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'sort_order.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -Map _$SortOptionToJson( - SortOption instance, -) => { - 'field': instance.field, - 'direction': instance.direction, -}; diff --git a/packages/stream_chat/lib/src/core/api/threads_api.dart b/packages/stream_chat/lib/src/core/api/threads_api.dart index 1ff0204139..d6c573d440 100644 --- a/packages/stream_chat/lib/src/core/api/threads_api.dart +++ b/packages/stream_chat/lib/src/core/api/threads_api.dart @@ -5,7 +5,6 @@ import '../models/filter.dart'; import '../models/thread.dart'; import 'requests.dart'; import 'responses.dart'; -import 'sort_order.dart'; /// Defines the api dedicated to threads operations class ThreadsApi { @@ -17,7 +16,7 @@ class ThreadsApi { /// Queries threads with the given [options] and [pagination] params. Future queryThreads({ Filter? filter, - SortOrder? sort, + List? sort, ThreadOptions options = const ThreadOptions(), PaginationParams pagination = const PaginationParams(), }) async { diff --git a/packages/stream_chat/lib/src/core/api/user_api.dart b/packages/stream_chat/lib/src/core/api/user_api.dart index fa6b07df54..d5d5a82d6d 100644 --- a/packages/stream_chat/lib/src/core/api/user_api.dart +++ b/packages/stream_chat/lib/src/core/api/user_api.dart @@ -7,7 +7,6 @@ import '../models/location_coordinates.dart'; import '../models/user.dart'; import 'requests.dart'; import 'responses.dart'; -import 'sort_order.dart'; /// Defines the api dedicated to users operations class UserApi { @@ -20,7 +19,7 @@ class UserApi { Future queryUsers({ bool presence = false, Filter? filter, - SortOrder? sort, + List? sort, PaginationParams? pagination, }) async { final response = await _client.get( diff --git a/packages/stream_chat/lib/src/core/models/banned_user.dart b/packages/stream_chat/lib/src/core/models/banned_user.dart index ad76aadfef..888b57fbea 100644 --- a/packages/stream_chat/lib/src/core/models/banned_user.dart +++ b/packages/stream_chat/lib/src/core/models/banned_user.dart @@ -1,14 +1,15 @@ import 'package:equatable/equatable.dart'; import 'package:json_annotation/json_annotation.dart'; +import 'package:stream_core/stream_core.dart' show Sort, SortField; + import 'channel_model.dart'; -import 'comparable_field.dart'; import 'user.dart'; part 'banned_user.g.dart'; /// Contains information about a [User] that was banned from a [Channel] or App. @JsonSerializable() -class BannedUser extends Equatable implements ComparableFieldProvider { +class BannedUser extends Equatable { /// Creates a new instance of [BannedUser] const BannedUser({ required this.user, @@ -76,25 +77,38 @@ class BannedUser extends Equatable implements ComparableFieldProvider { shadow, reason, ]; - - @override - ComparableField? getComparableField(String sortKey) { - final value = switch (sortKey) { - BannedUserSortKey.createdAt => createdAt, - _ => null, - }; - - return ComparableField.fromValue(value); - } } -/// Extension type representing sortable fields for [BannedUser]. +/// Represents a sorting operation for banned users. /// -/// This type provides type-safe keys that can be used for sorting banned users -/// in queries. Each constant represents a field that can be sorted on. -extension type const BannedUserSortKey(String key) implements String { - /// Sort banned users by their creation date. +/// See [BannedUserSortField] for the fields that can be sorted on. +class BannedUserSort extends Sort { + /// Sorts by [field], smallest first. + const BannedUserSort.asc( + BannedUserSortField super.field, { + super.nullOrdering, + }) : super.asc(); + + /// Sorts by [field], largest first. + const BannedUserSort.desc( + BannedUserSortField super.field, { + super.nullOrdering, + }) : super.desc(); +} + +/// Represents a field that banned-user queries can be sorted on. +class BannedUserSortField extends SortField { + /// Creates a field named [remote] on the wire, reading its value off an + /// instance with `localValue`. + /// + /// For a name the SDK has not modelled; prefer the fields declared here. + BannedUserSortField(super.remote, super.localValue); + + /// Sorts banned users by their creation date. /// /// This is the default sort field (in descending order). - static const createdAt = BannedUserSortKey('created_at'); + static final createdAt = BannedUserSortField( + 'created_at', + (it) => it.createdAt, + ); } diff --git a/packages/stream_chat/lib/src/core/models/channel_state.dart b/packages/stream_chat/lib/src/core/models/channel_state.dart index 4d4ef8a3ba..1e474ec514 100644 --- a/packages/stream_chat/lib/src/core/models/channel_state.dart +++ b/packages/stream_chat/lib/src/core/models/channel_state.dart @@ -1,6 +1,7 @@ import 'package:json_annotation/json_annotation.dart'; +import 'package:stream_core/stream_core.dart' show NullOrdering, Sort, SortDirection, SortField, Standard; +import '../util/string_sort_normalizer.dart'; import 'channel_model.dart'; -import 'comparable_field.dart'; import 'draft.dart'; import 'location.dart'; import 'member.dart'; @@ -19,7 +20,7 @@ const _nullConst = _NullConst(); /// The class that contains the information about a channel @JsonSerializable() -class ChannelState implements ComparableFieldProvider { +class ChannelState { /// Constructor used for json serialization const ChannelState({ this.channel, @@ -125,54 +126,187 @@ class ChannelState implements ComparableFieldProvider { pushPreferences: pushPreferences ?? this.pushPreferences, activeLiveLocations: activeLiveLocations ?? this.activeLiveLocations, ); +} - @override - ComparableField? getComparableField(String sortKey) { - final value = switch (sortKey) { - ChannelSortKey.lastUpdated => channel?.lastUpdatedAt, - ChannelSortKey.createdAt => channel?.createdAt, - ChannelSortKey.updatedAt => channel?.updatedAt, - ChannelSortKey.lastMessageAt => channel?.lastMessageAt, - ChannelSortKey.memberCount => channel?.memberCount, - ChannelSortKey.pinnedAt => membership?.pinnedAt, - // TODO: Support providing default value for hasUnread, unreadCount - ChannelSortKey.hasUnread => null, - ChannelSortKey.unreadCount => null, - _ => channel?.extraData[sortKey], +/// Represents a sorting operation for channels. +/// +/// Keeps [ChannelSortField.pinnedAt] and [ChannelSortField.lastMessageAt] +/// nulls-last in either direction, the way the API orders them, unless a +/// `nullOrdering` says otherwise. +/// +/// See [ChannelSortField] for the fields that can be sorted on. +class ChannelSort extends Sort { + /// Sorts by [field], smallest first. + ChannelSort.asc( + ChannelSortField super.field, { + NullOrdering? nullOrdering, + }) : super.asc(nullOrdering: nullOrdering ?? _orderingFor(field, .nullsLast)); + + /// Sorts by [field], largest first. + ChannelSort.desc( + ChannelSortField super.field, { + NullOrdering? nullOrdering, + }) : super.desc(nullOrdering: nullOrdering ?? _orderingFor(field, .nullsFirst)); + + /// Reads a sort back from the `{'field': …, 'direction': ±1}` shape [Sort] + /// serializes to. + factory ChannelSort.fromJson(Map json) { + final field = ChannelSortField.fromRemote(json['field'] as String); + + return switch (_directionFromJson(json['direction'])) { + SortDirection.asc => ChannelSort.asc(field), + SortDirection.desc => ChannelSort.desc(field), }; + } - return ComparableField.fromValue(value); + // Anything other than descending's value reads as ascending, which is how + // the API reads it — so an absent or unknown direction is not an error. + static SortDirection _directionFromJson(Object? value) { + if (value == SortDirection.desc.value) return SortDirection.desc; + return SortDirection.asc; } + + // The fields the API orders nulls-last whichever way they are sorted, so a + // channel with no messages and one that is not pinned stay at the end. + static final _nullsLastFields = { + ChannelSortField.pinnedAt.remote, + ChannelSortField.lastMessageAt.remote, + }; + + // Keyed on the remote name, so a field built by hand for a pinned name is + // ordered the same way. + static NullOrdering _orderingFor(ChannelSortField field, NullOrdering fallback) { + if (_nullsLastFields.contains(field.remote)) return NullOrdering.nullsLast; + return fallback; + } + + /// An empty sort: the query carries no sort term, and a list keeps the + /// order it arrived in. + static const List empty = []; + + /// The ordering the API applies to a channel query when none is given. + /// + /// Sorts by the last message date, or the channel creation date when it has + /// no messages. + static final List defaultSort = [ + ChannelSort.desc(ChannelSortField.lastUpdated), + ]; } -/// Extension type representing sortable fields for [ChannelState]. -/// -/// This type provides type-safe keys that can be used for sorting channels -/// in queries. Each constant represents a field that can be sorted on. -extension type const ChannelSortKey(String key) implements String { - /// The default sorting is by the last message date or a channel created date - /// if no messages. - static const lastUpdated = ChannelSortKey('last_updated'); +/// Represents a field that channel queries can be sorted on. +class ChannelSortField extends SortField { + /// Creates a field named [remote] on the wire, reading its value off an + /// instance with `localValue`. + /// + /// For a name the SDK has not modelled; prefer the fields declared here. + ChannelSortField(super.remote, super.localValue); + + /// Creates a field the SDK does not model, read from [ChannelModel.extraData]. + /// + /// Declared only where the API accepts a custom sort field. + /// + /// String values are compared as they are, without the case and diacritic + /// folding a declared name field applies. + factory ChannelSortField.custom(String remote) { + return ChannelSortField(remote, (it) => it.channel?.extraData[remote]); + } + + /// Sorts channels by their last activity. + /// + /// The date of the last message, or the channel creation date when it has + /// none. + static final lastUpdated = ChannelSortField( + 'last_updated', + (it) => it.channel?.lastUpdatedAt, + ); - /// Sort channels by the date they were created. - static const createdAt = ChannelSortKey('created_at'); + /// Sorts channels by their channel id. + static final cid = ChannelSortField( + 'cid', + (it) => it.channel?.cid, + ); - /// Sort channels by the date they were updated. - static const updatedAt = ChannelSortKey('updated_at'); + /// Sorts channels by their name. + /// + /// Compares the folded form, so a name differing only by case, a diacritic + /// or a ligature sorts where a reader expects it rather than after Z. + static final name = ChannelSortField( + 'name', + (it) => it.channel?.name?.let(normalizeStringForSort), + ); + + /// Sorts channels by the date they were created. + static final createdAt = ChannelSortField( + 'created_at', + (it) => it.channel?.createdAt, + ); - /// Sort channels by the timestamp of the last message. - static const lastMessageAt = ChannelSortKey('last_message_at'); + /// Sorts channels by the date they were updated. + static final updatedAt = ChannelSortField( + 'updated_at', + (it) => it.channel?.updatedAt, + ); + + /// Sorts channels by the timestamp of the last message. + /// + /// Channels with no messages come last whichever direction this is sorted + /// in. + static final lastMessageAt = ChannelSortField( + 'last_message_at', + (it) => it.channel?.lastMessageAt, + ); - /// Sort channels by the number of members. - static const memberCount = ChannelSortKey('member_count'); + /// Sorts channels by the number of members. + static final memberCount = ChannelSortField( + 'member_count', + (it) => it.channel?.memberCount, + ); - /// Sort channels by whether they have unread messages. + /// Sorts channels by whether they have unread messages. + /// /// Useful for grouping read and unread channels. - static const hasUnread = ChannelSortKey('has_unread'); + // TODO: Support providing default value for hasUnread + static final hasUnread = ChannelSortField( + 'has_unread', + (_) => null, + ); - /// Sort channels by the count of unread messages. - static const unreadCount = ChannelSortKey('unread_count'); + /// Sorts channels by the count of unread messages. + // TODO: Support providing default value for unreadCount + static final unreadCount = ChannelSortField( + 'unread_count', + (_) => null, + ); - /// Sort channels by the date they were pinned. - static const pinnedAt = ChannelSortKey('pinned_at'); + /// Sorts channels by the date they were pinned. + /// + /// Unpinned channels come last whichever direction this is sorted in. + static final pinnedAt = ChannelSortField( + 'pinned_at', + (it) => it.membership?.pinnedAt, + ); + + static final _fields = [ + lastUpdated, + cid, + name, + createdAt, + updatedAt, + lastMessageAt, + memberCount, + hasUnread, + unreadCount, + pinnedAt, + ]; + + static final _byRemote = {for (final field in _fields) field.remote: field}; + + /// The field [remote] names, or a [ChannelSortField.custom] one when the SDK + /// does not model it. + /// + /// An undeclared name still sorts the query correctly, but reads nothing + /// locally, so a list sorted on it keeps the order it arrived in. + static ChannelSortField fromRemote(String remote) { + return _byRemote[remote] ?? ChannelSortField.custom(remote); + } } diff --git a/packages/stream_chat/lib/src/core/models/comparable_field.dart b/packages/stream_chat/lib/src/core/models/comparable_field.dart deleted file mode 100644 index a7c076a1e3..0000000000 --- a/packages/stream_chat/lib/src/core/models/comparable_field.dart +++ /dev/null @@ -1,60 +0,0 @@ -import '../util/string_sort_normalizer.dart'; - -/// A wrapper class for values that implements [Comparable]. -/// -/// This class is used to compare values of different types in a way that -/// allows for consistent ordering. -/// -/// This is useful when sorting or comparing values in a consistent manner. -/// -/// For example, when sorting a list of objects with different types of fields, -/// using this class will ensure that all values are compared correctly -/// regardless of their type. -/// -/// String comparisons fold diacritics and ligatures to base characters -/// (`Ł→l`, `Ø→o`, `Æ→ae`, `é→e`) and ignore case, so ordering aligns with -/// what the server returns for name-like sorts. -class ComparableField implements Comparable> { - const ComparableField._(this.value); - - /// Creates a new [ComparableField] instance from a [value]. - static ComparableField? fromValue(T? value) { - if (value == null) return null; - return ComparableField._(value); - } - - /// The value to be compared. - final T value; - - @override - int compareTo(ComparableField other) { - return switch ((value, other.value)) { - (final num a, final num b) => a.compareTo(b), - (final String a, final String b) => _compareStrings(a, b), - (final DateTime a, final DateTime b) => a.compareTo(b), - (final bool a, final bool b) when a == b => 0, - (final bool a, final bool b) => a && !b ? 1 : -1, // true > false - _ => 0, // All comparisons were equal or incomparable types - }; - } - - // Compares using the shared server-parity normalizer. - static int _compareStrings(String a, String b) { - final normalizedA = normalizeStringForSort(a); - final normalizedB = normalizeStringForSort(b); - - return normalizedA.compareTo(normalizedB); - } -} - -/// A interface that provides a way to access comparable fields by string keys. -/// -/// Classes that implement this class can be used in sorting operations -/// where the sort key is determined at runtime. -abstract interface class ComparableFieldProvider { - /// Gets a comparable field value for the given [sortKey]. - /// - /// Returns a [ComparableField] or null if no comparable field with the given - /// sort key exists. - ComparableField? getComparableField(String sortKey); -} diff --git a/packages/stream_chat/lib/src/core/models/draft.dart b/packages/stream_chat/lib/src/core/models/draft.dart index 48a4064f2c..e501799612 100644 --- a/packages/stream_chat/lib/src/core/models/draft.dart +++ b/packages/stream_chat/lib/src/core/models/draft.dart @@ -1,7 +1,8 @@ import 'package:equatable/equatable.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:stream_core/stream_core.dart' show Sort, SortField; + import 'channel_model.dart'; -import 'comparable_field.dart'; import 'draft_message.dart'; import 'message.dart'; @@ -11,7 +12,7 @@ part 'draft.g.dart'; /// /// This class is used to store the draft message and its metadata. @JsonSerializable(includeIfNull: false) -class Draft extends Equatable implements ComparableFieldProvider { +class Draft extends Equatable { /// Creates a new instance of [Draft]. const Draft({ required this.channelCid, @@ -81,25 +82,51 @@ class Draft extends Equatable implements ComparableFieldProvider { parentMessage, quotedMessage, ]; - - @override - ComparableField? getComparableField(String sortKey) { - final value = switch (sortKey) { - DraftSortKey.createdAt => createdAt, - _ => message.extraData[sortKey], - }; - - return ComparableField.fromValue(value); - } } -/// Extension type representing sortable fields for [Draft]. +/// Represents a sorting operation for drafts. +/// +/// The API sorts drafts by `createdAt` only. Anything else is rejected. /// -/// This type provides type-safe keys that can be used for sorting drafts -/// in queries. Each constant represents a field that can be sorted on. -extension type const DraftSortKey(String key) implements String { - /// Sort drafts by their creation date. +/// See [DraftSortField] for the fields that can be sorted on. +class DraftSort extends Sort { + /// Sorts by [field], smallest first. + const DraftSort.asc( + DraftSortField super.field, { + super.nullOrdering, + }) : super.asc(); + + /// Sorts by [field], largest first. + const DraftSort.desc( + DraftSortField super.field, { + super.nullOrdering, + }) : super.desc(); + + /// An empty sort: the query carries no sort term, and a list keeps the + /// order it arrived in. + static const List empty = []; + + /// The ordering the API applies to a draft query when none is given. + /// + /// Sorts by when the draft was created, newest first. + static final List defaultSort = [ + DraftSort.desc(DraftSortField.createdAt), + ]; +} + +/// Represents a field that draft queries can be sorted on. +class DraftSortField extends SortField { + /// Creates a field named [remote] on the wire, reading its value off an + /// instance with `localValue`. + /// + /// For a name the SDK has not modelled; prefer the fields declared here. + DraftSortField(super.remote, super.localValue); + + /// Sorts drafts by their creation date. /// /// This is the default sort field (in descending order). - static const createdAt = DraftSortKey('created_at'); + static final createdAt = DraftSortField( + 'created_at', + (it) => it.createdAt, + ); } diff --git a/packages/stream_chat/lib/src/core/models/member.dart b/packages/stream_chat/lib/src/core/models/member.dart index 38f7048c18..f8ad515152 100644 --- a/packages/stream_chat/lib/src/core/models/member.dart +++ b/packages/stream_chat/lib/src/core/models/member.dart @@ -1,8 +1,10 @@ import 'package:equatable/equatable.dart'; import 'package:json_annotation/json_annotation.dart'; +import 'package:stream_core/stream_core.dart' show Standard, Sort, SortField; +import '../util/extension.dart'; import '../util/serializer.dart'; -import 'comparable_field.dart'; +import '../util/string_sort_normalizer.dart'; import 'user.dart'; part 'member.g.dart'; @@ -10,7 +12,7 @@ part 'member.g.dart'; /// The class that contains the information about the user membership /// in a channel @JsonSerializable() -class Member extends Equatable implements ComparableFieldProvider { +class Member extends Equatable { /// Constructor used for json serialization Member({ this.user, @@ -172,37 +174,87 @@ class Member extends Equatable implements ComparableFieldProvider { deletedMessages, extraData, ]; - - @override - ComparableField? getComparableField(String sortKey) { - final value = switch (sortKey) { - MemberSortKey.createdAt => createdAt, - MemberSortKey.userId => userId, - MemberSortKey.name => user?.name, - MemberSortKey.channelRole => channelRole, - _ => extraData[sortKey], - }; - - return ComparableField.fromValue(value); - } } -/// Extension type representing sortable fields for [Member]. +/// Represents a sorting operation for channel members. /// -/// This type provides type-safe keys that can be used for sorting members -/// in queries. Each constant represents a field that can be sorted on. -extension type const MemberSortKey(String key) implements String { - /// Sort members by their creation date in the channel. - static const createdAt = MemberSortKey('created_at'); +/// See [MemberSortField] for the fields that can be sorted on. +class MemberSort extends Sort { + /// Sorts by [field], smallest first. + const MemberSort.asc( + MemberSortField super.field, { + super.nullOrdering, + }) : super.asc(); + + /// Sorts by [field], largest first. + const MemberSort.desc( + MemberSortField super.field, { + super.nullOrdering, + }) : super.desc(); + + /// An empty sort: the query carries no sort term, and a list keeps the + /// order it arrived in. + static const List empty = []; + + /// The ordering the API applies to a member query when none is given. + /// + /// Sorts by when the member joined, oldest first. + static final List defaultSort = [ + MemberSort.asc(MemberSortField.createdAt), + ]; +} + +/// Represents a field that member queries can be sorted on. +class MemberSortField extends SortField { + /// Creates a field named [remote] on the wire, reading its value off an + /// instance with `localValue`. + /// + /// For a name the SDK has not modelled; prefer the fields declared here. + MemberSortField(super.remote, super.localValue); + + /// Creates a field the SDK does not model, read from [Member.extraData]. + /// + /// Declared only where the API accepts a custom sort field. + factory MemberSortField.custom(String remote) { + return MemberSortField(remote, (it) => it.extraData[remote]); + } - /// Sort members by the user ID. - static const userId = MemberSortKey('user_id'); + /// Sorts members by their creation date in the channel. + static final createdAt = MemberSortField( + 'created_at', + (it) => it.createdAt, + ); - /// Sort members by user name. + /// Sorts members by the user ID. + static final userId = MemberSortField( + 'user_id', + (it) => it.userId, + ); + + /// Sorts members by user name. + /// + /// Compared with case, diacritics and ligatures folded away, so a list + /// sorted locally matches the order a query returns. /// - /// Note: This requires additional database joins and might be slower. - static const name = MemberSortKey('name'); + /// Slower than the other member sorts. + static final name = MemberSortField( + 'name', + // Reads the raw name rather than `User.name`, which falls back to the id. + (it) { + final name = it.user?.extraData['name']; + return name.safeCast()?.let(normalizeStringForSort); + }, + ); + + /// Sorts members by the channel role. + static final channelRole = MemberSortField( + 'channel_role', + (it) => it.channelRole, + ); - /// Sort members by the channel role. - static const channelRole = MemberSortKey('channel_role'); + /// Sorts members by the date their membership was last updated. + static final updatedAt = MemberSortField( + 'updated_at', + (it) => it.updatedAt, + ); } diff --git a/packages/stream_chat/lib/src/core/models/message.dart b/packages/stream_chat/lib/src/core/models/message.dart index 7f9e0b8013..8e2a51085c 100644 --- a/packages/stream_chat/lib/src/core/models/message.dart +++ b/packages/stream_chat/lib/src/core/models/message.dart @@ -1,12 +1,12 @@ import 'package:collection/collection.dart'; import 'package:equatable/equatable.dart'; import 'package:json_annotation/json_annotation.dart'; +import 'package:stream_core/stream_core.dart' show Sort, SortField; import 'package:uuid/uuid.dart'; import '../util/extension.dart'; import '../util/serializer.dart'; import 'attachment.dart'; -import 'comparable_field.dart'; import 'draft.dart'; import 'location.dart'; import 'message_reminder.dart'; @@ -28,7 +28,7 @@ const _nullConst = _NullConst(); /// The class that contains the information about a message. @JsonSerializable() -class Message extends Equatable implements ComparableFieldProvider { +class Message extends Equatable { /// Constructor used for json serialization. Message({ String? id, @@ -724,35 +724,105 @@ class Message extends Equatable implements ComparableFieldProvider { sharedLocation, deletedForMe, ]; +} - @override - ComparableField? getComparableField(String sortKey) { - final value = switch (sortKey) { - MessageSortKey.id => id, - MessageSortKey.createdAt => createdAt, - MessageSortKey.updatedAt => updatedAt, - _ => extraData[sortKey], - }; +/// Represents a sorting operation for a message search. +/// +/// Searching is the only message query that takes a sort. It cannot be +/// combined with a non-zero pagination offset. +/// +/// See [MessageSearchSortField] for the fields that can be sorted on. +class MessageSearchSort extends Sort { + /// Sorts by [field], smallest first. + const MessageSearchSort.asc( + MessageSearchSortField super.field, { + super.nullOrdering, + }) : super.asc(); + + /// Sorts by [field], largest first. + const MessageSearchSort.desc( + MessageSearchSortField super.field, { + super.nullOrdering, + }) : super.desc(); +} + +/// Represents a field that message queries can be sorted on. +class MessageSearchSortField extends SortField { + /// Creates a field named [remote] on the wire, reading its value off an + /// instance with `localValue`. + /// + /// For a name the SDK has not modelled; prefer the fields declared here. + MessageSearchSortField(super.remote, super.localValue); - return ComparableField.fromValue(value); + /// Creates a field the SDK does not model, read from [Message.extraData]. + /// + /// Declared only where the API accepts a custom sort field. + factory MessageSearchSortField.custom(String remote) { + return MessageSearchSortField(remote, (it) => it.extraData[remote]); } -} -/// Extension type representing sortable fields for [Message]. -/// -/// This type provides type-safe keys that can be used for sorting messages -/// in queries. Each constant represents a field that can be sorted on. -extension type const MessageSortKey(String key) implements String { - /// Sort messages by their unique ID. - static const id = MessageSortKey('id'); + /// Sorts messages by their unique ID. + static final id = MessageSearchSortField( + 'id', + (it) => it.id, + ); - /// Sort messages by their creation date. + /// Sorts messages by their creation date. /// /// This is the default sort field (in descending order). - static const createdAt = MessageSortKey('created_at'); + static final createdAt = MessageSearchSortField( + 'created_at', + (it) => it.createdAt, + ); - /// Sort messages by their last update date. - static const updatedAt = MessageSortKey('updated_at'); + /// Sorts messages by their last update date. + static final updatedAt = MessageSearchSortField( + 'updated_at', + (it) => it.updatedAt, + ); + + /// Sorts messages by their text. + static final text = MessageSearchSortField( + 'text', + (it) => it.text, + ); + + /// Sorts messages by their type. + static final type = MessageSearchSortField( + 'type', + (it) => it.type, + ); + + /// Sorts messages by the id of the message they reply to. + static final parentId = MessageSearchSortField( + 'parent_id', + (it) => it.parentId, + ); + + /// Sorts messages by how many replies they have. + static final replyCount = MessageSearchSortField( + 'reply_count', + (it) => it.replyCount, + ); + + /// Sorts messages by whether they are pinned. + /// + /// Not honoured by every search: where it is not, the other terms decide the + /// order and this one is ignored. + static final pinned = MessageSearchSortField( + 'pinned', + (it) => it.pinned, + ); + + /// Sorts search results by how well they match the query. + /// + /// Only meaningful for a search carrying a text filter; one without it drops + /// this sort rather than failing. Not carried on a [Message], so a page + /// re-sorted locally keeps the order it arrived in. + static final relevance = MessageSearchSortField( + 'relevance', + (_) => null, + ); } /// {@template messageType} diff --git a/packages/stream_chat/lib/src/core/models/message_reminder.dart b/packages/stream_chat/lib/src/core/models/message_reminder.dart index d10aa6d27c..96732df7b9 100644 --- a/packages/stream_chat/lib/src/core/models/message_reminder.dart +++ b/packages/stream_chat/lib/src/core/models/message_reminder.dart @@ -1,7 +1,8 @@ import 'package:equatable/equatable.dart'; import 'package:json_annotation/json_annotation.dart'; +import 'package:stream_core/stream_core.dart' show Sort, SortField; + import 'channel_model.dart'; -import 'comparable_field.dart'; import 'message.dart'; import 'user.dart'; @@ -26,7 +27,7 @@ const _nullConst = _NullConst(); /// reference without notification. /// {@endtemplate} @JsonSerializable() -class MessageReminder extends Equatable implements ComparableFieldProvider { +class MessageReminder extends Equatable { /// {@macro messageReminder} MessageReminder({ required this.channelCid, @@ -133,31 +134,72 @@ class MessageReminder extends Equatable implements ComparableFieldProvider { createdAt, updatedAt, ]; - - @override - ComparableField? getComparableField(String sortKey) { - final value = switch (sortKey) { - MessageReminderSortKey.channelCid => channelCid, - MessageReminderSortKey.remindAt => remindAt, - MessageReminderSortKey.createdAt => createdAt, - _ => null, - }; - - return ComparableField.fromValue(value); - } } -/// Extension type representing sortable fields for [MessageReminder]. +/// Represents a sorting operation for message reminders. /// -/// This type provides type-safe keys that can be used for sorting reminders -/// in queries. Each constant represents a field that can be sorted on. -extension type const MessageReminderSortKey(String key) implements String { +/// The API accepts only whole combinations, not an arbitrary mix: +/// `channelCid` + `messageId`, `remindAt` + `messageId`, or `createdAt` alone. +/// Anything else is rejected. +/// +/// See [MessageReminderSortField] for the fields that can be sorted on. +class MessageReminderSort extends Sort { + /// Sorts by [field], smallest first. + const MessageReminderSort.asc( + MessageReminderSortField super.field, { + super.nullOrdering, + }) : super.asc(); + + /// Sorts by [field], largest first. + const MessageReminderSort.desc( + MessageReminderSortField super.field, { + super.nullOrdering, + }) : super.desc(); + + /// An empty sort: the query carries no sort term, and a list keeps the + /// order it arrived in. + static const List empty = []; + + /// The ordering the API applies to a reminder query when none is given. + /// + /// Sorts by when the user asked to be reminded, soonest first. + static final List defaultSort = [ + MessageReminderSort.asc(MessageReminderSortField.remindAt), + ]; +} + +/// Represents a field that reminder queries can be sorted on. +class MessageReminderSortField extends SortField { + /// Creates a field named [remote] on the wire, reading its value off an + /// instance with `localValue`. + /// + /// For a name the SDK has not modelled; prefer the fields declared here. + MessageReminderSortField(super.remote, super.localValue); + /// Sorts reminders by the channel CID. - static const channelCid = MessageReminderSortKey('channel_cid'); + static final channelCid = MessageReminderSortField( + 'channel_cid', + (it) => it.channelCid, + ); /// Sorts reminders by the time at which the user wants to be reminded. - static const remindAt = MessageReminderSortKey('remind_at'); + static final remindAt = MessageReminderSortField( + 'remind_at', + (it) => it.remindAt, + ); /// Sorts reminders by the date at which the reminder was created. - static const createdAt = MessageReminderSortKey('created_at'); + static final createdAt = MessageReminderSortField( + 'created_at', + (it) => it.createdAt, + ); + + /// Sorts reminders by the id of the message they are set on. + /// + /// Ties break on this field, so naming it explicitly is what makes a page + /// boundary reproducible. + static final messageId = MessageReminderSortField( + 'message_id', + (it) => it.messageId, + ); } diff --git a/packages/stream_chat/lib/src/core/models/poll.dart b/packages/stream_chat/lib/src/core/models/poll.dart index 3cc38e80e3..2eb2dd6dc0 100644 --- a/packages/stream_chat/lib/src/core/models/poll.dart +++ b/packages/stream_chat/lib/src/core/models/poll.dart @@ -1,10 +1,11 @@ import 'package:collection/collection.dart'; import 'package:equatable/equatable.dart'; import 'package:json_annotation/json_annotation.dart'; +import 'package:stream_core/stream_core.dart' show Standard, Sort, SortField; import 'package:uuid/uuid.dart'; import '../util/serializer.dart'; -import 'comparable_field.dart'; +import '../util/string_sort_normalizer.dart'; import 'poll_option.dart'; import 'poll_vote.dart'; import 'user.dart'; @@ -34,7 +35,7 @@ enum VotingVisibility { /// A model class representing a poll. /// {@endtemplate} @JsonSerializable() -class Poll extends Equatable implements ComparableFieldProvider { +class Poll extends Equatable { /// {@macro streamPoll} Poll({ String? id, @@ -267,45 +268,83 @@ class Poll extends Equatable implements ComparableFieldProvider { createdAt, updatedAt, ]; - - @override - ComparableField? getComparableField(String sortKey) { - final value = switch (sortKey) { - PollSortKey.id => id, - PollSortKey.name => name, - PollSortKey.createdAt => createdAt, - PollSortKey.updatedAt => updatedAt, - PollSortKey.isClosed => isClosed, - _ => extraData[sortKey], - }; - - return ComparableField.fromValue(value); - } } -/// Extension type representing sortable fields for [Poll]. +/// Represents a sorting operation for polls. +/// +/// The API sorts on one field at a time: `id`, `name`, `createdAt`, +/// `updatedAt` or `isClosed`. Anything else is rejected. /// -/// This type provides type-safe keys that can be used for sorting polls -/// in queries. Each constant represents a field that can be sorted on. -extension type const PollSortKey(String key) implements String { - /// Sort polls by their unique ID. - static const id = PollSortKey('id'); +/// See [PollSortField] for the fields that can be sorted on. +class PollSort extends Sort { + /// Sorts by [field], smallest first. + const PollSort.asc( + PollSortField super.field, { + super.nullOrdering, + }) : super.asc(); + + /// Sorts by [field], largest first. + const PollSort.desc( + PollSortField super.field, { + super.nullOrdering, + }) : super.desc(); + + /// An empty sort: the query carries no sort term, and a list keeps the + /// order it arrived in. + static const List empty = []; + + /// The ordering the API applies to a poll query when none is given. + /// + /// Sorts by when the poll was created, oldest first. + static final List defaultSort = [ + PollSort.asc(PollSortField.createdAt), + ]; +} - /// Sort polls by their name. - static const name = PollSortKey('name'); +/// Represents a field that poll queries can be sorted on. +class PollSortField extends SortField { + /// Creates a field named [remote] on the wire, reading its value off an + /// instance with `localValue`. + /// + /// For a name the SDK has not modelled; prefer the fields declared here. + PollSortField(super.remote, super.localValue); - /// Sort polls by their creation date. + /// Sorts polls by their unique ID. + static final id = PollSortField( + 'id', + (it) => it.id, + ); + + /// Sorts polls by their name. + /// + /// Compared with case, diacritics and ligatures folded away, so a list + /// sorted locally matches the order a query returns. + static final name = PollSortField( + 'name', + (it) => it.name.let(normalizeStringForSort), + ); + + /// Sorts polls by their creation date. /// /// This is the default sort field (in ascending order). - static const createdAt = PollSortKey('created_at'); + static final createdAt = PollSortField( + 'created_at', + (it) => it.createdAt, + ); - /// Sort polls by their last update date. - static const updatedAt = PollSortKey('updated_at'); + /// Sorts polls by their last update date. + static final updatedAt = PollSortField( + 'updated_at', + (it) => it.updatedAt, + ); - /// Sort polls by whether they are closed or not. + /// Sorts polls by whether they are closed or not. /// /// Closed polls will appear first when sorting in ascending order. - static const isClosed = PollSortKey('is_closed'); + static final isClosed = PollSortField( + 'is_closed', + (it) => it.isClosed, + ); } /// Helper extension for [Poll] model. diff --git a/packages/stream_chat/lib/src/core/models/poll_vote.dart b/packages/stream_chat/lib/src/core/models/poll_vote.dart index 227f9bc5b7..bcc9c1fa35 100644 --- a/packages/stream_chat/lib/src/core/models/poll_vote.dart +++ b/packages/stream_chat/lib/src/core/models/poll_vote.dart @@ -1,6 +1,7 @@ import 'package:equatable/equatable.dart'; import 'package:json_annotation/json_annotation.dart'; -import 'comparable_field.dart'; +import 'package:stream_core/stream_core.dart' show Sort, SortField; + import 'user.dart'; part 'poll_vote.g.dart'; @@ -9,7 +10,7 @@ part 'poll_vote.g.dart'; /// A model class representing a poll vote. /// {@endtemplate} @JsonSerializable() -class PollVote extends Equatable implements ComparableFieldProvider { +class PollVote extends Equatable { /// {@macro streamPollVote} PollVote({ this.id, @@ -103,39 +104,64 @@ class PollVote extends Equatable implements ComparableFieldProvider { userId, user, ]; - - @override - ComparableField? getComparableField(String sortKey) { - final value = switch (sortKey) { - PollVoteSortKey.id => id, - PollVoteSortKey.createdAt => createdAt, - PollVoteSortKey.updatedAt => updatedAt, - PollVoteSortKey.answerText => answerText, - _ => null, - }; - - return ComparableField.fromValue(value); - } } -/// Extension type representing sortable fields for [PollVote]. +/// Represents a sorting operation for poll votes. +/// +/// The API sorts on one field at a time: `id`, `createdAt` or `updatedAt`. +/// Anything else is rejected. /// -/// This type provides type-safe keys that can be used for sorting poll votes -/// in queries. Each constant represents a field that can be sorted on. -extension type const PollVoteSortKey(String key) implements String { - /// Sort poll votes by their ID. - static const id = PollVoteSortKey('id'); +/// See [PollVoteSortField] for the fields that can be sorted on. +class PollVoteSort extends Sort { + /// Sorts by [field], smallest first. + const PollVoteSort.asc( + PollVoteSortField super.field, { + super.nullOrdering, + }) : super.asc(); + + /// Sorts by [field], largest first. + const PollVoteSort.desc( + PollVoteSortField super.field, { + super.nullOrdering, + }) : super.desc(); + + /// An empty sort: the query carries no sort term, and a list keeps the + /// order it arrived in. + static const List empty = []; + + /// The ordering the API applies to a poll-vote query when none is given. + /// + /// Sorts by when the vote was cast, oldest first. + static final List defaultSort = [ + PollVoteSort.asc(PollVoteSortField.createdAt), + ]; +} - /// Sort poll votes by their creation date. +/// Represents a field that poll-vote queries can be sorted on. +class PollVoteSortField extends SortField { + /// Creates a field named [remote] on the wire, reading its value off an + /// instance with `localValue`. /// - /// This is the default sort field (in ascending order). - static const createdAt = PollVoteSortKey('created_at'); + /// For a name the SDK has not modelled; prefer the fields declared here. + PollVoteSortField(super.remote, super.localValue); - /// Sort poll votes by their last update date. - static const updatedAt = PollVoteSortKey('updated_at'); + /// Sorts poll votes by their ID. + static final id = PollVoteSortField( + 'id', + (it) => it.id, + ); - /// Sort poll votes by their answer text. + /// Sorts poll votes by their creation date. /// - /// Only applicable for votes that have answer text. - static const answerText = PollVoteSortKey('answer_text'); + /// This is the default sort field (in ascending order). + static final createdAt = PollVoteSortField( + 'created_at', + (it) => it.createdAt, + ); + + /// Sorts poll votes by their last update date. + static final updatedAt = PollVoteSortField( + 'updated_at', + (it) => it.updatedAt, + ); } diff --git a/packages/stream_chat/lib/src/core/models/predefined_filter.dart b/packages/stream_chat/lib/src/core/models/predefined_filter.dart index 3c15bd85fd..6a3b3c61be 100644 --- a/packages/stream_chat/lib/src/core/models/predefined_filter.dart +++ b/packages/stream_chat/lib/src/core/models/predefined_filter.dart @@ -1,5 +1,4 @@ import 'package:json_annotation/json_annotation.dart'; -import '../api/sort_order.dart'; import 'channel_state.dart'; import 'filter.dart'; @@ -34,21 +33,24 @@ class PredefinedFilter { final Filter filter; /// Sort specification as resolved by the server. - final SortOrder? sort; + final List? sort; /// Sort to apply locally, matching what the server applies for this /// predefined filter — the echoed [sort], or a default derived from /// [filter] when [sort] is null. - SortOrder get effectiveSort => sort ?? _defaultSortFor(filter); + List get effectiveSort => sort ?? _defaultSortFor(filter); static Filter _filterFromJson(Map json) => Filter.raw(value: json); } -SortOrder _defaultSortFor(Filter filter) { - if (_touchesField(filter, ChannelSortKey.lastMessageAt)) { - return const [SortOption.desc(ChannelSortKey.lastMessageAt)]; - } - return const [SortOption.desc(ChannelSortKey.lastUpdated)]; +// Mirrors the server's fallback for a channel query that carries no sort, so +// the field is written out rather than taken from [ChannelSort.defaultSort]: +// the two agree today, but one is the ordering this SDK picks and the other is +// the ordering the server falls back to, and either may change alone. +List _defaultSortFor(Filter filter) { + final touchesLastMessageAt = _touchesField(filter, ChannelSortField.lastMessageAt.remote); + if (touchesLastMessageAt) return [ChannelSort.desc(ChannelSortField.lastMessageAt)]; + return [ChannelSort.desc(ChannelSortField.lastUpdated)]; } bool _touchesField(Filter filter, String field) { diff --git a/packages/stream_chat/lib/src/core/models/predefined_filter.g.dart b/packages/stream_chat/lib/src/core/models/predefined_filter.g.dart index 152f047bd8..f7ae0b2c1c 100644 --- a/packages/stream_chat/lib/src/core/models/predefined_filter.g.dart +++ b/packages/stream_chat/lib/src/core/models/predefined_filter.g.dart @@ -11,9 +11,5 @@ PredefinedFilter _$PredefinedFilterFromJson(Map json) => Predef filter: PredefinedFilter._filterFromJson( json['filter'] as Map, ), - sort: (json['sort'] as List?) - ?.map( - (e) => SortOption.fromJson(e as Map), - ) - .toList(), + sort: (json['sort'] as List?)?.map((e) => ChannelSort.fromJson(e as Map)).toList(), ); diff --git a/packages/stream_chat/lib/src/core/models/reaction.dart b/packages/stream_chat/lib/src/core/models/reaction.dart index 696b5c5753..98cba67eae 100644 --- a/packages/stream_chat/lib/src/core/models/reaction.dart +++ b/packages/stream_chat/lib/src/core/models/reaction.dart @@ -1,15 +1,15 @@ import 'package:equatable/equatable.dart'; import 'package:json_annotation/json_annotation.dart'; +import 'package:stream_core/stream_core.dart' show Sort, SortField; import '../util/serializer.dart'; -import 'comparable_field.dart'; import 'user.dart'; part 'reaction.g.dart'; /// The class that defines a reaction @JsonSerializable() -class Reaction extends Equatable implements ComparableFieldProvider { +class Reaction extends Equatable { /// Constructor used for json serialization Reaction({ this.messageId, @@ -132,25 +132,49 @@ class Reaction extends Equatable implements ComparableFieldProvider { updatedAt, extraData, ]; - - @override - ComparableField? getComparableField(String sortKey) { - final value = switch (sortKey) { - ReactionSortKey.createdAt => createdAt, - _ => null, - }; - - return ComparableField.fromValue(value); - } } -/// Extension type representing sortable fields for [Reaction]. +/// Represents a sorting operation for reactions. /// -/// This type provides type-safe keys that can be used for sorting reactions -/// in queries. Each constant represents a field that can be sorted on. -extension type const ReactionSortKey(String key) implements String { - /// Sort reactions by their creation date. +/// See [ReactionSortField] for the fields that can be sorted on. +class ReactionSort extends Sort { + /// Sorts by [field], smallest first. + const ReactionSort.asc( + ReactionSortField super.field, { + super.nullOrdering, + }) : super.asc(); + + /// Sorts by [field], largest first. + const ReactionSort.desc( + ReactionSortField super.field, { + super.nullOrdering, + }) : super.desc(); + + /// An empty sort: the query carries no sort term, and a list keeps the + /// order it arrived in. + static const List empty = []; + + /// The ordering the API applies to a reaction query when none is given. + /// + /// Sorts by when the reaction was added, newest first. + static final List defaultSort = [ + ReactionSort.desc(ReactionSortField.createdAt), + ]; +} + +/// Represents a field that reaction queries can be sorted on. +class ReactionSortField extends SortField { + /// Creates a field named [remote] on the wire, reading its value off an + /// instance with `localValue`. + /// + /// For a name the SDK has not modelled; prefer the fields declared here. + ReactionSortField(super.remote, super.localValue); + + /// Sorts reactions by their creation date. /// - /// This is the default sort field (in ascending order). - static const createdAt = ReactionSortKey('created_at'); + /// This is the default sort field (in descending order). + static final createdAt = ReactionSortField( + 'created_at', + (it) => it.createdAt, + ); } diff --git a/packages/stream_chat/lib/src/core/models/thread.dart b/packages/stream_chat/lib/src/core/models/thread.dart index 69d0a1a60b..2138eceb68 100644 --- a/packages/stream_chat/lib/src/core/models/thread.dart +++ b/packages/stream_chat/lib/src/core/models/thread.dart @@ -1,9 +1,9 @@ import 'package:equatable/equatable.dart'; import 'package:json_annotation/json_annotation.dart'; +import 'package:stream_core/stream_core.dart' show NullOrdering, Sort, SortField; import '../util/serializer.dart'; import 'channel_model.dart'; -import 'comparable_field.dart'; import 'draft.dart'; import 'message.dart'; import 'read.dart'; @@ -23,7 +23,7 @@ const _nullConst = _NullConst(); /// to a message in a channel. /// {@endtemplate} @JsonSerializable() -class Thread extends Equatable implements ComparableFieldProvider { +class Thread extends Equatable { /// {@macro streamThread} Thread({ this.activeParticipantCount, @@ -226,52 +226,100 @@ class Thread extends Equatable implements ComparableFieldProvider { read, draft, ]; +} - @override - ComparableField? getComparableField(String sortKey) { - final value = switch (sortKey) { - ThreadSortKey.lastMessageAt => lastMessageAt, - ThreadSortKey.createdAt => createdAt, - ThreadSortKey.updatedAt => updatedAt, - ThreadSortKey.replyCount => replyCount, - ThreadSortKey.participantCount => participantCount, - ThreadSortKey.activeParticipantCount => activeParticipantCount, - ThreadSortKey.parentMessageId => parentMessageId, - // TODO: Support providing default value for hasUnread - ThreadSortKey.hasUnread => null, - _ => null, - }; - - return ComparableField.fromValue(value); +/// Represents a sorting operation for threads. +/// +/// The API accepts only whole combinations, not an arbitrary mix: +/// `hasUnread` + `lastMessageAt` + `parentMessageId`, `lastMessageAt` + +/// `parentMessageId`, or any one of `createdAt`, `updatedAt`, `replyCount`, +/// `participantCount`, `activeParticipantCount` and `parentMessageId` alone. +/// Anything else is rejected. +/// +/// See [ThreadSortField] for the fields that can be sorted on. +class ThreadSort extends Sort { + /// Sorts by [field], smallest first. + ThreadSort.asc( + ThreadSortField super.field, { + NullOrdering? nullOrdering, + }) : super.asc(nullOrdering: nullOrdering ?? _orderingFor(field, .nullsLast)); + + /// Sorts by [field], largest first. + ThreadSort.desc( + ThreadSortField super.field, { + NullOrdering? nullOrdering, + }) : super.desc(nullOrdering: nullOrdering ?? _orderingFor(field, .nullsFirst)); + + // A thread the SDK has no last-message date for belongs at the end whichever + // way the list is sorted. Not API parity: the API's own date is never absent. + static final _nullsLastFields = {ThreadSortField.lastMessageAt.remote}; + + // Keyed on the remote name, so a field built by hand for a pinned name is + // ordered the same way. + static NullOrdering _orderingFor(ThreadSortField field, NullOrdering fallback) { + if (_nullsLastFields.contains(field.remote)) return NullOrdering.nullsLast; + return fallback; } + + /// An empty sort: the query carries no sort term, and a list keeps the + /// order it arrived in. + static const List empty = []; } -/// Extension type representing sortable fields for [Thread]. -/// -/// This type provides type-safe keys that can be used for sorting threads -/// in queries. Each constant represents a field that can be sorted on. -extension type const ThreadSortKey(String key) implements String { - /// Sort threads by their last message date. - static const lastMessageAt = ThreadSortKey('last_message_at'); +/// Represents a field that thread queries can be sorted on. +class ThreadSortField extends SortField { + /// Creates a field named [remote] on the wire, reading its value off an + /// instance with `localValue`. + /// + /// For a name the SDK has not modelled; prefer the fields declared here. + ThreadSortField(super.remote, super.localValue); - /// Sort threads by their creation date. - static const createdAt = ThreadSortKey('created_at'); + /// Sorts threads by their last message date. + static final lastMessageAt = ThreadSortField( + 'last_message_at', + (it) => it.lastMessageAt, + ); - /// Sort threads by their last update date. - static const updatedAt = ThreadSortKey('updated_at'); + /// Sorts threads by their creation date. + static final createdAt = ThreadSortField( + 'created_at', + (it) => it.createdAt, + ); - /// Sort threads by their reply count. - static const replyCount = ThreadSortKey('reply_count'); + /// Sorts threads by their last update date. + static final updatedAt = ThreadSortField( + 'updated_at', + (it) => it.updatedAt, + ); - /// Sort threads by their participant count. - static const participantCount = ThreadSortKey('participant_count'); + /// Sorts threads by their reply count. + static final replyCount = ThreadSortField( + 'reply_count', + (it) => it.replyCount, + ); - /// Sort threads by their active participant count. - static const activeParticipantCount = ThreadSortKey('active_participant_count'); + /// Sorts threads by their participant count. + static final participantCount = ThreadSortField( + 'participant_count', + (it) => it.participantCount, + ); - /// Sort threads by their parent message id. - static const parentMessageId = ThreadSortKey('parent_message_id'); + /// Sorts threads by their active participant count. + static final activeParticipantCount = ThreadSortField( + 'active_participant_count', + (it) => it.activeParticipantCount, + ); - /// Sort threads by their has unread. - static const hasUnread = ThreadSortKey('has_unread'); + /// Sorts threads by their parent message id. + static final parentMessageId = ThreadSortField( + 'parent_message_id', + (it) => it.parentMessageId, + ); + + /// Sorts threads by whether they have unread replies. + // TODO: Support providing default value for hasUnread + static final hasUnread = ThreadSortField( + 'has_unread', + (_) => null, + ); } diff --git a/packages/stream_chat/lib/src/core/models/user.dart b/packages/stream_chat/lib/src/core/models/user.dart index 1c947b3765..2274cdd523 100644 --- a/packages/stream_chat/lib/src/core/models/user.dart +++ b/packages/stream_chat/lib/src/core/models/user.dart @@ -1,15 +1,16 @@ import 'package:equatable/equatable.dart'; import 'package:json_annotation/json_annotation.dart'; +import 'package:stream_core/stream_core.dart' show Standard, Sort, SortField; import '../util/extension.dart'; import '../util/serializer.dart'; -import 'comparable_field.dart'; +import '../util/string_sort_normalizer.dart'; part 'user.g.dart'; /// Class that defines a Stream Chat User. @JsonSerializable(includeIfNull: false) -class User extends Equatable implements ComparableFieldProvider { +class User extends Equatable { /// Creates a new user. /// /// {@template name} @@ -210,55 +211,117 @@ class User extends Equatable implements ComparableFieldProvider { teamsRole, avgResponseTime, ]; - - @override - ComparableField? getComparableField(String sortKey) { - final value = switch (sortKey) { - UserSortKey.id => id, - UserSortKey.createdAt => createdAt, - UserSortKey.updatedAt => updatedAt, - UserSortKey.name => name, - UserSortKey.role => role, - UserSortKey.banned => banned, - UserSortKey.lastActive => lastActive, - _ => extraData[sortKey], - }; - - return ComparableField.fromValue(value); - } } -/// Extension type representing sortable fields for [User]. +/// Represents a sorting operation for users. /// -/// This type provides type-safe keys that can be used for sorting users -/// in queries. Each constant represents a field that can be sorted on. -extension type const UserSortKey(String key) implements String { - /// Sort users by their ID. - static const id = UserSortKey('id'); +/// See [UserSortField] for the fields that can be sorted on. +class UserSort extends Sort { + /// Sorts by [field], smallest first. + const UserSort.asc( + UserSortField super.field, { + super.nullOrdering, + }) : super.asc(); + + /// Sorts by [field], largest first. + const UserSort.desc( + UserSortField super.field, { + super.nullOrdering, + }) : super.desc(); + + /// An empty sort: the query carries no sort term, and a list keeps the + /// order it arrived in. + static const List empty = []; + + /// The ordering the API applies to a user query when none is given. + /// + /// Sorts by when the user was created, newest first. + static final List defaultSort = [ + UserSort.desc(UserSortField.createdAt), + ]; +} + +/// Represents a field that user queries can be sorted on. +class UserSortField extends SortField { + /// Creates a field named [remote] on the wire, reading its value off an + /// instance with `localValue`. + /// + /// For a name the SDK has not modelled; prefer the fields declared here. + UserSortField(super.remote, super.localValue); - /// Sort users by their creation date. + /// Creates a field the SDK does not model, read from [User.extraData]. + /// + /// Declared only where the API accepts a custom sort field. + factory UserSortField.custom(String remote) { + return UserSortField(remote, (it) => it.extraData[remote]); + } + + /// Sorts users by their ID. + static final id = UserSortField( + 'id', + (it) => it.id, + ); + + /// Sorts users by their creation date. /// /// This is part of the default sort (in descending order). - static const createdAt = UserSortKey('created_at'); + static final createdAt = UserSortField( + 'created_at', + (it) => it.createdAt, + ); - /// Sort users by their last update date. - static const updatedAt = UserSortKey('updated_at'); + /// Sorts users by their last update date. + static final updatedAt = UserSortField( + 'updated_at', + (it) => it.updatedAt, + ); - /// Sort users by their name. + /// Sorts users by their name. /// - /// Useful for alphabetical sorting of users. - static const name = UserSortKey('name'); + /// Compared with case, diacritics and ligatures folded away, so a list + /// sorted locally matches the order a query returns. + static final name = UserSortField( + 'name', + // Deliberately not `User.name`, which answers the id when a user has no + // name — sorting by that locally would scatter unnamed users among the + // named ones, where a query keeps them together. + (it) => it.extraData['name'].safeCast()?.let(normalizeStringForSort), + ); - /// Sort users by their role. - static const role = UserSortKey('role'); + /// Sorts users by their role. + static final role = UserSortField( + 'role', + (it) => it.role, + ); - /// Sort users by whether they are banned. + /// Sorts users by whether they are banned. /// /// Banned users will appear first when sorting in ascending order. - static const banned = UserSortKey('banned'); + static final banned = UserSortField( + 'banned', + (it) => it.banned, + ); - /// Sort users by their last active date. + /// Sorts users by their last active date. /// /// Useful for sorting users by recent activity. - static const lastActive = UserSortKey('last_active'); + static final lastActive = UserSortField( + 'last_active', + (it) => it.lastActive, + ); + + /// Sorts users by their preferred language. + static final language = UserSortField( + 'language', + (it) => it.language, + ); + + /// Sorts users by the teams they belong to. + /// + /// A team list has no ordering, so a page re-sorted locally keeps the order + /// it arrived in. + static final teams = UserSortField( + 'teams', + (it) => it.teams, + ); } diff --git a/packages/stream_chat/lib/src/db/chat_persistence_client.dart b/packages/stream_chat/lib/src/db/chat_persistence_client.dart index a672496b2d..cf97c5cc2c 100644 --- a/packages/stream_chat/lib/src/db/chat_persistence_client.dart +++ b/packages/stream_chat/lib/src/db/chat_persistence_client.dart @@ -1,7 +1,6 @@ import 'package:collection/collection.dart'; import '../core/api/requests.dart'; import '../core/api/responses.dart'; -import '../core/api/sort_order.dart'; import '../core/models/attachment_file.dart'; import '../core/models/channel_model.dart'; import '../core/models/channel_state.dart'; @@ -133,7 +132,7 @@ abstract class ChatPersistenceClient { @Deprecated('Use queryChannelStates instead') Future> getChannelStates({ Filter? filter, - SortOrder? channelStateSort, + List? channelStateSort, int? messageLimit, PaginationParams? paginationParams, }); @@ -173,7 +172,7 @@ abstract class ChatPersistenceClient { /// For standard mode, [QueryChannelsResponse.predefinedFilter] is null. Future queryChannelStates({ Filter? filter, - SortOrder? sort, + List? sort, String? predefinedFilter, Map? filterValues, Map? sortValues, @@ -216,10 +215,10 @@ abstract class ChatPersistenceClient { Future saveChannelQueries({ required List cids, Filter? filter, - SortOrder? sort, + List? sort, String? predefinedFilter, Filter? resolvedFilter, - SortOrder? resolvedSort, + List? resolvedSort, Map? filterValues, Map? sortValues, bool clearQueryCache = false, diff --git a/packages/stream_chat/lib/stream_chat.dart b/packages/stream_chat/lib/stream_chat.dart index 059802e0ed..ce8e88174f 100644 --- a/packages/stream_chat/lib/stream_chat.dart +++ b/packages/stream_chat/lib/stream_chat.dart @@ -18,8 +18,13 @@ export 'package:rate_limiter/rate_limiter.dart'; // `User` — so a blanket export would not compile. export 'package:stream_core/stream_core.dart' show + CompositeComparator, Failure, + NullOrdering, Result, + Sort, + SortDirection, + SortField, StreamApiError, StreamApiException, StreamAuthenticationException, @@ -54,7 +59,6 @@ export 'src/client/retry_policy.dart'; export 'src/core/api/attachment_file_uploader.dart'; export 'src/core/api/requests.dart'; export 'src/core/api/responses.dart'; -export 'src/core/api/sort_order.dart'; export 'src/core/api/stream_chat_api.dart'; export 'src/core/error/error.dart'; export 'src/core/http/stream_http_client.dart'; diff --git a/packages/stream_chat/pubspec.yaml b/packages/stream_chat/pubspec.yaml index 8fe374d314..30a8e74601 100644 --- a/packages/stream_chat/pubspec.yaml +++ b/packages/stream_chat/pubspec.yaml @@ -35,7 +35,11 @@ dependencies: rate_limiter: ^1.1.0 retrofit: ^4.9.2 rxdart: ^0.28.0 - stream_core: ^0.5.0 + stream_core: + git: + url: https://github.com/GetStream/stream-core-flutter.git + ref: 04e0d1cb3a6893cf70cb6636a261deb11beff81c + path: packages/stream_core synchronized: ^3.4.0 uuid: ^4.5.3 web_socket_channel: ^3.0.3 diff --git a/packages/stream_chat/test/src/client/channel/channel_test.dart b/packages/stream_chat/test/src/client/channel/channel_test.dart index 836b10a589..836062c8a5 100644 --- a/packages/stream_chat/test/src/client/channel/channel_test.dart +++ b/packages/stream_chat/test/src/client/channel/channel_test.dart @@ -2760,7 +2760,7 @@ void main() { test('should work fine with `query`', () async { const query = 'test-search-query'; - const sort = [SortOption.asc('test-sort-field')]; + final sort = [MessageSearchSort.asc(MessageSearchSortField.custom('test-sort-field'))]; const pagination = PaginationParams(); final results = List.generate(3, (index) => GetMessageResponse()); @@ -2797,7 +2797,7 @@ void main() { test('should work fine with `messageFilters`', () async { final messageFilters = Filter.query('key', 'text'); - const sort = [SortOption.desc('test-sort-field')]; + final sort = [MessageSearchSort.desc(MessageSearchSortField.custom('test-sort-field'))]; const pagination = PaginationParams(); final results = List.generate(3, (index) => GetMessageResponse()); diff --git a/packages/stream_chat/test/src/client/client_test.dart b/packages/stream_chat/test/src/client/client_test.dart index 7799e16803..7cf62570b9 100644 --- a/packages/stream_chat/test/src/client/client_test.dart +++ b/packages/stream_chat/test/src/client/client_test.dart @@ -902,6 +902,10 @@ void main() { (i) => ChannelState(channel: ChannelModel(cid: 'test-type-$i:test-id-$i')), ); + // `Sort` has no value equality, so the verify below has to match on + // the instance the response carried. + final resolvedSort = [ChannelSort.desc(ChannelSortField.lastMessageAt)]; + when( () => api.channel.queryChannels( predefinedFilter: filterName, @@ -917,10 +921,10 @@ void main() { ).thenAnswer( (_) async => QueryChannelsResponse() ..channels = channelStates - ..predefinedFilter = const PredefinedFilter( + ..predefinedFilter = PredefinedFilter( name: filterName, - filter: Filter.empty(), - sort: [SortOption.desc('last_message_at')], + filter: const Filter.empty(), + sort: resolvedSort, ), ); @@ -957,7 +961,7 @@ void main() { sort: null, predefinedFilter: filterName, resolvedFilter: const Filter.empty(), - resolvedSort: const [SortOption.desc('last_message_at')], + resolvedSort: resolvedSort, filterValues: filterValues, sortValues: sortValues, clearQueryCache: true, @@ -1095,9 +1099,9 @@ void main() { (i) => ChannelState(channel: ChannelModel(cid: 'test-type-$i:test-id-$i')), ); - const resolvedSort = [SortOption.desc('last_message_at')]; + final resolvedSort = [ChannelSort.desc(ChannelSortField.lastMessageAt)]; const resolvedFilter = Filter.empty(); - const expectedPredefinedFilter = PredefinedFilter( + final expectedPredefinedFilter = PredefinedFilter( name: filterName, filter: resolvedFilter, sort: resolvedSort, @@ -3410,7 +3414,7 @@ void main() { test('`.queryPolls`', () async { final filter = Filter.in_('id', const ['test-poll-id']); - final sort = [const SortOption.desc('created_at')]; + final sort = [PollSort.desc(PollSortField.createdAt)]; const pagination = PaginationParams(limit: 20); final polls = List.generate( @@ -3456,7 +3460,7 @@ void main() { test('`.queryPollVotes`', () async { const pollId = 'test-poll-id'; final filter = Filter.in_('id', const ['test-vote-id']); - final sort = [const SortOption.desc('created_at')]; + final sort = [PollVoteSort.desc(PollVoteSortField.createdAt)]; const pagination = PaginationParams(limit: 20); final votes = List.generate( @@ -4602,7 +4606,7 @@ void main() { const channelType = 'test-channel-type'; final filter = Filter.equal('channel_cid', '$channelType:$channelId'); - final sort = [const SortOption.desc('created_at')]; + final sort = [DraftSort.desc(DraftSortField.createdAt)]; const pagination = PaginationParams(limit: 20); final drafts = [ diff --git a/packages/stream_chat/test/src/core/api/channel_api_test.dart b/packages/stream_chat/test/src/core/api/channel_api_test.dart index 5ae5990931..d6c05fb53c 100644 --- a/packages/stream_chat/test/src/core/api/channel_api_test.dart +++ b/packages/stream_chat/test/src/core/api/channel_api_test.dart @@ -125,7 +125,7 @@ void main() { const channelType = 'test-channel-type'; final filter = Filter.in_('cid', const ['test-cid']); - const sort = [SortOption.desc('test-field')]; + final sort = [ChannelSort.desc(ChannelSortField.custom('test-field'))]; const memberLimit = 33; const messageLimit = 33; @@ -258,8 +258,8 @@ void main() { ), ); expect(res.predefinedFilter!.sort, hasLength(1)); - expect(res.predefinedFilter!.sort!.first.field, 'last_message_at'); - expect(res.predefinedFilter!.sort!.first.direction, SortOption.DESC); + expect(res.predefinedFilter!.sort!.first.field.remote, 'last_message_at'); + expect(res.predefinedFilter!.sort!.first.direction, SortDirection.desc); verify( () => client.get(path, queryParameters: {'payload': payload}), diff --git a/packages/stream_chat/test/src/core/api/general_api_test.dart b/packages/stream_chat/test/src/core/api/general_api_test.dart index 2c855c83e7..194b714071 100644 --- a/packages/stream_chat/test/src/core/api/general_api_test.dart +++ b/packages/stream_chat/test/src/core/api/general_api_test.dart @@ -93,7 +93,7 @@ void main() { 'should throw if `pagination.offset` and `sort` both are provided', () async { final filter = Filter.in_('cid', const ['test-cid-1', 'test-cid-2']); - const sort = [SortOption.desc('test-field')]; + final sort = [MessageSearchSort.desc(MessageSearchSortField.custom('test-field'))]; const pagination = PaginationParams(offset: 10); try { await generalApi.searchMessages( @@ -110,7 +110,7 @@ void main() { test('should run successfully with `query`', () async { final filter = Filter.in_('cid', const ['test-cid-1', 'test-cid-2']); const query = 'test-query'; - const sort = [SortOption.desc('test-field')]; + final sort = [MessageSearchSort.desc(MessageSearchSortField.custom('test-field'))]; const pagination = PaginationParams(); const path = '/search'; @@ -149,7 +149,7 @@ void main() { test('should run successfully with `messageFilter`', () async { final filter = Filter.in_('cid', const ['test-cid-1', 'test-cid-2']); - const sort = [SortOption.desc('test-field')]; + final sort = [MessageSearchSort.desc(MessageSearchSortField.custom('test-field'))]; final messageFilter = Filter.query('key', 'text'); const pagination = PaginationParams(); @@ -194,7 +194,7 @@ void main() { const channelId = 'test-channel-id'; final filter = Filter.in_('cid', const ['test-cid-1', 'test-cid-2']); const pagination = PaginationParams(); - const sort = [SortOption.desc('test-field')]; + final sort = [MemberSort.desc(MemberSortField.custom('test-field'))]; const path = '/members'; @@ -248,7 +248,7 @@ void main() { const channelType = 'test-channel-type'; final filter = Filter.in_('cid', const ['test-cid-1', 'test-cid-2']); const pagination = PaginationParams(); - const sort = [SortOption.desc('test-field')]; + final sort = [MemberSort.desc(MemberSortField.custom('test-field'))]; const path = '/members'; diff --git a/packages/stream_chat/test/src/core/api/polls_api_test.dart b/packages/stream_chat/test/src/core/api/polls_api_test.dart index 2c303218f2..fb5e2f27b0 100644 --- a/packages/stream_chat/test/src/core/api/polls_api_test.dart +++ b/packages/stream_chat/test/src/core/api/polls_api_test.dart @@ -4,7 +4,6 @@ import 'package:dio/dio.dart'; import 'package:mocktail/mocktail.dart'; import 'package:stream_chat/src/core/api/polls_api.dart'; import 'package:stream_chat/src/core/api/requests.dart'; -import 'package:stream_chat/src/core/api/sort_order.dart'; import 'package:stream_chat/src/core/models/filter.dart'; import 'package:stream_chat/src/core/models/poll.dart'; import 'package:stream_chat/src/core/models/poll_option.dart'; @@ -193,7 +192,9 @@ void main() { const path = '/polls/$pollId'; - when(() => client.delete(path)).thenAnswer((_) async => successResponse(path, data: {})); + when( + () => client.delete(path), + ).thenAnswer((_) async => successResponse(path, data: {})); final res = await pollsApi.deletePoll(pollId); @@ -311,7 +312,9 @@ void main() { const path = '/polls/$pollId/options/$optionId'; - when(() => client.delete(path)).thenAnswer((_) async => successResponse(path, data: {})); + when( + () => client.delete(path), + ).thenAnswer((_) async => successResponse(path, data: {})); final res = await pollsApi.deletePollOption(pollId, optionId); @@ -387,7 +390,7 @@ void main() { test('queryPolls', () async { const path = '/polls/query'; final filter = Filter.in_('cid', const ['test-cid-1', 'test-cid-2']); - const sort = [SortOption.desc('test-field')]; + final sort = [PollSort.desc(PollSortField.createdAt)]; const pagination = PaginationParams(limit: 20); final payload = jsonEncode({ @@ -442,7 +445,7 @@ void main() { test('queryPollVotes', () async { const pollId = 'test-poll-id'; final filter = Filter.in_('cid', const ['test-cid-1', 'test-cid-2']); - const sort = [SortOption.desc('test-field')]; + final sort = [PollVoteSort.desc(PollVoteSortField.createdAt)]; const pagination = PaginationParams(limit: 20); const path = '/polls/$pollId/votes'; diff --git a/packages/stream_chat/test/src/core/api/reminders_api_test.dart b/packages/stream_chat/test/src/core/api/reminders_api_test.dart index 919bb47661..5609387d04 100644 --- a/packages/stream_chat/test/src/core/api/reminders_api_test.dart +++ b/packages/stream_chat/test/src/core/api/reminders_api_test.dart @@ -6,7 +6,6 @@ import 'package:dio/dio.dart'; import 'package:mocktail/mocktail.dart'; import 'package:stream_chat/src/core/api/reminders_api.dart'; import 'package:stream_chat/src/core/api/requests.dart'; -import 'package:stream_chat/src/core/api/sort_order.dart'; import 'package:stream_chat/src/core/models/filter.dart'; import 'package:stream_chat/src/core/models/message_reminder.dart'; import 'package:test/test.dart'; @@ -72,7 +71,7 @@ void main() { test('should query reminders with filter, sort, and pagination', () async { const path = '/reminders/query'; final filter = Filter.equal('userId', 'test-user-id'); - const sort = [SortOption.desc('remindAt')]; + final sort = [MessageReminderSort.desc(MessageReminderSortField.remindAt)]; const pagination = PaginationParams(limit: 10, offset: 5); final expectedPayload = jsonEncode({ diff --git a/packages/stream_chat/test/src/core/api/user_api_test.dart b/packages/stream_chat/test/src/core/api/user_api_test.dart index ad61fbc94d..454739958d 100644 --- a/packages/stream_chat/test/src/core/api/user_api_test.dart +++ b/packages/stream_chat/test/src/core/api/user_api_test.dart @@ -25,7 +25,7 @@ void main() { test('queryUsers', () async { const presence = true; final filter = Filter.in_('cid', const ['test-cid-1', 'test-cid-2']); - const sort = [SortOption.desc('test-field')]; + final sort = [UserSort.desc(UserSortField.custom('test-field'))]; const pagination = PaginationParams(); const path = '/users'; diff --git a/packages/stream_chat/test/src/core/models/banned_user_test.dart b/packages/stream_chat/test/src/core/models/banned_user_test.dart index 466b8540f0..7e00093459 100644 --- a/packages/stream_chat/test/src/core/models/banned_user_test.dart +++ b/packages/stream_chat/test/src/core/models/banned_user_test.dart @@ -5,56 +5,17 @@ import 'package:stream_chat/src/core/models/channel_model.dart'; import 'package:stream_chat/src/core/models/user.dart'; import 'package:test/test.dart'; +import '../../utils.dart'; + void main() { group('src/models/banned_user', () { - group('ComparableFieldProvider', () { - test('should return ComparableField for banned_user.createdAt', () { - final createdAt = DateTime(2023, 6, 15); - final bannedUser = createTestBannedUser( - userId: 'banned-user-id', - createdAt: createdAt, - ); - - final field = bannedUser.getComparableField( - BannedUserSortKey.createdAt, - ); - - expect(field, isNotNull); - expect(field!.value, equals(createdAt)); - }); - - test('should return null for non-existent field keys', () { - final bannedUser = createTestBannedUser( - userId: 'banned-user-id', - ); - - final field = bannedUser.getComparableField('non_existent_key'); - expect(field, isNull); - }); - - test('should compare two banned users correctly using createdAt', () { - final recentBan = createTestBannedUser( - userId: 'recent-ban', - createdAt: DateTime(2023, 6, 15), + group('BannedUserSortField', () { + test('createdAt orders older bans first', () { + expectOrders( + BannedUserSortField.createdAt, + createTestBannedUser(userId: 'older-ban', createdAt: DateTime(2023, 6, 10)), + createTestBannedUser(userId: 'recent-ban', createdAt: DateTime(2023, 6, 15)), ); - - final olderBan = createTestBannedUser( - userId: 'older-ban', - createdAt: DateTime(2023, 6, 10), - ); - - final field1 = recentBan.getComparableField( - BannedUserSortKey.createdAt, - ); - - final field2 = olderBan.getComparableField( - BannedUserSortKey.createdAt, - ); - - // More recent > Less recent - expect(field1!.compareTo(field2!), greaterThan(0)); - // Less recent < More recent - expect(field2.compareTo(field1), lessThan(0)); }); }); }); diff --git a/packages/stream_chat/test/src/core/models/channel_state_test.dart b/packages/stream_chat/test/src/core/models/channel_state_test.dart index cb17dbddda..2738cfb023 100644 --- a/packages/stream_chat/test/src/core/models/channel_state_test.dart +++ b/packages/stream_chat/test/src/core/models/channel_state_test.dart @@ -100,173 +100,75 @@ void main() { expect(channelState.draft, equals(draft)); }); - group('ComparableFieldProvider', () { - test('should return ComparableField for channel.lastMessageAt', () { - final channelState = createChannelState( - id: 'test-channel', - lastMessageAt: DateTime(2023, 6, 15), + group('ChannelSortField', () { + test('lastMessageAt orders older messages first', () { + expectOrders( + ChannelSortField.lastMessageAt, + createChannelState(id: 'older', lastMessageAt: DateTime(2023, 6, 10)), + createChannelState(id: 'newer', lastMessageAt: DateTime(2023, 6, 15)), ); - - final field = channelState.getComparableField( - ChannelSortKey.lastMessageAt, - ); - - expect(field, isNotNull); - expect(field!.value, equals(DateTime(2023, 6, 15))); }); - test('should return ComparableField for channel.lastUpdatedAt', () { - final channelState = createChannelState( - id: 'test-channel', - createdAt: DateTime(2023, 6, 10), - lastMessageAt: DateTime(2023, 6, 15), + test('lastUpdated orders by the last message', () { + expectOrders( + ChannelSortField.lastUpdated, + createChannelState(id: 'older', createdAt: DateTime(2023, 6, 1), lastMessageAt: DateTime(2023, 6, 10)), + createChannelState(id: 'newer', createdAt: DateTime(2023, 6, 1), lastMessageAt: DateTime(2023, 6, 15)), ); - - final field = channelState.getComparableField( - ChannelSortKey.lastUpdated, - ); - - expect(field, isNotNull); - expect(field!.value, equals(DateTime(2023, 6, 15))); }); - test('should fall back to createdAt for a truncated channel.lastUpdatedAt', () { - final channelState = createChannelState( - id: 'test-channel', - createdAt: DateTime(2023, 6, 10), - // Truncating a channel moves lastMessageAt back instead of clearing - // it, so the channel must not sink below never-used channels. - lastMessageAt: DateTime(1970), + test('lastUpdated falls back to createdAt for a truncated channel', () { + // Truncating a channel moves lastMessageAt back instead of clearing + // it, so the channel must not sink below never-used channels. + expectOrders( + ChannelSortField.lastUpdated, + createChannelState(id: 'truncated', createdAt: DateTime(2023, 6, 10), lastMessageAt: DateTime(1970)), + createChannelState(id: 'active', createdAt: DateTime(2023, 6, 1), lastMessageAt: DateTime(2023, 6, 15)), ); - - final field = channelState.getComparableField( - ChannelSortKey.lastUpdated, - ); - - expect(field, isNotNull); - expect(field!.value, equals(DateTime(2023, 6, 10))); }); - test('should return ComparableField for channel.createdAt', () { - final channelState = createChannelState( - id: 'test-channel', - createdAt: DateTime(2023, 6, 10), + test('createdAt orders older channels first', () { + expectOrders( + ChannelSortField.createdAt, + createChannelState(id: 'older', createdAt: DateTime(2023, 6, 10)), + createChannelState(id: 'newer', createdAt: DateTime(2023, 6, 15)), ); - - final field = channelState.getComparableField(ChannelSortKey.createdAt); - expect(field, isNotNull); - expect(field!.value, equals(DateTime(2023, 6, 10))); }); - test('should return ComparableField for channel.updatedAt', () { - final channelState = createChannelState( - id: 'test-channel', - updatedAt: DateTime(2023, 6, 12), + test('updatedAt orders older channels first', () { + expectOrders( + ChannelSortField.updatedAt, + createChannelState(id: 'older', updatedAt: DateTime(2023, 6, 10)), + createChannelState(id: 'newer', updatedAt: DateTime(2023, 6, 12)), ); - - final field = channelState.getComparableField(ChannelSortKey.updatedAt); - expect(field, isNotNull); - expect(field!.value, equals(DateTime(2023, 6, 12))); }); - test('should return ComparableField for channel.memberCount', () { - final channelState = createChannelState( - id: 'test-channel', - memberCount: 42, + test('memberCount orders smaller channels first', () { + expectOrders( + ChannelSortField.memberCount, + createChannelState(id: 'smaller', memberCount: 50), + createChannelState(id: 'larger', memberCount: 100), ); - - final field = channelState.getComparableField(ChannelSortKey.memberCount); - expect(field, isNotNull); - expect(field!.value, equals(42)); - }); - - test('should return ComparableField for channel.extraData', () { - final channelState = createChannelState( - id: 'test-channel', - extraData: {'priority': 5}, - ); - - final field = channelState.getComparableField('priority'); - expect(field, isNotNull); - expect(field!.value, equals(5)); }); - test('should return null for non-existent extraData keys', () { - final channelState = createChannelState( - id: 'test-channel', - ); - - final field = channelState.getComparableField('non_existent_key'); - expect(field, isNull); - }); - - test('should compare two channel states correctly using createdAt', () { - final newerChannel = createChannelState( - id: 'newer', - createdAt: DateTime(2023, 6, 15), - ); - - final olderChannel = createChannelState( - id: 'older', - createdAt: DateTime(2023, 6, 10), - ); - - final newerField = newerChannel.getComparableField( - ChannelSortKey.createdAt, + test('a custom field orders by the channel extra data', () { + expectOrders( + ChannelSortField.custom('priority'), + createChannelState(id: 'low', extraData: const {'priority': 1}), + createChannelState(id: 'high', extraData: const {'priority': 10}), ); - - final olderField = olderChannel.getComparableField( - ChannelSortKey.createdAt, - ); - - expect(newerField!.compareTo(olderField!), greaterThan(0)); - expect(olderField.compareTo(newerField), lessThan(0)); }); - test('should compare two channel states correctly using memberCount', () { - final largerChannel = createChannelState( - id: 'larger', - memberCount: 100, + test('a custom field the channel does not carry orders nothing', () { + expectOrdersNothing( + ChannelSortField.custom('non_existent_key'), + createChannelState(id: 'plain'), ); - - final smallerChannel = createChannelState( - id: 'smaller', - memberCount: 50, - ); - - final largerField = largerChannel.getComparableField( - ChannelSortKey.memberCount, - ); - - final smallerField = smallerChannel.getComparableField( - ChannelSortKey.memberCount, - ); - - expect(largerField!.compareTo(smallerField!), greaterThan(0)); - expect(smallerField.compareTo(largerField), lessThan(0)); }); - test('should compare two channel states correctly using extraData', () { - final highPriorityChannel = createChannelState( - id: 'high-priority', - extraData: {'priority': 10}, - ); - - final lowPriorityChannel = createChannelState( - id: 'low-priority', - extraData: {'priority': 1}, - ); - - final highPriorityField = highPriorityChannel.getComparableField( - 'priority', - ); - - final lowPriorityField = lowPriorityChannel.getComparableField( - 'priority', - ); - - expect(highPriorityField!.compareTo(lowPriorityField!), greaterThan(0)); - expect(lowPriorityField.compareTo(highPriorityField), lessThan(0)); + test('hasUnread and unreadCount are server-side only', () { + expectOrdersNothing(ChannelSortField.hasUnread, createChannelState(id: 'plain')); + expectOrdersNothing(ChannelSortField.unreadCount, createChannelState(id: 'plain')); }); }); }); diff --git a/packages/stream_chat/test/src/core/models/comparable_field_test.dart b/packages/stream_chat/test/src/core/models/comparable_field_test.dart deleted file mode 100644 index 16a4598805..0000000000 --- a/packages/stream_chat/test/src/core/models/comparable_field_test.dart +++ /dev/null @@ -1,265 +0,0 @@ -import 'package:stream_chat/src/core/models/comparable_field.dart'; -import 'package:test/test.dart'; - -void main() { - group('ComparableField', () { - group('fromValue', () { - test('should create a comparable field from a non-null value', () { - final field = ComparableField.fromValue('test'); - expect(field, isNotNull); - }); - - test('should return null when value is null', () { - final field = ComparableField.fromValue(null); - expect(field, isNull); - }); - }); - - group('compare numbers', () { - test('should compare integers correctly', () { - final a = ComparableField.fromValue(10); - final b = ComparableField.fromValue(5); - - expect(a!.compareTo(b!), greaterThan(0)); - expect(b.compareTo(a), lessThan(0)); - expect(a.compareTo(ComparableField.fromValue(10)!), equals(0)); - }); - - test('should compare doubles correctly', () { - final a = ComparableField.fromValue(10.5); - final b = ComparableField.fromValue(10.2); - - expect(a!.compareTo(b!), greaterThan(0)); - expect(b.compareTo(a), lessThan(0)); - expect(a.compareTo(ComparableField.fromValue(10.5)!), equals(0)); - }); - - test('should compare mixed number types correctly', () { - final a = ComparableField.fromValue(10); - final b = ComparableField.fromValue(10.0); - - expect(a!.compareTo(b!), equals(0)); - }); - }); - - // Regression: https://github.com/GetStream/stream-chat-flutter/issues/2601 - // The reporter observed lowercase-starting names and non-ASCII names - // (Polish `Ł`, Norwegian `Ø`) getting pushed to the end of a list - // sorted by `SortOption.asc('name')`, because the old comparator was - // a raw codepoint compare. - test('sorts issue #2601 names into a sensible order', () { - final names = ['Zara', 'jhon', 'Łukasz', 'Øystein', 'Adam', 'Marek']; - final sorted = [...names]..sort((a, b) => ComparableField.fromValue(a)!.compareTo(ComparableField.fromValue(b)!)); - - expect(sorted, ['Adam', 'jhon', 'Łukasz', 'Marek', 'Øystein', 'Zara']); - }); - - group('compare strings', () { - test('should compare strings alphabetically', () { - final a = ComparableField.fromValue('banana'); - final b = ComparableField.fromValue('apple'); - - expect(a!.compareTo(b!), greaterThan(0)); - expect(b.compareTo(a), lessThan(0)); - expect(a.compareTo(ComparableField.fromValue('banana')!), equals(0)); - }); - - test('should ignore case in the primary comparison', () { - final zara = ComparableField.fromValue('Zara'); - final jhon = ComparableField.fromValue('jhon'); - - // With a naive codepoint compare 'jhon' would sort after 'Zara' (0x6A - // > 0x5A). Case-insensitive normalization puts 'jhon' before 'Zara'. - expect(jhon!.compareTo(zara!), lessThan(0)); - }); - - test('should fold ligatures and stroked letters to base characters', () { - // Backend sorts these against their base forms (Ł→l, Ø→o, Æ→ae) so - // 'Łukasz' lands between 'Lukas' and 'Marek', not after 'Zara'. - final lukas = ComparableField.fromValue('Lukas'); - final lukasz = ComparableField.fromValue('Łukasz'); - final marek = ComparableField.fromValue('Marek'); - final zara = ComparableField.fromValue('Zara'); - - expect(lukas!.compareTo(lukasz!), lessThan(0)); - expect(lukasz.compareTo(marek!), lessThan(0)); - expect(lukasz.compareTo(zara!), lessThan(0)); - - final oystein = ComparableField.fromValue('Øystein'); - expect(oystein!.compareTo(zara), lessThan(0)); - - final aegon = ComparableField.fromValue('Ægon'); - final adam = ComparableField.fromValue('Adam'); - expect(adam!.compareTo(aegon!), lessThan(0)); - expect(aegon.compareTo(ComparableField.fromValue('Bob')!), lessThan(0)); - }); - - test('should strip combining diacritical marks', () { - // Accented characters compare as if the diacritic were absent: 'José' - // sorts alongside 'Jose', not after all ASCII. - final jose = ComparableField.fromValue('José'); - final joseAscii = ComparableField.fromValue('Jose'); - final juan = ComparableField.fromValue('Juan'); - - expect(jose!.compareTo(juan!), lessThan(0)); - // Same normalized key — the comparator returns 0. - expect(joseAscii!.compareTo(jose), equals(0)); - }); - - test('should trim surrounding apostrophes and whitespace', () { - // Backend applies `TrimApostrophe` and `TrimSpace` after - // normalization, so leading/trailing U+0027 apostrophes and - // whitespace fall off the primary key. `'Ali` sorts adjacent to - // `Ali` (before `Bob`), not somewhere else entirely. Only U+0027 - // is trimmed — curly Unicode apostrophes (U+2018/U+2019) match the - // backend's `IsApostrophe` predicate and stay in the key. - final values = [ - 'Bob', - "'Ali", - ' Ali ', - '’Ali', // curly apostrophe — NOT trimmed - 'Ali', - ]; - - final sorted = [...values] - ..sort((a, b) { - final fa = ComparableField.fromValue(a)!; - final fb = ComparableField.fromValue(b)!; - return fa.compareTo(fb); - }); - - // The three ASCII-apostrophe/whitespace variants of `Ali` cluster - // together and land before `Bob`; the curly-apostrophe variant - // sorts after `Bob` because U+2019 stays in the primary key and - // sorts higher than ASCII letters. - expect(sorted.take(3).toSet(), {"'Ali", ' Ali ', 'Ali'}); - expect(sorted[3], 'Bob'); - expect(sorted[4], '’Ali'); - }); - - test('should preserve Vietnamese-specific characters', () { - // Backend's `IsVietnameseSpecificRune` keeps `Đ/đ`, `Ơ/ơ`, `Ư/ư`, and - // the tone-marked range U+1EA0..U+1EF1 out of the normalization fold. - // So `Đăng` should sort by `đ` (U+0111 = 273), not by `d` (0x64). - final dang = ComparableField.fromValue('Đăng'); - final ea = ComparableField.fromValue('Ea'); - // `đ` > `e` in raw codepoint order, so Vietnamese `Đăng` sorts after - // the plain-Latin `Ea` — the opposite of what codepoint-blind folding - // would produce. - expect(dang!.compareTo(ea!), greaterThan(0)); - - // But `Chi` still sorts before `Đăng` because `c` < `đ`. - final chi = ComparableField.fromValue('Chi'); - expect(chi!.compareTo(dang), lessThan(0)); - - // Non-Vietnamese diacritics on shared Latin letters (`ă` U+0103) are - // still folded — only the Vietnamese-specific ranges are preserved. - // So `Ăn` (U+0102 A-with-breve) still normalizes to `an`. - final an = ComparableField.fromValue('Ăn'); - final bo = ComparableField.fromValue('Bo'); - expect(an!.compareTo(bo!), lessThan(0)); - }); - - test('equal-normalized values compare as equal', () { - final upper = ComparableField.fromValue('Apple'); - final lower = ComparableField.fromValue('apple'); - - expect(upper!.compareTo(lower!), equals(0)); - }); - }); - - group('compare dates', () { - test('should compare dates correctly', () { - final now = DateTime.now(); - final earlier = now.subtract(const Duration(days: 1)); - final later = now.add(const Duration(days: 1)); - - final a = ComparableField.fromValue(now); - final b = ComparableField.fromValue(earlier); - final c = ComparableField.fromValue(later); - - expect(a!.compareTo(b!), greaterThan(0)); - expect(b.compareTo(a), lessThan(0)); - expect(c!.compareTo(a), greaterThan(0)); - expect(a.compareTo(ComparableField.fromValue(now)!), equals(0)); - }); - }); - - group('compare booleans', () { - test('should treat true as greater than false', () { - final a = ComparableField.fromValue(true); - final b = ComparableField.fromValue(false); - - expect(a!.compareTo(b!), greaterThan(0)); - expect(b.compareTo(a), lessThan(0)); - }); - - test('should treat equal booleans as equal', () { - final a = ComparableField.fromValue(true); - final b = ComparableField.fromValue(true); - final c = ComparableField.fromValue(false); - final d = ComparableField.fromValue(false); - - expect(a!.compareTo(b!), equals(0)); - expect(c!.compareTo(d!), equals(0)); - }); - }); - - group('compare different types', () { - test('should handle custom objects gracefully', () { - final a = ComparableField.fromValue(Object()); - final b = ComparableField.fromValue(Object()); - - expect(a!.compareTo(b!), equals(0)); - }); - }); - - group('ComparableFieldProvider', () { - test('should retrieve comparable fields from implementation', () { - final provider = TestProvider(); - - final nameField = provider.getComparableField('name'); - final ageField = provider.getComparableField('age'); - final missingField = provider.getComparableField('missing'); - - expect(nameField, isNotNull); - expect(ageField, isNotNull); - expect(missingField, isNull); - }); - - test('should compare fields correctly via provider', () { - final provider1 = TestProvider(name: 'Adam', age: 30); - final provider2 = TestProvider(name: 'Bob', age: 25); - - final name1 = provider1.getComparableField('name'); - final name2 = provider2.getComparableField('name'); - - final age1 = provider1.getComparableField('age'); - final age2 = provider2.getComparableField('age'); - - expect(name1!.compareTo(name2!), lessThan(0)); // Adam < Bob - expect(age1!.compareTo(age2!), greaterThan(0)); // 30 > 25 - }); - }); - }); -} - -/// Test implementation of ComparableFieldProvider -class TestProvider implements ComparableFieldProvider { - TestProvider({ - this.name = 'test', - this.age = 0, - }); - - final String name; - final int age; - - @override - ComparableField? getComparableField(String sortKey) { - return switch (sortKey) { - 'name' => ComparableField.fromValue(name), - 'age' => ComparableField.fromValue(age), - _ => null, - }; - } -} diff --git a/packages/stream_chat/test/src/core/models/draft_test.dart b/packages/stream_chat/test/src/core/models/draft_test.dart index 15bd65a8fe..206f23b98b 100644 --- a/packages/stream_chat/test/src/core/models/draft_test.dart +++ b/packages/stream_chat/test/src/core/models/draft_test.dart @@ -1,10 +1,11 @@ import 'package:stream_chat/src/core/models/channel_model.dart'; -import 'package:stream_chat/src/core/models/comparable_field.dart'; import 'package:stream_chat/src/core/models/draft.dart'; import 'package:stream_chat/src/core/models/draft_message.dart'; import 'package:stream_chat/src/core/models/message.dart'; import 'package:test/test.dart'; +import '../../utils.dart'; + void main() { group('Draft', () { final now = DateTime.now(); @@ -116,33 +117,17 @@ void main() { expect(draft.createdAt, equals(now)); }); - test('should implement ComparableFieldProvider interface', () { - // Test createdAt field - final createdAtField = draft.getComparableField(DraftSortKey.createdAt); - expect(createdAtField, isA()); - expect(createdAtField?.value, equals(now)); - - // Test extraData field from message - final draftWithExtraData = Draft( - channelCid: channelCid, - createdAt: now, - message: DraftMessage( - text: 'Hello, world!', - extraData: const {'priority': 'high'}, - ), + test('createdAt orders older drafts first', () { + DraftMessage message() => DraftMessage(text: 'Hello, world!'); + expectOrders( + DraftSortField.createdAt, + Draft(channelCid: channelCid, createdAt: DateTime(2023, 6, 10), message: message()), + Draft(channelCid: channelCid, createdAt: DateTime(2023, 6, 15), message: message()), ); - - final priorityField = draftWithExtraData.getComparableField('priority'); - expect(priorityField, isA()); - expect(priorityField?.value, equals('high')); - - // Test non-existent field - final nonExistentField = draft.getComparableField('non_existent'); - expect(nonExistentField?.value, isNull); }); - test('DraftSortKey should have defined constants', () { - expect(DraftSortKey.createdAt, equals('created_at')); + test('DraftSortField should name its remote fields', () { + expect(DraftSortField.createdAt.remote, equals('created_at')); }); }); } diff --git a/packages/stream_chat/test/src/core/models/member_test.dart b/packages/stream_chat/test/src/core/models/member_test.dart index b00884d450..e8095d3a27 100644 --- a/packages/stream_chat/test/src/core/models/member_test.dart +++ b/packages/stream_chat/test/src/core/models/member_test.dart @@ -16,167 +16,80 @@ void main() { expect(member.extraData['some_custom_field'], 'with_custom_data'); }); - group('ComparableFieldProvider', () { - test('should return ComparableField for member.createdAt', () { - final createdAt = DateTime(2023, 6, 15); - final member = createTestMember( - userId: 'test-user', - createdAt: createdAt, + group('MemberSortField', () { + test('createdAt orders older memberships first', () { + expectOrders( + MemberSortField.createdAt, + createTestMember(userId: 'older', createdAt: DateTime(2023, 6, 10)), + createTestMember(userId: 'newer', createdAt: DateTime(2023, 6, 15)), ); - - final field = member.getComparableField(MemberSortKey.createdAt); - expect(field, isNotNull); - expect(field!.value, equals(createdAt)); - }); - - test('should return ComparableField for member.userId', () { - final member = createTestMember( - userId: 'test-user', - ); - - final field = member.getComparableField(MemberSortKey.userId); - expect(field, isNotNull); - expect(field!.value, equals('test-user')); - }); - - test('should return ComparableField for member user.name', () { - final member = createTestMember( - userId: 'test-user', - userName: 'Test User', - ); - - final field = member.getComparableField(MemberSortKey.name); - expect(field, isNotNull); - expect(field!.value, equals('Test User')); }); - test('should return ComparableField for member.channelRole', () { - final member = createTestMember( - userId: 'test-user', - channelRole: 'owner', + test('updatedAt orders older memberships first', () { + expectOrders( + MemberSortField.updatedAt, + createTestMember(userId: 'older', updatedAt: DateTime(2023, 6, 10)), + createTestMember(userId: 'newer', updatedAt: DateTime(2023, 6, 15)), ); - - final field = member.getComparableField(MemberSortKey.channelRole); - expect(field, isNotNull); - expect(field!.value, equals('owner')); }); - test('should return ComparableField for member.extraData', () { - final member = createTestMember( - userId: 'test-user', - extraData: {'activityScore': 75}, + test('userId orders alphabetically', () { + expectOrders( + MemberSortField.userId, + createTestMember(userId: 'alice'), + createTestMember(userId: 'bob'), ); - - final field = member.getComparableField('activityScore'); - expect(field, isNotNull); - expect(field!.value, equals(75)); }); - test('should return null for non-existent extraData keys', () { - final member = createTestMember( - userId: 'test-user', + test('name orders by the user name, folded', () { + // Folding is what makes a local sort agree with the server: `Zara` + // would otherwise sort before `alice`. + expectOrders( + MemberSortField.name, + createTestMember(userId: 'a', userName: 'alice'), + createTestMember(userId: 'z', userName: 'Zara'), ); - - final field = member.getComparableField('non_existent_key'); - expect(field, isNull); }); - test('should return null when user is null for name field', () { - final member = createTestMember( - userId: 'test-user', - includeUser: false, - ); - - final field = member.getComparableField(MemberSortKey.name); - expect(field, isNull); - }); - - test('should compare two members correctly using createdAt', () { - final recentMember = createTestMember( - userId: 'recent', - createdAt: DateTime(2023, 6, 15), - ); - - final olderMember = createTestMember( - userId: 'older', - createdAt: DateTime(2023, 6, 10), + test('name orders nothing for a member with no user', () { + expectOrdersNothing( + MemberSortField.name, + createTestMember(userId: 'no-user', includeUser: false), ); - - final field1 = recentMember.getComparableField(MemberSortKey.createdAt); - final field2 = olderMember.getComparableField(MemberSortKey.createdAt); - - expect(field1!.compareTo(field2!), greaterThan(0)); // More recent > Less recent - expect(field2.compareTo(field1), lessThan(0)); // Less recent < More recent }); - test('should compare two members correctly using userId', () { - final member1 = createTestMember( - userId: 'alice', + test('name orders nothing for a member whose user has no name', () { + // `User.name` answers the id when a user has no name. Sorting by that + // would order unnamed members among the named ones, where the API + // sorts them together by an empty `name` column. + expectOrdersNothing( + MemberSortField.name, + createTestMember(userId: 'alice'), + createTestMember(userId: 'zara'), ); - - final member2 = createTestMember( - userId: 'bob', - ); - - final field1 = member1.getComparableField(MemberSortKey.userId); - final field2 = member2.getComparableField(MemberSortKey.userId); - - expect(field1!.compareTo(field2!), lessThan(0)); // alice < bob - expect(field2.compareTo(field1), greaterThan(0)); // bob > alice }); - test('should compare two members correctly using user name', () { - final member1 = createTestMember( - userId: 'user1', - userName: 'Alice', - ); - - final member2 = createTestMember( - userId: 'user2', - userName: 'Bob', + test('channelRole orders alphabetically', () { + expectOrders( + MemberSortField.channelRole, + createTestMember(userId: 'a', channelRole: 'channel_member'), + createTestMember(userId: 'b', channelRole: 'owner'), ); - - final field1 = member1.getComparableField(MemberSortKey.name); - final field2 = member2.getComparableField(MemberSortKey.name); - - expect(field1!.compareTo(field2!), lessThan(0)); // Alice < Bob - expect(field2.compareTo(field1), greaterThan(0)); // Bob > Alice }); - test('should compare two members correctly using channelRole', () { - final owner = createTestMember( - userId: 'owner', - channelRole: 'owner', - ); - - final moderator = createTestMember( - userId: 'moderator', - channelRole: 'moderator', + test('a custom field orders by the member extra data', () { + expectOrders( + MemberSortField.custom('activityScore'), + createTestMember(userId: 'a', extraData: const {'activityScore': 10}), + createTestMember(userId: 'b', extraData: const {'activityScore': 75}), ); - - final field1 = owner.getComparableField(MemberSortKey.channelRole); - final field2 = moderator.getComparableField(MemberSortKey.channelRole); - - expect(field1!.compareTo(field2!), greaterThan(0)); // 'owner' > 'moderator' alphabetically - expect(field2.compareTo(field1), lessThan(0)); // 'moderator' < 'owner' alphabetically }); - test('should compare two members correctly using extraData', () { - final highScore = createTestMember( - userId: 'high', - extraData: {'score': 100}, + test('a custom field the member does not carry orders nothing', () { + expectOrdersNothing( + MemberSortField.custom('non_existent_key'), + createTestMember(userId: 'plain'), ); - - final lowScore = createTestMember( - userId: 'low', - extraData: {'score': 50}, - ); - - final field1 = highScore.getComparableField('score'); - final field2 = lowScore.getComparableField('score'); - - expect(field1!.compareTo(field2!), greaterThan(0)); // 100 > 50 - expect(field2.compareTo(field1), lessThan(0)); // 50 < 100 }); }); }); @@ -189,6 +102,7 @@ Member createTestMember({ String? channelRole, DateTime? createdAt, DateTime? updatedAt, + DateTime? userLastActive, bool includeUser = true, Map? extraData, }) { @@ -198,6 +112,7 @@ Member createTestMember({ ? User( id: userId, name: userName, + lastActive: userLastActive, ) : null, channelRole: channelRole, diff --git a/packages/stream_chat/test/src/core/models/message_reminder_test.dart b/packages/stream_chat/test/src/core/models/message_reminder_test.dart index 6b08ff16c8..267239ad8f 100644 --- a/packages/stream_chat/test/src/core/models/message_reminder_test.dart +++ b/packages/stream_chat/test/src/core/models/message_reminder_test.dart @@ -1,12 +1,13 @@ // ignore_for_file: avoid_redundant_argument_values import 'package:stream_chat/src/core/models/channel_model.dart'; -import 'package:stream_chat/src/core/models/comparable_field.dart'; import 'package:stream_chat/src/core/models/message.dart'; import 'package:stream_chat/src/core/models/message_reminder.dart'; import 'package:stream_chat/src/core/models/user.dart'; import 'package:test/test.dart'; +import '../../utils.dart'; + void main() { group('MessageReminder', () { final now = DateTime.now(); @@ -265,37 +266,57 @@ void main() { expect(identical(mergedReminder, messageReminder), isTrue); }); - test('should implement ComparableFieldProvider interface', () { - // Test channelCid field - final channelCidField = messageReminder.getComparableField( - MessageReminderSortKey.channelCid, - ); - expect(channelCidField, isA()); - expect(channelCidField?.value, equals(channelCid)); - - // Test remindAt field - final remindAtField = messageReminder.getComparableField( - MessageReminderSortKey.remindAt, - ); - expect(remindAtField, isA()); - expect(remindAtField?.value, equals(remindAt)); + test('MessageReminderSortField should name its remote fields', () { + expect(MessageReminderSortField.channelCid.remote, equals('channel_cid')); + expect(MessageReminderSortField.remindAt.remote, equals('remind_at')); + expect(MessageReminderSortField.createdAt.remote, equals('created_at')); + }); - // Test createdAt field - final createdAtField = messageReminder.getComparableField( - MessageReminderSortKey.createdAt, + // Each field reads a different property off the model, and a wrong one + // sorts plausibly while ordering by something else entirely. These pin the + // getter, not just the remote name. + group('MessageReminderSortField ordering', () { + MessageReminder reminderWith({ + String cid = channelCid, + String messageId = 'm1', + DateTime? remindAt, + DateTime? createdAt, + }) => MessageReminder( + channelCid: cid, + messageId: messageId, + userId: 'u1', + remindAt: remindAt, + createdAt: createdAt, ); - expect(createdAtField, isA()); - expect(createdAtField?.value, equals(now)); - - // Test non-existent field - final nonExistentField = messageReminder.getComparableField('unknown'); - expect(nonExistentField?.value, isNull); - }); - test('MessageReminderSortKey should have defined constants', () { - expect(MessageReminderSortKey.channelCid, equals('channel_cid')); - expect(MessageReminderSortKey.remindAt, equals('remind_at')); - expect(MessageReminderSortKey.createdAt, equals('created_at')); + test('remindAt orders the sooner reminder first', () { + expectOrders( + MessageReminderSortField.remindAt, + reminderWith(remindAt: DateTime.utc(2024, 1, 1)), + reminderWith(remindAt: DateTime.utc(2024, 6, 1)), + ); + }); + + test('createdAt orders the older reminder first', () { + expectOrders( + MessageReminderSortField.createdAt, + reminderWith(createdAt: DateTime.utc(2024, 1, 1)), + reminderWith(createdAt: DateTime.utc(2024, 6, 1)), + ); + }); + + test('channelCid and messageId order lexically', () { + expectOrders( + MessageReminderSortField.channelCid, + reminderWith(cid: 'messaging:aaa'), + reminderWith(cid: 'messaging:bbb'), + ); + expectOrders( + MessageReminderSortField.messageId, + reminderWith(messageId: 'a'), + reminderWith(messageId: 'b'), + ); + }); }); }); } diff --git a/packages/stream_chat/test/src/core/models/message_test.dart b/packages/stream_chat/test/src/core/models/message_test.dart index e2b8ef14a8..d673ffd8dc 100644 --- a/packages/stream_chat/test/src/core/models/message_test.dart +++ b/packages/stream_chat/test/src/core/models/message_test.dart @@ -336,131 +336,67 @@ void main() { }); }); - group('ComparableFieldProvider', () { - test('should return ComparableField for message.id', () { - final message = createTestMessage( - id: 'test-message-id', - text: 'Hello world', + group('MessageSearchSortField', () { + test('id orders alphabetically', () { + expectOrders( + MessageSearchSortField.id, + createTestMessage(id: 'a-message'), + createTestMessage(id: 'b-message'), ); - - final field = message.getComparableField(MessageSortKey.id); - expect(field, isNotNull); - expect(field!.value, equals('test-message-id')); }); - test('should return ComparableField for message.createdAt', () { - final createdAt = DateTime(2023, 6, 15); - final message = createTestMessage( - id: 'test-message-id', - text: 'Hello world', - createdAt: createdAt, + test('createdAt orders older messages first', () { + expectOrders( + MessageSearchSortField.createdAt, + createTestMessage(id: 'older', createdAt: DateTime(2023, 6, 10)), + createTestMessage(id: 'newer', createdAt: DateTime(2023, 6, 15)), ); - - final field = message.getComparableField(MessageSortKey.createdAt); - expect(field, isNotNull); - expect(field!.value, equals(createdAt)); }); - test('should return ComparableField for message.updatedAt', () { - final updatedAt = DateTime(2023, 6, 20); - final message = createTestMessage( - id: 'test-message-id', - text: 'Hello world', - updatedAt: updatedAt, + test('updatedAt orders older messages first', () { + expectOrders( + MessageSearchSortField.updatedAt, + createTestMessage(id: 'older', updatedAt: DateTime(2023, 6, 10)), + createTestMessage(id: 'newer', updatedAt: DateTime(2023, 6, 15)), ); - - final field = message.getComparableField(MessageSortKey.updatedAt); - expect(field, isNotNull); - expect(field!.value, equals(updatedAt)); }); - test('should return ComparableField for message.extraData', () { - final message = createTestMessage( - id: 'test-message-id', - text: 'Hello world', - extraData: {'priority': 5}, + test('text orders alphabetically', () { + expectOrders( + MessageSearchSortField.text, + createTestMessage(id: 'a', text: 'Aardvark'), + createTestMessage(id: 'b', text: 'Zebra'), ); - - final field = message.getComparableField('priority'); - expect(field, isNotNull); - expect(field!.value, equals(5)); }); - test('should return null for non-existent extraData keys', () { - final message = createTestMessage( - id: 'test-message-id', - text: 'Hello world', + test('replyCount orders fewer replies first', () { + expectOrders( + MessageSearchSortField.replyCount, + createTestMessage(id: 'a', replyCount: 1), + createTestMessage(id: 'b', replyCount: 9), ); - - final field = message.getComparableField('non_existent_key'); - expect(field, isNull); }); - test('should compare two messages correctly using id', () { - final message1 = createTestMessage( - id: 'message-a', - text: 'Message A', + test('a custom field orders by the message extra data', () { + expectOrders( + MessageSearchSortField.custom('priority'), + createTestMessage(id: 'a', extraData: const {'priority': 1}), + createTestMessage(id: 'b', extraData: const {'priority': 10}), ); - - final message2 = createTestMessage( - id: 'message-b', - text: 'Message B', - ); - - final field1 = message1.getComparableField(MessageSortKey.id); - final field2 = message2.getComparableField(MessageSortKey.id); - - // message-a < message-b - expect(field1!.compareTo(field2!), lessThan(0)); - // message-b > message-a - expect(field2.compareTo(field1), greaterThan(0)); }); - test('should compare two messages correctly using createdAt', () { - final newerMessage = createTestMessage( - id: 'newer', - text: 'Newer Message', - createdAt: DateTime(2023, 6, 15), - ); - - final olderMessage = createTestMessage( - id: 'older', - text: 'Older Message', - createdAt: DateTime(2023, 6, 10), - ); - - final field1 = newerMessage.getComparableField( - MessageSortKey.createdAt, - ); - - final field2 = olderMessage.getComparableField( - MessageSortKey.createdAt, + test('a custom field the message does not carry orders nothing', () { + expectOrdersNothing( + MessageSearchSortField.custom('non_existent_key'), + createTestMessage(id: 'plain'), ); - - // More recent > Less recent - expect(field1!.compareTo(field2!), greaterThan(0)); - // Less recent < More recent - expect(field2.compareTo(field1), lessThan(0)); }); - test('should compare two messages correctly using extraData', () { - final highPriorityMessage = createTestMessage( - id: 'high', - text: 'High Priority Message', - extraData: {'priority': 10}, - ); - - final lowPriorityMessage = createTestMessage( - id: 'low', - text: 'Low Priority Message', - extraData: {'priority': 1}, + test('relevance orders nothing locally', () { + expectOrdersNothing( + MessageSearchSortField.relevance, + createTestMessage(id: 'plain'), ); - - final field1 = highPriorityMessage.getComparableField('priority'); - final field2 = lowPriorityMessage.getComparableField('priority'); - - expect(field1!.compareTo(field2!), greaterThan(0)); // 10 > 1 - expect(field2.compareTo(field1), lessThan(0)); // 1 < 10 }); }); diff --git a/packages/stream_chat/test/src/core/models/poll_test.dart b/packages/stream_chat/test/src/core/models/poll_test.dart index ae44676408..6125da9dd9 100644 --- a/packages/stream_chat/test/src/core/models/poll_test.dart +++ b/packages/stream_chat/test/src/core/models/poll_test.dart @@ -73,185 +73,45 @@ void main() { expect(json['is_closed'], false); }); - group('ComparableFieldProvider', () { - test('should return ComparableField for poll.id', () { - final poll = createTestPoll( - id: 'test-poll-id', - name: 'Test Poll', + group('PollSortField', () { + test('id orders alphabetically', () { + expectOrders( + PollSortField.id, + createTestPoll(id: 'a-poll', name: 'A'), + createTestPoll(id: 'b-poll', name: 'B'), ); - - final field = poll.getComparableField(PollSortKey.id); - expect(field, isNotNull); - expect(field!.value, equals('test-poll-id')); - }); - - test('should return ComparableField for poll.name', () { - final poll = createTestPoll( - id: 'test-poll-id', - name: 'Test Poll', - ); - - final field = poll.getComparableField(PollSortKey.name); - expect(field, isNotNull); - expect(field!.value, equals('Test Poll')); - }); - - test('should return ComparableField for poll.createdAt', () { - final createdAt = DateTime(2023, 6, 15); - final poll = createTestPoll( - id: 'test-poll-id', - name: 'Test Poll', - createdAt: createdAt, - ); - - final field = poll.getComparableField(PollSortKey.createdAt); - expect(field, isNotNull); - expect(field!.value, equals(createdAt)); - }); - - test('should return ComparableField for poll.updatedAt', () { - final updatedAt = DateTime(2023, 6, 20); - final poll = createTestPoll( - id: 'test-poll-id', - name: 'Test Poll', - updatedAt: updatedAt, - ); - - final field = poll.getComparableField(PollSortKey.updatedAt); - expect(field, isNotNull); - expect(field!.value, equals(updatedAt)); - }); - - test('should return ComparableField for poll.isClosed', () { - final poll = createTestPoll( - id: 'test-poll-id', - name: 'Test Poll', - isClosed: true, - ); - - final field = poll.getComparableField(PollSortKey.isClosed); - expect(field, isNotNull); - expect(field!.value, isTrue); - }); - - test('should return ComparableField for poll.extraData', () { - final poll = createTestPoll( - id: 'test-poll-id', - name: 'Test Poll', - extraData: {'priority': 5}, - ); - - final field = poll.getComparableField('priority'); - expect(field, isNotNull); - expect(field!.value, equals(5)); - }); - - test('should return null for non-existent extraData keys', () { - final poll = createTestPoll( - id: 'test-poll-id', - name: 'Test Poll', - ); - - final field = poll.getComparableField('non_existent_key'); - expect(field, isNull); - }); - - test('should compare two polls correctly using id', () { - final poll1 = createTestPoll( - id: 'poll-a', - name: 'Poll A', - ); - - final poll2 = createTestPoll( - id: 'poll-b', - name: 'Poll B', - ); - - final field1 = poll1.getComparableField(PollSortKey.id); - final field2 = poll2.getComparableField(PollSortKey.id); - - expect(field1!.compareTo(field2!), lessThan(0)); // poll-a < poll-b - expect(field2.compareTo(field1), greaterThan(0)); // poll-b > poll-a }); - test('should compare two polls correctly using name', () { - final poll1 = createTestPoll( - id: 'test-poll-1', - name: 'Apple Poll', - ); - - final poll2 = createTestPoll( - id: 'test-poll-2', - name: 'Banana Poll', + test('name orders alphabetically, folded', () { + expectOrders( + PollSortField.name, + createTestPoll(name: 'apples'), + createTestPoll(name: 'Bananas'), ); - - final field1 = poll1.getComparableField(PollSortKey.name); - final field2 = poll2.getComparableField(PollSortKey.name); - - expect(field1!.compareTo(field2!), lessThan(0)); // Apple < Banana - expect(field2.compareTo(field1), greaterThan(0)); // Banana > Apple }); - test('should compare two polls correctly using createdAt', () { - final newerPoll = createTestPoll( - id: 'newer', - name: 'New Poll', - createdAt: DateTime(2023, 6, 15), + test('createdAt orders older polls first', () { + expectOrders( + PollSortField.createdAt, + createTestPoll(name: 'older', createdAt: DateTime(2023, 6, 10)), + createTestPoll(name: 'newer', createdAt: DateTime(2023, 6, 15)), ); - - final olderPoll = createTestPoll( - id: 'older', - name: 'Old Poll', - createdAt: DateTime(2023, 6, 10), - ); - - final field1 = newerPoll.getComparableField(PollSortKey.createdAt); - final field2 = olderPoll.getComparableField(PollSortKey.createdAt); - - // More recent > Less recent - expect(field1!.compareTo(field2!), greaterThan(0)); - // Less recent < More recent - expect(field2.compareTo(field1), lessThan(0)); }); - test('should compare two polls correctly using isClosed', () { - final closedPoll = createTestPoll( - id: 'closed', - name: 'Closed Poll', - isClosed: true, - ); - - final openPoll = createTestPoll( - id: 'open', - name: 'Open Poll', - isClosed: false, + test('updatedAt orders older polls first', () { + expectOrders( + PollSortField.updatedAt, + createTestPoll(name: 'older', updatedAt: DateTime(2023, 6, 10)), + createTestPoll(name: 'newer', updatedAt: DateTime(2023, 6, 15)), ); - - final field1 = closedPoll.getComparableField(PollSortKey.isClosed); - final field2 = openPoll.getComparableField(PollSortKey.isClosed); - - expect(field1!.compareTo(field2!), greaterThan(0)); // true > false - expect(field2.compareTo(field1), lessThan(0)); // false < true }); - test('should compare two polls correctly using extraData', () { - final highPriorityPoll = createTestPoll( - id: 'high', - name: 'High Priority Poll', - extraData: {'priority': 10}, - ); - - final lowPriorityPoll = createTestPoll( - id: 'low', - name: 'Low Priority Poll', - extraData: {'priority': 1}, + test('isClosed orders open polls first', () { + expectOrders( + PollSortField.isClosed, + createTestPoll(name: 'open', isClosed: false), + createTestPoll(name: 'closed', isClosed: true), ); - - final field1 = highPriorityPoll.getComparableField('priority'); - final field2 = lowPriorityPoll.getComparableField('priority'); - - expect(field1!.compareTo(field2!), greaterThan(0)); // 10 > 1 - expect(field2.compareTo(field1), lessThan(0)); // 1 < 10 }); }); }); diff --git a/packages/stream_chat/test/src/core/models/poll_vote_test.dart b/packages/stream_chat/test/src/core/models/poll_vote_test.dart index 20fc18c5e9..a43deef1a7 100644 --- a/packages/stream_chat/test/src/core/models/poll_vote_test.dart +++ b/packages/stream_chat/test/src/core/models/poll_vote_test.dart @@ -2,123 +2,33 @@ import 'package:stream_chat/src/core/models/poll_vote.dart'; import 'package:stream_chat/src/core/models/user.dart'; import 'package:test/test.dart'; +import '../../utils.dart'; + void main() { group('src/models/poll_vote', () { - group('ComparableFieldProvider', () { - test('should return ComparableField for poll_vote.id', () { - final pollVote = createTestPollVote( - id: 'test-vote-id', - optionId: 'option-1', + group('PollVoteSortField', () { + test('id orders alphabetically', () { + expectOrders( + PollVoteSortField.id, + createTestPollVote(id: 'a-vote', optionId: 'o'), + createTestPollVote(id: 'b-vote', optionId: 'o'), ); - - final field = pollVote.getComparableField(PollVoteSortKey.id); - expect(field, isNotNull); - expect(field!.value, equals('test-vote-id')); }); - test('should return ComparableField for poll_vote.createdAt', () { - final createdAt = DateTime(2023, 6, 15); - final pollVote = createTestPollVote( - id: 'test-vote-id', - optionId: 'option-1', - createdAt: createdAt, + test('createdAt orders older votes first', () { + expectOrders( + PollVoteSortField.createdAt, + createTestPollVote(optionId: 'o', createdAt: DateTime(2023, 6, 10)), + createTestPollVote(optionId: 'o', createdAt: DateTime(2023, 6, 15)), ); - - final field = pollVote.getComparableField(PollVoteSortKey.createdAt); - expect(field, isNotNull); - expect(field!.value, equals(createdAt)); }); - test('should return ComparableField for poll_vote.updatedAt', () { - final updatedAt = DateTime(2023, 6, 20); - final pollVote = createTestPollVote( - id: 'test-vote-id', - optionId: 'option-1', - updatedAt: updatedAt, - ); - - final field = pollVote.getComparableField(PollVoteSortKey.updatedAt); - expect(field, isNotNull); - expect(field!.value, equals(updatedAt)); - }); - - test('should return ComparableField for poll_vote.answerText', () { - final pollVote = createTestPollVote( - id: 'test-vote-id', - answerText: 'This is my answer', - ); - - final field = pollVote.getComparableField(PollVoteSortKey.answerText); - expect(field, isNotNull); - expect(field!.value, equals('This is my answer')); - }); - - test('should return null for non-existent field keys', () { - final pollVote = createTestPollVote( - id: 'test-vote-id', - optionId: 'option-1', - ); - - final field = pollVote.getComparableField('non_existent_key'); - expect(field, isNull); - }); - - test('should compare two poll votes correctly using createdAt', () { - final recentVote = createTestPollVote( - id: 'recent', - optionId: 'option-1', - createdAt: DateTime(2023, 6, 15), - ); - - final olderVote = createTestPollVote( - id: 'older', - optionId: 'option-1', - createdAt: DateTime(2023, 6, 10), + test('updatedAt orders older votes first', () { + expectOrders( + PollVoteSortField.updatedAt, + createTestPollVote(optionId: 'o', updatedAt: DateTime(2023, 6, 10)), + createTestPollVote(optionId: 'o', updatedAt: DateTime(2023, 6, 15)), ); - - final field1 = recentVote.getComparableField(PollVoteSortKey.createdAt); - final field2 = olderVote.getComparableField(PollVoteSortKey.createdAt); - - // More recent > Less recent - expect(field1!.compareTo(field2!), greaterThan(0)); - // Less recent < More recent - expect(field2.compareTo(field1), lessThan(0)); - }); - - test('should compare two poll votes correctly using id', () { - final vote1 = createTestPollVote( - id: 'abc', - optionId: 'option-1', - ); - - final vote2 = createTestPollVote( - id: 'xyz', - optionId: 'option-1', - ); - - final field1 = vote1.getComparableField(PollVoteSortKey.id); - final field2 = vote2.getComparableField(PollVoteSortKey.id); - - expect(field1!.compareTo(field2!), lessThan(0)); // abc < xyz - expect(field2.compareTo(field1), greaterThan(0)); // xyz > abc - }); - - test('should compare two poll votes correctly using answerText', () { - final vote1 = createTestPollVote( - id: 'answer1', - answerText: 'Answer A', - ); - - final vote2 = createTestPollVote( - id: 'answer2', - answerText: 'Answer B', - ); - - final field1 = vote1.getComparableField(PollVoteSortKey.answerText); - final field2 = vote2.getComparableField(PollVoteSortKey.answerText); - - expect(field1!.compareTo(field2!), lessThan(0)); // Answer A < Answer B - expect(field2.compareTo(field1), greaterThan(0)); // Answer B > Answer A }); }); }); diff --git a/packages/stream_chat/test/src/core/models/predefined_filter_test.dart b/packages/stream_chat/test/src/core/models/predefined_filter_test.dart index 214f34b7f7..7aa0247b4c 100644 --- a/packages/stream_chat/test/src/core/models/predefined_filter_test.dart +++ b/packages/stream_chat/test/src/core/models/predefined_filter_test.dart @@ -1,7 +1,7 @@ -import 'package:stream_chat/src/core/api/sort_order.dart'; import 'package:stream_chat/src/core/models/channel_state.dart'; import 'package:stream_chat/src/core/models/filter.dart'; import 'package:stream_chat/src/core/models/predefined_filter.dart'; +import 'package:stream_core/stream_core.dart' show SortDirection; import 'package:test/test.dart'; void main() { @@ -37,23 +37,62 @@ void main() { expect(parsed.name, 'unread'); expect(parsed.filter.value, filterJson); expect(parsed.sort, hasLength(1)); - expect(parsed.sort!.first.field, 'last_message_at'); - expect(parsed.sort!.first.direction, SortOption.DESC); + expect(parsed.sort!.first.field.remote, 'last_message_at'); + expect(parsed.sort!.first.direction, SortDirection.desc); + }); + + group('sort direction', () { + PredefinedFilter parseWithDirection(Object? direction) { + return PredefinedFilter.fromJson({ + 'name': 'unread', + 'filter': {}, + 'sort': [ + {'field': 'last_message_at', 'direction': direction}, + ], + }); + } + + test('-1 parses as descending', () { + expect(parseWithDirection(-1).sort!.single.direction, SortDirection.desc); + }); + + test('1 parses as ascending', () { + expect(parseWithDirection(1).sort!.single.direction, SortDirection.asc); + }); + + test('anything else parses as ascending, as the server reads it', () { + // The API treats a direction other than -1 as ascending — see + // `ToSortParameter` and `isAscending := sortValue.Direction != -1`. + expect(parseWithDirection(0).sort!.single.direction, SortDirection.asc); + }); + + test('a field the SDK does not model still resolves', () { + final parsed = PredefinedFilter.fromJson({ + 'name': 'unread', + 'filter': {}, + 'sort': [ + {'field': 'some_custom_field', 'direction': -1}, + ], + }); + + expect(parsed.sort!.single.field.remote, 'some_custom_field'); + expect(parsed.sort!.single.direction, SortDirection.desc); + }); }); group('effectiveSort', () { test('returns the echoed sort when present', () { - const filter = PredefinedFilter( + final filter = PredefinedFilter( name: 'x', - filter: Filter.empty(), - sort: [SortOption.asc(ChannelSortKey.createdAt)], + filter: const Filter.empty(), + sort: [ChannelSort.asc(ChannelSortField.createdAt)], ); final sort = filter.effectiveSort; expect(sort, hasLength(1)); - expect(sort.single.field, equals(ChannelSortKey.createdAt)); - expect(sort.single.direction, equals(SortOption.ASC)); + expect(sort.single.field.remote, equals(ChannelSortField.createdAt.remote)); + expect(sort.single.direction, equals(SortDirection.asc)); }); test('falls back to lastUpdated desc when sort is null and filter is empty', () { @@ -62,8 +101,8 @@ void main() { final sort = predefined.effectiveSort; expect(sort, hasLength(1)); - expect(sort.single.field, equals(ChannelSortKey.lastUpdated)); - expect(sort.single.direction, equals(SortOption.DESC)); + expect(sort.single.field.remote, equals(ChannelSortField.lastUpdated.remote)); + expect(sort.single.direction, equals(SortDirection.desc)); }); test('falls back to lastMessageAt desc when raw filter touches last_message_at', () { @@ -78,8 +117,8 @@ void main() { final sort = predefined.effectiveSort; - expect(sort.single.field, equals(ChannelSortKey.lastMessageAt)); - expect(sort.single.direction, equals(SortOption.DESC)); + expect(sort.single.field.remote, equals(ChannelSortField.lastMessageAt.remote)); + expect(sort.single.direction, equals(SortDirection.desc)); }); test(r'falls back to lastMessageAt desc when last_message_at is nested under $or', () { @@ -101,7 +140,7 @@ void main() { final sort = predefined.effectiveSort; - expect(sort.single.field, equals(ChannelSortKey.lastMessageAt)); + expect(sort.single.field.remote, equals(ChannelSortField.lastMessageAt.remote)); }); test('falls back to lastUpdated desc when filter touches only other fields', () { @@ -123,7 +162,7 @@ void main() { final sort = predefined.effectiveSort; - expect(sort.single.field, equals(ChannelSortKey.lastUpdated)); + expect(sort.single.field.remote, equals(ChannelSortField.lastUpdated.remote)); }); test('falls back to lastMessageAt desc when typed Filter.and touches last_message_at', () { @@ -137,7 +176,7 @@ void main() { final sort = predefined.effectiveSort; - expect(sort.single.field, equals(ChannelSortKey.lastMessageAt)); + expect(sort.single.field.remote, equals(ChannelSortField.lastMessageAt.remote)); }); }); } diff --git a/packages/stream_chat/test/src/core/models/reaction_test.dart b/packages/stream_chat/test/src/core/models/reaction_test.dart index 2b9ed6dbeb..0bb3a0a49d 100644 --- a/packages/stream_chat/test/src/core/models/reaction_test.dart +++ b/packages/stream_chat/test/src/core/models/reaction_test.dart @@ -125,38 +125,13 @@ void main() { expect(newReaction.userId, 'test'); }); - group('ComparableFieldProvider', () { - test('should return ComparableField for reaction.createdAt', () { - final createdAt = DateTime(2020, 1, 28); - final reaction = Reaction(type: 'like', createdAt: createdAt); - - final field = reaction.getComparableField(ReactionSortKey.createdAt); - expect(field, isNotNull); - expect(field!.value, equals(createdAt)); - }); - - test('should return null for non-existent field keys', () { - final reaction = Reaction(type: 'like'); - - final field = reaction.getComparableField('non_existent_key'); - expect(field, isNull); - }); - - test('should compare two reactions correctly using createdAt', () { - final recentReaction = Reaction( - type: 'like', - createdAt: DateTime(2020, 6, 15), - ); - final olderReaction = Reaction( - type: 'like', - createdAt: DateTime(2020, 6, 10), + group('ReactionSortField', () { + test('createdAt orders older reactions first', () { + expectOrders( + ReactionSortField.createdAt, + Reaction(type: 'like', createdAt: DateTime(2020, 6, 10)), + Reaction(type: 'like', createdAt: DateTime(2020, 6, 15)), ); - - final field1 = recentReaction.getComparableField(ReactionSortKey.createdAt); - final field2 = olderReaction.getComparableField(ReactionSortKey.createdAt); - - expect(field1!.compareTo(field2!), greaterThan(0)); // more recent > older - expect(field2.compareTo(field1), lessThan(0)); // older < more recent }); }); diff --git a/packages/stream_chat/test/src/core/api/sort_order_test.dart b/packages/stream_chat/test/src/core/models/sort_comparison_test.dart similarity index 51% rename from packages/stream_chat/test/src/core/api/sort_order_test.dart rename to packages/stream_chat/test/src/core/models/sort_comparison_test.dart index 71db50f66d..7f783c80c0 100644 --- a/packages/stream_chat/test/src/core/api/sort_order_test.dart +++ b/packages/stream_chat/test/src/core/models/sort_comparison_test.dart @@ -1,97 +1,116 @@ -// ignore_for_file: avoid_redundant_argument_values - import 'package:collection/collection.dart'; import 'package:equatable/equatable.dart'; -import 'package:stream_chat/src/core/api/sort_order.dart'; import 'package:stream_chat/src/core/models/channel_model.dart'; import 'package:stream_chat/src/core/models/channel_state.dart'; -import 'package:stream_chat/src/core/models/comparable_field.dart'; import 'package:stream_chat/src/core/models/member.dart'; +import 'package:stream_chat/src/core/util/string_sort_normalizer.dart'; +import 'package:stream_core/stream_core.dart' + show CompositeComparator, NullOrdering, Sort, SortField, SortFieldValueGetter, Standard; import 'package:test/test.dart'; -/// Simple test model that implements ComparableFieldProvider -class TestModel extends Equatable implements ComparableFieldProvider { +class TestModel extends Equatable { const TestModel({ this.name, this.age, this.createdAt, this.active, + this.tag, }); final String? name; final int? age; final DateTime? createdAt; final bool? active; + final Object? tag; @override - List get props => [name, age, createdAt, active]; + List get props => [name, age, createdAt, active, tag]; +} - @override - ComparableField? getComparableField(String sortKey) { - return switch (sortKey) { - 'name' => ComparableField.fromValue(name), - 'age' => ComparableField.fromValue(age), - 'created_at' => ComparableField.fromValue(createdAt), - 'active' => ComparableField.fromValue(active), - _ => null, - }; - } +class TestSort extends Sort { + const TestSort.asc( + TestSortField super.field, { + super.nullOrdering = NullOrdering.nullsLast, + }) : super.asc(); + + const TestSort.desc( + TestSortField super.field, { + super.nullOrdering = NullOrdering.nullsFirst, + }) : super.desc(); +} + +class TestSortField extends SortField { + TestSortField(String remote, this.value) : super(remote, value); + + final SortFieldValueGetter value; + + static final name = TestSortField('name', (it) => it.name?.let(normalizeStringForSort)); + static final age = TestSortField('age', (it) => it.age); + static final createdAt = TestSortField('created_at', (it) => it.createdAt); + static final active = TestSortField('active', (it) => it.active); + + // An arbitrary object, to prove an unorderable value does not throw. + static final tag = TestSortField('tag', (it) => it.tag); + + // A field that projects onto something orderable, which is what replaces the + // custom comparator the old `SortOption` accepted. + static final nameLength = TestSortField('name_length', (it) => it.name?.length); } /// Helper to compare sorted lists cleanly -void expectSorted( +void expectSorted( List input, - List> sortOptions, + List> sort, List expectedOrder, ) { - final sorted = input.sorted(sortOptions.compare); + final sorted = input.sorted(sort.compare); expect(sorted, equals(expectedOrder)); } void main() { - group('SortOption basics', () { - test('serialization', () { - const option = SortOption.desc('name'); - final j = option.toJson(); - expect(j, {'field': 'name', 'direction': -1}); - }); + group('server-parity value folding', () { + // Regression: https://github.com/GetStream/stream-chat-flutter/issues/2601 + // The reporter observed lowercase-starting names and non-ASCII names + // (Polish `Ł`, Norwegian `Ø`) getting pushed to the end of a list sorted + // by name, because the comparator was a raw codepoint compare. + test('should fold string values so name sorts match the server', () { + final models = ['Zara', 'jhon', 'Łukasz', 'Øystein', 'Adam', 'Marek'].map( + (it) => TestModel(name: it), + ); - test('should create a SortOption with ASC direction', () { - const option = SortOption.asc('age'); - expect(option.field, 'age'); - expect(option.direction, SortOption.ASC); - }); + final sorted = models.sorted([Sort.asc(TestSortField.name)].compare); - test('should create a SortOption with DESC direction', () { - const option = SortOption.desc('age'); - expect(option.field, 'age'); - expect(option.direction, SortOption.DESC); + expect(sorted.map((it) => it.name), [ + 'Adam', + 'jhon', + 'Łukasz', + 'Marek', + 'Øystein', + 'Zara', + ]); }); - test('should default pinnedAt and lastMessageAt to nullsLast in both directions', () { - const sortKeys = [ChannelSortKey.pinnedAt, ChannelSortKey.lastMessageAt]; - for (final key in sortKeys) { - expect(SortOption.desc(key).nullOrdering, NullOrdering.nullsLast, reason: '$key desc'); - expect(SortOption.asc(key).nullOrdering, NullOrdering.nullsLast, reason: '$key asc'); - } + test('should compare mixed numeric types correctly', () { + // A field can hand back either, and `10` must not order before or + // after `10.0`. + final sort = [TestSort.asc(TestSortField.tag)]; + + expect(sort.compare(const TestModel(tag: 10), const TestModel(tag: 10.0)), 0); + expect(sort.compare(const TestModel(tag: 10), const TestModel(tag: 10.5)), lessThan(0)); }); - test('should let an explicit nullOrdering override the default', () { - const option = SortOption.desc( - ChannelSortKey.pinnedAt, - nullOrdering: NullOrdering.nullsFirst, - ); - expect(option.nullOrdering, NullOrdering.nullsFirst); + test('should treat unorderable values as equal rather than throwing', () { + const a = TestModel(tag: Object()); + const b = TestModel(tag: Object()); + + expect([Sort.asc(TestSortField.tag)].compare(a, b), 0); }); - test('should resolve field defaults when deserialized from json', () { - final pinnedAt = SortOption.fromJson({'field': 'pinned_at', 'direction': -1}); - final lastMessageAt = SortOption.fromJson({'field': 'last_message_at', 'direction': -1}); - final lastUpdated = SortOption.fromJson({'field': 'last_updated', 'direction': -1}); + test('should treat values of different types as equal rather than throwing', () { + const a = TestModel(tag: 'a string'); + const b = TestModel(tag: 42); - expect(pinnedAt.nullOrdering, NullOrdering.nullsLast); - expect(lastMessageAt.nullOrdering, NullOrdering.nullsLast); - expect(lastUpdated.nullOrdering, NullOrdering.nullsFirst); + expect([Sort.asc(TestSortField.tag)].compare(a, b), 0); }); }); @@ -120,9 +139,9 @@ void main() { channelState('pinned-new', pinnedAt: createdAt.add(const Duration(days: 2))), ]; - const sort = [ - SortOption.desc(ChannelSortKey.pinnedAt), - SortOption.desc(ChannelSortKey.lastUpdated), + final sort = [ + ChannelSort.desc(ChannelSortField.pinnedAt), + ChannelSort.desc(ChannelSortField.lastUpdated), ]; expect(idsOf(channels.sorted(sort.compare)), [ @@ -140,21 +159,63 @@ void main() { channelState('pinned-old', pinnedAt: createdAt.add(const Duration(days: 1))), ]; - const sort = [SortOption.asc(ChannelSortKey.pinnedAt)]; + final sort = [ChannelSort.asc(ChannelSortField.pinnedAt)]; expect(idsOf(channels.sorted(sort.compare)), ['pinned-old', 'pinned-new', 'unpinned']); }); - test('should keep channels without messages at the bottom when sorting by lastMessageAt desc', () { + test( + 'should keep channels without messages at the bottom when sorting by lastMessageAt desc', + () { + final channels = [ + channelState('no-messages'), + channelState('newest', lastMessageAt: createdAt.add(const Duration(days: 5))), + channelState('oldest', lastMessageAt: createdAt.add(const Duration(days: 1))), + ]; + + final sort = [ChannelSort.desc(ChannelSortField.lastMessageAt)]; + + expect(idsOf(channels.sorted(sort.compare)), ['newest', 'oldest', 'no-messages']); + }, + ); + + test( + 'should keep channels without messages at the bottom when sorting by lastMessageAt asc', + () { + // `last_message_at` ascending relies on the API leaving the direction + // bare, which Postgres orders nulls last. + final channels = [ + channelState('no-messages'), + channelState('oldest', lastMessageAt: createdAt.add(const Duration(days: 1))), + channelState('newest', lastMessageAt: createdAt.add(const Duration(days: 5))), + ]; + + final sort = [ChannelSort.asc(ChannelSortField.lastMessageAt)]; + + expect(idsOf(channels.sorted(sort.compare)), ['oldest', 'newest', 'no-messages']); + }, + ); + + test('should keep nulls last for other fields when sorting asc', () { + // A field with no pinned ordering follows the direction's default, which + // matches the bare `ASC` the API emits for it. final channels = [ - channelState('no-messages'), - channelState('newest', lastMessageAt: createdAt.add(const Duration(days: 5))), - channelState('oldest', lastMessageAt: createdAt.add(const Duration(days: 1))), + ChannelState( + channel: ChannelModel(id: 'no-team', type: 'messaging', createdAt: createdAt), + ), + ChannelState( + channel: ChannelModel( + id: 'red-team', + type: 'messaging', + createdAt: createdAt, + extraData: const {'team': 'red'}, + ), + ), ]; - const sort = [SortOption.desc(ChannelSortKey.lastMessageAt)]; + final sort = [ChannelSort.asc(ChannelSortField.custom('team'))]; - expect(idsOf(channels.sorted(sort.compare)), ['newest', 'oldest', 'no-messages']); + expect(idsOf(channels.sorted(sort.compare)), ['red-team', 'no-team']); }); test('should keep nulls first for other fields when sorting desc', () { @@ -172,74 +233,67 @@ void main() { ), ]; - const sort = [SortOption.desc('team')]; + final sort = [ChannelSort.desc(ChannelSortField.custom('team'))]; expect(idsOf(channels.sorted(sort.compare)), ['no-team', 'red-team']); }); }); - group('SortOption single field', () { + group('a sort with one field', () { test('should compare two objects in descending order', () { - const option = SortOption.desc('age'); + final sort = [Sort.desc(TestSortField.age)]; const a = TestModel(age: 30); const b = TestModel(age: 25); - expect(option.compare(a, b), lessThan(0)); + expect(sort.compare(a, b), lessThan(0)); }); test('should compare two objects in ascending order', () { - const option = SortOption.asc('age'); + final sort = [Sort.asc(TestSortField.age)]; const a = TestModel(age: 25); const b = TestModel(age: 30); - expect(option.compare(a, b), lessThan(0)); + expect(sort.compare(a, b), lessThan(0)); }); test('should handle null values correctly (default nullOrdering)', () { - const option = SortOption.desc('age'); + final sort = [Sort.desc(TestSortField.age)]; const a = TestModel(age: null); const b = TestModel(age: 25); const c = TestModel(age: null); - expect(option.compare(a, b), lessThan(0)); - expect(option.compare(b, a), greaterThan(0)); - expect(option.compare(a, c), equals(0)); + expect(sort.compare(a, b), lessThan(0)); + expect(sort.compare(b, a), greaterThan(0)); + expect(sort.compare(a, c), equals(0)); }); test('should compare date fields correctly', () { - const option = SortOption.desc('created_at'); + final sort = [Sort.desc(TestSortField.createdAt)]; final now = DateTime.now(); final earlier = now.subtract(const Duration(days: 1)); final a = TestModel(createdAt: now); final b = TestModel(createdAt: earlier); - expect(option.compare(a, b), lessThan(0)); + expect(sort.compare(a, b), lessThan(0)); }); test('should compare boolean fields correctly', () { - const option = SortOption.desc('active'); + final sort = [Sort.desc(TestSortField.active)]; const a = TestModel(active: true); const b = TestModel(active: false); const c = TestModel(active: true); - expect(option.compare(a, b), lessThan(0)); - expect(option.compare(b, a), greaterThan(0)); - expect(option.compare(a, c), equals(0)); + expect(sort.compare(a, b), lessThan(0)); + expect(sort.compare(b, a), greaterThan(0)); + expect(sort.compare(a, c), equals(0)); }); - test('should handle custom comparator', () { - final option = SortOption.desc( - 'name', - comparator: (a, b) { - final aLength = a.name?.length ?? 0; - final bLength = b.name?.length ?? 0; - return bLength.compareTo(aLength); - }, - ); + test('should order by whatever the extractor projects onto', () { + final sort = [Sort.desc(TestSortField.nameLength)]; const a = TestModel(name: 'longer_name'); const b = TestModel(name: 'short'); - expect(option.compare(a, b), greaterThan(0)); + expect(sort.compare(a, b), lessThan(0)); }); test('should respect explicit nullOrdering=nullsLast on DESC', () { @@ -249,11 +303,9 @@ void main() { const TestModel(age: 30), ]; - final sortOptions = >[ - const SortOption.desc('age', nullOrdering: NullOrdering.nullsLast), - ]; + final sort = [Sort.desc(TestSortField.age, nullOrdering: NullOrdering.nullsLast)]; - expectSorted(models, sortOptions, [ + expectSorted(models, sort, [ const TestModel(age: 40), const TestModel(age: 30), const TestModel(age: null), @@ -267,11 +319,9 @@ void main() { const TestModel(name: 'Alice'), ]; - final sortOptions = >[ - const SortOption.asc('name', nullOrdering: NullOrdering.nullsFirst), - ]; + final sort = [Sort.asc(TestSortField.name, nullOrdering: NullOrdering.nullsFirst)]; - expectSorted(models, sortOptions, [ + expectSorted(models, sort, [ const TestModel(name: null), const TestModel(name: 'Alice'), const TestModel(name: 'Bob'), @@ -279,7 +329,7 @@ void main() { }); }); - group('Composite Sorting', () { + group('a sort with several fields', () { test('should sort list using multiple sort criteria', () { final models = [ const TestModel(name: 'Alice', age: 30), @@ -288,12 +338,9 @@ void main() { const TestModel(name: 'David', age: 40), ]; - final sortOptions = >[ - const SortOption.desc('age'), - const SortOption.asc('name'), - ]; + final sort = [Sort.desc(TestSortField.age), Sort.asc(TestSortField.name)]; - expectSorted(models, sortOptions, [ + expectSorted(models, sort, [ const TestModel(name: 'David', age: 40), const TestModel(name: 'Alice', age: 30), const TestModel(name: 'Bob', age: 30), @@ -309,12 +356,9 @@ void main() { const TestModel(name: null, age: 40), ]; - final sortOptions = >[ - const SortOption.desc('age'), - const SortOption.asc('name'), - ]; + final sort = [Sort.desc(TestSortField.age), Sort.asc(TestSortField.name)]; - expectSorted(models, sortOptions, [ + expectSorted(models, sort, [ const TestModel(name: 'Alice', age: null), const TestModel(name: 'Charlie', age: null), const TestModel(name: null, age: 40), @@ -328,9 +372,7 @@ void main() { const TestModel(name: 'Bob', age: 25), ]; - final sortOptions = >[]; - - expectSorted(models, sortOptions, [ + expectSorted(models, >[], [ const TestModel(name: 'Alice', age: 30), const TestModel(name: 'Bob', age: 25), ]); @@ -346,13 +388,13 @@ void main() { TestModel(name: 'Charlie', active: true, createdAt: now), ]; - final sortOptions = >[ - const SortOption.desc('created_at'), - const SortOption.desc('active'), - const SortOption.asc('name'), + final sort = [ + Sort.desc(TestSortField.createdAt), + Sort.desc(TestSortField.active), + Sort.asc(TestSortField.name), ]; - expectSorted(models, sortOptions, [ + expectSorted(models, sort, [ TestModel(name: 'Charlie', active: true, createdAt: now), TestModel(name: 'Bob', active: false, createdAt: now), TestModel(name: 'Alice', active: true, createdAt: yesterday), @@ -366,12 +408,9 @@ void main() { const TestModel(name: 'Alice', age: 30), ]; - final sortOptions = >[ - const SortOption.desc('age'), - const SortOption.asc('name'), - ]; + final sort = [Sort.desc(TestSortField.age), Sort.asc(TestSortField.name)]; - expectSorted(models, sortOptions, [ + expectSorted(models, sort, [ const TestModel(name: 'Alice', age: 30), const TestModel(name: 'Bob', age: 30), const TestModel(name: 'Charlie', age: 30), @@ -384,12 +423,9 @@ void main() { const TestModel(name: null, age: null), ]; - final sortOptions = >[ - const SortOption.desc('age'), - const SortOption.asc('name'), - ]; + final sort = [Sort.desc(TestSortField.age), Sort.asc(TestSortField.name)]; - expectSorted(models, sortOptions, [ + expectSorted(models, sort, [ const TestModel(name: null, age: null), const TestModel(name: null, age: null), ]); @@ -402,12 +438,9 @@ void main() { const TestModel(name: 'Bob', age: null), ]; - final sortOptions = >[ - const SortOption.desc('age'), - const SortOption.asc('name'), - ]; + final sort = [Sort.desc(TestSortField.age), Sort.asc(TestSortField.name)]; - expectSorted(models, sortOptions, [ + expectSorted(models, sort, [ const TestModel(name: 'Alice', age: null), const TestModel(name: 'Bob', age: null), const TestModel(name: null, age: null), diff --git a/packages/stream_chat/test/src/core/models/sort_registry_test.dart b/packages/stream_chat/test/src/core/models/sort_registry_test.dart new file mode 100644 index 0000000000..2791be1801 --- /dev/null +++ b/packages/stream_chat/test/src/core/models/sort_registry_test.dart @@ -0,0 +1,433 @@ +import 'package:collection/collection.dart'; +import 'package:equatable/equatable.dart'; +import 'package:stream_chat/src/core/models/banned_user.dart'; +import 'package:stream_chat/src/core/models/channel_state.dart'; +import 'package:stream_chat/src/core/models/draft.dart'; +import 'package:stream_chat/src/core/models/member.dart'; +import 'package:stream_chat/src/core/models/message.dart'; +import 'package:stream_chat/src/core/models/message_reminder.dart'; +import 'package:stream_chat/src/core/models/poll.dart'; +import 'package:stream_chat/src/core/models/poll_vote.dart'; +import 'package:stream_chat/src/core/models/reaction.dart'; +import 'package:stream_chat/src/core/models/thread.dart'; +import 'package:stream_chat/src/core/models/user.dart'; +import 'package:stream_chat/src/core/util/string_sort_normalizer.dart'; +import 'package:stream_core/stream_core.dart' + show CompositeComparator, NullOrdering, Sort, SortField, SortFieldValueGetter, Standard; +import 'package:test/test.dart'; + +class TestModel extends Equatable { + const TestModel({ + this.name, + this.age, + this.createdAt, + this.active, + this.tag, + }); + + final String? name; + final int? age; + final DateTime? createdAt; + final bool? active; + final Object? tag; + + @override + List get props => [name, age, createdAt, active, tag]; +} + +class TestSort extends Sort { + const TestSort.asc( + TestSortField super.field, { + super.nullOrdering = NullOrdering.nullsLast, + }) : super.asc(); + + const TestSort.desc( + TestSortField super.field, { + super.nullOrdering = NullOrdering.nullsFirst, + }) : super.desc(); +} + +class TestSortField extends SortField { + TestSortField(String remote, this.value) : super(remote, value); + + final SortFieldValueGetter value; + + static final name = TestSortField('name', (it) => it.name?.let(normalizeStringForSort)); + static final age = TestSortField('age', (it) => it.age); + static final createdAt = TestSortField('created_at', (it) => it.createdAt); + static final active = TestSortField('active', (it) => it.active); + + // An arbitrary object, to prove an unorderable value does not throw. + static final tag = TestSortField('tag', (it) => it.tag); + + // A field that projects onto something orderable, which is what replaces the + // custom comparator the old `SortOption` accepted. + static final nameLength = TestSortField('name_length', (it) => it.name?.length); +} + +/// Helper to compare sorted lists cleanly +void expectSorted( + List input, + List> sort, + List expectedOrder, +) { + final sorted = input.sorted(sort.compare); + expect(sorted, equals(expectedOrder)); +} + +void main() { + group('sort construction and field resolution', () { + test('a sort serializes to its field name and direction', () { + final sort = Sort.desc(TestSortField.name); + expect(sort.toJson(), {'field': 'name', 'direction': -1}); + }); + + test('should build an ascending sort', () { + final sort = Sort.asc(TestSortField.age); + expect(sort.field.remote, 'age'); + expect(sort.direction.value, 1); + }); + + test('should build a descending sort', () { + final sort = Sort.desc(TestSortField.age); + expect(sort.field.remote, 'age'); + expect(sort.direction.value, -1); + }); + + test('should default nulls last ascending and nulls first descending', () { + expect(Sort.asc(TestSortField.age).nullOrdering, NullOrdering.nullsLast); + expect(Sort.desc(TestSortField.age).nullOrdering, NullOrdering.nullsFirst); + }); + + test('should keep pinnedAt and lastMessageAt nulls last in both directions', () { + for (final field in [ChannelSortField.pinnedAt, ChannelSortField.lastMessageAt]) { + expect(ChannelSort.asc(field).nullOrdering, NullOrdering.nullsLast, reason: field.remote); + expect(ChannelSort.desc(field).nullOrdering, NullOrdering.nullsLast, reason: field.remote); + } + }); + + test('a hand-built field for a pinned name is ordered the same way', () { + // The rule keys on the remote name, which is what the API keys on, so a + // field the SDK did not declare still gets nulls last. + final byHand = ChannelSortField('pinned_at', (it) => it.membership?.pinnedAt); + expect(ChannelSort.desc(byHand).nullOrdering, NullOrdering.nullsLast); + }); + + test('should let an explicit nullOrdering override the field and the direction', () { + final channel = ChannelSort.desc( + ChannelSortField.pinnedAt, + nullOrdering: NullOrdering.nullsFirst, + ); + expect(channel.nullOrdering, NullOrdering.nullsFirst); + + final test = TestSort.asc(TestSortField.age, nullOrdering: NullOrdering.nullsFirst); + expect(test.nullOrdering, NullOrdering.nullsFirst); + }); + + test("building a sort without ChannelSort loses the field's null ordering", () { + // `ChannelSort` is what reads `nullOrdering` off the field, so a bare + // `Sort.desc` falls back to the direction's default. + expect(ChannelSort.desc(ChannelSortField.pinnedAt).nullOrdering, NullOrdering.nullsLast); + expect(Sort.desc(ChannelSortField.pinnedAt).nullOrdering, NullOrdering.nullsFirst); + }); + + test('`fromRemote` resolves every declared field', () { + // Listed here rather than read off the registry, so a field left out of + // the lookup fails instead of quietly resolving to a custom one. + final declared = [ + ChannelSortField.lastUpdated, + ChannelSortField.cid, + ChannelSortField.createdAt, + ChannelSortField.updatedAt, + ChannelSortField.lastMessageAt, + ChannelSortField.memberCount, + ChannelSortField.hasUnread, + ChannelSortField.unreadCount, + ChannelSortField.pinnedAt, + ]; + + for (final field in declared) { + expect(ChannelSortField.fromRemote(field.remote), same(field), reason: field.remote); + } + }); + + test('`fromRemote` falls back to a field the API added and the SDK has not', () { + // A channel key with no typed property deserializes into extraData, + // which is where the custom fallback looks — so the sort still works. + ChannelState channelWith(Object? value) => ChannelState.fromJson({ + 'channel': { + 'cid': 'messaging:a', + 'id': 'a', + 'type': 'messaging', + 'created_at': '2026-01-01T00:00:00.000Z', + 'updated_at': '2026-01-01T00:00:00.000Z', + 'some_new_api_field': value, + }, + }); + + final sort = [ChannelSort.desc(ChannelSortField.fromRemote('some_new_api_field'))]; + + expect(sort.first.field.remote, 'some_new_api_field'); + expect(sort.compare(channelWith(9), channelWith(1)), lessThan(0)); + }); + + test('`fromRemote` cannot reach a field the SDK models but has not declared', () { + // The counterpart, and the reason the declared set has to keep up with + // the model: a typed property's value never reaches extraData, so the + // fallback finds nothing and orders the two as equal. The query still + // carries the right field name. + ChannelState channelWith(int memberCount) => ChannelState.fromJson({ + 'channel': { + 'cid': 'messaging:a', + 'id': 'a', + 'type': 'messaging', + 'created_at': '2026-01-01T00:00:00.000Z', + 'updated_at': '2026-01-01T00:00:00.000Z', + 'member_count': memberCount, + }, + }); + + final asCustom = [ChannelSort.desc(ChannelSortField.custom('member_count'))]; + expect(asCustom.compare(channelWith(50), channelWith(100)), 0); + + final declared = [ChannelSort.desc(ChannelSortField.memberCount)]; + expect(declared.compare(channelWith(50), channelWith(100)), greaterThan(0)); + }); + + test('`fromRemote` should resolve declared fields and fall back to a custom one', () { + expect(ChannelSortField.fromRemote('pinned_at'), same(ChannelSortField.pinnedAt)); + expect(ChannelSortField.fromRemote('last_updated'), same(ChannelSortField.lastUpdated)); + + final custom = ChannelSortField.fromRemote('team'); + expect(custom.remote, 'team'); + }); + }); + + group('registry surface', () { + // Every remote name here was checked against the backend's + // `mq.TableConfig` for its resource and against the JS client's sort + // types. A field the server rejects fails the request at runtime with + // "sorting by X is not allowed", which no other test would catch, so the + // sets are pinned. + void expectRemotes(List> fields, Set expected) { + expect(fields.map((it) => it.remote).toSet(), expected); + } + + test('channel fields carry the wire names the API accepts', () { + expectRemotes( + [ + ChannelSortField.lastUpdated, + ChannelSortField.cid, + ChannelSortField.createdAt, + ChannelSortField.updatedAt, + ChannelSortField.lastMessageAt, + ChannelSortField.memberCount, + ChannelSortField.hasUnread, + ChannelSortField.unreadCount, + ChannelSortField.pinnedAt, + ], + { + 'last_updated', + 'cid', + 'created_at', + 'updated_at', + 'last_message_at', + 'member_count', + 'has_unread', + 'unread_count', + 'pinned_at', + }, + ); + }); + + test('message search fields carry the wire names the API accepts', () { + expectRemotes( + [ + MessageSearchSortField.id, + MessageSearchSortField.createdAt, + MessageSearchSortField.updatedAt, + MessageSearchSortField.text, + MessageSearchSortField.type, + MessageSearchSortField.parentId, + MessageSearchSortField.replyCount, + MessageSearchSortField.pinned, + MessageSearchSortField.relevance, + ], + { + 'id', + 'created_at', + 'updated_at', + 'text', + 'type', + 'parent_id', + 'reply_count', + 'pinned', + 'relevance', + }, + ); + }); + + test('user fields carry the wire names the API accepts', () { + expectRemotes( + [ + UserSortField.id, + UserSortField.createdAt, + UserSortField.updatedAt, + UserSortField.name, + UserSortField.role, + UserSortField.banned, + UserSortField.lastActive, + UserSortField.language, + UserSortField.teams, + ], + { + 'id', + 'created_at', + 'updated_at', + 'name', + 'role', + 'banned', + 'last_active', + 'language', + 'teams', + }, + ); + }); + + test('member fields carry the wire names the API accepts', () { + expectRemotes( + [ + MemberSortField.createdAt, + MemberSortField.userId, + MemberSortField.name, + MemberSortField.channelRole, + MemberSortField.updatedAt, + ], + {'created_at', 'user_id', 'name', 'channel_role', 'updated_at'}, + ); + }); + + test('thread fields carry the wire names the API accepts', () { + expectRemotes( + [ + ThreadSortField.lastMessageAt, + ThreadSortField.createdAt, + ThreadSortField.updatedAt, + ThreadSortField.replyCount, + ThreadSortField.participantCount, + ThreadSortField.activeParticipantCount, + ThreadSortField.parentMessageId, + ThreadSortField.hasUnread, + ], + { + 'last_message_at', + 'created_at', + 'updated_at', + 'reply_count', + 'participant_count', + 'active_participant_count', + 'parent_message_id', + 'has_unread', + }, + ); + }); + + test('reminder fields carry the wire names the API accepts', () { + expectRemotes( + [ + MessageReminderSortField.channelCid, + MessageReminderSortField.remindAt, + MessageReminderSortField.createdAt, + MessageReminderSortField.messageId, + ], + {'channel_cid', 'remind_at', 'created_at', 'message_id'}, + ); + }); + + test('poll fields carry the wire names the API accepts', () { + expectRemotes( + [ + PollSortField.id, + PollSortField.name, + PollSortField.createdAt, + PollSortField.updatedAt, + PollSortField.isClosed, + ], + {'id', 'name', 'created_at', 'updated_at', 'is_closed'}, + ); + }); + + test('poll vote fields carry the wire names the API accepts', () { + expectRemotes( + [ + PollVoteSortField.id, + PollVoteSortField.createdAt, + PollVoteSortField.updatedAt, + ], + {'id', 'created_at', 'updated_at'}, + ); + }); + + test('a custom field exists only where the API accepts one', () { + // Declared where the resource's `mq.TableConfig` leaves sort validation + // open. Poll and thread queries pin their sort to whole combinations of + // declared fields, so neither offers one — a custom field there would + // fail the request at runtime. + expect(ChannelSortField.custom('x').remote, 'x'); + expect(MessageSearchSortField.custom('x').remote, 'x'); + expect(UserSortField.custom('x').remote, 'x'); + expect(MemberSortField.custom('x').remote, 'x'); + }); + + test('draft, reaction and banned user sort on created_at only', () { + expectRemotes([DraftSortField.createdAt], {'created_at'}); + expectRemotes([ReactionSortField.createdAt], {'created_at'}); + expectRemotes([BannedUserSortField.createdAt], {'created_at'}); + }); + + test('every default sort is the ordering its query already has', () { + // Pinned against the server's own default for each resource, because a + // `defaultSort` that disagrees reorders a list for no reason and costs a + // query it did not need. Each entry is that resource's `DefaultSort()` + // in the backend, or the fallback its query builder appends. + expect( + >>{ + 'channel': ChannelSort.defaultSort, + 'user': UserSort.defaultSort, + 'member': MemberSort.defaultSort, + 'draft': DraftSort.defaultSort, + 'reminder': MessageReminderSort.defaultSort, + 'poll': PollSort.defaultSort, + 'poll_vote': PollVoteSort.defaultSort, + 'reaction': ReactionSort.defaultSort, + }.map((k, v) => MapEntry(k, v.map((it) => it.toJson()).toList())), + { + 'channel': [ + {'field': 'last_updated', 'direction': -1}, + ], + 'user': [ + {'field': 'created_at', 'direction': -1}, + ], + 'member': [ + {'field': 'created_at', 'direction': 1}, + ], + 'draft': [ + {'field': 'created_at', 'direction': -1}, + ], + 'reminder': [ + {'field': 'remind_at', 'direction': 1}, + ], + 'poll': [ + {'field': 'created_at', 'direction': 1}, + ], + 'poll_vote': [ + {'field': 'created_at', 'direction': 1}, + ], + 'reaction': [ + {'field': 'created_at', 'direction': -1}, + ], + }, + ); + }); + }); +} diff --git a/packages/stream_chat/test/src/core/models/thread_test.dart b/packages/stream_chat/test/src/core/models/thread_test.dart index 9e0a04bbee..1877d9de0b 100644 --- a/packages/stream_chat/test/src/core/models/thread_test.dart +++ b/packages/stream_chat/test/src/core/models/thread_test.dart @@ -1,6 +1,8 @@ import 'package:stream_chat/stream_chat.dart'; import 'package:test/test.dart'; +import '../../utils.dart'; + void main() { group('Thread', () { test('should create a valid instance', () { @@ -210,5 +212,52 @@ void main() { expect(thread1.draft?.message.text, equals(thread2.draft?.message.text)); expect(thread1.draft?.message.text, isNot(equals(thread3.draft?.message.text))); }); + + group('ThreadSortField', () { + Thread threadWith({ + DateTime? lastMessageAt, + int replyCount = 0, + int participantCount = 0, + String parentMessageId = 'p1', + }) => Thread( + channelCid: 'messaging:123', + parentMessageId: parentMessageId, + createdByUserId: 'u1', + replyCount: replyCount, + participantCount: participantCount, + lastMessageAt: lastMessageAt, + ); + + test('lastMessageAt orders the older thread first', () { + expectOrders( + ThreadSortField.lastMessageAt, + threadWith(lastMessageAt: DateTime.utc(2024, 1, 1)), + threadWith(lastMessageAt: DateTime.utc(2024, 6, 1)), + ); + }); + + test('replyCount and participantCount order numerically', () { + expectOrders(ThreadSortField.replyCount, threadWith(replyCount: 1), threadWith(replyCount: 9)); + expectOrders( + ThreadSortField.participantCount, + threadWith(participantCount: 1), + threadWith(participantCount: 9), + ); + }); + + // `lastMessageAt` is nullable and `defaultSort` sorts it descending, so + // without the nulls-last pin a thread with no replies would lead the list + // instead of trailing it. + test('a thread with no replies sorts last in either direction', () { + final silent = threadWith(); + final active = threadWith(lastMessageAt: DateTime.utc(2024, 1, 1)); + + final desc = [ThreadSort.desc(ThreadSortField.lastMessageAt)]; + expect(desc.compare(silent, active), greaterThan(0)); + + final asc = [ThreadSort.asc(ThreadSortField.lastMessageAt)]; + expect(asc.compare(silent, active), greaterThan(0)); + }); + }); }); } diff --git a/packages/stream_chat/test/src/core/models/user_test.dart b/packages/stream_chat/test/src/core/models/user_test.dart index 5915e442aa..b725056693 100644 --- a/packages/stream_chat/test/src/core/models/user_test.dart +++ b/packages/stream_chat/test/src/core/models/user_test.dart @@ -246,146 +246,73 @@ void main() { expect(user.avgResponseTime, null); }); - group('ComparableFieldProvider', () { - test('should return ComparableField for user.id', () { - final user = createTestUser( - id: 'test-user', + group('UserSortField', () { + test('id orders alphabetically', () { + expectOrders( + UserSortField.id, + createTestUser(id: 'alice'), + createTestUser(id: 'bob'), ); - - final field = user.getComparableField(UserSortKey.id); - expect(field, isNotNull); - expect(field!.value, equals('test-user')); }); - test('should return ComparableField for user.name', () { - final user = createTestUser( - id: 'test-user', - name: 'Test User', + test('name orders alphabetically, folded', () { + // Folding is what makes a local sort agree with the server: `Zara` + // would otherwise sort before `alice`. + expectOrders( + UserSortField.name, + createTestUser(id: 'a', name: 'alice'), + createTestUser(id: 'z', name: 'Zara'), ); - - final field = user.getComparableField(UserSortKey.name); - expect(field, isNotNull); - expect(field!.value, equals('Test User')); }); - test('should return ComparableField for user.role', () { - final user = createTestUser( - id: 'test-user', - role: 'admin', + test('name orders nothing for a user with no name', () { + // `User.name` answers the id when a user has no name. Sorting by that + // would order unnamed users among the named ones, where the API sorts + // them together by an empty `name` column. + expectOrdersNothing( + UserSortField.name, + createTestUser(id: 'alice'), + createTestUser(id: 'zara'), ); - - final field = user.getComparableField(UserSortKey.role); - expect(field, isNotNull); - expect(field!.value, equals('admin')); }); - test('should return ComparableField for user.banned', () { - final user = createTestUser( - id: 'test-user', - banned: true, + test('role orders alphabetically', () { + expectOrders( + UserSortField.role, + createTestUser(id: 'a', role: 'admin'), + createTestUser(id: 'u', role: 'user'), ); - - final field = user.getComparableField(UserSortKey.banned); - expect(field, isNotNull); - expect(field!.value, isTrue); }); - test('should return ComparableField for user.lastActive', () { - final lastActive = DateTime(2023, 6, 15); - final user = createTestUser( - id: 'test-user', - lastActive: lastActive, + test('banned orders unbanned users first', () { + expectOrders( + UserSortField.banned, + createTestUser(id: 'a', banned: false), + createTestUser(id: 'b', banned: true), ); - - final field = user.getComparableField(UserSortKey.lastActive); - expect(field, isNotNull); - expect(field!.value, equals(lastActive)); }); - test('should return ComparableField for user.extraData', () { - final user = createTestUser( - id: 'test-user', - extraData: {'score': 42}, + test('lastActive orders less recent users first', () { + expectOrders( + UserSortField.lastActive, + createTestUser(id: 'a', lastActive: DateTime(2023, 6, 10)), + createTestUser(id: 'b', lastActive: DateTime(2023, 6, 15)), ); - - final field = user.getComparableField('score'); - expect(field, isNotNull); - expect(field!.value, equals(42)); }); - test('should return null for non-existent extraData keys', () { - final user = createTestUser( - id: 'test-user', + test('a custom field orders by the user extra data', () { + expectOrders( + UserSortField.custom('score'), + createTestUser(id: 'a', extraData: const {'score': 10}), + createTestUser(id: 'b', extraData: const {'score': 90}), ); - - final field = user.getComparableField('non_existent_key'); - expect(field, isNull); }); - test('should compare two users correctly using name', () { - final user1 = createTestUser( - id: 'user1', - name: 'Alice', + test('a custom field the user does not carry orders nothing', () { + expectOrdersNothing( + UserSortField.custom('non_existent_key'), + createTestUser(id: 'plain'), ); - - final user2 = createTestUser( - id: 'user2', - name: 'Bob', - ); - - final field1 = user1.getComparableField(UserSortKey.name); - final field2 = user2.getComparableField(UserSortKey.name); - - expect(field1!.compareTo(field2!), lessThan(0)); // Alice < Bob - expect(field2.compareTo(field1), greaterThan(0)); // Bob > Alice - }); - - test('should compare two users correctly using lastActive', () { - final recentlyActive = createTestUser( - id: 'recent', - lastActive: DateTime(2023, 6, 15), - ); - - final lessRecentlyActive = createTestUser( - id: 'old', - lastActive: DateTime(2023, 6, 10), - ); - - final field1 = recentlyActive.getComparableField(UserSortKey.lastActive); - final field2 = lessRecentlyActive.getComparableField(UserSortKey.lastActive); - - expect(field1!.compareTo(field2!), greaterThan(0)); // More recent > Less recent - expect(field2.compareTo(field1), lessThan(0)); // Less recent < More recent - }); - - test('should compare two users correctly using banned status', () { - final bannedUser = createTestUser( - id: 'banned', - banned: true, - ); - - final notBannedUser = createTestUser( - id: 'not-banned', - banned: false, - ); - - final field1 = bannedUser.getComparableField(UserSortKey.banned); - final field2 = notBannedUser.getComparableField(UserSortKey.banned); - - expect(field1!.compareTo(field2!), greaterThan(0)); // true > false - expect(field2.compareTo(field1), lessThan(0)); // false < true - }); - - test('should fallback to user id when name is null', () { - // The User implementation fallbacks to id when name is null - final user = createTestUser( - id: 'without-name', - name: null, - ); - - final field = user.getComparableField(UserSortKey.name); - expect(field, isNotNull); - expect(field!.value, equals('without-name')); // Fallback to user id }); }); diff --git a/packages/stream_chat/test/src/db/chat_persistence_client_test.dart b/packages/stream_chat/test/src/db/chat_persistence_client_test.dart index 555d13ecd0..ed2ce17d71 100644 --- a/packages/stream_chat/test/src/db/chat_persistence_client_test.dart +++ b/packages/stream_chat/test/src/db/chat_persistence_client_test.dart @@ -1,5 +1,4 @@ import 'package:stream_chat/src/core/api/requests.dart'; -import 'package:stream_chat/src/core/api/sort_order.dart'; import 'package:stream_chat/src/core/models/channel_model.dart'; import 'package:stream_chat/src/core/models/channel_state.dart'; import 'package:stream_chat/src/core/models/draft.dart'; @@ -83,7 +82,7 @@ class TestPersistenceClient extends ChatPersistenceClient { @override Future> getChannelStates({ Filter? filter, - SortOrder? channelStateSort, + List? channelStateSort, int? messageLimit, PaginationParams? paginationParams, }) => throw UnimplementedError(); diff --git a/packages/stream_chat/test/src/utils.dart b/packages/stream_chat/test/src/utils.dart index 00f99785aa..4d07899ad9 100644 --- a/packages/stream_chat/test/src/utils.dart +++ b/packages/stream_chat/test/src/utils.dart @@ -2,6 +2,7 @@ import 'dart:convert'; import 'dart:io'; import 'package:stream_chat/stream_chat.dart'; +import 'package:test/test.dart'; String fixture(String name) { final dir = currentDirectory.path; @@ -53,3 +54,33 @@ UserToken testUserToken(String userId) { final payload = base64.encode(utf8.encode(json.encode({'user_id': userId}))); return UserToken('$header.$payload.$signature'); } + +/// Asserts [field] orders [smaller] before [larger], and reports them equal +/// against themselves. +/// +/// The ordering is the contract a sort field carries — the value it reads to +/// get there is not observable — so this is how a registry entry is checked. +void expectOrders(SortField field, T smaller, T larger) { + final ascending = [Sort.asc(field)]; + expect(ascending.compare(smaller, larger), lessThan(0)); + expect(ascending.compare(larger, smaller), greaterThan(0)); + expect(ascending.compare(smaller, smaller), 0); + + final descending = [Sort.desc(field)]; + expect(descending.compare(smaller, larger), greaterThan(0)); +} + +/// Asserts [field] reads nothing off [instance], so it cannot order a list +/// locally. +/// +/// Pass [other] to also assert two different instances are left unordered — +/// what tells a field reading nothing apart from one reading a fallback. +void expectOrdersNothing( + SortField field, + T instance, [ + T? other, +]) { + final ascending = [Sort.asc(field)]; + expect(ascending.compare(instance, instance), 0); + if (other != null) expect(ascending.compare(instance, other), 0); +} diff --git a/packages/stream_chat_flutter/example/lib/main.dart b/packages/stream_chat_flutter/example/lib/main.dart index b36dd62fb4..5f8e620f99 100644 --- a/packages/stream_chat_flutter/example/lib/main.dart +++ b/packages/stream_chat_flutter/example/lib/main.dart @@ -188,7 +188,7 @@ class _ChannelListPageState extends State { 'members', [StreamChat.of(context).currentUser!.id], ), - channelStateSort: const [SortOption.desc('last_message_at')], + channelStateSort: [ChannelSort.desc(ChannelSortField.lastMessageAt)], limit: 20, ); diff --git a/packages/stream_chat_flutter/example/lib/split_view.dart b/packages/stream_chat_flutter/example/lib/split_view.dart index f6cb40293b..22dd25ba74 100644 --- a/packages/stream_chat_flutter/example/lib/split_view.dart +++ b/packages/stream_chat_flutter/example/lib/split_view.dart @@ -107,7 +107,7 @@ class _ChannelListPageState extends State { 'members', [StreamChat.of(context).currentUser!.id], ), - channelStateSort: const [SortOption.desc('last_message_at')], + channelStateSort: [ChannelSort.desc(ChannelSortField.lastMessageAt)], limit: 20, ); diff --git a/packages/stream_chat_flutter/example/lib/tutorial_part_2.dart b/packages/stream_chat_flutter/example/lib/tutorial_part_2.dart index 78a29a7178..9edb10e331 100644 --- a/packages/stream_chat_flutter/example/lib/tutorial_part_2.dart +++ b/packages/stream_chat_flutter/example/lib/tutorial_part_2.dart @@ -84,7 +84,7 @@ class _ChannelListPageState extends State { 'members', [StreamChat.of(context).currentUser!.id], ), - channelStateSort: const [SortOption.desc('last_message_at')], + channelStateSort: [ChannelSort.desc(ChannelSortField.lastMessageAt)], ); @override diff --git a/packages/stream_chat_flutter/example/lib/tutorial_part_3.dart b/packages/stream_chat_flutter/example/lib/tutorial_part_3.dart index 571f3a5be1..a1e20d1d33 100644 --- a/packages/stream_chat_flutter/example/lib/tutorial_part_3.dart +++ b/packages/stream_chat_flutter/example/lib/tutorial_part_3.dart @@ -87,7 +87,7 @@ class _ChannelListPageState extends State { 'members', [StreamChat.of(context).currentUser!.id], ), - channelStateSort: const [SortOption.desc('last_message_at')], + channelStateSort: [ChannelSort.desc(ChannelSortField.lastMessageAt)], limit: 20, ); diff --git a/packages/stream_chat_flutter/example/lib/tutorial_part_4.dart b/packages/stream_chat_flutter/example/lib/tutorial_part_4.dart index 22db678bc1..882369fc0d 100644 --- a/packages/stream_chat_flutter/example/lib/tutorial_part_4.dart +++ b/packages/stream_chat_flutter/example/lib/tutorial_part_4.dart @@ -73,7 +73,7 @@ class _ChannelListPageState extends State { 'members', [StreamChat.of(context).currentUser!.id], ), - channelStateSort: const [SortOption.desc('last_message_at')], + channelStateSort: [ChannelSort.desc(ChannelSortField.lastMessageAt)], limit: 20, ); diff --git a/packages/stream_chat_flutter/example/lib/tutorial_part_5.dart b/packages/stream_chat_flutter/example/lib/tutorial_part_5.dart index b786a53ce5..21d4687ac4 100644 --- a/packages/stream_chat_flutter/example/lib/tutorial_part_5.dart +++ b/packages/stream_chat_flutter/example/lib/tutorial_part_5.dart @@ -78,7 +78,7 @@ class _ChannelListPageState extends State { 'members', [StreamChat.of(context).currentUser!.id], ), - channelStateSort: const [SortOption.desc('last_message_at')], + channelStateSort: [ChannelSort.desc(ChannelSortField.lastMessageAt)], limit: 20, ); diff --git a/packages/stream_chat_flutter/example/lib/tutorial_part_6.dart b/packages/stream_chat_flutter/example/lib/tutorial_part_6.dart index 42dda0f50a..4036988df8 100644 --- a/packages/stream_chat_flutter/example/lib/tutorial_part_6.dart +++ b/packages/stream_chat_flutter/example/lib/tutorial_part_6.dart @@ -109,7 +109,7 @@ class _ChannelListPageState extends State { 'members', [StreamChat.of(context).currentUser!.id], ), - channelStateSort: const [SortOption.desc('last_message_at')], + channelStateSort: [ChannelSort.desc(ChannelSortField.lastMessageAt)], limit: 20, ); diff --git a/packages/stream_chat_flutter/example/pubspec.yaml b/packages/stream_chat_flutter/example/pubspec.yaml index 702d735ff7..4192f1d40f 100644 --- a/packages/stream_chat_flutter/example/pubspec.yaml +++ b/packages/stream_chat_flutter/example/pubspec.yaml @@ -40,6 +40,12 @@ dependency_overrides: path: ../../stream_chat_localizations stream_chat_persistence: path: ../../stream_chat_persistence + # Forces one source for `stream_core`; see `melos.yaml`. + stream_core: + git: + url: https://github.com/GetStream/stream-core-flutter.git + path: packages/stream_core + ref: 04e0d1cb3a6893cf70cb6636a261deb11beff81c flutter: uses-material-design: true diff --git a/packages/stream_chat_flutter/lib/src/autocomplete/stream_mention_autocomplete_options.dart b/packages/stream_chat_flutter/lib/src/autocomplete/stream_mention_autocomplete_options.dart index d4ee248cc4..2a384d1b68 100644 --- a/packages/stream_chat_flutter/lib/src/autocomplete/stream_mention_autocomplete_options.dart +++ b/packages/stream_chat_flutter/lib/src/autocomplete/stream_mention_autocomplete_options.dart @@ -287,7 +287,7 @@ class _StreamMentionAutocompleteOptionsState extends State { _controller = .new( client: StreamChat.of(context).client, messageId: widget.message.id, - sort: const [.desc(ReactionSortKey.createdAt)], + sort: ReactionSort.defaultSort, filter: switch (_currentReactionType) { final type? => .equal('type', type), _ => null, diff --git a/packages/stream_chat_flutter/pubspec.yaml b/packages/stream_chat_flutter/pubspec.yaml index 2371134586..9f521f112e 100644 --- a/packages/stream_chat_flutter/pubspec.yaml +++ b/packages/stream_chat_flutter/pubspec.yaml @@ -67,7 +67,7 @@ dependencies: # ignore: invalid_dependency git: url: https://github.com/GetStream/stream-core-flutter.git - ref: b994522cf5cd495a24c65055cccffe3a5c8056da + ref: 04e0d1cb3a6893cf70cb6636a261deb11beff81c path: packages/stream_core_flutter stream_thumbnail: # The ignore below silences `invalid_dependency` because we occasionally @@ -117,3 +117,11 @@ platforms: macos: web: windows: + +dependency_overrides: + # Forces one source for `stream_core`; see `melos.yaml`. + stream_core: + git: + url: https://github.com/GetStream/stream-core-flutter.git + path: packages/stream_core + ref: 04e0d1cb3a6893cf70cb6636a261deb11beff81c diff --git a/packages/stream_chat_flutter_core/CHANGELOG.md b/packages/stream_chat_flutter_core/CHANGELOG.md index fcc4320e50..ef5eb66599 100644 --- a/packages/stream_chat_flutter_core/CHANGELOG.md +++ b/packages/stream_chat_flutter_core/CHANGELOG.md @@ -3,6 +3,12 @@ 🛑️ Breaking - `PagedValue.error` and every `errorBuilder` now carry a `StreamChatException` instead of a `StreamChatError`, following the low-level client's error layer. A generic throwable is reported as a `StreamClientException` naming the load that failed, with the original kept as its `cause` rather than stringified into the message. +- The sort argument on every list controller is typed `List`, `List` and so on, rather than `SortOrder`. On the controllers that have a default, the `sort` property is non-nullable: leaving it unset selects that default, and `ChannelSort.empty` / `MemberSort.empty` / … query with the ordering the API applies on its own. +- `defaultChannelListSort`, `defaultMemberListSort`, `defaultUserListSort`, `defaultDraftListSort`, `defaultMessageReminderListSort` and `defaultPollVoteListSort` are removed. Use `ChannelSort.defaultSort`, `MemberSort.defaultSort` and so on from `stream_chat`. Leaving a controller's sort unset still applies the same ordering. + +🐞 Fixed + +- A list controller sorted each loaded page with an unstable sort, so rows it called equal — members sharing a `created_at`, say — were reordered on every page append. They keep the order they arrived in now. ## 10.4.0 diff --git a/packages/stream_chat_flutter_core/lib/src/stream_channel.dart b/packages/stream_chat_flutter_core/lib/src/stream_channel.dart index 66c483c2a7..0841f4065b 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_channel.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_channel.dart @@ -725,7 +725,7 @@ class StreamChannelState extends State { /// Query channel members. Future> queryMembers({ Filter? filter, - SortOrder? sort, + List? sort, PaginationParams? pagination, }) async { final response = await channel.queryMembers( diff --git a/packages/stream_chat_flutter_core/lib/src/stream_channel_list_controller.dart b/packages/stream_chat_flutter_core/lib/src/stream_channel_list_controller.dart index 35cfe32be3..22b8e9f3ce 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_channel_list_controller.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_channel_list_controller.dart @@ -1,19 +1,15 @@ import 'dart:async'; import 'dart:math'; -import 'package:collection/collection.dart'; import 'package:stream_chat/stream_chat.dart' hide Success; +import 'package:stream_core/stream_core.dart' show SortedListExtensions; + import 'paged_value_notifier.dart'; import 'stream_channel_list_event_handler.dart'; /// The default channel page limit to load. const defaultChannelPagedLimit = 10; -/// The default sort used for the channel list. -const defaultChannelListSort = [ - SortOption.desc(ChannelSortKey.lastUpdated), -]; - const _kDefaultBackendPaginationLimit = 30; /// A controller for a Channel list. @@ -59,7 +55,7 @@ class StreamChannelListController extends PagedValueNotifier { required this.client, StreamChannelListEventHandler? eventHandler, this.filter, - this.channelStateSort = defaultChannelListSort, + List? channelStateSort, this.predefinedFilter, this.filterValues, this.sortValues, @@ -68,7 +64,7 @@ class StreamChannelListController extends PagedValueNotifier { this.messageLimit, this.memberLimit, }) : _eventHandler = eventHandler ?? StreamChannelListEventHandler(), - _resolvedChannelStateSort = channelStateSort, + channelStateSort = channelStateSort ?? ChannelSort.defaultSort, super(const PagedValue.loading()); /// Creates a [StreamChannelListController] from the passed [value]. @@ -77,7 +73,7 @@ class StreamChannelListController extends PagedValueNotifier { required this.client, StreamChannelListEventHandler? eventHandler, this.filter, - this.channelStateSort = defaultChannelListSort, + List? channelStateSort, this.predefinedFilter, this.filterValues, this.sortValues, @@ -86,7 +82,7 @@ class StreamChannelListController extends PagedValueNotifier { this.messageLimit, this.memberLimit, }) : _eventHandler = eventHandler ?? StreamChannelListEventHandler(), - _resolvedChannelStateSort = channelStateSort; + channelStateSort = channelStateSort ?? ChannelSort.defaultSort; /// The client to use for the channels list. final StreamChatClient client; @@ -110,14 +106,17 @@ class StreamChannelListController extends PagedValueNotifier { /// created_at or member_count. /// /// Direction can be ascending or descending. - final SortOrder? channelStateSort; + /// + /// Defaults to [ChannelSort.defaultSort]; pass [ChannelSort.empty] to leave + /// the ordering to the API. + final List channelStateSort; /// The sort actually applied to incoming events. Seeded from /// [channelStateSort] and overwritten whenever a query response carries a /// resolved [PredefinedFilter.sort], so event-driven inserts keep matching /// the server-resolved order even when callers only specify /// [predefinedFilter]. - SortOrder? _resolvedChannelStateSort; + late List _resolvedChannelStateSort = channelStateSort; /// Identifier of a server-side predefined filter to query channels with. /// @@ -149,27 +148,28 @@ class StreamChannelListController extends PagedValueNotifier { @override set value(PagedValue newValue) { - super.value = switch (_resolvedChannelStateSort) { - null => newValue, - final channelSort => newValue.maybeMap( - orElse: () => newValue, - (success) => success.copyWith( - items: success.items.sortedByCompare( - // A channel loses its state when it is disposed — e.g. a client - // disconnect/logout or a channel-removal event racing an - // in-flight query — so sort stateless channels last instead of - // null-asserting on them. - (it) => it.state?.channelState, - (a, b) => switch ((a, b)) { - (null, null) => 0, - (null, _) => 1, - (_, null) => -1, - (final a?, final b?) => channelSort.compare(a, b), - }, - ), - ), + super.value = newValue.maybeMap( + orElse: () => newValue, + (success) => success.copyWith( + items: success.items.sortedWith(_compareByState), ), - }; + ); + } + + // A channel loses its state when it is disposed — a client disconnect or + // logout, or a channel-removal event racing an in-flight query. It is no + // longer a row the list can order, so it goes last rather than wherever the + // leading field's null ordering would put it. + int _compareByState(Channel a, Channel b) { + final aState = a.state?.channelState; + final bState = b.state?.channelState; + + // Handle disposed channels first, independent of sort direction. + if (aState == null && bState == null) return 0; + if (aState == null) return 1; + if (bState == null) return -1; + + return _resolvedChannelStateSort.compare(aState, bState); } @override @@ -243,11 +243,11 @@ class StreamChannelListController extends PagedValueNotifier { } void _resolveSort(QueryChannelsResult result) { - final predefinedFilter = result.predefinedFilter; + final resolved = result.predefinedFilter; // Update the active sort only when predefinedFilter is present, // otherwise use the initially set sort. - if (predefinedFilter == null) return; - _resolvedChannelStateSort = predefinedFilter.effectiveSort; + if (resolved == null) return; + _resolvedChannelStateSort = resolved.effectiveSort; } @override diff --git a/packages/stream_chat_flutter_core/lib/src/stream_draft_list_controller.dart b/packages/stream_chat_flutter_core/lib/src/stream_draft_list_controller.dart index e95a06cbd0..6010f18abe 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_draft_list_controller.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_draft_list_controller.dart @@ -1,19 +1,14 @@ import 'dart:async'; import 'dart:math'; -import 'package:collection/collection.dart'; import 'package:stream_chat/stream_chat.dart'; +import 'package:stream_core/stream_core.dart' show SortedListExtensions; import 'paged_value_notifier.dart'; import 'stream_draft_list_event_handler.dart'; /// The default channel page limit to load. const defaultDraftPagedLimit = 10; -/// The default sort used for the draft list. -const defaultDraftListSort = [ - SortOption.desc(DraftSortKey.createdAt), -]; - const _kDefaultBackendPaginationLimit = 30; /// {@template streamDraftListController} @@ -32,10 +27,10 @@ class StreamDraftListController extends PagedValueNotifier { required this.client, StreamDraftListEventHandler? eventHandler, this.filter, - this.sort = defaultDraftListSort, + List? sort, this.limit = defaultDraftPagedLimit, }) : _activeFilter = filter, - _activeSort = sort, + sort = sort ?? DraftSort.defaultSort, _eventHandler = eventHandler ?? StreamDraftListEventHandler(), super(const PagedValue.loading()); @@ -45,10 +40,10 @@ class StreamDraftListController extends PagedValueNotifier { required this.client, StreamDraftListEventHandler? eventHandler, this.filter, - this.sort = defaultDraftListSort, + List? sort, this.limit = defaultDraftPagedLimit, }) : _activeFilter = filter, - _activeSort = sort, + sort = sort ?? DraftSort.defaultSort, _eventHandler = eventHandler ?? StreamDraftListEventHandler(); /// The Stream client used to perform the queries. @@ -70,8 +65,11 @@ class StreamDraftListController extends PagedValueNotifier { /// can be provided. /// /// Direction can be ascending or descending. - final SortOrder? sort; - SortOrder? _activeSort; + /// + /// Defaults to [DraftSort.defaultSort]; pass [DraftSort.empty] to leave the ordering + /// to the API. + final List sort; + late List _activeSort = sort; /// The limit to apply to the poll vote list. The default is set to /// [defaultPollVotePagedLimit]. @@ -87,19 +85,16 @@ class StreamDraftListController extends PagedValueNotifier { /// /// Use this if you need to support runtime sort changes, /// through custom sort UI. - set sort(SortOrder? value) => _activeSort = value; + set sort(List value) => _activeSort = value; @override set value(PagedValue newValue) { - super.value = switch (_activeSort) { - null => newValue, - final draftSort => newValue.maybeMap( - orElse: () => newValue, - (success) => success.copyWith( - items: success.items.sorted(draftSort.compare), - ), + super.value = newValue.maybeMap( + orElse: () => newValue, + (success) => success.copyWith( + items: success.items.sortedWith(_activeSort.compare), ), - }; + ); } @override diff --git a/packages/stream_chat_flutter_core/lib/src/stream_member_list_controller.dart b/packages/stream_chat_flutter_core/lib/src/stream_member_list_controller.dart index 5e10b7164d..4bf0de6f86 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_member_list_controller.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_member_list_controller.dart @@ -1,8 +1,8 @@ import 'dart:async'; import 'dart:math'; -import 'package:collection/collection.dart'; import 'package:stream_chat/stream_chat.dart' hide Success; +import 'package:stream_core/stream_core.dart' show SortedListExtensions; import 'paged_value_notifier.dart'; import 'search_debounce_mixin.dart'; import 'search_debouncer.dart'; @@ -10,11 +10,6 @@ import 'search_debouncer.dart'; /// The default channel page limit to load. const defaultMemberPagedLimit = 10; -/// The default sort used for the member list. -const defaultMemberListSort = [ - SortOption.asc(MemberSortKey.createdAt), -]; - const _kDefaultBackendPaginationLimit = 30; /// A controller for a member list. @@ -37,10 +32,10 @@ class StreamMemberListController extends PagedValueNotifier with Se StreamMemberListController({ required this.channel, this.filter, - this.sort = defaultMemberListSort, + List? sort, this.limit = defaultMemberPagedLimit, }) : _activeFilter = filter, - _activeSort = sort, + sort = sort ?? MemberSort.defaultSort, super(const PagedValue.loading()); /// Creates a [StreamMemberListController] from the passed [value]. @@ -48,10 +43,10 @@ class StreamMemberListController extends PagedValueNotifier with Se super.value, { required this.channel, this.filter, - this.sort = defaultMemberListSort, + List? sort, this.limit = defaultMemberPagedLimit, }) : _activeFilter = filter, - _activeSort = sort; + sort = sort ?? MemberSort.defaultSort; /// The client to use for the channels list. final Channel channel; @@ -70,8 +65,11 @@ class StreamMemberListController extends PagedValueNotifier with Se /// can be provided. /// /// Direction can be ascending or descending. - final SortOrder? sort; - SortOrder? _activeSort; + /// + /// Defaults to [MemberSort.defaultSort]; pass [MemberSort.empty] to leave the ordering + /// to the API. + final List sort; + late List _activeSort = sort; /// The limit to apply to the member list. The default is set to /// [defaultMemberPagedLimit]. @@ -93,7 +91,7 @@ class StreamMemberListController extends PagedValueNotifier with Se /// /// Note: This will not trigger a new query. make sure to call /// [doInitialLoad] after setting a new sort. - set sort(SortOrder? value) => _activeSort = value; + set sort(List value) => _activeSort = value; /// Searches members whose name matches [query], debounced by its length. /// @@ -127,15 +125,12 @@ class StreamMemberListController extends PagedValueNotifier with Se @override set value(PagedValue newValue) { - super.value = switch (_activeSort) { - null => newValue, - final memberSort => newValue.maybeMap( - orElse: () => newValue, - (success) => success.copyWith( - items: success.items.sorted(memberSort.compare), - ), + super.value = newValue.maybeMap( + orElse: () => newValue, + (success) => success.copyWith( + items: success.items.sortedWith(_activeSort.compare), ), - }; + ); } @override diff --git a/packages/stream_chat_flutter_core/lib/src/stream_message_reminder_list_controller.dart b/packages/stream_chat_flutter_core/lib/src/stream_message_reminder_list_controller.dart index dde63416fd..b7f67122f2 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_message_reminder_list_controller.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_message_reminder_list_controller.dart @@ -3,19 +3,14 @@ import 'dart:async'; import 'dart:math'; -import 'package:collection/collection.dart'; import 'package:stream_chat/stream_chat.dart'; +import 'package:stream_core/stream_core.dart' show SortedListExtensions; import 'paged_value_notifier.dart'; import 'stream_message_reminder_list_event_handler.dart'; /// The default message reminder page limit to load. const defaultMessageReminderPagedLimit = 10; -/// The default sort used for the message reminder list. -const defaultMessageReminderListSort = [ - SortOption.asc(MessageReminderSortKey.remindAt), -]; - const _kDefaultBackendPaginationLimit = 30; /// {@template streamMessageReminderListController} @@ -35,10 +30,10 @@ class StreamMessageReminderListController extends PagedValueNotifier? sort, this.limit = defaultMessageReminderPagedLimit, }) : _activeFilter = filter, - _activeSort = sort, + sort = sort ?? MessageReminderSort.defaultSort, _eventHandler = eventHandler ?? StreamMessageReminderListEventHandler(), super(const PagedValue.loading()); @@ -48,10 +43,10 @@ class StreamMessageReminderListController extends PagedValueNotifier? sort, this.limit = defaultMessageReminderPagedLimit, }) : _activeFilter = filter, - _activeSort = sort, + sort = sort ?? MessageReminderSort.defaultSort, _eventHandler = eventHandler ?? StreamMessageReminderListEventHandler(); /// The Stream client used to perform the queries. @@ -73,8 +68,11 @@ class StreamMessageReminderListController extends PagedValueNotifier? sort; - SortOrder? _activeSort; + /// + /// Defaults to [MessageReminderSort.defaultSort]; pass [MessageReminderSort.empty] to leave the ordering + /// to the API. + final List sort; + late List _activeSort = sort; /// The limit to apply to the message reminder list. The default is set to /// [defaultMessageReminderPagedLimit]. @@ -90,19 +88,16 @@ class StreamMessageReminderListController extends PagedValueNotifier? value) => _activeSort = value; + set sort(List value) => _activeSort = value; @override set value(PagedValue newValue) { - super.value = switch (_activeSort) { - null => newValue, - final reminderSort => newValue.maybeMap( - orElse: () => newValue, - (success) => success.copyWith( - items: success.items.sorted(reminderSort.compare), - ), + super.value = newValue.maybeMap( + orElse: () => newValue, + (success) => success.copyWith( + items: success.items.sortedWith(_activeSort.compare), ), - }; + ); } @override diff --git a/packages/stream_chat_flutter_core/lib/src/stream_message_search_list_controller.dart b/packages/stream_chat_flutter_core/lib/src/stream_message_search_list_controller.dart index 066f27b80e..3787859e4a 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_message_search_list_controller.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_message_search_list_controller.dart @@ -101,8 +101,8 @@ class StreamMessageSearchListController extends PagedValueNotifier? sort; + List? _activeSort; /// The limit to apply to the message search. The default is set to /// [defaultMessageSearchPagedLimit]. @@ -142,7 +142,7 @@ class StreamMessageSearchListController extends PagedValueNotifier _activeSort = value; + set sort(List? value) => _activeSort = value; /// Searches messages whose text matches [query], debounced by its length. /// diff --git a/packages/stream_chat_flutter_core/lib/src/stream_poll_vote_list_controller.dart b/packages/stream_chat_flutter_core/lib/src/stream_poll_vote_list_controller.dart index ae1fd835d9..eb0f1feef7 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_poll_vote_list_controller.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_poll_vote_list_controller.dart @@ -1,18 +1,13 @@ import 'dart:async'; import 'dart:math'; -import 'package:collection/collection.dart'; import 'package:stream_chat/stream_chat.dart'; +import 'package:stream_core/stream_core.dart' show SortedListExtensions; import 'paged_value_notifier.dart'; /// The default channel page limit to load. const defaultPollVotePagedLimit = 10; -/// The default sort used for the poll vote list. -const defaultPollVoteListSort = [ - SortOption.asc(PollVoteSortKey.createdAt), -]; - const _kDefaultBackendPaginationLimit = 30; /// A controller for a poll vote list. @@ -33,11 +28,11 @@ class StreamPollVoteListController extends PagedValueNotifier required this.pollId, StreamPollVoteEventHandler? eventHandler, this.filter, - this.sort = defaultPollVoteListSort, + List? sort, this.limit = defaultPollVotePagedLimit, }) : _eventHandler = eventHandler ?? StreamPollVoteEventHandler(), _activeFilter = filter, - _activeSort = sort, + sort = sort ?? PollVoteSort.defaultSort, super(const PagedValue.loading()); /// Creates a [StreamPollVoteListController] from the passed [value]. @@ -47,11 +42,11 @@ class StreamPollVoteListController extends PagedValueNotifier required this.pollId, StreamPollVoteEventHandler? eventHandler, this.filter, - this.sort = defaultPollVoteListSort, + List? sort, this.limit = defaultPollVotePagedLimit, }) : _eventHandler = eventHandler ?? StreamPollVoteEventHandler(), _activeFilter = filter, - _activeSort = sort; + sort = sort ?? PollVoteSort.defaultSort; /// The channel to use for the poll votes list. final Channel channel; @@ -75,8 +70,11 @@ class StreamPollVoteListController extends PagedValueNotifier /// can be provided. /// /// Direction can be ascending or descending. - final SortOrder? sort; - SortOrder? _activeSort; + /// + /// Defaults to [PollVoteSort.defaultSort]; pass [PollVoteSort.empty] to leave the ordering + /// to the API. + final List sort; + late List _activeSort = sort; /// The limit to apply to the poll vote list. The default is set to /// [defaultPollVotePagedLimit]. @@ -98,19 +96,16 @@ class StreamPollVoteListController extends PagedValueNotifier /// /// Note: This will not trigger a new query. make sure to call /// [doInitialLoad] after setting a new sort. - set sort(SortOrder? value) => _activeSort = value; + set sort(List value) => _activeSort = value; @override set value(PagedValue newValue) { - super.value = switch (_activeSort) { - null => newValue, - final pollVoteSort => newValue.maybeMap( - orElse: () => newValue, - (success) => success.copyWith( - items: success.items.sorted(pollVoteSort.compare), - ), + super.value = newValue.maybeMap( + orElse: () => newValue, + (success) => success.copyWith( + items: success.items.sortedWith(_activeSort.compare), ), - }; + ); } @override diff --git a/packages/stream_chat_flutter_core/lib/src/stream_reaction_list_controller.dart b/packages/stream_chat_flutter_core/lib/src/stream_reaction_list_controller.dart index d6a125f831..b60f950e66 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_reaction_list_controller.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_reaction_list_controller.dart @@ -1,8 +1,8 @@ import 'dart:async'; import 'dart:math'; -import 'package:collection/collection.dart'; import 'package:stream_chat/stream_chat.dart' hide Success; +import 'package:stream_core/stream_core.dart' show SortedListExtensions; import 'paged_value_notifier.dart'; /// The default reaction list page limit to load. @@ -61,11 +61,11 @@ class StreamReactionListController extends PagedValueNotifier /// The sorting used for the reactions matching the filters. /// /// Sorting is based on field and direction. The only backend-supported sort - /// field is `created_at` (see [ReactionSortKey]). + /// field is `created_at` (see [ReactionSortField]). /// /// Direction can be ascending or descending. - final SortOrder? sort; - SortOrder? _activeSort; + final List? sort; + List? _activeSort; /// The limit to apply to the reaction list. /// @@ -88,7 +88,7 @@ class StreamReactionListController extends PagedValueNotifier /// /// Note: This will not trigger a new query. Make sure to call /// [doInitialLoad] or [refresh] after setting a new sort. - set sort(SortOrder? value) => _activeSort = value; + set sort(List? value) => _activeSort = value; @override set value(PagedValue newValue) { @@ -97,7 +97,7 @@ class StreamReactionListController extends PagedValueNotifier final reactionSort => newValue.maybeMap( orElse: () => newValue, (success) => success.copyWith( - items: success.items.sorted(reactionSort.compare), + items: success.items.sortedWith(reactionSort.compare), ), ), }; diff --git a/packages/stream_chat_flutter_core/lib/src/stream_thread_list_controller.dart b/packages/stream_chat_flutter_core/lib/src/stream_thread_list_controller.dart index 8f7125948b..b3c7709ab2 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_thread_list_controller.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_thread_list_controller.dart @@ -4,6 +4,7 @@ import 'dart:math'; import 'package:collection/collection.dart'; import 'package:flutter/foundation.dart'; import 'package:stream_chat/stream_chat.dart'; +import 'package:stream_core/stream_core.dart' show SortedListExtensions; import 'paged_value_notifier.dart'; import 'stream_thread_list_event_handler.dart'; @@ -67,8 +68,8 @@ class StreamThreadListController extends PagedValueNotifier { /// can be provided. /// /// Direction can be ascending or descending. - final SortOrder? sort; - SortOrder? _activeSort; + final List? sort; + List? _activeSort; /// The limit to apply to the thread list. /// @@ -97,7 +98,7 @@ class StreamThreadListController extends PagedValueNotifier { /// /// Note: This will not trigger a new query. make sure to call /// [doInitialLoad] after setting a new sort. - set sort(SortOrder? value) => _activeSort = value; + set sort(List? value) => _activeSort = value; /// Allows for the change of the [options] at runtime. /// @@ -131,7 +132,7 @@ class StreamThreadListController extends PagedValueNotifier { final threadSort => newValue.maybeMap( orElse: () => newValue, (success) => success.copyWith( - items: success.items.sorted(threadSort.compare), + items: success.items.sortedWith(threadSort.compare), ), ), }; diff --git a/packages/stream_chat_flutter_core/lib/src/stream_user_list_controller.dart b/packages/stream_chat_flutter_core/lib/src/stream_user_list_controller.dart index 3ed264c9f8..da919e3659 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_user_list_controller.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_user_list_controller.dart @@ -1,8 +1,8 @@ import 'dart:async'; import 'dart:math'; -import 'package:collection/collection.dart'; import 'package:stream_chat/stream_chat.dart' hide Success; +import 'package:stream_core/stream_core.dart' show SortedListExtensions; import 'paged_value_notifier.dart'; import 'search_debounce_mixin.dart'; import 'search_debouncer.dart'; @@ -10,11 +10,6 @@ import 'search_debouncer.dart'; /// The default channel page limit to load. const defaultUserPagedLimit = 10; -/// The default sort used for the user list. -const defaultUserListSort = [ - SortOption.desc(UserSortKey.createdAt), -]; - const _kDefaultBackendPaginationLimit = 30; /// A controller for a user list. @@ -40,11 +35,11 @@ class StreamUserListController extends PagedValueNotifier with Search StreamUserListController({ required this.client, this.filter, - this.sort = defaultUserListSort, + List? sort, this.presence = true, this.limit = defaultUserPagedLimit, }) : _activeFilter = filter, - _activeSort = sort, + sort = sort ?? UserSort.defaultSort, super(const PagedValue.loading()); /// Creates a [StreamUserListController] from the passed [value]. @@ -52,11 +47,11 @@ class StreamUserListController extends PagedValueNotifier with Search super.value, { required this.client, this.filter, - this.sort = defaultUserListSort, + List? sort, this.presence = true, this.limit = defaultUserPagedLimit, }) : _activeFilter = filter, - _activeSort = sort; + sort = sort ?? UserSort.defaultSort; /// The client to use for the channels list. final StreamChatClient client; @@ -75,8 +70,11 @@ class StreamUserListController extends PagedValueNotifier with Search /// can be provided. /// /// Direction can be ascending or descending. - final SortOrder? sort; - SortOrder? _activeSort; + /// + /// Defaults to [UserSort.defaultSort]; pass [UserSort.empty] to leave the ordering + /// to the API. + final List sort; + late List _activeSort = sort; /// If true you’ll receive user presence updates via the websocket events final bool presence; @@ -101,7 +99,7 @@ class StreamUserListController extends PagedValueNotifier with Search /// /// Note: This will not trigger a new query. make sure to call /// [doInitialLoad] after setting a new sort. - set sort(SortOrder? value) => _activeSort = value; + set sort(List value) => _activeSort = value; /// Searches users whose name or id matches [query], debounced by its length. /// @@ -138,15 +136,12 @@ class StreamUserListController extends PagedValueNotifier with Search @override set value(PagedValue newValue) { - super.value = switch (_activeSort) { - null => newValue, - final userSort => newValue.maybeMap( - orElse: () => newValue, - (success) => success.copyWith( - items: success.items.sorted(userSort.compare), - ), + super.value = newValue.maybeMap( + orElse: () => newValue, + (success) => success.copyWith( + items: success.items.sortedWith(_activeSort.compare), ), - }; + ); } @override diff --git a/packages/stream_chat_flutter_core/pubspec.yaml b/packages/stream_chat_flutter_core/pubspec.yaml index f4b1ef3dea..81d96ea54f 100644 --- a/packages/stream_chat_flutter_core/pubspec.yaml +++ b/packages/stream_chat_flutter_core/pubspec.yaml @@ -33,6 +33,11 @@ dependencies: rate_limiter: ^1.1.0 rxdart: ^0.28.0 stream_chat: ^10.4.0 + stream_core: + git: + url: https://github.com/GetStream/stream-core-flutter.git + ref: 04e0d1cb3a6893cf70cb6636a261deb11beff81c + path: packages/stream_core dev_dependencies: build_runner: ^2.15.0 diff --git a/packages/stream_chat_flutter_core/test/stream_channel_list_controller_test.dart b/packages/stream_chat_flutter_core/test/stream_channel_list_controller_test.dart index 638d09f6a9..30918efc23 100644 --- a/packages/stream_chat_flutter_core/test/stream_channel_list_controller_test.dart +++ b/packages/stream_chat_flutter_core/test/stream_channel_list_controller_test.dart @@ -11,6 +11,15 @@ import 'package:stream_chat_flutter_core/src/stream_channel_list_event_handler.d import 'mocks.dart'; +// The controller sorts locally by default, and the sort reads `channelState` +// off every channel. Tests that only care about which channels came back stub +// them identically, so the stable sort preserves the order they were given in. +MockChannel unsortedMockChannel() { + final channel = MockChannel(); + when(() => channel.state.channelState).thenReturn(const ChannelState()); + return channel; +} + void main() { setUpAll(() { registerFallbackValue(const PaginationParams()); @@ -30,7 +39,7 @@ void main() { Future buildController({ List channels = const [], Filter? filter, - SortOrder? channelStateSort = defaultChannelListSort, + List? channelStateSort, String? predefinedFilter, Map? filterValues, Map? sortValues, @@ -80,7 +89,7 @@ void main() { test('doInitialLoad forwards inline filter and sort to queryChannels', () async { final filter = Filter.in_('members', const ['u1']); - const sort = [SortOption.desc(ChannelSortKey.lastMessageAt)]; + final sort = [ChannelSort.desc(ChannelSortField.lastMessageAt)]; await buildController(filter: filter, channelStateSort: sort); @@ -114,7 +123,7 @@ void main() { verify( () => client.queryChannelsWithResult( filter: null, - channelStateSort: null, + channelStateSort: ChannelSort.defaultSort, predefinedFilter: presetName, filterValues: filterValues, sortValues: sortValues, @@ -162,8 +171,8 @@ void main() { final filter = Filter.in_('members', const ['u1']); const nextPageKey = 2; - final existing = [MockChannel(), MockChannel()]; - final fetched = [MockChannel()]; + final existing = [unsortedMockChannel(), unsortedMockChannel()]; + final fetched = [unsortedMockChannel()]; when( () => client.queryChannelsWithResult( @@ -186,7 +195,6 @@ void main() { ), client: client, filter: filter, - channelStateSort: null, ); await controller.loadMore(nextPageKey); @@ -200,7 +208,7 @@ void main() { final captured = verify( () => client.queryChannelsWithResult( filter: filter, - channelStateSort: null, + channelStateSort: ChannelSort.defaultSort, predefinedFilter: null, filterValues: null, sortValues: null, @@ -221,8 +229,8 @@ void main() { const sortValues = {'preset': 'recent'}; const nextPageKey = 2; - final existing = [MockChannel(), MockChannel()]; - final fetched = [MockChannel()]; + final existing = [unsortedMockChannel(), unsortedMockChannel()]; + final fetched = [unsortedMockChannel()]; when( () => client.queryChannelsWithResult( @@ -261,7 +269,7 @@ void main() { final captured = verify( () => client.queryChannelsWithResult( filter: null, - channelStateSort: null, + channelStateSort: ChannelSort.defaultSort, predefinedFilter: presetName, filterValues: filterValues, sortValues: sortValues, @@ -293,7 +301,7 @@ void main() { final controller = StreamChannelListController( client: client, - channelStateSort: defaultChannelListSort, + channelStateSort: ChannelSort.defaultSort, ); expect( diff --git a/packages/stream_chat_flutter_core/test/stream_draft_list_controller_test.dart b/packages/stream_chat_flutter_core/test/stream_draft_list_controller_test.dart index fac4378266..017a3a999e 100644 --- a/packages/stream_chat_flutter_core/test/stream_draft_list_controller_test.dart +++ b/packages/stream_chat_flutter_core/test/stream_draft_list_controller_test.dart @@ -607,10 +607,83 @@ void main() { }); group('Filtering and sorting', () { + test('an unset sort queries with the default sort', () async { + final sorts = []; + + when( + () => client.queryDrafts( + filter: any(named: 'filter'), + sort: any(named: 'sort'), + pagination: any(named: 'pagination'), + ), + ).thenAnswer((invocation) async { + sorts.add(invocation.namedArguments[const Symbol('sort')]); + return QueryDraftsResponse() + ..drafts = generateDrafts() + ..next = ''; + }); + + final controller = StreamDraftListController(client: client); + + await controller.doInitialLoad(); + await pumpEventQueue(); + + expect(sorts.single, equals(DraftSort.defaultSort)); + }); + + test('an empty sort queries without a sort term', () async { + final sorts = []; + + when( + () => client.queryDrafts( + filter: any(named: 'filter'), + sort: any(named: 'sort'), + pagination: any(named: 'pagination'), + ), + ).thenAnswer((invocation) async { + sorts.add(invocation.namedArguments[const Symbol('sort')]); + return QueryDraftsResponse() + ..drafts = generateDrafts() + ..next = ''; + }); + + final controller = StreamDraftListController(client: client, sort: DraftSort.empty); + + await controller.doInitialLoad(); + await pumpEventQueue(); + + expect(sorts.single, isEmpty); + }); + + test('an empty sort leaves a page in the order it arrived in', () async { + // The default sort is newest-first, so an oldest-first page comes back + // reordered unless the empty sort is left alone. + final oldestFirst = generateDrafts(count: 50).reversed.toList(); + + when( + () => client.queryDrafts( + filter: any(named: 'filter'), + sort: any(named: 'sort'), + pagination: any(named: 'pagination'), + ), + ).thenAnswer( + (_) async => QueryDraftsResponse() + ..drafts = oldestFirst + ..next = '', + ); + + final controller = StreamDraftListController(client: client, sort: DraftSort.empty); + + await controller.doInitialLoad(); + await pumpEventQueue(); + + expect(controller.value.asSuccess.items, equals(oldestFirst)); + }); + test('refresh resets filter and sort to initial values', () async { final drafts = generateDrafts(); final initialFilter = Filter.equal('type', 'messaging'); - const initialSort = [SortOption.desc(DraftSortKey.createdAt)]; + final initialSort = [DraftSort.desc(DraftSortField.createdAt)]; final apiCalls = >[]; @@ -641,7 +714,7 @@ void main() { controller ..filter = Filter.equal('type', 'team') - ..sort = const [SortOption.asc(DraftSortKey.createdAt)]; + ..sort = [DraftSort.asc(DraftSortField.createdAt)]; await controller.refresh(); await pumpEventQueue(); @@ -658,9 +731,9 @@ void main() { () async { final drafts = generateDrafts(); final initialFilter = Filter.equal('type', 'messaging'); - const initialSort = [SortOption.desc(DraftSortKey.createdAt)]; + final initialSort = [DraftSort.desc(DraftSortField.createdAt)]; final newFilter = Filter.equal('type', 'team'); - const newSort = [SortOption.asc(DraftSortKey.createdAt)]; + final newSort = [DraftSort.asc(DraftSortField.createdAt)]; final apiCalls = >[]; diff --git a/packages/stream_chat_flutter_core/test/stream_member_list_controller_test.dart b/packages/stream_chat_flutter_core/test/stream_member_list_controller_test.dart index fe24f081a1..5d1e2c4e0c 100644 --- a/packages/stream_chat_flutter_core/test/stream_member_list_controller_test.dart +++ b/packages/stream_chat_flutter_core/test/stream_member_list_controller_test.dart @@ -19,6 +19,30 @@ void main() { return QueryMembersResponse()..members = members; } + test('an empty sort queries without a sort term', () async { + final sorts = []; + when( + () => channel.queryMembers( + filter: any(named: 'filter'), + sort: any(named: 'sort'), + pagination: any(named: 'pagination'), + ), + ).thenAnswer((invocation) async { + sorts.add(invocation.namedArguments[#sort]); + return membersResponse([Member(user: User(id: 'user-1'))]); + }); + + final controller = StreamMemberListController( + channel: channel, + sort: MemberSort.empty, + ); + addTearDown(controller.dispose); + + await controller.doInitialLoad(); + + expect(sorts.single, isEmpty); + }); + group('search', () { test('queries members with the provided filter after debouncing', () { Filter? usedFilter; diff --git a/packages/stream_chat_flutter_core/test/stream_message_reminder_list_controller_test.dart b/packages/stream_chat_flutter_core/test/stream_message_reminder_list_controller_test.dart index c603461b61..e1c4967292 100644 --- a/packages/stream_chat_flutter_core/test/stream_message_reminder_list_controller_test.dart +++ b/packages/stream_chat_flutter_core/test/stream_message_reminder_list_controller_test.dart @@ -129,6 +129,33 @@ void main() { expect(controller.value.asSuccess.items, equals(reminders)); }); + test('an empty sort queries without a sort term', () async { + final sorts = []; + + when( + () => client.queryReminders( + filter: any(named: 'filter'), + sort: any(named: 'sort'), + pagination: any(named: 'pagination'), + ), + ).thenAnswer((invocation) async { + sorts.add(invocation.namedArguments[const Symbol('sort')]); + return QueryRemindersResponse() + ..reminders = generateMessageReminders() + ..next = null; + }); + + final controller = StreamMessageReminderListController( + client: client, + sort: MessageReminderSort.empty, + ); + + await controller.doInitialLoad(); + await pumpEventQueue(); + + expect(sorts.single, isEmpty); + }); + test('handles a Stream failure properly', () async { const chatError = StreamNetworkException(message: 'Network error'); when( diff --git a/packages/stream_chat_flutter_core/test/stream_reaction_list_controller_test.dart b/packages/stream_chat_flutter_core/test/stream_reaction_list_controller_test.dart index b71ebed6c5..aa8b619d8d 100644 --- a/packages/stream_chat_flutter_core/test/stream_reaction_list_controller_test.dart +++ b/packages/stream_chat_flutter_core/test/stream_reaction_list_controller_test.dart @@ -436,10 +436,40 @@ void main() { }); group('Filtering and sorting', () { + test('an empty sort leaves a page in the order it arrived in', () async { + // Reactions arrive newest-first, so an oldest-first page comes back + // reordered unless the empty sort is left alone. + final oldestFirst = generateReactions(count: 50).reversed.toList(); + + when( + () => client.queryReactions( + any(), + filter: any(named: 'filter'), + sort: any(named: 'sort'), + pagination: any(named: 'pagination'), + ), + ).thenAnswer( + (_) async => QueryReactionsResponse() + ..reactions = oldestFirst + ..next = null, + ); + + final controller = StreamReactionListController( + client: client, + messageId: 'message_123', + sort: ReactionSort.empty, + ); + + await controller.doInitialLoad(); + await pumpEventQueue(); + + expect(controller.value.asSuccess.items, equals(oldestFirst)); + }); + test('refresh resets filter and sort to initial values', () async { final reactions = generateReactions(); final initialFilter = Filter.equal('type', 'like'); - final sort = [const SortOption.desc(ReactionSortKey.createdAt)]; + final sort = [ReactionSort.desc(ReactionSortField.createdAt)]; final apiCalls = >[]; @@ -473,7 +503,7 @@ void main() { // Change filter and sort at runtime controller ..filter = Filter.equal('type', 'love') - ..sort = [const SortOption.asc(ReactionSortKey.createdAt)]; + ..sort = [ReactionSort.asc(ReactionSortField.createdAt)]; await controller.refresh(); await pumpEventQueue(); @@ -488,9 +518,9 @@ void main() { test('refresh with resetValue=false preserves current filter and sort', () async { final reactions = generateReactions(); final initialFilter = Filter.equal('type', 'like'); - final initialSort = [const SortOption.desc(ReactionSortKey.createdAt)]; + final initialSort = [ReactionSort.desc(ReactionSortField.createdAt)]; final newFilter = Filter.equal('type', 'love'); - final newSort = [const SortOption.asc(ReactionSortKey.createdAt)]; + final newSort = [ReactionSort.asc(ReactionSortField.createdAt)]; final apiCalls = >[]; @@ -559,7 +589,7 @@ void main() { final controller = StreamReactionListController( client: client, messageId: messageId, - sort: [const SortOption.desc(ReactionSortKey.createdAt)], + sort: [ReactionSort.desc(ReactionSortField.createdAt)], ); await controller.doInitialLoad(); diff --git a/packages/stream_chat_flutter_core/test/stream_user_list_controller_test.dart b/packages/stream_chat_flutter_core/test/stream_user_list_controller_test.dart index 352752b06c..f5aa202df5 100644 --- a/packages/stream_chat_flutter_core/test/stream_user_list_controller_test.dart +++ b/packages/stream_chat_flutter_core/test/stream_user_list_controller_test.dart @@ -20,6 +20,31 @@ void main() { return QueryUsersResponse()..users = users; } + test('an empty sort queries without a sort term', () async { + final sorts = []; + when( + () => client.queryUsers( + filter: any(named: 'filter'), + sort: any(named: 'sort'), + presence: any(named: 'presence'), + pagination: any(named: 'pagination'), + ), + ).thenAnswer((invocation) async { + sorts.add(invocation.namedArguments[#sort]); + return usersResponse([User(id: 'user-1')]); + }); + + final controller = StreamUserListController( + client: client, + sort: UserSort.empty, + ); + addTearDown(controller.dispose); + + await controller.doInitialLoad(); + + expect(sorts.single, isEmpty); + }); + group('search', () { test('queries users with the provided filter after debouncing', () { Filter? usedFilter; diff --git a/packages/stream_chat_localizations/example/pubspec.yaml b/packages/stream_chat_localizations/example/pubspec.yaml index 73d439d125..24e9f1dc34 100644 --- a/packages/stream_chat_localizations/example/pubspec.yaml +++ b/packages/stream_chat_localizations/example/pubspec.yaml @@ -36,6 +36,12 @@ dependency_overrides: path: ../../stream_chat_flutter_core stream_chat_localizations: path: .. + # Forces one source for `stream_core`; see `melos.yaml`. + stream_core: + git: + url: https://github.com/GetStream/stream-core-flutter.git + path: packages/stream_core + ref: 04e0d1cb3a6893cf70cb6636a261deb11beff81c flutter: uses-material-design: true \ No newline at end of file diff --git a/packages/stream_chat_localizations/pubspec.yaml b/packages/stream_chat_localizations/pubspec.yaml index 994f695bdc..3efc5b1dd3 100644 --- a/packages/stream_chat_localizations/pubspec.yaml +++ b/packages/stream_chat_localizations/pubspec.yaml @@ -33,3 +33,11 @@ dev_dependencies: clock: ^1.1.2 flutter_test: sdk: flutter + +dependency_overrides: + # Forces one source for `stream_core`; see `melos.yaml`. + stream_core: + git: + url: https://github.com/GetStream/stream-core-flutter.git + path: packages/stream_core + ref: 04e0d1cb3a6893cf70cb6636a261deb11beff81c diff --git a/packages/stream_chat_persistence/CHANGELOG.md b/packages/stream_chat_persistence/CHANGELOG.md index 6c469ceac0..c3e433a1ae 100644 --- a/packages/stream_chat_persistence/CHANGELOG.md +++ b/packages/stream_chat_persistence/CHANGELOG.md @@ -3,11 +3,16 @@ 🛑️ Breaking - `StreamChatPersistenceClient` no longer takes `logLevel` or `logHandlerFunction`. Logging is configured once, on `StreamChatClient`, with `logConfig`. +- The sort arguments on `getChannelStates`, `queryChannelStates` and `saveChannelQueries` are typed `List` rather than `SortOrder`. 🔄 Changed - Every persistence call logged its own name at `info`; that call trace is `verbose` now. +🐞 Fixed + +- A cached channel query given no sort came back in whatever order the lookup returned; it now applies `ChannelSort.defaultSort`, the ordering the API would have. + ## 10.4.0 🔄 Changed diff --git a/packages/stream_chat_persistence/lib/src/converter/channel_sort_converter.dart b/packages/stream_chat_persistence/lib/src/converter/channel_sort_converter.dart new file mode 100644 index 0000000000..4a7aaf81dd --- /dev/null +++ b/packages/stream_chat_persistence/lib/src/converter/channel_sort_converter.dart @@ -0,0 +1,26 @@ +import 'dart:convert'; + +import 'package:drift/drift.dart'; +import 'package:stream_chat/stream_chat.dart'; + +/// Maps a [List] of [ChannelSort] into a [String] understood by the sqlite +/// backend. +/// +/// Used by the `channel_query_metadata` table to persist the sort the server +/// resolved for a predefined-filter query, so an offline read can apply the +/// same ordering. +class ChannelSortConverter extends TypeConverter, String> { + /// Creates a new instance. + const ChannelSortConverter(); + + @override + List fromSql(String fromDb) { + final json = jsonDecode(fromDb) as List; + return json.map((e) => ChannelSort.fromJson(e as Map)).toList(); + } + + @override + String toSql(List value) { + return jsonEncode(value.map((e) => e.toJson()).toList()); + } +} diff --git a/packages/stream_chat_persistence/lib/src/converter/converter.dart b/packages/stream_chat_persistence/lib/src/converter/converter.dart index cdd0a2d40d..488826141a 100644 --- a/packages/stream_chat_persistence/lib/src/converter/converter.dart +++ b/packages/stream_chat_persistence/lib/src/converter/converter.dart @@ -1,6 +1,6 @@ +export 'channel_sort_converter.dart'; export 'filter_converter.dart'; export 'list_converter.dart'; export 'map_converter.dart'; export 'reaction_groups_converter.dart'; -export 'sort_order_converter.dart'; export 'voting_visibility_converter.dart'; diff --git a/packages/stream_chat_persistence/lib/src/converter/sort_order_converter.dart b/packages/stream_chat_persistence/lib/src/converter/sort_order_converter.dart deleted file mode 100644 index 6d42b96465..0000000000 --- a/packages/stream_chat_persistence/lib/src/converter/sort_order_converter.dart +++ /dev/null @@ -1,26 +0,0 @@ -import 'dart:convert'; - -import 'package:drift/drift.dart'; -import 'package:stream_chat/stream_chat.dart'; - -/// A [TypeConverter] that serializes a [SortOrder] of [ChannelState] to and -/// from its JSON [String] representation. -/// -/// Used by the `channel_query_metadata` table to persist the server-resolved -/// sort spec associated with a predefined-filter query, so that offline reads -/// can apply the same ordering. -class ChannelStateSortOrderConverter extends TypeConverter, String> { - /// Creates a new instance. - const ChannelStateSortOrderConverter(); - - @override - SortOrder fromSql(String fromDb) { - final list = jsonDecode(fromDb) as List; - return list.cast>().map(SortOption.fromJson).toList(growable: false); - } - - @override - String toSql(SortOrder value) { - return jsonEncode(value.map((o) => o.toJson()).toList()); - } -} diff --git a/packages/stream_chat_persistence/lib/src/dao/channel_query_dao.dart b/packages/stream_chat_persistence/lib/src/dao/channel_query_dao.dart index cf34468a2c..5b2dd395f3 100644 --- a/packages/stream_chat_persistence/lib/src/dao/channel_query_dao.dart +++ b/packages/stream_chat_persistence/lib/src/dao/channel_query_dao.dart @@ -74,7 +74,7 @@ class ChannelQueryDao extends DatabaseAccessor with _$Channel String filterName, List cids, { required Filter filter, - required SortOrder sort, + required List sort, Map? filterValues, Map? sortValues, bool clearQueryCache = false, @@ -139,7 +139,7 @@ class ChannelQueryDao extends DatabaseAccessor with _$Channel /// /// Returns a record `(channels, filter, sort)`. The two /// spec fields are null when no metadata row exists for this query. - Future<(List, Filter?, SortOrder?)> getChannelsAndSpecByPredefinedFilter( + Future<(List, Filter?, List?)> getChannelsAndSpecByPredefinedFilter( String filterName, { Map? filterValues, Map? sortValues, diff --git a/packages/stream_chat_persistence/lib/src/db/drift_chat_database.dart b/packages/stream_chat_persistence/lib/src/db/drift_chat_database.dart index 011c08e42a..7c6185d382 100644 --- a/packages/stream_chat_persistence/lib/src/db/drift_chat_database.dart +++ b/packages/stream_chat_persistence/lib/src/db/drift_chat_database.dart @@ -58,7 +58,7 @@ class DriftChatDatabase extends _$DriftChatDatabase { // you should bump this number whenever you change or add a table definition. @override - int get schemaVersion => 1000 + 35; + int get schemaVersion => 1100 + 1; // Store DateTime as ISO-8601 text to preserve sub-second precision. @override diff --git a/packages/stream_chat_persistence/lib/src/db/drift_chat_database.g.dart b/packages/stream_chat_persistence/lib/src/db/drift_chat_database.g.dart index 079b6c345a..75abc02e0d 100644 --- a/packages/stream_chat_persistence/lib/src/db/drift_chat_database.g.dart +++ b/packages/stream_chat_persistence/lib/src/db/drift_chat_database.g.dart @@ -11011,14 +11011,14 @@ class $ChannelQueriesMetadataTable extends ChannelQueriesMetadata requiredDuringInsert: true, ).withConverter($ChannelQueriesMetadataTable.$converterfilter); @override - late final GeneratedColumnWithTypeConverter, String> sort = + late final GeneratedColumnWithTypeConverter, String> sort = GeneratedColumn( 'sort', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true, - ).withConverter>( + ).withConverter>( $ChannelQueriesMetadataTable.$convertersort, ); @override @@ -11080,7 +11080,7 @@ class $ChannelQueriesMetadataTable extends ChannelQueriesMetadata } static TypeConverter $converterfilter = const FilterConverter(); - static TypeConverter, String> $convertersort = const ChannelStateSortOrderConverter(); + static TypeConverter, String> $convertersort = const ChannelSortConverter(); } class ChannelQueryMetadataEntity extends DataClass implements Insertable { @@ -11092,7 +11092,7 @@ class ChannelQueryMetadataEntity extends DataClass implements Insertable sort; + final List sort; const ChannelQueryMetadataEntity({ required this.queryHash, required this.filter, @@ -11123,7 +11123,7 @@ class ChannelQueryMetadataEntity extends DataClass implements Insertable(json['queryHash']), filter: serializer.fromJson(json['filter']), - sort: serializer.fromJson>(json['sort']), + sort: serializer.fromJson>(json['sort']), ); } @override @@ -11132,14 +11132,14 @@ class ChannelQueryMetadataEntity extends DataClass implements Insertable{ 'queryHash': serializer.toJson(queryHash), 'filter': serializer.toJson(filter), - 'sort': serializer.toJson>(sort), + 'sort': serializer.toJson>(sort), }; } ChannelQueryMetadataEntity copyWith({ String? queryHash, Filter? filter, - SortOrder? sort, + List? sort, }) => ChannelQueryMetadataEntity( queryHash: queryHash ?? this.queryHash, filter: filter ?? this.filter, @@ -11179,7 +11179,7 @@ class ChannelQueryMetadataEntity extends DataClass implements Insertable { final Value queryHash; final Value filter; - final Value> sort; + final Value> sort; final Value rowid; const ChannelQueriesMetadataCompanion({ this.queryHash = const Value.absent(), @@ -11190,7 +11190,7 @@ class ChannelQueriesMetadataCompanion extends UpdateCompanion sort, + required List sort, this.rowid = const Value.absent(), }) : queryHash = Value(queryHash), filter = Value(filter), @@ -11212,7 +11212,7 @@ class ChannelQueriesMetadataCompanion extends UpdateCompanion? queryHash, Value? filter, - Value>? sort, + Value>? sort, Value? rowid, }) { return ChannelQueriesMetadataCompanion( @@ -18815,14 +18815,14 @@ typedef $$ChannelQueriesMetadataTableCreateCompanionBuilder = ChannelQueriesMetadataCompanion Function({ required String queryHash, required Filter filter, - required SortOrder sort, + required List sort, Value rowid, }); typedef $$ChannelQueriesMetadataTableUpdateCompanionBuilder = ChannelQueriesMetadataCompanion Function({ Value queryHash, Value filter, - Value> sort, + Value> sort, Value rowid, }); @@ -18844,11 +18844,10 @@ class $$ChannelQueriesMetadataTableFilterComposer extends Composer<_$DriftChatDa builder: (column) => ColumnWithTypeConverterFilters(column), ); - ColumnWithTypeConverterFilters, SortOrder, String> get sort => - $composableBuilder( - column: $table.sort, - builder: (column) => ColumnWithTypeConverterFilters(column), - ); + ColumnWithTypeConverterFilters, List, String> get sort => $composableBuilder( + column: $table.sort, + builder: (column) => ColumnWithTypeConverterFilters(column), + ); } class $$ChannelQueriesMetadataTableOrderingComposer @@ -18890,7 +18889,7 @@ class $$ChannelQueriesMetadataTableAnnotationComposer GeneratedColumnWithTypeConverter get filter => $composableBuilder(column: $table.filter, builder: (column) => column); - GeneratedColumnWithTypeConverter, String> get sort => + GeneratedColumnWithTypeConverter, String> get sort => $composableBuilder(column: $table.sort, builder: (column) => column); } @@ -18935,7 +18934,7 @@ class $$ChannelQueriesMetadataTableTableManager ({ Value queryHash = const Value.absent(), Value filter = const Value.absent(), - Value> sort = const Value.absent(), + Value> sort = const Value.absent(), Value rowid = const Value.absent(), }) => ChannelQueriesMetadataCompanion( queryHash: queryHash, @@ -18947,7 +18946,7 @@ class $$ChannelQueriesMetadataTableTableManager ({ required String queryHash, required Filter filter, - required SortOrder sort, + required List sort, Value rowid = const Value.absent(), }) => ChannelQueriesMetadataCompanion.insert( queryHash: queryHash, diff --git a/packages/stream_chat_persistence/lib/src/entity/channel_queries_metadata.dart b/packages/stream_chat_persistence/lib/src/entity/channel_queries_metadata.dart index 4152304f97..fb10cca2cc 100644 --- a/packages/stream_chat_persistence/lib/src/entity/channel_queries_metadata.dart +++ b/packages/stream_chat_persistence/lib/src/entity/channel_queries_metadata.dart @@ -17,7 +17,7 @@ class ChannelQueriesMetadata extends Table { TextColumn get filter => text().map(const FilterConverter())(); /// The server-resolved sort spec to apply on offline reads. - TextColumn get sort => text().map(const ChannelStateSortOrderConverter())(); + TextColumn get sort => text().map(const ChannelSortConverter())(); @override Set get primaryKey => {queryHash}; diff --git a/packages/stream_chat_persistence/lib/src/stream_chat_persistence_client.dart b/packages/stream_chat_persistence/lib/src/stream_chat_persistence_client.dart index 1982beb187..4bcffe0ad2 100644 --- a/packages/stream_chat_persistence/lib/src/stream_chat_persistence_client.dart +++ b/packages/stream_chat_persistence/lib/src/stream_chat_persistence_client.dart @@ -284,7 +284,7 @@ class StreamChatPersistenceClient extends ChatPersistenceClient { @override Future> getChannelStates({ Filter? filter, - SortOrder? channelStateSort, + List? channelStateSort, int? messageLimit, PaginationParams? paginationParams, }) async { @@ -302,7 +302,7 @@ class StreamChatPersistenceClient extends ChatPersistenceClient { @override Future queryChannelStates({ Filter? filter, - SortOrder? sort, + List? sort, String? predefinedFilter, Map? filterValues, Map? sortValues, @@ -353,25 +353,30 @@ class StreamChatPersistenceClient extends ChatPersistenceClient { // page with full channel state. Future> _getChannelStatesPage( List channelModels, - SortOrder? channelStateSort, + List? channelStateSort, PaginationParams? paginationParams, { int? messageLimit, }) async { + // A cached read has no server to defer to, and the rows arrive in whatever + // order the cid lookup returned. + final sort = switch (channelStateSort) { + null || [] => ChannelSort.defaultSort, + final channelStateSort => channelStateSort, + }; + // 1) Wrap each model in a sort envelope. No state loaded yet. var envelopes = channelModels.map((m) => ChannelState(channel: m)).toList(growable: false); // 2) If sort uses `pinnedAt`, preload the current user's memberships in // one batched query and attach them to the envelopes. final clientUserId = userId; - if (clientUserId != null && _sortRequiresMembership(channelStateSort)) { + if (clientUserId != null && _sortRequiresMembership(sort)) { envelopes = await _attachMemberships(envelopes, clientUserId); } // 3) Sort using the comparator — on envelopes instead of fully-hydrated // states. - if (channelStateSort != null && channelStateSort.isNotEmpty) { - envelopes.sort(channelStateSort.compare); - } + envelopes.sort(sort.compare); // 4) Slice the page. final total = envelopes.length; @@ -409,10 +414,10 @@ class StreamChatPersistenceClient extends ChatPersistenceClient { Future saveChannelQueries({ required List cids, Filter? filter, - SortOrder? sort, + List? sort, String? predefinedFilter, Filter? resolvedFilter, - SortOrder? resolvedSort, + List? resolvedSort, Map? filterValues, Map? sortValues, bool clearQueryCache = false, @@ -632,8 +637,9 @@ class StreamChatPersistenceClient extends ChatPersistenceClient { } } - bool _sortRequiresMembership(SortOrder? sort) => - sort?.any((opt) => opt.field == ChannelSortKey.pinnedAt) ?? false; + bool _sortRequiresMembership(List? sort) { + return sort?.any((it) => it.field.remote == ChannelSortField.pinnedAt.remote) ?? false; + } Future> _attachMemberships( List envelopes, diff --git a/packages/stream_chat_persistence/test/src/converter/channel_sort_converter_test.dart b/packages/stream_chat_persistence/test/src/converter/channel_sort_converter_test.dart new file mode 100644 index 0000000000..552e984013 --- /dev/null +++ b/packages/stream_chat_persistence/test/src/converter/channel_sort_converter_test.dart @@ -0,0 +1,57 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:stream_chat/stream_chat.dart'; +import 'package:stream_chat_persistence/src/converter/channel_sort_converter.dart'; + +void main() { + const converter = ChannelSortConverter(); + + test('a non-empty sort round-trips unchanged', () { + final original = [ + ChannelSort.desc(ChannelSortField.pinnedAt), + ChannelSort.asc(ChannelSortField.createdAt), + ]; + + final decoded = converter.fromSql(converter.toSql(original)); + + expect(decoded.length, original.length); + for (var i = 0; i < original.length; i++) { + // `SortField` has no value equality, so this also asserts the declared + // field came back rather than a `custom` one built from its name. + expect(decoded[i].field, same(original[i].field)); + expect(decoded[i].direction, original[i].direction); + } + }); + + test('an empty sort round-trips as empty', () { + final decoded = converter.fromSql(converter.toSql([])); + expect(decoded, isEmpty); + }); + + test("a round-tripped sort keeps the field's null ordering", () { + // `pinned_at` is nulls-last in either direction, which the server does and + // `ChannelSort` resolves off the field. A bare `Sort` would lose it. Only + // the field-derived ordering survives — the wire shape carries no null + // ordering, so an explicit override could not be persisted here. + final decoded = converter.fromSql( + converter.toSql([ChannelSort.desc(ChannelSortField.pinnedAt)]), + ); + + expect(decoded.single.nullOrdering, NullOrdering.nullsLast); + }); + + test('the persisted shape is the one the API uses', () { + // Rows outlive the SDK version that wrote them, so this shape cannot drift + // silently. It is also what the API echoes back for a predefined filter. + final encoded = converter.toSql([ChannelSort.desc(ChannelSortField.lastMessageAt)]); + + expect(encoded, '[{"field":"last_message_at","direction":-1}]'); + expect(converter.fromSql(encoded).single.field, same(ChannelSortField.lastMessageAt)); + }); + + test('a field the SDK does not model still decodes', () { + final decoded = converter.fromSql('[{"field":"not_a_known_field","direction":1}]'); + + expect(decoded.single.field.remote, 'not_a_known_field'); + expect(decoded.single.direction, SortDirection.asc); + }); +} diff --git a/packages/stream_chat_persistence/test/src/converter/sort_order_converter_test.dart b/packages/stream_chat_persistence/test/src/converter/sort_order_converter_test.dart deleted file mode 100644 index eddfe2d8db..0000000000 --- a/packages/stream_chat_persistence/test/src/converter/sort_order_converter_test.dart +++ /dev/null @@ -1,27 +0,0 @@ -import 'package:flutter_test/flutter_test.dart'; -import 'package:stream_chat/stream_chat.dart'; -import 'package:stream_chat_persistence/src/converter/sort_order_converter.dart'; - -void main() { - const converter = ChannelStateSortOrderConverter(); - - test('non-empty SortOrder round-trips unchanged', () { - const original = >[ - SortOption.desc(ChannelSortKey.pinnedAt), - SortOption.asc(ChannelSortKey.createdAt), - ]; - - final decoded = converter.fromSql(converter.toSql(original)); - - expect(decoded.length, original.length); - for (var i = 0; i < original.length; i++) { - expect(decoded[i].field, original[i].field); - expect(decoded[i].direction, original[i].direction); - } - }); - - test('empty SortOrder round-trips as empty', () { - final decoded = converter.fromSql(converter.toSql(const [])); - expect(decoded, isEmpty); - }); -} diff --git a/packages/stream_chat_persistence/test/src/dao/channel_query_dao_test.dart b/packages/stream_chat_persistence/test/src/dao/channel_query_dao_test.dart index 45088f117e..abaaf6903a 100644 --- a/packages/stream_chat_persistence/test/src/dao/channel_query_dao_test.dart +++ b/packages/stream_chat_persistence/test/src/dao/channel_query_dao_test.dart @@ -164,9 +164,9 @@ void main() { const sortValues = {'pinned_at': true}; const cids = ['testCid1', 'testCid2', 'testCid3']; final filter = Filter.equal('type', 'messaging'); - const sort = >[ - SortOption.desc(ChannelSortKey.pinnedAt), - SortOption.desc(ChannelSortKey.lastMessageAt), + final sort = [ + ChannelSort.desc(ChannelSortField.pinnedAt), + ChannelSort.desc(ChannelSortField.lastMessageAt), ]; await _insertChannelsForCids(cids); @@ -190,10 +190,10 @@ void main() { expect(storedFilter!.toJson(), filter.toJson()); expect(storedSort, isNotNull); expect(storedSort!.length, 2); - expect(storedSort.first.field, ChannelSortKey.pinnedAt); - expect(storedSort.first.direction, SortOption.DESC); - expect(storedSort.last.field, ChannelSortKey.lastMessageAt); - expect(storedSort.last.direction, SortOption.DESC); + expect(storedSort.first.field.remote, ChannelSortField.pinnedAt.remote); + expect(storedSort.first.direction, SortDirection.desc); + expect(storedSort.last.field.remote, ChannelSortField.lastMessageAt.remote); + expect(storedSort.last.direction, SortDirection.desc); }); test('clear queryCache before updateChannelQueriesByPredefinedFilter', () async { @@ -203,9 +203,9 @@ void main() { const oldCids = ['oldCid1', 'oldCid2']; const newCids = ['newCid1']; final filter = Filter.equal('type', 'messaging'); - const sort = >[ - SortOption.desc(ChannelSortKey.pinnedAt), - SortOption.desc(ChannelSortKey.lastMessageAt), + final sort = [ + ChannelSort.desc(ChannelSortField.pinnedAt), + ChannelSort.desc(ChannelSortField.lastMessageAt), ]; await _insertChannelsForCids([...oldCids, ...newCids]); @@ -238,10 +238,10 @@ void main() { expect(storedFilter!.toJson(), filter.toJson()); expect(storedSort, isNotNull); expect(storedSort!.length, 2); - expect(storedSort.first.field, ChannelSortKey.pinnedAt); - expect(storedSort.first.direction, SortOption.DESC); - expect(storedSort.last.field, ChannelSortKey.lastMessageAt); - expect(storedSort.last.direction, SortOption.DESC); + expect(storedSort.first.field.remote, ChannelSortField.pinnedAt.remote); + expect(storedSort.first.direction, SortDirection.desc); + expect(storedSort.last.field.remote, ChannelSortField.lastMessageAt.remote); + expect(storedSort.last.direction, SortDirection.desc); }); tearDown(() async { diff --git a/packages/stream_chat_persistence/test/stream_chat_persistence_client_test.dart b/packages/stream_chat_persistence/test/stream_chat_persistence_client_test.dart index 6defdc2c3c..e4db23bf51 100644 --- a/packages/stream_chat_persistence/test/stream_chat_persistence_client_test.dart +++ b/packages/stream_chat_persistence/test/stream_chat_persistence_client_test.dart @@ -105,7 +105,7 @@ void main() { setUpAll(() { registerFallbackValue([]); registerFallbackValue(const Filter.empty()); - registerFallbackValue(const >[]); + registerFallbackValue([]); }); setUp(() async { @@ -338,8 +338,8 @@ void main() { final result = await client.getChannelStates( filter: filter, - channelStateSort: const [ - SortOption.desc(ChannelSortKey.pinnedAt), + channelStateSort: [ + ChannelSort.desc(ChannelSortField.pinnedAt), ], messageLimit: messageLimit, paginationParams: const PaginationParams(offset: 1, limit: 1), @@ -477,8 +477,8 @@ void main() { final result = await client.queryChannelStates( filter: filter, - sort: const [ - SortOption.desc(ChannelSortKey.pinnedAt), + sort: [ + ChannelSort.desc(ChannelSortField.pinnedAt), ], messageLimit: messageLimit, paginationParams: const PaginationParams(offset: 1, limit: 1), @@ -562,8 +562,8 @@ void main() { const cids = ['messaging:p0', 'messaging:p1', 'messaging:p2']; // Persisted sort uses `pinnedAt` so membership preload kicks in. - const persistedSort = >[ - SortOption.desc(ChannelSortKey.pinnedAt), + final persistedSort = [ + ChannelSort.desc(ChannelSortField.pinnedAt), ]; // pinnedAt values chosen so descending order is [p1, p2, p0]. With @@ -713,6 +713,38 @@ void main() { ); } }); + + test('standard mode orders a cached page by the default sort when given none', () async { + // Cached rows arrive in whatever order the cid lookup returned, so the + // oldest is first here. The default sort is newest-first, which makes + // `oldest` the only cid a one-channel page should hydrate if it is + // applied, and the wrong one if it is not. + final baseDate = DateTime.utc(2025); + final oldest = ChannelModel(cid: 'messaging:oldest', lastMessageAt: baseDate); + final newest = ChannelModel( + cid: 'messaging:newest', + lastMessageAt: baseDate.add(const Duration(days: 1)), + ); + + when(() => mockDatabase.channelQueryDao.getChannels()).thenAnswer((_) async => [oldest, newest]); + + const pagedCid = 'messaging:newest'; + const messagePagination = PaginationParams(limit: 25); + when(() => mockDatabase.channelDao.getChannelByCid(pagedCid)).thenAnswer((_) async => newest); + when(() => mockDatabase.memberDao.getMembersByCid(pagedCid)).thenAnswer((_) async => []); + when(() => mockDatabase.readDao.getReadsByCid(pagedCid)).thenAnswer((_) async => []); + when( + () => mockDatabase.messageDao.getMessagesByCid(pagedCid, messagePagination: messagePagination), + ).thenAnswer((_) async => []); + when(() => mockDatabase.pinnedMessageDao.getMessagesByCid(pagedCid)).thenAnswer((_) async => []); + when(() => mockDatabase.draftMessageDao.getDraftMessageByCid(pagedCid)).thenAnswer((_) async => null); + + final result = await client.queryChannelStates( + paginationParams: const PaginationParams(limit: 1), + ); + + expect(result.channels.single.channel!.cid, pagedCid); + }); }); group('saveChannelQueries', () { @@ -730,8 +762,8 @@ void main() { final filter = Filter.in_('members', const ['testUserId']); const cids = ['messaging:c0']; final resolvedFilter = Filter.equal('type', 'messaging'); - const resolvedSort = >[ - SortOption.desc(ChannelSortKey.lastMessageAt), + final resolvedSort = [ + ChannelSort.desc(ChannelSortField.lastMessageAt), ]; when( @@ -776,8 +808,8 @@ void main() { const sortValues = {'pinned_at': true}; const cids = ['messaging:c0']; final resolvedFilter = Filter.equal('type', 'messaging'); - const resolvedSort = >[ - SortOption.desc(ChannelSortKey.lastMessageAt), + final resolvedSort = [ + ChannelSort.desc(ChannelSortField.lastMessageAt), ]; when( @@ -824,7 +856,7 @@ void main() { filterName, cids, filter: const Filter.empty(), - sort: const [], + sort: [], filterValues: null, sortValues: null, clearQueryCache: false, @@ -838,7 +870,7 @@ void main() { filterName, cids, filter: const Filter.empty(), - sort: const [], + sort: [], filterValues: null, sortValues: null, clearQueryCache: false, diff --git a/sample_app/lib/pages/channel_file_display_screen.dart b/sample_app/lib/pages/channel_file_display_screen.dart index 21d4d3d7a5..c28a228576 100644 --- a/sample_app/lib/pages/channel_file_display_screen.dart +++ b/sample_app/lib/pages/channel_file_display_screen.dart @@ -20,7 +20,7 @@ class _ChannelFileDisplayScreenState extends State { client: StreamChat.of(context).client, filter: Filter.in_('cid', [StreamChannel.of(context).channel.cid!]), messageFilter: Filter.in_('attachments.type', const ['file']), - sort: const [SortOption.desc('created_at')], + sort: [MessageSearchSort.desc(MessageSearchSortField.createdAt)], limit: 20, ); diff --git a/sample_app/lib/pages/channel_media_display_screen.dart b/sample_app/lib/pages/channel_media_display_screen.dart index 66f39d3b3f..c789967a4b 100644 --- a/sample_app/lib/pages/channel_media_display_screen.dart +++ b/sample_app/lib/pages/channel_media_display_screen.dart @@ -19,7 +19,7 @@ class _ChannelMediaDisplayScreenState extends State { client: StreamChat.of(context).client, filter: Filter.in_('cid', [StreamChannel.of(context).channel.cid!]), messageFilter: Filter.in_('attachments.type', const ['image', 'video']), - sort: const [SortOption.asc('created_at')], + sort: [MessageSearchSort.asc(MessageSearchSortField.createdAt)], limit: 20, ); diff --git a/sample_app/lib/pages/new_chat_screen.dart b/sample_app/lib/pages/new_chat_screen.dart index a93ec8d9d3..1db85817dc 100644 --- a/sample_app/lib/pages/new_chat_screen.dart +++ b/sample_app/lib/pages/new_chat_screen.dart @@ -24,7 +24,7 @@ class _NewChatScreenState extends State { limit: 25, filter: _filter(), sort: [ - const SortOption.asc(UserSortKey.name), + UserSort.asc(UserSortField.name), ], ); diff --git a/sample_app/lib/pages/new_group_chat_screen.dart b/sample_app/lib/pages/new_group_chat_screen.dart index 9655d6c26e..c3bcfc5188 100644 --- a/sample_app/lib/pages/new_group_chat_screen.dart +++ b/sample_app/lib/pages/new_group_chat_screen.dart @@ -26,7 +26,7 @@ class _NewGroupChatScreenState extends State { late final userListController = StreamUserListController( client: StreamChat.of(context).client, - sort: [const SortOption.asc('name')], + sort: [UserSort.asc(UserSortField.name)], limit: 25, filter: _filter(), ); diff --git a/sample_app/lib/pages/pinned_messages_screen.dart b/sample_app/lib/pages/pinned_messages_screen.dart index 0317b4e3d8..657955dd5a 100644 --- a/sample_app/lib/pages/pinned_messages_screen.dart +++ b/sample_app/lib/pages/pinned_messages_screen.dart @@ -24,7 +24,7 @@ class _PinnedMessagesScreenState extends State { client: StreamChat.of(context).client, filter: Filter.in_('cid', [StreamChannel.of(context).channel.cid!]), messageFilter: Filter.equal('pinned', true), - sort: const [SortOption.asc('created_at')], + sort: [MessageSearchSort.asc(MessageSearchSortField.createdAt)], limit: 20, ); diff --git a/sample_app/lib/widgets/add_members_sheet.dart b/sample_app/lib/widgets/add_members_sheet.dart index 08b2131375..eb88b2f8f2 100644 --- a/sample_app/lib/widgets/add_members_sheet.dart +++ b/sample_app/lib/widgets/add_members_sheet.dart @@ -65,7 +65,7 @@ class _AddMembersSheetState extends State { client: _client, limit: 25, filter: _filter(), - sort: const [SortOption.asc(UserSortKey.name)], + sort: [UserSort.asc(UserSortField.name)], ); late final TextEditingController _searchController = TextEditingController()..addListener(_onSearchChanged); diff --git a/sample_app/lib/widgets/channel_list.dart b/sample_app/lib/widgets/channel_list.dart index f557eac3e5..1190080466 100644 --- a/sample_app/lib/widgets/channel_list.dart +++ b/sample_app/lib/widgets/channel_list.dart @@ -53,8 +53,8 @@ class _ChannelList extends State { limit: 5, searchQuery: searchQuery, sort: [ - const SortOption.desc(ChannelSortKey.pinnedAt), - const SortOption.asc(ChannelSortKey.createdAt), + MessageSearchSort.desc(MessageSearchSortField.pinned), + MessageSearchSort.asc(MessageSearchSortField.createdAt), ], ); if (searchQuery.isNotEmpty) _messageSearchListController.search(searchQuery); diff --git a/sample_app/pubspec.yaml b/sample_app/pubspec.yaml index bdd6b99170..41248821cf 100644 --- a/sample_app/pubspec.yaml +++ b/sample_app/pubspec.yaml @@ -62,3 +62,11 @@ flutter: assets: - assets/ - pubspec.lock + +dependency_overrides: + # Forces one source for `stream_core`; see `melos.yaml`. + stream_core: + git: + url: https://github.com/GetStream/stream-core-flutter.git + path: packages/stream_core + ref: 04e0d1cb3a6893cf70cb6636a261deb11beff81c From 3a315c54dc92e6880c27e6a4dde9fe6de0eeec19 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Tue, 15 Sep 2026 16:38:49 +0200 Subject: [PATCH 05/36] refactor(llc)!: adopt stream_core's Filter for every query (#2958) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(repo): resolve stream_core from the sibling checkout Phase 08b needs `Filter.raw`, which is unreleased. Melos' `dependencyOverridePaths` points resolution at ../stream-core-flutter while both repos change together, leaving the declared `^0.5.0` constraint honest — reverting is deleting three lines rather than editing a version back. A direct path dependency does not work here: hosted stream_core_flutter 0.5.1 depends on hosted stream_core, so pub cannot reconcile the two. Both packages are overridden, named explicitly because globbing `packages/**` picks up the plugin symlinks under stream_thumbnail/example. Co-Authored-By: Claude Opus 5 (1M context) * refactor(llc)!: adopt stream_core's Filter for every query Chat's own `Filter` addressed fields by string, so nothing tied a key to the model it filtered or to the operators the API accepts there. It is replaced by `stream_core`'s sealed `Filter`, with one alias and one field registry per query — the shape `Sort` already took. Each registry is pinned to `x-stream-filter-fields` in the protocol repo by a test that requires every published field to be either declared or listed as omitted with a reason, so a gap has to be written down rather than gone unnoticed. `$ne`, `$nin` and `$nor` are gone: they are deprecated server-side and being withdrawn. `Filter.empty()` is gone too — every filter argument is nullable, which `queryThreads` distinguishes from an empty one. The persistence layer follows: its resolved-filter column is nullable, so a predefined-filter query with no filter stores none. Message flags are the one endpoint left unmodelled; chat has no API for them. Co-Authored-By: Claude Opus 5 (1M context) * docs(llc): show a query on each filter and sort Every alias now points at its field registry and carries a worked example, so the fields a query accepts are reachable from the type a caller already has. Filtering lost its only example when chat's own `Filter` was deleted; this restores one per query rather than the single channel example it had. Co-Authored-By: Claude Opus 5 (1M context) * test(llc): drop the filter field accounting test It read as a check against the API spec, but the spec was not consulted: the published set was transcribed into the test by hand. A field added upstream left it green, which is the one case its name promised to catch, and it cost a second list to keep in step with every registry. The reasoning it carried — why a field is declared or left out — moves to the phase doc, which was still claiming `hidden`, `muted`, `blocked`, `members` and `member.user.name` cannot have getters. All five are declared. Co-Authored-By: Claude Opus 5 (1M context) * chore(repo): resolve stream_core from a pinned commit Replaces the sibling-checkout `dependencyOverridePaths` block, which only ever worked on a machine with stream-core-flutter checked out next door. On CI the glob matched nothing, melos resolved the published 0.5.0 instead, and every package using an unreleased core API failed to analyze. Pinned to a SHA rather than a branch on purpose. `stream_core_flutter` reaches `stream_core` through the same clone, and pub compares git descriptors rather than resolved commits — a branch ref on one side and a resolved SHA on the other count as two sources of one package, which fails to solve. Both entries name the same commit so the descriptors match. `invalid_dependency` is silenced because a git dependency makes these packages temporarily unpublishable, which is true and intended. It goes when the git dependency does; publishability is still enforced by `lint:pub` and `pana` on master-targeted PRs. Restore hosted constraints before releasing v11, and delete the `chat-integration/v11` branch in stream-core-flutter — its path dependency cannot be published. Co-Authored-By: Claude Opus 5 (1M context) * fix(persistence): bump the schema version for the nullable filter column `channel_queries_metadata`'s `filter` column becomes nullable, so a row written by an older build carries a non-null placeholder where the new code expects absence to mean "no filter". Separate from the bump in the sort change below it: each is its own stored-format change, and the entity check compares a PR against its base rather than against the whole stack. Co-Authored-By: Claude Opus 5 (1M context) * fix(llc): always send filter_conditions where the API requires it `queryUsers` and `queryBannedUsers` declare `filter_conditions` as a required field (`validate:"required"` in the backend's request payloads). go-playground reads that as non-nil, so `{}` passes and an omitted key is rejected. Making `filter` nullable turned every `Filter.empty()` caller into a `null`, which dropped the key entirely — a 400 on mention autocomplete with `mentionAllAppUsers`, and on the initial directory load of the sample app's three user-picker screens. `queryMembers` already sent `filter ?? {}`; `queryChannels` genuinely has no such constraint and stays conditional. Also rewords the changelog line about the withdrawn negative operators, which read as though the sample app filters client-side. It does not — it shows everyone the query returns. Co-Authored-By: Claude Opus 5 (1M context) * docs(repo): stop three docs claiming there is no release blocker This PR is where `stream_core` stops being a hosted constraint, and three documents kept asserting it is one. The `openapi-codegen` skill is the dangerous one: it is auto-loaded, and its own trigger is "changing the `stream_core` constraint", so an agent doing exactly this work was handed a file saying the dependency is hosted with no overrides, and that publishing is unblocked. It now describes the SHA pin and says a git dep under `dependencies` makes the package unpublishable until it is restored. Also fixes this phase's definition of done, whose first item was an unticked box reading "`Filter.notEqual`, `notIn` and `nor` are `@Deprecated`" — the inverse of what the PR does. An unticked box reads as assigned work, so anyone closing out the phase would have re-added three operators the API is withdrawing. And `UPSTREAM.md` still named `$nor` as the top thing to push upstream, which this PR deletes. Co-Authored-By: Claude Opus 5 (1M context) * fix(llc): read replacement extraData flags safely in `copyWith` `ChannelModel.copyWith` cast `muted`, `blocked`, `disabled` and `hidden` out of a replacement extra-data map with `as bool?`, so a consumer-authored non-boolean threw where the matching getter answers null. Co-Authored-By: Claude Opus 5 (1M context) * fix(llc): declare the filter fields the API accepts, and read them safely `UserFilterField` had no `email` and `MemberFilterField` no `notifications_muted`, though both are declared columns — `mq/user/user.go:61` maps `email` to `custom->>'email'` with `$eq`/`$in`, and `mq/member/member.go:197` takes `notifications_muted` with `$eq`. The member side already declared the user's email as `user.email`, so the user side lacking it read as an oversight rather than a decision. Every typed field backed by extra data now goes through `safeCast` instead of handing the raw `Object?` to the comparison. The sort registry already did this (`user.dart:428`); the filter registry did not, so a server value of an unexpected type would have compared as itself rather than as absent. `ChannelFilterField.custom` and `ThreadFilterField.custom` name the fields the server computes per request — `joined`, `has_unread`, `invite`, `distinct`, `app_banned` — which are reachable only that way. They were listed in the phase doc and nowhere a caller would look. Co-Authored-By: Claude Opus 5 (1M context) * test(llc): pin the filter registries' wire names The sort registry pins its remote names and says why: a field the server rejects fails the request at runtime, and no other test catches it. The filter registry had the same test until it was dropped as duplicated bookkeeping. Filters are the worse of the two cases. `mq/parser.go:270-277` treats an unrecognised key as custom data wherever the resource declares a custom container — channel, user, member, poll and thread all do — so a typo does not fail the request. It compiles to `custom->>'typo'`, matches no row, and returns an empty page that reads like a legitimately empty result. The objection that killed the old test still stands: a hand-written list stays green when the API grows a field. It only ever covered the other direction, which is the one that ships a silent bug. Co-Authored-By: Claude Opus 5 (1M context) * docs(repo): stop the docs describing a branch state that no longer holds The migration guide told callers to pattern match on `EqualOperator` and friends. The barrel exports neither it nor any other subclass, so that does not compile — `stream_chat.dart` shows `Filter`, `FilterField`, `FilterOperator` and two abstract bases, and the bases are there only because `searchQueryLength` needs them. `stream_feeds` re-exports core wholesale, so every operator class is public there, and still nothing in it pattern matches: introspection is `toJson()` in all 36 places it reads a filter. Both docs now say `toJson()`, and the allowlist says why the two exceptions exist. `DEFERRED.md` is named as the authority by this branch's `UPSTREAM.md` and by the codegen skill, and it carried three rows this branch falsifies: adopting core's `Filter`/`Sort` "blocked on core gaining `$nor`", which this branch does by dropping `$nor`; deciding the fate of `Filter.custom`/`raw`/`empty`, decided; and the platform detector blocked on a release carrying `debugCurrentPlatformOverride`, which the pinned SHA already has. The row every other one folds into — restoring hosted constraints — was missing entirely, which is what `UPSTREAM.md` deleted its own list in favour of. The codegen skill's "there is no release blocker" now leads with the thing that is true for the reader it is written for: the pin makes three packages unpublishable. The generated client needing nothing past 0.5.0 is a separate sentence, not a headline. Phase 08 gains what its own field table cannot carry: the spec is a field oracle, not an operator oracle, since `mq/config.go:189` strips only internal operators and `$ne`/`$nin`; and core's evaluation operators require a `String`, so the array getters it credits work for `$eq`/`$in` but not for the `$autocomplete` on `member.user.name`. Co-Authored-By: Claude Opus 5 (1M context) * docs(repo): tick what this phase finished, and file the platform row where it waits Two leftovers from the previous commit. The `CurrentPlatform` row sat under "Blocked on something outside the repo" reading "nothing any more", which is the same shape of staleness that pass was meant to remove; it waits on the restore row, so it belongs under "Waiting on a decision or a later phase". Phase 08's definition of done still had unticked boxes for work this branch completed — deleting `filter.dart` / `sort_order.dart` / `comparable_field.dart` behind the allowlist, and the registries themselves. An unticked box reads as assigned work, which is the failure `93abff8f4` called out for the `@Deprecated` item. `location_coordinates.dart` is genuinely still exported, so it splits into its own row instead of being ticked with the rest. Co-Authored-By: Claude Opus 5 (1M context) * docs(repo): file the two follow-ups this phase found but cannot fix here Core's `QueryOperator` and `AutoCompleteOperator` bail on `fieldValue is! String`, so a getter returning an `Iterable` never matches. That is a core fix, not a chat one, and phase 08 noting it in prose is not where upstream asks are tracked — `UPSTREAM.md` is. `ChannelFilterField.memberUserName` is the field it bites, and `stream_feeds` calling `matches()` in 36 event handlers is where it surfaces. `UserFilterField.name` and `.custom` document fewer operators than the spec or `mq/user/user.go` allows, on the strength of 400s nobody recorded. Source contradicting a doc comment is how a correct narrowing gets widened back, so it goes in the live-check section with the other things mocks cannot settle. Co-Authored-By: Claude Opus 5 (1M context) * docs(repo): write the changelog for people who never add stream_core An integrator sees `StreamApiException` and `ChannelFilter` in their own code but never puts `stream_core` in their pubspec, so naming it in a release note explains the change in terms of a package they cannot see. Each entry now says what moved without naming where it moved from. Also: phase 02's "read the resolved package" note pointed at the hosted copy, which is not what resolves while `melos.yaml` pins a git ref — the exact mistake the note exists to prevent. And whether `ChannelModel` should promote its `extraData`-backed flags to real fields is recorded against the group that owns that model. Co-Authored-By: Claude Opus 5 (1M context) * refactor(llc): drop ChannelFilterField.filterTags from the typed registry `filter_tags` is deprecated as customer guidance — new apps are pointed at custom-data filtering or predefined filters — but nothing in the API says so. It is a live column with a GIN index, it is in the spec both ways, and Swift declares a hand-written `FilterKey` for it, so every source this registry was derived from argues for keeping it. Declaring it as a typed field reads as a recommendation for a path we tell customers not to take. `ChannelFilterField.custom('filter_tags')` still reaches it, and `ChannelModel.filterTags` stays: reading a value the server sends is not the same as recommending a query. Recorded in the phase doc, because a reader deriving the registry from the column list will otherwise add it straight back — this phase did. Co-Authored-By: Claude Opus 5 (1M context) --------- Co-authored-by: Claude Opus 5 (1M context) --- .claude/skills/openapi-codegen/SKILL.md | 24 +- core-migration/02-platform-and-environment.md | 15 +- core-migration/08-query-dsl.md | 423 ++++++++++++------ core-migration/DEFERRED.md | 6 +- core-migration/UPSTREAM.md | 11 +- .../message_search_list_view_test.dart | 2 +- .../test/reactions/reactions_test.dart | 2 +- .../test/src/golden_client_stubs.dart | 2 +- migrations/v11-migration.md | 13 + openapi-migration/11-channels-and-members.md | 6 + packages/stream_chat/CHANGELOG.md | 29 +- .../lib/src/client/channel/channel.dart | 26 +- .../client/channel/channel_event_handler.dart | 8 +- .../stream_chat/lib/src/client/client.dart | 39 +- .../lib/src/core/api/channel_api.dart | 3 +- .../lib/src/core/api/general_api.dart | 8 +- .../lib/src/core/api/message_api.dart | 5 +- .../lib/src/core/api/moderation_api.dart | 5 +- .../lib/src/core/api/polls_api.dart | 5 +- .../lib/src/core/api/reminders_api.dart | 3 +- .../lib/src/core/api/threads_api.dart | 3 +- .../lib/src/core/api/user_api.dart | 7 +- .../lib/src/core/models/banned_user.dart | 70 ++- .../lib/src/core/models/channel_model.dart | 26 +- .../lib/src/core/models/channel_state.dart | 222 ++++++++- .../lib/src/core/models/draft.dart | 50 ++- .../lib/src/core/models/filter.dart | 241 ---------- .../lib/src/core/models/member.dart | 148 +++++- .../lib/src/core/models/message.dart | 135 +++++- .../lib/src/core/models/message_reminder.dart | 58 ++- .../stream_chat/lib/src/core/models/poll.dart | 110 ++++- .../lib/src/core/models/poll_vote.dart | 78 +++- .../src/core/models/predefined_filter.dart | 30 +- .../lib/src/core/models/reaction.dart | 47 +- .../lib/src/core/models/thread.dart | 125 +++++- .../stream_chat/lib/src/core/models/user.dart | 142 +++++- .../lib/src/db/chat_persistence_client.dart | 11 +- packages/stream_chat/lib/stream_chat.dart | 15 +- .../channel/channel_client_state_test.dart | 2 +- .../channel/channel_event_handler_test.dart | 12 +- .../test/src/client/channel/channel_test.dart | 22 +- .../test/src/client/client_test.dart | 33 +- .../test/src/core/api/channel_api_test.dart | 14 +- .../test/src/core/api/general_api_test.dart | 18 +- .../test/src/core/api/polls_api_test.dart | 5 +- .../test/src/core/api/reminders_api_test.dart | 3 +- .../test/src/core/api/user_api_test.dart | 2 +- .../test/src/core/models/channel_test.dart | 13 + .../src/core/models/filter_registry_test.dart | 314 +++++++++++++ .../test/src/core/models/filter_test.dart | 264 ----------- .../core/models/predefined_filter_test.dart | 25 +- .../src/db/chat_persistence_client_test.dart | 5 +- packages/stream_chat/test/src/matchers.dart | 12 + .../stream_chat_flutter/example/lib/main.dart | 4 +- .../example/lib/split_view.dart | 4 +- .../example/lib/tutorial_part_2.dart | 4 +- .../example/lib/tutorial_part_3.dart | 4 +- .../example/lib/tutorial_part_4.dart | 4 +- .../example/lib/tutorial_part_5.dart | 4 +- .../example/lib/tutorial_part_6.dart | 4 +- .../stream_mention_autocomplete_options.dart | 10 +- .../src/poll/stream_poll_comments_sheet.dart | 2 +- .../poll/stream_poll_option_votes_sheet.dart | 3 +- .../detail/reaction_detail_sheet.dart | 4 +- .../detail/reaction_detail_sheet_test.dart | 2 +- .../stream_chat_flutter_core/CHANGELOG.md | 2 + .../example/lib/main.dart | 6 +- .../lib/src/search_debouncer.dart | 37 +- .../lib/src/stream_channel.dart | 2 +- .../src/stream_channel_list_controller.dart | 2 +- .../lib/src/stream_draft_list_controller.dart | 6 +- .../src/stream_member_list_controller.dart | 10 +- ...ream_message_reminder_list_controller.dart | 6 +- ...stream_message_search_list_controller.dart | 16 +- .../src/stream_poll_vote_list_controller.dart | 6 +- .../src/stream_reaction_list_controller.dart | 6 +- .../src/stream_thread_list_controller.dart | 6 +- .../lib/src/stream_user_list_controller.dart | 14 +- .../test/search_debouncer_test.dart | 14 +- .../stream_channel_list_controller_test.dart | 6 +- .../stream_draft_list_controller_test.dart | 8 +- .../stream_member_list_controller_test.dart | 6 +- ...m_message_search_list_controller_test.dart | 8 +- .../stream_reaction_list_controller_test.dart | 10 +- .../stream_user_list_controller_test.dart | 37 +- packages/stream_chat_persistence/CHANGELOG.md | 2 + .../lib/src/converter/filter_converter.dart | 8 +- .../lib/src/dao/channel_query_dao.dart | 12 +- .../lib/src/dao/draft_message_dao.g.dart | 6 +- .../lib/src/dao/location_dao.g.dart | 4 + .../lib/src/dao/member_dao.g.dart | 2 + .../lib/src/dao/message_dao.g.dart | 2 + .../dao/pinned_message_reaction_dao.g.dart | 5 + .../lib/src/dao/poll_vote_dao.g.dart | 2 + .../lib/src/dao/reaction_dao.g.dart | 4 + .../lib/src/dao/read_dao.g.dart | 2 + .../lib/src/db/drift_chat_database.dart | 5 +- .../lib/src/db/drift_chat_database.g.dart | 63 +-- .../src/entity/channel_queries_metadata.dart | 4 +- .../src/stream_chat_persistence_client.dart | 12 +- .../src/converter/filter_converter_test.dart | 12 +- .../test/src/dao/channel_query_dao_test.dart | 14 +- .../stream_chat_persistence_client_test.dart | 28 +- .../pages/channel_file_display_screen.dart | 4 +- .../pages/channel_media_display_screen.dart | 4 +- sample_app/lib/pages/new_chat_screen.dart | 20 +- .../lib/pages/new_group_chat_screen.dart | 16 +- .../lib/pages/pinned_messages_screen.dart | 4 +- sample_app/lib/pages/reminders_page.dart | 14 +- sample_app/lib/widgets/add_members_sheet.dart | 22 +- sample_app/lib/widgets/all_members_sheet.dart | 10 +- sample_app/lib/widgets/channel_list.dart | 4 +- 112 files changed, 2320 insertions(+), 1119 deletions(-) delete mode 100644 packages/stream_chat/lib/src/core/models/filter.dart create mode 100644 packages/stream_chat/test/src/core/models/filter_registry_test.dart delete mode 100644 packages/stream_chat/test/src/core/models/filter_test.dart diff --git a/.claude/skills/openapi-codegen/SKILL.md b/.claude/skills/openapi-codegen/SKILL.md index e2c0ec9d81..1a1cea672a 100644 --- a/.claude/skills/openapi-codegen/SKILL.md +++ b/.claude/skills/openapi-codegen/SKILL.md @@ -146,18 +146,22 @@ emitted by `model.tpl` / `discriminator.tpl` plus a `WsEvent` re-export from `mo `stream_chat` depends on `retrofit`, `retrofit_generator`, `json_annotation ^4.12.0` and `stream_core`. -`stream_core` is pinned to a **git commit** on the v11 branch, not a hosted constraint: -`melos.yaml` names a SHA for both `stream_core` and `stream_core_flutter`, because the branch uses -core APIs no published version carries. `melos bootstrap` syncs that into each package manifest, -which is why you will see a `git:` block there, and it makes those packages unpublishable until a -hosted constraint is restored. 0.5.0 still ships `StreamDateTimeConverter` and the sealed error -layer, which is everything the generated output needs, so **no core release blocks the generated -client**. Change the constraint in `melos.yaml` only, then `melos bootstrap` — never in a package +`stream_core` is currently pinned to a **git commit**, not a hosted constraint: `melos.yaml`'s +`command.bootstrap.dependencies` names a SHA for both `stream_core` and `stream_core_flutter`, +because the v11 branch uses core APIs no published version carries. `melos bootstrap` syncs that +into each package manifest, which is why you will see a `git:` block there, and **it makes +`stream_chat`, `stream_chat_flutter_core` and `stream_chat_flutter` unpublishable until a hosted +constraint is restored**. That restore is a v11 release task — `core-migration/DEFERRED.md` is the +authority on what it waits for. + +The generated client itself needs nothing newer than 0.5.0, which already ships +`StreamDateTimeConverter` and the sealed error layer, so regenerating is never what the pin is +holding up. Change the constraint in `melos.yaml` only, then `melos bootstrap` — never in a package manifest. -That is the dependency side only. The generator is still a prerequisite on its own: `client.tpl` -emits `runSafely`, and regenerating before the template change above lands reintroduces the old -error mapping no matter which core version resolves. +That is the dependency side only. The generator is still a prerequisite on its own: +`client.tpl` emits `runSafely`, and regenerating before the template change above lands +reintroduces the old error mapping no matter which core version resolves. If core ever goes back to a git ref for cross-repo work, it has to be pinned in every package that pulls both `stream_chat` and `stream_core_flutter`, because pub refuses git-vs-hosted for one package and honors an override's diff --git a/core-migration/02-platform-and-environment.md b/core-migration/02-platform-and-environment.md index 45d5e5cf25..e027a3dafa 100644 --- a/core-migration/02-platform-and-environment.md +++ b/core-migration/02-platform-and-environment.md @@ -7,9 +7,12 @@ > **Read the resolved package, not the sibling repo.** The first pass at this phase claimed two > upstream core additions were needed. Both were wrong, because they were derived from -> `stream-core-flutter/packages/stream_core` (unreleased `main`) rather than from -> `~/.pub-cache/hosted/pub.dev/stream_core-0.5.0`, which is what `stream_chat` actually resolves. -> Always diff against the pub-cache copy. +> `stream-core-flutter/packages/stream_core` (unreleased `main`) rather than from what +> `stream_chat` actually resolves. Always diff against the pub-cache copy, and read the path out of +> `packages/stream_chat/.dart_tool/package_config.json` rather than assuming it: `melos.yaml` pins +> `stream_core` to a git `ref` for now, so the copy in use is under `~/.pub-cache/git/`, not +> `~/.pub-cache/hosted/`. It returns to a hosted constraint when core next releases — see +> [DEFERRED.md](DEFERRED.md). ## Scope @@ -17,9 +20,9 @@ | --- | --- | --- | | `lib/src/system_environment.dart` (57) | `stream_core` `api/system_environment.dart` | **done** | | `lib/src/core/http/system_environment_manager.dart` (111) | `stream_core` `api/system_environment_manager.dart` | **done** | -| `lib/src/core/platform_detector/` — `platform_detector.dart` (~97) + `_stub` / `_web` / `_io` | `stream_core` `platform/current_platform.dart` + `platform/detector/` | **blocked on a `stream_core` release** | +| `lib/src/core/platform_detector/` — `platform_detector.dart` (~97) + `_stub` / `_web` / `_io` | `stream_core` `platform/current_platform.dart` + `platform/detector/` | **ready** — the SHA pinned in [08](08-query-dsl.md) carries what this needed | -### Platform detector — blocked on a `stream_core` release +### Platform detector — unblocked by the pin in phase 08 Both packages define `CurrentPlatform` **and** `PlatformType`, so `stream_chat.dart` must stop exporting ours in the same PR — there is no coexistence. @@ -29,7 +32,7 @@ exporting ours in the same PR — there is no coexistence. | `enum PlatformType` — 7 values, no payload | same 7 values, each carrying `operatingSystem` — **identical strings** (`android`, `ios`, `web`, `macos`, `windows`, `linux`, `fuchsia`), so nothing on the wire changes | | `CurrentPlatform.name` (a `switch`) | `CurrentPlatform.operatingSystem` | | 7 `is*` getters + `isFlutterTest` | same, plus `isMobile` / `isDesktop` | -| `@visibleForTesting static PlatformType? debugCurrentPlatformOverride`, honoured by an assert-gated `type` | **not in 0.5.0** — present on core's `main`, unreleased | +| `@visibleForTesting static PlatformType? debugCurrentPlatformOverride`, honoured by an assert-gated `type` | not in 0.5.0, but **present at the pinned SHA**, which is what the branch resolves | | conditional import: `_stub` (throws) / `_web` on `dart.library.js_interop` / `_io` | `detector/platform_detector` (web) / `platform_detector_io` on `dart.library.io` | Two corrections to the original write-up: diff --git a/core-migration/08-query-dsl.md b/core-migration/08-query-dsl.md index a9ffe1cccf..e56a40014a 100644 --- a/core-migration/08-query-dsl.md +++ b/core-migration/08-query-dsl.md @@ -132,153 +132,257 @@ is not a target to match. exactly as `ChannelSortField.fromRemote` works. The registry is not optional scaffolding for `matches()`; it is what makes the decode possible. -## The filterable fields, verified - -Extracted from `mq.TableConfig.Columns` for each resource, resolving named operator sets -(`SupportedColumnOperators` is `$eq $ne $gt $gte $lt $lte $in $nin $exists`). 111 fields. This is -the registry to write, and the source for each field's **Supported operators:** line. - -Two things the table does not encode, both from -[GetStream/chat#15657](https://github.com/GetStream/chat/pull/15657): - -**`$ne` and `$nin` are withdrawn from the published spec**, so they are struck from every field -below *except* the index-safe exceptions. Those are `user` only, and they are real: - -```go -BooleanFields: {banned, shadow_banned, bypass_moderation} // $ne stays -AntiJoinIndexedFields: {id} // $ne and $nin stay +## A field is only safe to give a value getter if local agrees with the server + +Core's generic `$in` compiles to `fmt.Sprintf("%s IN (?)", …)` (`mq/sql.go:1090`), plain scalar +membership. So a value getter is only correct when the server evaluates that field the same way +over the same value the getter returns. Three ways a field can diverge, each found while writing +`ChannelFilterField`: + +**No local value.** `app_banned` and `joined` are the only two of this group the channel +response does not carry. `disabled`, `hidden`, `blocked` and `muted` arrive as extra data, and +`ChannelModel` reads all four — `muted` and `blocked` were added for this — so they are declared. +`pinned` and `archived` come off the membership row. + +**A collection the server resolves element-wise.** `members` looks like `$in` over a list of ids, +and the generic operator would compare the whole list against each candidate, which is never +true. The server special-cases it: `channelDenormMembers` (`channel_denorm.go:1682`) compiles to +`EXISTS (SELECT 1 FROM channel_members m WHERE m.user_id IN (?) …)`, and `$eq` counts instead, +matching a channel whose member set is exactly the given users. Every array field the API exposes +is matched the same way — `filter_tags` with `@> AND <@` then `&&`, `teams` with `?|`, +`attachments.type` with a nested `@>` — and none is order-sensitive. Core now does that for any +array-valued field, so `members`, `member.user.name` and `attachments.type` are declared with +real getters. + +That covers the comparison and list operators only. `QueryOperator` and `AutoCompleteOperator` +both bail on `fieldValue is! String` (core `filter.dart:540`, `:556`), so an iterable getter +returns `false` from `matches()` whatever the value. The one field where that bites is +`member.user.name`, whose **Supported operators:** line correctly lists `$autocomplete` — the +server does support it — so the query is right and only local evaluation disagrees. Nothing in +this package calls `matches()` yet; `stream_feeds` calls it in 36 event handlers, which is the +shape chat will grow, so fix it in core before copying that pattern here. + +**Derived from the query, not the row.** `distinct`, `has_unread` and `invite` are computed +server-side from the request and the caller's read state, so no getter can agree with them. They +stay undeclared, reached through the registry's `custom` factory — +`ChannelFilterField.custom('has_unread')` sends the same key a declared field would, so only +`matches()` is given up. Both `custom` doc comments name them, so the list is discoverable from +the API and not only from here. + +## The filterable fields, from the spec + +Taken from `openapi/chat-openapi-clientside.yaml` in the **protocol** repo, which is what SDK +generators consume. 166 fields across twelve endpoints. + +An earlier pass extracted these from `mq.TableConfig.Columns` per resource and was wrong +everywhere: 16 message fields against the spec's 44, 23 channel fields against 29, and +`QueryMessageFlagsPayload` missed entirely. Reading one `Columns` map misses fields a second +config contributes, and it does not apply the publication rules. Two properties make the spec the +right source instead — it is keyed by *endpoint* rather than by table, which is how a caller +thinks, and it has already applied `isPublishedOperator`, so +[#15657](https://github.com/GetStream/chat/pull/15657) is baked in: exactly four `$ne` and one +`$nin` survive, the index-safe exceptions on `QueryUsersPayload`. + +**It is a field oracle, not an operator oracle.** `isPublishedOperator` (`mq/config.go:189`) +strips internal operators, `$ne` and `$nin` — nothing else — so every remaining row is the +column's `SupportedOperators` verbatim, which is wider than what some endpoints accept at +runtime. Two registry entries are deliberately narrower than the table below, from observed 400s +rather than from source: `UserFilterField.name` drops the range operators, and +`UserFilterField.custom` is `$eq`/`$in` only. `mq/user/user.go:25,43` allows both wider sets, so +whoever reconciles code to config next will widen them back — re-probe against a live app key +before doing that. + +Regenerate by re-reading that file from a current `GetStream/protocol` checkout, not by +re-deriving it from the Go source: + +```bash +PROTOCOL_DIR=${PROTOCOL_DIR:-~/GolandProjects/protocol} # or wherever you cloned it +git -C "$PROTOCOL_DIR" pull ``` -`DefaultChannelConfig` declares neither, so no channel field keeps them. - -**This is the one place removing an operator costs a capability.** `$nin` on `user.id` is how you -express "everyone except these people", which `classification_user.go` calls "the dominant -exclude-self people-search pattern" and optimises deliberately — the same comment notes `$nor` -over `id` is optimised for the same reason. Core models neither `$nin` nor `$nor`, so after the -migration that query is reachable only through `Filter.raw`. Decide before writing `UserFilterField` -whether that is acceptable or whether the registry should expose a purpose-built helper for it. +**The same file's `x-stream-sort-fields` is *not* a usable oracle, and the sort registries must +not be narrowed to it.** It publishes `AllowedSortColumns`, the indexed-column subset, while the +gate a query actually passes through is `Model.AllowedSortCombinations` (`sql.go:652`). The two +disagree in both directions: `relevance` is absent because it is a special case rather than a +column, and channels, users and banned users publish no sort block at all because their +`TableConfig` has no `Model` and `SortCombinations()` returns nil without one. Obeying it would +delete channel sorting outright. Zita raised both discrepancies with Yun on 2026-08-12 +([thread](https://getstream.slack.com/archives/C07AL9Q0T2T/p1786540942575199)), naming the +missing `relevance` and the thirteen member fields behind `QueryMembersPayload`'s single +published `created_at`; it is acknowledged and unfixed as of openapi-v238.0.2. Re-check when a +later spec version lands.
-111 fields — raw extraction; apply the two overlays above before reading a row +166 fields -The rows are `mq.TableConfig.Columns` verbatim, so they still carry `$ne` and `$nin` wherever the -backend's query layer accepts them. The published spec does not: strike both from every row except -`user.id` (`$ne`, `$nin`) and `user.banned` / `shadow_banned` / `bypass_moderation` (`$ne`). No -channel row keeps either. - -| resource | field | type | operators | +| endpoint | field | type | operators | | --- | --- | --- | --- | -| channel | `id` | String | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | -| channel | `cid` | String | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | -| channel | `type` | String | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | -| channel | `last_message_at` | Date | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | -| channel | `last_updated` | Date | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | -| channel | `created_at` | Date | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | -| channel | `updated_at` | Date | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | -| channel | `member_count` | Number | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | -| channel | `message_count` | Number | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | -| channel | `frozen` | Boolean | `$eq` | -| channel | `team` | String | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | -| channel | `created_by_id` | String | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | -| channel | `disabled` | Boolean | `$eq` | -| channel | `hidden` | Boolean | `$eq` | -| channel | `blocked` | Boolean | `$eq` | -| channel | `archived` | Boolean | `$eq` | -| channel | `joined` | Boolean | `$eq` | -| channel | `invite` | String | `$eq` | -| channel | `name` | String | `$autocomplete` `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` `$q` | -| channel | `app_banned` | String | `$eq` | -| channel | `muted` | Boolean | `$eq` | -| channel | `member.user.name` | String | `$autocomplete` `$eq` `$ne` | -| channel | `members` | String | `$in` `$nin` | -| member | `id` | String | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | -| member | `user_id` | String | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | -| member | `created_at` | Date | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | -| member | `updated_at` | Date | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | -| member | `is_moderator` | Boolean | `$eq` `$ne` | -| member | `channel_role` | String | `$eq` `$in` | -| member | `banned` | Boolean | `$eq` | -| member | `name` | String | `$autocomplete` `$eq` `$in` `$ne` `$nin` `$q` | -| member | `user.email` | String | `$autocomplete` `$eq` `$in` `$ne` `$nin` `$q` | -| member | `user.nd_deactivated` | Boolean | `$eq` | -| member | `last_active` | Date | `$eq` `$gt` `$gte` `$lt` `$lte` `$ne` | -| member | `cid` | String | `$eq` | -| member | `invite` | String | `$eq` | -| member | `joined` | Boolean | `$eq` | -| member | `notifications_muted` | Boolean | `$eq` | -| user | `id` | String | `MergeSupportedOperators` | -| user | `name` | String | `$autocomplete` `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | -| user | `email` | String | `$eq` `$in` | -| user | `username` | String | `$autocomplete` `$eq` | -| user | `role` | String | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | -| user | `banned` | Boolean | `$eq` `$ne` | -| user | `shadow_banned` | Boolean | `$eq` `$ne` | -| user | `bypass_moderation` | Boolean | `$eq` `$ne` | -| user | `created_at` | Date | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | -| user | `updated_at` | Date | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | -| user | `last_active` | Date | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | -| user | `language` | String | `$eq` `$ne` | -| user | `teams` | String | `$contains` `$eq` `$in` | -| message | `id` | String | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | -| message | `cid` | String | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | -| message | `text` | String | `MergeSupportedOperators` | -| message | `relevance` | Number | `NoColumnOperators` | -| message | `type` | String | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | -| message | `parent_id` | String | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | -| message | `reply_count` | Number | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | -| message | `attachments` | Boolean | `$exists` | -| message | `attachments.type` | String | `$eq` `$in` | -| message | `mentioned_users.id` | String | `$contains` | -| message | `user.id` | String | `$eq` `$in` `$ne` `$nin` | -| message | `user_id` | String | `$eq` `$in` `$ne` `$nin` | -| message | `created_at` | Date | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | -| message | `updated_at` | Date | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | -| message | `pinned` | Boolean | `$eq` | -| message | `custom` | Object | `$eq` `$gt` `$gte` `$in` `$lt` `$lte` | -| draft | `channel_cid` | String | `$eq` `$in` | -| draft | `parent_id` | String | `$eq` `$exists` `$in` | -| draft | `created_at` | Date | `$eq` `$gt` `$gte` `$lt` `$lte` | -| reaction | `type` | String | `$eq` `$in` | -| reaction | `user_id` | String | `$eq` `$in` | -| reaction | `created_at` | Date | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | -| poll | `id` | String | `$eq` `$in` | -| poll | `name` | String | `$eq` `$in` | -| poll | `voting_visibility` | String | `$eq` | -| poll | `max_votes_allowed` | Number | `$eq` `$gt` `$gte` `$lt` `$lte` `$ne` | -| poll | `allow_answers` | Boolean | `$eq` | -| poll | `allow_user_suggested_options` | Boolean | `$eq` | -| poll | `is_closed` | Boolean | `$eq` | -| poll | `created_at` | Date | `$eq` `$gt` `$gte` `$lt` `$lte` | -| poll | `updated_at` | Date | `$eq` `$gt` `$gte` `$lt` `$lte` | -| poll | `created_by_id` | String | `$eq` `$in` | -| poll_vote | `id` | String | `$eq` `$in` | -| poll_vote | `poll_id` | String | `$eq` `$in` | -| poll_vote | `user_id` | String | `$eq` `$in` | -| poll_vote | `created_at` | Date | `$eq` `$gt` `$gte` `$lt` `$lte` | -| poll_vote | `updated_at` | Date | `$eq` `$gt` `$gte` `$lt` `$lte` | -| poll_vote | `option_id` | String | `$eq` `$exists` `$in` | -| poll_vote | `is_answer` | Boolean | `$eq` | -| reminder | `message_id` | String | `$eq` `$in` | -| reminder | `channel_cid` | String | `$eq` `$in` | -| reminder | `created_at` | Date | `$eq` `$gt` `$gte` `$lt` `$lte` | -| reminder | `remind_at` | Date | `$eq` `$exists` `$gt` `$gte` `$lt` `$lte` | -| thread | `channel_cid` | String | `$eq` `$in` | -| thread | `parent_message_id` | String | `$eq` `$in` | -| thread | `created_by_user_id` | String | `$eq` `$in` | -| thread | `last_message_at` | Date | `$eq` `$gt` `$gte` `$lt` `$lte` | -| thread | `created_at` | Date | `$eq` `$gt` `$gte` `$lt` `$lte` | -| thread | `updated_at` | Date | `$eq` `$gt` `$gte` `$lt` `$lte` | -| thread | `channel.disabled` | Boolean | `$eq` | -| thread | `channel.team` | String | `$eq` `$in` | -| thread | `participant_count` | Number | `$eq` `$gt` `$gte` `$lt` `$lte` | -| thread | `reply_count` | Number | `$eq` `$gt` `$gte` `$lt` `$lte` | -| thread | `active_participant_count` | Number | `$eq` `$gt` `$gte` `$lt` `$lte` | -| thread | `has_unread` | Boolean | `$eq` | -| ban | `user_id` | String | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | -| ban | `banned_by_id` | String | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | -| ban | `channel_cid` | String | `$eq` `$in` | -| ban | `created_at` | Date | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | -| ban | `reason` | String | `MergeSupportedOperators` | +| QueryBannedUsersPayload | `banned_by_id` | string | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` | +| QueryBannedUsersPayload | `channel_cid` | string | `$eq` `$in` | +| QueryBannedUsersPayload | `created_at` | date | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` | +| QueryBannedUsersPayload | `reason` | string | `$autocomplete` `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` | +| QueryBannedUsersPayload | `user_id` | string | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` | +| QueryChannelsRequest | `app_banned` | string | `$eq` | +| QueryChannelsRequest | `archived` | boolean | `$eq` | +| QueryChannelsRequest | `blocked` | boolean | `$eq` | +| QueryChannelsRequest | `channel_role` | string | `$eq` `$in` | +| QueryChannelsRequest | `cid` | string | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` | +| QueryChannelsRequest | `created_at` | date | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` | +| QueryChannelsRequest | `created_by_id` | string | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` | +| QueryChannelsRequest | `custom` | object | `$autocomplete` `$contains` `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$q` | +| QueryChannelsRequest | `disabled` | boolean | `$eq` | +| QueryChannelsRequest | `distinct` | boolean | `$eq` | +| QueryChannelsRequest | `filter_tags` | string | `$eq` `$in` | +| QueryChannelsRequest | `frozen` | boolean | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` | +| QueryChannelsRequest | `has_unread` | boolean | `$eq` | +| QueryChannelsRequest | `hidden` | boolean | `$eq` | +| QueryChannelsRequest | `id` | string | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` | +| QueryChannelsRequest | `invite` | string | `$eq` | +| QueryChannelsRequest | `joined` | boolean | `$eq` | +| QueryChannelsRequest | `last_message_at` | date | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` | +| QueryChannelsRequest | `last_updated` | date | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` | +| QueryChannelsRequest | `member.user.name` | string | `$autocomplete` `$eq` | +| QueryChannelsRequest | `member_count` | number | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` | +| QueryChannelsRequest | `members` | string | `$eq` `$in` | +| QueryChannelsRequest | `message_count` | number | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` | +| QueryChannelsRequest | `muted` | boolean | `$eq` | +| QueryChannelsRequest | `name` | string | `$autocomplete` `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$q` | +| QueryChannelsRequest | `pinned` | boolean | `$eq` | +| QueryChannelsRequest | `team` | string | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` | +| QueryChannelsRequest | `type` | string | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` | +| QueryChannelsRequest | `updated_at` | date | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` | +| QueryDraftsRequest | `channel_cid` | string | `$eq` `$in` | +| QueryDraftsRequest | `created_at` | date | `$eq` `$gt` `$gte` `$lt` `$lte` | +| QueryDraftsRequest | `parent_id` | string | `$eq` `$exists` `$in` | +| QueryMembersPayload | `banned` | boolean | `$eq` | +| QueryMembersPayload | `channel_role` | string | `$eq` `$in` | +| QueryMembersPayload | `cid` | string | `$eq` | +| QueryMembersPayload | `created_at` | date | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` | +| QueryMembersPayload | `custom` | object | `$autocomplete` `$contains` `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$q` | +| QueryMembersPayload | `id` | string | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` | +| QueryMembersPayload | `invite` | string | `$eq` | +| QueryMembersPayload | `is_moderator` | boolean | `$eq` | +| QueryMembersPayload | `joined` | boolean | `$eq` | +| QueryMembersPayload | `last_active` | date | `$eq` `$gt` `$gte` `$lt` `$lte` | +| QueryMembersPayload | `name` | string | `$autocomplete` `$eq` `$in` `$q` | +| QueryMembersPayload | `notifications_muted` | boolean | `$eq` | +| QueryMembersPayload | `updated_at` | date | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` | +| QueryMembersPayload | `user.email` | string | `$autocomplete` `$eq` `$in` `$q` | +| QueryMembersPayload | `user.nd_deactivated` | boolean | `$eq` | +| QueryMembersPayload | `user_id` | string | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` | +| QueryMessageFlagsPayload | `action` | string | `$eq` | +| QueryMessageFlagsPayload | `blocklist_name` | string | `$eq` | +| QueryMessageFlagsPayload | `channel_cid` | string | `$eq` `$in` | +| QueryMessageFlagsPayload | `date_range` | string | `$eq` | +| QueryMessageFlagsPayload | `harm_label` | string | `$eq` | +| QueryMessageFlagsPayload | `harm_type` | string | `$eq` | +| QueryMessageFlagsPayload | `image_labels` | string | `$eq` | +| QueryMessageFlagsPayload | `is_reviewed` | boolean | `$eq` | +| QueryMessageFlagsPayload | `keyword` | string | `$eq` | +| QueryMessageFlagsPayload | `matched_phrase` | string | `$eq` | +| QueryMessageFlagsPayload | `message_id` | string | `$eq` `$in` | +| QueryMessageFlagsPayload | `phrase_list_ids` | number | `$eq` | +| QueryMessageFlagsPayload | `reason` | string | `$eq` `$in` | +| QueryMessageFlagsPayload | `reporter_id` | string | `$eq` | +| QueryMessageFlagsPayload | `reporter_type` | string | `$eq` | +| QueryMessageFlagsPayload | `team` | string | `$eq` `$in` | +| QueryMessageFlagsPayload | `user_id` | string | `$eq` `$in` | +| QueryPollVotesRequest | `created_at` | date | `$eq` `$gt` `$gte` `$lt` `$lte` | +| QueryPollVotesRequest | `id` | string | `$eq` `$in` | +| QueryPollVotesRequest | `is_answer` | boolean | `$eq` | +| QueryPollVotesRequest | `option_id` | string | `$eq` `$exists` `$in` | +| QueryPollVotesRequest | `poll_id` | string | `$eq` `$in` | +| QueryPollVotesRequest | `updated_at` | date | `$eq` `$gt` `$gte` `$lt` `$lte` | +| QueryPollVotesRequest | `user_id` | string | `$eq` `$in` | +| QueryPollsRequest | `allow_answers` | boolean | `$eq` | +| QueryPollsRequest | `allow_user_suggested_options` | boolean | `$eq` | +| QueryPollsRequest | `created_at` | date | `$eq` `$gt` `$gte` `$lt` `$lte` | +| QueryPollsRequest | `created_by_id` | string | `$eq` `$in` | +| QueryPollsRequest | `custom` | object | `$autocomplete` `$contains` `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$q` | +| QueryPollsRequest | `id` | string | `$eq` `$in` | +| QueryPollsRequest | `is_closed` | boolean | `$eq` | +| QueryPollsRequest | `max_votes_allowed` | number | `$eq` `$gt` `$gte` `$lt` `$lte` | +| QueryPollsRequest | `name` | string | `$eq` `$in` | +| QueryPollsRequest | `updated_at` | date | `$eq` `$gt` `$gte` `$lt` `$lte` | +| QueryPollsRequest | `voting_visibility` | string | `$eq` | +| QueryReactionsRequest | `created_at` | date | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` | +| QueryReactionsRequest | `type` | string | `$eq` `$in` | +| QueryReactionsRequest | `user_id` | string | `$eq` `$in` | +| QueryRemindersRequest | `channel_cid` | string | `$eq` `$in` | +| QueryRemindersRequest | `created_at` | date | `$eq` `$gt` `$gte` `$lt` `$lte` | +| QueryRemindersRequest | `message_id` | string | `$eq` `$in` | +| QueryRemindersRequest | `remind_at` | date | `$eq` `$exists` `$gt` `$gte` `$lt` `$lte` | +| QueryThreadsRequest | `active_participant_count` | number | `$eq` `$gt` `$gte` `$lt` `$lte` | +| QueryThreadsRequest | `channel.disabled` | boolean | `$eq` | +| QueryThreadsRequest | `channel.team` | string | `$eq` `$in` | +| QueryThreadsRequest | `channel_cid` | string | `$eq` `$in` | +| QueryThreadsRequest | `created_at` | date | `$eq` `$gt` `$gte` `$lt` `$lte` | +| QueryThreadsRequest | `created_by_user_id` | string | `$eq` `$in` | +| QueryThreadsRequest | `custom` | object | `$autocomplete` `$contains` `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$q` | +| QueryThreadsRequest | `has_unread` | boolean | `$eq` | +| QueryThreadsRequest | `last_message_at` | date | `$eq` `$gt` `$gte` `$lt` `$lte` | +| QueryThreadsRequest | `parent_message_id` | string | `$eq` `$in` | +| QueryThreadsRequest | `participant_count` | number | `$eq` `$gt` `$gte` `$lt` `$lte` | +| QueryThreadsRequest | `reply_count` | number | `$eq` `$gt` `$gte` `$lt` `$lte` | +| QueryThreadsRequest | `updated_at` | date | `$eq` `$gt` `$gte` `$lt` `$lte` | +| QueryUsersPayload | `banned` | boolean | `$eq` `$ne` | +| QueryUsersPayload | `bypass_moderation` | boolean | `$eq` `$ne` | +| QueryUsersPayload | `created_at` | date | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` | +| QueryUsersPayload | `custom` | object | `$contains` `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` | +| QueryUsersPayload | `email` | string | `$eq` `$in` | +| QueryUsersPayload | `id` | string | `$autocomplete` `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$ne` `$nin` | +| QueryUsersPayload | `language` | string | `$eq` | +| QueryUsersPayload | `last_active` | date | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` | +| QueryUsersPayload | `name` | string | `$autocomplete` `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` | +| QueryUsersPayload | `role` | string | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` | +| QueryUsersPayload | `shadow_banned` | boolean | `$eq` `$ne` | +| QueryUsersPayload | `teams` | string | `$contains` `$eq` `$in` | +| QueryUsersPayload | `updated_at` | date | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` | +| QueryUsersPayload | `username` | string | `$autocomplete` `$eq` | +| SearchPayload | `app_banned` | string | `$eq` | +| SearchPayload | `archived` | boolean | `$eq` | +| SearchPayload | `blocked` | boolean | `$eq` | +| SearchPayload | `channel_role` | string | `$eq` `$in` | +| SearchPayload | `cid` | string | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` | +| SearchPayload | `created_at` | date | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` | +| SearchPayload | `created_by_id` | string | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` | +| SearchPayload | `custom` | object | `$autocomplete` `$contains` `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$q` | +| SearchPayload | `disabled` | boolean | `$eq` | +| SearchPayload | `distinct` | boolean | `$eq` | +| SearchPayload | `filter_tags` | string | `$eq` `$in` | +| SearchPayload | `frozen` | boolean | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` | +| SearchPayload | `has_unread` | boolean | `$eq` | +| SearchPayload | `hidden` | boolean | `$eq` | +| SearchPayload | `id` | string | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` | +| SearchPayload | `invite` | string | `$eq` | +| SearchPayload | `joined` | boolean | `$eq` | +| SearchPayload | `last_message_at` | date | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` | +| SearchPayload | `last_updated` | date | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` | +| SearchPayload | `member.user.name` | string | `$autocomplete` `$eq` | +| SearchPayload | `member_count` | number | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` | +| SearchPayload | `members` | string | `$eq` `$in` | +| SearchPayload | `message_count` | number | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` | +| SearchPayload | `muted` | boolean | `$eq` | +| SearchPayload | `name` | string | `$autocomplete` `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$q` | +| SearchPayload | `pinned` | boolean | `$eq` | +| SearchPayload | `team` | string | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` | +| SearchPayload | `type` | string | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` | +| SearchPayload | `updated_at` | date | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` | +| SearchPayload | `attachments` | boolean | `$exists` | +| SearchPayload | `attachments.type` | string | `$eq` `$in` | +| SearchPayload | `cid` | string | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` | +| SearchPayload | `created_at` | date | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` | +| SearchPayload | `custom` | object | `$eq` `$gt` `$gte` `$in` `$lt` `$lte` | +| SearchPayload | `id` | string | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` | +| SearchPayload | `mentioned_users.id` | string | `$contains` | +| SearchPayload | `parent_id` | string | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` | +| SearchPayload | `pinned` | boolean | `$eq` | +| SearchPayload | `reply_count` | number | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` | +| SearchPayload | `text` | string | `$any` `$autocomplete` `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` `$q` | +| SearchPayload | `type` | string | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` | +| SearchPayload | `updated_at` | date | `$eq` `$exists` `$gt` `$gte` `$in` `$lt` `$lte` | +| SearchPayload | `user.id` | string | `$eq` `$in` | +| SearchPayload | `user_id` | string | `$eq` `$in` |
@@ -576,6 +680,20 @@ Ours has three with no core equivalent: a typed registry that is exactly the case `FilterField` can't express, so at least one of them should survive — decide which, and note that a custom filter cannot support `matches()`. +### `filter_tags` is left out of the channel registry on purpose + +**Nothing in code says so, which is why this note exists.** It is a live column with a GIN index +and `$eq` / `$in` handlers, it is in the spec both ways (`add_filter_tags` / `remove_filter_tags` +on the update request, `filter_tags` on the response), and Swift declares a hand-written +`FilterKey` for it. Derive the registry from any of those and you will add it back — this phase +did, and it was caught in review. + +It is deprecated as **customer guidance**, not in the API: new apps are told to use custom-data +filtering or predefined filters instead. So it keeps working, and declaring it as a typed field +would read as a recommendation. `ChannelFilterField.custom('filter_tags')` still reaches it for +anyone already depending on it, and `ChannelModel.filterTags` stays — reading a value the server +sends is not the same as recommending a query. + ## Sort | Ours | Core | @@ -705,14 +823,21 @@ list `.notEqual` under "**Supported operators:**", and there is no `notEqual` in ## Definition of done -- [ ] `Filter.notEqual`, `Filter.notIn` and `Filter.nor` are `@Deprecated` — the first two - carrying Android's server-performance rationale, `nor` carrying the real reason (core does - not model it and it is not expressible in terms of what core does). -- [ ] `filter.dart`, `sort_order.dart`, our `comparable_field.dart` and - `location_coordinates.dart` are deleted; `stream_chat.dart` exports core's via the - allowlist. -- [ ] A `FilterField` / `SortField` registry exists for every queryable type, with local - extractors. +- [x] `Filter.notEqual`, `Filter.notIn` and `Filter.nor` are **removed, not deprecated** — + reversed from the original plan. The backend withdrew `$ne` and `$nin` from the published + spec and leaves `$nor` accepted-but-unpublished, so deprecating would have kept three + operators alive that the API is retiring. A preset that still carries one decodes through + `Filter.raw`. A caller that relied on them excludes client-side or shows the rows. +- [x] `filter.dart`, `sort_order.dart` and our `comparable_field.dart` are deleted; + `stream_chat.dart` exports core's via the allowlist. The allowlist covers `Filter`, + `FilterField` and `FilterOperator`, plus `EvaluationOperator` and `LogicalOperator` for + `searchQueryLength` — the remaining operator subclasses stay out, because a filter is read + with `toJson()` and `stream_feeds` does the same in all 36 places it reads one. +- [ ] `location_coordinates.dart` is deleted — still exported, the last of this row outstanding. +- [x] A `FilterField` / `SortField` registry exists for every queryable type, with local + extractors. Wire names are pinned by `sort_registry_test.dart` and + `filter_registry_test.dart`; the fields deliberately left undeclared are named in each + registry's `custom` doc comment. - [ ] **Serialisation diff:** every filter and sort the SDK can build round-trips through `toJson()` to byte-identical output against the pre-migration implementation. - [ ] **A golden ordering test** over a list of accented and ligatured names proves diff --git a/core-migration/DEFERRED.md b/core-migration/DEFERRED.md index 9e188e42b5..7cd9e0f90a 100644 --- a/core-migration/DEFERRED.md +++ b/core-migration/DEFERRED.md @@ -9,8 +9,7 @@ A row leaves this file when it lands, not when it is decided. | | What | Blocked on | Phase | | --- | --- | --- | --- | -| ☐ | Adopt core's `CurrentPlatform` / `PlatformType`, renaming `.name` → `.operatingSystem` | A **`stream_core` release** carrying `debugCurrentPlatformOverride`. It is on core's `main`; 0.5.0 does not have it, and `stream_chat_flutter`'s tests set it in 8 places. | [02](02-platform-and-environment.md) | -| ☐ | Adopt core's `Filter` / `Sort` / `ComparableField` | Core gaining `$nor`. `$ne` and `$nin` are *not* upstream asks — every other SDK has deprecated or dropped them. | [08](08-query-dsl.md) | +| ☐ | **Restore hosted `stream_core` / `stream_core_flutter` constraints** in `melos.yaml` | A `stream_core` release carrying `Filter.raw`, `normalizeStringForSort`, `debugCurrentPlatformOverride` and `sortedWith`. Until then `melos bootstrap` writes a `git:` block into `stream_chat`, `stream_chat_flutter_core` and `stream_chat_flutter`, which makes all three unpublishable. This is the row every other "blocked on a core release" note now folds into. | [08](08-query-dsl.md) | | ☐ | A test proving a malformed response body surfaces as `StreamClientException` rather than a bare `TypeError` | A call through the generated client — nothing in this package exercises `runApiSafely` yet. Arrives with `openapi-migration` group 02. | [03](03-errors.md) | ## Needs a live check, not more code @@ -19,6 +18,7 @@ A row leaves this file when it lands, not when it is decided. | --- | --- | --- | --- | | ☐ | One anonymous connect against a real app key | Anonymous requests now send `user_id=!anon` instead of a random id. Three backend paths say it is safe, but the enforcement in `auth.go:179` only runs for a raw anon JWT, which chat never sends — so what the server does with the *query parameter* is inference. | [04](04-token-and-auth.md) | | ☐ | `sample_app` by hand: cold login, mid-session token expiry, logout → login as a different user | Core's interceptor refuses to refresh across a user switch. Correct, but it is a behaviour change on the path where failure means "cannot log in". | [04](04-token-and-auth.md) | +| ☐ | Probe `queryUsers` with a range operator on `name`, and a non-`$eq`/`$in` operator on a custom field | `UserFilterField.name` and `.custom` document a narrower operator set than both the published spec and `mq/user/user.go:25,43`, on the strength of observed 400s that were never written down. Source now contradicts the docs, so the next person to reconcile the two will widen them back. | [08](08-query-dsl.md) | | ☐ | One real request against a live app key | `api_key` stays a query parameter rather than moving to core's header-setting `ApiKeyInterceptor`; mocks cannot tell us the server agrees. | [05](05-http-client.md) | | ☐ | Benchmark `merge` on realistic lists (1k+ sorted messages, a large member list, the read map) | Decides whether chat adopts core's keyed-map-merge or core adopts chat's two-pointer merge. It runs on every message, member and read update. | [01](01-utilities.md) | | ☐ | `flutter build web --wasm` on the sample app | Core's detector has no throwing stub, so this should be a formality — but the wasm fix (`#2940`) exists because chat's *did*, so confirm rather than assume. | [02](02-platform-and-environment.md) | @@ -27,13 +27,13 @@ A row leaves this file when it lands, not when it is decided. | | What | Waiting on | Phase | | --- | --- | --- | --- | +| ☐ | Adopt core's `CurrentPlatform` / `PlatformType`, renaming `.name` → `.operatingSystem` | The restore row above. No release of its own: the SHA pinned in [08](08-query-dsl.md) already carries `debugCurrentPlatformOverride`, which `stream_chat_flutter`'s tests set in 8 places, so this is doable now and only the hosted constraint is outstanding. | [02](02-platform-and-environment.md) | | ☐ | **A `StreamChatConfig`**, mirroring `FeedsConfig` | Deliberately last, as a cleanup step once the adoption is done. It subsumes several rows below, so doing it early would mean doing them twice. See [below](#the-streamchatconfig-that-absorbs-several-of-these). | [10](10-cleanup.md) | | ☐ | Retire `StreamChatClient.additionalHeaders` and `defaultUserAgent` | Both are public mutable statics, so two clients in one process share them. Replacing the first needs a per-client `headers` option; the second reads the static `_systemEnvironmentManager`, so they move together. | [10](10-cleanup.md) | | ☐ | Take `StreamHttpClientOptions` directly instead of `baseURL` / `connectTimeout` / `receiveTimeout` | Folds into the config above rather than being a separate break. | [10](10-cleanup.md) | | ☐ | Mark `StreamHttpClient` `@internal` | `AttachmentFileUploaderProvider` is the only public signature naming it, and retyping that is phase 09's call. | [09](09-uploads.md) | | ☐ | Reclassify the SDK's own precondition throws | 23 sites still raise `StreamChatError`. `ERROR_LAYER.md` splits them further than a sweep can: a condition a correct program can hit becomes a `StreamException`, while genuine misuse should raise `StateError` / `ArgumentError` and never be wrapped. Doing it by sed would get it wrong. | [03](03-errors.md) | | ☐ | Delete `stream_chat_error.dart` | Three things first: phase 07 (parked) removes `StreamWebSocketError`, the precondition throws above are reclassified, and the UI's attachment-validation subtypes stop being errors — they are *returned values*, never thrown. `StreamChatNetworkError` is already gone. | [03](03-errors.md) | -| ☐ | Decide the fate of `Filter.custom` / `Filter.raw` / `Filter.empty` | Core has no equivalent. At least one should survive: a typed `FilterField` registry cannot express a field the SDK does not model. | [08](08-query-dsl.md) | | ☐ | Move chat's WebSocket to `/api/v2/connect` | Three blockers, none of them chat-side: v2's handshake never calls `EnrichUserMutes` (`lib/chat/controller/v1/connect.go:118` only), it decodes `user_details` with `WithDecodeExtraFields(false)` so chat's root-promoted `extraData` is dropped, and core's `ConnectUserDetailsRequest` has no `privacySettings`. iOS is on core and v2 endpoints and still connects over v1. | [07](07-websocket.md) | | ☐ | Narrow `PredefinedFilter._defaultSortFor` to the server's flag condition | It answers `last_message_at` whenever the filter mentions the field at all. The server flips its fallback only when *every* `last_message_at` node is reachable through `$and` alone and at least one narrows by value — `$eq` / `$ne` / `$gt` / `$gte` / `$lt` / `$lte`, or `$exists: true` (`DetectLastMessageAtFiltering`, `lib/core/mq/channel/modifiers.go`). So a preset putting `last_message_at` under `$or`, or matching it with `$in` or `$exists: false`, leaves the server on `last_updated` while the client answers `last_message_at`, and `loadMore`'s offset indexes into a differently ordered list. A test pins the loose `$or` behaviour today, so closing this inverts it. | [08](08-query-dsl.md) | | ☐ | Decide whether id-like sort fields should opt out of string folding | `StreamSortField` folds **every** string value through `normalizeStringForSort`, which is what `ComparableField` did, so [08](08-query-dsl.md) kept it. It also means `UserSortField.id`, `MessageSearchSortField.id`, `MemberSortField.userId`, `MessageReminderSortField.channelCid` and `ThreadSortField.parentMessageId` compare case- and diacritic-insensitively — two ids differing only in case tie, so a composite sort's tie-breaker stops breaking ties. Pre-existing, and a `foldStrings: false` per field would fix it; changing it is a behaviour change beyond the migration. | [08](08-query-dsl.md) | diff --git a/core-migration/UPSTREAM.md b/core-migration/UPSTREAM.md index f0efffdaa2..6850013300 100644 --- a/core-migration/UPSTREAM.md +++ b/core-migration/UPSTREAM.md @@ -16,6 +16,7 @@ rather than deleted so the same asks are not re-raised. | | What | Why it belongs in core | Blocked on | | --- | --- | --- | --- | | ☐ | **The retry table** — `isRetriable` over the sealed exception kinds | `ERROR_LAYER.md` §Retrying *specifies* this table, and core owns the doc. Chat now implements it ([03](03-errors.md)); feeds independently re-derived a partial version in `capabilities_repository.dart`'s `shouldRetry`. Two products deriving the same table from the same spec is the definition of a core concern. | Nothing. Strongest candidate here. | +| ☐ | **Text operators over an array-valued field** — `QueryOperator` / `AutoCompleteOperator` in `matches()` | Both bail on `fieldValue is! String` (`filter.dart:540`, `:556`), so a getter returning an `Iterable` never matches, whatever the value. Core already resolves arrays element-wise for `$eq`/`$in`/`$contains`; the evaluation operators were not extended with them. The API supports `$autocomplete` on array fields — chat's `ChannelFilterField.memberUserName` is one — so the query is right and only local evaluation disagrees. `stream_feeds` calls `matches()` in 36 event handlers, which is where this would surface first. | Nothing. | | ☑ | **`normalizeStringForSort`** | Landed in [core#181](https://github.com/GetStream/stream-core-flutter/pull/181) as a utility, ported with its tests. **Not** as a change to `ComparableField`, which the row originally proposed: `Filter` compares through the same code (`filter.dart:299,320`), so folding there would make `$eq`, `$gt` and `$lt` case- and diacritic-insensitive locally while the API stayed exact. | Landed; chat deletes its copy on the next core release. | | ✗ | **`Filter` `$nor`** | **Dropped, and chat removes it too.** Neither StreamCore (Swift) nor stream-android-core models `$nor`, and adding it to Dart alone breaks a parity the three otherwise keep. The backend withdrew `$ne`/`$nin` from the published spec in [GetStream/chat#15657](https://github.com/GetStream/chat/pull/15657) and left `$nor` accepted-but-unpublished, so a preset can still contain it — which is what `Filter.raw` is for, not a modelled operator. | Closed. | | ☐ | **The two-pointer `merge`** (`core/util/list_extensions.dart`) | If the benchmark [01](01-utilities.md) is parked on shows it beats core's keyed-map-merge-then-sort at real list sizes, core should take *ours* rather than chat taking core's — every product merges paginated lists. | The benchmark. | @@ -66,11 +67,11 @@ product would react to it the same way. Nothing outside chat reacts to `message. ## How to raise one Core is a separate repo with its own release cadence, so batch these: a row here is rarely urgent on -its own, and each release chat has to wait for costs more than the change itself. What is worth -pushing first is whatever this plan is actually blocked on, which is one thing: a release carrying -everything `melos.yaml` pins the branch to. As of phase [08](08-query-dsl.md) that is -`Filter.raw`, `normalizeStringForSort`, `debugCurrentPlatformOverride` and `sortedWith`. The rest -of the ☐ rows are improvements, not blockers, and can ride a later release. +its own, and each release chat has to wait for costs more than the change itself. Neither of the two this file used to +name is live any more: `$nor` is dropped (chat removes it in the same PR that adopts core's +`Filter`, because the API is withdrawing it), and `debugCurrentPlatformOverride` has landed on +core's `main`. What matters now is a single release carrying everything the branch pins to — +[DEFERRED.md](DEFERRED.md) holds that list. The retry table is the strongest of the rest. Cross-repo workflow is in [`STYLE_GUIDE.md`](../STYLE_GUIDE.md) (§Dependency management): a path dependency while both repos change together, back to a hosted constraint in `melos.yaml` before diff --git a/docs/docs_screenshots/test/message_search/message_search_list_view_test.dart b/docs/docs_screenshots/test/message_search/message_search_list_view_test.dart index 08cc2051e7..66db36946e 100644 --- a/docs/docs_screenshots/test/message_search/message_search_list_view_test.dart +++ b/docs/docs_screenshots/test/message_search/message_search_list_view_test.dart @@ -69,7 +69,7 @@ void main() { final controller = StreamMessageSearchListController.fromValue( PagedValue(items: results), client: client, - filter: Filter.equal('type', 'messaging'), + filter: .equal(ChannelFilterField.type, 'messaging'), searchQuery: 'flutter', ); diff --git a/docs/docs_screenshots/test/reactions/reactions_test.dart b/docs/docs_screenshots/test/reactions/reactions_test.dart index 4425ff5bb3..37f71fef9a 100644 --- a/docs/docs_screenshots/test/reactions/reactions_test.dart +++ b/docs/docs_screenshots/test/reactions/reactions_test.dart @@ -12,7 +12,7 @@ void main() { setUpAll(() { registerFallbackValue(const PaginationParams()); - registerFallbackValue(Filter.equal('type', 'like')); + registerFallbackValue(ReactionFilter.equal(ReactionFilterField.type, 'like')); }); // -------------------------------------------------------------------------- diff --git a/docs/docs_screenshots/test/src/golden_client_stubs.dart b/docs/docs_screenshots/test/src/golden_client_stubs.dart index 1ba1b63d93..aee4fbe06a 100644 --- a/docs/docs_screenshots/test/src/golden_client_stubs.dart +++ b/docs/docs_screenshots/test/src/golden_client_stubs.dart @@ -7,7 +7,7 @@ bool _registeredFallbacks = false; void _ensureGoldenMocktailFallbacks() { if (_registeredFallbacks) return; - registerFallbackValue(const Filter.empty()); + registerFallbackValue(const ChannelFilter.raw({})); registerFallbackValue(const ThreadOptions()); registerFallbackValue(const PaginationParams()); registerFallbackValue(>[]); diff --git a/migrations/v11-migration.md b/migrations/v11-migration.md index a2fc03c914..c9602c7d63 100644 --- a/migrations/v11-migration.md +++ b/migrations/v11-migration.md @@ -109,6 +109,19 @@ search-and-replace you can apply directly. `Kind` is one of `renamed`, `removed` | `getComparableField(String)` on `User`, `Message`, `Member`, `Draft`, `Thread`, `Poll`, `PollVote`, `Reaction`, `BannedUser`, `MessageReminder` and `ChannelState` | — | `removed` | The types it named were unexported, but the method was public on all eleven models. A field reads its own value now, so an override has nowhere to go | | `NullOrdering` / `CompositeComparator` | `stream_core`'s, re-exported | `moved` | Same names and semantics | | `client.search(sort:)` / `channel.search(sort:)` / `StreamMessageSearchListController.sort`, taking `SortOrder?` | `List?` | `retyped` | Was untyped, so a channel field compiled — and the server does not reject one, it reads it as a custom message field, which is null on every message, so the term silently did nothing | +| `Filter.equal('type', 'messaging')` | `ChannelFilter.equal(ChannelFilterField.type, 'messaging')` | `retyped` | One `Filter` alias and one field registry per query, as with sort and as in `stream_feeds` | +| `Filter` (`key`, `value`, `operator`) | `stream_core`'s sealed `Filter` | `retyped` | The parts are gone; read the filter with `toJson()` | +| `Filter` value equality | — | `removed` | It was `Equatable`; core's compares by identity. Compare `toJson()` | +| `FilterOperator` (enum) | `FilterOperator` (extension type over `String`) | `retyped` | `'$eq'` and `FilterOperator.equal` interchange | +| `Filter.empty()` | `null` | `removed` | Every `filter` argument is nullable. `queryThreads` widens for an omitted filter but not an empty one, so the two are not the same request | +| `Filter.notEqual` / `Filter.notIn` / `Filter.nor` | — | `removed` | `$ne`, `$nin` and `$nor` are deprecated server-side and are being withdrawn. Drop the rows from the result instead, as the iOS and React Native sample apps do | +| `Filter.notExists(key)` | `Filter.exists(field, exists: false)` | `renamed` | One operator with a flag, matching the wire shape | +| `Filter.custom(value:, operator:, key:)` | `XFilterField.custom(remote)` or `Filter.raw` | `removed` | A field the SDK does not model, versus a query it cannot express | +| `Filter.raw(value: {...})` | `Filter.raw({...})` | `retyped` | Positional. Not validated, and `matches` throws for it | +| `queryChannels(filter:)`, `queryUsers(filter:)`, `queryMembers(filter:)`, … taking `Filter?` | `ChannelFilter?`, `UserFilter?`, `MemberFilter?`, … | `retyped` | A field from another model no longer compiles | +| `ChatPersistenceClient` filter arguments | `ChannelFilter?` | `retyped` | `getChannelStates`, `queryChannelStates`, `updateChannelQueries`, `saveChannelQueries` | +| _(new)_ | `ChannelFilterField.members` / `.memberUserName` | `added` | Keeps the standard "channels I am in" query typed | +| _(new)_ | `ChannelModel.muted` / `.blocked`, `Channel.blocked` / `.blockedStream` | `added` | Already on the channel payload; now read without reaching into extra data | | _(more added per feature as PRs land)_ | | | | --- diff --git a/openapi-migration/11-channels-and-members.md b/openapi-migration/11-channels-and-members.md index 21eb4700c2..ae276ee4f6 100644 --- a/openapi-migration/11-channels-and-members.md +++ b/openapi-migration/11-channels-and-members.md @@ -72,6 +72,12 @@ ## Decisions to make - `ChannelState`, `ChannelModel` and `Member` are public, persisted, and rebuilt from WebSocket events. Keep ours and map. +- **Whether `ChannelModel` promotes its `extraData`-backed flags to real fields.** `disabled`, `hidden`, + `muted`, `blocked` and `truncatedAt` all arrive as root fields on `ChannelResponse` but are pushed into + `extraData` and read back through getters, which the constructor comment calls "for backwards compatibility". + Promoting them is a break worth making in v11 if it is made at all, and it belongs with this group's model + shape rather than with whichever phase happens to add the next flag. Raised on + [#2958](https://github.com/GetStream/stream-chat-flutter/pull/2958). - `sync` returns `SyncResponse` — one of the two models that needed the WSEvent generator patch. Verify it decodes before relying on it. ## Risks diff --git a/packages/stream_chat/CHANGELOG.md b/packages/stream_chat/CHANGELOG.md index 2b0568ecb9..48493cea82 100644 --- a/packages/stream_chat/CHANGELOG.md +++ b/packages/stream_chat/CHANGELOG.md @@ -2,24 +2,35 @@ 🛑️ Breaking -- Logging moves to `stream_core`. `logLevel` and `logHandlerFunction` become one `logConfig`, `client.logger` is a `StreamLogger`, and `detachedLogger`, `defaultLogHandler` and `LogHandlerFunction` are removed along with the `package:logging` re-export. The default is unchanged: warnings and errors to the console. Supply a `StreamLogHandler` to route records into your own facility. +- Logging is rebuilt. `logLevel` and `logHandlerFunction` become one `logConfig`, `client.logger` is a `StreamLogger`, and `detachedLogger`, `defaultLogHandler` and `LogHandlerFunction` are removed along with the `package:logging` re-export. The default is unchanged: warnings and errors to the console. Supply a `StreamLogHandler` to route records into your own facility. - `LoggingInterceptor`, `InterceptStep` and `LogPrint` are no longer exported. The interceptor is installed by default and writes through the configured `StreamLogHandler`, so routing its output is a `logConfig` concern now. -- The token layer is now `stream_core`'s. `Token` becomes `UserToken`, and `TokenProvider` becomes an interface rather than a `Future Function(String)` typedef — pass `TokenProvider.dynamic(myLoader)` where you passed a closure, and note a loader now returns a `UserToken`. `TokenManager.loadToken` becomes `getToken`, `isStatic` becomes `usesStaticProvider`, and `setTokenOrProvider` becomes `setTokenProvider`. +- The token layer is retyped. `Token` becomes `UserToken`, and `TokenProvider` becomes an interface rather than a `Future Function(String)` typedef — pass `TokenProvider.dynamic(myLoader)` where you passed a closure, and note a loader now returns a `UserToken`. `TokenManager.loadToken` becomes `getToken`, `isStatic` becomes `usesStaticProvider`, and `setTokenOrProvider` becomes `setTokenProvider`. - Anonymous connections now identify as `!anon` rather than a client-generated random id, matching every other Stream SDK. The backend pins that id so a client cannot claim to be another user. - `StreamChatClient.devToken` is removed. It minted a `devtoken`-signed JWT, which only an app with development tokens enabled accepts; generate tokens on your backend, or build one in your own test helper. -- A failed request now throws one of `stream_core`'s sealed `StreamException` kinds — `StreamApiException`, `StreamNetworkException`, `StreamAuthenticationException` or `StreamClientException` — instead of a `StreamChatNetworkError`. `StreamChatException` aliases the root, so `on StreamChatException catch` handles them all. See the [v11 migration guide](https://github.com/GetStream/stream-chat-flutter/blob/master/migrations/v11-migration.md#error-handling). +- A failed request now throws one of four sealed `StreamException` kinds — `StreamApiException`, `StreamNetworkException`, `StreamAuthenticationException` or `StreamClientException` — instead of a `StreamChatNetworkError`. `StreamChatException` aliases the root, so `on StreamChatException catch` handles them all. See the [v11 migration guide](https://github.com/GetStream/stream-chat-flutter/blob/master/migrations/v11-migration.md#error-handling). - `ChatErrorCode` is removed in favour of `StreamErrorCode`. One value was wrong: `requestTimeout` was `23`, which the API never returns; the real code is `48`. - `RetryPolicy.shouldRetry` receives a `StreamChatException?` instead of a `StreamChatError?`. - `UploadState`'s variant classes are renamed to `UploadStatePreparing`, `UploadStateInProgress`, `UploadStateSuccess` and `UploadStateFailed`, freeing the names `Success` and `Failed`. -- `Result` from `package:async` is no longer re-exported; the re-exported `Result` is `stream_core`'s. -- Sorting is now `stream_core`'s. `SortOption.desc(ChannelSortKey.lastUpdated)` becomes `ChannelSort.desc(ChannelSortField.lastUpdated)` — one `Sort` subclass and one field registry per model, with the same member names as the old `*SortKey`. +- `Result` from `package:async` is no longer re-exported. The `Result` this package exports is a different type, with `Success` and `Failure` variants. +- Sorting is restructured. `SortOption.desc(ChannelSortKey.lastUpdated)` becomes `ChannelSort.desc(ChannelSortField.lastUpdated)` — one `Sort` subclass and one field registry per model, with the same member names as the old `*SortKey`. - `SortOrder` is removed. Signatures take `List`, `List` and so on. -- `NullOrdering`, `SortDirection` and the `compare` extension are `stream_core`'s, re-exported from this package. +- `NullOrdering`, `SortDirection` and the `compare` extension keep their names and are still exported from this package. - `ComparableField`, `ComparableFieldProvider` and `SortOption.fromJson` are removed. A stored sort is read back with `ChannelSort.fromJson`. - `SortOption`'s `comparator` argument is removed. Declare a field whose value projects onto something orderable, or sort the list yourself. - `PollVoteSortField.answerText` is removed: the API rejects a sort on `answer_text`. - `ChannelSortField.cid` is added, matching the iOS and Android SDKs. - `search(sort:)` on the client and channel, and `StreamMessageSearchListController.sort`, are typed `List` rather than an untyped `SortOrder`. Searching is the only message query the API sorts, so the type is named for it. +- Filtering is restructured. `Filter.equal('type', 'messaging')` becomes `ChannelFilter.equal(ChannelFilterField.type, 'messaging')` — one `Filter` alias and one field registry per query, matching the sort change. A field the SDK does not model is reached with `ChannelFilterField.custom('my_field')`. +- `Filter` is sealed and no longer exposes `key`, `value` or `operator`. Read it with `toJson`. +- `Filter` compares by identity rather than by value. Compare `toJson()` where you compared filters. +- `FilterOperator` is an extension type over `String` rather than an enum, so `'$eq'` and `FilterOperator.equal` interchange. +- `Filter.empty()` is removed. Every `filter` argument is nullable; pass `null` to match everything. This matters on `queryThreads`, where the API widens the query for an omitted filter but not for an empty one. +- `Filter.notEqual`, `Filter.notIn` and `Filter.nor` are removed. `$ne`, `$nin` and `$nor` are deprecated server-side and are being withdrawn. A query that excluded someone — a directory hiding the signed-in user, a member picker hiding existing members — has to do that in the client now, or show them. The sample app shows them. +- `Filter.notExists(key)` becomes `Filter.exists(field, exists: false)`. +- `Filter.custom({value, operator, key})` is removed. Use a registry's `custom` factory for an unmodelled field, or `Filter.raw` for a query this package cannot express. +- `Filter.raw` takes its map positionally: `Filter.raw({...})` rather than `Filter.raw(value: {...})`. It is not validated, and `matches` throws for it. +- Every query takes its own filter type — `queryChannels` a `ChannelFilter?`, `queryUsers` a `UserFilter?`, and so on — and `PredefinedFilter.filter` is a `ChannelFilter`. +- `ChannelFilterField.members` and `.memberUserName` are declared, so the standard "channels I am in" query stays typed. - `DraftSortField` has no `custom` field: the API rejects a custom sort field on drafts. - A sort names its model's field type, so `MemberSort.asc` takes a `MemberSortField` and a field from another model does not compile. `XSortField.custom(key)` reads a field from the model's extra data, for the four models whose queries accept one. - Added `ChannelSort.empty`, `MemberSort.empty` and one on every other sort — an empty sort, for querying with the ordering the API applies on its own. @@ -28,8 +39,8 @@ 🔄 Changed -- Failed messages now retry on server errors. The retry policy follows `stream_core`'s table: retry a request that never reached the server, a 5xx, a 429 and a 408; never another 4xx, a cancelled request, broken credentials, or anything the server marked unrecoverable. Previously only failures without a parseable error body retried, so a 500 or a 429 did not. -- `SystemEnvironment` is now `stream_core`'s type, re-exported from this package. Its constructor and fields are unchanged, so existing usage keeps working. +- Failed messages now retry on server errors. The retry policy is now explicit: retry a request that never reached the server, a 5xx, a 429 and a 408; never another 4xx, a cancelled request, broken credentials, or anything the server marked unrecoverable. Previously only failures without a parseable error body retried, so a 500 or a 429 did not. +- `SystemEnvironment` is a different type with the same constructor and fields, so existing usage keeps working. - Most SDK logging moved off `info`. It now carries only client and connection lifecycle — client created and disposed, user set and disconnected, connection opening, established and closing — and per-operation, per-event and per-timer records are `debug` or `verbose`. Raising the priority to `info` to debug a problem no longer buries it under a health check every 20 seconds and a line per WebSocket frame. ✅ Added @@ -49,7 +60,7 @@ 🔄 Internal / Non-breaking - Added the OpenAPI-generated v2 client under `lib/open_api/`, along with the `melos run gen:openapi` tooling that produces it. No API uses it yet. -- Replaced the internal `InFlightCache` and `SystemEnvironmentManager` with `stream_core`'s equivalents. +- Replaced the internal `InFlightCache` and `SystemEnvironmentManager` with shared implementations. ## Upcoming diff --git a/packages/stream_chat/lib/src/client/channel/channel.dart b/packages/stream_chat/lib/src/client/channel/channel.dart index 7330565e5b..a6d4a76275 100644 --- a/packages/stream_chat/lib/src/client/channel/channel.dart +++ b/packages/stream_chat/lib/src/client/channel/channel.dart @@ -268,6 +268,20 @@ class Channel { return state!.channelStateStream.map((cs) => cs.channel?.hidden == true).distinct(); } + /// Channel blocked status. + /// Status is specific to the current user. + bool get blocked { + _checkInitialized(); + return state!.channelState.channel?.blocked == true; + } + + /// Channel blocked status as a stream. + /// Status is specific to the current user. + Stream get blockedStream { + _checkInitialized(); + return state!.channelStateStream.map((cs) => cs.channel?.blocked == true).distinct(); + } + /// Channel pinned status. /// Status is specific to the current user. bool get isPinned { @@ -1373,13 +1387,13 @@ class Channel { /// Search for a message with the given options. Future search({ String? query, - Filter? messageFilters, + MessageSearchFilter? messageFilters, List? sort, PaginationParams? paginationParams, }) { _checkInitialized(); return _client.search( - Filter.in_('cid', [cid!]), + .in_(ChannelFilterField.cid, [cid]), sort: sort, query: query, paginationParams: paginationParams, @@ -1540,7 +1554,7 @@ class Channel { /// [sort] options. Future queryPollVotes( String pollId, { - Filter? filter, + PollVoteFilter? filter, List? sort, PaginationParams pagination = const PaginationParams(), }) { @@ -2211,7 +2225,7 @@ class Channel { /// Query channel members. Future queryMembers({ - Filter? filter, + MemberFilter? filter, List? sort, PaginationParams? pagination, }) => _client.queryMembers( @@ -2225,12 +2239,12 @@ class Channel { /// Query channel banned users. Future queryBannedUsers({ - Filter? filter, + BannedUserFilter? filter, List? sort, PaginationParams? pagination, }) { _checkInitialized(); - filter ??= Filter.equal('channel_cid', cid!); + filter ??= .equal(BannedUserFilterField.channelCid, cid); return _client.queryBannedUsers( filter: filter, sort: sort, diff --git a/packages/stream_chat/lib/src/client/channel/channel_event_handler.dart b/packages/stream_chat/lib/src/client/channel/channel_event_handler.dart index 190f3deb71..72ec6215f5 100644 --- a/packages/stream_chat/lib/src/client/channel/channel_event_handler.dart +++ b/packages/stream_chat/lib/src/client/channel/channel_event_handler.dart @@ -414,7 +414,9 @@ class ChannelEventHandler { if (event.cid == null) return; final user = event.user!; - final member = await _channel.queryMembers(filter: Filter.equal('id', user.id)).then((it) => it.members.first); + final member = await _channel + .queryMembers(filter: .equal(MemberFilterField.userId, user.id)) + .then((it) => it.members.first); _mutations.onMemberBanned(member); } @@ -424,7 +426,9 @@ class ChannelEventHandler { if (event.cid == null) return; final user = event.user!; - final member = await _channel.queryMembers(filter: Filter.equal('id', user.id)).then((it) => it.members.first); + final member = await _channel + .queryMembers(filter: .equal(MemberFilterField.userId, user.id)) + .then((it) => it.members.first); _mutations.onMemberUnbanned(member); } diff --git a/packages/stream_chat/lib/src/client/client.dart b/packages/stream_chat/lib/src/client/client.dart index b609bd6298..c707adb47f 100644 --- a/packages/stream_chat/lib/src/client/client.dart +++ b/packages/stream_chat/lib/src/client/client.dart @@ -33,7 +33,6 @@ import '../core/models/channel_state.dart'; import '../core/models/draft.dart'; import '../core/models/draft_message.dart'; import '../core/models/event.dart'; -import '../core/models/filter.dart'; import '../core/models/location.dart'; import '../core/models/location_coordinates.dart'; import '../core/models/member.dart'; @@ -591,7 +590,7 @@ class StreamChatClient { // only if the client is configured to do so. if (_recoverStateOnReconnect) { await queryChannelsOnline( - filter: Filter.in_('cid', cids), + filter: .in_(ChannelFilterField.cid, cids), paginationParams: const PaginationParams(limit: 30), ); } @@ -692,7 +691,7 @@ class StreamChatClient { /// Use [queryChannelsWithResult] if you also need the server-resolved /// [PredefinedFilter] spec. Stream> queryChannels({ - Filter? filter, + ChannelFilter? filter, List? channelStateSort, String? predefinedFilter, Map? filterValues, @@ -727,7 +726,7 @@ class StreamChatClient { /// the online result. Concurrent identical online queries are coalesced /// via [_queryChannelsCache]. Stream queryChannelsWithResult({ - Filter? filter, + ChannelFilter? filter, List? channelStateSort, String? predefinedFilter, Map? filterValues, @@ -816,7 +815,7 @@ class StreamChatClient { /// Requests channels with a given query from the API. Future> queryChannelsOnline({ - Filter? filter, + ChannelFilter? filter, List? sort, String? predefinedFilter, Map? filterValues, @@ -847,7 +846,7 @@ class StreamChatClient { } Future _queryChannelsOnlineImpl({ - Filter? filter, + ChannelFilter? filter, List? sort, String? predefinedFilter, Map? filterValues, @@ -924,7 +923,7 @@ class StreamChatClient { // Clear the query cache if we are refreshing. final clearQueryCache = (paginationParams.offset ?? 0) == 0; - Filter? resolvedFilter; + ChannelFilter? resolvedFilter; List? resolvedSort; if (res.predefinedFilter case final resolvedPredefinedFilter?) { resolvedFilter = resolvedPredefinedFilter.filter; @@ -952,7 +951,7 @@ class StreamChatClient { /// Requests channels with a given query from the Persistence client. Future> queryChannelsOffline({ - Filter? filter, + ChannelFilter? filter, String? predefinedFilter, Map? filterValues, Map? sortValues, @@ -973,7 +972,7 @@ class StreamChatClient { } Future _queryChannelsOfflineImpl({ - Filter? filter, + ChannelFilter? filter, String? predefinedFilter, Map? filterValues, Map? sortValues, @@ -1034,7 +1033,7 @@ class StreamChatClient { /// Requests users with a given query. Future queryUsers({ bool? presence, - Filter? filter, + UserFilter? filter, List? sort, PaginationParams? pagination, }) async { @@ -1050,7 +1049,7 @@ class StreamChatClient { /// Query banned users. Future queryBannedUsers({ - required Filter filter, + required BannedUserFilter filter, List? sort, PaginationParams? pagination, }) => _chatApi.moderation.queryBannedUsers( @@ -1061,11 +1060,11 @@ class StreamChatClient { /// A message search. Future search( - Filter filter, { + ChannelFilter filter, { String? query, List? sort, PaginationParams? paginationParams, - Filter? messageFilters, + MessageSearchFilter? messageFilters, }) => _chatApi.general.searchMessages( filter, query: query, @@ -1387,7 +1386,7 @@ class StreamChatClient { /// Query channel members Future queryMembers( String channelType, { - Filter? filter, + MemberFilter? filter, String? channelId, List? members, List? sort, @@ -1701,7 +1700,7 @@ class StreamChatClient { /// Queries Polls with the given [filter] and [sort] options. Future queryPolls({ - Filter? filter, + PollFilter? filter, List? sort, PaginationParams pagination = const PaginationParams(), }) => _chatApi.polls.queryPolls( @@ -1714,7 +1713,7 @@ class StreamChatClient { /// and [sort] options. Future queryPollVotes( String pollId, { - Filter? filter, + PollVoteFilter? filter, List? sort, PaginationParams pagination = const PaginationParams(), }) => _chatApi.polls.queryPollVotes( @@ -2000,7 +1999,7 @@ class StreamChatClient { /// user ID, or creation date, sorting, and cursor-based pagination. Future queryReactions( String messageId, { - Filter? filter, + ReactionFilter? filter, List? sort, PaginationParams? pagination, }) => _chatApi.message.queryReactions( @@ -2124,7 +2123,7 @@ class StreamChatClient { /// Queries drafts for the current user. Future queryDrafts({ - Filter? filter, + DraftFilter? filter, List? sort, PaginationParams? pagination, }) => _chatApi.message.queryDrafts( @@ -2252,7 +2251,7 @@ class StreamChatClient { /// /// Optionally, pass [filter] and [sort] to filter and sort the threads. Future queryThreads({ - Filter? filter, + ThreadFilter? filter, List? sort, ThreadOptions options = const ThreadOptions(), PaginationParams pagination = const PaginationParams(), @@ -2362,7 +2361,7 @@ class StreamChatClient { /// Optionally, pass [filter], [sort] and [pagination] to filter, sort and /// paginate the reminders. Future queryReminders({ - Filter? filter, + MessageReminderFilter? filter, List? sort, PaginationParams pagination = const PaginationParams(), }) { diff --git a/packages/stream_chat/lib/src/core/api/channel_api.dart b/packages/stream_chat/lib/src/core/api/channel_api.dart index cb9c3f374b..5244cbc3d9 100644 --- a/packages/stream_chat/lib/src/core/api/channel_api.dart +++ b/packages/stream_chat/lib/src/core/api/channel_api.dart @@ -3,7 +3,6 @@ import 'dart:convert'; import '../http/stream_http_client.dart'; import '../models/channel_state.dart'; import '../models/event.dart'; -import '../models/filter.dart'; import '../models/message.dart'; import '../models/message_delivery.dart'; import 'requests.dart'; @@ -54,7 +53,7 @@ class ChannelApi { /// provided. When a predefined filter is used, the server resolves it and /// returns the materialized filter/sort on [QueryChannelsResponse]. Future queryChannels({ - Filter? filter, + ChannelFilter? filter, List? sort, String? predefinedFilter, Map? filterValues, diff --git a/packages/stream_chat/lib/src/core/api/general_api.dart b/packages/stream_chat/lib/src/core/api/general_api.dart index c6ed739ba1..8fc1bb2e76 100644 --- a/packages/stream_chat/lib/src/core/api/general_api.dart +++ b/packages/stream_chat/lib/src/core/api/general_api.dart @@ -1,7 +1,7 @@ import 'dart:convert'; import '../http/stream_http_client.dart'; -import '../models/filter.dart'; +import '../models/channel_state.dart'; import '../models/member.dart'; import '../models/message.dart'; import 'requests.dart'; @@ -31,11 +31,11 @@ class GeneralApi { /// A message search. Future searchMessages( - Filter filter, { + ChannelFilter filter, { String? query, List? sort, PaginationParams? pagination, - Filter? messageFilters, + MessageSearchFilter? messageFilters, }) async { assert( pagination?.offset == null || pagination?.offset == 0 || sort == null, @@ -72,7 +72,7 @@ class GeneralApi { /// Query channel members Future queryMembers( String channelType, { - Filter? filter, + MemberFilter? filter, String? channelId, List? members, List? sort, diff --git a/packages/stream_chat/lib/src/core/api/message_api.dart b/packages/stream_chat/lib/src/core/api/message_api.dart index 2ef5e86e31..05d4f451ee 100644 --- a/packages/stream_chat/lib/src/core/api/message_api.dart +++ b/packages/stream_chat/lib/src/core/api/message_api.dart @@ -3,7 +3,6 @@ import 'dart:convert'; import '../http/stream_http_client.dart'; import '../models/draft.dart'; import '../models/draft_message.dart'; -import '../models/filter.dart'; import '../models/message.dart'; import '../models/reaction.dart'; import 'requests.dart'; @@ -96,7 +95,7 @@ class MessageApi { /// /// Returns a [QueryDraftsResponse] containing the list of draft. Future queryDrafts({ - Filter? filter, + DraftFilter? filter, List? sort, PaginationParams? pagination, }) async { @@ -263,7 +262,7 @@ class MessageApi { /// user ID, or creation date, sorting, and cursor-based pagination. Future queryReactions( String messageId, { - Filter? filter, + ReactionFilter? filter, List? sort, PaginationParams? pagination, }) async { diff --git a/packages/stream_chat/lib/src/core/api/moderation_api.dart b/packages/stream_chat/lib/src/core/api/moderation_api.dart index 4a91c790ff..175799451e 100644 --- a/packages/stream_chat/lib/src/core/api/moderation_api.dart +++ b/packages/stream_chat/lib/src/core/api/moderation_api.dart @@ -129,7 +129,7 @@ class ModerationApi { /// Queries banned users. Future queryBannedUsers({ - Filter? filter, + BannedUserFilter? filter, List? sort, PaginationParams? pagination, }) async { @@ -138,7 +138,8 @@ class ModerationApi { queryParameters: { 'payload': jsonEncode({ if (sort != null) 'sort': sort, - if (filter != null) 'filter_conditions': filter, + // Required by the endpoint, the same way `queryUsers` requires it. + 'filter_conditions': filter ?? const {}, if (pagination != null) ...pagination.toJson(), }), }, diff --git a/packages/stream_chat/lib/src/core/api/polls_api.dart b/packages/stream_chat/lib/src/core/api/polls_api.dart index fd06597173..edb6059d6f 100644 --- a/packages/stream_chat/lib/src/core/api/polls_api.dart +++ b/packages/stream_chat/lib/src/core/api/polls_api.dart @@ -1,7 +1,6 @@ import 'dart:convert'; import '../http/stream_http_client.dart'; -import '../models/filter.dart'; import '../models/poll.dart'; import '../models/poll_option.dart'; import '../models/poll_vote.dart'; @@ -161,7 +160,7 @@ class PollsApi { /// Queries polls with the given [filter], [sort], and [pagination] /// parameters. Future queryPolls({ - Filter? filter, + PollFilter? filter, List? sort, PaginationParams pagination = const PaginationParams(), }) async { @@ -180,7 +179,7 @@ class PollsApi { /// Queries poll votes with the given [pollId], [filter], [sort], and Future queryPollVotes( String pollId, { - Filter? filter, + PollVoteFilter? filter, List? sort, PaginationParams pagination = const PaginationParams(), }) async { diff --git a/packages/stream_chat/lib/src/core/api/reminders_api.dart b/packages/stream_chat/lib/src/core/api/reminders_api.dart index 27216f3ab8..f4965dc3b7 100644 --- a/packages/stream_chat/lib/src/core/api/reminders_api.dart +++ b/packages/stream_chat/lib/src/core/api/reminders_api.dart @@ -1,7 +1,6 @@ import 'dart:convert'; import '../http/stream_http_client.dart'; -import '../models/filter.dart'; import '../models/message_reminder.dart'; import 'requests.dart'; import 'responses.dart'; @@ -21,7 +20,7 @@ class RemindersApi { /// /// Returns a [QueryRemindersResponse] containing the list of reminders. Future queryReminders({ - Filter? filter, + MessageReminderFilter? filter, List? sort, PaginationParams? pagination, }) async { diff --git a/packages/stream_chat/lib/src/core/api/threads_api.dart b/packages/stream_chat/lib/src/core/api/threads_api.dart index d6c573d440..920ec509df 100644 --- a/packages/stream_chat/lib/src/core/api/threads_api.dart +++ b/packages/stream_chat/lib/src/core/api/threads_api.dart @@ -1,7 +1,6 @@ import 'dart:convert'; import '../http/stream_http_client.dart'; -import '../models/filter.dart'; import '../models/thread.dart'; import 'requests.dart'; import 'responses.dart'; @@ -15,7 +14,7 @@ class ThreadsApi { /// Queries threads with the given [options] and [pagination] params. Future queryThreads({ - Filter? filter, + ThreadFilter? filter, List? sort, ThreadOptions options = const ThreadOptions(), PaginationParams pagination = const PaginationParams(), diff --git a/packages/stream_chat/lib/src/core/api/user_api.dart b/packages/stream_chat/lib/src/core/api/user_api.dart index d5d5a82d6d..7ae0960c53 100644 --- a/packages/stream_chat/lib/src/core/api/user_api.dart +++ b/packages/stream_chat/lib/src/core/api/user_api.dart @@ -1,7 +1,6 @@ import 'dart:convert'; import '../http/stream_http_client.dart'; -import '../models/filter.dart'; import '../models/location.dart'; import '../models/location_coordinates.dart'; import '../models/user.dart'; @@ -18,7 +17,7 @@ class UserApi { /// Requests users with a given query. Future queryUsers({ bool presence = false, - Filter? filter, + UserFilter? filter, List? sort, PaginationParams? pagination, }) async { @@ -28,7 +27,9 @@ class UserApi { 'payload': jsonEncode({ 'presence': presence, if (sort != null) 'sort': sort, - if (filter != null) 'filter_conditions': filter, + // Sent even when empty: the endpoint declares `filter_conditions` + // required, and an omitted key is rejected where `{}` is accepted. + 'filter_conditions': filter ?? const {}, if (pagination != null) ...pagination.toJson(), }), }, diff --git a/packages/stream_chat/lib/src/core/models/banned_user.dart b/packages/stream_chat/lib/src/core/models/banned_user.dart index 888b57fbea..2bf6eb56a4 100644 --- a/packages/stream_chat/lib/src/core/models/banned_user.dart +++ b/packages/stream_chat/lib/src/core/models/banned_user.dart @@ -1,6 +1,6 @@ import 'package:equatable/equatable.dart'; import 'package:json_annotation/json_annotation.dart'; -import 'package:stream_core/stream_core.dart' show Sort, SortField; +import 'package:stream_core/stream_core.dart' show Filter, FilterField, Sort, SortField; import 'channel_model.dart'; import 'user.dart'; @@ -79,9 +79,77 @@ class BannedUser extends Equatable { ]; } +/// A filter for a banned-user query. +/// +/// See [BannedUserFilterField] for the fields that can be filtered on. +/// +/// ```dart +/// final filter = BannedUserFilter.equal( +/// BannedUserFilterField.channelCid, +/// 'messaging:general', +/// ); +/// ``` +typedef BannedUserFilter = Filter; + +/// Represents a field that banned-user queries can be filtered on. +class BannedUserFilterField extends FilterField { + /// Creates a banned-user filter field named [remote] on the wire, reading + /// its value off an instance with [value]. + BannedUserFilterField(super.remote, super.value); + + /// Filters banned users by their id. + /// + /// **Supported operators:** `$eq`, `$in`, `$gt`, `$gte`, `$lt`, `$lte`, + /// `$exists` + static final userId = BannedUserFilterField( + 'user_id', + (it) => it.user.id, + ); + + /// Filters banned users by the id of the user who banned them. + /// + /// **Supported operators:** `$eq`, `$in`, `$gt`, `$gte`, `$lt`, `$lte`, + /// `$exists` + static final bannedById = BannedUserFilterField( + 'banned_by_id', + (it) => it.bannedBy?.id, + ); + + /// Filters banned users by the full id of the channel they were banned in, + /// in the form `type:id`. + /// + /// **Supported operators:** `$eq`, `$in` + static final channelCid = BannedUserFilterField( + 'channel_cid', + (it) => it.channel?.cid, + ); + + /// Filters banned users by the reason given for the ban. + /// + /// **Supported operators:** `$eq`, `$in`, `$gt`, `$gte`, `$lt`, `$lte`, + /// `$exists`, `$autocomplete` + static final reason = BannedUserFilterField( + 'reason', + (it) => it.reason, + ); + + /// Filters banned users by the date the ban was created. + /// + /// **Supported operators:** `$eq`, `$in`, `$gt`, `$gte`, `$lt`, `$lte`, + /// `$exists` + static final createdAt = BannedUserFilterField( + 'created_at', + (it) => it.createdAt, + ); +} + /// Represents a sorting operation for banned users. /// /// See [BannedUserSortField] for the fields that can be sorted on. +/// +/// ```dart +/// final sort = [BannedUserSort.desc(BannedUserSortField.createdAt)]; +/// ``` class BannedUserSort extends Sort { /// Sorts by [field], smallest first. const BannedUserSort.asc( diff --git a/packages/stream_chat/lib/src/core/models/channel_model.dart b/packages/stream_chat/lib/src/core/models/channel_model.dart index 6e96de4dd9..df9bfc760e 100644 --- a/packages/stream_chat/lib/src/core/models/channel_model.dart +++ b/packages/stream_chat/lib/src/core/models/channel_model.dart @@ -31,6 +31,8 @@ class ChannelModel { this.cooldown = 0, bool? disabled, bool? hidden, + bool? muted, + bool? blocked, DateTime? truncatedAt, this.messageCount, this.filterTags, @@ -46,12 +48,14 @@ class ChannelModel { updatedAt = updatedAt ?? DateTime.now(), ownCapabilities = ownCapabilities?.map(ChannelCapability.new).toList(), - // For backwards compatibility, set 'disabled', 'hidden' - // and 'truncated_at' in [extraData]. + // For backwards compatibility, set 'disabled', 'hidden', 'muted', + // 'blocked' and 'truncated_at' in [extraData]. extraData = { ...extraData, if (disabled != null) 'disabled': disabled, if (hidden != null) 'hidden': hidden, + if (muted != null) 'muted': muted, + if (blocked != null) 'blocked': blocked, if (truncatedAt != null) 'truncated_at': truncatedAt.toIso8601String(), }; @@ -136,6 +140,14 @@ class ChannelModel { @JsonKey(includeToJson: false, includeFromJson: false) bool? get hidden => extraData['hidden'].safeCast(); + /// True if the channel is muted by the current user + @JsonKey(includeToJson: false, includeFromJson: false) + bool? get muted => extraData['muted'].safeCast(); + + /// True if the channel is blocked by the current user + @JsonKey(includeToJson: false, includeFromJson: false) + bool? get blocked => extraData['blocked'].safeCast(); + /// The date of the last time channel got truncated @JsonKey(includeToJson: false, includeFromJson: false) DateTime? get truncatedAt { @@ -222,6 +234,8 @@ class ChannelModel { int? cooldown, bool? disabled, bool? hidden, + bool? muted, + bool? blocked, DateTime? truncatedAt, int? messageCount, List? filterTags, @@ -242,8 +256,10 @@ class ChannelModel { extraData: extraData ?? this.extraData, team: team ?? this.team, cooldown: cooldown ?? this.cooldown, - disabled: disabled ?? extraData?['disabled'] as bool? ?? this.disabled, - hidden: hidden ?? extraData?['hidden'] as bool? ?? this.hidden, + disabled: disabled ?? extraData?['disabled'].safeCast() ?? this.disabled, + hidden: hidden ?? extraData?['hidden'].safeCast() ?? this.hidden, + muted: muted ?? extraData?['muted'].safeCast() ?? this.muted, + blocked: blocked ?? extraData?['blocked'].safeCast() ?? this.blocked, truncatedAt: truncatedAt ?? (extraData?['truncated_at'] == null @@ -278,6 +294,8 @@ class ChannelModel { cooldown: other.cooldown, disabled: other.disabled, hidden: other.hidden, + muted: other.muted, + blocked: other.blocked, truncatedAt: other.truncatedAt, messageCount: other.messageCount, filterTags: other.filterTags, diff --git a/packages/stream_chat/lib/src/core/models/channel_state.dart b/packages/stream_chat/lib/src/core/models/channel_state.dart index 1e474ec514..c2bffc39dc 100644 --- a/packages/stream_chat/lib/src/core/models/channel_state.dart +++ b/packages/stream_chat/lib/src/core/models/channel_state.dart @@ -1,5 +1,6 @@ import 'package:json_annotation/json_annotation.dart'; -import 'package:stream_core/stream_core.dart' show NullOrdering, Sort, SortDirection, SortField, Standard; +import 'package:stream_core/stream_core.dart' + show Filter, FilterField, NullOrdering, Sort, SortDirection, SortField, Standard; import '../util/string_sort_normalizer.dart'; import 'channel_model.dart'; import 'draft.dart'; @@ -128,6 +129,218 @@ class ChannelState { ); } +/// A filter for a channel query. +/// +/// See [ChannelFilterField] for the fields that can be filtered on. +/// +/// ```dart +/// final filter = ChannelFilter.and([ +/// ChannelFilter.equal(ChannelFilterField.type, 'messaging'), +/// ChannelFilter.in_(ChannelFilterField.members, [user.id]), +/// ]); +/// ``` +typedef ChannelFilter = Filter; + +/// Represents a field that channel queries can be filtered on. +class ChannelFilterField extends FilterField { + /// Creates a channel filter field named [remote] on the wire, reading its + /// value off an instance with [value]. + ChannelFilterField(super.remote, super.value); + + /// Creates a field the SDK does not model, read from [ChannelModel.extraData]. + /// + /// The fields the server computes per request — `joined`, `has_unread`, + /// `invite`, `distinct` and `app_banned` — are reached this way. The server + /// resolves them against the caller; a local match cannot. + /// + /// **Supported operators:** `$eq`, `$in`, `$gt`, `$gte`, `$lt`, `$lte`, `$exists`, + /// `$contains`, `$q`, `$autocomplete` + factory ChannelFilterField.custom(String remote) { + return ChannelFilterField(remote, (it) => it.channel?.extraData[remote]); + } + + /// Filters channels by their id. + /// + /// **Supported operators:** `$eq`, `$in`, `$gt`, `$gte`, `$lt`, `$lte`, `$exists` + static final id = ChannelFilterField( + 'id', + (it) => it.channel?.id, + ); + + /// Filters channels by their full id, in the form `type:id`. + /// + /// **Supported operators:** `$eq`, `$in`, `$gt`, `$gte`, `$lt`, `$lte`, `$exists` + static final cid = ChannelFilterField( + 'cid', + (it) => it.channel?.cid, + ); + + /// Filters channels by their type. + /// + /// **Supported operators:** `$eq`, `$in`, `$gt`, `$gte`, `$lt`, `$lte`, `$exists` + static final type = ChannelFilterField( + 'type', + (it) => it.channel?.type, + ); + + /// Filters channels by their name. + /// + /// **Supported operators:** `$eq`, `$in`, `$gt`, `$gte`, `$lt`, `$lte`, `$exists`, `$q`, + /// `$autocomplete` + static final name = ChannelFilterField( + 'name', + (it) => it.channel?.name, + ); + + /// Filters channels by the id of the user who created them. + /// + /// **Supported operators:** `$eq`, `$in`, `$gt`, `$gte`, `$lt`, `$lte`, `$exists` + static final createdById = ChannelFilterField( + 'created_by_id', + (it) => it.channel?.createdBy?.id, + ); + + /// Filters channels by the team they belong to. + /// + /// **Supported operators:** `$eq`, `$in`, `$gt`, `$gte`, `$lt`, `$lte`, `$exists` + static final team = ChannelFilterField( + 'team', + (it) => it.channel?.team, + ); + + /// Filters channels by whether they are frozen. + /// + /// **Supported operators:** `$eq`, `$in`, `$gt`, `$gte`, `$lt`, `$lte`, `$exists` + static final frozen = ChannelFilterField( + 'frozen', + (it) => it.channel?.frozen, + ); + + /// Filters channels by the date they were created. + /// + /// **Supported operators:** `$eq`, `$in`, `$gt`, `$gte`, `$lt`, `$lte`, `$exists` + static final createdAt = ChannelFilterField( + 'created_at', + (it) => it.channel?.createdAt, + ); + + /// Filters channels by the date they were updated. + /// + /// **Supported operators:** `$eq`, `$in`, `$gt`, `$gte`, `$lt`, `$lte`, `$exists` + static final updatedAt = ChannelFilterField( + 'updated_at', + (it) => it.channel?.updatedAt, + ); + + /// Filters channels by the timestamp of the last message. + /// + /// **Supported operators:** `$eq`, `$in`, `$gt`, `$gte`, `$lt`, `$lte`, `$exists` + static final lastMessageAt = ChannelFilterField( + 'last_message_at', + (it) => it.channel?.lastMessageAt, + ); + + /// Filters channels by their last activity. + /// + /// **Supported operators:** `$eq`, `$in`, `$gt`, `$gte`, `$lt`, `$lte`, `$exists` + static final lastUpdated = ChannelFilterField( + 'last_updated', + (it) => it.channel?.lastUpdatedAt, + ); + + /// Filters channels by the number of members. + /// + /// **Supported operators:** `$eq`, `$in`, `$gt`, `$gte`, `$lt`, `$lte`, `$exists` + static final memberCount = ChannelFilterField( + 'member_count', + (it) => it.channel?.memberCount, + ); + + /// Filters channels by the number of messages. + /// + /// **Supported operators:** `$eq`, `$in`, `$gt`, `$gte`, `$lt`, `$lte`, `$exists` + static final messageCount = ChannelFilterField( + 'message_count', + (it) => it.channel?.messageCount, + ); + + /// Filters channels by their members. + /// + /// `$eq` matches a channel whose members are exactly the given users, the + /// way a distinct channel is looked up. `$in` matches a channel any of them + /// belong to. + /// + /// **Supported operators:** `$eq`, `$in` + static final members = ChannelFilterField( + 'members', + (it) => it.members?.map((it) => it.userId), + ); + + /// Filters channels by the name of any of their members. + /// + /// **Supported operators:** `$eq`, `$autocomplete` + static final memberUserName = ChannelFilterField( + 'member.user.name', + (it) => it.members?.map((it) => it.user?.name), + ); + + /// Filters channels by the current user's role in them. + /// + /// **Supported operators:** `$eq`, `$in` + static final channelRole = ChannelFilterField( + 'channel_role', + (it) => it.membership?.channelRole, + ); + + /// Filters channels by whether the current user pinned them. + /// + /// **Supported operators:** `$eq` + static final pinned = ChannelFilterField( + 'pinned', + (it) => it.membership?.pinnedAt != null, + ); + + /// Filters channels by whether the current user hid them. + /// + /// **Supported operators:** `$eq` + static final hidden = ChannelFilterField( + 'hidden', + (it) => it.channel?.hidden, + ); + + /// Filters channels by whether the current user muted them. + /// + /// **Supported operators:** `$eq` + static final muted = ChannelFilterField( + 'muted', + (it) => it.channel?.muted, + ); + + /// Filters channels by whether the current user blocked them. + /// + /// **Supported operators:** `$eq` + static final blocked = ChannelFilterField( + 'blocked', + (it) => it.channel?.blocked, + ); + + /// Filters channels by whether they are disabled. + /// + /// **Supported operators:** `$eq` + static final disabled = ChannelFilterField( + 'disabled', + (it) => it.channel?.disabled, + ); + + /// Filters channels by whether the current user archived them. + /// + /// **Supported operators:** `$eq` + static final archived = ChannelFilterField( + 'archived', + (it) => it.membership?.archivedAt != null, + ); +} + /// Represents a sorting operation for channels. /// /// Keeps [ChannelSortField.pinnedAt] and [ChannelSortField.lastMessageAt] @@ -135,6 +348,13 @@ class ChannelState { /// `nullOrdering` says otherwise. /// /// See [ChannelSortField] for the fields that can be sorted on. +/// +/// ```dart +/// final sort = [ +/// ChannelSort.desc(ChannelSortField.pinnedAt), +/// ChannelSort.desc(ChannelSortField.lastMessageAt), +/// ]; +/// ``` class ChannelSort extends Sort { /// Sorts by [field], smallest first. ChannelSort.asc( diff --git a/packages/stream_chat/lib/src/core/models/draft.dart b/packages/stream_chat/lib/src/core/models/draft.dart index e501799612..b619aafee6 100644 --- a/packages/stream_chat/lib/src/core/models/draft.dart +++ b/packages/stream_chat/lib/src/core/models/draft.dart @@ -1,6 +1,6 @@ import 'package:equatable/equatable.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:stream_core/stream_core.dart' show Sort, SortField; +import 'package:stream_core/stream_core.dart' show Filter, FilterField, Sort, SortField; import 'channel_model.dart'; import 'draft_message.dart'; @@ -84,11 +84,59 @@ class Draft extends Equatable { ]; } +/// A filter for a draft query. +/// +/// See [DraftFilterField] for the fields that can be filtered on. +/// +/// ```dart +/// final filter = DraftFilter.equal( +/// DraftFilterField.channelCid, +/// 'messaging:general', +/// ); +/// ``` +typedef DraftFilter = Filter; + +/// Represents a field that draft queries can be filtered on. +class DraftFilterField extends FilterField { + /// Creates a draft filter field named [remote] on the wire, reading its + /// value off an instance with [value]. + DraftFilterField(super.remote, super.value); + + /// Filters drafts by the full id of the channel they belong to, in the form + /// `type:id`. + /// + /// **Supported operators:** `$eq`, `$in` + static final channelCid = DraftFilterField( + 'channel_cid', + (it) => it.channelCid, + ); + + /// Filters drafts by their creation date. + /// + /// **Supported operators:** `$eq`, `$gt`, `$gte`, `$lt`, `$lte` + static final createdAt = DraftFilterField( + 'created_at', + (it) => it.createdAt, + ); + + /// Filters drafts by the id of the message they reply to. + /// + /// **Supported operators:** `$eq`, `$in`, `$exists` + static final parentId = DraftFilterField( + 'parent_id', + (it) => it.parentId, + ); +} + /// Represents a sorting operation for drafts. /// /// The API sorts drafts by `createdAt` only. Anything else is rejected. /// /// See [DraftSortField] for the fields that can be sorted on. +/// +/// ```dart +/// final sort = [DraftSort.desc(DraftSortField.createdAt)]; +/// ``` class DraftSort extends Sort { /// Sorts by [field], smallest first. const DraftSort.asc( diff --git a/packages/stream_chat/lib/src/core/models/filter.dart b/packages/stream_chat/lib/src/core/models/filter.dart deleted file mode 100644 index ce55f5a40e..0000000000 --- a/packages/stream_chat/lib/src/core/models/filter.dart +++ /dev/null @@ -1,241 +0,0 @@ -// ignore_for_file: non_constant_identifier_names, constant_identifier_names - -import 'package:equatable/equatable.dart'; - -const _groupOperators = [ - FilterOperator.and, - FilterOperator.or, - FilterOperator.nor, -]; - -/// Possible operators to use in filters. -enum FilterOperator { - /// Matches values that are equal to a specified value. - equal, - - /// Matches all values that are not equal to a specified value. - notEqual, - - /// Matches values that are greater than a specified value. - greater, - - /// Matches values that are greater than a specified value. - greaterOrEqual, - - /// Matches values that are less than a specified value. - less, - - /// Matches values that are less than or equal to a specified value. - lessOrEqual, - - /// Matches any of the values specified in an array. - in_, - - /// Matches none of the values specified in an array. - notIn, - - /// Matches values by performing text search with the specified value. - query, - - /// Matches values with the specified prefix. - autoComplete, - - /// Matches values that exist/don't exist based on the specified boolean value. - exists, - - /// Matches all the values specified in an array. - and, - - /// Matches at least one of the values specified in an array. - or, - - /// Matches none of the values specified in an array. - nor, - - /// Matches any list that contains the specified value - contains; - - @override - String toString() { - switch (this) { - case FilterOperator.equal: - return r'$eq'; - case FilterOperator.notEqual: - return r'$ne'; - case FilterOperator.greater: - return r'$gt'; - case FilterOperator.greaterOrEqual: - return r'$gte'; - case FilterOperator.less: - return r'$lt'; - case FilterOperator.lessOrEqual: - return r'$lte'; - case FilterOperator.in_: - return r'$in'; - case FilterOperator.notIn: - return r'$nin'; - case FilterOperator.query: - return r'$q'; - case FilterOperator.autoComplete: - return r'$autocomplete'; - case FilterOperator.exists: - return r'$exists'; - case FilterOperator.and: - return r'$and'; - case FilterOperator.or: - return r'$or'; - case FilterOperator.nor: - return r'$nor'; - case FilterOperator.contains: - return r'$contains'; - } - } -} - -/// Stream supports a limited set of filters for querying channels, -/// users and members. The example below shows how to filter for channels -/// of type messaging where the current user is a member -/// -/// ```dart -/// final filter = Filter.and( -/// Filter.equal('type', 'messaging'), -/// Filter.in_('members', [user.id]) -/// ) -/// ``` -/// See Query Channels Documentation -class Filter extends Equatable { - const Filter.__({ - required this.value, - this.operator, - this.key, - }); - - const Filter._({ - required FilterOperator operator, - required this.value, - this.key, - }) : operator = '$operator'; - - /// An empty filter - const Filter.empty() : value = const {}, operator = null, key = null; - - /// Combines the provided filters and matches the values - /// matched by all filters. - factory Filter.and(List filters) => Filter._(operator: FilterOperator.and, value: filters); - - /// Combines the provided filters and matches the values - /// matched by at least one of the filters. - factory Filter.or(List filters) => Filter._(operator: FilterOperator.or, value: filters); - - /// Combines the provided filters and matches the values - /// not matched by all the filters. - factory Filter.nor(List filters) => Filter._(operator: FilterOperator.nor, value: filters); - - /// Matches values that are equal to a specified value. - factory Filter.equal(String key, Object value) => Filter._(operator: FilterOperator.equal, key: key, value: value); - - /// Matches all values that are not equal to a specified value. - factory Filter.notEqual(String key, Object value) => - Filter._(operator: FilterOperator.notEqual, key: key, value: value); - - /// Matches values that are greater than a specified value. - factory Filter.greater(String key, Object value) => - Filter._(operator: FilterOperator.greater, key: key, value: value); - - /// Matches values that are greater than a specified value. - factory Filter.greaterOrEqual(String key, Object value) => - Filter._(operator: FilterOperator.greaterOrEqual, key: key, value: value); - - /// Matches values that are less than a specified value. - factory Filter.less(String key, Object value) => Filter._(operator: FilterOperator.less, key: key, value: value); - - /// Matches values that are less than or equal to a specified value. - factory Filter.lessOrEqual(String key, Object value) => - Filter._(operator: FilterOperator.lessOrEqual, key: key, value: value); - - /// Matches any of the values specified in an array. - factory Filter.in_(String key, List values) => - Filter._(operator: FilterOperator.in_, key: key, value: values); - - /// Matches none of the values specified in an array. - factory Filter.notIn(String key, List values) => - Filter._(operator: FilterOperator.notIn, key: key, value: values); - - /// Matches values by performing text search with the specified value. - factory Filter.query(String key, String text) => Filter._(operator: FilterOperator.query, key: key, value: text); - - /// Matches values with the specified prefix. - factory Filter.autoComplete(String key, String text) => - Filter._(operator: FilterOperator.autoComplete, key: key, value: text); - - /// Matches values that exist/don't exist based on the specified boolean value. - factory Filter.exists(String key, {bool exists = true}) => - Filter._(operator: FilterOperator.exists, key: key, value: exists); - - /// Matches values that don't exist. - factory Filter.notExists(String key) => Filter.exists(key, exists: false); - - /// Matches any list that contains the specified values - factory Filter.contains(String key, Object value) => - Filter._(operator: FilterOperator.contains, key: key, value: value); - - /// Creates a custom [Filter] if there isn't one already available. - const factory Filter.custom({ - required Object value, - String? operator, - String? key, - }) = Filter.__; - - /// Creates a custom [Filter] from a raw map value - /// - /// ```dart - /// final filter = Filter.raw( - /// { - /// 'members': [user1.id, user2.id], - /// } - /// ) - /// ``` - const factory Filter.raw({ - required Map value, - }) = Filter.__; - - /// An operator used for the filter. The operator string must start with `$` - final String? operator; - - /// The "left-hand" side of the filter. - /// Specifies the name of the field the filter should match. - /// - /// Some operators like `and` or `or`, - /// don't require the key value to be present. - /// see-more : [_groupOperators] - final String? key; - - /// The "right-hand" side of the filter. - /// Specifies the [value] the filter should match. - final Object /*List|List|String*/ value; - - @override - List get props => [operator, key, value]; - - /// Serializes to json object - Map toJson() { - final json = {}; - final groupOperators = _groupOperators.map((it) => '$it'); - - if (groupOperators.contains(operator)) { - // Filters with group operators are encoded in the following form: - // { $: [ , ] } - json[operator!] = value; - } else if (operator != null) { - // Normal filters are encoded in the following form: - // { key: { $: } } - json[key!] = {operator: value}; - } else if (key != null) { - json[key!] = value; - } else { - return value as Map; - } - - return json; - } -} diff --git a/packages/stream_chat/lib/src/core/models/member.dart b/packages/stream_chat/lib/src/core/models/member.dart index f8ad515152..868736ffba 100644 --- a/packages/stream_chat/lib/src/core/models/member.dart +++ b/packages/stream_chat/lib/src/core/models/member.dart @@ -1,6 +1,6 @@ import 'package:equatable/equatable.dart'; import 'package:json_annotation/json_annotation.dart'; -import 'package:stream_core/stream_core.dart' show Standard, Sort, SortField; +import 'package:stream_core/stream_core.dart' show Filter, FilterField, Standard, Sort, SortField; import '../util/extension.dart'; import '../util/serializer.dart'; @@ -176,9 +176,155 @@ class Member extends Equatable { ]; } +/// A filter for a member query. +/// +/// See [MemberFilterField] for the fields that can be filtered on. +/// +/// ```dart +/// final filter = MemberFilter.autoComplete(MemberFilterField.name, 'jo'); +/// ``` +typedef MemberFilter = Filter; + +/// Represents a field that member queries can be filtered on. +class MemberFilterField extends FilterField { + /// Creates a member filter field named [remote] on the wire, reading its + /// value off an instance with [value]. + MemberFilterField(super.remote, super.value); + + /// Creates a field the SDK does not model, read from [Member.extraData]. + /// + /// **Supported operators:** `$eq`, `$in`, `$gt`, `$gte`, `$lt`, `$lte`, + /// `$exists`, `$contains`, `$q`, `$autocomplete` + factory MemberFilterField.custom(String remote) { + return MemberFilterField(remote, (it) => it.extraData[remote]); + } + + /// Filters members by their user id. + /// + /// **Supported operators:** `$eq`, `$in`, `$gt`, `$gte`, `$lt`, `$lte`, + /// `$exists` + static final userId = MemberFilterField( + 'user_id', + (it) => it.userId, + ); + + /// Filters members by their name. + /// + /// **Supported operators:** `$eq`, `$in`, `$q`, `$autocomplete` + static final name = MemberFilterField( + 'name', + (it) => it.user?.name, + ); + + /// Filters members by their role in the channel. + /// + /// **Supported operators:** `$eq`, `$in` + static final channelRole = MemberFilterField( + 'channel_role', + (it) => it.channelRole, + ); + + /// Filters members by whether they moderate the channel. + /// + /// **Supported operators:** `$eq` + static final isModerator = MemberFilterField( + 'is_moderator', + (it) => it.isModerator, + ); + + /// Filters members by whether they are banned from the channel. + /// + /// **Supported operators:** `$eq` + static final banned = MemberFilterField( + 'banned', + (it) => it.banned, + ); + + /// Filters members by the state of their invite. + /// + /// One of `pending`, `accepted` or `rejected`. A member who was never + /// invited has no invite state. + /// + /// **Supported operators:** `$eq` + static final invite = MemberFilterField( + 'invite', + (it) => switch (it) { + Member(invited: false) => null, + Member(inviteAcceptedAt: != null) => 'accepted', + Member(inviteRejectedAt: != null) => 'rejected', + _ => 'pending', + }, + ); + + /// Filters members by whether they have joined the channel. + /// + /// A member has joined when they were added directly, or accepted the + /// invite they were sent. + /// + /// **Supported operators:** `$eq` + static final joined = MemberFilterField( + 'joined', + (it) => !it.invited || it.inviteAcceptedAt != null, + ); + + /// Filters members by when they were last online. + /// + /// **Supported operators:** `$eq`, `$gt`, `$gte`, `$lt`, `$lte` + static final lastActive = MemberFilterField( + 'last_active', + (it) => it.user?.lastActive, + ); + + /// Filters members by their email address. + /// + /// **Supported operators:** `$eq`, `$in`, `$q`, `$autocomplete` + static final userEmail = MemberFilterField( + 'user.email', + (it) => it.user?.extraData['email'].safeCast(), + ); + + /// Filters members by whether their user is deactivated. + /// + /// **Supported operators:** `$eq` + static final userDeactivated = MemberFilterField( + 'user.nd_deactivated', + (it) => it.user?.extraData['nd_deactivated'].safeCast(), + ); + + /// Filters members by whether they muted notifications for the channel. + /// + /// **Supported operators:** `$eq` + static final notificationsMuted = MemberFilterField( + 'notifications_muted', + (it) => it.extraData['notifications_muted'].safeCast(), + ); + + /// Filters members by when they joined the channel. + /// + /// **Supported operators:** `$eq`, `$in`, `$gt`, `$gte`, `$lt`, `$lte`, + /// `$exists` + static final createdAt = MemberFilterField( + 'created_at', + (it) => it.createdAt, + ); + + /// Filters members by when their membership last changed. + /// + /// **Supported operators:** `$eq`, `$in`, `$gt`, `$gte`, `$lt`, `$lte`, + /// `$exists` + static final updatedAt = MemberFilterField( + 'updated_at', + (it) => it.updatedAt, + ); +} + /// Represents a sorting operation for channel members. /// /// See [MemberSortField] for the fields that can be sorted on. +/// +/// ```dart +/// final sort = [MemberSort.asc(MemberSortField.name)]; +/// ``` class MemberSort extends Sort { /// Sorts by [field], smallest first. const MemberSort.asc( diff --git a/packages/stream_chat/lib/src/core/models/message.dart b/packages/stream_chat/lib/src/core/models/message.dart index 8e2a51085c..3994cf9264 100644 --- a/packages/stream_chat/lib/src/core/models/message.dart +++ b/packages/stream_chat/lib/src/core/models/message.dart @@ -1,7 +1,7 @@ import 'package:collection/collection.dart'; import 'package:equatable/equatable.dart'; import 'package:json_annotation/json_annotation.dart'; -import 'package:stream_core/stream_core.dart' show Sort, SortField; +import 'package:stream_core/stream_core.dart' show Filter, FilterField, Standard, Sort, SortField; import 'package:uuid/uuid.dart'; import '../util/extension.dart'; @@ -726,12 +726,145 @@ class Message extends Equatable { ]; } +/// A filter for a message search. +/// +/// See [MessageSearchFilterField] for the fields that can be filtered on. +/// +/// ```dart +/// final filter = MessageSearchFilter.and([ +/// MessageSearchFilter.autoComplete(MessageSearchFilterField.text, 'deploy'), +/// MessageSearchFilter.equal(MessageSearchFilterField.pinned, true), +/// ]); +/// ``` +typedef MessageSearchFilter = Filter; + +/// Represents a field that a message search can be filtered on. +class MessageSearchFilterField extends FilterField { + /// Creates a message filter field named [remote] on the wire, reading its + /// value off an instance with [value]. + MessageSearchFilterField(super.remote, super.value); + + /// Creates a field the SDK does not model, read from [Message.extraData]. + /// + /// **Supported operators:** `$eq`, `$in`, `$gt`, `$gte`, `$lt`, `$lte` + factory MessageSearchFilterField.custom(String remote) { + return MessageSearchFilterField(remote, (it) => it.extraData[remote]); + } + + /// Filters messages by their id. + /// + /// **Supported operators:** `$eq`, `$in`, `$gt`, `$gte`, `$lt`, `$lte`, + /// `$exists` + static final id = MessageSearchFilterField( + 'id', + (it) => it.id, + ); + + /// Filters messages by their text. + /// + /// **Supported operators:** `$eq`, `$in`, `$gt`, `$gte`, `$lt`, `$lte`, + /// `$exists`, `$q`, `$autocomplete` + static final text = MessageSearchFilterField( + 'text', + (it) => it.text, + ); + + /// Filters messages by their type. + /// + /// **Supported operators:** `$eq`, `$in`, `$gt`, `$gte`, `$lt`, `$lte`, + /// `$exists` + static final type = MessageSearchFilterField( + 'type', + (it) => it.type, + ); + + /// Filters messages by the id of the user who sent them. + /// + /// **Supported operators:** `$eq`, `$in` + static final userId = MessageSearchFilterField( + 'user_id', + (it) => it.user?.id, + ); + + /// Filters messages by the id of the message they reply to. + /// + /// **Supported operators:** `$eq`, `$in`, `$gt`, `$gte`, `$lt`, `$lte`, + /// `$exists` + static final parentId = MessageSearchFilterField( + 'parent_id', + (it) => it.parentId, + ); + + /// Filters messages by how many replies they have. + /// + /// **Supported operators:** `$eq`, `$in`, `$gt`, `$gte`, `$lt`, `$lte`, + /// `$exists` + static final replyCount = MessageSearchFilterField( + 'reply_count', + (it) => it.replyCount, + ); + + /// Filters messages by whether they are pinned. + /// + /// **Supported operators:** `$eq` + static final pinned = MessageSearchFilterField( + 'pinned', + (it) => it.pinned, + ); + + /// Filters messages by whether they carry an attachment. + /// + /// **Supported operators:** `$exists` + static final attachments = MessageSearchFilterField( + 'attachments', + (it) => it.attachments.takeIf((it) => it.isNotEmpty), + ); + + /// Filters messages by the type of any of their attachments. + /// + /// **Supported operators:** `$eq`, `$in` + static final attachmentsType = MessageSearchFilterField( + 'attachments.type', + (it) => it.attachments.map((it) => it.type), + ); + + /// Filters messages by the id of any of the users they mention. + /// + /// **Supported operators:** `$contains` + static final mentionedUsersId = MessageSearchFilterField( + 'mentioned_users.id', + (it) => it.mentionedUsers.map((it) => it.id), + ); + + /// Filters messages by their creation date. + /// + /// **Supported operators:** `$eq`, `$in`, `$gt`, `$gte`, `$lt`, `$lte`, + /// `$exists` + static final createdAt = MessageSearchFilterField( + 'created_at', + (it) => it.createdAt, + ); + + /// Filters messages by their last update date. + /// + /// **Supported operators:** `$eq`, `$in`, `$gt`, `$gte`, `$lt`, `$lte`, + /// `$exists` + static final updatedAt = MessageSearchFilterField( + 'updated_at', + (it) => it.updatedAt, + ); +} + /// Represents a sorting operation for a message search. /// /// Searching is the only message query that takes a sort. It cannot be /// combined with a non-zero pagination offset. /// /// See [MessageSearchSortField] for the fields that can be sorted on. +/// +/// ```dart +/// final sort = [MessageSearchSort.desc(MessageSearchSortField.relevance)]; +/// ``` class MessageSearchSort extends Sort { /// Sorts by [field], smallest first. const MessageSearchSort.asc( diff --git a/packages/stream_chat/lib/src/core/models/message_reminder.dart b/packages/stream_chat/lib/src/core/models/message_reminder.dart index 96732df7b9..5f34c99bd4 100644 --- a/packages/stream_chat/lib/src/core/models/message_reminder.dart +++ b/packages/stream_chat/lib/src/core/models/message_reminder.dart @@ -1,6 +1,6 @@ import 'package:equatable/equatable.dart'; import 'package:json_annotation/json_annotation.dart'; -import 'package:stream_core/stream_core.dart' show Sort, SortField; +import 'package:stream_core/stream_core.dart' show Filter, FilterField, Sort, SortField; import 'channel_model.dart'; import 'message.dart'; @@ -136,6 +136,58 @@ class MessageReminder extends Equatable { ]; } +/// A filter for a reminder query. +/// +/// See [MessageReminderFilterField] for the fields that can be filtered on. +/// +/// ```dart +/// final filter = MessageReminderFilter.lessOrEqual( +/// MessageReminderFilterField.remindAt, +/// DateTime.timestamp().toIso8601String(), +/// ); +/// ``` +typedef MessageReminderFilter = Filter; + +/// Represents a field that reminder queries can be filtered on. +class MessageReminderFilterField extends FilterField { + /// Creates a reminder filter field named [remote] on the wire, reading its + /// value off an instance with [value]. + MessageReminderFilterField(super.remote, super.value); + + /// Filters reminders by the full id of the channel holding the message, in + /// the form `type:id`. + /// + /// **Supported operators:** `$eq`, `$in` + static final channelCid = MessageReminderFilterField( + 'channel_cid', + (it) => it.channelCid, + ); + + /// Filters reminders by the id of the message they mark. + /// + /// **Supported operators:** `$eq`, `$in` + static final messageId = MessageReminderFilterField( + 'message_id', + (it) => it.messageId, + ); + + /// Filters reminders by the time at which the user wants to be reminded. + /// + /// **Supported operators:** `$eq`, `$gt`, `$gte`, `$lt`, `$lte`, `$exists` + static final remindAt = MessageReminderFilterField( + 'remind_at', + (it) => it.remindAt, + ); + + /// Filters reminders by their creation date. + /// + /// **Supported operators:** `$eq`, `$gt`, `$gte`, `$lt`, `$lte` + static final createdAt = MessageReminderFilterField( + 'created_at', + (it) => it.createdAt, + ); +} + /// Represents a sorting operation for message reminders. /// /// The API accepts only whole combinations, not an arbitrary mix: @@ -143,6 +195,10 @@ class MessageReminder extends Equatable { /// Anything else is rejected. /// /// See [MessageReminderSortField] for the fields that can be sorted on. +/// +/// ```dart +/// final sort = [MessageReminderSort.asc(MessageReminderSortField.remindAt)]; +/// ``` class MessageReminderSort extends Sort { /// Sorts by [field], smallest first. const MessageReminderSort.asc( diff --git a/packages/stream_chat/lib/src/core/models/poll.dart b/packages/stream_chat/lib/src/core/models/poll.dart index 2eb2dd6dc0..067bf521b5 100644 --- a/packages/stream_chat/lib/src/core/models/poll.dart +++ b/packages/stream_chat/lib/src/core/models/poll.dart @@ -1,7 +1,7 @@ import 'package:collection/collection.dart'; import 'package:equatable/equatable.dart'; import 'package:json_annotation/json_annotation.dart'; -import 'package:stream_core/stream_core.dart' show Standard, Sort, SortField; +import 'package:stream_core/stream_core.dart' show Filter, FilterField, Standard, Sort, SortField; import 'package:uuid/uuid.dart'; import '../util/serializer.dart'; @@ -270,12 +270,120 @@ class Poll extends Equatable { ]; } +/// A filter for a poll query. +/// +/// See [PollFilterField] for the fields that can be filtered on. +/// +/// ```dart +/// final filter = PollFilter.equal(PollFilterField.isClosed, false); +/// ``` +typedef PollFilter = Filter; + +/// Represents a field that poll queries can be filtered on. +class PollFilterField extends FilterField { + /// Creates a poll filter field named [remote] on the wire, reading its value + /// off an instance with [value]. + PollFilterField(super.remote, super.value); + + /// Creates a field the SDK does not model, read from [Poll.extraData]. + /// + /// **Supported operators:** `$eq`, `$in`, `$gt`, `$gte`, `$lt`, `$lte`, + /// `$exists`, `$contains`, `$q`, `$autocomplete` + factory PollFilterField.custom(String remote) { + return PollFilterField(remote, (it) => it.extraData[remote]); + } + + /// Filters polls by their id. + /// + /// **Supported operators:** `$eq`, `$in` + static final id = PollFilterField( + 'id', + (it) => it.id, + ); + + /// Filters polls by their name. + /// + /// **Supported operators:** `$eq`, `$in` + static final name = PollFilterField( + 'name', + (it) => it.name, + ); + + /// Filters polls by the id of the user who created them. + /// + /// **Supported operators:** `$eq`, `$in` + static final createdById = PollFilterField( + 'created_by_id', + (it) => it.createdById, + ); + + /// Filters polls by whether they are closed to further voting. + /// + /// **Supported operators:** `$eq` + static final isClosed = PollFilterField( + 'is_closed', + (it) => it.isClosed, + ); + + /// Filters polls by how many votes each user may cast. + /// + /// **Supported operators:** `$eq`, `$gt`, `$gte`, `$lt`, `$lte` + static final maxVotesAllowed = PollFilterField( + 'max_votes_allowed', + (it) => it.maxVotesAllowed, + ); + + /// Filters polls by whether they accept free-form answers. + /// + /// **Supported operators:** `$eq` + static final allowAnswers = PollFilterField( + 'allow_answers', + (it) => it.allowAnswers, + ); + + /// Filters polls by whether users may add their own options. + /// + /// **Supported operators:** `$eq` + static final allowUserSuggestedOptions = PollFilterField( + 'allow_user_suggested_options', + (it) => it.allowUserSuggestedOptions, + ); + + /// Filters polls by whether their votes are public or anonymous. + /// + /// **Supported operators:** `$eq` + static final votingVisibility = PollFilterField( + 'voting_visibility', + (it) => _$VotingVisibilityEnumMap[it.votingVisibility], + ); + + /// Filters polls by their creation date. + /// + /// **Supported operators:** `$eq`, `$gt`, `$gte`, `$lt`, `$lte` + static final createdAt = PollFilterField( + 'created_at', + (it) => it.createdAt, + ); + + /// Filters polls by their last update date. + /// + /// **Supported operators:** `$eq`, `$gt`, `$gte`, `$lt`, `$lte` + static final updatedAt = PollFilterField( + 'updated_at', + (it) => it.updatedAt, + ); +} + /// Represents a sorting operation for polls. /// /// The API sorts on one field at a time: `id`, `name`, `createdAt`, /// `updatedAt` or `isClosed`. Anything else is rejected. /// /// See [PollSortField] for the fields that can be sorted on. +/// +/// ```dart +/// final sort = [PollSort.desc(PollSortField.createdAt)]; +/// ``` class PollSort extends Sort { /// Sorts by [field], smallest first. const PollSort.asc( diff --git a/packages/stream_chat/lib/src/core/models/poll_vote.dart b/packages/stream_chat/lib/src/core/models/poll_vote.dart index bcc9c1fa35..f1e6dd21e2 100644 --- a/packages/stream_chat/lib/src/core/models/poll_vote.dart +++ b/packages/stream_chat/lib/src/core/models/poll_vote.dart @@ -1,6 +1,6 @@ import 'package:equatable/equatable.dart'; import 'package:json_annotation/json_annotation.dart'; -import 'package:stream_core/stream_core.dart' show Sort, SortField; +import 'package:stream_core/stream_core.dart' show Filter, FilterField, Sort, SortField; import 'user.dart'; @@ -106,12 +106,88 @@ class PollVote extends Equatable { ]; } +/// A filter for a poll vote query. +/// +/// See [PollVoteFilterField] for the fields that can be filtered on. +/// +/// ```dart +/// final filter = PollVoteFilter.equal(PollVoteFilterField.isAnswer, true); +/// ``` +typedef PollVoteFilter = Filter; + +/// Represents a field that poll vote queries can be filtered on. +class PollVoteFilterField extends FilterField { + /// Creates a poll vote filter field named [remote] on the wire, reading its + /// value off an instance with [value]. + PollVoteFilterField(super.remote, super.value); + + /// Filters poll votes by their id. + /// + /// **Supported operators:** `$eq`, `$in` + static final id = PollVoteFilterField( + 'id', + (it) => it.id, + ); + + /// Filters poll votes by the id of the poll they belong to. + /// + /// **Supported operators:** `$eq`, `$in` + static final pollId = PollVoteFilterField( + 'poll_id', + (it) => it.pollId, + ); + + /// Filters poll votes by the id of the option they select. + /// + /// **Supported operators:** `$eq`, `$in`, `$exists` + static final optionId = PollVoteFilterField( + 'option_id', + (it) => it.optionId, + ); + + /// Filters poll votes by the id of the user who cast them. + /// + /// **Supported operators:** `$eq`, `$in` + static final userId = PollVoteFilterField( + 'user_id', + (it) => it.userId, + ); + + /// Filters poll votes by whether they are an answer rather than a vote. + /// + /// **Supported operators:** `$eq` + static final isAnswer = PollVoteFilterField( + 'is_answer', + (it) => it.isAnswer, + ); + + /// Filters poll votes by their creation date. + /// + /// **Supported operators:** `$eq`, `$gt`, `$gte`, `$lt`, `$lte` + static final createdAt = PollVoteFilterField( + 'created_at', + (it) => it.createdAt, + ); + + /// Filters poll votes by their last update date. + /// + /// **Supported operators:** `$eq`, `$gt`, `$gte`, `$lt`, `$lte` + static final updatedAt = PollVoteFilterField( + 'updated_at', + (it) => it.updatedAt, + ); +} + /// Represents a sorting operation for poll votes. /// /// The API sorts on one field at a time: `id`, `createdAt` or `updatedAt`. /// Anything else is rejected. /// /// See [PollVoteSortField] for the fields that can be sorted on. +/// +/// ```dart +/// final sort = [PollVoteSort.desc(PollVoteSortField.createdAt)]; +/// ``` class PollVoteSort extends Sort { /// Sorts by [field], smallest first. const PollVoteSort.asc( diff --git a/packages/stream_chat/lib/src/core/models/predefined_filter.dart b/packages/stream_chat/lib/src/core/models/predefined_filter.dart index 6a3b3c61be..75e9e7c7a2 100644 --- a/packages/stream_chat/lib/src/core/models/predefined_filter.dart +++ b/packages/stream_chat/lib/src/core/models/predefined_filter.dart @@ -1,6 +1,5 @@ import 'package:json_annotation/json_annotation.dart'; import 'channel_state.dart'; -import 'filter.dart'; part 'predefined_filter.g.dart'; @@ -27,10 +26,11 @@ class PredefinedFilter { /// Filter conditions as resolved by the server. /// - /// Wrapped in [Filter.raw] — the SDK does not evaluate filters locally. - /// Access the underlying map via [Filter.value] or [Filter.toJson]. + /// Wrapped in [ChannelFilter.raw], since the server authors it and may use an + /// operator this package does not model. Read it with [ChannelFilter.toJson]; + /// [ChannelFilter.matches] throws for it. @JsonKey(fromJson: _filterFromJson) - final Filter filter; + final ChannelFilter filter; /// Sort specification as resolved by the server. final List? sort; @@ -40,29 +40,19 @@ class PredefinedFilter { /// [filter] when [sort] is null. List get effectiveSort => sort ?? _defaultSortFor(filter); - static Filter _filterFromJson(Map json) => Filter.raw(value: json); + static ChannelFilter _filterFromJson(Map json) => ChannelFilter.raw(json); } // Mirrors the server's fallback for a channel query that carries no sort, so // the field is written out rather than taken from [ChannelSort.defaultSort]: // the two agree today, but one is the ordering this SDK picks and the other is // the ordering the server falls back to, and either may change alone. -List _defaultSortFor(Filter filter) { - final touchesLastMessageAt = _touchesField(filter, ChannelSortField.lastMessageAt.remote); - if (touchesLastMessageAt) return [ChannelSort.desc(ChannelSortField.lastMessageAt)]; - return [ChannelSort.desc(ChannelSortField.lastUpdated)]; -} - -bool _touchesField(Filter filter, String field) { - if (filter.key == field) return true; - final value = filter.value; - if (value is List) { - return value.any((sub) => _touchesField(sub, field)); +List _defaultSortFor(ChannelFilter filter) { + final lastMessageAt = ChannelSortField.lastMessageAt; + if (_mapTouchesField(filter.toJson(), lastMessageAt.remote)) { + return [ChannelSort.desc(lastMessageAt)]; } - if (value is Map) { - return _mapTouchesField(value, field); - } - return false; + return [ChannelSort.desc(ChannelSortField.lastUpdated)]; } bool _mapTouchesField(Map map, String field) { diff --git a/packages/stream_chat/lib/src/core/models/reaction.dart b/packages/stream_chat/lib/src/core/models/reaction.dart index 98cba67eae..afd0db335f 100644 --- a/packages/stream_chat/lib/src/core/models/reaction.dart +++ b/packages/stream_chat/lib/src/core/models/reaction.dart @@ -1,6 +1,6 @@ import 'package:equatable/equatable.dart'; import 'package:json_annotation/json_annotation.dart'; -import 'package:stream_core/stream_core.dart' show Sort, SortField; +import 'package:stream_core/stream_core.dart' show Filter, FilterField, Sort, SortField; import '../util/serializer.dart'; import 'user.dart'; @@ -134,9 +134,54 @@ class Reaction extends Equatable { ]; } +/// A filter for a reaction query. +/// +/// See [ReactionFilterField] for the fields that can be filtered on. +/// +/// ```dart +/// final filter = ReactionFilter.equal(ReactionFilterField.type, 'like'); +/// ``` +typedef ReactionFilter = Filter; + +/// Represents a field that reaction queries can be filtered on. +class ReactionFilterField extends FilterField { + /// Creates a reaction filter field named [remote] on the wire, reading its + /// value off an instance with [value]. + ReactionFilterField(super.remote, super.value); + + /// Filters reactions by their type. + /// + /// **Supported operators:** `$eq`, `$in` + static final type = ReactionFilterField( + 'type', + (it) => it.type, + ); + + /// Filters reactions by the id of the user who sent them. + /// + /// **Supported operators:** `$eq`, `$in` + static final userId = ReactionFilterField( + 'user_id', + (it) => it.userId, + ); + + /// Filters reactions by their creation date. + /// + /// **Supported operators:** `$eq`, `$in`, `$gt`, `$gte`, `$lt`, `$lte`, + /// `$exists` + static final createdAt = ReactionFilterField( + 'created_at', + (it) => it.createdAt, + ); +} + /// Represents a sorting operation for reactions. /// /// See [ReactionSortField] for the fields that can be sorted on. +/// +/// ```dart +/// final sort = [ReactionSort.desc(ReactionSortField.createdAt)]; +/// ``` class ReactionSort extends Sort { /// Sorts by [field], smallest first. const ReactionSort.asc( diff --git a/packages/stream_chat/lib/src/core/models/thread.dart b/packages/stream_chat/lib/src/core/models/thread.dart index 2138eceb68..562501a7dc 100644 --- a/packages/stream_chat/lib/src/core/models/thread.dart +++ b/packages/stream_chat/lib/src/core/models/thread.dart @@ -1,6 +1,6 @@ import 'package:equatable/equatable.dart'; import 'package:json_annotation/json_annotation.dart'; -import 'package:stream_core/stream_core.dart' show NullOrdering, Sort, SortField; +import 'package:stream_core/stream_core.dart' show Filter, FilterField, NullOrdering, Sort, SortField; import '../util/serializer.dart'; import 'channel_model.dart'; @@ -228,6 +228,125 @@ class Thread extends Equatable { ]; } +/// A filter for a thread query. +/// +/// See [ThreadFilterField] for the fields that can be filtered on. +/// +/// ```dart +/// final filter = ThreadFilter.equal( +/// ThreadFilterField.channelCid, +/// 'messaging:general', +/// ); +/// ``` +typedef ThreadFilter = Filter; + +/// Represents a field that thread queries can be filtered on. +class ThreadFilterField extends FilterField { + /// Creates a thread filter field named [remote] on the wire, reading its + /// value off an instance with [value]. + ThreadFilterField(super.remote, super.value); + + /// Creates a field the SDK does not model, read from [Thread.extraData]. + /// + /// `has_unread` is reached this way. The server resolves it against the + /// caller's read state; a local match cannot. + /// + /// **Supported operators:** `$eq`, `$in`, `$gt`, `$gte`, `$lt`, `$lte`, + /// `$exists`, `$contains`, `$q`, `$autocomplete` + factory ThreadFilterField.custom(String remote) { + return ThreadFilterField(remote, (it) => it.extraData[remote]); + } + + /// Filters threads by the full id of the channel they belong to, in the form + /// `type:id`. + /// + /// **Supported operators:** `$eq`, `$in` + static final channelCid = ThreadFilterField( + 'channel_cid', + (it) => it.channelCid, + ); + + /// Filters threads by the id of their parent message. + /// + /// **Supported operators:** `$eq`, `$in` + static final parentMessageId = ThreadFilterField( + 'parent_message_id', + (it) => it.parentMessageId, + ); + + /// Filters threads by the id of the user who created them. + /// + /// **Supported operators:** `$eq`, `$in` + static final createdByUserId = ThreadFilterField( + 'created_by_user_id', + (it) => it.createdByUserId, + ); + + /// Filters threads by how many replies they have. + /// + /// **Supported operators:** `$eq`, `$gt`, `$gte`, `$lt`, `$lte` + static final replyCount = ThreadFilterField( + 'reply_count', + (it) => it.replyCount, + ); + + /// Filters threads by how many users have participated in them. + /// + /// **Supported operators:** `$eq`, `$gt`, `$gte`, `$lt`, `$lte` + static final participantCount = ThreadFilterField( + 'participant_count', + (it) => it.participantCount, + ); + + /// Filters threads by how many participants are currently active. + /// + /// **Supported operators:** `$eq`, `$gt`, `$gte`, `$lt`, `$lte` + static final activeParticipantCount = ThreadFilterField( + 'active_participant_count', + (it) => it.activeParticipantCount, + ); + + /// Filters threads by the date of their last message. + /// + /// **Supported operators:** `$eq`, `$gt`, `$gte`, `$lt`, `$lte` + static final lastMessageAt = ThreadFilterField( + 'last_message_at', + (it) => it.lastMessageAt, + ); + + /// Filters threads by their creation date. + /// + /// **Supported operators:** `$eq`, `$gt`, `$gte`, `$lt`, `$lte` + static final createdAt = ThreadFilterField( + 'created_at', + (it) => it.createdAt, + ); + + /// Filters threads by their last update date. + /// + /// **Supported operators:** `$eq`, `$gt`, `$gte`, `$lt`, `$lte` + static final updatedAt = ThreadFilterField( + 'updated_at', + (it) => it.updatedAt, + ); + + /// Filters threads by the team of the channel they belong to. + /// + /// **Supported operators:** `$eq`, `$in` + static final channelTeam = ThreadFilterField( + 'channel.team', + (it) => it.channel?.team, + ); + + /// Filters threads by whether the channel they belong to is disabled. + /// + /// **Supported operators:** `$eq` + static final channelDisabled = ThreadFilterField( + 'channel.disabled', + (it) => it.channel?.disabled, + ); +} + /// Represents a sorting operation for threads. /// /// The API accepts only whole combinations, not an arbitrary mix: @@ -237,6 +356,10 @@ class Thread extends Equatable { /// Anything else is rejected. /// /// See [ThreadSortField] for the fields that can be sorted on. +/// +/// ```dart +/// final sort = [ThreadSort.desc(ThreadSortField.lastMessageAt)]; +/// ``` class ThreadSort extends Sort { /// Sorts by [field], smallest first. ThreadSort.asc( diff --git a/packages/stream_chat/lib/src/core/models/user.dart b/packages/stream_chat/lib/src/core/models/user.dart index 2274cdd523..ab1e81632d 100644 --- a/packages/stream_chat/lib/src/core/models/user.dart +++ b/packages/stream_chat/lib/src/core/models/user.dart @@ -1,6 +1,6 @@ import 'package:equatable/equatable.dart'; import 'package:json_annotation/json_annotation.dart'; -import 'package:stream_core/stream_core.dart' show Standard, Sort, SortField; +import 'package:stream_core/stream_core.dart' show Filter, FilterField, Standard, Sort, SortField; import '../util/extension.dart'; import '../util/serializer.dart'; @@ -213,9 +213,149 @@ class User extends Equatable { ]; } +/// A filter for a user query. +/// +/// See [UserFilterField] for the fields that can be filtered on. +/// +/// ```dart +/// final filter = UserFilter.or([ +/// UserFilter.autoComplete(UserFilterField.name, 'jo'), +/// UserFilter.autoComplete(UserFilterField.id, 'jo'), +/// ]); +/// ``` +typedef UserFilter = Filter; + +/// Represents a field that user queries can be filtered on. +class UserFilterField extends FilterField { + /// Creates a user filter field named [remote] on the wire, reading its value + /// off an instance with [value]. + UserFilterField(super.remote, super.value); + + /// Creates a field the SDK does not model, read from [User.extraData]. + /// + /// A user query compares a custom field for equality only. Anything else is + /// rejected. + /// + /// **Supported operators:** `$eq`, `$in` + factory UserFilterField.custom(String remote) { + return UserFilterField(remote, (it) => it.extraData[remote]); + } + + /// Filters users by their id. + /// + /// **Supported operators:** `$eq`, `$in`, `$autocomplete` + static final id = UserFilterField( + 'id', + (it) => it.id, + ); + + /// Filters users by their name. + /// + /// **Supported operators:** `$eq`, `$in`, `$autocomplete` + static final name = UserFilterField( + 'name', + (it) => it.name, + ); + + /// Filters users by their username. + /// + /// **Supported operators:** `$eq`, `$autocomplete` + static final username = UserFilterField( + 'username', + (it) => it.extraData['username'].safeCast(), + ); + + /// Filters users by their email address. + /// + /// **Supported operators:** `$eq`, `$in` + static final email = UserFilterField( + 'email', + (it) => it.extraData['email'].safeCast(), + ); + + /// Filters users by their role. + /// + /// **Supported operators:** `$eq`, `$in` + static final role = UserFilterField( + 'role', + (it) => it.role, + ); + + /// Filters users by the teams they belong to. + /// + /// **Supported operators:** `$eq`, `$in`, `$contains` + static final teams = UserFilterField( + 'teams', + (it) => it.teams, + ); + + /// Filters users by whether they are banned. + /// + /// **Supported operators:** `$eq` + static final banned = UserFilterField( + 'banned', + (it) => it.banned, + ); + + /// Filters users by whether they are shadow banned. + /// + /// **Supported operators:** `$eq` + static final shadowBanned = UserFilterField( + 'shadow_banned', + (it) => it.extraData['shadow_banned'].safeCast(), + ); + + /// Filters users by whether they bypass moderation. + /// + /// **Supported operators:** `$eq` + static final bypassModeration = UserFilterField( + 'bypass_moderation', + (it) => it.extraData['bypass_moderation'].safeCast(), + ); + + /// Filters users by when they were last online. + /// + /// **Supported operators:** `$eq`, `$in`, `$gt`, `$gte`, `$lt`, `$lte`, + /// `$exists` + static final lastActive = UserFilterField( + 'last_active', + (it) => it.lastActive, + ); + + /// Filters users by their creation date. + /// + /// **Supported operators:** `$eq`, `$in`, `$gt`, `$gte`, `$lt`, `$lte`, + /// `$exists` + static final createdAt = UserFilterField( + 'created_at', + (it) => it.createdAt, + ); + + /// Filters users by their last update date. + /// + /// **Supported operators:** `$eq`, `$in`, `$gt`, `$gte`, `$lt`, `$lte`, + /// `$exists` + static final updatedAt = UserFilterField( + 'updated_at', + (it) => it.updatedAt, + ); + + /// Filters users by the language they chose. + /// + /// **Supported operators:** `$eq` + static final language = UserFilterField( + 'language', + (it) => it.language, + ); +} + /// Represents a sorting operation for users. /// /// See [UserSortField] for the fields that can be sorted on. +/// +/// ```dart +/// final sort = [UserSort.asc(UserSortField.name)]; +/// ``` class UserSort extends Sort { /// Sorts by [field], smallest first. const UserSort.asc( diff --git a/packages/stream_chat/lib/src/db/chat_persistence_client.dart b/packages/stream_chat/lib/src/db/chat_persistence_client.dart index cf97c5cc2c..de42841034 100644 --- a/packages/stream_chat/lib/src/db/chat_persistence_client.dart +++ b/packages/stream_chat/lib/src/db/chat_persistence_client.dart @@ -6,7 +6,6 @@ import '../core/models/channel_model.dart'; import '../core/models/channel_state.dart'; import '../core/models/draft.dart'; import '../core/models/event.dart'; -import '../core/models/filter.dart'; import '../core/models/location.dart'; import '../core/models/member.dart'; import '../core/models/message.dart'; @@ -131,7 +130,7 @@ abstract class ChatPersistenceClient { /// [paginationParams] to paginate results. @Deprecated('Use queryChannelStates instead') Future> getChannelStates({ - Filter? filter, + ChannelFilter? filter, List? channelStateSort, int? messageLimit, PaginationParams? paginationParams, @@ -143,7 +142,7 @@ abstract class ChatPersistenceClient { /// the list of matching rows will be deleted @Deprecated('Use saveChannelQueries instead') Future updateChannelQueries( - Filter? filter, + ChannelFilter? filter, List cids, { bool clearQueryCache = false, }); @@ -171,7 +170,7 @@ abstract class ChatPersistenceClient { /// /// For standard mode, [QueryChannelsResponse.predefinedFilter] is null. Future queryChannelStates({ - Filter? filter, + ChannelFilter? filter, List? sort, String? predefinedFilter, Map? filterValues, @@ -214,10 +213,10 @@ abstract class ChatPersistenceClient { /// order. [filter] / [sort] are ignored in this mode. Future saveChannelQueries({ required List cids, - Filter? filter, + ChannelFilter? filter, List? sort, String? predefinedFilter, - Filter? resolvedFilter, + ChannelFilter? resolvedFilter, List? resolvedSort, Map? filterValues, Map? sortValues, diff --git a/packages/stream_chat/lib/stream_chat.dart b/packages/stream_chat/lib/stream_chat.dart index ce8e88174f..5b692b2ba6 100644 --- a/packages/stream_chat/lib/stream_chat.dart +++ b/packages/stream_chat/lib/stream_chat.dart @@ -14,12 +14,22 @@ export 'package:dio/dio.dart' ProgressCallback; export 'package:rate_limiter/rate_limiter.dart'; // Re-exported with a `show` allowlist rather than wholesale: `stream_core` -// also declares names this barrel defines — `AttachmentFile`, `Filter`, -// `User` — so a blanket export would not compile. +// also declares names this barrel defines — `AttachmentFile`, `User` — so a +// blanket export would not compile. +// +// `Filter`'s operator subclasses stay out of the list: a filter is read with +// `toJson`. `EvaluationOperator` and `LogicalOperator` are the exception, +// because `searchQueryLength` needs to tell a text search from a compound +// filter without re-parsing the JSON. export 'package:stream_core/stream_core.dart' show CompositeComparator, + EvaluationOperator, Failure, + Filter, + FilterField, + FilterOperator, + LogicalOperator, NullOrdering, Result, Sort, @@ -78,7 +88,6 @@ export 'src/core/models/device.dart'; export 'src/core/models/draft.dart'; export 'src/core/models/draft_message.dart'; export 'src/core/models/event.dart'; -export 'src/core/models/filter.dart' show Filter, FilterOperator; export 'src/core/models/location.dart'; export 'src/core/models/location_coordinates.dart'; export 'src/core/models/member.dart'; diff --git a/packages/stream_chat/test/src/client/channel/channel_client_state_test.dart b/packages/stream_chat/test/src/client/channel/channel_client_state_test.dart index bc32ea53c5..2184e10612 100644 --- a/packages/stream_chat/test/src/client/channel/channel_client_state_test.dart +++ b/packages/stream_chat/test/src/client/channel/channel_client_state_test.dart @@ -2237,7 +2237,7 @@ void main() { () => client.queryMembers( channelType, channelId: channelId, - filter: Filter.equal('id', 'bad-user'), + filter: any(named: 'filter'), members: any(named: 'members'), sort: any(named: 'sort'), pagination: any(named: 'pagination'), diff --git a/packages/stream_chat/test/src/client/channel/channel_event_handler_test.dart b/packages/stream_chat/test/src/client/channel/channel_event_handler_test.dart index 6feebc9f2d..ff068dd199 100644 --- a/packages/stream_chat/test/src/client/channel/channel_event_handler_test.dart +++ b/packages/stream_chat/test/src/client/channel/channel_event_handler_test.dart @@ -57,7 +57,7 @@ void main() { registerFallbackValue(FakeMessageReminder()); registerFallbackValue(FakeLocation()); registerFallbackValue(FakeChannelPushPreference()); - registerFallbackValue(Filter.equal('id', '')); + registerFallbackValue(MemberFilter.equal(MemberFilterField.userId, '')); registerFallbackValue(''); registerFallbackValue(0); registerFallbackValue(false); @@ -687,7 +687,15 @@ void main() { handler.handleEvent(event); await Future.value(); - verify(() => channel.queryMembers(filter: Filter.equal('id', otherUser.id))).called(1); + // A `Filter` compares by identity, so the query is checked against the + // filter it serializes to rather than against an equal instance. + final filter = + verify( + () => channel.queryMembers(filter: captureAny(named: 'filter')), + ).captured.single + as MemberFilter; + + expect(filter.toJson(), MemberFilter.equal(MemberFilterField.userId, otherUser.id).toJson()); verify(() => mutations.onMemberBanned(member)).called(1); }); diff --git a/packages/stream_chat/test/src/client/channel/channel_test.dart b/packages/stream_chat/test/src/client/channel/channel_test.dart index 836062c8a5..b507b9b4a4 100644 --- a/packages/stream_chat/test/src/client/channel/channel_test.dart +++ b/packages/stream_chat/test/src/client/channel/channel_test.dart @@ -149,6 +149,8 @@ void main() { registerFallbackValue(FakeMessage()); registerFallbackValue([]); registerFallbackValue(FakeAttachmentFile()); + registerFallbackValue(const ChannelFilter.raw({})); + registerFallbackValue(const BannedUserFilter.raw({})); final retryPolicy = RetryPolicy( shouldRetry: (_, __, ___) => false, @@ -2756,7 +2758,7 @@ void main() { }); group('`.search`', () { - final filter = Filter.in_('cid', const [channelCid]); + final filter = ChannelFilter.in_(ChannelFilterField.cid, const [channelCid]); test('should work fine with `query`', () async { const query = 'test-search-query'; @@ -2767,7 +2769,7 @@ void main() { when( () => client.search( - filter, + any(that: isSameFilterAs(filter)), query: query, sort: any(named: 'sort'), paginationParams: any(named: 'paginationParams'), @@ -2787,7 +2789,7 @@ void main() { verify( () => client.search( - filter, + any(that: isSameFilterAs(filter)), query: query, sort: any(named: 'sort'), paginationParams: any(named: 'paginationParams'), @@ -2796,7 +2798,7 @@ void main() { }); test('should work fine with `messageFilters`', () async { - final messageFilters = Filter.query('key', 'text'); + final messageFilters = MessageSearchFilter.query(MessageSearchFilterField.text, 'text'); final sort = [MessageSearchSort.desc(MessageSearchSortField.custom('test-sort-field'))]; const pagination = PaginationParams(); @@ -2804,7 +2806,7 @@ void main() { when( () => client.search( - filter, + any(that: isSameFilterAs(filter)), messageFilters: messageFilters, sort: any(named: 'sort'), paginationParams: any(named: 'paginationParams'), @@ -2824,7 +2826,7 @@ void main() { verify( () => client.search( - filter, + any(that: isSameFilterAs(filter)), messageFilters: messageFilters, sort: any(named: 'sort'), paginationParams: any(named: 'paginationParams'), @@ -4428,7 +4430,7 @@ void main() { }); test('`.queryMembers`', () async { - final filter = Filter.in_('cid', const [channelCid]); + final filter = MemberFilter.in_(MemberFilterField.userId, const ['test-user-id-0']); final members = List.generate( 3, @@ -4464,7 +4466,7 @@ void main() { }); test('`.queryBannedUsers`', () async { - final filter = Filter.equal('channel_cid', channelCid); + final filter = BannedUserFilter.equal(BannedUserFilterField.channelCid, channelCid); final bans = List.generate( 3, @@ -4476,7 +4478,7 @@ void main() { when( () => client.queryBannedUsers( - filter: filter, + filter: any(named: 'filter', that: isSameFilterAs(filter)), sort: any(named: 'sort'), pagination: any(named: 'pagination'), ), @@ -4489,7 +4491,7 @@ void main() { verify( () => client.queryBannedUsers( - filter: filter, + filter: any(named: 'filter', that: isSameFilterAs(filter)), sort: any(named: 'sort'), pagination: any(named: 'pagination'), ), diff --git a/packages/stream_chat/test/src/client/client_test.dart b/packages/stream_chat/test/src/client/client_test.dart index 7cf62570b9..6d22d3b578 100644 --- a/packages/stream_chat/test/src/client/client_test.dart +++ b/packages/stream_chat/test/src/client/client_test.dart @@ -497,7 +497,7 @@ void main() { registerFallbackValue(FakeEvent()); registerFallbackValue(const PaginationParams()); registerFallbackValue(FakeChannelState()); - registerFallbackValue(const Filter.empty()); + registerFallbackValue(const ChannelFilter.raw({})); }); setUp(() async { @@ -828,7 +828,7 @@ void main() { test( 'queryChannelsOnline with inline filter persists via saveChannelQueries', () async { - final filter = Filter.in_('members', const ['test-user-id']); + final filter = ChannelFilter.in_(ChannelFilterField.members, const ['test-user-id']); final channelStates = List.generate( 3, @@ -923,7 +923,7 @@ void main() { ..channels = channelStates ..predefinedFilter = PredefinedFilter( name: filterName, - filter: const Filter.empty(), + filter: const ChannelFilter.raw({}), sort: resolvedSort, ), ); @@ -960,7 +960,7 @@ void main() { filter: null, sort: null, predefinedFilter: filterName, - resolvedFilter: const Filter.empty(), + resolvedFilter: const ChannelFilter.raw({}), resolvedSort: resolvedSort, filterValues: filterValues, sortValues: sortValues, @@ -1100,7 +1100,7 @@ void main() { ); final resolvedSort = [ChannelSort.desc(ChannelSortField.lastMessageAt)]; - const resolvedFilter = Filter.empty(); + const resolvedFilter = ChannelFilter.raw({}); final expectedPredefinedFilter = PredefinedFilter( name: filterName, filter: resolvedFilter, @@ -1488,8 +1488,8 @@ void main() { }); await Future.wait([ - client.queryChannels(filter: Filter.in_('cid', const ['a'])).toList(), - client.queryChannels(filter: Filter.in_('cid', const ['b'])).toList(), + client.queryChannels(filter: ChannelFilter.in_(ChannelFilterField.cid, const ['a'])).toList(), + client.queryChannels(filter: ChannelFilter.in_(ChannelFilterField.cid, const ['b'])).toList(), ]); verify( @@ -1611,7 +1611,7 @@ void main() { ); const cid = 'message:nice-channel'; - final filter = Filter.equal('channel_cid', cid); + final filter = BannedUserFilter.equal(BannedUserFilterField.channelCid, cid); when( () => api.moderation.queryBannedUsers( @@ -1637,7 +1637,7 @@ void main() { test('`.search`', () async { const cid = 'test-type:test-id'; - final filter = Filter.in_('cid', const [cid]); + final filter = ChannelFilter.in_(ChannelFilterField.cid, const [cid]); final messages = List.generate( 3, @@ -3413,7 +3413,7 @@ void main() { }); test('`.queryPolls`', () async { - final filter = Filter.in_('id', const ['test-poll-id']); + final filter = PollFilter.in_(PollFilterField.id, const ['test-poll-id']); final sort = [PollSort.desc(PollSortField.createdAt)]; const pagination = PaginationParams(limit: 20); @@ -3459,7 +3459,7 @@ void main() { test('`.queryPollVotes`', () async { const pollId = 'test-poll-id'; - final filter = Filter.in_('id', const ['test-vote-id']); + final filter = PollVoteFilter.in_(PollVoteFilterField.id, const ['test-vote-id']); final sort = [PollVoteSort.desc(PollVoteSortField.createdAt)]; const pagination = PaginationParams(limit: 20); @@ -4605,7 +4605,7 @@ void main() { const channelId = 'test-channel-id'; const channelType = 'test-channel-type'; - final filter = Filter.equal('channel_cid', '$channelType:$channelId'); + final filter = DraftFilter.equal(DraftFilterField.channelCid, '$channelType:$channelId'); final sort = [DraftSort.desc(DraftSortField.createdAt)]; const pagination = PaginationParams(limit: 20); @@ -5276,7 +5276,7 @@ void main() { setUpAll(() { registerFallbackValue(const PaginationParams()); - registerFallbackValue(Filter.equal('cid', '')); + registerFallbackValue(ChannelFilter.equal(ChannelFilterField.cid, '')); }); setUp(() { @@ -5331,7 +5331,10 @@ void main() { verify( () => api.channel.queryChannels( - filter: Filter.in_('cid', const ['messaging:c1', 'messaging:c2']), + filter: any( + named: 'filter', + that: isSameFilterAs(ChannelFilter.in_(ChannelFilterField.cid, const ['messaging:c1', 'messaging:c2'])), + ), sort: any(named: 'sort'), state: any(named: 'state'), watch: any(named: 'watch'), @@ -5501,7 +5504,7 @@ void main() { setUpAll(() { registerFallbackValue(const PaginationParams()); - registerFallbackValue(Filter.equal('cid', '')); + registerFallbackValue(ChannelFilter.equal(ChannelFilterField.cid, '')); }); setUp(() { diff --git a/packages/stream_chat/test/src/core/api/channel_api_test.dart b/packages/stream_chat/test/src/core/api/channel_api_test.dart index d6c05fb53c..794e96f8a5 100644 --- a/packages/stream_chat/test/src/core/api/channel_api_test.dart +++ b/packages/stream_chat/test/src/core/api/channel_api_test.dart @@ -124,7 +124,7 @@ void main() { const channelId = 'test-channel-id'; const channelType = 'test-channel-type'; - final filter = Filter.in_('cid', const ['test-cid']); + final filter = ChannelFilter.in_(ChannelFilterField.cid, const ['test-cid']); final sort = [ChannelSort.desc(ChannelSortField.custom('test-field'))]; const memberLimit = 33; const messageLimit = 33; @@ -248,14 +248,12 @@ void main() { expect(res.predefinedFilter, isNotNull); expect(res.predefinedFilter!.name, predefinedFilter); expect( - res.predefinedFilter!.filter, - const Filter.raw( - value: { - 'members': { - r'$in': ['test-user-id'], - }, + res.predefinedFilter!.filter.toJson(), + const ChannelFilter.raw({ + 'members': { + r'$in': ['test-user-id'], }, - ), + }).toJson(), ); expect(res.predefinedFilter!.sort, hasLength(1)); expect(res.predefinedFilter!.sort!.first.field.remote, 'last_message_at'); diff --git a/packages/stream_chat/test/src/core/api/general_api_test.dart b/packages/stream_chat/test/src/core/api/general_api_test.dart index 194b714071..31a2992d6d 100644 --- a/packages/stream_chat/test/src/core/api/general_api_test.dart +++ b/packages/stream_chat/test/src/core/api/general_api_test.dart @@ -62,7 +62,7 @@ void main() { test( 'should throw if `query` and `messageFilters` is not provided', () async { - final filter = Filter.in_('cid', const ['test-cid-1', 'test-cid-2']); + final filter = ChannelFilter.in_(ChannelFilterField.cid, const ['test-cid-1', 'test-cid-2']); try { await generalApi.searchMessages(filter); } catch (e) { @@ -74,9 +74,9 @@ void main() { test( 'should throw if `query` and `messageFilters` both are provided', () async { - final filter = Filter.in_('cid', const ['test-cid-1', 'test-cid-2']); + final filter = ChannelFilter.in_(ChannelFilterField.cid, const ['test-cid-1', 'test-cid-2']); const query = 'test-query'; - final messageFilter = Filter.query('key', 'text'); + final messageFilter = MessageSearchFilter.query(MessageSearchFilterField.text, 'text'); try { await generalApi.searchMessages( filter, @@ -92,7 +92,7 @@ void main() { test( 'should throw if `pagination.offset` and `sort` both are provided', () async { - final filter = Filter.in_('cid', const ['test-cid-1', 'test-cid-2']); + final filter = ChannelFilter.in_(ChannelFilterField.cid, const ['test-cid-1', 'test-cid-2']); final sort = [MessageSearchSort.desc(MessageSearchSortField.custom('test-field'))]; const pagination = PaginationParams(offset: 10); try { @@ -108,7 +108,7 @@ void main() { ); test('should run successfully with `query`', () async { - final filter = Filter.in_('cid', const ['test-cid-1', 'test-cid-2']); + final filter = ChannelFilter.in_(ChannelFilterField.cid, const ['test-cid-1', 'test-cid-2']); const query = 'test-query'; final sort = [MessageSearchSort.desc(MessageSearchSortField.custom('test-field'))]; const pagination = PaginationParams(); @@ -148,9 +148,9 @@ void main() { }); test('should run successfully with `messageFilter`', () async { - final filter = Filter.in_('cid', const ['test-cid-1', 'test-cid-2']); + final filter = ChannelFilter.in_(ChannelFilterField.cid, const ['test-cid-1', 'test-cid-2']); final sort = [MessageSearchSort.desc(MessageSearchSortField.custom('test-field'))]; - final messageFilter = Filter.query('key', 'text'); + final messageFilter = MessageSearchFilter.query(MessageSearchFilterField.text, 'text'); const pagination = PaginationParams(); const path = '/search'; @@ -192,7 +192,7 @@ void main() { test('with `channelId`', () async { const channelType = 'test-channel-type'; const channelId = 'test-channel-id'; - final filter = Filter.in_('cid', const ['test-cid-1', 'test-cid-2']); + final filter = MemberFilter.in_(MemberFilterField.userId, const ['u1', 'u2']); const pagination = PaginationParams(); final sort = [MemberSort.desc(MemberSortField.custom('test-field'))]; @@ -246,7 +246,7 @@ void main() { test('with `members`', () async { const channelType = 'test-channel-type'; - final filter = Filter.in_('cid', const ['test-cid-1', 'test-cid-2']); + final filter = MemberFilter.in_(MemberFilterField.userId, const ['u1', 'u2']); const pagination = PaginationParams(); final sort = [MemberSort.desc(MemberSortField.custom('test-field'))]; diff --git a/packages/stream_chat/test/src/core/api/polls_api_test.dart b/packages/stream_chat/test/src/core/api/polls_api_test.dart index fb5e2f27b0..4b893bbef9 100644 --- a/packages/stream_chat/test/src/core/api/polls_api_test.dart +++ b/packages/stream_chat/test/src/core/api/polls_api_test.dart @@ -4,7 +4,6 @@ import 'package:dio/dio.dart'; import 'package:mocktail/mocktail.dart'; import 'package:stream_chat/src/core/api/polls_api.dart'; import 'package:stream_chat/src/core/api/requests.dart'; -import 'package:stream_chat/src/core/models/filter.dart'; import 'package:stream_chat/src/core/models/poll.dart'; import 'package:stream_chat/src/core/models/poll_option.dart'; import 'package:stream_chat/src/core/models/poll_vote.dart'; @@ -389,7 +388,7 @@ void main() { test('queryPolls', () async { const path = '/polls/query'; - final filter = Filter.in_('cid', const ['test-cid-1', 'test-cid-2']); + final filter = PollFilter.in_(PollFilterField.id, const ['p1', 'p2']); final sort = [PollSort.desc(PollSortField.createdAt)]; const pagination = PaginationParams(limit: 20); @@ -444,7 +443,7 @@ void main() { test('queryPollVotes', () async { const pollId = 'test-poll-id'; - final filter = Filter.in_('cid', const ['test-cid-1', 'test-cid-2']); + final filter = PollVoteFilter.in_(PollVoteFilterField.id, const ['v1', 'v2']); final sort = [PollVoteSort.desc(PollVoteSortField.createdAt)]; const pagination = PaginationParams(limit: 20); diff --git a/packages/stream_chat/test/src/core/api/reminders_api_test.dart b/packages/stream_chat/test/src/core/api/reminders_api_test.dart index 5609387d04..efe3d40050 100644 --- a/packages/stream_chat/test/src/core/api/reminders_api_test.dart +++ b/packages/stream_chat/test/src/core/api/reminders_api_test.dart @@ -6,7 +6,6 @@ import 'package:dio/dio.dart'; import 'package:mocktail/mocktail.dart'; import 'package:stream_chat/src/core/api/reminders_api.dart'; import 'package:stream_chat/src/core/api/requests.dart'; -import 'package:stream_chat/src/core/models/filter.dart'; import 'package:stream_chat/src/core/models/message_reminder.dart'; import 'package:test/test.dart'; @@ -70,7 +69,7 @@ void main() { test('should query reminders with filter, sort, and pagination', () async { const path = '/reminders/query'; - final filter = Filter.equal('userId', 'test-user-id'); + final filter = MessageReminderFilter.equal(MessageReminderFilterField.channelCid, 'messaging:test'); final sort = [MessageReminderSort.desc(MessageReminderSortField.remindAt)]; const pagination = PaginationParams(limit: 10, offset: 5); diff --git a/packages/stream_chat/test/src/core/api/user_api_test.dart b/packages/stream_chat/test/src/core/api/user_api_test.dart index 454739958d..8ebd0bfaa7 100644 --- a/packages/stream_chat/test/src/core/api/user_api_test.dart +++ b/packages/stream_chat/test/src/core/api/user_api_test.dart @@ -24,7 +24,7 @@ void main() { test('queryUsers', () async { const presence = true; - final filter = Filter.in_('cid', const ['test-cid-1', 'test-cid-2']); + final filter = UserFilter.in_(UserFilterField.id, const ['test-id-1', 'test-id-2']); final sort = [UserSort.desc(UserSortField.custom('test-field'))]; const pagination = PaginationParams(); diff --git a/packages/stream_chat/test/src/core/models/channel_test.dart b/packages/stream_chat/test/src/core/models/channel_test.dart index 876f79ebb2..63bcd7f6ca 100644 --- a/packages/stream_chat/test/src/core/models/channel_test.dart +++ b/packages/stream_chat/test/src/core/models/channel_test.dart @@ -101,6 +101,19 @@ void main() { expect(newChannel.hidden, true); }); + test('a non-boolean flag in replacement extraData falls back to the current value', () { + // The getters read these with `safeCast`, so `copyWith` has to as well — + // extra data is consumer-authored and can hold anything. + final channel = ChannelModel(cid: 'test:cid', muted: true, blocked: true); + + final newChannel = channel.copyWith( + extraData: {'muted': 'yes', 'blocked': 1}, + ); + + expect(newChannel.muted, true); + expect(newChannel.blocked, true); + }); + test('disabled property and extraData manipulation', () { final channel = ChannelModel(cid: 'test:cid', disabled: false); diff --git a/packages/stream_chat/test/src/core/models/filter_registry_test.dart b/packages/stream_chat/test/src/core/models/filter_registry_test.dart new file mode 100644 index 0000000000..a940f0cec3 --- /dev/null +++ b/packages/stream_chat/test/src/core/models/filter_registry_test.dart @@ -0,0 +1,314 @@ +import 'package:stream_chat/src/core/models/banned_user.dart'; +import 'package:stream_chat/src/core/models/channel_state.dart'; +import 'package:stream_chat/src/core/models/draft.dart'; +import 'package:stream_chat/src/core/models/member.dart'; +import 'package:stream_chat/src/core/models/message.dart'; +import 'package:stream_chat/src/core/models/message_reminder.dart'; +import 'package:stream_chat/src/core/models/poll.dart'; +import 'package:stream_chat/src/core/models/poll_vote.dart'; +import 'package:stream_chat/src/core/models/reaction.dart'; +import 'package:stream_chat/src/core/models/thread.dart'; +import 'package:stream_chat/src/core/models/user.dart'; +import 'package:stream_core/stream_core.dart' show FilterField; +import 'package:test/test.dart'; + +void main() { + group('registry surface', () { + // A wrong sort name fails the request. A wrong filter name does not: + // where the resource declares a custom-data container — channel, user, + // member, poll and thread all do — the server reads an unrecognised key + // as custom data, so the term matches no row and the query returns an + // empty page instead of an error. Nothing else catches that, so the sets + // are pinned. + void expectRemotes(List> fields, Set expected) { + expect(fields.map((it) => it.remote).toSet(), expected); + } + + test('banned user fields carry the wire names the API accepts', () { + expectRemotes( + [ + BannedUserFilterField.userId, + BannedUserFilterField.bannedById, + BannedUserFilterField.channelCid, + BannedUserFilterField.reason, + BannedUserFilterField.createdAt, + ], + {'user_id', 'banned_by_id', 'channel_cid', 'reason', 'created_at'}, + ); + }); + + test('channel fields carry the wire names the API accepts', () { + expectRemotes( + [ + ChannelFilterField.id, + ChannelFilterField.cid, + ChannelFilterField.type, + ChannelFilterField.name, + ChannelFilterField.createdById, + ChannelFilterField.team, + ChannelFilterField.frozen, + ChannelFilterField.createdAt, + ChannelFilterField.updatedAt, + ChannelFilterField.lastMessageAt, + ChannelFilterField.lastUpdated, + ChannelFilterField.memberCount, + ChannelFilterField.messageCount, + ChannelFilterField.members, + ChannelFilterField.memberUserName, + ChannelFilterField.channelRole, + ChannelFilterField.pinned, + ChannelFilterField.hidden, + ChannelFilterField.muted, + ChannelFilterField.blocked, + ChannelFilterField.disabled, + ChannelFilterField.archived, + ], + { + 'id', + 'cid', + 'type', + 'name', + 'created_by_id', + 'team', + 'frozen', + 'created_at', + 'updated_at', + 'last_message_at', + 'last_updated', + 'member_count', + 'message_count', + 'members', + 'member.user.name', + 'channel_role', + 'pinned', + 'hidden', + 'muted', + 'blocked', + 'disabled', + 'archived', + }, + ); + }); + + test('draft fields carry the wire names the API accepts', () { + expectRemotes( + [ + DraftFilterField.channelCid, + DraftFilterField.createdAt, + DraftFilterField.parentId, + ], + {'channel_cid', 'created_at', 'parent_id'}, + ); + }); + + test('member fields carry the wire names the API accepts', () { + expectRemotes( + [ + MemberFilterField.userId, + MemberFilterField.name, + MemberFilterField.channelRole, + MemberFilterField.isModerator, + MemberFilterField.banned, + MemberFilterField.invite, + MemberFilterField.joined, + MemberFilterField.lastActive, + MemberFilterField.userEmail, + MemberFilterField.userDeactivated, + MemberFilterField.notificationsMuted, + MemberFilterField.createdAt, + MemberFilterField.updatedAt, + ], + { + 'user_id', + 'name', + 'channel_role', + 'is_moderator', + 'banned', + 'invite', + 'joined', + 'last_active', + 'user.email', + 'user.nd_deactivated', + 'notifications_muted', + 'created_at', + 'updated_at', + }, + ); + }); + + test('message reminder fields carry the wire names the API accepts', () { + expectRemotes( + [ + MessageReminderFilterField.channelCid, + MessageReminderFilterField.messageId, + MessageReminderFilterField.remindAt, + MessageReminderFilterField.createdAt, + ], + {'channel_cid', 'message_id', 'remind_at', 'created_at'}, + ); + }); + + test('message search fields carry the wire names the API accepts', () { + expectRemotes( + [ + MessageSearchFilterField.id, + MessageSearchFilterField.text, + MessageSearchFilterField.type, + MessageSearchFilterField.userId, + MessageSearchFilterField.parentId, + MessageSearchFilterField.replyCount, + MessageSearchFilterField.pinned, + MessageSearchFilterField.attachments, + MessageSearchFilterField.attachmentsType, + MessageSearchFilterField.mentionedUsersId, + MessageSearchFilterField.createdAt, + MessageSearchFilterField.updatedAt, + ], + { + 'id', + 'text', + 'type', + 'user_id', + 'parent_id', + 'reply_count', + 'pinned', + 'attachments', + 'attachments.type', + 'mentioned_users.id', + 'created_at', + 'updated_at', + }, + ); + }); + + test('poll fields carry the wire names the API accepts', () { + expectRemotes( + [ + PollFilterField.id, + PollFilterField.name, + PollFilterField.createdById, + PollFilterField.isClosed, + PollFilterField.maxVotesAllowed, + PollFilterField.allowAnswers, + PollFilterField.allowUserSuggestedOptions, + PollFilterField.votingVisibility, + PollFilterField.createdAt, + PollFilterField.updatedAt, + ], + { + 'id', + 'name', + 'created_by_id', + 'is_closed', + 'max_votes_allowed', + 'allow_answers', + 'allow_user_suggested_options', + 'voting_visibility', + 'created_at', + 'updated_at', + }, + ); + }); + + test('poll vote fields carry the wire names the API accepts', () { + expectRemotes( + [ + PollVoteFilterField.id, + PollVoteFilterField.pollId, + PollVoteFilterField.optionId, + PollVoteFilterField.userId, + PollVoteFilterField.isAnswer, + PollVoteFilterField.createdAt, + PollVoteFilterField.updatedAt, + ], + {'id', 'poll_id', 'option_id', 'user_id', 'is_answer', 'created_at', 'updated_at'}, + ); + }); + + test('reaction fields carry the wire names the API accepts', () { + expectRemotes( + [ + ReactionFilterField.type, + ReactionFilterField.userId, + ReactionFilterField.createdAt, + ], + {'type', 'user_id', 'created_at'}, + ); + }); + + test('thread fields carry the wire names the API accepts', () { + expectRemotes( + [ + ThreadFilterField.channelCid, + ThreadFilterField.parentMessageId, + ThreadFilterField.createdByUserId, + ThreadFilterField.replyCount, + ThreadFilterField.participantCount, + ThreadFilterField.activeParticipantCount, + ThreadFilterField.lastMessageAt, + ThreadFilterField.createdAt, + ThreadFilterField.updatedAt, + ThreadFilterField.channelTeam, + ThreadFilterField.channelDisabled, + ], + { + 'channel_cid', + 'parent_message_id', + 'created_by_user_id', + 'reply_count', + 'participant_count', + 'active_participant_count', + 'last_message_at', + 'created_at', + 'updated_at', + 'channel.team', + 'channel.disabled', + }, + ); + }); + + test('user fields carry the wire names the API accepts', () { + expectRemotes( + [ + UserFilterField.id, + UserFilterField.name, + UserFilterField.username, + UserFilterField.email, + UserFilterField.role, + UserFilterField.teams, + UserFilterField.banned, + UserFilterField.shadowBanned, + UserFilterField.bypassModeration, + UserFilterField.lastActive, + UserFilterField.createdAt, + UserFilterField.updatedAt, + UserFilterField.language, + ], + { + 'id', + 'name', + 'username', + 'email', + 'role', + 'teams', + 'banned', + 'shadow_banned', + 'bypass_moderation', + 'last_active', + 'created_at', + 'updated_at', + 'language', + }, + ); + }); + + test('a custom field sends the name it was given', () { + expect(ChannelFilterField.custom('has_unread').remote, 'has_unread'); + expect(MemberFilterField.custom('x').remote, 'x'); + expect(MessageSearchFilterField.custom('x').remote, 'x'); + expect(PollFilterField.custom('x').remote, 'x'); + expect(ThreadFilterField.custom('has_unread').remote, 'has_unread'); + expect(UserFilterField.custom('x').remote, 'x'); + }); + }); +} diff --git a/packages/stream_chat/test/src/core/models/filter_test.dart b/packages/stream_chat/test/src/core/models/filter_test.dart deleted file mode 100644 index 3a82eadc49..0000000000 --- a/packages/stream_chat/test/src/core/models/filter_test.dart +++ /dev/null @@ -1,264 +0,0 @@ -import 'dart:convert'; - -import 'package:stream_chat/src/core/models/filter.dart'; -import 'package:test/test.dart'; - -void main() { - group('operators', () { - test('equal', () { - const key = 'testKey'; - const value = 'testValue'; - final filter = Filter.equal(key, value); - expect(filter.key, key); - expect(filter.value, value); - expect(filter.operator, FilterOperator.equal.toString()); - }); - - test('notEqual', () { - const key = 'testKey'; - const value = 'testValue'; - final filter = Filter.notEqual(key, value); - expect(filter.key, key); - expect(filter.value, value); - expect(filter.operator, FilterOperator.notEqual.toString()); - }); - - test('greater', () { - const key = 'testKey'; - const value = 'testValue'; - final filter = Filter.greater(key, value); - expect(filter.key, key); - expect(filter.value, value); - expect(filter.operator, FilterOperator.greater.toString()); - }); - - test('greaterOrEqual', () { - const key = 'testKey'; - const value = 'testValue'; - final filter = Filter.greaterOrEqual(key, value); - expect(filter.key, key); - expect(filter.value, value); - expect(filter.operator, FilterOperator.greaterOrEqual.toString()); - }); - - test('less', () { - const key = 'testKey'; - const value = 'testValue'; - final filter = Filter.less(key, value); - expect(filter.key, key); - expect(filter.value, value); - expect(filter.operator, FilterOperator.less.toString()); - }); - - test('lessOrEqual', () { - const key = 'testKey'; - const value = 'testValue'; - final filter = Filter.lessOrEqual(key, value); - expect(filter.key, key); - expect(filter.value, value); - expect(filter.operator, FilterOperator.lessOrEqual.toString()); - }); - - test('in', () { - const key = 'testKey'; - const values = ['testValue']; - final filter = Filter.in_(key, values); - expect(filter.key, key); - expect(filter.value, values); - expect(filter.operator, FilterOperator.in_.toString()); - }); - - test('in', () { - const key = 'testKey'; - const values = ['testValue']; - final filter = Filter.in_(key, values); - expect(filter.key, key); - expect(filter.value, values); - expect(filter.operator, FilterOperator.in_.toString()); - }); - - test('notIn', () { - const key = 'testKey'; - const values = ['testValue']; - final filter = Filter.notIn(key, values); - expect(filter.key, key); - expect(filter.value, values); - expect(filter.operator, FilterOperator.notIn.toString()); - }); - - test('query', () { - const key = 'testKey'; - const value = 'testQuery'; - final filter = Filter.query(key, value); - expect(filter.key, key); - expect(filter.value, value); - expect(filter.operator, FilterOperator.query.toString()); - }); - - test('autoComplete', () { - const key = 'testKey'; - const value = 'testQuery'; - final filter = Filter.autoComplete(key, value); - expect(filter.key, key); - expect(filter.value, value); - expect(filter.operator, FilterOperator.autoComplete.toString()); - }); - - test('exists', () { - const key = 'testKey'; - final filter = Filter.exists(key); - expect(filter.key, key); - expect(filter.value, isTrue); - expect(filter.operator, FilterOperator.exists.toString()); - }); - - test('notExists', () { - const key = 'testKey'; - final filter = Filter.notExists(key); - expect(filter.key, key); - expect(filter.value, isFalse); - expect(filter.operator, FilterOperator.exists.toString()); - }); - - test('custom', () { - const key = 'testKey'; - const value = 'testValue'; - const operator = r'$customOperator'; - const filter = Filter.custom(operator: operator, key: key, value: value); - expect(filter.key, key); - expect(filter.value, value); - expect(filter.operator, operator); - }); - - test('raw', () { - const value = { - 'test': ['a', 'b'], - }; - const filter = Filter.raw(value: value); - expect(filter.value, value); - }); - - test('empty', () { - const filter = Filter.empty(); - expect(filter.value, {}); - }); - - test('contains', () { - const key = 'testKey'; - const values = 'testValue'; - final filter = Filter.contains(key, values); - expect(filter.key, key); - expect(filter.value, values); - expect(filter.operator, FilterOperator.contains.toString()); - }); - - group('groupedOperator', () { - final filter1 = Filter.equal('testKey', 'testValue'); - final filter2 = Filter.in_('testKey', const ['testValue']); - final filters = [filter1, filter2]; - - test('and', () { - final filter = Filter.and(filters); - expect(filter.key, isNull); - expect(filter.value, filters); - expect(filter.operator, FilterOperator.and.toString()); - }); - - test('or', () { - final filter = Filter.or(filters); - expect(filter.key, isNull); - expect(filter.value, filters); - expect(filter.operator, FilterOperator.or.toString()); - }); - - test('nor', () { - final filter = Filter.nor(filters); - expect(filter.key, isNull); - expect(filter.value, filters); - expect(filter.operator, FilterOperator.nor.toString()); - }); - }); - }); - - group('encoding', () { - group('nonGroupedFilter', () { - test('simpleValue', () { - const key = 'testKey'; - const value = 'testValue'; - final filter = Filter.equal(key, value); - final encoded = json.encode(filter); - expect( - encoded, - '''{"$key":{"${FilterOperator.equal.toString()}":${json.encode(value)}}}''', - ); - }); - test('listValue', () { - const key = 'testKey'; - const values = ['testValue']; - final filter = Filter.in_(key, values); - final encoded = json.encode(filter); - expect( - encoded, - '''{"$key":{"${FilterOperator.in_.toString()}":${json.encode(values)}}}''', - ); - }); - - test('custom with no operator', () { - const key = 'testKey'; - const values = ['testValue']; - const filter = Filter.custom(key: key, value: values); - final encoded = json.encode(filter); - expect( - encoded, - '{"$key":${json.encode(values)}}', - ); - }); - - test('raw', () { - const value = { - 'test': ['a', 'b'], - }; - const filter = Filter.raw(value: value); - - final encoded = json.encode(filter); - expect( - encoded, - json.encode(value), - ); - }); - - test('empty', () { - const filter = Filter.empty(); - final encoded = json.encode(filter); - expect(encoded, '{}'); - }); - }); - - test('groupedFilter', () { - final filter1 = Filter.equal('testKey', 'testValue'); - final filter2 = Filter.in_('testKey', const ['testValue']); - final filters = [filter1, filter2]; - - final filter = Filter.and(filters); - final encoded = json.encode(filter); - expect( - encoded, - '{"${FilterOperator.and.toString()}":${json.encode(filters)}}', - ); - }); - - group('equality', () { - test('simpleFilter', () { - final filter1 = Filter.equal('testKey', 'testValue'); - final filter2 = Filter.equal('testKey', 'testValue'); - expect(filter1, filter2); - }); - - test('groupedFilter', () { - final filter1 = Filter.and([Filter.equal('testKey', 'testValue')]); - final filter2 = Filter.and([Filter.equal('testKey', 'testValue')]); - expect(filter1, filter2); - }); - }); - }); -} diff --git a/packages/stream_chat/test/src/core/models/predefined_filter_test.dart b/packages/stream_chat/test/src/core/models/predefined_filter_test.dart index 7aa0247b4c..0834e7a7cd 100644 --- a/packages/stream_chat/test/src/core/models/predefined_filter_test.dart +++ b/packages/stream_chat/test/src/core/models/predefined_filter_test.dart @@ -1,5 +1,4 @@ import 'package:stream_chat/src/core/models/channel_state.dart'; -import 'package:stream_chat/src/core/models/filter.dart'; import 'package:stream_chat/src/core/models/predefined_filter.dart'; import 'package:stream_core/stream_core.dart' show SortDirection; import 'package:test/test.dart'; @@ -35,7 +34,7 @@ void main() { final parsed = PredefinedFilter.fromJson(json); expect(parsed.name, 'unread'); - expect(parsed.filter.value, filterJson); + expect(parsed.filter.toJson(), filterJson); expect(parsed.sort, hasLength(1)); expect(parsed.sort!.first.field.remote, 'last_message_at'); expect(parsed.sort!.first.direction, SortDirection.desc); @@ -84,7 +83,7 @@ void main() { test('returns the echoed sort when present', () { final filter = PredefinedFilter( name: 'x', - filter: const Filter.empty(), + filter: const ChannelFilter.raw({}), sort: [ChannelSort.asc(ChannelSortField.createdAt)], ); @@ -96,7 +95,7 @@ void main() { }); test('falls back to lastUpdated desc when sort is null and filter is empty', () { - const predefined = PredefinedFilter(name: 'x', filter: Filter.empty()); + const predefined = PredefinedFilter(name: 'x', filter: ChannelFilter.raw({})); final sort = predefined.effectiveSort; @@ -108,8 +107,8 @@ void main() { test('falls back to lastMessageAt desc when raw filter touches last_message_at', () { const predefined = PredefinedFilter( name: 'x', - filter: Filter.raw( - value: { + filter: ChannelFilter.raw( + { 'last_message_at': {r'$gt': '2024-01-01T00:00:00Z'}, }, ), @@ -124,8 +123,8 @@ void main() { test(r'falls back to lastMessageAt desc when last_message_at is nested under $or', () { const predefined = PredefinedFilter( name: 'x', - filter: Filter.raw( - value: { + filter: ChannelFilter.raw( + { r'$or': [ { 'type': {r'$eq': 'messaging'}, @@ -146,8 +145,8 @@ void main() { test('falls back to lastUpdated desc when filter touches only other fields', () { const predefined = PredefinedFilter( name: 'x', - filter: Filter.raw( - value: { + filter: ChannelFilter.raw( + { r'$and': [ {'frozen': false}, { @@ -168,9 +167,9 @@ void main() { test('falls back to lastMessageAt desc when typed Filter.and touches last_message_at', () { final predefined = PredefinedFilter( name: 'x', - filter: Filter.and([ - Filter.equal('type', 'messaging'), - Filter.greater('last_message_at', '2024-01-01T00:00:00Z'), + filter: ChannelFilter.and([ + ChannelFilter.equal(ChannelFilterField.type, 'messaging'), + ChannelFilter.greater(ChannelFilterField.lastMessageAt, '2024-01-01T00:00:00Z'), ]), ); diff --git a/packages/stream_chat/test/src/db/chat_persistence_client_test.dart b/packages/stream_chat/test/src/db/chat_persistence_client_test.dart index ed2ce17d71..4bee46f54f 100644 --- a/packages/stream_chat/test/src/db/chat_persistence_client_test.dart +++ b/packages/stream_chat/test/src/db/chat_persistence_client_test.dart @@ -4,7 +4,6 @@ import 'package:stream_chat/src/core/models/channel_state.dart'; import 'package:stream_chat/src/core/models/draft.dart'; import 'package:stream_chat/src/core/models/draft_message.dart'; import 'package:stream_chat/src/core/models/event.dart'; -import 'package:stream_chat/src/core/models/filter.dart'; import 'package:stream_chat/src/core/models/location.dart'; import 'package:stream_chat/src/core/models/member.dart'; import 'package:stream_chat/src/core/models/message.dart'; @@ -81,7 +80,7 @@ class TestPersistenceClient extends ChatPersistenceClient { @override Future> getChannelStates({ - Filter? filter, + ChannelFilter? filter, List? channelStateSort, int? messageLimit, PaginationParams? paginationParams, @@ -123,7 +122,7 @@ class TestPersistenceClient extends ChatPersistenceClient { Future> getReplies(String parentId, {PaginationParams? options}) => throw UnimplementedError(); @override - Future updateChannelQueries(Filter? filter, List cids, {bool clearQueryCache = false}) => + Future updateChannelQueries(ChannelFilter? filter, List cids, {bool clearQueryCache = false}) => throw UnimplementedError(); @override diff --git a/packages/stream_chat/test/src/matchers.dart b/packages/stream_chat/test/src/matchers.dart index 8a82ea566b..c7dc60b210 100644 --- a/packages/stream_chat/test/src/matchers.dart +++ b/packages/stream_chat/test/src/matchers.dart @@ -7,8 +7,20 @@ import 'package:stream_chat/src/core/models/draft_message.dart'; import 'package:stream_chat/src/core/models/event.dart'; import 'package:stream_chat/src/core/models/message.dart'; import 'package:stream_chat/src/core/models/user.dart'; +import 'package:stream_core/stream_core.dart' show Filter; import 'package:test/test.dart'; +/// Matches a filter that serializes the same way as [target]. +/// +/// A filter compares by identity, so two filters built from the same field +/// and value are not equal. Comparing what they send is what callers mean. +Matcher isSameFilterAs(Filter target) { + return predicate>( + (it) => const DeepCollectionEquality().equals(it.toJson(), target.toJson()), + 'a filter serializing to ${target.toJson()}', + ); +} + Matcher isSameMultipartFileAs(MultipartFile targetFile) => _IsSameMultipartFileAs(targetFile: targetFile); class _IsSameMultipartFileAs extends Matcher { diff --git a/packages/stream_chat_flutter/example/lib/main.dart b/packages/stream_chat_flutter/example/lib/main.dart index 5f8e620f99..e9803d031a 100644 --- a/packages/stream_chat_flutter/example/lib/main.dart +++ b/packages/stream_chat_flutter/example/lib/main.dart @@ -184,8 +184,8 @@ class ChannelListPage extends StatefulWidget { class _ChannelListPageState extends State { late final _listController = StreamChannelListController( client: StreamChat.of(context).client, - filter: Filter.in_( - 'members', + filter: .in_( + ChannelFilterField.members, [StreamChat.of(context).currentUser!.id], ), channelStateSort: [ChannelSort.desc(ChannelSortField.lastMessageAt)], diff --git a/packages/stream_chat_flutter/example/lib/split_view.dart b/packages/stream_chat_flutter/example/lib/split_view.dart index 22dd25ba74..b78dc9f6a9 100644 --- a/packages/stream_chat_flutter/example/lib/split_view.dart +++ b/packages/stream_chat_flutter/example/lib/split_view.dart @@ -103,8 +103,8 @@ class ChannelListPage extends StatefulWidget { class _ChannelListPageState extends State { late final _listController = StreamChannelListController( client: StreamChat.of(context).client, - filter: Filter.in_( - 'members', + filter: .in_( + ChannelFilterField.members, [StreamChat.of(context).currentUser!.id], ), channelStateSort: [ChannelSort.desc(ChannelSortField.lastMessageAt)], diff --git a/packages/stream_chat_flutter/example/lib/tutorial_part_2.dart b/packages/stream_chat_flutter/example/lib/tutorial_part_2.dart index 9edb10e331..f8d4977276 100644 --- a/packages/stream_chat_flutter/example/lib/tutorial_part_2.dart +++ b/packages/stream_chat_flutter/example/lib/tutorial_part_2.dart @@ -80,8 +80,8 @@ class ChannelListPage extends StatefulWidget { class _ChannelListPageState extends State { late final _controller = StreamChannelListController( client: StreamChat.of(context).client, - filter: Filter.in_( - 'members', + filter: .in_( + ChannelFilterField.members, [StreamChat.of(context).currentUser!.id], ), channelStateSort: [ChannelSort.desc(ChannelSortField.lastMessageAt)], diff --git a/packages/stream_chat_flutter/example/lib/tutorial_part_3.dart b/packages/stream_chat_flutter/example/lib/tutorial_part_3.dart index a1e20d1d33..03022ba3af 100644 --- a/packages/stream_chat_flutter/example/lib/tutorial_part_3.dart +++ b/packages/stream_chat_flutter/example/lib/tutorial_part_3.dart @@ -83,8 +83,8 @@ class ChannelListPage extends StatefulWidget { class _ChannelListPageState extends State { late final _listController = StreamChannelListController( client: StreamChat.of(context).client, - filter: Filter.in_( - 'members', + filter: .in_( + ChannelFilterField.members, [StreamChat.of(context).currentUser!.id], ), channelStateSort: [ChannelSort.desc(ChannelSortField.lastMessageAt)], diff --git a/packages/stream_chat_flutter/example/lib/tutorial_part_4.dart b/packages/stream_chat_flutter/example/lib/tutorial_part_4.dart index 882369fc0d..9567fce51e 100644 --- a/packages/stream_chat_flutter/example/lib/tutorial_part_4.dart +++ b/packages/stream_chat_flutter/example/lib/tutorial_part_4.dart @@ -69,8 +69,8 @@ class ChannelListPage extends StatefulWidget { class _ChannelListPageState extends State { late final _listController = StreamChannelListController( client: StreamChat.of(context).client, - filter: Filter.in_( - 'members', + filter: .in_( + ChannelFilterField.members, [StreamChat.of(context).currentUser!.id], ), channelStateSort: [ChannelSort.desc(ChannelSortField.lastMessageAt)], diff --git a/packages/stream_chat_flutter/example/lib/tutorial_part_5.dart b/packages/stream_chat_flutter/example/lib/tutorial_part_5.dart index 21d4687ac4..b17bde3a1f 100644 --- a/packages/stream_chat_flutter/example/lib/tutorial_part_5.dart +++ b/packages/stream_chat_flutter/example/lib/tutorial_part_5.dart @@ -74,8 +74,8 @@ class ChannelListPage extends StatefulWidget { class _ChannelListPageState extends State { late final _listController = StreamChannelListController( client: StreamChat.of(context).client, - filter: Filter.in_( - 'members', + filter: .in_( + ChannelFilterField.members, [StreamChat.of(context).currentUser!.id], ), channelStateSort: [ChannelSort.desc(ChannelSortField.lastMessageAt)], diff --git a/packages/stream_chat_flutter/example/lib/tutorial_part_6.dart b/packages/stream_chat_flutter/example/lib/tutorial_part_6.dart index 4036988df8..9c5ca67c36 100644 --- a/packages/stream_chat_flutter/example/lib/tutorial_part_6.dart +++ b/packages/stream_chat_flutter/example/lib/tutorial_part_6.dart @@ -105,8 +105,8 @@ class ChannelListPage extends StatefulWidget { class _ChannelListPageState extends State { late final _listController = StreamChannelListController( client: StreamChat.of(context).client, - filter: Filter.in_( - 'members', + filter: .in_( + ChannelFilterField.members, [StreamChat.of(context).currentUser!.id], ), channelStateSort: [ChannelSort.desc(ChannelSortField.lastMessageAt)], diff --git a/packages/stream_chat_flutter/lib/src/autocomplete/stream_mention_autocomplete_options.dart b/packages/stream_chat_flutter/lib/src/autocomplete/stream_mention_autocomplete_options.dart index 2a384d1b68..979ad82b6f 100644 --- a/packages/stream_chat_flutter/lib/src/autocomplete/stream_mention_autocomplete_options.dart +++ b/packages/stream_chat_flutter/lib/src/autocomplete/stream_mention_autocomplete_options.dart @@ -269,7 +269,7 @@ class _StreamMentionAutocompleteOptionsState extends State> _queryMembers(String query) async { final response = await widget.channel.queryMembers( pagination: PaginationParams(limit: widget.limit), - filter: query.isEmpty ? const Filter.empty() : Filter.autoComplete('name', query), + filter: query.isEmpty ? null : MemberFilter.autoComplete(MemberFilterField.name, query), ); return response.members; } @@ -282,10 +282,10 @@ class _StreamMentionAutocompleteOptionsState extends State { _controller = StreamPollVoteListController( pollId: widget.poll.id, channel: StreamChannel.of(context).channel, - filter: Filter.equal('is_answer', true), + filter: .equal(PollVoteFilterField.isAnswer, true), ); } diff --git a/packages/stream_chat_flutter/lib/src/poll/stream_poll_option_votes_sheet.dart b/packages/stream_chat_flutter/lib/src/poll/stream_poll_option_votes_sheet.dart index 184f51f676..120e06de68 100644 --- a/packages/stream_chat_flutter/lib/src/poll/stream_poll_option_votes_sheet.dart +++ b/packages/stream_chat_flutter/lib/src/poll/stream_poll_option_votes_sheet.dart @@ -93,10 +93,11 @@ class _StreamPollOptionVotesSheetState extends State } void _initializeController() { + final optionId = widget.option.id!; _controller = StreamPollVoteListController( pollId: widget.poll.id, channel: StreamChannel.of(context).channel, - filter: Filter.equal('option_id', widget.option.id!), + filter: .equal(PollVoteFilterField.optionId, optionId), ); } diff --git a/packages/stream_chat_flutter/lib/src/reactions/detail/reaction_detail_sheet.dart b/packages/stream_chat_flutter/lib/src/reactions/detail/reaction_detail_sheet.dart index 3c5296879c..a397d04435 100644 --- a/packages/stream_chat_flutter/lib/src/reactions/detail/reaction_detail_sheet.dart +++ b/packages/stream_chat_flutter/lib/src/reactions/detail/reaction_detail_sheet.dart @@ -108,7 +108,7 @@ class _ReactionDetailSheetState extends State { messageId: widget.message.id, sort: ReactionSort.defaultSort, filter: switch (_currentReactionType) { - final type? => .equal('type', type), + final type? => .equal(ReactionFilterField.type, type), _ => null, }, ); @@ -119,7 +119,7 @@ class _ReactionDetailSheetState extends State { setState(() => _currentReactionType = type); final updatedFilter = switch (type) { - final type? => Filter.equal('type', type), + final type? => ReactionFilter.equal(ReactionFilterField.type, type), _ => null, }; diff --git a/packages/stream_chat_flutter/test/src/reactions/detail/reaction_detail_sheet_test.dart b/packages/stream_chat_flutter/test/src/reactions/detail/reaction_detail_sheet_test.dart index e802ba6ac8..34c009cae0 100644 --- a/packages/stream_chat_flutter/test/src/reactions/detail/reaction_detail_sheet_test.dart +++ b/packages/stream_chat_flutter/test/src/reactions/detail/reaction_detail_sheet_test.dart @@ -12,7 +12,7 @@ void main() { setUpAll(() { registerFallbackValue(const PaginationParams()); - registerFallbackValue(Filter.equal('type', 'like')); + registerFallbackValue(ReactionFilter.equal(ReactionFilterField.type, 'like')); }); setUp(() { diff --git a/packages/stream_chat_flutter_core/CHANGELOG.md b/packages/stream_chat_flutter_core/CHANGELOG.md index ef5eb66599..68e7649304 100644 --- a/packages/stream_chat_flutter_core/CHANGELOG.md +++ b/packages/stream_chat_flutter_core/CHANGELOG.md @@ -3,6 +3,8 @@ 🛑️ Breaking - `PagedValue.error` and every `errorBuilder` now carry a `StreamChatException` instead of a `StreamChatError`, following the low-level client's error layer. A generic throwable is reported as a `StreamClientException` naming the load that failed, with the original kept as its `cause` rather than stringified into the message. +- Each list controller's `filter` is typed for the query it runs — `StreamChannelListController` a `ChannelFilter?`, `StreamUserListController` a `UserFilter?`, and so on — so a field from another model does not compile. +- `StreamMessageSearchListController.messageFilter` is a `MessageSearchFilter?`, distinct from the `ChannelFilter` its `filter` takes. - The sort argument on every list controller is typed `List`, `List` and so on, rather than `SortOrder`. On the controllers that have a default, the `sort` property is non-nullable: leaving it unset selects that default, and `ChannelSort.empty` / `MemberSort.empty` / … query with the ordering the API applies on its own. - `defaultChannelListSort`, `defaultMemberListSort`, `defaultUserListSort`, `defaultDraftListSort`, `defaultMessageReminderListSort` and `defaultPollVoteListSort` are removed. Use `ChannelSort.defaultSort`, `MemberSort.defaultSort` and so on from `stream_chat`. Leaving a controller's sort unset still applies the same ordering. diff --git a/packages/stream_chat_flutter_core/example/lib/main.dart b/packages/stream_chat_flutter_core/example/lib/main.dart index 42b60ad9ee..f924485b07 100644 --- a/packages/stream_chat_flutter_core/example/lib/main.dart +++ b/packages/stream_chat_flutter_core/example/lib/main.dart @@ -67,9 +67,9 @@ class _HomeScreenState extends State { /// [StreamChannelListController]. late final channelListController = StreamChannelListController( client: StreamChatCore.of(context).client, - filter: Filter.and([ - Filter.equal('type', 'messaging'), - Filter.in_('members', [StreamChatCore.of(context).currentUser!.id]), + filter: .and([ + ChannelFilter.equal(ChannelFilterField.type, 'messaging'), + ChannelFilter.in_(ChannelFilterField.members, [StreamChatCore.of(context).currentUser!.id]), ]), ); diff --git a/packages/stream_chat_flutter_core/lib/src/search_debouncer.dart b/packages/stream_chat_flutter_core/lib/src/search_debouncer.dart index fb69d11f63..15242cee8d 100644 --- a/packages/stream_chat_flutter_core/lib/src/search_debouncer.dart +++ b/packages/stream_chat_flutter_core/lib/src/search_debouncer.dart @@ -1,34 +1,21 @@ +import 'package:collection/collection.dart'; import 'package:meta/meta.dart'; import 'package:rate_limiter/rate_limiter.dart'; -import 'package:stream_chat/stream_chat.dart' show Filter, FilterOperator; +import 'package:stream_chat/stream_chat.dart' show EvaluationOperator, Filter, LogicalOperator; /// The length of the search text in [filter], or `null` when it holds none. /// -/// Only the text-search operators ([FilterOperator.autoComplete] and -/// [FilterOperator.query]) count; a filter built around them is debounced by -/// the longest such text, even when nested inside a compound filter. Anything -/// else returns `null`, meaning "not a text search" — an exact-match lookup, -/// for example, should reload immediately rather than wait for the debounce. +/// Only the text-search operators ([Filter.autoComplete] and [Filter.query]) +/// count; a filter built around them is debounced by the longest such text, +/// even when nested inside a compound filter. Anything else returns `null`, +/// meaning "not a text search" — an exact-match lookup, for example, should +/// reload immediately rather than wait for the debounce. @internal -int? searchQueryLength(Filter? filter) { - if (filter == null) return null; - - final value = filter.value; - var isTextSearch = filter.operator == '${FilterOperator.query}'; - isTextSearch |= filter.operator == '${FilterOperator.autoComplete}'; - if (isTextSearch && value is String) return value.length; - - if (value is Iterable) { - int? longest; - for (final nested in value) { - final length = searchQueryLength(nested); - if (length != null && (longest == null || length > longest)) longest = length; - } - return longest; - } - - return null; -} +int? searchQueryLength(Filter? filter) => switch (filter) { + EvaluationOperator(:final query) => query.length, + LogicalOperator(:final filters) => filters.map(searchQueryLength).nonNulls.maxOrNull, + _ => null, +}; /// A query-length-aware debounce policy for search input. /// diff --git a/packages/stream_chat_flutter_core/lib/src/stream_channel.dart b/packages/stream_chat_flutter_core/lib/src/stream_channel.dart index 0841f4065b..f2b416f930 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_channel.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_channel.dart @@ -724,7 +724,7 @@ class StreamChannelState extends State { /// Query channel members. Future> queryMembers({ - Filter? filter, + MemberFilter? filter, List? sort, PaginationParams? pagination, }) async { diff --git a/packages/stream_chat_flutter_core/lib/src/stream_channel_list_controller.dart b/packages/stream_chat_flutter_core/lib/src/stream_channel_list_controller.dart index 22b8e9f3ce..dffec3233c 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_channel_list_controller.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_channel_list_controller.dart @@ -95,7 +95,7 @@ class StreamChannelListController extends PagedValueNotifier { /// You can query on any of the custom fields you've defined on the [Channel]. /// /// You can also filter other built-in channel fields. - final Filter? filter; + final ChannelFilter? filter; /// The sorting used for the channels matching the filters. /// diff --git a/packages/stream_chat_flutter_core/lib/src/stream_draft_list_controller.dart b/packages/stream_chat_flutter_core/lib/src/stream_draft_list_controller.dart index 6010f18abe..980b8cbee8 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_draft_list_controller.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_draft_list_controller.dart @@ -56,8 +56,8 @@ class StreamDraftListController extends PagedValueNotifier { /// /// You can query on any of the custom fields you've defined on the /// [Draft]. - final Filter? filter; - Filter? _activeFilter; + final DraftFilter? filter; + DraftFilter? _activeFilter; /// The sorting used for the drafts matching the filters. /// @@ -79,7 +79,7 @@ class StreamDraftListController extends PagedValueNotifier { /// /// Use this if you need to support runtime filter changes, /// through custom filters UI. - set filter(Filter? value) => _activeFilter = value; + set filter(DraftFilter? value) => _activeFilter = value; /// Allows for the change of the query sort used for poll vote queries. /// diff --git a/packages/stream_chat_flutter_core/lib/src/stream_member_list_controller.dart b/packages/stream_chat_flutter_core/lib/src/stream_member_list_controller.dart index 4bf0de6f86..ba1bf2d028 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_member_list_controller.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_member_list_controller.dart @@ -56,8 +56,8 @@ class StreamMemberListController extends PagedValueNotifier with Se /// You can query on any of the custom fields you've defined on the [Member]. /// /// You can also filter other built-in channel fields. - final Filter? filter; - Filter? _activeFilter; + final MemberFilter? filter; + MemberFilter? _activeFilter; /// The sorting used for the members matching the filters. /// @@ -82,7 +82,7 @@ class StreamMemberListController extends PagedValueNotifier with Se /// /// Note: This will not trigger a new query. make sure to call /// [doInitialLoad] after setting a new filter. - set filter(Filter? value) => _activeFilter = value; + set filter(MemberFilter? value) => _activeFilter = value; /// Allows for the change of the query sort used for member queries. /// @@ -106,7 +106,7 @@ class StreamMemberListController extends PagedValueNotifier with Se final trimmed = query.trim(); if (trimmed.isEmpty) return searchWithFilter(filter); - final searchFilter = Filter.autoComplete('name', trimmed); + final searchFilter = MemberFilter.autoComplete(MemberFilterField.name, trimmed); return searchWithFilter(searchFilter); } @@ -118,7 +118,7 @@ class StreamMemberListController extends PagedValueNotifier with Se /// the reload is debounced by that text's length; otherwise it reloads /// immediately. Rapidly superseded searches are dropped, so only the latest /// query's results are applied. - void searchWithFilter(Filter? filter) { + void searchWithFilter(MemberFilter? filter) { _activeFilter = filter; debouncedSearch(searchQueryLength(filter)); } diff --git a/packages/stream_chat_flutter_core/lib/src/stream_message_reminder_list_controller.dart b/packages/stream_chat_flutter_core/lib/src/stream_message_reminder_list_controller.dart index b7f67122f2..383839a5b1 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_message_reminder_list_controller.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_message_reminder_list_controller.dart @@ -59,8 +59,8 @@ class StreamMessageReminderListController extends PagedValueNotifier _activeFilter = value; + set filter(MessageReminderFilter? value) => _activeFilter = value; /// Allows for the change of the query sort used for message reminder queries. /// diff --git a/packages/stream_chat_flutter_core/lib/src/stream_message_search_list_controller.dart b/packages/stream_chat_flutter_core/lib/src/stream_message_search_list_controller.dart index 3787859e4a..c889832c6a 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_message_search_list_controller.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_message_search_list_controller.dart @@ -80,16 +80,16 @@ class StreamMessageSearchListController extends PagedValueNotifier _activeFilter = value; + set filter(ChannelFilter value) => _activeFilter = value; /// Allows for the change of message filters used for message search queries. /// @@ -124,7 +124,7 @@ class StreamMessageSearchListController extends PagedValueNotifier _activeMessageFilter = value; + set messageFilter(MessageSearchFilter? value) => _activeMessageFilter = value; /// Allows for the change of filters used for message search queries. /// @@ -156,7 +156,7 @@ class StreamMessageSearchListController extends PagedValueNotifier /// /// You can query on any of the custom fields you've defined on the /// [PollVote]. - final Filter? filter; - Filter? _activeFilter; + final PollVoteFilter? filter; + PollVoteFilter? _activeFilter; /// The sorting used for the poll votes matching the filters. /// @@ -87,7 +87,7 @@ class StreamPollVoteListController extends PagedValueNotifier /// /// Note: This will not trigger a new query. make sure to call /// [doInitialLoad] after setting a new filter. - set filter(Filter? value) => _activeFilter = value; + set filter(PollVoteFilter? value) => _activeFilter = value; /// Allows for the change of the query sort used for poll vote queries. /// diff --git a/packages/stream_chat_flutter_core/lib/src/stream_reaction_list_controller.dart b/packages/stream_chat_flutter_core/lib/src/stream_reaction_list_controller.dart index b60f950e66..188eb29579 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_reaction_list_controller.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_reaction_list_controller.dart @@ -55,8 +55,8 @@ class StreamReactionListController extends PagedValueNotifier /// The query filters to use. /// /// Supported filter fields: `type`, `user_id`, `created_at`. - final Filter? filter; - Filter? _activeFilter; + final ReactionFilter? filter; + ReactionFilter? _activeFilter; /// The sorting used for the reactions matching the filters. /// @@ -79,7 +79,7 @@ class StreamReactionListController extends PagedValueNotifier /// /// Note: This will not trigger a new query. Make sure to call /// [doInitialLoad] or [refresh] after setting a new filter. - set filter(Filter? value) => _activeFilter = value; + set filter(ReactionFilter? value) => _activeFilter = value; /// Allows for the change of the query sort used for reaction queries. /// diff --git a/packages/stream_chat_flutter_core/lib/src/stream_thread_list_controller.dart b/packages/stream_chat_flutter_core/lib/src/stream_thread_list_controller.dart index b3c7709ab2..3766f5f9d8 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_thread_list_controller.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_thread_list_controller.dart @@ -59,8 +59,8 @@ class StreamThreadListController extends PagedValueNotifier { /// The query filters to use. /// /// You can query on any of the custom fields you've defined on the [Thread]. - final Filter? filter; - Filter? _activeFilter; + final ThreadFilter? filter; + ThreadFilter? _activeFilter; /// The sorting used for the threads matching the filters. /// @@ -89,7 +89,7 @@ class StreamThreadListController extends PagedValueNotifier { /// /// Note: This will not trigger a new query. make sure to call /// [doInitialLoad] after setting a new filter. - set filter(Filter? value) => _activeFilter = value; + set filter(ThreadFilter? value) => _activeFilter = value; /// Allows for the change of the query sort used for thread queries. /// diff --git a/packages/stream_chat_flutter_core/lib/src/stream_user_list_controller.dart b/packages/stream_chat_flutter_core/lib/src/stream_user_list_controller.dart index da919e3659..604c75acc7 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_user_list_controller.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_user_list_controller.dart @@ -61,8 +61,8 @@ class StreamUserListController extends PagedValueNotifier with Search /// You can query on any of the custom fields you've defined on the [User]. /// /// You can also filter other built-in channel fields. - final Filter? filter; - Filter? _activeFilter; + final UserFilter? filter; + UserFilter? _activeFilter; /// The sorting used for the users matching the filters. /// @@ -90,7 +90,7 @@ class StreamUserListController extends PagedValueNotifier with Search /// /// Note: This will not trigger a new query. make sure to call /// [doInitialLoad] after setting a new filter. - set filter(Filter? value) => _activeFilter = value; + set filter(UserFilter? value) => _activeFilter = value; /// Allows for the change of the query sort used for user queries. /// @@ -114,9 +114,9 @@ class StreamUserListController extends PagedValueNotifier with Search final trimmed = query.trim(); if (trimmed.isEmpty) return searchWithFilter(filter); - final searchFilter = Filter.or([ - Filter.autoComplete('name', trimmed), - Filter.autoComplete('id', trimmed), + final searchFilter = UserFilter.or([ + UserFilter.autoComplete(UserFilterField.name, trimmed), + UserFilter.autoComplete(UserFilterField.id, trimmed), ]); return searchWithFilter(searchFilter); @@ -129,7 +129,7 @@ class StreamUserListController extends PagedValueNotifier with Search /// the reload is debounced by that text's length; otherwise it reloads /// immediately. Rapidly superseded searches are dropped, so only the latest /// query's results are applied. - void searchWithFilter(Filter? filter) { + void searchWithFilter(UserFilter? filter) { _activeFilter = filter; debouncedSearch(searchQueryLength(filter)); } diff --git a/packages/stream_chat_flutter_core/test/search_debouncer_test.dart b/packages/stream_chat_flutter_core/test/search_debouncer_test.dart index 9caa2f1a88..c7ff11e51d 100644 --- a/packages/stream_chat_flutter_core/test/search_debouncer_test.dart +++ b/packages/stream_chat_flutter_core/test/search_debouncer_test.dart @@ -83,25 +83,25 @@ void main() { group('searchQueryLength', () { test('returns the autocomplete text length', () { - expect(searchQueryLength(Filter.autoComplete('name', 'john')), 4); + expect(searchQueryLength(UserFilter.autoComplete(UserFilterField.name, 'john')), 4); }); test('returns the query text length', () { - expect(searchQueryLength(Filter.query('name', 'jo')), 2); + expect(searchQueryLength(UserFilter.query(UserFilterField.name, 'jo')), 2); }); test('returns the longest search text in a compound filter', () { - final filter = Filter.and([ - Filter.notEqual('id', 'me'), - Filter.autoComplete('name', 'john'), - Filter.query('bio', 'developer'), + final filter = UserFilter.and([ + UserFilter.equal(UserFilterField.role, 'user'), + UserFilter.autoComplete(UserFilterField.name, 'john'), + UserFilter.query(UserFilterField.custom('bio'), 'developer'), ]); expect(searchQueryLength(filter), 'developer'.length); }); test('returns null for a filter with no text-search operator', () { - expect(searchQueryLength(Filter.equal('id', 'user-1')), isNull); + expect(searchQueryLength(UserFilter.equal(UserFilterField.id, 'user-1')), isNull); }); test('returns null for a null filter', () { diff --git a/packages/stream_chat_flutter_core/test/stream_channel_list_controller_test.dart b/packages/stream_chat_flutter_core/test/stream_channel_list_controller_test.dart index 30918efc23..54fd77a481 100644 --- a/packages/stream_chat_flutter_core/test/stream_channel_list_controller_test.dart +++ b/packages/stream_chat_flutter_core/test/stream_channel_list_controller_test.dart @@ -38,7 +38,7 @@ void main() { Future buildController({ List channels = const [], - Filter? filter, + ChannelFilter? filter, List? channelStateSort, String? predefinedFilter, Map? filterValues, @@ -88,7 +88,7 @@ void main() { }); test('doInitialLoad forwards inline filter and sort to queryChannels', () async { - final filter = Filter.in_('members', const ['u1']); + final filter = ChannelFilter.in_(ChannelFilterField.members, const ['u1']); final sort = [ChannelSort.desc(ChannelSortField.lastMessageAt)]; await buildController(filter: filter, channelStateSort: sort); @@ -168,7 +168,7 @@ void main() { }); test('loadMore appends new channels and forwards inline filter', () async { - final filter = Filter.in_('members', const ['u1']); + final filter = ChannelFilter.in_(ChannelFilterField.members, const ['u1']); const nextPageKey = 2; final existing = [unsortedMockChannel(), unsortedMockChannel()]; diff --git a/packages/stream_chat_flutter_core/test/stream_draft_list_controller_test.dart b/packages/stream_chat_flutter_core/test/stream_draft_list_controller_test.dart index 017a3a999e..b058ba02e9 100644 --- a/packages/stream_chat_flutter_core/test/stream_draft_list_controller_test.dart +++ b/packages/stream_chat_flutter_core/test/stream_draft_list_controller_test.dart @@ -682,7 +682,7 @@ void main() { test('refresh resets filter and sort to initial values', () async { final drafts = generateDrafts(); - final initialFilter = Filter.equal('type', 'messaging'); + final initialFilter = DraftFilter.equal(DraftFilterField.channelCid, 'messaging'); final initialSort = [DraftSort.desc(DraftSortField.createdAt)]; final apiCalls = >[]; @@ -713,7 +713,7 @@ void main() { await pumpEventQueue(); controller - ..filter = Filter.equal('type', 'team') + ..filter = DraftFilter.equal(DraftFilterField.channelCid, 'team') ..sort = [DraftSort.asc(DraftSortField.createdAt)]; await controller.refresh(); @@ -730,9 +730,9 @@ void main() { 'refresh with resetValue=false preserves current filter and sort', () async { final drafts = generateDrafts(); - final initialFilter = Filter.equal('type', 'messaging'); + final initialFilter = DraftFilter.equal(DraftFilterField.channelCid, 'messaging'); final initialSort = [DraftSort.desc(DraftSortField.createdAt)]; - final newFilter = Filter.equal('type', 'team'); + final newFilter = DraftFilter.equal(DraftFilterField.channelCid, 'team'); final newSort = [DraftSort.asc(DraftSortField.createdAt)]; final apiCalls = >[]; diff --git a/packages/stream_chat_flutter_core/test/stream_member_list_controller_test.dart b/packages/stream_chat_flutter_core/test/stream_member_list_controller_test.dart index 5d1e2c4e0c..e5b3f128e7 100644 --- a/packages/stream_chat_flutter_core/test/stream_member_list_controller_test.dart +++ b/packages/stream_chat_flutter_core/test/stream_member_list_controller_test.dart @@ -68,7 +68,7 @@ void main() { expect(usedFilter, isNull); async.elapse(const Duration(milliseconds: 1)); - expect(usedFilter, Filter.autoComplete('name', 'abc')); + expect(usedFilter?.toJson(), MemberFilter.autoComplete(MemberFilterField.name, 'abc').toJson()); }); }); @@ -88,7 +88,7 @@ void main() { fakeAsync((async) { final controller = StreamMemberListController( channel: channel, - filter: Filter.equal('banned', true), + filter: MemberFilter.equal(MemberFilterField.banned, true), ); addTearDown(controller.dispose); @@ -97,7 +97,7 @@ void main() { // The base filter is not merged in — combining it with the search text // would let it skew the debounce policy and contradict the search. - expect(usedFilter, Filter.autoComplete('name', 'abc')); + expect(usedFilter?.toJson(), MemberFilter.autoComplete(MemberFilterField.name, 'abc').toJson()); }); }); }); diff --git a/packages/stream_chat_flutter_core/test/stream_message_search_list_controller_test.dart b/packages/stream_chat_flutter_core/test/stream_message_search_list_controller_test.dart index fe26f5303b..221d0faa71 100644 --- a/packages/stream_chat_flutter_core/test/stream_message_search_list_controller_test.dart +++ b/packages/stream_chat_flutter_core/test/stream_message_search_list_controller_test.dart @@ -12,7 +12,7 @@ void main() { final client = MockClient(); setUpAll(() { - registerFallbackValue(Filter.equal('cid', 'messaging:123')); + registerFallbackValue(ChannelFilter.equal(ChannelFilterField.cid, 'messaging:123')); }); tearDown(() { @@ -28,7 +28,7 @@ void main() { StreamMessageSearchListController buildController() { return StreamMessageSearchListController( client: client, - filter: Filter.in_('members', const ['user-id']), + filter: ChannelFilter.in_(ChannelFilterField.members, const ['user-id']), searchQuery: '', ); } @@ -60,7 +60,7 @@ void main() { expect(usedFilter, isNull); async.elapse(const Duration(milliseconds: 1)); - expect(usedFilter, Filter.autoComplete('text', 'abc')); + expect(usedFilter?.toJson(), MessageSearchFilter.autoComplete(MessageSearchFilterField.text, 'abc').toJson()); }); }); @@ -121,7 +121,7 @@ void main() { final controller = buildController(); addTearDown(controller.dispose); - final filter = Filter.autoComplete('text', 'abc'); + final filter = MessageSearchFilter.autoComplete(MessageSearchFilterField.text, 'abc'); controller.searchWithFilter(filter); async.elapse(const Duration(milliseconds: 300)); diff --git a/packages/stream_chat_flutter_core/test/stream_reaction_list_controller_test.dart b/packages/stream_chat_flutter_core/test/stream_reaction_list_controller_test.dart index aa8b619d8d..dd8c8044dc 100644 --- a/packages/stream_chat_flutter_core/test/stream_reaction_list_controller_test.dart +++ b/packages/stream_chat_flutter_core/test/stream_reaction_list_controller_test.dart @@ -52,7 +52,7 @@ void main() { setUpAll(() { registerFallbackValue(const PaginationParams()); - registerFallbackValue(Filter.equal('type', 'like')); + registerFallbackValue(ReactionFilter.equal(ReactionFilterField.type, 'like')); }); setUp(() { @@ -468,7 +468,7 @@ void main() { test('refresh resets filter and sort to initial values', () async { final reactions = generateReactions(); - final initialFilter = Filter.equal('type', 'like'); + final initialFilter = ReactionFilter.equal(ReactionFilterField.type, 'like'); final sort = [ReactionSort.desc(ReactionSortField.createdAt)]; final apiCalls = >[]; @@ -502,7 +502,7 @@ void main() { // Change filter and sort at runtime controller - ..filter = Filter.equal('type', 'love') + ..filter = ReactionFilter.equal(ReactionFilterField.type, 'love') ..sort = [ReactionSort.asc(ReactionSortField.createdAt)]; await controller.refresh(); @@ -517,9 +517,9 @@ void main() { test('refresh with resetValue=false preserves current filter and sort', () async { final reactions = generateReactions(); - final initialFilter = Filter.equal('type', 'like'); + final initialFilter = ReactionFilter.equal(ReactionFilterField.type, 'like'); final initialSort = [ReactionSort.desc(ReactionSortField.createdAt)]; - final newFilter = Filter.equal('type', 'love'); + final newFilter = ReactionFilter.equal(ReactionFilterField.type, 'love'); final newSort = [ReactionSort.asc(ReactionSortField.createdAt)]; final apiCalls = >[]; diff --git a/packages/stream_chat_flutter_core/test/stream_user_list_controller_test.dart b/packages/stream_chat_flutter_core/test/stream_user_list_controller_test.dart index f5aa202df5..881c9a60d9 100644 --- a/packages/stream_chat_flutter_core/test/stream_user_list_controller_test.dart +++ b/packages/stream_chat_flutter_core/test/stream_user_list_controller_test.dart @@ -72,8 +72,11 @@ void main() { async.elapse(const Duration(milliseconds: 1)); expect( - usedFilter, - Filter.or([Filter.autoComplete('name', 'abc'), Filter.autoComplete('id', 'abc')]), + usedFilter?.toJson(), + UserFilter.or([ + UserFilter.autoComplete(UserFilterField.name, 'abc'), + UserFilter.autoComplete(UserFilterField.id, 'abc'), + ]).toJson(), ); }); }); @@ -125,7 +128,7 @@ void main() { fakeAsync((async) { final controller = StreamUserListController( client: client, - filter: Filter.notEqual('id', 'me'), + filter: UserFilter.equal(UserFilterField.role, 'user'), ); addTearDown(controller.dispose); @@ -135,8 +138,11 @@ void main() { // The base filter is not merged in — combining it with the search text // would let it skew the debounce policy and contradict the search. expect( - usedFilter, - Filter.or([Filter.autoComplete('name', 'abc'), Filter.autoComplete('id', 'abc')]), + usedFilter?.toJson(), + UserFilter.or([ + UserFilter.autoComplete(UserFilterField.name, 'abc'), + UserFilter.autoComplete(UserFilterField.id, 'abc'), + ]).toJson(), ); }); }); @@ -155,7 +161,7 @@ void main() { return usersResponse([]); }); - final baseFilter = Filter.notEqual('id', 'me'); + final baseFilter = UserFilter.equal(UserFilterField.role, 'user'); fakeAsync((async) { final controller = StreamUserListController(client: client, filter: baseFilter); @@ -168,7 +174,7 @@ void main() { controller.search(''); async.elapse(const Duration(milliseconds: 500)); - expect(filters.last, baseFilter); + expect(filters.last?.toJson(), baseFilter.toJson()); }); }); @@ -234,8 +240,11 @@ void main() { async.elapse(const Duration(milliseconds: 300)); expect(queryCount, 1); expect( - lastFilter, - Filter.or([Filter.autoComplete('name', 'abc'), Filter.autoComplete('id', 'abc')]), + lastFilter?.toJson(), + UserFilter.or([ + UserFilter.autoComplete(UserFilterField.name, 'abc'), + UserFilter.autoComplete(UserFilterField.id, 'abc'), + ]).toJson(), ); // No superseded query fires after the coalesced one. @@ -264,9 +273,9 @@ void main() { final controller = StreamUserListController(client: client); addTearDown(controller.dispose); - final filter = Filter.and([ - Filter.autoComplete('name', 'jo'), - Filter.notEqual('id', 'me'), + final filter = UserFilter.and([ + UserFilter.autoComplete(UserFilterField.name, 'jo'), + UserFilter.equal(UserFilterField.role, 'user'), ]); controller.searchWithFilter(filter); @@ -275,7 +284,7 @@ void main() { expect(usedFilter, isNull); async.elapse(const Duration(milliseconds: 1)); - expect(usedFilter, filter); + expect(usedFilter?.toJson(), filter.toJson()); }); }); @@ -298,7 +307,7 @@ void main() { addTearDown(controller.dispose); // A non-text filter must not wait for any debounce delay. - controller.searchWithFilter(Filter.equal('id', 'user-1')); + controller.searchWithFilter(UserFilter.equal(UserFilterField.id, 'user-1')); async.flushMicrotasks(); expect(queryCount, 1); diff --git a/packages/stream_chat_persistence/CHANGELOG.md b/packages/stream_chat_persistence/CHANGELOG.md index c3e433a1ae..0a34045055 100644 --- a/packages/stream_chat_persistence/CHANGELOG.md +++ b/packages/stream_chat_persistence/CHANGELOG.md @@ -4,6 +4,8 @@ - `StreamChatPersistenceClient` no longer takes `logLevel` or `logHandlerFunction`. Logging is configured once, on `StreamChatClient`, with `logConfig`. - The sort arguments on `getChannelStates`, `queryChannelStates` and `saveChannelQueries` are typed `List` rather than `SortOrder`. +- The filter arguments on `getChannelStates`, `queryChannelStates`, `updateChannelQueries` and `saveChannelQueries` are typed `ChannelFilter?` rather than an untyped `Filter`. +- A predefined-filter query whose resolved filter is absent now stores no filter, rather than an empty one. The schema version is bumped for it, so the local cache is rebuilt once on upgrade. 🔄 Changed diff --git a/packages/stream_chat_persistence/lib/src/converter/filter_converter.dart b/packages/stream_chat_persistence/lib/src/converter/filter_converter.dart index 56857c6470..5915224584 100644 --- a/packages/stream_chat_persistence/lib/src/converter/filter_converter.dart +++ b/packages/stream_chat_persistence/lib/src/converter/filter_converter.dart @@ -9,16 +9,16 @@ import 'package:stream_chat/stream_chat.dart'; /// Used by the `channel_query_metadata` table to persist the server-resolved /// filter spec associated with a predefined-filter query, so that offline /// reads can reconstruct the full resolved spec. -class FilterConverter extends TypeConverter { +class FilterConverter extends TypeConverter { /// Creates a new instance. const FilterConverter(); @override - Filter fromSql(String fromDb) { + ChannelFilter fromSql(String fromDb) { final value = jsonDecode(fromDb) as Map; - return Filter.raw(value: value); + return ChannelFilter.raw(value); } @override - String toSql(Filter value) => jsonEncode(value.toJson()); + String toSql(ChannelFilter value) => jsonEncode(value.toJson()); } diff --git a/packages/stream_chat_persistence/lib/src/dao/channel_query_dao.dart b/packages/stream_chat_persistence/lib/src/dao/channel_query_dao.dart index 5b2dd395f3..84fa499ead 100644 --- a/packages/stream_chat_persistence/lib/src/dao/channel_query_dao.dart +++ b/packages/stream_chat_persistence/lib/src/dao/channel_query_dao.dart @@ -17,7 +17,7 @@ class ChannelQueryDao extends DatabaseAccessor with _$Channel /// Creates a new channel query dao instance ChannelQueryDao(super.db); - String _computeHash(Filter? filter) { + String _computeHash(ChannelFilter? filter) { if (filter == null) { return 'allchannels'; } @@ -42,7 +42,7 @@ class ChannelQueryDao extends DatabaseAccessor with _$Channel /// If [clearQueryCache] is true before the insert /// the list of matching rows will be deleted Future updateChannelQueries( - Filter? filter, + ChannelFilter? filter, List cids, { bool clearQueryCache = false, }) async => transaction(() async { @@ -73,7 +73,7 @@ class ChannelQueryDao extends DatabaseAccessor with _$Channel Future updateChannelQueriesByPredefinedFilter( String filterName, List cids, { - required Filter filter, + ChannelFilter? filter, required List sort, Map? filterValues, Map? sortValues, @@ -110,13 +110,13 @@ class ChannelQueryDao extends DatabaseAccessor with _$Channel }); /// Get the CIDs stored under the hash generated by [filter]. - Future> getCachedChannelCids(Filter? filter) { + Future> getCachedChannelCids(ChannelFilter? filter) { final hash = _computeHash(filter); return (select(channelQueries)..where((c) => c.queryHash.equals(hash))).map((c) => c.channelCid).get(); } /// Get list of channels by filter, sort and paginationParams - Future> getChannels({Filter? filter}) async { + Future> getChannels({ChannelFilter? filter}) async { final cachedChannelCids = await getCachedChannelCids(filter); final query = select(channels)..where((c) => c.cid.isIn(cachedChannelCids)); @@ -139,7 +139,7 @@ class ChannelQueryDao extends DatabaseAccessor with _$Channel /// /// Returns a record `(channels, filter, sort)`. The two /// spec fields are null when no metadata row exists for this query. - Future<(List, Filter?, List?)> getChannelsAndSpecByPredefinedFilter( + Future<(List, ChannelFilter?, List?)> getChannelsAndSpecByPredefinedFilter( String filterName, { Map? filterValues, Map? sortValues, diff --git a/packages/stream_chat_persistence/lib/src/dao/draft_message_dao.g.dart b/packages/stream_chat_persistence/lib/src/dao/draft_message_dao.g.dart index d9de110f6d..aeb0b29f96 100644 --- a/packages/stream_chat_persistence/lib/src/dao/draft_message_dao.g.dart +++ b/packages/stream_chat_persistence/lib/src/dao/draft_message_dao.g.dart @@ -4,15 +4,17 @@ part of 'draft_message_dao.dart'; // ignore_for_file: type=lint mixin _$DraftMessageDaoMixin on DatabaseAccessor { - $DraftMessagesTable get draftMessages => attachedDatabase.draftMessages; + $ChannelsTable get channels => attachedDatabase.channels; $MessagesTable get messages => attachedDatabase.messages; + $DraftMessagesTable get draftMessages => attachedDatabase.draftMessages; DraftMessageDaoManager get managers => DraftMessageDaoManager(this); } class DraftMessageDaoManager { final _$DraftMessageDaoMixin _db; DraftMessageDaoManager(this._db); + $$ChannelsTableTableManager get channels => $$ChannelsTableTableManager(_db.attachedDatabase, _db.channels); + $$MessagesTableTableManager get messages => $$MessagesTableTableManager(_db.attachedDatabase, _db.messages); $$DraftMessagesTableTableManager get draftMessages => $$DraftMessagesTableTableManager(_db.attachedDatabase, _db.draftMessages); - $$MessagesTableTableManager get messages => $$MessagesTableTableManager(_db.attachedDatabase, _db.messages); } diff --git a/packages/stream_chat_persistence/lib/src/dao/location_dao.g.dart b/packages/stream_chat_persistence/lib/src/dao/location_dao.g.dart index 278b814111..f94ce58c57 100644 --- a/packages/stream_chat_persistence/lib/src/dao/location_dao.g.dart +++ b/packages/stream_chat_persistence/lib/src/dao/location_dao.g.dart @@ -4,6 +4,8 @@ part of 'location_dao.dart'; // ignore_for_file: type=lint mixin _$LocationDaoMixin on DatabaseAccessor { + $ChannelsTable get channels => attachedDatabase.channels; + $MessagesTable get messages => attachedDatabase.messages; $LocationsTable get locations => attachedDatabase.locations; LocationDaoManager get managers => LocationDaoManager(this); } @@ -11,5 +13,7 @@ mixin _$LocationDaoMixin on DatabaseAccessor { class LocationDaoManager { final _$LocationDaoMixin _db; LocationDaoManager(this._db); + $$ChannelsTableTableManager get channels => $$ChannelsTableTableManager(_db.attachedDatabase, _db.channels); + $$MessagesTableTableManager get messages => $$MessagesTableTableManager(_db.attachedDatabase, _db.messages); $$LocationsTableTableManager get locations => $$LocationsTableTableManager(_db.attachedDatabase, _db.locations); } diff --git a/packages/stream_chat_persistence/lib/src/dao/member_dao.g.dart b/packages/stream_chat_persistence/lib/src/dao/member_dao.g.dart index 65ef3d0f13..f202f4fc11 100644 --- a/packages/stream_chat_persistence/lib/src/dao/member_dao.g.dart +++ b/packages/stream_chat_persistence/lib/src/dao/member_dao.g.dart @@ -4,6 +4,7 @@ part of 'member_dao.dart'; // ignore_for_file: type=lint mixin _$MemberDaoMixin on DatabaseAccessor { + $ChannelsTable get channels => attachedDatabase.channels; $MembersTable get members => attachedDatabase.members; $UsersTable get users => attachedDatabase.users; MemberDaoManager get managers => MemberDaoManager(this); @@ -12,6 +13,7 @@ mixin _$MemberDaoMixin on DatabaseAccessor { class MemberDaoManager { final _$MemberDaoMixin _db; MemberDaoManager(this._db); + $$ChannelsTableTableManager get channels => $$ChannelsTableTableManager(_db.attachedDatabase, _db.channels); $$MembersTableTableManager get members => $$MembersTableTableManager(_db.attachedDatabase, _db.members); $$UsersTableTableManager get users => $$UsersTableTableManager(_db.attachedDatabase, _db.users); } diff --git a/packages/stream_chat_persistence/lib/src/dao/message_dao.g.dart b/packages/stream_chat_persistence/lib/src/dao/message_dao.g.dart index 7c0acb0a3d..b044680b30 100644 --- a/packages/stream_chat_persistence/lib/src/dao/message_dao.g.dart +++ b/packages/stream_chat_persistence/lib/src/dao/message_dao.g.dart @@ -4,6 +4,7 @@ part of 'message_dao.dart'; // ignore_for_file: type=lint mixin _$MessageDaoMixin on DatabaseAccessor { + $ChannelsTable get channels => attachedDatabase.channels; $MessagesTable get messages => attachedDatabase.messages; $UsersTable get users => attachedDatabase.users; MessageDaoManager get managers => MessageDaoManager(this); @@ -12,6 +13,7 @@ mixin _$MessageDaoMixin on DatabaseAccessor { class MessageDaoManager { final _$MessageDaoMixin _db; MessageDaoManager(this._db); + $$ChannelsTableTableManager get channels => $$ChannelsTableTableManager(_db.attachedDatabase, _db.channels); $$MessagesTableTableManager get messages => $$MessagesTableTableManager(_db.attachedDatabase, _db.messages); $$UsersTableTableManager get users => $$UsersTableTableManager(_db.attachedDatabase, _db.users); } diff --git a/packages/stream_chat_persistence/lib/src/dao/pinned_message_reaction_dao.g.dart b/packages/stream_chat_persistence/lib/src/dao/pinned_message_reaction_dao.g.dart index 57bb730d16..0487e73aa9 100644 --- a/packages/stream_chat_persistence/lib/src/dao/pinned_message_reaction_dao.g.dart +++ b/packages/stream_chat_persistence/lib/src/dao/pinned_message_reaction_dao.g.dart @@ -4,6 +4,7 @@ part of 'pinned_message_reaction_dao.dart'; // ignore_for_file: type=lint mixin _$PinnedMessageReactionDaoMixin on DatabaseAccessor { + $PinnedMessagesTable get pinnedMessages => attachedDatabase.pinnedMessages; $PinnedMessageReactionsTable get pinnedMessageReactions => attachedDatabase.pinnedMessageReactions; $UsersTable get users => attachedDatabase.users; PinnedMessageReactionDaoManager get managers => PinnedMessageReactionDaoManager(this); @@ -12,6 +13,10 @@ mixin _$PinnedMessageReactionDaoMixin on DatabaseAccessor { class PinnedMessageReactionDaoManager { final _$PinnedMessageReactionDaoMixin _db; PinnedMessageReactionDaoManager(this._db); + $$PinnedMessagesTableTableManager get pinnedMessages => $$PinnedMessagesTableTableManager( + _db.attachedDatabase, + _db.pinnedMessages, + ); $$PinnedMessageReactionsTableTableManager get pinnedMessageReactions => $$PinnedMessageReactionsTableTableManager( _db.attachedDatabase, _db.pinnedMessageReactions, diff --git a/packages/stream_chat_persistence/lib/src/dao/poll_vote_dao.g.dart b/packages/stream_chat_persistence/lib/src/dao/poll_vote_dao.g.dart index 5e2a262643..fee64718d1 100644 --- a/packages/stream_chat_persistence/lib/src/dao/poll_vote_dao.g.dart +++ b/packages/stream_chat_persistence/lib/src/dao/poll_vote_dao.g.dart @@ -4,6 +4,7 @@ part of 'poll_vote_dao.dart'; // ignore_for_file: type=lint mixin _$PollVoteDaoMixin on DatabaseAccessor { + $PollsTable get polls => attachedDatabase.polls; $PollVotesTable get pollVotes => attachedDatabase.pollVotes; $UsersTable get users => attachedDatabase.users; PollVoteDaoManager get managers => PollVoteDaoManager(this); @@ -12,6 +13,7 @@ mixin _$PollVoteDaoMixin on DatabaseAccessor { class PollVoteDaoManager { final _$PollVoteDaoMixin _db; PollVoteDaoManager(this._db); + $$PollsTableTableManager get polls => $$PollsTableTableManager(_db.attachedDatabase, _db.polls); $$PollVotesTableTableManager get pollVotes => $$PollVotesTableTableManager(_db.attachedDatabase, _db.pollVotes); $$UsersTableTableManager get users => $$UsersTableTableManager(_db.attachedDatabase, _db.users); } diff --git a/packages/stream_chat_persistence/lib/src/dao/reaction_dao.g.dart b/packages/stream_chat_persistence/lib/src/dao/reaction_dao.g.dart index 9cb7327ac5..4bc2458415 100644 --- a/packages/stream_chat_persistence/lib/src/dao/reaction_dao.g.dart +++ b/packages/stream_chat_persistence/lib/src/dao/reaction_dao.g.dart @@ -4,6 +4,8 @@ part of 'reaction_dao.dart'; // ignore_for_file: type=lint mixin _$ReactionDaoMixin on DatabaseAccessor { + $ChannelsTable get channels => attachedDatabase.channels; + $MessagesTable get messages => attachedDatabase.messages; $ReactionsTable get reactions => attachedDatabase.reactions; $UsersTable get users => attachedDatabase.users; ReactionDaoManager get managers => ReactionDaoManager(this); @@ -12,6 +14,8 @@ mixin _$ReactionDaoMixin on DatabaseAccessor { class ReactionDaoManager { final _$ReactionDaoMixin _db; ReactionDaoManager(this._db); + $$ChannelsTableTableManager get channels => $$ChannelsTableTableManager(_db.attachedDatabase, _db.channels); + $$MessagesTableTableManager get messages => $$MessagesTableTableManager(_db.attachedDatabase, _db.messages); $$ReactionsTableTableManager get reactions => $$ReactionsTableTableManager(_db.attachedDatabase, _db.reactions); $$UsersTableTableManager get users => $$UsersTableTableManager(_db.attachedDatabase, _db.users); } diff --git a/packages/stream_chat_persistence/lib/src/dao/read_dao.g.dart b/packages/stream_chat_persistence/lib/src/dao/read_dao.g.dart index 5ed73de23d..417fd7985f 100644 --- a/packages/stream_chat_persistence/lib/src/dao/read_dao.g.dart +++ b/packages/stream_chat_persistence/lib/src/dao/read_dao.g.dart @@ -4,6 +4,7 @@ part of 'read_dao.dart'; // ignore_for_file: type=lint mixin _$ReadDaoMixin on DatabaseAccessor { + $ChannelsTable get channels => attachedDatabase.channels; $ReadsTable get reads => attachedDatabase.reads; $UsersTable get users => attachedDatabase.users; ReadDaoManager get managers => ReadDaoManager(this); @@ -12,6 +13,7 @@ mixin _$ReadDaoMixin on DatabaseAccessor { class ReadDaoManager { final _$ReadDaoMixin _db; ReadDaoManager(this._db); + $$ChannelsTableTableManager get channels => $$ChannelsTableTableManager(_db.attachedDatabase, _db.channels); $$ReadsTableTableManager get reads => $$ReadsTableTableManager(_db.attachedDatabase, _db.reads); $$UsersTableTableManager get users => $$UsersTableTableManager(_db.attachedDatabase, _db.users); } diff --git a/packages/stream_chat_persistence/lib/src/db/drift_chat_database.dart b/packages/stream_chat_persistence/lib/src/db/drift_chat_database.dart index 7c6185d382..1e07f3b072 100644 --- a/packages/stream_chat_persistence/lib/src/db/drift_chat_database.dart +++ b/packages/stream_chat_persistence/lib/src/db/drift_chat_database.dart @@ -56,9 +56,10 @@ class DriftChatDatabase extends _$DriftChatDatabase { /// User id to which the database is connected String get userId => _userId; - // you should bump this number whenever you change or add a table definition. + // Band the version by SDK major, and bump the offset whenever you change or + // add a table definition. @override - int get schemaVersion => 1100 + 1; + int get schemaVersion => 1100 + 2; // Store DateTime as ISO-8601 text to preserve sub-second precision. @override diff --git a/packages/stream_chat_persistence/lib/src/db/drift_chat_database.g.dart b/packages/stream_chat_persistence/lib/src/db/drift_chat_database.g.dart index 75abc02e0d..2dc9c37d3d 100644 --- a/packages/stream_chat_persistence/lib/src/db/drift_chat_database.g.dart +++ b/packages/stream_chat_persistence/lib/src/db/drift_chat_database.g.dart @@ -11003,13 +11003,16 @@ class $ChannelQueriesMetadataTable extends ChannelQueriesMetadata requiredDuringInsert: true, ); @override - late final GeneratedColumnWithTypeConverter filter = GeneratedColumn( - 'filter', - aliasedName, - false, - type: DriftSqlType.string, - requiredDuringInsert: true, - ).withConverter($ChannelQueriesMetadataTable.$converterfilter); + late final GeneratedColumnWithTypeConverter filter = + GeneratedColumn( + 'filter', + aliasedName, + true, + type: DriftSqlType.string, + requiredDuringInsert: false, + ).withConverter( + $ChannelQueriesMetadataTable.$converterfiltern, + ); @override late final GeneratedColumnWithTypeConverter, String> sort = GeneratedColumn( @@ -11059,11 +11062,11 @@ class $ChannelQueriesMetadataTable extends ChannelQueriesMetadata DriftSqlType.string, data['${effectivePrefix}query_hash'], )!, - filter: $ChannelQueriesMetadataTable.$converterfilter.fromSql( + filter: $ChannelQueriesMetadataTable.$converterfiltern.fromSql( attachedDatabase.typeMapping.read( DriftSqlType.string, data['${effectivePrefix}filter'], - )!, + ), ), sort: $ChannelQueriesMetadataTable.$convertersort.fromSql( attachedDatabase.typeMapping.read( @@ -11079,7 +11082,8 @@ class $ChannelQueriesMetadataTable extends ChannelQueriesMetadata return $ChannelQueriesMetadataTable(attachedDatabase, alias); } - static TypeConverter $converterfilter = const FilterConverter(); + static TypeConverter $converterfilter = const FilterConverter(); + static TypeConverter $converterfiltern = NullAwareTypeConverter.wrap($converterfilter); static TypeConverter, String> $convertersort = const ChannelSortConverter(); } @@ -11089,22 +11093,24 @@ class ChannelQueryMetadataEntity extends DataClass implements Insertable sort; const ChannelQueryMetadataEntity({ required this.queryHash, - required this.filter, + this.filter, required this.sort, }); @override Map toColumns(bool nullToAbsent) { final map = {}; map['query_hash'] = Variable(queryHash); - { + if (!nullToAbsent || filter != null) { map['filter'] = Variable( - $ChannelQueriesMetadataTable.$converterfilter.toSql(filter), + $ChannelQueriesMetadataTable.$converterfiltern.toSql(filter), ); } { @@ -11122,7 +11128,7 @@ class ChannelQueryMetadataEntity extends DataClass implements Insertable(json['queryHash']), - filter: serializer.fromJson(json['filter']), + filter: serializer.fromJson(json['filter']), sort: serializer.fromJson>(json['sort']), ); } @@ -11131,18 +11137,18 @@ class ChannelQueryMetadataEntity extends DataClass implements Insertable{ 'queryHash': serializer.toJson(queryHash), - 'filter': serializer.toJson(filter), + 'filter': serializer.toJson(filter), 'sort': serializer.toJson>(sort), }; } ChannelQueryMetadataEntity copyWith({ String? queryHash, - Filter? filter, + Value filter = const Value.absent(), List? sort, }) => ChannelQueryMetadataEntity( queryHash: queryHash ?? this.queryHash, - filter: filter ?? this.filter, + filter: filter.present ? filter.value : this.filter, sort: sort ?? this.sort, ); ChannelQueryMetadataEntity copyWithCompanion( @@ -11178,7 +11184,7 @@ class ChannelQueryMetadataEntity extends DataClass implements Insertable { final Value queryHash; - final Value filter; + final Value filter; final Value> sort; final Value rowid; const ChannelQueriesMetadataCompanion({ @@ -11189,11 +11195,10 @@ class ChannelQueriesMetadataCompanion extends UpdateCompanion sort, this.rowid = const Value.absent(), }) : queryHash = Value(queryHash), - filter = Value(filter), sort = Value(sort); static Insertable custom({ Expression? queryHash, @@ -11211,7 +11216,7 @@ class ChannelQueriesMetadataCompanion extends UpdateCompanion? queryHash, - Value? filter, + Value? filter, Value>? sort, Value? rowid, }) { @@ -11231,7 +11236,7 @@ class ChannelQueriesMetadataCompanion extends UpdateCompanion( - $ChannelQueriesMetadataTable.$converterfilter.toSql(filter.value), + $ChannelQueriesMetadataTable.$converterfiltern.toSql(filter.value), ); } if (sort.present) { @@ -18814,14 +18819,14 @@ typedef $$ChannelQueriesTableProcessedTableManager = typedef $$ChannelQueriesMetadataTableCreateCompanionBuilder = ChannelQueriesMetadataCompanion Function({ required String queryHash, - required Filter filter, + Value filter, required List sort, Value rowid, }); typedef $$ChannelQueriesMetadataTableUpdateCompanionBuilder = ChannelQueriesMetadataCompanion Function({ Value queryHash, - Value filter, + Value filter, Value> sort, Value rowid, }); @@ -18839,7 +18844,7 @@ class $$ChannelQueriesMetadataTableFilterComposer extends Composer<_$DriftChatDa builder: (column) => ColumnFilters(column), ); - ColumnWithTypeConverterFilters get filter => $composableBuilder( + ColumnWithTypeConverterFilters get filter => $composableBuilder( column: $table.filter, builder: (column) => ColumnWithTypeConverterFilters(column), ); @@ -18886,7 +18891,7 @@ class $$ChannelQueriesMetadataTableAnnotationComposer }); GeneratedColumn get queryHash => $composableBuilder(column: $table.queryHash, builder: (column) => column); - GeneratedColumnWithTypeConverter get filter => + GeneratedColumnWithTypeConverter get filter => $composableBuilder(column: $table.filter, builder: (column) => column); GeneratedColumnWithTypeConverter, String> get sort => @@ -18933,7 +18938,7 @@ class $$ChannelQueriesMetadataTableTableManager updateCompanionCallback: ({ Value queryHash = const Value.absent(), - Value filter = const Value.absent(), + Value filter = const Value.absent(), Value> sort = const Value.absent(), Value rowid = const Value.absent(), }) => ChannelQueriesMetadataCompanion( @@ -18945,7 +18950,7 @@ class $$ChannelQueriesMetadataTableTableManager createCompanionCallback: ({ required String queryHash, - required Filter filter, + Value filter = const Value.absent(), required List sort, Value rowid = const Value.absent(), }) => ChannelQueriesMetadataCompanion.insert( diff --git a/packages/stream_chat_persistence/lib/src/entity/channel_queries_metadata.dart b/packages/stream_chat_persistence/lib/src/entity/channel_queries_metadata.dart index fb10cca2cc..8c5b5acd8c 100644 --- a/packages/stream_chat_persistence/lib/src/entity/channel_queries_metadata.dart +++ b/packages/stream_chat_persistence/lib/src/entity/channel_queries_metadata.dart @@ -14,7 +14,9 @@ class ChannelQueriesMetadata extends Table { TextColumn get queryHash => text()(); /// The server-resolved filter spec to surface on offline reads. - TextColumn get filter => text().map(const FilterConverter())(); + /// + /// Null when the query resolved to no filter at all. + TextColumn get filter => text().map(const FilterConverter()).nullable()(); /// The server-resolved sort spec to apply on offline reads. TextColumn get sort => text().map(const ChannelSortConverter())(); diff --git a/packages/stream_chat_persistence/lib/src/stream_chat_persistence_client.dart b/packages/stream_chat_persistence/lib/src/stream_chat_persistence_client.dart index 4bcffe0ad2..25499b45b7 100644 --- a/packages/stream_chat_persistence/lib/src/stream_chat_persistence_client.dart +++ b/packages/stream_chat_persistence/lib/src/stream_chat_persistence_client.dart @@ -283,7 +283,7 @@ class StreamChatPersistenceClient extends ChatPersistenceClient { @Deprecated('Use queryChannelStates instead') @override Future> getChannelStates({ - Filter? filter, + ChannelFilter? filter, List? channelStateSort, int? messageLimit, PaginationParams? paginationParams, @@ -301,7 +301,7 @@ class StreamChatPersistenceClient extends ChatPersistenceClient { /// [ChatPersistenceClient.queryChannelStates]. @override Future queryChannelStates({ - Filter? filter, + ChannelFilter? filter, List? sort, String? predefinedFilter, Map? filterValues, @@ -397,7 +397,7 @@ class StreamChatPersistenceClient extends ChatPersistenceClient { @Deprecated('Use saveChannelQueries instead') @override Future updateChannelQueries( - Filter? filter, + ChannelFilter? filter, List cids, { bool clearQueryCache = false, }) { @@ -413,10 +413,10 @@ class StreamChatPersistenceClient extends ChatPersistenceClient { @override Future saveChannelQueries({ required List cids, - Filter? filter, + ChannelFilter? filter, List? sort, String? predefinedFilter, - Filter? resolvedFilter, + ChannelFilter? resolvedFilter, List? resolvedSort, Map? filterValues, Map? sortValues, @@ -428,7 +428,7 @@ class StreamChatPersistenceClient extends ChatPersistenceClient { return db!.channelQueryDao.updateChannelQueriesByPredefinedFilter( predefinedFilter, cids, - filter: resolvedFilter ?? const Filter.empty(), + filter: resolvedFilter, sort: resolvedSort ?? const [], filterValues: filterValues, sortValues: sortValues, diff --git a/packages/stream_chat_persistence/test/src/converter/filter_converter_test.dart b/packages/stream_chat_persistence/test/src/converter/filter_converter_test.dart index bee55dccb0..dd54ff2fe9 100644 --- a/packages/stream_chat_persistence/test/src/converter/filter_converter_test.dart +++ b/packages/stream_chat_persistence/test/src/converter/filter_converter_test.dart @@ -6,7 +6,7 @@ void main() { const converter = FilterConverter(); test('empty filter round-trips as empty', () { - const original = Filter.empty(); + const original = ChannelFilter.raw({}); final decoded = converter.fromSql(converter.toSql(original)); @@ -14,12 +14,10 @@ void main() { }); test('raw map filter round-trips unchanged', () { - const original = Filter.raw( - value: { - 'type': 'messaging', - 'members': ['user-1', 'user-2'], - }, - ); + const original = ChannelFilter.raw({ + 'type': 'messaging', + 'members': ['user-1', 'user-2'], + }); final decoded = converter.fromSql(converter.toSql(original)); diff --git a/packages/stream_chat_persistence/test/src/dao/channel_query_dao_test.dart b/packages/stream_chat_persistence/test/src/dao/channel_query_dao_test.dart index abaaf6903a..edd4245b68 100644 --- a/packages/stream_chat_persistence/test/src/dao/channel_query_dao_test.dart +++ b/packages/stream_chat_persistence/test/src/dao/channel_query_dao_test.dart @@ -16,7 +16,7 @@ void main() { }); test('updateChannelQueries', () async { - final filter = Filter.in_('members', const ['testUserId']); + final filter = ChannelFilter.in_(ChannelFilterField.members, const ['testUserId']); const cids = ['testCid1', 'testCid2', 'testCid3']; @@ -31,7 +31,7 @@ void main() { }); test('clear queryCache before updateChannelQueries', () async { - final filter = Filter.in_('members', const ['testUserId']); + final filter = ChannelFilter.in_(ChannelFilterField.members, const ['testUserId']); const cids = ['testCid1', 'testCid2', 'testCid3']; @@ -50,7 +50,7 @@ void main() { }); test('getCachedChannelCids', () async { - final filter = Filter.in_('members', const ['testUserId']); + final filter = ChannelFilter.in_(ChannelFilterField.members, const ['testUserId']); const cids = ['testCid1', 'testCid2', 'testCid3']; @@ -65,7 +65,7 @@ void main() { }); Future> _insertTestDataForGetChannel( - Filter filter, { + ChannelFilter filter, { int count = 3, }) async { final now = DateTime.now(); @@ -101,7 +101,7 @@ void main() { group('getChannels', () { tearDown(() async => database.flush()); - final filter = Filter.in_('members', const ['testUserId']); + final filter = ChannelFilter.in_(ChannelFilterField.members, const ['testUserId']); test('should return empty list of channels', () async { final channels = await channelQueryDao.getChannels(filter: filter); @@ -163,7 +163,7 @@ void main() { const filterValues = {'user_id': 'testUserId'}; const sortValues = {'pinned_at': true}; const cids = ['testCid1', 'testCid2', 'testCid3']; - final filter = Filter.equal('type', 'messaging'); + final filter = ChannelFilter.equal(ChannelFilterField.type, 'messaging'); final sort = [ ChannelSort.desc(ChannelSortField.pinnedAt), ChannelSort.desc(ChannelSortField.lastMessageAt), @@ -202,7 +202,7 @@ void main() { const sortValues = {'pinned_at': true}; const oldCids = ['oldCid1', 'oldCid2']; const newCids = ['newCid1']; - final filter = Filter.equal('type', 'messaging'); + final filter = ChannelFilter.equal(ChannelFilterField.type, 'messaging'); final sort = [ ChannelSort.desc(ChannelSortField.pinnedAt), ChannelSort.desc(ChannelSortField.lastMessageAt), diff --git a/packages/stream_chat_persistence/test/stream_chat_persistence_client_test.dart b/packages/stream_chat_persistence/test/stream_chat_persistence_client_test.dart index e4db23bf51..87afaf9c9b 100644 --- a/packages/stream_chat_persistence/test/stream_chat_persistence_client_test.dart +++ b/packages/stream_chat_persistence/test/stream_chat_persistence_client_test.dart @@ -104,7 +104,7 @@ void main() { setUpAll(() { registerFallbackValue([]); - registerFallbackValue(const Filter.empty()); + registerFallbackValue(const ChannelFilter.raw({})); registerFallbackValue([]); }); @@ -288,7 +288,7 @@ void main() { const cids = ['messaging:c0', 'messaging:c1', 'messaging:c2']; const currentUserId = 'test-user-id'; - final filter = Filter.in_('members', const [currentUserId]); + final filter = ChannelFilter.in_(ChannelFilterField.members, const [currentUserId]); // pinnedAt values chosen so descending order is [c1, c2, c0]. With // offset 1 / limit 1 the only paged cid is c2. @@ -372,7 +372,7 @@ void main() { }); test('returns empty list and skips hydration when no channels match', () async { - final filter = Filter.in_('members', const ['unknown_user']); + final filter = ChannelFilter.in_(ChannelFilterField.members, const ['unknown_user']); when(() => mockDatabase.channelQueryDao.getChannels(filter: filter)).thenAnswer((_) async => []); @@ -408,7 +408,7 @@ void main() { }); test('updateChannelQueries', () async { - final filter = Filter.in_('members', const ['testUserId']); + final filter = ChannelFilter.in_(ChannelFilterField.members, const ['testUserId']); const cids = []; when(() => mockDatabase.channelQueryDao.updateChannelQueries(filter, cids)).thenAnswer((_) => Future.value()); @@ -427,7 +427,7 @@ void main() { const cids = ['messaging:c0', 'messaging:c1', 'messaging:c2']; const currentUserId = 'test-user-id'; - final filter = Filter.in_('members', const [currentUserId]); + final filter = ChannelFilter.in_(ChannelFilterField.members, const [currentUserId]); // pinnedAt values chosen so descending order is [c1, c2, c0]. With // offset 1 / limit 1 the only paged cid is c2. @@ -512,7 +512,7 @@ void main() { }); test('standard mode returns empty response when no channels match', () async { - final filter = Filter.in_('members', const ['unknown_user']); + final filter = ChannelFilter.in_(ChannelFilterField.members, const ['unknown_user']); when(() => mockDatabase.channelQueryDao.getChannels(filter: filter)).thenAnswer((_) async => []); @@ -584,7 +584,7 @@ void main() { ), }; - final persistedFilter = Filter.equal('type', 'messaging'); + final persistedFilter = ChannelFilter.equal(ChannelFilterField.type, 'messaging'); when( () => mockDatabase.channelQueryDao.getChannelsAndSpecByPredefinedFilter( @@ -749,7 +749,7 @@ void main() { group('saveChannelQueries', () { test('standard mode forwards to channelQueryDao.updateChannelQueries', () async { - final filter = Filter.in_('members', const ['testUserId']); + final filter = ChannelFilter.in_(ChannelFilterField.members, const ['testUserId']); const cids = []; when(() => mockDatabase.channelQueryDao.updateChannelQueries(filter, cids)).thenAnswer((_) => Future.value()); @@ -759,9 +759,9 @@ void main() { }); test('standard mode ignores resolvedFilter and resolvedSort', () async { - final filter = Filter.in_('members', const ['testUserId']); + final filter = ChannelFilter.in_(ChannelFilterField.members, const ['testUserId']); const cids = ['messaging:c0']; - final resolvedFilter = Filter.equal('type', 'messaging'); + final resolvedFilter = ChannelFilter.equal(ChannelFilterField.type, 'messaging'); final resolvedSort = [ ChannelSort.desc(ChannelSortField.lastMessageAt), ]; @@ -807,7 +807,7 @@ void main() { const filterValues = {'user_id': 'testUserId'}; const sortValues = {'pinned_at': true}; const cids = ['messaging:c0']; - final resolvedFilter = Filter.equal('type', 'messaging'); + final resolvedFilter = ChannelFilter.equal(ChannelFilterField.type, 'messaging'); final resolvedSort = [ ChannelSort.desc(ChannelSortField.lastMessageAt), ]; @@ -847,7 +847,7 @@ void main() { ).called(1); }); - test('predefined mode applies Filter.empty() and empty-sort fallback when resolved values are null', () async { + test('predefined mode passes a null filter and empty-sort fallback when resolved values are null', () async { const filterName = 'sample-app-list'; const cids = ['messaging:c0']; @@ -855,7 +855,7 @@ void main() { () => mockDatabase.channelQueryDao.updateChannelQueriesByPredefinedFilter( filterName, cids, - filter: const Filter.empty(), + filter: null, sort: [], filterValues: null, sortValues: null, @@ -869,7 +869,7 @@ void main() { () => mockDatabase.channelQueryDao.updateChannelQueriesByPredefinedFilter( filterName, cids, - filter: const Filter.empty(), + filter: null, sort: [], filterValues: null, sortValues: null, diff --git a/sample_app/lib/pages/channel_file_display_screen.dart b/sample_app/lib/pages/channel_file_display_screen.dart index c28a228576..a70a4bb8e5 100644 --- a/sample_app/lib/pages/channel_file_display_screen.dart +++ b/sample_app/lib/pages/channel_file_display_screen.dart @@ -18,8 +18,8 @@ class ChannelFileDisplayScreen extends StatefulWidget { class _ChannelFileDisplayScreenState extends State { late final StreamMessageSearchListController _controller = StreamMessageSearchListController( client: StreamChat.of(context).client, - filter: Filter.in_('cid', [StreamChannel.of(context).channel.cid!]), - messageFilter: Filter.in_('attachments.type', const ['file']), + filter: .in_(ChannelFilterField.cid, [StreamChannel.of(context).channel.cid]), + messageFilter: .in_(MessageSearchFilterField.attachmentsType, const ['file']), sort: [MessageSearchSort.desc(MessageSearchSortField.createdAt)], limit: 20, ); diff --git a/sample_app/lib/pages/channel_media_display_screen.dart b/sample_app/lib/pages/channel_media_display_screen.dart index c789967a4b..e5d005ef45 100644 --- a/sample_app/lib/pages/channel_media_display_screen.dart +++ b/sample_app/lib/pages/channel_media_display_screen.dart @@ -17,8 +17,8 @@ class ChannelMediaDisplayScreen extends StatefulWidget { class _ChannelMediaDisplayScreenState extends State { late final StreamMessageSearchListController _controller = StreamMessageSearchListController( client: StreamChat.of(context).client, - filter: Filter.in_('cid', [StreamChannel.of(context).channel.cid!]), - messageFilter: Filter.in_('attachments.type', const ['image', 'video']), + filter: .in_(ChannelFilterField.cid, [StreamChannel.of(context).channel.cid]), + messageFilter: .in_(MessageSearchFilterField.attachmentsType, const ['image', 'video']), sort: [MessageSearchSort.asc(MessageSearchSortField.createdAt)], limit: 20, ); diff --git a/sample_app/lib/pages/new_chat_screen.dart b/sample_app/lib/pages/new_chat_screen.dart index 1db85817dc..4281dd3901 100644 --- a/sample_app/lib/pages/new_chat_screen.dart +++ b/sample_app/lib/pages/new_chat_screen.dart @@ -28,17 +28,11 @@ class _NewChatScreenState extends State { ], ); - // Excludes the current user from the directory listing — searching must keep - // excluding them, so the search text is combined with this rather than - // replacing it. - Filter _filter({String query = ''}) { - return Filter.and([ - Filter.notEqual('id', StreamChat.of(context).currentUser!.id), - if (query.isNotEmpty) - Filter.or([ - Filter.autoComplete('name', query), - Filter.autoComplete('id', query), - ]), + UserFilter? _filter({String query = ''}) { + if (query.isEmpty) return null; + return UserFilter.or([ + UserFilter.autoComplete(UserFilterField.name, query), + UserFilter.autoComplete(UserFilterField.id, query), ]); } @@ -90,8 +84,8 @@ class _NewChatScreenState extends State { final res = await chatState.client.queryChannelsOnline( state: false, watch: false, - filter: Filter.raw( - value: { + filter: ChannelFilter.raw( + { 'members': [ ..._selectedUsers.map((e) => e.id), chatState.currentUser!.id, diff --git a/sample_app/lib/pages/new_group_chat_screen.dart b/sample_app/lib/pages/new_group_chat_screen.dart index c3bcfc5188..33bfa771e9 100644 --- a/sample_app/lib/pages/new_group_chat_screen.dart +++ b/sample_app/lib/pages/new_group_chat_screen.dart @@ -31,17 +31,11 @@ class _NewGroupChatScreenState extends State { filter: _filter(), ); - // Excludes the current user from the directory listing — searching must keep - // excluding them, so the search text is combined with this rather than - // replacing it. - Filter _filter({String query = ''}) { - return Filter.and([ - Filter.notEqual('id', StreamChat.of(context).currentUser!.id), - if (query.isNotEmpty) - Filter.or([ - Filter.autoComplete('name', query), - Filter.autoComplete('id', query), - ]), + UserFilter? _filter({String query = ''}) { + if (query.isEmpty) return null; + return UserFilter.or([ + UserFilter.autoComplete(UserFilterField.name, query), + UserFilter.autoComplete(UserFilterField.id, query), ]); } diff --git a/sample_app/lib/pages/pinned_messages_screen.dart b/sample_app/lib/pages/pinned_messages_screen.dart index 657955dd5a..94b70b77e9 100644 --- a/sample_app/lib/pages/pinned_messages_screen.dart +++ b/sample_app/lib/pages/pinned_messages_screen.dart @@ -22,8 +22,8 @@ class PinnedMessagesScreen extends StatefulWidget { class _PinnedMessagesScreenState extends State { late final StreamMessageSearchListController _controller = StreamMessageSearchListController( client: StreamChat.of(context).client, - filter: Filter.in_('cid', [StreamChannel.of(context).channel.cid!]), - messageFilter: Filter.equal('pinned', true), + filter: .in_(ChannelFilterField.cid, [StreamChannel.of(context).channel.cid]), + messageFilter: .equal(MessageSearchFilterField.pinned, true), sort: [MessageSearchSort.asc(MessageSearchSortField.createdAt)], limit: 20, ); diff --git a/sample_app/lib/pages/reminders_page.dart b/sample_app/lib/pages/reminders_page.dart index 4df2cc66a7..288991644e 100644 --- a/sample_app/lib/pages/reminders_page.dart +++ b/sample_app/lib/pages/reminders_page.dart @@ -202,15 +202,15 @@ enum MessageRemindersFilter { const MessageRemindersFilter(this.label); final String label; - Filter get queryFilter { - const key = 'remind_at'; + MessageReminderFilter? get queryFilter { + final key = MessageReminderFilterField.remindAt; final now = DateTime.timestamp().toIso8601String(); return switch (this) { - MessageRemindersFilter.all => const Filter.empty(), - MessageRemindersFilter.overdue => Filter.lessOrEqual(key, now), - MessageRemindersFilter.upcoming => Filter.greaterOrEqual(key, now), - MessageRemindersFilter.scheduled => Filter.exists(key), - MessageRemindersFilter.savedForLater => Filter.notExists(key), + MessageRemindersFilter.all => null, + MessageRemindersFilter.overdue => .lessOrEqual(key, now), + MessageRemindersFilter.upcoming => .greaterOrEqual(key, now), + MessageRemindersFilter.scheduled => .exists(key, exists: true), + MessageRemindersFilter.savedForLater => .exists(key, exists: false), }; } } diff --git a/sample_app/lib/widgets/add_members_sheet.dart b/sample_app/lib/widgets/add_members_sheet.dart index eb88b2f8f2..c3924682c7 100644 --- a/sample_app/lib/widgets/add_members_sheet.dart +++ b/sample_app/lib/widgets/add_members_sheet.dart @@ -59,7 +59,6 @@ class AddMembersSheet extends StatefulWidget { class _AddMembersSheetState extends State { late final Channel _channel = StreamChannel.of(context).channel; late final StreamChatClient _client = StreamChat.of(context).client; - late final String? _currentUserId = _client.state.currentUser?.id; late final StreamUserListController _userListController = StreamUserListController( client: _client, @@ -80,22 +79,11 @@ class _AddMembersSheetState extends State { bool get _canConfirm => _selectedIds.isNotEmpty && !_saving; - // Excludes the current user and existing channel members from the directory - // search — they can't be added again, so the search text is combined with - // the exclusion rather than replacing it. - Filter _filter({String query = ''}) { - final excludedIds = { - if (_currentUserId case final id?) id, - for (final member in _channel.state!.members) - if (member.userId case final id?) id, - }; - return Filter.and([ - Filter.notIn('id', excludedIds.toList()), - if (query.isNotEmpty) - Filter.or([ - Filter.autoComplete('name', query), - Filter.autoComplete('id', query), - ]), + UserFilter? _filter({String query = ''}) { + if (query.isEmpty) return null; + return UserFilter.or([ + UserFilter.autoComplete(UserFilterField.name, query), + UserFilter.autoComplete(UserFilterField.id, query), ]); } diff --git a/sample_app/lib/widgets/all_members_sheet.dart b/sample_app/lib/widgets/all_members_sheet.dart index 65694af838..c61767d482 100644 --- a/sample_app/lib/widgets/all_members_sheet.dart +++ b/sample_app/lib/widgets/all_members_sheet.dart @@ -411,12 +411,10 @@ Future _openDirectChannel(BuildContext context, User user) async { final existing = await chat.client.queryChannelsOnline( state: false, watch: false, - filter: Filter.raw( - value: { - 'members': [currentUser.id, user.id], - 'distinct': true, - }, - ), + filter: .raw({ + 'members': [currentUser.id, user.id], + 'distinct': true, + }), messageLimit: 0, paginationParams: const PaginationParams(limit: 1), ); diff --git a/sample_app/lib/widgets/channel_list.dart b/sample_app/lib/widgets/channel_list.dart index 1190080466..096fad8003 100644 --- a/sample_app/lib/widgets/channel_list.dart +++ b/sample_app/lib/widgets/channel_list.dart @@ -49,7 +49,7 @@ class _ChannelList extends State { _messageSearchListController = StreamMessageSearchListController( client: _streamChat.client, - filter: Filter.in_('members', [_streamChat.currentUser!.id]), + filter: .in_(ChannelFilterField.members, [_streamChat.currentUser!.id]), limit: 5, searchQuery: searchQuery, sort: [ @@ -65,7 +65,7 @@ class _ChannelList extends State { final predefinedFilter = authController.usingCustomBackend ? null : kChannelListPredefinedFilter; _channelListController = StreamChannelListController( client: _streamChat.client, - filter: predefinedFilter == null ? Filter.in_('members', [userId]) : null, + filter: predefinedFilter == null ? ChannelFilter.in_(ChannelFilterField.members, [userId]) : null, predefinedFilter: predefinedFilter, filterValues: predefinedFilter == null ? null : {'user_id': userId}, limit: 30, From 3a915ac35fd9b744794702df602e468f9cc7e8b5 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Tue, 15 Sep 2026 16:38:50 +0200 Subject: [PATCH 06/36] refactor(llc)!: adopt stream_core's LocationCoordinate, sort normalizer and list extensions (#2959) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor(llc)!: adopt stream_core's LocationCoordinate Chat's `LocationCoordinates` was two doubles and a `copyWith` nothing called. Core's `LocationCoordinate` carries the same pair and adds `distanceTo`, so the duplicate goes. Equality changes with it: core compares to a 1e-7 epsilon rather than demanding identical doubles, so a coordinate that has round-tripped through the API still matches the one it came from. This closes phase 08. Co-Authored-By: Claude Opus 5 (1M context) * docs(repo): bring the query DSL phase doc up to what shipped Its decisions were still open questions, its upstream section still said none was needed, and its definition of done still called for deprecating `$ne`, `$nin` and `$nor` — all three were removed instead, since the API is withdrawing them. The one box left open is the serialisation diff: the api tests assert request payloads and every documented example was executed, but no systematic before/after comparison was run. Co-Authored-By: Claude Opus 5 (1M context) * docs(repo): verify the uploads phase against the code Records Option A as decided, with the check that could have sunk it: `CdnClient` takes core's `AttachmentFile`, a different type of the same name from the one chat's models use, and the conversion is total only because core ships `fromData` for the bytes-only case chat's nullable path exists to serve. Corrects three things the code disagreed with. The provider is wired at `client.dart:94`, `UploadState`'s variants were renamed by phase 03, and phase 05 has not landed, so nothing deprecates the provider typedef yet. States the persistence argument accurately: `file` and `upload_state` ride inside a `text()` column as JSON, so retyping them changes a payload rather than a schema, and a `schemaVersion` bump already drops the rows. Keeping the models rests on the web case and on surviving an app restart, not on a migration. Co-Authored-By: Claude Opus 5 (1M context) * docs(repo): bring the cleanup phase doc up to the current tree Three of its dependency rows were already settled: `logging` is gone with 06, `equatable` stays because 28 files use it, and `diacritic` is actionable now — chat still keeps a copy of `normalizeStringForSort` that differs from core's only in its doc comment. The barrel listing showed a `logging` export that no longer exists and called `async` wholesale when 03 narrowed it, leaving two wholesale re-exports rather than three. The rename table now says which transforms can actually be written. A `dart fix` rule needs the old name gone and the new one in place, and four of the eleven renames have not happened yet — one of them in a phase that is parked. Records that the kit-before-08 question was answered by events: 08 landed without it. Co-Authored-By: Claude Opus 5 (1M context) * refactor(llc): use stream_core's normalizeStringForSort Chat kept its own copy after the function went upstream, differing from core's only in its doc comment. The three sort fields that fold a name now use core's, and `diacritic` is no longer a direct dependency of `stream_chat`. Nothing public moves: chat's copy was `@internal` and never exported, and core's tests carry the same 24 assertions. Co-Authored-By: Claude Opus 5 (1M context) * docs(repo): record why a name filter matches only approximately `user.name` and `channel.name` are stored normalized and the API normalizes the filter value before comparing, so it compares normalized against normalized. We control only the field side, so folding the getter would not reproduce that — it would move which inputs disagree, and break the natural call to fix the unusual one. Sorting is the opposite case, and that is why the two registries differ. Also corrects the neighbouring paragraph: `matches()` on a raw leaf throws now rather than returning true. Co-Authored-By: Claude Opus 5 (1M context) * docs(repo): correct the deferred and upstream indexes Three deferred rows had landed. The query DSL one was blocked on a premise that turned out false — core gaining `$nor` — when no core SDK models it and chat removed all three withdrawn operators instead. Upstream still described `matches` on a raw leaf as returning true; it throws. Element-wise array matching, the third change in core#181, was missing entirely, and chat has already deleted its copy of `normalizeStringForSort` rather than waiting for a release. Co-Authored-By: Claude Opus 5 (1M context) * refactor(llc)!: adopt stream_core's list extensions Deletes `core/util/list_extensions.dart`. Every helper it held now lives in `stream_core`: `sortedUpsertAt` and `mergeSorted` (as `sortedMerge`) were added there, `updateIf` became `updateWhere`, and `mergeFrom` is expressed as `merge` over a projected list. `SortedListExtensions` is re-exported from the barrel in its place, so `SortedListX`, `IterableMergeX` and `ListX` are gone. Behaviour is unchanged on the paths this package uses: 40k randomized merges across tie-heavy inputs produce output identical to the version removed, and the two `sortedMerge` call sites in `ChannelClientState` measure 0.97-1.01x against it, 0.92-0.95x where the incoming batch shares no id. The one visible difference is that a repeated key now collapses instead of being carried through. That tolerance was a workaround for duplicates the old merge manufactured itself, through a concat fast path that skipped dedup on inputs whose `createdAt` disagreed between memory and the Drift cache. Both causes are fixed — #2660 removed the fast path, 7f0804d2d made persistence store ISO-8601 text — so the workaround has nothing left to guard. Co-Authored-By: Claude Opus 5 (1M context) * docs(repo): record that persistence already tiebreaks on `(createdAt, id)` `message_dao.dart` orders `getMessagesByCid` — the query that feeds channel state — by the tuple, while the in-memory `_sortByCreatedAt` compares `createdAt` alone. So the two disagree on messages sharing a timestamp, and a channel can render in one order from disk and another after a merge. That makes adding the tiebreaker a matter of closing an internal gap rather than picking a convention, which is worth knowing before the cross-SDK check. Notes `getThreadMessages` separately: it orders by `createdAt` alone where both of its siblings use the tuple. Co-Authored-By: Claude Opus 5 (1M context) * Revert "docs(repo): record that persistence already tiebreaks on `(createdAt, id)`" This reverts commit cb1eb8fff. The note misread why `message_dao` orders by the tuple. It is there for keyset pagination — the cursor predicates compare the same `(createdAt, id)` key, so rows sharing a `createdAt` fall on the correct side of a page boundary — not because the SDK had settled on `id` as a display tiebreak. Recommending the comparator follow it was built on that mistake. `Message.id` is a v4 uuid, so ordering ties by it is deterministic and meaningless: it says nothing about when a message was sent or arrived, where a tie almost always means two messages sent at nearly the same moment and arrival order is what the reader expects. Co-Authored-By: Claude Opus 5 (1M context) * docs(repo): write up the message ordering investigation Records why messages sharing a `createdAt` change places, and — more useful — which of the obvious fixes are wrong, with the measurements behind each. A tiebreak on `id` is deterministic and meaningless: `Message.id` is a v4 uuid, and `message_dao`'s `(createdAt, id)` is keyset-pagination machinery rather than a chosen display order. Stamping `localCreatedAt` at construction does not give a total order either — 500 of 500 rounds building five messages produced duplicate timestamps, because `DateTime.now()` cannot resolve that fast. And `client.dart:646` only looks like the same defect; it sorts `/sync` events, whose replay sequence is meaningful. What is left is tie-stability in `sortedMerge`, measured at 1.08-1.39x, which is why `stream_core` ships without it. The `DEFERRED.md` row now says that rather than pointing at the comparator. Co-Authored-By: Claude Opus 5 (1M context) * docs(repo): map the list extension renames in the v11 guide `aaba3734b` removed `SortedListX`, `IterableMergeX` and `ListX`, all of them publicly exported, and shipped only a CHANGELOG entry. Anyone calling `mergeSorted`, `updateIf` or `mergeFrom` had nothing to look up. Co-Authored-By: Claude Opus 5 (1M context) * docs(repo): close the utilities phase `list_extensions` was the last open row. It moved to core once `sortedMerge` and `sortedUpsertAt` measured at parity with ours, so the phase doc no longer describes it as deferred pending a benchmark. Co-Authored-By: Claude Opus 5 (1M context) * fix(llc): sort pinned messages before merging into them `updateChannelState` assigned `pinnedMessages` straight from the payload while `messages` went through `sortedMerge`. Every later write reaches `_mergePinnedMessagesIntoExisting`, which merges by `createdAt` — and the API returns pinned messages by `pinned_at` descending, so the receiver was in the wrong order. Chat's own helpers reordered silently. `stream_core`'s assert that a receiver is sorted, so the next message event in a channel with two or more pins threw `AssertionError` in any debug build, including the SDK's test suite. The existing pinned tests never exercise more than one pin, so nothing caught it. The merge already produced `createdAt` order, so sorting on the way in makes the invariant hold from the first assignment rather than from the first merge. Co-Authored-By: Claude Opus 5 (1M context) * chore(core): reach `sortedWith` through `stream_chat` again The controllers named `stream_core` directly because this package's barrel still exported its own `SortedListX`, which declares three of the same members. That extension is gone as of this phase, so the barrel carries core's and the direct dependency is redundant. Co-Authored-By: Claude Opus 5 (1M context) * test(llc): point the split sort test at core's normalizeStringForSort The phase moved the normalizer and updated `sort_registry_test.dart` because git tracked that file through its rename. `sort_comparison_test.dart` is new in the same phase that split them, so it kept the chat-side import and stopped resolving here. Co-Authored-By: Claude Opus 5 (1M context) * fix(persistence): sort cached channels stably before paging them `List.sort` makes no promise about channels the comparator calls equal, so two reads of the same cache could order a tie differently and the offset below would skip or repeat a cid between pages. `sortedWith` is a merge sort. Reachable here only from this phase on, which is where the barrel starts exporting `SortedListExtensions`. Co-Authored-By: Claude Opus 5 (1M context) * docs(llc): keep stream_core out of these entries too Same reason as the rest of the section: an integrator reads the new names in their own code and never adds the package that declares them. Co-Authored-By: Claude Opus 5 (1M context) * docs(repo): file the pinned-message ordering this phase exposed Sorting the payload by `createdAt` on the way in is what makes the existing merge sound; it is not the order a pinned list should show. Ordering by `pinnedAt` is the real fix and needs a null-ordering decision, so it is recorded rather than folded into this phase. Co-Authored-By: Claude Opus 5 (1M context) * revert(llc): stop sorting pinned messages on the way in Unrelated to adopting core's list extensions, so it belongs in its own change rather than riding along here. The test that pinned it goes with it. What this leaves behind is recorded in DEFERRED.md: core's `sortedUpsertAt` asserts its receiver is sorted, so a pinned payload in `pinned_at` order now trips that assert in debug. Release builds strip it and misplace the message, which is what v10 already did. Both halves get fixed together by comparing on `pinnedAt` instead. Co-Authored-By: Claude Opus 5 (1M context) * docs(repo): record core's coordinate equality as an upstream ask `LocationCoordinate.==` compares with a `1e-7` epsilon while `hashCode` hashes the raw doubles, so the type cannot be a `Set` element or `Map` key, and the epsilon is non-transitive, so no hash can ever agree with it. It also makes `distanceTo` report exactly 0m for anything under ~1.1cm, since that method short-circuits on `==`. Nothing here depends on the tolerance, and neither does feeds, so the fix is free today — but feeds' `ActivityData` and `FeedData` already carry the field through freezed, which generates both members over it. Also: the closing advice said to read core from the hosted pub-cache, which is not what resolves while `melos.yaml` pins a git ref — the same staleness the platform phase carried. Co-Authored-By: Claude Opus 5 (1M context) * fix(llc)!: pin the core commit that makes coordinate equality exact `LocationCoordinate.==` compared within a `1e-7` epsilon while `hashCode` hashed the raw doubles, so the type could not be a `Set` element or `Map` key, and the epsilon was non-transitive, so no hash could have agreed with it. It also made `distanceTo` report exactly 0m for anything under ~1.1cm, since that method short-circuits on `==`. Fixed in core#181 with `Equatable`, which is what sixteen other classes there use, so the two members cannot drift apart again. Proximity is `distanceTo`: `a.distanceTo(b) <= 1.meters`. Drops the changelog line advertising the tolerance, which is no longer true. Co-Authored-By: Claude Opus 5 (1M context) * docs(repo): add the coordinate fix to what a core release has to carry Pinning the commit that makes `LocationCoordinate` equality exact adds a fifth thing the branch needs from core before the hosted constraints can come back. Co-Authored-By: Claude Opus 5 (1M context) --------- Co-authored-by: Claude Opus 5 (1M context) --- core-migration/01-utilities.md | 97 +++-- core-migration/08-query-dsl.md | 125 +++--- core-migration/09-uploads.md | 46 ++- core-migration/10-cleanup.md | 73 ++-- core-migration/DEFERRED.md | 12 +- core-migration/README.md | 4 +- core-migration/UPSTREAM.md | 14 +- core-migration/message-ordering.md | 102 +++++ migrations/v11-migration.md | 8 + packages/stream_chat/CHANGELOG.md | 2 + .../lib/src/client/channel/channel.dart | 4 +- .../client/channel/channel_client_state.dart | 8 +- .../stream_chat/lib/src/client/client.dart | 6 +- .../lib/src/core/api/user_api.dart | 5 +- .../lib/src/core/models/channel_state.dart | 3 +- .../lib/src/core/models/location.dart | 9 +- .../src/core/models/location_coordinates.dart | 33 -- .../lib/src/core/models/member.dart | 4 +- .../stream_chat/lib/src/core/models/poll.dart | 4 +- .../stream_chat/lib/src/core/models/user.dart | 4 +- .../lib/src/core/util/list_extensions.dart | 270 ------------ .../lib/src/core/util/message_merging.dart | 24 +- .../src/core/util/string_sort_normalizer.dart | 95 ----- packages/stream_chat/lib/stream_chat.dart | 5 +- .../channel/channel_client_state_test.dart | 4 +- .../test/src/client/channel/channel_test.dart | 4 +- .../test/src/client/client_test.dart | 2 +- .../test/src/core/api/user_api_test.dart | 2 +- .../test/src/core/models/location_test.dart | 4 +- .../src/core/models/sort_comparison_test.dart | 3 +- .../src/core/models/sort_registry_test.dart | 3 +- .../src/core/util/list_extensions_test.dart | 390 ------------------ .../util/string_sort_normalizer_test.dart | 142 ------- .../src/stream_channel_list_controller.dart | 2 - .../lib/src/stream_draft_list_controller.dart | 1 - .../src/stream_member_list_controller.dart | 1 - ...ream_message_reminder_list_controller.dart | 1 - .../src/stream_poll_vote_list_controller.dart | 1 - .../src/stream_reaction_list_controller.dart | 1 - .../src/stream_thread_list_controller.dart | 1 - .../lib/src/stream_user_list_controller.dart | 1 - .../src/stream_chat_persistence_client.dart | 4 +- .../lib/utils/shared_location_service.dart | 2 +- .../location/location_picker_dialog.dart | 6 +- sample_app/lib/widgets/simple_map_view.dart | 4 +- 45 files changed, 398 insertions(+), 1138 deletions(-) create mode 100644 core-migration/message-ordering.md delete mode 100644 packages/stream_chat/lib/src/core/models/location_coordinates.dart delete mode 100644 packages/stream_chat/lib/src/core/util/list_extensions.dart delete mode 100644 packages/stream_chat/lib/src/core/util/string_sort_normalizer.dart delete mode 100644 packages/stream_chat/test/src/core/util/list_extensions_test.dart delete mode 100644 packages/stream_chat/test/src/core/util/string_sort_normalizer_test.dart diff --git a/core-migration/01-utilities.md b/core-migration/01-utilities.md index 641e8fd7d7..91cf18c5eb 100644 --- a/core-migration/01-utilities.md +++ b/core-migration/01-utilities.md @@ -2,14 +2,14 @@ **Goal:** prove the pattern on files that touch no behaviour and almost no public surface. -**Size:** 47 chat LOC deleted so far. No upstream core work. +**Size:** 317 chat LOC deleted. Two methods added to `stream_core` — `sortedMerge` and `sortedUpsertAt`. ## Scope | Delete | Adopt | Status | | --- | --- | --- | | `lib/src/core/util/in_flight_cache.dart` (47) | `stream_core` `utils/in_flight_cache.dart` (32) | **done** | -| `lib/src/core/util/list_extensions.dart` (270) | `stream_core` `utils/list_extensions.dart` (656) | **deferred** — needs a performance comparison first | +| `lib/src/core/util/list_extensions.dart` (270) | `stream_core` `utils/list_extensions.dart` | **done** — every helper moved to core, measured at parity first | | `lib/src/core/http/stream_chat_dio_error.dart` (19) | `stream_core` `StreamDioException` | **moved to [03](03-errors.md)** — blocked on the error layer | ### `in_flight_cache` — done @@ -48,18 +48,36 @@ Both its producers are phase-03/04 code anyway: `auth_interceptor.dart:30` const in [04](04-token-and-auth.md)) and `stream_http_client.dart:102` unwraps it (deleted in [05](05-http-client.md)). It goes when the payload type does. -### `list_extensions` — deferred pending a performance comparison +### `list_extensions` — moved to core, after a performance comparison -**Deferred deliberately, not forgotten.** Core's `merge` is a keyed-map-merge-then-sort +**Why this was held back rather than swapped.** Core's `merge` is a keyed-map-merge-then-sort (O(n log n)); ours is a two-pointer merge (O(n)) and the file's own header calls it "a runtime optimization". `channel_client_state.dart` (2,154 LOC) calls these helpers on **every** message, member and read update, so this is the hottest path in the SDK and "same result for sorted inputs" is not "same cost". -Before adopting, benchmark both implementations on realistic shapes — a 1k+ sorted message list -with incremental upserts, a large member list, and the read-state map — and either confirm the -difference is immaterial at these sizes or take the two-pointer algorithm upstream so core is -fast for everyone. Do not swap on the strength of the TODO alone. +**Benchmarked.** Mean per call, over `List` of `{String id, DateTime at}` sorted by date, +merged with `key: (it) => it.id` and a date comparator, warmed up then averaged over 500–20,000 +reps depending on size: + +| shape | chat | core | | +| --- | --- | --- | --- | +| 1k existing + 1 new | 46us | 64us | chat 1.4x | +| 5k existing + 1 new | 282us | 378us | chat 1.3x | +| 1k existing + 25 page | 47us | 77us | chat 1.6x | +| 1k existing + 25 updates | 43us | 62us | chat 1.4x | +| 1k existing + 1k refresh | 107us | 105us | tie | +| 50 existing + 1 new | 2us | 2us | tie | + +Chat's wins wherever the receiver is long and the increment is small, which is the shape the hot +path actually has, and ties on a full refresh where core's re-sort is not wasted. **So chat keeps +its merge; do not adopt core's.** + +Upstreaming ours is *not* a drop-in, though, and that is the second finding. The two disagree on +duplicate keys **within** the incoming list: chat's emits both, core's map resolves them to one. +Chat's behaviour is deliberate and pinned by a test (`'tolerates duplicate keys in other'`), so +porting the algorithm up would change core's contract for feeds as well. Either the ask includes +that semantic change, or the algorithm gains a dedup pass first — which costs some of the win. The file's own header already specifies the migration: @@ -82,23 +100,24 @@ Core's split is different, not just renamed: `upsert` / `batchReplace` / `partit / `removeNested` / `updateNested` sit on `SortedListExtensions`. Map each call site to the right one; a blanket rename will not compile. -Ours has `sortedUpsertAt`, `mergeSorted`, `mergeFrom` and `updateIf`; core has `sumOf`, -`removeNested`, `updateNested` and `partition`. Confirm every method we call has a home before -deleting, and take the missing ones upstream rather than keeping a two-method file behind. +All of ours landed in core: `sortedUpsertAt` and `mergeSorted` (as `sortedMerge`) were added +there, `updateIf` became `updateWhere`, and `mergeFrom` is expressed as `merge` over a projected +list. `core/util/list_extensions.dart` is deleted; `SortedListExtensions` is re-exported from the +barrel in its place. ## Decisions to make -Both remaining decisions belong to `list_extensions`, and both wait on the benchmark: +Both belonged to `list_extensions`, and both are answered: -- **Adopt core's `merge`, or upstream ours?** If the two-pointer merge measurably wins at chat's - list sizes, core should have it — that makes every product faster and removes the reason to keep - a fork. If the difference is noise, adopt core's and delete ours. -- **Deprecated forwarders, or a clean break?** `list_extensions.dart` is exported at - `stream_chat.dart:85` and the extension names differ, so the renames are visible. A Dart - `extension` cannot be aliased by a `typedef`, so a soft landing means keeping our extension - names as thin forwarders for one release. Decide whether that is worth it for list helpers most - consumers never call directly — if not, this becomes a `refactor(llc)!:` with a migration entry - and the phase is no longer non-breaking. +- ~~**Adopt core's `merge`, or upstream ours?**~~ **Neither, in the end.** Ours wins 1.76-1.86x + on the shape the hot path has, so adopting `merge` was not an option — but rather than keeping + it chat-side it went up as `sortedMerge`, a second method beside `merge` with the narrower + contract. See [UPSTREAM.md](UPSTREAM.md). +- ~~**Deprecated forwarders, or a clean break?**~~ **A clean break.** A Dart `extension` cannot be + aliased by a `typedef`, so forwarders would mean keeping all three extension names alive for a + release. Not worth it for list helpers almost nobody calls directly, so this shipped as a + `refactor(llc)!:` with a CHANGELOG entry and Symbol Map rows, and the phase is breaking rather + than silent. ## Risks @@ -111,8 +130,26 @@ Both remaining decisions belong to `list_extensions`, and both wait on the bench ## Upstream `stream_core` work -None so far. Possible outcomes of the benchmark: the two-pointer `merge`, and any of -`sortedUpsertAt` / `mergeSorted` / `mergeFrom` / `updateIf` that core has no home for. +Done: core gained `sortedUpsertAt` and `sortedMerge`, `merge` took a nullable `other`, and +`updateWhere` became copy-on-write. Each was benchmarked against the chat method it replaced +before the chat copy was deleted. + +## Outcome + +Chat's file is deleted rather than kept. The plan allowed for keeping the two-pointer `merge` +chat-side if it beat core's, and it did — so it moved to core as `sortedMerge` instead, alongside +`sortedUpsertAt`. `updateIf` became core's `updateWhere`, and `mergeFrom` is expressed as `merge` +over a projected list, so nothing needed a home chat-side. + +Each helper was measured against the one it replaced before that one was deleted: 0.97-1.01x on +merges whose keys overlap, 0.92-0.95x where they do not, and identical output over 40k randomized +merges. `sortedMerge` keeps the O(n + m) walk that made chat's version worth keeping; `merge` +would have cost 1.76-1.86x on the same shapes. + +Two things came out of the benchmarking rather than the migration, and are written up in +[message-ordering.md](message-ordering.md): what actually caused the duplicate-key crash in +[#2660](https://github.com/GetStream/stream-chat-flutter/pull/2660), and why a tiebreak on +`Message.id` is the wrong fix for tied timestamps. ## Definition of done @@ -121,11 +158,11 @@ None so far. Possible outcomes of the benchmark: the two-pointer `merge`, and an - [x] `dart analyze --fatal-infos` clean on `stream_chat`; `dart format` clean. - [x] `stream_chat` tests green (1687 passing); `stream_chat_persistence` tests green (302 passing) and analyze clean. -- [ ] `merge` benchmarked on realistic shapes, with numbers recorded here. -- [ ] `list_extensions.dart` resolved — adopted, or ours upstreamed — and the export at - `stream_chat.dart:85` updated accordingly. -- [ ] `stream_chat_dio_error.dart` handled in [03](03-errors.md) (tracked there, not here). -- [ ] `melos run analyze && melos run test:all` before the phase closes. -- [ ] If the extension renames ship as a break: `refactor(llc)!:` title, `🛑️ Breaking` CHANGELOG +- [x] `merge` benchmarked on realistic shapes, with numbers recorded here. +- [x] `list_extensions.dart` resolved — every helper moved to core, the file deleted, and + `SortedListExtensions` re-exported from the barrel in its place. +- [x] `stream_chat_dio_error.dart` handled in [03](03-errors.md) (tracked there, not here). +- [x] `melos run analyze && melos run test:all` before the phase closes. +- [x] The extension renames shipped as a break: `refactor(llc)!:` title, `🛑️ Breaking` CHANGELOG entry, `migrations/v11-migration.md` Symbol Map rows. -- [ ] Decisions recorded here, status box updated in `README.md`. +- [x] Decisions recorded here, status box updated in `README.md`. diff --git a/core-migration/08-query-dsl.md b/core-migration/08-query-dsl.md index e56a40014a..93ccbd7fb2 100644 --- a/core-migration/08-query-dsl.md +++ b/core-migration/08-query-dsl.md @@ -4,8 +4,8 @@ evaluated client-side as well as sent to the server. **Size:** ~600 chat LOC deleted against ~1,420 core LOC. The widest public break after phase -[03](03-errors.md). **No upstream `stream_core` work** — and three operators chat should deprecate -rather than port. +[03](03-errors.md). Three changes went upstream to `stream_core` alongside it, and three +operators were removed rather than ported. ## Scope @@ -400,12 +400,25 @@ The earlier pass called client-side filtering "the payoff". No Stream chat SDK d So adopting core's `Filter` does not oblige us to call `matches()`, and nothing will at first. -One consequence to carry: `matches()` on a `Filter.raw` leaf returns `true`. That is correct under -`and` and wrong under `or` and `nor`, and it cannot be fixed — Swift's drop semantics needs the -third state its nullable predicate provides, which `bool matches(T)` does not have. Harmless while -nothing calls `matches()`. If list-membership correctness is ever taken on as a feature — a real -gap in both SDKs, where a channel joins a list it does not match — this is the first thing to -revisit. +Two consequences to carry. + +**`matches()` throws on a `Filter.raw` leaf.** Returning `true` is correct under `and` and wrong +under `or`, and returning `false` inverts that; Swift's drop semantics needs the third state its +nullable predicate provides, which `bool matches(T)` does not have. Refusing is the only outcome +that cannot silently produce a wrong result, so core throws. + +**A name filter matches approximately.** `user.name` and `channel.name` are stored normalized — +the column is `name_nf` — and `NormalizedNameHandlers` (`mq/name.go:23`) normalizes the filter +value before comparing, so the server compares normalized against normalized. Locally we control +only the field side: the caller's value reaches core's operator verbatim. Normalizing the getter +would not reproduce the server, it would only move which inputs disagree, and it would break +`equal(name, 'José')` — the natural call — to fix `equal(name, 'jose')`. So the getters stay raw. +This is the opposite of the sort registry, where both compared values come from the getter, which +is why normalizing is right there and wrong here. Fixing it properly means normalizing the query +value too, which is a per-field transform in core's operators. + +If list-membership correctness is ever taken on as a feature — a real gap in both SDKs, where a +channel joins a list it does not match — these are the first things to revisit. ## The registries are verified against the backend @@ -781,17 +794,19 @@ but has to be remembered field by field; see [`UPSTREAM.md`](UPSTREAM.md). In co default for every SDK and core's own `ComparableField` stops being wrong for names. Nothing in this phase waits on it. -## Decisions to make +## Decisions taken -- Which escape hatches survive, and in what form. -- Whether `ComparableFieldProvider` survives. 48 models implement it; core has no such interface. - Under a typed `SortField` registry it may be unnecessary — but removing it touches every model. -- Whether `Filter` keeps a chat-side `typedef` per queryable type (`typedef ChannelFilter = - Filter`) as feeds does. It reads much better in public signatures. -- Whether `predefined_filter.dart` is rebuilt on the registry or dropped. -- Whether client-side `matches()` gets *used* anywhere in this phase, or is just enabled. Enabling - it is the cheap half; using it (e.g. deciding whether a new channel belongs in a filtered list, - the way feeds' handlers do) is a behaviour improvement that deserves its own change. +- **Escape hatches.** `Filter.custom` and `Filter.empty` are gone. An unmodelled *field* is + reached with a registry's `custom` factory, an unmodelled *query* with core's `Filter.raw`. + Nullability replaces `empty`, which matters on `queryThreads`. +- **`ComparableFieldProvider` is removed**, along with `getComparableField` on all eleven models. + A field reads its own value, so an override had nowhere to go. +- **A `typedef` per queryable type**, as feeds does — `ChannelFilter`, `MemberFilter` and so on. + Each names its registry and carries a worked example. +- **`predefined_filter.dart` is rebuilt on the registry.** Its filter is a `ChannelFilter` and the + sort-fallback walk reads `toJson()`, since a preset is always a raw filter. +- **`matches()` is enabled, not used.** Nothing in the SDK calls it yet; wiring it into list + handling is a behaviour change that deserves its own PR. ## Risks @@ -811,48 +826,53 @@ this phase waits on it. ## Upstream `stream_core` work -**None. This phase is unblocked.** Both asks an earlier draft listed dissolved on inspection: -`$nor` is omitted by all three core SDKs deliberately, and the two `ComparableField` divergences -resolve chat-side (see above). `normalizeStringForSort` remains a standalone -[`UPSTREAM.md`](UPSTREAM.md) candidate, not a prerequisite. +Three changes landed in core alongside this phase, in +[#181](https://github.com/GetStream/stream-core-flutter/pull/181): + +- `normalizeStringForSort`, ported from chat so a locally sorted list of names matches the order + a query returns. +- `Filter.raw`, the fallback leaf that lets a decoder stay total. `matches` throws for it. +- `Filter.equal` and `Filter.in_` now match an array-valued field element-wise. Comparing the + whole list could never match, so `members`, `member.user.name` and `attachments.type` were + undeclarable before it. -One thing to raise with the core owners, separately from this phase: feeds' query docs advertise -operators core does not have — `activities_query.dart:87` and `feeds_query.dart:137,146,155` all -list `.notEqual` under "**Supported operators:**", and there is no `notEqual` in -`FilterOperator`. Doc-only, but it is where someone would go looking for the operator set. +`$ne` and `$nin` were **not** added, and should not be: they are deprecated server-side and being +withdrawn. `$nor` is modelled by none of the three cores. ## Definition of done -- [x] `Filter.notEqual`, `Filter.notIn` and `Filter.nor` are **removed, not deprecated** — - reversed from the original plan. The backend withdrew `$ne` and `$nin` from the published - spec and leaves `$nor` accepted-but-unpublished, so deprecating would have kept three - operators alive that the API is retiring. A preset that still carries one decodes through - `Filter.raw`. A caller that relied on them excludes client-side or shows the rows. -- [x] `filter.dart`, `sort_order.dart` and our `comparable_field.dart` are deleted; - `stream_chat.dart` exports core's via the allowlist. The allowlist covers `Filter`, - `FilterField` and `FilterOperator`, plus `EvaluationOperator` and `LogicalOperator` for - `searchQueryLength` — the remaining operator subclasses stay out, because a filter is read - with `toJson()` and `stream_feeds` does the same in all 36 places it reads one. -- [ ] `location_coordinates.dart` is deleted — still exported, the last of this row outstanding. +- [x] `Filter.notEqual`, `Filter.notIn` and `Filter.nor` are **removed**, not deprecated: + `$ne`, `$nin` and `$nor` are deprecated server-side and being withdrawn. The three + sample-app call sites that hid the signed-in user or existing members now list everyone the + query returns, as the iOS and React Native sample apps do. +- [x] `filter.dart`, `sort_order.dart`, our `comparable_field.dart` and + `location_coordinates.dart` are deleted; `stream_chat.dart` exports core's via the + allowlist. The allowlist covers `Filter`, `FilterField` and `FilterOperator`, plus + `EvaluationOperator` and `LogicalOperator` for `searchQueryLength` — the remaining + operator subclasses stay out, because a filter is read with `toJson()` and + `stream_feeds` does the same in all 36 places it reads one. - [x] A `FilterField` / `SortField` registry exists for every queryable type, with local - extractors. Wire names are pinned by `sort_registry_test.dart` and + extractors. Eleven of each. `QueryMessageFlagsPayload` is the one endpoint left unmodelled, + because chat has no API for it. Wire names are pinned by `sort_registry_test.dart` and `filter_registry_test.dart`; the fields deliberately left undeclared are named in each registry's `custom` doc comment. -- [ ] **Serialisation diff:** every filter and sort the SDK can build round-trips through - `toJson()` to byte-identical output against the pre-migration implementation. -- [ ] **A golden ordering test** over a list of accented and ligatured names proves - `normalizeStringForSort` behaviour survives. -- [ ] Per-field `NullOrdering` defaults preserved — asserted for `pinnedAt` and `lastMessageAt` in - both directions. -- [ ] Nothing throws where the old `ComparableField` returned `0` — asserted (core's - `runSafelySync` should already cover it; the test is what proves it). +- [x] **A golden ordering test** over accented and ligatured names proves `normalizeStringForSort` + behaviour survives — `string_sort_normalizer_test.dart` and `sort_test.dart`. +- [x] Per-field `NullOrdering` defaults preserved — `pinnedAt` and `lastMessageAt` asserted in + both directions (`sort_test.dart:103`). +- [x] Nothing throws where the old `ComparableField` returned `0` (`sort_test.dart:419`, + "should treat unorderable values as equal rather than throwing"). - [x] `SortOption.fromJson` callers accounted for — there are two, and both now go through `ChannelSort.fromJson`: `PredefinedFilter.sort`, where the API echoes the sort it resolved for a preset (found by `json_serializable` by convention, so no `@JsonKey` hook), and `stream_chat_persistence`'s Drift converter for the same spec persisted for offline reads. A bare `Sort.fromJson` would not have served either — see [UPSTREAM.md](UPSTREAM.md). -- [ ] `melos bootstrap && melos run analyze && melos run test:dart && melos run test:flutter`, - plus `stream_chat_persistence` tests if any stored query shape changed. +- [x] `melos run analyze`, `melos run format` and `melos run test:dart` are green, as are + `stream_chat_flutter_core`'s tests. `stream_chat_flutter` and `docs_screenshots` each carry + 11 pre-existing golden failures, in files this phase does not touch. +- [ ] **Serialisation diff.** Not run as a systematic before/after byte diff. The api tests assert + request payloads and pass unchanged, and every documented example was executed and its JSON + checked, but a filter the SDK can build and no test exercises is unverified. ### Re-verified against the right backend field @@ -1060,7 +1080,8 @@ deleted serializer rather than assumed — `git show HEAD:…/core/api/sort_orde (`stream_chat_persistence/lib/src/converter/channel_sort_converter.dart`, renamed from `ChannelStateSortOrderConverter`) writes those same two keys, which its test now pins as a literal — rows outlive the SDK version that wrote them, so the shape may not drift by accident. -- [ ] `refactor(llc)!:` title, `🛑️ Breaking` CHANGELOG entries, `migrations/v11-migration.md` - Symbol Map rows and a feature section with before/after query examples — this is the section - consumers will actually read. -- [ ] Decisions recorded here, status box ticked in `README.md`. +- [x] `refactor(llc)!:` titles, `🛑️ Breaking` CHANGELOG entries in `stream_chat`, + `stream_chat_persistence` and `stream_chat_flutter_core`, and `migrations/v11-migration.md` + Symbol Map rows. No feature section: none of the phases has written one, and the Symbol Map + rows carry the before/after. +- [x] Decisions recorded here, status box ticked in `README.md`. diff --git a/core-migration/09-uploads.md b/core-migration/09-uploads.md index 4646ac298b..2cf4a3b086 100644 --- a/core-migration/09-uploads.md +++ b/core-migration/09-uploads.md @@ -16,8 +16,8 @@ Drift persists. | --- | --- | | `abstract AttachmentFileUploader` — **8 methods**: `sendImage` / `sendFile` / `deleteImage` / `deleteFile` (channel-scoped, each taking `Map? extraData`) and `uploadImage` / `uploadFile` / `removeImage` / `removeFile` (CDN-scoped) | `abstract interface CdnClient` — **4 methods**, CDN-scoped only, no `extraData` | | `StreamAttachmentFileUploader` — thin `client.postFile` / `client.delete` wrappers | `StreamAttachmentUploader(cdn: CdnClient)` — returns running `AttachmentUploadTask`s | -| `AttachmentFileUploaderProvider = AttachmentFileUploader Function(StreamHttpClient)` — public pluggability, wired at `client.dart:102` | — | -| `@freezed sealed UploadState` — `Preparing` / `InProgress(uploaded, total)` / `Success` / `Failed(error: String)`, JSON-serialisable, **stored on the `Attachment` model** | `sealed AttachmentUploadState` — `UploadQueued` / `UploadPreparing` / `UploadInProgress(UploadProgress)` / `UploadSuccess` / `UploadFailed(StreamException)` / `UploadCancelled`, **stored on the task** | +| `AttachmentFileUploaderProvider = AttachmentFileUploader Function(StreamHttpClient)` — public pluggability, wired at `client.dart:94` | — | +| `@freezed sealed UploadState` — `UploadStatePreparing` / `UploadStateInProgress(uploaded, total)` / `UploadStateSuccess` / `UploadStateFailed(error: String)`, JSON-serialisable, **stored on the `Attachment` model** | `sealed AttachmentUploadState` — `UploadQueued` / `UploadPreparing` / `UploadInProgress(UploadProgress)` / `UploadSuccess` / `UploadFailed(StreamException)` / `UploadCancelled`, **stored on the task** | | `AttachmentFile` — `@JsonSerializable`, nullable `path`, sync `size`, persisted to Drift | `AttachmentFile` — wraps `XFile`, non-nullable `path`, `Future size`, not serialisable | ## The gating decision: channel-scoped uploads @@ -35,9 +35,16 @@ pluggability point survives in recognisable form. need scoped uploads; today they don't, so it is chat-shaped API in a product-agnostic package — exactly the leak the README's non-goals warn about. -**Recommend A.** It is cheaper, it does not block on a core release, and `CdnClient` is explicitly -a pluggable seam — using it for the part that fits and not for the part that doesn't is the -intended use. Record the decision here before starting. +**A is decided.** It is cheaper, it does not block on a core release, and `CdnClient` is +explicitly a pluggable seam — using it for the part that fits and not for the part that doesn't +is the intended use. + +The one thing that could have sunk it is checked: `CdnClient.uploadImage` takes **core's** +`AttachmentFile`, a different type of the same name from the one every chat model and the Drift +payload use, so implementing it means both in scope and a conversion at the seam. That +conversion is total — core ships `AttachmentFile.fromData(Uint8List bytes, {name})` for exactly +the web case chat's nullable `path` exists to serve. Adapter: `path` when there is one, +`fromData` otherwise. ## What core buys us either way @@ -65,13 +72,19 @@ for a retry. *removed* `StreamAttachment.uploadState` and moved state to the task — a good design for feeds, and wrong for chat, because: -- `AttachmentFile` is `@JsonSerializable` and persisted by `stream_chat_persistence` (Drift). - `path` nullable → non-nullable and `size` sync → `Future` are both breaking, and the schema - depends on the serialisable form. -- `UploadState` on `Attachment` is how the UI renders a half-uploaded attachment across an app - restart. Task state is in-memory and does not survive one. -- A model retype here is simultaneously a `stream_chat` break, a `ChatPersistenceClient` interface - break, and a Drift schema migration. Three for the price of one, for no user-visible gain. +- **`path` nullable → non-nullable is not expressible.** Chat's `AttachmentFile` carries + `String? path`, `Uint8List? bytes` and a sync `int? size`; a file picked on web has bytes and no + path. Core's wraps a single `XFile` with a non-nullable `path` and an async `Future size`. +- **`UploadState` on `Attachment` survives an app restart; task state does not.** It is how the UI + renders a half-uploaded attachment after a cold start. This is the argument that decides it. +- It is also a `stream_chat` break and a `ChatPersistenceClient` one. + +The persistence half is weaker than it looks, and worth stating accurately so nobody plans a +migration that isn't needed. `Attachment.toData()` serialises both `file` and `upload_state`, and +the whole attachment goes into Drift's `attachments` **`text()`** column as JSON — there is no +schema shaped around either type, so retyping them changes a payload, not a table. And any +release that bumps `schemaVersion` drops every table on upgrade, so stale payloads are never read +back by new code. So expose the task-based API **additively**: `StreamAttachmentUploader` drives the upload and its task state is *mirrored onto* `Attachment.uploadState` for persistence and rendering. That keeps @@ -91,11 +104,14 @@ but is not a prerequisite. ## Decisions to make -- **Option A or B**, above. Nothing else in the phase can be scoped until this is settled. +Option A is settled, above. What is left: + - Whether `AttachmentFileUploaderProvider` is retyped (`AttachmentFileUploader Function(Dio)` once phase [05](05-http-client.md) removes `StreamHttpClient`) or replaced by a `CdnClient` injection - point à la `FeedsConfig.cdnClient`. Either way it is a break for anyone with a custom uploader, - and phase 05 already deprecates the type in its signature. + point à la `FeedsConfig.cdnClient`. Either way it is a break for anyone with a custom uploader. + Note phase 05 has **not** landed: the typedef still reads + `AttachmentFileUploader Function(StreamHttpClient)` and carries no deprecation, so this phase + either waits for 05 or breaks it itself. - Whether `UploadState` gains a `cancelled` variant to mirror `UploadCancelled`. Today a cancelled upload has nowhere to land, which is why cancellation is invisible in the UI. - Whether progress and cancellation become public API in this phase or stay internal until the UI diff --git a/core-migration/10-cleanup.md b/core-migration/10-cleanup.md index 8d8515511c..364152c635 100644 --- a/core-migration/10-cleanup.md +++ b/core-migration/10-cleanup.md @@ -19,9 +19,9 @@ block and running `melos bootstrap`**, never the package manifest directly. | `dio: ^5.11.0` | 05 | Core re-exports all of dio and declares `^5.8.0+1`. Watch the skew when either moves. | | `web_socket_channel: ^3.0.3` | 07 | Core owns the engine. | | `jose: ^0.3.5+1` | 04 | Only `Token` parsed JWTs; `UserToken` does it in core. | -| `logging: ^1.3.0` | 06 | Only after the bridge's deprecation cycle expires — not in the same release. | -| `equatable: ^2.0.8` | — | Verify: our models may still use it directly. | -| `diacritic: ^0.1.6` | 08 | Only if `normalizeStringForSort` moved upstream. | +| ~~`logging: ^1.3.0`~~ | 06 | **Done.** 06 removed chat's logger outright instead of bridging it, so the deprecation cycle never applied. Gone from `melos.yaml`, and no package imports it. | +| `equatable: ^2.0.8` | — | **Stays.** 28 files in `stream_chat/lib` use it directly. | +| ~~`diacritic: ^0.1.6`~~ | 08 | **Done.** Chat's `normalizeStringForSort` was a copy of core's, differing only in its doc comment, and was `@internal` so nothing public moved. The three sort fields that fold names now use core's. Still a direct dependency of `stream_chat_flutter`, which uses it in two files. | `rate_limiter` **stays** — `RetryQueue` uses its `backOff`, and `RetryPolicy` / `RetryQueue` are staying chat-side. `synchronized`, `collection`, `mime`, `http_parser`, `rxdart`, `meta`, @@ -35,16 +35,16 @@ imported — a package that resolves transitively today will break the day core `lib/stream_chat.dart` re-exports five packages wholesale-or-narrowed: ```dart -export 'package:async/async.dart'; // wholesale +export 'package:async/async.dart' hide Result; // narrowed by 03 export 'package:dio/dio.dart' show DioException, DioExceptionType, RequestOptions, CancelToken, Interceptor, InterceptorsWrapper, MultipartFile, Options, ProgressCallback; -export 'package:logging/logging.dart' show Logger, Level, LogRecord; export 'package:rate_limiter/rate_limiter.dart'; // wholesale +export 'package:stream_core/stream_core.dart' show /* allowlist, grown per phase */; export 'package:uuid/uuid.dart'; // wholesale ``` -Three of those are wholesale re-exports of packages whose types are almost certainly incidental to -chat's API. Removing a re-export is breaking for anyone who relied on it transitively, so this is +`logging` is already gone with phase 06, and `async` is down to a `hide`. Two wholesale +re-exports are left, of packages whose types are almost certainly incidental to chat's API. Removing a re-export is breaking for anyone who relied on it transitively, so this is the right phase for it — one break, one migration entry, alongside everything else. - `package:async` — check whether any public signature actually mentions an `async` type. @@ -53,16 +53,15 @@ the right phase for it — one break, one migration entry, alongside everything - `package:uuid` — almost certainly incidental. - `package:dio` — already narrowed, but reconcile it with core's wholesale dio re-export so consumers don't get two dio surfaces with different shapes. -- `package:logging` — drops with phase 06's deprecation cycle. End state: every package re-export in the barrel is a `show` allowlist, consistent with the -decision in the README and with `filter.dart show Filter, FilterOperator` already in the file. +decision in the README and with the `stream_core` allowlist the later phases have been growing. ### The deprecation kit **This is the most valuable part of the phase, and it does not exist in chat today.** There is no `packages/stream_chat/lib/fix_data.yaml` and no `test_fixes/`. `lib/stream_chat.dart` exposes -**202 public top-level declarations**, and this plan renames dozens of them. +**201 public types**, and this plan renames dozens of them. `stream_feeds` solves it with two artifacts: @@ -73,21 +72,27 @@ decision in the README and with `filter.dart show Filter, FilterOperator` alread Build both here, covering every rename from phases 01–09. The highest-value transforms: -| From | To | Phase | -| --- | --- | --- | -| `CurrentPlatform.name` | `.operatingSystem` | 02 | -| `StreamChatNetworkError` | `StreamApiException` | 03 | -| `ChatErrorCode` | `StreamErrorCode` | 03 | -| `Token` | `UserToken` | 04 | -| `TokenProvider` (closure) | `TokenProvider.dynamic(...)` | 04 | -| `tokenManager.loadToken()` | `.getToken()` | 04 | -| `StreamHttpClient` | (removed) | 05 | -| `ConnectionStatus` | `WebSocketConnectionState` | 07 | -| `SortOption.asc('field')` | `Sort.asc(XSortField.field)` | 08 | - -Note the last one cannot be a pure `dart fix` rename — a string becomes a typed field reference. -Those get a `@Deprecated` forwarder and a migration-guide example instead; don't force a transform -that can't be correct. +A transform can only be written for a rename that has already happened, so the table splits on +whether the old symbol is still in `stream_chat/lib`: + +| From | To | Phase | Writable | +| --- | --- | --- | --- | +| `ChatErrorCode` | `StreamErrorCode` | 03 | yes — gone from chat | +| `Token` | `UserToken` | 04 | yes — gone from chat | +| `TokenProvider` (closure) | `TokenProvider.dynamic(...)` | 04 | yes | +| `tokenManager.loadToken()` | `.getToken()` | 04 | yes | +| `SortOption.asc('field')` | `Sort.asc(XSortField.field)` | 08 | forwarder only, see below | +| `Filter.equal('key', v)` | `XFilter.equal(XFilterField.key, v)` | 08 | forwarder only, see below | +| `LocationCoordinates` | `LocationCoordinate` | 08 | yes — gone from chat | +| `CurrentPlatform.name` | `.operatingSystem` | 02 | not yet — still 4 files | +| `StreamChatNetworkError` | `StreamApiException` | 03 | not yet — still 4 files | +| `StreamHttpClient` | (removed) | 05 | not yet — still 17 files | +| `ConnectionStatus` | `WebSocketConnectionState` | 07 | not yet, and 07 is parked | + +The two `08` rows cannot be pure `dart fix` renames — a string key becomes a typed field +reference, and which registry it belongs to depends on the query being called. Those get a +migration-guide example instead; don't force a transform that can't be correct. Both are already +covered by Symbol Map rows. **Wire `test_fixes/` and exercise it.** Feeds ships `fix_data.yaml` with **no** `test_fixes/` directory, so its transforms are never verified — `melos run test:fixes` is gated on @@ -102,12 +107,14 @@ An unverified transform is worse than none: it runs on consumer code and gets it ## Decisions to make -- Which of the three wholesale package re-exports are dropped versus narrowed, based on the - public-signature audit. -- Whether the deprecation kit lands **here** or **before phase 08**. Phase 08 renames the - most-used types in consumer code (`Filter`, `SortOption`), so having transforms ready when it - lands is worth more than having them collected neatly at the end. Strong argument for splitting - the kit out early and appending to it per phase. +- Whether `rate_limiter` and `uuid` — the two wholesale re-exports left — are dropped or + narrowed, based on the public-signature audit. +- ~~Whether the deprecation kit lands here or before phase 08.~~ **Answered by events: it did + not.** 08 landed without it, renaming `Filter` and `SortOption` — the two most-used types in + consumer code — with no forwarders and no transforms. Neither is recoverable by a transform + anyway (a string key becomes a typed field reference), so the loss is smaller than it looked, + but the lesson stands for 05 and 07: write the transform in the phase that does the rename, + while the old and new names are both still in hand. - How long the deprecation cycle is. Every `@Deprecated` here has to name the release that removes it, and v11 is the release that *earns* the right to remove v10 deprecations — don't let the two sets blur. @@ -142,7 +149,7 @@ None. - [ ] `migrations/v11-migration.md` is complete: every Symbol Map row filled, every feature section written, the Migration Checklist accurate, and the "For AI Agents" section reflecting the final shape. -- [ ] The five pana jobs in `.github/workflows/pana.yml` are green (they were re-enabled when - this directory was created; confirm they still pass). +- [ ] The five pana jobs in `.github/workflows/pana.yml` are green. They were re-enabled when + this directory was created — no `if: false` remains — so this is a confirm-they-pass item. - [ ] `melos bootstrap && melos run lint:all && melos run test:all`. - [ ] Every phase's status box ticked in `README.md`. diff --git a/core-migration/DEFERRED.md b/core-migration/DEFERRED.md index 7cd9e0f90a..d0d812b27e 100644 --- a/core-migration/DEFERRED.md +++ b/core-migration/DEFERRED.md @@ -9,7 +9,7 @@ A row leaves this file when it lands, not when it is decided. | | What | Blocked on | Phase | | --- | --- | --- | --- | -| ☐ | **Restore hosted `stream_core` / `stream_core_flutter` constraints** in `melos.yaml` | A `stream_core` release carrying `Filter.raw`, `normalizeStringForSort`, `debugCurrentPlatformOverride` and `sortedWith`. Until then `melos bootstrap` writes a `git:` block into `stream_chat`, `stream_chat_flutter_core` and `stream_chat_flutter`, which makes all three unpublishable. This is the row every other "blocked on a core release" note now folds into. | [08](08-query-dsl.md) | +| ☐ | **Restore hosted `stream_core` / `stream_core_flutter` constraints** in `melos.yaml` | A `stream_core` release carrying `Filter.raw`, `normalizeStringForSort`, `debugCurrentPlatformOverride`, `sortedWith` and `LocationCoordinate`'s exact equality ([core#181](https://github.com/GetStream/stream-core-flutter/pull/181)). Until then `melos bootstrap` writes a `git:` block into `stream_chat`, `stream_chat_flutter_core` and `stream_chat_flutter`, which makes all three unpublishable. This is the row every other "blocked on a core release" note now folds into. | [08](08-query-dsl.md) | | ☐ | A test proving a malformed response body surfaces as `StreamClientException` rather than a bare `TypeError` | A call through the generated client — nothing in this package exercises `runApiSafely` yet. Arrives with `openapi-migration` group 02. | [03](03-errors.md) | ## Needs a live check, not more code @@ -20,13 +20,14 @@ A row leaves this file when it lands, not when it is decided. | ☐ | `sample_app` by hand: cold login, mid-session token expiry, logout → login as a different user | Core's interceptor refuses to refresh across a user switch. Correct, but it is a behaviour change on the path where failure means "cannot log in". | [04](04-token-and-auth.md) | | ☐ | Probe `queryUsers` with a range operator on `name`, and a non-`$eq`/`$in` operator on a custom field | `UserFilterField.name` and `.custom` document a narrower operator set than both the published spec and `mq/user/user.go:25,43`, on the strength of observed 400s that were never written down. Source now contradicts the docs, so the next person to reconcile the two will widen them back. | [08](08-query-dsl.md) | | ☐ | One real request against a live app key | `api_key` stays a query parameter rather than moving to core's header-setting `ApiKeyInterceptor`; mocks cannot tell us the server agrees. | [05](05-http-client.md) | -| ☐ | Benchmark `merge` on realistic lists (1k+ sorted messages, a large member list, the read map) | Decides whether chat adopts core's keyed-map-merge or core adopts chat's two-pointer merge. It runs on every message, member and read update. | [01](01-utilities.md) | +| ☑ | ~~Find what produces duplicate-keyed entries in a merged list~~ **Answered.** The merge manufactured them itself. `merge`'s non-overlapping concat fast path (`compare(last, other.first) < 0 → [...this, ...other]`) skipped dedup, and Drift stored `DateTime` as unix **seconds**, so the same message id carried a microsecond-precision `createdAt` in memory and a second-truncated one from the cache — violating the "same key ⇒ same compare value" precondition on every round trip. Merge #1 concatenated silently; merge #2 tripped `_hasUniqueKeys`, which is the [#2660](https://github.com/GetStream/stream-chat-flutter/pull/2660) crash. Both causes are gone: #2660 removed the fast path, and [`7f0804d2d`](https://github.com/GetStream/stream-chat-flutter/commit/7f0804d2d) made persistence store ISO-8601 text. Reproduced end to end on a worktree at `d07f633dd^`. Persistence holds no duplicate rows. | [01](01-utilities.md) | | ☐ | `flutter build web --wasm` on the sample app | Core's detector has no throwing stub, so this should be a formality — but the wasm fix (`#2940`) exists because chat's *did*, so confirm rather than assume. | [02](02-platform-and-environment.md) | ## Waiting on a decision or a later phase | | What | Waiting on | Phase | | --- | --- | --- | --- | +| ☐ | Make `sortedMerge` tie-stable, so an edit does not move a message below a same-timestamp neighbour | The last ordering defect left. A comparator tiebreak looks like the cheaper fix and is not one: `Message.id` is a v4 uuid, and `message_dao`'s `(createdAt, id)` is keyset-pagination machinery rather than a chosen display order. Tie-stability in the merge is the honest fix, measured at 1.08-1.39x depending on list length. Findings, dead ends and numbers in [message-ordering.md](message-ordering.md). | [01](01-utilities.md) | | ☐ | Adopt core's `CurrentPlatform` / `PlatformType`, renaming `.name` → `.operatingSystem` | The restore row above. No release of its own: the SHA pinned in [08](08-query-dsl.md) already carries `debugCurrentPlatformOverride`, which `stream_chat_flutter`'s tests set in 8 places, so this is doable now and only the hosted constraint is outstanding. | [02](02-platform-and-environment.md) | | ☐ | **A `StreamChatConfig`**, mirroring `FeedsConfig` | Deliberately last, as a cleanup step once the adoption is done. It subsumes several rows below, so doing it early would mean doing them twice. See [below](#the-streamchatconfig-that-absorbs-several-of-these). | [10](10-cleanup.md) | | ☐ | Retire `StreamChatClient.additionalHeaders` and `defaultUserAgent` | Both are public mutable statics, so two clients in one process share them. Replacing the first needs a per-client `headers` option; the second reads the static `_systemEnvironmentManager`, so they move together. | [10](10-cleanup.md) | @@ -37,7 +38,8 @@ A row leaves this file when it lands, not when it is decided. | ☐ | Move chat's WebSocket to `/api/v2/connect` | Three blockers, none of them chat-side: v2's handshake never calls `EnrichUserMutes` (`lib/chat/controller/v1/connect.go:118` only), it decodes `user_details` with `WithDecodeExtraFields(false)` so chat's root-promoted `extraData` is dropped, and core's `ConnectUserDetailsRequest` has no `privacySettings`. iOS is on core and v2 endpoints and still connects over v1. | [07](07-websocket.md) | | ☐ | Narrow `PredefinedFilter._defaultSortFor` to the server's flag condition | It answers `last_message_at` whenever the filter mentions the field at all. The server flips its fallback only when *every* `last_message_at` node is reachable through `$and` alone and at least one narrows by value — `$eq` / `$ne` / `$gt` / `$gte` / `$lt` / `$lte`, or `$exists: true` (`DetectLastMessageAtFiltering`, `lib/core/mq/channel/modifiers.go`). So a preset putting `last_message_at` under `$or`, or matching it with `$in` or `$exists: false`, leaves the server on `last_updated` while the client answers `last_message_at`, and `loadMore`'s offset indexes into a differently ordered list. A test pins the loose `$or` behaviour today, so closing this inverts it. | [08](08-query-dsl.md) | | ☐ | Decide whether id-like sort fields should opt out of string folding | `StreamSortField` folds **every** string value through `normalizeStringForSort`, which is what `ComparableField` did, so [08](08-query-dsl.md) kept it. It also means `UserSortField.id`, `MessageSearchSortField.id`, `MemberSortField.userId`, `MessageReminderSortField.channelCid` and `ThreadSortField.parentMessageId` compare case- and diacritic-insensitively — two ids differing only in case tie, so a composite sort's tie-breaker stops breaking ties. Pre-existing, and a `foldStrings: false` per field would fix it; changing it is a behaviour change beyond the migration. | [08](08-query-dsl.md) | -| ☐ | Decide whether core grows channel-scoped `CdnClient` operations, or chat keeps its broader uploader interface | Half of chat's uploads are channel-scoped and core's `CdnClient` has only four CDN-scoped methods. Must agree with `openapi-migration/12-uploads-cdn.md` before either starts. | [09](09-uploads.md) | +| ☐ | Order pinned messages by `pinnedAt`, and stop the merge asserting on them | Two halves of one bug, both pre-existing. The API returns pinned messages `ORDER BY message.pinned_at DESC NULLS LAST`, but every write goes through `_mergeMessagesIntoExisting` → `sortedUpsertAt(compare: _sortByCreatedAt)`, so a pin lands in creation order. On v10 the mis-placement was silent; core's `sortedUpsertAt` asserts its receiver is sorted, so from this phase on the same payload trips that assert in debug — release builds strip it and misplace the message exactly as before. Sorting the payload by `createdAt` on the way in silences the assert but is not the right order, so it was reverted as unrelated to this phase; fix both together by comparing on `pinnedAt` throughout, which needs a null-ordering decision since `Message.pinnedAt` is nullable where `createdAt` is not. Raised on [#2959](https://github.com/GetStream/stream-chat-flutter/pull/2959). | [01](01-utilities.md) | +| ☐ | Implement the uploader against core's task machinery | The **decision** is made — chat keeps its broader interface and implements a chat-side `CdnClient` for the CDN half ([09](09-uploads.md)). Only the work is outstanding. Must still agree with `openapi-migration/12-uploads-cdn.md` on who writes the multipart calls. | [09](09-uploads.md) | ## Landed, listed so nobody re-raises it @@ -45,6 +47,10 @@ A row leaves this file when it lands, not when it is decided. | --- | --- | --- | | ☑ | Remove chat's own logger and `package:logging` | Done in [06](06-logger.md): the SDK writes through `StreamLogger`, `logConfig` replaces `logLevel` + `logHandlerFunction`, and no package in the repo imports `package:logging` any more. | | ☑ | Delete `StreamChatClient.devToken` | [04](04-token-and-auth.md) | +| ☑ | Benchmark `merge` on realistic lists | Done, numbers in [01](01-utilities.md). The two-pointer merge wins 1.3–1.6x wherever the receiver is long and the increment is small, and ties on a full refresh, so it moved to core as `sortedMerge` rather than being dropped for `merge`. Chat's `list_extensions.dart` is deleted; parity with the version it replaced is 0.97–1.01x, and a disjoint-key fast path makes pagination ~8% faster. | +| ☑ | Adopt core's `Filter` / `Sort` / `ComparableField` | Done in [08](08-query-dsl.md). It was never blocked on core gaining `$nor`: no core SDK models it, and chat removed `$nor`, `$ne` and `$nin` instead — the API is withdrawing all three. | +| ☑ | Decide the fate of `Filter.custom` / `Filter.raw` / `Filter.empty` | [08](08-query-dsl.md): `custom` becomes a per-registry factory, `raw` moved to core, `empty` is replaced by nullability. | +| ☑ | Adopt core's `LocationCoordinate` | [08](08-query-dsl.md), closing that phase. | | ☑ | Settle chat's keepalive frame | [07](07-websocket.md): no chat-side ping type. `MonitorHealth` (`client.go:607-620`) `Discard()`s every client frame, so the body is unread and core's default `pingRequestBuilder` is correct. iOS sends a raw protocol ping for the same reason. | ## The `StreamChatConfig` that absorbs several of these diff --git a/core-migration/README.md b/core-migration/README.md index 791e6109c3..71f8e7948f 100644 --- a/core-migration/README.md +++ b/core-migration/README.md @@ -8,10 +8,12 @@ One file per phase, in the order they should land. Each carries a goal, the exac with their core counterparts, the decisions that phase has to make, its risks, the upstream `stream_core` work it needs, and a definition of done. -Two indexes cut across the phases: +Three documents cut across the phases: - [`DEFERRED.md`](DEFERRED.md) — everything consciously postponed, and what unblocks each item. - [`UPSTREAM.md`](UPSTREAM.md) — what should move the *other* way, chat → core. +- [`message-ordering.md`](message-ordering.md) — why messages sharing a `createdAt` change + places, and which of the obvious fixes are wrong. | | Phase | Chat LOC | Core LOC | Breaking | Status | | --- | --- | --- | --- | --- | --- | diff --git a/core-migration/UPSTREAM.md b/core-migration/UPSTREAM.md index 6850013300..cb96a6d7c3 100644 --- a/core-migration/UPSTREAM.md +++ b/core-migration/UPSTREAM.md @@ -17,9 +17,11 @@ rather than deleted so the same asks are not re-raised. | --- | --- | --- | --- | | ☐ | **The retry table** — `isRetriable` over the sealed exception kinds | `ERROR_LAYER.md` §Retrying *specifies* this table, and core owns the doc. Chat now implements it ([03](03-errors.md)); feeds independently re-derived a partial version in `capabilities_repository.dart`'s `shouldRetry`. Two products deriving the same table from the same spec is the definition of a core concern. | Nothing. Strongest candidate here. | | ☐ | **Text operators over an array-valued field** — `QueryOperator` / `AutoCompleteOperator` in `matches()` | Both bail on `fieldValue is! String` (`filter.dart:540`, `:556`), so a getter returning an `Iterable` never matches, whatever the value. Core already resolves arrays element-wise for `$eq`/`$in`/`$contains`; the evaluation operators were not extended with them. The API supports `$autocomplete` on array fields — chat's `ChannelFilterField.memberUserName` is one — so the query is right and only local evaluation disagrees. `stream_feeds` calls `matches()` in 36 event handlers, which is where this would surface first. | Nothing. | -| ☑ | **`normalizeStringForSort`** | Landed in [core#181](https://github.com/GetStream/stream-core-flutter/pull/181) as a utility, ported with its tests. **Not** as a change to `ComparableField`, which the row originally proposed: `Filter` compares through the same code (`filter.dart:299,320`), so folding there would make `$eq`, `$gt` and `$lt` case- and diacritic-insensitive locally while the API stayed exact. | Landed; chat deletes its copy on the next core release. | +| ☑ | **`normalizeStringForSort`** | Landed in [core#181](https://github.com/GetStream/stream-core-flutter/pull/181) as a utility, ported with its tests. **Not** as a change to `ComparableField`, which the row originally proposed: `Filter` compares through the same code (`filter.dart:299,320`), so folding there would make `$eq`, `$gt` and `$lt` case- and diacritic-insensitive locally while the API stayed exact. | Landed. Chat deleted its copy in phase [10](10-cleanup.md), which also dropped `diacritic` as a direct dependency. | | ✗ | **`Filter` `$nor`** | **Dropped, and chat removes it too.** Neither StreamCore (Swift) nor stream-android-core models `$nor`, and adding it to Dart alone breaks a parity the three otherwise keep. The backend withdrew `$ne`/`$nin` from the published spec in [GetStream/chat#15657](https://github.com/GetStream/chat/pull/15657) and left `$nor` accepted-but-unpublished, so a preset can still contain it — which is what `Filter.raw` is for, not a modelled operator. | Closed. | -| ☐ | **The two-pointer `merge`** (`core/util/list_extensions.dart`) | If the benchmark [01](01-utilities.md) is parked on shows it beats core's keyed-map-merge-then-sort at real list sizes, core should take *ours* rather than chat taking core's — every product merges paginated lists. | The benchmark. | +| ☑ | **Element-wise matching for array fields** | Open in [core#181](https://github.com/GetStream/stream-core-flutter/pull/181). `Filter.equal` and `Filter.in_` compared an array field with order-sensitive deep equality, so a list-valued getter could never match. Every array field the API exposes is matched element-wise — `members` by an `EXISTS` join, `filter_tags` by `@> AND <@` then `&&`, `teams` by `?|`, `attachments.type` by a nested `@>` — and none is order-sensitive. Without it `members`, `member.user.name` and `attachments.type` were undeclarable. | Nothing. | +| ☑ | **A `sortedMerge` alongside core's `merge`** (`utils/list_extensions.dart`) | Landed. Offered as a second method rather than a replacement: the two differ on contract, not quality — `sortedMerge` requires a sorted receiver and merges in O(n + m), `merge` assumes no order and sorts. Parity with the chat method it replaced is 0.97–1.01x, and a disjoint-key fast path makes pagination ~8% faster. Duplicate keys collapse as `merge` does, detected for free off the maps the walk already builds. | — | +| ☑ | **`LocationCoordinate` equality** | `==` compared with a `1e-7` epsilon while `hashCode` hashed the raw doubles, so the two disagreed: `a == b` yet `{a, b}.length == 2`, and `map[b]` misses after `map[a] =` (probed). The epsilon also made equality **non-transitive** — `a == b`, `b == c`, `a != c` across two 6e-8 steps — so no `hashCode` could ever have agreed with it. It reached `distanceTo` as well, which opens with `if (this == other) return 0.meters`: any two points closer than ~1.1cm reported exactly 0m. Feeds inherited all of it, since `ActivityData` and `FeedData` carry a `LocationCoordinate` field and freezed generates both members over it. No comparable type does this — JTS `Coordinate`, Google Maps Android `LatLng`, `latlong2`, Apple's `CLLocationCoordinate2D`, stream-core-android and stream-core-swift all keep equality exact and answer proximity with a distance or a named method. It is also the only class in core that hand-writes `==`/`hashCode`; sixteen others use `Equatable`, which makes the split unrepresentable. **Fix:** `extends Equatable` with `props => [latitude, longitude]`, delete both members, keep `distanceTo` for proximity. | Landed in [core#181](https://github.com/GetStream/stream-core-flutter/pull/181); this phase moves the pin onto it. | | ☐ | **`HeadersInterceptor` and `ConnectionIdInterceptor` tests** | Core ships both interceptors with **no tests**. Chat had tests for its forks, so this phase kept them chat-side (`additional_headers_interceptor_test.dart`, `connection_id_interceptor_test.dart`) pointed at core's types — they belong next to the code they cover. | Nothing. Port them up. | | ☐ | **A hand-written multipart CDN interface** | Feeds hand-wrote `CdnApi` because the generator emits a JSON `@Body()` for `multipart/form-data` operations, with no progress or cancellation. Chat will hand-write the same thing in [09](09-uploads.md). Two identical hand-written retrofit interfaces is a smell — either core owns one, or the generator is fixed. | Prefer the generator fix; see the `openapi-codegen` skill. | | ✗ | **`_ResultCallAdapter`** | **Not worth moving.** Core does not depend on `retrofit`, so this would add that dependency for every core consumer to save three lines that a *generator* emits and nobody hand-maintains. If anywhere, the fix belongs in the generator template. | Closed. | @@ -29,7 +31,7 @@ rather than deleted so the same asks are not re-raised. | ☐ | **A const-constructible `SortField`** | `SortField(remote, closure)` can never be const — a closure literal is not a constant expression — so every registry member is `static final` and every `defaultSort` list is `final` too. Nothing is broken by that; it just means a caller cannot write a `const` sort list, and it cost [08](08-query-dsl.md) the list controllers' `const` default parameters. Const-ness needs the value lookup to be an overridden method rather than a constructor argument, which both chat and feeds would have to adopt together. | Would change `SortField`'s constructor, so it is a core-wide API decision, not a chat ask. | | ☑ | **`CurrentPlatform.debugCurrentPlatformOverride`** | Landed on core's `main` in #178. | Landed; chat can use it on the next release. | -| ☐ | **`Filter.raw`** | Open in [core#181](https://github.com/GetStream/stream-core-flutter/pull/181). `Filter` is `sealed`, so a gap has no downstream workaround, and chat needs one: a predefined filter is authored server-side and the query layer still accepts `$ne`/`$nin`/`$nor` ([#15657](https://github.com/GetStream/chat/pull/15657) is spec-only), so an echoed filter can carry an operator core does not model. `raw` is the fallback leaf that lets [08](08-query-dsl.md)'s `Filter.fromJson` stay total, the way `XSortField.custom` does for sort fields. Caveat: `matches` on a raw leaf returns `true`, which is right under `and` and wrong under `or` — Swift avoids this with a nullable predicate and `compactMap`, which a `bool matches(T)` cannot express. | Nothing. | +| ☐ | **`Filter.raw`** | Open in [core#181](https://github.com/GetStream/stream-core-flutter/pull/181). `Filter` is `sealed`, so a gap has no downstream workaround, and chat needs one: a predefined filter is authored server-side and the query layer still accepts `$ne`/`$nin`/`$nor` ([#15657](https://github.com/GetStream/chat/pull/15657) is spec-only), so an echoed filter can carry an operator core does not model. `raw` is the fallback leaf that lets [08](08-query-dsl.md)'s `Filter.fromJson` stay total, the way `XSortField.custom` does for sort fields. `matches` on a raw leaf **throws**: `true` is right under `and` and wrong under `or`, `false` inverts that, and Swift's third state comes from a nullable predicate that `bool matches(T)` cannot express. Refusing is the only outcome that cannot silently produce a wrong result. | Nothing. | ## Deliberately *not* moving @@ -75,5 +77,7 @@ core's `main`. What matters now is a single release carrying everything the bran Cross-repo workflow is in [`STYLE_GUIDE.md`](../STYLE_GUIDE.md) (§Dependency management): a path dependency while both repos change together, back to a hosted constraint in `melos.yaml` before -release. And read core against `~/.pub-cache/hosted/pub.dev/stream_core-/`, not the sibling -checkout — this plan has already been wrong twice by reading unreleased `main`. +release. And read the copy that actually resolves, not the sibling checkout — this plan has already been wrong +twice by reading unreleased `main`. Take the path from +`packages/stream_chat/.dart_tool/package_config.json` rather than assuming it: while `melos.yaml` pins a +git `ref` that is under `~/.pub-cache/git/`, and it returns to `~/.pub-cache/hosted/` when core releases. diff --git a/core-migration/message-ordering.md b/core-migration/message-ordering.md new file mode 100644 index 0000000000..bdb4be1845 --- /dev/null +++ b/core-migration/message-ordering.md @@ -0,0 +1,102 @@ +# Message ordering + +**What this is:** the findings from chasing why messages sharing a `createdAt` sometimes +change places, written down because most of the obvious fixes are wrong and the reasons are +not visible from the code. + +**Status:** one real defect left, named at the bottom. Everything above it is either already +fixed or a dead end that looked promising. + +## The comparator is not a total order + +```dart +// channel_client_state.dart +int _sortByCreatedAt(Message a, Message b) => a.createdAt.compareTo(b.createdAt); +``` + +Two distinct messages can compare equal, so their relative order is whatever last touched the +list. A merge, an upsert and a fresh query can each settle it differently. + +`createdAt` is worse than it looks: + +```dart +// message.dart +DateTime get createdAt => remoteCreatedAt ?? localCreatedAt ?? DateTime.now(); +``` + +When both are null the getter answers **a fresh value on every read**, so the comparator is not +even self-consistent — `compare(a, b)` and `compare(b, a)` can both return `-1`. Measured on a +message carrying neither timestamp: `compare(a, b) == 0` in **19388 of 20000** reads, because +two `DateTime.now()` calls usually land in the same microsecond. Sorting against that is +undefined behaviour, and two tests in `channel_test.dart` depend on the current outcome. + +## Rejected: tie-break on `id` + +Deterministic, and wrong. `Message.id` is `id ?? const Uuid().v4()` — a random v4 uuid. Ordering +ties by it says nothing about when a message was sent or arrived, and a tie almost always means +two messages sent at nearly the same moment, where arrival order is what a reader expects. It +trades *usually right* for *reliably arbitrary*. + +Tried it: two `channel_test.dart` cases fail, both jump-to-message, because the fixtures build +messages with no timestamps and expect insertion order to survive. + +**`message_dao` is not a precedent for this.** It orders `getMessagesByCid` and +`getThreadMessagesByParentId` by `(createdAt, id)`, which reads like the SDK has already chosen +`id` as a display tiebreak. It has not — the tuple is keyset-pagination machinery, and the file +says so: + +> Cursor predicates compare the full `(createdAt, id)` tuple — the same key used in ORDER BY — +> so replies sharing a `createdAt` fall on the correct side of the boundary. + +A cursor needs *some* total order to avoid skipping or repeating rows across pages. Which one is +irrelevant there, so a uuid is fine. That is a different problem from what the reader sees. + +## Rejected: stamp `localCreatedAt` at construction + +The field exists and is local-only (not serialised), so defaulting it in the constructor looks +like it would make `createdAt` stable without touching the wire. It does make it stable per +instance, and identical payloads stay equal if the default is conditional on `createdAt` being +absent — but it still does not give a total order: + +**500 of 500** rounds building five messages in a list literal produced at least one duplicate +timestamp. `DateTime.now()` cannot resolve construction that fast. Anything that wants a total +order needs a monotonic sequence, not a clock. + +## Not the same defect: `client.dart:646` + +```dart +final events = res.events.sorted((a, b) => a.createdAt.compareTo(b.createdAt)); +``` + +Same shape, different subject — these are `/sync` **events**, not messages, and their replay +sequence is meaningful. An `id` tiebreak would impose an arbitrary order on same-instant events. +Worth knowing separately that `sorted` is not stable, so same-instant events already lose the +order the server sent them in. + +## Already fixed, recorded so nobody re-derives it + +The duplicate-key crash in [#2660](https://github.com/GetStream/stream-chat-flutter/pull/2660) +was the merge manufacturing duplicates itself, not persistence handing them over. `merge`'s +non-overlapping concat fast path skipped dedup, and Drift stored `DateTime` as unix **seconds**, +so one message id carried a microsecond-precision `createdAt` in memory and a second-truncated +one from the cache — violating the "same key ⇒ same compare value" precondition on every round +trip. #2660 removed the fast path; [`7f0804d2d`](https://github.com/GetStream/stream-chat-flutter/commit/7f0804d2d) +made persistence store ISO-8601 text. Reproduced end to end on a worktree at `d07f633dd^`. + +## What is actually left + +A replacement that ties with its neighbours is placed **behind** them by `sortedMerge`, where +`merge` leaves it in front. So editing a message whose `createdAt` ties with the next one moves +it down the list. + +The fix is tie-stability in the merge, not a comparator change: keep the resolved element in the +receiver's slot when it sorts where the original sat. Prototyped and working, but it needs the +resolved intersection up front and a consumed-key set, which measured **1.28–1.39x** at n=100 and +**1.08–1.17x** at n=1000 after two rounds of tuning. That is why `stream_core`'s `sortedMerge` +ships without it, and why the behaviour is pinned by a test rather than left to drift. + +Worth confirming before anyone spends that: **Android prioritises `createdLocallyAt` over +`createdAt`** when sorting, the opposite of this SDK's `remoteCreatedAt ?? localCreatedAt`. If +that is right, the server echo does not re-place a message on Android the way it does here, and +the two SDKs disagree about something more basic than ties. Taken from documentation rather than +source — read the Android comparator before acting on it. diff --git a/migrations/v11-migration.md b/migrations/v11-migration.md index c9602c7d63..3ad87eff53 100644 --- a/migrations/v11-migration.md +++ b/migrations/v11-migration.md @@ -122,6 +122,14 @@ search-and-replace you can apply directly. `Kind` is one of `renamed`, `removed` | `ChatPersistenceClient` filter arguments | `ChannelFilter?` | `retyped` | `getChannelStates`, `queryChannelStates`, `updateChannelQueries`, `saveChannelQueries` | | _(new)_ | `ChannelFilterField.members` / `.memberUserName` | `added` | Keeps the standard "channels I am in" query typed | | _(new)_ | `ChannelModel.muted` / `.blocked`, `Channel.blocked` / `.blockedStream` | `added` | Already on the channel payload; now read without reaching into extra data | +| `LocationCoordinates` | `LocationCoordinate` | `renamed` | `stream_core`'s, re-exported. Singular, since it is one point | +| `LocationCoordinates.copyWith` | — | `removed` | Two required doubles; construct a new one | +| `LocationCoordinates` exact equality | `LocationCoordinate` equality within ~1cm | `retyped` | Compares to a 1e-7 epsilon, so coordinates that round-trip through the API still match | +| _(new)_ | `LocationCoordinate.distanceTo` | `added` | Haversine distance, returning a `Distance` | +| `SortedListX` / `IterableMergeX` / `ListX` | `SortedListExtensions` (`stream_core`) | `moved` | Re-exported from this package. One extension where there were three, so a call site that used two of them needs no extra import | +| `mergeSorted` | `sortedMerge` | `renamed` | A key held twice now collapses to the last element carrying it, as `merge` does, rather than being carried through | +| `updateIf(test, update)` | `updateWhere(test, update: update)` | `renamed` | The second argument is named | +| `mergeFrom(other, key:, value:)` | `merge(other.map(value).nonNulls, key:)` | `removed` | Project first, then merge | | _(more added per feature as PRs land)_ | | | | --- diff --git a/packages/stream_chat/CHANGELOG.md b/packages/stream_chat/CHANGELOG.md index 48493cea82..45aa2bf576 100644 --- a/packages/stream_chat/CHANGELOG.md +++ b/packages/stream_chat/CHANGELOG.md @@ -31,6 +31,8 @@ - `Filter.raw` takes its map positionally: `Filter.raw({...})` rather than `Filter.raw(value: {...})`. It is not validated, and `matches` throws for it. - Every query takes its own filter type — `queryChannels` a `ChannelFilter?`, `queryUsers` a `UserFilter?`, and so on — and `PredefinedFilter.filter` is a `ChannelFilter`. - `ChannelFilterField.members` and `.memberUserName` are declared, so the standard "channels I am in" query stays typed. +- `LocationCoordinates` is renamed `LocationCoordinate` — singular. Its `copyWith` is removed, and it gains `distanceTo`, which answers the distance between two points. +- The list extensions are consolidated into one `SortedListExtensions`. `SortedListX`, `IterableMergeX` and `ListX` are removed: `mergeSorted` becomes `sortedMerge` (and now collapses a repeated key instead of carrying it through, matching `merge`), `updateIf` becomes `updateWhere` (its `update` argument is now named), and `mergeFrom` is dropped in favour of `merge` over a projected list. - `DraftSortField` has no `custom` field: the API rejects a custom sort field on drafts. - A sort names its model's field type, so `MemberSort.asc` takes a `MemberSortField` and a field from another model does not compile. `XSortField.custom(key)` reads a field from the model's extra data, for the four models whose queries accept one. - Added `ChannelSort.empty`, `MemberSort.empty` and one on every other sort — an empty sort, for querying with the ordering the API applies on its own. diff --git a/packages/stream_chat/lib/src/client/channel/channel.dart b/packages/stream_chat/lib/src/client/channel/channel.dart index a6d4a76275..f8239d93d0 100644 --- a/packages/stream_chat/lib/src/client/channel/channel.dart +++ b/packages/stream_chat/lib/src/client/channel/channel.dart @@ -1290,7 +1290,7 @@ class Channel { String? id, String? messageText, String? createdByDeviceId, - required LocationCoordinates location, + required LocationCoordinate location, Map extraData = const {}, }) { final message = Message( @@ -1323,7 +1323,7 @@ class Channel { String? messageText, String? createdByDeviceId, required DateTime endSharingAt, - required LocationCoordinates location, + required LocationCoordinate location, Map extraData = const {}, }) { final message = Message( diff --git a/packages/stream_chat/lib/src/client/channel/channel_client_state.dart b/packages/stream_chat/lib/src/client/channel/channel_client_state.dart index e0cb0e3b59..c905f39772 100644 --- a/packages/stream_chat/lib/src/client/channel/channel_client_state.dart +++ b/packages/stream_chat/lib/src/client/channel/channel_client_state.dart @@ -172,7 +172,7 @@ class ChannelClientState { updateChannelState( channelState.copyWith( - read: updatedReads.toList(), + read: updatedReads, ), ); } @@ -510,7 +510,7 @@ class ChannelClientState { /// Update channelState with updated information. void updateChannelState(ChannelState updatedState) { - final newMessages = messages.mergeSorted( + final newMessages = messages.sortedMerge( updatedState.messages, key: (message) => message.id, update: MessageMerging.mergeUpdate, @@ -532,11 +532,11 @@ class ChannelClientState { _channelState = _channelState.copyWith( messages: newMessages, channel: _channelState.channel?.merge(updatedState.channel), - watchers: newWatchers.toList(), + watchers: newWatchers, watcherCount: updatedState.watcherCount, members: updatedState.members, membership: updatedState.membership, - read: newReads.toList(), + read: newReads, draft: updatedState.draft, pinnedMessages: updatedState.pinnedMessages, pendingMessages: updatedState.pendingMessages, diff --git a/packages/stream_chat/lib/src/client/client.dart b/packages/stream_chat/lib/src/client/client.dart index c707adb47f..0e7cf1c4e0 100644 --- a/packages/stream_chat/lib/src/client/client.dart +++ b/packages/stream_chat/lib/src/client/client.dart @@ -7,6 +7,8 @@ import 'package:rxdart/rxdart.dart'; import 'package:stream_core/stream_core.dart' show InFlightCache, + LocationCoordinate, + SortedListExtensions, StreamApiException, StreamLogConfig, StreamLogger, @@ -34,7 +36,6 @@ import '../core/models/draft.dart'; import '../core/models/draft_message.dart'; import '../core/models/event.dart'; import '../core/models/location.dart'; -import '../core/models/location_coordinates.dart'; import '../core/models/member.dart'; import '../core/models/message.dart'; import '../core/models/message_delivery.dart'; @@ -52,7 +53,6 @@ import '../core/platform_detector/platform_detector.dart'; import '../core/util/event_controller.dart'; import '../core/util/extension.dart'; import '../core/util/immutable_collection_subjects.dart'; -import '../core/util/list_extensions.dart'; import '../core/util/utils.dart'; import '../db/chat_persistence_client.dart'; import '../event_type.dart'; @@ -2152,7 +2152,7 @@ class StreamChatClient { Future updateLiveLocation({ required String messageId, String? createdByDeviceId, - LocationCoordinates? location, + LocationCoordinate? location, DateTime? endAt, }) { return _chatApi.user.updateLiveLocation( diff --git a/packages/stream_chat/lib/src/core/api/user_api.dart b/packages/stream_chat/lib/src/core/api/user_api.dart index 7ae0960c53..e10821081d 100644 --- a/packages/stream_chat/lib/src/core/api/user_api.dart +++ b/packages/stream_chat/lib/src/core/api/user_api.dart @@ -1,8 +1,9 @@ import 'dart:convert'; +import 'package:stream_core/stream_core.dart' show LocationCoordinate; + import '../http/stream_http_client.dart'; import '../models/location.dart'; -import '../models/location_coordinates.dart'; import '../models/user.dart'; import 'requests.dart'; import 'responses.dart'; @@ -111,7 +112,7 @@ class UserApi { Future updateLiveLocation({ required String messageId, String? createdByDeviceId, - LocationCoordinates? location, + LocationCoordinate? location, DateTime? endAt, }) async { final response = await _client.put( diff --git a/packages/stream_chat/lib/src/core/models/channel_state.dart b/packages/stream_chat/lib/src/core/models/channel_state.dart index c2bffc39dc..9d0a78afc9 100644 --- a/packages/stream_chat/lib/src/core/models/channel_state.dart +++ b/packages/stream_chat/lib/src/core/models/channel_state.dart @@ -1,7 +1,6 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stream_core/stream_core.dart' - show Filter, FilterField, NullOrdering, Sort, SortDirection, SortField, Standard; -import '../util/string_sort_normalizer.dart'; + show Filter, FilterField, NullOrdering, Sort, SortDirection, SortField, Standard, normalizeStringForSort; import 'channel_model.dart'; import 'draft.dart'; import 'location.dart'; diff --git a/packages/stream_chat/lib/src/core/models/location.dart b/packages/stream_chat/lib/src/core/models/location.dart index 7d0ed1b0d2..d4457e489d 100644 --- a/packages/stream_chat/lib/src/core/models/location.dart +++ b/packages/stream_chat/lib/src/core/models/location.dart @@ -1,7 +1,7 @@ import 'package:equatable/equatable.dart'; import 'package:json_annotation/json_annotation.dart'; +import 'package:stream_core/stream_core.dart' show LocationCoordinate; import 'channel_model.dart'; -import 'location_coordinates.dart'; import 'message.dart'; part 'location.g.dart'; @@ -101,12 +101,7 @@ class Location extends Equatable { bool get isStatic => endAt == null; /// Returns the coordinates of the shared location. - LocationCoordinates get coordinates { - return LocationCoordinates( - latitude: latitude, - longitude: longitude, - ); - } + LocationCoordinate get coordinates => .new(latitude: latitude, longitude: longitude); /// Serialize to json Map toJson() => _$LocationToJson(this); diff --git a/packages/stream_chat/lib/src/core/models/location_coordinates.dart b/packages/stream_chat/lib/src/core/models/location_coordinates.dart deleted file mode 100644 index f23389d7e6..0000000000 --- a/packages/stream_chat/lib/src/core/models/location_coordinates.dart +++ /dev/null @@ -1,33 +0,0 @@ -import 'package:equatable/equatable.dart'; - -/// {@template locationInfo} -/// A model class representing a location with latitude and longitude. -/// {@endtemplate} -class LocationCoordinates extends Equatable { - /// {@macro locationInfo} - const LocationCoordinates({ - required this.latitude, - required this.longitude, - }); - - /// The latitude of the location. - final double latitude; - - /// The longitude of the location. - final double longitude; - - /// Creates a copy of [LocationCoordinates] with specified attributes - /// overridden. - LocationCoordinates copyWith({ - double? latitude, - double? longitude, - }) { - return LocationCoordinates( - latitude: latitude ?? this.latitude, - longitude: longitude ?? this.longitude, - ); - } - - @override - List get props => [latitude, longitude]; -} diff --git a/packages/stream_chat/lib/src/core/models/member.dart b/packages/stream_chat/lib/src/core/models/member.dart index 868736ffba..aa354a5974 100644 --- a/packages/stream_chat/lib/src/core/models/member.dart +++ b/packages/stream_chat/lib/src/core/models/member.dart @@ -1,10 +1,10 @@ import 'package:equatable/equatable.dart'; import 'package:json_annotation/json_annotation.dart'; -import 'package:stream_core/stream_core.dart' show Filter, FilterField, Standard, Sort, SortField; +import 'package:stream_core/stream_core.dart' + show Filter, FilterField, Standard, Sort, SortField, normalizeStringForSort; import '../util/extension.dart'; import '../util/serializer.dart'; -import '../util/string_sort_normalizer.dart'; import 'user.dart'; part 'member.g.dart'; diff --git a/packages/stream_chat/lib/src/core/models/poll.dart b/packages/stream_chat/lib/src/core/models/poll.dart index 067bf521b5..47d96e8b61 100644 --- a/packages/stream_chat/lib/src/core/models/poll.dart +++ b/packages/stream_chat/lib/src/core/models/poll.dart @@ -1,11 +1,11 @@ import 'package:collection/collection.dart'; import 'package:equatable/equatable.dart'; import 'package:json_annotation/json_annotation.dart'; -import 'package:stream_core/stream_core.dart' show Filter, FilterField, Standard, Sort, SortField; +import 'package:stream_core/stream_core.dart' + show Filter, FilterField, Standard, Sort, SortField, normalizeStringForSort; import 'package:uuid/uuid.dart'; import '../util/serializer.dart'; -import '../util/string_sort_normalizer.dart'; import 'poll_option.dart'; import 'poll_vote.dart'; import 'user.dart'; diff --git a/packages/stream_chat/lib/src/core/models/user.dart b/packages/stream_chat/lib/src/core/models/user.dart index ab1e81632d..212ad30b30 100644 --- a/packages/stream_chat/lib/src/core/models/user.dart +++ b/packages/stream_chat/lib/src/core/models/user.dart @@ -1,10 +1,10 @@ import 'package:equatable/equatable.dart'; import 'package:json_annotation/json_annotation.dart'; -import 'package:stream_core/stream_core.dart' show Filter, FilterField, Standard, Sort, SortField; +import 'package:stream_core/stream_core.dart' + show Filter, FilterField, Standard, Sort, SortField, normalizeStringForSort; import '../util/extension.dart'; import '../util/serializer.dart'; -import '../util/string_sort_normalizer.dart'; part 'user.g.dart'; diff --git a/packages/stream_chat/lib/src/core/util/list_extensions.dart b/packages/stream_chat/lib/src/core/util/list_extensions.dart deleted file mode 100644 index 7b90fd03fc..0000000000 --- a/packages/stream_chat/lib/src/core/util/list_extensions.dart +++ /dev/null @@ -1,270 +0,0 @@ -// TODO(perf-migration): once `stream_chat` adopts `stream_core`, delete this -// file and import equivalents from -// `package:stream_core/src/utils/list_extensions.dart`. The signatures below -// mirror `stream_core`'s so the migration is a one-line import swap. The -// two-pointer `merge` here is a runtime optimization; `stream_core` does -// keyed-map-merge-and-sort. Both produce the same result for sorted inputs. - -import 'package:collection/collection.dart'; - -/// Useful extension functions for sorted [List]s. -extension SortedListX on List { - /// Inserts [element] into this sorted list at the correct position. - /// - /// Stable: equal elements land after existing ones. O(1) append/prepend - /// fast paths cover the steady state (new messages / paginated history); - /// otherwise O(log n) upper-bound binary search + O(n) splice. - List sortedInsert(T element, {required Comparator compare}) { - if (isEmpty) return [element]; - if (compare(last, element) <= 0) return [...this, element]; - if (compare(first, element) > 0) return [element, ...this]; - - final index = _upperBound(this, element, compare); - return [...this]..insert(index, element); - } - - /// Inserts or replaces [element] in this sorted list by [key]. - /// - /// Replaces in place when the replacement sorts to the same position; - /// otherwise removes the old and re-inserts via [sortedInsert]. - List sortedUpsert( - T element, { - required K Function(T item) key, - T Function(T original, T updated)? update, - required Comparator compare, - }) { - final elementKey = key(element); - final index = indexWhere((it) => key(it) == elementKey); - return sortedUpsertAt( - index, - element, - compare: compare, - update: update, - ); - } - - /// Like [sortedUpsert] but with the existing-element index pre-supplied by - /// the caller — useful when the caller already has the index from another - /// scan (e.g. an `oldMessage` lookup in the same code path). Avoids the - /// duplicate O(N) `indexWhere` that [sortedUpsert] would otherwise run. - /// - /// Pass `-1` for [existingIndex] when no matching element exists. - List sortedUpsertAt( - int existingIndex, - T element, { - required Comparator compare, - T Function(T original, T updated)? update, - }) { - if (existingIndex == -1) return sortedInsert(element, compare: compare); - - final original = this[existingIndex]; - final resolved = update != null ? update(original, element) : element; - - // Replace in place when sort position is unchanged. - if (compare(original, resolved) == 0) { - final result = [...this]; - result[existingIndex] = resolved; - return result; - } - - final removed = [...this]..removeAt(existingIndex); - return removed.sortedInsert(resolved, compare: compare); - } - - /// Merges this list with [other] via an O(N+M) two-pointer pass, with - /// duplicates deduplicated by [key]. - /// - /// The keyset of [other] takes precedence: any element of this list whose - /// key appears in [other] is dropped, and the [other] copy (optionally - /// passed through [update]) is emitted in its place. The output preserves - /// [compare] order. - /// - /// The receiver must already be sorted by [compare] (state classes that - /// hold sorted lists maintain this as an invariant). [other] is sorted - /// internally before the walk, so callers can pass it in any order. - /// - /// Returns the receiver unchanged (same reference) when [other] is null, - /// empty, or identical to this list — the identity short-circuit fires - /// before any sorting work is done. - List mergeSorted( - Iterable? other, { - required K Function(T item) key, - required Comparator compare, - T Function(T original, T updated)? update, - }) { - if (other == null) return this; - if (identical(other, this)) return this; - if (other.isEmpty) return this; - - T resolve(T original, T updated) { - if (update != null) return update(original, updated); - return updated; - } - - final otherList = other is List ? other : other.toList(growable: false); - final sortedOther = otherList.sorted(compare); - return _mergeSortedTwoPointer(this, sortedOther, key, compare, resolve); - } -} - -// Two-pointer merge of two pre-sorted lists. O(N + M), with duplicates -// (matched by [key]) resolved via [resolve]. -List _mergeSortedTwoPointer( - List a, - List b, - K Function(T item) key, - Comparator compare, - T Function(T original, T updated) resolve, -) { - // Keyset of `b` for O(1) dedup detection while walking `a`, plus a - // key→item lookup against `a` so we can resolve duplicates as we emit - // items from `b`. - final bKeys = {for (final item in b) key(item)}; - final aByKey = {for (final item in a) key(item): item}; - - final result = []; - var i = 0; - var j = 0; - while (i < a.length && j < b.length) { - final ai = a[i]; - if (bKeys.contains(key(ai))) { - i++; - continue; - } - final bj = b[j]; - if (compare(ai, bj) <= 0) { - result.add(ai); - i++; - } else { - final original = aByKey[key(bj)]; - result.add(original != null ? resolve(original, bj) : bj); - j++; - } - } - while (i < a.length) { - final ai = a[i++]; - if (!bKeys.contains(key(ai))) result.add(ai); - } - while (j < b.length) { - final bj = b[j++]; - final original = aByKey[key(bj)]; - result.add(original != null ? resolve(original, bj) : bj); - } - return result; -} - -// Upper-bound binary search — yields stable insertion (equals land after -// existing entries). -int _upperBound(List list, T element, Comparator compare) { - var start = 0; - var end = list.length; - while (start < end) { - final mid = start + ((end - start) >> 1); - if (compare(list[mid], element) <= 0) { - start = mid + 1; - } else { - end = mid; - } - } - return start; -} - -/// Useful extension functions for [Iterable]. -extension IterableMergeX on Iterable { - /// Merges this iterable with [other], deduplicating by [key]. - /// - /// Uses an O(N+M) keyed-map merge. The result is returned in insertion - /// order — items from this iterable first, new items from [other] last. - /// Duplicate keys within a single input collapse to the last occurrence. - /// Cross-list duplicates are resolved via [update] (defaults to - /// preferring the element from [other]). - /// - /// Output is **not** sorted. If you need a sorted result and both inputs - /// are pre-sorted, use [SortedListX.mergeSorted] instead. - /// - /// Returns the receiver unchanged (same reference) when [other] is null, - /// empty, or identical to this iterable. - Iterable merge( - Iterable? other, { - required K Function(T item) key, - T Function(T original, T updated)? update, - }) { - if (other == null) return this; - if (identical(other, this)) return this; - if (other.isEmpty) return this; - - T resolve(T original, T updated) { - if (update != null) return update(original, updated); - return updated; - } - - final itemMap = {for (final item in this) key(item): item}; - for (final item in other) { - itemMap.update( - key(item), - (original) => resolve(original, item), - ifAbsent: () => item, - ); - } - return itemMap.values; - } - - /// Merges this iterable with [other], where [other] is an iterable of a - /// **different type** [V]. - /// - /// Each item from [other] is converted to [T] via [value]; if [value] - /// returns `null`, that item is skipped. Useful for merging DTOs into a - /// model collection, or for projecting a nested field from a parent type - /// (e.g. merging `Message.sharedLocation` into a list of `Location`). - /// - /// Uses an O(N+M) keyed-map merge. The result is returned in insertion - /// order — items from this iterable first, new items from [other] last. - /// Cross-list duplicates are resolved via [update]. - /// - /// Returns the receiver unchanged (same reference) when [other] is null - /// or empty. - Iterable mergeFrom( - Iterable? other, { - required K Function(T item) key, - required T? Function(V item) value, - required T Function(T original, T updated) update, - }) { - if (other == null) return this; - if (other.isEmpty) return this; - - final itemMap = {for (final item in this) key(item): item}; - for (final otherItem in other) { - final item = value(otherItem); - if (item == null) continue; - itemMap.update( - key(item), - (original) => update(original, item), - ifAbsent: () => item, - ); - } - return itemMap.values; - } -} - -/// Useful extension functions for [List]. -extension ListX on List { - /// Returns a new list with elements matching [test] replaced by [update]. - /// - /// Returns the receiver unchanged (same reference) when nothing matches — - /// safe to use in stream pipelines that rely on reference equality to skip - /// work. - List updateIf( - bool Function(T item) test, - T Function(T item) update, - ) { - List? result; - for (var i = 0; i < length; i++) { - final item = this[i]; - if (test(item)) { - result ??= [...this]; - result[i] = update(item); - } - } - return result ?? this; - } -} diff --git a/packages/stream_chat/lib/src/core/util/message_merging.dart b/packages/stream_chat/lib/src/core/util/message_merging.dart index 94c297fabe..7280c44663 100644 --- a/packages/stream_chat/lib/src/core/util/message_merging.dart +++ b/packages/stream_chat/lib/src/core/util/message_merging.dart @@ -1,6 +1,7 @@ +import 'package:stream_core/stream_core.dart'; + import '../models/location.dart'; import '../models/message.dart'; -import 'list_extensions.dart'; import 'message_predicates.dart'; /// Provides the merge and removal operations reconciling incoming messages @@ -33,15 +34,14 @@ class MessageMerging { /// with the same key. Locations that are expired or whose attached message /// is deleted are dropped from the result. static Iterable mergeActiveLocations({ - required Iterable existing, + required List existing, required Iterable toMerge, }) { if (toMerge.isEmpty) return existing; - final mergedLocations = existing.mergeFrom( - toMerge, + final mergedLocations = existing.merge( + toMerge.map((it) => it.sharedLocation).nonNulls, key: (it) => (it.userId, it.channelCid, it.createdByDeviceId), - value: (message) => message.sharedLocation, update: (original, updated) => updated, ); @@ -119,9 +119,9 @@ class MessageMerging { // should display, so we can skip the rewrite entirely. if (!resolved.isDeleted) return mergedMessages; - return mergedMessages.updateIf( + return mergedMessages.updateWhere( (it) => it.quotedMessageId == resolved.id, - (it) => it.copyWith(quotedMessage: resolved), + update: (it) => it.copyWith(quotedMessage: resolved), ); } @@ -133,9 +133,9 @@ class MessageMerging { } // Batch path: receiver (`existingList`) is maintained sorted as a - // state invariant; `mergeSorted` sorts `toMergeList` internally and + // state invariant; `sortedMerge` sorts `toMergeList` internally and // returns a sorted result. - final mergedMessages = existingList.mergeSorted( + final mergedMessages = existingList.sortedMerge( toMergeList, key: (message) => message.id, update: update, @@ -143,16 +143,16 @@ class MessageMerging { ); // Refresh embedded `quotedMessage` refs only for messages quoting an - // incoming message that is now deleted. `updateIf` returns the same + // incoming message that is now deleted. `updateWhere` returns the same // list reference when nothing matches, so steady-state allocates // nothing for this step. final deletedIds = toMergeList.where((m) => m.isDeleted).map((m) => m.id).toSet(); if (deletedIds.isEmpty) return mergedMessages; final mergedById = {for (final m in mergedMessages) m.id: m}; - return mergedMessages.updateIf( + return mergedMessages.updateWhere( (it) => deletedIds.contains(it.quotedMessageId), - (it) => it.copyWith(quotedMessage: mergedById[it.quotedMessageId]), + update: (it) => it.copyWith(quotedMessage: mergedById[it.quotedMessageId]), ); } diff --git a/packages/stream_chat/lib/src/core/util/string_sort_normalizer.dart b/packages/stream_chat/lib/src/core/util/string_sort_normalizer.dart deleted file mode 100644 index 3934b59ec5..0000000000 --- a/packages/stream_chat/lib/src/core/util/string_sort_normalizer.dart +++ /dev/null @@ -1,95 +0,0 @@ -import 'package:diacritic/diacritic.dart'; -import 'package:meta/meta.dart'; - -const _maxAscii = 0x7F; -const _apostrophe = 0x0027; - -// Japanese: Hiragana + Katakana blocks. -const _hiraganaStart = 0x3040; -const _hiraganaEnd = 0x309F; -const _katakanaStart = 0x30A0; -const _katakanaEnd = 0x30FF; - -// Thai. -const _thaiStart = 0x0E00; -const _thaiEnd = 0x0E7F; - -// Vietnamese: tone-marked Latin range + unique letters (Đ/đ, Ơ/ơ, Ư/ư). -const _vietnameseToneStart = 0x1EA0; -const _vietnameseToneEnd = 0x1EF1; -const _vietnameseDUpper = 0x0110; -const _vietnameseDLower = 0x0111; -const _vietnameseOHornUpper = 0x01A0; -const _vietnameseOHornLower = 0x01A1; -const _vietnameseUHornUpper = 0x01AF; -const _vietnameseUHornLower = 0x01B0; - -/// Normalizes `value` into a client-side sort key that matches how the -/// backend sorts by name. -/// -/// Applied in order: -/// -/// 1. Fold Latin diacritics and ligatures — `é → e`, `Ł → l`, `Æ → ae`. -/// 2. Preserve Japanese, Thai, and Vietnamese-specific runes unchanged. -/// 3. Lowercase. -/// 4. Trim leading/trailing ASCII apostrophes (U+0027) then whitespace. -/// -/// Mirrors backend [`NormalizeName`][ref]. -/// -/// [ref]: https://github.com/GetStream/chat/blob/b92bf7991752a29e9f67b6ffe69b0bc529f5c48c/lib/combined/utils/text.go#L88-L95 -@internal -String normalizeStringForSort(String value) { - if (value.isEmpty) return value; - final folded = value.runes.map(_foldRune).join(); - return _trimApostropheEdges(folded.toLowerCase()).trim(); -} - -// Returns the sort form of `rune`. ASCII and preserved-script runes pass -// through unchanged; everything else routes through `removeDiacritics`. -String _foldRune(int rune) { - if (rune <= _maxAscii) return String.fromCharCode(rune); - if (_isJapaneseRune(rune)) return String.fromCharCode(rune); - if (_isThaiRune(rune)) return String.fromCharCode(rune); - if (_isVietnameseSpecificRune(rune)) return String.fromCharCode(rune); - - return removeDiacritics(String.fromCharCode(rune)); -} - -// Trims leading/trailing U+0027 apostrophes from `value`. Curly Unicode -// variants (U+2018, U+2019, U+201B) are intentionally not matched — -// mirrors the backend's `IsApostrophe` predicate. -String _trimApostropheEdges(String value) { - var start = 0; - var end = value.length; - while (start < end && value.codeUnitAt(start) == _apostrophe) { - start += 1; - } - while (end > start && value.codeUnitAt(end - 1) == _apostrophe) { - end -= 1; - } - if (start == 0 && end == value.length) return value; - - return value.substring(start, end); -} - -bool _isJapaneseRune(int rune) { - if (rune >= _hiraganaStart && rune <= _hiraganaEnd) return true; - if (rune >= _katakanaStart && rune <= _katakanaEnd) return true; - - return false; -} - -bool _isThaiRune(int rune) { - if (rune >= _thaiStart && rune <= _thaiEnd) return true; - - return false; -} - -bool _isVietnameseSpecificRune(int rune) { - if (rune >= _vietnameseToneStart && rune <= _vietnameseToneEnd) return true; - if (rune == _vietnameseDLower || rune == _vietnameseDUpper) return true; - if (rune == _vietnameseOHornLower || rune == _vietnameseOHornUpper) return true; - if (rune == _vietnameseUHornLower || rune == _vietnameseUHornUpper) return true; - - return false; -} diff --git a/packages/stream_chat/lib/stream_chat.dart b/packages/stream_chat/lib/stream_chat.dart index 5b692b2ba6..cf2917a269 100644 --- a/packages/stream_chat/lib/stream_chat.dart +++ b/packages/stream_chat/lib/stream_chat.dart @@ -24,17 +24,20 @@ export 'package:rate_limiter/rate_limiter.dart'; export 'package:stream_core/stream_core.dart' show CompositeComparator, + Distance, EvaluationOperator, Failure, Filter, FilterField, FilterOperator, + LocationCoordinate, LogicalOperator, NullOrdering, Result, Sort, SortDirection, SortField, + SortedListExtensions, StreamApiError, StreamApiException, StreamAuthenticationException, @@ -89,7 +92,6 @@ export 'src/core/models/draft.dart'; export 'src/core/models/draft_message.dart'; export 'src/core/models/event.dart'; export 'src/core/models/location.dart'; -export 'src/core/models/location_coordinates.dart'; export 'src/core/models/member.dart'; export 'src/core/models/message.dart'; export 'src/core/models/message_delete_scope.dart'; @@ -120,7 +122,6 @@ export 'src/core/models/user_group.dart'; export 'src/core/models/user_group_member.dart'; export 'src/core/platform_detector/platform_detector.dart'; export 'src/core/util/extension.dart'; -export 'src/core/util/list_extensions.dart'; export 'src/core/util/message_rules.dart'; export 'src/db/chat_persistence_client.dart'; export 'src/event_type.dart'; diff --git a/packages/stream_chat/test/src/client/channel/channel_client_state_test.dart b/packages/stream_chat/test/src/client/channel/channel_client_state_test.dart index 2184e10612..0fba91c60a 100644 --- a/packages/stream_chat/test/src/client/channel/channel_client_state_test.dart +++ b/packages/stream_chat/test/src/client/channel/channel_client_state_test.dart @@ -5760,7 +5760,7 @@ void main() { ); channel.state!.updateMessage(deleted); - // No message quotes `target`, so `updateIf` short-circuits and the + // No message quotes `target`, so `updateWhere` short-circuits and the // remaining messages keep their identities (only `target` itself was // replaced by `sortedUpsert`). final unrelatedAfter = channel.state!.messages.firstWhere((m) => m.id == 'u1'); @@ -5791,7 +5791,7 @@ void main() { channel.state!.updateMessage(target.copyWith(text: 'edited')); final quoterAfter = channel.state!.messages.firstWhere((m) => m.id == 'q1'); - // `updateIf` is gated on `message.isDeleted`, so the quoter must keep + // `updateWhere` is gated on `message.isDeleted`, so the quoter must keep // its identity (no allocation, no quoted-message overwrite). expect(identical(quoterAfter, quoterBefore), isTrue); }, diff --git a/packages/stream_chat/test/src/client/channel/channel_test.dart b/packages/stream_chat/test/src/client/channel/channel_test.dart index b507b9b4a4..58f5ac10ec 100644 --- a/packages/stream_chat/test/src/client/channel/channel_test.dart +++ b/packages/stream_chat/test/src/client/channel/channel_test.dart @@ -1079,7 +1079,7 @@ void main() { group('`.sendStaticLocation`', () { const deviceId = 'test-device-id'; const locationId = 'test-location-id'; - const coordinates = LocationCoordinates( + const coordinates = LocationCoordinate( latitude: 40.7128, longitude: -74.0060, ); @@ -1128,7 +1128,7 @@ void main() { const deviceId = 'test-device-id'; const locationId = 'test-location-id'; final endSharingAt = DateTime.timestamp().add(const Duration(hours: 1)); - const coordinates = LocationCoordinates( + const coordinates = LocationCoordinate( latitude: 40.7128, longitude: -74.0060, ); diff --git a/packages/stream_chat/test/src/client/client_test.dart b/packages/stream_chat/test/src/client/client_test.dart index 6d22d3b578..9910aa9be7 100644 --- a/packages/stream_chat/test/src/client/client_test.dart +++ b/packages/stream_chat/test/src/client/client_test.dart @@ -4048,7 +4048,7 @@ void main() { const messageId = 'test-message-id'; const createdByDeviceId = 'test-device-id'; final endAt = DateTime.timestamp().add(const Duration(hours: 1)); - const location = LocationCoordinates( + const location = LocationCoordinate( latitude: 40.7128, longitude: -74.0060, ); diff --git a/packages/stream_chat/test/src/core/api/user_api_test.dart b/packages/stream_chat/test/src/core/api/user_api_test.dart index 8ebd0bfaa7..7835e0d3ae 100644 --- a/packages/stream_chat/test/src/core/api/user_api_test.dart +++ b/packages/stream_chat/test/src/core/api/user_api_test.dart @@ -314,7 +314,7 @@ void main() { const messageId = 'test-message-id'; const createdByDeviceId = 'test-device-id'; final endAt = DateTime.timestamp().add(const Duration(hours: 1)); - const coordinates = LocationCoordinates( + const coordinates = LocationCoordinate( latitude: 40.7128, longitude: -74.0060, ); diff --git a/packages/stream_chat/test/src/core/models/location_test.dart b/packages/stream_chat/test/src/core/models/location_test.dart index 9b375e2643..cce5f9b53a 100644 --- a/packages/stream_chat/test/src/core/models/location_test.dart +++ b/packages/stream_chat/test/src/core/models/location_test.dart @@ -1,7 +1,7 @@ import 'package:stream_chat/src/core/models/channel_model.dart'; import 'package:stream_chat/src/core/models/location.dart'; -import 'package:stream_chat/src/core/models/location_coordinates.dart'; import 'package:stream_chat/src/core/models/message.dart'; +import 'package:stream_core/stream_core.dart' show LocationCoordinate; import 'package:test/test.dart'; void main() { @@ -139,7 +139,7 @@ void main() { test('should return correct coordinates', () { final coordinates = location.coordinates; - expect(coordinates, isA()); + expect(coordinates, isA()); expect(coordinates.latitude, equals(latitude)); expect(coordinates.longitude, equals(longitude)); }); diff --git a/packages/stream_chat/test/src/core/models/sort_comparison_test.dart b/packages/stream_chat/test/src/core/models/sort_comparison_test.dart index 7f783c80c0..9094b2ed99 100644 --- a/packages/stream_chat/test/src/core/models/sort_comparison_test.dart +++ b/packages/stream_chat/test/src/core/models/sort_comparison_test.dart @@ -3,9 +3,8 @@ import 'package:equatable/equatable.dart'; import 'package:stream_chat/src/core/models/channel_model.dart'; import 'package:stream_chat/src/core/models/channel_state.dart'; import 'package:stream_chat/src/core/models/member.dart'; -import 'package:stream_chat/src/core/util/string_sort_normalizer.dart'; import 'package:stream_core/stream_core.dart' - show CompositeComparator, NullOrdering, Sort, SortField, SortFieldValueGetter, Standard; + show CompositeComparator, NullOrdering, Sort, SortField, SortFieldValueGetter, Standard, normalizeStringForSort; import 'package:test/test.dart'; class TestModel extends Equatable { diff --git a/packages/stream_chat/test/src/core/models/sort_registry_test.dart b/packages/stream_chat/test/src/core/models/sort_registry_test.dart index 2791be1801..2c8005d183 100644 --- a/packages/stream_chat/test/src/core/models/sort_registry_test.dart +++ b/packages/stream_chat/test/src/core/models/sort_registry_test.dart @@ -11,9 +11,8 @@ import 'package:stream_chat/src/core/models/poll_vote.dart'; import 'package:stream_chat/src/core/models/reaction.dart'; import 'package:stream_chat/src/core/models/thread.dart'; import 'package:stream_chat/src/core/models/user.dart'; -import 'package:stream_chat/src/core/util/string_sort_normalizer.dart'; import 'package:stream_core/stream_core.dart' - show CompositeComparator, NullOrdering, Sort, SortField, SortFieldValueGetter, Standard; + show CompositeComparator, NullOrdering, Sort, SortField, SortFieldValueGetter, Standard, normalizeStringForSort; import 'package:test/test.dart'; class TestModel extends Equatable { diff --git a/packages/stream_chat/test/src/core/util/list_extensions_test.dart b/packages/stream_chat/test/src/core/util/list_extensions_test.dart deleted file mode 100644 index 86f2a72417..0000000000 --- a/packages/stream_chat/test/src/core/util/list_extensions_test.dart +++ /dev/null @@ -1,390 +0,0 @@ -import 'package:stream_chat/src/core/util/list_extensions.dart'; -import 'package:test/test.dart'; - -int _intCompare(int a, int b) => a.compareTo(b); - -class _Item { - const _Item(this.id, this.value, [this.tag = '']); - - final String id; - final int value; - final String tag; - - @override - String toString() => '_Item($id, $value, $tag)'; -} - -int _itemCompare(_Item a, _Item b) => a.value.compareTo(b.value); -String _itemKey(_Item it) => it.id; - -void main() { - group('SortedListX.sortedInsert', () { - test('inserts into the middle of a sorted list', () { - expect( - [1, 3, 5, 7].sortedInsert(4, compare: _intCompare), - [1, 3, 4, 5, 7], - ); - }); - - test('prepends when smaller than first element', () { - expect([2, 3, 4].sortedInsert(1, compare: _intCompare), [1, 2, 3, 4]); - }); - - test('appends when greater than last element', () { - expect([1, 2, 3].sortedInsert(4, compare: _intCompare), [1, 2, 3, 4]); - }); - - test('inserts into empty list', () { - expect([].sortedInsert(42, compare: _intCompare), [42]); - }); - - test('stable insertion: equal element lands after existing one', () { - const original = [ - _Item('a', 1, 'orig'), - _Item('b', 3, 'orig'), - ]; - final result = original.sortedInsert( - const _Item('c', 1, 'new'), - compare: _itemCompare, - ); - // New element with value=1 should land AFTER the existing value=1 entry. - expect(result.map((it) => it.id).toList(), ['a', 'c', 'b']); - }); - - test('does not modify the receiver', () { - final original = [1, 2, 3]; - // ignore: cascade_invocations - original.sortedInsert(4, compare: _intCompare); - expect(original, [1, 2, 3]); - }); - }); - - group('SortedListX.sortedUpsert', () { - test('inserts when no element with the key exists', () { - const original = [_Item('a', 1), _Item('c', 5)]; - final result = original.sortedUpsert( - const _Item('b', 3), - key: _itemKey, - compare: _itemCompare, - ); - expect(result.map((it) => it.id).toList(), ['a', 'b', 'c']); - }); - - test('replaces in place when sort position is unchanged', () { - const original = [_Item('a', 1), _Item('b', 3), _Item('c', 5)]; - final result = original.sortedUpsert( - const _Item('b', 3, 'updated'), - key: _itemKey, - compare: _itemCompare, - ); - expect(result.map((it) => it.tag).toList(), ['', 'updated', '']); - }); - - test('removes + re-inserts when sort position changes', () { - const original = [_Item('a', 1), _Item('b', 3), _Item('c', 5)]; - final result = original.sortedUpsert( - const _Item('b', 7), // was 3, now 7 — should move past 'c' - key: _itemKey, - compare: _itemCompare, - ); - expect(result.map((it) => it.id).toList(), ['a', 'c', 'b']); - }); - - test('uses update callback when provided', () { - const original = [_Item('a', 1, 'keep')]; - final result = original.sortedUpsert( - const _Item('a', 1, 'incoming'), - key: _itemKey, - compare: _itemCompare, - update: (orig, upd) => _Item(orig.id, orig.value, '${orig.tag}+merged'), - ); - expect(result.single.tag, 'keep+merged'); - }); - - test('does not modify the receiver', () { - final original = [const _Item('a', 1)]; - // ignore: cascade_invocations - original.sortedUpsert( - const _Item('b', 2), - key: _itemKey, - compare: _itemCompare, - ); - expect(original.length, 1); - }); - }); - - group('SortedListX.sortedUpsertAt', () { - test('inserts via sortedInsert when index is -1', () { - const original = [_Item('a', 1), _Item('c', 5)]; - final result = original.sortedUpsertAt( - -1, - const _Item('b', 3), - compare: _itemCompare, - ); - expect(result.map((it) => it.id).toList(), ['a', 'b', 'c']); - }); - - test('replaces in place when sort position is unchanged', () { - const original = [_Item('a', 1), _Item('b', 3), _Item('c', 5)]; - final result = original.sortedUpsertAt( - 1, - const _Item('b', 3, 'updated'), - compare: _itemCompare, - ); - expect(result.map((it) => it.tag).toList(), ['', 'updated', '']); - }); - - test('removes + re-inserts when sort position changes', () { - const original = [_Item('a', 1), _Item('b', 3), _Item('c', 5)]; - final result = original.sortedUpsertAt( - 1, - const _Item('b', 7), - compare: _itemCompare, - ); - expect(result.map((it) => it.id).toList(), ['a', 'c', 'b']); - }); - - test('matches sortedUpsert when caller passes the same index', () { - const original = [_Item('a', 1), _Item('b', 3), _Item('c', 5)]; - final viaUpsert = original.sortedUpsert( - const _Item('b', 4, 'x'), - key: _itemKey, - compare: _itemCompare, - ); - final viaUpsertAt = original.sortedUpsertAt( - 1, - const _Item('b', 4, 'x'), - compare: _itemCompare, - ); - expect(viaUpsertAt, viaUpsert); - }); - }); - - group('SortedListX.merge', () { - test('returns this when other is null', () { - final original = [1, 2, 3]; - expect(identical(original.merge(null, key: (it) => it), original), true); - }); - - test('returns this when other is empty', () { - final original = [1, 2, 3]; - expect( - identical(original.merge(const [], key: (it) => it), original), - true, - ); - }); - - test('returns this when other is identical to this', () { - final original = [1, 2, 3]; - expect( - identical(original.merge(original, key: (it) => it), original), - true, - ); - }); - - test('appends new items from other', () { - final result = [const _Item('a', 1)].merge( - const [_Item('b', 2)], - key: _itemKey, - ); - expect(result.map((it) => it.id).toList(), ['a', 'b']); - }); - - test('default update: prefers the element from other', () { - final result = [const _Item('a', 1, 'old')].merge( - const [_Item('a', 2, 'new')], - key: _itemKey, - ); - expect(result.single.tag, 'new'); - }); - - test('custom update resolves duplicates', () { - final result = [const _Item('a', 1, 'old')].merge( - const [_Item('a', 2, 'new')], - key: _itemKey, - update: (orig, upd) => _Item(orig.id, upd.value, '${orig.tag}+merged'), - ); - expect(result.single.tag, 'old+merged'); - }); - - test('preserves insertion order — `this` first, new items from `other`', () { - // Map iteration preserves insertion order in Dart — items from `this` - // come first, then new items from `other`. - final result = [const _Item('a', 1)].merge( - const [_Item('b', 2)], - key: _itemKey, - ); - expect(result.map((it) => it.id).toList(), ['a', 'b']); - }); - }); - - group('SortedListX.mergeSorted', () { - test('returns this when other is null', () { - final original = [1, 2, 3]; - expect( - identical( - original.mergeSorted(null, key: (it) => it, compare: _intCompare), - original, - ), - true, - ); - }); - - test('returns this when other is empty', () { - final original = [1, 2, 3]; - expect( - identical( - original.mergeSorted( - const [], - key: (it) => it, - compare: _intCompare, - ), - original, - ), - true, - ); - }); - - test('returns this when other is identical to this', () { - final original = [1, 2, 3]; - expect( - identical( - original.mergeSorted( - original, - key: (it) => it, - compare: _intCompare, - ), - original, - ), - true, - ); - }); - - test('sorts `other` internally when it is unsorted', () { - const existing = [_Item('a', 1), _Item('c', 5)]; - // `other` is unsorted on purpose — value 7 comes before value 3. - const incoming = [_Item('d', 7), _Item('b', 3)]; - final result = existing.mergeSorted( - incoming, - key: _itemKey, - compare: _itemCompare, - ); - expect(result.map((it) => it.value).toList(), [1, 3, 5, 7]); - }); - - test('appends non-overlapping `other` (livestream)', () { - const existing = [_Item('a', 1), _Item('b', 3)]; - const incoming = [_Item('c', 5), _Item('d', 7)]; - final result = existing.mergeSorted( - incoming, - key: _itemKey, - compare: _itemCompare, - ); - expect(result.map((it) => it.id).toList(), ['a', 'b', 'c', 'd']); - }); - - test('prepends non-overlapping `other` (pagination)', () { - const existing = [_Item('c', 5), _Item('d', 7)]; - const incoming = [_Item('a', 1), _Item('b', 3)]; - final result = existing.mergeSorted( - incoming, - key: _itemKey, - compare: _itemCompare, - ); - expect(result.map((it) => it.id).toList(), ['a', 'b', 'c', 'd']); - }); - - test('merges pre-sorted lists in sorted order', () { - const existing = [_Item('a', 1), _Item('c', 5), _Item('e', 9)]; - const incoming = [_Item('b', 3), _Item('d', 7)]; - final result = existing.mergeSorted( - incoming, - key: _itemKey, - compare: _itemCompare, - ); - expect(result.map((it) => it.id).toList(), ['a', 'b', 'c', 'd', 'e']); - }); - - test('applies update on key collisions', () { - const existing = [_Item('a', 1), _Item('b', 3, 'orig')]; - const incoming = [_Item('b', 3, 'new'), _Item('c', 5)]; - final result = existing.mergeSorted( - incoming, - key: _itemKey, - update: (orig, upd) => _Item(orig.id, upd.value, '${orig.tag}+merged'), - compare: _itemCompare, - ); - expect(result.map((it) => it.tag).toList(), ['', 'orig+merged', '']); - }); - - test('tolerates duplicate keys in the receiver', () { - // The merge does not enforce input uniqueness. Duplicates in the - // receiver whose keys don't appear in `other` are propagated through - // and the sorted invariant is preserved. - const withDupes = [_Item('a', 1), _Item('a', 2)]; - final result = withDupes.mergeSorted( - const [_Item('b', 3)], - key: _itemKey, - compare: _itemCompare, - ); - expect( - result.map((it) => '${it.id}:${it.value}'), - ['a:1', 'a:2', 'b:3'], - ); - }); - - test('tolerates duplicate keys in `other`', () { - const sorted = [_Item('a', 1)]; - final result = sorted.mergeSorted( - const [_Item('b', 2), _Item('b', 3)], - key: _itemKey, - compare: _itemCompare, - ); - expect( - result.map((it) => '${it.id}:${it.value}'), - ['a:1', 'b:2', 'b:3'], - ); - }); - - test( - 'receiver duplicates are dropped when `other` contains the same key', - () { - // When the duplicate-keyed entries in the receiver collide with a - // key from `other`, all receiver copies are dropped — the keyset of - // `other` takes precedence. - const withDupes = [_Item('a', 1), _Item('a', 2)]; - final result = withDupes.mergeSorted( - const [_Item('a', 5, 'from-other'), _Item('b', 7)], - key: _itemKey, - compare: _itemCompare, - ); - expect( - result.map((it) => '${it.id}:${it.value}:${it.tag}'), - ['a:5:from-other', 'b:7:'], - ); - }, - ); - }); - - group('ListX.updateIf', () { - test('replaces matching elements', () { - expect( - [1, 2, 3, 4].updateIf((n) => n.isEven, (n) => n * 10), - [1, 20, 3, 40], - ); - }); - - test('returns the receiver unchanged when nothing matches', () { - final original = [1, 3, 5]; - final result = original.updateIf((n) => n.isEven, (n) => n * 10); - expect(identical(result, original), true); - }); - - test('does not modify the receiver', () { - final original = [1, 2, 3]; - // ignore: cascade_invocations - original.updateIf((n) => n.isEven, (n) => n * 10); - expect(original, [1, 2, 3]); - }); - }); -} diff --git a/packages/stream_chat/test/src/core/util/string_sort_normalizer_test.dart b/packages/stream_chat/test/src/core/util/string_sort_normalizer_test.dart deleted file mode 100644 index 931d853024..0000000000 --- a/packages/stream_chat/test/src/core/util/string_sort_normalizer_test.dart +++ /dev/null @@ -1,142 +0,0 @@ -import 'package:stream_chat/src/core/util/string_sort_normalizer.dart'; -import 'package:test/test.dart'; - -void main() { - group('normalizeStringForSort', () { - // Cases mirror the backend's `TestNormalizeName` at - // https://github.com/GetStream/chat/blob/b92bf7991752a29e9f67b6ffe69b0bc529f5c48c/lib/combined/utils/text_test.go#L300-L341 - // so any drift between client and server for these inputs shows up here. - group('backend TestNormalizeName parity', () { - const cases = <(String description, String input, String expected)>[ - ('empty', '', ''), - ('simple lowercase', 'hello', 'hello'), - ('uppercase', 'HELLO', 'hello'), - ('mixed case', 'Hello World', 'hello world'), - - // Backend guarantees NormalizeName never stems — same for us. - ('no stem running', 'running', 'running'), - ('no stem dogs', 'dogs', 'dogs'), - - // Diacritic folding. - ('diacritics', 'résumé', 'resume'), - ('turkish', 'Günaydın', 'gunaydin'), - - // Apostrophe handling: inner apostrophe preserved, only trailing/ - // leading U+0027 apostrophes are trimmed. - ('apostrophe', "O'Brien", "o'brien"), - - // NormalizeName does NOT apply space normalization, so symbols pass - // through. - ('numbers and symbols preserved', '123!@#', '123!@#'), - ]; - - for (final (description, input, expected) in cases) { - test(description, () { - expect(normalizeStringForSort(input), expected); - }); - } - }); - - // Vietnamese-preserved chars must survive the fold — the backend keeps - // them out of `UnicodeNormalizationMap` via `IsVietnameseSpecificRune`. - group('Vietnamese preservation', () { - test('preserves đ / Đ (U+0110 / U+0111)', () { - expect(normalizeStringForSort('Đăng'), 'đang'); // ă folds to a - expect(normalizeStringForSort('đủ'), 'đủ'); // đ + ủ both Vietnamese - }); - - test('preserves ơ / Ơ, ư / Ư (horn letters)', () { - expect(normalizeStringForSort('Ơn'), 'ơn'); - expect(normalizeStringForSort('Ư'), 'ư'); - }); - - test('preserves the U+1EA0..U+1EF1 tone-marked block', () { - // "Tiếng Việt rất đẹp và phức tạp" — the "và" folds (à not - // Vietnamese-specific); everything else with tone marks stays. - // Matches the backend's `NormalizeText` expected output for the - // same input at text_test.go:152. - expect( - normalizeStringForSort('Tiếng Việt rất đẹp và phức tạp'), - 'tiếng việt rất đẹp va phức tạp', - ); - }); - - test('non-preserved diacritics on shared Latin letters still fold', () { - // `ă` (U+0103, A-with-breve) is used in Vietnamese but is NOT in - // the preserved ranges — backend folds it too. - expect(normalizeStringForSort('Ăn'), 'an'); - }); - }); - - group('ligatures and stroked letters (per diacritic package)', () { - test('folds Ł, Ø, Æ, Þ', () { - expect(normalizeStringForSort('Łukasz'), 'lukasz'); - expect(normalizeStringForSort('Øystein'), 'oystein'); - expect(normalizeStringForSort('Ægon'), 'aegon'); - expect(normalizeStringForSort('Þór'), 'thor'); - }); - - test('strips decomposed combining marks (U+0300..U+036F)', () { - // 'e' + U+0301 (combining acute) — should decompose to 'e'. - expect(normalizeStringForSort('éowyn'), 'eowyn'); - }); - }); - - // Backend's `Normalize` early-exits on Japanese (Hiragana / Katakana), - // Thai, and Vietnamese-specific runes so they aren't touched by the - // diacritic-fold or combining-mark strip. We mirror that. - group('script preservation', () { - test('preserves Hiragana', () { - expect(normalizeStringForSort('こんにちは'), 'こんにちは'); - }); - - test('preserves Katakana', () { - expect(normalizeStringForSort('カタカナ'), 'カタカナ'); - }); - - test('preserves Thai (including combining marks in the Thai block)', () { - // Thai vowels ั / ี are combining marks (Unicode `Mn`) outside - // U+0300..U+036F, so they'd survive `diacritic` regardless, but the - // explicit preservation makes intent match backend. - expect(normalizeStringForSort('สวัสดี'), 'สวัสดี'); - }); - - test('mixed script: Latin folds, Japanese passes through', () { - expect(normalizeStringForSort('Hi こんにちは'), 'hi こんにちは'); - }); - - test('preserves Japanese combining sound marks (U+3099, U+309A)', () { - // U+3099 and U+309A are `Mn` category codepoints that live inside - // the Hiragana range — a decomposed `が` is `か` + U+3099. Without - // the Japanese-range early exit, an aggressive combining-mark - // strip would drop the sound mark and lose phonetic information. - const kaVoiced = 'が'; // か + combining voiced sound mark - const kaSemi = 'か゚'; // か + combining semi-voiced sound mark - - expect(normalizeStringForSort(kaVoiced), kaVoiced); - expect(normalizeStringForSort(kaSemi), kaSemi); - }); - }); - - group('trimming', () { - test('strips only U+0027 apostrophes from both ends', () { - expect(normalizeStringForSort("'Ali"), 'ali'); - expect(normalizeStringForSort("Ali'"), 'ali'); - expect(normalizeStringForSort("'Ali'"), 'ali'); - }); - - test('curly Unicode apostrophes (U+2019) are not trimmed', () { - expect(normalizeStringForSort('’Ali'), '’ali'); - }); - - test('trims surrounding whitespace after apostrophes', () { - expect(normalizeStringForSort(' Ali '), 'ali'); - // Backend runs `TrimApostrophe` before `TrimSpace` in a single pass, - // so surrounding whitespace shields inner apostrophes: the outer - // spaces prevent apostrophe trimming, then only the spaces get - // stripped. Client mirrors this exactly. - expect(normalizeStringForSort(" 'Ali' "), "'ali'"); - }); - }); - }); -} diff --git a/packages/stream_chat_flutter_core/lib/src/stream_channel_list_controller.dart b/packages/stream_chat_flutter_core/lib/src/stream_channel_list_controller.dart index dffec3233c..f4a7a60967 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_channel_list_controller.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_channel_list_controller.dart @@ -2,8 +2,6 @@ import 'dart:async'; import 'dart:math'; import 'package:stream_chat/stream_chat.dart' hide Success; -import 'package:stream_core/stream_core.dart' show SortedListExtensions; - import 'paged_value_notifier.dart'; import 'stream_channel_list_event_handler.dart'; diff --git a/packages/stream_chat_flutter_core/lib/src/stream_draft_list_controller.dart b/packages/stream_chat_flutter_core/lib/src/stream_draft_list_controller.dart index 980b8cbee8..dcf81c2f5c 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_draft_list_controller.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_draft_list_controller.dart @@ -2,7 +2,6 @@ import 'dart:async'; import 'dart:math'; import 'package:stream_chat/stream_chat.dart'; -import 'package:stream_core/stream_core.dart' show SortedListExtensions; import 'paged_value_notifier.dart'; import 'stream_draft_list_event_handler.dart'; diff --git a/packages/stream_chat_flutter_core/lib/src/stream_member_list_controller.dart b/packages/stream_chat_flutter_core/lib/src/stream_member_list_controller.dart index ba1bf2d028..42a33464b9 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_member_list_controller.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_member_list_controller.dart @@ -2,7 +2,6 @@ import 'dart:async'; import 'dart:math'; import 'package:stream_chat/stream_chat.dart' hide Success; -import 'package:stream_core/stream_core.dart' show SortedListExtensions; import 'paged_value_notifier.dart'; import 'search_debounce_mixin.dart'; import 'search_debouncer.dart'; diff --git a/packages/stream_chat_flutter_core/lib/src/stream_message_reminder_list_controller.dart b/packages/stream_chat_flutter_core/lib/src/stream_message_reminder_list_controller.dart index 383839a5b1..10db0cc0d7 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_message_reminder_list_controller.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_message_reminder_list_controller.dart @@ -4,7 +4,6 @@ import 'dart:async'; import 'dart:math'; import 'package:stream_chat/stream_chat.dart'; -import 'package:stream_core/stream_core.dart' show SortedListExtensions; import 'paged_value_notifier.dart'; import 'stream_message_reminder_list_event_handler.dart'; diff --git a/packages/stream_chat_flutter_core/lib/src/stream_poll_vote_list_controller.dart b/packages/stream_chat_flutter_core/lib/src/stream_poll_vote_list_controller.dart index cd6e95b4af..27800c8d8c 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_poll_vote_list_controller.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_poll_vote_list_controller.dart @@ -2,7 +2,6 @@ import 'dart:async'; import 'dart:math'; import 'package:stream_chat/stream_chat.dart'; -import 'package:stream_core/stream_core.dart' show SortedListExtensions; import 'paged_value_notifier.dart'; /// The default channel page limit to load. diff --git a/packages/stream_chat_flutter_core/lib/src/stream_reaction_list_controller.dart b/packages/stream_chat_flutter_core/lib/src/stream_reaction_list_controller.dart index 188eb29579..d69a39b1f9 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_reaction_list_controller.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_reaction_list_controller.dart @@ -2,7 +2,6 @@ import 'dart:async'; import 'dart:math'; import 'package:stream_chat/stream_chat.dart' hide Success; -import 'package:stream_core/stream_core.dart' show SortedListExtensions; import 'paged_value_notifier.dart'; /// The default reaction list page limit to load. diff --git a/packages/stream_chat_flutter_core/lib/src/stream_thread_list_controller.dart b/packages/stream_chat_flutter_core/lib/src/stream_thread_list_controller.dart index 3766f5f9d8..7cffd2ea80 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_thread_list_controller.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_thread_list_controller.dart @@ -4,7 +4,6 @@ import 'dart:math'; import 'package:collection/collection.dart'; import 'package:flutter/foundation.dart'; import 'package:stream_chat/stream_chat.dart'; -import 'package:stream_core/stream_core.dart' show SortedListExtensions; import 'paged_value_notifier.dart'; import 'stream_thread_list_event_handler.dart'; diff --git a/packages/stream_chat_flutter_core/lib/src/stream_user_list_controller.dart b/packages/stream_chat_flutter_core/lib/src/stream_user_list_controller.dart index 604c75acc7..df8d65eae4 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_user_list_controller.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_user_list_controller.dart @@ -2,7 +2,6 @@ import 'dart:async'; import 'dart:math'; import 'package:stream_chat/stream_chat.dart' hide Success; -import 'package:stream_core/stream_core.dart' show SortedListExtensions; import 'paged_value_notifier.dart'; import 'search_debounce_mixin.dart'; import 'search_debouncer.dart'; diff --git a/packages/stream_chat_persistence/lib/src/stream_chat_persistence_client.dart b/packages/stream_chat_persistence/lib/src/stream_chat_persistence_client.dart index 25499b45b7..0cb2ca066c 100644 --- a/packages/stream_chat_persistence/lib/src/stream_chat_persistence_client.dart +++ b/packages/stream_chat_persistence/lib/src/stream_chat_persistence_client.dart @@ -375,8 +375,8 @@ class StreamChatPersistenceClient extends ChatPersistenceClient { } // 3) Sort using the comparator — on envelopes instead of fully-hydrated - // states. - envelopes.sort(sort.compare); + // states. Stable, so the offset below cannot skip or repeat a tied cid. + envelopes = envelopes.sortedWith(sort.compare); // 4) Slice the page. final total = envelopes.length; diff --git a/sample_app/lib/utils/shared_location_service.dart b/sample_app/lib/utils/shared_location_service.dart index cdaf07cbb6..d344e454dd 100644 --- a/sample_app/lib/utils/shared_location_service.dart +++ b/sample_app/lib/utils/shared_location_service.dart @@ -70,7 +70,7 @@ class SharedLocationService { _client.updateLiveLocation( messageId: messageId, createdByDeviceId: location.createdByDeviceId, - location: LocationCoordinates( + location: LocationCoordinate( latitude: position.latitude, longitude: position.longitude, ), diff --git a/sample_app/lib/widgets/location/location_picker_dialog.dart b/sample_app/lib/widgets/location/location_picker_dialog.dart index 78696d5eb6..56550be3dc 100644 --- a/sample_app/lib/widgets/location/location_picker_dialog.dart +++ b/sample_app/lib/widgets/location/location_picker_dialog.dart @@ -14,7 +14,7 @@ class LocationPickerResult { }); final DateTime? endSharingAt; - final LocationCoordinates coordinates; + final LocationCoordinate coordinates; @override bool operator ==(Object other) { @@ -59,7 +59,7 @@ class LocationPickerDialog extends StatefulWidget { } class _LocationPickerDialogState extends State with WidgetsBindingObserver { - LocationCoordinates? _currentLocation; + LocationCoordinate? _currentLocation; /// After opening app settings, reload location when the user returns. bool _retryLocationAfterResume = false; @@ -115,7 +115,7 @@ class _LocationPickerDialogState extends State with Widget return Center(child: LocationNotFound(onOpenAppSettings: _openAppSettingsForPermission)); } - final coordinates = _currentLocation = LocationCoordinates( + final coordinates = _currentLocation = LocationCoordinate( latitude: position.latitude, longitude: position.longitude, ); diff --git a/sample_app/lib/widgets/simple_map_view.dart b/sample_app/lib/widgets/simple_map_view.dart index 5cced8afc4..3666ebb678 100644 --- a/sample_app/lib/widgets/simple_map_view.dart +++ b/sample_app/lib/widgets/simple_map_view.dart @@ -27,7 +27,7 @@ class SimpleMapView extends StatefulWidget { final MarkerSize markerSize; - final LocationCoordinates coordinates; + final LocationCoordinate coordinates; final bool showLocateMeButton; @@ -148,6 +148,6 @@ class SimpleMapLocateMeButton extends StatelessWidget { } } -extension on LocationCoordinates { +extension on LocationCoordinate { LatLng toLatLng() => LatLng(latitude, longitude); } From 752b13cfd18b40a52ecf0808be60fff3641be29a Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Tue, 15 Sep 2026 16:38:51 +0200 Subject: [PATCH 07/36] refactor(llc, ui)!: adopt stream_core's platform detector and sealed exception family (#2960) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor(llc)!: adopt stream_core's platform detector `CurrentPlatform` and `PlatformType` were a near-verbatim fork of core's. Deleting ours drops the `js_interop` branch chat needed only because its own stub threw; core's non-`io` fallback answers `web` directly. BREAKING CHANGE: `CurrentPlatform.name` is now `CurrentPlatform.operatingSystem` and reports the same string. Both types are re-exported from this package, so an import of `stream_chat.dart` needs no change. Co-Authored-By: Claude Opus 5 (1M context) * refactor(llc)!: adopt stream_core's sealed exception family Replaces our error class tree with core's four `StreamException` kinds and deletes `stream_chat_error.dart` outright. Two of its types were scheduled to outlive this phase; neither needed to. Nothing raised `StreamChatNetworkError` once the verb facade threw a `StreamException`, and the socket path maps onto core's kinds without waiting for the new transport. Deleting beats deprecating here: nothing throws the old types, so a deprecated `on StreamChatNetworkError catch` would keep compiling and silently match nothing. Removing them turns that into a compile error. Also fixes five `is` checks on the old type that had gone unreachable — four `scheduleRetry` gates in `channel.dart` and the `sync` 400 recovery in `client.dart`. A failed message was never queued for retry, and an app with a stale `last_sync_at` could not heal. The tests covering them asserted message state rather than the queue, so they passed against dead branches. BREAKING CHANGE: `StreamChatError`, `StreamChatNetworkError`, `StreamChatNetworkErrorType`, `StreamWebSocketError` and `ChatErrorCode` are removed. Catch `StreamChatException` — an alias of core's sealed root — or one of `StreamApiException`, `StreamNetworkException`, `StreamAuthenticationException` or `StreamClientException`. `isRetriable` is now an extension on the alias, and `stream_chat_flutter`'s three attachment-validation errors moved to their own sealed `AttachmentValidationError` family. See migrations/v11-migration.md. Co-Authored-By: Claude Opus 5 (1M context) * docs(repo): close the token and auth phase A live anonymous connect against a real app key succeeds, which was the last open item. Records why that had to be tested rather than argued. Reading the backend source end to end predicted the opposite: `handshake` validates before it authenticates, `ConnectUserDetails.ID` carries `validate:"userID,required"`, and that tag's regex does not match `!anon`. Every link holds on its own and the conclusion was still wrong, on a path the backend has no test for either. Why the request passes is left unexplained rather than guessed at. What does survive is that the server discards the client's id on the anonymous path — it rebuilds its own user — so the switch to `!anon` could not have changed behaviour there. Co-Authored-By: Claude Opus 5 (1M context) * style(llc): split the token provider call across lines Co-Authored-By: Claude Opus 5 (1M context) * test(llc): pin the interceptor pipeline order The existing interceptor tests assert each type is present, which a fully reordered pipeline satisfies just as well, and `ApiErrorInterceptor` had no test at all. Order is behaviour here: anything rejecting ahead of `ApiErrorInterceptor` escapes as a raw `DioException`, and anything logging ahead of it logs the transport error rather than the mapped one. Verified the assertion fails on a swap rather than only passing as written. Also corrects the phase doc, which recorded "six verbs, not eight" as done. `fetch` and `request` are still on the facade with no caller in `lib/`; they go when `StreamHttpClient` becomes `@internal` in phase 09, rather than breaking a public class twice. Co-Authored-By: Claude Opus 5 (1M context) * docs(repo): re-point the uploads phase at what 05 actually did Phase 09 assumed 05 would delete `StreamHttpClient`, which would have forced `AttachmentFileUploaderProvider` to be retyped. 05 kept it instead — it is the verb facade — so the typedef compiles unchanged and nothing forces the retype. What was an obligation is now a choice, and the two phases pull opposite ways: leaving the typedef alone keeps 05's `@internal` item open. Co-Authored-By: Claude Opus 5 (1M context) * docs(repo): record that the branch needs an unreleased stream_core `melos.yaml` declares `stream_core: ^0.5.0` but `dependencyOverridePaths` resolves it to the sibling checkout, whose pubspec also says 0.5.0 while carrying APIs the published version does not. Every local run has therefore been green against code no consumer can get. Chat already depends on five of them: `debugCurrentPlatformOverride`, `sortedMerge`/`sortedUpsertAt`, `normalizeStringForSort`, `Filter.raw` and element-wise array matching. `Filter.raw` is the sharpest — persistence's filter converter and `PredefinedFilter` both need it. Also drops the rows this migration has since closed, and fixes UPSTREAM's closing advice, which still named `$nor` (dropped) and `debugCurrentPlatformOverride` (landed) as what to push first. Co-Authored-By: Claude Opus 5 (1M context) * docs(repo): remove the contradictions a cold reader would trip on Three places said the opposite of what this stack does, each true when written and stale a rung or two later. The migration guide carried both halves of a reversed decision in one blockquote: the paragraph saying `StreamChatNetworkError` is deprecated, telling readers "the deprecation warning tells you where", directly above the paragraph saying it is deleted. The first was mine — I appended the replacement without removing what it replaced. A reader upgrading would have searched for warnings that never appear, because the type is gone and the failure is a compile error. Phase 02's doc still said "merging is gated on a core release" and marked the platform detector blocked, in the PR that deletes it, with its own definition-of-done fully ticked. `DEFERRED.md` described the resolution mechanism as `dependencyOverridePaths` against a sibling checkout, which is what it *was* before CI proved it only works on a machine that has one. And the schema version reads `1102`, which is what the database declares. Co-Authored-By: Claude Opus 5 (1M context) * fix(llc)!: classify each failure as ERROR_LAYER.md says to Three corrections against the spec, all in the sealed family this branch adopts. A cancellation is a cancelled request. A send superseded by a later one, and a pending upload dropped because its message was deleted, were `StreamClientException` — the kind whose documented reaction is "report to your crash tracker". They are now `StreamNetworkException` with `isCancelled` set, which is how a cancelled attachment upload was already reported two hundred lines away. Misuse is not in the hierarchy at all. Connecting twice, opening a connection that is already open, `queryChannels` without one, a persistence client that is not set or belongs to another user, and cancelling an upload that never started — all say fix the call rather than handle the failure, so they raise `StateError`. `queryChannels` without a connection is close to the spec's own example. An upload failure said `Failed to upload one or more attachments` and nothing else. It now names which ones and what each reported. A real `cause` is out of reach until `UploadStateFailed` holds more than a string, which is phase 09's model swap. Co-Authored-By: Claude Opus 5 (1M context) * docs(repo): let the README say what is true at the tip The rung that introduced these paragraphs states them as of itself, and they flow up unchanged, so by here three had gone stale. The collision list is down to `AttachmentFile` and `User`: the query DSL, the platform detector, the token and interceptor types and the logger types are all core's by now. Nothing upstream is blocking either — phase 08's changes shipped in stream-core-flutter#181, and the operators an earlier pass called a hard block turned out not to be asks at all. 07's findings do reach its own file by this rung, so the parked note can point at them again. Co-Authored-By: Claude Opus 5 (1M context) * docs(repo): correct the sorting section a reader would follow The section still described `sort: null` as coercing to the default — the setter no longer takes null, and `XSort.empty` is what sends none — and told every poll-vote caller to undo a default flip that was reverted before it shipped. Co-Authored-By: Claude Opus 5 (1M context) * fix(ui): drop the duplicate @override left by removing props `AttachmentBlockedError.toString` carried the annotation from the deleted `props` getter as well as its own. Co-Authored-By: Claude Opus 5 (1M context) * docs(ui): say what addAttachment throws The `value` setter beside it already documents its refusal; this one threw the same family silently. Co-Authored-By: Claude Opus 5 (1M context) * docs(ui): give the attachment errors a summary paragraph, and say who throws them Effective Dart wants a one-sentence summary in its own paragraph; the addition in 0548bb597 ran the summary and the detail together. The family doc also said these are "returned rather than thrown", which sent me looking in the wrong place: `StreamAttachmentPickerController` throws them from `addAttachment` and from its `value` setter. It now says so, and states the consequence a caller needs — an `on StreamChatException` clause does not catch one — rather than naming the package the type does not come from. Co-Authored-By: Claude Opus 5 (1M context) --------- Co-authored-by: Claude Opus 5 (1M context) --- core-migration/02-platform-and-environment.md | 36 ++- core-migration/03-errors.md | 295 +++++++++++------- core-migration/04-token-and-auth.md | 43 ++- core-migration/05-http-client.md | 14 +- core-migration/07-websocket.md | 24 +- core-migration/09-uploads.md | 20 +- core-migration/10-cleanup.md | 2 +- core-migration/DEFERRED.md | 37 ++- core-migration/README.md | 31 +- core-migration/UPSTREAM.md | 20 +- migrations/v11-migration.md | 107 +++++-- packages/stream_chat/CHANGELOG.md | 9 +- .../lib/src/client/channel/channel.dart | 94 ++++-- .../stream_chat/lib/src/client/client.dart | 36 ++- .../lib/src/client/retry_policy.dart | 2 +- .../lib/src/core/api/responses.dart | 2 +- .../stream_chat/lib/src/core/error/error.dart | 2 - .../lib/src/core/error/stream_chat_error.dart | 75 ----- .../lib/src/core/http/stream_http_client.dart | 2 +- .../lib/src/core/models/attachment_file.dart | 2 +- .../platform_detector/platform_detector.dart | 97 ------ .../platform_detector_io.dart | 17 - .../platform_detector_stub.dart | 7 - .../platform_detector_web.dart | 9 - .../lib/src/db/chat_persistence_client.dart | 2 +- .../stream_chat/lib/src/ws/websocket.dart | 35 ++- packages/stream_chat/lib/stream_chat.dart | 6 +- .../channel/channel_client_state_test.dart | 2 +- .../test/src/client/channel/channel_test.dart | 95 +++++- .../test/src/client/client_test.dart | 25 +- .../src/client/system_environment_test.dart | 4 +- .../core/error/stream_chat_error_test.dart | 56 ---- .../error/stream_chat_exception_test.dart | 2 +- .../core/http/stream_http_client_test.dart | 34 +- .../platform_detector_test.dart | 46 --- packages/stream_chat/test/src/fakes.dart | 2 +- .../test/src/ws/websocket_test.dart | 17 +- packages/stream_chat_flutter/CHANGELOG.md | 1 + .../stream_attachment_picker_controller.dart | 4 + .../stream_attachment_validator.dart | 37 ++- .../stream_message_composer.dart | 2 +- .../lib/src/stream_chat_core.dart | 2 +- 42 files changed, 694 insertions(+), 661 deletions(-) delete mode 100644 packages/stream_chat/lib/src/core/error/error.dart delete mode 100644 packages/stream_chat/lib/src/core/error/stream_chat_error.dart delete mode 100644 packages/stream_chat/lib/src/core/platform_detector/platform_detector.dart delete mode 100644 packages/stream_chat/lib/src/core/platform_detector/platform_detector_io.dart delete mode 100644 packages/stream_chat/lib/src/core/platform_detector/platform_detector_stub.dart delete mode 100644 packages/stream_chat/lib/src/core/platform_detector/platform_detector_web.dart delete mode 100644 packages/stream_chat/test/src/core/error/stream_chat_error_test.dart delete mode 100644 packages/stream_chat/test/src/core/platform_detector/platform_detector_test.dart diff --git a/core-migration/02-platform-and-environment.md b/core-migration/02-platform-and-environment.md index e027a3dafa..3a425a8483 100644 --- a/core-migration/02-platform-and-environment.md +++ b/core-migration/02-platform-and-environment.md @@ -5,14 +5,15 @@ **Size:** ~330 chat LOC deleted. One public type swap, one public rename. -> **Read the resolved package, not the sibling repo.** The first pass at this phase claimed two -> upstream core additions were needed. Both were wrong, because they were derived from -> `stream-core-flutter/packages/stream_core` (unreleased `main`) rather than from what -> `stream_chat` actually resolves. Always diff against the pub-cache copy, and read the path out of -> `packages/stream_chat/.dart_tool/package_config.json` rather than assuming it: `melos.yaml` pins -> `stream_core` to a git `ref` for now, so the copy in use is under `~/.pub-cache/git/`, not -> `~/.pub-cache/hosted/`. It returns to a hosted constraint when core next releases — see -> [DEFERRED.md](DEFERRED.md). +> **Check what resolves before claiming core is missing something.** The first pass at this phase +> named two upstream additions as prerequisites; both already existed. Where to look has since +> moved: `melos.yaml` pins `stream_core` to a git commit, so that commit is what resolves, not +> `~/.pub-cache/.../stream_core-0.5.0`. Read the pinned ref. +> +> **This phase has landed.** It was gated on a core release, because +> `debugCurrentPlatformOverride` is on core's `main` and not in 0.5.0. That was resolved by pinning +> rather than waiting — see [DEFERRED.md](DEFERRED.md) for what restoring a hosted constraint +> still requires before the v11 release. ## Scope @@ -20,9 +21,9 @@ | --- | --- | --- | | `lib/src/system_environment.dart` (57) | `stream_core` `api/system_environment.dart` | **done** | | `lib/src/core/http/system_environment_manager.dart` (111) | `stream_core` `api/system_environment_manager.dart` | **done** | -| `lib/src/core/platform_detector/` — `platform_detector.dart` (~97) + `_stub` / `_web` / `_io` | `stream_core` `platform/current_platform.dart` + `platform/detector/` | **ready** — the SHA pinned in [08](08-query-dsl.md) carries what this needed | +| `lib/src/core/platform_detector/` — `platform_detector.dart` (~97) + `_stub` / `_web` / `_io` | `stream_core` `platform/current_platform.dart` + `platform/detector/` | **done** | -### Platform detector — unblocked by the pin in phase 08 +### Platform detector — done, after the pin replaced the wait Both packages define `CurrentPlatform` **and** `PlatformType`, so `stream_chat.dart` must stop exporting ours in the same PR — there is no coexistence. @@ -149,10 +150,11 @@ code changes needed. `stream_chat_flutter` 1302 green (11 golden failures pre-existing on a clean tree — verified by stashing). - [x] CHANGELOG entry under `🔄 Changed` for the `SystemEnvironment` type swap. -- [ ] `lib/src/core/platform_detector/` deleted; `stream_chat.dart` exports core's - `CurrentPlatform` / `PlatformType` — **after the core release**. -- [ ] `CurrentPlatform.name` → `.operatingSystem` at both non-test call sites. -- [ ] Wasm build verified (`flutter build web --wasm` on the sample app) once the platform half - lands — core's shape should make this a formality, but confirm rather than assume. -- [ ] `migrations/v11-migration.md` Symbol Map row for `CurrentPlatform.name`. -- [ ] Decisions recorded here, status box updated in `README.md`. +- [x] `lib/src/core/platform_detector/` deleted; `stream_chat.dart` exports core's + `CurrentPlatform` / `PlatformType`. +- [x] `CurrentPlatform.name` → `.operatingSystem` at both non-test call sites. +- [x] Wasm needs no build to confirm: core has no web-conditional import to get wrong. Its + fallback returns `PlatformType.web` directly, so JS and wasm resolve the same file. Chat + needed the `js_interop` branch `#2940` added because its stub threw `UnimplementedError`. +- [x] `migrations/v11-migration.md` Symbol Map row for `CurrentPlatform.name`. +- [x] Decisions recorded here, status box updated in `README.md`. diff --git a/core-migration/03-errors.md b/core-migration/03-errors.md index 6be872370b..809736ae98 100644 --- a/core-migration/03-errors.md +++ b/core-migration/03-errors.md @@ -13,7 +13,7 @@ | Delete | Adopt | | --- | --- | -| `lib/src/core/error/stream_chat_error.dart` (230) — `StreamChatError`, `StreamChatNetworkError`, `StreamChatNetworkErrorType`, `StreamWebSocketError` | `stream_core` `errors/stream_exception.dart` — `sealed StreamException` → `StreamApiException`, `StreamNetworkException`, `StreamAuthenticationException`, `StreamClientException` | +| `lib/src/core/error/stream_chat_error.dart` (223) — `StreamChatError`, `StreamChatNetworkError`, `StreamChatNetworkErrorType`, `StreamWebSocketError` | `stream_core` `errors/stream_exception.dart` — `sealed StreamException` → `StreamApiException`, `StreamNetworkException`, `StreamAuthenticationException`, `StreamClientException` | | `lib/src/core/error/chat_error_code.dart` (158) — `ChatErrorCode` (25 values), `_errorCodeWithDescription`, `chatErrorCodeFromCode`, `ChatErrorCodeX` | `stream_core` `errors/stream_error_code.dart` — `StreamErrorCode`, an `extension type const StreamErrorCode(int) implements int` with ~40 constants, plus `StreamErrorCodePredicates` | | `ErrorResponse` decoding in `StreamHttpClient._parseError` | `stream_core` `errors/stream_api_error.dart` — `StreamApiError` | @@ -45,12 +45,12 @@ typedef StreamChatException = StreamException; package. The four kinds keep their core names, since those are what a `switch` matches on and renaming them would break the shared-handler property. -**`StreamChatError` is *not* aliased onto it.** An earlier draft of this file suggested -`@Deprecated typedef StreamChatError = StreamException;`, which turned out to be wrong: that class -is still a live base for things unrelated to request failures — -`stream_chat_flutter`'s `AttachmentLimitReachedError`, `AttachmentTooLargeError` and -`AttachmentBlockedError` extend it, and the SDK's own precondition throws raise it. It stays as it -is; `StreamChatNetworkError` is the one that goes. +**`StreamChatError` is *not* aliased onto it.** An earlier draft suggested +`@Deprecated typedef StreamChatError = StreamException;`. That was wrong for a reason worth +keeping: the class was a base for two unrelated things — request failures, and *returned* values +that never get thrown (`stream_chat_flutter`'s three attachment-validation errors). An alias would +have flattened that distinction instead of forcing it. Both were separated and the class deleted; +see [`stream_chat_error.dart` is gone](#stream_chat_errordart-is-gone). Export the alias from `lib/stream_chat.dart` alongside the allowlist below. @@ -64,9 +64,12 @@ It is **not installed anywhere in chat today.** That is why a call through the g currently hands back a `Failure` carrying a raw `DioException`: `DefaultApi` goes straight to `_dio.fetch` and bypasses `StreamHttpClient._parseError`, which only its own verb wrappers call. -Install it **last** in the pipeline (it must see every rejection on the way out) and the guarantee -holds: `runApiSafely` — already used by `default_api.dart:783` — maps a `DioException` through -`toStreamException()`, passes a `StreamException` through unchanged, and wraps everything else, +Install it **after every interceptor that can reject**, so it sees the rejection on the way out — +in practice that means after auth and connection-id, and *before* the logging interceptor, so what +gets logged is the mapped `StreamException` rather than a raw `DioException`. It is therefore not +literally last: user-supplied interceptors and the default logger follow it. With it in place the +guarantee holds: `runApiSafely` — already used by `default_api.dart:783` — maps a `DioException` +through `toStreamException()`, passes a `StreamException` through unchanged, and wraps everything else, *including a `TypeError` from an undecodable response body*, in a `StreamClientException` with the original as `cause`. @@ -85,10 +88,11 @@ export 'package:stream_core/stream_core.dart' Plus the `StreamChatException` alias above, from wherever it is declared. -**Resolve the `Success` collision first.** Chat's `UploadState` is a `@freezed sealed` union whose -success variant is a class named `Success`, and it is exported. Either rename it (breaking, and -phase [09](09-uploads.md) touches `UploadState` anyway) or do not export core's `Success` and -document `Result` pattern-matching through `switch` on the sealed type instead. +**The `Success` collision had to be resolved first.** Chat's `UploadState` is a `@freezed sealed` +union whose success variant was a class named `Success`, and it is exported. The options were to +rename it (breaking, and phase [09](09-uploads.md) touches `UploadState` anyway) or to withhold +core's `Success` from the allowlist and document `Result` pattern-matching through `switch` on the +sealed type. It was renamed — see [the name to avoid](#the-success-collision-and-the-name-to-avoid). ### Keep the hand-written API layer throwing @@ -97,8 +101,10 @@ of a `StreamChatNetworkError`. This is deliberate and it is what keeps this plan `openapi-migration`: each of that plan's 12 feature groups converts its own methods to `Future>` when it migrates, and until then nothing above the api layer changes shape. -The break is already promised in `migrations/v11-migration.md`'s Symbol Map, so this phase -delivers what that guide advertises rather than adding a new row. +The break was already promised in `migrations/v11-migration.md`'s Symbol Map, so this phase mostly +delivers what that guide advertised. It did add rows, for the symbols the guide had not +anticipated being deleted outright: `StreamChatError`, `StreamWebSocketError`, `isRetriable`, and +the attachment-validation retype. ### Error codes @@ -119,47 +125,81 @@ matching the old constant. ### `isRetriable` stays ours -It exists on both `StreamChatNetworkError` and `StreamWebSocketError` (`data == null`) and drives +It lived on both `StreamChatNetworkError` and `StreamWebSocketError` (`data == null`) and drives `RetryQueue` via `RetryPolicy.shouldRetry`. Core has nothing equivalent — its `DisconnectionSource.isReconnectable` is transport-level policy for the socket, not for a request. -Re-express ours as a chat-side extension over the core kinds. `ERROR_LAYER.md` is explicit that +It is now a chat-side extension over the core kinds. `ERROR_LAYER.md` is explicit that retryability is the caller's policy, so this is the intended shape, not a workaround. -### Two lossy conversions to document +### The two types with no direct analogue -- `StreamChatNetworkErrorType` mirrors `DioExceptionType` with 9 values. +- **Lossy.** `StreamChatNetworkErrorType` mirrored `DioExceptionType` with 9 values. `StreamNetworkException` has `isCancelled` / `isTimeout` / `closeCode`, so `sendTimeout`, `receiveTimeout` and `connectionTimeout` all collapse into one `isTimeout`. -- `StreamWebSocketError` has no analogue; core surfaces socket failures through - `DisconnectionSource.serverInitiated(error:)`. **Keep it alive through this phase** — the WS - layer still throws it until phase [07](07-websocket.md), and `client.dart:459` catches it by - type during `connectUser`. - - **Be explicit that this is a carry-forward, not an oversight.** `StreamWebSocketError` outlives - this phase and stays fully live through phases 04–06: `websocket.dart` constructs it - (`_handleStreamError`, `websocket.dart:392`), `connectUser` catches it by type to decide whether - to retry the initial connect, and it keeps its own `isRetriable`. So for as long as 04–06 take, - the SDK has *two* error families in flight — the sealed `StreamException` everywhere else, and - this one type on the socket path. That is intended and bounded; it becomes dead code only when - 07 replaces the transport, and 07's definition of done is what deletes it. Do not try to - half-migrate it here. +- **Not lossy, just relocated.** `StreamWebSocketError` is **deleted in this phase**, not carried + forward. It was originally scheduled for phase [07](07-websocket.md) on the assumption that only the new + transport could replace it, but the socket path maps onto core's kinds without touching the + transport at all: a frame carrying an `error` object becomes a `StreamApiException`, and a + failure raised by the channel itself becomes whatever `StreamException.tryFrom` recovers, or a + `StreamNetworkException` when the outcome of the connection is unknown. Phase 07 still replaces + the transport; it no longer inherits an error type to clean up. + + The `error` object is the server's `APIError` verbatim, so it parses as a `StreamApiError` with + no massaging — see below. + +### The WS error frame is a full `APIError` + +Worth writing down because the obvious assumption is wrong: a frame off the socket looks nothing +like an HTTP response, so `StreamApiError.statusCode` (required, non-nullable) reads like a field +the server cannot supply. It always does. + +Both emitters — `monolith/engine/websocket/conn.go` `CloseWithError` and `monolith/server/ws/server.go` +— marshal `event.NewConnectionErrorEvent(*apiErr)`, whose `error` field is a full `errors.APIError`. +`CloseWithError` guarantees a non-nil one: a cause that is not an `*APIError` is replaced with +`InternalSystemError` (500). `StatusCode` carries no `omitempty`, `APIError` has no custom +marshaller, and neither the V1 nor the V2 encode option set can drop a zero field — they only +handle tag-ignored fields, null slices/maps, extra fields and time format. So `code`, `message` +and `StatusCode` are always on the wire. + +This matters because it is easy to "fix" in the wrong direction. Seeding a default +(`{...errorResponse}..['StatusCode'] ??= 0`) makes an under-specified *test fixture* parse and +then reads, in the source, as a claim about the server. Core makes the same distinction +deliberately: `duration` and `moreInfo` get `@JsonKey(defaultValue: '')` because they genuinely +can be absent, while `message` and `statusCode` get no default. Build the fixture the way the +server sends it instead. + +One loose end, checked and closed: `_onDataReceived` reads `jsonData['error']` as a map on *any* +frame, not just `connection.error`, and the `export.*.error` events register under +`openapi.ProductChat` with `error` typed as a **string** — which would be a `TypeError` inside the +socket callback. They cannot reach one: they are built with `NewEventWithoutUserID`, so there is no +user to route them to, and a client socket is user-scoped. Pre-existing either way, and unrelated +to how the error object is parsed. + +`ErrorResponse` is now redundant and should go when something forces the issue. Its four fields +(`code`, `message`, `StatusCode`, `moreInfo`) are a strict subset of `StreamApiError`, which adds +`details`, `duration`, `exceptionFields` and `unrecoverable` — and `websocket_test.dart` builds an +`ErrorResponse` for the sole purpose of being parsed back as a `StreamApiError`. It survives only +because `responses.dart` is generated-adjacent and nothing in `lib/` reads it any more. ## Decisions taken 1. **Retry policy adopts core's table** (`ERROR_LAYER.md` §Retrying) rather than preserving v10 - behaviour. Today's predicate is `isRetriable => data == null` — it retries only when the - response carried *no* parseable Stream error payload, so a 500 or a 429 never retries a failed - message. The new predicate retries network failures (unless cancelled), 5xx, 429 and 408, and - never other 4xx, auth failures, client failures, or anything flagged `unrecoverable`. **This - changes runtime behaviour** and gets its own CHANGELOG line. -2. **`StreamChatNetworkError` is deleted, not deprecated.** An earlier draft deferred it to - `openapi-migration` group 12, on the grounds that endpoints that group has not moved still flow - through the hand-written verb facade. That reasoning does not survive this phase: the facade - throws a `StreamChatException` now, so nothing raises the type whichever endpoint you call. - Keeping it declared would buy source compatibility for a type that no longer works — an - `on StreamChatNetworkError catch` would still *compile* and silently match nothing, which is - the one break a consumer can ship without noticing. Deleting it makes that a compile error - instead. `StreamChatNetworkErrorType` goes with it. + behaviour. The old predicate was `isRetriable => data == null` — it retried only when the + response carried *no* parseable Stream error payload, so a 500 or a 429 never retried a failed + message. The new one retries network failures (unless cancelled), 5xx, 429 and 408, and never + other 4xx, auth failures, client failures, or anything the server flagged `unrecoverable`. + Two token cases do not follow from the status alone and are decided by name: a token that is + *not yet valid* retries, because that is clock skew on `nbf`/`iat` healing itself and a fresh + token from the same skewed clock would not help; an *expired* one does not, because a refresh + already failed to fix it. **This changes runtime behaviour** and gets its own CHANGELOG line. +2. **`StreamChatNetworkError` is deleted, not deprecated** — reversed during the phase. The + original reasoning was that it had to survive until `openapi-migration` group 12 moved the last + endpoint off the hand-written verb facade. That confused *who throws it* with *who names it*: + once the facade threw a `StreamException`, nothing in `lib/` raised or caught the old type, so + there was nothing for group 12 to release. Deprecating it would have been actively worse than + deleting it — nothing throws it, so `on StreamChatNetworkError catch` keeps compiling and + silently matches nothing, which is a break a consumer ships without noticing. Deleting it makes + that a compile error. The migration guide says so in those words. 3. **`ChatErrorCode` is deleted**, as `migrations/v11-migration.md` already promises. An `enum` cannot alias an extension type, so a deprecated forwarder is not available, and three of its entries are not real wire codes anyway (see below). @@ -172,10 +212,10 @@ retryability is the caller's policy, so this is the intended shape, not a workar Chat's `UploadState` union exports four strikingly generic names — `Preparing`, `InProgress`, `Success`, `Failed` — and `Success` is contended three ways: chat's `UploadState.success` variant, `stream_chat_flutter_core`'s `PagedValue.success` variant (`Success`), and core's -`Result` `Success`. There are already **13 `hide Success` import clauses** in this repo working -around the first two. +`Result` `Success`. Before this phase there were **13 `hide Success` import clauses** in this +repo working around the first two; renaming took it to 5. -Rename chat's four variants to `UploadStatePreparing`, `UploadStateInProgress`, +Chat's four variants are now `UploadStatePreparing`, `UploadStateInProgress`, `UploadStateSuccess`, `UploadStateFailed`. **Do not name them `UploadPreparing` / `UploadInProgress` / `UploadSuccess` / `UploadFailed`,** @@ -185,41 +225,43 @@ phase [09](09-uploads.md) puts core's union in scope *alongside* chat's — whic ## Downstream: the Flutter packages -The original scope note undercounted this badly. `StreamChatError` is not confined to the LLC — -it is woven through `stream_chat_flutter_core`'s **public** API: +The original scope note undercounted this badly. `StreamChatError` was not confined to the LLC — +it ran through `stream_chat_flutter_core`'s **public** API: | Surface | Where | Public | | --- | --- | --- | | `PagedValue.error(StreamChatError)`, plus the generated `when` / `map` / `maybeWhen` signatures | `paged_value_notifier.dart` | yes — backs every list controller | | `errorBuilder: Widget Function(BuildContext, StreamChatError)` | `paged_value_scroll_view.dart` (×2) | yes — widget API | -| `on StreamChatError catch` followed by `StreamChatError(error.toString())` | 11 controllers, two sites each | internal | +| `on StreamChatError catch` followed by `StreamChatError(error.toString())` | 9 list controllers, two sites each, plus one in `search_debounce_mixin.dart` | internal | -Real totals for this phase: **205 `lib` references and 230 `test` references across three -packages**, not one. `stream_chat_persistence` has zero and is untouched. +Counted before the change: **205 `lib` references and 230 `test` references across three +packages**, not one. `stream_chat_persistence` had zero and is untouched. -All of it is retyped to `StreamException` here. The controllers already wrapped non-chat errors as -`StreamChatError(error.toString())`, so those sites become `on StreamChatException catch` with the -wrap rewritten as `StreamClientException(message: 'Failed to load channels', cause: error)` — the -message names the load, and the original throwable survives as `cause`, which the old wrap -discarded by stringifying it. +All of it was retyped to `StreamChatException` here. The controllers had been wrapping non-chat +errors as `StreamChatError(error.toString())`, so those sites became `on StreamChatException catch` +with the wrap rewritten as `StreamClientException(message: 'Failed to load channels', cause: error)` +— the message names the load, and the original throwable survives as `cause`, where stringifying it +into the message was losing it. ## Risks -- **The widest blast radius in the plan**, and it now spans three packages. Inside the LLC, - `StreamChatNetworkError` is caught by type in `retry_queue.dart`, `app_settings_manager.dart`, - `websocket.dart:392` and across `channel.dart` / `channel_client_state.dart`'s optimistic-update - rollbacks. -- **The silent-catch trap, avoided by deleting rather than deprecating.** Had the type stayed - declared, `on StreamChatNetworkError catch` would keep compiling and quietly match nothing — the - one break a consumer can ship without noticing. It is gone, so the same clause fails to compile - and the consumer is sent to the migration guide. +- **The widest blast radius in the plan**, and it spans three packages. Inside the LLC, + `StreamChatNetworkError` was caught by type in `retry_queue.dart`, `app_settings_manager.dart`, + `websocket.dart` and across `channel.dart` / `channel_client_state.dart`'s optimistic-update + rollbacks — every one of which had to be found by grep, not by a failing test. See + [Found after the fact](#found-after-the-fact). +- **The silent-catch trap — avoided here, still live for consumers.** A *deprecated* + `on StreamChatNetworkError catch` keeps compiling and quietly matches nothing, which is the one + break a consumer can ship without noticing. Deleting the type is what turns it into a compile + error. The same trap applies to any `catch` clause in *their* code naming a type we retyped + rather than removed. - **`StreamException` has no `stackTrace`, by design** — `ERROR_LAYER.md`: "a trace records the raise, not the failure." `StreamChatNetworkError` has one, plus `toString({bool printStackTrace})`. Traces now come from the carrier (`Failure.stackTrace`) or from the language at the throw site. -- **`RetryPolicy.shouldRetry` is public** and typed - `FutureOr Function(StreamChatClient, int, StreamChatError?)`. Its third parameter becomes - `StreamException?`, and `retry_queue.dart:85`'s `is! StreamChatError` guard changes with it. +- **`RetryPolicy.shouldRetry` is public** and was typed + `FutureOr Function(StreamChatClient, int, StreamChatError?)`. Its third parameter is now + `StreamChatException?`, and `retry_queue.dart`'s guard reads `error is! StreamChatException`. - `StreamApiException.code` is **nullable** (null when no Stream payload reached us, e.g. a proxy's bare status), where `StreamChatNetworkError.code` was a non-null `int`. Every code read needs a null path. @@ -232,67 +274,84 @@ None. ## Definition of done -- [x] `chat_error_code.dart` and `stream_chat_dio_error.dart` deleted; `StreamChatNetworkError` - and `StreamChatNetworkErrorType` deleted; `StreamChatError` and `StreamWebSocketError` kept - (the WS layer still raises the latter until phase 07, and the UI package's - attachment-validation errors subclass the former). +- [x] `chat_error_code.dart`, `stream_chat_dio_error.dart`, `stream_chat_error.dart` and the + `error.dart` barrel deleted. `StreamChatError`, `StreamChatNetworkError`, + `StreamChatNetworkErrorType` and `StreamWebSocketError` are gone with them; the UI package's + attachment-validation errors moved to their own sealed family. - [x] `ApiErrorInterceptor` installed, before the logging interceptor so a rejection is mapped before it is logged. `_parseError` delegates to `DioExceptionMapping.toStreamException()`, - so all seven verb wrappers throw a `StreamChatException`. + so all eight verb wrappers throw a `StreamChatException`. - [x] `Result` and the core error kinds exported via the `show` allowlist, plus the `StreamChatException` alias. The `Success` collision is resolved by renaming `UploadState`'s variants. - [x] `isRetriable` re-expressed chat-side over the sealed kinds, per `ERROR_LAYER.md` §Retrying, with a test per row of that table. - [x] The 23 → 48 `requestTimeout` correction has its own CHANGELOG line. -- [x] `melos run analyze` clean across every package; `melos run format` clean. `stream_chat` - 1672 tests green, `stream_chat_flutter_core` 362, `stream_chat_flutter` 1302 (the 11 macOS - golden failures are pre-existing — verified against a clean tree). -- [x] `migrations/v11-migration.md`: Symbol Map rows for every retyped symbol, plus new sections - for endpoints that still throw, the silent-catch trap, and the retry change. +- [x] `melos run analyze` clean across every package; `melos run format` clean; the non-golden + suites green in all three packages. (Goldens are not a local signal — alchemist compares + against CI-rendered images in CI and platform ones locally.) +- [x] `migrations/v11-migration.md`: Symbol Map rows for every retyped and every deleted symbol, + plus new sections for endpoints that still throw, why the old types were deleted rather than + deprecated, and the retry change. - [x] `🛑️ Breaking` CHANGELOG entries in all three packages. -- [ ] A test asserting a **malformed response body** yields a `StreamClientException` rather than a - bare `TypeError`. `runApiSafely` guarantees it, but nothing in this package exercises that - path yet — it needs a call through the generated client, which arrives with - `openapi-migration` group 02. -- [ ] Status box updated in `README.md`. +- [x] Status box updated in `README.md`. -### When `stream_chat_error.dart` goes +A test asserting a **malformed response body** yields a `StreamClientException` rather than a bare +`TypeError` is *not* a condition of this phase. `runApiSafely` guarantees it and lives in +`lib/open_api/api/default_api.dart`, which nothing under `lib/src` calls, so the path cannot be +exercised until `openapi-migration` group 02 lands. It is owned by +[DEFERRED.md](DEFERRED.md), which carries it against this phase. -The file held three things with three different lifetimes, so it empties in stages rather than -being deleted here: +### `stream_chat_error.dart` is gone -| In the file | Last users | Goes when | +This was planned as a staged emptying — the file held three things with three different +lifetimes, and two of them looked like they belonged to later phases. It was deleted outright +instead, along with the `error.dart` barrel, because each of the supposed blockers dissolved on +contact: + +| In the file | Planned exit | What actually happened | | --- | --- | --- | -| `StreamChatNetworkError`, `StreamChatNetworkErrorType` | none — nothing raised them once the verb facade threw `StreamChatException` | **this phase** | -| `StreamWebSocketError` | `websocket.dart` raises it, `client.dart:459` catches it | phase [07](07-websocket.md), where `DisconnectionSource.serverInitiated(error:)` replaces it | -| `StreamChatError` (the base) | 23 SDK precondition throws; `stream_chat_flutter`'s attachment-validation subtypes | two more pieces of work, below | - -So the file is deletable once **three** things are true — two of them already scheduled, and one -that is not: - -1. Phase 07 removes `StreamWebSocketError`. -2. The 23 precondition throws are reclassified (see below). -3. **The attachment-validation errors stop being errors.** `StreamAttachmentValidator`'s own - dartdoc says it best: "Both return `null` on success and a typed `StreamChatError` subtype on - failure — neither ever throws." `AttachmentLimitReachedError`, `AttachmentTooLargeError` and - `AttachmentBlockedError` are *returned values* that `StreamMessageComposer` pattern-matches to - choose localized copy. They carry data (`maxCount`, `maxSize`, `fileExtension`) and are never - raised, so they belong in a sealed result type of their own in `stream_chat_flutter` — not in - an exception hierarchy in the low-level client. That is a UI-package change and does not need - this plan. - -Until then `StreamChatError` stays, undeprecated. Deprecating it now would put a warning on every -one of those legitimate uses. +| `StreamChatNetworkError`, `StreamChatNetworkErrorType` | wait for `openapi-migration` group 12 | nothing in `lib/` raised or caught it once the verb facade threw `StreamException`, so there was nothing to wait for | +| `StreamWebSocketError` | wait for phase 07's new transport | the socket path maps onto core's kinds without replacing the transport (see above) | +| `StreamChatError` (the base) | 19 precondition throws + 3 attachment-validation subtypes | throws retyped to `StreamClientException`; the attachment errors became their own sealed family | + +The attachment errors are the one that needed a decision rather than a mechanical edit. +`StreamAttachmentValidator`'s dartdoc had already noticed the smell — "Both return `null` on +success and a typed subtype on failure — neither ever throws." They are *returned values* that +`StreamMessageComposer` pattern-matches to choose localized copy, and they carry data +(`maxCount`, `maxSize`, `fileExtension`). So they are now a sealed `AttachmentValidationError` +family in `stream_chat_flutter`, deliberately **not** extending one of core's kinds: nothing +failed, an attachment was refused, and typing a refusal as a transport or client exception invites +callers to treat it as one. + +### Found after the fact + +Retyping the errors was done, but five `is` checks on the old type were not, and they were not +the kind a test catches: `channel.dart` gated four `scheduleRetry` calls and `client.dart` gated +the `sync` 400 recovery on `e is StreamChatNetworkError`. Nothing raises that type any more, so +every branch was unreachable — a failed message was never queued for retry, and an app with a +stale `last_sync_at` could not heal. `isRetriable` itself was correct and covered a row at a +time; only the callers were missed. + +Five cases hid it rather than catching it, in two patterns. Four named "should add message to +retry queue on a retriable failure" throw a 403, which is not retriable, and assert message state +rather than the queue — so they passed whether or not the queue was reached. The fifth, +`should flush persistence client on 400 error`, constructed a `StreamChatNetworkError` the SDK +cannot produce, so it exercised a dead branch. + +The WS error fixture gave the same lesson from the other direction (above): **a fixture that does +not parse is evidence about the fixture until the wire format says otherwise.** + +The lesson generalises to every phase that retypes something: grep for `is OldType` and +`on OldType catch` across all packages, and treat a test that constructs the old type as +evidence the test is stale rather than evidence the path works. ### Carried out of this phase -- **The SDK's own precondition throws are untouched.** 23 sites still raise - `StreamChatError` — "Chat persistence client is not set", "Connection already in progress", - "Message not found", "Failed to upload one or more attachments". These are a different axis from - request failures, and `ERROR_LAYER.md` splits them further: a condition a correct program can hit - becomes a `StreamException`, while genuine misuse should raise `StateError`/`ArgumentError` and - never be wrapped. Reclassifying them one by one is worth its own change; doing it by sed would - get it wrong. -- **`StreamWebSocketError`** goes in phase [07](07-websocket.md), where - `DisconnectionSource.serverInitiated(error:)` replaces it. +- **The misuse-vs-failure split.** The 19 precondition throws were retyped to + `StreamClientException` mechanically, which is right for most of them but not all. + `ERROR_LAYER.md` splits the axis further: a condition a correct program can hit becomes a + `StreamException`, while genuine misuse should raise `StateError`/`ArgumentError` and never be + wrapped. "Connection already in progress" and "You cannot use `queryChannels` without an active + connection" read as the second kind. Reclassifying them one by one is worth its own change; + doing it by sed would get it wrong. diff --git a/core-migration/04-token-and-auth.md b/core-migration/04-token-and-auth.md index 8383fd1709..ef5d98ee21 100644 --- a/core-migration/04-token-and-auth.md +++ b/core-migration/04-token-and-auth.md @@ -117,12 +117,12 @@ None. - [x] `melos run analyze` and `melos run format` clean; `stream_chat` 1664 tests green. - [x] `🛑️ Breaking` CHANGELOG entries and `migrations/v11-migration.md` Symbol Map rows for the whole rename map, plus a section on the anonymous id. -- [ ] **Verify a live anonymous connect against a real app key.** Adopting core's token layer - changes the anonymous `user_id` from a random value to `!anon` (see below). The source - evidence says it is safe; only a live connect proves it. -- [ ] Verified by hand in `sample_app`: cold login, a token that expires mid-session, and a +- [x] **A live anonymous connect against a real app key succeeds.** Adopting core's token layer + changes the anonymous `user_id` from a random value to `!anon`; verified by hand, not from + source — see below for why the distinction mattered here. +- [x] Verified by hand in `sample_app`: cold login, a token that expires mid-session, and a logout → login as a different user. -- [ ] Status box updated in `README.md`. +- [x] Status box updated in `README.md`. ### The anonymous id changed, deliberately @@ -136,8 +136,31 @@ Adopting `!anon` is the right call rather than a compromise: `monolith/types/use *specifically so* "customers [cannot] create anon tokens that can be used to impersonate other users or a server". Chat's random id was the outlier. -Why it still needs a live check: that enforcement only runs when a raw anon JWT is present, and -chat's anonymous token has an empty `rawValue`, so the claims path is never exercised. What the -server does with the `user_id` **query parameter** on an anonymous request is not settled from -source — `types.NewAnonymousUser(...)` suggests it builds its own user and ignores the client's, -but that is inference. +That enforcement only runs when a raw anon JWT is present, and chat's anonymous token has an empty +`rawValue`, so the claims path is never exercised — which is why this was checked live rather than +argued from source. **A live anonymous connect against a real app key succeeds.** + +Two useful things came out of confirming it, one of which is a warning about this file's method. + +**The server discards the id.** On the anonymous path it never reads what the client sent: +`AnonymousAuth.ConnectUserFromRequest` (`monolith/auth/auth.go:247`) takes the user as `_` and +returns `types.NewAnonymousUser(...)`; `UserID()` returns the `!anon` constant unconditionally; and +every session builder discards the user it is passed. So chat's old random id was never the +server's notion of identity, and the switch to `!anon` could not have changed behaviour there. + +**A source-only reading predicted the opposite, and was wrong.** `Connect.handshake` validates +`ConnectRequest` before authenticating, `ConnectUserDetails.ID` carries `validate:"userID,required"` +(`v1/payload/connect_user_details.go:31`, and v2's `commonpayloads` type carries the identical +tag), that tag runs `ValidUserIDOrTypeRe = ^[@\w .-]*$` +(`monolith/internal/validator/registry.go:19,327`), and running that regex against `!anon` returns +false. Read end to end that chain says an anonymous connect is rejected before auth ever sees it. +It is not. **Why the live request passes is not established** — do not write an explanation into +this file without one. + +The lesson is narrower than "don't read source": a chain of individually-correct source facts is +not a prediction until something executes it. Note also that there is no anonymous WS connect test +anywhere in the Go repo — `!anon` appears in HTTP response assertions +(`send_message_test.go`, `query_channels_test.go`) but no testkit helper opens an anonymous socket. +An uncovered path was exactly where a source-only reading was least safe. + +Anyone revisiting the anonymous id should start from the live result, not from the regex. diff --git a/core-migration/05-http-client.md b/core-migration/05-http-client.md index d6a94d01db..091169be9f 100644 --- a/core-migration/05-http-client.md +++ b/core-migration/05-http-client.md @@ -117,7 +117,11 @@ two. [09](09-uploads.md). - **`api_key` stays a query parameter**, so core's `ApiKeyInterceptor` is the one pipeline piece chat does not adopt. See below. -- **Six verbs, not eight.** `fetch` and `request` had no callers in the api layer. +- **Six verbs are used; eight still exist.** `fetch` and `request` have no caller in `lib/` — only + their own tests — but they were not removed. `StreamHttpClient` is still public, so dropping two + methods is a break for no gain while the class is on its way to `@internal` anyway. They go with + that move in [09](09-uploads.md). An earlier draft of this line claimed six had shipped; it had + not, and the facade the api layer actually needs is the relevant number. ## Risks @@ -126,7 +130,11 @@ two. custom uploader breaks. Coordinate the retype with phase [09](09-uploads.md) rather than doing it twice. - Interceptor order mistakes fail *sometimes* — a misplaced `ApiErrorInterceptor` still works - until something rejects. Assert the order in a test rather than trusting the code reads right. + until something rejects. **Pinned by a test now** (`stream_http_client_test.dart`, "interceptors + are installed in the order the pipeline depends on"): the other interceptor tests only assert + each type is *present*, which a reordered pipeline satisfies just as well. The order matters + twice — anything rejecting ahead of `ApiErrorInterceptor` escapes as a raw `DioException`, and + anything logging ahead of it logs the transport error rather than the mapped one. - `dio` version skew: chat declares `^5.11.0`, core `^5.8.0+1`. Compatible today; worth pinning attention on when either moves. @@ -188,6 +196,8 @@ rather than moved to core. - [x] Interceptor coverage kept: the connection-id test is retargeted at core's type through our closure, and a `HeadersInterceptor` group is added — core ships both interceptors with **no** tests of its own ([`UPSTREAM.md`](UPSTREAM.md)). +- [x] The pipeline **order** is asserted, not just each interceptor's presence. Verified to fail on + a swap rather than only to pass as written. - [x] `melos run analyze` and `melos run format` clean; `stream_chat` 1670 tests green. - [x] `🛑️ Breaking` CHANGELOG entry for `LoggingInterceptor`. - [ ] `StreamHttpClient` itself is still ours — it *is* the verb facade. It becomes `@internal` diff --git a/core-migration/07-websocket.md b/core-migration/07-websocket.md index f00787831e..51a55e6101 100644 --- a/core-migration/07-websocket.md +++ b/core-migration/07-websocket.md @@ -79,7 +79,7 @@ move to `/api/v2/connect` (`lib/core/api/connect/routes.go`), all verified in | `_needsToReconnect`, `pauseReconnect`, `resumeReconnect` | `AutomaticReconnectionPolicy` family + `CompositeReconnectionPolicy` | | `_reconnect`, `client.maybeReconnect()` | `ConnectionRecoveryHandler` | | `lib/src/ws/connection_status.dart` (11) — `enum ConnectionStatus` | `sealed WebSocketConnectionState` + `sealed DisconnectionSource` | -| `StreamWebSocketError` (deferred from phase 03) | `DisconnectionSource.serverInitiated(error:)` | +| the `StreamApiException` / `StreamNetworkException` raised by `_handleStreamError` and `_onConnectionError` (phase 03) | `DisconnectionSource.serverInitiated(error:)` | `lib/src/ws/connect_user_details.dart` maps onto core's `ConnectUserDetailsRequest`, which has `invisible` and `language` already — those are chat's fields, in core. @@ -154,9 +154,9 @@ Then `ConnectionRecoveryHandler(client:, retryStrategy:, networkStateProvider:, lifecycleStateProvider:, policies:)`. `ConnectionRecoveryHandler` **only recovers a connection that was once `Connected`** — a first -`connect()` that fails is never retried by it. Chat's `connectUser` catches -`StreamWebSocketError.isRetriable` at `client.dart:459` and retries the initial connect itself; -that behaviour has to stay somewhere, and it is not in core. +`connect()` that fails is never retried by it. Chat's `connectUser` gates on `isRetriable` at +`client.dart:459` and retries the initial connect itself; that behaviour has to stay somewhere, +and it is not in core. ### 4. Rewrite `connectUser` around state observation @@ -341,13 +341,14 @@ work — which is exactly why this is worth writing down rather than relying on. `connectionState.value case Connected(:final healthCheck)` the way feeds does would remove the per-ping churn at the root. -### `StreamWebSocketError` would go with this phase +### `StreamWebSocketError` did not wait for this phase -Phase [03](03-errors.md) deferred it here: `DisconnectionSource.serverInitiated(error:)` carries -the reason, so nothing would produce it. Its `data == null` retry test goes too — the offline -fallback in `connectUser` keys off the sealed retry table instead. That closes one of the four -preconditions for deleting `stream_chat_error.dart`, and closing it is now blocked on this phase -resuming. +It was deferred here on the assumption that only `DisconnectionSource.serverInitiated(error:)` +could replace it. Phase [03](03-errors.md) deleted it instead: the socket path maps onto core's +kinds without touching the transport, so this phase inherits no error type to clean up. What is +still true is that `DisconnectionSource` is where the *reason* belongs once the transport moves — +`_handleStreamError` and `_onConnectionError` both become codec/state concerns rather than +exception construction. ## Decisions to make @@ -412,6 +413,5 @@ resuming. server-initiated close; and a queued failed message draining after reconnect. - [ ] `melos bootstrap && melos run analyze && melos run test:dart && melos run test:flutter`. - [ ] `refactor(llc)!:` title, `🛑️ Breaking` CHANGELOG entries, `migrations/v11-migration.md` - Symbol Map rows for `ConnectionStatus` and `StreamWebSocketError`, plus a feature section on - the new connection state. + Symbol Map row for `ConnectionStatus`, plus a feature section on the new connection state. - [ ] Decisions recorded here, status box ticked in `README.md`. diff --git a/core-migration/09-uploads.md b/core-migration/09-uploads.md index 2cf4a3b086..b883af1b91 100644 --- a/core-migration/09-uploads.md +++ b/core-migration/09-uploads.md @@ -106,12 +106,20 @@ but is not a prerequisite. Option A is settled, above. What is left: -- Whether `AttachmentFileUploaderProvider` is retyped (`AttachmentFileUploader Function(Dio)` once - phase [05](05-http-client.md) removes `StreamHttpClient`) or replaced by a `CdnClient` injection - point à la `FeedsConfig.cdnClient`. Either way it is a break for anyone with a custom uploader. - Note phase 05 has **not** landed: the typedef still reads - `AttachmentFileUploader Function(StreamHttpClient)` and carries no deprecation, so this phase - either waits for 05 or breaks it itself. +- Whether `AttachmentFileUploaderProvider` stays as it is or is replaced by a `CdnClient` injection + point à la `FeedsConfig.cdnClient`. + + **This decision changed shape, because phase [05](05-http-client.md) landed differently than + assumed here.** The original framing was "retyped to `AttachmentFileUploader Function(Dio)` once + 05 removes `StreamHttpClient`". 05 did not remove it — it concluded `StreamHttpClient` *is* the + verb facade, kept it, and gave it core's `StreamCoreHttpClient` as the `Dio` it builds. The + typedef still reads `AttachmentFileUploader Function(StreamHttpClient httpClient)` and compiles + fine, so **nothing forces a retype any more**. + + What remains is a choice, not an obligation: leave the typedef alone (no break for custom + uploaders, and 09 stays purely additive), or take the break deliberately to move to a `CdnClient` + injection point. Note 05's own last open item runs the other way — `StreamHttpClient` becomes + `@internal` only once this typedef stops naming it, so leaving it alone keeps that box open. - Whether `UploadState` gains a `cancelled` variant to mirror `UploadCancelled`. Today a cancelled upload has nowhere to land, which is why cancellation is invisible in the UI. - Whether progress and cancellation become public API in this phase or stay internal until the UI diff --git a/core-migration/10-cleanup.md b/core-migration/10-cleanup.md index 364152c635..00e929694c 100644 --- a/core-migration/10-cleanup.md +++ b/core-migration/10-cleanup.md @@ -85,7 +85,7 @@ whether the old symbol is still in `stream_chat/lib`: | `Filter.equal('key', v)` | `XFilter.equal(XFilterField.key, v)` | 08 | forwarder only, see below | | `LocationCoordinates` | `LocationCoordinate` | 08 | yes — gone from chat | | `CurrentPlatform.name` | `.operatingSystem` | 02 | not yet — still 4 files | -| `StreamChatNetworkError` | `StreamApiException` | 03 | not yet — still 4 files | +| `StreamChatNetworkError` | `StreamApiException` | 03 | yes — gone from chat, along with `StreamChatError` and `StreamWebSocketError` | | `StreamHttpClient` | (removed) | 05 | not yet — still 17 files | | `ConnectionStatus` | `WebSocketConnectionState` | 07 | not yet, and 07 is parked | diff --git a/core-migration/DEFERRED.md b/core-migration/DEFERRED.md index d0d812b27e..ffb349124f 100644 --- a/core-migration/DEFERRED.md +++ b/core-migration/DEFERRED.md @@ -7,17 +7,42 @@ A row leaves this file when it lands, not when it is decided. ## Blocked on something outside the repo +### ⚠️ The branch does not compile against a released `stream_core` + +**The single thing gating everything else, and it is easy to miss because the tree is green.** +`melos.yaml` pins both core packages to a git commit that no published version contains, so +`analyze` and the test suites pass against code a consumer cannot resolve from pub.dev. (An earlier +form of this used `dependencyOverridePaths` pointing at a sibling checkout; that only worked on a +machine that had one, which is why CI went red and the pin replaced it.) + +Checked against `~/.pub-cache/hosted/pub.dev/stream_core-0.5.0`, chat already depends on six +things missing from it: + +| Missing from released 0.5.0 | Used by | Where it is | +| --- | --- | --- | +| `debugCurrentPlatformOverride` | `stream_chat_flutter` tests | core #178, on `main` | +| `sortedMerge`, `sortedUpsertAt` | `channel_client_state.dart` — the SDK's hottest path | `feat/chat-migration-gaps`, pushed | +| `normalizeStringForSort` | the sort registries | [core#181](https://github.com/GetStream/stream-core-flutter/pull/181) | +| `Filter.raw` | `stream_chat_persistence`'s filter converter, `PredefinedFilter` | core#181 | +| element-wise matching for array fields | `members`, `attachments.type` and friends | core#181 | +| `LocationCoordinate`'s exact equality | `Location.coordinates`, and anything putting a coordinate in a `Set` or `Map` | core#181 | + +Nothing on this branch ships until one `stream_core` release carries all six. That is one release, +not six — see [UPSTREAM.md](UPSTREAM.md) on batching. Until it exists, treat a green local run as +evidence about the sibling checkout and nothing more, and re-run against the hosted constraint +before believing the branch is releasable. + | | What | Blocked on | Phase | | --- | --- | --- | --- | -| ☐ | **Restore hosted `stream_core` / `stream_core_flutter` constraints** in `melos.yaml` | A `stream_core` release carrying `Filter.raw`, `normalizeStringForSort`, `debugCurrentPlatformOverride`, `sortedWith` and `LocationCoordinate`'s exact equality ([core#181](https://github.com/GetStream/stream-core-flutter/pull/181)). Until then `melos bootstrap` writes a `git:` block into `stream_chat`, `stream_chat_flutter_core` and `stream_chat_flutter`, which makes all three unpublishable. This is the row every other "blocked on a core release" note now folds into. | [08](08-query-dsl.md) | +| ☐ | Restore `melos.yaml` to a hosted `stream_core` constraint and re-verify | The release above. `STYLE_GUIDE.md` §Dependency management says the path override is temporary by design; this is the step that ends it. | [10](10-cleanup.md) | | ☐ | A test proving a malformed response body surfaces as `StreamClientException` rather than a bare `TypeError` | A call through the generated client — nothing in this package exercises `runApiSafely` yet. Arrives with `openapi-migration` group 02. | [03](03-errors.md) | ## Needs a live check, not more code | | What | Why source cannot settle it | Phase | | --- | --- | --- | --- | -| ☐ | One anonymous connect against a real app key | Anonymous requests now send `user_id=!anon` instead of a random id. Three backend paths say it is safe, but the enforcement in `auth.go:179` only runs for a raw anon JWT, which chat never sends — so what the server does with the *query parameter* is inference. | [04](04-token-and-auth.md) | -| ☐ | `sample_app` by hand: cold login, mid-session token expiry, logout → login as a different user | Core's interceptor refuses to refresh across a user switch. Correct, but it is a behaviour change on the path where failure means "cannot log in". | [04](04-token-and-auth.md) | +| ☑ | ~~One anonymous connect against a real app key~~ **Done, and it works.** Worth keeping for the method: reading the backend end to end predicted it would *fail* — `handshake` validates before it authenticates, and the `userID` tag's regex `^[@\w .-]*$` does not match `!anon`. Every link held and the conclusion was wrong, on a path the backend has no test for either. Why it passes is not established; see [04](04-token-and-auth.md). | [04](04-token-and-auth.md) | +| ☑ | ~~`sample_app` by hand: cold login, mid-session token expiry, logout → login as a different user~~ Done. | Core's interceptor refuses to refresh across a user switch. Correct, but it is a behaviour change on the path where failure means "cannot log in". | [04](04-token-and-auth.md) | | ☐ | Probe `queryUsers` with a range operator on `name`, and a non-`$eq`/`$in` operator on a custom field | `UserFilterField.name` and `.custom` document a narrower operator set than both the published spec and `mq/user/user.go:25,43`, on the strength of observed 400s that were never written down. Source now contradicts the docs, so the next person to reconcile the two will widen them back. | [08](08-query-dsl.md) | | ☐ | One real request against a live app key | `api_key` stays a query parameter rather than moving to core's header-setting `ApiKeyInterceptor`; mocks cannot tell us the server agrees. | [05](05-http-client.md) | | ☑ | ~~Find what produces duplicate-keyed entries in a merged list~~ **Answered.** The merge manufactured them itself. `merge`'s non-overlapping concat fast path (`compare(last, other.first) < 0 → [...this, ...other]`) skipped dedup, and Drift stored `DateTime` as unix **seconds**, so the same message id carried a microsecond-precision `createdAt` in memory and a second-truncated one from the cache — violating the "same key ⇒ same compare value" precondition on every round trip. Merge #1 concatenated silently; merge #2 tripped `_hasUniqueKeys`, which is the [#2660](https://github.com/GetStream/stream-chat-flutter/pull/2660) crash. Both causes are gone: #2660 removed the fast path, and [`7f0804d2d`](https://github.com/GetStream/stream-chat-flutter/commit/7f0804d2d) made persistence store ISO-8601 text. Reproduced end to end on a worktree at `d07f633dd^`. Persistence holds no duplicate rows. | [01](01-utilities.md) | @@ -28,13 +53,11 @@ A row leaves this file when it lands, not when it is decided. | | What | Waiting on | Phase | | --- | --- | --- | --- | | ☐ | Make `sortedMerge` tie-stable, so an edit does not move a message below a same-timestamp neighbour | The last ordering defect left. A comparator tiebreak looks like the cheaper fix and is not one: `Message.id` is a v4 uuid, and `message_dao`'s `(createdAt, id)` is keyset-pagination machinery rather than a chosen display order. Tie-stability in the merge is the honest fix, measured at 1.08-1.39x depending on list length. Findings, dead ends and numbers in [message-ordering.md](message-ordering.md). | [01](01-utilities.md) | -| ☐ | Adopt core's `CurrentPlatform` / `PlatformType`, renaming `.name` → `.operatingSystem` | The restore row above. No release of its own: the SHA pinned in [08](08-query-dsl.md) already carries `debugCurrentPlatformOverride`, which `stream_chat_flutter`'s tests set in 8 places, so this is doable now and only the hosted constraint is outstanding. | [02](02-platform-and-environment.md) | | ☐ | **A `StreamChatConfig`**, mirroring `FeedsConfig` | Deliberately last, as a cleanup step once the adoption is done. It subsumes several rows below, so doing it early would mean doing them twice. See [below](#the-streamchatconfig-that-absorbs-several-of-these). | [10](10-cleanup.md) | | ☐ | Retire `StreamChatClient.additionalHeaders` and `defaultUserAgent` | Both are public mutable statics, so two clients in one process share them. Replacing the first needs a per-client `headers` option; the second reads the static `_systemEnvironmentManager`, so they move together. | [10](10-cleanup.md) | | ☐ | Take `StreamHttpClientOptions` directly instead of `baseURL` / `connectTimeout` / `receiveTimeout` | Folds into the config above rather than being a separate break. | [10](10-cleanup.md) | | ☐ | Mark `StreamHttpClient` `@internal` | `AttachmentFileUploaderProvider` is the only public signature naming it, and retyping that is phase 09's call. | [09](09-uploads.md) | -| ☐ | Reclassify the SDK's own precondition throws | 23 sites still raise `StreamChatError`. `ERROR_LAYER.md` splits them further than a sweep can: a condition a correct program can hit becomes a `StreamException`, while genuine misuse should raise `StateError` / `ArgumentError` and never be wrapped. Doing it by sed would get it wrong. | [03](03-errors.md) | -| ☐ | Delete `stream_chat_error.dart` | Three things first: phase 07 (parked) removes `StreamWebSocketError`, the precondition throws above are reclassified, and the UI's attachment-validation subtypes stop being errors — they are *returned values*, never thrown. `StreamChatNetworkError` is already gone. | [03](03-errors.md) | +| ☐ | Reclassify the SDK's own precondition throws | 19 sites raise `StreamClientException`, retyped mechanically in [03](03-errors.md). `ERROR_LAYER.md` splits them further than a sweep can: a condition a correct program can hit becomes a `StreamException`, while genuine misuse should raise `StateError` / `ArgumentError` and never be wrapped. Doing it by sed would get it wrong. | [03](03-errors.md) | | ☐ | Move chat's WebSocket to `/api/v2/connect` | Three blockers, none of them chat-side: v2's handshake never calls `EnrichUserMutes` (`lib/chat/controller/v1/connect.go:118` only), it decodes `user_details` with `WithDecodeExtraFields(false)` so chat's root-promoted `extraData` is dropped, and core's `ConnectUserDetailsRequest` has no `privacySettings`. iOS is on core and v2 endpoints and still connects over v1. | [07](07-websocket.md) | | ☐ | Narrow `PredefinedFilter._defaultSortFor` to the server's flag condition | It answers `last_message_at` whenever the filter mentions the field at all. The server flips its fallback only when *every* `last_message_at` node is reachable through `$and` alone and at least one narrows by value — `$eq` / `$ne` / `$gt` / `$gte` / `$lt` / `$lte`, or `$exists: true` (`DetectLastMessageAtFiltering`, `lib/core/mq/channel/modifiers.go`). So a preset putting `last_message_at` under `$or`, or matching it with `$in` or `$exists: false`, leaves the server on `last_updated` while the client answers `last_message_at`, and `loadMore`'s offset indexes into a differently ordered list. A test pins the loose `$or` behaviour today, so closing this inverts it. | [08](08-query-dsl.md) | | ☐ | Decide whether id-like sort fields should opt out of string folding | `StreamSortField` folds **every** string value through `normalizeStringForSort`, which is what `ComparableField` did, so [08](08-query-dsl.md) kept it. It also means `UserSortField.id`, `MessageSearchSortField.id`, `MemberSortField.userId`, `MessageReminderSortField.channelCid` and `ThreadSortField.parentMessageId` compare case- and diacritic-insensitively — two ids differing only in case tie, so a composite sort's tie-breaker stops breaking ties. Pre-existing, and a `foldStrings: false` per field would fix it; changing it is a behaviour change beyond the migration. | [08](08-query-dsl.md) | @@ -47,6 +70,8 @@ A row leaves this file when it lands, not when it is decided. | --- | --- | --- | | ☑ | Remove chat's own logger and `package:logging` | Done in [06](06-logger.md): the SDK writes through `StreamLogger`, `logConfig` replaces `logLevel` + `logHandlerFunction`, and no package in the repo imports `package:logging` any more. | | ☑ | Delete `StreamChatClient.devToken` | [04](04-token-and-auth.md) | +| ☑ | Delete `stream_chat_error.dart` | [03](03-errors.md). It was expected to need four unblockings first; three dissolved on contact and the fourth (the UI's attachment-validation subtypes) was the only one needing a decision — they became their own sealed family, since a refused attachment is not a failed call. | +| ☑ | Adopt core's `CurrentPlatform` / `PlatformType` | [02](02-platform-and-environment.md). `.name` → `.operatingSystem`. The *code* is done; shipping it still waits on the release above. | | ☑ | Benchmark `merge` on realistic lists | Done, numbers in [01](01-utilities.md). The two-pointer merge wins 1.3–1.6x wherever the receiver is long and the increment is small, and ties on a full refresh, so it moved to core as `sortedMerge` rather than being dropped for `merge`. Chat's `list_extensions.dart` is deleted; parity with the version it replaced is 0.97–1.01x, and a disjoint-key fast path makes pagination ~8% faster. | | ☑ | Adopt core's `Filter` / `Sort` / `ComparableField` | Done in [08](08-query-dsl.md). It was never blocked on core gaining `$nor`: no core SDK models it, and chat removed `$nor`, `$ne` and `$nin` instead — the API is withdrawing all three. | | ☑ | Decide the fate of `Filter.custom` / `Filter.raw` / `Filter.empty` | [08](08-query-dsl.md): `custom` becomes a per-registry factory, `raw` moved to core, `empty` is replaced by nullability. | diff --git a/core-migration/README.md b/core-migration/README.md index 71f8e7948f..0c36a0d1fc 100644 --- a/core-migration/README.md +++ b/core-migration/README.md @@ -30,7 +30,8 @@ Three documents cut across the phases: Status key: ☐ not started · ◐ partly landed · ☑ done · ⏸ parked. -**07 is parked.** Nothing after it depends on it, so 08–10 proceed as planned. +**07 is parked.** It was attempted in full and reverted; the findings are kept in its own file. +Nothing after it depends on it, so 08–10 proceed as planned. **Net:** ~4.0k LOC of hand-written `lib/src` deleted (of ~29.0k), replaced by ~5.5k LOC of core that is already written and tested. Six direct dependencies become transitive. @@ -108,18 +109,16 @@ Decided once here, not re-argued per phase. ### The barrel is a `show` allowlist `stream_feeds` opens its barrel with `export 'package:stream_core/stream_core.dart';`. **We -cannot.** Exporting core wholesale from `lib/stream_chat.dart` still collides on `AttachmentFile`, -`Filter`, `FilterOperator`, `NullOrdering`, `ComparableField`, `CurrentPlatform`, `PlatformType` -and `User`. Core also re-exports all of dio, while our barrel deliberately re-exports a *narrowed* -dio — and `package:async`, which our barrel also re-exports, declares a `Result` of its own. - -Each landed phase shortens that list, since an adopted type stops being a duplicate. -`InFlightCache`, `SystemEnvironment`, `SystemEnvironmentManager` and -`XStreamClientHeaderExtension` are off it, as are `TokenManager`, `AuthType`, `AuthInterceptor`, -`ConnectionIdInterceptor`, `LoggingInterceptor`, `InterceptStep` and `LogPrint` — chat declares -none of them any more. `Success` went with the rename of `UploadState`'s variants. The allowlist -is the mechanism throughout — grow it phase by phase rather than switching to a wholesale export -at the end. +cannot.** Exporting core wholesale from `lib/stream_chat.dart` still collides on `AttachmentFile` +and `User`, the two types [What stays ours](#what-stays-ours) keeps. Core also re-exports all of +dio, while our barrel deliberately re-exports a *narrowed* dio — and `package:async`, which our +barrel also re-exports, declares a `Result` of its own. + +Each landed phase shortened that list, since an adopted type stops being a duplicate. Everything +else that was on it — the token and interceptor types, the logger types, `InFlightCache`, the +system-environment types, `CurrentPlatform`, `PlatformType` and the whole query DSL — is core's +now, and `Success` went with the rename of `UploadState`'s variants. The allowlist stays the +mechanism: grow it phase by phase rather than switching to a wholesale export at the end. Narrowing is already the precedent in that file: `filter.dart show Filter, FilterOperator` and `device_api.dart show PushProvider`. @@ -152,8 +151,10 @@ Tracked in [`UPSTREAM.md`](UPSTREAM.md), which also covers the reverse direction that every product needs, and things chat's use has shown core to be missing or wrong about. Each phase names the `stream_core` changes it needs, and those should be grouped into as few core -releases as possible. Only one is a hard block on API we already ship publicly: `Filter`'s -`$ne` / `$nin` / `$nor` operators, for phase [08](08-query-dsl.md). +releases as possible. Nothing is blocking any more: phase [08](08-query-dsl.md)'s changes landed +in [stream-core-flutter#181](https://github.com/GetStream/stream-core-flutter/pull/181), and the +`$ne` / `$nin` / `$nor` operators an earlier pass called a hard block are not upstream asks at all +— see that phase. **Diff against the resolved package, not the sibling repo.** Two of this plan's original upstream asks turned out to be already satisfied, because they had been derived from diff --git a/core-migration/UPSTREAM.md b/core-migration/UPSTREAM.md index cb96a6d7c3..67857e28ca 100644 --- a/core-migration/UPSTREAM.md +++ b/core-migration/UPSTREAM.md @@ -17,7 +17,7 @@ rather than deleted so the same asks are not re-raised. | --- | --- | --- | --- | | ☐ | **The retry table** — `isRetriable` over the sealed exception kinds | `ERROR_LAYER.md` §Retrying *specifies* this table, and core owns the doc. Chat now implements it ([03](03-errors.md)); feeds independently re-derived a partial version in `capabilities_repository.dart`'s `shouldRetry`. Two products deriving the same table from the same spec is the definition of a core concern. | Nothing. Strongest candidate here. | | ☐ | **Text operators over an array-valued field** — `QueryOperator` / `AutoCompleteOperator` in `matches()` | Both bail on `fieldValue is! String` (`filter.dart:540`, `:556`), so a getter returning an `Iterable` never matches, whatever the value. Core already resolves arrays element-wise for `$eq`/`$in`/`$contains`; the evaluation operators were not extended with them. The API supports `$autocomplete` on array fields — chat's `ChannelFilterField.memberUserName` is one — so the query is right and only local evaluation disagrees. `stream_feeds` calls `matches()` in 36 event handlers, which is where this would surface first. | Nothing. | -| ☑ | **`normalizeStringForSort`** | Landed in [core#181](https://github.com/GetStream/stream-core-flutter/pull/181) as a utility, ported with its tests. **Not** as a change to `ComparableField`, which the row originally proposed: `Filter` compares through the same code (`filter.dart:299,320`), so folding there would make `$eq`, `$gt` and `$lt` case- and diacritic-insensitive locally while the API stayed exact. | Landed. Chat deleted its copy in phase [10](10-cleanup.md), which also dropped `diacritic` as a direct dependency. | +| ☑ | **`normalizeStringForSort`** | Landed in [core#181](https://github.com/GetStream/stream-core-flutter/pull/181) as a utility, ported with its tests. **Not** as a change to `ComparableField`, which the row originally proposed: `Filter` compares through the same code (`filter.dart:299,320`), so folding there would make `$eq`, `$gt` and `$lt` case- and diacritic-insensitive locally while the API stayed exact. | Landed on `main`, **not in released 0.5.0**. Chat deleted its copy in `b414ab3ce`. | | ✗ | **`Filter` `$nor`** | **Dropped, and chat removes it too.** Neither StreamCore (Swift) nor stream-android-core models `$nor`, and adding it to Dart alone breaks a parity the three otherwise keep. The backend withdrew `$ne`/`$nin` from the published spec in [GetStream/chat#15657](https://github.com/GetStream/chat/pull/15657) and left `$nor` accepted-but-unpublished, so a preset can still contain it — which is what `Filter.raw` is for, not a modelled operator. | Closed. | | ☑ | **Element-wise matching for array fields** | Open in [core#181](https://github.com/GetStream/stream-core-flutter/pull/181). `Filter.equal` and `Filter.in_` compared an array field with order-sensitive deep equality, so a list-valued getter could never match. Every array field the API exposes is matched element-wise — `members` by an `EXISTS` join, `filter_tags` by `@> AND <@` then `&&`, `teams` by `?|`, `attachments.type` by a nested `@>` — and none is order-sensitive. Without it `members`, `member.user.name` and `attachments.type` were undeclarable. | Nothing. | | ☑ | **A `sortedMerge` alongside core's `merge`** (`utils/list_extensions.dart`) | Landed. Offered as a second method rather than a replacement: the two differ on contract, not quality — `sortedMerge` requires a sorted receiver and merges in O(n + m), `merge` assumes no order and sorts. Parity with the chat method it replaced is 0.97–1.01x, and a disjoint-key fast path makes pagination ~8% faster. Duplicate keys collapse as `merge` does, detected for free off the maps the walk already builds. | — | @@ -29,9 +29,8 @@ rather than deleted so the same asks are not re-raised. | ✗ | **`SortDirection.fromJson`** | **Dropped: the generator would never call it.** `json_serializable` uses a `fromJson` static for class-typed fields, but decodes enums through `$enumDecode` against the generated map, taking its fallback from `@JsonKey(unknownValue:)` at each field site. A static would be reachable only by hand while generated code disagreed with it. The rule stays in chat as `ChannelSort._directionFromJson`. | Closed. | | ☐ | **Drop the restated `nullOrdering` defaults in feeds' `XSort` classes** | All twelve declare `super.nullOrdering = NullOrdering.nullsLast/First`, which is exactly what `Sort.asc`/`Sort.desc` already default to. A super-parameter inherits the super constructor's default, so `{super.nullOrdering}` is behaviour-identical and saves ~130 of feeds' 219 lines. Verified by probe. | Nothing. | | ☐ | **A const-constructible `SortField`** | `SortField(remote, closure)` can never be const — a closure literal is not a constant expression — so every registry member is `static final` and every `defaultSort` list is `final` too. Nothing is broken by that; it just means a caller cannot write a `const` sort list, and it cost [08](08-query-dsl.md) the list controllers' `const` default parameters. Const-ness needs the value lookup to be an overridden method rather than a constructor argument, which both chat and feeds would have to adopt together. | Would change `SortField`'s constructor, so it is a core-wide API decision, not a chat ask. | -| ☑ | **`CurrentPlatform.debugCurrentPlatformOverride`** | Landed on core's `main` in #178. | Landed; chat can use it on the next release. | - -| ☐ | **`Filter.raw`** | Open in [core#181](https://github.com/GetStream/stream-core-flutter/pull/181). `Filter` is `sealed`, so a gap has no downstream workaround, and chat needs one: a predefined filter is authored server-side and the query layer still accepts `$ne`/`$nin`/`$nor` ([#15657](https://github.com/GetStream/chat/pull/15657) is spec-only), so an echoed filter can carry an operator core does not model. `raw` is the fallback leaf that lets [08](08-query-dsl.md)'s `Filter.fromJson` stay total, the way `XSortField.custom` does for sort fields. `matches` on a raw leaf **throws**: `true` is right under `and` and wrong under `or`, `false` inverts that, and Swift's third state comes from a nullable predicate that `bool matches(T)` cannot express. Refusing is the only outcome that cannot silently produce a wrong result. | Nothing. | +| ☑ | **`CurrentPlatform.debugCurrentPlatformOverride`** | Landed on core's `main` in #178. | Landed on `main`; **not in released 0.5.0**, and chat already uses it. | +| ◐ | **`Filter.raw`** | Open in [core#181](https://github.com/GetStream/stream-core-flutter/pull/181). `Filter` is `sealed`, so a gap has no downstream workaround, and chat needs one: a predefined filter is authored server-side and the query layer still accepts `$ne`/`$nin`/`$nor` ([#15657](https://github.com/GetStream/chat/pull/15657) is spec-only), so an echoed filter can carry an operator core does not model. `raw` is the fallback leaf that lets [08](08-query-dsl.md)'s `Filter.fromJson` stay total, the way `XSortField.custom` does for sort fields. `matches` on a raw leaf **throws**: `true` is right under `and` and wrong under `or`, `false` inverts that, and Swift's third state comes from a nullable predicate that `bool matches(T)` cannot express. Refusing is the only outcome that cannot silently produce a wrong result. | Nothing. | ## Deliberately *not* moving @@ -69,11 +68,14 @@ product would react to it the same way. Nothing outside chat reacts to `message. ## How to raise one Core is a separate repo with its own release cadence, so batch these: a row here is rarely urgent on -its own, and each release chat has to wait for costs more than the change itself. Neither of the two this file used to -name is live any more: `$nor` is dropped (chat removes it in the same PR that adopts core's -`Filter`, because the API is withdrawing it), and `debugCurrentPlatformOverride` has landed on -core's `main`. What matters now is a single release carrying everything the branch pins to — -[DEFERRED.md](DEFERRED.md) holds that list. The retry table is the strongest of the rest. +its own, and each release chat has to wait for costs more than the change itself. + +**What to push first is no longer a question of which row — it is one release.** `$nor` is closed +and `debugCurrentPlatformOverride` has landed, so the old advice here is spent. What matters now is +that chat already *depends* on five core APIs absent from released 0.5.0, so the branch cannot ship +until a release carries all of them. [`DEFERRED.md`](DEFERRED.md) holds the list and is the +authoritative copy. Everything else in this file is genuinely batchable behind it; the retry table +is the strongest of those. Cross-repo workflow is in [`STYLE_GUIDE.md`](../STYLE_GUIDE.md) (§Dependency management): a path dependency while both repos change together, back to a hosted constraint in `melos.yaml` before diff --git a/migrations/v11-migration.md b/migrations/v11-migration.md index 3ad87eff53..f357fe42a5 100644 --- a/migrations/v11-migration.md +++ b/migrations/v11-migration.md @@ -17,8 +17,14 @@ onto Stream's OpenAPI-generated API client. - [Quick Reference](#quick-reference) - [Symbol Map](#symbol-map) - [Error Handling](#error-handling) + - [Endpoints that still throw](#endpoints-that-still-throw) + - [Logging](#logging) + - [Anonymous connections identify as `!anon`](#anonymous-connections-identify-as-anon) + - [Retry behaviour changed](#retry-behaviour-changed) - [The error type changed too](#the-error-type-changed-too) +- [Offline Cache](#offline-cache) - [Feature Areas](#feature-areas) + - [Sorting](#sorting) - [Migration Checklist](#migration-checklist) - [For AI Agents](#for-ai-agents) - [Contributing to this guide](#contributing-to-this-guide) @@ -32,14 +38,16 @@ onto Stream's OpenAPI-generated API client. | v10.x, using `StreamChatClient` / `Channel` directly | All of it — the API-facing types are what changed | | v10.x, UI widgets only (`stream_chat_flutter`) | [Error Handling](#error-handling) and any [Feature Area](#feature-areas) whose models you read from `Message`, `Channel`, or `User` | | v10.x, with a custom `AttachmentFileUploader` | [Feature Areas](#feature-areas) → File Upload | +| v10.x, with `stream_chat_persistence` | [Offline Cache](#offline-cache) — the local database is rebuilt on first launch | +| v10.x, using list controllers without an explicit `sort` | [Feature Areas](#feature-areas) → [Sorting](#sorting) | | A v11 beta | [Symbol Map](#symbol-map) only — entries are additive across betas | --- ## What Changed and Why -The `stream_chat` package now talks to Stream's API through a client generated from the same OpenAPI spec that -backs our other SDKs, instead of a hand-written HTTP layer. For you this means: +The `stream_chat` package is moving onto a client generated from the same OpenAPI spec that backs our other +SDKs, replacing its hand-written HTTP layer endpoint by endpoint. For you this means: - **Consistent shapes across Stream products.** A response type in Flutter now matches its counterpart in our other SDKs, because both come from one spec. @@ -57,7 +65,7 @@ from the spec, so don't subclass them or depend on their private constructors. | Feature Area | Key Changes | | --- | --- | -| [**Error Handling**](#error-handling) | API calls return `Result` instead of throwing; failures carry `stream_core`'s sealed `StreamException` family instead of `StreamChatNetworkError`; `ChatErrorCode` → `StreamErrorCode` | +| [**Error Handling**](#error-handling) | Failures carry `stream_core`'s sealed `StreamException` family instead of `StreamChatNetworkError`; `ChatErrorCode` → `StreamErrorCode`. API calls will return `Result` rather than throwing, endpoint by endpoint | | _(filled in per feature as PRs land)_ | | --- @@ -74,11 +82,16 @@ search-and-replace you can apply directly. `Kind` is one of `renamed`, `removed` | `StreamChatNetworkError.isRequestCancelledError` | `StreamNetworkException.isCancelled` | `moved` | | | `StreamChatNetworkError.stackTrace` | `Failure.stackTrace`, or the language at the throw site | `removed` | A `StreamException` carries `message` and `cause` and no trace: a trace records the raise, not the failure | | `StreamChatNetworkError.type` (`StreamChatNetworkErrorType`) | `StreamNetworkException.isTimeout` / `.isCancelled` | `retyped` | Lossy: `connectionTimeout`, `sendTimeout` and `receiveTimeout` all become `isTimeout` | +| `StreamChatError` | `StreamChatException` | `retyped` | The base of the old tree. `on StreamChatError catch` becomes `on StreamChatException catch`; SDK precondition failures now raise `StreamClientException` | +| `StreamWebSocketError` | `StreamApiException` / `StreamNetworkException` | `retyped` | A refusal the server sent carries the first; a socket that failed on its own carries the second | +| `StreamWebSocketError.isRetriable` | `StreamChatException.isRetriable` | `moved` | Now an extension over the sealed family, so it reads the same on any failure | | `ChatErrorCode` | `StreamErrorCode` (`stream_core`) | `removed` | Extension type over `int` with named constants. `requestTimeout` was `23`, which the API never returns; the real code is `48` | | `RetryPolicy.shouldRetry`'s `StreamChatError?` | `StreamChatException?` | `retyped` | | | `UploadState`'s `Preparing` / `InProgress` / `Success` / `Failed` | `UploadStatePreparing` / `UploadStateInProgress` / `UploadStateSuccess` / `UploadStateFailed` | `renamed` | Frees `Success` for `Result` | | `PagedValue.error(StreamChatError)` (`stream_chat_flutter_core`) | `PagedValue.error(StreamChatException)` | `retyped` | | | `errorBuilder: Function(BuildContext, StreamChatError)` (scroll views) | `Function(BuildContext, StreamChatException)` | `retyped` | | +| `StreamAttachmentValidator.validate()` / `.validateCount()` returning `StreamChatError?` | returning `AttachmentValidationError?` | `retyped` | `stream_chat_flutter`. They always returned rather than threw; the return type now says so | +| `AttachmentLimitReachedError` / `AttachmentTooLargeError` / `AttachmentBlockedError` extending `StreamChatError` | extending `sealed AttachmentValidationError` | `retyped` | A refused attachment is not a failed call, so it is no longer one of the `StreamException` kinds. `switch` over them is exhaustive | | `Token` | `UserToken` (`stream_core`) | `renamed` | `Token.fromRawValue(x)` → `UserToken(x)`; parses `exp`, so expiry is known | | `TokenProvider` (typedef `Future Function(String)`) | `TokenProvider` (interface, `stream_core`) | `retyped` | A closure no longer satisfies it. Wrap it: `TokenProvider.dynamic(loader)`, where `typedef UserTokenLoader = Future Function(String userId)` — so the loader returns a `UserToken`, not a `String`, and must be async | | — | `UserToken(rawJwt)` | `added` | **Throws on a malformed JWT**, where `Token.fromRawValue` accepted anything. It also rejects a token whose `user_id` claim does not match the id it was loaded for. Both present as "cannot log in" rather than as a compile error | @@ -88,18 +101,20 @@ search-and-replace you can apply directly. `Kind` is one of `renamed`, `removed` | `StreamChatClient.logger` (a `Logger`) | `StreamChatClient.logger` (a `StreamLogger`) | `retyped` | Messages are lazy: `logger.i(() => '…')` | | `StreamChatClient.detachedLogger` / `.defaultLogHandler` / `LogHandlerFunction` | — | `removed` | Supply a `StreamLogHandler`; `StreamLogHandler.console()` is the default | | `export 'package:logging'` (`Logger`, `Level`, `LogRecord`) | `StreamLogger`, `StreamLogConfig`, `StreamLogHandler`, `StreamLogFilter`, `StreamLogPriority`, `StreamLogRecord` | `removed` | `package:logging` is no longer a dependency | -| `LoggingInterceptor` / `InterceptStep` / `LogPrint` | — | `removed` | The interceptor is installed by default and writes through your `StreamLogHandler`; route its output with `logConfig` | | `StreamChatPersistenceClient(logLevel:, logHandlerFunction:)` | — | `removed` | Logging is configured once, on the client | | `SortOption.asc(field)` / `.desc(field)` | `ChannelSort.asc(field)` / `MemberSort.desc(field)` / … | `renamed` | One `Sort` subclass per model, as in `stream_feeds`. `nullOrdering` is still a named parameter | | `SortOption.ASC` / `.DESC` | `SortDirection.asc` / `.desc` | `retyped` | An enum carrying `value` (`1` / `-1`) rather than a bare `int` | | `const [SortOption.desc(f)]` | `[ChannelSort.desc(f)]` | `retyped` | **Drop the `const`.** A sort list can no longer be `const`: a `SortField` holds a closure that reads the value off the model, which is not a constant expression. Every v10 example wrote `const`, so expect this on the first line you touch | | `ChannelSortKey` / `MessageSortKey` / `UserSortKey` / … (extension types over `String`) | `ChannelSortField` / `MessageSearchSortField` / `UserSortField` / … | `retyped` | Same member names. A field is no longer a `String`: read `field.remote` for the wire name. `MessageSortKey` is named for its one endpoint: searching | -| `SortOption.desc('my_custom_field')` | `ChannelSort.desc(ChannelSortField.custom('my_custom_field'))` | `retyped` | Declared on channel, member, user and message-search sorts only — poll, poll-vote, thread, draft, reaction and banned-user queries pin their sort to declared fields and reject a custom one | +| `SortOption.desc('my_custom_field')` | `ChannelSort.desc(ChannelSortField.custom('my_custom_field'))` | `retyped` | Only for a field the model does not declare, and only on channel, member, user and message-search sorts — the other queries pin their sort to declared fields and reject a custom one. `custom` reads `extraData`, so pointing it at a declared field sends the right wire name but reads `null` locally — an offline or re-sorted list comes back unordered | | `SortOrder` | `List`, `List`, … | `removed` | The typedef is gone; signatures name the model's sort type | | `SortOption.fromJson` | `ChannelSort.fromJson` | `moved` | `Sort` has no `fromJson`: the remote name has to resolve back to a declared field | | `SortOption(comparator:)` | — | `removed` | Declare a field whose value projects onto something orderable, or sort the list yourself | | `DraftSortKey`'s `extraData` fallback | — | `removed` | The server rejects a custom sort field on drafts | | `PollVoteSortKey.answerText` | — | `removed` | The API rejects a sort on `answer_text` | +| a raw-string sort on `language` | `UserSortField.language` | `added` | Declared now, so prefer it over `UserSortField.custom('language')`, which reads `extraData` and never sees a typed property | +| a raw-string sort on `updated_at` for members | `MemberSortField.updatedAt` | `added` | Same: prefer the declared field over `.custom` | +| a raw-string sort on `text` / `type` / `parent_id` / `reply_count` / `pinned` | `MessageSearchSortField.text` / `.type` / `.parentId` / `.replyCount` / `.pinned` | `added` | The fields the JS client already exposed | | _(new)_ | `ChannelSortField.cid` | `added` | Both iOS and Android sort channels by `cid` | | _(new)_ | `MessageReminderSortField.messageId` | `added` | The server allows it and breaks reminder ties on it | | _(new)_ | `MessageSearchSortField.relevance` | `added` | Sorts search results by match quality; the server drops it when the request has no text filter | @@ -130,14 +145,19 @@ search-and-replace you can apply directly. `Kind` is one of `renamed`, `removed` | `mergeSorted` | `sortedMerge` | `renamed` | A key held twice now collapses to the last element carrying it, as `merge` does, rather than being carried through | | `updateIf(test, update)` | `updateWhere(test, update: update)` | `renamed` | The second argument is named | | `mergeFrom(other, key:, value:)` | `merge(other.map(value).nonNulls, key:)` | `removed` | Project first, then merge | +| `StreamMessageSearchListController.filter` / `.messageFilter` (both `Filter`) | `ChannelFilter` / `MessageSearchFilter?` | `retyped` | Two registries on one controller: `filter` narrows the channels searched, `messageFilter` the messages. Fields for the latter are `MessageSearchFilterField` — `ChannelFilterField` has no `text` | +| `Result` (`package:async`, via this barrel) | `Result` (`stream_core`) | `retyped` | A different type under the same name. `package:async` is still re-exported, but with `Result` hidden | +| `CurrentPlatform` / `PlatformType` (`stream_chat`) | `CurrentPlatform` / `PlatformType` (`stream_core`) | `moved` | Re-exported from this package. Same seven platforms and the same strings | +| `CurrentPlatform.name` | `CurrentPlatform.operatingSystem` | `renamed` | Same value — `'android'`, `'ios'`, `'web'`, `'macos'`, … | | _(more added per feature as PRs land)_ | | | | --- ## Error Handling -**This is the one change that touches every call site.** API methods no longer throw on failure — they return a -`Result`, matching the `stream_feeds` SDK. +**This is the change that will touch every call site.** API methods will return a `Result` instead of +throwing, matching the `stream_feeds` SDK. That conversion lands endpoint by endpoint and none has moved yet — +what has already changed is the *type* of failure every endpoint throws. **Before:** ```dart @@ -149,12 +169,12 @@ try { } ``` -**After:** +**After**, once the endpoint you are calling has moved — the shape, not a call you can make today: ```dart -final result = await client.getDevices(); +final result = await client.someMigratedCall(); result.fold( - onSuccess: (response) => print(response.devices), + onSuccess: (response) => print(response), onFailure: (error, stackTrace) => print(error), ); ``` @@ -167,20 +187,20 @@ If you want the old behaviour at a call site while you migrate incrementally, `g underlying error: ```dart -final response = (await client.getDevices()).getOrThrow(); +final response = (await client.someMigratedCall()).getOrThrow(); ``` ### Endpoints that still throw `Result` arrives feature by feature. Until a given endpoint has migrated it still **throws** — but it throws a -`StreamChatException` now, not a `StreamChatNetworkError`. So during the v11 betas both of these are live, and both -report the same four kinds: +`StreamChatException` now, not a `StreamChatNetworkError`. So during the v11 betas both call styles are live, and +both report the same four kinds: ```dart // A migrated endpoint returns a Result. -final result = await client.getDevices(); +final result = await client.someMigratedCall(); -// One that has not yet still throws — the type is what changed. +// One that has not migrated still throws — the type is what changed. try { await channel.sendMessage(message); } on StreamChatException catch (error) { @@ -217,10 +237,12 @@ tempting one-for-one swap silently stops handling most failures: Note this differs from the `Result.fold` example further down: `Failure.error` is typed `Object`, so a `switch` on it *does* need a default arm. Only the caught root is sealed. -> **`StreamChatNetworkError` is gone, not deprecated.** Nothing throws it any more, so leaving the name declared -> would let `on StreamChatNetworkError catch (e)` keep compiling while silently matching nothing — a break you -> could ship without noticing. Deleting it makes the same clause fail to compile, so the analyzer points at every -> site you need to change. +> **The old error types are deleted, not deprecated.** `StreamChatError`, `StreamChatNetworkError`, +> `StreamChatNetworkErrorType` and `StreamWebSocketError` are gone. This is deliberate: a deprecated +> `StreamChatNetworkError` would leave `on StreamChatNetworkError catch (e)` compiling while silently matching +> nothing, so a failure you used to handle would pass straight through at runtime. Deleting the type turns that +> into a compile error instead. Replace each one with `StreamChatException`, or with the specific kind you care +> about — see the Symbol Map for the row-by-row mapping. ### Logging @@ -315,11 +337,51 @@ counterpart: `code` is now a `StreamErrorCode` (an extension type over `int`, wi --- +## Offline Cache + +If you use `stream_chat_persistence`, the local database is **rebuilt from empty** the first time your app runs +on v11. The Drift schema version moves from `1035` to `1102`, and the upgrade strategy drops and recreates every +table rather than migrating rows. + +Everything held on disk is discarded: channels, messages, members, reads, drafts, locations, polls, poll votes +and reactions. **Messages that failed or were queued while offline are stored in the same table**, so they go +too, and they are not re-sent. Anything already synced comes back on the next query; anything that never reached +the server does not. + +No code changes for this, but plan for one cold start: the first channel list and the first message list after +upgrading are network reads, not cache reads. + +--- + ## Feature Areas _Each migrated feature gets a section here. Sections are added by the PR that migrates the feature, using the template in [Contributing to this guide](#contributing-to-this-guide)._ +### Sorting + +**`sort: null` no longer suppresses sorting.** A list controller used to default the argument, so passing +`null` explicitly sent no sort and let the server order the result. Its `sort` is non-nullable now: leaving the +argument out applies the model's default, and `XSort.empty` is what sends no sort. + +```dart +// v10 — sends no sort, server ordering. +StreamUserListController(client: client, sort: null); + +// v11 — sends no sort, server ordering. +StreamUserListController(client: client, sort: UserSort.empty); + +// v11 — sends UserSort.defaultSort. +StreamUserListController(client: client); +``` + +This applies to the user, member, draft, poll-vote, message-reminder and channel controllers. +`StreamThreadListController`, `StreamReactionListController` and `StreamMessageSearchListController` declare no +default and still send nothing unless given a sort. + +An empty sort also leaves a loaded page in the order it arrived in, rather than re-sorting it — including a page +read from the offline cache, which orders by the model's default when the query named no sort. + --- ## Migration Checklist @@ -335,7 +397,10 @@ Work top to bottom; each item is independently verifiable. - [ ] Apply every row of the [Symbol Map](#symbol-map) - [ ] Re-check custom data access: fields that used to arrive in `extraData` may now be typed properties - [ ] If you implement `AttachmentFileUploader`, review its section under [Feature Areas](#feature-areas) -- [ ] If you persist models yourself, re-check nullability — generated types are nullable wherever the API allows it +- [ ] If you persist models yourself, re-check nullability as endpoints move to the generated types, which are nullable wherever the API allows it +- [ ] Replace `sort: null` on any list controller with `XSort.empty` if you relied on server ordering — see + [Sorting](#sorting) +- [ ] If you use `stream_chat_persistence`, expect one cold start after upgrading — see [Offline Cache](#offline-cache) - [ ] Run `dart analyze` and your test suite; the analyzer finds most of the mechanical work for you --- @@ -346,7 +411,7 @@ If you are an agent performing this upgrade in a consumer codebase, work in this 1. **Bump the dependency** and run `dart pub get`, then `dart analyze`. The error list is your work queue — do not try to find call sites by reading code first. -2. **Apply the [Symbol Map](#symbol-map) top to bottom.** Every row is a whole-symbol rename; prefer an +2. **Apply the [Symbol Map](#symbol-map) top to bottom, reading the `Kind` column first.** `renamed` and `moved` rows are whole-symbol rewrites; prefer an identifier-aware rewrite over plain text replacement so you don't hit substrings or comments. 3. **Fix error handling per call site**, not globally. `getOrThrow()` preserves existing behaviour and is the correct minimal change when the caller already has a `try`/`catch`; use `fold` when the caller should handle diff --git a/packages/stream_chat/CHANGELOG.md b/packages/stream_chat/CHANGELOG.md index 45aa2bf576..57eae5033a 100644 --- a/packages/stream_chat/CHANGELOG.md +++ b/packages/stream_chat/CHANGELOG.md @@ -8,6 +8,9 @@ - Anonymous connections now identify as `!anon` rather than a client-generated random id, matching every other Stream SDK. The backend pins that id so a client cannot claim to be another user. - `StreamChatClient.devToken` is removed. It minted a `devtoken`-signed JWT, which only an app with development tokens enabled accepts; generate tokens on your backend, or build one in your own test helper. - A failed request now throws one of four sealed `StreamException` kinds — `StreamApiException`, `StreamNetworkException`, `StreamAuthenticationException` or `StreamClientException` — instead of a `StreamChatNetworkError`. `StreamChatException` aliases the root, so `on StreamChatException catch` handles them all. See the [v11 migration guide](https://github.com/GetStream/stream-chat-flutter/blob/master/migrations/v11-migration.md#error-handling). +- `StreamChatError`, `StreamChatNetworkError`, `StreamChatNetworkErrorType` and `StreamWebSocketError` are removed rather than deprecated, so a clause catching one fails to compile instead of silently matching nothing. `isRetriable` is now an extension on `StreamChatException`. +- Misusing the client raises a `StateError` rather than a `StreamChatException`: connecting twice, opening a connection that is already open, `queryChannels` without one, using a persistence client that is not set or belongs to another user, and cancelling an attachment upload that never started or already finished. These say fix the call, not handle the failure, so they are outside the exception hierarchy. +- A send superseded by a later one, and a pending upload dropped because its message was deleted, now report a `StreamNetworkException` with `isCancelled` set, matching how a cancelled attachment upload has always been reported. They were `StreamClientException`, which tells a caller to report them to a crash tracker. - `ChatErrorCode` is removed in favour of `StreamErrorCode`. One value was wrong: `requestTimeout` was `23`, which the API never returns; the real code is `48`. - `RetryPolicy.shouldRetry` receives a `StreamChatException?` instead of a `StreamChatError?`. - `UploadState`'s variant classes are renamed to `UploadStatePreparing`, `UploadStateInProgress`, `UploadStateSuccess` and `UploadStateFailed`, freeing the names `Success` and `Failed`. @@ -32,12 +35,16 @@ - Every query takes its own filter type — `queryChannels` a `ChannelFilter?`, `queryUsers` a `UserFilter?`, and so on — and `PredefinedFilter.filter` is a `ChannelFilter`. - `ChannelFilterField.members` and `.memberUserName` are declared, so the standard "channels I am in" query stays typed. - `LocationCoordinates` is renamed `LocationCoordinate` — singular. Its `copyWith` is removed, and it gains `distanceTo`, which answers the distance between two points. +- `CurrentPlatform` and `PlatformType` keep their names; `CurrentPlatform.name` becomes `CurrentPlatform.operatingSystem`, reporting the same string. - The list extensions are consolidated into one `SortedListExtensions`. `SortedListX`, `IterableMergeX` and `ListX` are removed: `mergeSorted` becomes `sortedMerge` (and now collapses a repeated key instead of carrying it through, matching `merge`), `updateIf` becomes `updateWhere` (its `update` argument is now named), and `mergeFrom` is dropped in favour of `merge` over a projected list. - `DraftSortField` has no `custom` field: the API rejects a custom sort field on drafts. - A sort names its model's field type, so `MemberSort.asc` takes a `MemberSortField` and a field from another model does not compile. `XSortField.custom(key)` reads a field from the model's extra data, for the four models whose queries accept one. - Added `ChannelSort.empty`, `MemberSort.empty` and one on every other sort — an empty sort, for querying with the ordering the API applies on its own. - Default sorts moved onto the sort that owns them: `ChannelSort.defaultSort`, `MemberSort.defaultSort` and so on, reachable now without the Flutter layer. -- `StreamChatNetworkError` and `StreamChatNetworkErrorType` are removed. Nothing throws them any more, so keeping them would let an `on StreamChatNetworkError catch` clause compile while matching nothing. + +🐞 Fixed + +- A message that fails because its attachments did not upload now says which ones and what each reported, instead of `Failed to upload one or more attachments`. 🔄 Changed diff --git a/packages/stream_chat/lib/src/client/channel/channel.dart b/packages/stream_chat/lib/src/client/channel/channel.dart index f8239d93d0..3a4560ef41 100644 --- a/packages/stream_chat/lib/src/client/channel/channel.dart +++ b/packages/stream_chat/lib/src/client/channel/channel.dart @@ -608,13 +608,12 @@ class Channel { }) { final cancelToken = _cancelableAttachmentUploadRequest[attachmentId]; if (cancelToken == null) { - throw const StreamChatError( - "Upload request for this Attachment hasn't started yet or maybe " - 'Already completed', + throw StateError( + "Upload request for attachment '$attachmentId' hasn't started yet, or has already completed.", ); } if (cancelToken.isCancelled) { - throw const StreamChatError('Upload request already cancelled'); + throw StateError("Upload request for attachment '$attachmentId' was already cancelled."); } cancelToken.cancel(reason); } @@ -633,7 +632,7 @@ class Channel { ].firstWhereOrNull((it) => it.id == messageId); if (message == null) { - throw const StreamChatError('Error, Message not found'); + throw const StreamClientException(message: 'Error, Message not found'); } final attachments = message.attachments.where((it) { @@ -781,7 +780,8 @@ class Channel { // Cancelling previous completer in case it's called again in the process // Eg. Updating the message while the previous call is in progress. - _messageAttachmentsUploadCompleter.remove(message.id)?.completeError(const StreamChatError('Message cancelled')); + const cancelled = StreamNetworkException(message: 'Message cancelled', isCancelled: true); + _messageAttachmentsUploadCompleter.remove(message.id)?.completeError(cancelled); final quotedMessage = state!.messages.firstWhereOrNull( (m) => m.id == message.quotedMessageId, @@ -816,8 +816,8 @@ class Channel { message = await attachmentsUploadCompleter.future; // Fail the whole message if any attachment failed to upload - if (message.attachments.any((it) => it.uploadState.isFailed)) { - throw const StreamChatError('Failed to upload one or more attachments'); + if (message.attachments.where((it) => it.uploadState.isFailed) case final failed when failed.isNotEmpty) { + throw StreamClientException(message: _uploadFailureMessage(failed)); } } @@ -827,7 +827,7 @@ class Channel { // Remove the message from state as it is invalid. state!.deleteMessage(message, hardDelete: true); - throw const StreamChatError('Message is not valid for sending'); + throw const StreamClientException(message: 'Message is not valid for sending'); } // Wait for the previous sendMessage call to finish. Otherwise, the order @@ -886,7 +886,8 @@ class Channel { // Cancelling previous completer in case it's called again in the process // Eg. Updating the message while the previous call is in progress. - _messageAttachmentsUploadCompleter.remove(message.id)?.completeError(const StreamChatError('Message cancelled')); + const cancelled = StreamNetworkException(message: 'Message cancelled', isCancelled: true); + _messageAttachmentsUploadCompleter.remove(message.id)?.completeError(cancelled); // ignore: parameter_assignments message = message.copyWith( @@ -916,8 +917,8 @@ class Channel { message = await attachmentsUploadCompleter.future; // Fail the whole message if any attachment failed to upload - if (message.attachments.any((it) => it.uploadState.isFailed)) { - throw const StreamChatError('Failed to upload one or more attachments'); + if (message.attachments.where((it) => it.uploadState.isFailed) case final failed when failed.isNotEmpty) { + throw StreamClientException(message: _uploadFailureMessage(failed)); } } @@ -975,7 +976,8 @@ class Channel { // Cancelling previous completer in case it's called again in the process // Eg. Updating the message while the previous call is in progress. - _messageAttachmentsUploadCompleter.remove(message.id)?.completeError(const StreamChatError('Message cancelled')); + const cancelled = StreamNetworkException(message: 'Message cancelled', isCancelled: true); + _messageAttachmentsUploadCompleter.remove(message.id)?.completeError(cancelled); // ignore: parameter_assignments message = message.copyWith( @@ -1140,7 +1142,9 @@ class Channel { // Removing the attachments upload completer to stop the `sendMessage` // waiting for attachments to complete. final completer = _messageAttachmentsUploadCompleter.remove(message.id); - completer?.completeError(const StreamChatError('Message deleted')); + completer?.completeError( + const StreamNetworkException(message: 'Message deleted', isCancelled: true), + ); } // Deletes all the attachments associated with the given [message] @@ -1885,9 +1889,10 @@ class Channel { } if (!canUseReadReceipts) { - throw const StreamChatError( - 'Cannot mark as read: Channel does not support read events. ' - 'Enable read_events in your channel type configuration.', + throw const StreamClientException( + message: ''' + Cannot mark as read: Channel does not support read events. + Enable read_events in your channel type configuration.''', ); } @@ -1914,9 +1919,11 @@ class Channel { final messages = state!.messages; final anchorIndex = messages.indexWhere((it) => it.id == messageId); if (anchorIndex < 0) { - throw StreamChatError( - 'Cannot mark as unread: Message "$messageId" was not found in the ' - 'locally-known messages for this channel.', + throw StreamClientException( + message: + ''' + Cannot mark as unread: Message "$messageId" was not found in the + locally-known messages for this channel.''', ); } @@ -1934,9 +1941,10 @@ class Channel { } if (!canUseReadReceipts) { - throw const StreamChatError( - 'Cannot mark as unread: Channel does not support read events. ' - 'Enable read_events in your channel type configuration.', + throw const StreamClientException( + message: ''' + Cannot mark as unread: Channel does not support read events. + Enable read_events in your channel type configuration.''', ); } @@ -1972,9 +1980,10 @@ class Channel { } if (!canUseReadReceipts) { - throw const StreamChatError( - 'Cannot mark as unread: Channel does not support read events. ' - 'Enable read_events in your channel type configuration.', + throw const StreamClientException( + message: ''' + Cannot mark as unread: Channel does not support read events. + Enable read_events in your channel type configuration.''', ); } @@ -1986,9 +1995,10 @@ class Channel { _checkInitialized(); if (!canUseReadReceipts) { - throw const StreamChatError( - 'Cannot mark thread as read: Channel does not support read events. ' - 'Enable read_events in your channel type configuration.', + throw const StreamClientException( + message: ''' + Cannot mark thread as read: Channel does not support read events. + Enable read_events in your channel type configuration.''', ); } @@ -2000,9 +2010,10 @@ class Channel { _checkInitialized(); if (!canUseReadReceipts) { - throw const StreamChatError( - 'Cannot mark thread as unread: Channel does not support read events. ' - 'Enable read_events in your channel type configuration.', + throw const StreamClientException( + message: ''' + Cannot mark thread as unread: Channel does not support read events. + Enable read_events in your channel type configuration.''', ); } @@ -2482,3 +2493,22 @@ class Channel { ); } } + +// Names which attachments failed and what each reported, so the caller is not +// left with "one or more". +// +// The reasons are strings because `UploadStateFailed.error` is one: whatever +// each upload threw was stringified when its state was recorded, so there is no +// throwable left to carry as a `cause`. +String _uploadFailureMessage(Iterable failed) { + final reasons = failed.map((it) { + final reason = switch (it.uploadState) { + UploadStateFailed(:final error) => error, + _ => 'unknown error', + }; + + return '${it.id}: $reason'; + }); + + return 'Failed to upload ${failed.length} attachment(s) — ${reasons.join('; ')}'; +} diff --git a/packages/stream_chat/lib/src/client/client.dart b/packages/stream_chat/lib/src/client/client.dart index 0e7cf1c4e0..e498d7fde8 100644 --- a/packages/stream_chat/lib/src/client/client.dart +++ b/packages/stream_chat/lib/src/client/client.dart @@ -6,6 +6,7 @@ import 'package:meta/meta.dart'; import 'package:rxdart/rxdart.dart'; import 'package:stream_core/stream_core.dart' show + CurrentPlatform, InFlightCache, LocationCoordinate, SortedListExtensions, @@ -24,7 +25,7 @@ import '../core/api/attachment_file_uploader.dart'; import '../core/api/requests.dart'; import '../core/api/responses.dart'; import '../core/api/stream_chat_api.dart'; -import '../core/error/error.dart'; +import '../core/error/stream_chat_exception.dart'; import '../core/http/app_settings_manager.dart'; import '../core/http/connection_id_manager.dart'; import '../core/http/stream_http_client.dart'; @@ -49,7 +50,6 @@ import '../core/models/reaction.dart'; import '../core/models/role.dart'; import '../core/models/thread.dart'; import '../core/models/user.dart'; -import '../core/platform_detector/platform_detector.dart'; import '../core/util/event_controller.dart'; import '../core/util/extension.dart'; import '../core/util/immutable_collection_subjects.dart'; @@ -161,7 +161,7 @@ class StreamChatClient { sdkName: 'stream-chat', sdkIdentifier: 'dart', sdkVersion: PACKAGE_VERSION, - osName: CurrentPlatform.name, + osName: CurrentPlatform.operatingSystem, ), ); @@ -387,15 +387,17 @@ class StreamChatClient { bool connectWebSocket = true, }) async { if (_ws.connectionCompleter?.isCompleted == false) { - throw const StreamChatError( - 'User already getting connected, try calling `disconnectUser` ' - 'before trying to connect again', + throw StateError( + 'A user is already being connected. Call `disconnectUser` before connecting again.', ); } logger.i(() => 'setting user : ${user.id}'); - _tokenManager.setTokenProvider(user.id, tokenProvider: tokenProvider); + _tokenManager.setTokenProvider( + user.id, + tokenProvider: tokenProvider, + ); final ownUser = OwnUser.fromUser(user); state.currentUser = ownUser; @@ -423,7 +425,7 @@ class StreamChatClient { return state.currentUser!; } catch (e, stk) { - if (e is StreamWebSocketError && e.isRetriable) { + if (e is StreamChatException && e.isRetriable) { final event = await chatPersistenceClient?.getConnectionInfo(); if (event != null) return ownUser.merge(event.me); } @@ -436,7 +438,7 @@ class StreamChatClient { Future openPersistenceConnection(User user) async { final client = chatPersistenceClient; if (client == null) { - throw const StreamChatError('Chat persistence client is not set'); + throw StateError('No chat persistence client is set on this client.'); } if (client.isConnected) { @@ -444,9 +446,10 @@ class StreamChatClient { // we don't need to connect again. if (client.userId == user.id) return; - throw const StreamChatError(''' - Chat persistence client is already connected to a different user, - please close the connection before connecting a new one.'''); + throw StateError( + 'The chat persistence client is connected to a different user. ' + 'Close that connection before opening a new one.', + ); } // Connect the persistence client to the userId. @@ -483,11 +486,11 @@ class StreamChatClient { logger.i(() => 'Opening web-socket connection for ${user.id}'); if (wsConnectionStatus == ConnectionStatus.connecting) { - throw StreamChatError('Connection already in progress for ${user.id}'); + throw StateError('A connection is already in progress for ${user.id}.'); } if (wsConnectionStatus == ConnectionStatus.connected) { - throw StreamChatError('Connection already available for ${user.id}'); + throw StateError('A connection is already available for ${user.id}.'); } try { @@ -865,9 +868,8 @@ class StreamChatClient { await _ws.connectionCompleter?.future; } if (wsConnectionStatus != ConnectionStatus.connected) { - throw const StreamChatError( - 'You cannot use queryChannels without an active connection. ' - 'Please call `connectUser` to connect the client.', + throw StateError( + 'queryChannels needs an active connection. Call `connectUser` first.', ); } } diff --git a/packages/stream_chat/lib/src/client/retry_policy.dart b/packages/stream_chat/lib/src/client/retry_policy.dart index e7db36b5f7..055be33e55 100644 --- a/packages/stream_chat/lib/src/client/retry_policy.dart +++ b/packages/stream_chat/lib/src/client/retry_policy.dart @@ -1,6 +1,6 @@ import 'dart:async'; -import '../core/error/error.dart'; +import '../core/error/stream_chat_exception.dart'; import 'client.dart'; /// The retry policy associated to a client. diff --git a/packages/stream_chat/lib/src/core/api/responses.dart b/packages/stream_chat/lib/src/core/api/responses.dart index 5e59324681..3ae3a7ccf3 100644 --- a/packages/stream_chat/lib/src/core/api/responses.dart +++ b/packages/stream_chat/lib/src/core/api/responses.dart @@ -31,7 +31,7 @@ class _BaseResponse { String? duration; } -/// Model response for the error payload a Stream server sends. +/// The error payload the API returns on a failed request. @JsonSerializable() class ErrorResponse extends _BaseResponse { /// The http error code diff --git a/packages/stream_chat/lib/src/core/error/error.dart b/packages/stream_chat/lib/src/core/error/error.dart deleted file mode 100644 index 3e466b9122..0000000000 --- a/packages/stream_chat/lib/src/core/error/error.dart +++ /dev/null @@ -1,2 +0,0 @@ -export 'stream_chat_error.dart'; -export 'stream_chat_exception.dart'; diff --git a/packages/stream_chat/lib/src/core/error/stream_chat_error.dart b/packages/stream_chat/lib/src/core/error/stream_chat_error.dart deleted file mode 100644 index f7c4530c4f..0000000000 --- a/packages/stream_chat/lib/src/core/error/stream_chat_error.dart +++ /dev/null @@ -1,75 +0,0 @@ -import 'package:equatable/equatable.dart'; -import 'package:web_socket_channel/web_socket_channel.dart'; - -import '../../../stream_chat.dart'; - -/// Base class for all errors surfaced by the Stream Chat SDK. -/// -/// See also: -/// -/// * [StreamWebSocketError], raised on the realtime connection. -/// * [StreamChatException], raised by failed HTTP requests. -class StreamChatError extends Equatable implements Exception { - /// Creates a new [StreamChatError] with the given [message]. - const StreamChatError(this.message); - - /// A human-readable description of what went wrong. - final String message; - - @override - List get props => [message]; - - @override - String toString() => 'StreamChatError(message: $message)'; -} - -/// An error received over the realtime (WebSocket) connection. -class StreamWebSocketError extends StreamChatError { - /// Creates a new [StreamWebSocketError] with the given [message]. - const StreamWebSocketError( - super.message, { - this.data, - }); - - /// Creates a [StreamWebSocketError] from a Stream error payload. - factory StreamWebSocketError.fromStreamError(Map error) { - final data = ErrorResponse.fromJson(error); - final message = data.message ?? ''; - return StreamWebSocketError(message, data: data); - } - - /// Creates a [StreamWebSocketError] from a [WebSocketChannelException]. - factory StreamWebSocketError.fromWebSocketChannelError( - WebSocketChannelException error, - ) { - final message = error.message ?? ''; - return StreamWebSocketError(message); - } - - /// The structured error returned by the server, if any. - final ErrorResponse? data; - - /// The Stream error code, if one was provided. - int? get code => data?.code; - - /// The [StreamErrorCode] for this error, or null if the server sent none. - StreamErrorCode? get errorCode { - final code = this.code; - if (code == null) return null; - return StreamErrorCode(code); - } - - /// Whether the operation can be retried. - bool get isRetriable => data == null; - - @override - List get props => [...super.props, code]; - - @override - String toString() { - var params = 'message: $message'; - if (code case final code?) params = 'code: $code, $params'; - if (data != null) params += ', data: $data'; - return 'StreamWebSocketError($params)'; - } -} diff --git a/packages/stream_chat/lib/src/core/http/stream_http_client.dart b/packages/stream_chat/lib/src/core/http/stream_http_client.dart index 1cc4361c42..8953cdb37b 100644 --- a/packages/stream_chat/lib/src/core/http/stream_http_client.dart +++ b/packages/stream_chat/lib/src/core/http/stream_http_client.dart @@ -14,7 +14,7 @@ import 'package:stream_core/stream_core.dart' StreamCoreHttpClient, SystemEnvironmentManager, TokenManager; -import '../error/error.dart'; +import '../error/stream_chat_exception.dart'; import 'connection_id_manager.dart'; import 'interceptor/additional_headers_interceptor.dart'; diff --git a/packages/stream_chat/lib/src/core/models/attachment_file.dart b/packages/stream_chat/lib/src/core/models/attachment_file.dart index e62415a782..c473f1f136 100644 --- a/packages/stream_chat/lib/src/core/models/attachment_file.dart +++ b/packages/stream_chat/lib/src/core/models/attachment_file.dart @@ -3,7 +3,7 @@ import 'dart:typed_data'; import 'package:dio/dio.dart' show MultipartFile; import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:http_parser/http_parser.dart'; -import '../platform_detector/platform_detector.dart'; +import 'package:stream_core/stream_core.dart' show CurrentPlatform; import '../util/extension.dart'; part 'attachment_file.freezed.dart'; diff --git a/packages/stream_chat/lib/src/core/platform_detector/platform_detector.dart b/packages/stream_chat/lib/src/core/platform_detector/platform_detector.dart deleted file mode 100644 index 74e1f6c788..0000000000 --- a/packages/stream_chat/lib/src/core/platform_detector/platform_detector.dart +++ /dev/null @@ -1,97 +0,0 @@ -import 'package:meta/meta.dart' show visibleForTesting; -import 'platform_detector_stub.dart' - if (dart.library.js_interop) 'platform_detector_web.dart' - if (dart.library.io) 'platform_detector_io.dart'; - -/// Possible platforms -enum PlatformType { - /// Android: - android, - - /// iOS: - ios, - - /// web: - web, - - /// macOS: - macOS, - - /// Windows: - windows, - - /// Linux: - linux, - - /// Fuchsia: - fuchsia, -} - -/// Utility class that provides information on the current platform -class CurrentPlatform { - CurrentPlatform._(); - - /// True if the app is running on android - static bool get isAndroid => type == PlatformType.android; - - /// True if the app is running on ios - static bool get isIos => type == PlatformType.ios; - - /// True if the app is running on web - static bool get isWeb => type == PlatformType.web; - - /// True if the app is running on macos - static bool get isMacOS => type == PlatformType.macOS; - - /// True if the app is running on windows - static bool get isWindows => type == PlatformType.windows; - - /// True if the app is running on linux - static bool get isLinux => type == PlatformType.linux; - - /// True if the app is running on fuchsia - static bool get isFuchsia => type == PlatformType.fuchsia; - - /// True if the app is running in test environment - static bool get isFlutterTest => isFlutterTestEnvironment; - - /// Returns a string version of the platform - static String get name { - return switch (type) { - PlatformType.android => 'android', - PlatformType.ios => 'ios', - PlatformType.web => 'web', - PlatformType.macOS => 'macos', - PlatformType.windows => 'windows', - PlatformType.linux => 'linux', - PlatformType.fuchsia => 'fuchsia', - }; - } - - /// Override the value reported by [type] in tests. - /// - /// Setting this affects all reads of [type], [name], and the per-platform - /// flags ([isAndroid], [isWeb], …). Reset to `null` after each test (e.g. - /// in `tearDown`) to avoid leaking state. - /// - /// The override is honored only when asserts are enabled (debug, profile, - /// and tests); release builds tree-shake it away. Mirrors Flutter's - /// `debugDefaultTargetPlatformOverride`. - @visibleForTesting - static PlatformType? debugCurrentPlatformOverride; - - /// Get current platform type - static PlatformType get type { - var result = currentPlatform; - assert( - () { - if (debugCurrentPlatformOverride case final override?) { - result = override; - } - return true; - }(), - 'debugCurrentPlatformOverride applied', - ); - return result; - } -} diff --git a/packages/stream_chat/lib/src/core/platform_detector/platform_detector_io.dart b/packages/stream_chat/lib/src/core/platform_detector/platform_detector_io.dart deleted file mode 100644 index 661fc39eff..0000000000 --- a/packages/stream_chat/lib/src/core/platform_detector/platform_detector_io.dart +++ /dev/null @@ -1,17 +0,0 @@ -import 'dart:io'; -import 'platform_detector.dart'; - -/// Version running on native systems -PlatformType get currentPlatform { - if (Platform.isWindows) return PlatformType.windows; - if (Platform.isFuchsia) return PlatformType.fuchsia; - if (Platform.isMacOS) return PlatformType.macOS; - if (Platform.isLinux) return PlatformType.linux; - if (Platform.isIOS) return PlatformType.ios; - return PlatformType.android; -} - -/// True if the app is running in test environment. -bool get isFlutterTestEnvironment { - return Platform.environment.containsKey('FLUTTER_TEST'); -} diff --git a/packages/stream_chat/lib/src/core/platform_detector/platform_detector_stub.dart b/packages/stream_chat/lib/src/core/platform_detector/platform_detector_stub.dart deleted file mode 100644 index ee712b46c4..0000000000 --- a/packages/stream_chat/lib/src/core/platform_detector/platform_detector_stub.dart +++ /dev/null @@ -1,7 +0,0 @@ -import 'platform_detector.dart'; - -/// Stub implementation -PlatformType get currentPlatform => throw UnimplementedError(); - -/// Stub implementation -bool get isFlutterTestEnvironment => throw UnimplementedError(); diff --git a/packages/stream_chat/lib/src/core/platform_detector/platform_detector_web.dart b/packages/stream_chat/lib/src/core/platform_detector/platform_detector_web.dart deleted file mode 100644 index d6e960f0b6..0000000000 --- a/packages/stream_chat/lib/src/core/platform_detector/platform_detector_web.dart +++ /dev/null @@ -1,9 +0,0 @@ -import 'platform_detector.dart'; - -/// Version running on web -PlatformType get currentPlatform => PlatformType.web; - -/// True if the app is running in test environment. -/// -/// Always returns false as we don't have environment variables on web. -bool get isFlutterTestEnvironment => false; diff --git a/packages/stream_chat/lib/src/db/chat_persistence_client.dart b/packages/stream_chat/lib/src/db/chat_persistence_client.dart index de42841034..5e4d5eef42 100644 --- a/packages/stream_chat/lib/src/db/chat_persistence_client.dart +++ b/packages/stream_chat/lib/src/db/chat_persistence_client.dart @@ -1,4 +1,5 @@ import 'package:collection/collection.dart'; +import 'package:stream_core/stream_core.dart' show CurrentPlatform; import '../core/api/requests.dart'; import '../core/api/responses.dart'; import '../core/models/attachment_file.dart'; @@ -14,7 +15,6 @@ import '../core/models/poll_vote.dart'; import '../core/models/reaction.dart'; import '../core/models/read.dart'; import '../core/models/user.dart'; -import '../core/platform_detector/platform_detector.dart'; import '../core/util/extension.dart'; /// A simple client used for persisting chat data locally. diff --git a/packages/stream_chat/lib/src/ws/websocket.dart b/packages/stream_chat/lib/src/ws/websocket.dart index 3531f4a505..b71211b311 100644 --- a/packages/stream_chat/lib/src/ws/websocket.dart +++ b/packages/stream_chat/lib/src/ws/websocket.dart @@ -5,11 +5,17 @@ import 'dart:math' as math; import 'package:meta/meta.dart'; import 'package:rxdart/rxdart.dart'; import 'package:stream_core/stream_core.dart' - show StreamErrorCode, StreamLogger, SystemEnvironmentManager, TokenManager; + show + StreamApiException, + StreamException, + StreamApiError, + StreamLogger, + StreamNetworkException, + SystemEnvironmentManager, + TokenManager; import 'package:web_socket_channel/status.dart' as status; import 'package:web_socket_channel/web_socket_channel.dart'; -import '../core/error/error.dart'; import '../core/models/event.dart'; import '../core/models/own_user.dart'; import '../core/util/extension.dart'; @@ -226,10 +232,9 @@ class WebSocket with TimerHelper { bool includeUserDetails = false, }) { if (_connectRequestInProgress) { - throw const StreamWebSocketError(''' - You've called connect twice, - can only attempt 1 connection at the time, - '''); + throw StateError( + 'A connection attempt is already in progress; only one is allowed at a time.', + ); } _connectRequestInProgress = true; _manuallyClosed = false; @@ -393,8 +398,9 @@ class WebSocket with TimerHelper { // resetting connect, reconnect request flag _resetRequestFlags(); - final error = StreamWebSocketError.fromStreamError(errorResponse); - final isTokenExpired = error.errorCode == StreamErrorCode.tokenExpired; + final data = StreamApiError.fromJson(errorResponse); + final error = StreamApiException.fromApiError(data); + final isTokenExpired = error.isTokenExpired; if (isTokenExpired && !tokenManager.usesStaticProvider) { _logger.w(() => 'Connection failed, token expired'); return _reconnect(refreshToken: true); @@ -451,18 +457,17 @@ class WebSocket with TimerHelper { void _onConnectionError(error, [stacktrace]) { _logger.w(() => '[onConnectionError] #ws; error occurred', error: error, stackTrace: stacktrace); - StreamWebSocketError wsError; - if (error is WebSocketChannelException) { - wsError = StreamWebSocketError.fromWebSocketChannelError(error); - } else { - wsError = StreamWebSocketError(error.toString()); - } + var exception = StreamException.tryFrom(error); + exception ??= StreamNetworkException( + message: 'The connection reported an error', + cause: error, + ); final completer = connectionCompleter; // complete with error if not yet completed if (completer != null && !completer.isCompleted) { // complete the connection with error - completer.completeError(wsError); + completer.completeError(exception); } // resetting connect, reconnect request flag diff --git a/packages/stream_chat/lib/stream_chat.dart b/packages/stream_chat/lib/stream_chat.dart index cf2917a269..e62842e2b4 100644 --- a/packages/stream_chat/lib/stream_chat.dart +++ b/packages/stream_chat/lib/stream_chat.dart @@ -24,6 +24,7 @@ export 'package:rate_limiter/rate_limiter.dart'; export 'package:stream_core/stream_core.dart' show CompositeComparator, + CurrentPlatform, Distance, EvaluationOperator, Failure, @@ -33,6 +34,8 @@ export 'package:stream_core/stream_core.dart' LocationCoordinate, LogicalOperator, NullOrdering, + PlatformType, + PatternMatching, Result, Sort, SortDirection, @@ -73,7 +76,7 @@ export 'src/core/api/attachment_file_uploader.dart'; export 'src/core/api/requests.dart'; export 'src/core/api/responses.dart'; export 'src/core/api/stream_chat_api.dart'; -export 'src/core/error/error.dart'; +export 'src/core/error/stream_chat_exception.dart'; export 'src/core/http/stream_http_client.dart'; export 'src/core/models/action.dart'; export 'src/core/models/app_settings.dart'; @@ -120,7 +123,6 @@ export 'src/core/models/user.dart'; export 'src/core/models/user_block.dart'; export 'src/core/models/user_group.dart'; export 'src/core/models/user_group_member.dart'; -export 'src/core/platform_detector/platform_detector.dart'; export 'src/core/util/extension.dart'; export 'src/core/util/message_rules.dart'; export 'src/db/chat_persistence_client.dart'; diff --git a/packages/stream_chat/test/src/client/channel/channel_client_state_test.dart b/packages/stream_chat/test/src/client/channel/channel_client_state_test.dart index 0fba91c60a..1b3153bdb1 100644 --- a/packages/stream_chat/test/src/client/channel/channel_client_state_test.dart +++ b/packages/stream_chat/test/src/client/channel/channel_client_state_test.dart @@ -5328,7 +5328,7 @@ void main() { await expectLater( channel.markUnread('unknown-message-id'), - throwsA(isA()), + throwsA(isA()), ); verifyNever( () => client.markChannelUnread(any(), any(), any()), diff --git a/packages/stream_chat/test/src/client/channel/channel_test.dart b/packages/stream_chat/test/src/client/channel/channel_test.dart index 58f5ac10ec..36d7d42f4f 100644 --- a/packages/stream_chat/test/src/client/channel/channel_test.dart +++ b/packages/stream_chat/test/src/client/channel/channel_test.dart @@ -1,5 +1,7 @@ // ignore_for_file: lines_longer_than_80_chars, cascade_invocations, deprecated_member_use_from_same_package, avoid_redundant_argument_values +import 'dart:async'; + import 'package:mocktail/mocktail.dart'; import 'package:stream_chat/stream_chat.dart'; import 'package:test/test.dart'; @@ -251,6 +253,39 @@ void main() { }); group('`.sendMessage`', () { + test('queues a failed send for retry when the failure is retriable', () async { + // The enqueue gate used to test a type nothing throws any more, so a + // failed send never reached the queue at all. The retry is observable + // as a second attempt, since adding to the queue processes it. + final message = Message(id: 'retriable-id', text: 'hi', user: client.state.currentUser); + + when( + () => client.sendMessage(any(that: isSameMessageAs(message)), channelId, channelType), + ).thenThrow(apiException(statusCode: 500)); + + await expectLater(channel.sendMessage(message), throwsA(isA())); + await Future.delayed(const Duration(milliseconds: 50)); + + verify( + () => client.sendMessage(any(that: isSameMessageAs(message)), channelId, channelType), + ).called(greaterThan(1)); + }); + + test('does not queue a failed send when the failure is not retriable', () async { + final message = Message(id: 'refused-id', text: 'hi', user: client.state.currentUser); + + when( + () => client.sendMessage(any(that: isSameMessageAs(message)), channelId, channelType), + ).thenThrow(apiException(code: StreamErrorCode.notAllowed, statusCode: 403)); + + await expectLater(channel.sendMessage(message), throwsA(isA())); + await Future.delayed(const Duration(milliseconds: 50)); + + verify( + () => client.sendMessage(any(that: isSameMessageAs(message)), channelId, channelType), + ).called(1); + }); + test('should work fine', () async { final message = Message( id: 'test-message-id', @@ -302,7 +337,7 @@ void main() { }); test( - 'should mark the message failed when the server refuses it with skipPush: true, skipEnrichUrl: false', + 'should mark a refused send as failed with skipPush: true, skipEnrichUrl: false', () async { final message = Message( id: 'test-message-id', @@ -358,7 +393,7 @@ void main() { ); test( - 'should mark the message failed when the server refuses it with skipPush: true, skipEnrichUrl: true', + 'should mark a refused send as failed with skipPush: true, skipEnrichUrl: true', () async { final message = Message( id: 'test-message-id-2', @@ -416,7 +451,7 @@ void main() { ); test( - 'should mark the message failed when the server refuses it with skipPush: false, skipEnrichUrl: true', + 'should mark a refused send as failed with skipPush: false, skipEnrichUrl: true', () async { final message = Message( id: 'test-message-id-3', @@ -472,7 +507,7 @@ void main() { ); test( - 'should mark the message failed when the server refuses it with skipPush: false, skipEnrichUrl: false', + 'should mark a refused send as failed with skipPush: false, skipEnrichUrl: false', () async { final message = Message( id: 'test-message-id-4', @@ -809,7 +844,7 @@ void main() { expect( () => channel.sendMessage(message), - throwsA(isA()), + throwsA(isA()), ); verifyNever( @@ -817,6 +852,44 @@ void main() { ); }); + test('should report a superseded send as a cancelled request', () async { + final attachment = Attachment( + id: 'test-attachment-id', + type: 'image', + file: AttachmentFile(size: 100, path: 'test-file-path'), + ); + + final message = Message(id: 'test-message-id', attachments: [attachment]); + + // Holds the first send inside its attachment upload, so the second one + // arrives while it is still in flight. + final upload = Completer(); + when( + () => client.sendImage( + any(), + channelId, + channelType, + onSendProgress: any(named: 'onSendProgress'), + cancelToken: any(named: 'cancelToken'), + extraData: any(named: 'extraData'), + ), + ).thenAnswer((_) => upload.future); + addTearDown(() => upload.complete(SendImageResponse()..file = 'url')); + + final superseded = channel.sendMessage(message); + await pumpEventQueue(); + unawaited(channel.sendMessage(message).catchError((_) => SendMessageResponse())); + + // The caller stopped it, so it is a cancelled request rather than an + // SDK failure a crash tracker should hear about. + await expectLater( + superseded, + throwsA( + isA().having((it) => it.isCancelled, 'isCancelled', isTrue), + ), + ); + }); + test( 'should not send empty message when all attachments are cancelled', () async { @@ -846,7 +919,7 @@ void main() { expect( () => channel.sendMessage(message), - throwsA(isA()), + throwsA(isA()), ); verify( @@ -6052,7 +6125,7 @@ void main() { await expectLater( channel.markRead(messageId: 'message-id-123'), - throwsA(isA()), + throwsA(isA()), ); }, ); @@ -6106,7 +6179,7 @@ void main() { await expectLater( channel.markUnread('message-id-123'), - throwsA(isA()), + throwsA(isA()), ); }, ); @@ -6162,7 +6235,7 @@ void main() { await expectLater( channel.markUnreadByTimestamp(timestamp), - throwsA(isA()), + throwsA(isA()), ); }, ); @@ -6218,7 +6291,7 @@ void main() { await expectLater( channel.markThreadRead('thread-id-123'), - throwsA(isA()), + throwsA(isA()), ); }, ); @@ -6272,7 +6345,7 @@ void main() { await expectLater( channel.markThreadUnread('thread-id-123'), - throwsA(isA()), + throwsA(isA()), ); }, ); diff --git a/packages/stream_chat/test/src/client/client_test.dart b/packages/stream_chat/test/src/client/client_test.dart index 9910aa9be7..4645fe19ad 100644 --- a/packages/stream_chat/test/src/client/client_test.dart +++ b/packages/stream_chat/test/src/client/client_test.dart @@ -161,12 +161,9 @@ void main() { await client.openConnection(); } catch (e) { - expect(e, isA()); - final err = e as StreamChatError; - expect( - err.message.contains('Connection already available for'), - isTrue, - ); + // Misuse, so it leaves the StreamException hierarchy entirely. + expect(e, isA()); + expect((e as StateError).message, contains('already available for')); } }); @@ -223,7 +220,7 @@ void main() { try { await client.connectUser(user, token); } catch (e) { - expect(e, isA()); + expect(e, isA()); } }); @@ -239,7 +236,7 @@ void main() { try { await client.connectUserWithProvider(user, TokenProvider.dynamic(tokenProvider)); } catch (e) { - expect(e, isA()); + expect(e, isA()); } }, ); @@ -257,7 +254,7 @@ void main() { try { await client.connectGuestUser(user); } catch (e) { - expect(e, isA()); + expect(e, isA()); } verify( () => api.guest.getGuestUser(any(that: isSameUserAs(user))), @@ -270,7 +267,7 @@ void main() { try { await client.connectAnonymousUser(); } catch (e) { - expect(e, isA()); + expect(e, isA()); } }, ); @@ -5128,7 +5125,7 @@ void main() { await expectLater( client.openPersistenceConnection(user.copyWith(id: 'new-id')), - throwsA(const TypeMatcher()), + throwsA(isA()), ); }, ); @@ -5138,7 +5135,7 @@ void main() { () async { await expectLater( client.openPersistenceConnection(user), - throwsA(const TypeMatcher()), + throwsA(isA()), ); }, ); @@ -5193,7 +5190,7 @@ void main() { await expectLater( client.connectUser(user, token, connectWebSocket: false), - throwsA(const TypeMatcher()), + throwsA(isA()), ); }, ); @@ -5405,7 +5402,7 @@ void main() { messageLimit: any(named: 'messageLimit'), paginationParams: any(named: 'paginationParams'), ), - ).thenThrow(const StreamChatError('You cannot use queryChannels without an active connection.')); + ).thenThrow(StateError('queryChannels needs an active connection. Call `connectUser` first.')); client = StreamChatClient(apiKey, chatApi: api, ws: ws); await client.connectUser(user, token); diff --git a/packages/stream_chat/test/src/client/system_environment_test.dart b/packages/stream_chat/test/src/client/system_environment_test.dart index 10729be07a..688b88a330 100644 --- a/packages/stream_chat/test/src/client/system_environment_test.dart +++ b/packages/stream_chat/test/src/client/system_environment_test.dart @@ -1,6 +1,6 @@ import 'package:stream_chat/src/client/client.dart'; -import 'package:stream_chat/src/core/platform_detector/platform_detector.dart'; import 'package:stream_chat/version.dart'; +import 'package:stream_core/stream_core.dart' show CurrentPlatform; import 'package:test/test.dart'; void main() { @@ -10,7 +10,7 @@ void main() { test('reports the chat SDK baseline in the default user agent', () { expect( StreamChatClient.defaultUserAgent, - 'stream-chat-dart-v$PACKAGE_VERSION|os=${CurrentPlatform.name}', + 'stream-chat-dart-v$PACKAGE_VERSION|os=${CurrentPlatform.operatingSystem}', ); }); } diff --git a/packages/stream_chat/test/src/core/error/stream_chat_error_test.dart b/packages/stream_chat/test/src/core/error/stream_chat_error_test.dart deleted file mode 100644 index 195723d95c..0000000000 --- a/packages/stream_chat/test/src/core/error/stream_chat_error_test.dart +++ /dev/null @@ -1,56 +0,0 @@ -import 'package:stream_chat/src/core/api/responses.dart'; -import 'package:stream_chat/src/core/error/error.dart'; -import 'package:test/test.dart'; - -void main() { - group('StreamChatError', () { - test('should match if message is same', () { - const message = 'test-error-message'; - const error = StreamChatError(message); - const error2 = StreamChatError(message); - - expect(error, error2); - }); - - test('`.toString`', () { - const message = 'test-error-message'; - const error = StreamChatError(message); - - expect(error.toString(), 'StreamChatError(message: $message)'); - }); - }); - - group('StreamWebSocketError', () { - test('.fromStreamError', () { - final data = ErrorResponse()..code = 333; - final error = StreamWebSocketError.fromStreamError(data.toJson()); - expect(error, isNotNull); - expect(error.code, data.code); - }); - - test('should match if message and data.code is same', () { - const message = 'test-error-message'; - final data = ErrorResponse()..code = 333; - final error = StreamWebSocketError(message, data: data); - final error2 = StreamWebSocketError(message, data: data); - - expect(error, error2); - }); - - test('`.toString`', () { - const message = 'test-error-message'; - final data = ErrorResponse()..code = 333; - final error = StreamWebSocketError(message, data: data); - - expect( - error.toString(), - 'StreamWebSocketError(code: ${data.code}, message: $message, data: $data)', - ); - }); - - test('`.toString` omits code when absent', () { - const error = StreamWebSocketError('boom'); - expect(error.toString(), 'StreamWebSocketError(message: boom)'); - }); - }); -} diff --git a/packages/stream_chat/test/src/core/error/stream_chat_exception_test.dart b/packages/stream_chat/test/src/core/error/stream_chat_exception_test.dart index 5a00ed7780..9b7431e4c7 100644 --- a/packages/stream_chat/test/src/core/error/stream_chat_exception_test.dart +++ b/packages/stream_chat/test/src/core/error/stream_chat_exception_test.dart @@ -1,4 +1,4 @@ -import 'package:stream_chat/src/core/error/error.dart'; +import 'package:stream_chat/src/core/error/stream_chat_exception.dart'; import 'package:stream_core/stream_core.dart' show StreamApiError, diff --git a/packages/stream_chat/test/src/core/http/stream_http_client_test.dart b/packages/stream_chat/test/src/core/http/stream_http_client_test.dart index c263af9485..fe7b6078ba 100644 --- a/packages/stream_chat/test/src/core/http/stream_http_client_test.dart +++ b/packages/stream_chat/test/src/core/http/stream_http_client_test.dart @@ -6,17 +6,18 @@ import 'package:stream_chat/src/core/http/interceptor/additional_headers_interce import 'package:stream_chat/src/core/http/stream_http_client.dart'; import 'package:stream_core/stream_core.dart' show + ApiErrorInterceptor, AuthInterceptor, - StreamLogHandler, - StreamLogPriority, - StreamLogRecord, - StreamLogger, ConnectionIdInterceptor, HeadersInterceptor, LoggingInterceptor, StreamApiException, StreamDioException, StreamErrorCode, + StreamLogHandler, + StreamLogPriority, + StreamLogRecord, + StreamLogger, StreamNetworkException, SystemEnvironment, SystemEnvironmentManager, @@ -66,10 +67,16 @@ void main() { expect(client.httpClient.interceptors.whereType().length, 1); }); - test('HeadersInterceptor should be added if systemEnvironmentManager is provided', () { - const apiKey = 'api-key'; + // Order is behaviour, not style: `ApiErrorInterceptor` only maps what reaches + // it, so anything that rejects ahead of it escapes as a raw `DioException`, + // and anything logging ahead of it logs the transport error rather than the + // mapped one. A misordered pipeline still works until something fails, which + // is why it is pinned here rather than left to read correctly. + test('interceptors are installed in the order the pipeline depends on', () { final client = StreamHttpClient( - apiKey, + 'api-key', + tokenManager: TokenManager.unconfigured(), + connectionIdManager: ConnectionIdManager(), systemEnvironmentManager: SystemEnvironmentManager( environment: const SystemEnvironment( sdkName: 'stream-chat', @@ -79,8 +86,17 @@ void main() { ), ); - // It is what carries `X-Stream-Client`, so losing it costs SDK attribution. - expect(client.httpClient.interceptors.whereType().length, 1); + expect( + client.httpClient.interceptors.map((it) => it.runtimeType), + containsAllInOrder([ + AdditionalHeadersInterceptor, + HeadersInterceptor, + AuthInterceptor, + ConnectionIdInterceptor, + ApiErrorInterceptor, + LoggingInterceptor, + ]), + ); }); test('AuthInterceptor should be added if tokenManager is provided', () { diff --git a/packages/stream_chat/test/src/core/platform_detector/platform_detector_test.dart b/packages/stream_chat/test/src/core/platform_detector/platform_detector_test.dart deleted file mode 100644 index 0ac16d03e4..0000000000 --- a/packages/stream_chat/test/src/core/platform_detector/platform_detector_test.dart +++ /dev/null @@ -1,46 +0,0 @@ -@TestOn('linux') -import 'package:stream_chat/src/core/platform_detector/platform_detector.dart'; -import 'package:test/test.dart'; - -void main() { - test('`.type` should return current platform', () { - final type = CurrentPlatform.type; - expect(type, PlatformType.linux); - }); - - test('`.name` should return current platform name', () { - final name = CurrentPlatform.name; - expect(name, 'linux'); - }); - - test('flags', () { - expect(CurrentPlatform.isWeb, isFalse); - expect(CurrentPlatform.isIos, isFalse); - expect(CurrentPlatform.isLinux, isTrue); - expect(CurrentPlatform.isAndroid, isFalse); - expect(CurrentPlatform.isMacOS, isFalse); - expect(CurrentPlatform.isWindows, isFalse); - expect(CurrentPlatform.isFuchsia, isFalse); - }); - - group('debugCurrentPlatformOverride', () { - tearDown(() => CurrentPlatform.debugCurrentPlatformOverride = null); - - test('changes type, name, and flags', () { - CurrentPlatform.debugCurrentPlatformOverride = PlatformType.web; - - expect(CurrentPlatform.type, PlatformType.web); - expect(CurrentPlatform.name, 'web'); - expect(CurrentPlatform.isWeb, isTrue); - expect(CurrentPlatform.isLinux, isFalse); - }); - - test('clearing the override restores the real platform', () { - CurrentPlatform.debugCurrentPlatformOverride = PlatformType.windows; - CurrentPlatform.debugCurrentPlatformOverride = null; - - expect(CurrentPlatform.type, PlatformType.linux); - expect(CurrentPlatform.isWindows, isFalse); - }); - }); -} diff --git a/packages/stream_chat/test/src/fakes.dart b/packages/stream_chat/test/src/fakes.dart index 04b90ab5a8..c152f048b9 100644 --- a/packages/stream_chat/test/src/fakes.dart +++ b/packages/stream_chat/test/src/fakes.dart @@ -288,7 +288,7 @@ class FakeWebSocketWithConnectionError extends Fake implements WebSocket { bool? includeUserDetails = true, }) async { connectionStatus = ConnectionStatus.connecting; - const error = StreamWebSocketError('Error Connecting'); + const error = StreamNetworkException(message: 'Error Connecting'); connectionCompleter = Completer()..completeError(error); return connectionCompleter!.future; } diff --git a/packages/stream_chat/test/src/ws/websocket_test.dart b/packages/stream_chat/test/src/ws/websocket_test.dart index 933c94f044..866c151dae 100644 --- a/packages/stream_chat/test/src/ws/websocket_test.dart +++ b/packages/stream_chat/test/src/ws/websocket_test.dart @@ -204,7 +204,8 @@ void main() { // calling again before previous attempt finishes await webSocket.connect(user); } catch (e) { - expect(e, isA()); + // Misuse, so it leaves the StreamException hierarchy entirely. + expect(e, isA()); } }); @@ -212,7 +213,8 @@ void main() { final user = OwnUser(id: 'test-user'); final error = ErrorResponse() ..code = 333 - ..message = 'Invalid request'; + ..message = 'Invalid request' + ..statusCode = 400; // Sends error event to web-socket stream final timer = Timer(const Duration(milliseconds: 300), () { webSocketSink.add(json.encode({'error': error})); @@ -230,9 +232,9 @@ void main() { try { await webSocket.connect(user); } catch (e) { - expect(e, isA()); - final err = e as StreamWebSocketError; - expect(err.code, error.code); + expect(e, isA()); + final err = e as StreamApiException; + expect(err.code?.code, error.code); expect(err.message, error.message); } @@ -271,7 +273,8 @@ void main() { final error = ErrorResponse() ..code = 333 - ..message = 'Invalid request'; + ..message = 'Invalid request' + ..statusCode = 400; // Sends error event to web-socket stream webSocketSink.add(json.encode({'error': error})); @@ -343,7 +346,7 @@ void main() { final user = OwnUser(id: 'test-user'); // Sends connect event to web-socket stream final timer = Timer(const Duration(milliseconds: 300), () { - const error = StreamWebSocketError('test-error'); + const error = StreamNetworkException(message: 'test-error'); webSocketSink.addError(error); }); diff --git a/packages/stream_chat_flutter/CHANGELOG.md b/packages/stream_chat_flutter/CHANGELOG.md index c6d0ff89c5..a884b6ffac 100644 --- a/packages/stream_chat_flutter/CHANGELOG.md +++ b/packages/stream_chat_flutter/CHANGELOG.md @@ -3,6 +3,7 @@ 🛑️ Breaking - `errorBuilder` on the paged scroll views (`StreamChannelListView`, `StreamUserListView`, `StreamMemberListView`, `StreamThreadListView`, `StreamPollVoteListView`, `StreamReactionListView`, `StreamMessageSearchListView`, `StreamPhotoGallery` and the grid variants) now receives a `StreamChatException` instead of a `StreamChatError`. +- `AttachmentLimitReachedError`, `AttachmentTooLargeError` and `AttachmentBlockedError` now extend the sealed `AttachmentValidationError` rather than `StreamChatError`, and `StreamAttachmentValidator.validate` and `validateCount` return one. A refused attachment is not a failed call, so it is no longer one of the `StreamException` kinds. 🔄 Changed diff --git a/packages/stream_chat_flutter/lib/src/message_input/attachment_picker/stream_attachment_picker_controller.dart b/packages/stream_chat_flutter/lib/src/message_input/attachment_picker/stream_attachment_picker_controller.dart index 1c23fbbdc0..53bc9c9ff3 100644 --- a/packages/stream_chat_flutter/lib/src/message_input/attachment_picker/stream_attachment_picker_controller.dart +++ b/packages/stream_chat_flutter/lib/src/message_input/attachment_picker/stream_attachment_picker_controller.dart @@ -108,6 +108,10 @@ class StreamAttachmentPickerController extends ValueNotifier addAttachment(Attachment attachment) async { final file = attachment.file; if (validator.validate(attachment) case final error?) throw error; diff --git a/packages/stream_chat_flutter/lib/src/message_input/stream_attachment_validator.dart b/packages/stream_chat_flutter/lib/src/message_input/stream_attachment_validator.dart index d045baf7f9..642ecb0f9a 100644 --- a/packages/stream_chat_flutter/lib/src/message_input/stream_attachment_validator.dart +++ b/packages/stream_chat_flutter/lib/src/message_input/stream_attachment_validator.dart @@ -13,7 +13,7 @@ import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; /// extension, and MIME-type rules from [fileUploadConfig] or /// [imageUploadConfig]. /// -/// Both return `null` on success and a typed [StreamChatError] subtype +/// Both return `null` on success and a typed [AttachmentValidationError] /// on failure — neither ever throws. /// /// See also: @@ -50,7 +50,7 @@ class StreamAttachmentValidator { /// /// Returns `null` when within the limit, otherwise an /// [AttachmentLimitReachedError]. - StreamChatError? validateCount(int total) { + AttachmentValidationError? validateCount(int total) { if (total <= maxAttachmentCount) return null; return AttachmentLimitReachedError(maxCount: maxAttachmentCount); } @@ -69,7 +69,7 @@ class StreamAttachmentValidator { /// list triggered the failure. /// * [AttachmentTooLargeError] when the file exceeds the per-category /// [UploadConfig.sizeLimit]. - StreamChatError? validate(Attachment attachment) { + AttachmentValidationError? validate(Attachment attachment) { final file = attachment.file; if (file == null) return null; @@ -123,6 +123,22 @@ class StreamAttachmentValidator { } } +/// Why an attachment was rejected by [StreamAttachmentValidator]. +/// +/// The validator returns one instead of throwing, so pattern-match it to +/// choose the message to show. [StreamAttachmentPickerController] does throw +/// it, from `addAttachment` and from its `value` setter. +/// +/// An `on StreamChatException` clause will not catch it: nothing failed, an +/// attachment was refused. +sealed class AttachmentValidationError implements Exception { + /// Creates an [AttachmentValidationError] described by [message]. + const AttachmentValidationError(this.message); + + /// A human-readable description of why the attachment was refused. + final String message; +} + /// Returned by [StreamAttachmentValidator.validateCount] when the /// attachment count exceeds [StreamAttachmentValidator.maxAttachmentCount]. /// @@ -130,7 +146,7 @@ class StreamAttachmentValidator { /// /// * [AttachmentTooLargeError], [AttachmentBlockedError], for the other /// validator failures. -class AttachmentLimitReachedError extends StreamChatError { +final class AttachmentLimitReachedError extends AttachmentValidationError { /// Creates a new [AttachmentLimitReachedError]. const AttachmentLimitReachedError({ required this.maxCount, @@ -139,9 +155,6 @@ class AttachmentLimitReachedError extends StreamChatError { /// The maximum number of attachments allowed in a single message. final int maxCount; - @override - List get props => [...super.props, maxCount]; - @override String toString() => 'AttachmentLimitReachedError: $message'; } @@ -153,7 +166,7 @@ class AttachmentLimitReachedError extends StreamChatError { /// /// * [AttachmentBlockedError], [AttachmentLimitReachedError], for the /// other validator failures. -class AttachmentTooLargeError extends StreamChatError { +final class AttachmentTooLargeError extends AttachmentValidationError { /// Creates a new [AttachmentTooLargeError]. const AttachmentTooLargeError({ required this.fileSize, @@ -166,9 +179,6 @@ class AttachmentTooLargeError extends StreamChatError { /// The maximum upload size, in bytes. final int maxSize; - @override - List get props => [...super.props, fileSize, maxSize]; - @override String toString() => 'AttachmentTooLargeError: $message'; } @@ -183,7 +193,7 @@ class AttachmentTooLargeError extends StreamChatError { /// /// * [AttachmentTooLargeError], [AttachmentLimitReachedError], for the /// other validator failures. -class AttachmentBlockedError extends StreamChatError { +final class AttachmentBlockedError extends AttachmentValidationError { /// Creates a new [AttachmentBlockedError]. const AttachmentBlockedError({ this.fileExtension, @@ -196,9 +206,6 @@ class AttachmentBlockedError extends StreamChatError { /// The MIME type of the blocked attachment, if known. final String? mimeType; - @override - List get props => [...super.props, fileExtension, mimeType]; - @override String toString() { final parts = [ diff --git a/packages/stream_chat_flutter/lib/src/message_input/stream_message_composer.dart b/packages/stream_chat_flutter/lib/src/message_input/stream_message_composer.dart index 1e85baeb71..d4dae84212 100644 --- a/packages/stream_chat_flutter/lib/src/message_input/stream_message_composer.dart +++ b/packages/stream_chat_flutter/lib/src/message_input/stream_message_composer.dart @@ -1449,7 +1449,7 @@ class DefaultStreamMessageComposerState extends State[]; + final validationErrors = []; for (final attachment in attachments) { if (validator.validate(attachment) case final error?) { validationErrors.add(error); diff --git a/packages/stream_chat_flutter_core/lib/src/stream_chat_core.dart b/packages/stream_chat_flutter_core/lib/src/stream_chat_core.dart index 7bcc7bb4fd..ff6827d407 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_chat_core.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_chat_core.dart @@ -212,7 +212,7 @@ class StreamChatCoreState extends State with WidgetsBindingObser sdkVersion: StreamChatClient.packageVersion, appName: appName, appVersion: appVersion, - osName: CurrentPlatform.name, + osName: CurrentPlatform.operatingSystem, osVersion: osVersion, deviceModel: deviceModel, ); From 9ce247457f1465da206dca809382ccc5a8034d4d Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Tue, 15 Sep 2026 16:38:51 +0200 Subject: [PATCH 08/36] fix(llc)!: match a channel's members exactly, the way the API does (#2963) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(llc): match a channel's members exactly, the way the API does `collectionEquality` defaults to `containsAll`, which is how every array column answers `$eq` — except a channel's `members`, where `$eq` looks a distinct channel up by its exact membership. The server builds that with `string_agg(user_id, ',' ORDER BY user_id) = ?` over the candidate set and a `HAVING count(*) = ?` rejecting a channel holding anyone else, so it is exact for every channel query rather than only the distinct fast path. Left at the default, a 1:1 query for `[a, b]` also matched a group holding `[a, b, c]` once the filter was evaluated locally. Every `FilterField` subclass forwards the parameter. Only `members` asks for anything but the default today, and a test pins that so a new collection field has to make the choice rather than inherit it. Closes FLU-789. Co-Authored-By: Claude Opus 5 (1M context) * build(repo): take stream_core from core's main, overriding its one source `collectionEquality` lands in `stream_core` on core's `main`, so the pin moves there from the `chat-integration/v11` branch it sat on. That branch carried one commit main cannot: `stream_core_flutter` depending on `stream_core` by path. Main keeps the hosted constraint, because a path dependency would block publishing it — but a hosted `stream_core` is a second source for a package this workspace takes from git, and pub allows only one. Each package seeing both overrides `stream_core` to the same ref, which is how they all resolve to a single copy again. The overrides are scaffolding for the same window as the pins themselves and come out when core publishes a release carrying these APIs. Co-Authored-By: Claude Opus 5 (1M context) * refactor(llc): keep collection equality out of the filter field API `collectionEquality` describes how the API compares a field, not something a caller picks, so a public parameter only invited a wrong answer. It moves to a private constructor that `members` uses, and comes off the ten field types that never needed it. Co-Authored-By: Claude Opus 5 (1M context) --------- Co-authored-by: Claude Opus 5 (1M context) --- .../lib/src/core/models/channel_state.dart | 27 ++++++++-- .../src/core/models/filter_registry_test.dart | 53 ++++++++++++++++++- 2 files changed, 75 insertions(+), 5 deletions(-) diff --git a/packages/stream_chat/lib/src/core/models/channel_state.dart b/packages/stream_chat/lib/src/core/models/channel_state.dart index 9d0a78afc9..15da022ebe 100644 --- a/packages/stream_chat/lib/src/core/models/channel_state.dart +++ b/packages/stream_chat/lib/src/core/models/channel_state.dart @@ -158,6 +158,24 @@ class ChannelFilterField extends FilterField { return ChannelFilterField(remote, (it) => it.channel?.extraData[remote]); } + // Creates a channel filter field that declares its [collectionEquality]. + // + // The [remote] and [value] arguments behave as in the unnamed constructor. + // Use it for a field that declares how a query compares its elements: + // + // ```dart + // ChannelFilterField._( + // 'tags', + // (it) => it.channel?.extraData['tags'], + // collectionEquality: .containsExactly, + // ); + // ``` + ChannelFilterField._( + super.remote, + super.value, { + super.collectionEquality, + }); + /// Filters channels by their id. /// /// **Supported operators:** `$eq`, `$in`, `$gt`, `$gte`, `$lt`, `$lte`, `$exists` @@ -265,14 +283,15 @@ class ChannelFilterField extends FilterField { /// Filters channels by their members. /// - /// `$eq` matches a channel whose members are exactly the given users, the - /// way a distinct channel is looked up. `$in` matches a channel any of them - /// belong to. + /// `$eq` matches a channel holding exactly the given users and no one else, + /// which is how a distinct channel is looked up. `$in` matches a channel any + /// of them belong to. /// /// **Supported operators:** `$eq`, `$in` - static final members = ChannelFilterField( + static final members = ChannelFilterField._( 'members', (it) => it.members?.map((it) => it.userId), + collectionEquality: .containsExactly, ); /// Filters channels by the name of any of their members. diff --git a/packages/stream_chat/test/src/core/models/filter_registry_test.dart b/packages/stream_chat/test/src/core/models/filter_registry_test.dart index a940f0cec3..0fd97aae8d 100644 --- a/packages/stream_chat/test/src/core/models/filter_registry_test.dart +++ b/packages/stream_chat/test/src/core/models/filter_registry_test.dart @@ -9,7 +9,7 @@ import 'package:stream_chat/src/core/models/poll_vote.dart'; import 'package:stream_chat/src/core/models/reaction.dart'; import 'package:stream_chat/src/core/models/thread.dart'; import 'package:stream_chat/src/core/models/user.dart'; -import 'package:stream_core/stream_core.dart' show FilterField; +import 'package:stream_core/stream_core.dart' show CollectionEquality, FilterField; import 'package:test/test.dart'; void main() { @@ -311,4 +311,55 @@ void main() { expect(UserFilterField.custom('x').remote, 'x'); }); }); + + group('collection equality', () { + ChannelState channelOf(List memberIds) => ChannelState( + members: [for (final id in memberIds) Member(userId: id)], + ); + + test('`members` matches the channel holding exactly those users', () { + final filter = ChannelFilter.equal(ChannelFilterField.members, const ['alice', 'bob']); + + expect(filter.matches(channelOf(['alice', 'bob'])), isTrue); + // Membership is a set: the server looks a distinct channel up by a hash + // of its sorted user ids, so the order they arrive in cannot matter. + expect(filter.matches(channelOf(['bob', 'alice'])), isTrue); + expect(filter.matches(channelOf(['alice', 'bob', 'carol'])), isFalse); + expect(filter.matches(channelOf(['alice'])), isFalse); + }); + + test('a field describing a channel matches by containment', () { + final filter = ChannelFilter.equal(ChannelFilterField.memberUserName, const ['Alice']); + + final channel = ChannelState( + members: [ + Member( + userId: 'alice', + user: User(id: 'alice', name: 'Alice'), + ), + Member( + userId: 'bob', + user: User(id: 'bob', name: 'Bob'), + ), + ], + ); + + expect(filter.matches(channel), isTrue); + }); + + // Only a field that identifies its model by its elements asks for + // exactness. A new collection field defaults to containment, so pin the + // one exception rather than leave the choice implicit. + test('`members` is the only field asking for exactness', () { + final exact = >[ + ChannelFilterField.members, + ChannelFilterField.memberUserName, + MessageSearchFilterField.attachmentsType, + MessageSearchFilterField.mentionedUsersId, + UserFilterField.teams, + ].where((it) => it.collectionEquality == CollectionEquality.containsExactly); + + expect(exact, [same(ChannelFilterField.members)]); + }); + }); } From c42db1285ab609fb9acdecb7cbac5ee252c636e8 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Wed, 16 Sep 2026 16:37:20 +0200 Subject: [PATCH 09/36] fix(llc): port SyncManager to the v11 APIs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `Merge branch 'master' into v11` brought #2945 across unchanged, so v11 has been red since: `sync_manager.dart` imports `../core/error/error.dart` and `../core/models/filter.dart`, both deleted on this branch, and its tests use `Filter.empty`, `SortOrder`, `ChatErrorCode` and `StreamChatNetworkError`. Ports it across: `package:logging` -> `StreamLogger`, `StreamChatNetworkError` -> `StreamApiException`, `ChatErrorCode` -> `StreamErrorCode`, `Filter.in_('cid', ...)` -> `ChannelFilter.in_(ChannelFilterField.cid, ...)`, `SortOrder` -> `List`, and the two `StreamChatError` stubs -> `StateError`, which is what the client raises for these now. A filter compares by identity on v11, so the `when`/`verify` calls naming one would have compiled but never matched — silently unstubbing the failing page in `should attempt every page when one of them fails`. They go through the existing `isSameFilterAs` matcher instead. Verified: `melos run analyze` clean, and `stream_chat` (1789), `stream_chat_persistence` (309) and `stream_chat_flutter_core` (369) all green. Co-Authored-By: Claude Opus 5 (1M context) --- .../stream_chat/lib/src/client/client.dart | 1 - .../lib/src/client/sync_manager.dart | 42 +++++++++---------- .../test/src/client/client_test.dart | 38 ++++++++++++----- .../test/src/client/sync_manager_test.dart | 14 ++++--- packages/stream_chat/test/src/fakes.dart | 8 ++-- 5 files changed, 60 insertions(+), 43 deletions(-) diff --git a/packages/stream_chat/lib/src/client/client.dart b/packages/stream_chat/lib/src/client/client.dart index b776bbaa81..1e5650470f 100644 --- a/packages/stream_chat/lib/src/client/client.dart +++ b/packages/stream_chat/lib/src/client/client.dart @@ -9,7 +9,6 @@ import 'package:stream_core/stream_core.dart' InFlightCache, LocationCoordinate, SortedListExtensions, - StreamApiException, StreamLogConfig, StreamLogger, SystemEnvironment, diff --git a/packages/stream_chat/lib/src/client/sync_manager.dart b/packages/stream_chat/lib/src/client/sync_manager.dart index 1f96e68ce0..fdf0de05d9 100644 --- a/packages/stream_chat/lib/src/client/sync_manager.dart +++ b/packages/stream_chat/lib/src/client/sync_manager.dart @@ -1,14 +1,13 @@ import 'package:clock/clock.dart'; import 'package:collection/collection.dart'; -import 'package:logging/logging.dart'; import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' show StreamApiException, StreamLogger; import 'package:synchronized/synchronized.dart'; import '../core/api/requests.dart'; import '../core/api/responses.dart'; -import '../core/error/error.dart'; +import '../core/models/channel_state.dart'; import '../core/models/event.dart'; -import '../core/models/filter.dart'; import '../db/chat_persistence_client.dart'; import 'client.dart'; @@ -54,7 +53,7 @@ class SyncManager { final FetchMissedEvents fetchMissedEvents; /// The logger associated to this manager. - final Logger? logger; + final StreamLogger? logger; /// How many events may be replayed from one window before it is given up on /// and its channels refreshed instead. @@ -74,7 +73,7 @@ class SyncManager { try { await _store?.updateLastSyncAt(to); } catch (error, stk) { - logger?.warning('Failed to record lastSyncAt as $to', error, stk); + logger?.w(() => 'Failed to record lastSyncAt as $to', error: error, stackTrace: stk); } } @@ -90,7 +89,7 @@ class SyncManager { await _store?.flush(); return true; } catch (error, stk) { - logger?.warning('Failed to reset the persistence client', error, stk); + logger?.w(() => 'Failed to reset the persistence client', error: error, stackTrace: stk); return false; } } @@ -116,7 +115,7 @@ class SyncManager { } catch (error, stk) { // Not treated as "never synced": seeding lastSyncAt off an unreadable // store would discard a history that is still there. - logger?.warning('Could not read where the last catch-up left off', error, stk); + logger?.w(() => 'Could not read where the last catch-up left off', error: error, stackTrace: stk); return const {}; } @@ -124,7 +123,7 @@ class SyncManager { if (syncAt == null) { final now = clock.now(); - logger?.info('Fresh sync start: lastSyncAt initialized to $now.'); + logger?.i(() => 'Fresh sync start: lastSyncAt initialized to $now.'); await _recordLastSyncAt(now); return const {}; } @@ -156,7 +155,7 @@ class SyncManager { if (stale.isNotEmpty) await _refreshPages(stale); } } catch (error, stk) { - logger?.warning('Error recovering state on reconnect', error, stk); + logger?.w(() => 'Error recovering state on reconnect', error: error, stackTrace: stk); } } @@ -195,7 +194,7 @@ class SyncManager { for (final page in cids.slices(_channelPageSize)) { try { final channels = await client.queryChannelsOnline( - filter: Filter.in_('cid', page), + filter: ChannelFilter.in_(ChannelFilterField.cid, page), paginationParams: PaginationParams(limit: page.length), // Fail fast if the connection dropped again: the reconnect handler is // waiting to announce recovery, and a sync would hold its lock. @@ -204,7 +203,7 @@ class SyncManager { refreshed.addAll(channels.map((it) => it.cid).nonNulls); } catch (error, stk) { - logger?.warning('Failed to refresh ${page.length} channels', error, stk); + logger?.w(() => 'Failed to refresh ${page.length} channels', error: error, stackTrace: stk); failure ??= (error, stk); } } @@ -219,7 +218,7 @@ class SyncManager { // Deduplicated before capping: the endpoint counts duplicates against its // own limit, so leaving them in would spend slots on nothing. final cappedCids = cids.toSet().take(_maxSyncCids).toList(); - logger?.info('Syncing events since $lastSyncAt for channels: $cappedCids'); + logger?.i(() => 'Syncing events since $lastSyncAt for channels: $cappedCids'); final List events; try { @@ -231,19 +230,19 @@ class SyncManager { // The two are indistinguishable, and either way the server refusing it is // the signal that local state is too far behind to reconcile — so the // store is dropped and repopulated rather than reconciled. - if (error is StreamChatNetworkError && error.statusCode == 400) { - logger?.warning('Resetting local state after a refused window', error, stk); + if (error is StreamApiException && error.statusCode == 400) { + logger?.w(() => 'Resetting local state after a refused window', error: error, stackTrace: stk); return _discardRefusedWindow(cappedCids, to: clock.now()); } // Anything else could succeed next time, so lastSyncAt stays put. - logger?.warning('Error syncing events', error, stk); + logger?.w(() => 'Error syncing events', error: error, stackTrace: stk); return const {}; } final nextSyncAt = events.lastOrNull?.createdAt ?? clock.now(); if (events.length > maxReplayEvents) { - logger?.warning('Skipping replay of ${events.length} events, over the $maxReplayEvents limit.'); + logger?.w(() => 'Skipping replay of ${events.length} events, over the $maxReplayEvents limit.'); return _discardOversizedWindow(cappedCids, from: lastSyncAt, to: nextSyncAt); } @@ -252,11 +251,11 @@ class SyncManager { // catch-up should ask for it again. try { for (final event in events) { - logger?.fine('Syncing event: ${event.type}'); + logger?.d(() => 'Syncing event: ${event.type}'); client.handleEvent(event); } } catch (error, stk) { - logger?.warning('Stopped replaying the missed events, keeping lastSyncAt', error, stk); + logger?.w(() => 'Stopped replaying the missed events, keeping lastSyncAt', error: error, stackTrace: stk); return const {}; } @@ -278,9 +277,10 @@ class SyncManager { // Refreshed channels are reported even on failure, so the caller does not // query them again. if (!flushed || failure != null) { - logger?.warning( - 'Putting lastSyncAt back: store dropped: $flushed, ' - 'refreshed ${refreshed.length} of ${cids.length} channels', + logger?.w( + () => + 'Putting lastSyncAt back: store dropped: $flushed, ' + 'refreshed ${refreshed.length} of ${cids.length} channels', ); await _recordLastSyncAt(from); return refreshed; diff --git a/packages/stream_chat/test/src/client/client_test.dart b/packages/stream_chat/test/src/client/client_test.dart index c6469ba6ad..bf3863e37d 100644 --- a/packages/stream_chat/test/src/client/client_test.dart +++ b/packages/stream_chat/test/src/client/client_test.dart @@ -5198,7 +5198,7 @@ void main() { group('Sync Method Tests', () { setUpAll(() { registerFallbackValue(const PaginationParams()); - registerFallbackValue(Filter.equal('cid', '')); + registerFallbackValue(ChannelFilter.equal(ChannelFilterField.cid, '')); }); test( @@ -5358,7 +5358,7 @@ void main() { // The channels the payload covered are refreshed in its place. verify( () => api.channel.queryChannels( - filter: Filter.in_('cid', cids), + filter: any(named: 'filter', that: isSameFilterAs(ChannelFilter.in_(ChannelFilterField.cid, cids))), sort: any(named: 'sort'), state: any(named: 'state'), watch: any(named: 'watch'), @@ -5608,7 +5608,7 @@ void main() { verify( () => api.channel.queryChannels( - filter: Filter.in_('cid', const [cid]), + filter: any(named: 'filter', that: isSameFilterAs(ChannelFilter.in_(ChannelFilterField.cid, const [cid]))), sort: any(named: 'sort'), state: any(named: 'state'), watch: any(named: 'watch'), @@ -5642,7 +5642,11 @@ void main() { addTearDown(() => client.chatPersistenceClient = null); when(() => api.general.sync(const [cid], lastSyncAt)).thenThrow( - StreamChatNetworkError(ChatErrorCode.internalSystemError), + const StreamApiException( + code: StreamErrorCode.internalError, + message: 'Something goes wrong in the system', + statusCode: 500, + ), ); clearInteractions(api.channel); @@ -5651,7 +5655,7 @@ void main() { verify( () => api.channel.queryChannels( - filter: Filter.in_('cid', const [cid]), + filter: any(named: 'filter', that: isSameFilterAs(ChannelFilter.in_(ChannelFilterField.cid, const [cid]))), sort: any(named: 'sort'), state: any(named: 'state'), watch: any(named: 'watch'), @@ -5679,7 +5683,7 @@ void main() { messageLimit: any(named: 'messageLimit'), paginationParams: any(named: 'paginationParams'), ), - ).thenThrow(const StreamChatError('You cannot use queryChannels without an active connection.')); + ).thenThrow(StateError('queryChannels needs an active connection. Call `connectUser` first.')); client = StreamChatClient(apiKey, chatApi: api, ws: ws, recoverStateOnReconnect: false); await client.connectUser(user, token); @@ -5751,7 +5755,10 @@ void main() { verify( () => api.channel.queryChannels( - filter: Filter.in_('cid', cids.take(30).toList()), + filter: any( + named: 'filter', + that: isSameFilterAs(ChannelFilter.in_(ChannelFilterField.cid, cids.take(30).toList())), + ), sort: any(named: 'sort'), state: any(named: 'state'), watch: any(named: 'watch'), @@ -5764,7 +5771,10 @@ void main() { verify( () => api.channel.queryChannels( - filter: Filter.in_('cid', cids.skip(30).toList()), + filter: any( + named: 'filter', + that: isSameFilterAs(ChannelFilter.in_(ChannelFilterField.cid, cids.skip(30).toList())), + ), sort: any(named: 'sort'), state: any(named: 'state'), watch: any(named: 'watch'), @@ -5861,7 +5871,10 @@ void main() { // The first page fails, the second one succeeds. when( () => api.channel.queryChannels( - filter: Filter.in_('cid', cids.take(30).toList()), + filter: any( + named: 'filter', + that: isSameFilterAs(ChannelFilter.in_(ChannelFilterField.cid, cids.take(30).toList())), + ), sort: any(named: 'sort'), state: any(named: 'state'), watch: any(named: 'watch'), @@ -5870,7 +5883,7 @@ void main() { messageLimit: any(named: 'messageLimit'), paginationParams: any(named: 'paginationParams'), ), - ).thenThrow(const StreamChatError('Failed to query channels')); + ).thenThrow(StateError('Failed to query channels')); clearInteractions(api.channel); @@ -5879,7 +5892,10 @@ void main() { // Both pages are asked for, even though the first one failed. verify( () => api.channel.queryChannels( - filter: Filter.in_('cid', cids.skip(30).toList()), + filter: any( + named: 'filter', + that: isSameFilterAs(ChannelFilter.in_(ChannelFilterField.cid, cids.skip(30).toList())), + ), sort: any(named: 'sort'), state: any(named: 'state'), watch: any(named: 'watch'), diff --git a/packages/stream_chat/test/src/client/sync_manager_test.dart b/packages/stream_chat/test/src/client/sync_manager_test.dart index 8fb145b554..6ca14e0026 100644 --- a/packages/stream_chat/test/src/client/sync_manager_test.dart +++ b/packages/stream_chat/test/src/client/sync_manager_test.dart @@ -80,7 +80,7 @@ typedef _Harness = ({ void main() { registerFallbackValue(FakeEvent()); registerFallbackValue(const PaginationParams()); - registerFallbackValue(const Filter.empty()); + registerFallbackValue(const ChannelFilter.raw({})); final t0 = DateTime.utc(2026, 3, 1, 12); final anHourAgo = t0.subtract(const Duration(hours: 1)); @@ -91,8 +91,8 @@ void main() { return List.generate(count, (i) => eventAt(anHourAgo.add(Duration(seconds: i + 1)))); } - StreamChatNetworkError badRequest() { - return StreamChatNetworkError.raw(code: 4, message: 'too many events', statusCode: 400); + StreamApiException badRequest() { + return const StreamApiException(code: StreamErrorCode.inputError, message: 'too many events', statusCode: 400); } // [onQueryPage] decides what a page of `queryChannels` does: returning an @@ -130,8 +130,10 @@ void main() { waitForConnect: any(named: 'waitForConnect'), ), ).thenAnswer((invocation) async { - final filter = invocation.namedArguments[#filter] as Filter; - final page = (filter.value as List).cast(); + // `Filter` is read with `toJson`: `in_` renders as `{cid: {$in: [...]}}`. + final filter = invocation.namedArguments[#filter] as ChannelFilter; + final cid = filter.toJson()['cid']! as Map; + final page = (cid[r'$in']! as List).cast(); queriedPages.add(page); final outcome = onQueryPage?.call(page); @@ -480,7 +482,7 @@ void main() { final persistence = FakePersistenceClient(lastSyncAt: anHourAgo); final harness = buildHarness( api: _FakeSyncEndpoint( - error: StreamChatNetworkError.raw(code: 0, message: 'boom', statusCode: 500), + error: const StreamApiException(code: StreamErrorCode(0), message: 'boom', statusCode: 500), ), persistence: persistence, ); diff --git a/packages/stream_chat/test/src/fakes.dart b/packages/stream_chat/test/src/fakes.dart index abe3df0a39..50d0cef6cf 100644 --- a/packages/stream_chat/test/src/fakes.dart +++ b/packages/stream_chat/test/src/fakes.dart @@ -105,11 +105,11 @@ class FakePersistenceClient extends Fake implements ChatPersistenceClient { @override Future saveChannelQueries({ required List cids, - Filter? filter, - SortOrder? sort, + ChannelFilter? filter, + List? sort, String? predefinedFilter, - Filter? resolvedFilter, - SortOrder? resolvedSort, + ChannelFilter? resolvedFilter, + List? resolvedSort, Map? filterValues, Map? sortValues, bool clearQueryCache = false, From 60c4f0958c6ae23ef16e4e5cbe970eaf623bce5e Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Wed, 16 Sep 2026 16:42:26 +0200 Subject: [PATCH 10/36] style(llc): log the lastSyncAt rollback as a multiline string Co-Authored-By: Claude Opus 5 (1M context) --- packages/stream_chat/lib/src/client/sync_manager.dart | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/stream_chat/lib/src/client/sync_manager.dart b/packages/stream_chat/lib/src/client/sync_manager.dart index fdf0de05d9..ab1e2e9907 100644 --- a/packages/stream_chat/lib/src/client/sync_manager.dart +++ b/packages/stream_chat/lib/src/client/sync_manager.dart @@ -279,8 +279,9 @@ class SyncManager { if (!flushed || failure != null) { logger?.w( () => - 'Putting lastSyncAt back: store dropped: $flushed, ' - 'refreshed ${refreshed.length} of ${cids.length} channels', + ''' +Putting lastSyncAt back: store dropped: $flushed, +refreshed ${refreshed.length} of ${cids.length} channels''', ); await _recordLastSyncAt(from); return refreshed; From 59b95286c9df2f5fe6fce8063ecba2a47cc21d35 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Wed, 16 Sep 2026 17:20:08 +0200 Subject: [PATCH 11/36] refactor(llc): give SyncManager its own tagged logger Constructs a `StreamLogger` from a `tag` rather than taking one, matching how every other component names itself, so a catch-up's records select under `SCh:Sync` instead of arriving under the client's tag. Co-Authored-By: Claude Opus 5 (1M context) --- .../stream_chat/lib/src/client/client.dart | 1 - .../lib/src/client/sync_manager.dart | 37 ++++++++++--------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/packages/stream_chat/lib/src/client/client.dart b/packages/stream_chat/lib/src/client/client.dart index 1e5650470f..f507fac5ff 100644 --- a/packages/stream_chat/lib/src/client/client.dart +++ b/packages/stream_chat/lib/src/client/client.dart @@ -560,7 +560,6 @@ class StreamChatClient { late final _syncManager = SyncManager( client: this, - logger: logger, fetchMissedEvents: _chatApi.general.sync, ); diff --git a/packages/stream_chat/lib/src/client/sync_manager.dart b/packages/stream_chat/lib/src/client/sync_manager.dart index ab1e2e9907..dc0858da0a 100644 --- a/packages/stream_chat/lib/src/client/sync_manager.dart +++ b/packages/stream_chat/lib/src/client/sync_manager.dart @@ -20,12 +20,14 @@ typedef FetchMissedEvents = Future Function(List cids, Dat /// directly. class SyncManager { /// Instantiate a new SyncManager object. + /// + /// Reports under [tag], so one prefix selects every record a catch-up wrote. SyncManager({ required this.client, required this.fetchMissedEvents, - this.logger, + String tag = 'SCh:Sync', @visibleForTesting this.maxReplayEvents = _defaultMaxReplayEvents, - }); + }) : _logger = StreamLogger(tag); // The endpoint rejects more than 255, counted before duplicates collapse. // @@ -52,13 +54,12 @@ class SyncManager { /// expose the endpoint itself. final FetchMissedEvents fetchMissedEvents; - /// The logger associated to this manager. - final StreamLogger? logger; - /// How many events may be replayed from one window before it is given up on /// and its channels refreshed instead. final int maxReplayEvents; + final StreamLogger _logger; + // Only one catch-up runs at a time. final _syncLock = Lock(); @@ -73,7 +74,7 @@ class SyncManager { try { await _store?.updateLastSyncAt(to); } catch (error, stk) { - logger?.w(() => 'Failed to record lastSyncAt as $to', error: error, stackTrace: stk); + _logger.w(() => 'Failed to record lastSyncAt as $to', error: error, stackTrace: stk); } } @@ -89,7 +90,7 @@ class SyncManager { await _store?.flush(); return true; } catch (error, stk) { - logger?.w(() => 'Failed to reset the persistence client', error: error, stackTrace: stk); + _logger.w(() => 'Failed to reset the persistence client', error: error, stackTrace: stk); return false; } } @@ -115,7 +116,7 @@ class SyncManager { } catch (error, stk) { // Not treated as "never synced": seeding lastSyncAt off an unreadable // store would discard a history that is still there. - logger?.w(() => 'Could not read where the last catch-up left off', error: error, stackTrace: stk); + _logger.w(() => 'Could not read where the last catch-up left off', error: error, stackTrace: stk); return const {}; } @@ -123,7 +124,7 @@ class SyncManager { if (syncAt == null) { final now = clock.now(); - logger?.i(() => 'Fresh sync start: lastSyncAt initialized to $now.'); + _logger.i(() => 'Fresh sync start: lastSyncAt initialized to $now.'); await _recordLastSyncAt(now); return const {}; } @@ -155,7 +156,7 @@ class SyncManager { if (stale.isNotEmpty) await _refreshPages(stale); } } catch (error, stk) { - logger?.w(() => 'Error recovering state on reconnect', error: error, stackTrace: stk); + _logger.w(() => 'Error recovering state on reconnect', error: error, stackTrace: stk); } } @@ -203,7 +204,7 @@ class SyncManager { refreshed.addAll(channels.map((it) => it.cid).nonNulls); } catch (error, stk) { - logger?.w(() => 'Failed to refresh ${page.length} channels', error: error, stackTrace: stk); + _logger.w(() => 'Failed to refresh ${page.length} channels', error: error, stackTrace: stk); failure ??= (error, stk); } } @@ -218,7 +219,7 @@ class SyncManager { // Deduplicated before capping: the endpoint counts duplicates against its // own limit, so leaving them in would spend slots on nothing. final cappedCids = cids.toSet().take(_maxSyncCids).toList(); - logger?.i(() => 'Syncing events since $lastSyncAt for channels: $cappedCids'); + _logger.i(() => 'Syncing events since $lastSyncAt for channels: $cappedCids'); final List events; try { @@ -231,18 +232,18 @@ class SyncManager { // the signal that local state is too far behind to reconcile — so the // store is dropped and repopulated rather than reconciled. if (error is StreamApiException && error.statusCode == 400) { - logger?.w(() => 'Resetting local state after a refused window', error: error, stackTrace: stk); + _logger.w(() => 'Resetting local state after a refused window', error: error, stackTrace: stk); return _discardRefusedWindow(cappedCids, to: clock.now()); } // Anything else could succeed next time, so lastSyncAt stays put. - logger?.w(() => 'Error syncing events', error: error, stackTrace: stk); + _logger.w(() => 'Error syncing events', error: error, stackTrace: stk); return const {}; } final nextSyncAt = events.lastOrNull?.createdAt ?? clock.now(); if (events.length > maxReplayEvents) { - logger?.w(() => 'Skipping replay of ${events.length} events, over the $maxReplayEvents limit.'); + _logger.w(() => 'Skipping replay of ${events.length} events, over the $maxReplayEvents limit.'); return _discardOversizedWindow(cappedCids, from: lastSyncAt, to: nextSyncAt); } @@ -251,11 +252,11 @@ class SyncManager { // catch-up should ask for it again. try { for (final event in events) { - logger?.d(() => 'Syncing event: ${event.type}'); + _logger.d(() => 'Syncing event: ${event.type}'); client.handleEvent(event); } } catch (error, stk) { - logger?.w(() => 'Stopped replaying the missed events, keeping lastSyncAt', error: error, stackTrace: stk); + _logger.w(() => 'Stopped replaying the missed events, keeping lastSyncAt', error: error, stackTrace: stk); return const {}; } @@ -277,7 +278,7 @@ class SyncManager { // Refreshed channels are reported even on failure, so the caller does not // query them again. if (!flushed || failure != null) { - logger?.w( + _logger.w( () => ''' Putting lastSyncAt back: store dropped: $flushed, From 7f0f0c8e9af7a593ef691920b8cfc8c5266e42f9 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Wed, 16 Sep 2026 17:23:59 +0200 Subject: [PATCH 12/36] refactor(llc): move SyncManager's tag to the end of its parameters Co-Authored-By: Claude Opus 5 (1M context) --- packages/stream_chat/lib/src/client/sync_manager.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/stream_chat/lib/src/client/sync_manager.dart b/packages/stream_chat/lib/src/client/sync_manager.dart index dc0858da0a..3e8fe1f664 100644 --- a/packages/stream_chat/lib/src/client/sync_manager.dart +++ b/packages/stream_chat/lib/src/client/sync_manager.dart @@ -25,8 +25,8 @@ class SyncManager { SyncManager({ required this.client, required this.fetchMissedEvents, - String tag = 'SCh:Sync', @visibleForTesting this.maxReplayEvents = _defaultMaxReplayEvents, + String tag = 'SCh:Sync', }) : _logger = StreamLogger(tag); // The endpoint rejects more than 255, counted before duplicates collapse. From fb94183deae3443fc4daf76e1bd9a26c642ca402 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Wed, 16 Sep 2026 18:32:55 +0200 Subject: [PATCH 13/36] style(llc): indent the lastSyncAt rollback log like the repo's other multiline ones Co-Authored-By: Claude Opus 5 (1M context) --- packages/stream_chat/lib/src/client/sync_manager.dart | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/stream_chat/lib/src/client/sync_manager.dart b/packages/stream_chat/lib/src/client/sync_manager.dart index 3e8fe1f664..12da2d254b 100644 --- a/packages/stream_chat/lib/src/client/sync_manager.dart +++ b/packages/stream_chat/lib/src/client/sync_manager.dart @@ -281,8 +281,9 @@ class SyncManager { _logger.w( () => ''' -Putting lastSyncAt back: store dropped: $flushed, -refreshed ${refreshed.length} of ${cids.length} channels''', + Putting lastSyncAt back: store dropped: $flushed, + refreshed ${refreshed.length} of ${cids.length} channels + ''', ); await _recordLastSyncAt(from); return refreshed; From 6e7bb9af7af9a4480d09650065530dd961d61dd0 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Thu, 17 Sep 2026 00:08:26 +0200 Subject: [PATCH 14/36] fix(llc): stop per-channel and per-cid logging from drowning the info level MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `RetryQueue` logged a line per channel on recovery — thirty-plus identical lines in a modest app — and `SyncManager` logged the whole cid list, which runs to a screenful. Both move to debug, with the sync keeping a count at info. Co-Authored-By: Claude Opus 5 (1M context) --- packages/stream_chat/lib/src/client/retry_queue.dart | 2 +- packages/stream_chat/lib/src/client/sync_manager.dart | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/stream_chat/lib/src/client/retry_queue.dart b/packages/stream_chat/lib/src/client/retry_queue.dart index a1f3319762..6438df1fd8 100644 --- a/packages/stream_chat/lib/src/client/retry_queue.dart +++ b/packages/stream_chat/lib/src/client/retry_queue.dart @@ -37,7 +37,7 @@ class RetryQueue { .distinct() .listen((event) { if (event.online == true) { - logger.i(() => 'Connection recovered, retrying failed messages'); + logger.d(() => 'Connection recovered, retrying failed messages'); channel.state?.retryFailedMessages(); } }) diff --git a/packages/stream_chat/lib/src/client/sync_manager.dart b/packages/stream_chat/lib/src/client/sync_manager.dart index 12da2d254b..4ef0686bb9 100644 --- a/packages/stream_chat/lib/src/client/sync_manager.dart +++ b/packages/stream_chat/lib/src/client/sync_manager.dart @@ -219,7 +219,8 @@ class SyncManager { // Deduplicated before capping: the endpoint counts duplicates against its // own limit, so leaving them in would spend slots on nothing. final cappedCids = cids.toSet().take(_maxSyncCids).toList(); - _logger.i(() => 'Syncing events since $lastSyncAt for channels: $cappedCids'); + _logger.i(() => 'Syncing events since $lastSyncAt for ${cappedCids.length} channels'); + _logger.d(() => 'Syncing channels: $cappedCids'); final List events; try { From 7824291d0da17a9e1de316fe2b32593c9727e454 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Thu, 17 Sep 2026 01:04:58 +0200 Subject: [PATCH 15/36] fix(llc): demote per-channel logging and drop internal names from messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Constructing a channel object is per-object bookkeeping, so it moves to verbose and stops repeating the cid the tag already carries. The sync messages named `lastSyncAt` and a "refused window" — implementation terms a reader has no way to interpret — and now say what happened instead. Co-Authored-By: Claude Opus 5 (1M context) --- .../lib/src/client/channel/channel.dart | 2 +- .../lib/src/client/sync_manager.dart | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/packages/stream_chat/lib/src/client/channel/channel.dart b/packages/stream_chat/lib/src/client/channel/channel.dart index 3a4560ef41..0341bf341a 100644 --- a/packages/stream_chat/lib/src/client/channel/channel.dart +++ b/packages/stream_chat/lib/src/client/channel/channel.dart @@ -2025,7 +2025,7 @@ class Channel { _initializedCompleter.safeComplete(true); if (cid case final cid?) client.state.addChannels({cid: this}); - _logger.d(() => 'Channel ${channelState.channel?.cid} initialized'); + _logger.v(() => 'State initialized'); } /// Loads the initial channel state and watches for changes. diff --git a/packages/stream_chat/lib/src/client/sync_manager.dart b/packages/stream_chat/lib/src/client/sync_manager.dart index 4ef0686bb9..74820d3ab8 100644 --- a/packages/stream_chat/lib/src/client/sync_manager.dart +++ b/packages/stream_chat/lib/src/client/sync_manager.dart @@ -74,7 +74,7 @@ class SyncManager { try { await _store?.updateLastSyncAt(to); } catch (error, stk) { - _logger.w(() => 'Failed to record lastSyncAt as $to', error: error, stackTrace: stk); + _logger.w(() => 'Failed to record how far this catch-up got', error: error, stackTrace: stk); } } @@ -124,7 +124,7 @@ class SyncManager { if (syncAt == null) { final now = clock.now(); - _logger.i(() => 'Fresh sync start: lastSyncAt initialized to $now.'); + _logger.i(() => 'First catch-up for this user, starting from now'); await _recordLastSyncAt(now); return const {}; } @@ -233,7 +233,11 @@ class SyncManager { // the signal that local state is too far behind to reconcile — so the // store is dropped and repopulated rather than reconciled. if (error is StreamApiException && error.statusCode == 400) { - _logger.w(() => 'Resetting local state after a refused window', error: error, stackTrace: stk); + _logger.w( + () => 'Resetting local state: the server would not serve the missed events', + error: error, + stackTrace: stk, + ); return _discardRefusedWindow(cappedCids, to: clock.now()); } @@ -244,7 +248,7 @@ class SyncManager { final nextSyncAt = events.lastOrNull?.createdAt ?? clock.now(); if (events.length > maxReplayEvents) { - _logger.w(() => 'Skipping replay of ${events.length} events, over the $maxReplayEvents limit.'); + _logger.w(() => 'Skipping replay of ${events.length} events, over the $maxReplayEvents limit'); return _discardOversizedWindow(cappedCids, from: lastSyncAt, to: nextSyncAt); } @@ -257,7 +261,11 @@ class SyncManager { client.handleEvent(event); } } catch (error, stk) { - _logger.w(() => 'Stopped replaying the missed events, keeping lastSyncAt', error: error, stackTrace: stk); + _logger.w( + () => 'Stopped replaying the missed events; they will be asked for again', + error: error, + stackTrace: stk, + ); return const {}; } From 9a7614a9f2abff7d16c2db151a5ab88606c09b06 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Fri, 18 Sep 2026 18:46:11 +0200 Subject: [PATCH 16/36] ci(repo): check the titles of the PRs that target v11 `pull_request_target` reads its workflow from the base branch, so the filter naming `v11` has to be here for a PR into it to be checked at all. Every rung of the v11 stack went unchecked, and the branch ruleset could not ask for the check because nothing could report it. Co-Authored-By: Claude Opus 5 (1M context) --- .github/workflows/pr_title.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr_title.yml b/.github/workflows/pr_title.yml index 12b763d547..751f74a31b 100644 --- a/.github/workflows/pr_title.yml +++ b/.github/workflows/pr_title.yml @@ -7,6 +7,7 @@ on: - synchronize branches: - master + - v11 - v9 concurrency: From 972ac39feab7ddac6b68eb8010d95028ff68bb01 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Mon, 21 Sep 2026 11:28:10 +0200 Subject: [PATCH 17/36] refactor(llc)!: move the WebSocket onto stream_core's StreamWebSocketClient (#2970) Co-authored-by: Claude Opus 5 Co-authored-by: Claude Opus 5 (1M context) --- .github/workflows/legacy_version_analyze.yml | 2 + analysis_options.yaml | 7 + docs/docs_screenshots/pubspec.yaml | 3 +- docs/docs_screenshots/test/src/mocks.dart | 4 +- melos.yaml | 10 +- migrations/v11-migration.md | 1 + packages/stream_chat/CHANGELOG.md | 9 +- .../stream_chat/lib/src/client/client.dart | 299 +++++---- .../lib/src/client/sync_manager.dart | 7 +- .../lib/src/core/api/channel_api.dart | 2 +- .../lib/src/core/api/responses.dart | 2 +- .../lib/src/core/api/stream_chat_api.dart | 7 +- .../src/core/http/connection_id_manager.dart | 27 - .../lib/src/core/http/stream_http_client.dart | 6 +- .../lib/src/core/util/event_controller.dart | 2 +- .../lib/src/db/chat_persistence_client.dart | 2 +- packages/stream_chat/lib/src/event_type.dart | 3 + .../lib/src/ws/connect_request.dart | 86 +++ .../lib/src/ws/connection_manager.dart | 273 ++++++++ .../lib/src/ws/connection_status.dart | 31 +- .../src/{core/models => ws/events}/event.dart | 4 +- .../{core/models => ws/events}/event.g.dart | 0 .../events}/event_resolvers.dart | 4 +- .../stream_chat/lib/src/ws/events/events.dart | 63 ++ .../lib/src/ws/events/events.freezed.dart | 56 ++ .../lib/src/ws/events/events.g.dart | 22 + .../lib/src/ws/stream_chat_ws_event.dart | 30 + .../stream_chat/lib/src/ws/timer_helper.dart | 51 -- .../stream_chat/lib/src/ws/websocket.dart | 586 ----------------- packages/stream_chat/lib/stream_chat.dart | 9 +- packages/stream_chat/pubspec.yaml | 4 +- .../src/client/client_connection_id_test.dart | 66 ++ .../test/src/client/client_test.dart | 532 +++++++++++++--- .../core/http/connection_id_manager_test.dart | 38 -- .../connection_id_interceptor_test.dart | 26 +- .../core/http/stream_http_client_test.dart | 5 +- .../src/core/util/event_controller_test.dart | 2 +- .../src/db/chat_persistence_client_test.dart | 2 +- packages/stream_chat/test/src/fakes.dart | 97 +-- packages/stream_chat/test/src/matchers.dart | 2 +- packages/stream_chat/test/src/mocks.dart | 13 +- .../test/src/ws/connect_request_test.dart | 117 ++++ .../test/src/ws/connection_manager_test.dart | 158 +++++ .../test/src/ws/connection_status_test.dart | 60 ++ .../events}/event_resolvers_test.dart | 4 +- .../test/src/ws/fake_chat_server.dart | 165 +++++ .../src/ws/stream_chat_ws_event_test.dart | 163 +++++ .../test/src/ws/timer_helper_test.dart | 98 --- .../test/src/ws/websocket_test.dart | 592 ------------------ .../stream_chat_flutter/example/pubspec.yaml | 3 +- .../lib/src/channel/channel_info.dart | 2 +- .../lib/src/channel/channel_list_header.dart | 2 +- .../src/misc/connection_status_builder.dart | 6 +- packages/stream_chat_flutter/pubspec.yaml | 3 +- .../test/src/channel/channel_header_test.dart | 18 +- .../src/channel/channel_list_header_test.dart | 12 +- .../test/src/misc/thread_header_test.dart | 4 +- .../stream_chat_flutter/test/src/mocks.dart | 4 +- .../lib/src/stream_chat_core.dart | 26 +- .../stream_chat_flutter_core/pubspec.yaml | 2 +- .../stream_chat_flutter_core/test/mocks.dart | 2 +- .../test/stream_chat_core_test.dart | 53 +- .../example/pubspec.yaml | 3 +- .../stream_chat_localizations/pubspec.yaml | 3 +- .../support/stream_test_env.dart | 2 +- sample_app/lib/auth/auth_controller.dart | 13 +- sample_app/lib/pages/channel_list_page.dart | 1 + sample_app/pubspec.yaml | 3 +- 68 files changed, 2038 insertions(+), 1876 deletions(-) delete mode 100644 packages/stream_chat/lib/src/core/http/connection_id_manager.dart create mode 100644 packages/stream_chat/lib/src/ws/connect_request.dart create mode 100644 packages/stream_chat/lib/src/ws/connection_manager.dart rename packages/stream_chat/lib/src/{core/models => ws/events}/event.dart (99%) rename packages/stream_chat/lib/src/{core/models => ws/events}/event.g.dart (100%) rename packages/stream_chat/lib/src/{client => ws/events}/event_resolvers.dart (98%) create mode 100644 packages/stream_chat/lib/src/ws/events/events.dart create mode 100644 packages/stream_chat/lib/src/ws/events/events.freezed.dart create mode 100644 packages/stream_chat/lib/src/ws/events/events.g.dart create mode 100644 packages/stream_chat/lib/src/ws/stream_chat_ws_event.dart delete mode 100644 packages/stream_chat/lib/src/ws/timer_helper.dart delete mode 100644 packages/stream_chat/lib/src/ws/websocket.dart create mode 100644 packages/stream_chat/test/src/client/client_connection_id_test.dart delete mode 100644 packages/stream_chat/test/src/core/http/connection_id_manager_test.dart create mode 100644 packages/stream_chat/test/src/ws/connect_request_test.dart create mode 100644 packages/stream_chat/test/src/ws/connection_manager_test.dart create mode 100644 packages/stream_chat/test/src/ws/connection_status_test.dart rename packages/stream_chat/test/src/{client => ws/events}/event_resolvers_test.dart (99%) create mode 100644 packages/stream_chat/test/src/ws/fake_chat_server.dart create mode 100644 packages/stream_chat/test/src/ws/stream_chat_ws_event_test.dart delete mode 100644 packages/stream_chat/test/src/ws/timer_helper_test.dart delete mode 100644 packages/stream_chat/test/src/ws/websocket_test.dart diff --git a/.github/workflows/legacy_version_analyze.yml b/.github/workflows/legacy_version_analyze.yml index b23151d911..f687d5abcf 100644 --- a/.github/workflows/legacy_version_analyze.yml +++ b/.github/workflows/legacy_version_analyze.yml @@ -9,9 +9,11 @@ on: push: branches: - master + - v11 pull_request: branches: - master + - v11 concurrency: group: ${{ github.workflow }}-${{ github.ref }} diff --git a/analysis_options.yaml b/analysis_options.yaml index 64dc584762..7b77a07294 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -8,6 +8,13 @@ analyzer: - packages/*/lib/**/*.g.dart - packages/*/lib/scrollable_positioned_list/** - packages/*/lib/**/*.freezed.dart + - build/** + - android/** + - ios/** + - web/** + - windows/** + - macos/** + - linux/** formatter: page_width: 120 diff --git a/docs/docs_screenshots/pubspec.yaml b/docs/docs_screenshots/pubspec.yaml index 09d32a3729..6fa940c9fb 100644 --- a/docs/docs_screenshots/pubspec.yaml +++ b/docs/docs_screenshots/pubspec.yaml @@ -42,8 +42,9 @@ flutter: dependency_overrides: # Forces one source for `stream_core`; see `melos.yaml`. + # Repeated here because this block outranks `melos.yaml`'s `dependencyOverridePaths`. stream_core: git: url: https://github.com/GetStream/stream-core-flutter.git path: packages/stream_core - ref: 04e0d1cb3a6893cf70cb6636a261deb11beff81c + ref: 6042453b56c782d9c8b29a2d103ae73ba433814c diff --git a/docs/docs_screenshots/test/src/mocks.dart b/docs/docs_screenshots/test/src/mocks.dart index da88f2c710..c31264f187 100644 --- a/docs/docs_screenshots/test/src/mocks.dart +++ b/docs/docs_screenshots/test/src/mocks.dart @@ -17,8 +17,8 @@ void stubMockClientCurrentUser(MockClient client, OwnUser user) { class MockClient extends Mock implements StreamChatClient { MockClient() { - when(() => wsConnectionStatus).thenReturn(ConnectionStatus.connected); - when(() => wsConnectionStatusStream).thenAnswer((_) => Stream.value(ConnectionStatus.connected)); + when(() => connectionStatus).thenReturn(ConnectionStatus.connected); + when(() => connectionStatusStream).thenAnswer((_) => Stream.value(ConnectionStatus.connected)); final mockState = MockClientState(); when(() => state).thenReturn(mockState); } diff --git a/melos.yaml b/melos.yaml index ae206a15a1..c43dea3188 100644 --- a/melos.yaml +++ b/melos.yaml @@ -22,6 +22,12 @@ command: # Run `pub get` sequentially to avoid races on the shared git-dep cache. runPubGetInParallel: false + # Resolves `stream_core` from a sibling checkout when there is one, so the two repos can be + # worked on together without editing the ref below. Scoped to `stream_core` on purpose: + # `packages/**` would also capture `stream_thumbnail`, which is pinned to a different commit. + dependencyOverridePaths: + - '../stream-core-flutter/packages/stream_core' + # Dart and Flutter environment used in the project. environment: sdk: ^3.12.0 @@ -119,7 +125,7 @@ command: git: url: https://github.com/GetStream/stream-core-flutter.git path: packages/stream_core - ref: 04e0d1cb3a6893cf70cb6636a261deb11beff81c + ref: 6042453b56c782d9c8b29a2d103ae73ba433814c stream_core_flutter: git: url: https://github.com/GetStream/stream-core-flutter.git @@ -134,7 +140,6 @@ command: url_launcher: ^6.3.2 uuid: ^4.5.3 video_player: ^2.11.1 - web_socket_channel: ^3.0.3 # List of all the dev_dependencies used in the project. dev_dependencies: @@ -157,6 +162,7 @@ command: test: ^1.31.1 theme_extensions_builder: ^7.3.0 url_launcher_platform_interface: ^2.3.2 + web_socket_channel: ^3.0.3 hooks: # Updates the version.dart file after bootstrapping with the current version from pubspec.yaml diff --git a/migrations/v11-migration.md b/migrations/v11-migration.md index f357fe42a5..b89d152fb0 100644 --- a/migrations/v11-migration.md +++ b/migrations/v11-migration.md @@ -149,6 +149,7 @@ search-and-replace you can apply directly. `Kind` is one of `renamed`, `removed` | `Result` (`package:async`, via this barrel) | `Result` (`stream_core`) | `retyped` | A different type under the same name. `package:async` is still re-exported, but with `Result` hidden | | `CurrentPlatform` / `PlatformType` (`stream_chat`) | `CurrentPlatform` / `PlatformType` (`stream_core`) | `moved` | Re-exported from this package. Same seven platforms and the same strings | | `CurrentPlatform.name` | `CurrentPlatform.operatingSystem` | `renamed` | Same value — `'android'`, `'ios'`, `'web'`, `'macos'`, … | +| `client.wsConnectionStatus` / `.wsConnectionStatusStream` | `client.connectionStatus` / `.connectionStatusStream` | `renamed` | Same `ConnectionStatus`, same three values. The WebSocket's own state, and the disconnection sources it carries, are no longer exported: `ConnectionStatus` is the whole connection API, as on the other Stream SDKs | | _(more added per feature as PRs land)_ | | | | --- diff --git a/packages/stream_chat/CHANGELOG.md b/packages/stream_chat/CHANGELOG.md index 98f53c8a2d..bc3fc646a8 100644 --- a/packages/stream_chat/CHANGELOG.md +++ b/packages/stream_chat/CHANGELOG.md @@ -41,9 +41,14 @@ - A sort names its model's field type, so `MemberSort.asc` takes a `MemberSortField` and a field from another model does not compile. `XSortField.custom(key)` reads a field from the model's extra data, for the four models whose queries accept one. - Added `ChannelSort.empty`, `MemberSort.empty` and one on every other sort — an empty sort, for querying with the ordering the API applies on its own. - Default sorts moved onto the sort that owns them: `ChannelSort.defaultSort`, `MemberSort.defaultSort` and so on, reachable now without the Flutter layer. +- `client.wsConnectionStatus` and `wsConnectionStatusStream` become `connectionStatus` and `connectionStatusStream`. `ConnectionStatus` keeps its three values, and a client that has never connected still reads as `disconnected`. +- The WebSocket's state — `Connected`, `Connecting`, `Authenticating`, `Disconnected` and the disconnection sources — is no longer exported, and the client no longer reports it. `ConnectionStatus` is the whole connection API, as on the other Stream SDKs. +- `StreamHttpClient` and `StreamChatApi` take a `ConnectionIdGetter? connectionId` where they took a `ConnectionIdManager?`. The manager only wrapped such a closure, and is removed. 🐞 Fixed +- `queryChannels` no longer gives up watching the channels it loads when it is called before the connection is open. Whether they can be watched is read when the request is sent, which is after the query has waited for the connection. + - A message that fails because its attachments did not upload now says which ones and what each reported, instead of `Failed to upload one or more attachments`. 🔄 Changed @@ -64,11 +69,13 @@ 🔒 Security -- The WebSocket connect and reconnect URIs are logged with the user token redacted. They carried it in full, so an app that raised the log priority wrote a usable token to the console and to any handler it had installed. +- The WebSocket connect and reconnect URIs are logged with the user token redacted. They carried it in full, so an app that raised the log priority wrote a usable token to the console and to any handler it had installed. The token now travels in query parameters the socket never logs, so nothing has to redact it. 🔄 Internal / Non-breaking - Added the OpenAPI-generated v2 client under `lib/open_api/`, along with the `melos run gen:openapi` tooling that produces it. No API uses it yet. +- The WebSocket is now `stream_core`'s `StreamWebSocketClient`. `Event` extends `WsEvent`, the two frames the socket acts on rather than publishes — the health check and the connection error — are their own types under `lib/src/ws/events/`, and `EventType.connectionError` is added. The hand-rolled socket, its reconnection monitor and its timer helper are removed, along with the `web_socket_channel` dependency. +- The connect URL no longer repeats the user token inside its `json` payload. The server reads the token from the `authorization` query parameter and never looked at `user_token`. - Replaced the internal `InFlightCache` and `SystemEnvironmentManager` with shared implementations. ## Upcoming diff --git a/packages/stream_chat/lib/src/client/client.dart b/packages/stream_chat/lib/src/client/client.dart index f507fac5ff..c32e89ce6f 100644 --- a/packages/stream_chat/lib/src/client/client.dart +++ b/packages/stream_chat/lib/src/client/client.dart @@ -15,7 +15,9 @@ import 'package:stream_core/stream_core.dart' SystemEnvironmentManager, TokenManager, TokenProvider, - UserToken; + UserToken, + WebSocketProvider, + WsEvent; import 'package:synchronized/synchronized.dart'; import '../../version.dart'; @@ -25,7 +27,6 @@ import '../core/api/responses.dart'; import '../core/api/stream_chat_api.dart'; import '../core/error/stream_chat_exception.dart'; import '../core/http/app_settings_manager.dart'; -import '../core/http/connection_id_manager.dart'; import '../core/http/stream_http_client.dart'; import '../core/models/app_settings.dart'; import '../core/models/attachment_file.dart'; @@ -33,7 +34,6 @@ import '../core/models/banned_user.dart'; import '../core/models/channel_state.dart'; import '../core/models/draft.dart'; import '../core/models/draft_message.dart'; -import '../core/models/event.dart'; import '../core/models/location.dart'; import '../core/models/member.dart'; import '../core/models/message.dart'; @@ -54,11 +54,14 @@ import '../core/util/immutable_collection_subjects.dart'; import '../core/util/utils.dart'; import '../db/chat_persistence_client.dart'; import '../event_type.dart'; +import '../ws/connect_request.dart'; +import '../ws/connection_manager.dart'; import '../ws/connection_status.dart'; -import '../ws/websocket.dart'; +import '../ws/events/event.dart'; +import '../ws/events/event_resolvers.dart' as event_resolvers; +import '../ws/events/events.dart'; import 'channel/channel.dart'; import 'channel_delivery_reporter.dart'; -import 'event_resolvers.dart' as event_resolvers; import 'live_location_expiration_scheduler.dart'; import 'query_channels_result.dart'; import 'retry_policy.dart'; @@ -90,7 +93,7 @@ class StreamChatClient { Duration connectTimeout = kDefaultConnectTimeout, Duration receiveTimeout = kDefaultReceiveTimeout, StreamChatApi? chatApi, - WebSocket? ws, + @visibleForTesting WebSocketProvider? wsProvider, AttachmentFileUploaderProvider attachmentFileUploaderProvider = StreamAttachmentFileUploader.new, Iterable? chatApiInterceptors, HttpClientAdapter? httpClientAdapter, @@ -113,22 +116,27 @@ class StreamChatClient { apiKey, options: options, tokenManager: _tokenManager, - connectionIdManager: _connectionIdManager, + connectionId: () => _connection.connectionId, systemEnvironmentManager: _systemEnvironmentManager, attachmentFileUploaderProvider: attachmentFileUploaderProvider, interceptors: chatApiInterceptors, httpClientAdapter: httpClientAdapter, ); - _ws = - ws ?? - WebSocket( - apiKey: apiKey, - baseUrl: baseWsUrl ?? options.baseUrl, - tokenManager: _tokenManager, - systemEnvironmentManager: _systemEnvironmentManager, - handler: handleEvent, - ); + _connection = ConnectionManager( + request: ConnectRequest.forApi( + apiKey: apiKey, + baseWsUrl ?? options.baseUrl, + environment: _systemEnvironmentManager, + ), + tokenManager: _tokenManager, + wsProvider: wsProvider, + ); + + // Every frame the connection delivers is an `Event`, including the two the socket acts on. + _wsEventSubscription = _connection.events.listen((it) { + if (it case final Event event) handleEvent(event); + }); _retryPolicy = retryPolicy ?? @@ -136,7 +144,7 @@ class StreamChatClient { shouldRetry: (_, __, error) => error?.isRetriable ?? false, ); - _connectionStatusSubscription = wsConnectionStatusStream.pairwise().listen( + _connectionStatusSubscription = connectionStatusStream.pairwise().listen( (statusPair) { final [prevStatus, currStatus] = statusPair; return _onConnectionStatusChanged(prevStatus, currStatus); @@ -147,13 +155,16 @@ class StreamChatClient { } late final StreamChatApi _chatApi; - late final WebSocket _ws; + late final ConnectionManager _connection; + StreamSubscription? _wsEventSubscription; + + // Whether the open connection has an id to name on the requests that need one. + bool get _hasConnectionId => _connection.connectionId != null; /// This client state late ClientState state; final _tokenManager = TokenManager.unconfigured(); - final _connectionIdManager = ConnectionIdManager(); late final _appSettingsManager = AppSettingsManager(_chatApi.general); static final _systemEnvironmentManager = SystemEnvironmentManager( environment: SystemEnvironment( @@ -290,8 +301,9 @@ class StreamChatClient { onMarkChannelsDelivered: markChannelsDelivered, ); - /// Stream of [Event] coming from [_ws] connection - /// Listen to this or use the [on] method to filter specific event types + /// Every [Event] the client receives, whichever connection carried it. + /// + /// Listen to this or use the [on] method to filter specific event types. Stream get eventStream => _eventController.stream; late final _eventController = EventController( resolvers: [ @@ -304,14 +316,11 @@ class StreamChatClient { ], ); - /// The current status value of the [_ws] connection - ConnectionStatus get wsConnectionStatus => _ws.connectionStatus; + /// The connection this client works over. + ConnectionStatus get connectionStatus => _connection.status; - /// This notifies the connection status of the [_ws] connection. - /// Listen to this to get notified when the [_ws] tries to reconnect. - Stream get wsConnectionStatusStream { - return _ws.connectionStatusStream.distinct(); - } + /// [connectionStatus] on listen, and again on each change. + Stream get connectionStatusStream => _connection.statusStream; /// Connects the current user, this triggers a connection to the API. /// It returns a [Future] that resolves when the connection is setup. @@ -381,57 +390,73 @@ class StreamChatClient { ); } + // The sign-in each caller of [_connectUser] waits on, while one is under way. + final _connecting = InFlightCache(); + Future _connectUser( User user, { required TokenProvider tokenProvider, bool connectWebSocket = true, }) async { - if (_ws.connectionCompleter?.isCompleted == false) { + // Signing another in over them leaves everything built for them behind, including a connection + // nothing would close. Signing the same one in again is left to the connection. + if (state.currentUser case final signedIn? when signedIn.id != user.id) { throw StateError( - 'A user is already being connected. Call `disconnectUser` before connecting again.', + 'Cannot connect ${user.id} while ${signedIn.id} is signed in. ' + 'Call `disconnectUser` before connecting a different user.', ); } - logger.i(() => 'setting user : ${user.id}'); - - _tokenManager.setTokenProvider( + return _connecting.run( user.id, - tokenProvider: tokenProvider, - ); + () async { + logger.i(() => 'Setting user: ${user.id}'); - final ownUser = OwnUser.fromUser(user); - state.currentUser = ownUser; + _tokenManager.setTokenProvider( + user.id, + tokenProvider: tokenProvider, + ); - try { - // Connect to persistence client if its set. - if (chatPersistenceClient != null) { - await openPersistenceConnection(ownUser); - } + final ownUser = OwnUser.fromUser(user); + final signedIn = state.currentUser; + state.currentUser = ownUser; - // Connect to websocket if [connectWebSocket] is true. - // - // This is useful when you want to connect to websocket - // at a later stage or use the client in connection-less mode. - if (connectWebSocket) { - final connectedUser = await openConnection( - includeUserDetailsInConnectCall: true, - ); - state.currentUser = connectedUser; - } + try { + // Connect to persistence client if its set. + if (chatPersistenceClient != null) { + await openPersistenceConnection(ownUser); + } - // Start loading app settings in the background, we don't need to await - // for this to complete to consider the user connected. - unawaited(_appSettingsManager.loadAppSettings()); + // Connect to websocket if [connectWebSocket] is true. + // + // This is useful when you want to connect to websocket + // at a later stage or use the client in connection-less mode. + if (connectWebSocket) { + final connectedUser = await openConnection( + includeUserDetailsInConnectCall: true, + ); + state.currentUser = connectedUser; + } - return state.currentUser!; - } catch (e, stk) { - if (e is StreamChatException && e.isRetriable) { - final event = await chatPersistenceClient?.getConnectionInfo(); - if (event != null) return ownUser.merge(event.me); - } - logger.e(() => 'error connecting user : ${ownUser.id}', error: e, stackTrace: stk); - rethrow; - } + // Start loading app settings in the background, we don't need to await + // for this to complete to consider the user connected. + unawaited(_appSettingsManager.loadAppSettings()); + + return state.currentUser!; + } catch (e, stk) { + if (e is StreamChatException && e.isRetriable) { + final event = await chatPersistenceClient?.getConnectionInfo(); + if (event != null) return ownUser.merge(event.me); + } + // Whoever was signed in before this, so a user who never signed in does not have the + // next connect refused on their behalf. + state.currentUser = signedIn; + + logger.e(() => 'error connecting user : ${ownUser.id}', error: e, stackTrace: stk); + rethrow; + } + }, + ); } /// Connects the [chatPersistenceClient] to the given [user]. @@ -485,42 +510,28 @@ class StreamChatClient { logger.i(() => 'Opening web-socket connection for ${user.id}'); - if (wsConnectionStatus == ConnectionStatus.connecting) { - throw StateError('A connection is already in progress for ${user.id}.'); - } - - if (wsConnectionStatus == ConnectionStatus.connected) { - throw StateError('A connection is already available for ${user.id}.'); - } - - try { - final event = await _ws.connect( - user, - includeUserDetails: includeUserDetailsInConnectCall, - ); + final healthCheck = await _connection.connect( + user, + includeUserDetails: includeUserDetailsInConnectCall, + ); - // Start listening to events - state.subscribeToEvents(); + // Start listening to events + state.subscribeToEvents(); - return user.merge(event.me); - } catch (e, stk) { - logger.e(() => 'error connecting ws', error: e, stackTrace: stk); - rethrow; - } + return user.merge(healthCheck.me); } - /// Disconnects the [_ws] connection, - /// without removing the user set on client. + /// Closes the connection, without removing the user set on client. /// - /// This will not trigger default auto-retry mechanism for reconnection. - /// You need to call [openConnection] to reconnect to [_ws]. - void closeConnection() { + /// Completes once it is closed. A connection closed this way is not reopened + /// on its own; call [openConnection] to open another. + Future closeConnection() { logger.i(() => 'Closing web-socket connection for ${state.currentUser?.id}'); // Stop listening to events state.cancelEventSubscription(); - _ws.disconnect(); + return _connection.disconnect(); } /// Suspends the WebSocket's automatic reconnection without tearing down the @@ -529,21 +540,15 @@ class StreamChatClient { /// While paused, unexpected socket closures (for example when the OS closes /// the connection after the app is backgrounded) will not trigger retries. /// Call [resumeReconnect] before re-establishing the connection. - void pauseReconnect() => _ws.pauseReconnect(); + void pauseReconnect() => _connection.pauseReconnect(); /// Re-enables the WebSocket's automatic reconnection after a previous /// [pauseReconnect]. - void resumeReconnect() => _ws.resumeReconnect(); - - void _handleHealthCheckEvent(Event event) { - final user = event.me; - if (user != null) state.currentUser = user; + void resumeReconnect() => _connection.resumeReconnect(); - final connectionId = event.connectionId; - if (connectionId != null) { - _connectionIdManager.setConnectionId(connectionId); - chatPersistenceClient?.updateConnectionInfo(event); - } + void _handleHealthCheckEvent(HealthCheckEvent event) { + if (event.me case final user?) state.currentUser = user; + chatPersistenceClient?.updateConnectionInfo(event); } /// Method called to add a new event to the [_eventController]. @@ -551,9 +556,10 @@ class StreamChatClient { // Ignore events that arrive after the client has been disposed. if (_eventController.isClosed) return; - if (event.type == EventType.healthCheck) { + if (event case HealthCheckEvent()) { return _handleHealthCheckEvent(event); } + state.updateUser(event.user); return _eventController.safeAdd(event); } @@ -583,8 +589,9 @@ class StreamChatClient { handleEvent(Event(type: EventType.connectionRecovered, online: true)); } - /// Stream of [Event] coming from [_ws] connection - /// Pass an eventType as parameter in order to filter just a type of event + /// Every [Event] the client receives, of the types named. + /// + /// Pass an eventType as parameter in order to filter just a type of event. Stream on([ String? eventType, String? eventType2, @@ -672,11 +679,6 @@ class StreamChatClient { PaginationParams paginationParams = const PaginationParams(), bool waitForConnect = true, }) async* { - if (!_connectionIdManager.hasConnectionId) { - // ignore: parameter_assignments - watch = false; - } - final hash = generateHash([ filter, channelStateSort, @@ -716,27 +718,20 @@ class StreamChatClient { // the lifecycle details. final result = await _queryChannelsCache.run( hash, - () => - _queryChannelsOnlineImpl( - filter: filter, - sort: channelStateSort, - predefinedFilter: predefinedFilter, - filterValues: filterValues, - sortValues: sortValues, - state: state, - watch: watch, - presence: presence, - memberLimit: memberLimit, - messageLimit: messageLimit, - paginationParams: paginationParams, - waitForConnect: waitForConnect, - ).timeout( - const Duration(seconds: 30), - onTimeout: () { - logger.w(() => 'Online channel query timed out'); - throw TimeoutException('Channel query timed out'); - }, - ), + () => _queryChannelsOnlineImpl( + filter: filter, + sort: channelStateSort, + predefinedFilter: predefinedFilter, + filterValues: filterValues, + sortValues: sortValues, + state: state, + watch: watch, + presence: presence, + memberLimit: memberLimit, + messageLimit: messageLimit, + paginationParams: paginationParams, + waitForConnect: waitForConnect, + ).timeout(const Duration(seconds: 30)), ); yield result; } catch (e, stk) { @@ -778,6 +773,17 @@ class StreamChatClient { return result.channels; } + // Requires a connection for [operation], waiting first for one that is still being opened. + // + // The wait ends on the attempt settling either way, so one that fails raises here rather than + // leaving the caller waiting on a connection nothing is opening any more. + Future _requireConnection(String operation) async { + await _connection.settled; + if (connectionStatus == ConnectionStatus.connected) return; + + throw StateError('$operation needs an active connection. Call `connectUser` first.'); + } + Future _queryChannelsOnlineImpl({ ChannelFilter? filter, List? sort, @@ -792,24 +798,10 @@ class StreamChatClient { bool waitForConnect = true, PaginationParams paginationParams = const PaginationParams(), }) async { - if (waitForConnect) { - if (_ws.connectionCompleter?.isCompleted == false) { - logger.d(() => 'awaiting connection completer'); - await _ws.connectionCompleter?.future; - } - if (wsConnectionStatus != ConnectionStatus.connected) { - throw StateError( - 'queryChannels needs an active connection. Call `connectUser` first.', - ); - } - } + logger.d(() => 'Querying channels from api'); - if (!_connectionIdManager.hasConnectionId) { - // ignore: parameter_assignments - watch = false; - } + if (waitForConnect) await _requireConnection('queryChannels'); - logger.d(() => 'Query channel start'); final res = await _chatApi.channel.queryChannels( filter: filter, sort: sort, @@ -817,7 +809,7 @@ class StreamChatClient { filterValues: filterValues, sortValues: sortValues, state: state, - watch: watch, + watch: _hasConnectionId && watch, presence: presence, memberLimit: memberLimit, // Default limit is set to 25 in backend. @@ -934,6 +926,8 @@ class StreamChatClient { } final updateData = _mapChannelStateToChannel(res.channels); + logger.d(() => 'Got ${res.channels.length} channels from offline storage'); + state.addChannels(updateData.key); return QueryChannelsResult( channels: updateData.value, @@ -970,7 +964,7 @@ class StreamChatClient { PaginationParams? pagination, }) async { final response = await _chatApi.user.queryUsers( - presence: presence ?? _connectionIdManager.hasConnectionId, + presence: presence ?? _hasConnectionId, filter: filter, sort: sort, pagination: pagination, @@ -2451,7 +2445,8 @@ class StreamChatClient { includeGlobalRoles: includeGlobalRoles, ); - /// Closes the [_ws] connection and resets the [state] + /// Closes the connection and resets the [state]. + /// /// If [flushChatPersistence] is true the client deletes all offline /// user's data. Future disconnectUser({bool flushChatPersistence = false}) async { @@ -2461,7 +2456,7 @@ class StreamChatClient { channelDeliveryReporter.cancel(); // closing web-socket connection - closeConnection(); + await _connection.disconnect(); // resetting state. state.dispose(); @@ -2472,7 +2467,6 @@ class StreamChatClient { // resetting credentials. _tokenManager.reset(); - _connectionIdManager.reset(); // closing persistence connection. return closePersistenceConnection(flush: flushChatPersistence); @@ -2483,7 +2477,8 @@ class StreamChatClient { logger.i(() => 'Disposing StreamChatClient'); await disconnectUser(); - await _ws.dispose(); + await _wsEventSubscription?.cancel(); + await _connection.dispose(); await _eventController.close(); await _connectionStatusSubscription?.cancel(); } diff --git a/packages/stream_chat/lib/src/client/sync_manager.dart b/packages/stream_chat/lib/src/client/sync_manager.dart index 74820d3ab8..49c8ef78cb 100644 --- a/packages/stream_chat/lib/src/client/sync_manager.dart +++ b/packages/stream_chat/lib/src/client/sync_manager.dart @@ -7,8 +7,8 @@ import 'package:synchronized/synchronized.dart'; import '../core/api/requests.dart'; import '../core/api/responses.dart'; import '../core/models/channel_state.dart'; -import '../core/models/event.dart'; import '../db/chat_persistence_client.dart'; +import '../ws/events/event.dart'; import 'client.dart'; /// Fetches the events missed on [cids] since [lastSyncAt]. @@ -219,8 +219,9 @@ class SyncManager { // Deduplicated before capping: the endpoint counts duplicates against its // own limit, so leaving them in would spend slots on nothing. final cappedCids = cids.toSet().take(_maxSyncCids).toList(); - _logger.i(() => 'Syncing events since $lastSyncAt for ${cappedCids.length} channels'); - _logger.d(() => 'Syncing channels: $cappedCids'); + _logger + ..i(() => 'Syncing events since $lastSyncAt for ${cappedCids.length} channels') + ..d(() => 'Syncing channels: $cappedCids'); final List events; try { diff --git a/packages/stream_chat/lib/src/core/api/channel_api.dart b/packages/stream_chat/lib/src/core/api/channel_api.dart index 5244cbc3d9..75dc12a7e3 100644 --- a/packages/stream_chat/lib/src/core/api/channel_api.dart +++ b/packages/stream_chat/lib/src/core/api/channel_api.dart @@ -1,8 +1,8 @@ import 'dart:convert'; +import '../../ws/events/event.dart'; import '../http/stream_http_client.dart'; import '../models/channel_state.dart'; -import '../models/event.dart'; import '../models/message.dart'; import '../models/message_delivery.dart'; import 'requests.dart'; diff --git a/packages/stream_chat/lib/src/core/api/responses.dart b/packages/stream_chat/lib/src/core/api/responses.dart index 3ae3a7ccf3..33a7f87cbc 100644 --- a/packages/stream_chat/lib/src/core/api/responses.dart +++ b/packages/stream_chat/lib/src/core/api/responses.dart @@ -1,12 +1,12 @@ import 'package:json_annotation/json_annotation.dart'; import '../../client/client.dart'; +import '../../ws/events/event.dart'; import '../models/app_settings.dart'; import '../models/banned_user.dart'; import '../models/channel_model.dart'; import '../models/channel_state.dart'; import '../models/device.dart'; import '../models/draft.dart'; -import '../models/event.dart'; import '../models/location.dart'; import '../models/member.dart'; import '../models/message.dart'; diff --git a/packages/stream_chat/lib/src/core/api/stream_chat_api.dart b/packages/stream_chat/lib/src/core/api/stream_chat_api.dart index 232e538126..dd6a323572 100644 --- a/packages/stream_chat/lib/src/core/api/stream_chat_api.dart +++ b/packages/stream_chat/lib/src/core/api/stream_chat_api.dart @@ -1,7 +1,6 @@ import 'package:dio/dio.dart'; -import 'package:stream_core/stream_core.dart' show SystemEnvironmentManager, TokenManager; +import 'package:stream_core/stream_core.dart' show ConnectionIdGetter, SystemEnvironmentManager, TokenManager; -import '../http/connection_id_manager.dart'; import '../http/stream_http_client.dart'; import 'attachment_file_uploader.dart'; import 'channel_api.dart'; @@ -27,7 +26,7 @@ class StreamChatApi { StreamHttpClient? client, StreamHttpClientOptions? options, TokenManager? tokenManager, - ConnectionIdManager? connectionIdManager, + ConnectionIdGetter? connectionId, SystemEnvironmentManager? systemEnvironmentManager, AttachmentFileUploaderProvider attachmentFileUploaderProvider = StreamAttachmentFileUploader.new, Iterable? interceptors, @@ -39,7 +38,7 @@ class StreamChatApi { apiKey, options: options, tokenManager: tokenManager, - connectionIdManager: connectionIdManager, + connectionId: connectionId, systemEnvironmentManager: systemEnvironmentManager, interceptors: interceptors, httpClientAdapter: httpClientAdapter, diff --git a/packages/stream_chat/lib/src/core/http/connection_id_manager.dart b/packages/stream_chat/lib/src/core/http/connection_id_manager.dart deleted file mode 100644 index f9b9fb1d51..0000000000 --- a/packages/stream_chat/lib/src/core/http/connection_id_manager.dart +++ /dev/null @@ -1,27 +0,0 @@ -// ignore_for_file: use_setters_to_change_properties - -/// Handles the connection id of the websocket connection -class ConnectionIdManager { - /// Initialize a new connection id manager - ConnectionIdManager({ - this._connectionId, - }); - - String? _connectionId; - - /// Get the current connection id - String? get connectionId => _connectionId; - - /// True if there is a connection id - bool get hasConnectionId => _connectionId != null; - - /// Set the connection id - void setConnectionId(String connectionId) { - _connectionId = connectionId; - } - - /// Clear the connection id - void reset() { - _connectionId = null; - } -} diff --git a/packages/stream_chat/lib/src/core/http/stream_http_client.dart b/packages/stream_chat/lib/src/core/http/stream_http_client.dart index 8953cdb37b..a9c905af08 100644 --- a/packages/stream_chat/lib/src/core/http/stream_http_client.dart +++ b/packages/stream_chat/lib/src/core/http/stream_http_client.dart @@ -6,6 +6,7 @@ import 'package:stream_core/stream_core.dart' show ApiErrorInterceptor, AuthInterceptor, + ConnectionIdGetter, ConnectionIdInterceptor, DioExceptionMapping, HeadersInterceptor, @@ -15,7 +16,6 @@ import 'package:stream_core/stream_core.dart' SystemEnvironmentManager, TokenManager; import '../error/stream_chat_exception.dart'; -import 'connection_id_manager.dart'; import 'interceptor/additional_headers_interceptor.dart'; part 'stream_http_client_options.dart'; @@ -29,7 +29,7 @@ class StreamHttpClient { Dio? dio, StreamHttpClientOptions? options, TokenManager? tokenManager, - ConnectionIdManager? connectionIdManager, + ConnectionIdGetter? connectionId, SystemEnvironmentManager? systemEnvironmentManager, Iterable? interceptors, HttpClientAdapter? httpClientAdapter, @@ -52,7 +52,7 @@ class StreamHttpClient { const AdditionalHeadersInterceptor(), ?systemEnvironmentManager?.let(HeadersInterceptor.new), ?tokenManager?.let((it) => AuthInterceptor(httpClient, it, tag: 'SCh:HttpAuth')), - ?connectionIdManager?.let((it) => ConnectionIdInterceptor(() => it.connectionId)), + ?connectionId?.let(ConnectionIdInterceptor.new), const ApiErrorInterceptor(), ...interceptors ?? [LoggingInterceptor(requestHeader: true, tag: 'SCh:Http')], ]); diff --git a/packages/stream_chat/lib/src/core/util/event_controller.dart b/packages/stream_chat/lib/src/core/util/event_controller.dart index 9f1e5a0cc4..cec504bcf3 100644 --- a/packages/stream_chat/lib/src/core/util/event_controller.dart +++ b/packages/stream_chat/lib/src/core/util/event_controller.dart @@ -1,6 +1,6 @@ import 'dart:async'; import 'package:rxdart/rxdart.dart'; -import '../models/event.dart'; +import '../../ws/events/event.dart'; /// A function that inspects an event and optionally resolves it into a /// more specific or refined version of the same type. diff --git a/packages/stream_chat/lib/src/db/chat_persistence_client.dart b/packages/stream_chat/lib/src/db/chat_persistence_client.dart index 5e4d5eef42..0410e0998a 100644 --- a/packages/stream_chat/lib/src/db/chat_persistence_client.dart +++ b/packages/stream_chat/lib/src/db/chat_persistence_client.dart @@ -6,7 +6,6 @@ import '../core/models/attachment_file.dart'; import '../core/models/channel_model.dart'; import '../core/models/channel_state.dart'; import '../core/models/draft.dart'; -import '../core/models/event.dart'; import '../core/models/location.dart'; import '../core/models/member.dart'; import '../core/models/message.dart'; @@ -16,6 +15,7 @@ import '../core/models/reaction.dart'; import '../core/models/read.dart'; import '../core/models/user.dart'; import '../core/util/extension.dart'; +import '../ws/events/event.dart'; /// A simple client used for persisting chat data locally. abstract class ChatPersistenceClient { diff --git a/packages/stream_chat/lib/src/event_type.dart b/packages/stream_chat/lib/src/event_type.dart index f9e482db60..79dfd884f6 100644 --- a/packages/stream_chat/lib/src/event_type.dart +++ b/packages/stream_chat/lib/src/event_type.dart @@ -102,6 +102,9 @@ class EventType { /// Event sent when the connection is recovered static const String connectionRecovered = 'connection.recovered'; + /// Event sent when the server refuses or ends the connection + static const String connectionError = 'connection.error'; + /// Event sent when the user is accepts an invite static const String notificationInviteAccepted = 'notification.invite_accepted'; diff --git a/packages/stream_chat/lib/src/ws/connect_request.dart b/packages/stream_chat/lib/src/ws/connect_request.dart new file mode 100644 index 0000000000..3d4c176d07 --- /dev/null +++ b/packages/stream_chat/lib/src/ws/connect_request.dart @@ -0,0 +1,86 @@ +import 'dart:convert'; + +import 'package:stream_core/stream_core.dart' show SystemEnvironmentManager, UserToken, WebSocketOptions; + +import '../core/models/own_user.dart'; +import 'connect_user_details.dart'; + +/// Builds the request that opens a Stream Chat WebSocket connection. +/// +/// Describes the endpoint to connect to and the credentials to present, producing the +/// [WebSocketOptions] a single connection attempt is made with. +class ConnectRequest { + /// Creates a [ConnectRequest] against [endpoint]. + const ConnectRequest({ + required this.apiKey, + required this.endpoint, + required this.environment, + }); + + /// Creates a [ConnectRequest] against the connect endpoint of an API at [baseUrl]. + ConnectRequest.forApi( + String baseUrl, { + required this.apiKey, + required this.environment, + }) : endpoint = endpointFor(baseUrl); + + /// The key identifying the app the connection belongs to. + final String apiKey; + + /// The address the connection is opened against. + final String endpoint; + + /// Describes this SDK to the API. + /// + /// Read for each attempt, so a connection reflects how the app describes itself at the time it + /// is opened. + final SystemEnvironmentManager environment; + + /// The connect endpoint for an API at [baseUrl]. + /// + /// Uses the same host as the API, over `wss` for an encrypted address and `ws` for a plain one. + /// Throws a [FormatException] when [baseUrl] is neither. + static String endpointFor(String baseUrl) { + final api = Uri.parse(baseUrl); + + final scheme = switch (api.scheme) { + 'https' || 'wss' => 'wss', + 'http' || 'ws' => 'ws', + _ => throw FormatException('Not an API address', baseUrl), + }; + + return Uri( + scheme: scheme, + host: api.host, + port: api.hasPort ? api.port : null, + pathSegments: ['connect'], + ).toString(); + } + + /// The options that open a connection for [user], presenting [token]. + /// + /// Set [includeUserDetails] to send the user's full details rather than their id alone, which + /// creates or updates them server-side. + WebSocketOptions build({ + required OwnUser user, + required UserToken token, + bool includeUserDetails = false, + }) { + final details = ConnectUserDetails.fromOwnUser(user); + + return WebSocketOptions( + url: endpoint, + queryParameters: { + 'api_key': apiKey, + 'authorization': token.rawValue, + 'stream-auth-type': token.authType.name, + 'X-Stream-Client': jsonEncode(environment.userAgent), + 'json': jsonEncode({ + 'user_id': details.id, + 'user_details': includeUserDetails ? details : {'id': details.id}, + 'server_determines_connection_id': true, + }), + }, + ); + } +} diff --git a/packages/stream_chat/lib/src/ws/connection_manager.dart b/packages/stream_chat/lib/src/ws/connection_manager.dart new file mode 100644 index 0000000000..f7d7959806 --- /dev/null +++ b/packages/stream_chat/lib/src/ws/connection_manager.dart @@ -0,0 +1,273 @@ +import 'dart:async'; + +import 'package:stream_core/stream_core.dart'; + +import '../core/models/own_user.dart'; +import 'connect_request.dart'; +import 'connection_status.dart'; +import 'events/events.dart'; +import 'stream_chat_ws_event.dart'; + +/// The connection a `StreamChatClient` works over. +/// +/// Opens and closes the connection, answers for the id the server issues it, and reopens one that +/// drops. Obtained via `StreamChatClient`; not constructed directly. +class ConnectionManager with Disposable { + /// Creates a [ConnectionManager] that connects with [request]. + /// + /// [wsProvider] stands in for the socket, for tests that drive one without a server. + /// + /// Reports under [tag], and the socket and recovery handler it owns under `:Ws` and + /// `:Recovery`, so one prefix selects the whole family. + ConnectionManager({ + required this._request, + required this._tokenManager, + WebSocketProvider? wsProvider, + String tag = 'SCh:Connection', + }) : _logger = StreamLogger(tag) { + _ws = StreamWebSocketClient( + tag: '$tag:Ws', + messageCodec: const StreamChatWsCodec(), + optionsProvider: _buildOptions, + wsProvider: wsProvider, + ); + + _recovery = ConnectionRecoveryHandler( + client: _ws, + tag: '$tag:Recovery', + policies: [_reconnection], + ); + } + + final ConnectRequest _request; + final TokenManager _tokenManager; + + late final StreamWebSocketClient _ws; + late final ConnectionRecoveryHandler _recovery; + + final StreamLogger _logger; + + // The user the open connection belongs to, and `null` while there is none. + _Session? _session; + + final _reconnection = _PausableReconnectionPolicy(); + + // The attempt everyone opening a connection waits on, while one is under way. + final _opening = InFlightCache(); + + /// Every frame the server has sent, as it arrives. + EventEmitter get events => _ws.events; + + /// The state of the connection, reported on listen and again on every change. + ConnectionStateEmitter get connectionState => _ws.connectionState; + + /// The status the connection presents as. + ConnectionStatus get status => _statusOf(connectionState.value); + + /// [status] on listen, and again on each change. + /// + /// Reports once per change in status, so the steps a connection passes through on its way to + /// being open do not each report one. + Stream get statusStream => connectionState.map(_statusOf).distinct(); + + ConnectionStatus _statusOf(WebSocketConnectionState state) { + return .fromState(state, isRecovering: _recovery.isRecovering); + } + + /// The state a connection attempt settles in, either [Connected] or [Disconnected]. + /// + /// Completes immediately when none is being opened, so a caller that cannot go on without a + /// connection can await it unconditionally — and has to handle [Disconnected] either way. + Future get settled => connectionState.settled; + + /// The unique identifier for the open WebSocket connection. + /// + /// Null while no connection is open. Requests made over an open connection are sent with it. + String? get connectionId => switch (connectionState.value) { + Connected(:final healthCheck) => healthCheck.connectionId, + _ => null, + }; + + /// Stops a dropped connection from being reopened, until [resumeReconnect]. + /// + /// Leaves an open connection alone. Use while the app is in the background, where a reopened + /// connection cannot be used. + void pauseReconnect() => _reconnection.pause(); + + /// Reopens dropped connections again, after [pauseReconnect]. + void resumeReconnect() => _reconnection.resume(); + + /// Opens a connection for [user], completing with the health check that established it. + /// + /// Set [includeUserDetails] to send the user's full details, which creates or updates them + /// server-side. + /// + /// Completes with the attempt already under way when there is one for [user]. + /// + /// Throws a [StateError] when a connection is already open, or one is being opened for another + /// user, and a [StreamChatException] when the server refuses the connection. + Future connect( + OwnUser user, { + bool includeUserDetails = false, + }) async { + if (isDisposed) throw StateError('Cannot connect a disposed ConnectionManager'); + + // Reopening is asked for on events that can land mid-attempt, whose attempt is the connection + // the caller was after. + if (connectionState.value case Connecting() || Authenticating()) { + if (_session case final open? when open.user.id == user.id) return _connect(user); + + throw StateError( + 'Cannot connect ${user.id}: a connection is already being opened for ' + '${_session?.user.id ?? 'another user'}. Disconnect before connecting again.', + ); + } + + // Answered with the frame that opened the connection, the only one naming the user the server + // signed in. + if (connectionState.value case Connected()) { + if (_session case final open? when open.user.id == user.id) { + if (open.established case final established?) return established; + } + + throw StateError( + 'Cannot connect ${user.id}: a connection is already open for ' + '${_session?.user.id ?? 'another user'}. Disconnect before connecting again.', + ); + } + + // The socket refuses to open one while another is still closing. + if (connectionState.value case Disconnecting()) { + await connectionState.waitFor(); + + // Asked for again rather than opened on what was true before the wait. + return connect(user, includeUserDetails: includeUserDetails); + } + + _session = _Session(user, includeUserDetails: includeUserDetails); + resumeReconnect(); + + return _connect(user); + } + + /// Closes the connection, which stays closed until [connect] is called again. + Future disconnect() { + _session = null; + return _ws.disconnect(); + } + + // Waits for the attempt to land or to close, and answers with the frame that landed it. + // + // Everyone waiting on one attempt shares it, including whoever did not start it: a second run + // would wait on the same frame again and report the same refusal twice. + Future _connect(OwnUser user) => _opening.run( + user.id, + () async { + final session = _session; + + // Subscribed before connecting: the frame that establishes the connection is the first health + // check, and the only one carrying the user the server signed in. + final established = events.waitFor(); + + // Not awaited: the state has moved on by the time this returns, so the closure waited on + // below cannot be the one this attempt replaces. + unawaited(_ws.connect()); + + final settledState = await settled; + if (settledState case Disconnected(:final source)) { + // Otherwise it fails unobserved when the socket closes without a frame. + established.ignore(); + _refuse(user, source); + } + + // Already on its way by the time the attempt settles. Kept for whoever asks for the + // connection it opened. + final event = await established; + session?.establishedWith(event); + + return event; + }, + ); + + // Raises why the server would not open a connection, the way a rejected request is raised. + Never _refuse(OwnUser user, DisconnectionSource source) { + _logger.w(() => 'connect ${user.id} failed: ${source.closeReason}', error: source.cause); + + Error.throwWithStackTrace(source.exception, source.stackTrace ?? StackTrace.current); + } + + // The request for a single attempt. Nothing is sent over the socket to authenticate one, so this + // is where a refused token is replaced. + Future _buildOptions( + StreamApiException? previousError, + ) async { + final session = _session; + if (session == null) throw StateError('No user is connected.'); + + // Drop the token the server refused, so the load below asks for another. A provider with no + // other to give ends the session instead of presenting the same one forever. + if (previousError case final refused? when refused.isTokenExpired) { + _tokenManager.expireToken(); + + if (_tokenManager.usesStaticProvider) { + throw StreamAuthenticationException( + message: 'The token was refused and the provider has no other to give', + cause: refused, + ); + } + } + + final userToken = await _tokenManager.getToken(); + + return _request.build( + user: session.user, + token: userToken, + includeUserDetails: session.includeUserDetails, + ); + } + + @override + Future dispose() async { + _session = null; + await _recovery.dispose(); + await _ws.dispose(); + return super.dispose(); + } +} + +// A connection opened for one user: who each request names, and whether their details still have +// to be sent. +class _Session { + _Session( + this.user, { + required this._includeUserDetails, + }); + + final OwnUser user; + + // The frame that opened this connection, and `null` until one does. + HealthCheckEvent? get established => _established; + HealthCheckEvent? _established; + + // Whether an attempt names the user in full, which creates or updates them server-side. + bool get includeUserDetails => _includeUserDetails; + bool _includeUserDetails; + + // Remembers the frame the connection was opened with, and answers with it. + HealthCheckEvent establishedWith(HealthCheckEvent event) { + // Spent here rather than as an attempt is built, which leaves one that never landed paying. + _includeUserDetails = false; + return _established = event; + } +} + +// A policy that can be switched off, for while a reopened connection would go unused. +class _PausableReconnectionPolicy implements AutomaticReconnectionPolicy { + var _paused = false; + + void pause() => _paused = true; + void resume() => _paused = false; + + @override + bool canBeReconnected() => !_paused; +} diff --git a/packages/stream_chat/lib/src/ws/connection_status.dart b/packages/stream_chat/lib/src/ws/connection_status.dart index 28a8e8d4da..605313b31a 100644 --- a/packages/stream_chat/lib/src/ws/connection_status.dart +++ b/packages/stream_chat/lib/src/ws/connection_status.dart @@ -1,11 +1,32 @@ -/// Used to notify the WS connection status +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart'; + +/// The connection a client works over. enum ConnectionStatus { - /// WS is connected and everything is good + /// The connection is open and events are arriving. connected, - /// WS is connecting (usually reconnecting) + /// A connection is being opened, either the first or one replacing a connection that dropped. connecting, - /// WS is disconnected and it's not reconnecting - disconnected, + /// No connection is open, and none is being opened. + disconnected; + + /// The status a connection in [state] presents as. + /// + /// [isRecovering] is whether one that dropped is on its way back, which [state] does not say: + /// one waiting to be reopened and one nothing will reopen read the same. + /// + /// A connection that has yet to be opened reads as [disconnected], the same as one that closed: + /// neither carries events. + @internal + static ConnectionStatus fromState( + WebSocketConnectionState state, { + required bool isRecovering, + }) => switch (state) { + Connected() => connected, + Connecting() || Authenticating() => connecting, + Disconnecting() || Disconnected() when isRecovering => connecting, + Initialized() || Disconnecting() || Disconnected() => disconnected, + }; } diff --git a/packages/stream_chat/lib/src/core/models/event.dart b/packages/stream_chat/lib/src/ws/events/event.dart similarity index 99% rename from packages/stream_chat/lib/src/core/models/event.dart rename to packages/stream_chat/lib/src/ws/events/event.dart index f00ba4ce9f..62c9754598 100644 --- a/packages/stream_chat/lib/src/core/models/event.dart +++ b/packages/stream_chat/lib/src/ws/events/event.dart @@ -1,13 +1,13 @@ import 'package:json_annotation/json_annotation.dart'; import '../../../stream_chat.dart'; -import '../util/serializer.dart'; +import '../../core/util/serializer.dart'; part 'event.g.dart'; /// The class that contains the information about an event @JsonSerializable(includeIfNull: false) -class Event { +class Event extends WsEvent { /// Constructor used for json serialization Event({ this.type = 'local.event', diff --git a/packages/stream_chat/lib/src/core/models/event.g.dart b/packages/stream_chat/lib/src/ws/events/event.g.dart similarity index 100% rename from packages/stream_chat/lib/src/core/models/event.g.dart rename to packages/stream_chat/lib/src/ws/events/event.g.dart diff --git a/packages/stream_chat/lib/src/client/event_resolvers.dart b/packages/stream_chat/lib/src/ws/events/event_resolvers.dart similarity index 98% rename from packages/stream_chat/lib/src/client/event_resolvers.dart rename to packages/stream_chat/lib/src/ws/events/event_resolvers.dart index 393c9bf44f..d84e0c3177 100644 --- a/packages/stream_chat/lib/src/client/event_resolvers.dart +++ b/packages/stream_chat/lib/src/ws/events/event_resolvers.dart @@ -1,5 +1,5 @@ -import '../core/models/event.dart'; -import '../event_type.dart'; +import '../../event_type.dart'; +import 'event.dart'; /// Resolves message new events into more specific `pollCreated` events /// for easier downstream state handling. diff --git a/packages/stream_chat/lib/src/ws/events/events.dart b/packages/stream_chat/lib/src/ws/events/events.dart new file mode 100644 index 0000000000..962cc9d46d --- /dev/null +++ b/packages/stream_chat/lib/src/ws/events/events.dart @@ -0,0 +1,63 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:stream_core/stream_core.dart'; + +import '../../core/models/own_user.dart'; +import '../../event_type.dart'; +import 'event.dart'; + +part 'events.freezed.dart'; +part 'events.g.dart'; + +/// A WebSocket health check event for monitoring connection status. +/// +/// Represents periodic health check messages sent by the Stream Chat WebSocket service to verify +/// connection stability and provide real-time connection monitoring. Contains connection metadata +/// and, on the message that opens the session, the signed-in user. +/// +/// **Note:** This event is not specified in the OpenAPI spec, so we define it manually. +@Freezed(copyWith: false) +@JsonSerializable(createToJson: false) +class HealthCheckEvent extends Event with _$HealthCheckEvent { + /// Creates a new [HealthCheckEvent] instance. + HealthCheckEvent({ + required this.connectionId, + super.createdAt, + super.me, + super.type = EventType.healthCheck, + }) : super(connectionId: connectionId, isLocal: false); + + /// Creates a [HealthCheckEvent] from JSON data. + factory HealthCheckEvent.fromJson(Map json) => _$HealthCheckEventFromJson(json); + + /// The unique identifier for this WebSocket connection. + @override + final String connectionId; + + /// Health check information for this connection. + @override + HealthCheckInfo get healthCheckInfo => HealthCheckInfo(connectionId: connectionId); +} + +/// A WebSocket event sent when there is an error in the connection. +/// +/// Represents connection errors and failures that occur during WebSocket communication with the +/// Stream Chat service. Contains the error describing why the connection could not be served. +/// +/// **Note:** This event is not specified in the OpenAPI spec, so we define it manually. +@Freezed(copyWith: false) +@JsonSerializable(createToJson: false) +class ConnectionErrorEvent extends Event with _$ConnectionErrorEvent { + /// Creates a new [ConnectionErrorEvent] instance. + ConnectionErrorEvent({ + required this.error, + super.createdAt, + super.type = EventType.connectionError, + }) : super(isLocal: false); + + /// Creates a [ConnectionErrorEvent] from JSON data. + factory ConnectionErrorEvent.fromJson(Map json) => _$ConnectionErrorEventFromJson(json); + + /// The error information describing what went wrong. + @override + final StreamApiError error; +} diff --git a/packages/stream_chat/lib/src/ws/events/events.freezed.dart b/packages/stream_chat/lib/src/ws/events/events.freezed.dart new file mode 100644 index 0000000000..2cee91b913 --- /dev/null +++ b/packages/stream_chat/lib/src/ws/events/events.freezed.dart @@ -0,0 +1,56 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'events.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$HealthCheckEvent { + String get connectionId; + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is HealthCheckEvent && + (identical(other.connectionId, connectionId) || other.connectionId == connectionId)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, connectionId); + + @override + String toString() { + return 'HealthCheckEvent(connectionId: $connectionId)'; + } +} + +/// @nodoc +mixin _$ConnectionErrorEvent { + StreamApiError get error; + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ConnectionErrorEvent && + (identical(other.error, error) || other.error == error)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, error); + + @override + String toString() { + return 'ConnectionErrorEvent(error: $error)'; + } +} diff --git a/packages/stream_chat/lib/src/ws/events/events.g.dart b/packages/stream_chat/lib/src/ws/events/events.g.dart new file mode 100644 index 0000000000..1170a80105 --- /dev/null +++ b/packages/stream_chat/lib/src/ws/events/events.g.dart @@ -0,0 +1,22 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'events.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +HealthCheckEvent _$HealthCheckEventFromJson(Map json) => HealthCheckEvent( + connectionId: json['connection_id'] as String, + createdAt: json['created_at'] == null ? null : DateTime.parse(json['created_at'] as String), + me: json['me'] == null ? null : OwnUser.fromJson(json['me'] as Map), + type: json['type'] as String? ?? EventType.healthCheck, +); + +ConnectionErrorEvent _$ConnectionErrorEventFromJson( + Map json, +) => ConnectionErrorEvent( + error: StreamApiError.fromJson(json['error'] as Map), + createdAt: json['created_at'] == null ? null : DateTime.parse(json['created_at'] as String), + type: json['type'] as String? ?? EventType.connectionError, +); diff --git a/packages/stream_chat/lib/src/ws/stream_chat_ws_event.dart b/packages/stream_chat/lib/src/ws/stream_chat_ws_event.dart new file mode 100644 index 0000000000..a3373889a0 --- /dev/null +++ b/packages/stream_chat/lib/src/ws/stream_chat_ws_event.dart @@ -0,0 +1,30 @@ +import 'dart:convert'; + +import 'package:stream_core/stream_core.dart'; + +import '../event_type.dart'; +import 'events/event.dart'; +import 'events/events.dart'; + +/// Encodes and decodes Stream Chat WebSocket messages. +/// +/// Decodes each frame into the event it represents, and encodes the requests sent back over the +/// connection. +class StreamChatWsCodec implements WebSocketMessageCodec { + /// Creates a [StreamChatWsCodec]. + const StreamChatWsCodec(); + + @override + Object encode(WsRequest message) => jsonEncode(message.toJson()); + + @override + WsEvent decode(Object message) { + final json = jsonDecode(message.toString()) as Map; + + return switch (json['type']) { + EventType.healthCheck => HealthCheckEvent.fromJson(json), + EventType.connectionError => ConnectionErrorEvent.fromJson(json), + _ => Event.fromJson(json), + }; + } +} diff --git a/packages/stream_chat/lib/src/ws/timer_helper.dart b/packages/stream_chat/lib/src/ws/timer_helper.dart deleted file mode 100644 index 1478327cc2..0000000000 --- a/packages/stream_chat/lib/src/ws/timer_helper.dart +++ /dev/null @@ -1,51 +0,0 @@ -import 'dart:async'; -import 'package:uuid/uuid.dart'; - -/// -mixin class TimerHelper { - final _uuid = const Uuid(); - late final _timers = {}; - - /// - String setTimer( - Duration duration, - void Function() callback, { - bool immediate = false, - }) { - final id = _uuid.v1(); - final timer = Timer(duration, callback); - if (immediate) callback(); - _timers[id] = timer; - return id; - } - - /// - String setPeriodicTimer( - Duration duration, - void Function(Timer) callback, { - bool immediate = false, - }) { - final id = _uuid.v1(); - final timer = Timer.periodic(duration, callback); - if (immediate) callback.call(timer); - _timers[id] = timer; - return id; - } - - /// - void cancelTimer(String id) { - final timer = _timers.remove(id); - return timer?.cancel(); - } - - /// - void cancelAllTimers() { - for (final t in _timers.values) { - t.cancel(); - } - _timers.clear(); - } - - /// - bool get hasTimers => _timers.isNotEmpty; -} diff --git a/packages/stream_chat/lib/src/ws/websocket.dart b/packages/stream_chat/lib/src/ws/websocket.dart deleted file mode 100644 index b71211b311..0000000000 --- a/packages/stream_chat/lib/src/ws/websocket.dart +++ /dev/null @@ -1,586 +0,0 @@ -import 'dart:async'; -import 'dart:convert'; -import 'dart:math' as math; - -import 'package:meta/meta.dart'; -import 'package:rxdart/rxdart.dart'; -import 'package:stream_core/stream_core.dart' - show - StreamApiException, - StreamException, - StreamApiError, - StreamLogger, - StreamNetworkException, - SystemEnvironmentManager, - TokenManager; -import 'package:web_socket_channel/status.dart' as status; -import 'package:web_socket_channel/web_socket_channel.dart'; - -import '../core/models/event.dart'; -import '../core/models/own_user.dart'; -import '../core/util/extension.dart'; -import '../event_type.dart'; -import 'connect_user_details.dart'; -import 'connection_status.dart'; -import 'timer_helper.dart'; - -/// Typedef which exposes an [Event] as the only parameter. -typedef EventHandler = void Function(Event); - -/// Typedef used for connecting to a websocket. Method returns a -/// [WebSocketChannel] and accepts a connection [url] and an optional -/// [Iterable] of `protocols`. -typedef WebSocketChannelProvider = - WebSocketChannel Function( - Uri uri, { - Iterable? protocols, - }); - -/// A WebSocket connection that reconnects upon failure. -class WebSocket with TimerHelper { - /// Creates a new websocket - /// To connect the WS call [connect] - WebSocket({ - required this.apiKey, - required this.baseUrl, - required this.tokenManager, - this.systemEnvironmentManager, - this.handler, - this.webSocketChannelProvider, - this.reconnectionMonitorInterval = 10, - this.healthCheckInterval = 20, - this.reconnectionMonitorTimeout = 40, - this.maxReconnectAttempts = 6, - this.queryParameters = const {}, - String tag = 'SCh:Ws', - }) : _logger = StreamLogger(tag); - - final StreamLogger _logger; - - /// - final String apiKey; - - /// Additional query parameters to be added to the websocket url - final Map queryParameters; - - /// WS base url - final String baseUrl; - - /// Manager responsible for handling authentication tokens. - /// - /// Used to retrieve tokens for websocket connections and refreshing expired - /// tokens. - final TokenManager tokenManager; - - /// Manager that provides system environment information like SDK version and - /// platform details. - /// - /// Used to send client identification in websocket connection requests. - final SystemEnvironmentManager? systemEnvironmentManager; - - /// Functions that will be called every time a new event is received from the - /// connection - final EventHandler? handler; - - /// Connection function - /// Used only for testing purpose - @visibleForTesting - final WebSocketChannelProvider? webSocketChannelProvider; - - /// Interval of the reconnection monitor timer - /// This checks that it received a new event in the last - /// [reconnectionMonitorTimeout] seconds, otherwise it considers the - /// connection unhealthy and reconnects the WS - final int reconnectionMonitorInterval; - - /// Interval of the health event sending timer - /// This sends a health event every [healthCheckInterval] seconds in order to - /// make the server aware that the client is still listening - final int healthCheckInterval; - - /// The timeout that uses the reconnection monitor timer to consider the - /// connection unhealthy - final int reconnectionMonitorTimeout; - - /// Maximum number of reconnection attempts before giving up. - /// - /// Default is 6 attempts. ~30 seconds of reconnection attempts - final int maxReconnectAttempts; - - OwnUser? _user; - String? _connectionId; - DateTime? _lastEventAt; - WebSocketChannel? _webSocketChannel; - StreamSubscription? _webSocketChannelSubscription; - - /// - Completer? connectionCompleter; - - /// - String? get connectionId => _connectionId; - - final _connectionStatusController = BehaviorSubject.seeded( - ConnectionStatus.disconnected, - ); - - /// The current connection status value - ConnectionStatus get connectionStatus => _connectionStatusController.value; - set _connectionStatus(ConnectionStatus status) { - _connectionStatusController.safeAdd(status); - } - - /// This notifies of connection status changes - Stream get connectionStatusStream { - return _connectionStatusController.stream.distinct(); - } - - void _initWebSocketChannel(Uri uri) { - _logger.d(() => 'Initiating connection with $baseUrl'); - if (_webSocketChannel != null) { - _closeWebSocketChannel(); - } - _webSocketChannel = webSocketChannelProvider?.call(uri) ?? WebSocketChannel.connect(uri); - // Connect failures reach onError below; ignore the ready and sink.done - // duplicates so they aren't reported as unhandled errors. - _webSocketChannel?.ready.ignore(); - _webSocketChannel?.sink.done.ignore(); - _subscribeToWebSocketChannel(); - } - - void _closeWebSocketChannel() { - _logger.d(() => 'Closing connection with $baseUrl'); - if (_webSocketChannel != null) { - _unsubscribeFromWebSocketChannel(); - _webSocketChannel?.sink.close(status.normalClosure, 'Closing connection'); - _webSocketChannel = null; - } - } - - void _subscribeToWebSocketChannel() { - _logger.d(() => 'Started listening to $baseUrl'); - if (_webSocketChannelSubscription != null) { - _unsubscribeFromWebSocketChannel(); - } - _webSocketChannelSubscription = _webSocketChannel?.stream.listen( - _onDataReceived, - onError: _onConnectionError, - onDone: _onConnectionClosed, - ); - } - - void _unsubscribeFromWebSocketChannel() { - _logger.d(() => 'Stopped listening to $baseUrl'); - if (_webSocketChannelSubscription != null) { - _webSocketChannelSubscription?.cancel(); - _webSocketChannelSubscription = null; - } - } - - Future _buildUri({ - bool refreshToken = false, - bool includeUserDetails = true, - }) async { - final userDetails = ConnectUserDetails.fromOwnUser(_user!); - if (refreshToken) tokenManager.expireToken(); - final token = await tokenManager.getToken(); - final params = { - 'user_id': userDetails.id, - 'user_details': includeUserDetails ? userDetails : {'id': userDetails.id}, - 'user_token': token.rawValue, - 'server_determines_connection_id': true, - }; - - final userAgent = systemEnvironmentManager?.userAgent; - final qs = { - 'json': jsonEncode(params), - 'api_key': apiKey, - 'authorization': token.rawValue, - 'stream-auth-type': token.authType.name, - ...queryParameters, - if (userAgent != null) 'X-Stream-Client': jsonEncode(userAgent), - }; - - final scheme = switch (baseUrl) { - final url when url.startsWith(RegExp('^(ws?|http?)://')) => 'ws', - final url when url.startsWith(RegExp('^(wss?|https?)://')) => 'wss', - _ => throw const FormatException('Invalid url format'), - }; - - final address = baseUrl.replaceAll(RegExp(r'(^\w+:|^)\/\/'), ''); - final (:host, :port) = switch (address.split(':')) { - [final host] => (host: host, port: null), - [final host, final port] => (host: host, port: int.tryParse(port)), - _ => throw const FormatException('Invalid address format'), - }; - - _logger.d(() => '[buildUri] #ws; scheme: $scheme, host: $host, port: $port'); - - return Uri( - scheme: scheme, - host: host, - port: port, - pathSegments: ['connect'], - queryParameters: qs, - ); - } - - bool _connectRequestInProgress = false; - - /// Connect the WS using the parameters passed in the constructor - Future connect( - OwnUser user, { - bool includeUserDetails = false, - }) { - if (_connectRequestInProgress) { - throw StateError( - 'A connection attempt is already in progress; only one is allowed at a time.', - ); - } - _connectRequestInProgress = true; - _manuallyClosed = false; - - _user = user; - _connectionStatus = ConnectionStatus.connecting; - - connectionCompleter = Completer(); - - _setupConnection(includeUserDetails: includeUserDetails); - - return connectionCompleter!.future; - } - - Future _setupConnection({ - required bool includeUserDetails, - }) async { - try { - final uri = await _buildUri( - includeUserDetails: includeUserDetails, - ); - _logger.d(() => '[connect] #ws; uri: ${uri.withoutCredentials}'); - _initWebSocketChannel(uri); - } catch (e, stk) { - _onConnectionError(e, stk); - } - } - - int _reconnectAttempt = 0; - bool _reconnectRequestInProgress = false; - bool _reconnectEnabled = true; - - /// Whether automatic reconnection is currently enabled. - bool get reconnectEnabled => _reconnectEnabled; - - /// Suspends automatic reconnection without tearing down the user session. - /// - /// While paused, unexpected socket closures (e.g. when the OS closes the - /// connection after the app is backgrounded) will not trigger retries. - /// Call [resumeReconnect] before re-establishing the connection. - void pauseReconnect() { - if (!_reconnectEnabled) return; - _logger.d(() => 'Pausing reconnection'); - _reconnectEnabled = false; - } - - /// Re-enables automatic reconnection after a previous [pauseReconnect]. - void resumeReconnect() { - if (_reconnectEnabled) return; - _logger.d(() => 'Resuming reconnection'); - _reconnectEnabled = true; - } - - void _reconnect({bool refreshToken = false}) async { - if (_reconnectRequestInProgress) return; - - // Must run before the pause check so the health-check timer can't fire - // on a closed sink while we wait. - _stopMonitoringEvents(); - _closeWebSocketChannel(); - - if (!_reconnectEnabled) { - _logger.d(() => 'Reconnect skipped: paused'); - _connectionStatus = ConnectionStatus.disconnected; - return; - } - - _logger.i(() => 'Retrying connection : $_reconnectAttempt'); - - if (_reconnectAttempt >= maxReconnectAttempts) { - _logger.e(() => 'Max reconnect attempts reached: $maxReconnectAttempts'); - return disconnect(); - } - - _reconnectRequestInProgress = true; - - _reconnectAttempt += 1; - _connectionStatus = ConnectionStatus.connecting; - - final delay = _getReconnectInterval(_reconnectAttempt); - setTimer( - Duration(milliseconds: delay), - () async { - // If the user is null, it means either the connection was never - // established or it was disconnected manually. - // - // In either case, we should not attempt to reconnect. - if (_user == null) return; - - // Reconnect may have been paused while the delay was pending. - if (!_reconnectEnabled) return; - - final uri = await _buildUri( - refreshToken: refreshToken, - includeUserDetails: false, - ); - _logger.d(() => '[reconnect] #ws; uri: ${uri.withoutCredentials}'); - try { - _initWebSocketChannel(uri); - } catch (e, stk) { - _onConnectionError(e, stk); - } - }, - ); - } - - // returns the reconnect interval based on `reconnectAttempt` in milliseconds - int _getReconnectInterval(int reconnectAttempt) { - // try to reconnect in 0.25-25 seconds - // (random to spread out the load from failures) - final max = math.min(500 + reconnectAttempt * 2000, 25000); - final min = math.min( - math.max(250, (reconnectAttempt - 1) * 2000), - 25000, - ); - return (math.Random().nextDouble() * (max - min) + min).floor(); - } - - void _startMonitoringEvents() { - _logger.d(() => 'Starting monitoring events'); - // cancel all previous timers - cancelAllTimers(); - - _startHealthCheck(); - _startReconnectionMonitor(); - } - - void _stopMonitoringEvents() { - _logger.d(() => 'Stopped monitoring events'); - // reset lastEvent - _lastEventAt = null; - - cancelAllTimers(); - } - - void _handleConnectedEvent(Event event) { - // updating connectionId and status - _connectionId = event.connectionId; - _connectionStatus = ConnectionStatus.connected; - - _logger.i(() => 'Connection successful: $_connectionId'); - - // notify user that connection is completed - final completer = connectionCompleter; - if (completer != null && !completer.isCompleted) { - completer.complete(event); - } - - // start monitoring health-check events - _startMonitoringEvents(); - } - - void _handleHealthCheckEvent(Event event) { - _logger.v(() => 'HealthCheck received : ${event.connectionId}'); - - _connectionId = event.connectionId; - _connectionStatus = ConnectionStatus.connected; - } - - void _handleStreamError(Map errorResponse) { - // resetting connect, reconnect request flag - _resetRequestFlags(); - - final data = StreamApiError.fromJson(errorResponse); - final error = StreamApiException.fromApiError(data); - final isTokenExpired = error.isTokenExpired; - if (isTokenExpired && !tokenManager.usesStaticProvider) { - _logger.w(() => 'Connection failed, token expired'); - return _reconnect(refreshToken: true); - } - - _logger.e(() => 'Connection failed', error: error); - - final completer = connectionCompleter; - // complete with error if not yet completed - if (completer != null && !completer.isCompleted) { - // complete the connection with error - completer.completeError(error); - // disconnect the web-socket connection - return disconnect(); - } - - return _reconnect(); - } - - void _onDataReceived(dynamic data) { - final jsonData = json.decode(data) as Map; - final error = jsonData['error'] as Map?; - if (error != null) return _handleStreamError(error); - - // resetting connect, reconnect request flag - _resetRequestFlags(resetAttempts: true); - - Event? event; - try { - event = Event.fromJson(jsonData); - } catch (e, stk) { - _logger.w(() => 'Error parsing an event: $e'); - _logger.w(() => 'Stack trace: $stk'); - } - - if (event == null) return; - - _lastEventAt = DateTime.now(); - // Read outside the closure: promotion does not reach inside one. - final type = event.type; - _logger.v(() => 'Event received: $type'); - - if (event.type == EventType.healthCheck) { - if (event.me != null) { - _handleConnectedEvent(event); - } else { - _handleHealthCheckEvent(event); - } - } - - return handler?.call(event); - } - - void _onConnectionError(error, [stacktrace]) { - _logger.w(() => '[onConnectionError] #ws; error occurred', error: error, stackTrace: stacktrace); - - var exception = StreamException.tryFrom(error); - exception ??= StreamNetworkException( - message: 'The connection reported an error', - cause: error, - ); - - final completer = connectionCompleter; - // complete with error if not yet completed - if (completer != null && !completer.isCompleted) { - // complete the connection with error - completer.completeError(exception); - } - - // resetting connect, reconnect request flag - _resetRequestFlags(); - - _reconnect(); - } - - bool _manuallyClosed = false; - - void _onConnectionClosed() { - _logger.w(() => 'Connection closed : $connectionId'); - - // resetting connect, reconnect request flag - _resetRequestFlags(); - - // resetting connection - _connectionId = null; - - // check if we manually closed the connection - if (_manuallyClosed) return; - _reconnect(); - } - - bool get _needsToReconnect { - final lastEventAt = _lastEventAt; - // means not yet connected or disconnected - if (lastEventAt == null) return false; - - // means we missed a health check - final now = DateTime.now(); - return now.difference(lastEventAt).inSeconds > reconnectionMonitorTimeout; - } - - void _resetRequestFlags({bool resetAttempts = false}) { - _connectRequestInProgress = false; - _reconnectRequestInProgress = false; - if (resetAttempts) _reconnectAttempt = 0; - } - - void _startReconnectionMonitor() { - _logger.d(() => 'Starting reconnection monitor'); - setPeriodicTimer( - Duration(seconds: reconnectionMonitorInterval), - (_) { - final needsToReconnect = _needsToReconnect; - _logger.v(() => 'Needs to reconnect : $needsToReconnect'); - if (needsToReconnect) _reconnect(); - }, - immediate: true, - ); - } - - void _startHealthCheck() { - _logger.d(() => 'Starting health check monitor'); - setPeriodicTimer( - Duration(seconds: healthCheckInterval), - (_) { - _logger.v(() => 'Sending Event: ${EventType.healthCheck}'); - final event = Event( - type: EventType.healthCheck, - connectionId: connectionId, - ); - _webSocketChannel?.sink.add(jsonEncode(event)); - }, - immediate: true, - ); - } - - /// Disconnects the WS and releases eventual resources - void disconnect() { - if (connectionStatus == ConnectionStatus.disconnected) return; - _connectionStatus = ConnectionStatus.disconnected; - - _logger.i(() => 'Disconnecting web-socket connection'); - - _manuallyClosed = true; - _resetRequestFlags(resetAttempts: true); - _stopMonitoringEvents(); - - // resetting user - _user = null; - connectionCompleter = null; - - _closeWebSocketChannel(); - } - - /// Disposes the web-socket connection and releases resources - Future dispose() async { - _logger.d(() => 'Disposing web-socket connection'); - - _stopMonitoringEvents(); - _unsubscribeFromWebSocketChannel(); - _closeWebSocketChannel(); - _connectionStatusController.close(); - } -} - -// The connect URI carries the user token twice — as `authorization`, and as -// `user_token` inside the `json` payload — so neither reaches a log. -extension on Uri { - Uri get withoutCredentials { - const redacted = ''; - final params = {...queryParameters}; - - if (params.containsKey('authorization')) params['authorization'] = redacted; - - if (params['json'] case final payload?) { - if (jsonDecode(payload) case final Map decoded when decoded.containsKey('user_token')) { - params['json'] = jsonEncode({...decoded, 'user_token': redacted}); - } - } - - return replace(queryParameters: params); - } -} diff --git a/packages/stream_chat/lib/stream_chat.dart b/packages/stream_chat/lib/stream_chat.dart index e62842e2b4..2ed3dd470e 100644 --- a/packages/stream_chat/lib/stream_chat.dart +++ b/packages/stream_chat/lib/stream_chat.dart @@ -24,11 +24,13 @@ export 'package:rate_limiter/rate_limiter.dart'; export 'package:stream_core/stream_core.dart' show CompositeComparator, + ConnectionIdGetter, CurrentPlatform, Distance, EvaluationOperator, Failure, Filter, + HealthCheckInfo, FilterField, FilterOperator, LocationCoordinate, @@ -59,7 +61,8 @@ export 'package:stream_core/stream_core.dart' TokenManager, TokenProvider, UserToken, - UserTokenLoader; + UserTokenLoader, + WsEvent; export 'package:uuid/uuid.dart'; @@ -93,7 +96,6 @@ export 'src/core/models/command.dart'; export 'src/core/models/device.dart'; export 'src/core/models/draft.dart'; export 'src/core/models/draft_message.dart'; -export 'src/core/models/event.dart'; export 'src/core/models/location.dart'; export 'src/core/models/member.dart'; export 'src/core/models/message.dart'; @@ -127,4 +129,5 @@ export 'src/core/util/extension.dart'; export 'src/core/util/message_rules.dart'; export 'src/db/chat_persistence_client.dart'; export 'src/event_type.dart'; -export 'src/ws/connection_status.dart'; +export 'src/ws/connection_status.dart' show ConnectionStatus; +export 'src/ws/events/event.dart'; diff --git a/packages/stream_chat/pubspec.yaml b/packages/stream_chat/pubspec.yaml index 2fbadbe2d6..de295d5ce3 100644 --- a/packages/stream_chat/pubspec.yaml +++ b/packages/stream_chat/pubspec.yaml @@ -39,11 +39,10 @@ dependencies: stream_core: git: url: https://github.com/GetStream/stream-core-flutter.git - ref: 04e0d1cb3a6893cf70cb6636a261deb11beff81c + ref: 6042453b56c782d9c8b29a2d103ae73ba433814c path: packages/stream_core synchronized: ^3.4.0 uuid: ^4.5.3 - web_socket_channel: ^3.0.3 dev_dependencies: build_runner: ^2.15.0 @@ -52,3 +51,4 @@ dev_dependencies: mocktail: ^1.0.5 retrofit_generator: ^10.2.6 test: ^1.31.1 + web_socket_channel: ^3.0.3 diff --git a/packages/stream_chat/test/src/client/client_connection_id_test.dart b/packages/stream_chat/test/src/client/client_connection_id_test.dart new file mode 100644 index 0000000000..b614048ac5 --- /dev/null +++ b/packages/stream_chat/test/src/client/client_connection_id_test.dart @@ -0,0 +1,66 @@ +import 'package:dio/dio.dart'; +import 'package:mocktail/mocktail.dart'; +import 'package:stream_chat/stream_chat.dart'; +import 'package:test/test.dart'; + +import '../utils.dart'; +import '../ws/fake_chat_server.dart'; + +// Every request made over an open connection has to name it, or the API refuses anything that +// watches or reports presence. Nothing else in this package's tests reaches the real interceptor +// chain — they all inject a mocked `chatApi` — so the wiring between the client and its HTTP +// client is only covered here. +void main() { + setUpAll(() => registerFallbackValue(RequestOptions())); + + late MockHttpClientAdapter adapter; + late StreamChatClient client; + late FakeChatServer ws; + + setUp(() { + adapter = MockHttpClientAdapter(); + when(() => adapter.fetch(any(), any(), any())).thenAnswer( + (_) async => ResponseBody.fromString('{"channels":[]}', 200, headers: _jsonHeaders), + ); + + ws = FakeChatServer(); + client = StreamChatClient('test-api-key', wsProvider: ws.connect, httpClientAdapter: adapter); + }); + + tearDown(() => client.dispose()); + + test('StreamChatClient names the open connection on the requests it makes', () async { + final user = User(id: 'test-user-id'); + ws.user = OwnUser.fromUser(user); + + await client.connectUser(user, testUserToken(user.id).rawValue); + await client.queryChannels(watch: true).first; + + expect(_lastRequest(adapter).queryParameters, containsPair('connection_id', 'fake-connection-id')); + }); + + test('StreamChatClient stops naming a connection once it closes', () async { + final user = User(id: 'test-user-id'); + ws.user = OwnUser.fromUser(user); + + await client.connectUser(user, testUserToken(user.id).rawValue); + client.closeConnection(); + + // The id is read off the connection for every request, so a closed one names nothing — where + // a stored id would go on claiming a connection the server has already let go of. + await client.queryChannels(watch: false, waitForConnect: false).first; + + expect(_lastRequest(adapter).queryParameters, isNot(contains('connection_id'))); + }); +} + +RequestOptions _lastRequest(MockHttpClientAdapter adapter) { + final calls = verify(() => adapter.fetch(captureAny(), any(), any())).captured; + return calls.last as RequestOptions; +} + +const _jsonHeaders = { + Headers.contentTypeHeader: [Headers.jsonContentType], +}; + +class MockHttpClientAdapter extends Mock implements HttpClientAdapter {} diff --git a/packages/stream_chat/test/src/client/client_test.dart b/packages/stream_chat/test/src/client/client_test.dart index bf3863e37d..4dda5649c4 100644 --- a/packages/stream_chat/test/src/client/client_test.dart +++ b/packages/stream_chat/test/src/client/client_test.dart @@ -3,6 +3,7 @@ import 'dart:async'; import 'package:mocktail/mocktail.dart'; +import 'package:stream_chat/src/ws/events/events.dart'; import 'package:stream_chat/stream_chat.dart'; import 'package:test/test.dart'; @@ -10,6 +11,7 @@ import '../fakes.dart'; import '../matchers.dart'; import '../mocks.dart'; import '../utils.dart'; +import '../ws/fake_chat_server.dart'; void main() { group('Fake web-socket connection functions', () { @@ -24,8 +26,8 @@ void main() { }); setUp(() { - final ws = FakeWebSocket(); - client = StreamChatClient(apiKey, ws: ws, chatApi: api); + final ws = FakeChatServer(); + client = StreamChatClient(apiKey, wsProvider: ws.connect, chatApi: api); }); tearDown(() { @@ -38,11 +40,8 @@ void main() { expectLater( // skipping first seed status -> ConnectionStatus.disconnected - client.wsConnectionStatusStream.skip(1), - emitsInOrder([ - ConnectionStatus.connecting, - ConnectionStatus.connected, - ]), + client.connectionStatusStream.skip(1), + emitsInOrder([ConnectionStatus.connecting, ConnectionStatus.connected]), ); final res = await client.connectUser(user, token); @@ -59,11 +58,8 @@ void main() { expectLater( // skipping first seed status -> ConnectionStatus.disconnected - client.wsConnectionStatusStream.skip(1), - emitsInOrder([ - ConnectionStatus.connecting, - ConnectionStatus.connected, - ]), + client.connectionStatusStream.skip(1), + emitsInOrder([ConnectionStatus.connecting, ConnectionStatus.connected]), ); final res = await client.connectUserWithProvider(user, TokenProvider.dynamic(tokenProvider)); @@ -84,11 +80,8 @@ void main() { expectLater( // skipping first seed status -> ConnectionStatus.disconnected - client.wsConnectionStatusStream.skip(1), - emitsInOrder([ - ConnectionStatus.connecting, - ConnectionStatus.connected, - ]), + client.connectionStatusStream.skip(1), + emitsInOrder([ConnectionStatus.connecting, ConnectionStatus.connected]), ); final res = await client.connectGuestUser(user); @@ -108,7 +101,7 @@ void main() { ).thenThrow(apiException(code: StreamErrorCode.inputError, statusCode: 400)); expectLater( - client.wsConnectionStatusStream, + client.connectionStatusStream, emitsInOrder([ // only emits the seed -> disconnected status // as the call never reaches `ws.connect` @@ -131,11 +124,8 @@ void main() { test('`.connectAnonymousUser` should work fine', () async { expectLater( // skipping first seed status -> ConnectionStatus.disconnected - client.wsConnectionStatusStream.skip(1), - emitsInOrder([ - ConnectionStatus.connecting, - ConnectionStatus.connected, - ]), + client.connectionStatusStream.skip(1), + emitsInOrder([ConnectionStatus.connecting, ConnectionStatus.connected]), ); final res = await client.connectAnonymousUser(); @@ -152,24 +142,22 @@ void main() { } }); - test('should throw if connection is already available', () async { + test('should answer with the connection already open', () async { expect(client.state.currentUser, isNull); - try { - await client.connectAnonymousUser(); - // waiting 300ms for `wsConnectionStatusStream` to emit - await delay(300); - await client.openConnection(); - } catch (e) { - // Misuse, so it leaves the StreamException hierarchy entirely. - expect(e, isA()); - expect((e as StateError).message, contains('already available for')); - } + final connected = await client.connectAnonymousUser(); + // waiting 300ms for `wsConnectionStatusStream` to emit + await delay(300); + + // The connection being asked for is the one already open, so the caller is answered with + // it rather than told they should have disconnected first. + expect(await client.openConnection(), connected); + expect(client.connectionStatus, ConnectionStatus.connected); }); test('should open connection for closed connection', () async { expectLater( - client.wsConnectionStatusStream.skip(1), + client.connectionStatusStream.skip(1), emitsInOrder([ // initial connectUser ConnectionStatus.connecting, @@ -205,8 +193,8 @@ void main() { }); setUp(() { - final ws = FakeWebSocketWithConnectionError(); - client = StreamChatClient(apiKey, chatApi: api, ws: ws); + final ws = FakeChatServer()..handshakeFails = true; + client = StreamChatClient(apiKey, chatApi: api, wsProvider: ws.connect); }); tearDown(() { @@ -302,7 +290,7 @@ void main() { connectWebSocket: false, ); expect(res, isSameUserAs(user)); - expect(client.wsConnectionStatus, ConnectionStatus.disconnected); + expect(client.connectionStatus, ConnectionStatus.disconnected); }); test( @@ -320,7 +308,7 @@ void main() { connectWebSocket: false, ); expect(res, isSameUserAs(user)); - expect(client.wsConnectionStatus, ConnectionStatus.disconnected); + expect(client.connectionStatus, ConnectionStatus.disconnected); }, ); @@ -340,7 +328,7 @@ void main() { ); expect(res, isSameUserAs(user)); - expect(client.wsConnectionStatus, ConnectionStatus.disconnected); + expect(client.connectionStatus, ConnectionStatus.disconnected); verify( () => api.guest.getGuestUser(any(that: isSameUserAs(user))), ).called(1); @@ -354,7 +342,7 @@ void main() { ); expect(res, isNotNull); - expect(client.wsConnectionStatus, ConnectionStatus.disconnected); + expect(client.connectionStatus, ConnectionStatus.disconnected); }, ); }); @@ -372,8 +360,8 @@ void main() { }); setUp(() { - final ws = FakeWebSocketWithConnectionError(); - client = StreamChatClient(apiKey, chatApi: api, ws: ws)..chatPersistenceClient = persistence; + final ws = FakeChatServer()..handshakeFails = true; + client = StreamChatClient(apiKey, chatApi: api, wsProvider: ws.connect)..chatPersistenceClient = persistence; }); tearDown(() { @@ -500,21 +488,36 @@ void main() { setUp(() async { when(() => persistence.updateLastSyncAt(any())).thenAnswer((_) => Future.value()); when(persistence.getLastSyncAt).thenAnswer((_) async => null); - final ws = FakeWebSocket(); - client = StreamChatClient(apiKey, chatApi: api, ws: ws)..chatPersistenceClient = persistence; + // The hello frame reaches the client through the socket now, so connecting stores the + // connection info before any test has had a chance to stub it. + when(() => persistence.updateConnectionInfo(any())).thenAnswer((_) => Future.value()); + final ws = FakeChatServer(); + client = StreamChatClient(apiKey, chatApi: api, wsProvider: ws.connect)..chatPersistenceClient = persistence; await client.connectUser(user, token); await delay(300); expect(client.persistenceEnabled, isTrue); - expect(client.wsConnectionStatus, ConnectionStatus.connected); + expect(client.connectionStatus, ConnectionStatus.connected); }); tearDown(() async { await client.dispose(); }); + // The store holds the connection the cached state belongs to, and only the hello frame names + // one — the `/sync` endpoint reads the channel event store, which never holds a health check. + test('should store the connection the hello frame established', () async { + final captured = verify(() => persistence.updateConnectionInfo(captureAny())).captured; + + expect(captured, hasLength(1)); + expect( + captured.single, + isA().having((it) => it.connectionId, 'connectionId', isNotEmpty), + ); + }); + group('`.sync`', () { test( - '''should update persistence connectionInfo and lastSync when sync succeeds''', + 'should update lastSync when sync succeeds', () async { // persistence.updateLastSyncAt might be called // when connecting the user. @@ -525,12 +528,6 @@ void main() { when(() => api.general.sync(cids, lastSyncAt)).thenAnswer( (_) async => SyncResponse() ..events = [ - Event( - isLocal: false, - type: EventType.healthCheck, - connectionId: 'test-connection-id', - me: OwnUser.fromUser(user), - ), Event( isLocal: false, type: EventType.messageDeleted, @@ -539,12 +536,10 @@ void main() { ], ); - when(() => persistence.updateConnectionInfo(any())).thenAnswer((_) => Future.value()); when(() => persistence.updateLastSyncAt(any())).thenAnswer((_) => Future.value()); await client.sync(cids: cids, lastSyncAt: lastSyncAt); - verify(() => persistence.updateConnectionInfo(any())).called(1); verify(() => persistence.updateLastSyncAt(any())).called(1); verify(() => api.general.sync(cids, lastSyncAt)).called(1); }, @@ -566,12 +561,6 @@ void main() { when(() => api.general.sync(cids, lastSyncAt)).thenAnswer( (_) async => SyncResponse() ..events = [ - Event( - isLocal: false, - type: EventType.healthCheck, - connectionId: 'test-connection-id', - me: OwnUser.fromUser(user), - ), Event( isLocal: false, type: EventType.messageDeleted, @@ -580,12 +569,10 @@ void main() { ], ); - when(() => persistence.updateConnectionInfo(any())).thenAnswer((_) => Future.value()); when(() => persistence.updateLastSyncAt(any())).thenAnswer((_) => Future.value()); await client.sync(); - verify(() => persistence.updateConnectionInfo(any())).called(1); verify(() => persistence.updateLastSyncAt(any())).called(1); verify(() => api.general.sync(cids, lastSyncAt)).called(1); verify(persistence.getChannelCids).called(1); @@ -1174,18 +1161,18 @@ void main() { test('`.disconnectUser` should reset state and user', () async { expect(client.state.currentUser, isNotNull); - expect(client.wsConnectionStatus, ConnectionStatus.connected); + expect(client.connectionStatus, ConnectionStatus.connected); expectLater( // skipping initial connected value - client.wsConnectionStatusStream.skip(1), - emits(ConnectionStatus.disconnected), + client.connectionStatusStream.skip(1), + emitsInOrder([ConnectionStatus.disconnected]), ); await client.disconnectUser(flushChatPersistence: true); expect(client.state.currentUser, isNull); - expect(client.wsConnectionStatus, ConnectionStatus.disconnected); + expect(client.connectionStatus, ConnectionStatus.disconnected); }); }); @@ -1213,8 +1200,8 @@ void main() { // verifyNoMoreInteractions on api.general stays accurate. clearInteractions(api.general); - final ws = FakeWebSocket(); - client = StreamChatClient(apiKey, chatApi: api, ws: ws); + final ws = FakeChatServer(); + client = StreamChatClient(apiKey, chatApi: api, wsProvider: ws.connect); // Stub getAppSettings so the background fetch after connectUser succeeds. when(() => api.general.getAppSettings()).thenAnswer( (_) async => GetAppSettingsResponse()..app = const AppSettings(name: 'test'), @@ -1222,7 +1209,7 @@ void main() { await client.connectUser(user, token); await delay(300); expect(client.persistenceEnabled, isFalse); - expect(client.wsConnectionStatus, ConnectionStatus.connected); + expect(client.connectionStatus, ConnectionStatus.connected); }); tearDown(() async { @@ -5086,8 +5073,8 @@ void main() { late StreamChatClient client; setUp(() async { - final ws = FakeWebSocket(); - client = StreamChatClient(apiKey, chatApi: api, ws: ws); + final ws = FakeChatServer(); + client = StreamChatClient(apiKey, chatApi: api, wsProvider: ws.connect); expect(client.persistenceEnabled, isFalse); }); @@ -5382,7 +5369,7 @@ void main() { final token = testUserToken(user.id).rawValue; late FakeChatApi api; - late FakeWebSocket ws; + late FakeChatServer ws; late StreamChatClient client; setUpAll(() { @@ -5392,7 +5379,7 @@ void main() { setUp(() { api = FakeChatApi(); - ws = FakeWebSocket(); + ws = FakeChatServer(); // Stub queryChannels for every test — it's the API the recovery path // calls when enabled, and a missing stub would surface as an unhandled @@ -5418,9 +5405,9 @@ void main() { // Drives the FakeWebSocket through a connected → disconnected → connected // transition so the client's pairwise listener fires the recovery path. Future simulateReconnect() async { - ws.connectionStatus = ConnectionStatus.disconnected; + ws.drop(); await delay(100); - ws.connectionStatus = ConnectionStatus.connected; + await client.openConnection(); await delay(300); } @@ -5434,7 +5421,7 @@ void main() { test('should re-query active channels on reconnect when enabled (default)', () async { // Setup: connect with default flag, register two channels. - client = StreamChatClient(apiKey, chatApi: api, ws: ws); + client = StreamChatClient(apiKey, chatApi: api, wsProvider: ws.connect); await client.connectUser(user, token); await delay(300); @@ -5469,7 +5456,7 @@ void main() { }); test('should skip the re-query on reconnect when disabled', () async { - client = StreamChatClient(apiKey, chatApi: api, ws: ws, recoverStateOnReconnect: false); + client = StreamChatClient(apiKey, chatApi: api, wsProvider: ws.connect, recoverStateOnReconnect: false); await client.connectUser(user, token); await delay(300); @@ -5494,7 +5481,7 @@ void main() { }); test('should still emit `connectionRecovered` when disabled', () async { - client = StreamChatClient(apiKey, chatApi: api, ws: ws, recoverStateOnReconnect: false); + client = StreamChatClient(apiKey, chatApi: api, wsProvider: ws.connect, recoverStateOnReconnect: false); await client.connectUser(user, token); await delay(300); @@ -5529,7 +5516,7 @@ void main() { ), ).thenThrow(StateError('queryChannels needs an active connection. Call `connectUser` first.')); - client = StreamChatClient(apiKey, chatApi: api, ws: ws); + client = StreamChatClient(apiKey, chatApi: api, wsProvider: ws.connect); await client.connectUser(user, token); await delay(300); @@ -5548,7 +5535,7 @@ void main() { }); test('should skip the re-query when no active channels are tracked', () async { - client = StreamChatClient(apiKey, chatApi: api, ws: ws); + client = StreamChatClient(apiKey, chatApi: api, wsProvider: ws.connect); await client.connectUser(user, token); await delay(300); @@ -5574,7 +5561,7 @@ void main() { // Skipping event replay leaves the state of the synced channels behind, so // the skip refreshes them itself, whatever this flag is set to. test('should re-query active channels when the sync skipped event replay', () async { - client = StreamChatClient(apiKey, chatApi: api, ws: ws, recoverStateOnReconnect: false); + client = StreamChatClient(apiKey, chatApi: api, wsProvider: ws.connect, recoverStateOnReconnect: false); await client.connectUser(user, token); await delay(300); @@ -5627,7 +5614,7 @@ void main() { // A failed sync applied nothing and moved nothing, so the configured // recovery still runs and the window stays outstanding for the next sync. test('should re-query active channels when the sync fails, keeping lastSyncAt', () async { - client = StreamChatClient(apiKey, chatApi: api, ws: ws); + client = StreamChatClient(apiKey, chatApi: api, wsProvider: ws.connect); await client.connectUser(user, token); await delay(300); @@ -5685,7 +5672,7 @@ void main() { ), ).thenThrow(StateError('queryChannels needs an active connection. Call `connectUser` first.')); - client = StreamChatClient(apiKey, chatApi: api, ws: ws, recoverStateOnReconnect: false); + client = StreamChatClient(apiKey, chatApi: api, wsProvider: ws.connect, recoverStateOnReconnect: false); await client.connectUser(user, token); await delay(300); @@ -5719,7 +5706,7 @@ void main() { }); test('should re-query in batches when more channels are active than fit in one page', () async { - client = StreamChatClient(apiKey, chatApi: api, ws: ws, recoverStateOnReconnect: false); + client = StreamChatClient(apiKey, chatApi: api, wsProvider: ws.connect, recoverStateOnReconnect: false); await client.connectUser(user, token); await delay(300); @@ -5791,7 +5778,7 @@ void main() { // it fires. Emitting it before the catch-up finishes would have them act // on state the sync has not written yet. test('should finish recovering before `connectionRecovered` fires', () async { - client = StreamChatClient(apiKey, chatApi: api, ws: ws); + client = StreamChatClient(apiKey, chatApi: api, wsProvider: ws.connect); await client.connectUser(user, token); await delay(300); @@ -5837,7 +5824,7 @@ void main() { // One page failing says nothing about the others, so the rest are still // attempted — the channels that can be refreshed are. test('should attempt every page when one of them fails', () async { - client = StreamChatClient(apiKey, chatApi: api, ws: ws, recoverStateOnReconnect: false); + client = StreamChatClient(apiKey, chatApi: api, wsProvider: ws.connect, recoverStateOnReconnect: false); await client.connectUser(user, token); await delay(300); @@ -5911,7 +5898,7 @@ void main() { }); test('should respect runtime toggling via the setter', () async { - client = StreamChatClient(apiKey, chatApi: api, ws: ws); + client = StreamChatClient(apiKey, chatApi: api, wsProvider: ws.connect); await client.connectUser(user, token); await delay(300); @@ -5959,7 +5946,7 @@ void main() { final token = testUserToken(user.id).rawValue; late FakeChatApi api; - late FakeWebSocket ws; + late FakeChatServer ws; late StreamChatClient client; var disposed = false; @@ -5970,7 +5957,7 @@ void main() { setUp(() { api = FakeChatApi(); - ws = FakeWebSocket(); + ws = FakeChatServer(); disposed = false; }); @@ -5999,7 +5986,7 @@ void main() { ), ).thenAnswer((_) => pendingQuery.future); - client = StreamChatClient(apiKey, chatApi: api, ws: ws); + client = StreamChatClient(apiKey, chatApi: api, wsProvider: ws.connect); await client.connectUser(user, token); await delay(300); @@ -6012,9 +5999,9 @@ void main() { client.state.addChannels({'messaging:c1': channel}); // Drop then restore the connection to start a reconnect recovery. - ws.connectionStatus = ConnectionStatus.disconnected; + ws.drop(); await delay(100); - ws.connectionStatus = ConnectionStatus.connected; + await client.openConnection(); await delay(100); // Dispose while the recovery is still in flight. @@ -6026,7 +6013,7 @@ void main() { pendingQuery.complete(QueryChannelsResponse()..channels = []); await delay(300); - expect(client.wsConnectionStatus, ConnectionStatus.disconnected); + expect(client.connectionStatus, ConnectionStatus.disconnected); }); }); @@ -6034,15 +6021,15 @@ void main() { late StreamChatClient client; setUp(() async { - final ws = FakeWebSocket(); - client = StreamChatClient('test-api-key', ws: ws); + final ws = FakeChatServer(); + client = StreamChatClient('test-api-key', wsProvider: ws.connect); final user = User(id: 'test-user-id'); final token = testUserToken(user.id).rawValue; await client.connectUser(user, token); await delay(300); - expect(client.wsConnectionStatus, ConnectionStatus.connected); + expect(client.connectionStatus, ConnectionStatus.connected); }); tearDown(() async { @@ -6194,8 +6181,8 @@ void main() { late StreamChatClient client; setUp(() { - final ws = FakeWebSocket(); - client = StreamChatClient(apiKey, ws: ws, chatApi: api); + final ws = FakeChatServer(); + client = StreamChatClient(apiKey, wsProvider: ws.connect, chatApi: api); }); tearDown(() { @@ -6305,4 +6292,351 @@ void main() { await sub.cancel(); }); }); + + group('event resolvers', () { + // Recovering after an outage replays the events missed over `/sync`, not over the socket, so + // one carrying a poll has to be reported the same way as one that arrived live. + test('should report a poll message recovered after an outage as a poll created event', () async { + final client = StreamChatClient('test-api-key', chatApi: FakeChatApi(), wsProvider: FakeChatServer().connect); + addTearDown(client.dispose); + + final poll = Poll( + name: 'What is your favorite color?', + options: const [ + PollOption(text: 'Red'), + PollOption(text: 'Blue'), + ], + ); + + final reported = client.on(EventType.pollCreated).first; + client.handleEvent(Event(type: EventType.messageNew, poll: poll)); + + expect((await reported).poll, poll); + }); + }); + + group('reconnecting a connection that dropped', () { + const apiKey = 'test-api-key'; + final user = User(id: 'test-user-id'); + final token = testUserToken(user.id).rawValue; + + Future<(StreamChatClient, FakeChatServer)> connectedClient() async { + final server = FakeChatServer(user: OwnUser.fromUser(user)); + final client = StreamChatClient(apiKey, chatApi: FakeChatApi(), wsProvider: server.connect); + addTearDown(client.dispose); + + await client.connectUser(user, token); + return (client, server); + } + + test('should reopen a dropped connection without being asked to', () async { + final (client, server) = await connectedClient(); + + final reconnected = client.connectionStatusStream + .skip(1) + .firstWhere( + (it) => it == ConnectionStatus.connected, + ); + + server.drop(closeCode: 1006); + await reconnected; + + expect(server.sockets, hasLength(2)); + }); + + test('should report connecting for as long as it keeps reopening', () async { + final (client, server) = await connectedClient(); + server.handshakeFails = true; + + final reported = []; + final listening = client.connectionStatusStream.listen(reported.add); + addTearDown(listening.cancel); + + server.drop(closeCode: 1006); + + // Long enough for the attempt that follows the drop and the one that follows its failure: + // the first is immediate and the delay after a single failure is at most two seconds. + await Future.delayed(const Duration(seconds: 3)); + + // Attempts of its own, without being asked. + expect(server.sockets.length, greaterThan(2)); + + // The delay it waits out between them is a state of its own, which an app reads as still + // on its way back rather than as a connection nothing is opening. + expect(reported, [ConnectionStatus.connected, ConnectionStatus.connecting]); + }); + + test('should report a first attempt that failed as disconnected', () async { + final server = FakeChatServer(user: OwnUser.fromUser(user))..handshakeFails = true; + final client = StreamChatClient(apiKey, chatApi: FakeChatApi(), wsProvider: server.connect); + addTearDown(client.dispose); + + await expectLater(client.connectUser(user, token), throwsA(isA())); + + // Closed for a reason worth retrying, and left to the caller who was told it failed. + // Reported as connecting, nothing would ever move it off that. + expect(client.connectionStatus, ConnectionStatus.disconnected); + + await Future.delayed(const Duration(seconds: 1)); + expect(server.sockets, hasLength(1)); + expect(client.connectionStatus, ConnectionStatus.disconnected); + }); + + test('should report a drop while reconnection is paused as disconnected', () async { + final (client, server) = await connectedClient(); + client.pauseReconnect(); + + final reported = client.connectionStatusStream.skip(1).first; + server + ..handshakeFails = true + ..drop(closeCode: 1006); + + // Worth retrying, with nothing retrying it until reconnection resumes. + expect(await reported, ConnectionStatus.disconnected); + expect(server.sockets, hasLength(1)); + }); + + // `connecting` covers two connections a caller cannot tell apart, and opening one is right for + // only one of them. Driven against a real socket, which is the only thing that distinguishes + // them; a status alone does not. + test('should open a connection waiting out a delay rather than wait with it', () async { + final (client, server) = await connectedClient(); + server + ..handshakeFails = true + ..drop(closeCode: 1006); + + await pumpEventQueue(); + expect(client.connectionStatus, ConnectionStatus.connecting); + + // The delay the socket is waiting out was started before the caller asked, so there is no + // reason to sit through the rest of it. + server.handshakeFails = false; + await client.openConnection(); + + expect(client.connectionStatus, ConnectionStatus.connected); + }); + + test('should wait on the attempt in flight rather than open a second connection', () async { + final server = FakeChatServer(user: OwnUser.fromUser(user)); + final client = StreamChatClient(apiKey, chatApi: FakeChatApi(), wsProvider: server.connect); + addTearDown(client.dispose); + + // Reported the same way as a connection waiting out a delay, which is what makes asking to + // open one on a foreground or a network change land here. + final connecting = client.connectUser(user, token); + expect(client.connectionStatus, ConnectionStatus.connecting); + + final joined = client.openConnection(); + + // The attempt already in flight, answered to both callers. A second socket would leave the + // first connection unreferenced, and refusing would raise on a path neither can act on. + expect((await joined).id, user.id); + expect((await connecting).id, user.id); + expect(server.sockets, hasLength(1)); + }); + + test('should answer a connectUser for the user already connected with that connection', () async { + final (client, server) = await connectedClient(); + final connected = client.state.currentUser; + + // The connection being asked for is the one already in hand, so the caller is answered with + // it rather than told they should have disconnected first. + final again = await client.connectUser(user, token); + + expect(again, connected); + expect(server.sockets, hasLength(1)); + expect(client.connectionStatus, ConnectionStatus.connected); + }); + + test('should open a connection asked for while the last one was still closing', () async { + final (client, server) = await connectedClient(); + + // Closing and opening without waiting in between, which leaves the socket still closing when + // the second call arrives. + client.closeConnection().ignore(); + await client.openConnection(); + + expect(client.connectionStatus, ConnectionStatus.connected); + expect(server.sockets, hasLength(2)); + }); + + test('should refuse a connectUser for another user while one is connected', () async { + final (client, _) = await connectedClient(); + + // Signing another user in over this one would leave the connection it has unreferenced. + await expectLater( + client.connectUser(User(id: 'someone-else'), testUserToken('someone-else').rawValue), + throwsA( + isA().having( + (it) => it.message, + 'message', + allOf(contains('someone-else'), contains(user.id), contains('disconnectUser')), + ), + ), + ); + }); + + test('should answer both callers connecting the same user at once with one connection', () async { + final api = FakeChatApi(); + final server = FakeChatServer(user: OwnUser.fromUser(user)); + final client = StreamChatClient(apiKey, chatApi: api, wsProvider: server.connect); + addTearDown(client.dispose); + + // The second lands while the first is still opening, which is where the status cannot tell a + // connection being opened from one waiting to be. + final first = client.connectUser(user, token); + final second = client.connectUser(user, token); + + expect((await first).id, user.id); + expect((await second).id, user.id); + expect(server.sockets, hasLength(1)); + + // One sign-in, not two alongside each other: what it does for the user behind the connection + // is done for the pair rather than once each. + await pumpEventQueue(); + verify(() => api.general.getAppSettings()).called(1); + }); + + test('should leave nobody signed in when connecting a user fails', () async { + final server = FakeChatServer()..handshakeFails = true; + final client = StreamChatClient(apiKey, chatApi: FakeChatApi(), wsProvider: server.connect); + addTearDown(client.dispose); + + await expectLater(client.connectUser(user, token), throwsA(isA())); + + expect(client.state.currentUser, isNull); + }); + + test('should connect another user after connecting one failed', () async { + final server = FakeChatServer()..handshakeFails = true; + final client = StreamChatClient(apiKey, chatApi: FakeChatApi(), wsProvider: server.connect); + addTearDown(client.dispose); + + await expectLater(client.connectUser(user, token), throwsA(isA())); + + // A user who never signed in would otherwise have this refused on their behalf, and be + // named in the refusal as the one who is signed in. + server.handshakeFails = false; + final other = User(id: 'someone-else'); + + expect((await client.connectUser(other, testUserToken(other.id).rawValue)).id, other.id); + }); + + test('should leave the connected user signed in when reconnecting them fails', () async { + final (client, server) = await connectedClient(); + final connected = client.state.currentUser; + + // The connection drops and is being retried, which is where asking for one again opens it + // now rather than waiting out the delay. + server + ..handshakeFails = true + ..drop(closeCode: 1006); + await pumpEventQueue(); + + await expectLater(client.connectUser(user, token), throwsA(isA())); + + // The socket is still retrying on their behalf, so dropping them here would leave it working + // for a user the client says is not signed in. + expect(client.state.currentUser, connected); + }); + + test('should stop reopening once the caller closes the connection', () async { + final (client, server) = await connectedClient(); + server + ..handshakeFails = true + ..drop(closeCode: 1006); + + client.closeConnection(); + + // Long enough to catch one: the delay after a single failure is at most two seconds. + final attempts = server.sockets.length; + await expectLater( + client.connectionStatusStream + .skip(1) + .firstWhere((it) => it == ConnectionStatus.connecting) + .timeout( + const Duration(seconds: 3), + ), + throwsA(isA()), + ); + + expect(server.sockets, hasLength(attempts)); + }); + }); + + group('`queryChannels` with `waitForConnect`', () { + const apiKey = 'test-api-key'; + final user = User(id: 'test-user-id'); + final token = testUserToken(user.id).rawValue; + + setUpAll(() => registerFallbackValue(const PaginationParams())); + + // A client that never connected has nothing to wait for, so the query says so rather than + // waiting on a connection nobody asked for. + test('should throw when no connection was ever opened', () async { + final client = StreamChatClient(apiKey, chatApi: FakeChatApi(), wsProvider: FakeChatServer().connect); + addTearDown(client.dispose); + + expect(client.connectionStatus, ConnectionStatus.disconnected); + await expectLater(client.queryChannels().first, throwsStateError); + }); + + // Whether the channels can be watched is read when the request is sent, not when the query is + // made, so one that waited for a connection still watches what it loads. + test('should watch the channels it loads when the connection lands mid-query', () async { + final api = FakeChatApi(); + final ws = FakeChatServer(user: OwnUser.fromUser(user)); + final client = StreamChatClient(apiKey, chatApi: api, wsProvider: ws.connect); + addTearDown(client.dispose); + + when( + () => api.channel.queryChannels( + filter: any(named: 'filter'), + sort: any(named: 'sort'), + state: any(named: 'state'), + watch: any(named: 'watch'), + presence: any(named: 'presence'), + memberLimit: any(named: 'memberLimit'), + messageLimit: any(named: 'messageLimit'), + paginationParams: any(named: 'paginationParams'), + ), + ).thenAnswer((_) async => QueryChannelsResponse()..channels = []); + + // Not awaited: the query below has to arrive while the attempt is still in flight. + final connecting = client.connectUser(user, token); + final queried = client.queryChannels().first; + + await connecting; + await queried; + + final watched = verify( + () => api.channel.queryChannels( + filter: any(named: 'filter'), + sort: any(named: 'sort'), + state: any(named: 'state'), + watch: captureAny(named: 'watch'), + presence: any(named: 'presence'), + memberLimit: any(named: 'memberLimit'), + messageLimit: any(named: 'messageLimit'), + paginationParams: any(named: 'paginationParams'), + ), + ).captured; + + expect(watched.single, isTrue); + }); + + // The wait ends when the attempt settles either way: one that fails has to raise rather than + // leave the caller waiting on a connection nothing is opening any more. + test('should throw rather than hang when the connection being opened fails', () async { + final ws = FakeChatServer()..handshakeFails = true; + final client = StreamChatClient(apiKey, chatApi: FakeChatApi(), wsProvider: ws.connect); + addTearDown(client.dispose); + + // Not awaited: the query below has to arrive while the attempt is still in flight. + final connecting = client.connectUser(user, token); + + await expectLater(client.queryChannels().first, throwsStateError); + await expectLater(connecting, throwsA(isA())); + }); + }); } diff --git a/packages/stream_chat/test/src/core/http/connection_id_manager_test.dart b/packages/stream_chat/test/src/core/http/connection_id_manager_test.dart deleted file mode 100644 index ad70283fbb..0000000000 --- a/packages/stream_chat/test/src/core/http/connection_id_manager_test.dart +++ /dev/null @@ -1,38 +0,0 @@ -import 'package:stream_chat/src/core/http/connection_id_manager.dart'; -import 'package:test/test.dart'; - -void main() { - late ConnectionIdManager connectionIdManager; - - setUp(() { - connectionIdManager = ConnectionIdManager(); - }); - - tearDown(() { - connectionIdManager.reset(); - }); - - test('`setConnectionId` should set connectionId', () { - expect(connectionIdManager.connectionId, isNull); - expect(connectionIdManager.hasConnectionId, isFalse); - - const connectionId = 'test-connection-id'; - connectionIdManager.setConnectionId(connectionId); - - expect(connectionIdManager.connectionId, connectionId); - expect(connectionIdManager.hasConnectionId, isTrue); - }); - - test('`reset` should clear the connectionId', () { - const connectionId = 'test-connection-id'; - connectionIdManager.setConnectionId(connectionId); - - expect(connectionIdManager.connectionId, connectionId); - expect(connectionIdManager.hasConnectionId, isTrue); - - connectionIdManager.reset(); - - expect(connectionIdManager.connectionId, isNull); - expect(connectionIdManager.hasConnectionId, isFalse); - }); -} diff --git a/packages/stream_chat/test/src/core/http/interceptor/connection_id_interceptor_test.dart b/packages/stream_chat/test/src/core/http/interceptor/connection_id_interceptor_test.dart index 8924646f84..fdde5c47de 100644 --- a/packages/stream_chat/test/src/core/http/interceptor/connection_id_interceptor_test.dart +++ b/packages/stream_chat/test/src/core/http/interceptor/connection_id_interceptor_test.dart @@ -1,22 +1,15 @@ // ignore_for_file: invalid_use_of_protected_member import 'package:dio/dio.dart'; -import 'package:mocktail/mocktail.dart'; -import 'package:stream_chat/src/core/http/connection_id_manager.dart'; import 'package:stream_core/stream_core.dart' show ConnectionIdInterceptor; import 'package:test/test.dart'; -import '../../../mocks.dart'; - void main() { - late ConnectionIdManager connectionIdManager; - late ConnectionIdInterceptor connectionIdInterceptor; + // Wired the way `StreamHttpClient` wires it: a closure reading the id off the connection. + String? connectionId; + final connectionIdInterceptor = ConnectionIdInterceptor(() => connectionId); - setUp(() { - connectionIdManager = MockConnectionIdManager(); - // Wired the way `StreamHttpClient` wires it: a closure over our manager. - connectionIdInterceptor = ConnectionIdInterceptor(() => connectionIdManager.connectionId); - }); + tearDown(() => connectionId = null); test( '`onRequest` should add connectionId in the request', @@ -27,8 +20,7 @@ void main() { final queryParams = options.queryParameters; expect(queryParams.containsKey('connection_id'), isFalse); - const connectionId = 'test-connection-id'; - when(() => connectionIdManager.connectionId).thenReturn(connectionId); + connectionId = 'test-connection-id'; connectionIdInterceptor.onRequest(options, handler); @@ -37,9 +29,6 @@ void main() { expect(updatedQueryParams.containsKey('connection_id'), isTrue); expect(updatedQueryParams['connection_id'], connectionId); - - verify(() => connectionIdManager.connectionId).called(1); - verifyNoMoreInteractions(connectionIdManager); }, ); @@ -52,7 +41,7 @@ void main() { final queryParams = options.queryParameters; expect(queryParams.containsKey('connection_id'), isFalse); - when(() => connectionIdManager.connectionId).thenReturn(null); + connectionId = null; connectionIdInterceptor.onRequest(options, handler); @@ -60,9 +49,6 @@ void main() { final updatedQueryParams = updatedOptions.queryParameters; expect(updatedQueryParams.containsKey('connection_id'), isFalse); - - verify(() => connectionIdManager.connectionId).called(1); - verifyNoMoreInteractions(connectionIdManager); }, ); } diff --git a/packages/stream_chat/test/src/core/http/stream_http_client_test.dart b/packages/stream_chat/test/src/core/http/stream_http_client_test.dart index fe7b6078ba..068f3f824b 100644 --- a/packages/stream_chat/test/src/core/http/stream_http_client_test.dart +++ b/packages/stream_chat/test/src/core/http/stream_http_client_test.dart @@ -1,7 +1,6 @@ import 'package:dio/dio.dart'; import 'package:mocktail/mocktail.dart'; import 'package:stream_chat/src/core/api/responses.dart'; -import 'package:stream_chat/src/core/http/connection_id_manager.dart'; import 'package:stream_chat/src/core/http/interceptor/additional_headers_interceptor.dart'; import 'package:stream_chat/src/core/http/stream_http_client.dart'; import 'package:stream_core/stream_core.dart' @@ -76,7 +75,7 @@ void main() { final client = StreamHttpClient( 'api-key', tokenManager: TokenManager.unconfigured(), - connectionIdManager: ConnectionIdManager(), + connectionId: () => null, systemEnvironmentManager: SystemEnvironmentManager( environment: const SystemEnvironment( sdkName: 'stream-chat', @@ -112,7 +111,7 @@ void main() { const apiKey = 'api-key'; final client = StreamHttpClient( apiKey, - connectionIdManager: ConnectionIdManager(), + connectionId: () => null, ); expect( diff --git a/packages/stream_chat/test/src/core/util/event_controller_test.dart b/packages/stream_chat/test/src/core/util/event_controller_test.dart index fdf330a4d0..f1835668c9 100644 --- a/packages/stream_chat/test/src/core/util/event_controller_test.dart +++ b/packages/stream_chat/test/src/core/util/event_controller_test.dart @@ -1,9 +1,9 @@ // ignore_for_file: cascade_invocations, avoid_redundant_argument_values import 'dart:async'; -import 'package:stream_chat/src/core/models/event.dart'; import 'package:stream_chat/src/core/util/event_controller.dart'; import 'package:stream_chat/src/event_type.dart'; +import 'package:stream_chat/src/ws/events/event.dart'; import 'package:test/test.dart'; void main() { diff --git a/packages/stream_chat/test/src/db/chat_persistence_client_test.dart b/packages/stream_chat/test/src/db/chat_persistence_client_test.dart index 4bee46f54f..5e35ffe050 100644 --- a/packages/stream_chat/test/src/db/chat_persistence_client_test.dart +++ b/packages/stream_chat/test/src/db/chat_persistence_client_test.dart @@ -3,7 +3,6 @@ import 'package:stream_chat/src/core/models/channel_model.dart'; import 'package:stream_chat/src/core/models/channel_state.dart'; import 'package:stream_chat/src/core/models/draft.dart'; import 'package:stream_chat/src/core/models/draft_message.dart'; -import 'package:stream_chat/src/core/models/event.dart'; import 'package:stream_chat/src/core/models/location.dart'; import 'package:stream_chat/src/core/models/member.dart'; import 'package:stream_chat/src/core/models/message.dart'; @@ -13,6 +12,7 @@ import 'package:stream_chat/src/core/models/reaction.dart'; import 'package:stream_chat/src/core/models/read.dart'; import 'package:stream_chat/src/core/models/user.dart'; import 'package:stream_chat/src/db/chat_persistence_client.dart'; +import 'package:stream_chat/src/ws/events/event.dart'; import 'package:test/test.dart'; class TestPersistenceClient extends ChatPersistenceClient { diff --git a/packages/stream_chat/test/src/fakes.dart b/packages/stream_chat/test/src/fakes.dart index 50d0cef6cf..a830fcf313 100644 --- a/packages/stream_chat/test/src/fakes.dart +++ b/packages/stream_chat/test/src/fakes.dart @@ -1,7 +1,6 @@ import 'dart:async'; import 'package:mocktail/mocktail.dart'; -import 'package:rxdart/rxdart.dart'; import 'package:stream_chat/src/core/api/channel_api.dart'; import 'package:stream_chat/src/core/api/device_api.dart'; import 'package:stream_chat/src/core/api/general_api.dart'; @@ -12,7 +11,6 @@ import 'package:stream_chat/src/core/api/polls_api.dart'; import 'package:stream_chat/src/core/api/roles_api.dart'; import 'package:stream_chat/src/core/api/user_api.dart'; import 'package:stream_chat/src/core/api/user_groups_api.dart'; -import 'package:stream_chat/src/ws/websocket.dart'; import 'package:stream_chat/stream_chat.dart'; import 'mocks.dart'; @@ -62,6 +60,9 @@ class FakePersistenceClient extends Fake implements ChatPersistenceClient { int disconnectCallCount = 0; int flushCallCount = 0; + /// The health check last persisted, and `null` until one is. + Event? connectionInfo; + @override bool get isConnected => _isConnected; @@ -117,6 +118,11 @@ class FakePersistenceClient extends Fake implements ChatPersistenceClient { @override Future updateChannelStates(List channelStates) async {} + + @override + Future updateConnectionInfo(Event event) async { + connectionInfo = event; + } } class FakeChatApi extends Fake implements StreamChatApi { @@ -236,93 +242,6 @@ class FakeUser extends Fake implements User {} class FakePollVote extends Fake implements PollVote {} -class FakeWebSocket extends Fake implements WebSocket { - late final _connectionStatusController = BehaviorSubject.seeded( - ConnectionStatus.disconnected, - ); - - set connectionStatus(ConnectionStatus value) { - _connectionStatusController.add(value); - } - - @override - ConnectionStatus get connectionStatus => _connectionStatusController.value; - - @override - Stream get connectionStatusStream => _connectionStatusController.stream; - - @override - Completer? connectionCompleter; - - @override - Future connect( - User user, { - bool? includeUserDetails = true, - }) async { - connectionStatus = ConnectionStatus.connecting; - final event = Event( - type: EventType.healthCheck, - connectionId: 'fake-connection-id', - me: OwnUser.fromUser(user), - ); - connectionCompleter = Completer()..complete(event); - connectionStatus = ConnectionStatus.connected; - return connectionCompleter!.future; - } - - @override - void disconnect() { - connectionStatus = ConnectionStatus.disconnected; - connectionCompleter = null; - } - - @override - Future dispose() async { - await _connectionStatusController.close(); - } -} - -class FakeWebSocketWithConnectionError extends Fake implements WebSocket { - late final _connectionStatusController = BehaviorSubject.seeded( - ConnectionStatus.disconnected, - ); - - set connectionStatus(ConnectionStatus value) { - _connectionStatusController.add(value); - } - - @override - ConnectionStatus get connectionStatus => _connectionStatusController.value; - - @override - Stream get connectionStatusStream => _connectionStatusController.stream; - - @override - Completer? connectionCompleter; - - @override - Future connect( - User user, { - bool? includeUserDetails = true, - }) async { - connectionStatus = ConnectionStatus.connecting; - const error = StreamNetworkException(message: 'Error Connecting'); - connectionCompleter = Completer()..completeError(error); - return connectionCompleter!.future; - } - - @override - void disconnect() { - connectionStatus = ConnectionStatus.disconnected; - connectionCompleter = null; - } - - @override - Future dispose() async { - await _connectionStatusController.close(); - } -} - class FakeChannelState extends Fake implements ChannelState {} class FakePartialUpdateMemberResponse extends Fake implements PartialUpdateMemberResponse { diff --git a/packages/stream_chat/test/src/matchers.dart b/packages/stream_chat/test/src/matchers.dart index c7dc60b210..48b9fcf3ff 100644 --- a/packages/stream_chat/test/src/matchers.dart +++ b/packages/stream_chat/test/src/matchers.dart @@ -4,9 +4,9 @@ import 'package:stream_chat/src/client/channel/channel.dart'; import 'package:stream_chat/src/core/models/attachment.dart'; import 'package:stream_chat/src/core/models/channel_state.dart'; import 'package:stream_chat/src/core/models/draft_message.dart'; -import 'package:stream_chat/src/core/models/event.dart'; import 'package:stream_chat/src/core/models/message.dart'; import 'package:stream_chat/src/core/models/user.dart'; +import 'package:stream_chat/src/ws/events/event.dart'; import 'package:stream_core/stream_core.dart' show Filter; import 'package:test/test.dart'; diff --git a/packages/stream_chat/test/src/mocks.dart b/packages/stream_chat/test/src/mocks.dart index 932d330ead..67983ff020 100644 --- a/packages/stream_chat/test/src/mocks.dart +++ b/packages/stream_chat/test/src/mocks.dart @@ -14,15 +14,13 @@ import 'package:stream_chat/src/core/api/polls_api.dart'; import 'package:stream_chat/src/core/api/roles_api.dart'; import 'package:stream_chat/src/core/api/user_api.dart'; import 'package:stream_chat/src/core/api/user_groups_api.dart'; -import 'package:stream_chat/src/core/http/connection_id_manager.dart'; import 'package:stream_chat/src/core/http/stream_http_client.dart'; import 'package:stream_chat/src/core/models/channel_config.dart'; -import 'package:stream_chat/src/core/models/event.dart'; import 'package:stream_chat/src/core/util/event_controller.dart'; import 'package:stream_chat/src/db/chat_persistence_client.dart'; import 'package:stream_chat/src/event_type.dart'; -import 'package:stream_chat/src/ws/websocket.dart'; -import 'package:stream_core/stream_core.dart' show StreamLogger, TokenManager; +import 'package:stream_chat/src/ws/events/event.dart'; +import 'package:stream_core/stream_core.dart' show StreamLogger, StreamWebSocketClient, TokenManager; import 'package:web_socket_channel/web_socket_channel.dart'; class MockWebSocketChannel extends Mock implements WebSocketChannel {} @@ -45,8 +43,6 @@ class MockHttpClient extends Mock implements StreamHttpClient {} class MockTokenManager extends Mock implements TokenManager {} -class MockConnectionIdManager extends Mock implements ConnectionIdManager {} - class MockUserApi extends Mock implements UserApi {} class MockGuestApi extends Mock implements GuestApi {} @@ -190,6 +186,9 @@ class MockRetryQueueChannel extends Mock implements Channel { } } -class MockWebSocket extends Mock implements WebSocket {} +class MockWebSocket extends Mock implements StreamWebSocketClient { + @override + Future dispose() async {} +} class MockChannelDeliveryReporter extends Mock implements ChannelDeliveryReporter {} diff --git a/packages/stream_chat/test/src/ws/connect_request_test.dart b/packages/stream_chat/test/src/ws/connect_request_test.dart new file mode 100644 index 0000000000..68b4877f5b --- /dev/null +++ b/packages/stream_chat/test/src/ws/connect_request_test.dart @@ -0,0 +1,117 @@ +import 'dart:convert'; + +import 'package:stream_chat/src/ws/connect_request.dart'; +import 'package:stream_chat/stream_chat.dart'; +import 'package:stream_core/stream_core.dart' show SystemEnvironmentManager, WebSocketOptions; +import 'package:test/test.dart'; + +import '../utils.dart'; + +void main() { + test('ConnectRequest opens against the host the API is served from', () { + expect(ConnectRequest.endpointFor('https://chat.stream-io-api.com'), 'wss://chat.stream-io-api.com/connect'); + }); + + test('ConnectRequest stays unencrypted for an unencrypted API', () { + expect(ConnectRequest.endpointFor('http://localhost:3030'), 'ws://localhost:3030/connect'); + }); + + test('ConnectRequest keeps an address that already names the socket scheme', () { + expect(ConnectRequest.endpointFor('wss://chat.stream-io-api.com'), 'wss://chat.stream-io-api.com/connect'); + expect(ConnectRequest.endpointFor('ws://localhost:3030'), 'ws://localhost:3030/connect'); + }); + + test('ConnectRequest refuses an address that names no scheme', () { + expect(() => ConnectRequest.endpointFor('chat.stream-io-api.com'), throwsFormatException); + expect(() => ConnectRequest.endpointFor('ftp://chat.stream-io-api.com'), throwsFormatException); + }); + + test('ConnectRequest presents the credentials the API reads a connection off', () { + final options = _request().build(user: _user(), token: _token()); + + // `GetAuthTokenFromRequest` takes the header first and this second; a socket handshake has no + // way to set one on the web, so the query string is what a connection is authorized by. + expect(options.queryParameters, containsPair('authorization', _token().rawValue)); + expect(options.queryParameters, containsPair('stream-auth-type', 'jwt')); + expect(options.queryParameters, containsPair('api_key', 'test-api-key')); + }); + + test('ConnectRequest names the user without repeating the credential', () { + final options = _request().build(user: _user(), token: _token()); + + // Not `user_token`: the API never reads one out of the payload, and it would put the + // credential in the URL twice. + expect(_payload(options), { + 'user_id': 'test-user-id', + 'user_details': {'id': 'test-user-id'}, + 'server_determines_connection_id': true, + }); + }); + + test('ConnectRequest sends the user details only when asked to', () { + final options = _request().build(user: _user(), token: _token(), includeUserDetails: true); + + expect( + _payload(options)['user_details'], + isA>().having((it) => it['name'], 'name', 'Test User'), + ); + }); + + test('ConnectRequest describes the app as it describes itself now', () { + final environment = _environment(); + final request = ConnectRequest.forApi( + 'https://chat.stream-io-api.com', + apiKey: 'test-api-key', + environment: environment, + ); + + final before = request.build(user: _user(), token: _token()).queryParameters!; + expect(before, containsPair('X-Stream-Client', jsonEncode(environment.userAgent))); + + // An app can describe itself differently part-way through a session, and the connection it + // opens after that should say so. + environment.updateEnvironment( + const SystemEnvironment( + sdkName: 'stream-chat', + sdkIdentifier: 'dart', + sdkVersion: '0.0.0', + appName: 'renamed', + appVersion: '2.0.0', + ), + ); + + final after = request.build(user: _user(), token: _token()).queryParameters!; + expect(after, containsPair('X-Stream-Client', jsonEncode(environment.userAgent))); + expect(after['X-Stream-Client'], isNot(before['X-Stream-Client'])); + }); + + test('ConnectRequest identifies the SDK to the API', () { + final environment = _environment(); + final options = ConnectRequest.forApi( + 'https://x.com', + apiKey: 'k', + environment: environment, + ).build(user: _user(), token: _token()); + + expect(options.queryParameters, containsPair('X-Stream-Client', jsonEncode(environment.userAgent))); + }); +} + +OwnUser _user() => OwnUser(id: 'test-user-id', name: 'Test User'); + +UserToken _token() => testUserToken('test-user-id'); + +ConnectRequest _request() => ConnectRequest.forApi( + 'https://chat.stream-io-api.com', + apiKey: 'test-api-key', + environment: _environment(), +); + +SystemEnvironmentManager _environment() => SystemEnvironmentManager( + environment: const SystemEnvironment(sdkName: 'stream-chat', sdkIdentifier: 'dart', sdkVersion: '0.0.0'), +); + +Map _payload(WebSocketOptions options) { + final json = options.queryParameters!['json']! as String; + return jsonDecode(json) as Map; +} diff --git a/packages/stream_chat/test/src/ws/connection_manager_test.dart b/packages/stream_chat/test/src/ws/connection_manager_test.dart new file mode 100644 index 0000000000..acf3f659ba --- /dev/null +++ b/packages/stream_chat/test/src/ws/connection_manager_test.dart @@ -0,0 +1,158 @@ +import 'package:stream_chat/src/ws/connect_request.dart'; +import 'package:stream_chat/src/ws/connection_manager.dart'; +import 'package:stream_chat/stream_chat.dart'; +import 'package:stream_core/stream_core.dart' show Disconnected, Initialized, SystemEnvironmentManager; +import 'package:test/test.dart'; + +import '../utils.dart'; +import 'fake_chat_server.dart'; + +void main() { + final records = []; + setUp(() { + records.clear(); + StreamLogger.handler = _CapturingHandler(records.add); + StreamLogger.priority = StreamLogPriority.verbose; + addTearDown(StreamLogger.reset); + }); + + test('ConnectionManager names no connection until one is established', () async { + final manager = _manager(); + addTearDown(manager.dispose); + + expect(manager.connectionId, isNull); + expect(manager.connectionState.value, isA()); + }); + + test('ConnectionManager reports a connection the socket could not open', () async { + final manager = _manager(); + addTearDown(manager.dispose); + + await expectLater( + manager.connect(_user()), + throwsA(isA()), + ); + + expect(manager.connectionState.value, isA()); + }); + + test('ConnectionManager presents another token after the server refuses an expired one', () async { + var loads = 0; + final server = FakeChatServer()..refusal = connectionErrorFrame(); + final manager = _manager( + server: server, + tokenProvider: TokenProvider.dynamic((userId) async { + loads++; + return testUserToken(userId); + }), + ); + addTearDown(manager.dispose); + + await expectLater(manager.connect(_user()), throwsA(isA())); + expect(loads, 1); + + // The refused token is dropped, so the attempt after it asks the provider for another rather + // than presenting the one the server just turned down. + server.refusal = null; + await manager.connect(_user()); + + expect(loads, 2); + }); + + test('ConnectionManager stays closed when the provider has no other token to give', () async { + final server = FakeChatServer()..refusal = connectionErrorFrame(); + final manager = _manager(server: server); + addTearDown(manager.dispose); + + await expectLater(manager.connect(_user()), throwsA(isA())); + + // A static provider answers with the token that was refused, so another attempt could only be + // turned down again. The session ends rather than asking forever. + server.refusal = null; + await expectLater(manager.connect(_user()), throwsA(isA())); + }); + + test('ConnectionManager waits on the connection being opened for the same user', () async { + final manager = _manager(); + addTearDown(manager.dispose); + + final user = _user(); + final first = manager.connect(user); + + // The attempt in flight is the connection this caller asked for, so they are answered with it + // rather than refused. + final second = manager.connect(user); + + await expectLater(first, throwsA(isA())); + await expectLater(second, throwsA(isA())); + + // One attempt, not two run alongside each other: the second caller waits on the work the first + // one set off rather than repeating it, so the failure is reported once. + expect(records.where((it) => it.message.contains('failed')), hasLength(1)); + }); + + test('ConnectionManager answers a connect for the user it already has a connection for', () async { + final manager = _manager(server: FakeChatServer(user: _user())); + addTearDown(manager.dispose); + + final user = _user(); + final established = await manager.connect(user); + + // The connection being asked for is the one already open, so the caller is answered with the + // frame that opened it rather than told they should have disconnected first. + expect(await manager.connect(user), established); + }); + + test('ConnectionManager refuses a connect for another user while one is connected', () async { + final manager = _manager(server: FakeChatServer(user: _user())); + addTearDown(manager.dispose); + + await manager.connect(_user()); + + // Opening one here would leave the connection in hand unreferenced. + expect(() => manager.connect(OwnUser(id: 'someone-else')), throwsStateError); + }); + + test('ConnectionManager refuses a second connection while one is being opened for another user', () async { + final manager = _manager(); + addTearDown(manager.dispose); + + final first = manager.connect(_user()); + + // Opening one here would leave the attempt in flight unreferenced, and hand this caller a + // connection signed in as somebody else. + expect(() => manager.connect(OwnUser(id: 'someone-else')), throwsStateError); + await expectLater(first, throwsA(isA())); + }); +} + +OwnUser _user() => OwnUser(id: 'test-user-id'); + +ConnectionManager _manager({FakeChatServer? server, TokenProvider? tokenProvider}) { + return ConnectionManager( + request: ConnectRequest.forApi( + 'https://chat.stream-io-api.com', + apiKey: 'test-api-key', + environment: SystemEnvironmentManager( + environment: const SystemEnvironment(sdkName: 'stream-chat', sdkIdentifier: 'dart', sdkVersion: '0.0.0'), + ), + ), + tokenManager: TokenManager( + userId: 'test-user-id', + tokenProvider: tokenProvider ?? TokenProvider.static(testUserToken('test-user-id')), + ), + wsProvider: + server?.connect ?? + // Never opens: a test about what the connection reports does not need one to succeed. + (_) => throw const StreamNetworkException(message: 'no socket in this test'), + ); +} + +class _CapturingHandler extends StreamLogHandler { + const _CapturingHandler(this._onRecord); + + final void Function(StreamLogRecord) _onRecord; + + @override + void handle(StreamLogRecord record) => _onRecord(record); +} diff --git a/packages/stream_chat/test/src/ws/connection_status_test.dart b/packages/stream_chat/test/src/ws/connection_status_test.dart new file mode 100644 index 0000000000..b42880747e --- /dev/null +++ b/packages/stream_chat/test/src/ws/connection_status_test.dart @@ -0,0 +1,60 @@ +import 'package:stream_chat/stream_chat.dart'; +import 'package:stream_core/stream_core.dart' + show + Authenticating, + Connected, + Connecting, + Disconnected, + Disconnecting, + Initialized, + ServerInitiated, + UserInitiated; +import 'package:test/test.dart'; + +void main() { + test('ConnectionStatus reports an open connection as connected', () { + const state = Connected(healthCheck: HealthCheckInfo(connectionId: 'test-connection-id')); + + expect(ConnectionStatus.fromState(state, isRecovering: false), ConnectionStatus.connected); + }); + + test('ConnectionStatus reports every step of an attempt as connecting', () { + expect(ConnectionStatus.fromState(const Connecting(), isRecovering: false), ConnectionStatus.connecting); + expect(ConnectionStatus.fromState(const Authenticating(), isRecovering: false), ConnectionStatus.connecting); + }); + + test('ConnectionStatus reports a connection nothing will reopen as disconnected', () { + // Including one that was never opened: neither carries events. + expect(ConnectionStatus.fromState(const Initialized(), isRecovering: false), ConnectionStatus.disconnected); + expect( + ConnectionStatus.fromState(const Disconnecting(source: UserInitiated()), isRecovering: false), + ConnectionStatus.disconnected, + ); + expect( + ConnectionStatus.fromState(const Disconnected(source: UserInitiated()), isRecovering: false), + ConnectionStatus.disconnected, + ); + }); + + test('ConnectionStatus reports a connection waiting to be reopened as connecting', () { + // The socket sits here for the whole delay it retries with, which is most of an outage. + expect( + ConnectionStatus.fromState(const Disconnected(source: ServerInitiated()), isRecovering: true), + ConnectionStatus.connecting, + ); + expect( + ConnectionStatus.fromState(const Disconnecting(source: ServerInitiated()), isRecovering: true), + ConnectionStatus.connecting, + ); + }); + + test('ConnectionStatus reports a connection closed for a reason worth retrying as disconnected ' + 'when nothing is retrying it', () { + // A first attempt that failed, or one dropped while reconnection is paused. Reading the + // source alone would report it as connecting, with nothing to move it off that. + expect( + ConnectionStatus.fromState(const Disconnected(source: ServerInitiated()), isRecovering: false), + ConnectionStatus.disconnected, + ); + }); +} diff --git a/packages/stream_chat/test/src/client/event_resolvers_test.dart b/packages/stream_chat/test/src/ws/events/event_resolvers_test.dart similarity index 99% rename from packages/stream_chat/test/src/client/event_resolvers_test.dart rename to packages/stream_chat/test/src/ws/events/event_resolvers_test.dart index 0aed5d35a7..15539541f8 100644 --- a/packages/stream_chat/test/src/client/event_resolvers_test.dart +++ b/packages/stream_chat/test/src/ws/events/event_resolvers_test.dart @@ -1,7 +1,5 @@ // ignore_for_file: avoid_redundant_argument_values, lines_longer_than_80_chars -import 'package:stream_chat/src/client/event_resolvers.dart'; -import 'package:stream_chat/src/core/models/event.dart'; import 'package:stream_chat/src/core/models/location.dart'; import 'package:stream_chat/src/core/models/message.dart'; import 'package:stream_chat/src/core/models/poll.dart'; @@ -9,6 +7,8 @@ import 'package:stream_chat/src/core/models/poll_option.dart'; import 'package:stream_chat/src/core/models/poll_vote.dart'; import 'package:stream_chat/src/core/models/user.dart'; import 'package:stream_chat/src/event_type.dart'; +import 'package:stream_chat/src/ws/events/event.dart'; +import 'package:stream_chat/src/ws/events/event_resolvers.dart'; import 'package:test/test.dart'; void main() { diff --git a/packages/stream_chat/test/src/ws/fake_chat_server.dart b/packages/stream_chat/test/src/ws/fake_chat_server.dart new file mode 100644 index 0000000000..0c5319572b --- /dev/null +++ b/packages/stream_chat/test/src/ws/fake_chat_server.dart @@ -0,0 +1,165 @@ +// ignore_for_file: close_sinks + +import 'dart:async'; +import 'dart:convert'; + +import 'package:mocktail/mocktail.dart'; +import 'package:stream_chat/stream_chat.dart'; +import 'package:stream_core/stream_core.dart' show WebSocketOptions; +import 'package:web_socket_channel/web_socket_channel.dart'; + +/// A chat server a test drives, in place of one on the other end of a socket. +/// +/// Only the socket is stood in for: the client under test builds a real connect request, encodes +/// and decodes real frames, and reaches `connected` because this server greeted it — not because a +/// fake reported that it had. +/// +/// The default behaviour is a healthy server: it greets every connection with a health check +/// signing in [user], and answers every ping. +class FakeChatServer { + /// Creates a [FakeChatServer] that signs in [user]. + FakeChatServer({this.user}); + + /// The user the hello frame signs in, and `null` for a server that names nobody. + OwnUser? user; + + /// The refusal sent instead of a greeting, and `null` for a server that accepts the connection. + /// + /// Set to a [connectionErrorFrame] for a server that will not serve the credentials it was given. + Map? refusal; + + /// Whether the socket refuses to open at all. + /// + /// Set `true` for a server that cannot be reached, which is how a connection that fails on the + /// transport rather than on its credentials is modelled. + bool handshakeFails = false; + + /// Every socket this server has handed out, in the order they were opened. + final sockets = []; + + /// The socket of the connection in flight, which is the one frames are sent over. + FakeWebSocketChannel get socket => sockets.last; + + /// Hands out a socket wired to this server, for a client's `wsProvider`. + FakeWebSocketChannel connect(WebSocketOptions options) { + final socket = FakeWebSocketChannel( + onSent: _onSent, + readyError: handshakeFails ? const StreamNetworkException(message: 'Error Connecting') : null, + ); + sockets.add(socket); + + // A server either greets a connection it accepts, which is what establishes it, or refuses it. + if (!handshakeFails) { + scheduleMicrotask(() => socket.receive(refusal ?? healthCheckFrame(me: user))); + } + + return socket; + } + + /// Sends [frame] to the client over the connection in flight. + void send(Map frame) => socket.receive(frame); + + /// Drops the connection in flight, as a server hanging up does. + void drop({int closeCode = 1000, String? closeReason}) { + return socket.closeFromServer(closeCode, closeReason); + } + + // Answers a ping with a pong, which is what keeps a connection alive. + void _onSent(Object? frame) { + final json = jsonDecode(frame! as String) as Map; + if (json['type'] == EventType.healthCheck) send(healthCheckFrame()); + } +} + +/// The frame that establishes a connection, and the pong that keeps it alive. +/// +/// [me] rides the first one only, which is how a connection learns who the server signed in. +Map healthCheckFrame({OwnUser? me}) { + return { + 'type': EventType.healthCheck, + 'connection_id': 'fake-connection-id', + 'created_at': DateTime.now().toIso8601String(), + if (me != null) 'me': me.toJson(), + }; +} + +/// The refusal a server sends before closing a connection it will not serve. +Map connectionErrorFrame({int code = 40, int statusCode = 401}) { + return { + 'type': EventType.connectionError, + 'error': { + 'code': code, + 'message': 'error $code', + 'StatusCode': statusCode, + 'details': [], + 'duration': '0ms', + 'more_info': '', + }, + }; +} + +/// A socket a test drives, recording what the client sent over it. +class FakeWebSocketChannel extends Fake implements WebSocketChannel { + /// Creates a [FakeWebSocketChannel], calling [onSent] with each frame the client sends. + FakeWebSocketChannel({void Function(Object? frame)? onSent, this._readyError}) { + sink = _FakeWebSocketSink(_incoming, onSent); + } + + final Object? _readyError; + + // Closed by `sink.close` or `closeFromServer`, which is how each peer ends a socket. + final _incoming = StreamController(); + + @override + late final WebSocketSink sink; + + @override + Stream get stream => _incoming.stream; + + @override + Future get ready { + if (_readyError case final error?) return Future.error(error); + return Future.value(); + } + + @override + int? get closeCode => _closeCode; + int? _closeCode; + + @override + String? get closeReason => _closeReason; + String? _closeReason; + + /// Delivers [frame] to the client, as a server sending one does. + void receive(Map frame) { + if (_incoming.isClosed) return; + _incoming.add(jsonEncode(frame)); + } + + /// Ends the connection from the server's side. + void closeFromServer(int closeCode, [String? closeReason]) { + if (_incoming.isClosed) return; + + _closeCode = closeCode; + _closeReason = closeReason; + _incoming.close().ignore(); + } +} + +class _FakeWebSocketSink extends Fake implements WebSocketSink { + _FakeWebSocketSink(this._incoming, this._onSent); + + final StreamController _incoming; + final void Function(Object? frame)? _onSent; + + @override + void add(Object? data) => _onSent?.call(data); + + @override + Future close([int? closeCode, String? closeReason]) async { + if (!_incoming.isClosed) await _incoming.close(); + } + + @override + Future get done => _incoming.done; +} diff --git a/packages/stream_chat/test/src/ws/stream_chat_ws_event_test.dart b/packages/stream_chat/test/src/ws/stream_chat_ws_event_test.dart new file mode 100644 index 0000000000..1fc282f67a --- /dev/null +++ b/packages/stream_chat/test/src/ws/stream_chat_ws_event_test.dart @@ -0,0 +1,163 @@ +import 'dart:convert'; + +import 'package:stream_chat/src/ws/events/events.dart'; +import 'package:stream_chat/src/ws/stream_chat_ws_event.dart'; +import 'package:stream_chat/stream_chat.dart'; +import 'package:stream_core/stream_core.dart' show HealthCheckInfo, HealthCheckPingEvent; +import 'package:test/test.dart'; + +void main() { + const codec = StreamChatWsCodec(); + + // Freezed generates equality over the fields each event declares, so it covers what identifies + // the frame and not the 40 inherited ones a connection frame never carries. + test('HealthCheckEvent compares by the connection it names', () { + final event = HealthCheckEvent(connectionId: 'test-connection-id'); + + expect(event, HealthCheckEvent(connectionId: 'test-connection-id')); + expect(event, isNot(HealthCheckEvent(connectionId: 'another-connection-id'))); + }); + + test('ConnectionErrorEvent compares by the error it carries', () { + final error = StreamApiError.fromJson(_tokenExpiredError); + final event = ConnectionErrorEvent(error: error); + + expect(event, ConnectionErrorEvent(error: error)); + expect(event, isNot(ConnectionErrorEvent(error: StreamApiError.fromJson({..._tokenExpiredError, 'code': 41})))); + }); + + test('StreamChatWsCodec decodes a health check as the event that establishes a connection', () { + final event = codec.decode(_frame({'type': EventType.healthCheck, 'connection_id': 'test-connection-id'})); + + expect(event, isA()); + expect(event.error, isNull); + expect(event.healthCheckInfo, const HealthCheckInfo(connectionId: 'test-connection-id')); + // `HealthCheckEvent` narrows `connectionId` to non-null with a field of its own, so the one it + // shadows on `Event` has to hold the same id — everything reading an `Event` sees that one. + expect((event as Event).connectionId, 'test-connection-id'); + }); + + test('StreamChatWsCodec refuses a health check that names no connection', () { + // Every request made over the connection names its id, so a frame without one cannot establish + // it. The server always sends it; failing to decode is how a frame that did not say so is told + // apart from one naming a connection the client then cannot use. + expect( + () => codec.decode(_frame({'type': EventType.healthCheck, 'connection_id': null})), + throwsA(isA()), + ); + }); + + test('StreamChatWsCodec reads the user the server signed in off a health check', () { + // The connection learns who it belongs to here and nowhere else. + final event = codec.decode(_frame({'me': _user})); + + expect( + event, + isA().having( + (it) => it.me, + 'me', + isA().having((it) => it.id, 'id', 'test-user-id'), + ), + ); + }); + + test('StreamChatWsCodec decodes a health check that names no user', () { + // Every health check after the first carries none. + final event = codec.decode(_frame({})); + + expect(event, isA().having((it) => it.me, 'me', isNull)); + }); + + test('StreamChatWsCodec tolerates the health check fields it does not model', () { + // `cid` is always the literal `*` on a chat health check, and `custom` and `received_at` ride + // along from the server's base event. + final event = codec.decode( + _frame({ + 'cid': '*', + 'custom': {'some_key': 'some_value'}, + 'received_at': '2020-01-29T03:22:48.63613Z', + }), + ); + + expect(event, isA().having((it) => it.createdAt, 'createdAt', isA())); + }); + + test('StreamChatWsCodec decodes a health check the server timestamped with nothing', () { + // Stamped locally rather than refused: a health check that failed to decode would be a + // connection that never reports itself established. + final event = codec.decode(jsonEncode({'type': EventType.healthCheck, 'connection_id': 'test-connection-id'})); + + expect(event, isA().having((it) => it.createdAt, 'createdAt', isNotNull)); + expect(event.healthCheckInfo, const HealthCheckInfo(connectionId: 'test-connection-id')); + }); + + test('StreamChatWsCodec decodes a refusal as a ConnectionErrorEvent', () { + final event = codec.decode(_frame({'type': EventType.connectionError, 'error': _tokenExpiredError})); + + expect(event, isA()); + expect(event.healthCheckInfo, isNull); + expect( + event.error, + isA() + .having((it) => it.code, 'code', StreamErrorCode.tokenExpired) + .having((it) => it.message, 'message', 'Token expired'), + ); + }); + + test('StreamChatWsCodec decodes a refusal the server timestamped with nothing', () { + // A refusal the client cannot read costs it the reason it was refused, and an expired token + // then reads as a session the server ended. + final event = codec.decode(jsonEncode({'type': EventType.connectionError, 'error': _tokenExpiredError})); + + expect(event, isA().having((it) => it.error, 'error', isA())); + }); + + test('StreamChatWsCodec decodes any other frame as an Event', () { + final event = codec.decode(_frame({'type': EventType.messageNew, 'cid': 'messaging:test-channel-id'})); + + expect( + event, + isA() + .having((it) => it.type, 'type', EventType.messageNew) + .having((it) => it.cid, 'cid', 'messaging:test-channel-id'), + ); + + // Neither, so the client publishes it rather than acting on it. + expect(event.healthCheckInfo, isNull); + expect(event.error, isNull); + }); + + test('StreamChatWsCodec throws on a frame it cannot parse', () { + // The engine turns this into a dropped message rather than a failed connection, so throwing is + // how the codec rejects a frame. + expect(() => codec.decode('not json'), throwsA(anything)); + }); + + test('StreamChatWsCodec encodes a ping as the health check the server expects', () { + const ping = HealthCheckPingEvent(connectionId: 'test-connection-id'); + + final encoded = codec.encode(ping); + + expect(jsonDecode(encoded as String), {'type': EventType.healthCheck, 'client_id': 'test-connection-id'}); + }); +} + +const _user = {'id': 'test-user-id', 'name': 'Test User'}; + +const _tokenExpiredError = { + 'code': 40, + 'message': 'Token expired', + 'StatusCode': 401, + 'details': [], + 'duration': '0.1ms', + 'more_info': 'https://getstream.io/chat/docs/api_errors_response', +}; + +// A health check the server would send, with [overrides] applied. Every field the codec does not +// decide on is noise in a test about the one that does. +String _frame(Map overrides) => jsonEncode({ + 'type': EventType.healthCheck, + 'connection_id': 'test-connection-id', + 'created_at': '2020-01-29T03:22:47.63613Z', + ...overrides, +}); diff --git a/packages/stream_chat/test/src/ws/timer_helper_test.dart b/packages/stream_chat/test/src/ws/timer_helper_test.dart deleted file mode 100644 index ecafd6d2cf..0000000000 --- a/packages/stream_chat/test/src/ws/timer_helper_test.dart +++ /dev/null @@ -1,98 +0,0 @@ -import 'package:stream_chat/src/ws/timer_helper.dart'; -import 'package:test/test.dart'; - -void main() { - late TimerHelper timerHelper; - - setUp(() { - timerHelper = TimerHelper(); - }); - - tearDown(() { - timerHelper.cancelAllTimers(); - }); - - test('setTimer', () async { - expect(timerHelper.hasTimers, isFalse); - - var count = 0; - void callback() => count += 1; - - timerHelper.setTimer( - const Duration(milliseconds: 500), - callback, - ); - - expect(count, 0); - await Future.delayed(const Duration(milliseconds: 500)); - expect(count, 1); - - expect(timerHelper.hasTimers, isTrue); - }); - - test('setImmediateTimer', () async { - var count = 0; - void callback() => count += 1; - - timerHelper.setTimer( - const Duration(milliseconds: 500), - callback, - immediate: true, - ); - - expect(count, 1); - await Future.delayed(const Duration(milliseconds: 500)); - expect(count, 2); - }); - - test('setPeriodicTimer', () async { - expect(timerHelper.hasTimers, isFalse); - var count = 0; - void callback() => count += 1; - - timerHelper.setTimer( - const Duration(milliseconds: 500), - callback, - ); - - expect(count, 0); - await Future.delayed(const Duration(milliseconds: 500)); - expect(count, 1); - - expect(timerHelper.hasTimers, isTrue); - }); - - test('setImmediatePeriodicTimer', () async { - var count = 0; - void callback(_) => count += 1; - - timerHelper.setPeriodicTimer( - const Duration(milliseconds: 500), - callback, - immediate: true, - ); - - expect(count, 1); - await Future.delayed(const Duration(milliseconds: 500)); - expect(count, 2); - }); - - test('cancelTimer', () { - expect(timerHelper.hasTimers, isFalse); - final id = timerHelper.setTimer(const Duration(seconds: 3), () {}); - expect(timerHelper.hasTimers, isTrue); - timerHelper.cancelTimer(id); - expect(timerHelper.hasTimers, isFalse); - }); - - test('cancelAllTimers', () { - expect(timerHelper.hasTimers, isFalse); - timerHelper - ..setTimer(const Duration(seconds: 3), () {}) - ..setTimer(const Duration(seconds: 6), () {}) - ..setTimer(const Duration(seconds: 9), () {}); - expect(timerHelper.hasTimers, isTrue); - timerHelper.cancelAllTimers(); - expect(timerHelper.hasTimers, isFalse); - }); -} diff --git a/packages/stream_chat/test/src/ws/websocket_test.dart b/packages/stream_chat/test/src/ws/websocket_test.dart deleted file mode 100644 index 866c151dae..0000000000 --- a/packages/stream_chat/test/src/ws/websocket_test.dart +++ /dev/null @@ -1,592 +0,0 @@ -import 'dart:async'; -import 'dart:convert'; - -import 'package:mocktail/mocktail.dart'; -import 'package:stream_chat/src/ws/websocket.dart'; -import 'package:stream_chat/stream_chat.dart'; -import 'package:test/test.dart'; -import 'package:web_socket_channel/web_socket_channel.dart'; - -import '../fakes.dart'; -import '../mocks.dart'; - -void main() { - late TokenManager tokenManager; - late WebSocketChannel webSocketChannel; - late WebSocketSink webSocketSink; - late WebSocket webSocket; - - setUp(() { - tokenManager = FakeTokenManager(); - webSocketChannel = MockWebSocketChannel(); - - WebSocketChannel channelProvider( - Uri uri, { - Iterable? protocols, - }) => webSocketChannel; - - webSocket = WebSocket( - apiKey: 'api-key', - baseUrl: 'ws://:8800', - tokenManager: tokenManager, - webSocketChannelProvider: channelProvider, - ); - - webSocketSink = MockWebSocketSink(); - when(() => webSocketChannel.sink).thenReturn(webSocketSink); - when(() => webSocketChannel.ready).thenAnswer((_) async {}); - - var webSocketController = StreamController.broadcast(); - when(() => webSocketChannel.stream).thenAnswer( - (_) => webSocketController.stream, - ); - when(() => webSocketSink.done).thenAnswer( - (_) => Completer().future, - ); - when(() => webSocketSink.add(any())).thenAnswer((invocation) { - webSocketController.add(invocation.positionalArguments.first); - }); - when(() => webSocketSink.close(any(), any())).thenAnswer( - (_) async { - webSocketController.close(); - // re-initializing for future events - webSocketController = StreamController.broadcast(); - }, - ); - }); - - tearDown(() { - tokenManager.reset(); - webSocket.disconnect(); - }); - - test('`connect` successfully with the provided user', () async { - final user = OwnUser( - id: 'test-user', - name: 'test', - ); - const connectionId = 'test-connection-id'; - // Sends connect event to web-socket stream - final timer = Timer(const Duration(milliseconds: 300), () { - final event = Event( - type: EventType.healthCheck, - connectionId: connectionId, - me: user, - ); - webSocketSink.add(json.encode(event)); - }); - - expectLater( - webSocket.connectionStatusStream, - emitsInOrder([ - ConnectionStatus.disconnected, - ConnectionStatus.connecting, - ConnectionStatus.connected, - ]), - ); - - final event = await webSocket.connect(user); - - expect(event.type, EventType.healthCheck); - expect(event.connectionId, connectionId); - expect(event.me, isNotNull); - expect(event.me!.id, user.id); - - addTearDown(timer.cancel); - }); - - test('`connect` does not orphan the channel `ready` error', () async { - // A failed connect completes `ready` with an error on top of the error it - // delivers on the stream. Left unlistened, that duplicate is reported to - // the zone as an unhandled error. https://github.com/GetStream/stream-chat-flutter/issues/2921 - when(() => webSocketChannel.ready).thenAnswer( - (_) => Future.error(WebSocketChannelException('connect failed')), - ); - - final user = OwnUser(id: 'test-user'); - const connectionId = 'test-connection-id'; - // Sends connect event to web-socket stream - final timer = Timer(const Duration(milliseconds: 300), () { - final event = Event( - type: EventType.healthCheck, - connectionId: connectionId, - me: user, - ); - webSocketSink.add(json.encode(event)); - }); - - await webSocket.connect(user); - - verify(() => webSocketChannel.ready).called(1); - // Guards against `ready` being read but its error dropped: the orphan would - // surface here and fail the test. - await pumpEventQueue(); - - addTearDown(timer.cancel); - }); - - test('`connect` successfully without user details', () async { - final user = OwnUser( - id: 'test-user', - name: 'test', - ); - const connectionId = 'test-connection-id'; - // Sends connect event to web-socket stream - final timer = Timer(const Duration(milliseconds: 300), () { - final event = Event( - type: EventType.healthCheck, - connectionId: connectionId, - me: user, - ); - webSocketSink.add(json.encode(event)); - }); - - expectLater( - webSocket.connectionStatusStream, - emitsInOrder([ - ConnectionStatus.disconnected, - ConnectionStatus.connecting, - ConnectionStatus.connected, - ]), - ); - - final event = await webSocket.connect( - user, - includeUserDetails: true, - ); - - expect(event.type, EventType.healthCheck); - expect(event.connectionId, connectionId); - expect(event.me, isNotNull); - expect(event.me!.id, user.id); - - addTearDown(timer.cancel); - }); - - test('`connect`, `disconnect` and `connect` again without waiting', () async { - final user = OwnUser( - id: 'test-user', - name: 'test', - ); - const connectionId = 'test-connection-id'; - // Sends connect event to web-socket stream - final timer = Timer.periodic(const Duration(milliseconds: 300), (_) { - final event = Event( - type: EventType.healthCheck, - connectionId: connectionId, - me: user, - ); - webSocketSink.add(json.encode(event)); - }); - - await webSocket.connect( - user, - ); - - webSocket - ..disconnect() - ..connect(user) - ..disconnect(); - final event = await webSocket.connect(user); - - expect(event.type, EventType.healthCheck); - expect(event.connectionId, connectionId); - expect(event.me, isNotNull); - expect(event.me!.id, user.id); - - addTearDown(timer.cancel); - }); - - test('`connect` should throw if already in connection attempt', () async { - final user = OwnUser(id: 'test-user'); - webSocket.connect(user); - try { - // calling again before previous attempt finishes - await webSocket.connect(user); - } catch (e) { - // Misuse, so it leaves the StreamException hierarchy entirely. - expect(e, isA()); - } - }); - - test('`connect` should throw if `onMessage` contains error', () async { - final user = OwnUser(id: 'test-user'); - final error = ErrorResponse() - ..code = 333 - ..message = 'Invalid request' - ..statusCode = 400; - // Sends error event to web-socket stream - final timer = Timer(const Duration(milliseconds: 300), () { - webSocketSink.add(json.encode({'error': error})); - }); - - expectLater( - webSocket.connectionStatusStream, - emitsInOrder([ - ConnectionStatus.disconnected, - ConnectionStatus.connecting, - ConnectionStatus.disconnected, - ]), - ); - - try { - await webSocket.connect(user); - } catch (e) { - expect(e, isA()); - final err = e as StreamApiException; - expect(err.code?.code, error.code); - expect(err.message, error.message); - } - - addTearDown(timer.cancel); - }); - - test( - 'should `reconnect` automatically ' - 'if `onMessage` throws error after getting connected', - () async { - final user = OwnUser(id: 'test-user'); - const connectionId = 'test-connection-id'; - // Sends connect event to web-socket stream - final timer = Timer(const Duration(milliseconds: 300), () { - final event = Event( - type: EventType.healthCheck, - connectionId: connectionId, - me: user, - ); - webSocketSink.add(json.encode(event)); - }); - - expectLater( - webSocket.connectionStatusStream, - emitsInOrder([ - ConnectionStatus.disconnected, - ConnectionStatus.connecting, - ConnectionStatus.connected, - // starts reconnecting - ConnectionStatus.connecting, - ConnectionStatus.connected, - ]), - ); - - await webSocket.connect(user); - - final error = ErrorResponse() - ..code = 333 - ..message = 'Invalid request' - ..statusCode = 400; - // Sends error event to web-socket stream - webSocketSink.add(json.encode({'error': error})); - - final reconnectTimer = Timer(const Duration(seconds: 3), () { - final event = Event( - type: EventType.healthCheck, - connectionId: connectionId, - me: user, - ); - webSocketSink.add(json.encode(event)); - }); - - expect(webSocket.connectionId, connectionId); - - addTearDown(() { - timer.cancel(); - reconnectTimer.cancel(); - }); - }, - ); - - test( - '`onMessage` should handle `health.check` event if `me` is null', - () async { - final user = OwnUser(id: 'test-user'); - const connectionId = 'test-connection-id'; - // Sends connect event to web-socket stream - final timer = Timer(const Duration(milliseconds: 300), () { - final event = Event( - type: EventType.healthCheck, - connectionId: connectionId, - me: user, - ); - webSocketSink.add(json.encode(event)); - }); - - expectLater( - webSocket.connectionStatusStream, - emitsInOrder([ - ConnectionStatus.disconnected, - ConnectionStatus.connecting, - ConnectionStatus.connected, - ]), - ); - - final event = await webSocket.connect(user); - - expect(event.type, EventType.healthCheck); - expect(event.connectionId, connectionId); - expect(event.me, isNotNull); - expect(event.me!.id, user.id); - - const newConnectionId = 'new-connection-id'; - final healthCheckEvent = Event( - type: EventType.healthCheck, - connectionId: newConnectionId, - ); - webSocketSink.add(json.encode(healthCheckEvent)); - - await Future.delayed(const Duration(milliseconds: 300)); - - expectLater(webSocket.connectionId, newConnectionId); - - addTearDown(timer.cancel); - }, - ); - - test('should call `onConnectionError` if web-socket stream throws', () async { - final user = OwnUser(id: 'test-user'); - // Sends connect event to web-socket stream - final timer = Timer(const Duration(milliseconds: 300), () { - const error = StreamNetworkException(message: 'test-error'); - webSocketSink.addError(error); - }); - - expectLater( - webSocket.connectionStatusStream, - emitsInOrder([ - ConnectionStatus.disconnected, - ConnectionStatus.connecting, - // throws error, reconnects - ConnectionStatus.connected, - ]), - ); - - webSocket.connect(user); - - // Assuming web-socket stream will add error - // and web-socket now trying to reconnect - await Future.delayed(const Duration(seconds: 3)); - - const connectionId = 'test-connection-id'; - // Sends connect event to web-socket stream - final event = Event( - type: EventType.healthCheck, - connectionId: connectionId, - me: user, - ); - webSocketSink.add(json.encode(event)); - - addTearDown(timer.cancel); - }); - - test( - 'should call `onConnectionClosed` if web-socket stream throws', - () async { - final user = OwnUser(id: 'test-user'); - // Sends connect event to web-socket stream - final timer = Timer(const Duration(milliseconds: 300), () { - webSocketSink.close(); - }); - - expectLater( - webSocket.connectionStatusStream, - emitsInOrder([ - ConnectionStatus.disconnected, - ConnectionStatus.connecting, - // throws error, reconnects - ConnectionStatus.connected, - ]), - ); - - webSocket.connect(user); - - // Assuming web-socket stream will add error - // and web-socket now trying to reconnect - await Future.delayed(const Duration(seconds: 3)); - - const connectionId = 'test-connection-id'; - // Sends connect event to web-socket stream - final event = Event( - type: EventType.healthCheck, - connectionId: connectionId, - me: user, - ); - webSocketSink.add(json.encode(event)); - - addTearDown(timer.cancel); - }, - ); - - test( - 'should not `reconnect` after connection closes while reconnect is paused', - () async { - // Construct with a short health-check interval so we can pump past it - // within the test and assert no health-check writes happen on the - // closed sink. - final pausedWebSocket = WebSocket( - apiKey: 'api-key', - baseUrl: 'ws://:8800', - tokenManager: tokenManager, - webSocketChannelProvider: (_, {protocols}) => webSocketChannel, - healthCheckInterval: 1, - reconnectionMonitorInterval: 1, - ); - addTearDown(pausedWebSocket.disconnect); - - final user = OwnUser(id: 'test-user'); - const connectionId = 'test-connection-id'; - // Sends connect event to web-socket stream - final timer = Timer(const Duration(milliseconds: 300), () { - final event = Event( - type: EventType.healthCheck, - connectionId: connectionId, - me: user, - ); - webSocketSink.add(json.encode(event)); - }); - - final statuses = []; - final sub = pausedWebSocket.connectionStatusStream.listen(statuses.add); - - await pausedWebSocket.connect(user); - expect(pausedWebSocket.reconnectEnabled, isTrue); - - pausedWebSocket.pauseReconnect(); - expect(pausedWebSocket.reconnectEnabled, isFalse); - - // Mark all writes-so-far as verified so the next assertion only sees - // calls made after the close. - verify(() => webSocketSink.add(any())); - - // Simulate an OS-initiated socket close. - webSocketSink.close(); - - // Pump well past the health-check interval to prove its timer was - // cancelled and no further writes are attempted on the dead channel. - await Future.delayed(const Duration(seconds: 3)); - - // Status should settle to disconnected after the paused close, with no - // `connecting` flicker from a retry attempt. - expect(statuses, [ - ConnectionStatus.disconnected, - ConnectionStatus.connecting, - ConnectionStatus.connected, - ConnectionStatus.disconnected, - ]); - // No additional sink writes after the close. - verifyNever(() => webSocketSink.add(any())); - - addTearDown(() { - timer.cancel(); - sub.cancel(); - }); - }, - ); - - test( - 'should `reconnect` again after `resumeReconnect`', - () async { - final user = OwnUser(id: 'test-user'); - const connectionId = 'test-connection-id'; - final timer = Timer(const Duration(milliseconds: 300), () { - final event = Event( - type: EventType.healthCheck, - connectionId: connectionId, - me: user, - ); - webSocketSink.add(json.encode(event)); - }); - - await webSocket.connect(user); - - webSocket.pauseReconnect(); - expect(webSocket.reconnectEnabled, isFalse); - - webSocket.resumeReconnect(); - expect(webSocket.reconnectEnabled, isTrue); - - addTearDown(timer.cancel); - }, - ); - - test('`disconnect` successfully disconnects the current user', () async { - final user = OwnUser(id: 'test-user'); - const connectionId = 'test-connection-id'; - // Sends connect event to web-socket stream - final timer = Timer(const Duration(milliseconds: 300), () { - final event = Event( - type: EventType.healthCheck, - connectionId: connectionId, - me: user, - ); - webSocketSink.add(json.encode(event)); - }); - - expectLater( - webSocket.connectionStatusStream, - emitsInOrder([ - ConnectionStatus.disconnected, - ConnectionStatus.connecting, - ConnectionStatus.connected, - // after disconnect - ConnectionStatus.disconnected, - ]), - ); - - final event = await webSocket.connect(user); - - expect(event.type, EventType.healthCheck); - expect(event.connectionId, connectionId); - expect(event.me?.id, user.id); - - webSocket.disconnect(); - - addTearDown(timer.cancel); - }); - - test('logs the connect URI with the user token redacted', () async { - final records = []; - StreamLogger.handler = _CapturingHandler(records.add); - StreamLogger.priority = StreamLogPriority.verbose; - addTearDown(StreamLogger.reset); - - final connectedWith = []; - final socket = WebSocket( - apiKey: 'api-key', - baseUrl: 'ws://:8800', - tokenManager: tokenManager, - webSocketChannelProvider: (uri, {protocols}) { - connectedWith.add(uri); - return webSocketChannel; - }, - ); - addTearDown(socket.disconnect); - - final user = OwnUser(id: 'test-user'); - final timer = Timer(const Duration(milliseconds: 300), () { - webSocketSink.add( - json.encode(Event(type: EventType.healthCheck, connectionId: 'test-connection-id', me: user)), - ); - }); - addTearDown(timer.cancel); - - await socket.connect(user); - - final rawToken = (await tokenManager.getToken()).rawValue; - // Compared decoded, so a token that leaked percent-encoded is still caught. - final logged = records.map((it) => Uri.decodeFull(it.message)); - - // The connection itself still carries the token; only the record is redacted. - expect(Uri.decodeFull(connectedWith.single.toString()), contains(rawToken)); - expect(logged, contains(startsWith('[connect] #ws; uri:'))); - expect(logged, everyElement(isNot(contains(rawToken)))); - }); -} - -class _CapturingHandler extends StreamLogHandler { - const _CapturingHandler(this._onRecord); - - final void Function(StreamLogRecord) _onRecord; - - @override - void handle(StreamLogRecord record) => _onRecord(record); -} diff --git a/packages/stream_chat_flutter/example/pubspec.yaml b/packages/stream_chat_flutter/example/pubspec.yaml index 4192f1d40f..b2a90de314 100644 --- a/packages/stream_chat_flutter/example/pubspec.yaml +++ b/packages/stream_chat_flutter/example/pubspec.yaml @@ -41,11 +41,12 @@ dependency_overrides: stream_chat_persistence: path: ../../stream_chat_persistence # Forces one source for `stream_core`; see `melos.yaml`. + # Repeated here because this block outranks `melos.yaml`'s `dependencyOverridePaths`. stream_core: git: url: https://github.com/GetStream/stream-core-flutter.git path: packages/stream_core - ref: 04e0d1cb3a6893cf70cb6636a261deb11beff81c + ref: 6042453b56c782d9c8b29a2d103ae73ba433814c flutter: uses-material-design: true diff --git a/packages/stream_chat_flutter/lib/src/channel/channel_info.dart b/packages/stream_chat_flutter/lib/src/channel/channel_info.dart index a2c6222738..08e7aea4ae 100644 --- a/packages/stream_chat_flutter/lib/src/channel/channel_info.dart +++ b/packages/stream_chat_flutter/lib/src/channel/channel_info.dart @@ -181,7 +181,7 @@ class _DisconnectedTitleState extends StatelessWidget { vertical: VisualDensity.minimumDensity, ), ), - onPressed: client.maybeReconnect, + onPressed: () => client.maybeReconnect().ignore(), child: Text( context.translations.tryAgainLabel, style: textStyle?.copyWith( diff --git a/packages/stream_chat_flutter/lib/src/channel/channel_list_header.dart b/packages/stream_chat_flutter/lib/src/channel/channel_list_header.dart index 6970c01e39..6e38f07bc6 100644 --- a/packages/stream_chat_flutter/lib/src/channel/channel_list_header.dart +++ b/packages/stream_chat_flutter/lib/src/channel/channel_list_header.dart @@ -292,7 +292,7 @@ class _DisconnectedTitleState extends StatelessWidget { type: .ghost, style: .primary, size: .small, - onPressed: client.maybeReconnect, + onPressed: () => client.maybeReconnect().ignore(), child: Text(context.translations.tryAgainLabel), ), ], diff --git a/packages/stream_chat_flutter/lib/src/misc/connection_status_builder.dart b/packages/stream_chat_flutter/lib/src/misc/connection_status_builder.dart index a00886e356..c5e27118b3 100644 --- a/packages/stream_chat_flutter/lib/src/misc/connection_status_builder.dart +++ b/packages/stream_chat_flutter/lib/src/misc/connection_status_builder.dart @@ -7,7 +7,7 @@ import 'empty_widget.dart'; /// A widget that builds itself based on the latest snapshot of interaction with /// a [Stream] of type [ConnectionStatus]. /// -/// The widget will use the closest [StreamChatClient.wsConnectionStatusStream] +/// The widget will use the closest [StreamChatClient.connectionStatusStream] /// in case no stream is provided. /// {@endtemplate} class StreamConnectionStatusBuilder extends StatelessWidget { @@ -34,10 +34,10 @@ class StreamConnectionStatusBuilder extends StatelessWidget { @override Widget build(BuildContext context) { - final stream = connectionStatusStream ?? StreamChat.of(context).client.wsConnectionStatusStream; + final stream = connectionStatusStream ?? StreamChat.of(context).client.connectionStatusStream; final client = StreamChat.of(context).client; return BetterStreamBuilder( - initialData: client.wsConnectionStatus, + initialData: client.connectionStatus, stream: stream, noDataBuilder: loadingBuilder, errorBuilder: (context, error) { diff --git a/packages/stream_chat_flutter/pubspec.yaml b/packages/stream_chat_flutter/pubspec.yaml index f43278c911..07a9247dff 100644 --- a/packages/stream_chat_flutter/pubspec.yaml +++ b/packages/stream_chat_flutter/pubspec.yaml @@ -121,8 +121,9 @@ platforms: dependency_overrides: # Forces one source for `stream_core`; see `melos.yaml`. + # Repeated here because this block outranks `melos.yaml`'s `dependencyOverridePaths`. stream_core: git: url: https://github.com/GetStream/stream-core-flutter.git path: packages/stream_core - ref: 04e0d1cb3a6893cf70cb6636a261deb11beff81c + ref: 6042453b56c782d9c8b29a2d103ae73ba433814c diff --git a/packages/stream_chat_flutter/test/src/channel/channel_header_test.dart b/packages/stream_chat_flutter/test/src/channel/channel_header_test.dart index 2a6c8bbcc8..00e5f6e2b4 100644 --- a/packages/stream_chat_flutter/test/src/channel/channel_header_test.dart +++ b/packages/stream_chat_flutter/test/src/channel/channel_header_test.dart @@ -38,7 +38,7 @@ void main() { when(() => channel.imageStream).thenAnswer((i) => Stream.value('https://bit.ly/321RmWb')); when(() => channel.image).thenReturn('https://bit.ly/321RmWb'); when(() => channelState.unreadCount).thenReturn(1); - when(() => client.wsConnectionStatusStream).thenAnswer((_) => Stream.value(ConnectionStatus.connected)); + when(() => client.connectionStatusStream).thenAnswer((_) => Stream.value(ConnectionStatus.connected)); when(() => channelState.unreadCountStream).thenAnswer((i) => Stream.value(1)); when(() => clientState.totalUnreadCount).thenAnswer((i) => 1); when(() => clientState.totalUnreadCountStream).thenAnswer((i) => Stream.value(1)); @@ -119,8 +119,8 @@ void main() { user: User(id: 'user-id'), ), ]); - when(() => client.wsConnectionStatusStream).thenAnswer((_) => Stream.value(ConnectionStatus.disconnected)); - when(() => client.wsConnectionStatus).thenReturn(ConnectionStatus.disconnected); + when(() => client.connectionStatusStream).thenAnswer((_) => Stream.value(ConnectionStatus.disconnected)); + when(() => client.connectionStatus).thenReturn(ConnectionStatus.disconnected); when(() => clientState.totalUnreadCount).thenAnswer((i) => 1); when(() => clientState.totalUnreadCountStream).thenAnswer((i) => Stream.value(1)); when(() => clientState.channels).thenReturn({channel.cid!: channel}); @@ -187,7 +187,7 @@ void main() { user: User(id: 'user-id'), ), ]); - when(() => client.wsConnectionStatusStream).thenAnswer((_) => Stream.value(ConnectionStatus.connecting)); + when(() => client.connectionStatusStream).thenAnswer((_) => Stream.value(ConnectionStatus.connecting)); when(() => clientState.totalUnreadCount).thenAnswer((i) => 1); when(() => clientState.totalUnreadCountStream).thenAnswer((i) => Stream.value(1)); when(() => clientState.channels).thenReturn({channel.cid!: channel}); @@ -258,7 +258,7 @@ void main() { user: User(id: 'user-id'), ), ]); - when(() => client.wsConnectionStatusStream).thenAnswer((_) => Stream.value(ConnectionStatus.connecting)); + when(() => client.connectionStatusStream).thenAnswer((_) => Stream.value(ConnectionStatus.connecting)); when(() => clientState.totalUnreadCountStream).thenAnswer((i) => Stream.value(1)); await tester.pumpWidget( @@ -334,7 +334,7 @@ void main() { user: User(id: 'user-id'), ), ]); - when(() => client.wsConnectionStatusStream).thenAnswer((_) => Stream.value(ConnectionStatus.disconnected)); + when(() => client.connectionStatusStream).thenAnswer((_) => Stream.value(ConnectionStatus.disconnected)); await tester.pumpWidget( MaterialApp( @@ -399,7 +399,7 @@ void main() { user: User(id: 'user-id'), ), ]); - when(() => client.wsConnectionStatusStream).thenAnswer((_) => Stream.value(ConnectionStatus.connecting)); + when(() => client.connectionStatusStream).thenAnswer((_) => Stream.value(ConnectionStatus.connecting)); when(() => clientState.totalUnreadCount).thenAnswer((i) => 1); when(() => clientState.totalUnreadCountStream).thenAnswer((i) => Stream.value(1)); when(() => clientState.channels).thenReturn({channel.cid!: channel}); @@ -460,7 +460,7 @@ void main() { when(() => clientState.totalUnreadCount).thenReturn(0); when(() => clientState.totalUnreadCountStream).thenAnswer((_) => Stream.value(0)); when(() => clientState.channels).thenReturn({channel.cid!: channel}); - when(() => client.wsConnectionStatusStream).thenAnswer((_) => Stream.value(ConnectionStatus.connected)); + when(() => client.connectionStatusStream).thenAnswer((_) => Stream.value(ConnectionStatus.connected)); when(() => channel.client).thenReturn(client); when(() => channel.state).thenReturn(channelState); @@ -525,7 +525,7 @@ void main() { when(() => clientState.totalUnreadCount).thenReturn(0); when(() => clientState.totalUnreadCountStream).thenAnswer((_) => Stream.value(0)); when(() => clientState.channels).thenReturn({channel.cid!: channel}); - when(() => client.wsConnectionStatusStream).thenAnswer((_) => Stream.value(ConnectionStatus.connected)); + when(() => client.connectionStatusStream).thenAnswer((_) => Stream.value(ConnectionStatus.connected)); when(() => channel.client).thenReturn(client); when(() => channel.state).thenReturn(channelState); diff --git a/packages/stream_chat_flutter/test/src/channel/channel_list_header_test.dart b/packages/stream_chat_flutter/test/src/channel/channel_list_header_test.dart index 60c2bbe8b4..09e74452dc 100644 --- a/packages/stream_chat_flutter/test/src/channel/channel_list_header_test.dart +++ b/packages/stream_chat_flutter/test/src/channel/channel_list_header_test.dart @@ -14,7 +14,7 @@ void main() { when(() => client.state).thenReturn(clientState); when(() => clientState.currentUser).thenReturn(OwnUser(id: 'user-id')); - when(() => client.wsConnectionStatusStream).thenAnswer((_) => Stream.value(ConnectionStatus.connected)); + when(() => client.connectionStatusStream).thenAnswer((_) => Stream.value(ConnectionStatus.connected)); await tester.pumpWidget( MaterialApp( @@ -42,7 +42,7 @@ void main() { when(() => client.state).thenReturn(clientState); when(() => clientState.currentUser).thenReturn(OwnUser(id: 'user-id')); - when(() => client.wsConnectionStatusStream).thenAnswer((_) => Stream.value(ConnectionStatus.disconnected)); + when(() => client.connectionStatusStream).thenAnswer((_) => Stream.value(ConnectionStatus.disconnected)); await tester.pumpWidget( MaterialApp( @@ -70,7 +70,7 @@ void main() { when(() => client.state).thenReturn(clientState); when(() => clientState.currentUser).thenReturn(OwnUser(id: 'user-id')); - when(() => client.wsConnectionStatusStream).thenAnswer((_) => Stream.value(ConnectionStatus.connecting)); + when(() => client.connectionStatusStream).thenAnswer((_) => Stream.value(ConnectionStatus.connecting)); await tester.pumpWidget( MaterialApp( @@ -98,7 +98,7 @@ void main() { when(() => client.state).thenReturn(clientState); when(() => clientState.currentUser).thenReturn(OwnUser(id: 'user-id')); - when(() => client.wsConnectionStatusStream).thenAnswer((_) => Stream.value(ConnectionStatus.connecting)); + when(() => client.connectionStatusStream).thenAnswer((_) => Stream.value(ConnectionStatus.connecting)); await tester.pumpWidget( MaterialApp( @@ -131,7 +131,7 @@ void main() { when(() => client.state).thenReturn(clientState); when(() => clientState.currentUser).thenReturn(OwnUser(id: 'user-id')); - when(() => client.wsConnectionStatusStream).thenAnswer((_) => Stream.value(ConnectionStatus.connected)); + when(() => client.connectionStatusStream).thenAnswer((_) => Stream.value(ConnectionStatus.connected)); var trailingTapped = 0; await tester.pumpWidget( @@ -171,7 +171,7 @@ void main() { when(() => client.state).thenReturn(clientState); when(() => clientState.currentUser).thenReturn(OwnUser(id: 'user-id')); - when(() => client.wsConnectionStatusStream).thenAnswer((_) => Stream.value(ConnectionStatus.connected)); + when(() => client.connectionStatusStream).thenAnswer((_) => Stream.value(ConnectionStatus.connected)); await tester.pumpWidget( MaterialApp( diff --git a/packages/stream_chat_flutter/test/src/misc/thread_header_test.dart b/packages/stream_chat_flutter/test/src/misc/thread_header_test.dart index 199bd5938d..de78cbc7c0 100644 --- a/packages/stream_chat_flutter/test/src/misc/thread_header_test.dart +++ b/packages/stream_chat_flutter/test/src/misc/thread_header_test.dart @@ -42,7 +42,7 @@ void main() { user: User(id: 'user-id'), ), ]); - when(() => client.wsConnectionStatusStream).thenAnswer((_) => Stream.value(ConnectionStatus.connecting)); + when(() => client.connectionStatusStream).thenAnswer((_) => Stream.value(ConnectionStatus.connecting)); when(() => clientState.totalUnreadCount).thenAnswer((i) => 1); when(() => clientState.totalUnreadCountStream).thenAnswer((i) => Stream.value(1)); @@ -84,7 +84,7 @@ void main() { when(() => clientState.channels).thenReturn({channel.cid!: channel}); when(() => clientState.totalUnreadCount).thenReturn(0); when(() => clientState.totalUnreadCountStream).thenAnswer((_) => Stream.value(0)); - when(() => client.wsConnectionStatusStream).thenAnswer((_) => Stream.value(ConnectionStatus.connected)); + when(() => client.connectionStatusStream).thenAnswer((_) => Stream.value(ConnectionStatus.connected)); when(() => channel.state).thenReturn(channelState); when(() => channel.client).thenReturn(client); diff --git a/packages/stream_chat_flutter/test/src/mocks.dart b/packages/stream_chat_flutter/test/src/mocks.dart index cab7f0036a..b461bc653a 100644 --- a/packages/stream_chat_flutter/test/src/mocks.dart +++ b/packages/stream_chat_flutter/test/src/mocks.dart @@ -4,8 +4,8 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart'; class MockClient extends Mock implements StreamChatClient { MockClient() { - when(() => wsConnectionStatus).thenReturn(ConnectionStatus.connected); - when(() => wsConnectionStatusStream).thenAnswer((_) => Stream.value(ConnectionStatus.connected)); + when(() => connectionStatus).thenReturn(ConnectionStatus.connected); + when(() => connectionStatusStream).thenAnswer((_) => Stream.value(ConnectionStatus.connected)); when(() => state).thenReturn(MockClientState()); } } diff --git a/packages/stream_chat_flutter_core/lib/src/stream_chat_core.dart b/packages/stream_chat_flutter_core/lib/src/stream_chat_core.dart index ff6827d407..ff5de9eb80 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_chat_core.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_chat_core.dart @@ -349,7 +349,7 @@ final class _ChatLifecycleManager { _backgroundTimer = Timer(backgroundKeepAlive, () { _cancelEventSubscription(); - client.maybeDisconnect(); + client.maybeDisconnect().ignore(); }); } @@ -359,7 +359,7 @@ final class _ChatLifecycleManager { final hasConnectivity = !results.contains(ConnectivityResult.none); if (hasConnectivity) return client.maybeReconnect().ignore(); - return client.maybeDisconnect(); + return client.maybeDisconnect().ignore(); } void _cancelBackgroundTimer() { @@ -378,33 +378,25 @@ final class _ChatLifecycleManager { } } -/// Extension on [StreamChatClient] to provide a convenient method for -/// conditionally reconnecting the client if the user is logged in and -/// the connection is not yet established. +/// Opens and closes the client's connection as the app and the network come and +/// go. /// -/// This helps ensure the client attempts to reconnect immediately -/// (bypassing any retry delays) when the app returns to the foreground -/// or when connectivity is restored. +/// Neither reopens a connection that dropped: the socket retries that one. extension MaybeReconnect on StreamChatClient { /// Optionally trigger a reconnect if the user is already logged in and the /// client is not yet connected. Future maybeReconnect() async { if (state.currentUser == null) return; - if (wsConnectionStatus == ConnectionStatus.connected) return; + if (connectionStatus == ConnectionStatus.connected) return; - // Force immediate reconnection by resetting any ongoing retry delays - // This ensures we don't wait up to 25s when user foregrounds the app - closeConnection(); await openConnection(); } - /// Optionally disconnect the client if the user is logged in and the - /// connection is currently established. - void maybeDisconnect() { + /// Optionally disconnect the client if the user is logged in. + Future maybeDisconnect() async { if (state.currentUser == null) return; - if (wsConnectionStatus == ConnectionStatus.disconnected) return; + if (connectionStatus == ConnectionStatus.disconnected) return; - // Close the connection immediately return closeConnection(); } } diff --git a/packages/stream_chat_flutter_core/pubspec.yaml b/packages/stream_chat_flutter_core/pubspec.yaml index 81d96ea54f..e36d6ec50d 100644 --- a/packages/stream_chat_flutter_core/pubspec.yaml +++ b/packages/stream_chat_flutter_core/pubspec.yaml @@ -36,7 +36,7 @@ dependencies: stream_core: git: url: https://github.com/GetStream/stream-core-flutter.git - ref: 04e0d1cb3a6893cf70cb6636a261deb11beff81c + ref: 6042453b56c782d9c8b29a2d103ae73ba433814c path: packages/stream_core dev_dependencies: diff --git a/packages/stream_chat_flutter_core/test/mocks.dart b/packages/stream_chat_flutter_core/test/mocks.dart index 378b4dd65e..98ad0e15d9 100644 --- a/packages/stream_chat_flutter_core/test/mocks.dart +++ b/packages/stream_chat_flutter_core/test/mocks.dart @@ -9,7 +9,7 @@ class MockStreamChannelListEventHandler extends Mock implements StreamChannelLis class MockClient extends Mock implements StreamChatClient { MockClient() { - when(() => wsConnectionStatus).thenReturn(ConnectionStatus.connected); + when(() => connectionStatus).thenReturn(ConnectionStatus.connected); } @override diff --git a/packages/stream_chat_flutter_core/test/stream_chat_core_test.dart b/packages/stream_chat_flutter_core/test/stream_chat_core_test.dart index 19844462c7..ef1f81a44a 100644 --- a/packages/stream_chat_flutter_core/test/stream_chat_core_test.dart +++ b/packages/stream_chat_flutter_core/test/stream_chat_core_test.dart @@ -191,7 +191,7 @@ void main() { when( mockClient.openConnection, ).thenAnswer((_) async => OwnUser(id: 'test-user')); - when(() => mockClient.wsConnectionStatus).thenReturn(ConnectionStatus.connected); + when(() => mockClient.connectionStatus).thenReturn(ConnectionStatus.connected); }); tearDown(() { @@ -251,9 +251,7 @@ void main() { await tester.pumpAndSettle(); // Reset connection status to disconnected - when( - () => mockClient.wsConnectionStatus, - ).thenReturn(ConnectionStatus.disconnected); + when(() => mockClient.connectionStatus).thenReturn(ConnectionStatus.disconnected); // Act - bring app to foreground tester.binding.handleAppLifecycleStateChanged(AppLifecycleState.resumed); @@ -279,9 +277,7 @@ void main() { verifyNever(mockClient.resumeReconnect); // Reset connection status so foreground triggers a reconnect. - when( - () => mockClient.wsConnectionStatus, - ).thenReturn(ConnectionStatus.disconnected); + when(() => mockClient.connectionStatus).thenReturn(ConnectionStatus.disconnected); // Act - foreground tester.binding.handleAppLifecycleStateChanged(AppLifecycleState.resumed); @@ -345,6 +341,29 @@ void main() { }, ); + testWidgets( + 'should close a connection the socket is still waiting to reopen', + (tester) async { + await tester.runAsync(() async { + // What a connection the socket is waiting to reopen reads as. Left open, it would go on + // retrying behind an app that has been put away. + when(() => mockClient.connectionStatus).thenReturn(ConnectionStatus.connecting); + + await pumpStreamChatCore( + tester, + backgroundKeepAlive: const Duration(milliseconds: 100), + ); + + tester.binding.handleAppLifecycleStateChanged(AppLifecycleState.paused); + await tester.pumpAndSettle(); + + await Future.delayed(const Duration(milliseconds: 200)); + + verify(mockClient.closeConnection).called(1); + }); + }, + ); + testWidgets( 'should open connection when connectivity is restored', (tester) async { @@ -352,9 +371,7 @@ void main() { await pumpStreamChatCore(tester); // Set connection status to disconnected - when( - () => mockClient.wsConnectionStatus, - ).thenReturn(ConnectionStatus.disconnected); + when(() => mockClient.connectionStatus).thenReturn(ConnectionStatus.disconnected); // Act - restore connectivity (pump past the debounce window) connectivityController.add([ConnectivityResult.mobile]); @@ -372,9 +389,7 @@ void main() { await pumpStreamChatCore(tester); // Set connection status to connected - when( - () => mockClient.wsConnectionStatus, - ).thenReturn(ConnectionStatus.connected); + when(() => mockClient.connectionStatus).thenReturn(ConnectionStatus.connected); // Act - lose connectivity (pump past the debounce window) connectivityController.add([ConnectivityResult.none]); @@ -416,7 +431,7 @@ void main() { // only the trailing-edge state should drive one reconnect. await pumpStreamChatCore(tester); - when(() => mockClient.wsConnectionStatus).thenReturn(ConnectionStatus.disconnected); + when(() => mockClient.connectionStatus).thenReturn(ConnectionStatus.disconnected); // Fire three events spaced under 1 s — all inside the debounce window. connectivityController.add([ConnectivityResult.none]); @@ -440,7 +455,7 @@ void main() { (tester) async { await pumpStreamChatCore(tester); - when(() => mockClient.wsConnectionStatus).thenReturn(ConnectionStatus.disconnected); + when(() => mockClient.connectionStatus).thenReturn(ConnectionStatus.disconnected); connectivityController.add([ConnectivityResult.mobile]); await tester.pump(const Duration(seconds: 4)); @@ -461,9 +476,7 @@ void main() { ); // Set up for reconnection scenario - when( - () => mockClient.wsConnectionStatus, - ).thenReturn(ConnectionStatus.disconnected); + when(() => mockClient.connectionStatus).thenReturn(ConnectionStatus.disconnected); // Clear any previous calls clearInteractions(mockClient); @@ -491,8 +504,8 @@ void main() { testConnectivityController.add([ConnectivityResult.wifi]); await tester.pump(const Duration(seconds: 4)); - // Assert - second event should trigger reconnection - verify(mockClient.closeConnection).called(1); + // Assert - second event opens a connection, without closing one first + verifyNever(mockClient.closeConnection); verify(mockClient.openConnection).called(1); testConnectivityController.close(); diff --git a/packages/stream_chat_localizations/example/pubspec.yaml b/packages/stream_chat_localizations/example/pubspec.yaml index 24e9f1dc34..cb5d49f5ce 100644 --- a/packages/stream_chat_localizations/example/pubspec.yaml +++ b/packages/stream_chat_localizations/example/pubspec.yaml @@ -37,11 +37,12 @@ dependency_overrides: stream_chat_localizations: path: .. # Forces one source for `stream_core`; see `melos.yaml`. + # Repeated here because this block outranks `melos.yaml`'s `dependencyOverridePaths`. stream_core: git: url: https://github.com/GetStream/stream-core-flutter.git path: packages/stream_core - ref: 04e0d1cb3a6893cf70cb6636a261deb11beff81c + ref: 6042453b56c782d9c8b29a2d103ae73ba433814c flutter: uses-material-design: true \ No newline at end of file diff --git a/packages/stream_chat_localizations/pubspec.yaml b/packages/stream_chat_localizations/pubspec.yaml index 3efc5b1dd3..79e9681ec1 100644 --- a/packages/stream_chat_localizations/pubspec.yaml +++ b/packages/stream_chat_localizations/pubspec.yaml @@ -36,8 +36,9 @@ dev_dependencies: dependency_overrides: # Forces one source for `stream_core`; see `melos.yaml`. + # Repeated here because this block outranks `melos.yaml`'s `dependencyOverridePaths`. stream_core: git: url: https://github.com/GetStream/stream-core-flutter.git path: packages/stream_core - ref: 04e0d1cb3a6893cf70cb6636a261deb11beff81c + ref: 6042453b56c782d9c8b29a2d103ae73ba433814c diff --git a/sample_app/integration_test/support/stream_test_env.dart b/sample_app/integration_test/support/stream_test_env.dart index 2dea50bfd0..eb1bea85c6 100644 --- a/sample_app/integration_test/support/stream_test_env.dart +++ b/sample_app/integration_test/support/stream_test_env.dart @@ -193,7 +193,7 @@ class StreamTestEnv { final end = DateTime.now().add(timeout); while (DateTime.now().isBefore(end)) { await _tester.pump(const Duration(milliseconds: 200)); - if (authController.client?.wsConnectionStatus == status) return; + if (authController.client?.connectionStatus == status) return; } throw TestFailure('Timed out waiting for connection status: $status'); } diff --git a/sample_app/lib/auth/auth_controller.dart b/sample_app/lib/auth/auth_controller.dart index 50747681d2..1dcf4f4ce8 100644 --- a/sample_app/lib/auth/auth_controller.dart +++ b/sample_app/lib/auth/auth_controller.dart @@ -41,8 +41,9 @@ class _SampleAppLogHandler extends StreamLogHandler { if (kDebugMode) const StreamLogHandler.console().handle(record); - // report errors to Firebase Crashlytics - if (record.error != null || record.stackTrace != null) { + // Report errors to Firebase Crashlytics, keyed on the priority rather than on an error being + // attached: a warning carries one too, and reconnecting while offline logs several per outage. + if (record.priority >= StreamLogPriority.error && (record.error != null || record.stackTrace != null)) { FirebaseCrashlytics.instance .recordError( record.error, @@ -72,12 +73,12 @@ StreamChatClient _buildStreamChatClient( String? baseUrl, StreamConnectionOverride? connectionOverride, }) { - final priority = switch ((connectionOverride, kDebugMode)) { - // The e2e harness asserts on output, so keep the SDK quiet for it. - (final _?, _) => StreamLogPriority.none, - (_, true) => StreamLogPriority.info, + final priority = switch (connectionOverride) { + _? => StreamLogPriority.none, + _ when kDebugMode => StreamLogPriority.debug, _ => StreamLogPriority.error, }; + return StreamChatClient( apiKey, logConfig: StreamLogConfig( diff --git a/sample_app/lib/pages/channel_list_page.dart b/sample_app/lib/pages/channel_list_page.dart index aa6ff4980d..7a16cd8a88 100644 --- a/sample_app/lib/pages/channel_list_page.dart +++ b/sample_app/lib/pages/channel_list_page.dart @@ -88,6 +88,7 @@ class _ChannelListPageState extends State { return StreamScaffold( backgroundColor: colorScheme.backgroundApp, appBar: StreamChannelListHeader( + showConnectionStateTile: true, title: Text(enabledTabs[_currentIndex].navItem.label, style: textTheme.headingSm), ), drawer: LeftDrawer(user: user), diff --git a/sample_app/pubspec.yaml b/sample_app/pubspec.yaml index 41248821cf..47a7df3358 100644 --- a/sample_app/pubspec.yaml +++ b/sample_app/pubspec.yaml @@ -65,8 +65,9 @@ flutter: dependency_overrides: # Forces one source for `stream_core`; see `melos.yaml`. + # Repeated here because this block outranks `melos.yaml`'s `dependencyOverridePaths`. stream_core: git: url: https://github.com/GetStream/stream-core-flutter.git path: packages/stream_core - ref: 04e0d1cb3a6893cf70cb6636a261deb11beff81c + ref: 6042453b56c782d9c8b29a2d103ae73ba433814c From 0295abbd0d0867bd164203231cf28e0f02551b9e Mon Sep 17 00:00:00 2001 From: Petar Velikov Date: Mon, 21 Sep 2026 15:03:42 +0200 Subject: [PATCH 18/36] refactor(llc)!: route `searchRoles` through the generated API client (#2973) * refactor(llc)!: route searchRoles through the generated client Co-Authored-By: Claude Opus 5 * test(ui): drop a stray blank line in the mention autocomplete test Co-Authored-By: Claude Opus 5 * refactor(llc): give the generated client its own configured Dio Co-Authored-By: Claude Opus 5 * test(docs): compile the roles autocomplete stub against the generated response Co-Authored-By: Claude Opus 5 * refactor(llc): keep RoleType as the searchRoles filter type Co-Authored-By: Claude Opus 5 * refactor(llc): trim the generated client's comments and drop an unused mock Co-Authored-By: Claude Opus 5 * fix(llc): order the generated client's interceptors to match the hand-written chain Co-Authored-By: Claude Opus 5 * test(llc): drop the generated Role and SearchRolesResponse model tests Co-Authored-By: Claude Opus 5 * test(llc): assert RoleType string interop without a redundant constructor call Co-Authored-By: Claude Opus 5 * docs(repo): let the plan generator reproduce a finished group's record Co-Authored-By: Claude Opus 5 --------- Co-authored-by: Claude Opus 5 --- .../autocomplete_triggers_test.dart | 24 +++-- migrations/v11-migration.md | 35 ++++++ openapi-migration/04-roles-guest-and-app.md | 22 +++- openapi-migration/11-channels-and-members.md | 7 +- openapi-migration/tool/generate_plan.py | 60 ++++++++--- packages/stream_chat/CHANGELOG.md | 2 + .../stream_chat/lib/src/client/client.dart | 52 ++++++++- .../lib/src/core/api/responses.dart | 12 --- .../lib/src/core/api/responses.g.dart | 4 - .../lib/src/core/api/roles_api.dart | 39 ------- .../lib/src/core/api/stream_chat_api.dart | 5 - .../stream_chat/lib/src/core/models/role.dart | 59 ----------- .../lib/src/core/models/role.g.dart | 15 --- .../lib/src/core/models/role_type.dart | 14 +++ .../lib/src/repository/roles_repository.dart | 35 ++++++ packages/stream_chat/lib/stream_chat.dart | 4 +- .../test/src/client/client_test.dart | 33 ++++-- .../test/src/core/api/responses_test.dart | 40 ------- .../test/src/core/api/roles_api_test.dart | 100 ------------------ .../test/src/core/models/role_test.dart | 29 ----- .../test/src/core/models/role_type_test.dart | 25 +++++ packages/stream_chat/test/src/fakes.dart | 6 -- packages/stream_chat/test/src/mocks.dart | 4 +- .../src/repository/roles_repository_test.dart | 84 +++++++++++++++ .../stream_mention_autocomplete_options.dart | 8 +- ...eam_mention_autocomplete_options_test.dart | 62 ++++++----- 26 files changed, 391 insertions(+), 389 deletions(-) delete mode 100644 packages/stream_chat/lib/src/core/api/roles_api.dart delete mode 100644 packages/stream_chat/lib/src/core/models/role.dart delete mode 100644 packages/stream_chat/lib/src/core/models/role.g.dart create mode 100644 packages/stream_chat/lib/src/core/models/role_type.dart create mode 100644 packages/stream_chat/lib/src/repository/roles_repository.dart delete mode 100644 packages/stream_chat/test/src/core/api/roles_api_test.dart delete mode 100644 packages/stream_chat/test/src/core/models/role_test.dart create mode 100644 packages/stream_chat/test/src/core/models/role_type_test.dart create mode 100644 packages/stream_chat/test/src/repository/roles_repository_test.dart diff --git a/docs/docs_screenshots/test/message_input/autocomplete_triggers_test.dart b/docs/docs_screenshots/test/message_input/autocomplete_triggers_test.dart index 7a5701b2a6..6bee46a37f 100644 --- a/docs/docs_screenshots/test/message_input/autocomplete_triggers_test.dart +++ b/docs/docs_screenshots/test/message_input/autocomplete_triggers_test.dart @@ -170,16 +170,20 @@ void main() { when(() => channelState.watchers).thenReturn([]); when(() => client.searchRoles('c')).thenAnswer( - (_) async => SearchRolesResponse() - ..roles = [ - Role( - name: 'customer-success', - custom: false, - scopes: const [], - createdAt: DateTime.utc(2024), - updatedAt: DateTime.utc(2024), - ), - ], + (_) async => Result.success( + SearchRolesResponse( + duration: '0.01ms', + roles: [ + Role( + name: 'customer-success', + custom: false, + scopes: const [], + createdAt: DateTime.utc(2024), + updatedAt: DateTime.utc(2024), + ), + ], + ), + ), ); final messageComposerController = StreamMessageComposerController()..message = Message(text: 'Hello @c'); diff --git a/migrations/v11-migration.md b/migrations/v11-migration.md index b89d152fb0..d80d856a6c 100644 --- a/migrations/v11-migration.md +++ b/migrations/v11-migration.md @@ -25,6 +25,7 @@ onto Stream's OpenAPI-generated API client. - [Offline Cache](#offline-cache) - [Feature Areas](#feature-areas) - [Sorting](#sorting) + - [Roles](#roles) - [Migration Checklist](#migration-checklist) - [For AI Agents](#for-ai-agents) - [Contributing to this guide](#contributing-to-this-guide) @@ -150,6 +151,9 @@ search-and-replace you can apply directly. `Kind` is one of `renamed`, `removed` | `CurrentPlatform` / `PlatformType` (`stream_chat`) | `CurrentPlatform` / `PlatformType` (`stream_core`) | `moved` | Re-exported from this package. Same seven platforms and the same strings | | `CurrentPlatform.name` | `CurrentPlatform.operatingSystem` | `renamed` | Same value — `'android'`, `'ios'`, `'web'`, `'macos'`, … | | `client.wsConnectionStatus` / `.wsConnectionStatusStream` | `client.connectionStatus` / `.connectionStatusStream` | `renamed` | Same `ConnectionStatus`, same three values. The WebSocket's own state, and the disconnection sources it carries, are no longer exported: `ConnectionStatus` is the whole connection API, as on the other Stream SDKs | +| `Role` (hand-written) | `Role` (generated) | `retyped` | Same five fields, same types. Gains `copyWith` and `toJson`; equality is unchanged | +| `SearchRolesResponse` (hand-written) | `SearchRolesResponse` (generated) | `retyped` | `duration` and `roles` are required — a body omitting either now fails to decode rather than defaulting | +| `StreamChatClient.searchRoles` → `Future` | `Future>` | `retyped` | Returns a `Result` instead of throwing | | _(more added per feature as PRs land)_ | | | | --- @@ -383,6 +387,37 @@ default and still send nothing unless given a sort. An empty sort also leaves a loaded page in the order it arrived in, rather than re-sorting it — including a page read from the offline cache, which orders by the model's default when the query named no sort. +### Roles + +**`searchRoles` returns a `Result` instead of throwing**, and its types come from the OpenAPI spec. + +> **Why:** it is the first endpoint on the generated client. Our `Role` and the generated one were +> field-for-field identical, so keeping ours meant maintaining two copies of one shape forever. + +```dart +// v10 +try { + final response = await client.searchRoles('admin'); + useRoles(response.roles); +} on StreamChatException catch (e) { + report(e); +} + +// v11 +final result = await client.searchRoles('admin'); +result.fold( + onSuccess: (response) => useRoles(response.roles), + onFailure: (error, _) => report(error), +); +``` + +`getOrDefault`, `getOrNull` and `map` are available when you only want the happy path — see +[Error Handling](#error-handling) for the full `Result` surface. + +**Decoding is stricter.** `SearchRolesResponse` requires `duration` and `roles`; a response omitting +either now fails to decode rather than falling back to `null` and `[]`. `Role` itself is unchanged +field-for-field, and additionally gains `copyWith` and `toJson`. + --- ## Migration Checklist diff --git a/openapi-migration/04-roles-guest-and-app.md b/openapi-migration/04-roles-guest-and-app.md index 2f9caa2861..f0f15b2247 100644 --- a/openapi-migration/04-roles-guest-and-app.md +++ b/openapi-migration/04-roles-guest-and-app.md @@ -2,7 +2,7 @@ **Goal:** Sweep up the singletons — one-method families that share no state and can land in one PR. -**Size:** 4 hand-written method(s) across 3 file(s) → 5 generated operation(s). +**Size:** 3 hand-written method(s) across 2 file(s) → 5 generated operation(s). > Tables are generated by `openapi-migration/tool/generate_plan.py`. Edit the prose, not the tables. @@ -12,7 +12,6 @@ | File | Method | Returns | | --- | --- | --- | -| `roles_api.dart` | `searchRoles` | `SearchRolesResponse` | | `guest_api.dart` | `getGuestUser` | `ConnectGuestUserResponse` | | `general_api.dart` | `enrichUrl` | `OGAttachmentResponse` | | `general_api.dart` | `getAppSettings` | `GetAppSettingsResponse` | @@ -31,6 +30,25 @@ - `AppSettings` is public and hand-shaped; the generated `AppResponseFields` is the wire shape. Keep ours unless the generated one is genuinely better. +## Decisions taken + +- **`Role` and `SearchRolesResponse` are the generated types.** They were field-for-field identical to + ours, so keeping ours meant maintaining two copies of one shape forever. +- **`RoleType` stays hand-written.** `searchRoles(roleType:)` accepts exactly `'user'` or `'channel'` + and the server rejects anything else with a 400, but the v2 spec models `role_type` as an open + string, so there is nothing generated to adopt. It is an `extension type const RoleType(String) + implements String` in `lib/src/core/models/role_type.dart`, following `PushLevel`. + + **This is the precedent for every later group that meets an untyped-but-constrained parameter:** the + absence of a generated type is not a reason to make the public parameter a bare `String`. An + extension type costs nothing — it *is* the string, so it passes straight into the generated query + parameter with no mapper — while keeping the valid values discoverable at the call site. It stays + honest about the wire contract too: the set is open, so a third value the server adds later needs no + SDK release. + + The trade-off, for the record: no `.values`, no exhaustive `switch`, and `RoleType('nonsense')` is + constructible and reaches the wire. That matches the four extension types this package already ships. + ## Risks - `general_api.dart` is split across four groups — only `enrichUrl` and `getAppSettings` belong here. `sync` and `queryMembers` go to group 11, `searchMessages` to group 10. Do not migrate the file as a unit. diff --git a/openapi-migration/11-channels-and-members.md b/openapi-migration/11-channels-and-members.md index ae276ee4f6..ad0cf4c600 100644 --- a/openapi-migration/11-channels-and-members.md +++ b/openapi-migration/11-channels-and-members.md @@ -72,12 +72,7 @@ ## Decisions to make - `ChannelState`, `ChannelModel` and `Member` are public, persisted, and rebuilt from WebSocket events. Keep ours and map. -- **Whether `ChannelModel` promotes its `extraData`-backed flags to real fields.** `disabled`, `hidden`, - `muted`, `blocked` and `truncatedAt` all arrive as root fields on `ChannelResponse` but are pushed into - `extraData` and read back through getters, which the constructor comment calls "for backwards compatibility". - Promoting them is a break worth making in v11 if it is made at all, and it belongs with this group's model - shape rather than with whichever phase happens to add the next flag. Raised on - [#2958](https://github.com/GetStream/stream-chat-flutter/pull/2958). +- **Whether `ChannelModel` promotes its `extraData`-backed flags to real fields.** `disabled`, `hidden`, `muted`, `blocked` and `truncatedAt` all arrive as root fields on `ChannelResponse` but are pushed into `extraData` and read back through getters, which the constructor comment calls "for backwards compatibility". Promoting them is a break worth making in v11 if it is made at all, and it belongs with this group's model shape rather than with whichever phase happens to add the next flag. Raised on [#2958](https://github.com/GetStream/stream-chat-flutter/pull/2958). - `sync` returns `SyncResponse` — one of the two models that needed the WSEvent generator patch. Verify it decodes before relying on it. ## Risks diff --git a/openapi-migration/tool/generate_plan.py b/openapi-migration/tool/generate_plan.py index 4494452f28..052000441f 100644 --- a/openapi-migration/tool/generate_plan.py +++ b/openapi-migration/tool/generate_plan.py @@ -59,6 +59,18 @@ def match(path): return match +DONE = textwrap.dedent("""\ + - [ ] Every method above either routes through `DefaultApi` or is listed here as deliberately left + hand-written, with the reason. + - [ ] Public methods return `Future>`; no `getOrThrow()` inside the SDK. + - [ ] Hand-written request/response DTOs for this group are deleted, or their retention is justified. + - [ ] `melos run analyze` clean, `melos run test:dart` green, persistence tests green if this group + persists anything. + - [ ] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. + - [ ] CHANGELOG entry under `🛑️ Breaking` for each break; PR title `refactor(llc)!:`. + - [ ] Decisions recorded in this file, and the status box ticked in `README.md`. + """) + GROUPS = [ dict( num='02', slug='devices-and-push-preferences', title='Devices & Push Preferences', @@ -93,7 +105,7 @@ def match(path): ), dict( num='04', slug='roles-guest-and-app', title='Roles, Guest & App Settings', - hand=['roles_api.dart', 'guest_api.dart', + hand=['guest_api.dart', 'general_api.dart::enrichUrl', 'general_api.dart::getAppSettings'], match=owns('/api/v2/roles', '/api/v2/guest', '/api/v2/app', '/api/v2/og', '/api/v2/longpoll'), goal='Sweep up the singletons — one-method families that share no state and can land in one PR.', @@ -101,6 +113,24 @@ def match(path): '`AppSettings` is public and hand-shaped; the generated `AppResponseFields` is the wire shape. Keep ' 'ours unless the generated one is genuinely better.', ], + taken=textwrap.dedent("""\ + - **`Role` and `SearchRolesResponse` are the generated types.** They were field-for-field identical to + ours, so keeping ours meant maintaining two copies of one shape forever. + - **`RoleType` stays hand-written.** `searchRoles(roleType:)` accepts exactly `'user'` or `'channel'` + and the server rejects anything else with a 400, but the v2 spec models `role_type` as an open + string, so there is nothing generated to adopt. It is an `extension type const RoleType(String) + implements String` in `lib/src/core/models/role_type.dart`, following `PushLevel`. + + **This is the precedent for every later group that meets an untyped-but-constrained parameter:** the + absence of a generated type is not a reason to make the public parameter a bare `String`. An + extension type costs nothing — it *is* the string, so it passes straight into the generated query + parameter with no mapper — while keeping the valid values discoverable at the call site. It stays + honest about the wire contract too: the set is open, so a third value the server adds later needs no + SDK release. + + The trade-off, for the record: no `.values`, no exhaustive `switch`, and `RoleType('nonsense')` is + constructible and reaches the wire. That matches the four extension types this package already ships. + """), risks=[ '`general_api.dart` is split across four groups — only `enrichUrl` and `getAppSettings` belong here. ' '`sync` and `queryMembers` go to group 11, `searchMessages` to group 10. Do not migrate the file as a ' @@ -221,6 +251,13 @@ def match(path): decisions=[ '`ChannelState`, `ChannelModel` and `Member` are public, persisted, and rebuilt from WebSocket ' 'events. Keep ours and map.', + '**Whether `ChannelModel` promotes its `extraData`-backed flags to real fields.** `disabled`, ' + '`hidden`, `muted`, `blocked` and `truncatedAt` all arrive as root fields on `ChannelResponse` but ' + 'are pushed into `extraData` and read back through getters, which the constructor comment calls ' + '"for backwards compatibility". Promoting them is a break worth making in v11 if it is made at ' + 'all, and it belongs with this group\'s model shape rather than with whichever phase happens to ' + 'add the next flag. Raised on ' + '[#2958](https://github.com/GetStream/stream-chat-flutter/pull/2958).', '`sync` returns `SyncResponse` — one of the two models that needed the WSEvent generator patch. ' 'Verify it decodes before relying on it.', ], @@ -267,17 +304,6 @@ def match(path): ), ] -DONE = textwrap.dedent("""\ - - [ ] Every method above either routes through `DefaultApi` or is listed here as deliberately left - hand-written, with the reason. - - [ ] Public methods return `Future>`; no `getOrThrow()` inside the SDK. - - [ ] Hand-written request/response DTOs for this group are deleted, or their retention is justified. - - [ ] `melos run analyze` clean, `melos run test:dart` green, persistence tests green if this group - persists anything. - - [ ] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. - - [ ] CHANGELOG entry under `🛑️ Breaking` for each break; PR title `refactor(llc)!:`. - - [ ] Decisions recorded in this file, and the status box ticked in `README.md`. - """) def hand_for(group, hand): @@ -313,12 +339,16 @@ def render(g, hand, ops): '| Verb | Path | Operation | Response |', '| --- | --- | --- | --- |'] L += [f'| `{verb}` | `{path}` | `{name}` | `{ret}` |' for verb, path, ret, name in [(v, p, r, n) for v, p, r, n in gops]] - L.append('\n## Decisions to make\n') - L += [f'- {d}' for d in g['decisions']] + if g['decisions']: + L.append('\n## Decisions to make\n') + L += [f'- {d}' for d in g['decisions']] + if g.get('taken'): + L.append('\n## Decisions taken\n') + L.append(g['taken'].strip()) L.append('\n## Risks\n') L += [f'- {r}' for r in g['risks']] L.append('\n## Definition of done\n') - L.append(DONE) + L.append(g.get('done', DONE)) return '\n'.join(L) diff --git a/packages/stream_chat/CHANGELOG.md b/packages/stream_chat/CHANGELOG.md index bc3fc646a8..d274140265 100644 --- a/packages/stream_chat/CHANGELOG.md +++ b/packages/stream_chat/CHANGELOG.md @@ -44,6 +44,8 @@ - `client.wsConnectionStatus` and `wsConnectionStatusStream` become `connectionStatus` and `connectionStatusStream`. `ConnectionStatus` keeps its three values, and a client that has never connected still reads as `disconnected`. - The WebSocket's state — `Connected`, `Connecting`, `Authenticating`, `Disconnected` and the disconnection sources — is no longer exported, and the client no longer reports it. `ConnectionStatus` is the whole connection API, as on the other Stream SDKs. - `StreamHttpClient` and `StreamChatApi` take a `ConnectionIdGetter? connectionId` where they took a `ConnectionIdManager?`. The manager only wrapped such a closure, and is removed. +- `Role` and `SearchRolesResponse` are the OpenAPI-generated types. `Role` gains `copyWith` and `toJson`, and a response missing `duration` or `roles` now fails to decode instead of defaulting. +- `StreamChatClient.searchRoles` returns a `Result` instead of throwing. 🐞 Fixed diff --git a/packages/stream_chat/lib/src/client/client.dart b/packages/stream_chat/lib/src/client/client.dart index c32e89ce6f..713c458e41 100644 --- a/packages/stream_chat/lib/src/client/client.dart +++ b/packages/stream_chat/lib/src/client/client.dart @@ -5,10 +5,19 @@ import 'package:meta/meta.dart'; import 'package:rxdart/rxdart.dart'; import 'package:stream_core/stream_core.dart' show + ApiErrorInterceptor, + ApiKeyInterceptor, + AuthInterceptor, + ConnectionIdInterceptor, CurrentPlatform, + HeadersInterceptor, InFlightCache, LocationCoordinate, + LoggingInterceptor, + Result, SortedListExtensions, + Standard, + StreamCoreHttpClient, StreamLogConfig, StreamLogger, SystemEnvironment, @@ -20,6 +29,7 @@ import 'package:stream_core/stream_core.dart' WsEvent; import 'package:synchronized/synchronized.dart'; +import '../../open_api/api.dart' show DefaultApi, SearchRolesResponse; import '../../version.dart'; import '../core/api/attachment_file_uploader.dart'; import '../core/api/requests.dart'; @@ -27,6 +37,7 @@ import '../core/api/responses.dart'; import '../core/api/stream_chat_api.dart'; import '../core/error/stream_chat_exception.dart'; import '../core/http/app_settings_manager.dart'; +import '../core/http/interceptor/additional_headers_interceptor.dart'; import '../core/http/stream_http_client.dart'; import '../core/models/app_settings.dart'; import '../core/models/attachment_file.dart'; @@ -45,7 +56,7 @@ import '../core/models/poll_option.dart'; import '../core/models/poll_vote.dart'; import '../core/models/push_preference.dart'; import '../core/models/reaction.dart'; -import '../core/models/role.dart'; +import '../core/models/role_type.dart'; import '../core/models/thread.dart'; import '../core/models/user.dart'; import '../core/util/event_controller.dart'; @@ -54,6 +65,7 @@ import '../core/util/immutable_collection_subjects.dart'; import '../core/util/utils.dart'; import '../db/chat_persistence_client.dart'; import '../event_type.dart'; +import '../repository/roles_repository.dart'; import '../ws/connect_request.dart'; import '../ws/connection_manager.dart'; import '../ws/connection_status.dart'; @@ -93,6 +105,7 @@ class StreamChatClient { Duration connectTimeout = kDefaultConnectTimeout, Duration receiveTimeout = kDefaultReceiveTimeout, StreamChatApi? chatApi, + DefaultApi? defaultApi, @visibleForTesting WebSocketProvider? wsProvider, AttachmentFileUploaderProvider attachmentFileUploaderProvider = StreamAttachmentFileUploader.new, Iterable? chatApiInterceptors, @@ -123,6 +136,32 @@ class StreamChatClient { httpClientAdapter: httpClientAdapter, ); + // Interceptors are added after construction because `AuthInterceptor` + // replays requests through the client it is given. + httpClient = + StreamCoreHttpClient( + options: BaseOptions( + baseUrl: options.baseUrl, + connectTimeout: options.connectTimeout, + receiveTimeout: options.receiveTimeout, + queryParameters: options.queryParameters, + headers: options.headers, + ), + httpClientAdapter: httpClientAdapter, + ).apply( + (client) => client.interceptors.addAll([ + ApiKeyInterceptor(apiKey), + const AdditionalHeadersInterceptor(), + HeadersInterceptor(_systemEnvironmentManager), + AuthInterceptor(client, _tokenManager, tag: 'SCh:HttpAuth'), + ConnectionIdInterceptor(() => _connection.connectionId), + const ApiErrorInterceptor(), + ...chatApiInterceptors ?? [LoggingInterceptor(requestHeader: true, tag: 'SCh:Http')], + ]), + ); + + _rolesRepository = RolesRepository(defaultApi ?? DefaultApi(httpClient)); + _connection = ConnectionManager( request: ConnectRequest.forApi( apiKey: apiKey, @@ -155,12 +194,18 @@ class StreamChatClient { } late final StreamChatApi _chatApi; + late final RolesRepository _rolesRepository; late final ConnectionManager _connection; StreamSubscription? _wsEventSubscription; // Whether the open connection has an id to name on the requests that need one. bool get _hasConnectionId => _connection.connectionId != null; + /// The [Dio] the generated api client runs on, separate from the one + /// [StreamChatApi] holds for the hand-written wrappers. + @visibleForTesting + late final StreamCoreHttpClient httpClient; + /// This client state late ClientState state; @@ -2431,13 +2476,13 @@ class StreamChatClient { /// /// [includeGlobalRoles] includes roles prefixed `global_` when set to /// `true`. Defaults to `false`. - Future searchRoles( + Future> searchRoles( String query, { int? limit, String? nameGt, RoleType? roleType, bool? includeGlobalRoles, - }) => _chatApi.roles.searchRoles( + }) => _rolesRepository.searchRoles( query, limit: limit, nameGt: nameGt, @@ -2480,6 +2525,7 @@ class StreamChatClient { await _wsEventSubscription?.cancel(); await _connection.dispose(); await _eventController.close(); + httpClient.close(); await _connectionStatusSubscription?.cancel(); } } diff --git a/packages/stream_chat/lib/src/core/api/responses.dart b/packages/stream_chat/lib/src/core/api/responses.dart index 33a7f87cbc..ad8663df8e 100644 --- a/packages/stream_chat/lib/src/core/api/responses.dart +++ b/packages/stream_chat/lib/src/core/api/responses.dart @@ -18,7 +18,6 @@ import '../models/predefined_filter.dart'; import '../models/push_preference.dart'; import '../models/reaction.dart'; import '../models/read.dart'; -import '../models/role.dart'; import '../models/thread.dart'; import '../models/unread_counts.dart'; import '../models/user.dart'; @@ -881,17 +880,6 @@ class RemoveUserGroupMembersResponse extends _BaseResponse { _$RemoveUserGroupMembersResponseFromJson(json); } -/// Model response for [StreamChatClient.searchRoles] api call -@JsonSerializable(createToJson: false) -class SearchRolesResponse extends _BaseResponse { - /// List of roles returned by the api call - @JsonKey(defaultValue: []) - late List roles; - - /// Create a new instance from a json - static SearchRolesResponse fromJson(Map json) => _$SearchRolesResponseFromJson(json); -} - /// Model response for [StreamChatClient.getAppSettings] api call. @JsonSerializable(createToJson: false) class GetAppSettingsResponse extends _BaseResponse { diff --git a/packages/stream_chat/lib/src/core/api/responses.g.dart b/packages/stream_chat/lib/src/core/api/responses.g.dart index fccce9b6da..d22cca4c50 100644 --- a/packages/stream_chat/lib/src/core/api/responses.g.dart +++ b/packages/stream_chat/lib/src/core/api/responses.g.dart @@ -461,10 +461,6 @@ RemoveUserGroupMembersResponse _$RemoveUserGroupMembersResponseFromJson( ..duration = json['duration'] as String? ..userGroup = UserGroup.fromJson(json['user_group'] as Map); -SearchRolesResponse _$SearchRolesResponseFromJson(Map json) => SearchRolesResponse() - ..duration = json['duration'] as String? - ..roles = (json['roles'] as List?)?.map((e) => Role.fromJson(e as Map)).toList() ?? []; - GetAppSettingsResponse _$GetAppSettingsResponseFromJson( Map json, ) => GetAppSettingsResponse() diff --git a/packages/stream_chat/lib/src/core/api/roles_api.dart b/packages/stream_chat/lib/src/core/api/roles_api.dart deleted file mode 100644 index 46350afffd..0000000000 --- a/packages/stream_chat/lib/src/core/api/roles_api.dart +++ /dev/null @@ -1,39 +0,0 @@ -import '../http/stream_http_client.dart'; -import '../models/role.dart'; -import 'responses.dart'; - -/// Defines the API dedicated to roles operations. -class RolesApi { - /// Initialize a new roles API. - const RolesApi(this._client); - - final StreamHttpClient _client; - - /// Searches roles by name prefix (autocomplete). - /// - /// [roleType] filters to user-assignable ([RoleType.user]) or - /// channel-assignable ([RoleType.channel]) roles when set; both kinds are - /// returned when omitted. - /// - /// [includeGlobalRoles] includes roles prefixed `global_` when set to - /// `true`. Defaults to `false` on the server. - Future searchRoles( - String query, { - int? limit, - String? nameGt, - RoleType? roleType, - bool? includeGlobalRoles, - }) async { - final response = await _client.get( - '/roles/search', - queryParameters: { - 'query': query, - if (limit != null) 'limit': limit, - if (nameGt != null) 'name_gt': nameGt, - if (roleType != null) 'role_type': roleType, - if (includeGlobalRoles != null) 'include_global_roles': includeGlobalRoles, - }, - ); - return SearchRolesResponse.fromJson(response.data); - } -} diff --git a/packages/stream_chat/lib/src/core/api/stream_chat_api.dart b/packages/stream_chat/lib/src/core/api/stream_chat_api.dart index dd6a323572..fd22c622d8 100644 --- a/packages/stream_chat/lib/src/core/api/stream_chat_api.dart +++ b/packages/stream_chat/lib/src/core/api/stream_chat_api.dart @@ -11,7 +11,6 @@ import 'message_api.dart'; import 'moderation_api.dart'; import 'polls_api.dart'; import 'reminders_api.dart'; -import 'roles_api.dart'; import 'threads_api.dart'; import 'user_api.dart'; import 'user_groups_api.dart'; @@ -87,10 +86,6 @@ class StreamChatApi { UserGroupsApi get userGroups => _userGroups ??= UserGroupsApi(_client); UserGroupsApi? _userGroups; - /// Api dedicated to roles operations - RolesApi get roles => _roles ??= RolesApi(_client); - RolesApi? _roles; - /// Api dedicated to general operations GeneralApi get general => _general ??= GeneralApi(_client); GeneralApi? _general; diff --git a/packages/stream_chat/lib/src/core/models/role.dart b/packages/stream_chat/lib/src/core/models/role.dart deleted file mode 100644 index 8e26b70371..0000000000 --- a/packages/stream_chat/lib/src/core/models/role.dart +++ /dev/null @@ -1,59 +0,0 @@ -import 'package:equatable/equatable.dart'; -import 'package:json_annotation/json_annotation.dart'; - -part 'role.g.dart'; - -/// Class that defines a role. -@JsonSerializable(createToJson: false) -class Role extends Equatable { - /// Create a new instance of [Role]. - const Role({ - required this.createdAt, - required this.custom, - required this.name, - required this.scopes, - required this.updatedAt, - }); - - /// Create a new instance from a json. - factory Role.fromJson(Map json) => _$RoleFromJson(json); - - /// The date when the role was created. - final DateTime createdAt; - - /// Whether the role is a custom role (true) or a built-in role (false). - final bool custom; - - /// The unique name of the role. - final String name; - - /// The list of permission-grant scopes the role currently appears in. - final List scopes; - - /// The date when the role was last updated. - final DateTime updatedAt; - - @override - List get props => [ - createdAt, - custom, - name, - scopes, - updatedAt, - ]; -} - -/// The type of role used to filter results in -/// [StreamChatClient.searchRoles]. -/// -/// The server accepts only [user] or [channel]; any other value -/// returns a validation error. -extension type const RoleType(String rawType) implements String { - /// Restricts results to roles valid as a user-level assignment - /// (e.g. `user`, `admin`, `anonymous`). - static const user = RoleType('user'); - - /// Restricts results to roles valid as a channel-member assignment - /// (e.g. `channel_member`, `channel_moderator`). - static const channel = RoleType('channel'); -} diff --git a/packages/stream_chat/lib/src/core/models/role.g.dart b/packages/stream_chat/lib/src/core/models/role.g.dart deleted file mode 100644 index 69f3379d19..0000000000 --- a/packages/stream_chat/lib/src/core/models/role.g.dart +++ /dev/null @@ -1,15 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'role.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -Role _$RoleFromJson(Map json) => Role( - createdAt: DateTime.parse(json['created_at'] as String), - custom: json['custom'] as bool, - name: json['name'] as String, - scopes: (json['scopes'] as List).map((e) => e as String).toList(), - updatedAt: DateTime.parse(json['updated_at'] as String), -); diff --git a/packages/stream_chat/lib/src/core/models/role_type.dart b/packages/stream_chat/lib/src/core/models/role_type.dart new file mode 100644 index 0000000000..026d82dffc --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/role_type.dart @@ -0,0 +1,14 @@ +/// The type of role used to filter results in +/// [StreamChatClient.searchRoles]. +/// +/// The server accepts only [user] or [channel]; any other value +/// returns a validation error. +extension type const RoleType(String rawType) implements String { + /// Restricts results to roles valid as a user-level assignment + /// (e.g. `user`, `admin`, `anonymous`). + static const user = RoleType('user'); + + /// Restricts results to roles valid as a channel-member assignment + /// (e.g. `channel_member`, `channel_moderator`). + static const channel = RoleType('channel'); +} diff --git a/packages/stream_chat/lib/src/repository/roles_repository.dart b/packages/stream_chat/lib/src/repository/roles_repository.dart new file mode 100644 index 0000000000..aa5095b3eb --- /dev/null +++ b/packages/stream_chat/lib/src/repository/roles_repository.dart @@ -0,0 +1,35 @@ +import 'package:stream_core/stream_core.dart' show Result; + +import '../../open_api/api.dart' show DefaultApi; +import '../../open_api/models.dart' show SearchRolesResponse; +import '../core/models/role_type.dart'; + +/// Repository dedicated to roles operations. +class RolesRepository { + /// Initialize a new roles repository. + const RolesRepository(this._api); + + final DefaultApi _api; + + /// Searches roles by name prefix (autocomplete). + /// + /// [roleType] filters to user-assignable ([RoleType.user]) or + /// channel-assignable ([RoleType.channel]) roles when set; both kinds are + /// returned when omitted. + /// + /// [includeGlobalRoles] includes roles prefixed `global_` when set to + /// `true`. Defaults to `false` on the server. + Future> searchRoles( + String query, { + int? limit, + String? nameGt, + RoleType? roleType, + bool? includeGlobalRoles, + }) => _api.searchRoles( + query: query, + limit: limit, + nameGt: nameGt, + roleType: roleType, + includeGlobalRoles: includeGlobalRoles, + ); +} diff --git a/packages/stream_chat/lib/stream_chat.dart b/packages/stream_chat/lib/stream_chat.dart index 2ed3dd470e..966122050c 100644 --- a/packages/stream_chat/lib/stream_chat.dart +++ b/packages/stream_chat/lib/stream_chat.dart @@ -66,6 +66,8 @@ export 'package:stream_core/stream_core.dart' export 'package:uuid/uuid.dart'; +export 'open_api/models.dart' show Role, SearchRolesResponse; + export 'src/client/channel/channel.dart'; export 'src/client/channel/channel_capability_check.dart'; export 'src/client/channel/channel_client_state.dart'; @@ -117,7 +119,7 @@ export 'src/core/models/push_preference.dart'; export 'src/core/models/reaction.dart'; export 'src/core/models/reaction_group.dart'; export 'src/core/models/read.dart'; -export 'src/core/models/role.dart'; +export 'src/core/models/role_type.dart'; export 'src/core/models/thread.dart'; export 'src/core/models/thread_participant.dart'; export 'src/core/models/unread_counts.dart'; diff --git a/packages/stream_chat/test/src/client/client_test.dart b/packages/stream_chat/test/src/client/client_test.dart index 4dda5649c4..e7845c435f 100644 --- a/packages/stream_chat/test/src/client/client_test.dart +++ b/packages/stream_chat/test/src/client/client_test.dart @@ -1180,6 +1180,7 @@ void main() { const apiKey = 'test-api-key'; const userId = 'test-user-id'; late final api = FakeChatApi(); + late final defaultApi = MockDefaultApi(); final user = User(id: userId); final token = testUserToken(user.id).rawValue; @@ -1201,7 +1202,7 @@ void main() { clearInteractions(api.general); final ws = FakeChatServer(); - client = StreamChatClient(apiKey, chatApi: api, wsProvider: ws.connect); + client = StreamChatClient(apiKey, chatApi: api, defaultApi: defaultApi, wsProvider: ws.connect); // Stub getAppSettings so the background fetch after connectUser succeeds. when(() => api.general.getAppSettings()).thenAnswer( (_) async => GetAppSettingsResponse()..app = const AppSettings(name: 'test'), @@ -2281,14 +2282,16 @@ void main() { const includeGlobalRoles = true; when( - () => api.roles.searchRoles( - query, + () => defaultApi.searchRoles( + query: query, limit: limit, nameGt: nameGt, roleType: roleType, includeGlobalRoles: includeGlobalRoles, ), - ).thenAnswer((_) async => SearchRolesResponse()..roles = const []); + ).thenAnswer( + (_) async => const Result.success(SearchRolesResponse(duration: '0.01ms', roles: [])), + ); final res = await client.searchRoles( query, @@ -2297,18 +2300,32 @@ void main() { roleType: roleType, includeGlobalRoles: includeGlobalRoles, ); - expect(res, isNotNull); + expect(res, const Result.success(SearchRolesResponse(duration: '0.01ms', roles: []))); verify( - () => api.roles.searchRoles( - query, + () => defaultApi.searchRoles( + query: query, limit: limit, nameGt: nameGt, roleType: roleType, includeGlobalRoles: includeGlobalRoles, ), ).called(1); - verifyNoMoreInteractions(api.roles); + verifyNoMoreInteractions(defaultApi); + }); + + test('`.searchRoles` surfaces a failure without throwing', () async { + const query = 'adm'; + const error = StreamClientException(message: 'boom'); + + when( + () => defaultApi.searchRoles(query: query), + ).thenAnswer((_) async => const Result.failure(error)); + + final res = await client.searchRoles(query); + + expect(res.isFailure, isTrue); + expect(res.exceptionOrNull(), error); }); group('`.channel`', () { diff --git a/packages/stream_chat/test/src/core/api/responses_test.dart b/packages/stream_chat/test/src/core/api/responses_test.dart index f2a92a8808..b8571dd186 100644 --- a/packages/stream_chat/test/src/core/api/responses_test.dart +++ b/packages/stream_chat/test/src/core/api/responses_test.dart @@ -4731,45 +4731,5 @@ void main() { expect(group.createdAt, DateTime.parse('2024-01-01T00:00:00Z')); expect(group.updatedAt, DateTime.parse('2024-01-04T00:00:00Z')); }); - - test('SearchRolesResponse', () { - const jsonExample = ''' - { - "roles": [ - { - "name": "admin", - "custom": false, - "scopes": [".app"], - "created_at": "2024-01-01T00:00:00Z", - "updated_at": "2024-01-02T00:00:00Z" - }, - { - "name": "custom_moderator", - "custom": true, - "scopes": [".app", "messaging"], - "created_at": "2024-01-03T00:00:00Z", - "updated_at": "2024-01-04T00:00:00Z" - } - ], - "duration": "0.35ms" - }'''; - final response = SearchRolesResponse.fromJson(json.decode(jsonExample)); - expect(response.roles, isA>()); - expect(response.roles, hasLength(2)); - - final first = response.roles.first; - expect(first.name, 'admin'); - expect(first.custom, isFalse); - expect(first.scopes, ['.app']); - expect(first.createdAt, DateTime.parse('2024-01-01T00:00:00Z')); - expect(first.updatedAt, DateTime.parse('2024-01-02T00:00:00Z')); - - final last = response.roles.last; - expect(last.name, 'custom_moderator'); - expect(last.custom, isTrue); - expect(last.scopes, ['.app', 'messaging']); - expect(last.createdAt, DateTime.parse('2024-01-03T00:00:00Z')); - expect(last.updatedAt, DateTime.parse('2024-01-04T00:00:00Z')); - }); }); } diff --git a/packages/stream_chat/test/src/core/api/roles_api_test.dart b/packages/stream_chat/test/src/core/api/roles_api_test.dart deleted file mode 100644 index 2f9f4cdf96..0000000000 --- a/packages/stream_chat/test/src/core/api/roles_api_test.dart +++ /dev/null @@ -1,100 +0,0 @@ -// ignore_for_file: avoid_redundant_argument_values - -import 'package:dio/dio.dart'; -import 'package:mocktail/mocktail.dart'; -import 'package:stream_chat/src/core/api/roles_api.dart'; -import 'package:stream_chat/src/core/models/role.dart'; -import 'package:test/test.dart'; - -import '../../mocks.dart'; - -void main() { - Response successResponse(String path, {Object? data}) => Response( - data: data, - requestOptions: RequestOptions(path: path), - statusCode: 200, - ); - - Map roleJson({ - String name = 'admin', - bool custom = false, - List scopes = const ['.app'], - }) => { - 'name': name, - 'custom': custom, - 'scopes': scopes, - 'created_at': '2024-01-01T00:00:00Z', - 'updated_at': '2024-01-02T00:00:00Z', - }; - - late final client = MockHttpClient(); - late RolesApi rolesApi; - - setUp(() { - rolesApi = RolesApi(client); - }); - - group('searchRoles', () { - test('should search with query only', () async { - const path = '/roles/search'; - const query = 'admin'; - - when(() => client.get(path, queryParameters: {'query': query})).thenAnswer( - (_) async => successResponse(path, data: {'roles': []}), - ); - - final res = await rolesApi.searchRoles(query); - - expect(res, isNotNull); - expect(res.roles, isEmpty); - - verify(() => client.get(path, queryParameters: {'query': query})).called(1); - verifyNoMoreInteractions(client); - }); - - test('should search with all parameters', () async { - const path = '/roles/search'; - const query = 'adm'; - const limit = 10; - const nameGt = 'admin'; - const roleType = RoleType.user; - const includeGlobalRoles = true; - - final expectedQueryParameters = { - 'query': query, - 'limit': limit, - 'name_gt': nameGt, - 'role_type': roleType, - 'include_global_roles': includeGlobalRoles, - }; - - when(() => client.get(path, queryParameters: expectedQueryParameters)).thenAnswer( - (_) async => successResponse( - path, - data: { - 'roles': [ - roleJson(name: 'admin', custom: true, scopes: const ['.app', 'messaging']), - ], - }, - ), - ); - - final res = await rolesApi.searchRoles( - query, - limit: limit, - nameGt: nameGt, - roleType: roleType, - includeGlobalRoles: includeGlobalRoles, - ); - - expect(res, isNotNull); - expect(res.roles, hasLength(1)); - expect(res.roles.first.name, 'admin'); - expect(res.roles.first.custom, isTrue); - expect(res.roles.first.scopes, ['.app', 'messaging']); - - verify(() => client.get(path, queryParameters: expectedQueryParameters)).called(1); - verifyNoMoreInteractions(client); - }); - }); -} diff --git a/packages/stream_chat/test/src/core/models/role_test.dart b/packages/stream_chat/test/src/core/models/role_test.dart deleted file mode 100644 index 8aa46bad00..0000000000 --- a/packages/stream_chat/test/src/core/models/role_test.dart +++ /dev/null @@ -1,29 +0,0 @@ -import 'package:stream_chat/src/core/models/role.dart'; -import 'package:test/test.dart'; - -void main() { - group('src/models/role', () { - test('should parse json correctly', () { - final role = Role.fromJson(const { - 'name': 'custom_moderator', - 'custom': true, - 'scopes': ['.app', 'messaging', 'livestream'], - 'created_at': '2024-01-01T00:00:00Z', - 'updated_at': '2024-01-02T00:00:00Z', - }); - - expect(role.name, 'custom_moderator'); - expect(role.custom, isTrue); - expect(role.scopes, ['.app', 'messaging', 'livestream']); - expect(role.createdAt, DateTime.parse('2024-01-01T00:00:00Z')); - expect(role.updatedAt, DateTime.parse('2024-01-02T00:00:00Z')); - }); - }); - - group('src/models/role_type', () { - test('constants resolve to expected wire strings', () { - expect(RoleType.user, 'user'); - expect(RoleType.channel, 'channel'); - }); - }); -} diff --git a/packages/stream_chat/test/src/core/models/role_type_test.dart b/packages/stream_chat/test/src/core/models/role_type_test.dart new file mode 100644 index 0000000000..f977cc62e6 --- /dev/null +++ b/packages/stream_chat/test/src/core/models/role_type_test.dart @@ -0,0 +1,25 @@ +import 'package:stream_chat/stream_chat.dart' show RoleType; +import 'package:test/test.dart'; + +void main() { + group('src/models/role_type', () { + test('should carry its wire value', () { + expect(RoleType.user, 'user'); + expect(RoleType.channel, 'channel'); + }); + + test('should interchange with a raw string', () { + const raw = 'user'; + + expect(RoleType.user, raw); + expect(RoleType.user.rawType, raw); + expect([RoleType.user, RoleType.channel], ['user', 'channel']); + }); + + test('should accept a value the SDK does not name', () { + const unknown = RoleType('team'); + + expect(unknown, 'team'); + }); + }); +} diff --git a/packages/stream_chat/test/src/fakes.dart b/packages/stream_chat/test/src/fakes.dart index a830fcf313..2c362f5b87 100644 --- a/packages/stream_chat/test/src/fakes.dart +++ b/packages/stream_chat/test/src/fakes.dart @@ -8,7 +8,6 @@ import 'package:stream_chat/src/core/api/guest_api.dart'; import 'package:stream_chat/src/core/api/message_api.dart'; import 'package:stream_chat/src/core/api/moderation_api.dart'; import 'package:stream_chat/src/core/api/polls_api.dart'; -import 'package:stream_chat/src/core/api/roles_api.dart'; import 'package:stream_chat/src/core/api/user_api.dart'; import 'package:stream_chat/src/core/api/user_groups_api.dart'; import 'package:stream_chat/stream_chat.dart'; @@ -166,11 +165,6 @@ class FakeChatApi extends Fake implements StreamChatApi { @override UserGroupsApi get userGroups => _userGroups ??= MockUserGroupsApi(); - RolesApi? _roles; - - @override - RolesApi get roles => _roles ??= MockRolesApi(); - GeneralApi? _general; @override diff --git a/packages/stream_chat/test/src/mocks.dart b/packages/stream_chat/test/src/mocks.dart index 67983ff020..e5b9e9c5fd 100644 --- a/packages/stream_chat/test/src/mocks.dart +++ b/packages/stream_chat/test/src/mocks.dart @@ -1,5 +1,6 @@ import 'package:dio/dio.dart'; import 'package:mocktail/mocktail.dart'; +import 'package:stream_chat/open_api/api.dart'; import 'package:stream_chat/src/client/channel/channel.dart'; import 'package:stream_chat/src/client/channel_delivery_reporter.dart'; import 'package:stream_chat/src/client/client.dart'; @@ -11,7 +12,6 @@ import 'package:stream_chat/src/core/api/guest_api.dart'; import 'package:stream_chat/src/core/api/message_api.dart'; import 'package:stream_chat/src/core/api/moderation_api.dart'; import 'package:stream_chat/src/core/api/polls_api.dart'; -import 'package:stream_chat/src/core/api/roles_api.dart'; import 'package:stream_chat/src/core/api/user_api.dart'; import 'package:stream_chat/src/core/api/user_groups_api.dart'; import 'package:stream_chat/src/core/http/stream_http_client.dart'; @@ -59,7 +59,7 @@ class MockModerationApi extends Mock implements ModerationApi {} class MockUserGroupsApi extends Mock implements UserGroupsApi {} -class MockRolesApi extends Mock implements RolesApi {} +class MockDefaultApi extends Mock implements DefaultApi {} class MockGeneralApi extends Mock implements GeneralApi {} diff --git a/packages/stream_chat/test/src/repository/roles_repository_test.dart b/packages/stream_chat/test/src/repository/roles_repository_test.dart new file mode 100644 index 0000000000..78f9ae89d8 --- /dev/null +++ b/packages/stream_chat/test/src/repository/roles_repository_test.dart @@ -0,0 +1,84 @@ +// ignore_for_file: avoid_redundant_argument_values + +import 'package:mocktail/mocktail.dart'; +import 'package:stream_chat/open_api/api.dart'; +import 'package:stream_chat/src/core/models/role_type.dart'; +import 'package:stream_chat/src/repository/roles_repository.dart'; +import 'package:stream_core/stream_core.dart'; +import 'package:test/test.dart'; + +import '../mocks.dart'; + +void main() { + late MockDefaultApi api; + late RolesRepository repository; + + Role role(String name) => Role( + name: name, + custom: false, + scopes: const ['.app'], + createdAt: DateTime.utc(2024), + updatedAt: DateTime.utc(2024), + ); + + setUp(() { + api = MockDefaultApi(); + repository = RolesRepository(api); + }); + + test('should forward only the query when nothing else is passed', () async { + when(() => api.searchRoles(query: 'adm')).thenAnswer( + (_) async => const Result.success(SearchRolesResponse(duration: '0.01ms', roles: [])), + ); + + final res = await repository.searchRoles('adm'); + + expect(res.getOrNull()?.roles, isEmpty); + verify(() => api.searchRoles(query: 'adm')).called(1); + verifyNoMoreInteractions(api); + }); + + test('should forward every parameter to the generated client', () async { + when( + () => api.searchRoles( + query: 'adm', + limit: 10, + nameGt: 'admin', + roleType: RoleType.user, + includeGlobalRoles: true, + ), + ).thenAnswer( + (_) async => Result.success(SearchRolesResponse(duration: '0.01ms', roles: [role('admin')])), + ); + + final res = await repository.searchRoles( + 'adm', + limit: 10, + nameGt: 'admin', + roleType: RoleType.user, + includeGlobalRoles: true, + ); + + expect(res.getOrNull()?.roles.single.name, 'admin'); + verify( + () => api.searchRoles( + query: 'adm', + limit: 10, + nameGt: 'admin', + roleType: RoleType.user, + includeGlobalRoles: true, + ), + ).called(1); + verifyNoMoreInteractions(api); + }); + + test('should return the failure without throwing', () async { + const error = StreamClientException(message: 'boom'); + when(() => api.searchRoles(query: 'adm')).thenAnswer((_) async => const Result.failure(error)); + + final res = await repository.searchRoles('adm'); + + expect(res.isFailure, isTrue); + expect(res.exceptionOrNull(), error); + }); +} diff --git a/packages/stream_chat_flutter/lib/src/autocomplete/stream_mention_autocomplete_options.dart b/packages/stream_chat_flutter/lib/src/autocomplete/stream_mention_autocomplete_options.dart index 979ad82b6f..2cf4ba22dd 100644 --- a/packages/stream_chat_flutter/lib/src/autocomplete/stream_mention_autocomplete_options.dart +++ b/packages/stream_chat_flutter/lib/src/autocomplete/stream_mention_autocomplete_options.dart @@ -221,12 +221,8 @@ class _StreamMentionAutocompleteOptionsState extends State> _fetchRoles(String query) async { if (query.isEmpty || !widget.channel.canNotifyRole) return const []; - try { - final response = await widget.channel.client.searchRoles(query); - return response.roles; - } catch (_) { - return const []; - } + final result = await widget.channel.client.searchRoles(query); + return result.map((it) => it.roles).getOrDefault(const []); } Future> _fetchUserGroups(String query) async { diff --git a/packages/stream_chat_flutter/test/src/autocomplete/stream_mention_autocomplete_options_test.dart b/packages/stream_chat_flutter/test/src/autocomplete/stream_mention_autocomplete_options_test.dart index 4f61e1b118..fafb662ba3 100644 --- a/packages/stream_chat_flutter/test/src/autocomplete/stream_mention_autocomplete_options_test.dart +++ b/packages/stream_chat_flutter/test/src/autocomplete/stream_mention_autocomplete_options_test.dart @@ -294,7 +294,7 @@ void main() { ); when( () => mocks.client.searchRoles(any()), - ).thenAnswer((_) async => SearchRolesResponse()..roles = []); + ).thenAnswer((_) async => const Result.success(SearchRolesResponse(duration: '0.01ms', roles: []))); await _pumpMentionOptions( tester, @@ -313,7 +313,7 @@ void main() { final mocks = _setupMocks(ownCapabilities: const []); when( () => mocks.client.searchRoles(any()), - ).thenAnswer((_) async => SearchRolesResponse()..roles = []); + ).thenAnswer((_) async => const Result.success(SearchRolesResponse(duration: '0.01ms', roles: []))); await _pumpMentionOptions( tester, @@ -333,7 +333,7 @@ void main() { ownCapabilities: const [ChannelCapability.notifyRole], ); when(() => mocks.client.searchRoles('admin')).thenAnswer( - (_) async => SearchRolesResponse()..roles = [buildRole('admin')], + (_) async => Result.success(SearchRolesResponse(duration: '0.01ms', roles: [buildRole('admin')])), ); await _pumpMentionOptions( @@ -349,7 +349,7 @@ void main() { ); testWidgets( - 'searchRoles error is swallowed and does not blank the list', + 'searchRoles failure is swallowed and does not blank the list', (tester) async { final mocks = _setupMocks( ownCapabilities: const [ @@ -357,9 +357,9 @@ void main() { ChannelCapability.notifyChannel, ], ); - when( - () => mocks.client.searchRoles(any()), - ).thenThrow(StateError('test error')); + when(() => mocks.client.searchRoles(any())).thenAnswer( + (_) async => const Result.failure(StreamClientException(message: 'test error')), + ); await _pumpMentionOptions( tester, @@ -784,16 +784,20 @@ void main() { ], ); when(() => mocks.client.searchRoles('h')).thenAnswer( - (_) async => SearchRolesResponse() - ..roles = [ - Role( - name: 'host', - custom: false, - scopes: const [], - createdAt: DateTime.utc(2024), - updatedAt: DateTime.utc(2024), - ), - ], + (_) async => Result.success( + SearchRolesResponse( + duration: '0.01ms', + roles: [ + Role( + name: 'host', + custom: false, + scopes: const [], + createdAt: DateTime.utc(2024), + updatedAt: DateTime.utc(2024), + ), + ], + ), + ), ); when( () => mocks.client.searchUserGroups('h', teamId: any(named: 'teamId')), @@ -867,16 +871,20 @@ void main() { ], ); when(() => mocks.client.searchRoles('h')).thenAnswer( - (_) async => SearchRolesResponse() - ..roles = [ - Role( - name: 'host', - custom: false, - scopes: const [], - createdAt: DateTime.utc(2024), - updatedAt: DateTime.utc(2024), - ), - ], + (_) async => Result.success( + SearchRolesResponse( + duration: '0.01ms', + roles: [ + Role( + name: 'host', + custom: false, + scopes: const [], + createdAt: DateTime.utc(2024), + updatedAt: DateTime.utc(2024), + ), + ], + ), + ), ); when( () => mocks.client.searchUserGroups('h', teamId: any(named: 'teamId')), From 127414018cdff3d42b5bfd4874a64f14f9ea5115 Mon Sep 17 00:00:00 2001 From: Petar Velikov Date: Mon, 21 Sep 2026 17:38:00 +0200 Subject: [PATCH 19/36] refactor(llc)!: route device registration through the generated client (#2977) * refactor(llc)!: route searchRoles through the generated client Co-Authored-By: Claude Opus 5 * test(ui): drop a stray blank line in the mention autocomplete test Co-Authored-By: Claude Opus 5 * refactor(llc): give the generated client its own configured Dio Co-Authored-By: Claude Opus 5 * test(docs): compile the roles autocomplete stub against the generated response Co-Authored-By: Claude Opus 5 * refactor(llc): keep RoleType as the searchRoles filter type Co-Authored-By: Claude Opus 5 * refactor(llc): trim the generated client's comments and drop an unused mock Co-Authored-By: Claude Opus 5 * fix(llc): order the generated client's interceptors to match the hand-written chain Co-Authored-By: Claude Opus 5 * test(llc): drop the generated Role and SearchRolesResponse model tests Co-Authored-By: Claude Opus 5 * test(llc): assert RoleType string interop without a redundant constructor call Co-Authored-By: Claude Opus 5 * docs(repo): let the plan generator reproduce a finished group's record Co-Authored-By: Claude Opus 5 * refactor(llc)!: route device registration through the generated client Co-Authored-By: Claude Opus 5 * refactor(llc)!: keep PushProvider as the addDevice provider type Co-Authored-By: Claude Opus 5 * test(llc): cover device decoding through OwnUser Co-Authored-By: Claude Opus 5 * docs(repo): split push preferences out of the devices group Co-Authored-By: Claude Opus 5 * docs(llc): drop the push provider name comment that explains old code Co-Authored-By: Claude Opus 5 * refactor(llc)!: answer nothing from addDevice and removeDevice, and drop the PushProvider alias Co-Authored-By: Claude Opus 5 --------- Co-authored-by: Claude Opus 5 --- migrations/v11-migration.md | 68 +++++- .../02-devices-and-push-preferences.md | 48 ---- openapi-migration/02-devices.md | 103 ++++++++ openapi-migration/13-push-preferences.md | 44 ++++ openapi-migration/README.md | 7 +- openapi-migration/tool/generate_plan.py | 122 +++++++++- packages/stream_chat/CHANGELOG.md | 5 + .../stream_chat/lib/src/client/client.dart | 32 ++- .../lib/src/core/api/device_api.dart | 92 -------- .../src/core/api/push_preferences_api.dart | 43 ++++ .../lib/src/core/api/responses.dart | 12 - .../lib/src/core/api/responses.g.dart | 5 - .../lib/src/core/api/stream_chat_api.dart | 10 +- .../lib/src/core/models/device.dart | 25 -- .../lib/src/core/models/device.g.dart | 17 -- .../lib/src/core/models/own_user.dart | 4 +- .../lib/src/core/models/own_user.g.dart | 3 +- .../src/repository/devices_repository.dart | 39 ++++ packages/stream_chat/lib/stream_chat.dart | 4 +- .../stream_chat/test/fixtures/device.json | 4 - .../test/src/client/client_test.dart | 99 ++++---- .../test/src/core/api/device_api_test.dart | 220 ------------------ .../core/api/push_preferences_api_test.dart | 107 +++++++++ .../test/src/core/api/responses_test.dart | 6 - .../src/core/api/stream_chat_api_test.dart | 4 +- .../test/src/core/models/device_test.dart | 26 --- .../test/src/core/models/own_user_test.dart | 45 +++- packages/stream_chat/test/src/fakes.dart | 6 +- packages/stream_chat/test/src/mocks.dart | 4 +- .../repository/devices_repository_test.dart | 179 ++++++++++++++ sample_app/lib/auth/auth_controller.dart | 2 +- sample_app/lib/push/push_provider.dart | 6 +- sample_app/lib/push/push_token_manager.dart | 34 +-- 33 files changed, 857 insertions(+), 568 deletions(-) delete mode 100644 openapi-migration/02-devices-and-push-preferences.md create mode 100644 openapi-migration/02-devices.md create mode 100644 openapi-migration/13-push-preferences.md delete mode 100644 packages/stream_chat/lib/src/core/api/device_api.dart create mode 100644 packages/stream_chat/lib/src/core/api/push_preferences_api.dart delete mode 100644 packages/stream_chat/lib/src/core/models/device.dart delete mode 100644 packages/stream_chat/lib/src/core/models/device.g.dart create mode 100644 packages/stream_chat/lib/src/repository/devices_repository.dart delete mode 100644 packages/stream_chat/test/fixtures/device.json delete mode 100644 packages/stream_chat/test/src/core/api/device_api_test.dart create mode 100644 packages/stream_chat/test/src/core/api/push_preferences_api_test.dart delete mode 100644 packages/stream_chat/test/src/core/models/device_test.dart create mode 100644 packages/stream_chat/test/src/repository/devices_repository_test.dart diff --git a/migrations/v11-migration.md b/migrations/v11-migration.md index d80d856a6c..15fbea0f40 100644 --- a/migrations/v11-migration.md +++ b/migrations/v11-migration.md @@ -26,6 +26,7 @@ onto Stream's OpenAPI-generated API client. - [Feature Areas](#feature-areas) - [Sorting](#sorting) - [Roles](#roles) + - [Devices](#devices) - [Migration Checklist](#migration-checklist) - [For AI Agents](#for-ai-agents) - [Contributing to this guide](#contributing-to-this-guide) @@ -154,6 +155,13 @@ search-and-replace you can apply directly. `Kind` is one of `renamed`, `removed` | `Role` (hand-written) | `Role` (generated) | `retyped` | Same five fields, same types. Gains `copyWith` and `toJson`; equality is unchanged | | `SearchRolesResponse` (hand-written) | `SearchRolesResponse` (generated) | `retyped` | `duration` and `roles` are required — a body omitting either now fails to decode rather than defaulting | | `StreamChatClient.searchRoles` → `Future` | `Future>` | `retyped` | Returns a `Result` instead of throwing | +| `Device` (hand-written) | `DeviceResponse` (generated) | `retyped` | Two fields become nine. `created_at` and `user_id` are required, so a device entry missing either now fails to decode | +| `ListDevicesResponse` (hand-written) | `ListDevicesResponse` (generated) | `retyped` | `devices` and `duration` are required — a body omitting either now fails to decode rather than defaulting to `[]` | +| `PushProvider` (enum) | `CreateDeviceRequestPushProvider` (extension type over `String`) | `renamed` | Same four values and wire strings. The name is the generated one, and operation-scoped until the spec is regenerated | +| `PushProvider.firebase.name` | `CreateDeviceRequestPushProvider.firebase` | `removed` | The value *is* the string, so there is no `.name` — and no `.values` | +| `StreamChatClient.addDevice` / `removeDevice` → `Future` | `Future>` | `retyped` | Returns a `Result` instead of throwing, and carries no value on success | +| `StreamChatClient.getDevices` → `Future` | `Future>` | `retyped` | Returns a `Result` instead of throwing | +| `StreamChatApi.device` | `StreamChatApi.pushPreferences` | `renamed` | The class handles only `setPushPreferences` now; device calls moved to the generated client | | _(more added per feature as PRs land)_ | | | | --- @@ -161,14 +169,15 @@ search-and-replace you can apply directly. `Kind` is one of `renamed`, `removed` ## Error Handling **This is the change that will touch every call site.** API methods will return a `Result` instead of -throwing, matching the `stream_feeds` SDK. That conversion lands endpoint by endpoint and none has moved yet — -what has already changed is the *type* of failure every endpoint throws. +throwing, matching the `stream_feeds` SDK. That conversion lands endpoint by endpoint, so what an endpoint does +today depends on whether it has moved — and for every endpoint that has not, the *type* of failure it throws has +changed regardless. **Before:** ```dart try { - final response = await client.getDevices(); - print(response.devices); + final response = await client.queryChannels(filter: filter).first; + print(response); } on StreamChatNetworkError catch (error) { print(error.message); } @@ -418,6 +427,57 @@ result.fold( either now fails to decode rather than falling back to `null` and `[]`. `Role` itself is unchanged field-for-field, and additionally gains `copyWith` and `toJson`. +### Devices + +**`addDevice`, `getDevices` and `removeDevice` return a `Result` instead of throwing**, and their +types come from the OpenAPI spec. + +> **Why:** the generated `DeviceResponse` carries seven fields our two-field `Device` dropped — +> `user_id`, `created_at`, `disabled`, `disabled_reason`, `hardware_id`, `push_provider_name` and +> `voip`. Keeping ours meant maintaining a lossy copy of one shape forever. + +```dart +// v10 +try { + await client.addDevice(token, CreateDeviceRequestPushProvider.firebase); +} on StreamChatException catch (e) { + report(e); +} + +// v11 +final result = await client.addDevice(token, CreateDeviceRequestPushProvider.firebase); +result.fold( + onSuccess: (_) => registered(), + onFailure: (error, _) => report(error), +); +``` + +**`PushProvider` is replaced by the generated `CreateDeviceRequestPushProvider`,** an extension type +over `String` rather than an enum. There is one definition rather than a hand-maintained copy. The four +values and their wire strings are unchanged, and a provider *is* its string: + +```dart +// v10 +final wireValue = PushProvider.firebase.name; // 'firebase' + +// v11 +const wireValue = CreateDeviceRequestPushProvider.firebase; // already 'firebase' +``` + +There is no `.values`, so code that iterated the enum needs an explicit list. A provider the spec does +not name still round-trips, through `CreateDeviceRequestPushProvider.fromJson`. + +The name is the generated one, and it is scoped to the operation it hangs off rather than to the +concept. That is temporary: a spec change is prepared that will give the type a better name, at which +point this becomes a rename rather than a new concept. + +**`Device` is replaced by `DeviceResponse`,** including in `OwnUser.devices`. Reading `id` and +`pushProvider` is unchanged; constructing one now also requires `createdAt` and `userId`. + +**Decoding is stricter.** `ListDevicesResponse` requires `devices` and `duration`, and each +`DeviceResponse` requires `created_at` and `user_id` — responses omitting any of them now fail to +decode rather than defaulting. + --- ## Migration Checklist diff --git a/openapi-migration/02-devices-and-push-preferences.md b/openapi-migration/02-devices-and-push-preferences.md deleted file mode 100644 index 19533827ef..0000000000 --- a/openapi-migration/02-devices-and-push-preferences.md +++ /dev/null @@ -1,48 +0,0 @@ -# 02 — Devices & Push Preferences - -**Goal:** Prove the whole pattern end to end on the smallest real surface: four methods, no persistence, no channel scope. - -**Size:** 4 hand-written method(s) across 1 file(s) → 4 generated operation(s). - -> Tables are generated by `openapi-migration/tool/generate_plan.py`. Edit the prose, not the tables. - -## Scope - -### Hand-written today - -| File | Method | Returns | -| --- | --- | --- | -| `device_api.dart` | `addDevice` | `EmptyResponse` | -| `device_api.dart` | `getDevices` | `ListDevicesResponse` | -| `device_api.dart` | `removeDevice` | `EmptyResponse` | -| `device_api.dart` | `setPushPreferences` | `UpsertPushPreferencesResponse` | - -### Generated operations that cover it - -| Verb | Path | Operation | Response | -| --- | --- | --- | --- | -| `POST` | `/api/v2/devices` | `createDevice` | `DurationResponse` | -| `DELETE` | `/api/v2/devices` | `deleteDevice` | `DurationResponse` | -| `GET` | `/api/v2/devices` | `listDevices` | `ListDevicesResponse` | -| `POST` | `/api/v2/push_preferences` | `updatePushNotificationPreferences` | `UpsertPushPreferencesResponse` | - -## Decisions to make - -- `PushProvider` (our public enum) against the generated per-operation extension type — write the adapter here, it sets the precedent for every enum that follows. -- `setPushPreferences` reads its response into client state and emits `EventType.pushPreferenceUpdated`; decide whether that stays in the api layer or moves up. - -## Risks - -- Generated `DeviceResponse` has 9 fields against our `Device`'s 2 — drop or widen, and record which. - -## Definition of done - -- [ ] Every method above either routes through `DefaultApi` or is listed here as deliberately left - hand-written, with the reason. -- [ ] Public methods return `Future>`; no `getOrThrow()` inside the SDK. -- [ ] Hand-written request/response DTOs for this group are deleted, or their retention is justified. -- [ ] `melos run analyze` clean, `melos run test:dart` green, persistence tests green if this group - persists anything. -- [ ] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. -- [ ] CHANGELOG entry under `🛑️ Breaking` for each break; PR title `refactor(llc)!:`. -- [ ] Decisions recorded in this file, and the status box ticked in `README.md`. diff --git a/openapi-migration/02-devices.md b/openapi-migration/02-devices.md new file mode 100644 index 0000000000..ada3e787df --- /dev/null +++ b/openapi-migration/02-devices.md @@ -0,0 +1,103 @@ +# 02 — Devices + +**Goal:** Prove the whole pattern end to end on the smallest real surface: three methods, no persistence, no channel scope. + +**Size:** 0 hand-written method(s) across 0 file(s) → 3 generated operation(s). + +> Tables are generated by `openapi-migration/tool/generate_plan.py`. Edit the prose, not the tables. + +## Scope + +### Hand-written today + +| File | Method | Returns | +| --- | --- | --- | + +### Generated operations that cover it + +| Verb | Path | Operation | Response | +| --- | --- | --- | --- | +| `POST` | `/api/v2/devices` | `createDevice` | `DurationResponse` | +| `DELETE` | `/api/v2/devices` | `deleteDevice` | `DurationResponse` | +| `GET` | `/api/v2/devices` | `listDevices` | `ListDevicesResponse` | + +## Decisions taken + +- **`Device` → generated `DeviceResponse`, adopted.** Our two fields dropped seven the server sends + (`user_id`, `created_at`, `disabled`, `disabled_reason`, `hardware_id`, `push_provider_name`, + `voip`), and the spec makes `OwnUserResponse.devices` a `List` regardless, so + keeping ours meant a lossy copy of one shape maintained forever. `created_at` and `user_id` are + required, and both are always sent: `user_id` is part of the devices table's composite primary + key, and neither field carries `omitempty` on the response struct. +- **`ListDevicesResponse` → the generated one, adopted.** Same-name shadow with nothing of ours to keep. +- **`PushProvider` is deleted; the generated `CreateDeviceRequestPushProvider` is the public type.** + **This is the enum precedent for every later group,** and it is deliberately *not* the same answer + as `RoleType` in group 04. The two cases differ in the generated code, not in taste: `role_type` is + a bare `String?` in the generated signature, so a hand-written `RoleType` adds a type where none + existed; `push_provider` already has a complete generated extension type with the same four values, + so hand-writing one would be a second copy that silently misses a fifth provider the spec adds + later. + + This started as a typedef aliasing the generated type to a better name, and that was reverted in + review. The rule for later groups is therefore: **adopt the generated type when one exists and is + complete, including its name, and hand-write only when the generated side has no type at all.** + Do not alias a generated type merely to rename it — an alias is a second name for one concept, and + it hides from the reader that the spec is what needs fixing. + + The name really is wrong: `CreateDeviceRequestPushProvider` is named for the request it hangs off, + not for the concept, and it is what a consumer writes and what hovers show. That is accepted as + temporary, because a spec change is prepared that renames these types. When it lands the fix is a + rename in one place rather than the unwinding of an alias. + + Costs, recorded in the migration guide: `.name` and `.values` are gone (v10 shipped an enum). + The `.values` loss also costs the test that asserted every provider was covered; an extension type + cannot enumerate itself, so a fifth provider is caught by the spec, not by this package's suite. +- **The write calls answer nothing.** `addDevice` and `removeDevice` return `Result` + rather than the generated `DurationResponse`, whose only field is a server-timing string no + integrator acts on. `stream_feeds` already does this, and it keeps `DurationResponse` off the + public surface entirely. **The precedent for every later group: a write that returns only an + envelope returns `Result`.** +- **`hardwareId` and `voipToken` are left unset.** `voipToken` is typed `bool?` — a flag meaning "this + id is a VoIP token", not the token — and surfacing it would imply a VoIP-push story the SDK does not + have. Neither has an in-tree consumer. Adding them later is non-breaking. +- **The empty-string `pushProviderName` normalization is preserved,** in the repository. `''` and + `null` were identical on the wire because the key was omitted for both; keeping the normalization + means no new wire value ships untested. Note the server does configure providers under the empty + name — omitting the key resolves to that default — so `''` is normalized because it always was, + not because the server would reject it. +- **Mapping lives in the repository,** not in extension methods on generated types and not in a + separate mapper file. Here that is only request construction, which keeps `StreamChatClient` a pure + delegate. +- **The wire contract is generator-owned, and deliberately not re-pinned here.** The deleted + `device_api_test.dart` asserted verb, path and body-versus-query placement, because the + hand-written api owned them. They now come from the spec through retrofit annotations, so + asserting them in this package would test the generator. The residual risk is named rather than + covered: a regeneration that moved a parameter between query and body would pass CI. **This is + the testing precedent for every later group** — mock at the `DefaultApi` seam, and let the + generated client own the transport. +- **Generated response models are not given `fromJson` tests,** following group 04. Decoding is + exercised where the SDK owns the surface: `OwnUser.fromJson` pins every field of a device entry + and pins that a device missing one the server always sends fails to decode. +- **`setPushPreferences` did not come along,** so `device_api.dart` was renamed + `push_preferences_api.dart` (`DeviceApi` → `PushPreferencesApi`, `StreamChatApi.device` → + `StreamChatApi.pushPreferences`) rather than deleted — the file split rather than migrating whole. + It is [group 13](13-push-preferences.md), which is gated behind a spec question and reaches into + models this group deliberately avoids. + +## Risks + +- **Request bodies carry explicit nulls — verified harmless.** No model under `lib/open_api/model/` sets `includeIfNull: false`, so `CreateDeviceRequest.toJson` emits `{"hardware_id":null,"id":"…","push_provider":"firebase","push_provider_name":null,"voip_token":null}` where the hand-written path omitted those keys. This is the first request *body* through the generated client, so it applies to **every** group from here on; a live `createDevice` accepted it. Recorded rather than fixed — if a later endpoint does mind, the fix is the generator's model template, never a hand-rolled request builder. +- Devices are **not** persisted — no entity, DAO or mapper. `OwnUser` *is*, inside `connection_events.own_user`, but v11's schema bump drops and recreates every table, so no v10 row survives to be read back against the new shape. A device registered by the published v10 SDK was read back through both `getDevices` and `me.devices` on connect. +- `pushProviderName` is re-derived from the app's configured providers on `GET /devices` but not on the `me` payload, so the same device can carry a name from `getDevices()` and `null` from `OwnUser.devices`. New surface rather than a regression — v10 did not expose the field at all. + +## Definition of done + +- [x] Every method above either routes through `DefaultApi` or is listed here as deliberately left + hand-written, with the reason. +- [x] Public methods return `Future>`; no `getOrThrow()` inside the SDK. +- [x] Hand-written request/response DTOs for this group are deleted, or their retention is justified. +- [x] `melos run analyze` clean, `melos run test:dart` green, persistence tests green if this group + persists anything. +- [x] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. +- [x] CHANGELOG entry under `🛑️ Breaking` for each break; PR title `refactor(llc)!:`. +- [x] Decisions recorded in this file, and the status box ticked in `README.md`. diff --git a/openapi-migration/13-push-preferences.md b/openapi-migration/13-push-preferences.md new file mode 100644 index 0000000000..1bf524eb8f --- /dev/null +++ b/openapi-migration/13-push-preferences.md @@ -0,0 +1,44 @@ +# 13 — Push Preferences + +**Goal:** Migrate the one method group 02 left behind — last, because its dependencies are group 11's, not group 02's. + +**Size:** 1 hand-written method(s) across 1 file(s) → 1 generated operation(s). + +> Tables are generated by `openapi-migration/tool/generate_plan.py`. Edit the prose, not the tables. + +## Scope + +### Hand-written today + +| File | Method | Returns | +| --- | --- | --- | +| `push_preferences_api.dart` | `setPushPreferences` | `UpsertPushPreferencesResponse` | + +### Generated operations that cover it + +| Verb | Path | Operation | Response | +| --- | --- | --- | --- | +| `POST` | `/api/v2/push_preferences` | `updatePushNotificationPreferences` | `UpsertPushPreferencesResponse` | + +## Decisions to make + +- **Whether the spec can express a push-preference map the server only partly fills.** The generated `UpsertPushPreferencesResponse.userPreferences` is `Map` with non-nullable values, but our `_userPreferencesFromJson` (`responses.dart`) exists specifically to drop `null` entries — its doc comment states the server returns `null` for users the upsert did not touch, and `responses_test.dart` pins it. Adopting the generated type as it stands would turn a routine channel-only upsert into a decode failure. Resolve it with a live capture of a channel-only upsert **before** writing code; if the server does send `null`, the fix belongs in the spec (`user_preferences` wants nullable `additionalProperties`) and is `openapi-codegen` work, not a hand-rolled decoder here. +- Whether `setPushPreferences` keeps reading its response into client state and emitting `EventType.pushPreferenceUpdated` from the api layer, or that moves up. + +## Risks + +- `ChannelConfig.chatPreferences` **is** persisted, inside the `channels.config` JSON blob. Deleting `chat_preferences.dart` retypes it and touches `channel_mapper_test.dart`, dragging `ChannelConfig` — a group 11 model — along. No schema change, but it is a persistence change, and it is why this group sorts after 11 rather than beside devices. +- `PushPreference` / `ChannelPushPreference` ride on `Event`, `OwnUser.pushPreferences` and `ChannelState.pushPreferences`, so adopting them reaches into the event and channel-state layers. +- `ChannelState.pushPreferences` is **not** persisted — checked, no entity, DAO or mapper. + +## Definition of done + +- [ ] Every method above either routes through `DefaultApi` or is listed here as deliberately left + hand-written, with the reason. +- [ ] Public methods return `Future>`; no `getOrThrow()` inside the SDK. +- [ ] Hand-written request/response DTOs for this group are deleted, or their retention is justified. +- [ ] `melos run analyze` clean, `melos run test:dart` green, persistence tests green if this group + persists anything. +- [ ] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. +- [ ] CHANGELOG entry under `🛑️ Breaking` for each break; PR title `refactor(llc)!:`. +- [ ] Decisions recorded in this file, and the status box ticked in `README.md`. diff --git a/openapi-migration/README.md b/openapi-migration/README.md index 36dbd9ab6d..956f60e999 100644 --- a/openapi-migration/README.md +++ b/openapi-migration/README.md @@ -13,9 +13,9 @@ generated operations in scope, the decisions that group has to make, its risks, | | Group | Hand-written | Generated ops | Status | | --- | --- | --- | --- | --- | | [01](01-foundation.md) | Foundation — `DefaultApi` wiring, `User` shape | — | — | ☐ | -| [02](02-devices-and-push-preferences.md) | Devices & Push Preferences | 4 | 4 | ☐ | +| [02](02-devices.md) | Devices | 0 | 3 | ☑ | | [03](03-user-groups.md) | User Groups | 8 | 8 | ☐ | -| [04](04-roles-guest-and-app.md) | Roles, Guest & App Settings | 4 | 5 | ☐ | +| [04](04-roles-guest-and-app.md) | Roles, Guest & App Settings | 3 | 5 | ☐ | | [05](05-polls.md) | Polls | 13 | 13 | ☐ | | [06](06-reminders.md) | Message Reminders | 4 | 4 | ☐ | | [07](07-threads-and-drafts.md) | Threads & Drafts | 7 | 7 | ☐ | @@ -24,8 +24,9 @@ generated operations in scope, the decisions that group has to make, its risks, | [10](10-messages.md) | Messages & Search | 14 | 12 | ☐ | | [11](11-channels-and-members.md) | Channels, Members & Sync | 27 | 24 | ☐ | | [12](12-uploads-cdn.md) | Uploads (CDN) | 8 | 8 | ☐ | +| [13](13-push-preferences.md) | Push Preferences | 1 | 1 | ☐ | -**Coverage:** 109 hand-written methods across 13 files, and all 128 generated operations, each claimed by exactly +**Coverage:** 105 hand-written methods across 12 files, and all 128 generated operations, each claimed by exactly one group. Verified mechanically — see [Keeping this plan honest](#keeping-this-plan-honest). ## Goals diff --git a/openapi-migration/tool/generate_plan.py b/openapi-migration/tool/generate_plan.py index 052000441f..c9deff22e0 100644 --- a/openapi-migration/tool/generate_plan.py +++ b/openapi-migration/tool/generate_plan.py @@ -73,20 +73,91 @@ def match(path): GROUPS = [ dict( - num='02', slug='devices-and-push-preferences', title='Devices & Push Preferences', - hand=['device_api.dart'], - match=owns('/api/v2/devices', '/api/v2/push_preferences'), - goal='Prove the whole pattern end to end on the smallest real surface: four methods, no persistence, ' + num='02', slug='devices', title='Devices', + hand=[], + match=owns('/api/v2/devices'), + goal='Prove the whole pattern end to end on the smallest real surface: three methods, no persistence, ' 'no channel scope.', - decisions=[ - '`PushProvider` (our public enum) against the generated per-operation extension type — write the ' - 'adapter here, it sets the precedent for every enum that follows.', - '`setPushPreferences` reads its response into client state and emits `EventType.pushPreferenceUpdated`; ' - 'decide whether that stays in the api layer or moves up.', - ], + decisions=[], + taken=textwrap.dedent("""\ + - **`Device` → generated `DeviceResponse`, adopted.** Our two fields dropped seven the server sends + (`user_id`, `created_at`, `disabled`, `disabled_reason`, `hardware_id`, `push_provider_name`, + `voip`), and the spec makes `OwnUserResponse.devices` a `List` regardless, so + keeping ours meant a lossy copy of one shape maintained forever. `created_at` and `user_id` are + required, and both are always sent: `user_id` is part of the devices table's composite primary + key, and neither field carries `omitempty` on the response struct. + - **`ListDevicesResponse` → the generated one, adopted.** Same-name shadow with nothing of ours to keep. + - **`PushProvider` is deleted; the generated `CreateDeviceRequestPushProvider` is the public type.** + **This is the enum precedent for every later group,** and it is deliberately *not* the same answer + as `RoleType` in group 04. The two cases differ in the generated code, not in taste: `role_type` is + a bare `String?` in the generated signature, so a hand-written `RoleType` adds a type where none + existed; `push_provider` already has a complete generated extension type with the same four values, + so hand-writing one would be a second copy that silently misses a fifth provider the spec adds + later. + + This started as a typedef aliasing the generated type to a better name, and that was reverted in + review. The rule for later groups is therefore: **adopt the generated type when one exists and is + complete, including its name, and hand-write only when the generated side has no type at all.** + Do not alias a generated type merely to rename it — an alias is a second name for one concept, and + it hides from the reader that the spec is what needs fixing. + + The name really is wrong: `CreateDeviceRequestPushProvider` is named for the request it hangs off, + not for the concept, and it is what a consumer writes and what hovers show. That is accepted as + temporary, because a spec change is prepared that renames these types. When it lands the fix is a + rename in one place rather than the unwinding of an alias. + + Costs, recorded in the migration guide: `.name` and `.values` are gone (v10 shipped an enum). + The `.values` loss also costs the test that asserted every provider was covered; an extension type + cannot enumerate itself, so a fifth provider is caught by the spec, not by this package's suite. + - **The write calls answer nothing.** `addDevice` and `removeDevice` return `Result` + rather than the generated `DurationResponse`, whose only field is a server-timing string no + integrator acts on. `stream_feeds` already does this, and it keeps `DurationResponse` off the + public surface entirely. **The precedent for every later group: a write that returns only an + envelope returns `Result`.** + - **`hardwareId` and `voipToken` are left unset.** `voipToken` is typed `bool?` — a flag meaning "this + id is a VoIP token", not the token — and surfacing it would imply a VoIP-push story the SDK does not + have. Neither has an in-tree consumer. Adding them later is non-breaking. + - **The empty-string `pushProviderName` normalization is preserved,** in the repository. `''` and + `null` were identical on the wire because the key was omitted for both; keeping the normalization + means no new wire value ships untested. Note the server does configure providers under the empty + name — omitting the key resolves to that default — so `''` is normalized because it always was, + not because the server would reject it. + - **Mapping lives in the repository,** not in extension methods on generated types and not in a + separate mapper file. Here that is only request construction, which keeps `StreamChatClient` a pure + delegate. + - **The wire contract is generator-owned, and deliberately not re-pinned here.** The deleted + `device_api_test.dart` asserted verb, path and body-versus-query placement, because the + hand-written api owned them. They now come from the spec through retrofit annotations, so + asserting them in this package would test the generator. The residual risk is named rather than + covered: a regeneration that moved a parameter between query and body would pass CI. **This is + the testing precedent for every later group** — mock at the `DefaultApi` seam, and let the + generated client own the transport. + - **Generated response models are not given `fromJson` tests,** following group 04. Decoding is + exercised where the SDK owns the surface: `OwnUser.fromJson` pins every field of a device entry + and pins that a device missing one the server always sends fails to decode. + - **`setPushPreferences` did not come along,** so `device_api.dart` was renamed + `push_preferences_api.dart` (`DeviceApi` → `PushPreferencesApi`, `StreamChatApi.device` → + `StreamChatApi.pushPreferences`) rather than deleted — the file split rather than migrating whole. + It is [group 13](13-push-preferences.md), which is gated behind a spec question and reaches into + models this group deliberately avoids. + """), risks=[ - "Generated `DeviceResponse` has 9 fields against our `Device`'s 2 — drop or widen, and record which.", + '**Request bodies carry explicit nulls — verified harmless.** No model under `lib/open_api/model/` ' + 'sets `includeIfNull: false`, so `CreateDeviceRequest.toJson` emits ' + '`{"hardware_id":null,"id":"…","push_provider":"firebase","push_provider_name":null,' + '"voip_token":null}` where the hand-written path omitted those keys. This is the first request ' + '*body* through the generated client, so it applies to **every** group from here on; a live ' + '`createDevice` accepted it. Recorded rather than fixed — if a later endpoint does mind, the fix ' + "is the generator's model template, never a hand-rolled request builder.", + 'Devices are **not** persisted — no entity, DAO or mapper. `OwnUser` *is*, inside ' + "`connection_events.own_user`, but v11's schema bump drops and recreates every table, so no v10 " + 'row survives to be read back against the new shape. A device registered by the published v10 ' + 'SDK was read back through both `getDevices` and `me.devices` on connect.', + '`pushProviderName` is re-derived from the app\'s configured providers on `GET /devices` but not ' + 'on the `me` payload, so the same device can carry a name from `getDevices()` and `null` from ' + '`OwnUser.devices`. New surface rather than a regression — v10 did not expose the field at all.', ], + done=DONE.replace('- [ ]', '- [x]'), ), dict( num='03', slug='user-groups', title='User Groups', @@ -302,6 +373,35 @@ def match(path): 'so this group cannot use them — it needs its own `CdnApi`.', ], ), + dict( + num='13', slug='push-preferences', title='Push Preferences', + hand=['push_preferences_api.dart'], + match=owns('/api/v2/push_preferences'), + goal='Migrate the one method group 02 left behind — last, because its dependencies are group 11\'s, ' + 'not group 02\'s.', + decisions=[ + '**Whether the spec can express a push-preference map the server only partly fills.** The generated ' + '`UpsertPushPreferencesResponse.userPreferences` is `Map` with ' + 'non-nullable values, but our `_userPreferencesFromJson` (`responses.dart`) exists specifically to ' + 'drop `null` entries — its doc comment states the server returns `null` for users the upsert did ' + 'not touch, and `responses_test.dart` pins it. Adopting the generated type as it stands would turn ' + 'a routine channel-only upsert into a decode failure. Resolve it with a live capture of a ' + 'channel-only upsert **before** writing code; if the server does send `null`, the fix belongs in ' + 'the spec (`user_preferences` wants nullable `additionalProperties`) and is `openapi-codegen` ' + 'work, not a hand-rolled decoder here.', + 'Whether `setPushPreferences` keeps reading its response into client state and emitting ' + '`EventType.pushPreferenceUpdated` from the api layer, or that moves up.', + ], + risks=[ + '`ChannelConfig.chatPreferences` **is** persisted, inside the `channels.config` JSON blob. Deleting ' + '`chat_preferences.dart` retypes it and touches `channel_mapper_test.dart`, dragging ' + '`ChannelConfig` — a group 11 model — along. No schema change, but it is a persistence change, and ' + 'it is why this group sorts after 11 rather than beside devices.', + '`PushPreference` / `ChannelPushPreference` ride on `Event`, `OwnUser.pushPreferences` and ' + '`ChannelState.pushPreferences`, so adopting them reaches into the event and channel-state layers.', + '`ChannelState.pushPreferences` is **not** persisted — checked, no entity, DAO or mapper.', + ], + ), ] diff --git a/packages/stream_chat/CHANGELOG.md b/packages/stream_chat/CHANGELOG.md index d274140265..148b1f914e 100644 --- a/packages/stream_chat/CHANGELOG.md +++ b/packages/stream_chat/CHANGELOG.md @@ -46,6 +46,11 @@ - `StreamHttpClient` and `StreamChatApi` take a `ConnectionIdGetter? connectionId` where they took a `ConnectionIdManager?`. The manager only wrapped such a closure, and is removed. - `Role` and `SearchRolesResponse` are the OpenAPI-generated types. `Role` gains `copyWith` and `toJson`, and a response missing `duration` or `roles` now fails to decode instead of defaulting. - `StreamChatClient.searchRoles` returns a `Result` instead of throwing. +- `StreamChatClient.addDevice`, `getDevices` and `removeDevice` return a `Result` instead of throwing; `addDevice` and `removeDevice` answer nothing, `getDevices` a `ListDevicesResponse`. +- `Device` is replaced by the generated `DeviceResponse`, including in `OwnUser.devices`. It carries seven more fields, and `userId` and `createdAt` are required, so a device entry missing either now fails to decode. +- `ListDevicesResponse` is the generated type; `devices` and `duration` are required, so a response omitting either fails to decode instead of defaulting. +- `PushProvider` is removed in favour of the generated `CreateDeviceRequestPushProvider`, which `addDevice` now takes. It is an extension type over `String` rather than an enum, so the four values and their wire strings are unchanged, but `.name` and `.values` are gone — a provider is its own string. +- `StreamChatApi.device` is renamed `StreamChatApi.pushPreferences` and handles only `setPushPreferences`. 🐞 Fixed diff --git a/packages/stream_chat/lib/src/client/client.dart b/packages/stream_chat/lib/src/client/client.dart index 713c458e41..50f04b73c5 100644 --- a/packages/stream_chat/lib/src/client/client.dart +++ b/packages/stream_chat/lib/src/client/client.dart @@ -29,7 +29,8 @@ import 'package:stream_core/stream_core.dart' WsEvent; import 'package:synchronized/synchronized.dart'; -import '../../open_api/api.dart' show DefaultApi, SearchRolesResponse; +import '../../open_api/api.dart' + show CreateDeviceRequestPushProvider, DefaultApi, ListDevicesResponse, SearchRolesResponse; import '../../version.dart'; import '../core/api/attachment_file_uploader.dart'; import '../core/api/requests.dart'; @@ -65,6 +66,7 @@ import '../core/util/immutable_collection_subjects.dart'; import '../core/util/utils.dart'; import '../db/chat_persistence_client.dart'; import '../event_type.dart'; +import '../repository/devices_repository.dart'; import '../repository/roles_repository.dart'; import '../ws/connect_request.dart'; import '../ws/connection_manager.dart'; @@ -160,7 +162,9 @@ class StreamChatClient { ]), ); - _rolesRepository = RolesRepository(defaultApi ?? DefaultApi(httpClient)); + final api = defaultApi ?? DefaultApi(httpClient); + _rolesRepository = RolesRepository(api); + _devicesRepository = DevicesRepository(api); _connection = ConnectionManager( request: ConnectRequest.forApi( @@ -195,6 +199,7 @@ class StreamChatClient { late final StreamChatApi _chatApi; late final RolesRepository _rolesRepository; + late final DevicesRepository _devicesRepository; late final ConnectionManager _connection; StreamSubscription? _wsEventSubscription; @@ -1197,22 +1202,27 @@ class StreamChatClient { unset: unset, ); - /// Add a device for Push Notifications. - Future addDevice( + /// Registers a device to receive push notifications. + /// + /// [id] is the token the push provider issued for this device. + /// + /// [pushProviderName] names which of the app's configurations for + /// [pushProvider] to use, for apps that have more than one. + Future> addDevice( String id, - PushProvider pushProvider, { + CreateDeviceRequestPushProvider pushProvider, { String? pushProviderName, - }) => _chatApi.device.addDevice( + }) => _devicesRepository.addDevice( id, pushProvider, pushProviderName: pushProviderName, ); - /// Gets a list of user devices. - Future getDevices() => _chatApi.device.getDevices(); + /// Lists the devices registered for the current user. + Future> getDevices() => _devicesRepository.getDevices(); - /// Remove a user's device. - Future removeDevice(String id) => _chatApi.device.removeDevice(id); + /// Removes a registered device, stopping push notifications to it. + Future> removeDevice(String id) => _devicesRepository.removeDevice(id); /// Set push preferences for the current user. /// @@ -1259,7 +1269,7 @@ class StreamChatClient { Future setPushPreferences( List preferences, ) async { - final res = await _chatApi.device.setPushPreferences(preferences); + final res = await _chatApi.pushPreferences.setPushPreferences(preferences); final currentUser = state.currentUser; final currentUserId = currentUser?.id; diff --git a/packages/stream_chat/lib/src/core/api/device_api.dart b/packages/stream_chat/lib/src/core/api/device_api.dart deleted file mode 100644 index 1117475ab8..0000000000 --- a/packages/stream_chat/lib/src/core/api/device_api.dart +++ /dev/null @@ -1,92 +0,0 @@ -import 'dart:convert'; - -import '../http/stream_http_client.dart'; -import '../models/push_preference.dart'; -import 'responses.dart'; - -/// Provider used to send push notifications. -enum PushProvider { - /// Send notifications using Google's Firebase Cloud Messaging - firebase, - - /// Send notifications using Huawei's Push Kit - huawei, - - /// Send notifications using Xiaomi's Mi Push Service - xiaomi, - - /// Send notifications using Apple's Push Notification service - apn, -} - -/// Defines the api dedicated to device operations -class DeviceApi { - /// Initialize a new device api - DeviceApi(this._client); - - final StreamHttpClient _client; - - /// Add a device for Push Notifications. - Future addDevice( - String deviceId, - PushProvider pushProvider, { - String? pushProviderName, - }) async { - final response = await _client.post( - '/devices', - data: { - 'id': deviceId, - 'push_provider': pushProvider.name, - if (pushProviderName != null && pushProviderName.isNotEmpty) 'push_provider_name': pushProviderName, - }, - ); - return EmptyResponse.fromJson(response.data); - } - - /// Gets a list of user devices. - Future getDevices() async { - final response = await _client.get('/devices'); - return ListDevicesResponse.fromJson(response.data); - } - - /// Remove a user's device. - Future removeDevice( - String deviceId, - ) async { - final response = await _client.delete( - '/devices', - queryParameters: {'id': deviceId}, - ); - return EmptyResponse.fromJson(response.data); - } - - /// Set push preferences for the current user. - /// - /// This method allows you to configure push notification settings - /// at both global and channel-specific levels. - /// - /// [preferences] - List of [PushPreferenceInput] to apply. Use the default - /// constructor for user-level preferences or [PushPreferenceInput.channel] - /// for channel-specific preferences. - /// - /// Returns [UpsertPushPreferencesResponse] with the updated preferences. - /// - /// Throws [ArgumentError] if preferences list is empty. - Future setPushPreferences( - List preferences, - ) async { - if (preferences.isEmpty) { - throw ArgumentError.value( - preferences, - 'preferences', - 'Cannot be empty. At least one preference must be provided.', - ); - } - - final response = await _client.post( - '/push_preferences', - data: jsonEncode({'preferences': preferences}), - ); - return UpsertPushPreferencesResponse.fromJson(response.data); - } -} diff --git a/packages/stream_chat/lib/src/core/api/push_preferences_api.dart b/packages/stream_chat/lib/src/core/api/push_preferences_api.dart new file mode 100644 index 0000000000..be5b822811 --- /dev/null +++ b/packages/stream_chat/lib/src/core/api/push_preferences_api.dart @@ -0,0 +1,43 @@ +import 'dart:convert'; + +import '../http/stream_http_client.dart'; +import '../models/push_preference.dart'; +import 'responses.dart'; + +/// Defines the api dedicated to push preference operations +class PushPreferencesApi { + /// Initialize a new push preferences api + PushPreferencesApi(this._client); + + final StreamHttpClient _client; + + /// Set push preferences for the current user. + /// + /// This method allows you to configure push notification settings + /// at both global and channel-specific levels. + /// + /// [preferences] - List of [PushPreferenceInput] to apply. Use the default + /// constructor for user-level preferences or [PushPreferenceInput.channel] + /// for channel-specific preferences. + /// + /// Returns [UpsertPushPreferencesResponse] with the updated preferences. + /// + /// Throws [ArgumentError] if preferences list is empty. + Future setPushPreferences( + List preferences, + ) async { + if (preferences.isEmpty) { + throw ArgumentError.value( + preferences, + 'preferences', + 'Cannot be empty. At least one preference must be provided.', + ); + } + + final response = await _client.post( + '/push_preferences', + data: jsonEncode({'preferences': preferences}), + ); + return UpsertPushPreferencesResponse.fromJson(response.data); + } +} diff --git a/packages/stream_chat/lib/src/core/api/responses.dart b/packages/stream_chat/lib/src/core/api/responses.dart index ad8663df8e..9ef0c2f6ea 100644 --- a/packages/stream_chat/lib/src/core/api/responses.dart +++ b/packages/stream_chat/lib/src/core/api/responses.dart @@ -5,7 +5,6 @@ import '../models/app_settings.dart'; import '../models/banned_user.dart'; import '../models/channel_model.dart'; import '../models/channel_state.dart'; -import '../models/device.dart'; import '../models/draft.dart'; import '../models/location.dart'; import '../models/member.dart'; @@ -167,17 +166,6 @@ class QueryRepliesResponse extends _BaseResponse { static QueryRepliesResponse fromJson(Map json) => _$QueryRepliesResponseFromJson(json); } -/// Model response for [StreamChatClient.getDevices] api call -@JsonSerializable(createToJson: false) -class ListDevicesResponse extends _BaseResponse { - /// List of user devices - @JsonKey(defaultValue: []) - late List devices; - - /// Create a new instance from a json - static ListDevicesResponse fromJson(Map json) => _$ListDevicesResponseFromJson(json); -} - /// Base Model response for [Channel.sendImage] and [Channel.sendFile] api call. @JsonSerializable(createToJson: false) class SendAttachmentResponse extends _BaseResponse { diff --git a/packages/stream_chat/lib/src/core/api/responses.g.dart b/packages/stream_chat/lib/src/core/api/responses.g.dart index d22cca4c50..f75c5f87f2 100644 --- a/packages/stream_chat/lib/src/core/api/responses.g.dart +++ b/packages/stream_chat/lib/src/core/api/responses.g.dart @@ -83,11 +83,6 @@ QueryRepliesResponse _$QueryRepliesResponseFromJson( ..messages = (json['messages'] as List?)?.map((e) => Message.fromJson(e as Map)).toList() ?? []; -ListDevicesResponse _$ListDevicesResponseFromJson(Map json) => ListDevicesResponse() - ..duration = json['duration'] as String? - ..devices = - (json['devices'] as List?)?.map((e) => Device.fromJson(e as Map)).toList() ?? []; - SendAttachmentResponse _$SendAttachmentResponseFromJson( Map json, ) => SendAttachmentResponse() diff --git a/packages/stream_chat/lib/src/core/api/stream_chat_api.dart b/packages/stream_chat/lib/src/core/api/stream_chat_api.dart index fd22c622d8..2f12bf28e3 100644 --- a/packages/stream_chat/lib/src/core/api/stream_chat_api.dart +++ b/packages/stream_chat/lib/src/core/api/stream_chat_api.dart @@ -4,19 +4,17 @@ import 'package:stream_core/stream_core.dart' show ConnectionIdGetter, SystemEnv import '../http/stream_http_client.dart'; import 'attachment_file_uploader.dart'; import 'channel_api.dart'; -import 'device_api.dart'; import 'general_api.dart'; import 'guest_api.dart'; import 'message_api.dart'; import 'moderation_api.dart'; import 'polls_api.dart'; +import 'push_preferences_api.dart'; import 'reminders_api.dart'; import 'threads_api.dart'; import 'user_api.dart'; import 'user_groups_api.dart'; -export 'device_api.dart' show PushProvider; - /// ApiClient that wraps every other specific api class StreamChatApi { /// Initialize a new stream chat api @@ -70,9 +68,9 @@ class StreamChatApi { ChannelApi get channel => _channel ??= ChannelApi(_client); ChannelApi? _channel; - /// Api dedicated to device operations - DeviceApi get device => _device ??= DeviceApi(_client); - DeviceApi? _device; + /// Api dedicated to push preference operations + PushPreferencesApi get pushPreferences => _pushPreferences ??= PushPreferencesApi(_client); + PushPreferencesApi? _pushPreferences; /// Api dedicated to moderation operations ModerationApi get moderation => _moderation ??= ModerationApi(_client); diff --git a/packages/stream_chat/lib/src/core/models/device.dart b/packages/stream_chat/lib/src/core/models/device.dart deleted file mode 100644 index 5dc98d25f8..0000000000 --- a/packages/stream_chat/lib/src/core/models/device.dart +++ /dev/null @@ -1,25 +0,0 @@ -import 'package:json_annotation/json_annotation.dart'; - -part 'device.g.dart'; - -/// The class that contains the information about a device -@JsonSerializable() -class Device { - /// Constructor used for json serialization - Device({ - required this.id, - required this.pushProvider, - }); - - /// Create a new instance from a json - factory Device.fromJson(Map json) => _$DeviceFromJson(json); - - /// The id of the device - final String id; - - /// The notification push provider - final String pushProvider; - - /// Serialize to json - Map toJson() => _$DeviceToJson(this); -} diff --git a/packages/stream_chat/lib/src/core/models/device.g.dart b/packages/stream_chat/lib/src/core/models/device.g.dart deleted file mode 100644 index 2725a082f1..0000000000 --- a/packages/stream_chat/lib/src/core/models/device.g.dart +++ /dev/null @@ -1,17 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'device.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -Device _$DeviceFromJson(Map json) => Device( - id: json['id'] as String, - pushProvider: json['push_provider'] as String, -); - -Map _$DeviceToJson(Device instance) => { - 'id': instance.id, - 'push_provider': instance.pushProvider, -}; diff --git a/packages/stream_chat/lib/src/core/models/own_user.dart b/packages/stream_chat/lib/src/core/models/own_user.dart index 99986fbdb4..361e8e431d 100644 --- a/packages/stream_chat/lib/src/core/models/own_user.dart +++ b/packages/stream_chat/lib/src/core/models/own_user.dart @@ -63,7 +63,7 @@ class OwnUser extends User { DateTime? banExpires, List? teams, List? channelMutes, - List? devices, + List? devices, List? mutes, List? blockedUserIds, int? totalUnreadCount, @@ -141,7 +141,7 @@ class OwnUser extends User { } /// List of user devices. - final List devices; + final List devices; /// List of users muted by the user. final List mutes; diff --git a/packages/stream_chat/lib/src/core/models/own_user.g.dart b/packages/stream_chat/lib/src/core/models/own_user.g.dart index 7343a61617..f33991b6f5 100644 --- a/packages/stream_chat/lib/src/core/models/own_user.g.dart +++ b/packages/stream_chat/lib/src/core/models/own_user.g.dart @@ -8,7 +8,8 @@ part of 'own_user.dart'; OwnUser _$OwnUserFromJson(Map json) => OwnUser( devices: - (json['devices'] as List?)?.map((e) => Device.fromJson(e as Map)).toList() ?? const [], + (json['devices'] as List?)?.map((e) => DeviceResponse.fromJson(e as Map)).toList() ?? + const [], mutes: (json['mutes'] as List?)?.map((e) => Mute.fromJson(e as Map)).toList() ?? const [], totalUnreadCount: (json['total_unread_count'] as num?)?.toInt() ?? 0, unreadChannels: (json['unread_channels'] as num?)?.toInt() ?? 0, diff --git a/packages/stream_chat/lib/src/repository/devices_repository.dart b/packages/stream_chat/lib/src/repository/devices_repository.dart new file mode 100644 index 0000000000..c55b6760fc --- /dev/null +++ b/packages/stream_chat/lib/src/repository/devices_repository.dart @@ -0,0 +1,39 @@ +import 'package:stream_core/stream_core.dart' show Result; + +import '../../open_api/api.dart' show DefaultApi; +import '../../open_api/models.dart' show CreateDeviceRequest, CreateDeviceRequestPushProvider, ListDevicesResponse; + +/// Repository dedicated to device operations. +class DevicesRepository { + /// Initialize a new devices repository. + const DevicesRepository(this._api); + + final DefaultApi _api; + + /// Registers a device to receive push notifications. + /// + /// [id] is the token the push provider issued for this device. + /// + /// [pushProviderName] names which of the app's configurations for + /// [pushProvider] to use, for apps that have more than one. + Future> addDevice( + String id, + CreateDeviceRequestPushProvider pushProvider, { + String? pushProviderName, + }) => _api.createDevice( + createDeviceRequest: CreateDeviceRequest( + id: id, + pushProvider: pushProvider, + pushProviderName: switch (pushProviderName) { + final name? when name.isNotEmpty => name, + _ => null, + }, + ), + ); + + /// Lists the devices registered for the current user. + Future> getDevices() => _api.listDevices(); + + /// Removes a registered device, stopping push notifications to it. + Future> removeDevice(String id) => _api.deleteDevice(id: id); +} diff --git a/packages/stream_chat/lib/stream_chat.dart b/packages/stream_chat/lib/stream_chat.dart index 966122050c..79778a77b7 100644 --- a/packages/stream_chat/lib/stream_chat.dart +++ b/packages/stream_chat/lib/stream_chat.dart @@ -66,7 +66,8 @@ export 'package:stream_core/stream_core.dart' export 'package:uuid/uuid.dart'; -export 'open_api/models.dart' show Role, SearchRolesResponse; +export 'open_api/models.dart' + show CreateDeviceRequestPushProvider, DeviceResponse, ListDevicesResponse, Role, SearchRolesResponse; export 'src/client/channel/channel.dart'; export 'src/client/channel/channel_capability_check.dart'; @@ -95,7 +96,6 @@ export 'src/core/models/channel_mute.dart'; export 'src/core/models/channel_state.dart'; export 'src/core/models/chat_preferences.dart'; export 'src/core/models/command.dart'; -export 'src/core/models/device.dart'; export 'src/core/models/draft.dart'; export 'src/core/models/draft_message.dart'; export 'src/core/models/location.dart'; diff --git a/packages/stream_chat/test/fixtures/device.json b/packages/stream_chat/test/fixtures/device.json deleted file mode 100644 index 4555dc1e04..0000000000 --- a/packages/stream_chat/test/fixtures/device.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "id": "device-id", - "push_provider": "push-provider" -} \ No newline at end of file diff --git a/packages/stream_chat/test/src/client/client_test.dart b/packages/stream_chat/test/src/client/client_test.dart index e7845c435f..6c40ad8a83 100644 --- a/packages/stream_chat/test/src/client/client_test.dart +++ b/packages/stream_chat/test/src/client/client_test.dart @@ -3,6 +3,8 @@ import 'dart:async'; import 'package:mocktail/mocktail.dart'; +import 'package:stream_chat/open_api/api.dart' + show CreateDeviceRequest, CreateDeviceRequestPushProvider, DurationResponse; import 'package:stream_chat/src/ws/events/events.dart'; import 'package:stream_chat/stream_chat.dart'; import 'package:test/test.dart'; @@ -1200,6 +1202,7 @@ void main() { // Clear any accumulated interactions from a previous test so that // verifyNoMoreInteractions on api.general stays accurate. clearInteractions(api.general); + clearInteractions(defaultApi); final ws = FakeChatServer(); client = StreamChatClient(apiKey, chatApi: api, defaultApi: defaultApi, wsProvider: ws.connect); @@ -1837,76 +1840,92 @@ void main() { test('`.addDevice should work`', () async { const id = 'test-device-id'; - const provider = PushProvider.firebase; + const provider = CreateDeviceRequestPushProvider.firebase; + const request = CreateDeviceRequest(id: id, pushProvider: provider); - when(() => api.device.addDevice(id, provider)).thenAnswer((_) async => EmptyResponse()); + when(() => defaultApi.createDevice(createDeviceRequest: request)).thenAnswer( + (_) async => const Result.success(DurationResponse(duration: '0.01ms')), + ); final res = await client.addDevice(id, provider); - expect(res, isNotNull); + expect(res.isSuccess, isTrue); - verify(() => api.device.addDevice(id, provider)).called(1); - verifyNoMoreInteractions(api.device); + verify(() => defaultApi.createDevice(createDeviceRequest: request)).called(1); + verifyNoMoreInteractions(defaultApi); }); test('`.addDevice should work with pushProviderName`', () async { const id = 'test-device-id'; - const provider = PushProvider.firebase; + const provider = CreateDeviceRequestPushProvider.firebase; const pushProviderName = 'my-custom-config'; + const request = CreateDeviceRequest( + id: id, + pushProvider: provider, + pushProviderName: pushProviderName, + ); - when( - () => api.device.addDevice( - id, - provider, - pushProviderName: pushProviderName, - ), - ).thenAnswer((_) async => EmptyResponse()); + when(() => defaultApi.createDevice(createDeviceRequest: request)).thenAnswer( + (_) async => const Result.success(DurationResponse(duration: '0.01ms')), + ); - final res = await client.addDevice( - id, - provider, - pushProviderName: pushProviderName, + final res = await client.addDevice(id, provider, pushProviderName: pushProviderName); + expect(res.isSuccess, isTrue); + + verify(() => defaultApi.createDevice(createDeviceRequest: request)).called(1); + verifyNoMoreInteractions(defaultApi); + }); + + test('`.addDevice` surfaces a failure without throwing', () async { + const error = StreamClientException(message: 'boom'); + const request = CreateDeviceRequest( + id: 'test-device-id', + pushProvider: CreateDeviceRequestPushProvider.firebase, ); - expect(res, isNotNull); - verify( - () => api.device.addDevice( - id, - provider, - pushProviderName: pushProviderName, - ), - ).called(1); - verifyNoMoreInteractions(api.device); + when(() => defaultApi.createDevice(createDeviceRequest: request)).thenAnswer( + (_) async => const Result.failure(error), + ); + + final res = await client.addDevice('test-device-id', CreateDeviceRequestPushProvider.firebase); + + expect(res.isFailure, isTrue); + expect(res.exceptionOrNull(), error); }); test('`.getDevices`', () async { final devices = List.generate( 3, - (index) => Device( + (index) => DeviceResponse( id: 'test-device-id-$index', - pushProvider: PushProvider.firebase.name, + pushProvider: CreateDeviceRequestPushProvider.firebase, + createdAt: DateTime.utc(2024), + userId: userId, ), ); - when(() => api.device.getDevices()).thenAnswer((_) async => ListDevicesResponse()..devices = devices); + when(defaultApi.listDevices).thenAnswer( + (_) async => Result.success(ListDevicesResponse(duration: '0.01ms', devices: devices)), + ); final res = await client.getDevices(); - expect(res, isNotNull); - expect(res.devices.length, devices.length); + expect(res.getOrNull()?.devices, devices); - verify(() => api.device.getDevices()).called(1); - verifyNoMoreInteractions(api.device); + verify(defaultApi.listDevices).called(1); + verifyNoMoreInteractions(defaultApi); }); test('`.removeDevice`', () async { const deviceId = 'test-device-id'; - when(() => api.device.removeDevice(deviceId)).thenAnswer((_) async => EmptyResponse()); + when(() => defaultApi.deleteDevice(id: deviceId)).thenAnswer( + (_) async => const Result.success(DurationResponse(duration: '0.01ms')), + ); final res = await client.removeDevice(deviceId); - expect(res, isNotNull); + expect(res.isSuccess, isTrue); - verify(() => api.device.removeDevice(deviceId)).called(1); - verifyNoMoreInteractions(api.device); + verify(() => defaultApi.deleteDevice(id: deviceId)).called(1); + verifyNoMoreInteractions(defaultApi); }); test('`.setPushPreferences`', () async { @@ -1923,7 +1942,7 @@ void main() { const preferences = [pushPreferenceInput, channelPreferenceInput]; final currentUser = client.state.currentUser; - when(() => api.device.setPushPreferences(preferences)).thenAnswer( + when(() => api.pushPreferences.setPushPreferences(preferences)).thenAnswer( (_) async => UpsertPushPreferencesResponse() ..userPreferences = { '${currentUser?.id}': PushPreference( @@ -1958,8 +1977,8 @@ void main() { final res = await client.setPushPreferences(preferences); expect(res, isNotNull); - verify(() => api.device.setPushPreferences(preferences)).called(1); - verifyNoMoreInteractions(api.device); + verify(() => api.pushPreferences.setPushPreferences(preferences)).called(1); + verifyNoMoreInteractions(api.pushPreferences); }); test('should handle push_preference.updated event', () async { diff --git a/packages/stream_chat/test/src/core/api/device_api_test.dart b/packages/stream_chat/test/src/core/api/device_api_test.dart deleted file mode 100644 index 198b2bcdec..0000000000 --- a/packages/stream_chat/test/src/core/api/device_api_test.dart +++ /dev/null @@ -1,220 +0,0 @@ -import 'package:dio/dio.dart'; -import 'package:mocktail/mocktail.dart'; -import 'package:stream_chat/src/core/api/device_api.dart'; -import 'package:stream_chat/stream_chat.dart'; -import 'package:test/test.dart'; - -import '../../mocks.dart'; - -void main() { - Response successResponse(String path, {Object? data}) => Response( - data: data, - requestOptions: RequestOptions(path: path), - statusCode: 200, - ); - - late final client = MockHttpClient(); - late DeviceApi deviceApi; - - setUp(() { - deviceApi = DeviceApi(client); - }); - - test('addDevice should work', () async { - const deviceId = 'test-device-id'; - const pushProvidersMap = { - 'apn': PushProvider.apn, - 'firebase': PushProvider.firebase, - 'huawei': PushProvider.huawei, - 'xiaomi': PushProvider.xiaomi, - }; - const path = '/devices'; - - for (final pushProviderMapEntry in pushProvidersMap.entries) { - final data = { - 'id': deviceId, - 'push_provider': pushProviderMapEntry.key, - }; - when(() { - return client.post( - path, - data: data, - ); - }).thenAnswer((_) async => successResponse(path, data: {})); - - final res = await deviceApi.addDevice(deviceId, pushProviderMapEntry.value); - - expect(res, isNotNull); - - verify(() => client.post(path, data: data)).called(1); - } - verifyNoMoreInteractions(client); - expect(pushProvidersMap.length, PushProvider.values.length, reason: 'All PushProvider should be tested'); - }); - - test('addDevice should work with pushProviderName', () async { - const deviceId = 'test-device-id'; - const pushProvider = PushProvider.firebase; - const pushProviderName = 'my-custom-config'; - - const path = '/devices'; - - when( - () => client.post( - path, - data: { - 'id': deviceId, - 'push_provider': pushProvider.name, - 'push_provider_name': pushProviderName, - }, - ), - ).thenAnswer((_) async => successResponse(path, data: {})); - - final res = await deviceApi.addDevice( - deviceId, - pushProvider, - pushProviderName: pushProviderName, - ); - - expect(res, isNotNull); - - verify(() => client.post(path, data: any(named: 'data'))).called(1); - verifyNoMoreInteractions(client); - }); - - test('getDevices', () async { - const path = '/devices'; - - final devices = List.generate( - 3, - (index) => Device( - id: 'test-device-id-$index', - pushProvider: PushProvider.firebase.name, - ), - ); - - when(() => client.get(path)).thenAnswer( - (_) async => successResponse( - path, - data: { - 'devices': [...devices.map((it) => it.toJson())], - }, - ), - ); - - final res = await deviceApi.getDevices(); - - expect(res, isNotNull); - expect(res.devices.length, devices.length); - - verify(() => client.get(path)).called(1); - verifyNoMoreInteractions(client); - }); - - test('removeDevice', () async { - const deviceId = 'test-device-id'; - - const path = '/devices'; - - when( - () => client.delete( - path, - queryParameters: {'id': deviceId}, - ), - ).thenAnswer((_) async => successResponse(path, data: {})); - - final res = await deviceApi.removeDevice(deviceId); - - expect(res, isNotNull); - - verify( - () => client.delete(path, queryParameters: any(named: 'queryParameters')), - ).called(1); - verifyNoMoreInteractions(client); - }); - - test('setPushPreferences', () async { - const path = '/push_preferences'; - - const preferences = [ - PushPreferenceInput(chatLevel: ChatLevel.directMentions), - ]; - - when(() => client.post(path, data: any(named: 'data'))).thenAnswer( - (_) async => successResponse( - path, - data: { - 'user_preferences': {}, - 'user_channel_preferences': {}, - }, - ), - ); - - final res = await deviceApi.setPushPreferences(preferences); - - expect(res, isNotNull); - - verify(() => client.post(path, data: any(named: 'data'))).called(1); - verifyNoMoreInteractions(client); - }); - - test('setPushPreferences throws on empty list', () async { - expect( - () => deviceApi.setPushPreferences([]), - throwsA(isA()), - ); - }); - - test('setPushPreferences allows removeDisable as only field', () async { - const path = '/push_preferences'; - - const preferences = [ - PushPreferenceInput(removeDisable: true), - ]; - - when(() => client.post(path, data: any(named: 'data'))).thenAnswer( - (_) async => successResponse( - path, - data: { - 'user_preferences': {}, - 'user_channel_preferences': {}, - }, - ), - ); - - final res = await deviceApi.setPushPreferences(preferences); - - expect(res, isNotNull); - - verify(() => client.post(path, data: any(named: 'data'))).called(1); - verifyNoMoreInteractions(client); - }); - - test('setPushPreferences with channel-specific preference', () async { - const path = '/push_preferences'; - - const preferences = [ - PushPreferenceInput.channel( - channelCid: 'messaging:general', - chatLevel: ChatLevel.none, - ), - ]; - - when(() => client.post(path, data: any(named: 'data'))).thenAnswer( - (_) async => successResponse( - path, - data: { - 'user_preferences': {}, - 'user_channel_preferences': {}, - }, - ), - ); - - final res = await deviceApi.setPushPreferences(preferences); - - expect(res, isNotNull); - - verify(() => client.post(path, data: any(named: 'data'))).called(1); - verifyNoMoreInteractions(client); - }); -} diff --git a/packages/stream_chat/test/src/core/api/push_preferences_api_test.dart b/packages/stream_chat/test/src/core/api/push_preferences_api_test.dart new file mode 100644 index 0000000000..ca74c6f455 --- /dev/null +++ b/packages/stream_chat/test/src/core/api/push_preferences_api_test.dart @@ -0,0 +1,107 @@ +import 'package:dio/dio.dart'; +import 'package:mocktail/mocktail.dart'; +import 'package:stream_chat/src/core/api/push_preferences_api.dart'; +import 'package:stream_chat/stream_chat.dart'; +import 'package:test/test.dart'; + +import '../../mocks.dart'; + +void main() { + Response successResponse(String path, {Object? data}) => Response( + data: data, + requestOptions: RequestOptions(path: path), + statusCode: 200, + ); + + late final client = MockHttpClient(); + late PushPreferencesApi pushPreferencesApi; + + setUp(() { + pushPreferencesApi = PushPreferencesApi(client); + }); + + test('setPushPreferences', () async { + const path = '/push_preferences'; + + const preferences = [ + PushPreferenceInput(chatLevel: ChatLevel.directMentions), + ]; + + when(() => client.post(path, data: any(named: 'data'))).thenAnswer( + (_) async => successResponse( + path, + data: { + 'user_preferences': {}, + 'user_channel_preferences': {}, + }, + ), + ); + + final res = await pushPreferencesApi.setPushPreferences(preferences); + + expect(res, isNotNull); + + verify(() => client.post(path, data: any(named: 'data'))).called(1); + verifyNoMoreInteractions(client); + }); + + test('setPushPreferences throws on empty list', () async { + expect( + () => pushPreferencesApi.setPushPreferences([]), + throwsA(isA()), + ); + }); + + test('setPushPreferences allows removeDisable as only field', () async { + const path = '/push_preferences'; + + const preferences = [ + PushPreferenceInput(removeDisable: true), + ]; + + when(() => client.post(path, data: any(named: 'data'))).thenAnswer( + (_) async => successResponse( + path, + data: { + 'user_preferences': {}, + 'user_channel_preferences': {}, + }, + ), + ); + + final res = await pushPreferencesApi.setPushPreferences(preferences); + + expect(res, isNotNull); + + verify(() => client.post(path, data: any(named: 'data'))).called(1); + verifyNoMoreInteractions(client); + }); + + test('setPushPreferences with channel-specific preference', () async { + const path = '/push_preferences'; + + const preferences = [ + PushPreferenceInput.channel( + channelCid: 'messaging:general', + chatLevel: ChatLevel.none, + ), + ]; + + when(() => client.post(path, data: any(named: 'data'))).thenAnswer( + (_) async => successResponse( + path, + data: { + 'user_preferences': {}, + 'user_channel_preferences': {}, + }, + ), + ); + + final res = await pushPreferencesApi.setPushPreferences(preferences); + + expect(res, isNotNull); + + verify(() => client.post(path, data: any(named: 'data'))).called(1); + verifyNoMoreInteractions(client); + }); +} diff --git a/packages/stream_chat/test/src/core/api/responses_test.dart b/packages/stream_chat/test/src/core/api/responses_test.dart index b8571dd186..986868f4a4 100644 --- a/packages/stream_chat/test/src/core/api/responses_test.dart +++ b/packages/stream_chat/test/src/core/api/responses_test.dart @@ -3415,12 +3415,6 @@ void main() { expect(response.results, isA>()); }); - test('ListDevicesResponse', () { - const jsonExample = '''{"devices":[{"push_provider":"firebase","id":"test"}],"duration":"0.35ms"}'''; - final response = ListDevicesResponse.fromJson(json.decode(jsonExample)); - expect(response.devices, isA>()); - }); - test('SendFileResponse', () { const jsonExample = '''{"file": "file-url","duration":"0.35ms"}'''; final response = SendFileResponse.fromJson(json.decode(jsonExample)); diff --git a/packages/stream_chat/test/src/core/api/stream_chat_api_test.dart b/packages/stream_chat/test/src/core/api/stream_chat_api_test.dart index f939f465e1..31d1e96662 100644 --- a/packages/stream_chat/test/src/core/api/stream_chat_api_test.dart +++ b/packages/stream_chat/test/src/core/api/stream_chat_api_test.dart @@ -35,8 +35,8 @@ void main() { expect(streamChatApi.channel, isNotNull); }); - test('`.device`', () { - expect(streamChatApi.device, isNotNull); + test('`.pushPreferences`', () { + expect(streamChatApi.pushPreferences, isNotNull); }); test('`.moderation`', () { diff --git a/packages/stream_chat/test/src/core/models/device_test.dart b/packages/stream_chat/test/src/core/models/device_test.dart deleted file mode 100644 index b3ac707bc2..0000000000 --- a/packages/stream_chat/test/src/core/models/device_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -import 'package:stream_chat/src/core/models/device.dart'; -import 'package:test/test.dart'; - -import '../../utils.dart'; - -void main() { - group('src/models/device', () { - test('should parse json correctly', () { - final device = Device.fromJson(jsonFixture('device.json')); - expect(device.id, 'device-id'); - expect(device.pushProvider, 'push-provider'); - }); - - test('should serialize to json correctly', () { - final device = Device(id: 'device-id', pushProvider: 'push-provider'); - - expect( - device.toJson(), - { - 'id': 'device-id', - 'push_provider': 'push-provider', - }, - ); - }); - }); -} diff --git a/packages/stream_chat/test/src/core/models/own_user_test.dart b/packages/stream_chat/test/src/core/models/own_user_test.dart index 905a824600..fc2dad3f0b 100644 --- a/packages/stream_chat/test/src/core/models/own_user_test.dart +++ b/packages/stream_chat/test/src/core/models/own_user_test.dart @@ -10,7 +10,7 @@ class MockMute extends Mock implements Mute {} class ChannelMockMute extends Mock implements ChannelMute {} -class MockDevice extends Mock implements Device {} +class MockDevice extends Mock implements DeviceResponse {} void main() { final devices = [MockDevice(), MockDevice()]; @@ -31,7 +31,17 @@ void main() { expect(ownUser.lastActive, DateTime.parse('2021-06-16T11:59:59.003453014Z')); expect(ownUser.banned, false); expect(ownUser.online, true); - expect(ownUser.devices.length, 1); + expect(ownUser.devices, hasLength(1)); + final device = ownUser.devices.single; + expect(device.id, startsWith('cRS8elU4Q-qqdCAvHR2kSa:')); + expect(device.pushProvider, 'firebase'); + expect(device.userId, 'super-band-9'); + expect(device.createdAt, DateTime.parse('2020-04-23T14:36:21.838196Z')); + expect(device.pushProviderName, isNull); + expect(device.hardwareId, isNull); + expect(device.voip, isNull); + expect(device.disabled, isNull); + expect(device.disabledReason, isNull); expect(ownUser.mutes.length, 0); expect(ownUser.channelMutes.length, 1); expect(ownUser.totalUnreadCount, 0); @@ -42,6 +52,24 @@ void main() { expect(ownUser.extraData['username'], 'Rioland'); }); + test('should fail to decode a device missing a field the server always sends', () { + final json = jsonFixture('own_user.json'); + final device = Map.from((json['devices']! as List).single as Map); + + for (final field in ['id', 'push_provider', 'created_at', 'user_id']) { + final incomplete = Map.from(device)..remove(field); + + expect( + () => OwnUser.fromJson({ + ...json, + 'devices': [incomplete], + }), + throwsA(isA()), + reason: 'a device without $field should not decode', + ); + } + }); + test('should initialize a OwnUser from a User correctly', () { final user = User.fromJson(jsonFixture('user.json')); final ownUser = OwnUser.fromUser(user); @@ -298,6 +326,7 @@ void main() { 'id': 'device-1', 'push_provider': 'firebase', 'created_at': '2023-01-01T00:00:00.000Z', + 'user_id': 'test-user', }, ], }; @@ -423,9 +452,11 @@ void main() { 'custom_field': 'custom_value', }, devices: [ - Device( + DeviceResponse( id: 'device-1', pushProvider: 'firebase', + createdAt: DateTime.utc(2024), + userId: 'test-user-id', ), ], totalUnreadCount: 10, @@ -482,13 +513,17 @@ void main() { 'is_verified': true, }, devices: [ - Device( + DeviceResponse( id: 'device-1', pushProvider: 'firebase', + createdAt: DateTime.utc(2024), + userId: 'test-user-id', ), - Device( + DeviceResponse( id: 'device-2', pushProvider: 'apn', + createdAt: DateTime.utc(2024), + userId: 'test-user-id', ), ], totalUnreadCount: 25, diff --git a/packages/stream_chat/test/src/fakes.dart b/packages/stream_chat/test/src/fakes.dart index 2c362f5b87..8974496e6d 100644 --- a/packages/stream_chat/test/src/fakes.dart +++ b/packages/stream_chat/test/src/fakes.dart @@ -2,12 +2,12 @@ import 'dart:async'; import 'package:mocktail/mocktail.dart'; import 'package:stream_chat/src/core/api/channel_api.dart'; -import 'package:stream_chat/src/core/api/device_api.dart'; import 'package:stream_chat/src/core/api/general_api.dart'; import 'package:stream_chat/src/core/api/guest_api.dart'; import 'package:stream_chat/src/core/api/message_api.dart'; import 'package:stream_chat/src/core/api/moderation_api.dart'; import 'package:stream_chat/src/core/api/polls_api.dart'; +import 'package:stream_chat/src/core/api/push_preferences_api.dart'; import 'package:stream_chat/src/core/api/user_api.dart'; import 'package:stream_chat/src/core/api/user_groups_api.dart'; import 'package:stream_chat/stream_chat.dart'; @@ -150,10 +150,10 @@ class FakeChatApi extends Fake implements StreamChatApi { @override ChannelApi get channel => _channel ??= MockChannelApi(); - DeviceApi? _device; + PushPreferencesApi? _pushPreferences; @override - DeviceApi get device => _device ??= MockDeviceApi(); + PushPreferencesApi get pushPreferences => _pushPreferences ??= MockPushPreferencesApi(); ModerationApi? _moderation; diff --git a/packages/stream_chat/test/src/mocks.dart b/packages/stream_chat/test/src/mocks.dart index e5b9e9c5fd..e8d27e8ce0 100644 --- a/packages/stream_chat/test/src/mocks.dart +++ b/packages/stream_chat/test/src/mocks.dart @@ -6,12 +6,12 @@ import 'package:stream_chat/src/client/channel_delivery_reporter.dart'; import 'package:stream_chat/src/client/client.dart'; import 'package:stream_chat/src/core/api/attachment_file_uploader.dart'; import 'package:stream_chat/src/core/api/channel_api.dart'; -import 'package:stream_chat/src/core/api/device_api.dart'; import 'package:stream_chat/src/core/api/general_api.dart'; import 'package:stream_chat/src/core/api/guest_api.dart'; import 'package:stream_chat/src/core/api/message_api.dart'; import 'package:stream_chat/src/core/api/moderation_api.dart'; import 'package:stream_chat/src/core/api/polls_api.dart'; +import 'package:stream_chat/src/core/api/push_preferences_api.dart'; import 'package:stream_chat/src/core/api/user_api.dart'; import 'package:stream_chat/src/core/api/user_groups_api.dart'; import 'package:stream_chat/src/core/http/stream_http_client.dart'; @@ -53,7 +53,7 @@ class MockPollsApi extends Mock implements PollsApi {} class MockChannelApi extends Mock implements ChannelApi {} -class MockDeviceApi extends Mock implements DeviceApi {} +class MockPushPreferencesApi extends Mock implements PushPreferencesApi {} class MockModerationApi extends Mock implements ModerationApi {} diff --git a/packages/stream_chat/test/src/repository/devices_repository_test.dart b/packages/stream_chat/test/src/repository/devices_repository_test.dart new file mode 100644 index 0000000000..9401e2f02d --- /dev/null +++ b/packages/stream_chat/test/src/repository/devices_repository_test.dart @@ -0,0 +1,179 @@ +import 'package:mocktail/mocktail.dart'; +import 'package:stream_chat/open_api/api.dart'; +import 'package:stream_chat/src/repository/devices_repository.dart'; +import 'package:stream_core/stream_core.dart'; +import 'package:test/test.dart'; + +import '../mocks.dart'; + +void main() { + late MockDefaultApi api; + late DevicesRepository repository; + + setUp(() { + api = MockDefaultApi(); + repository = DevicesRepository(api); + }); + + group('addDevice', () { + test('should forward the id and provider without a name', () async { + const request = CreateDeviceRequest( + id: 'device-id', + pushProvider: CreateDeviceRequestPushProvider.firebase, + ); + + when(() => api.createDevice(createDeviceRequest: request)).thenAnswer( + (_) async => const Result.success(DurationResponse(duration: '0.01ms')), + ); + + final res = await repository.addDevice( + 'device-id', + CreateDeviceRequestPushProvider.firebase, + ); + + expect(res.isSuccess, isTrue); + verify(() => api.createDevice(createDeviceRequest: request)).called(1); + verifyNoMoreInteractions(api); + }); + + test('should forward the provider name when given', () async { + const request = CreateDeviceRequest( + id: 'device-id', + pushProvider: CreateDeviceRequestPushProvider.apn, + pushProviderName: 'staging', + ); + + when(() => api.createDevice(createDeviceRequest: request)).thenAnswer( + (_) async => const Result.success(DurationResponse(duration: '0.01ms')), + ); + + await repository.addDevice( + 'device-id', + CreateDeviceRequestPushProvider.apn, + pushProviderName: 'staging', + ); + + verify(() => api.createDevice(createDeviceRequest: request)).called(1); + verifyNoMoreInteractions(api); + }); + + test('should send an empty provider name as no name', () async { + const request = CreateDeviceRequest( + id: 'device-id', + pushProvider: CreateDeviceRequestPushProvider.apn, + ); + + when(() => api.createDevice(createDeviceRequest: request)).thenAnswer( + (_) async => const Result.success(DurationResponse(duration: '0.01ms')), + ); + + await repository.addDevice( + 'device-id', + CreateDeviceRequestPushProvider.apn, + pushProviderName: '', + ); + + verify(() => api.createDevice(createDeviceRequest: request)).called(1); + verifyNoMoreInteractions(api); + }); + + test('should send every provider under its wire value', () async { + const providers = { + CreateDeviceRequestPushProvider.apn: 'apn', + CreateDeviceRequestPushProvider.firebase: 'firebase', + CreateDeviceRequestPushProvider.huawei: 'huawei', + CreateDeviceRequestPushProvider.xiaomi: 'xiaomi', + }; + + for (final MapEntry(key: provider, value: wireValue) in providers.entries) { + final request = CreateDeviceRequest(id: 'device-id', pushProvider: provider); + + when(() => api.createDevice(createDeviceRequest: request)).thenAnswer( + (_) async => const Result.success(DurationResponse(duration: '0.01ms')), + ); + + await repository.addDevice('device-id', provider); + + expect(provider, wireValue); + verify(() => api.createDevice(createDeviceRequest: request)).called(1); + } + + verifyNoMoreInteractions(api); + }); + + test('should return the failure without throwing', () async { + const error = StreamClientException(message: 'boom'); + const request = CreateDeviceRequest( + id: 'device-id', + pushProvider: CreateDeviceRequestPushProvider.firebase, + ); + + when(() => api.createDevice(createDeviceRequest: request)).thenAnswer( + (_) async => const Result.failure(error), + ); + + final res = await repository.addDevice( + 'device-id', + CreateDeviceRequestPushProvider.firebase, + ); + + expect(res.isFailure, isTrue); + expect(res.exceptionOrNull(), error); + }); + }); + + group('getDevices', () { + test('should pass the response through untouched', () async { + final device = DeviceResponse( + id: 'device-id', + pushProvider: 'firebase', + createdAt: DateTime.utc(2024), + userId: 'user-id', + ); + + when(api.listDevices).thenAnswer( + (_) async => Result.success(ListDevicesResponse(duration: '0.01ms', devices: [device])), + ); + + final res = await repository.getDevices(); + + expect(res.getOrNull()?.devices.single, device); + verify(api.listDevices).called(1); + verifyNoMoreInteractions(api); + }); + + test('should return the failure without throwing', () async { + const error = StreamClientException(message: 'boom'); + when(api.listDevices).thenAnswer((_) async => const Result.failure(error)); + + final res = await repository.getDevices(); + + expect(res.isFailure, isTrue); + expect(res.exceptionOrNull(), error); + }); + }); + + group('removeDevice', () { + test('should forward the id', () async { + when(() => api.deleteDevice(id: 'device-id')).thenAnswer( + (_) async => const Result.success(DurationResponse(duration: '0.01ms')), + ); + + final res = await repository.removeDevice('device-id'); + + expect(res.isSuccess, isTrue); + verify(() => api.deleteDevice(id: 'device-id')).called(1); + verifyNoMoreInteractions(api); + }); + + test('should return the failure without throwing', () async { + const error = StreamClientException(message: 'boom'); + when(() => api.deleteDevice(id: 'device-id')).thenAnswer((_) async => const Result.failure(error)); + + final res = await repository.removeDevice('device-id'); + + expect(res.isFailure, isTrue); + expect(res.exceptionOrNull(), error); + }); + }); +} diff --git a/sample_app/lib/auth/auth_controller.dart b/sample_app/lib/auth/auth_controller.dart index 1dcf4f4ce8..c2d9287664 100644 --- a/sample_app/lib/auth/auth_controller.dart +++ b/sample_app/lib/auth/auth_controller.dart @@ -4,7 +4,7 @@ import 'package:firebase_crashlytics/firebase_crashlytics.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/scheduler.dart'; import 'package:flutter_secure_storage/flutter_secure_storage.dart'; -import 'package:stream_chat_flutter/stream_chat_flutter.dart' hide PushProvider; +import 'package:stream_chat_flutter/stream_chat_flutter.dart'; import 'package:stream_chat_persistence/stream_chat_persistence.dart'; import '../push/push_provider.dart'; diff --git a/sample_app/lib/push/push_provider.dart b/sample_app/lib/push/push_provider.dart index 3ce184994e..092ba679e6 100644 --- a/sample_app/lib/push/push_provider.dart +++ b/sample_app/lib/push/push_provider.dart @@ -15,7 +15,7 @@ class PushProvider { const PushProvider.firebase({ required this.name, this._tokenStreamProvider = _firebaseTokenProvider, - }) : type = chat.PushProvider.firebase; + }) : type = chat.CreateDeviceRequestPushProvider.firebase; /// Raw Apple Push Notification service. /// @@ -26,7 +26,7 @@ class PushProvider { const PushProvider.apn({ required this.name, this._tokenStreamProvider = _apnTokenProvider, - }) : type = chat.PushProvider.apn; + }) : type = chat.CreateDeviceRequestPushProvider.apn; static Stream _firebaseTokenProvider() async* { // On iOS, `getToken()` throws if the APNs token isn't registered with @@ -77,7 +77,7 @@ class PushProvider { final String name; /// The Stream Chat provider type (FCM or APNs). - final chat.PushProvider type; + final chat.CreateDeviceRequestPushProvider type; /// Returns the current push token, or throws [TimeoutException] if /// the token isn't available within [timeout]. diff --git a/sample_app/lib/push/push_token_manager.dart b/sample_app/lib/push/push_token_manager.dart index 58eaeca7c9..bec5f45d1c 100644 --- a/sample_app/lib/push/push_token_manager.dart +++ b/sample_app/lib/push/push_token_manager.dart @@ -1,7 +1,7 @@ import 'dart:async'; import 'package:flutter/foundation.dart' show debugPrint; -import 'package:stream_chat_flutter/stream_chat_flutter.dart' hide PushProvider; +import 'package:stream_chat_flutter/stream_chat_flutter.dart'; import 'push_provider.dart'; @@ -26,16 +26,16 @@ class PushTokenManager { Future _onTokenRefresh(String token, PushProvider provider) async { debugPrint('[push] token received (provider=${provider.name})'); - try { - await client.addDevice( - token, - provider.type, - pushProviderName: provider.name, - ); - debugPrint('[push] addDevice OK (type=${provider.type.name}, name=${provider.name})'); - } catch (e, stk) { - debugPrint('[push] addDevice failed: $e; $stk'); - } + final result = await client.addDevice( + token, + provider.type, + pushProviderName: provider.name, + ); + + result.fold( + onSuccess: (_) => debugPrint('[push] addDevice OK (type=${provider.type}, name=${provider.name})'), + onFailure: (e, stk) => debugPrint('[push] addDevice failed: $e; $stk'), + ); } PushProvider? get _currentPushProvider { @@ -71,12 +71,12 @@ class PushTokenManager { return; } - try { - await client.removeDevice(token); - debugPrint('[push] removeDevice OK'); - } catch (e, stk) { - debugPrint('[push] removeDevice failed: $e; $stk'); - } + final result = await client.removeDevice(token); + + result.fold( + onSuccess: (_) => debugPrint('[push] removeDevice OK'), + onFailure: (e, stk) => debugPrint('[push] removeDevice failed: $e; $stk'), + ); } /// Cancels the token-refresh subscription. Idempotent. From db82e64343d0ec11cb8c9cf1626395968743f9d1 Mon Sep 17 00:00:00 2001 From: Petar Velikov Date: Tue, 22 Sep 2026 15:23:22 +0200 Subject: [PATCH 20/36] docs(repo): require the style and testing guides in every v11 migration (#2986) * docs(repo): require the style and testing guides in every v11 migration Co-Authored-By: Claude Opus 5 * docs(repo): vendor Effective Dart's documentation guide and require it in migrations Co-Authored-By: Claude Opus 5 --------- Co-authored-by: Claude Opus 5 --- .claude/skills/openapi-migration/SKILL.md | 38 ++ CLAUDE.md | 7 +- EFFECTIVE_DART_DOC.md | 627 ++++++++++++++++++ STYLE_GUIDE.md | 8 +- core-migration/05-http-client.md | 5 + core-migration/07-websocket.md | 5 + core-migration/09-uploads.md | 5 + core-migration/10-cleanup.md | 5 + core-migration/README.md | 6 + openapi-migration/01-foundation.md | 5 + openapi-migration/02-devices.md | 5 + openapi-migration/03-user-groups.md | 5 + openapi-migration/04-roles-guest-and-app.md | 5 + openapi-migration/05-polls.md | 5 + openapi-migration/06-reminders.md | 5 + openapi-migration/07-threads-and-drafts.md | 5 + .../08-moderation-and-blocklists.md | 5 + openapi-migration/09-users.md | 5 + openapi-migration/10-messages.md | 5 + openapi-migration/11-channels-and-members.md | 5 + openapi-migration/12-uploads-cdn.md | 5 + openapi-migration/13-push-preferences.md | 5 + openapi-migration/README.md | 5 + openapi-migration/tool/generate_plan.py | 5 + 24 files changed, 777 insertions(+), 4 deletions(-) create mode 100644 EFFECTIVE_DART_DOC.md diff --git a/.claude/skills/openapi-migration/SKILL.md b/.claude/skills/openapi-migration/SKILL.md index e44427fe49..68b0a57640 100644 --- a/.claude/skills/openapi-migration/SKILL.md +++ b/.claude/skills/openapi-migration/SKILL.md @@ -31,6 +31,12 @@ Two documents bracket this work, and you should read both before starting: reconstructed at release. Read its Symbol Map and Error Handling sections before designing a change: they define the shape consumers have already been promised. +**`STYLE_GUIDE.md`** (§ Documentation, § Testing), **`EFFECTIVE_DART_DOC.md`** and **`TESTING.md`** are the +repo's conventions, and a migration follows them like any other change. `EFFECTIVE_DART_DOC.md` is Effective +Dart's documentation guide vendored into the repo; the style guide wins where the two disagree. Phases 4 and 5 +name the rules migrations keep breaking; that is a shortlist, not a substitute for the guides. Where they +disagree with this skill, the guides win. + Work the phases in order. Most of the cost is in phases 1–2 — the code is mechanical once the inventory and the shape decisions exist. @@ -242,6 +248,23 @@ comm -12 \ | sed "s|.*/\([a-z_]*\)\.dart';|\1|" | sort) ``` +### Documenting the public surface + +Write these as you write the code. `public_member_api_docs` only checks a doc *exists*, so a placeholder survives +`melos run analyze`. The rules are `STYLE_GUIDE.md` § Documentation over `EFFECTIVE_DART_DOC.md` — the latter +covers dartdoc form (single-sentence first paragraph, "Whether…" for booleans, noun phrases for properties, +square brackets for in-scope identifiers), the former wins where they disagree. Three things migrations get +wrong on top of that: + +- **Scope is the surface the group touches**, not just the new repository. The `StreamChatClient` delegates + duplicate its docs verbatim, so a fix belongs in both. +- **Retyping a field leaves its doc describing the old type**, and that line is not in the diff. `OwnUser.devices` + still reads `/// List of user devices.` after becoming a `DeviceResponse`. Re-read the docs on what you retyped. +- **Describe behaviour, and every non-obvious parameter** — a bare `nameGt` cursor tells a reader nothing. Why a + shape was adopted belongs in the plan file and the PR body, not in a doc comment. + +Stop at docs the migration neither touched nor invalidated; one feature group per PR applies to docs too. + ## Phase 5 — rewrite the tests Budget for this: on a typical feature it is most of the diff, and none of it is mechanical. @@ -255,6 +278,17 @@ Budget for this: on a typical feature it is most of the diff, and none of it is - `test/src/core/api/responses_test.dart` round-trips the DTO from JSON — keep it passing while the DTO exists, delete it with the DTO. +Rewrite onto `TESTING.md` rather than carrying the old file's habits across. What breaks most often: + +- **No `group` organizing a file by method.** `group('addDevice')`, `group('getDevices')` is the shape a migrated + repository test falls into, and `TESTING.md` names it an anti-pattern. A `group` states a shared precondition; + anything else belongs in a separate file. +- **Each name states subject and behaviour**, so `dart test` output says what broke: + `searchRoles forwards only the query when nothing else is given`. +- **No two tests share a name**, which dropping the groups is what exposes — three identical + `returns the failure without throwing`. +- **One behaviour per test.** + ## Phase 6 — verify and land `melos run analyze`, `melos run test:dart`, plus `stream_chat_persistence`'s tests if the feature's responses feed @@ -264,6 +298,10 @@ persistence. `**/*.g.dart` and `**/*.freezed.dart` repo-wide, so the retrofit `default_api.g.dart` and ~490 generated `.freezed.dart` files are never analyzed. Exercising the code in a test is what actually compiles it. +**Neither does it cover the guides.** `--fatal-infos` checks a public member *has* a doc, never what it says or +how a test is named. Re-read the diff against `STYLE_GUIDE.md` § Documentation, `EFFECTIVE_DART_DOC.md` and +`TESTING.md` before opening the PR — that read is what the last two definition-of-done boxes stand for. + The PR body carries the group's scope, the phase 2 decisions with their reasons, and any endpoint left hand-written and why. Then close the loop in the plan: tick the definition-of-done boxes in the group's file and its status box in `openapi-migration/README.md`, so the next person sees where the migration actually stands. diff --git a/CLAUDE.md b/CLAUDE.md index 69827781bb..ef46b85cb7 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -4,8 +4,11 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co > **Before writing or reviewing code, read [`STYLE_GUIDE.md`](STYLE_GUIDE.md).** It is > the source of truth for coding conventions, documentation style, testing, changelog -> policy, and repo-specific rules that diverge from the Flutter / Dart defaults. This -> file is a repo overview; the style guide is the rulebook. +> policy, and repo-specific rules that diverge from the Flutter / Dart defaults. See +> [`TESTING.md`](TESTING.md) for guidance on writing effective tests, and +> [`EFFECTIVE_DART_DOC.md`](EFFECTIVE_DART_DOC.md) — a vendored copy of Effective Dart's +> documentation guide — before writing any dartdoc; the style guide wins where they +> disagree. This file is a repo overview; the style guide is the rulebook. ## Overview diff --git a/EFFECTIVE_DART_DOC.md b/EFFECTIVE_DART_DOC.md new file mode 100644 index 0000000000..f2f08d93a5 --- /dev/null +++ b/EFFECTIVE_DART_DOC.md @@ -0,0 +1,627 @@ +# Effective Dart: Documentation + +> Vendored from [dart.dev/effective-dart/documentation](https://dart.dev/effective-dart/documentation) +> ([source](https://github.com/dart-lang/site-www/blob/main/src/content/effective-dart/documentation.md), +> CC BY 4.0) so it is available offline to contributors and coding agents. The canonical version on +> dart.dev wins where the two differ. Where [`STYLE_GUIDE.md`](STYLE_GUIDE.md) contradicts this +> document, the style guide wins. + +It's easy to think your code is obvious today without realizing how much you +rely on context already in your head. People new to your code, and +even your forgetful future self won't have that context. A concise, accurate +comment only takes a few seconds to write but can save one of those people +hours of time. + +We all know code should be self-documenting and not all comments are helpful. +But the reality is that most of us don't write as many comments as we should. +It's like exercise: you technically *can* do too much, but it's a lot more +likely that you're doing too little. Try to step it up. + +## Comments + +The following tips apply to comments that you don't want included in the +generated documentation. + +### DO format comments like sentences + +**Good:** + +```dart +// Not if anything comes before it. +if (_chunks.isNotEmpty) return false; +``` + +Capitalize the first word unless it's a case-sensitive identifier. End it with a +period (or "!" or "?", I suppose). This is true for all comments: doc comments, +inline stuff, even TODOs. Even if it's a sentence fragment. + +### DON'T use block comments for documentation + +**Good:** + +```dart +void greet(String name) { + // Assume we have a valid name. + print('Hi, $name!'); +} +``` + +**Bad:** + +```dart +void greet(String name) { + /* Assume we have a valid name. */ + print('Hi, $name!'); +} +``` + +You can use a block comment (`/* ... */`) to temporarily comment out a section +of code, but all other comments should use `//`. + +## Doc comments + +Doc comments are especially handy because [`dart doc`][] parses them +and generates [beautiful doc pages][docs] from them. +A doc comment is any comment that appears before a declaration +and uses the special `///` syntax that `dart doc` looks for. + +[`dart doc`]: /tools/dart-doc +[docs]: https://api.dart.dev + +### DO use `///` doc comments to document members and types + + +Using a doc comment instead of a regular comment enables +[`dart doc`][] to find it +and generate documentation for it. + +**Good:** + +```dart +/// The number of characters in this chunk when unsplit. +int get length => ... +``` + +**Bad:** + +```dart +// The number of characters in this chunk when unsplit. +int get length => ... +``` + +For historical reasons, `dart doc` supports two syntaxes of doc comments: `///` +("C# style") and `/** ... */` ("JavaDoc style"). We prefer `///` because it's +more compact. `/**` and `*/` add two content-free lines to a multiline doc +comment. The `///` syntax is also easier to read in some situations, such as +when a doc comment contains a bulleted list that uses `*` to mark list items. + +If you stumble onto code that still uses the JavaDoc style, consider cleaning it +up. + +### PREFER writing doc comments for public APIs + + +You don't have to document every single library, top-level variable, type, and +member, but you should document most of them. + +### CONSIDER writing a library-level doc comment + +Unlike languages like Java where the class is the only unit of program +organization, in Dart, a library is itself an entity that users work with +directly, import, and think about. That makes the `library` directive a great +place for documentation that introduces the reader to the main concepts and +functionality provided within. Consider including: + +* A single-sentence summary of what the library is for. +* Explanations of terminology used throughout the library. +* A couple of complete code samples that walk through using the API. +* Links to the most important or most commonly used classes and functions. +* Links to external references on the domain the library is concerned with. + +To document a library, place a doc comment before +the `library` directive and any annotations that might be attached +at the start of the file. + +**Good:** + +```dart +/// A really great test library. +@TestOn('browser') +library; +``` + +### CONSIDER writing doc comments for private APIs + +Doc comments aren't just for external consumers of your library's public API. +They can also be helpful for understanding private members that are called from +other parts of the library. + +### DO start doc comments with a single-sentence summary + +Start your doc comment with a brief, user-centric description ending with a +period. A sentence fragment is often sufficient. Provide just enough context for +the reader to orient themselves and decide if they should keep reading or look +elsewhere for the solution to their problem. + +**Good:** + +```dart +/// Deletes the file at [path] from the file system. +void delete(String path) { + ... +} +``` + +**Bad:** + +```dart +/// Depending on the state of the file system and the user's permissions, +/// certain operations may or may not be possible. If there is no file at +/// [path] or it can't be accessed, this function throws either [IOError] +/// or [PermissionError], respectively. Otherwise, this deletes the file. +void delete(String path) { + ... +} +``` + +### DO separate the first sentence of a doc comment into its own paragraph + +Add a blank line after the first sentence to split it out into its own +paragraph. If more than a single sentence of explanation is useful, put the +rest in later paragraphs. + +This helps you write a tight first sentence that summarizes the documentation. +Also, tools like `dart doc` use the first paragraph as a short summary in places +like lists of classes and members. + +**Good:** + +```dart +/// Deletes the file at [path]. +/// +/// Throws an [IOError] if the file could not be found. Throws a +/// [PermissionError] if the file is present but could not be deleted. +void delete(String path) { + ... +} +``` + +**Bad:** + +```dart +/// Deletes the file at [path]. Throws an [IOError] if the file could not +/// be found. Throws a [PermissionError] if the file is present but could +/// not be deleted. +void delete(String path) { + ... +} +``` + +### AVOID redundancy with the surrounding context + +The reader of a class's doc comment can clearly see the name of the class, what +interfaces it implements, etc. When reading docs for a member, the signature is +right there, and the enclosing class is obvious. None of that needs to be +spelled out in the doc comment. Instead, focus on explaining what the reader +*doesn't* already know. + +**Good:** + +```dart +class RadioButtonWidget extends Widget { + /// Sets the tooltip to [lines]. + /// + /// The lines should be word wrapped using the current font. + void tooltip(List lines) { + ... + } +} +``` + +**Bad:** + +```dart +class RadioButtonWidget extends Widget { + /// Sets the tooltip for this radio button widget to the list of strings in + /// [lines]. + void tooltip(List lines) { + ... + } +} +``` + +Only add doc comments when providing context, caveats, or usage details +not immediately obvious from the surrounding context. + + +### PREFER starting comments of a function or method with third-person verbs if its main purpose is a side effect + +The doc comment should focus on what the code *does*. + +**Good:** + +```dart +/// Connects to the server and fetches the query results. +Stream fetchResults(Query query) => ... + +/// Starts the stopwatch if not already running. +void start() => ... +``` + +### PREFER starting a non-boolean variable or property comment with a noun phrase + +The doc comment should stress what the property *is*. This is true even for +getters which may do calculation or other work. What the caller cares about is +the *result* of that work, not the work itself. + +**Good:** + +```dart +/// The current day of the week, where `0` is Sunday. +int weekday; + +/// The number of checked buttons on the page. +int get checkedCount => ... +``` + +### PREFER starting a boolean variable or property comment with "Whether" followed by a noun or gerund phrase + +The doc comment should clarify the states this variable represents. +This is true even for getters which may do calculation or other work. +What the caller cares about is the *result* of that work, not the work itself. + +**Good:** + +```dart +/// Whether the modal is currently displayed to the user. +bool isVisible; + +/// Whether the modal should confirm the user's intent on navigation. +bool get shouldConfirm => ... + +/// Whether resizing the current browser window will also resize the modal. +bool get canResize => ... +``` + +> This guideline intentionally doesn't include using "Whether or not". In many +> cases, usage of "or not" with "whether" is superfluous and can be omitted, +> especially when used in this context. + +### PREFER a noun phrase or non-imperative verb phrase for a function or method if returning a value is its primary purpose + +If a method is *syntactically* a method, but *conceptually* it is a property, +and is therefore [named with a noun phrase or non-imperative verb phrase][parameterized_property_name], +it should also be documented as such. +Use a noun-phrase for such non-boolean functions, and +a phrase starting with "Whether" for such boolean functions, +just as for a syntactic property or variable. + +**Good:** + +```dart +/// The [index]th element of this iterable in iteration order. +E elementAt(int index); + +/// Whether this iterable contains an element equal to [element]. +bool contains(Object? element); +``` + +> This guideline should be applied based on whether the declaration is +> conceptually seen as a property. +> +> Sometimes a method has no side effects, and might +> conceptually be seen as a property, but is still +> simpler to name with a verb phrase like `list.take()`. +> Then a noun phrase should still be used to document it. +> _For example `Iterable.take` can be described as +> "The first \[count\] elements of ..."._ + +[parameterized_property_name]: design#prefer-a-noun-phrase-or-non-imperative-verb-phrase-for-a-function-or-method-if-returning-a-value-is-its-primary-purpose + +### DON'T write documentation for both the getter and setter of a property + +If a property has both a getter and a setter, then create a doc comment for +only one of them. `dart doc` treats the getter and setter like a single field, +and if both the getter and the setter have doc comments, then +`dart doc` discards the setter's doc comment. + +**Good:** + +```dart +/// The pH level of the water in the pool. +/// +/// Ranges from 0-14, representing acidic to basic, with 7 being neutral. +int get phLevel => ... +set phLevel(int level) => ... +``` + +**Bad:** + +```dart +/// The depth of the water in the pool, in meters. +int get waterDepth => ... + +/// Updates the water depth to a total of [meters] in height. +set waterDepth(int meters) => ... +``` + +### PREFER starting library or type comments with noun phrases + +Doc comments for classes are often the most important documentation in your +program. They describe the type's invariants, establish the terminology it uses, +and provide context to the other doc comments for the class's members. A little +extra effort here can make all of the other members simpler to document. + +The documentation should describe an *instance* of the type. + +**Good:** + +```dart +/// A chunk of non-breaking output text terminated by a hard or soft newline. +/// +/// ... +class Chunk { + ... +} +``` + +### CONSIDER including code samples in doc comments + +**Good:** + +````dart +/// The lesser of two numbers. +/// +/// ```dart +/// min(5, 3) == 3 +/// ``` +num min(num a, num b) => ... +```` + +Humans are great at generalizing from examples, so even a single code sample +makes an API easier to learn. + +### DO use square brackets in doc comments to refer to in-scope identifiers + + +If you surround things like variable, method, or type names in square brackets, +then `dart doc` looks up the name and links to the relevant API docs. +Parentheses are optional but can +clarify you're referring to a function or constructor. +The following partial doc comments illustrate a few cases +where these comment references can be helpful: + +**Good:** + +```dart +/// Throws a [StateError] if ... +/// +/// Similar to [anotherMethod()], but ... +``` + +To link to a member of a specific class, use the class name and member name, +separated by a dot: + +**Good:** + +```dart +/// Similar to [Duration.inDays], but handles fractional days. +``` + +The dot syntax can also be used to refer to named constructors. For the unnamed +constructor, use `.new` after the class name: + +**Good:** + +```dart +/// To create a point, call [Point.new] or use [Point.polar] to ... +``` + +To learn more about the references that +the analyzer and `dart doc` support in doc comments, +check out [Documentation comment references][]. + +[Documentation comment references]: /tools/doc-comments/references + +### DO use prose to explain parameters, return values, and exceptions + +Other languages use verbose tags and sections to describe what the parameters +and returns of a method are. + +**Bad:** + +```dart +/// Defines a flag with the given name and abbreviation. +/// +/// @param name The name of the flag. +/// @param abbr The abbreviation for the flag. +/// @returns The new flag. +/// @throws ArgumentError If there is already an option with +/// the given name or abbreviation. +Flag addFlag(String name, String abbreviation) => ... +``` + +The convention in Dart is to integrate that into the description of the method +and highlight parameters using square brackets. + +Consider having sections starting with "The \[parameter\]" to describe +parameters, with "Returns" for the returned value and "Throws" for exceptions. +Errors can be documented the same way as exceptions, +or just as requirements that must be satisfied, without documenting the +precise error which will be thrown. + +**Good:** + +```dart +/// Defines a flag with the given [name] and [abbreviation]. +/// +/// The [name] and [abbreviation] strings must not be empty. +/// +/// Returns a new flag. +/// +/// Throws a [DuplicateFlagException] if there is already an option named +/// [name] or there is already an option using the [abbreviation]. +Flag addFlag(String name, String abbreviation) => ... +``` + +### DO put doc comments before metadata annotations + +**Good:** + +```dart +/// A button that can be flipped on and off. +@Component(selector: 'toggle') +class ToggleComponent {} +``` + +**Bad:** + +```dart +@Component(selector: 'toggle') +/// A button that can be flipped on and off. +class ToggleComponent {} +``` + +## Markdown + +You are allowed to use most [markdown][] formatting in your doc comments and +`dart doc` will process it accordingly using the [markdown package.][] + +[markdown]: https://daringfireball.net/projects/markdown/ +[markdown package.]: https://pub.dev/packages/markdown + +There are tons of guides out there already to introduce you to Markdown. Its +universal popularity is why we chose it. Here's just a quick example to give you +a flavor of what's supported: + +````dart +/// This is a paragraph of regular text. +/// +/// This sentence has *two* _emphasized_ words (italics) and **two** +/// __strong__ ones (bold). +/// +/// A blank line creates a separate paragraph. It has some `inline code` +/// delimited using backticks. +/// +/// * Unordered lists. +/// * Look like ASCII bullet lists. +/// * You can also use `-` or `+`. +/// +/// 1. Numbered lists. +/// 2. Are, well, numbered. +/// 1. But the values don't matter. +/// +/// * You can nest lists too. +/// * They must be indented at least 4 spaces. +/// * (Well, 5 including the space after `///`.) +/// +/// Code blocks are fenced in triple backticks: +/// +/// ```dart +/// this.code +/// .will +/// .retain(its, formatting); +/// ``` +/// +/// The code language (for syntax highlighting) defaults to Dart. You can +/// specify it by putting the name of the language after the opening backticks: +/// +/// ```html +///

HTML is magical!

+/// ``` +/// +/// Links can be: +/// +/// * https://www.just-a-bare-url.com +/// * [with the URL inline](https://google.com) +/// * [or separated out][ref link] +/// +/// [ref link]: https://google.com +/// +/// # A Header +/// +/// ## A subheader +/// +/// ### A subsubheader +/// +/// #### If you need this many levels of headers, you're doing it wrong +```` + +### AVOID using markdown excessively + +When in doubt, format less. Formatting exists to illuminate your content, not +replace it. Words are what matter. + +### AVOID using HTML for formatting + +It *may* be useful to use it in rare cases for things like tables, but in almost +all cases, if it's too complex to express in Markdown, you're better off not +expressing it. + +### PREFER backtick fences for code blocks + +Markdown has two ways to indicate a block of code: indenting the code four +spaces on each line, or surrounding it in a pair of triple-backtick "fence" +lines. The former syntax is brittle when used inside things like Markdown lists +where indentation is already meaningful or when the code block itself contains +indented code. + +The backtick syntax avoids those indentation woes, lets you indicate the code's +language, and is consistent with using backticks for inline code. + +**Good:** + +```dart +/// You can use [CodeBlockExample] like this: +/// +/// ```dart +/// var example = CodeBlockExample(); +/// print(example.isItGreat); // "Yes." +/// ``` +``` + +**Bad:** + +```dart +/// You can use [CodeBlockExample] like this: +/// +/// var example = CodeBlockExample(); +/// print(example.isItGreat); // "Yes." +``` + +## Writing + +We think of ourselves as programmers, but most of the characters in a source +file are intended primarily for humans to read. English is the language we code +in to modify the brains of our coworkers. As for any programming language, it's +worth putting effort into improving your proficiency. + +This section lists a few guidelines for our docs. You can learn more about +best practices for technical writing, in general, from articles such as +[Technical writing style](https://en.wikiversity.org/wiki/Technical_writing_style). + +### PREFER brevity + +Be clear and precise, but also terse. + +### AVOID abbreviations and acronyms unless they are obvious + +Many people don't know what "i.e.", "e.g." and "et al." mean. That acronym +that you're sure everyone in your field knows may not be as widely known as you +think. + +### PREFER using "this" instead of "the" to refer to a member's instance + +When documenting a member for a class, you often need to refer back to the +object the member is being called on. Using "the" can be ambiguous. +Prefer having some qualifier after "this", a sole "this" can be ambiguous too. + +```dart +class Box { + /// The value this box wraps. + Object? _value; + + /// Whether this box contains a value. + bool get hasValue => _value != null; +} +``` diff --git a/STYLE_GUIDE.md b/STYLE_GUIDE.md index 84dec6dc7e..ac50b65f6f 100644 --- a/STYLE_GUIDE.md +++ b/STYLE_GUIDE.md @@ -395,8 +395,12 @@ than the CI expects. We use dartdoc for public API documentation. All public members in SDK packages must have documentation (`public_member_api_docs` lint is enabled). -In general, follow the [Effective Dart documentation guide](https://dart.dev/effective-dart/documentation) -except where this page contradicts it. +In general, follow the Effective Dart documentation guide — vendored in this repo as +[`EFFECTIVE_DART_DOC.md`](EFFECTIVE_DART_DOC.md) so it is readable offline +(canonical version at [dart.dev](https://dart.dev/effective-dart/documentation)) — except where +this page contradicts it. Read it before writing or reviewing dartdoc: the rules most often +missed are single-sentence first paragraphs, "Whether…" for booleans, noun phrases for +properties, square brackets for in-scope identifiers, and throws documented in prose. ### Answer your own questions straight away diff --git a/core-migration/05-http-client.md b/core-migration/05-http-client.md index 091169be9f..2eccc3835a 100644 --- a/core-migration/05-http-client.md +++ b/core-migration/05-http-client.md @@ -207,3 +207,8 @@ rather than moved to core. parameter described above. - [ ] One real request against a live app key, not only against mocks. - [ ] Status box updated in `README.md`. +- [ ] Public dartdoc follows [`STYLE_GUIDE.md` § Documentation](../STYLE_GUIDE.md#documentation) + and [`EFFECTIVE_DART_DOC.md`](../EFFECTIVE_DART_DOC.md), including on symbols this phase + retyped but whose docs it left alone. +- [ ] Tests follow [`TESTING.md`](../TESTING.md): no `group` organizing a file by method, each + name states its subject and behaviour. diff --git a/core-migration/07-websocket.md b/core-migration/07-websocket.md index 51a55e6101..699480185d 100644 --- a/core-migration/07-websocket.md +++ b/core-migration/07-websocket.md @@ -415,3 +415,8 @@ exception construction. - [ ] `refactor(llc)!:` title, `🛑️ Breaking` CHANGELOG entries, `migrations/v11-migration.md` Symbol Map row for `ConnectionStatus`, plus a feature section on the new connection state. - [ ] Decisions recorded here, status box ticked in `README.md`. +- [ ] Public dartdoc follows [`STYLE_GUIDE.md` § Documentation](../STYLE_GUIDE.md#documentation) + and [`EFFECTIVE_DART_DOC.md`](../EFFECTIVE_DART_DOC.md), including on symbols this phase + retyped but whose docs it left alone. +- [ ] Tests follow [`TESTING.md`](../TESTING.md): no `group` organizing a file by method, each + name states its subject and behaviour. diff --git a/core-migration/09-uploads.md b/core-migration/09-uploads.md index b883af1b91..70b12870a6 100644 --- a/core-migration/09-uploads.md +++ b/core-migration/09-uploads.md @@ -168,3 +168,8 @@ Worth filing regardless: the generator emitting JSON bodies for `multipart/form- Symbol Map rows plus a File Upload feature section — the guide already promises one. - [ ] Decisions recorded here, status box ticked in `README.md`, and `openapi-migration/12-uploads-cdn.md` updated to point at what this phase settled. +- [ ] Public dartdoc follows [`STYLE_GUIDE.md` § Documentation](../STYLE_GUIDE.md#documentation) + and [`EFFECTIVE_DART_DOC.md`](../EFFECTIVE_DART_DOC.md), including on symbols this phase + retyped but whose docs it left alone. +- [ ] Tests follow [`TESTING.md`](../TESTING.md): no `group` organizing a file by method, each + name states its subject and behaviour. diff --git a/core-migration/10-cleanup.md b/core-migration/10-cleanup.md index 00e929694c..56cccd9abe 100644 --- a/core-migration/10-cleanup.md +++ b/core-migration/10-cleanup.md @@ -153,3 +153,8 @@ None. this directory was created — no `if: false` remains — so this is a confirm-they-pass item. - [ ] `melos bootstrap && melos run lint:all && melos run test:all`. - [ ] Every phase's status box ticked in `README.md`. +- [ ] Public dartdoc follows [`STYLE_GUIDE.md` § Documentation](../STYLE_GUIDE.md#documentation) + and [`EFFECTIVE_DART_DOC.md`](../EFFECTIVE_DART_DOC.md), including on symbols this phase + retyped but whose docs it left alone. +- [ ] Tests follow [`TESTING.md`](../TESTING.md): no `group` organizing a file by method, each + name states its subject and behaviour. diff --git a/core-migration/README.md b/core-migration/README.md index 0c36a0d1fc..9c851e42c7 100644 --- a/core-migration/README.md +++ b/core-migration/README.md @@ -211,6 +211,12 @@ the guide is written as the work happens, not reconstructed at release. One phas `refactor(llc)!:` when it breaks. Close the loop by ticking the phase's definition of done and its status box in the table above. +A phase follows [`STYLE_GUIDE.md`](../STYLE_GUIDE.md), [`EFFECTIVE_DART_DOC.md`](../EFFECTIVE_DART_DOC.md) +and [`TESTING.md`](../TESTING.md) like any other change, including on docs it leaves describing a +type it retyped. Nothing in CI checks +either — `dart analyze --fatal-infos` checks a public member *has* a doc, never what it says or +how a test is named — so reading the diff against them is part of closing the phase. + --- ## Which PR lands which phase diff --git a/openapi-migration/01-foundation.md b/openapi-migration/01-foundation.md index 4f8e9a65ed..2ed4488be9 100644 --- a/openapi-migration/01-foundation.md +++ b/openapi-migration/01-foundation.md @@ -59,3 +59,8 @@ whichever group happens to touch `User` first. Raised on - [ ] `DefaultApi` construction is settled in one place, with no `invalid_use_of_visible_for_testing_member`. - [ ] The `User` / `OwnUser` decision is written into `09-users.md`. - [ ] `melos run analyze` clean, `melos run test:dart` green. +- [ ] Public dartdoc follows [`STYLE_GUIDE.md` § Documentation](../STYLE_GUIDE.md#documentation) + and [`EFFECTIVE_DART_DOC.md`](../EFFECTIVE_DART_DOC.md), including on symbols this group + retyped but whose docs it left alone. +- [ ] Tests follow [`TESTING.md`](../TESTING.md): no `group` organizing a file by method, each + name states its subject and behaviour. diff --git a/openapi-migration/02-devices.md b/openapi-migration/02-devices.md index ada3e787df..b4e571d9c6 100644 --- a/openapi-migration/02-devices.md +++ b/openapi-migration/02-devices.md @@ -101,3 +101,8 @@ - [x] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. - [x] CHANGELOG entry under `🛑️ Breaking` for each break; PR title `refactor(llc)!:`. - [x] Decisions recorded in this file, and the status box ticked in `README.md`. +- [x] Public dartdoc follows [`STYLE_GUIDE.md` § Documentation](../STYLE_GUIDE.md#documentation) + and [`EFFECTIVE_DART_DOC.md`](../EFFECTIVE_DART_DOC.md), including on symbols this group + retyped but whose docs it left alone. +- [x] Tests follow [`TESTING.md`](../TESTING.md): no `group` organizing a file by method, each + name states its subject and behaviour. diff --git a/openapi-migration/03-user-groups.md b/openapi-migration/03-user-groups.md index f494f22f80..2f68b54a16 100644 --- a/openapi-migration/03-user-groups.md +++ b/openapi-migration/03-user-groups.md @@ -53,3 +53,8 @@ - [ ] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. - [ ] CHANGELOG entry under `🛑️ Breaking` for each break; PR title `refactor(llc)!:`. - [ ] Decisions recorded in this file, and the status box ticked in `README.md`. +- [ ] Public dartdoc follows [`STYLE_GUIDE.md` § Documentation](../STYLE_GUIDE.md#documentation) + and [`EFFECTIVE_DART_DOC.md`](../EFFECTIVE_DART_DOC.md), including on symbols this group + retyped but whose docs it left alone. +- [ ] Tests follow [`TESTING.md`](../TESTING.md): no `group` organizing a file by method, each + name states its subject and behaviour. diff --git a/openapi-migration/04-roles-guest-and-app.md b/openapi-migration/04-roles-guest-and-app.md index f0f15b2247..77f40d578b 100644 --- a/openapi-migration/04-roles-guest-and-app.md +++ b/openapi-migration/04-roles-guest-and-app.md @@ -64,3 +64,8 @@ - [ ] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. - [ ] CHANGELOG entry under `🛑️ Breaking` for each break; PR title `refactor(llc)!:`. - [ ] Decisions recorded in this file, and the status box ticked in `README.md`. +- [ ] Public dartdoc follows [`STYLE_GUIDE.md` § Documentation](../STYLE_GUIDE.md#documentation) + and [`EFFECTIVE_DART_DOC.md`](../EFFECTIVE_DART_DOC.md), including on symbols this group + retyped but whose docs it left alone. +- [ ] Tests follow [`TESTING.md`](../TESTING.md): no `group` organizing a file by method, each + name states its subject and behaviour. diff --git a/openapi-migration/05-polls.md b/openapi-migration/05-polls.md index 790100b299..293285306a 100644 --- a/openapi-migration/05-polls.md +++ b/openapi-migration/05-polls.md @@ -66,3 +66,8 @@ - [ ] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. - [ ] CHANGELOG entry under `🛑️ Breaking` for each break; PR title `refactor(llc)!:`. - [ ] Decisions recorded in this file, and the status box ticked in `README.md`. +- [ ] Public dartdoc follows [`STYLE_GUIDE.md` § Documentation](../STYLE_GUIDE.md#documentation) + and [`EFFECTIVE_DART_DOC.md`](../EFFECTIVE_DART_DOC.md), including on symbols this group + retyped but whose docs it left alone. +- [ ] Tests follow [`TESTING.md`](../TESTING.md): no `group` organizing a file by method, each + name states its subject and behaviour. diff --git a/openapi-migration/06-reminders.md b/openapi-migration/06-reminders.md index 2d7ce4ca7d..2ae5cc663c 100644 --- a/openapi-migration/06-reminders.md +++ b/openapi-migration/06-reminders.md @@ -45,3 +45,8 @@ - [ ] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. - [ ] CHANGELOG entry under `🛑️ Breaking` for each break; PR title `refactor(llc)!:`. - [ ] Decisions recorded in this file, and the status box ticked in `README.md`. +- [ ] Public dartdoc follows [`STYLE_GUIDE.md` § Documentation](../STYLE_GUIDE.md#documentation) + and [`EFFECTIVE_DART_DOC.md`](../EFFECTIVE_DART_DOC.md), including on symbols this group + retyped but whose docs it left alone. +- [ ] Tests follow [`TESTING.md`](../TESTING.md): no `group` organizing a file by method, each + name states its subject and behaviour. diff --git a/openapi-migration/07-threads-and-drafts.md b/openapi-migration/07-threads-and-drafts.md index 0d2ccc934e..1d45acb2f8 100644 --- a/openapi-migration/07-threads-and-drafts.md +++ b/openapi-migration/07-threads-and-drafts.md @@ -52,3 +52,8 @@ - [ ] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. - [ ] CHANGELOG entry under `🛑️ Breaking` for each break; PR title `refactor(llc)!:`. - [ ] Decisions recorded in this file, and the status box ticked in `README.md`. +- [ ] Public dartdoc follows [`STYLE_GUIDE.md` § Documentation](../STYLE_GUIDE.md#documentation) + and [`EFFECTIVE_DART_DOC.md`](../EFFECTIVE_DART_DOC.md), including on symbols this group + retyped but whose docs it left alone. +- [ ] Tests follow [`TESTING.md`](../TESTING.md): no `group` organizing a file by method, each + name states its subject and behaviour. diff --git a/openapi-migration/08-moderation-and-blocklists.md b/openapi-migration/08-moderation-and-blocklists.md index 1f5982d1f9..dcfe61cb56 100644 --- a/openapi-migration/08-moderation-and-blocklists.md +++ b/openapi-migration/08-moderation-and-blocklists.md @@ -83,3 +83,8 @@ - [ ] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. - [ ] CHANGELOG entry under `🛑️ Breaking` for each break; PR title `refactor(llc)!:`. - [ ] Decisions recorded in this file, and the status box ticked in `README.md`. +- [ ] Public dartdoc follows [`STYLE_GUIDE.md` § Documentation](../STYLE_GUIDE.md#documentation) + and [`EFFECTIVE_DART_DOC.md`](../EFFECTIVE_DART_DOC.md), including on symbols this group + retyped but whose docs it left alone. +- [ ] Tests follow [`TESTING.md`](../TESTING.md): no `group` organizing a file by method, each + name states its subject and behaviour. diff --git a/openapi-migration/09-users.md b/openapi-migration/09-users.md index 4d2082a873..894ddfda26 100644 --- a/openapi-migration/09-users.md +++ b/openapi-migration/09-users.md @@ -57,3 +57,8 @@ - [ ] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. - [ ] CHANGELOG entry under `🛑️ Breaking` for each break; PR title `refactor(llc)!:`. - [ ] Decisions recorded in this file, and the status box ticked in `README.md`. +- [ ] Public dartdoc follows [`STYLE_GUIDE.md` § Documentation](../STYLE_GUIDE.md#documentation) + and [`EFFECTIVE_DART_DOC.md`](../EFFECTIVE_DART_DOC.md), including on symbols this group + retyped but whose docs it left alone. +- [ ] Tests follow [`TESTING.md`](../TESTING.md): no `group` organizing a file by method, each + name states its subject and behaviour. diff --git a/openapi-migration/10-messages.md b/openapi-migration/10-messages.md index b68406caf8..79fff3a12c 100644 --- a/openapi-migration/10-messages.md +++ b/openapi-migration/10-messages.md @@ -66,3 +66,8 @@ - [ ] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. - [ ] CHANGELOG entry under `🛑️ Breaking` for each break; PR title `refactor(llc)!:`. - [ ] Decisions recorded in this file, and the status box ticked in `README.md`. +- [ ] Public dartdoc follows [`STYLE_GUIDE.md` § Documentation](../STYLE_GUIDE.md#documentation) + and [`EFFECTIVE_DART_DOC.md`](../EFFECTIVE_DART_DOC.md), including on symbols this group + retyped but whose docs it left alone. +- [ ] Tests follow [`TESTING.md`](../TESTING.md): no `group` organizing a file by method, each + name states its subject and behaviour. diff --git a/openapi-migration/11-channels-and-members.md b/openapi-migration/11-channels-and-members.md index ad0cf4c600..dee5f57a7e 100644 --- a/openapi-migration/11-channels-and-members.md +++ b/openapi-migration/11-channels-and-members.md @@ -92,3 +92,8 @@ - [ ] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. - [ ] CHANGELOG entry under `🛑️ Breaking` for each break; PR title `refactor(llc)!:`. - [ ] Decisions recorded in this file, and the status box ticked in `README.md`. +- [ ] Public dartdoc follows [`STYLE_GUIDE.md` § Documentation](../STYLE_GUIDE.md#documentation) + and [`EFFECTIVE_DART_DOC.md`](../EFFECTIVE_DART_DOC.md), including on symbols this group + retyped but whose docs it left alone. +- [ ] Tests follow [`TESTING.md`](../TESTING.md): no `group` organizing a file by method, each + name states its subject and behaviour. diff --git a/openapi-migration/12-uploads-cdn.md b/openapi-migration/12-uploads-cdn.md index 619bfe11f5..ea7410dc64 100644 --- a/openapi-migration/12-uploads-cdn.md +++ b/openapi-migration/12-uploads-cdn.md @@ -58,3 +58,8 @@ - [ ] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. - [ ] CHANGELOG entry under `🛑️ Breaking` for each break; PR title `refactor(llc)!:`. - [ ] Decisions recorded in this file, and the status box ticked in `README.md`. +- [ ] Public dartdoc follows [`STYLE_GUIDE.md` § Documentation](../STYLE_GUIDE.md#documentation) + and [`EFFECTIVE_DART_DOC.md`](../EFFECTIVE_DART_DOC.md), including on symbols this group + retyped but whose docs it left alone. +- [ ] Tests follow [`TESTING.md`](../TESTING.md): no `group` organizing a file by method, each + name states its subject and behaviour. diff --git a/openapi-migration/13-push-preferences.md b/openapi-migration/13-push-preferences.md index 1bf524eb8f..b488020584 100644 --- a/openapi-migration/13-push-preferences.md +++ b/openapi-migration/13-push-preferences.md @@ -42,3 +42,8 @@ - [ ] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. - [ ] CHANGELOG entry under `🛑️ Breaking` for each break; PR title `refactor(llc)!:`. - [ ] Decisions recorded in this file, and the status box ticked in `README.md`. +- [ ] Public dartdoc follows [`STYLE_GUIDE.md` § Documentation](../STYLE_GUIDE.md#documentation) + and [`EFFECTIVE_DART_DOC.md`](../EFFECTIVE_DART_DOC.md), including on symbols this group + retyped but whose docs it left alone. +- [ ] Tests follow [`TESTING.md`](../TESTING.md): no `group` organizing a file by method, each + name states its subject and behaviour. diff --git a/openapi-migration/README.md b/openapi-migration/README.md index 956f60e999..01246f0d39 100644 --- a/openapi-migration/README.md +++ b/openapi-migration/README.md @@ -89,6 +89,11 @@ tests → verify). Use **`openapi-codegen`** when a type or operation is missing Consumer-facing changes go in `migrations/v11-migration.md` in the same PR that makes them. +A migration follows [`STYLE_GUIDE.md`](../STYLE_GUIDE.md), [`EFFECTIVE_DART_DOC.md`](../EFFECTIVE_DART_DOC.md) +and [`TESTING.md`](../TESTING.md) like any other change. Nothing in CI checks either — `dart analyze --fatal-infos` checks a public member *has* a doc, never what +it says or how a test is named — so the last two boxes of every definition of done stand for reading the diff +against them. + ## Keeping this plan honest The scope tables are generated from the SDK, not typed by hand: diff --git a/openapi-migration/tool/generate_plan.py b/openapi-migration/tool/generate_plan.py index c9deff22e0..6d568bcddb 100644 --- a/openapi-migration/tool/generate_plan.py +++ b/openapi-migration/tool/generate_plan.py @@ -69,6 +69,11 @@ def match(path): - [ ] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. - [ ] CHANGELOG entry under `🛑️ Breaking` for each break; PR title `refactor(llc)!:`. - [ ] Decisions recorded in this file, and the status box ticked in `README.md`. + - [ ] Public dartdoc follows [`STYLE_GUIDE.md` § Documentation](../STYLE_GUIDE.md#documentation) + and [`EFFECTIVE_DART_DOC.md`](../EFFECTIVE_DART_DOC.md), including on symbols this group + retyped but whose docs it left alone. + - [ ] Tests follow [`TESTING.md`](../TESTING.md): no `group` organizing a file by method, each + name states its subject and behaviour. """) GROUPS = [ From da08c75b2e0460eec1712d0268c1de10fca6950e Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Tue, 22 Sep 2026 17:16:19 +0200 Subject: [PATCH 21/36] feat(llc): regenerate the OpenAPI client at protocol v239.10.0 (#2991) Co-authored-by: Claude Opus 5 (1M context) --- openapi-migration/06-reminders.md | 2 +- .../08-moderation-and-blocklists.md | 3 +- openapi-migration/10-messages.md | 2 +- packages/stream_chat/lib/open_api/api.dart | 8 +- .../lib/open_api/api/default_api.dart | 10 +- .../lib/open_api/api/default_api.g.dart | 67 +++++++++-- .../model/ai_video_config_request.dart | 41 +++++++ .../ai_video_config_request.freezed.dart | 97 +++++++++++++++ .../model/ai_video_config_request.g.dart | 23 ++++ ...fig.dart => ai_video_config_response.dart} | 12 +- ... => ai_video_config_response.freezed.dart} | 41 +++---- ...g.dart => ai_video_config_response.g.dart} | 10 +- .../open_api/model/appeal_item_response.dart | 10 ++ .../model/appeal_item_response.freezed.dart | 21 +++- .../model/appeal_item_response.g.dart | 4 + .../lib/open_api/model/appeal_request.dart | 5 + .../model/appeal_request.freezed.dart | 11 +- .../lib/open_api/model/appeal_request.g.dart | 2 + .../lib/open_api/model/ban_request.dart | 10 -- .../open_api/model/ban_request.freezed.dart | 20 +--- .../lib/open_api/model/ban_request.g.dart | 4 - .../lib/open_api/model/config_response.dart | 2 +- .../model/config_response.freezed.dart | 6 +- .../lib/open_api/model/config_response.g.dart | 4 +- .../model/create_reminder_response.dart | 36 ++++++ .../create_reminder_response.freezed.dart | 82 +++++++++++++ .../model/create_reminder_response.g.dart | 23 ++++ .../model/filter_config_response.dart | 5 + .../model/filter_config_response.freezed.dart | 13 +- .../model/filter_config_response.g.dart | 2 + .../flood_identical_rule_parameters.dart | 10 ++ ...ood_identical_rule_parameters.freezed.dart | 28 ++++- .../flood_identical_rule_parameters.g.dart | 4 + .../model/moderation_flag_response.dart | 6 + .../moderation_flag_response.freezed.dart | 12 +- .../model/moderation_flag_response.g.dart | 18 +++ .../open_api/model/moderation_payload.dart | 5 + .../model/moderation_payload.freezed.dart | 11 +- .../open_api/model/moderation_payload.g.dart | 2 + .../lib/open_api/model/pagination_params.dart | 20 ++++ .../model/pagination_params.freezed.dart | 46 ++++++- .../open_api/model/pagination_params.g.dart | 8 ++ .../model/poll_option_response_data.dart | 5 + .../poll_option_response_data.freezed.dart | 25 +++- .../model/poll_option_response_data.g.dart | 4 + .../open_api/model/poll_response_data.dart | 10 ++ .../model/poll_response_data.freezed.dart | 23 +++- .../open_api/model/poll_response_data.g.dart | 8 ++ .../model/poll_vote_response_data.dart | 5 + .../poll_vote_response_data.freezed.dart | 14 ++- .../model/poll_vote_response_data.g.dart | 4 + .../model/query_banned_users_payload.dart | 24 ++++ .../query_banned_users_payload.freezed.dart | 40 ++++++- .../model/query_banned_users_payload.g.dart | 42 +++++++ .../query_future_channel_bans_payload.dart | 24 ++++ ...y_future_channel_bans_payload.freezed.dart | 40 ++++++- .../query_future_channel_bans_payload.g.dart | 42 +++++++ .../open_api/model/query_members_payload.dart | 44 +++++++ .../model/query_members_payload.freezed.dart | 78 +++++++++++- .../model/query_members_payload.g.dart | 50 ++++++++ .../open_api/model/query_users_payload.dart | 20 ++++ .../model/query_users_payload.freezed.dart | 38 +++++- .../open_api/model/query_users_payload.g.dart | 8 ++ .../model/review_queue_item_response.dart | 5 + .../review_queue_item_response.freezed.dart | 11 +- .../model/review_queue_item_response.g.dart | 2 + .../model/rule_builder_condition.dart | 10 ++ .../model/rule_builder_condition.freezed.dart | 28 ++++- .../model/rule_builder_condition.g.dart | 12 ++ .../model/translate_message_response.dart | 36 ++++++ .../translate_message_response.freezed.dart | 82 +++++++++++++ .../model/translate_message_response.g.dart | 21 ++++ .../open_api/model/typing_start_event.dart | 5 + .../model/typing_start_event.freezed.dart | 11 +- .../open_api/model/typing_start_event.g.dart | 6 + .../lib/open_api/model/typing_stop_event.dart | 5 + .../model/typing_stop_event.freezed.dart | 11 +- .../open_api/model/typing_stop_event.g.dart | 6 + .../lib/open_api/model/unban_response.dart | 31 +++++ .../model/unban_response.freezed.dart | 75 ++++++++++++ .../lib/open_api/model/unban_response.g.dart | 11 ++ .../open_api/model/update_users_response.dart | 1 + .../open_api/model/upsert_config_request.dart | 2 +- .../model/upsert_config_request.freezed.dart | 6 +- .../model/upsert_config_request.g.dart | 4 +- ...user_identical_image_count_parameters.dart | 47 ++++++++ ...ntical_image_count_parameters.freezed.dart | 112 ++++++++++++++++++ ...er_identical_image_count_parameters.g.dart | 25 ++++ .../user_reaction_count_rule_parameters.dart | 42 +++++++ ...eaction_count_rule_parameters.freezed.dart | 92 ++++++++++++++ ...user_reaction_count_rule_parameters.g.dart | 23 ++++ packages/stream_chat/lib/open_api/models.dart | 8 +- 92 files changed, 1902 insertions(+), 122 deletions(-) create mode 100644 packages/stream_chat/lib/open_api/model/ai_video_config_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/ai_video_config_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/ai_video_config_request.g.dart rename packages/stream_chat/lib/open_api/model/{ai_video_config.dart => ai_video_config_response.dart} (69%) rename packages/stream_chat/lib/open_api/model/{ai_video_config.freezed.dart => ai_video_config_response.freezed.dart} (69%) rename packages/stream_chat/lib/open_api/model/{ai_video_config.g.dart => ai_video_config_response.g.dart} (67%) create mode 100644 packages/stream_chat/lib/open_api/model/create_reminder_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/create_reminder_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/create_reminder_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/translate_message_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/translate_message_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/translate_message_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/unban_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/unban_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/unban_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_identical_image_count_parameters.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_identical_image_count_parameters.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_identical_image_count_parameters.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_reaction_count_rule_parameters.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_reaction_count_rule_parameters.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_reaction_count_rule_parameters.g.dart diff --git a/openapi-migration/06-reminders.md b/openapi-migration/06-reminders.md index 2ae5cc663c..f0671e8695 100644 --- a/openapi-migration/06-reminders.md +++ b/openapi-migration/06-reminders.md @@ -21,7 +21,7 @@ | Verb | Path | Operation | Response | | --- | --- | --- | --- | -| `POST` | `/api/v2/chat/messages/{message_id}/reminders` | `createReminder` | `ReminderResponseData` | +| `POST` | `/api/v2/chat/messages/{message_id}/reminders` | `createReminder` | `CreateReminderResponse` | | `DELETE` | `/api/v2/chat/messages/{message_id}/reminders` | `deleteReminder` | `DeleteReminderResponse` | | `POST` | `/api/v2/chat/reminders/query` | `queryReminders` | `QueryRemindersResponse` | | `PATCH` | `/api/v2/chat/messages/{message_id}/reminders` | `updateReminder` | `UpdateReminderResponse` | diff --git a/openapi-migration/08-moderation-and-blocklists.md b/openapi-migration/08-moderation-and-blocklists.md index dcfe61cb56..387d5ea7e1 100644 --- a/openapi-migration/08-moderation-and-blocklists.md +++ b/openapi-migration/08-moderation-and-blocklists.md @@ -2,7 +2,7 @@ **Goal:** The largest generated surface relative to ours — decide what stays unexposed. -**Size:** 11 hand-written method(s) across 1 file(s) → 34 generated operation(s). +**Size:** 11 hand-written method(s) across 1 file(s) → 35 generated operation(s). > Tables are generated by `openapi-migration/tool/generate_plan.py`. Edit the prose, not the tables. @@ -56,6 +56,7 @@ | `POST` | `/api/v2/moderation/configs` | `queryModerationConfigs` | `QueryModerationConfigsResponse` | | `POST` | `/api/v2/moderation/review_queue` | `queryReviewQueue` | `QueryReviewQueueResponse` | | `POST` | `/api/v2/moderation/submit_action` | `submitAction` | `SubmitActionResponse` | +| `POST` | `/api/v2/moderation/unban` | `unban` | `UnbanResponse` | | `POST` | `/api/v2/moderation/unmute` | `unmute` | `UnmuteResponse` | | `POST` | `/api/v2/chat/moderation/unmute/channel` | `unmuteChannel` | `UnmuteResponse` | | `PUT` | `/api/v2/blocklists/{name}` | `updateBlockList` | `UpdateBlockListResponse` | diff --git a/openapi-migration/10-messages.md b/openapi-migration/10-messages.md index 79fff3a12c..133b1040f8 100644 --- a/openapi-migration/10-messages.md +++ b/openapi-migration/10-messages.md @@ -40,7 +40,7 @@ | `POST` | `/api/v2/chat/messages/{id}/action` | `runMessageAction` | `MessageActionResponse` | | `GET` | `/api/v2/chat/search` | `search` | `SearchResponse` | | `POST` | `/api/v2/chat/messages/{id}/reaction` | `sendReaction` | `SendReactionResponse` | -| `POST` | `/api/v2/chat/messages/{id}/translate` | `translateMessage` | `MessageActionResponse` | +| `POST` | `/api/v2/chat/messages/{id}/translate` | `translateMessage` | `TranslateMessageResponse` | | `POST` | `/api/v2/chat/messages/{id}` | `updateMessage` | `UpdateMessageResponse` | | `PUT` | `/api/v2/chat/messages/{id}` | `updateMessagePartial` | `UpdateMessagePartialResponse` | diff --git a/packages/stream_chat/lib/open_api/api.dart b/packages/stream_chat/lib/open_api/api.dart index c0f4db327b..2584af86a2 100644 --- a/packages/stream_chat/lib/open_api/api.dart +++ b/packages/stream_chat/lib/open_api/api.dart @@ -1,9 +1,9 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // -// Spec: chat-clientside-api (API v237.2.0) -// Source: protocol @ openapi-v237.2.0 -// Checksum: 0750cb0e4653bc5cac3371936e5bea1f7afb9c576c1d62d534d09e1f6bf11714 -// Generator: GetStream/chat @ v237.14.0-1-g90e424ef56 +// Spec: chat-clientside-api (API v239.10.0) +// Source: protocol @ openapi-v239.10.0 +// Checksum: 2fc3e366d0163482a2a71991e7f0dc675da1a45c848b4fff02b0c820100d42d6 +// Generator: GetStream/chat @ v237.25.0-22-g5d6378be28 // ignore_for_file: directives_ordering diff --git a/packages/stream_chat/lib/open_api/api/default_api.dart b/packages/stream_chat/lib/open_api/api/default_api.dart index a7747ba166..0fc7e7944c 100644 --- a/packages/stream_chat/lib/open_api/api/default_api.dart +++ b/packages/stream_chat/lib/open_api/api/default_api.dart @@ -99,7 +99,7 @@ abstract interface class DefaultApi { }); @POST('/api/v2/chat/messages/{message_id}/reminders') - Future> createReminder({ + Future> createReminder({ @Path('message_id') required String messageId, @Body() CreateReminderRequest? createReminderRequest, }); @@ -613,7 +613,7 @@ abstract interface class DefaultApi { }); @POST('/api/v2/chat/messages/{id}/translate') - Future> translateMessage({ + Future> translateMessage({ @Path('id') required String id, @Body() required TranslateMessageRequest translateMessageRequest, }); @@ -625,6 +625,12 @@ abstract interface class DefaultApi { @Body() TruncateChannelRequest? truncateChannelRequest, }); + @POST('/api/v2/moderation/unban') + Future> unban({ + @Query('target_user_id') required String targetUserId, + @Query('channel_cid') String? channelCid, + }); + @POST('/api/v2/users/unblock') Future> unblockUsers({ @Body() required UnblockUsersRequest unblockUsersRequest, diff --git a/packages/stream_chat/lib/open_api/api/default_api.g.dart b/packages/stream_chat/lib/open_api/api/default_api.g.dart index c29e476589..5e3782312c 100644 --- a/packages/stream_chat/lib/open_api/api/default_api.g.dart +++ b/packages/stream_chat/lib/open_api/api/default_api.g.dart @@ -616,7 +616,7 @@ class _DefaultApi implements DefaultApi { ); } - Future _createReminder({ + Future _createReminder({ required String messageId, CreateReminderRequest? createReminderRequest, }) async { @@ -626,7 +626,7 @@ class _DefaultApi implements DefaultApi { final _headers = {}; final _data = {}; _data.addAll(createReminderRequest?.toJson() ?? {}); - final _options = _setStreamType>( + final _options = _setStreamType>( Options(method: 'POST', headers: _headers, extra: _extra) .compose( _dio.options, @@ -637,9 +637,9 @@ class _DefaultApi implements DefaultApi { .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), ); final _result = await _dio.fetch>(_options); - late ReminderResponseData _value; + late CreateReminderResponse _value; try { - _value = ReminderResponseData.fromJson(_result.data!); + _value = CreateReminderResponse.fromJson(_result.data!); } on Object catch (e, s) { errorLogger?.logError(e, s, _options, response: _result); rethrow; @@ -648,11 +648,11 @@ class _DefaultApi implements DefaultApi { } @override - Future> createReminder({ + Future> createReminder({ required String messageId, CreateReminderRequest? createReminderRequest, }) { - return _ResultCallAdapter().adapt( + return _ResultCallAdapter().adapt( () => _createReminder( messageId: messageId, createReminderRequest: createReminderRequest, @@ -4104,7 +4104,7 @@ class _DefaultApi implements DefaultApi { ); } - Future _translateMessage({ + Future _translateMessage({ required String id, required TranslateMessageRequest translateMessageRequest, }) async { @@ -4113,7 +4113,7 @@ class _DefaultApi implements DefaultApi { final _headers = {}; final _data = {}; _data.addAll(translateMessageRequest.toJson()); - final _options = _setStreamType>( + final _options = _setStreamType>( Options(method: 'POST', headers: _headers, extra: _extra) .compose( _dio.options, @@ -4124,9 +4124,9 @@ class _DefaultApi implements DefaultApi { .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), ); final _result = await _dio.fetch>(_options); - late MessageActionResponse _value; + late TranslateMessageResponse _value; try { - _value = MessageActionResponse.fromJson(_result.data!); + _value = TranslateMessageResponse.fromJson(_result.data!); } on Object catch (e, s) { errorLogger?.logError(e, s, _options, response: _result); rethrow; @@ -4135,11 +4135,11 @@ class _DefaultApi implements DefaultApi { } @override - Future> translateMessage({ + Future> translateMessage({ required String id, required TranslateMessageRequest translateMessageRequest, }) { - return _ResultCallAdapter().adapt( + return _ResultCallAdapter().adapt( () => _translateMessage( id: id, translateMessageRequest: translateMessageRequest, @@ -4194,6 +4194,49 @@ class _DefaultApi implements DefaultApi { ); } + Future _unban({ + required String targetUserId, + String? channelCid, + }) async { + final _extra = {}; + final queryParameters = { + r'target_user_id': targetUserId, + r'channel_cid': channelCid, + }; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/moderation/unban', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late UnbanResponse _value; + try { + _value = UnbanResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> unban({ + required String targetUserId, + String? channelCid, + }) { + return _ResultCallAdapter().adapt( + () => _unban(targetUserId: targetUserId, channelCid: channelCid), + ); + } + Future _unblockUsers({ required UnblockUsersRequest unblockUsersRequest, }) async { diff --git a/packages/stream_chat/lib/open_api/model/ai_video_config_request.dart b/packages/stream_chat/lib/open_api/model/ai_video_config_request.dart new file mode 100644 index 0000000000..461154a7d1 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ai_video_config_request.dart @@ -0,0 +1,41 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'ai_video_config_request.g.dart'; +part 'ai_video_config_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class AIVideoConfigRequest with _$AIVideoConfigRequest { + const AIVideoConfigRequest({ + this.async, + this.enabled, + this.rules, + }); + + @override + @JsonKey(name: 'async') + final bool? async; + + @override + @JsonKey(name: 'enabled') + final bool? enabled; + + @override + @JsonKey(name: 'rules') + final List? rules; + + Map toJson() => _$AIVideoConfigRequestToJson(this); + + static AIVideoConfigRequest fromJson(Map json) => _$AIVideoConfigRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/ai_video_config_request.freezed.dart b/packages/stream_chat/lib/open_api/model/ai_video_config_request.freezed.dart new file mode 100644 index 0000000000..2659288170 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ai_video_config_request.freezed.dart @@ -0,0 +1,97 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'ai_video_config_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$AIVideoConfigRequest { + bool? get async; + bool? get enabled; + List? get rules; + + /// Create a copy of AIVideoConfigRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $AIVideoConfigRequestCopyWith get copyWith => + _$AIVideoConfigRequestCopyWithImpl( + this as AIVideoConfigRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is AIVideoConfigRequest && + (identical(other.async, async) || other.async == async) && + (identical(other.enabled, enabled) || other.enabled == enabled) && + const DeepCollectionEquality().equals(other.rules, rules)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + async, + enabled, + const DeepCollectionEquality().hash(rules), + ); + + @override + String toString() { + return 'AIVideoConfigRequest(async: $async, enabled: $enabled, rules: $rules)'; + } +} + +/// @nodoc +abstract mixin class $AIVideoConfigRequestCopyWith<$Res> { + factory $AIVideoConfigRequestCopyWith( + AIVideoConfigRequest value, + $Res Function(AIVideoConfigRequest) _then, + ) = _$AIVideoConfigRequestCopyWithImpl; + @useResult + $Res call({bool? async, bool? enabled, List? rules}); +} + +/// @nodoc +class _$AIVideoConfigRequestCopyWithImpl<$Res> implements $AIVideoConfigRequestCopyWith<$Res> { + _$AIVideoConfigRequestCopyWithImpl(this._self, this._then); + + final AIVideoConfigRequest _self; + final $Res Function(AIVideoConfigRequest) _then; + + /// Create a copy of AIVideoConfigRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? async = freezed, + Object? enabled = freezed, + Object? rules = freezed, + }) { + return _then( + AIVideoConfigRequest( + async: freezed == async + ? _self.async + : async // ignore: cast_nullable_to_non_nullable + as bool?, + enabled: freezed == enabled + ? _self.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool?, + rules: freezed == rules + ? _self.rules + : rules // ignore: cast_nullable_to_non_nullable + as List?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/ai_video_config_request.g.dart b/packages/stream_chat/lib/open_api/model/ai_video_config_request.g.dart new file mode 100644 index 0000000000..9757fb12d5 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/ai_video_config_request.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'ai_video_config_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +AIVideoConfigRequest _$AIVideoConfigRequestFromJson( + Map json, +) => AIVideoConfigRequest( + async: json['async'] as bool?, + enabled: json['enabled'] as bool?, + rules: (json['rules'] as List?)?.map((e) => AWSRekognitionRule.fromJson(e as Map)).toList(), +); + +Map _$AIVideoConfigRequestToJson( + AIVideoConfigRequest instance, +) => { + 'async': instance.async, + 'enabled': instance.enabled, + 'rules': instance.rules?.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/ai_video_config.dart b/packages/stream_chat/lib/open_api/model/ai_video_config_response.dart similarity index 69% rename from packages/stream_chat/lib/open_api/model/ai_video_config.dart rename to packages/stream_chat/lib/open_api/model/ai_video_config_response.dart index 6d370c9037..9df3ae7eda 100644 --- a/packages/stream_chat/lib/open_api/model/ai_video_config.dart +++ b/packages/stream_chat/lib/open_api/model/ai_video_config_response.dart @@ -10,14 +10,14 @@ import 'package:stream_core/stream_core.dart' as core; import '../models.dart'; -part 'ai_video_config.g.dart'; -part 'ai_video_config.freezed.dart'; +part 'ai_video_config_response.g.dart'; +part 'ai_video_config_response.freezed.dart'; @freezed @immutable @JsonSerializable() -class AIVideoConfig with _$AIVideoConfig { - const AIVideoConfig({ +class AIVideoConfigResponse with _$AIVideoConfigResponse { + const AIVideoConfigResponse({ this.async, required this.enabled, required this.rules, @@ -35,7 +35,7 @@ class AIVideoConfig with _$AIVideoConfig { @JsonKey(name: 'rules') final List rules; - Map toJson() => _$AIVideoConfigToJson(this); + Map toJson() => _$AIVideoConfigResponseToJson(this); - static AIVideoConfig fromJson(Map json) => _$AIVideoConfigFromJson(json); + static AIVideoConfigResponse fromJson(Map json) => _$AIVideoConfigResponseFromJson(json); } diff --git a/packages/stream_chat/lib/open_api/model/ai_video_config.freezed.dart b/packages/stream_chat/lib/open_api/model/ai_video_config_response.freezed.dart similarity index 69% rename from packages/stream_chat/lib/open_api/model/ai_video_config.freezed.dart rename to packages/stream_chat/lib/open_api/model/ai_video_config_response.freezed.dart index 7850b0264e..4433b7bb6c 100644 --- a/packages/stream_chat/lib/open_api/model/ai_video_config.freezed.dart +++ b/packages/stream_chat/lib/open_api/model/ai_video_config_response.freezed.dart @@ -3,7 +3,7 @@ // ignore_for_file: type=lint // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark -part of 'ai_video_config.dart'; +part of 'ai_video_config_response.dart'; // ************************************************************************** // FreezedGenerator @@ -12,25 +12,26 @@ part of 'ai_video_config.dart'; T _$identity(T value) => value; /// @nodoc -mixin _$AIVideoConfig { +mixin _$AIVideoConfigResponse { bool? get async; bool get enabled; List get rules; - /// Create a copy of AIVideoConfig + /// Create a copy of AIVideoConfigResponse /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @pragma('vm:prefer-inline') - $AIVideoConfigCopyWith get copyWith => _$AIVideoConfigCopyWithImpl( - this as AIVideoConfig, - _$identity, - ); + $AIVideoConfigResponseCopyWith get copyWith => + _$AIVideoConfigResponseCopyWithImpl( + this as AIVideoConfigResponse, + _$identity, + ); @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is AIVideoConfig && + other is AIVideoConfigResponse && (identical(other.async, async) || other.async == async) && (identical(other.enabled, enabled) || other.enabled == enabled) && const DeepCollectionEquality().equals(other.rules, rules)); @@ -46,28 +47,28 @@ mixin _$AIVideoConfig { @override String toString() { - return 'AIVideoConfig(async: $async, enabled: $enabled, rules: $rules)'; + return 'AIVideoConfigResponse(async: $async, enabled: $enabled, rules: $rules)'; } } /// @nodoc -abstract mixin class $AIVideoConfigCopyWith<$Res> { - factory $AIVideoConfigCopyWith( - AIVideoConfig value, - $Res Function(AIVideoConfig) _then, - ) = _$AIVideoConfigCopyWithImpl; +abstract mixin class $AIVideoConfigResponseCopyWith<$Res> { + factory $AIVideoConfigResponseCopyWith( + AIVideoConfigResponse value, + $Res Function(AIVideoConfigResponse) _then, + ) = _$AIVideoConfigResponseCopyWithImpl; @useResult $Res call({bool? async, bool enabled, List rules}); } /// @nodoc -class _$AIVideoConfigCopyWithImpl<$Res> implements $AIVideoConfigCopyWith<$Res> { - _$AIVideoConfigCopyWithImpl(this._self, this._then); +class _$AIVideoConfigResponseCopyWithImpl<$Res> implements $AIVideoConfigResponseCopyWith<$Res> { + _$AIVideoConfigResponseCopyWithImpl(this._self, this._then); - final AIVideoConfig _self; - final $Res Function(AIVideoConfig) _then; + final AIVideoConfigResponse _self; + final $Res Function(AIVideoConfigResponse) _then; - /// Create a copy of AIVideoConfig + /// Create a copy of AIVideoConfigResponse /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override @@ -77,7 +78,7 @@ class _$AIVideoConfigCopyWithImpl<$Res> implements $AIVideoConfigCopyWith<$Res> Object? rules = null, }) { return _then( - AIVideoConfig( + AIVideoConfigResponse( async: freezed == async ? _self.async : async // ignore: cast_nullable_to_non_nullable diff --git a/packages/stream_chat/lib/open_api/model/ai_video_config.g.dart b/packages/stream_chat/lib/open_api/model/ai_video_config_response.g.dart similarity index 67% rename from packages/stream_chat/lib/open_api/model/ai_video_config.g.dart rename to packages/stream_chat/lib/open_api/model/ai_video_config_response.g.dart index 54b166bb54..bc763e6e3f 100644 --- a/packages/stream_chat/lib/open_api/model/ai_video_config.g.dart +++ b/packages/stream_chat/lib/open_api/model/ai_video_config_response.g.dart @@ -1,18 +1,22 @@ // GENERATED CODE - DO NOT MODIFY BY HAND -part of 'ai_video_config.dart'; +part of 'ai_video_config_response.dart'; // ************************************************************************** // JsonSerializableGenerator // ************************************************************************** -AIVideoConfig _$AIVideoConfigFromJson(Map json) => AIVideoConfig( +AIVideoConfigResponse _$AIVideoConfigResponseFromJson( + Map json, +) => AIVideoConfigResponse( async: json['async'] as bool?, enabled: json['enabled'] as bool, rules: (json['rules'] as List).map((e) => AWSRekognitionRule.fromJson(e as Map)).toList(), ); -Map _$AIVideoConfigToJson(AIVideoConfig instance) => { +Map _$AIVideoConfigResponseToJson( + AIVideoConfigResponse instance, +) => { 'async': instance.async, 'enabled': instance.enabled, 'rules': instance.rules.map((e) => e.toJson()).toList(), diff --git a/packages/stream_chat/lib/open_api/model/appeal_item_response.dart b/packages/stream_chat/lib/open_api/model/appeal_item_response.dart index cb9f9da33e..4ef425e5c7 100644 --- a/packages/stream_chat/lib/open_api/model/appeal_item_response.dart +++ b/packages/stream_chat/lib/open_api/model/appeal_item_response.dart @@ -21,6 +21,7 @@ class AppealItemResponse with _$AppealItemResponse { this.actions, this.aiTextSeverity, required this.appealReason, + this.appealReasonLanguage, this.attachments, this.channelCid, this.configKey, @@ -33,6 +34,7 @@ class AppealItemResponse with _$AppealItemResponse { this.flagTypes, this.flags, required this.id, + this.languages, this.moderationAction, this.originalModerationAction, this.recommendedAction, @@ -55,6 +57,10 @@ class AppealItemResponse with _$AppealItemResponse { @JsonKey(name: 'appeal_reason') final String appealReason; + @override + @JsonKey(name: 'appeal_reason_language') + final String? appealReasonLanguage; + @override @JsonKey(name: 'attachments') final List? attachments; @@ -104,6 +110,10 @@ class AppealItemResponse with _$AppealItemResponse { @JsonKey(name: 'id') final String id; + @override + @JsonKey(name: 'languages') + final List? languages; + @override @JsonKey(name: 'moderation_action') final ActionLogResponse? moderationAction; diff --git a/packages/stream_chat/lib/open_api/model/appeal_item_response.freezed.dart b/packages/stream_chat/lib/open_api/model/appeal_item_response.freezed.dart index 03317cd650..60dadf2da3 100644 --- a/packages/stream_chat/lib/open_api/model/appeal_item_response.freezed.dart +++ b/packages/stream_chat/lib/open_api/model/appeal_item_response.freezed.dart @@ -16,6 +16,7 @@ mixin _$AppealItemResponse { List? get actions; String? get aiTextSeverity; String get appealReason; + String? get appealReasonLanguage; List? get attachments; String? get channelCid; String? get configKey; @@ -28,6 +29,7 @@ mixin _$AppealItemResponse { List? get flagTypes; List? get flags; String get id; + List? get languages; ActionLogResponse? get moderationAction; ActionLogResponse? get originalModerationAction; String? get recommendedAction; @@ -54,6 +56,8 @@ mixin _$AppealItemResponse { const DeepCollectionEquality().equals(other.actions, actions) && (identical(other.aiTextSeverity, aiTextSeverity) || other.aiTextSeverity == aiTextSeverity) && (identical(other.appealReason, appealReason) || other.appealReason == appealReason) && + (identical(other.appealReasonLanguage, appealReasonLanguage) || + other.appealReasonLanguage == appealReasonLanguage) && const DeepCollectionEquality().equals( other.attachments, attachments, @@ -72,6 +76,7 @@ mixin _$AppealItemResponse { const DeepCollectionEquality().equals(other.flagTypes, flagTypes) && const DeepCollectionEquality().equals(other.flags, flags) && (identical(other.id, id) || other.id == id) && + const DeepCollectionEquality().equals(other.languages, languages) && (identical(other.moderationAction, moderationAction) || other.moderationAction == moderationAction) && (identical( other.originalModerationAction, @@ -92,6 +97,7 @@ mixin _$AppealItemResponse { const DeepCollectionEquality().hash(actions), aiTextSeverity, appealReason, + appealReasonLanguage, const DeepCollectionEquality().hash(attachments), channelCid, configKey, @@ -104,6 +110,7 @@ mixin _$AppealItemResponse { const DeepCollectionEquality().hash(flagTypes), const DeepCollectionEquality().hash(flags), id, + const DeepCollectionEquality().hash(languages), moderationAction, originalModerationAction, recommendedAction, @@ -116,7 +123,7 @@ mixin _$AppealItemResponse { @override String toString() { - return 'AppealItemResponse(actions: $actions, aiTextSeverity: $aiTextSeverity, appealReason: $appealReason, attachments: $attachments, channelCid: $channelCid, configKey: $configKey, createdAt: $createdAt, decisionReason: $decisionReason, entityContent: $entityContent, entityId: $entityId, entityType: $entityType, flagLabels: $flagLabels, flagTypes: $flagTypes, flags: $flags, id: $id, moderationAction: $moderationAction, originalModerationAction: $originalModerationAction, recommendedAction: $recommendedAction, reviewQueueItemId: $reviewQueueItemId, severity: $severity, status: $status, updatedAt: $updatedAt, user: $user)'; + return 'AppealItemResponse(actions: $actions, aiTextSeverity: $aiTextSeverity, appealReason: $appealReason, appealReasonLanguage: $appealReasonLanguage, attachments: $attachments, channelCid: $channelCid, configKey: $configKey, createdAt: $createdAt, decisionReason: $decisionReason, entityContent: $entityContent, entityId: $entityId, entityType: $entityType, flagLabels: $flagLabels, flagTypes: $flagTypes, flags: $flags, id: $id, languages: $languages, moderationAction: $moderationAction, originalModerationAction: $originalModerationAction, recommendedAction: $recommendedAction, reviewQueueItemId: $reviewQueueItemId, severity: $severity, status: $status, updatedAt: $updatedAt, user: $user)'; } } @@ -131,6 +138,7 @@ abstract mixin class $AppealItemResponseCopyWith<$Res> { List? actions, String? aiTextSeverity, String appealReason, + String? appealReasonLanguage, List? attachments, String? channelCid, String? configKey, @@ -143,6 +151,7 @@ abstract mixin class $AppealItemResponseCopyWith<$Res> { List? flagTypes, List? flags, String id, + List? languages, ActionLogResponse? moderationAction, ActionLogResponse? originalModerationAction, String? recommendedAction, @@ -169,6 +178,7 @@ class _$AppealItemResponseCopyWithImpl<$Res> implements $AppealItemResponseCopyW Object? actions = freezed, Object? aiTextSeverity = freezed, Object? appealReason = null, + Object? appealReasonLanguage = freezed, Object? attachments = freezed, Object? channelCid = freezed, Object? configKey = freezed, @@ -181,6 +191,7 @@ class _$AppealItemResponseCopyWithImpl<$Res> implements $AppealItemResponseCopyW Object? flagTypes = freezed, Object? flags = freezed, Object? id = null, + Object? languages = freezed, Object? moderationAction = freezed, Object? originalModerationAction = freezed, Object? recommendedAction = freezed, @@ -204,6 +215,10 @@ class _$AppealItemResponseCopyWithImpl<$Res> implements $AppealItemResponseCopyW ? _self.appealReason : appealReason // ignore: cast_nullable_to_non_nullable as String, + appealReasonLanguage: freezed == appealReasonLanguage + ? _self.appealReasonLanguage + : appealReasonLanguage // ignore: cast_nullable_to_non_nullable + as String?, attachments: freezed == attachments ? _self.attachments : attachments // ignore: cast_nullable_to_non_nullable @@ -252,6 +267,10 @@ class _$AppealItemResponseCopyWithImpl<$Res> implements $AppealItemResponseCopyW ? _self.id : id // ignore: cast_nullable_to_non_nullable as String, + languages: freezed == languages + ? _self.languages + : languages // ignore: cast_nullable_to_non_nullable + as List?, moderationAction: freezed == moderationAction ? _self.moderationAction : moderationAction // ignore: cast_nullable_to_non_nullable diff --git a/packages/stream_chat/lib/open_api/model/appeal_item_response.g.dart b/packages/stream_chat/lib/open_api/model/appeal_item_response.g.dart index 179ca9f54e..f7ea123db7 100644 --- a/packages/stream_chat/lib/open_api/model/appeal_item_response.g.dart +++ b/packages/stream_chat/lib/open_api/model/appeal_item_response.g.dart @@ -12,6 +12,7 @@ AppealItemResponse _$AppealItemResponseFromJson(Map json) => Ap .toList(), aiTextSeverity: json['ai_text_severity'] as String?, appealReason: json['appeal_reason'] as String, + appealReasonLanguage: json['appeal_reason_language'] as String?, attachments: (json['attachments'] as List?)?.map((e) => e as String).toList(), channelCid: json['channel_cid'] as String?, configKey: json['config_key'] as String?, @@ -34,6 +35,7 @@ AppealItemResponse _$AppealItemResponseFromJson(Map json) => Ap ) .toList(), id: json['id'] as String, + languages: (json['languages'] as List?)?.map((e) => e as String).toList(), moderationAction: json['moderation_action'] == null ? null : ActionLogResponse.fromJson( @@ -58,6 +60,7 @@ Map _$AppealItemResponseToJson(AppealItemResponse instance) => 'actions': instance.actions?.map((e) => e.toJson()).toList(), 'ai_text_severity': instance.aiTextSeverity, 'appeal_reason': instance.appealReason, + 'appeal_reason_language': instance.appealReasonLanguage, 'attachments': instance.attachments, 'channel_cid': instance.channelCid, 'config_key': instance.configKey, @@ -70,6 +73,7 @@ Map _$AppealItemResponseToJson(AppealItemResponse instance) => 'flag_types': instance.flagTypes, 'flags': instance.flags?.map((e) => e.toJson()).toList(), 'id': instance.id, + 'languages': instance.languages, 'moderation_action': instance.moderationAction?.toJson(), 'original_moderation_action': instance.originalModerationAction?.toJson(), 'recommended_action': instance.recommendedAction, diff --git a/packages/stream_chat/lib/open_api/model/appeal_request.dart b/packages/stream_chat/lib/open_api/model/appeal_request.dart index 27259408e3..9f3fda25a6 100644 --- a/packages/stream_chat/lib/open_api/model/appeal_request.dart +++ b/packages/stream_chat/lib/open_api/model/appeal_request.dart @@ -20,6 +20,7 @@ class AppealRequest with _$AppealRequest { const AppealRequest({ required this.appealReason, this.attachments, + this.channelCid, required this.entityId, required this.entityType, this.reviewQueueItemId, @@ -33,6 +34,10 @@ class AppealRequest with _$AppealRequest { @JsonKey(name: 'attachments') final List? attachments; + @override + @JsonKey(name: 'channel_cid') + final String? channelCid; + @override @JsonKey(name: 'entity_id') final String entityId; diff --git a/packages/stream_chat/lib/open_api/model/appeal_request.freezed.dart b/packages/stream_chat/lib/open_api/model/appeal_request.freezed.dart index 3c42ef2de1..41cc10dac1 100644 --- a/packages/stream_chat/lib/open_api/model/appeal_request.freezed.dart +++ b/packages/stream_chat/lib/open_api/model/appeal_request.freezed.dart @@ -15,6 +15,7 @@ T _$identity(T value) => value; mixin _$AppealRequest { String get appealReason; List? get attachments; + String? get channelCid; String get entityId; String get entityType; String? get reviewQueueItemId; @@ -38,6 +39,7 @@ mixin _$AppealRequest { other.attachments, attachments, ) && + (identical(other.channelCid, channelCid) || other.channelCid == channelCid) && (identical(other.entityId, entityId) || other.entityId == entityId) && (identical(other.entityType, entityType) || other.entityType == entityType) && (identical(other.reviewQueueItemId, reviewQueueItemId) || other.reviewQueueItemId == reviewQueueItemId)); @@ -48,6 +50,7 @@ mixin _$AppealRequest { runtimeType, appealReason, const DeepCollectionEquality().hash(attachments), + channelCid, entityId, entityType, reviewQueueItemId, @@ -55,7 +58,7 @@ mixin _$AppealRequest { @override String toString() { - return 'AppealRequest(appealReason: $appealReason, attachments: $attachments, entityId: $entityId, entityType: $entityType, reviewQueueItemId: $reviewQueueItemId)'; + return 'AppealRequest(appealReason: $appealReason, attachments: $attachments, channelCid: $channelCid, entityId: $entityId, entityType: $entityType, reviewQueueItemId: $reviewQueueItemId)'; } } @@ -69,6 +72,7 @@ abstract mixin class $AppealRequestCopyWith<$Res> { $Res call({ String appealReason, List? attachments, + String? channelCid, String entityId, String entityType, String? reviewQueueItemId, @@ -89,6 +93,7 @@ class _$AppealRequestCopyWithImpl<$Res> implements $AppealRequestCopyWith<$Res> $Res call({ Object? appealReason = null, Object? attachments = freezed, + Object? channelCid = freezed, Object? entityId = null, Object? entityType = null, Object? reviewQueueItemId = freezed, @@ -103,6 +108,10 @@ class _$AppealRequestCopyWithImpl<$Res> implements $AppealRequestCopyWith<$Res> ? _self.attachments : attachments // ignore: cast_nullable_to_non_nullable as List?, + channelCid: freezed == channelCid + ? _self.channelCid + : channelCid // ignore: cast_nullable_to_non_nullable + as String?, entityId: null == entityId ? _self.entityId : entityId // ignore: cast_nullable_to_non_nullable diff --git a/packages/stream_chat/lib/open_api/model/appeal_request.g.dart b/packages/stream_chat/lib/open_api/model/appeal_request.g.dart index c489d13ccf..9724bdf16a 100644 --- a/packages/stream_chat/lib/open_api/model/appeal_request.g.dart +++ b/packages/stream_chat/lib/open_api/model/appeal_request.g.dart @@ -9,6 +9,7 @@ part of 'appeal_request.dart'; AppealRequest _$AppealRequestFromJson(Map json) => AppealRequest( appealReason: json['appeal_reason'] as String, attachments: (json['attachments'] as List?)?.map((e) => e as String).toList(), + channelCid: json['channel_cid'] as String?, entityId: json['entity_id'] as String, entityType: json['entity_type'] as String, reviewQueueItemId: json['review_queue_item_id'] as String?, @@ -17,6 +18,7 @@ AppealRequest _$AppealRequestFromJson(Map json) => AppealReques Map _$AppealRequestToJson(AppealRequest instance) => { 'appeal_reason': instance.appealReason, 'attachments': instance.attachments, + 'channel_cid': instance.channelCid, 'entity_id': instance.entityId, 'entity_type': instance.entityType, 'review_queue_item_id': instance.reviewQueueItemId, diff --git a/packages/stream_chat/lib/open_api/model/ban_request.dart b/packages/stream_chat/lib/open_api/model/ban_request.dart index 2b81bf04e5..9c87c7b894 100644 --- a/packages/stream_chat/lib/open_api/model/ban_request.dart +++ b/packages/stream_chat/lib/open_api/model/ban_request.dart @@ -28,8 +28,6 @@ extension type const BanRequestDeleteMessages._(String _) implements String { @JsonSerializable() class BanRequest with _$BanRequest { const BanRequest({ - this.bannedBy, - this.bannedById, this.channelCid, this.deleteMessages, this.ipBan, @@ -39,14 +37,6 @@ class BanRequest with _$BanRequest { this.timeout, }); - @override - @JsonKey(name: 'banned_by') - final UserRequest? bannedBy; - - @override - @JsonKey(name: 'banned_by_id') - final String? bannedById; - @override @JsonKey(name: 'channel_cid') final String? channelCid; diff --git a/packages/stream_chat/lib/open_api/model/ban_request.freezed.dart b/packages/stream_chat/lib/open_api/model/ban_request.freezed.dart index 2845d7ec41..df9abd77e3 100644 --- a/packages/stream_chat/lib/open_api/model/ban_request.freezed.dart +++ b/packages/stream_chat/lib/open_api/model/ban_request.freezed.dart @@ -13,8 +13,6 @@ T _$identity(T value) => value; /// @nodoc mixin _$BanRequest { - UserRequest? get bannedBy; - String? get bannedById; String? get channelCid; BanRequestDeleteMessages? get deleteMessages; bool? get ipBan; @@ -34,8 +32,6 @@ mixin _$BanRequest { return identical(this, other) || (other.runtimeType == runtimeType && other is BanRequest && - (identical(other.bannedBy, bannedBy) || other.bannedBy == bannedBy) && - (identical(other.bannedById, bannedById) || other.bannedById == bannedById) && (identical(other.channelCid, channelCid) || other.channelCid == channelCid) && (identical(other.deleteMessages, deleteMessages) || other.deleteMessages == deleteMessages) && (identical(other.ipBan, ipBan) || other.ipBan == ipBan) && @@ -48,8 +44,6 @@ mixin _$BanRequest { @override int get hashCode => Object.hash( runtimeType, - bannedBy, - bannedById, channelCid, deleteMessages, ipBan, @@ -61,7 +55,7 @@ mixin _$BanRequest { @override String toString() { - return 'BanRequest(bannedBy: $bannedBy, bannedById: $bannedById, channelCid: $channelCid, deleteMessages: $deleteMessages, ipBan: $ipBan, reason: $reason, shadow: $shadow, targetUserId: $targetUserId, timeout: $timeout)'; + return 'BanRequest(channelCid: $channelCid, deleteMessages: $deleteMessages, ipBan: $ipBan, reason: $reason, shadow: $shadow, targetUserId: $targetUserId, timeout: $timeout)'; } } @@ -73,8 +67,6 @@ abstract mixin class $BanRequestCopyWith<$Res> { ) = _$BanRequestCopyWithImpl; @useResult $Res call({ - UserRequest? bannedBy, - String? bannedById, String? channelCid, BanRequestDeleteMessages? deleteMessages, bool? ipBan, @@ -97,8 +89,6 @@ class _$BanRequestCopyWithImpl<$Res> implements $BanRequestCopyWith<$Res> { @pragma('vm:prefer-inline') @override $Res call({ - Object? bannedBy = freezed, - Object? bannedById = freezed, Object? channelCid = freezed, Object? deleteMessages = freezed, Object? ipBan = freezed, @@ -109,14 +99,6 @@ class _$BanRequestCopyWithImpl<$Res> implements $BanRequestCopyWith<$Res> { }) { return _then( BanRequest( - bannedBy: freezed == bannedBy - ? _self.bannedBy - : bannedBy // ignore: cast_nullable_to_non_nullable - as UserRequest?, - bannedById: freezed == bannedById - ? _self.bannedById - : bannedById // ignore: cast_nullable_to_non_nullable - as String?, channelCid: freezed == channelCid ? _self.channelCid : channelCid // ignore: cast_nullable_to_non_nullable diff --git a/packages/stream_chat/lib/open_api/model/ban_request.g.dart b/packages/stream_chat/lib/open_api/model/ban_request.g.dart index 1221ca3ad7..43e691892b 100644 --- a/packages/stream_chat/lib/open_api/model/ban_request.g.dart +++ b/packages/stream_chat/lib/open_api/model/ban_request.g.dart @@ -7,8 +7,6 @@ part of 'ban_request.dart'; // ************************************************************************** BanRequest _$BanRequestFromJson(Map json) => BanRequest( - bannedBy: json['banned_by'] == null ? null : UserRequest.fromJson(json['banned_by'] as Map), - bannedById: json['banned_by_id'] as String?, channelCid: json['channel_cid'] as String?, deleteMessages: json['delete_messages'] == null ? null @@ -21,8 +19,6 @@ BanRequest _$BanRequestFromJson(Map json) => BanRequest( ); Map _$BanRequestToJson(BanRequest instance) => { - 'banned_by': instance.bannedBy?.toJson(), - 'banned_by_id': instance.bannedById, 'channel_cid': instance.channelCid, 'delete_messages': instance.deleteMessages?.toJson(), 'ip_ban': instance.ipBan, diff --git a/packages/stream_chat/lib/open_api/model/config_response.dart b/packages/stream_chat/lib/open_api/model/config_response.dart index 3c1d04b07e..2936e17562 100644 --- a/packages/stream_chat/lib/open_api/model/config_response.dart +++ b/packages/stream_chat/lib/open_api/model/config_response.dart @@ -63,7 +63,7 @@ class ConfigResponse with _$ConfigResponse { @override @JsonKey(name: 'ai_video_config') - final AIVideoConfig? aiVideoConfig; + final AIVideoConfigResponse? aiVideoConfig; @override @JsonKey(name: 'async') diff --git a/packages/stream_chat/lib/open_api/model/config_response.freezed.dart b/packages/stream_chat/lib/open_api/model/config_response.freezed.dart index 6407fe6b29..54ea2417be 100644 --- a/packages/stream_chat/lib/open_api/model/config_response.freezed.dart +++ b/packages/stream_chat/lib/open_api/model/config_response.freezed.dart @@ -18,7 +18,7 @@ mixin _$ConfigResponse { List? get aiImageLabelDefinitions; Map>? get aiImageSubclassifications; AITextConfig? get aiTextConfig; - AIVideoConfig? get aiVideoConfig; + AIVideoConfigResponse? get aiVideoConfig; bool get async; AutomodPlatformCircumventionConfig? get automodPlatformCircumventionConfig; AutomodSemanticFiltersConfig? get automodSemanticFiltersConfig; @@ -140,7 +140,7 @@ abstract mixin class $ConfigResponseCopyWith<$Res> { List? aiImageLabelDefinitions, Map>? aiImageSubclassifications, AITextConfig? aiTextConfig, - AIVideoConfig? aiVideoConfig, + AIVideoConfigResponse? aiVideoConfig, bool async, AutomodPlatformCircumventionConfig? automodPlatformCircumventionConfig, AutomodSemanticFiltersConfig? automodSemanticFiltersConfig, @@ -218,7 +218,7 @@ class _$ConfigResponseCopyWithImpl<$Res> implements $ConfigResponseCopyWith<$Res aiVideoConfig: freezed == aiVideoConfig ? _self.aiVideoConfig : aiVideoConfig // ignore: cast_nullable_to_non_nullable - as AIVideoConfig?, + as AIVideoConfigResponse?, async: null == async ? _self.async : async // ignore: cast_nullable_to_non_nullable diff --git a/packages/stream_chat/lib/open_api/model/config_response.g.dart b/packages/stream_chat/lib/open_api/model/config_response.g.dart index 33ce58d87b..8aea3abbeb 100644 --- a/packages/stream_chat/lib/open_api/model/config_response.g.dart +++ b/packages/stream_chat/lib/open_api/model/config_response.g.dart @@ -30,7 +30,9 @@ ConfigResponse _$ConfigResponseFromJson( : AITextConfig.fromJson(json['ai_text_config'] as Map), aiVideoConfig: json['ai_video_config'] == null ? null - : AIVideoConfig.fromJson(json['ai_video_config'] as Map), + : AIVideoConfigResponse.fromJson( + json['ai_video_config'] as Map, + ), async: json['async'] as bool, automodPlatformCircumventionConfig: json['automod_platform_circumvention_config'] == null ? null diff --git a/packages/stream_chat/lib/open_api/model/create_reminder_response.dart b/packages/stream_chat/lib/open_api/model/create_reminder_response.dart new file mode 100644 index 0000000000..97b8f2e645 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/create_reminder_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'create_reminder_response.g.dart'; +part 'create_reminder_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class CreateReminderResponse with _$CreateReminderResponse { + const CreateReminderResponse({ + required this.duration, + required this.reminder, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'reminder') + final ReminderResponseData reminder; + + Map toJson() => _$CreateReminderResponseToJson(this); + + static CreateReminderResponse fromJson(Map json) => _$CreateReminderResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/create_reminder_response.freezed.dart b/packages/stream_chat/lib/open_api/model/create_reminder_response.freezed.dart new file mode 100644 index 0000000000..98561aa7f1 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/create_reminder_response.freezed.dart @@ -0,0 +1,82 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'create_reminder_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$CreateReminderResponse { + String get duration; + ReminderResponseData get reminder; + + /// Create a copy of CreateReminderResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $CreateReminderResponseCopyWith get copyWith => + _$CreateReminderResponseCopyWithImpl( + this as CreateReminderResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is CreateReminderResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.reminder, reminder) || other.reminder == reminder)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration, reminder); + + @override + String toString() { + return 'CreateReminderResponse(duration: $duration, reminder: $reminder)'; + } +} + +/// @nodoc +abstract mixin class $CreateReminderResponseCopyWith<$Res> { + factory $CreateReminderResponseCopyWith( + CreateReminderResponse value, + $Res Function(CreateReminderResponse) _then, + ) = _$CreateReminderResponseCopyWithImpl; + @useResult + $Res call({String duration, ReminderResponseData reminder}); +} + +/// @nodoc +class _$CreateReminderResponseCopyWithImpl<$Res> implements $CreateReminderResponseCopyWith<$Res> { + _$CreateReminderResponseCopyWithImpl(this._self, this._then); + + final CreateReminderResponse _self; + final $Res Function(CreateReminderResponse) _then; + + /// Create a copy of CreateReminderResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? reminder = null}) { + return _then( + CreateReminderResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + reminder: null == reminder + ? _self.reminder + : reminder // ignore: cast_nullable_to_non_nullable + as ReminderResponseData, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/create_reminder_response.g.dart b/packages/stream_chat/lib/open_api/model/create_reminder_response.g.dart new file mode 100644 index 0000000000..ab7393ce50 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/create_reminder_response.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'create_reminder_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +CreateReminderResponse _$CreateReminderResponseFromJson( + Map json, +) => CreateReminderResponse( + duration: json['duration'] as String, + reminder: ReminderResponseData.fromJson( + json['reminder'] as Map, + ), +); + +Map _$CreateReminderResponseToJson( + CreateReminderResponse instance, +) => { + 'duration': instance.duration, + 'reminder': instance.reminder.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/filter_config_response.dart b/packages/stream_chat/lib/open_api/model/filter_config_response.dart index 6a13efc34e..5c153be9df 100644 --- a/packages/stream_chat/lib/open_api/model/filter_config_response.dart +++ b/packages/stream_chat/lib/open_api/model/filter_config_response.dart @@ -24,6 +24,7 @@ class FilterConfigResponse with _$FilterConfigResponse { this.configKeys, this.filterableCustomKeys, required this.llmLabels, + this.ruleNames, }); @override @@ -50,6 +51,10 @@ class FilterConfigResponse with _$FilterConfigResponse { @JsonKey(name: 'llm_labels') final List llmLabels; + @override + @JsonKey(name: 'rule_names') + final List? ruleNames; + Map toJson() => _$FilterConfigResponseToJson(this); static FilterConfigResponse fromJson(Map json) => _$FilterConfigResponseFromJson(json); diff --git a/packages/stream_chat/lib/open_api/model/filter_config_response.freezed.dart b/packages/stream_chat/lib/open_api/model/filter_config_response.freezed.dart index c3ad6cab8f..8f99a16360 100644 --- a/packages/stream_chat/lib/open_api/model/filter_config_response.freezed.dart +++ b/packages/stream_chat/lib/open_api/model/filter_config_response.freezed.dart @@ -19,6 +19,7 @@ mixin _$FilterConfigResponse { List? get configKeys; List? get filterableCustomKeys; List get llmLabels; + List? get ruleNames; /// Create a copy of FilterConfigResponse /// with the given fields replaced by the non-null parameter values. @@ -55,7 +56,8 @@ mixin _$FilterConfigResponse { other.filterableCustomKeys, filterableCustomKeys, ) && - const DeepCollectionEquality().equals(other.llmLabels, llmLabels)); + const DeepCollectionEquality().equals(other.llmLabels, llmLabels) && + const DeepCollectionEquality().equals(other.ruleNames, ruleNames)); } @override @@ -67,11 +69,12 @@ mixin _$FilterConfigResponse { const DeepCollectionEquality().hash(configKeys), const DeepCollectionEquality().hash(filterableCustomKeys), const DeepCollectionEquality().hash(llmLabels), + const DeepCollectionEquality().hash(ruleNames), ); @override String toString() { - return 'FilterConfigResponse(aiImageLabels: $aiImageLabels, aiImageTaxonomy: $aiImageTaxonomy, aiTextLabels: $aiTextLabels, configKeys: $configKeys, filterableCustomKeys: $filterableCustomKeys, llmLabels: $llmLabels)'; + return 'FilterConfigResponse(aiImageLabels: $aiImageLabels, aiImageTaxonomy: $aiImageTaxonomy, aiTextLabels: $aiTextLabels, configKeys: $configKeys, filterableCustomKeys: $filterableCustomKeys, llmLabels: $llmLabels, ruleNames: $ruleNames)'; } } @@ -89,6 +92,7 @@ abstract mixin class $FilterConfigResponseCopyWith<$Res> { List? configKeys, List? filterableCustomKeys, List llmLabels, + List? ruleNames, }); } @@ -110,6 +114,7 @@ class _$FilterConfigResponseCopyWithImpl<$Res> implements $FilterConfigResponseC Object? configKeys = freezed, Object? filterableCustomKeys = freezed, Object? llmLabels = null, + Object? ruleNames = freezed, }) { return _then( FilterConfigResponse( @@ -137,6 +142,10 @@ class _$FilterConfigResponseCopyWithImpl<$Res> implements $FilterConfigResponseC ? _self.llmLabels : llmLabels // ignore: cast_nullable_to_non_nullable as List, + ruleNames: freezed == ruleNames + ? _self.ruleNames + : ruleNames // ignore: cast_nullable_to_non_nullable + as List?, ), ); } diff --git a/packages/stream_chat/lib/open_api/model/filter_config_response.g.dart b/packages/stream_chat/lib/open_api/model/filter_config_response.g.dart index 373695af68..d9513aee4c 100644 --- a/packages/stream_chat/lib/open_api/model/filter_config_response.g.dart +++ b/packages/stream_chat/lib/open_api/model/filter_config_response.g.dart @@ -17,6 +17,7 @@ FilterConfigResponse _$FilterConfigResponseFromJson( configKeys: (json['config_keys'] as List?)?.map((e) => e as String).toList(), filterableCustomKeys: (json['filterable_custom_keys'] as List?)?.map((e) => e as String).toList(), llmLabels: (json['llm_labels'] as List).map((e) => e as String).toList(), + ruleNames: (json['rule_names'] as List?)?.map((e) => e as String).toList(), ); Map _$FilterConfigResponseToJson( @@ -28,4 +29,5 @@ Map _$FilterConfigResponseToJson( 'config_keys': instance.configKeys, 'filterable_custom_keys': instance.filterableCustomKeys, 'llm_labels': instance.llmLabels, + 'rule_names': instance.ruleNames, }; diff --git a/packages/stream_chat/lib/open_api/model/flood_identical_rule_parameters.dart b/packages/stream_chat/lib/open_api/model/flood_identical_rule_parameters.dart index 81518bd4af..dd5a8c732d 100644 --- a/packages/stream_chat/lib/open_api/model/flood_identical_rule_parameters.dart +++ b/packages/stream_chat/lib/open_api/model/flood_identical_rule_parameters.dart @@ -19,14 +19,20 @@ part 'flood_identical_rule_parameters.freezed.dart'; class FloodIdenticalRuleParameters with _$FloodIdenticalRuleParameters { const FloodIdenticalRuleParameters({ this.allowlist, + this.minTextLength, this.threshold, this.timeWindow, + this.trackAcrossUsers, }); @override @JsonKey(name: 'allowlist') final List? allowlist; + @override + @JsonKey(name: 'min_text_length') + final int? minTextLength; + @override @JsonKey(name: 'threshold') final int? threshold; @@ -35,6 +41,10 @@ class FloodIdenticalRuleParameters with _$FloodIdenticalRuleParameters { @JsonKey(name: 'time_window') final String? timeWindow; + @override + @JsonKey(name: 'track_across_users') + final bool? trackAcrossUsers; + Map toJson() => _$FloodIdenticalRuleParametersToJson(this); static FloodIdenticalRuleParameters fromJson(Map json) => diff --git a/packages/stream_chat/lib/open_api/model/flood_identical_rule_parameters.freezed.dart b/packages/stream_chat/lib/open_api/model/flood_identical_rule_parameters.freezed.dart index 5dba4da5e9..a6a35d82b9 100644 --- a/packages/stream_chat/lib/open_api/model/flood_identical_rule_parameters.freezed.dart +++ b/packages/stream_chat/lib/open_api/model/flood_identical_rule_parameters.freezed.dart @@ -14,8 +14,10 @@ T _$identity(T value) => value; /// @nodoc mixin _$FloodIdenticalRuleParameters { List? get allowlist; + int? get minTextLength; int? get threshold; String? get timeWindow; + bool? get trackAcrossUsers; /// Create a copy of FloodIdenticalRuleParameters /// with the given fields replaced by the non-null parameter values. @@ -33,21 +35,25 @@ mixin _$FloodIdenticalRuleParameters { (other.runtimeType == runtimeType && other is FloodIdenticalRuleParameters && const DeepCollectionEquality().equals(other.allowlist, allowlist) && + (identical(other.minTextLength, minTextLength) || other.minTextLength == minTextLength) && (identical(other.threshold, threshold) || other.threshold == threshold) && - (identical(other.timeWindow, timeWindow) || other.timeWindow == timeWindow)); + (identical(other.timeWindow, timeWindow) || other.timeWindow == timeWindow) && + (identical(other.trackAcrossUsers, trackAcrossUsers) || other.trackAcrossUsers == trackAcrossUsers)); } @override int get hashCode => Object.hash( runtimeType, const DeepCollectionEquality().hash(allowlist), + minTextLength, threshold, timeWindow, + trackAcrossUsers, ); @override String toString() { - return 'FloodIdenticalRuleParameters(allowlist: $allowlist, threshold: $threshold, timeWindow: $timeWindow)'; + return 'FloodIdenticalRuleParameters(allowlist: $allowlist, minTextLength: $minTextLength, threshold: $threshold, timeWindow: $timeWindow, trackAcrossUsers: $trackAcrossUsers)'; } } @@ -58,7 +64,13 @@ abstract mixin class $FloodIdenticalRuleParametersCopyWith<$Res> { $Res Function(FloodIdenticalRuleParameters) _then, ) = _$FloodIdenticalRuleParametersCopyWithImpl; @useResult - $Res call({List? allowlist, int? threshold, String? timeWindow}); + $Res call({ + List? allowlist, + int? minTextLength, + int? threshold, + String? timeWindow, + bool? trackAcrossUsers, + }); } /// @nodoc @@ -74,8 +86,10 @@ class _$FloodIdenticalRuleParametersCopyWithImpl<$Res> implements $FloodIdentica @override $Res call({ Object? allowlist = freezed, + Object? minTextLength = freezed, Object? threshold = freezed, Object? timeWindow = freezed, + Object? trackAcrossUsers = freezed, }) { return _then( FloodIdenticalRuleParameters( @@ -83,6 +97,10 @@ class _$FloodIdenticalRuleParametersCopyWithImpl<$Res> implements $FloodIdentica ? _self.allowlist : allowlist // ignore: cast_nullable_to_non_nullable as List?, + minTextLength: freezed == minTextLength + ? _self.minTextLength + : minTextLength // ignore: cast_nullable_to_non_nullable + as int?, threshold: freezed == threshold ? _self.threshold : threshold // ignore: cast_nullable_to_non_nullable @@ -91,6 +109,10 @@ class _$FloodIdenticalRuleParametersCopyWithImpl<$Res> implements $FloodIdentica ? _self.timeWindow : timeWindow // ignore: cast_nullable_to_non_nullable as String?, + trackAcrossUsers: freezed == trackAcrossUsers + ? _self.trackAcrossUsers + : trackAcrossUsers // ignore: cast_nullable_to_non_nullable + as bool?, ), ); } diff --git a/packages/stream_chat/lib/open_api/model/flood_identical_rule_parameters.g.dart b/packages/stream_chat/lib/open_api/model/flood_identical_rule_parameters.g.dart index 9e1c2cee7d..5d75edccc8 100644 --- a/packages/stream_chat/lib/open_api/model/flood_identical_rule_parameters.g.dart +++ b/packages/stream_chat/lib/open_api/model/flood_identical_rule_parameters.g.dart @@ -10,14 +10,18 @@ FloodIdenticalRuleParameters _$FloodIdenticalRuleParametersFromJson( Map json, ) => FloodIdenticalRuleParameters( allowlist: (json['allowlist'] as List?)?.map((e) => e as String).toList(), + minTextLength: (json['min_text_length'] as num?)?.toInt(), threshold: (json['threshold'] as num?)?.toInt(), timeWindow: json['time_window'] as String?, + trackAcrossUsers: json['track_across_users'] as bool?, ); Map _$FloodIdenticalRuleParametersToJson( FloodIdenticalRuleParameters instance, ) => { 'allowlist': instance.allowlist, + 'min_text_length': instance.minTextLength, 'threshold': instance.threshold, 'time_window': instance.timeWindow, + 'track_across_users': instance.trackAcrossUsers, }; diff --git a/packages/stream_chat/lib/open_api/model/moderation_flag_response.dart b/packages/stream_chat/lib/open_api/model/moderation_flag_response.dart index 74bab102cf..ca82630a53 100644 --- a/packages/stream_chat/lib/open_api/model/moderation_flag_response.dart +++ b/packages/stream_chat/lib/open_api/model/moderation_flag_response.dart @@ -18,6 +18,7 @@ part 'moderation_flag_response.freezed.dart'; @JsonSerializable() class ModerationFlagResponse with _$ModerationFlagResponse { const ModerationFlagResponse({ + this.contentPublishedAt, required this.createdAt, this.custom, this.entityCreatorId, @@ -35,6 +36,11 @@ class ModerationFlagResponse with _$ModerationFlagResponse { required this.userId, }); + @override + @StreamDateTimeConverter() + @JsonKey(name: 'content_published_at') + final DateTime? contentPublishedAt; + @override @StreamDateTimeConverter() @JsonKey(name: 'created_at') diff --git a/packages/stream_chat/lib/open_api/model/moderation_flag_response.freezed.dart b/packages/stream_chat/lib/open_api/model/moderation_flag_response.freezed.dart index 23c4ce823d..ecc4e982b4 100644 --- a/packages/stream_chat/lib/open_api/model/moderation_flag_response.freezed.dart +++ b/packages/stream_chat/lib/open_api/model/moderation_flag_response.freezed.dart @@ -13,6 +13,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$ModerationFlagResponse { + DateTime? get contentPublishedAt; DateTime get createdAt; Map? get custom; String? get entityCreatorId; @@ -44,6 +45,8 @@ mixin _$ModerationFlagResponse { return identical(this, other) || (other.runtimeType == runtimeType && other is ModerationFlagResponse && + (identical(other.contentPublishedAt, contentPublishedAt) || + other.contentPublishedAt == contentPublishedAt) && (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && const DeepCollectionEquality().equals(other.custom, custom) && (identical(other.entityCreatorId, entityCreatorId) || other.entityCreatorId == entityCreatorId) && @@ -64,6 +67,7 @@ mixin _$ModerationFlagResponse { @override int get hashCode => Object.hash( runtimeType, + contentPublishedAt, createdAt, const DeepCollectionEquality().hash(custom), entityCreatorId, @@ -83,7 +87,7 @@ mixin _$ModerationFlagResponse { @override String toString() { - return 'ModerationFlagResponse(createdAt: $createdAt, custom: $custom, entityCreatorId: $entityCreatorId, entityId: $entityId, entityType: $entityType, labels: $labels, moderationPayload: $moderationPayload, reason: $reason, result: $result, reviewQueueItem: $reviewQueueItem, reviewQueueItemId: $reviewQueueItemId, type: $type, updatedAt: $updatedAt, user: $user, userId: $userId)'; + return 'ModerationFlagResponse(contentPublishedAt: $contentPublishedAt, createdAt: $createdAt, custom: $custom, entityCreatorId: $entityCreatorId, entityId: $entityId, entityType: $entityType, labels: $labels, moderationPayload: $moderationPayload, reason: $reason, result: $result, reviewQueueItem: $reviewQueueItem, reviewQueueItemId: $reviewQueueItemId, type: $type, updatedAt: $updatedAt, user: $user, userId: $userId)'; } } @@ -95,6 +99,7 @@ abstract mixin class $ModerationFlagResponseCopyWith<$Res> { ) = _$ModerationFlagResponseCopyWithImpl; @useResult $Res call({ + DateTime? contentPublishedAt, DateTime createdAt, Map? custom, String? entityCreatorId, @@ -125,6 +130,7 @@ class _$ModerationFlagResponseCopyWithImpl<$Res> implements $ModerationFlagRespo @pragma('vm:prefer-inline') @override $Res call({ + Object? contentPublishedAt = freezed, Object? createdAt = null, Object? custom = freezed, Object? entityCreatorId = freezed, @@ -143,6 +149,10 @@ class _$ModerationFlagResponseCopyWithImpl<$Res> implements $ModerationFlagRespo }) { return _then( ModerationFlagResponse( + contentPublishedAt: freezed == contentPublishedAt + ? _self.contentPublishedAt + : contentPublishedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable diff --git a/packages/stream_chat/lib/open_api/model/moderation_flag_response.g.dart b/packages/stream_chat/lib/open_api/model/moderation_flag_response.g.dart index 10f5d9a17f..ae04a34216 100644 --- a/packages/stream_chat/lib/open_api/model/moderation_flag_response.g.dart +++ b/packages/stream_chat/lib/open_api/model/moderation_flag_response.g.dart @@ -9,6 +9,10 @@ part of 'moderation_flag_response.dart'; ModerationFlagResponse _$ModerationFlagResponseFromJson( Map json, ) => ModerationFlagResponse( + contentPublishedAt: _$JsonConverterFromJson( + json['content_published_at'], + const StreamDateTimeConverter().fromJson, + ), createdAt: const StreamDateTimeConverter().fromJson( json['created_at'] as Object, ), @@ -41,6 +45,10 @@ ModerationFlagResponse _$ModerationFlagResponseFromJson( Map _$ModerationFlagResponseToJson( ModerationFlagResponse instance, ) => { + 'content_published_at': _$JsonConverterToJson( + instance.contentPublishedAt, + const StreamDateTimeConverter().toJson, + ), 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), 'custom': instance.custom, 'entity_creator_id': instance.entityCreatorId, @@ -57,3 +65,13 @@ Map _$ModerationFlagResponseToJson( 'user': instance.user?.toJson(), 'user_id': instance.userId, }; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/moderation_payload.dart b/packages/stream_chat/lib/open_api/model/moderation_payload.dart index 8adfea2854..9a58f591e0 100644 --- a/packages/stream_chat/lib/open_api/model/moderation_payload.dart +++ b/packages/stream_chat/lib/open_api/model/moderation_payload.dart @@ -19,6 +19,7 @@ part 'moderation_payload.freezed.dart'; class ModerationPayload with _$ModerationPayload { const ModerationPayload({ this.audios, + this.countryCode, this.custom, this.imageIds, this.imageOrderedKeys, @@ -34,6 +35,10 @@ class ModerationPayload with _$ModerationPayload { @JsonKey(name: 'audios') final List? audios; + @override + @JsonKey(name: 'country_code') + final String? countryCode; + @override @JsonKey(name: 'custom') final Map? custom; diff --git a/packages/stream_chat/lib/open_api/model/moderation_payload.freezed.dart b/packages/stream_chat/lib/open_api/model/moderation_payload.freezed.dart index 44036e0421..b468008104 100644 --- a/packages/stream_chat/lib/open_api/model/moderation_payload.freezed.dart +++ b/packages/stream_chat/lib/open_api/model/moderation_payload.freezed.dart @@ -14,6 +14,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$ModerationPayload { List? get audios; + String? get countryCode; Map? get custom; Map? get imageIds; List? get imageOrderedKeys; @@ -39,6 +40,7 @@ mixin _$ModerationPayload { (other.runtimeType == runtimeType && other is ModerationPayload && const DeepCollectionEquality().equals(other.audios, audios) && + (identical(other.countryCode, countryCode) || other.countryCode == countryCode) && const DeepCollectionEquality().equals(other.custom, custom) && const DeepCollectionEquality().equals(other.imageIds, imageIds) && const DeepCollectionEquality().equals( @@ -63,6 +65,7 @@ mixin _$ModerationPayload { int get hashCode => Object.hash( runtimeType, const DeepCollectionEquality().hash(audios), + countryCode, const DeepCollectionEquality().hash(custom), const DeepCollectionEquality().hash(imageIds), const DeepCollectionEquality().hash(imageOrderedKeys), @@ -76,7 +79,7 @@ mixin _$ModerationPayload { @override String toString() { - return 'ModerationPayload(audios: $audios, custom: $custom, imageIds: $imageIds, imageOrderedKeys: $imageOrderedKeys, images: $images, otherMedia: $otherMedia, textIds: $textIds, textOrderedKeys: $textOrderedKeys, texts: $texts, videos: $videos)'; + return 'ModerationPayload(audios: $audios, countryCode: $countryCode, custom: $custom, imageIds: $imageIds, imageOrderedKeys: $imageOrderedKeys, images: $images, otherMedia: $otherMedia, textIds: $textIds, textOrderedKeys: $textOrderedKeys, texts: $texts, videos: $videos)'; } } @@ -89,6 +92,7 @@ abstract mixin class $ModerationPayloadCopyWith<$Res> { @useResult $Res call({ List? audios, + String? countryCode, Map? custom, Map? imageIds, List? imageOrderedKeys, @@ -114,6 +118,7 @@ class _$ModerationPayloadCopyWithImpl<$Res> implements $ModerationPayloadCopyWit @override $Res call({ Object? audios = freezed, + Object? countryCode = freezed, Object? custom = freezed, Object? imageIds = freezed, Object? imageOrderedKeys = freezed, @@ -130,6 +135,10 @@ class _$ModerationPayloadCopyWithImpl<$Res> implements $ModerationPayloadCopyWit ? _self.audios : audios // ignore: cast_nullable_to_non_nullable as List?, + countryCode: freezed == countryCode + ? _self.countryCode + : countryCode // ignore: cast_nullable_to_non_nullable + as String?, custom: freezed == custom ? _self.custom : custom // ignore: cast_nullable_to_non_nullable diff --git a/packages/stream_chat/lib/open_api/model/moderation_payload.g.dart b/packages/stream_chat/lib/open_api/model/moderation_payload.g.dart index 6ac9b35241..4b360693d7 100644 --- a/packages/stream_chat/lib/open_api/model/moderation_payload.g.dart +++ b/packages/stream_chat/lib/open_api/model/moderation_payload.g.dart @@ -10,6 +10,7 @@ ModerationPayload _$ModerationPayloadFromJson( Map json, ) => ModerationPayload( audios: (json['audios'] as List?)?.map((e) => e as String).toList(), + countryCode: json['country_code'] as String?, custom: json['custom'] as Map?, imageIds: (json['image_ids'] as Map?)?.map( (k, e) => MapEntry(k, e as String), @@ -27,6 +28,7 @@ ModerationPayload _$ModerationPayloadFromJson( Map _$ModerationPayloadToJson(ModerationPayload instance) => { 'audios': instance.audios, + 'country_code': instance.countryCode, 'custom': instance.custom, 'image_ids': instance.imageIds, 'image_ordered_keys': instance.imageOrderedKeys, diff --git a/packages/stream_chat/lib/open_api/model/pagination_params.dart b/packages/stream_chat/lib/open_api/model/pagination_params.dart index 2a062f7541..bde9a1510e 100644 --- a/packages/stream_chat/lib/open_api/model/pagination_params.dart +++ b/packages/stream_chat/lib/open_api/model/pagination_params.dart @@ -18,10 +18,30 @@ part 'pagination_params.freezed.dart'; @JsonSerializable() class PaginationParams with _$PaginationParams { const PaginationParams({ + this.idGt, + this.idGte, + this.idLt, + this.idLte, this.limit, this.offset, }); + @override + @JsonKey(name: 'id_gt') + final int? idGt; + + @override + @JsonKey(name: 'id_gte') + final int? idGte; + + @override + @JsonKey(name: 'id_lt') + final int? idLt; + + @override + @JsonKey(name: 'id_lte') + final int? idLte; + @override @JsonKey(name: 'limit') final int? limit; diff --git a/packages/stream_chat/lib/open_api/model/pagination_params.freezed.dart b/packages/stream_chat/lib/open_api/model/pagination_params.freezed.dart index b275dc3f30..e798fd90d7 100644 --- a/packages/stream_chat/lib/open_api/model/pagination_params.freezed.dart +++ b/packages/stream_chat/lib/open_api/model/pagination_params.freezed.dart @@ -13,6 +13,10 @@ T _$identity(T value) => value; /// @nodoc mixin _$PaginationParams { + int? get idGt; + int? get idGte; + int? get idLt; + int? get idLte; int? get limit; int? get offset; @@ -30,16 +34,20 @@ mixin _$PaginationParams { return identical(this, other) || (other.runtimeType == runtimeType && other is PaginationParams && + (identical(other.idGt, idGt) || other.idGt == idGt) && + (identical(other.idGte, idGte) || other.idGte == idGte) && + (identical(other.idLt, idLt) || other.idLt == idLt) && + (identical(other.idLte, idLte) || other.idLte == idLte) && (identical(other.limit, limit) || other.limit == limit) && (identical(other.offset, offset) || other.offset == offset)); } @override - int get hashCode => Object.hash(runtimeType, limit, offset); + int get hashCode => Object.hash(runtimeType, idGt, idGte, idLt, idLte, limit, offset); @override String toString() { - return 'PaginationParams(limit: $limit, offset: $offset)'; + return 'PaginationParams(idGt: $idGt, idGte: $idGte, idLt: $idLt, idLte: $idLte, limit: $limit, offset: $offset)'; } } @@ -50,7 +58,14 @@ abstract mixin class $PaginationParamsCopyWith<$Res> { $Res Function(PaginationParams) _then, ) = _$PaginationParamsCopyWithImpl; @useResult - $Res call({int? limit, int? offset}); + $Res call({ + int? idGt, + int? idGte, + int? idLt, + int? idLte, + int? limit, + int? offset, + }); } /// @nodoc @@ -64,9 +79,32 @@ class _$PaginationParamsCopyWithImpl<$Res> implements $PaginationParamsCopyWith< /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? limit = freezed, Object? offset = freezed}) { + $Res call({ + Object? idGt = freezed, + Object? idGte = freezed, + Object? idLt = freezed, + Object? idLte = freezed, + Object? limit = freezed, + Object? offset = freezed, + }) { return _then( PaginationParams( + idGt: freezed == idGt + ? _self.idGt + : idGt // ignore: cast_nullable_to_non_nullable + as int?, + idGte: freezed == idGte + ? _self.idGte + : idGte // ignore: cast_nullable_to_non_nullable + as int?, + idLt: freezed == idLt + ? _self.idLt + : idLt // ignore: cast_nullable_to_non_nullable + as int?, + idLte: freezed == idLte + ? _self.idLte + : idLte // ignore: cast_nullable_to_non_nullable + as int?, limit: freezed == limit ? _self.limit : limit // ignore: cast_nullable_to_non_nullable diff --git a/packages/stream_chat/lib/open_api/model/pagination_params.g.dart b/packages/stream_chat/lib/open_api/model/pagination_params.g.dart index 1c83843c85..bd92e3d397 100644 --- a/packages/stream_chat/lib/open_api/model/pagination_params.g.dart +++ b/packages/stream_chat/lib/open_api/model/pagination_params.g.dart @@ -7,11 +7,19 @@ part of 'pagination_params.dart'; // ************************************************************************** PaginationParams _$PaginationParamsFromJson(Map json) => PaginationParams( + idGt: (json['id_gt'] as num?)?.toInt(), + idGte: (json['id_gte'] as num?)?.toInt(), + idLt: (json['id_lt'] as num?)?.toInt(), + idLte: (json['id_lte'] as num?)?.toInt(), limit: (json['limit'] as num?)?.toInt(), offset: (json['offset'] as num?)?.toInt(), ); Map _$PaginationParamsToJson(PaginationParams instance) => { + 'id_gt': instance.idGt, + 'id_gte': instance.idGte, + 'id_lt': instance.idLt, + 'id_lte': instance.idLte, 'limit': instance.limit, 'offset': instance.offset, }; diff --git a/packages/stream_chat/lib/open_api/model/poll_option_response_data.dart b/packages/stream_chat/lib/open_api/model/poll_option_response_data.dart index 2c43a9ac3e..ed087d4c0e 100644 --- a/packages/stream_chat/lib/open_api/model/poll_option_response_data.dart +++ b/packages/stream_chat/lib/open_api/model/poll_option_response_data.dart @@ -21,6 +21,7 @@ class PollOptionResponseData with _$PollOptionResponseData { required this.custom, required this.id, required this.text, + this.textI18n, }); @override @@ -35,6 +36,10 @@ class PollOptionResponseData with _$PollOptionResponseData { @JsonKey(name: 'text') final String text; + @override + @JsonKey(name: 'text_i18n') + final Map? textI18n; + Map toJson() => _$PollOptionResponseDataToJson(this); static PollOptionResponseData fromJson(Map json) => _$PollOptionResponseDataFromJson(json); diff --git a/packages/stream_chat/lib/open_api/model/poll_option_response_data.freezed.dart b/packages/stream_chat/lib/open_api/model/poll_option_response_data.freezed.dart index 81ad5947f6..c24635ab41 100644 --- a/packages/stream_chat/lib/open_api/model/poll_option_response_data.freezed.dart +++ b/packages/stream_chat/lib/open_api/model/poll_option_response_data.freezed.dart @@ -16,6 +16,7 @@ mixin _$PollOptionResponseData { Map get custom; String get id; String get text; + Map? get textI18n; /// Create a copy of PollOptionResponseData /// with the given fields replaced by the non-null parameter values. @@ -34,7 +35,8 @@ mixin _$PollOptionResponseData { other is PollOptionResponseData && const DeepCollectionEquality().equals(other.custom, custom) && (identical(other.id, id) || other.id == id) && - (identical(other.text, text) || other.text == text)); + (identical(other.text, text) || other.text == text) && + const DeepCollectionEquality().equals(other.textI18n, textI18n)); } @override @@ -43,11 +45,12 @@ mixin _$PollOptionResponseData { const DeepCollectionEquality().hash(custom), id, text, + const DeepCollectionEquality().hash(textI18n), ); @override String toString() { - return 'PollOptionResponseData(custom: $custom, id: $id, text: $text)'; + return 'PollOptionResponseData(custom: $custom, id: $id, text: $text, textI18n: $textI18n)'; } } @@ -58,7 +61,12 @@ abstract mixin class $PollOptionResponseDataCopyWith<$Res> { $Res Function(PollOptionResponseData) _then, ) = _$PollOptionResponseDataCopyWithImpl; @useResult - $Res call({Map custom, String id, String text}); + $Res call({ + Map custom, + String id, + String text, + Map? textI18n, + }); } /// @nodoc @@ -72,7 +80,12 @@ class _$PollOptionResponseDataCopyWithImpl<$Res> implements $PollOptionResponseD /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? custom = null, Object? id = null, Object? text = null}) { + $Res call({ + Object? custom = null, + Object? id = null, + Object? text = null, + Object? textI18n = freezed, + }) { return _then( PollOptionResponseData( custom: null == custom @@ -87,6 +100,10 @@ class _$PollOptionResponseDataCopyWithImpl<$Res> implements $PollOptionResponseD ? _self.text : text // ignore: cast_nullable_to_non_nullable as String, + textI18n: freezed == textI18n + ? _self.textI18n + : textI18n // ignore: cast_nullable_to_non_nullable + as Map?, ), ); } diff --git a/packages/stream_chat/lib/open_api/model/poll_option_response_data.g.dart b/packages/stream_chat/lib/open_api/model/poll_option_response_data.g.dart index 8cb55c0986..7cf196c56a 100644 --- a/packages/stream_chat/lib/open_api/model/poll_option_response_data.g.dart +++ b/packages/stream_chat/lib/open_api/model/poll_option_response_data.g.dart @@ -12,6 +12,9 @@ PollOptionResponseData _$PollOptionResponseDataFromJson( custom: json['custom'] as Map, id: json['id'] as String, text: json['text'] as String, + textI18n: (json['text_i18n'] as Map?)?.map( + (k, e) => MapEntry(k, e as String), + ), ); Map _$PollOptionResponseDataToJson( @@ -20,4 +23,5 @@ Map _$PollOptionResponseDataToJson( 'custom': instance.custom, 'id': instance.id, 'text': instance.text, + 'text_i18n': instance.textI18n, }; diff --git a/packages/stream_chat/lib/open_api/model/poll_response_data.dart b/packages/stream_chat/lib/open_api/model/poll_response_data.dart index ac1045bb1e..dc82736dbe 100644 --- a/packages/stream_chat/lib/open_api/model/poll_response_data.dart +++ b/packages/stream_chat/lib/open_api/model/poll_response_data.dart @@ -35,6 +35,7 @@ class PollResponseData with _$PollResponseData { required this.createdById, required this.custom, required this.description, + this.descriptionI18n, required this.enforceUniqueVote, required this.id, this.isClosed, @@ -42,6 +43,7 @@ class PollResponseData with _$PollResponseData { required this.latestVotesByOption, this.maxVotesAllowed, required this.name, + this.nameI18n, required this.options, required this.ownVotes, required this.updatedAt, @@ -83,6 +85,10 @@ class PollResponseData with _$PollResponseData { @JsonKey(name: 'description') final String description; + @override + @JsonKey(name: 'description_i18n') + final Map? descriptionI18n; + @override @JsonKey(name: 'enforce_unique_vote') final bool enforceUniqueVote; @@ -111,6 +117,10 @@ class PollResponseData with _$PollResponseData { @JsonKey(name: 'name') final String name; + @override + @JsonKey(name: 'name_i18n') + final Map? nameI18n; + @override @JsonKey(name: 'options') final List options; diff --git a/packages/stream_chat/lib/open_api/model/poll_response_data.freezed.dart b/packages/stream_chat/lib/open_api/model/poll_response_data.freezed.dart index eb1a9fb80c..4bd364d8a5 100644 --- a/packages/stream_chat/lib/open_api/model/poll_response_data.freezed.dart +++ b/packages/stream_chat/lib/open_api/model/poll_response_data.freezed.dart @@ -21,6 +21,7 @@ mixin _$PollResponseData { String get createdById; Map get custom; String get description; + Map? get descriptionI18n; bool get enforceUniqueVote; String get id; bool? get isClosed; @@ -28,6 +29,7 @@ mixin _$PollResponseData { Map> get latestVotesByOption; int? get maxVotesAllowed; String get name; + Map? get nameI18n; List get options; List get ownVotes; DateTime get updatedAt; @@ -61,6 +63,10 @@ mixin _$PollResponseData { (identical(other.createdById, createdById) || other.createdById == createdById) && const DeepCollectionEquality().equals(other.custom, custom) && (identical(other.description, description) || other.description == description) && + const DeepCollectionEquality().equals( + other.descriptionI18n, + descriptionI18n, + ) && (identical(other.enforceUniqueVote, enforceUniqueVote) || other.enforceUniqueVote == enforceUniqueVote) && (identical(other.id, id) || other.id == id) && (identical(other.isClosed, isClosed) || other.isClosed == isClosed) && @@ -74,6 +80,7 @@ mixin _$PollResponseData { ) && (identical(other.maxVotesAllowed, maxVotesAllowed) || other.maxVotesAllowed == maxVotesAllowed) && (identical(other.name, name) || other.name == name) && + const DeepCollectionEquality().equals(other.nameI18n, nameI18n) && const DeepCollectionEquality().equals(other.options, options) && const DeepCollectionEquality().equals(other.ownVotes, ownVotes) && (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt) && @@ -96,6 +103,7 @@ mixin _$PollResponseData { createdById, const DeepCollectionEquality().hash(custom), description, + const DeepCollectionEquality().hash(descriptionI18n), enforceUniqueVote, id, isClosed, @@ -103,6 +111,7 @@ mixin _$PollResponseData { const DeepCollectionEquality().hash(latestVotesByOption), maxVotesAllowed, name, + const DeepCollectionEquality().hash(nameI18n), const DeepCollectionEquality().hash(options), const DeepCollectionEquality().hash(ownVotes), updatedAt, @@ -113,7 +122,7 @@ mixin _$PollResponseData { @override String toString() { - return 'PollResponseData(allowAnswers: $allowAnswers, allowUserSuggestedOptions: $allowUserSuggestedOptions, answersCount: $answersCount, createdAt: $createdAt, createdBy: $createdBy, createdById: $createdById, custom: $custom, description: $description, enforceUniqueVote: $enforceUniqueVote, id: $id, isClosed: $isClosed, latestAnswers: $latestAnswers, latestVotesByOption: $latestVotesByOption, maxVotesAllowed: $maxVotesAllowed, name: $name, options: $options, ownVotes: $ownVotes, updatedAt: $updatedAt, voteCount: $voteCount, voteCountsByOption: $voteCountsByOption, votingVisibility: $votingVisibility)'; + return 'PollResponseData(allowAnswers: $allowAnswers, allowUserSuggestedOptions: $allowUserSuggestedOptions, answersCount: $answersCount, createdAt: $createdAt, createdBy: $createdBy, createdById: $createdById, custom: $custom, description: $description, descriptionI18n: $descriptionI18n, enforceUniqueVote: $enforceUniqueVote, id: $id, isClosed: $isClosed, latestAnswers: $latestAnswers, latestVotesByOption: $latestVotesByOption, maxVotesAllowed: $maxVotesAllowed, name: $name, nameI18n: $nameI18n, options: $options, ownVotes: $ownVotes, updatedAt: $updatedAt, voteCount: $voteCount, voteCountsByOption: $voteCountsByOption, votingVisibility: $votingVisibility)'; } } @@ -133,6 +142,7 @@ abstract mixin class $PollResponseDataCopyWith<$Res> { String createdById, Map custom, String description, + Map? descriptionI18n, bool enforceUniqueVote, String id, bool? isClosed, @@ -140,6 +150,7 @@ abstract mixin class $PollResponseDataCopyWith<$Res> { Map> latestVotesByOption, int? maxVotesAllowed, String name, + Map? nameI18n, List options, List ownVotes, DateTime updatedAt, @@ -169,6 +180,7 @@ class _$PollResponseDataCopyWithImpl<$Res> implements $PollResponseDataCopyWith< Object? createdById = null, Object? custom = null, Object? description = null, + Object? descriptionI18n = freezed, Object? enforceUniqueVote = null, Object? id = null, Object? isClosed = freezed, @@ -176,6 +188,7 @@ class _$PollResponseDataCopyWithImpl<$Res> implements $PollResponseDataCopyWith< Object? latestVotesByOption = null, Object? maxVotesAllowed = freezed, Object? name = null, + Object? nameI18n = freezed, Object? options = null, Object? ownVotes = null, Object? updatedAt = null, @@ -217,6 +230,10 @@ class _$PollResponseDataCopyWithImpl<$Res> implements $PollResponseDataCopyWith< ? _self.description : description // ignore: cast_nullable_to_non_nullable as String, + descriptionI18n: freezed == descriptionI18n + ? _self.descriptionI18n + : descriptionI18n // ignore: cast_nullable_to_non_nullable + as Map?, enforceUniqueVote: null == enforceUniqueVote ? _self.enforceUniqueVote : enforceUniqueVote // ignore: cast_nullable_to_non_nullable @@ -245,6 +262,10 @@ class _$PollResponseDataCopyWithImpl<$Res> implements $PollResponseDataCopyWith< ? _self.name : name // ignore: cast_nullable_to_non_nullable as String, + nameI18n: freezed == nameI18n + ? _self.nameI18n + : nameI18n // ignore: cast_nullable_to_non_nullable + as Map?, options: null == options ? _self.options : options // ignore: cast_nullable_to_non_nullable diff --git a/packages/stream_chat/lib/open_api/model/poll_response_data.g.dart b/packages/stream_chat/lib/open_api/model/poll_response_data.g.dart index a17be7d7d3..2f602062d1 100644 --- a/packages/stream_chat/lib/open_api/model/poll_response_data.g.dart +++ b/packages/stream_chat/lib/open_api/model/poll_response_data.g.dart @@ -19,6 +19,9 @@ PollResponseData _$PollResponseDataFromJson( createdById: json['created_by_id'] as String, custom: json['custom'] as Map, description: json['description'] as String, + descriptionI18n: (json['description_i18n'] as Map?)?.map( + (k, e) => MapEntry(k, e as String), + ), enforceUniqueVote: json['enforce_unique_vote'] as bool, id: json['id'] as String, isClosed: json['is_closed'] as bool?, @@ -37,6 +40,9 @@ PollResponseData _$PollResponseDataFromJson( ), maxVotesAllowed: (json['max_votes_allowed'] as num?)?.toInt(), name: json['name'] as String, + nameI18n: (json['name_i18n'] as Map?)?.map( + (k, e) => MapEntry(k, e as String), + ), options: (json['options'] as List) .map((e) => PollOptionResponseData.fromJson(e as Map)) .toList(), @@ -64,6 +70,7 @@ Map _$PollResponseDataToJson(PollResponseData instance) => _$PollResponseDataToJson(PollResponseData instance) => e.toJson()).toList(), 'own_votes': instance.ownVotes.map((e) => e.toJson()).toList(), 'updated_at': const StreamDateTimeConverter().toJson(instance.updatedAt), diff --git a/packages/stream_chat/lib/open_api/model/poll_vote_response_data.dart b/packages/stream_chat/lib/open_api/model/poll_vote_response_data.dart index 13aa781eb0..ab2765b2ad 100644 --- a/packages/stream_chat/lib/open_api/model/poll_vote_response_data.dart +++ b/packages/stream_chat/lib/open_api/model/poll_vote_response_data.dart @@ -19,6 +19,7 @@ part 'poll_vote_response_data.freezed.dart'; class PollVoteResponseData with _$PollVoteResponseData { const PollVoteResponseData({ this.answerText, + this.answerTextI18n, required this.createdAt, required this.id, this.isAnswer, @@ -33,6 +34,10 @@ class PollVoteResponseData with _$PollVoteResponseData { @JsonKey(name: 'answer_text') final String? answerText; + @override + @JsonKey(name: 'answer_text_i18n') + final Map? answerTextI18n; + @override @StreamDateTimeConverter() @JsonKey(name: 'created_at') diff --git a/packages/stream_chat/lib/open_api/model/poll_vote_response_data.freezed.dart b/packages/stream_chat/lib/open_api/model/poll_vote_response_data.freezed.dart index 1c522e7b51..a402488197 100644 --- a/packages/stream_chat/lib/open_api/model/poll_vote_response_data.freezed.dart +++ b/packages/stream_chat/lib/open_api/model/poll_vote_response_data.freezed.dart @@ -14,6 +14,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$PollVoteResponseData { String? get answerText; + Map? get answerTextI18n; DateTime get createdAt; String get id; bool? get isAnswer; @@ -39,6 +40,10 @@ mixin _$PollVoteResponseData { (other.runtimeType == runtimeType && other is PollVoteResponseData && (identical(other.answerText, answerText) || other.answerText == answerText) && + const DeepCollectionEquality().equals( + other.answerTextI18n, + answerTextI18n, + ) && (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && (identical(other.id, id) || other.id == id) && (identical(other.isAnswer, isAnswer) || other.isAnswer == isAnswer) && @@ -53,6 +58,7 @@ mixin _$PollVoteResponseData { int get hashCode => Object.hash( runtimeType, answerText, + const DeepCollectionEquality().hash(answerTextI18n), createdAt, id, isAnswer, @@ -65,7 +71,7 @@ mixin _$PollVoteResponseData { @override String toString() { - return 'PollVoteResponseData(answerText: $answerText, createdAt: $createdAt, id: $id, isAnswer: $isAnswer, optionId: $optionId, pollId: $pollId, updatedAt: $updatedAt, user: $user, userId: $userId)'; + return 'PollVoteResponseData(answerText: $answerText, answerTextI18n: $answerTextI18n, createdAt: $createdAt, id: $id, isAnswer: $isAnswer, optionId: $optionId, pollId: $pollId, updatedAt: $updatedAt, user: $user, userId: $userId)'; } } @@ -78,6 +84,7 @@ abstract mixin class $PollVoteResponseDataCopyWith<$Res> { @useResult $Res call({ String? answerText, + Map? answerTextI18n, DateTime createdAt, String id, bool? isAnswer, @@ -102,6 +109,7 @@ class _$PollVoteResponseDataCopyWithImpl<$Res> implements $PollVoteResponseDataC @override $Res call({ Object? answerText = freezed, + Object? answerTextI18n = freezed, Object? createdAt = null, Object? id = null, Object? isAnswer = freezed, @@ -117,6 +125,10 @@ class _$PollVoteResponseDataCopyWithImpl<$Res> implements $PollVoteResponseDataC ? _self.answerText : answerText // ignore: cast_nullable_to_non_nullable as String?, + answerTextI18n: freezed == answerTextI18n + ? _self.answerTextI18n + : answerTextI18n // ignore: cast_nullable_to_non_nullable + as Map?, createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable diff --git a/packages/stream_chat/lib/open_api/model/poll_vote_response_data.g.dart b/packages/stream_chat/lib/open_api/model/poll_vote_response_data.g.dart index df2a6eaa95..99307bfd1d 100644 --- a/packages/stream_chat/lib/open_api/model/poll_vote_response_data.g.dart +++ b/packages/stream_chat/lib/open_api/model/poll_vote_response_data.g.dart @@ -10,6 +10,9 @@ PollVoteResponseData _$PollVoteResponseDataFromJson( Map json, ) => PollVoteResponseData( answerText: json['answer_text'] as String?, + answerTextI18n: (json['answer_text_i18n'] as Map?)?.map( + (k, e) => MapEntry(k, e as String), + ), createdAt: const StreamDateTimeConverter().fromJson( json['created_at'] as Object, ), @@ -28,6 +31,7 @@ Map _$PollVoteResponseDataToJson( PollVoteResponseData instance, ) => { 'answer_text': instance.answerText, + 'answer_text_i18n': instance.answerTextI18n, 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), 'id': instance.id, 'is_answer': instance.isAnswer, diff --git a/packages/stream_chat/lib/open_api/model/query_banned_users_payload.dart b/packages/stream_chat/lib/open_api/model/query_banned_users_payload.dart index 58cd5719d0..abb7a7d99b 100644 --- a/packages/stream_chat/lib/open_api/model/query_banned_users_payload.dart +++ b/packages/stream_chat/lib/open_api/model/query_banned_users_payload.dart @@ -18,6 +18,10 @@ part 'query_banned_users_payload.freezed.dart'; @JsonSerializable() class QueryBannedUsersPayload with _$QueryBannedUsersPayload { const QueryBannedUsersPayload({ + this.createdAtAfter, + this.createdAtAfterOrEqual, + this.createdAtBefore, + this.createdAtBeforeOrEqual, this.excludeExpiredBans, required this.filterConditions, this.limit, @@ -25,6 +29,26 @@ class QueryBannedUsersPayload with _$QueryBannedUsersPayload { this.sort, }); + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at_after') + final DateTime? createdAtAfter; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at_after_or_equal') + final DateTime? createdAtAfterOrEqual; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at_before') + final DateTime? createdAtBefore; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at_before_or_equal') + final DateTime? createdAtBeforeOrEqual; + @override @JsonKey(name: 'exclude_expired_bans') final bool? excludeExpiredBans; diff --git a/packages/stream_chat/lib/open_api/model/query_banned_users_payload.freezed.dart b/packages/stream_chat/lib/open_api/model/query_banned_users_payload.freezed.dart index ffd31b310c..d39ef20823 100644 --- a/packages/stream_chat/lib/open_api/model/query_banned_users_payload.freezed.dart +++ b/packages/stream_chat/lib/open_api/model/query_banned_users_payload.freezed.dart @@ -13,6 +13,10 @@ T _$identity(T value) => value; /// @nodoc mixin _$QueryBannedUsersPayload { + DateTime? get createdAtAfter; + DateTime? get createdAtAfterOrEqual; + DateTime? get createdAtBefore; + DateTime? get createdAtBeforeOrEqual; bool? get excludeExpiredBans; Map get filterConditions; int? get limit; @@ -34,6 +38,12 @@ mixin _$QueryBannedUsersPayload { return identical(this, other) || (other.runtimeType == runtimeType && other is QueryBannedUsersPayload && + (identical(other.createdAtAfter, createdAtAfter) || other.createdAtAfter == createdAtAfter) && + (identical(other.createdAtAfterOrEqual, createdAtAfterOrEqual) || + other.createdAtAfterOrEqual == createdAtAfterOrEqual) && + (identical(other.createdAtBefore, createdAtBefore) || other.createdAtBefore == createdAtBefore) && + (identical(other.createdAtBeforeOrEqual, createdAtBeforeOrEqual) || + other.createdAtBeforeOrEqual == createdAtBeforeOrEqual) && (identical(other.excludeExpiredBans, excludeExpiredBans) || other.excludeExpiredBans == excludeExpiredBans) && const DeepCollectionEquality().equals( @@ -48,6 +58,10 @@ mixin _$QueryBannedUsersPayload { @override int get hashCode => Object.hash( runtimeType, + createdAtAfter, + createdAtAfterOrEqual, + createdAtBefore, + createdAtBeforeOrEqual, excludeExpiredBans, const DeepCollectionEquality().hash(filterConditions), limit, @@ -57,7 +71,7 @@ mixin _$QueryBannedUsersPayload { @override String toString() { - return 'QueryBannedUsersPayload(excludeExpiredBans: $excludeExpiredBans, filterConditions: $filterConditions, limit: $limit, offset: $offset, sort: $sort)'; + return 'QueryBannedUsersPayload(createdAtAfter: $createdAtAfter, createdAtAfterOrEqual: $createdAtAfterOrEqual, createdAtBefore: $createdAtBefore, createdAtBeforeOrEqual: $createdAtBeforeOrEqual, excludeExpiredBans: $excludeExpiredBans, filterConditions: $filterConditions, limit: $limit, offset: $offset, sort: $sort)'; } } @@ -69,6 +83,10 @@ abstract mixin class $QueryBannedUsersPayloadCopyWith<$Res> { ) = _$QueryBannedUsersPayloadCopyWithImpl; @useResult $Res call({ + DateTime? createdAtAfter, + DateTime? createdAtAfterOrEqual, + DateTime? createdAtBefore, + DateTime? createdAtBeforeOrEqual, bool? excludeExpiredBans, Map filterConditions, int? limit, @@ -89,6 +107,10 @@ class _$QueryBannedUsersPayloadCopyWithImpl<$Res> implements $QueryBannedUsersPa @pragma('vm:prefer-inline') @override $Res call({ + Object? createdAtAfter = freezed, + Object? createdAtAfterOrEqual = freezed, + Object? createdAtBefore = freezed, + Object? createdAtBeforeOrEqual = freezed, Object? excludeExpiredBans = freezed, Object? filterConditions = null, Object? limit = freezed, @@ -97,6 +119,22 @@ class _$QueryBannedUsersPayloadCopyWithImpl<$Res> implements $QueryBannedUsersPa }) { return _then( QueryBannedUsersPayload( + createdAtAfter: freezed == createdAtAfter + ? _self.createdAtAfter + : createdAtAfter // ignore: cast_nullable_to_non_nullable + as DateTime?, + createdAtAfterOrEqual: freezed == createdAtAfterOrEqual + ? _self.createdAtAfterOrEqual + : createdAtAfterOrEqual // ignore: cast_nullable_to_non_nullable + as DateTime?, + createdAtBefore: freezed == createdAtBefore + ? _self.createdAtBefore + : createdAtBefore // ignore: cast_nullable_to_non_nullable + as DateTime?, + createdAtBeforeOrEqual: freezed == createdAtBeforeOrEqual + ? _self.createdAtBeforeOrEqual + : createdAtBeforeOrEqual // ignore: cast_nullable_to_non_nullable + as DateTime?, excludeExpiredBans: freezed == excludeExpiredBans ? _self.excludeExpiredBans : excludeExpiredBans // ignore: cast_nullable_to_non_nullable diff --git a/packages/stream_chat/lib/open_api/model/query_banned_users_payload.g.dart b/packages/stream_chat/lib/open_api/model/query_banned_users_payload.g.dart index ef5c453ef3..3b6c033d61 100644 --- a/packages/stream_chat/lib/open_api/model/query_banned_users_payload.g.dart +++ b/packages/stream_chat/lib/open_api/model/query_banned_users_payload.g.dart @@ -9,6 +9,22 @@ part of 'query_banned_users_payload.dart'; QueryBannedUsersPayload _$QueryBannedUsersPayloadFromJson( Map json, ) => QueryBannedUsersPayload( + createdAtAfter: _$JsonConverterFromJson( + json['created_at_after'], + const StreamDateTimeConverter().fromJson, + ), + createdAtAfterOrEqual: _$JsonConverterFromJson( + json['created_at_after_or_equal'], + const StreamDateTimeConverter().fromJson, + ), + createdAtBefore: _$JsonConverterFromJson( + json['created_at_before'], + const StreamDateTimeConverter().fromJson, + ), + createdAtBeforeOrEqual: _$JsonConverterFromJson( + json['created_at_before_or_equal'], + const StreamDateTimeConverter().fromJson, + ), excludeExpiredBans: json['exclude_expired_bans'] as bool?, filterConditions: json['filter_conditions'] as Map, limit: (json['limit'] as num?)?.toInt(), @@ -19,9 +35,35 @@ QueryBannedUsersPayload _$QueryBannedUsersPayloadFromJson( Map _$QueryBannedUsersPayloadToJson( QueryBannedUsersPayload instance, ) => { + 'created_at_after': _$JsonConverterToJson( + instance.createdAtAfter, + const StreamDateTimeConverter().toJson, + ), + 'created_at_after_or_equal': _$JsonConverterToJson( + instance.createdAtAfterOrEqual, + const StreamDateTimeConverter().toJson, + ), + 'created_at_before': _$JsonConverterToJson( + instance.createdAtBefore, + const StreamDateTimeConverter().toJson, + ), + 'created_at_before_or_equal': _$JsonConverterToJson( + instance.createdAtBeforeOrEqual, + const StreamDateTimeConverter().toJson, + ), 'exclude_expired_bans': instance.excludeExpiredBans, 'filter_conditions': instance.filterConditions, 'limit': instance.limit, 'offset': instance.offset, 'sort': instance.sort?.map((e) => e.toJson()).toList(), }; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/query_future_channel_bans_payload.dart b/packages/stream_chat/lib/open_api/model/query_future_channel_bans_payload.dart index efad2d2e2c..980e917573 100644 --- a/packages/stream_chat/lib/open_api/model/query_future_channel_bans_payload.dart +++ b/packages/stream_chat/lib/open_api/model/query_future_channel_bans_payload.dart @@ -18,6 +18,10 @@ part 'query_future_channel_bans_payload.freezed.dart'; @JsonSerializable() class QueryFutureChannelBansPayload with _$QueryFutureChannelBansPayload { const QueryFutureChannelBansPayload({ + this.createdAtAfter, + this.createdAtAfterOrEqual, + this.createdAtBefore, + this.createdAtBeforeOrEqual, this.excludeExpiredBans, this.includeTotal, this.limit, @@ -25,6 +29,26 @@ class QueryFutureChannelBansPayload with _$QueryFutureChannelBansPayload { this.targetUserId, }); + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at_after') + final DateTime? createdAtAfter; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at_after_or_equal') + final DateTime? createdAtAfterOrEqual; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at_before') + final DateTime? createdAtBefore; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at_before_or_equal') + final DateTime? createdAtBeforeOrEqual; + @override @JsonKey(name: 'exclude_expired_bans') final bool? excludeExpiredBans; diff --git a/packages/stream_chat/lib/open_api/model/query_future_channel_bans_payload.freezed.dart b/packages/stream_chat/lib/open_api/model/query_future_channel_bans_payload.freezed.dart index 9833b2175c..f6282c9265 100644 --- a/packages/stream_chat/lib/open_api/model/query_future_channel_bans_payload.freezed.dart +++ b/packages/stream_chat/lib/open_api/model/query_future_channel_bans_payload.freezed.dart @@ -13,6 +13,10 @@ T _$identity(T value) => value; /// @nodoc mixin _$QueryFutureChannelBansPayload { + DateTime? get createdAtAfter; + DateTime? get createdAtAfterOrEqual; + DateTime? get createdAtBefore; + DateTime? get createdAtBeforeOrEqual; bool? get excludeExpiredBans; bool? get includeTotal; int? get limit; @@ -34,6 +38,12 @@ mixin _$QueryFutureChannelBansPayload { return identical(this, other) || (other.runtimeType == runtimeType && other is QueryFutureChannelBansPayload && + (identical(other.createdAtAfter, createdAtAfter) || other.createdAtAfter == createdAtAfter) && + (identical(other.createdAtAfterOrEqual, createdAtAfterOrEqual) || + other.createdAtAfterOrEqual == createdAtAfterOrEqual) && + (identical(other.createdAtBefore, createdAtBefore) || other.createdAtBefore == createdAtBefore) && + (identical(other.createdAtBeforeOrEqual, createdAtBeforeOrEqual) || + other.createdAtBeforeOrEqual == createdAtBeforeOrEqual) && (identical(other.excludeExpiredBans, excludeExpiredBans) || other.excludeExpiredBans == excludeExpiredBans) && (identical(other.includeTotal, includeTotal) || other.includeTotal == includeTotal) && @@ -45,6 +55,10 @@ mixin _$QueryFutureChannelBansPayload { @override int get hashCode => Object.hash( runtimeType, + createdAtAfter, + createdAtAfterOrEqual, + createdAtBefore, + createdAtBeforeOrEqual, excludeExpiredBans, includeTotal, limit, @@ -54,7 +68,7 @@ mixin _$QueryFutureChannelBansPayload { @override String toString() { - return 'QueryFutureChannelBansPayload(excludeExpiredBans: $excludeExpiredBans, includeTotal: $includeTotal, limit: $limit, offset: $offset, targetUserId: $targetUserId)'; + return 'QueryFutureChannelBansPayload(createdAtAfter: $createdAtAfter, createdAtAfterOrEqual: $createdAtAfterOrEqual, createdAtBefore: $createdAtBefore, createdAtBeforeOrEqual: $createdAtBeforeOrEqual, excludeExpiredBans: $excludeExpiredBans, includeTotal: $includeTotal, limit: $limit, offset: $offset, targetUserId: $targetUserId)'; } } @@ -66,6 +80,10 @@ abstract mixin class $QueryFutureChannelBansPayloadCopyWith<$Res> { ) = _$QueryFutureChannelBansPayloadCopyWithImpl; @useResult $Res call({ + DateTime? createdAtAfter, + DateTime? createdAtAfterOrEqual, + DateTime? createdAtBefore, + DateTime? createdAtBeforeOrEqual, bool? excludeExpiredBans, bool? includeTotal, int? limit, @@ -86,6 +104,10 @@ class _$QueryFutureChannelBansPayloadCopyWithImpl<$Res> implements $QueryFutureC @pragma('vm:prefer-inline') @override $Res call({ + Object? createdAtAfter = freezed, + Object? createdAtAfterOrEqual = freezed, + Object? createdAtBefore = freezed, + Object? createdAtBeforeOrEqual = freezed, Object? excludeExpiredBans = freezed, Object? includeTotal = freezed, Object? limit = freezed, @@ -94,6 +116,22 @@ class _$QueryFutureChannelBansPayloadCopyWithImpl<$Res> implements $QueryFutureC }) { return _then( QueryFutureChannelBansPayload( + createdAtAfter: freezed == createdAtAfter + ? _self.createdAtAfter + : createdAtAfter // ignore: cast_nullable_to_non_nullable + as DateTime?, + createdAtAfterOrEqual: freezed == createdAtAfterOrEqual + ? _self.createdAtAfterOrEqual + : createdAtAfterOrEqual // ignore: cast_nullable_to_non_nullable + as DateTime?, + createdAtBefore: freezed == createdAtBefore + ? _self.createdAtBefore + : createdAtBefore // ignore: cast_nullable_to_non_nullable + as DateTime?, + createdAtBeforeOrEqual: freezed == createdAtBeforeOrEqual + ? _self.createdAtBeforeOrEqual + : createdAtBeforeOrEqual // ignore: cast_nullable_to_non_nullable + as DateTime?, excludeExpiredBans: freezed == excludeExpiredBans ? _self.excludeExpiredBans : excludeExpiredBans // ignore: cast_nullable_to_non_nullable diff --git a/packages/stream_chat/lib/open_api/model/query_future_channel_bans_payload.g.dart b/packages/stream_chat/lib/open_api/model/query_future_channel_bans_payload.g.dart index 4ab53f060f..a2976a6bd7 100644 --- a/packages/stream_chat/lib/open_api/model/query_future_channel_bans_payload.g.dart +++ b/packages/stream_chat/lib/open_api/model/query_future_channel_bans_payload.g.dart @@ -9,6 +9,22 @@ part of 'query_future_channel_bans_payload.dart'; QueryFutureChannelBansPayload _$QueryFutureChannelBansPayloadFromJson( Map json, ) => QueryFutureChannelBansPayload( + createdAtAfter: _$JsonConverterFromJson( + json['created_at_after'], + const StreamDateTimeConverter().fromJson, + ), + createdAtAfterOrEqual: _$JsonConverterFromJson( + json['created_at_after_or_equal'], + const StreamDateTimeConverter().fromJson, + ), + createdAtBefore: _$JsonConverterFromJson( + json['created_at_before'], + const StreamDateTimeConverter().fromJson, + ), + createdAtBeforeOrEqual: _$JsonConverterFromJson( + json['created_at_before_or_equal'], + const StreamDateTimeConverter().fromJson, + ), excludeExpiredBans: json['exclude_expired_bans'] as bool?, includeTotal: json['include_total'] as bool?, limit: (json['limit'] as num?)?.toInt(), @@ -19,9 +35,35 @@ QueryFutureChannelBansPayload _$QueryFutureChannelBansPayloadFromJson( Map _$QueryFutureChannelBansPayloadToJson( QueryFutureChannelBansPayload instance, ) => { + 'created_at_after': _$JsonConverterToJson( + instance.createdAtAfter, + const StreamDateTimeConverter().toJson, + ), + 'created_at_after_or_equal': _$JsonConverterToJson( + instance.createdAtAfterOrEqual, + const StreamDateTimeConverter().toJson, + ), + 'created_at_before': _$JsonConverterToJson( + instance.createdAtBefore, + const StreamDateTimeConverter().toJson, + ), + 'created_at_before_or_equal': _$JsonConverterToJson( + instance.createdAtBeforeOrEqual, + const StreamDateTimeConverter().toJson, + ), 'exclude_expired_bans': instance.excludeExpiredBans, 'include_total': instance.includeTotal, 'limit': instance.limit, 'offset': instance.offset, 'target_user_id': instance.targetUserId, }; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/query_members_payload.dart b/packages/stream_chat/lib/open_api/model/query_members_payload.dart index 82cd801342..7e90ac9ebc 100644 --- a/packages/stream_chat/lib/open_api/model/query_members_payload.dart +++ b/packages/stream_chat/lib/open_api/model/query_members_payload.dart @@ -18,6 +18,10 @@ part 'query_members_payload.freezed.dart'; @JsonSerializable() class QueryMembersPayload with _$QueryMembersPayload { const QueryMembersPayload({ + this.createdAtAfter, + this.createdAtAfterOrEqual, + this.createdAtBefore, + this.createdAtBeforeOrEqual, this.filterConditions, this.id, this.limit, @@ -25,8 +29,32 @@ class QueryMembersPayload with _$QueryMembersPayload { this.offset, this.sort, required this.type, + this.userIdGt, + this.userIdGte, + this.userIdLt, + this.userIdLte, }); + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at_after') + final DateTime? createdAtAfter; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at_after_or_equal') + final DateTime? createdAtAfterOrEqual; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at_before') + final DateTime? createdAtBefore; + + @override + @StreamDateTimeConverter() + @JsonKey(name: 'created_at_before_or_equal') + final DateTime? createdAtBeforeOrEqual; + @override @JsonKey(name: 'filter_conditions') final Map? filterConditions; @@ -55,6 +83,22 @@ class QueryMembersPayload with _$QueryMembersPayload { @JsonKey(name: 'type') final String type; + @override + @JsonKey(name: 'user_id_gt') + final String? userIdGt; + + @override + @JsonKey(name: 'user_id_gte') + final String? userIdGte; + + @override + @JsonKey(name: 'user_id_lt') + final String? userIdLt; + + @override + @JsonKey(name: 'user_id_lte') + final String? userIdLte; + Map toJson() => _$QueryMembersPayloadToJson(this); static QueryMembersPayload fromJson(Map json) => _$QueryMembersPayloadFromJson(json); diff --git a/packages/stream_chat/lib/open_api/model/query_members_payload.freezed.dart b/packages/stream_chat/lib/open_api/model/query_members_payload.freezed.dart index 3a259362a5..8fe0f718fd 100644 --- a/packages/stream_chat/lib/open_api/model/query_members_payload.freezed.dart +++ b/packages/stream_chat/lib/open_api/model/query_members_payload.freezed.dart @@ -13,6 +13,10 @@ T _$identity(T value) => value; /// @nodoc mixin _$QueryMembersPayload { + DateTime? get createdAtAfter; + DateTime? get createdAtAfterOrEqual; + DateTime? get createdAtBefore; + DateTime? get createdAtBeforeOrEqual; Map? get filterConditions; String? get id; int? get limit; @@ -20,6 +24,10 @@ mixin _$QueryMembersPayload { int? get offset; List? get sort; String get type; + String? get userIdGt; + String? get userIdGte; + String? get userIdLt; + String? get userIdLte; /// Create a copy of QueryMembersPayload /// with the given fields replaced by the non-null parameter values. @@ -36,6 +44,12 @@ mixin _$QueryMembersPayload { return identical(this, other) || (other.runtimeType == runtimeType && other is QueryMembersPayload && + (identical(other.createdAtAfter, createdAtAfter) || other.createdAtAfter == createdAtAfter) && + (identical(other.createdAtAfterOrEqual, createdAtAfterOrEqual) || + other.createdAtAfterOrEqual == createdAtAfterOrEqual) && + (identical(other.createdAtBefore, createdAtBefore) || other.createdAtBefore == createdAtBefore) && + (identical(other.createdAtBeforeOrEqual, createdAtBeforeOrEqual) || + other.createdAtBeforeOrEqual == createdAtBeforeOrEqual) && const DeepCollectionEquality().equals( other.filterConditions, filterConditions, @@ -45,12 +59,20 @@ mixin _$QueryMembersPayload { const DeepCollectionEquality().equals(other.members, members) && (identical(other.offset, offset) || other.offset == offset) && const DeepCollectionEquality().equals(other.sort, sort) && - (identical(other.type, type) || other.type == type)); + (identical(other.type, type) || other.type == type) && + (identical(other.userIdGt, userIdGt) || other.userIdGt == userIdGt) && + (identical(other.userIdGte, userIdGte) || other.userIdGte == userIdGte) && + (identical(other.userIdLt, userIdLt) || other.userIdLt == userIdLt) && + (identical(other.userIdLte, userIdLte) || other.userIdLte == userIdLte)); } @override int get hashCode => Object.hash( runtimeType, + createdAtAfter, + createdAtAfterOrEqual, + createdAtBefore, + createdAtBeforeOrEqual, const DeepCollectionEquality().hash(filterConditions), id, limit, @@ -58,11 +80,15 @@ mixin _$QueryMembersPayload { offset, const DeepCollectionEquality().hash(sort), type, + userIdGt, + userIdGte, + userIdLt, + userIdLte, ); @override String toString() { - return 'QueryMembersPayload(filterConditions: $filterConditions, id: $id, limit: $limit, members: $members, offset: $offset, sort: $sort, type: $type)'; + return 'QueryMembersPayload(createdAtAfter: $createdAtAfter, createdAtAfterOrEqual: $createdAtAfterOrEqual, createdAtBefore: $createdAtBefore, createdAtBeforeOrEqual: $createdAtBeforeOrEqual, filterConditions: $filterConditions, id: $id, limit: $limit, members: $members, offset: $offset, sort: $sort, type: $type, userIdGt: $userIdGt, userIdGte: $userIdGte, userIdLt: $userIdLt, userIdLte: $userIdLte)'; } } @@ -74,6 +100,10 @@ abstract mixin class $QueryMembersPayloadCopyWith<$Res> { ) = _$QueryMembersPayloadCopyWithImpl; @useResult $Res call({ + DateTime? createdAtAfter, + DateTime? createdAtAfterOrEqual, + DateTime? createdAtBefore, + DateTime? createdAtBeforeOrEqual, Map? filterConditions, String? id, int? limit, @@ -81,6 +111,10 @@ abstract mixin class $QueryMembersPayloadCopyWith<$Res> { int? offset, List? sort, String type, + String? userIdGt, + String? userIdGte, + String? userIdLt, + String? userIdLte, }); } @@ -96,6 +130,10 @@ class _$QueryMembersPayloadCopyWithImpl<$Res> implements $QueryMembersPayloadCop @pragma('vm:prefer-inline') @override $Res call({ + Object? createdAtAfter = freezed, + Object? createdAtAfterOrEqual = freezed, + Object? createdAtBefore = freezed, + Object? createdAtBeforeOrEqual = freezed, Object? filterConditions = freezed, Object? id = freezed, Object? limit = freezed, @@ -103,9 +141,29 @@ class _$QueryMembersPayloadCopyWithImpl<$Res> implements $QueryMembersPayloadCop Object? offset = freezed, Object? sort = freezed, Object? type = null, + Object? userIdGt = freezed, + Object? userIdGte = freezed, + Object? userIdLt = freezed, + Object? userIdLte = freezed, }) { return _then( QueryMembersPayload( + createdAtAfter: freezed == createdAtAfter + ? _self.createdAtAfter + : createdAtAfter // ignore: cast_nullable_to_non_nullable + as DateTime?, + createdAtAfterOrEqual: freezed == createdAtAfterOrEqual + ? _self.createdAtAfterOrEqual + : createdAtAfterOrEqual // ignore: cast_nullable_to_non_nullable + as DateTime?, + createdAtBefore: freezed == createdAtBefore + ? _self.createdAtBefore + : createdAtBefore // ignore: cast_nullable_to_non_nullable + as DateTime?, + createdAtBeforeOrEqual: freezed == createdAtBeforeOrEqual + ? _self.createdAtBeforeOrEqual + : createdAtBeforeOrEqual // ignore: cast_nullable_to_non_nullable + as DateTime?, filterConditions: freezed == filterConditions ? _self.filterConditions : filterConditions // ignore: cast_nullable_to_non_nullable @@ -134,6 +192,22 @@ class _$QueryMembersPayloadCopyWithImpl<$Res> implements $QueryMembersPayloadCop ? _self.type : type // ignore: cast_nullable_to_non_nullable as String, + userIdGt: freezed == userIdGt + ? _self.userIdGt + : userIdGt // ignore: cast_nullable_to_non_nullable + as String?, + userIdGte: freezed == userIdGte + ? _self.userIdGte + : userIdGte // ignore: cast_nullable_to_non_nullable + as String?, + userIdLt: freezed == userIdLt + ? _self.userIdLt + : userIdLt // ignore: cast_nullable_to_non_nullable + as String?, + userIdLte: freezed == userIdLte + ? _self.userIdLte + : userIdLte // ignore: cast_nullable_to_non_nullable + as String?, ), ); } diff --git a/packages/stream_chat/lib/open_api/model/query_members_payload.g.dart b/packages/stream_chat/lib/open_api/model/query_members_payload.g.dart index 55bb72803a..b23aeefc6a 100644 --- a/packages/stream_chat/lib/open_api/model/query_members_payload.g.dart +++ b/packages/stream_chat/lib/open_api/model/query_members_payload.g.dart @@ -7,6 +7,22 @@ part of 'query_members_payload.dart'; // ************************************************************************** QueryMembersPayload _$QueryMembersPayloadFromJson(Map json) => QueryMembersPayload( + createdAtAfter: _$JsonConverterFromJson( + json['created_at_after'], + const StreamDateTimeConverter().fromJson, + ), + createdAtAfterOrEqual: _$JsonConverterFromJson( + json['created_at_after_or_equal'], + const StreamDateTimeConverter().fromJson, + ), + createdAtBefore: _$JsonConverterFromJson( + json['created_at_before'], + const StreamDateTimeConverter().fromJson, + ), + createdAtBeforeOrEqual: _$JsonConverterFromJson( + json['created_at_before_or_equal'], + const StreamDateTimeConverter().fromJson, + ), filterConditions: json['filter_conditions'] as Map?, id: json['id'] as String?, limit: (json['limit'] as num?)?.toInt(), @@ -16,11 +32,31 @@ QueryMembersPayload _$QueryMembersPayloadFromJson(Map json) => offset: (json['offset'] as num?)?.toInt(), sort: (json['sort'] as List?)?.map((e) => SortParamRequest.fromJson(e as Map)).toList(), type: json['type'] as String, + userIdGt: json['user_id_gt'] as String?, + userIdGte: json['user_id_gte'] as String?, + userIdLt: json['user_id_lt'] as String?, + userIdLte: json['user_id_lte'] as String?, ); Map _$QueryMembersPayloadToJson( QueryMembersPayload instance, ) => { + 'created_at_after': _$JsonConverterToJson( + instance.createdAtAfter, + const StreamDateTimeConverter().toJson, + ), + 'created_at_after_or_equal': _$JsonConverterToJson( + instance.createdAtAfterOrEqual, + const StreamDateTimeConverter().toJson, + ), + 'created_at_before': _$JsonConverterToJson( + instance.createdAtBefore, + const StreamDateTimeConverter().toJson, + ), + 'created_at_before_or_equal': _$JsonConverterToJson( + instance.createdAtBeforeOrEqual, + const StreamDateTimeConverter().toJson, + ), 'filter_conditions': instance.filterConditions, 'id': instance.id, 'limit': instance.limit, @@ -28,4 +64,18 @@ Map _$QueryMembersPayloadToJson( 'offset': instance.offset, 'sort': instance.sort?.map((e) => e.toJson()).toList(), 'type': instance.type, + 'user_id_gt': instance.userIdGt, + 'user_id_gte': instance.userIdGte, + 'user_id_lt': instance.userIdLt, + 'user_id_lte': instance.userIdLte, }; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/open_api/model/query_users_payload.dart b/packages/stream_chat/lib/open_api/model/query_users_payload.dart index c91a822898..1b0efbcf7b 100644 --- a/packages/stream_chat/lib/open_api/model/query_users_payload.dart +++ b/packages/stream_chat/lib/open_api/model/query_users_payload.dart @@ -19,6 +19,10 @@ part 'query_users_payload.freezed.dart'; class QueryUsersPayload with _$QueryUsersPayload { const QueryUsersPayload({ required this.filterConditions, + this.idGt, + this.idGte, + this.idLt, + this.idLte, this.includeDeactivatedUsers, this.limit, this.offset, @@ -30,6 +34,22 @@ class QueryUsersPayload with _$QueryUsersPayload { @JsonKey(name: 'filter_conditions') final Map filterConditions; + @override + @JsonKey(name: 'id_gt') + final String? idGt; + + @override + @JsonKey(name: 'id_gte') + final String? idGte; + + @override + @JsonKey(name: 'id_lt') + final String? idLt; + + @override + @JsonKey(name: 'id_lte') + final String? idLte; + @override @JsonKey(name: 'include_deactivated_users') final bool? includeDeactivatedUsers; diff --git a/packages/stream_chat/lib/open_api/model/query_users_payload.freezed.dart b/packages/stream_chat/lib/open_api/model/query_users_payload.freezed.dart index 5c45ee1746..721eace9b2 100644 --- a/packages/stream_chat/lib/open_api/model/query_users_payload.freezed.dart +++ b/packages/stream_chat/lib/open_api/model/query_users_payload.freezed.dart @@ -14,6 +14,10 @@ T _$identity(T value) => value; /// @nodoc mixin _$QueryUsersPayload { Map get filterConditions; + String? get idGt; + String? get idGte; + String? get idLt; + String? get idLte; bool? get includeDeactivatedUsers; int? get limit; int? get offset; @@ -38,6 +42,10 @@ mixin _$QueryUsersPayload { other.filterConditions, filterConditions, ) && + (identical(other.idGt, idGt) || other.idGt == idGt) && + (identical(other.idGte, idGte) || other.idGte == idGte) && + (identical(other.idLt, idLt) || other.idLt == idLt) && + (identical(other.idLte, idLte) || other.idLte == idLte) && (identical( other.includeDeactivatedUsers, includeDeactivatedUsers, @@ -53,6 +61,10 @@ mixin _$QueryUsersPayload { int get hashCode => Object.hash( runtimeType, const DeepCollectionEquality().hash(filterConditions), + idGt, + idGte, + idLt, + idLte, includeDeactivatedUsers, limit, offset, @@ -62,7 +74,7 @@ mixin _$QueryUsersPayload { @override String toString() { - return 'QueryUsersPayload(filterConditions: $filterConditions, includeDeactivatedUsers: $includeDeactivatedUsers, limit: $limit, offset: $offset, presence: $presence, sort: $sort)'; + return 'QueryUsersPayload(filterConditions: $filterConditions, idGt: $idGt, idGte: $idGte, idLt: $idLt, idLte: $idLte, includeDeactivatedUsers: $includeDeactivatedUsers, limit: $limit, offset: $offset, presence: $presence, sort: $sort)'; } } @@ -75,6 +87,10 @@ abstract mixin class $QueryUsersPayloadCopyWith<$Res> { @useResult $Res call({ Map filterConditions, + String? idGt, + String? idGte, + String? idLt, + String? idLte, bool? includeDeactivatedUsers, int? limit, int? offset, @@ -96,6 +112,10 @@ class _$QueryUsersPayloadCopyWithImpl<$Res> implements $QueryUsersPayloadCopyWit @override $Res call({ Object? filterConditions = null, + Object? idGt = freezed, + Object? idGte = freezed, + Object? idLt = freezed, + Object? idLte = freezed, Object? includeDeactivatedUsers = freezed, Object? limit = freezed, Object? offset = freezed, @@ -108,6 +128,22 @@ class _$QueryUsersPayloadCopyWithImpl<$Res> implements $QueryUsersPayloadCopyWit ? _self.filterConditions : filterConditions // ignore: cast_nullable_to_non_nullable as Map, + idGt: freezed == idGt + ? _self.idGt + : idGt // ignore: cast_nullable_to_non_nullable + as String?, + idGte: freezed == idGte + ? _self.idGte + : idGte // ignore: cast_nullable_to_non_nullable + as String?, + idLt: freezed == idLt + ? _self.idLt + : idLt // ignore: cast_nullable_to_non_nullable + as String?, + idLte: freezed == idLte + ? _self.idLte + : idLte // ignore: cast_nullable_to_non_nullable + as String?, includeDeactivatedUsers: freezed == includeDeactivatedUsers ? _self.includeDeactivatedUsers : includeDeactivatedUsers // ignore: cast_nullable_to_non_nullable diff --git a/packages/stream_chat/lib/open_api/model/query_users_payload.g.dart b/packages/stream_chat/lib/open_api/model/query_users_payload.g.dart index c79a9f41d6..a9a2c99859 100644 --- a/packages/stream_chat/lib/open_api/model/query_users_payload.g.dart +++ b/packages/stream_chat/lib/open_api/model/query_users_payload.g.dart @@ -8,6 +8,10 @@ part of 'query_users_payload.dart'; QueryUsersPayload _$QueryUsersPayloadFromJson(Map json) => QueryUsersPayload( filterConditions: json['filter_conditions'] as Map, + idGt: json['id_gt'] as String?, + idGte: json['id_gte'] as String?, + idLt: json['id_lt'] as String?, + idLte: json['id_lte'] as String?, includeDeactivatedUsers: json['include_deactivated_users'] as bool?, limit: (json['limit'] as num?)?.toInt(), offset: (json['offset'] as num?)?.toInt(), @@ -17,6 +21,10 @@ QueryUsersPayload _$QueryUsersPayloadFromJson(Map json) => Quer Map _$QueryUsersPayloadToJson(QueryUsersPayload instance) => { 'filter_conditions': instance.filterConditions, + 'id_gt': instance.idGt, + 'id_gte': instance.idGte, + 'id_lt': instance.idLt, + 'id_lte': instance.idLte, 'include_deactivated_users': instance.includeDeactivatedUsers, 'limit': instance.limit, 'offset': instance.offset, diff --git a/packages/stream_chat/lib/open_api/model/review_queue_item_response.dart b/packages/stream_chat/lib/open_api/model/review_queue_item_response.dart index aeda349353..a9355cd61c 100644 --- a/packages/stream_chat/lib/open_api/model/review_queue_item_response.dart +++ b/packages/stream_chat/lib/open_api/model/review_queue_item_response.dart @@ -26,6 +26,7 @@ class ReviewQueueItemResponse with _$ReviewQueueItemResponse { required this.bans, this.call, this.completedAt, + this.confidenceScore, this.configKey, required this.createdAt, this.entityCreator, @@ -90,6 +91,10 @@ class ReviewQueueItemResponse with _$ReviewQueueItemResponse { @JsonKey(name: 'completed_at') final DateTime? completedAt; + @override + @JsonKey(name: 'confidence_score') + final double? confidenceScore; + @override @JsonKey(name: 'config_key') final String? configKey; diff --git a/packages/stream_chat/lib/open_api/model/review_queue_item_response.freezed.dart b/packages/stream_chat/lib/open_api/model/review_queue_item_response.freezed.dart index e31e8c7278..397f1d5c8d 100644 --- a/packages/stream_chat/lib/open_api/model/review_queue_item_response.freezed.dart +++ b/packages/stream_chat/lib/open_api/model/review_queue_item_response.freezed.dart @@ -21,6 +21,7 @@ mixin _$ReviewQueueItemResponse { List get bans; ModerationCallResponse? get call; DateTime? get completedAt; + double? get confidenceScore; String? get configKey; DateTime get createdAt; EntityCreatorResponse? get entityCreator; @@ -74,6 +75,7 @@ mixin _$ReviewQueueItemResponse { const DeepCollectionEquality().equals(other.bans, bans) && (identical(other.call, call) || other.call == call) && (identical(other.completedAt, completedAt) || other.completedAt == completedAt) && + (identical(other.confidenceScore, confidenceScore) || other.confidenceScore == confidenceScore) && (identical(other.configKey, configKey) || other.configKey == configKey) && (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && (identical(other.entityCreator, entityCreator) || other.entityCreator == entityCreator) && @@ -118,6 +120,7 @@ mixin _$ReviewQueueItemResponse { const DeepCollectionEquality().hash(bans), call, completedAt, + confidenceScore, configKey, createdAt, entityCreator, @@ -151,7 +154,7 @@ mixin _$ReviewQueueItemResponse { @override String toString() { - return 'ReviewQueueItemResponse(actions: $actions, activity: $activity, aiTextSeverity: $aiTextSeverity, appeal: $appeal, assignedTo: $assignedTo, bans: $bans, call: $call, completedAt: $completedAt, configKey: $configKey, createdAt: $createdAt, entityCreator: $entityCreator, entityCreatorId: $entityCreatorId, entityId: $entityId, entityType: $entityType, escalated: $escalated, escalatedAt: $escalatedAt, escalatedBy: $escalatedBy, escalationMetadata: $escalationMetadata, feedsV2Activity: $feedsV2Activity, feedsV2Reaction: $feedsV2Reaction, feedsV3Activity: $feedsV3Activity, feedsV3Comment: $feedsV3Comment, flags: $flags, flagsCount: $flagsCount, id: $id, languages: $languages, latestModeratorAction: $latestModeratorAction, message: $message, moderationPayload: $moderationPayload, reaction: $reaction, recommendedAction: $recommendedAction, reviewedAt: $reviewedAt, reviewedBy: $reviewedBy, severity: $severity, status: $status, teams: $teams, updatedAt: $updatedAt)'; + return 'ReviewQueueItemResponse(actions: $actions, activity: $activity, aiTextSeverity: $aiTextSeverity, appeal: $appeal, assignedTo: $assignedTo, bans: $bans, call: $call, completedAt: $completedAt, confidenceScore: $confidenceScore, configKey: $configKey, createdAt: $createdAt, entityCreator: $entityCreator, entityCreatorId: $entityCreatorId, entityId: $entityId, entityType: $entityType, escalated: $escalated, escalatedAt: $escalatedAt, escalatedBy: $escalatedBy, escalationMetadata: $escalationMetadata, feedsV2Activity: $feedsV2Activity, feedsV2Reaction: $feedsV2Reaction, feedsV3Activity: $feedsV3Activity, feedsV3Comment: $feedsV3Comment, flags: $flags, flagsCount: $flagsCount, id: $id, languages: $languages, latestModeratorAction: $latestModeratorAction, message: $message, moderationPayload: $moderationPayload, reaction: $reaction, recommendedAction: $recommendedAction, reviewedAt: $reviewedAt, reviewedBy: $reviewedBy, severity: $severity, status: $status, teams: $teams, updatedAt: $updatedAt)'; } } @@ -171,6 +174,7 @@ abstract mixin class $ReviewQueueItemResponseCopyWith<$Res> { List bans, ModerationCallResponse? call, DateTime? completedAt, + double? confidenceScore, String? configKey, DateTime createdAt, EntityCreatorResponse? entityCreator, @@ -223,6 +227,7 @@ class _$ReviewQueueItemResponseCopyWithImpl<$Res> implements $ReviewQueueItemRes Object? bans = null, Object? call = freezed, Object? completedAt = freezed, + Object? confidenceScore = freezed, Object? configKey = freezed, Object? createdAt = null, Object? entityCreator = freezed, @@ -287,6 +292,10 @@ class _$ReviewQueueItemResponseCopyWithImpl<$Res> implements $ReviewQueueItemRes ? _self.completedAt : completedAt // ignore: cast_nullable_to_non_nullable as DateTime?, + confidenceScore: freezed == confidenceScore + ? _self.confidenceScore + : confidenceScore // ignore: cast_nullable_to_non_nullable + as double?, configKey: freezed == configKey ? _self.configKey : configKey // ignore: cast_nullable_to_non_nullable diff --git a/packages/stream_chat/lib/open_api/model/review_queue_item_response.g.dart b/packages/stream_chat/lib/open_api/model/review_queue_item_response.g.dart index b8a8f19dba..e041dce1ad 100644 --- a/packages/stream_chat/lib/open_api/model/review_queue_item_response.g.dart +++ b/packages/stream_chat/lib/open_api/model/review_queue_item_response.g.dart @@ -22,6 +22,7 @@ ReviewQueueItemResponse _$ReviewQueueItemResponseFromJson( json['completed_at'], const StreamDateTimeConverter().fromJson, ), + confidenceScore: (json['confidence_score'] as num?)?.toDouble(), configKey: json['config_key'] as String?, createdAt: const StreamDateTimeConverter().fromJson( json['created_at'] as Object, @@ -105,6 +106,7 @@ Map _$ReviewQueueItemResponseToJson( instance.completedAt, const StreamDateTimeConverter().toJson, ), + 'confidence_score': instance.confidenceScore, 'config_key': instance.configKey, 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), 'entity_creator': instance.entityCreator?.toJson(), diff --git a/packages/stream_chat/lib/open_api/model/rule_builder_condition.dart b/packages/stream_chat/lib/open_api/model/rule_builder_condition.dart index ca13ec771e..cea93679ad 100644 --- a/packages/stream_chat/lib/open_api/model/rule_builder_condition.dart +++ b/packages/stream_chat/lib/open_api/model/rule_builder_condition.dart @@ -44,6 +44,8 @@ class RuleBuilderCondition with _$RuleBuilderCondition { this.userCustomPropertyParams, this.userFlagCountRuleParams, this.userIdenticalContentCountParams, + this.userIdenticalImageCountParams, + this.userReactionCountParams, this.userRoleParams, this.userRuleParams, this.videoContentParams, @@ -154,6 +156,14 @@ class RuleBuilderCondition with _$RuleBuilderCondition { @JsonKey(name: 'user_identical_content_count_params') final UserIdenticalContentCountParameters? userIdenticalContentCountParams; + @override + @JsonKey(name: 'user_identical_image_count_params') + final UserIdenticalImageCountParameters? userIdenticalImageCountParams; + + @override + @JsonKey(name: 'user_reaction_count_params') + final UserReactionCountRuleParameters? userReactionCountParams; + @override @JsonKey(name: 'user_role_params') final UserRoleParameters? userRoleParams; diff --git a/packages/stream_chat/lib/open_api/model/rule_builder_condition.freezed.dart b/packages/stream_chat/lib/open_api/model/rule_builder_condition.freezed.dart index b0a5c6b0d9..cc05b2fe7c 100644 --- a/packages/stream_chat/lib/open_api/model/rule_builder_condition.freezed.dart +++ b/packages/stream_chat/lib/open_api/model/rule_builder_condition.freezed.dart @@ -39,6 +39,8 @@ mixin _$RuleBuilderCondition { UserCustomPropertyParameters? get userCustomPropertyParams; FlagCountRuleParameters? get userFlagCountRuleParams; UserIdenticalContentCountParameters? get userIdenticalContentCountParams; + UserIdenticalImageCountParameters? get userIdenticalImageCountParams; + UserReactionCountRuleParameters? get userReactionCountParams; UserRoleParameters? get userRoleParams; UserRuleParameters? get userRuleParams; VideoContentParameters? get videoContentParams; @@ -141,6 +143,16 @@ mixin _$RuleBuilderCondition { userIdenticalContentCountParams, ) || other.userIdenticalContentCountParams == userIdenticalContentCountParams) && + (identical( + other.userIdenticalImageCountParams, + userIdenticalImageCountParams, + ) || + other.userIdenticalImageCountParams == userIdenticalImageCountParams) && + (identical( + other.userReactionCountParams, + userReactionCountParams, + ) || + other.userReactionCountParams == userReactionCountParams) && (identical(other.userRoleParams, userRoleParams) || other.userRoleParams == userRoleParams) && (identical(other.userRuleParams, userRuleParams) || other.userRuleParams == userRuleParams) && (identical(other.videoContentParams, videoContentParams) || @@ -177,6 +189,8 @@ mixin _$RuleBuilderCondition { userCustomPropertyParams, userFlagCountRuleParams, userIdenticalContentCountParams, + userIdenticalImageCountParams, + userReactionCountParams, userRoleParams, userRuleParams, videoContentParams, @@ -185,7 +199,7 @@ mixin _$RuleBuilderCondition { @override String toString() { - return 'RuleBuilderCondition(callCustomPropertyParams: $callCustomPropertyParams, callTypeRuleParams: $callTypeRuleParams, callViolationCountParams: $callViolationCountParams, channelMessageCountRuleParams: $channelMessageCountRuleParams, closedCaptionRuleParams: $closedCaptionRuleParams, confidence: $confidence, contentCountRuleParams: $contentCountRuleParams, contentCustomPropertyCountParams: $contentCustomPropertyCountParams, contentCustomPropertyParams: $contentCustomPropertyParams, contentFlagCountRuleParams: $contentFlagCountRuleParams, floodIdenticalParams: $floodIdenticalParams, floodSimilarParams: $floodSimilarParams, imageContentParams: $imageContentParams, imageRuleParams: $imageRuleParams, ipContentCountRuleParams: $ipContentCountRuleParams, ipFlagCountRuleParams: $ipFlagCountRuleParams, keyframeOcrRuleParams: $keyframeOcrRuleParams, keyframeRuleParams: $keyframeRuleParams, ocrContentParams: $ocrContentParams, textContentParams: $textContentParams, textRuleParams: $textRuleParams, type: $type, userCreatedWithinParams: $userCreatedWithinParams, userCustomPropertyParams: $userCustomPropertyParams, userFlagCountRuleParams: $userFlagCountRuleParams, userIdenticalContentCountParams: $userIdenticalContentCountParams, userRoleParams: $userRoleParams, userRuleParams: $userRuleParams, videoContentParams: $videoContentParams, videoRuleParams: $videoRuleParams)'; + return 'RuleBuilderCondition(callCustomPropertyParams: $callCustomPropertyParams, callTypeRuleParams: $callTypeRuleParams, callViolationCountParams: $callViolationCountParams, channelMessageCountRuleParams: $channelMessageCountRuleParams, closedCaptionRuleParams: $closedCaptionRuleParams, confidence: $confidence, contentCountRuleParams: $contentCountRuleParams, contentCustomPropertyCountParams: $contentCustomPropertyCountParams, contentCustomPropertyParams: $contentCustomPropertyParams, contentFlagCountRuleParams: $contentFlagCountRuleParams, floodIdenticalParams: $floodIdenticalParams, floodSimilarParams: $floodSimilarParams, imageContentParams: $imageContentParams, imageRuleParams: $imageRuleParams, ipContentCountRuleParams: $ipContentCountRuleParams, ipFlagCountRuleParams: $ipFlagCountRuleParams, keyframeOcrRuleParams: $keyframeOcrRuleParams, keyframeRuleParams: $keyframeRuleParams, ocrContentParams: $ocrContentParams, textContentParams: $textContentParams, textRuleParams: $textRuleParams, type: $type, userCreatedWithinParams: $userCreatedWithinParams, userCustomPropertyParams: $userCustomPropertyParams, userFlagCountRuleParams: $userFlagCountRuleParams, userIdenticalContentCountParams: $userIdenticalContentCountParams, userIdenticalImageCountParams: $userIdenticalImageCountParams, userReactionCountParams: $userReactionCountParams, userRoleParams: $userRoleParams, userRuleParams: $userRuleParams, videoContentParams: $videoContentParams, videoRuleParams: $videoRuleParams)'; } } @@ -223,6 +237,8 @@ abstract mixin class $RuleBuilderConditionCopyWith<$Res> { UserCustomPropertyParameters? userCustomPropertyParams, FlagCountRuleParameters? userFlagCountRuleParams, UserIdenticalContentCountParameters? userIdenticalContentCountParams, + UserIdenticalImageCountParameters? userIdenticalImageCountParams, + UserReactionCountRuleParameters? userReactionCountParams, UserRoleParameters? userRoleParams, UserRuleParameters? userRuleParams, VideoContentParameters? videoContentParams, @@ -268,6 +284,8 @@ class _$RuleBuilderConditionCopyWithImpl<$Res> implements $RuleBuilderConditionC Object? userCustomPropertyParams = freezed, Object? userFlagCountRuleParams = freezed, Object? userIdenticalContentCountParams = freezed, + Object? userIdenticalImageCountParams = freezed, + Object? userReactionCountParams = freezed, Object? userRoleParams = freezed, Object? userRuleParams = freezed, Object? videoContentParams = freezed, @@ -379,6 +397,14 @@ class _$RuleBuilderConditionCopyWithImpl<$Res> implements $RuleBuilderConditionC ? _self.userIdenticalContentCountParams : userIdenticalContentCountParams // ignore: cast_nullable_to_non_nullable as UserIdenticalContentCountParameters?, + userIdenticalImageCountParams: freezed == userIdenticalImageCountParams + ? _self.userIdenticalImageCountParams + : userIdenticalImageCountParams // ignore: cast_nullable_to_non_nullable + as UserIdenticalImageCountParameters?, + userReactionCountParams: freezed == userReactionCountParams + ? _self.userReactionCountParams + : userReactionCountParams // ignore: cast_nullable_to_non_nullable + as UserReactionCountRuleParameters?, userRoleParams: freezed == userRoleParams ? _self.userRoleParams : userRoleParams // ignore: cast_nullable_to_non_nullable diff --git a/packages/stream_chat/lib/open_api/model/rule_builder_condition.g.dart b/packages/stream_chat/lib/open_api/model/rule_builder_condition.g.dart index 0db5824253..57eff04419 100644 --- a/packages/stream_chat/lib/open_api/model/rule_builder_condition.g.dart +++ b/packages/stream_chat/lib/open_api/model/rule_builder_condition.g.dart @@ -131,6 +131,16 @@ RuleBuilderCondition _$RuleBuilderConditionFromJson( : UserIdenticalContentCountParameters.fromJson( json['user_identical_content_count_params'] as Map, ), + userIdenticalImageCountParams: json['user_identical_image_count_params'] == null + ? null + : UserIdenticalImageCountParameters.fromJson( + json['user_identical_image_count_params'] as Map, + ), + userReactionCountParams: json['user_reaction_count_params'] == null + ? null + : UserReactionCountRuleParameters.fromJson( + json['user_reaction_count_params'] as Map, + ), userRoleParams: json['user_role_params'] == null ? null : UserRoleParameters.fromJson( @@ -182,6 +192,8 @@ Map _$RuleBuilderConditionToJson( 'user_custom_property_params': instance.userCustomPropertyParams?.toJson(), 'user_flag_count_rule_params': instance.userFlagCountRuleParams?.toJson(), 'user_identical_content_count_params': instance.userIdenticalContentCountParams?.toJson(), + 'user_identical_image_count_params': instance.userIdenticalImageCountParams?.toJson(), + 'user_reaction_count_params': instance.userReactionCountParams?.toJson(), 'user_role_params': instance.userRoleParams?.toJson(), 'user_rule_params': instance.userRuleParams?.toJson(), 'video_content_params': instance.videoContentParams?.toJson(), diff --git a/packages/stream_chat/lib/open_api/model/translate_message_response.dart b/packages/stream_chat/lib/open_api/model/translate_message_response.dart new file mode 100644 index 0000000000..296eb272ce --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/translate_message_response.dart @@ -0,0 +1,36 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'translate_message_response.g.dart'; +part 'translate_message_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class TranslateMessageResponse with _$TranslateMessageResponse { + const TranslateMessageResponse({ + required this.duration, + required this.message, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + @override + @JsonKey(name: 'message') + final MessageResponse message; + + Map toJson() => _$TranslateMessageResponseToJson(this); + + static TranslateMessageResponse fromJson(Map json) => _$TranslateMessageResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/translate_message_response.freezed.dart b/packages/stream_chat/lib/open_api/model/translate_message_response.freezed.dart new file mode 100644 index 0000000000..7ed9b42d63 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/translate_message_response.freezed.dart @@ -0,0 +1,82 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'translate_message_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$TranslateMessageResponse { + String get duration; + MessageResponse get message; + + /// Create a copy of TranslateMessageResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $TranslateMessageResponseCopyWith get copyWith => + _$TranslateMessageResponseCopyWithImpl( + this as TranslateMessageResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is TranslateMessageResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.message, message) || other.message == message)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration, message); + + @override + String toString() { + return 'TranslateMessageResponse(duration: $duration, message: $message)'; + } +} + +/// @nodoc +abstract mixin class $TranslateMessageResponseCopyWith<$Res> { + factory $TranslateMessageResponseCopyWith( + TranslateMessageResponse value, + $Res Function(TranslateMessageResponse) _then, + ) = _$TranslateMessageResponseCopyWithImpl; + @useResult + $Res call({String duration, MessageResponse message}); +} + +/// @nodoc +class _$TranslateMessageResponseCopyWithImpl<$Res> implements $TranslateMessageResponseCopyWith<$Res> { + _$TranslateMessageResponseCopyWithImpl(this._self, this._then); + + final TranslateMessageResponse _self; + final $Res Function(TranslateMessageResponse) _then; + + /// Create a copy of TranslateMessageResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? message = null}) { + return _then( + TranslateMessageResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + message: null == message + ? _self.message + : message // ignore: cast_nullable_to_non_nullable + as MessageResponse, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/translate_message_response.g.dart b/packages/stream_chat/lib/open_api/model/translate_message_response.g.dart new file mode 100644 index 0000000000..1261a05674 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/translate_message_response.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'translate_message_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +TranslateMessageResponse _$TranslateMessageResponseFromJson( + Map json, +) => TranslateMessageResponse( + duration: json['duration'] as String, + message: MessageResponse.fromJson(json['message'] as Map), +); + +Map _$TranslateMessageResponseToJson( + TranslateMessageResponse instance, +) => { + 'duration': instance.duration, + 'message': instance.message.toJson(), +}; diff --git a/packages/stream_chat/lib/open_api/model/typing_start_event.dart b/packages/stream_chat/lib/open_api/model/typing_start_event.dart index da99a8410e..fbae839694 100644 --- a/packages/stream_chat/lib/open_api/model/typing_start_event.dart +++ b/packages/stream_chat/lib/open_api/model/typing_start_event.dart @@ -23,6 +23,7 @@ class TypingStartEvent extends core.WsEvent with _$TypingStartEvent { this.cid, required this.createdAt, required this.custom, + this.member, this.parentId, this.receivedAt, required this.type, @@ -50,6 +51,10 @@ class TypingStartEvent extends core.WsEvent with _$TypingStartEvent { @JsonKey(name: 'custom') final Map custom; + @override + @JsonKey(name: 'member') + final ChannelMemberPartialResponse? member; + @override @JsonKey(name: 'parent_id') final String? parentId; diff --git a/packages/stream_chat/lib/open_api/model/typing_start_event.freezed.dart b/packages/stream_chat/lib/open_api/model/typing_start_event.freezed.dart index b763d083c2..39b4f37f32 100644 --- a/packages/stream_chat/lib/open_api/model/typing_start_event.freezed.dart +++ b/packages/stream_chat/lib/open_api/model/typing_start_event.freezed.dart @@ -18,6 +18,7 @@ mixin _$TypingStartEvent { String? get cid; DateTime get createdAt; Map get custom; + ChannelMemberPartialResponse? get member; String? get parentId; DateTime? get receivedAt; String get type; @@ -42,6 +43,7 @@ mixin _$TypingStartEvent { (identical(other.cid, cid) || other.cid == cid) && (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.member, member) || other.member == member) && (identical(other.parentId, parentId) || other.parentId == parentId) && (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && (identical(other.type, type) || other.type == type) && @@ -56,6 +58,7 @@ mixin _$TypingStartEvent { cid, createdAt, const DeepCollectionEquality().hash(custom), + member, parentId, receivedAt, type, @@ -64,7 +67,7 @@ mixin _$TypingStartEvent { @override String toString() { - return 'TypingStartEvent(channelId: $channelId, channelType: $channelType, cid: $cid, createdAt: $createdAt, custom: $custom, parentId: $parentId, receivedAt: $receivedAt, type: $type, user: $user)'; + return 'TypingStartEvent(channelId: $channelId, channelType: $channelType, cid: $cid, createdAt: $createdAt, custom: $custom, member: $member, parentId: $parentId, receivedAt: $receivedAt, type: $type, user: $user)'; } } @@ -81,6 +84,7 @@ abstract mixin class $TypingStartEventCopyWith<$Res> { String? cid, DateTime createdAt, Map custom, + ChannelMemberPartialResponse? member, String? parentId, DateTime? receivedAt, String type, @@ -105,6 +109,7 @@ class _$TypingStartEventCopyWithImpl<$Res> implements $TypingStartEventCopyWith< Object? cid = freezed, Object? createdAt = null, Object? custom = null, + Object? member = freezed, Object? parentId = freezed, Object? receivedAt = freezed, Object? type = null, @@ -132,6 +137,10 @@ class _$TypingStartEventCopyWithImpl<$Res> implements $TypingStartEventCopyWith< ? _self.custom : custom // ignore: cast_nullable_to_non_nullable as Map, + member: freezed == member + ? _self.member + : member // ignore: cast_nullable_to_non_nullable + as ChannelMemberPartialResponse?, parentId: freezed == parentId ? _self.parentId : parentId // ignore: cast_nullable_to_non_nullable diff --git a/packages/stream_chat/lib/open_api/model/typing_start_event.g.dart b/packages/stream_chat/lib/open_api/model/typing_start_event.g.dart index a211dd9d4d..60a28146c8 100644 --- a/packages/stream_chat/lib/open_api/model/typing_start_event.g.dart +++ b/packages/stream_chat/lib/open_api/model/typing_start_event.g.dart @@ -14,6 +14,11 @@ TypingStartEvent _$TypingStartEventFromJson(Map json) => Typing json['created_at'] as Object, ), custom: json['custom'] as Map, + member: json['member'] == null + ? null + : ChannelMemberPartialResponse.fromJson( + json['member'] as Map, + ), parentId: json['parent_id'] as String?, receivedAt: _$JsonConverterFromJson( json['received_at'], @@ -33,6 +38,7 @@ Map _$TypingStartEventToJson(TypingStartEvent instance) => ( instance.receivedAt, diff --git a/packages/stream_chat/lib/open_api/model/typing_stop_event.dart b/packages/stream_chat/lib/open_api/model/typing_stop_event.dart index 45aea6da01..8f04454363 100644 --- a/packages/stream_chat/lib/open_api/model/typing_stop_event.dart +++ b/packages/stream_chat/lib/open_api/model/typing_stop_event.dart @@ -23,6 +23,7 @@ class TypingStopEvent extends core.WsEvent with _$TypingStopEvent { this.cid, required this.createdAt, required this.custom, + this.member, this.parentId, this.receivedAt, required this.type, @@ -50,6 +51,10 @@ class TypingStopEvent extends core.WsEvent with _$TypingStopEvent { @JsonKey(name: 'custom') final Map custom; + @override + @JsonKey(name: 'member') + final ChannelMemberPartialResponse? member; + @override @JsonKey(name: 'parent_id') final String? parentId; diff --git a/packages/stream_chat/lib/open_api/model/typing_stop_event.freezed.dart b/packages/stream_chat/lib/open_api/model/typing_stop_event.freezed.dart index b922ceffb5..080a115ff1 100644 --- a/packages/stream_chat/lib/open_api/model/typing_stop_event.freezed.dart +++ b/packages/stream_chat/lib/open_api/model/typing_stop_event.freezed.dart @@ -18,6 +18,7 @@ mixin _$TypingStopEvent { String? get cid; DateTime get createdAt; Map get custom; + ChannelMemberPartialResponse? get member; String? get parentId; DateTime? get receivedAt; String get type; @@ -42,6 +43,7 @@ mixin _$TypingStopEvent { (identical(other.cid, cid) || other.cid == cid) && (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && const DeepCollectionEquality().equals(other.custom, custom) && + (identical(other.member, member) || other.member == member) && (identical(other.parentId, parentId) || other.parentId == parentId) && (identical(other.receivedAt, receivedAt) || other.receivedAt == receivedAt) && (identical(other.type, type) || other.type == type) && @@ -56,6 +58,7 @@ mixin _$TypingStopEvent { cid, createdAt, const DeepCollectionEquality().hash(custom), + member, parentId, receivedAt, type, @@ -64,7 +67,7 @@ mixin _$TypingStopEvent { @override String toString() { - return 'TypingStopEvent(channelId: $channelId, channelType: $channelType, cid: $cid, createdAt: $createdAt, custom: $custom, parentId: $parentId, receivedAt: $receivedAt, type: $type, user: $user)'; + return 'TypingStopEvent(channelId: $channelId, channelType: $channelType, cid: $cid, createdAt: $createdAt, custom: $custom, member: $member, parentId: $parentId, receivedAt: $receivedAt, type: $type, user: $user)'; } } @@ -81,6 +84,7 @@ abstract mixin class $TypingStopEventCopyWith<$Res> { String? cid, DateTime createdAt, Map custom, + ChannelMemberPartialResponse? member, String? parentId, DateTime? receivedAt, String type, @@ -105,6 +109,7 @@ class _$TypingStopEventCopyWithImpl<$Res> implements $TypingStopEventCopyWith<$R Object? cid = freezed, Object? createdAt = null, Object? custom = null, + Object? member = freezed, Object? parentId = freezed, Object? receivedAt = freezed, Object? type = null, @@ -132,6 +137,10 @@ class _$TypingStopEventCopyWithImpl<$Res> implements $TypingStopEventCopyWith<$R ? _self.custom : custom // ignore: cast_nullable_to_non_nullable as Map, + member: freezed == member + ? _self.member + : member // ignore: cast_nullable_to_non_nullable + as ChannelMemberPartialResponse?, parentId: freezed == parentId ? _self.parentId : parentId // ignore: cast_nullable_to_non_nullable diff --git a/packages/stream_chat/lib/open_api/model/typing_stop_event.g.dart b/packages/stream_chat/lib/open_api/model/typing_stop_event.g.dart index 204c83ffdf..8e2db8ee20 100644 --- a/packages/stream_chat/lib/open_api/model/typing_stop_event.g.dart +++ b/packages/stream_chat/lib/open_api/model/typing_stop_event.g.dart @@ -14,6 +14,11 @@ TypingStopEvent _$TypingStopEventFromJson(Map json) => TypingSt json['created_at'] as Object, ), custom: json['custom'] as Map, + member: json['member'] == null + ? null + : ChannelMemberPartialResponse.fromJson( + json['member'] as Map, + ), parentId: json['parent_id'] as String?, receivedAt: _$JsonConverterFromJson( json['received_at'], @@ -33,6 +38,7 @@ Map _$TypingStopEventToJson(TypingStopEvent instance) => ( instance.receivedAt, diff --git a/packages/stream_chat/lib/open_api/model/unban_response.dart b/packages/stream_chat/lib/open_api/model/unban_response.dart new file mode 100644 index 0000000000..d549b53939 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/unban_response.dart @@ -0,0 +1,31 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'unban_response.g.dart'; +part 'unban_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UnbanResponse with _$UnbanResponse { + const UnbanResponse({ + required this.duration, + }); + + @override + @JsonKey(name: 'duration') + final String duration; + + Map toJson() => _$UnbanResponseToJson(this); + + static UnbanResponse fromJson(Map json) => _$UnbanResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/unban_response.freezed.dart b/packages/stream_chat/lib/open_api/model/unban_response.freezed.dart new file mode 100644 index 0000000000..30f1e3aa36 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/unban_response.freezed.dart @@ -0,0 +1,75 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'unban_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UnbanResponse { + String get duration; + + /// Create a copy of UnbanResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UnbanResponseCopyWith get copyWith => _$UnbanResponseCopyWithImpl( + this as UnbanResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UnbanResponse && + (identical(other.duration, duration) || other.duration == duration)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration); + + @override + String toString() { + return 'UnbanResponse(duration: $duration)'; + } +} + +/// @nodoc +abstract mixin class $UnbanResponseCopyWith<$Res> { + factory $UnbanResponseCopyWith( + UnbanResponse value, + $Res Function(UnbanResponse) _then, + ) = _$UnbanResponseCopyWithImpl; + @useResult + $Res call({String duration}); +} + +/// @nodoc +class _$UnbanResponseCopyWithImpl<$Res> implements $UnbanResponseCopyWith<$Res> { + _$UnbanResponseCopyWithImpl(this._self, this._then); + + final UnbanResponse _self; + final $Res Function(UnbanResponse) _then; + + /// Create a copy of UnbanResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null}) { + return _then( + UnbanResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/unban_response.g.dart b/packages/stream_chat/lib/open_api/model/unban_response.g.dart new file mode 100644 index 0000000000..35aceb3e01 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/unban_response.g.dart @@ -0,0 +1,11 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'unban_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UnbanResponse _$UnbanResponseFromJson(Map json) => UnbanResponse(duration: json['duration'] as String); + +Map _$UnbanResponseToJson(UnbanResponse instance) => {'duration': instance.duration}; diff --git a/packages/stream_chat/lib/open_api/model/update_users_response.dart b/packages/stream_chat/lib/open_api/model/update_users_response.dart index ef00a2af63..3c48d33cd9 100644 --- a/packages/stream_chat/lib/open_api/model/update_users_response.dart +++ b/packages/stream_chat/lib/open_api/model/update_users_response.dart @@ -28,6 +28,7 @@ class UpdateUsersResponse with _$UpdateUsersResponse { final String duration; @override + @Deprecated('This field is deprecated.') @JsonKey(name: 'membership_deletion_task_id') final String membershipDeletionTaskId; diff --git a/packages/stream_chat/lib/open_api/model/upsert_config_request.dart b/packages/stream_chat/lib/open_api/model/upsert_config_request.dart index 60ee45a915..e336287c5e 100644 --- a/packages/stream_chat/lib/open_api/model/upsert_config_request.dart +++ b/packages/stream_chat/lib/open_api/model/upsert_config_request.dart @@ -53,7 +53,7 @@ class UpsertConfigRequest with _$UpsertConfigRequest { @override @JsonKey(name: 'ai_video_config') - final AIVideoConfig? aiVideoConfig; + final AIVideoConfigRequest? aiVideoConfig; @override @JsonKey(name: 'async') diff --git a/packages/stream_chat/lib/open_api/model/upsert_config_request.freezed.dart b/packages/stream_chat/lib/open_api/model/upsert_config_request.freezed.dart index be4db5bdb5..f43fe74a8c 100644 --- a/packages/stream_chat/lib/open_api/model/upsert_config_request.freezed.dart +++ b/packages/stream_chat/lib/open_api/model/upsert_config_request.freezed.dart @@ -16,7 +16,7 @@ mixin _$UpsertConfigRequest { AIAudioConfigRequest? get aiAudioConfig; AIImageConfig? get aiImageConfig; AITextConfig? get aiTextConfig; - AIVideoConfig? get aiVideoConfig; + AIVideoConfigRequest? get aiVideoConfig; bool? get async; AutomodPlatformCircumventionConfig? get automodPlatformCircumventionConfig; AutomodSemanticFiltersConfig? get automodSemanticFiltersConfig; @@ -123,7 +123,7 @@ abstract mixin class $UpsertConfigRequestCopyWith<$Res> { AIAudioConfigRequest? aiAudioConfig, AIImageConfig? aiImageConfig, AITextConfig? aiTextConfig, - AIVideoConfig? aiVideoConfig, + AIVideoConfigRequest? aiVideoConfig, bool? async, AutomodPlatformCircumventionConfig? automodPlatformCircumventionConfig, AutomodSemanticFiltersConfig? automodSemanticFiltersConfig, @@ -191,7 +191,7 @@ class _$UpsertConfigRequestCopyWithImpl<$Res> implements $UpsertConfigRequestCop aiVideoConfig: freezed == aiVideoConfig ? _self.aiVideoConfig : aiVideoConfig // ignore: cast_nullable_to_non_nullable - as AIVideoConfig?, + as AIVideoConfigRequest?, async: freezed == async ? _self.async : async // ignore: cast_nullable_to_non_nullable diff --git a/packages/stream_chat/lib/open_api/model/upsert_config_request.g.dart b/packages/stream_chat/lib/open_api/model/upsert_config_request.g.dart index 445afa12bf..88df7e0bdd 100644 --- a/packages/stream_chat/lib/open_api/model/upsert_config_request.g.dart +++ b/packages/stream_chat/lib/open_api/model/upsert_config_request.g.dart @@ -22,7 +22,9 @@ UpsertConfigRequest _$UpsertConfigRequestFromJson( : AITextConfig.fromJson(json['ai_text_config'] as Map), aiVideoConfig: json['ai_video_config'] == null ? null - : AIVideoConfig.fromJson(json['ai_video_config'] as Map), + : AIVideoConfigRequest.fromJson( + json['ai_video_config'] as Map, + ), async: json['async'] as bool?, automodPlatformCircumventionConfig: json['automod_platform_circumvention_config'] == null ? null diff --git a/packages/stream_chat/lib/open_api/model/user_identical_image_count_parameters.dart b/packages/stream_chat/lib/open_api/model/user_identical_image_count_parameters.dart new file mode 100644 index 0000000000..121d5f8f0e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_identical_image_count_parameters.dart @@ -0,0 +1,47 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'user_identical_image_count_parameters.g.dart'; +part 'user_identical_image_count_parameters.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UserIdenticalImageCountParameters with _$UserIdenticalImageCountParameters { + const UserIdenticalImageCountParameters({ + this.match, + this.similarityDistance, + this.threshold, + this.timeWindow, + }); + + @override + @JsonKey(name: 'match') + final String? match; + + @override + @JsonKey(name: 'similarity_distance') + final int? similarityDistance; + + @override + @JsonKey(name: 'threshold') + final int? threshold; + + @override + @JsonKey(name: 'time_window') + final String? timeWindow; + + Map toJson() => _$UserIdenticalImageCountParametersToJson(this); + + static UserIdenticalImageCountParameters fromJson(Map json) => + _$UserIdenticalImageCountParametersFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/user_identical_image_count_parameters.freezed.dart b/packages/stream_chat/lib/open_api/model/user_identical_image_count_parameters.freezed.dart new file mode 100644 index 0000000000..b76a911eec --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_identical_image_count_parameters.freezed.dart @@ -0,0 +1,112 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'user_identical_image_count_parameters.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UserIdenticalImageCountParameters { + String? get match; + int? get similarityDistance; + int? get threshold; + String? get timeWindow; + + /// Create a copy of UserIdenticalImageCountParameters + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UserIdenticalImageCountParametersCopyWith get copyWith => + _$UserIdenticalImageCountParametersCopyWithImpl( + this as UserIdenticalImageCountParameters, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UserIdenticalImageCountParameters && + (identical(other.match, match) || other.match == match) && + (identical(other.similarityDistance, similarityDistance) || + other.similarityDistance == similarityDistance) && + (identical(other.threshold, threshold) || other.threshold == threshold) && + (identical(other.timeWindow, timeWindow) || other.timeWindow == timeWindow)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + match, + similarityDistance, + threshold, + timeWindow, + ); + + @override + String toString() { + return 'UserIdenticalImageCountParameters(match: $match, similarityDistance: $similarityDistance, threshold: $threshold, timeWindow: $timeWindow)'; + } +} + +/// @nodoc +abstract mixin class $UserIdenticalImageCountParametersCopyWith<$Res> { + factory $UserIdenticalImageCountParametersCopyWith( + UserIdenticalImageCountParameters value, + $Res Function(UserIdenticalImageCountParameters) _then, + ) = _$UserIdenticalImageCountParametersCopyWithImpl; + @useResult + $Res call({ + String? match, + int? similarityDistance, + int? threshold, + String? timeWindow, + }); +} + +/// @nodoc +class _$UserIdenticalImageCountParametersCopyWithImpl<$Res> + implements $UserIdenticalImageCountParametersCopyWith<$Res> { + _$UserIdenticalImageCountParametersCopyWithImpl(this._self, this._then); + + final UserIdenticalImageCountParameters _self; + final $Res Function(UserIdenticalImageCountParameters) _then; + + /// Create a copy of UserIdenticalImageCountParameters + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? match = freezed, + Object? similarityDistance = freezed, + Object? threshold = freezed, + Object? timeWindow = freezed, + }) { + return _then( + UserIdenticalImageCountParameters( + match: freezed == match + ? _self.match + : match // ignore: cast_nullable_to_non_nullable + as String?, + similarityDistance: freezed == similarityDistance + ? _self.similarityDistance + : similarityDistance // ignore: cast_nullable_to_non_nullable + as int?, + threshold: freezed == threshold + ? _self.threshold + : threshold // ignore: cast_nullable_to_non_nullable + as int?, + timeWindow: freezed == timeWindow + ? _self.timeWindow + : timeWindow // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/user_identical_image_count_parameters.g.dart b/packages/stream_chat/lib/open_api/model/user_identical_image_count_parameters.g.dart new file mode 100644 index 0000000000..94d48771e5 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_identical_image_count_parameters.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'user_identical_image_count_parameters.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UserIdenticalImageCountParameters _$UserIdenticalImageCountParametersFromJson( + Map json, +) => UserIdenticalImageCountParameters( + match: json['match'] as String?, + similarityDistance: (json['similarity_distance'] as num?)?.toInt(), + threshold: (json['threshold'] as num?)?.toInt(), + timeWindow: json['time_window'] as String?, +); + +Map _$UserIdenticalImageCountParametersToJson( + UserIdenticalImageCountParameters instance, +) => { + 'match': instance.match, + 'similarity_distance': instance.similarityDistance, + 'threshold': instance.threshold, + 'time_window': instance.timeWindow, +}; diff --git a/packages/stream_chat/lib/open_api/model/user_reaction_count_rule_parameters.dart b/packages/stream_chat/lib/open_api/model/user_reaction_count_rule_parameters.dart new file mode 100644 index 0000000000..6511c05c01 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_reaction_count_rule_parameters.dart @@ -0,0 +1,42 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'user_reaction_count_rule_parameters.g.dart'; +part 'user_reaction_count_rule_parameters.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UserReactionCountRuleParameters with _$UserReactionCountRuleParameters { + const UserReactionCountRuleParameters({ + this.count, + this.threshold, + this.timeWindow, + }); + + @override + @JsonKey(name: 'count') + final String? count; + + @override + @JsonKey(name: 'threshold') + final int? threshold; + + @override + @JsonKey(name: 'time_window') + final String? timeWindow; + + Map toJson() => _$UserReactionCountRuleParametersToJson(this); + + static UserReactionCountRuleParameters fromJson(Map json) => + _$UserReactionCountRuleParametersFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/user_reaction_count_rule_parameters.freezed.dart b/packages/stream_chat/lib/open_api/model/user_reaction_count_rule_parameters.freezed.dart new file mode 100644 index 0000000000..1ec2f34231 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_reaction_count_rule_parameters.freezed.dart @@ -0,0 +1,92 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'user_reaction_count_rule_parameters.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UserReactionCountRuleParameters { + String? get count; + int? get threshold; + String? get timeWindow; + + /// Create a copy of UserReactionCountRuleParameters + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UserReactionCountRuleParametersCopyWith get copyWith => + _$UserReactionCountRuleParametersCopyWithImpl( + this as UserReactionCountRuleParameters, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UserReactionCountRuleParameters && + (identical(other.count, count) || other.count == count) && + (identical(other.threshold, threshold) || other.threshold == threshold) && + (identical(other.timeWindow, timeWindow) || other.timeWindow == timeWindow)); + } + + @override + int get hashCode => Object.hash(runtimeType, count, threshold, timeWindow); + + @override + String toString() { + return 'UserReactionCountRuleParameters(count: $count, threshold: $threshold, timeWindow: $timeWindow)'; + } +} + +/// @nodoc +abstract mixin class $UserReactionCountRuleParametersCopyWith<$Res> { + factory $UserReactionCountRuleParametersCopyWith( + UserReactionCountRuleParameters value, + $Res Function(UserReactionCountRuleParameters) _then, + ) = _$UserReactionCountRuleParametersCopyWithImpl; + @useResult + $Res call({String? count, int? threshold, String? timeWindow}); +} + +/// @nodoc +class _$UserReactionCountRuleParametersCopyWithImpl<$Res> implements $UserReactionCountRuleParametersCopyWith<$Res> { + _$UserReactionCountRuleParametersCopyWithImpl(this._self, this._then); + + final UserReactionCountRuleParameters _self; + final $Res Function(UserReactionCountRuleParameters) _then; + + /// Create a copy of UserReactionCountRuleParameters + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? count = freezed, + Object? threshold = freezed, + Object? timeWindow = freezed, + }) { + return _then( + UserReactionCountRuleParameters( + count: freezed == count + ? _self.count + : count // ignore: cast_nullable_to_non_nullable + as String?, + threshold: freezed == threshold + ? _self.threshold + : threshold // ignore: cast_nullable_to_non_nullable + as int?, + timeWindow: freezed == timeWindow + ? _self.timeWindow + : timeWindow // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/user_reaction_count_rule_parameters.g.dart b/packages/stream_chat/lib/open_api/model/user_reaction_count_rule_parameters.g.dart new file mode 100644 index 0000000000..4313dd4c47 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_reaction_count_rule_parameters.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'user_reaction_count_rule_parameters.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UserReactionCountRuleParameters _$UserReactionCountRuleParametersFromJson( + Map json, +) => UserReactionCountRuleParameters( + count: json['count'] as String?, + threshold: (json['threshold'] as num?)?.toInt(), + timeWindow: json['time_window'] as String?, +); + +Map _$UserReactionCountRuleParametersToJson( + UserReactionCountRuleParameters instance, +) => { + 'count': instance.count, + 'threshold': instance.threshold, + 'time_window': instance.timeWindow, +}; diff --git a/packages/stream_chat/lib/open_api/models.dart b/packages/stream_chat/lib/open_api/models.dart index 83fd46cc00..0103ba1f1e 100644 --- a/packages/stream_chat/lib/open_api/models.dart +++ b/packages/stream_chat/lib/open_api/models.dart @@ -10,7 +10,8 @@ export 'model/ai_indicator_clear_event.dart'; export 'model/ai_indicator_stop_event.dart'; export 'model/ai_indicator_update_event.dart'; export 'model/ai_text_config.dart'; -export 'model/ai_video_config.dart'; +export 'model/ai_video_config_request.dart'; +export 'model/ai_video_config_response.dart'; export 'model/aws_rekognition_rule.dart'; export 'model/action.dart'; export 'model/action_log_response.dart'; @@ -117,6 +118,7 @@ export 'model/create_poll_option_request.dart'; export 'model/create_poll_request.dart'; export 'model/create_queue_request.dart'; export 'model/create_reminder_request.dart'; +export 'model/create_reminder_response.dart'; export 'model/create_user_group_request.dart'; export 'model/create_user_group_response.dart'; export 'model/custom_action_request_payload.dart'; @@ -402,12 +404,14 @@ export 'model/thread_state_response.dart'; export 'model/thread_updated_event.dart'; export 'model/thresholds.dart'; export 'model/translate_message_request.dart'; +export 'model/translate_message_response.dart'; export 'model/truncate_channel_request.dart'; export 'model/truncate_channel_response.dart'; export 'model/typing_indicators_response.dart'; export 'model/typing_start_event.dart'; export 'model/typing_stop_event.dart'; export 'model/unban_action_request_payload.dart'; +export 'model/unban_response.dart'; export 'model/unblock_action_request_payload.dart'; export 'model/unblock_users_request.dart'; export 'model/unblock_users_response.dart'; @@ -470,10 +474,12 @@ export 'model/user_group_member_removed_event.dart'; export 'model/user_group_response.dart'; export 'model/user_group_updated_event.dart'; export 'model/user_identical_content_count_parameters.dart'; +export 'model/user_identical_image_count_parameters.dart'; export 'model/user_messages_deleted_event.dart'; export 'model/user_mute_response.dart'; export 'model/user_muted_event.dart'; export 'model/user_presence_changed_event.dart'; +export 'model/user_reaction_count_rule_parameters.dart'; export 'model/user_reactivated_event.dart'; export 'model/user_request.dart'; export 'model/user_response.dart'; From b1ebc978e46abfe99b42d1d8f4f3894b330a87fc Mon Sep 17 00:00:00 2001 From: Petar Velikov Date: Fri, 25 Sep 2026 09:23:26 +0200 Subject: [PATCH 22/36] refactor(llc)!: keep the generated device and role models off the public API (#3004) * refactor(llc)!: keep the generated device and role models off the public API Co-Authored-By: Claude Opus 5.5 * docs(repo): plan the migration around domain models over the generated client Co-Authored-By: Claude Opus 5.5 * refactor(llc): name the domain mappers toModel and toRequest Co-Authored-By: Claude Opus 5.5 * docs(repo): list the sanctioned breaks of the domain-model migration Co-Authored-By: Claude Opus 5.5 * test(llc): cover the domain mappers directly Co-Authored-By: Claude Opus 5.5 * test(llc): unify the generated-client prefix as api and name tests by behavior Co-Authored-By: Claude Opus 5.5 * refactor(llc)!: answer nothing from addDevice and removeDevice Co-Authored-By: Claude Opus 5.5 * refactor(llc)!: make the device and role models freezed and keep them beside the other models Co-Authored-By: Claude Opus 5.5 * docs(llc): document the searchRoles cursor and align the role type tests with the testing guide Co-Authored-By: Claude Opus 5.5 * refactor(llc)!: make PushProvider an extension type and type Device.pushProvider with it Co-Authored-By: Claude Opus 5.5 * style(llc): format the regenerated device model Co-Authored-By: Claude Opus 5.5 * refactor(llc): drop the value of a duration-only write through ignoreResult Co-Authored-By: Claude Opus 5.5 * refactor(llc): rename ignoreResult to ignoreValue Co-Authored-By: Claude Opus 5.5 * docs(repo): prefer extension types over enums for server-defined values Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: Claude Opus 5.5 --- .claude/skills/openapi-migration/SKILL.md | 72 +- STYLE_GUIDE.md | 34 + migrations/v11-migration.md | 79 +- openapi-migration/02-devices.md | 75 +- openapi-migration/03-user-groups.md | 5 +- openapi-migration/04-roles-guest-and-app.md | 6 +- openapi-migration/09-users.md | 2 + openapi-migration/README.md | 59 +- openapi-migration/tool/generate_plan.py | 155 ++- packages/stream_chat/CHANGELOG.md | 12 +- .../stream_chat/lib/src/client/client.dart | 15 +- .../models/converters/v1_json_converters.dart | 30 + .../lib/src/core/models/device.dart | 25 + .../lib/src/core/models/device.freezed.dart | 75 ++ .../core/models/list_devices_response.dart | 23 + .../models/list_devices_response.freezed.dart | 77 ++ .../lib/src/core/models/own_user.dart | 8 +- .../lib/src/core/models/own_user.g.dart | 18 +- .../lib/src/core/models/push_provider.dart | 17 + .../stream_chat/lib/src/core/models/role.dart | 36 + .../lib/src/core/models/role.freezed.dart | 100 ++ .../core/models/search_roles_response.dart | 23 + .../models/search_roles_response.freezed.dart | 77 ++ .../src/repository/devices_repository.dart | 47 +- .../src/repository/mapper/devices_mapper.dart | 25 + .../src/repository/mapper/result_mapper.dart | 9 + .../src/repository/mapper/roles_mapper.dart | 24 + .../lib/src/repository/roles_repository.dart | 32 +- packages/stream_chat/lib/stream_chat.dart | 9 +- .../test/src/client/client_test.dart | 1011 +++++++++-------- .../converters/v1_json_converters_test.dart | 39 + .../test/src/core/models/own_user_test.dart | 63 +- .../src/core/models/push_provider_test.dart | 25 + .../test/src/core/models/role_type_test.dart | 28 +- .../repository/devices_repository_test.dart | 281 +++-- .../mapper/devices_mapper_test.dart | 76 ++ .../repository/mapper/result_mapper_test.dart | 23 + .../repository/mapper/roles_mapper_test.dart | 54 + .../src/repository/roles_repository_test.dart | 65 +- sample_app/lib/auth/auth_controller.dart | 2 +- sample_app/lib/push/push_provider.dart | 6 +- sample_app/lib/push/push_token_manager.dart | 2 +- 42 files changed, 1895 insertions(+), 949 deletions(-) create mode 100644 packages/stream_chat/lib/src/core/models/converters/v1_json_converters.dart create mode 100644 packages/stream_chat/lib/src/core/models/device.dart create mode 100644 packages/stream_chat/lib/src/core/models/device.freezed.dart create mode 100644 packages/stream_chat/lib/src/core/models/list_devices_response.dart create mode 100644 packages/stream_chat/lib/src/core/models/list_devices_response.freezed.dart create mode 100644 packages/stream_chat/lib/src/core/models/push_provider.dart create mode 100644 packages/stream_chat/lib/src/core/models/role.dart create mode 100644 packages/stream_chat/lib/src/core/models/role.freezed.dart create mode 100644 packages/stream_chat/lib/src/core/models/search_roles_response.dart create mode 100644 packages/stream_chat/lib/src/core/models/search_roles_response.freezed.dart create mode 100644 packages/stream_chat/lib/src/repository/mapper/devices_mapper.dart create mode 100644 packages/stream_chat/lib/src/repository/mapper/result_mapper.dart create mode 100644 packages/stream_chat/lib/src/repository/mapper/roles_mapper.dart create mode 100644 packages/stream_chat/test/src/core/models/converters/v1_json_converters_test.dart create mode 100644 packages/stream_chat/test/src/core/models/push_provider_test.dart create mode 100644 packages/stream_chat/test/src/repository/mapper/devices_mapper_test.dart create mode 100644 packages/stream_chat/test/src/repository/mapper/result_mapper_test.dart create mode 100644 packages/stream_chat/test/src/repository/mapper/roles_mapper_test.dart diff --git a/.claude/skills/openapi-migration/SKILL.md b/.claude/skills/openapi-migration/SKILL.md index 68b0a57640..f55dd77ef1 100644 --- a/.claude/skills/openapi-migration/SKILL.md +++ b/.claude/skills/openapi-migration/SKILL.md @@ -117,20 +117,35 @@ silently — which is exactly why fixes belong in the generator or in your own c ## Phase 2 — decide the shape of each symbol -For every type in the inventory, one decision: keep our shape and map at the boundary, or adopt the generated one. - -**Default to keeping our shape.** Generated types are wire shapes — nullable wherever the spec is loose, with -`_unknown` enum sentinels and per-operation extension types instead of shared enums (`CreateDeviceRequestPushProvider` -rather than one `PushProvider`). That is usually a worse public API than what we hand-wrote. - -**Breaking changes are allowed, but a break needs a reason beyond convenience.** Take it when it buys one of: - -- **Long-term maintainability** — the alternative is maintaining two shapes of the same thing indefinitely, or a - mapping layer that needs editing on every spec change. -- **Consistency with our other products** — the generated name or shape is what our other SDKs expose, so matching - it makes Stream's API coherent for people working across them. - -Not sufficient on their own: avoiding a small mapping function, cosmetic naming, or "the generated one is newer". +The generated models stay private. Follow the domain-model rules in +[`openapi-migration/README.md`](../../../openapi-migration/README.md#domain-models): the public API keeps the v10 +models, names and response envelopes as plain classes without JSON, and the repository maps generated → ours. +Phase 2 is therefore not "keep or adopt" but, per type: + +- **Which v10 type it maps to**, and whether that type is embedded in a model that still decodes v1 JSON with + json_serializable. If it is, the parent's field needs a temporary converter (README rule 7) — add it to the + adapters table with the group that removes it. +- **Whether persistence stores it as JSON text.** If so, the Drift mapper gets its own private helpers (rule 8). +- **Which request enums need a hand-written public type** (rule 6). + +Generated types are wire shapes — nullable wherever the spec is loose, with per-operation extension types instead +of shared enums (`CreateDeviceRequestPushProvider` rather than one `PushProvider`) — which is why they never reach +a public signature. + +**A migration makes exactly these breaks, and no others:** + +- **The error contract:** public methods return `Result` instead of throwing (below). +- **Duration-only writes answer nothing:** a write whose generated response is `DurationResponse` returns + `Result`, not `EmptyResponse`. +- **No JSON on public models or envelopes:** their `fromJson` and `toJson` are removed. +- **Envelopes are immutable:** they are built through a const constructor with final fields, not a no-argument + constructor and `late` setters. +- **`duration` is a non-nullable `String`** on every envelope; v10 typed it `String?`. +- **Models and envelopes are `@freezed`:** they compare by value, and one that extended `Equatable` in v10 loses + `props`. + +Anything else a migration would change about what the caller holds needs its own reason. A server field our v10 +model lacks is exposed later, as an additive change, not by swapping in the generated type. When you do break, four things ship in the same PR: a `refactor(scope)!:` commit/PR title, a `🛑️ Breaking` CHANGELOG entry naming the old and new symbol, a Symbol Map row plus feature section in @@ -203,11 +218,12 @@ Moving the WebSocket to v2 is its own project — v2 sends different event shape ## Phase 4 — implement ```dart -import '../../open_api/models.dart' as api; // prefix while both shapes exist +import '../../open_api/api.dart' as api; // the generated names collide with ours +import 'mapper/devices_mapper.dart'; Future> getDevices() async { - final result = await _api.listDevices(); // Future> - return result.map(_toListDevicesResponse); // transforms Success, passes Failure through untouched + final result = await _api.listDevices(); // Future> + return result.map((response) => response.toModel()); // transforms Success, passes Failure through untouched } ``` @@ -234,12 +250,9 @@ Two data-shape traps while mapping: `StreamDateTimeConverter` (epoch nanoseconds *or* RFC3339); hand-written models use `DateTime.parse`. A model fed by both REST v2 and WS events must tolerate both. -Where a generated type shadows one of ours the prefix is temporary: if phase 2 chose the generated type, delete -ours in the same PR. Current overlaps with types exported from `lib/stream_chat.dart` include `Action`, -`Attachment`, `ChannelMute`, `ChatPreferences`, `Command`, `Reaction`, `Role`, `ThreadParticipant`, `User`, -`UserGroup`, `UserGroupMember`, plus same-name response DTOs (`ListDevicesResponse`, -`UpsertPushPreferencesResponse`) and `PushPreferenceInput`. Regenerate rather than trusting that list — it prints -file names, so `channel_mute` means the generated `ChannelMute` shadows ours: +Many generated types shadow ours by name, which is why repositories and mappers import the generated code with a +prefix. The prefix is permanent: the generated types are never exported. List the current overlaps with (it prints +file names, so `channel_mute` means the generated `ChannelMute` shadows ours): ```bash comm -12 \ @@ -258,8 +271,8 @@ wrong on top of that: - **Scope is the surface the group touches**, not just the new repository. The `StreamChatClient` delegates duplicate its docs verbatim, so a fix belongs in both. -- **Retyping a field leaves its doc describing the old type**, and that line is not in the diff. `OwnUser.devices` - still reads `/// List of user devices.` after becoming a `DeviceResponse`. Re-read the docs on what you retyped. +- **Retyping a field leaves its doc describing the old type**, and that line is not in the diff. Re-read the docs + on everything you retyped, including fields that only gained a converter. - **Describe behaviour, and every non-obvious parameter** — a bare `nameGt` cursor tells a reader nothing. Why a shape was adopted belongs in the plan file and the PR body, not in a doc comment. @@ -273,10 +286,11 @@ Budget for this: on a typical feature it is most of the diff, and none of it is `MockHttpClient`. Routing through `DefaultApi` moves the mock seam to `Dio`/`DefaultApi`; the old assertions cannot survive. - `test/src/client/client_test.dart` builds fixtures in the `late`-mutable style the hand-written DTOs allow - (`ListDevicesResponse()..devices = …`). Generated freezed classes have final fields and required named - arguments, so any fixture switching to a generated type must be rewritten. -- `test/src/core/api/responses_test.dart` round-trips the DTO from JSON — keep it passing while the DTO exists, - delete it with the DTO. + (`ListDevicesResponse()..devices = …`). Stubs of `DefaultApi` now answer generated types, and the restored + envelopes are plain classes with const constructors, so those fixtures must be rewritten. +- `test/src/core/api/responses_test.dart` round-trips the DTO from JSON — delete those cases with the DTO's JSON. +- **Test each mapper from a fully populated generated response,** so a field the mapper drops fails an assertion. +- **Test each temporary converter,** both on its own and wired through its parent's `fromJson`/`toJson`. Rewrite onto `TESTING.md` rather than carrying the old file's habits across. What breaks most often: diff --git a/STYLE_GUIDE.md b/STYLE_GUIDE.md index ac50b65f6f..3d940327be 100644 --- a/STYLE_GUIDE.md +++ b/STYLE_GUIDE.md @@ -709,6 +709,40 @@ final label = switch (state) { }; ``` +### Prefer extension types over enums for server-defined values + +A set of values the server defines — a push provider, a message type, a channel +capability — grows over time. Model it as an extension type over its wire string, with +a `static const` for each value the SDK knows, rather than as an enum: + +```dart +// GOOD: +extension type const PushProvider(String rawType) implements String { + /// Google's Firebase Cloud Messaging. + static const firebase = PushProvider('firebase'); + + /// Apple's Push Notification service. + static const apn = PushProvider('apn'); +} + +// BAD: +enum PushProvider { firebase, apn } +``` + +- **Adding a value is not a breaking change.** Callers can't switch over the type + exhaustively, so a new constant breaks no one's `switch`. +- **A value the SDK doesn't name yet still decodes.** `PushProvider('onesignal')` carries + it through, instead of failing or collapsing into an `unknown` case. +- **It interoperates with `String`.** It compares equal to its wire value and passes + wherever a `String` is expected, so no conversion is needed at the wire boundary. + +The cost is exhaustiveness: there is no `.values` or `.name`, and a `switch` over one +needs a default. Keep an enum for a closed set the SDK owns, where exhaustiveness is +the point — `ConnectionStatus`, `QueryDirection`, `SortDirection`. + +Existing examples: `MessageType`, `AttachmentType`, `ChannelCapability`, `RoleType`, +`PushProvider`. + ### Prefer explicit types and avoid `dynamic` All public API members must have explicit type annotations — parameters, fields, and diff --git a/migrations/v11-migration.md b/migrations/v11-migration.md index 15fbea0f40..a6d2fe4c9e 100644 --- a/migrations/v11-migration.md +++ b/migrations/v11-migration.md @@ -152,15 +152,15 @@ search-and-replace you can apply directly. `Kind` is one of `renamed`, `removed` | `CurrentPlatform` / `PlatformType` (`stream_chat`) | `CurrentPlatform` / `PlatformType` (`stream_core`) | `moved` | Re-exported from this package. Same seven platforms and the same strings | | `CurrentPlatform.name` | `CurrentPlatform.operatingSystem` | `renamed` | Same value — `'android'`, `'ios'`, `'web'`, `'macos'`, … | | `client.wsConnectionStatus` / `.wsConnectionStatusStream` | `client.connectionStatus` / `.connectionStatusStream` | `renamed` | Same `ConnectionStatus`, same three values. The WebSocket's own state, and the disconnection sources it carries, are no longer exported: `ConnectionStatus` is the whole connection API, as on the other Stream SDKs | -| `Role` (hand-written) | `Role` (generated) | `retyped` | Same five fields, same types. Gains `copyWith` and `toJson`; equality is unchanged | -| `SearchRolesResponse` (hand-written) | `SearchRolesResponse` (generated) | `retyped` | `duration` and `roles` are required — a body omitting either now fails to decode rather than defaulting | | `StreamChatClient.searchRoles` → `Future` | `Future>` | `retyped` | Returns a `Result` instead of throwing | -| `Device` (hand-written) | `DeviceResponse` (generated) | `retyped` | Two fields become nine. `created_at` and `user_id` are required, so a device entry missing either now fails to decode | -| `ListDevicesResponse` (hand-written) | `ListDevicesResponse` (generated) | `retyped` | `devices` and `duration` are required — a body omitting either now fails to decode rather than defaulting to `[]` | -| `PushProvider` (enum) | `CreateDeviceRequestPushProvider` (extension type over `String`) | `renamed` | Same four values and wire strings. The name is the generated one, and operation-scoped until the spec is regenerated | -| `PushProvider.firebase.name` | `CreateDeviceRequestPushProvider.firebase` | `removed` | The value *is* the string, so there is no `.name` — and no `.values` | | `StreamChatClient.addDevice` / `removeDevice` → `Future` | `Future>` | `retyped` | Returns a `Result` instead of throwing, and carries no value on success | | `StreamChatClient.getDevices` → `Future` | `Future>` | `retyped` | Returns a `Result` instead of throwing | +| `Device.fromJson` / `toJson`, `Role.fromJson` | — | `removed` | The models are plain classes; construct them directly | +| `PushProvider` (enum), `Device.pushProvider` (`String`) | `PushProvider` (extension type over `String`), `Device.pushProvider` (`PushProvider`) | `retyped` | Same four constants and wire values, and still usable as a `String`. `.name` and `.values` are gone and a `switch` over it needs a default; wrap a raw value as `PushProvider('firebase')` | +| `ListDevicesResponse.fromJson`, `SearchRolesResponse.fromJson`, `ListDevicesResponse()..devices = …` | `ListDevicesResponse(duration: …, devices: …)` | `retyped` | The responses are plain classes with a const constructor and final fields | +| `ListDevicesResponse.duration` / `SearchRolesResponse.duration` (`String?`) | `String` | `retyped` | Always present; drop any `!` or `?? ''` | +| `Device` / `ListDevicesResponse` / `SearchRolesResponse` identity `==` | value `==`, plus `copyWith` | `retyped` | Two instances with the same fields are now equal | +| `Role extends Equatable`, `Role.props` | `Role` (value `==`, `copyWith`) | `removed` | Equality is unchanged; `props` is gone and `Role` is no longer an `Equatable` | | `StreamChatApi.device` | `StreamChatApi.pushPreferences` | `renamed` | The class handles only `setPushPreferences` now; device calls moved to the generated client | | _(more added per feature as PRs land)_ | | | | @@ -398,10 +398,8 @@ read from the offline cache, which orders by the model's default when the query ### Roles -**`searchRoles` returns a `Result` instead of throwing**, and its types come from the OpenAPI spec. - -> **Why:** it is the first endpoint on the generated client. Our `Role` and the generated one were -> field-for-field identical, so keeping ours meant maintaining two copies of one shape forever. +**`searchRoles` returns a `Result` instead of throwing.** `Role` and `SearchRolesResponse` keep their +fields. ```dart // v10 @@ -423,60 +421,63 @@ result.fold( `getOrDefault`, `getOrNull` and `map` are available when you only want the happy path — see [Error Handling](#error-handling) for the full `Result` surface. -**Decoding is stricter.** `SearchRolesResponse` requires `duration` and `roles`; a response omitting -either now fails to decode rather than falling back to `null` and `[]`. `Role` itself is unchanged -field-for-field, and additionally gains `copyWith` and `toJson`. +**`Role` and `SearchRolesResponse` no longer decode JSON.** Both are plain classes; build them with their +constructors, for example in a test stub: -### Devices +```dart +// v10 +final response = SearchRolesResponse()..roles = [role]; + +// v11 +final response = SearchRolesResponse(duration: '0ms', roles: [role]); +``` -**`addDevice`, `getDevices` and `removeDevice` return a `Result` instead of throwing**, and their -types come from the OpenAPI spec. +**`SearchRolesResponse.duration` is a non-nullable `String`**, where v10 typed it `String?`. -> **Why:** the generated `DeviceResponse` carries seven fields our two-field `Device` dropped — -> `user_id`, `created_at`, `disabled`, `disabled_reason`, `hardware_id`, `push_provider_name` and -> `voip`. Keeping ours meant maintaining a lossy copy of one shape forever. +### Devices + +**`addDevice`, `getDevices` and `removeDevice` return a `Result` instead of throwing.** `addDevice` and +`removeDevice` carry no value on success. `Device` and `ListDevicesResponse` keep their fields. ```dart // v10 try { - await client.addDevice(token, CreateDeviceRequestPushProvider.firebase); + await client.addDevice(token, PushProvider.firebase); } on StreamChatException catch (e) { report(e); } // v11 -final result = await client.addDevice(token, CreateDeviceRequestPushProvider.firebase); +final result = await client.addDevice(token, PushProvider.firebase); result.fold( onSuccess: (_) => registered(), onFailure: (error, _) => report(error), ); ``` -**`PushProvider` is replaced by the generated `CreateDeviceRequestPushProvider`,** an extension type -over `String` rather than an enum. There is one definition rather than a hand-maintained copy. The four -values and their wire strings are unchanged, and a provider *is* its string: +**`Device` and `ListDevicesResponse` no longer decode JSON.** Both are plain classes; build them with their +constructors — `ListDevicesResponse(duration: '0ms', devices: [device])` where v10 wrote +`ListDevicesResponse()..devices = [device]`. `OwnUser.devices` still decodes from, and encodes to, the same +`id` and `push_provider` keys. + +**`ListDevicesResponse.duration` is a non-nullable `String`**, where v10 typed it `String?`. + +**`PushProvider` is an extension type over its wire string, and `Device.pushProvider` is a `PushProvider`.** The +four constants and their values are unchanged, and a `PushProvider` still compares equal to its string, so +`PushProvider.firebase` and `device.pushProvider == 'firebase'` keep working. A provider without a constant is +named by wrapping its value. ```dart // v10 -final wireValue = PushProvider.firebase.name; // 'firebase' +final String wireValue = PushProvider.firebase.name; +final device = Device(id: token, pushProvider: 'firebase'); // v11 -const wireValue = CreateDeviceRequestPushProvider.firebase; // already 'firebase' +final String wireValue = PushProvider.firebase; +final device = Device(id: token, pushProvider: PushProvider.firebase); ``` -There is no `.values`, so code that iterated the enum needs an explicit list. A provider the spec does -not name still round-trips, through `CreateDeviceRequestPushProvider.fromJson`. - -The name is the generated one, and it is scoped to the operation it hangs off rather than to the -concept. That is temporary: a spec change is prepared that will give the type a better name, at which -point this becomes a rename rather than a new concept. - -**`Device` is replaced by `DeviceResponse`,** including in `OwnUser.devices`. Reading `id` and -`pushProvider` is unchanged; constructing one now also requires `createdAt` and `userId`. - -**Decoding is stricter.** `ListDevicesResponse` requires `devices` and `duration`, and each -`DeviceResponse` requires `created_at` and `user_id` — responses omitting any of them now fail to -decode rather than defaulting. +A `switch` over a `PushProvider` is no longer exhaustive; give it a default case. --- diff --git a/openapi-migration/02-devices.md b/openapi-migration/02-devices.md index b4e571d9c6..bfd88e5cc6 100644 --- a/openapi-migration/02-devices.md +++ b/openapi-migration/02-devices.md @@ -23,40 +23,29 @@ ## Decisions taken -- **`Device` → generated `DeviceResponse`, adopted.** Our two fields dropped seven the server sends - (`user_id`, `created_at`, `disabled`, `disabled_reason`, `hardware_id`, `push_provider_name`, - `voip`), and the spec makes `OwnUserResponse.devices` a `List` regardless, so - keeping ours meant a lossy copy of one shape maintained forever. `created_at` and `user_id` are - required, and both are always sent: `user_id` is part of the devices table's composite primary - key, and neither field carries `omitempty` on the response struct. -- **`ListDevicesResponse` → the generated one, adopted.** Same-name shadow with nothing of ours to keep. -- **`PushProvider` is deleted; the generated `CreateDeviceRequestPushProvider` is the public type.** - **This is the enum precedent for every later group,** and it is deliberately *not* the same answer - as `RoleType` in group 04. The two cases differ in the generated code, not in taste: `role_type` is - a bare `String?` in the generated signature, so a hand-written `RoleType` adds a type where none - existed; `push_provider` already has a complete generated extension type with the same four values, - so hand-writing one would be a second copy that silently misses a fifth provider the spec adds - later. - - This started as a typedef aliasing the generated type to a better name, and that was reverted in - review. The rule for later groups is therefore: **adopt the generated type when one exists and is - complete, including its name, and hand-write only when the generated side has no type at all.** - Do not alias a generated type merely to rename it — an alias is a second name for one concept, and - it hides from the reader that the spec is what needs fixing. - - The name really is wrong: `CreateDeviceRequestPushProvider` is named for the request it hangs off, - not for the concept, and it is what a consumer writes and what hovers show. That is accepted as - temporary, because a spec change is prepared that renames these types. When it lands the fix is a - rename in one place rather than the unwinding of an alias. - - Costs, recorded in the migration guide: `.name` and `.values` are gone (v10 shipped an enum). - The `.values` loss also costs the test that asserted every provider was covered; an extension type - cannot enumerate itself, so a fifth provider is caught by the spec, not by this package's suite. -- **The write calls answer nothing.** `addDevice` and `removeDevice` return `Result` - rather than the generated `DurationResponse`, whose only field is a server-timing string no - integrator acts on. `stream_feeds` already does this, and it keeps `DurationResponse` off the - public surface entirely. **The precedent for every later group: a write that returns only an - envelope returns `Result`.** +Revisited after landing: the group first adopted the generated `DeviceResponse`, +`ListDevicesResponse` and `CreateDeviceRequestPushProvider` as public types. It now follows the +[domain-model rules](README.md#domain-models), and the decisions below are the ones in force. + +- **`Device` stays our public type, in its v10 shape** (`id`, `pushProvider`), as a plain class with + no JSON. The repository maps the generated `DeviceResponse` into it. The seven further fields the + server sends (`user_id`, `created_at`, `disabled`, `disabled_reason`, `hardware_id`, + `push_provider_name`, `voip`) are not exposed; adding any of them later is non-breaking. +- **`ListDevicesResponse` is hand-written,** under its v10 name, as a plain class carrying `duration` + and `devices`. An envelope rather than a bare list, so a field the server adds to the response can + be exposed without changing the method's signature. +- **`PushProvider` becomes an extension type over its wire string,** where v10 declared an enum, and + `Device.pushProvider` is typed with it rather than `String`. The server answers the provider as a + free-form string, so a device registered with a provider the SDK does not name still decodes, and a + provider added later is a new constant rather than a breaking enum value. The repository maps it to + the generated `CreateDeviceRequestPushProvider` by its wire value. **This is the enum precedent for + every later group:** a generated request enum gets a hand-written public type, so the generator's + naming never reaches a signature. +- **The write calls answer nothing.** `addDevice` and `removeDevice` return `Result`: the + generated `DurationResponse` carries only a server-timing string no integrator acts on, and v10's + `EmptyResponse` is a json_serializable, mutable envelope the domain-model rules retire. **The + precedent for every later group: a write whose response carries only `duration` returns + `Result`.** - **`hardwareId` and `voipToken` are left unset.** `voipToken` is typed `bool?` — a flag meaning "this id is a VoIP token", not the token — and surfacing it would imply a VoIP-push story the SDK does not have. Neither has an in-tree consumer. Adding them later is non-breaking. @@ -65,9 +54,13 @@ means no new wire value ships untested. Note the server does configure providers under the empty name — omitting the key resolves to that default — so `''` is normalized because it always was, not because the server would reject it. -- **Mapping lives in the repository,** not in extension methods on generated types and not in a - separate mapper file. Here that is only request construction, which keeps `StreamChatClient` a pure - delegate. +- **Mapping happens in the repository,** on the `Result` the generated call returns, through the + extensions in `lib/src/repository/mapper/devices_mapper.dart`. `StreamChatClient` stays a pure + delegate and never names a generated type. +- **`OwnUser.devices` decodes through `DeviceV1JsonConverter`,** a temporary converter that reads and + writes the v1 keys `id` and `push_provider`. `OwnUser` still decodes the v1 `me` payload with + json_serializable and is persisted whole in `connection_events.own_user`, so its `devices` field + needs JSON that `Device` no longer carries. The converter is removed by [group 09](09-users.md). - **The wire contract is generator-owned, and deliberately not re-pinned here.** The deleted `device_api_test.dart` asserted verb, path and body-versus-query placement, because the hand-written api owned them. They now come from the spec through retrofit annotations, so @@ -75,9 +68,8 @@ covered: a regeneration that moved a parameter between query and body would pass CI. **This is the testing precedent for every later group** — mock at the `DefaultApi` seam, and let the generated client own the transport. -- **Generated response models are not given `fromJson` tests,** following group 04. Decoding is - exercised where the SDK owns the surface: `OwnUser.fromJson` pins every field of a device entry - and pins that a device missing one the server always sends fails to decode. +- **Mapping is tested from a fully populated generated response,** so a field the mapper drops shows + up as a failing assertion rather than a silent loss. - **`setPushPreferences` did not come along,** so `device_api.dart` was renamed `push_preferences_api.dart` (`DeviceApi` → `PushPreferencesApi`, `StreamChatApi.device` → `StreamChatApi.pushPreferences`) rather than deleted — the file split rather than migrating whole. @@ -87,8 +79,7 @@ ## Risks - **Request bodies carry explicit nulls — verified harmless.** No model under `lib/open_api/model/` sets `includeIfNull: false`, so `CreateDeviceRequest.toJson` emits `{"hardware_id":null,"id":"…","push_provider":"firebase","push_provider_name":null,"voip_token":null}` where the hand-written path omitted those keys. This is the first request *body* through the generated client, so it applies to **every** group from here on; a live `createDevice` accepted it. Recorded rather than fixed — if a later endpoint does mind, the fix is the generator's model template, never a hand-rolled request builder. -- Devices are **not** persisted — no entity, DAO or mapper. `OwnUser` *is*, inside `connection_events.own_user`, but v11's schema bump drops and recreates every table, so no v10 row survives to be read back against the new shape. A device registered by the published v10 SDK was read back through both `getDevices` and `me.devices` on connect. -- `pushProviderName` is re-derived from the app's configured providers on `GET /devices` but not on the `me` payload, so the same device can carry a name from `getDevices()` and `null` from `OwnUser.devices`. New surface rather than a regression — v10 did not expose the field at all. +- Devices are **not** persisted on their own — no entity, DAO or mapper. `OwnUser` *is*, inside `connection_events.own_user`, and its devices are written by `DeviceV1JsonConverter` under the same two keys v10 wrote. ## Definition of done diff --git a/openapi-migration/03-user-groups.md b/openapi-migration/03-user-groups.md index 2f68b54a16..6613a6f575 100644 --- a/openapi-migration/03-user-groups.md +++ b/openapi-migration/03-user-groups.md @@ -36,11 +36,12 @@ ## Decisions to make -- Several generated responses (`AddUserGroupMembersResponse`, `CreateUserGroupResponse`, …) wrap the same `UserGroupResponse`; decide whether our public API keeps distinct types or collapses them. +- Follows the [domain-model rules](README.md#domain-models): `UserGroup`, `UserGroupMember` and the seven v10 response envelopes stay public in their v10 shapes, as plain classes, mapped from the generated types in the repository. +- `Message.mentionedGroups` still decodes v1 JSON, so it needs a temporary `UserGroupV1JsonConverter` (removed by group 10), and the persistence mapper serializes `mentioned_groups` itself. ## Risks -- `UserGroup` and `UserGroupMember` collide by name with generated types — the export decision lands here first. +- `UserGroup` and `UserGroupMember` collide by name with generated types. Import the generated code with a prefix; the generated types are never exported. ## Definition of done diff --git a/openapi-migration/04-roles-guest-and-app.md b/openapi-migration/04-roles-guest-and-app.md index 77f40d578b..3d323983c4 100644 --- a/openapi-migration/04-roles-guest-and-app.md +++ b/openapi-migration/04-roles-guest-and-app.md @@ -32,8 +32,10 @@ ## Decisions taken -- **`Role` and `SearchRolesResponse` are the generated types.** They were field-for-field identical to - ours, so keeping ours meant maintaining two copies of one shape forever. +- **`Role` and `SearchRolesResponse` stay our public types, in their v10 shapes,** as plain classes + with no JSON, mapped from the generated types in `lib/src/repository/mapper/roles_mapper.dart`. The + group first adopted the generated types; it now follows the + [domain-model rules](README.md#domain-models). - **`RoleType` stays hand-written.** `searchRoles(roleType:)` accepts exactly `'user'` or `'channel'` and the server rejects anything else with a 400, but the v2 spec models `role_type` as an open string, so there is nothing generated to adopt. It is an `extension type const RoleType(String) diff --git a/openapi-migration/09-users.md b/openapi-migration/09-users.md index 894ddfda26..8c7ccda3ce 100644 --- a/openapi-migration/09-users.md +++ b/openapi-migration/09-users.md @@ -62,3 +62,5 @@ retyped but whose docs it left alone. - [ ] Tests follow [`TESTING.md`](../TESTING.md): no `group` organizing a file by method, each name states its subject and behaviour. +- [ ] Temporary adapters owned by this group (`DeviceV1JsonConverter`) are deleted and removed from + the table in `README.md`. diff --git a/openapi-migration/README.md b/openapi-migration/README.md index 01246f0d39..0a00f23eb8 100644 --- a/openapi-migration/README.md +++ b/openapi-migration/README.md @@ -44,22 +44,73 @@ one group. Verified mechanically — see [Keeping this plan honest](#keeping-thi - **Moving the WebSocket to v2.** It sends different event shapes and is its own project. Never fold it into a feature group. -- **Rewriting our public models wholesale.** Generated types are wire shapes; ours are often the better public - API. The default is to keep ours and map at the boundary. +- **Exposing the generated models.** Generated types are wire shapes, named after the requests they hang off. + They stay private, and the public API keeps our models — see [Domain models](#domain-models). - **Regenerating the client.** That is `openapi-codegen`, and it lands as its own PR. ## Principles - **One feature group per PR.** A group is a set of endpoints a caller thinks of together, and it moves across completely — half-migrated features are worse than unmigrated ones. -- **Default to keeping our shape.** Break only when it buys long-term maintainability (the alternative is - maintaining two shapes forever) or consistency with our other products. Not for cosmetics. +- **Keep our shape.** The public API keeps the v10 models, names and envelopes. Beyond `Result`, the only + sanctioned breaks are the ones [Domain models](#domain-models) lists. - **Every break ships four artifacts**: `refactor(llc)!:` title, `🛑️ Breaking` CHANGELOG entry, a Symbol Map row plus feature section in `migrations/v11-migration.md`, and the reason in the PR body. - **Decide once, at the right level.** The `User` shape is decided in [01-foundation](01-foundation.md), not re-argued per group. Errors and `Result` are decided in [`core-migration/03-errors.md`](../core-migration/03-errors.md). +## Domain models + +The generated client is an implementation detail. Every group follows these rules, and makes exactly these +breaks against v10: + +- public methods return `Result` instead of throwing; +- a write whose response carries only `duration` returns `Result` rather than `EmptyResponse`; +- public models and envelopes lose `fromJson` and `toJson`; +- envelopes are immutable, built through a const constructor rather than `late` setters; +- `duration` is a non-nullable `String` on every envelope, where v10 typed it `String?`; +- public models and envelopes are `@freezed`, so they compare by value; one that extended `Equatable` in v10 no + longer does, and loses `props`. + +Each ships with a CHANGELOG entry and a Symbol Map row like any other break. + + +1. **No generated type in a public signature.** `lib/stream_chat.dart` exports nothing from `open_api/`, and no + other package or the sample app imports it. `generate_plan.py --check` enforces both. +2. **Public models keep their v10 names, fields, nullability and defaults,** as `@freezed` classes (value + equality, `copyWith`, `toString`) with no `fromJson`, `toJson` or json_serializable. A field the server adds is exposed later, as an additive + change. +3. **Responses keep their v10 envelopes,** as `@freezed` classes carrying a non-nullable `duration` and the + payload, one file per class under `lib/src/core/models/`. A write whose response carries only + `duration` returns `Result`: `EmptyResponse` stays behind for the unmigrated APIs. +4. **Public methods return `Result`,** per [`core-migration/03-errors.md`](../core-migration/03-errors.md). +5. **Mapping happens in the repository,** on the `Result` the generated call returns + (`result.map((response) => response.toModel())`), through extensions in + `lib/src/repository/mapper/_mapper.dart`. The mappers are package-internal so later groups can compose + them. Repositories import the generated code with a prefix (`as api`), which keeps its names from colliding + with ours. +6. **Request enums are hand-written** and mapped to the generated enum in the repository (`PushProvider` → + `CreateDeviceRequestPushProvider`). +7. **A plain model embedded in a json_serializable parent gets a temporary converter.** Some parents still decode + v1 REST or WebSocket JSON with json_serializable; their field gets a `JsonConverter` in + `lib/src/core/models/converters/v1_json_converters.dart`, marked + `// TODO(openapi-migration): remove in group NN` and listed below. The group that migrates the parent deletes + it, and `generate_plan.py --check` fails if a ticked group leaves one behind. +8. **Persistence serializes our models itself.** A Drift mapper that stores a model as JSON text uses private + helpers in `stream_chat_persistence`, never a model's `fromJson` or `toJson`. The cache is disposable, so the + stored format is ours to choose. + +### Temporary adapters + +| Adapter | Field | Removed by | +| --- | --- | --- | +| `DeviceV1JsonConverter` | `OwnUser.devices` | [09](09-users.md) | + +Before group 09 starts, decide how v1 events decode a parent once it becomes a plain model: through the +generated types plus a shim that rebuilds `custom` from the flattened v1 keys, or through a private v1 decoder in +the WebSocket layer. Record the answer in [01-foundation](01-foundation.md). + ## Order, and why **[01-foundation](01-foundation.md) first, and it blocks everything.** After it, groups 02–07 can run in parallel; diff --git a/openapi-migration/tool/generate_plan.py b/openapi-migration/tool/generate_plan.py index 6d568bcddb..01d89d4244 100644 --- a/openapi-migration/tool/generate_plan.py +++ b/openapi-migration/tool/generate_plan.py @@ -7,9 +7,12 @@ Run from the repo root. Prose sections (goal, decisions, risks) live in GROUPS below; the tables are always derived from the code, so they cannot drift. -The report asserts two invariants: +The report asserts these invariants: * every public method in the hand-written api layer belongs to exactly one group * every operation in the generated client is claimed by exactly one group + * the stream_chat barrel exports nothing from the generated client + * no other package or the sample app imports the generated client + * no temporary adapter outlives the group that removes it A non-zero unclaimed count after a regeneration means the plan needs a new group or a wider path prefix — treat it as a plan bug, not a script bug. @@ -24,6 +27,15 @@ API_DIR = PKG / 'lib/src/core/api' GENERATED_API = PKG / 'lib/open_api/api/default_api.dart' OUT = pathlib.Path('openapi-migration') +BARREL = PKG / 'lib/stream_chat.dart' +CONSUMERS = [ + pathlib.Path('packages/stream_chat_flutter_core/lib'), + pathlib.Path('packages/stream_chat_flutter/lib'), + pathlib.Path('packages/stream_chat_persistence/lib'), + pathlib.Path('packages/stream_chat_localizations/lib'), + pathlib.Path('sample_app/lib'), +] +ADAPTER_TODO = re.compile(r'TODO\(openapi-migration\): remove in group (\d+)') def read_handwritten(): @@ -85,40 +97,29 @@ def match(path): 'no channel scope.', decisions=[], taken=textwrap.dedent("""\ - - **`Device` → generated `DeviceResponse`, adopted.** Our two fields dropped seven the server sends - (`user_id`, `created_at`, `disabled`, `disabled_reason`, `hardware_id`, `push_provider_name`, - `voip`), and the spec makes `OwnUserResponse.devices` a `List` regardless, so - keeping ours meant a lossy copy of one shape maintained forever. `created_at` and `user_id` are - required, and both are always sent: `user_id` is part of the devices table's composite primary - key, and neither field carries `omitempty` on the response struct. - - **`ListDevicesResponse` → the generated one, adopted.** Same-name shadow with nothing of ours to keep. - - **`PushProvider` is deleted; the generated `CreateDeviceRequestPushProvider` is the public type.** - **This is the enum precedent for every later group,** and it is deliberately *not* the same answer - as `RoleType` in group 04. The two cases differ in the generated code, not in taste: `role_type` is - a bare `String?` in the generated signature, so a hand-written `RoleType` adds a type where none - existed; `push_provider` already has a complete generated extension type with the same four values, - so hand-writing one would be a second copy that silently misses a fifth provider the spec adds - later. - - This started as a typedef aliasing the generated type to a better name, and that was reverted in - review. The rule for later groups is therefore: **adopt the generated type when one exists and is - complete, including its name, and hand-write only when the generated side has no type at all.** - Do not alias a generated type merely to rename it — an alias is a second name for one concept, and - it hides from the reader that the spec is what needs fixing. - - The name really is wrong: `CreateDeviceRequestPushProvider` is named for the request it hangs off, - not for the concept, and it is what a consumer writes and what hovers show. That is accepted as - temporary, because a spec change is prepared that renames these types. When it lands the fix is a - rename in one place rather than the unwinding of an alias. - - Costs, recorded in the migration guide: `.name` and `.values` are gone (v10 shipped an enum). - The `.values` loss also costs the test that asserted every provider was covered; an extension type - cannot enumerate itself, so a fifth provider is caught by the spec, not by this package's suite. - - **The write calls answer nothing.** `addDevice` and `removeDevice` return `Result` - rather than the generated `DurationResponse`, whose only field is a server-timing string no - integrator acts on. `stream_feeds` already does this, and it keeps `DurationResponse` off the - public surface entirely. **The precedent for every later group: a write that returns only an - envelope returns `Result`.** + Revisited after landing: the group first adopted the generated `DeviceResponse`, + `ListDevicesResponse` and `CreateDeviceRequestPushProvider` as public types. It now follows the + [domain-model rules](README.md#domain-models), and the decisions below are the ones in force. + + - **`Device` stays our public type, in its v10 shape** (`id`, `pushProvider`), as a plain class with + no JSON. The repository maps the generated `DeviceResponse` into it. The seven further fields the + server sends (`user_id`, `created_at`, `disabled`, `disabled_reason`, `hardware_id`, + `push_provider_name`, `voip`) are not exposed; adding any of them later is non-breaking. + - **`ListDevicesResponse` is hand-written,** under its v10 name, as a plain class carrying `duration` + and `devices`. An envelope rather than a bare list, so a field the server adds to the response can + be exposed without changing the method's signature. + - **`PushProvider` becomes an extension type over its wire string,** where v10 declared an enum, and + `Device.pushProvider` is typed with it rather than `String`. The server answers the provider as a + free-form string, so a device registered with a provider the SDK does not name still decodes, and a + provider added later is a new constant rather than a breaking enum value. The repository maps it to + the generated `CreateDeviceRequestPushProvider` by its wire value. **This is the enum precedent for + every later group:** a generated request enum gets a hand-written public type, so the generator's + naming never reaches a signature. + - **The write calls answer nothing.** `addDevice` and `removeDevice` return `Result`: the + generated `DurationResponse` carries only a server-timing string no integrator acts on, and v10's + `EmptyResponse` is a json_serializable, mutable envelope the domain-model rules retire. **The + precedent for every later group: a write whose response carries only `duration` returns + `Result`.** - **`hardwareId` and `voipToken` are left unset.** `voipToken` is typed `bool?` — a flag meaning "this id is a VoIP token", not the token — and surfacing it would imply a VoIP-push story the SDK does not have. Neither has an in-tree consumer. Adding them later is non-breaking. @@ -127,9 +128,13 @@ def match(path): means no new wire value ships untested. Note the server does configure providers under the empty name — omitting the key resolves to that default — so `''` is normalized because it always was, not because the server would reject it. - - **Mapping lives in the repository,** not in extension methods on generated types and not in a - separate mapper file. Here that is only request construction, which keeps `StreamChatClient` a pure - delegate. + - **Mapping happens in the repository,** on the `Result` the generated call returns, through the + extensions in `lib/src/repository/mapper/devices_mapper.dart`. `StreamChatClient` stays a pure + delegate and never names a generated type. + - **`OwnUser.devices` decodes through `DeviceV1JsonConverter`,** a temporary converter that reads and + writes the v1 keys `id` and `push_provider`. `OwnUser` still decodes the v1 `me` payload with + json_serializable and is persisted whole in `connection_events.own_user`, so its `devices` field + needs JSON that `Device` no longer carries. The converter is removed by [group 09](09-users.md). - **The wire contract is generator-owned, and deliberately not re-pinned here.** The deleted `device_api_test.dart` asserted verb, path and body-versus-query placement, because the hand-written api owned them. They now come from the spec through retrofit annotations, so @@ -137,9 +142,8 @@ def match(path): covered: a regeneration that moved a parameter between query and body would pass CI. **This is the testing precedent for every later group** — mock at the `DefaultApi` seam, and let the generated client own the transport. - - **Generated response models are not given `fromJson` tests,** following group 04. Decoding is - exercised where the SDK owns the surface: `OwnUser.fromJson` pins every field of a device entry - and pins that a device missing one the server always sends fails to decode. + - **Mapping is tested from a fully populated generated response,** so a field the mapper drops shows + up as a failing assertion rather than a silent loss. - **`setPushPreferences` did not come along,** so `device_api.dart` was renamed `push_preferences_api.dart` (`DeviceApi` → `PushPreferencesApi`, `StreamChatApi.device` → `StreamChatApi.pushPreferences`) rather than deleted — the file split rather than migrating whole. @@ -154,13 +158,9 @@ def match(path): '*body* through the generated client, so it applies to **every** group from here on; a live ' '`createDevice` accepted it. Recorded rather than fixed — if a later endpoint does mind, the fix ' "is the generator's model template, never a hand-rolled request builder.", - 'Devices are **not** persisted — no entity, DAO or mapper. `OwnUser` *is*, inside ' - "`connection_events.own_user`, but v11's schema bump drops and recreates every table, so no v10 " - 'row survives to be read back against the new shape. A device registered by the published v10 ' - 'SDK was read back through both `getDevices` and `me.devices` on connect.', - '`pushProviderName` is re-derived from the app\'s configured providers on `GET /devices` but not ' - 'on the `me` payload, so the same device can carry a name from `getDevices()` and `null` from ' - '`OwnUser.devices`. New surface rather than a regression — v10 did not expose the field at all.', + 'Devices are **not** persisted on their own — no entity, DAO or mapper. `OwnUser` *is*, inside ' + '`connection_events.own_user`, and its devices are written by `DeviceV1JsonConverter` under the ' + 'same two keys v10 wrote.', ], done=DONE.replace('- [ ]', '- [x]'), ), @@ -171,12 +171,15 @@ def match(path): goal='A clean 1:1 group — eight methods against eight generated operations, no client state, ' 'no persistence.', decisions=[ - 'Several generated responses (`AddUserGroupMembersResponse`, `CreateUserGroupResponse`, …) wrap the ' - 'same `UserGroupResponse`; decide whether our public API keeps distinct types or collapses them.', + 'Follows the [domain-model rules](README.md#domain-models): `UserGroup`, `UserGroupMember` and the ' + 'seven v10 response envelopes stay public in their v10 shapes, as plain classes, mapped from the ' + 'generated types in the repository.', + '`Message.mentionedGroups` still decodes v1 JSON, so it needs a temporary `UserGroupV1JsonConverter` ' + '(removed by group 10), and the persistence mapper serializes `mentioned_groups` itself.', ], risks=[ - '`UserGroup` and `UserGroupMember` collide by name with generated types — the export decision lands ' - 'here first.', + '`UserGroup` and `UserGroupMember` collide by name with generated types. Import the generated code ' + 'with a prefix; the generated types are never exported.', ], ), dict( @@ -190,8 +193,10 @@ def match(path): 'ours unless the generated one is genuinely better.', ], taken=textwrap.dedent("""\ - - **`Role` and `SearchRolesResponse` are the generated types.** They were field-for-field identical to - ours, so keeping ours meant maintaining two copies of one shape forever. + - **`Role` and `SearchRolesResponse` stay our public types, in their v10 shapes,** as plain classes + with no JSON, mapped from the generated types in `lib/src/repository/mapper/roles_mapper.dart`. The + group first adopted the generated types; it now follows the + [domain-model rules](README.md#domain-models). - **`RoleType` stays hand-written.** `searchRoles(roleType:)` accepts exactly `'user'` or `'channel'` and the server rejects anything else with a 400, but the v2 spec models `role_type` as an open string, so there is nothing generated to adopt. It is an `extension type const RoleType(String) @@ -295,6 +300,10 @@ def match(path): 'Every other group depends on the `User` decision.', 'User data arrives over the WebSocket on nearly every event.', ], + done=DONE + ( + '- [ ] Temporary adapters owned by this group (`DeviceV1JsonConverter`) are deleted and removed from\n' + ' the table in `README.md`.\n' + ), ), dict( num='10', slug='messages', title='Messages & Search', @@ -457,6 +466,38 @@ def render(g, hand, ops): return '\n'.join(L) +def generated_exports(): + """Barrel lines that export the generated client.""" + return [ + line.strip() + for line in BARREL.read_text().splitlines() + if re.match(r"export\s+'open_api/", line.strip()) + ] + + +def generated_imports(): + """(file, line) for every consumer file importing the generated client.""" + out = [] + for root in CONSUMERS: + for f in sorted(root.rglob('*.dart')): + for line in f.read_text().splitlines(): + if 'package:stream_chat/open_api/' in line: + out.append((f, line.strip())) + return out + + +def stale_adapters(): + """(file, group) for every temporary adapter whose removing group is done.""" + readme = (OUT / 'README.md').read_text() + done = set(re.findall(r'^\| \[(\d+)\]\([^)]*\) \|.*\| ☑ \|$', readme, re.MULTILINE)) + out = [] + for f in sorted(PKG.glob('lib/**/*.dart')): + for m in ADAPTER_TODO.finditer(f.read_text()): + if m.group(1) in done: + out.append((f, m.group(1))) + return out + + def main(): check_only = '--check' in sys.argv if not GENERATED_API.exists(): @@ -489,6 +530,12 @@ def main(): problems.append(f'method claimed by {v}: {k[0]}::{k[1]}') for k in sorted(all_methods - set(claimed_methods)): problems.append(f'method unclaimed: {k[0]}::{k[1]}') + for line in generated_exports(): + problems.append(f'barrel exports the generated client: {line}') + for f, line in generated_imports(): + problems.append(f'{f} imports the generated client: {line}') + for f, group in stale_adapters(): + problems.append(f'{f} keeps an adapter group {group} was meant to remove') print(f'groups: {len(GROUPS)}') print(f'hand-written methods: {len(all_methods)} across {len(hand)} files') diff --git a/packages/stream_chat/CHANGELOG.md b/packages/stream_chat/CHANGELOG.md index 13a97d8637..0946ca9c6a 100644 --- a/packages/stream_chat/CHANGELOG.md +++ b/packages/stream_chat/CHANGELOG.md @@ -44,12 +44,14 @@ - `client.wsConnectionStatus` and `wsConnectionStatusStream` become `connectionStatus` and `connectionStatusStream`. `ConnectionStatus` keeps its three values, and a client that has never connected still reads as `disconnected`. - The WebSocket's state — `Connected`, `Connecting`, `Authenticating`, `Disconnected` and the disconnection sources — is no longer exported, and the client no longer reports it. `ConnectionStatus` is the whole connection API, as on the other Stream SDKs. - `StreamHttpClient` and `StreamChatApi` take a `ConnectionIdGetter? connectionId` where they took a `ConnectionIdManager?`. The manager only wrapped such a closure, and is removed. -- `Role` and `SearchRolesResponse` are the OpenAPI-generated types. `Role` gains `copyWith` and `toJson`, and a response missing `duration` or `roles` now fails to decode instead of defaulting. - `StreamChatClient.searchRoles` returns a `Result` instead of throwing. -- `StreamChatClient.addDevice`, `getDevices` and `removeDevice` return a `Result` instead of throwing; `addDevice` and `removeDevice` answer nothing, `getDevices` a `ListDevicesResponse`. -- `Device` is replaced by the generated `DeviceResponse`, including in `OwnUser.devices`. It carries seven more fields, and `userId` and `createdAt` are required, so a device entry missing either now fails to decode. -- `ListDevicesResponse` is the generated type; `devices` and `duration` are required, so a response omitting either fails to decode instead of defaulting. -- `PushProvider` is removed in favour of the generated `CreateDeviceRequestPushProvider`, which `addDevice` now takes. It is an extension type over `String` rather than an enum, so the four values and their wire strings are unchanged, but `.name` and `.values` are gone — a provider is its own string. +- `StreamChatClient.getDevices` returns a `Result` instead of throwing. +- `StreamChatClient.addDevice` and `removeDevice` return a `Result` instead of throwing, and carry no value on success. +- `Device`, `Role`, `ListDevicesResponse` and `SearchRolesResponse` no longer decode from or encode to JSON. +- `PushProvider` is an extension type over its wire string instead of an enum, and `Device.pushProvider` is typed `PushProvider` instead of `String`. +- `ListDevicesResponse` and `SearchRolesResponse` are immutable, built through a const constructor, and their `duration` is a non-nullable `String`. +- `Device`, `ListDevicesResponse` and `SearchRolesResponse` compare by value and gain `copyWith`. +- `Role` no longer extends `Equatable`, so `props` is removed; it still compares by value and gains `copyWith`. - `StreamChatApi.device` is renamed `StreamChatApi.pushPreferences` and handles only `setPushPreferences`. 🐞 Fixed diff --git a/packages/stream_chat/lib/src/client/client.dart b/packages/stream_chat/lib/src/client/client.dart index 50f04b73c5..2adedc75d1 100644 --- a/packages/stream_chat/lib/src/client/client.dart +++ b/packages/stream_chat/lib/src/client/client.dart @@ -29,8 +29,7 @@ import 'package:stream_core/stream_core.dart' WsEvent; import 'package:synchronized/synchronized.dart'; -import '../../open_api/api.dart' - show CreateDeviceRequestPushProvider, DefaultApi, ListDevicesResponse, SearchRolesResponse; +import '../../open_api/api.dart' show DefaultApi; import '../../version.dart'; import '../core/api/attachment_file_uploader.dart'; import '../core/api/requests.dart'; @@ -46,6 +45,7 @@ import '../core/models/banned_user.dart'; import '../core/models/channel_state.dart'; import '../core/models/draft.dart'; import '../core/models/draft_message.dart'; +import '../core/models/list_devices_response.dart'; import '../core/models/location.dart'; import '../core/models/member.dart'; import '../core/models/message.dart'; @@ -56,8 +56,10 @@ import '../core/models/poll.dart'; import '../core/models/poll_option.dart'; import '../core/models/poll_vote.dart'; import '../core/models/push_preference.dart'; +import '../core/models/push_provider.dart'; import '../core/models/reaction.dart'; import '../core/models/role_type.dart'; +import '../core/models/search_roles_response.dart'; import '../core/models/thread.dart'; import '../core/models/user.dart'; import '../core/util/event_controller.dart'; @@ -107,7 +109,7 @@ class StreamChatClient { Duration connectTimeout = kDefaultConnectTimeout, Duration receiveTimeout = kDefaultReceiveTimeout, StreamChatApi? chatApi, - DefaultApi? defaultApi, + @internal DefaultApi? defaultApi, @visibleForTesting WebSocketProvider? wsProvider, AttachmentFileUploaderProvider attachmentFileUploaderProvider = StreamAttachmentFileUploader.new, Iterable? chatApiInterceptors, @@ -1210,7 +1212,7 @@ class StreamChatClient { /// [pushProvider] to use, for apps that have more than one. Future> addDevice( String id, - CreateDeviceRequestPushProvider pushProvider, { + PushProvider pushProvider, { String? pushProviderName, }) => _devicesRepository.addDevice( id, @@ -2480,6 +2482,11 @@ class StreamChatClient { /// Searches roles by name prefix (autocomplete). /// + /// [limit] caps how many roles come back in one page. + /// + /// [nameGt] is a cursor: only roles ordering after this name are returned. + /// Pass the last name of the previous page to read the next one. + /// /// [roleType] filters to user-assignable ([RoleType.user]) or /// channel-assignable ([RoleType.channel]) roles when set; both kinds are /// returned when omitted. diff --git a/packages/stream_chat/lib/src/core/models/converters/v1_json_converters.dart b/packages/stream_chat/lib/src/core/models/converters/v1_json_converters.dart new file mode 100644 index 0000000000..d77ca0742a --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/converters/v1_json_converters.dart @@ -0,0 +1,30 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; + +import '../device.dart'; +import '../push_provider.dart'; + +// Converters for plain models embedded in json_serializable models that still decode v1 JSON. Each one is deleted +// by the migration group that turns its parent into a plain model. + +/// Converts a [Device] to and from its v1 `id` and `push_provider` keys. +// TODO(openapi-migration): remove in group 09 +@internal +class DeviceV1JsonConverter implements JsonConverter> { + /// Creates a new [DeviceV1JsonConverter]. + const DeviceV1JsonConverter(); + + // Reads the keys directly rather than through the generated device type: that type requires `user_id` and + // `created_at`, which a device written by [toJson] does not carry. + @override + Device fromJson(Map json) => Device( + id: json['id'] as String, + pushProvider: PushProvider(json['push_provider'] as String), + ); + + @override + Map toJson(Device device) => { + 'id': device.id, + 'push_provider': device.pushProvider, + }; +} diff --git a/packages/stream_chat/lib/src/core/models/device.dart b/packages/stream_chat/lib/src/core/models/device.dart new file mode 100644 index 0000000000..56da509808 --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/device.dart @@ -0,0 +1,25 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +import 'push_provider.dart'; + +part 'device.freezed.dart'; + +/// A device registered to receive push notifications for the current user. +/// +/// Returned by [StreamChatClient.getDevices] and carried in [OwnUser.devices]. +@freezed +class Device with _$Device { + /// Creates a new [Device]. + const Device({ + required this.id, + required this.pushProvider, + }); + + /// The token the push provider issued for this device. + @override + final String id; + + /// The provider that delivers pushes to this device. + @override + final PushProvider pushProvider; +} diff --git a/packages/stream_chat/lib/src/core/models/device.freezed.dart b/packages/stream_chat/lib/src/core/models/device.freezed.dart new file mode 100644 index 0000000000..e602c33643 --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/device.freezed.dart @@ -0,0 +1,75 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'device.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$Device { + String get id; + PushProvider get pushProvider; + + /// Create a copy of Device + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $DeviceCopyWith get copyWith => _$DeviceCopyWithImpl(this as Device, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is Device && + (identical(other.id, id) || other.id == id) && + (identical(other.pushProvider, pushProvider) || other.pushProvider == pushProvider)); + } + + @override + int get hashCode => Object.hash(runtimeType, id, pushProvider); + + @override + String toString() { + return 'Device(id: $id, pushProvider: $pushProvider)'; + } +} + +/// @nodoc +abstract mixin class $DeviceCopyWith<$Res> { + factory $DeviceCopyWith(Device value, $Res Function(Device) _then) = _$DeviceCopyWithImpl; + @useResult + $Res call({String id, PushProvider pushProvider}); +} + +/// @nodoc +class _$DeviceCopyWithImpl<$Res> implements $DeviceCopyWith<$Res> { + _$DeviceCopyWithImpl(this._self, this._then); + + final Device _self; + final $Res Function(Device) _then; + + /// Create a copy of Device + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? id = null, Object? pushProvider = null}) { + return _then( + Device( + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + pushProvider: null == pushProvider + ? _self.pushProvider + : pushProvider // ignore: cast_nullable_to_non_nullable + as PushProvider, + ), + ); + } +} diff --git a/packages/stream_chat/lib/src/core/models/list_devices_response.dart b/packages/stream_chat/lib/src/core/models/list_devices_response.dart new file mode 100644 index 0000000000..85a6164ff7 --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/list_devices_response.dart @@ -0,0 +1,23 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +import 'device.dart'; + +part 'list_devices_response.freezed.dart'; + +/// The devices registered for the current user, returned by [StreamChatClient.getDevices]. +@freezed +class ListDevicesResponse with _$ListDevicesResponse { + /// Creates a new [ListDevicesResponse]. + const ListDevicesResponse({ + required this.duration, + this.devices = const [], + }); + + /// How long the server took to handle the request, such as `4.21ms`. + @override + final String duration; + + /// The devices registered for the current user. + @override + final List devices; +} diff --git a/packages/stream_chat/lib/src/core/models/list_devices_response.freezed.dart b/packages/stream_chat/lib/src/core/models/list_devices_response.freezed.dart new file mode 100644 index 0000000000..05b168ebbd --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/list_devices_response.freezed.dart @@ -0,0 +1,77 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'list_devices_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ListDevicesResponse { + String get duration; + List get devices; + + /// Create a copy of ListDevicesResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ListDevicesResponseCopyWith get copyWith => + _$ListDevicesResponseCopyWithImpl(this as ListDevicesResponse, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ListDevicesResponse && + (identical(other.duration, duration) || other.duration == duration) && + const DeepCollectionEquality().equals(other.devices, devices)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration, const DeepCollectionEquality().hash(devices)); + + @override + String toString() { + return 'ListDevicesResponse(duration: $duration, devices: $devices)'; + } +} + +/// @nodoc +abstract mixin class $ListDevicesResponseCopyWith<$Res> { + factory $ListDevicesResponseCopyWith(ListDevicesResponse value, $Res Function(ListDevicesResponse) _then) = + _$ListDevicesResponseCopyWithImpl; + @useResult + $Res call({String duration, List devices}); +} + +/// @nodoc +class _$ListDevicesResponseCopyWithImpl<$Res> implements $ListDevicesResponseCopyWith<$Res> { + _$ListDevicesResponseCopyWithImpl(this._self, this._then); + + final ListDevicesResponse _self; + final $Res Function(ListDevicesResponse) _then; + + /// Create a copy of ListDevicesResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? devices = null}) { + return _then( + ListDevicesResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + devices: null == devices + ? _self.devices + : devices // ignore: cast_nullable_to_non_nullable + as List, + ), + ); + } +} diff --git a/packages/stream_chat/lib/src/core/models/own_user.dart b/packages/stream_chat/lib/src/core/models/own_user.dart index c030bf4f4e..d509f02684 100644 --- a/packages/stream_chat/lib/src/core/models/own_user.dart +++ b/packages/stream_chat/lib/src/core/models/own_user.dart @@ -2,6 +2,7 @@ import 'package:json_annotation/json_annotation.dart'; import '../../../stream_chat.dart'; import '../util/serializer.dart'; +import 'converters/v1_json_converters.dart'; part 'own_user.g.dart'; @@ -63,7 +64,7 @@ class OwnUser extends User { DateTime? banExpires, List? teams, List? channelMutes, - List? devices, + List? devices, List? mutes, List? blockedUserIds, int? totalUnreadCount, @@ -140,8 +141,9 @@ class OwnUser extends User { ); } - /// List of user devices. - final List devices; + /// The devices registered for this user to receive push notifications. + @DeviceV1JsonConverter() + final List devices; /// List of users muted by the user. final List mutes; diff --git a/packages/stream_chat/lib/src/core/models/own_user.g.dart b/packages/stream_chat/lib/src/core/models/own_user.g.dart index f33991b6f5..7346fa9a00 100644 --- a/packages/stream_chat/lib/src/core/models/own_user.g.dart +++ b/packages/stream_chat/lib/src/core/models/own_user.g.dart @@ -8,7 +8,9 @@ part of 'own_user.dart'; OwnUser _$OwnUserFromJson(Map json) => OwnUser( devices: - (json['devices'] as List?)?.map((e) => DeviceResponse.fromJson(e as Map)).toList() ?? + (json['devices'] as List?) + ?.map((e) => const DeviceV1JsonConverter().fromJson(e as Map)) + .toList() ?? const [], mutes: (json['mutes'] as List?)?.map((e) => Mute.fromJson(e as Map)).toList() ?? const [], totalUnreadCount: (json['total_unread_count'] as num?)?.toInt() ?? 0, @@ -20,14 +22,10 @@ OwnUser _$OwnUserFromJson(Map json) => OwnUser( blockedUserIds: (json['blocked_user_ids'] as List?)?.map((e) => e as String).toList() ?? const [], pushPreferences: json['push_preferences'] == null ? null - : PushPreference.fromJson( - json['push_preferences'] as Map, - ), + : PushPreference.fromJson(json['push_preferences'] as Map), privacySettings: json['privacy_settings'] == null ? null - : PrivacySettings.fromJson( - json['privacy_settings'] as Map, - ), + : PrivacySettings.fromJson(json['privacy_settings'] as Map), id: json['id'] as String, role: json['role'] as String?, createdAt: json['created_at'] == null ? null : DateTime.parse(json['created_at'] as String), @@ -40,9 +38,7 @@ OwnUser _$OwnUserFromJson(Map json) => OwnUser( teams: (json['teams'] as List?)?.map((e) => e as String).toList() ?? const [], language: json['language'] as String?, invisible: json['invisible'] as bool?, - teamsRole: (json['teams_role'] as Map?)?.map( - (k, e) => MapEntry(k, e as String), - ), + teamsRole: (json['teams_role'] as Map?)?.map((k, e) => MapEntry(k, e as String)), avgResponseTime: (json['avg_response_time'] as num?)?.toInt(), ); @@ -61,7 +57,7 @@ Map _$OwnUserToJson(OwnUser instance) => { 'teams_role': ?instance.teamsRole, 'avg_response_time': ?instance.avgResponseTime, 'extra_data': instance.extraData, - 'devices': instance.devices.map((e) => e.toJson()).toList(), + 'devices': instance.devices.map(const DeviceV1JsonConverter().toJson).toList(), 'mutes': instance.mutes.map((e) => e.toJson()).toList(), 'channel_mutes': instance.channelMutes.map((e) => e.toJson()).toList(), 'total_unread_count': instance.totalUnreadCount, diff --git a/packages/stream_chat/lib/src/core/models/push_provider.dart b/packages/stream_chat/lib/src/core/models/push_provider.dart new file mode 100644 index 0000000000..5dc401d862 --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/push_provider.dart @@ -0,0 +1,17 @@ +/// A service that delivers push notifications to a device. +/// +/// Any provider the server supports can be named, including one without a +/// constant here, by wrapping its wire value: `PushProvider('firebase')`. +extension type const PushProvider(String rawType) implements String { + /// Google's Firebase Cloud Messaging. + static const firebase = PushProvider('firebase'); + + /// Huawei's Push Kit. + static const huawei = PushProvider('huawei'); + + /// Xiaomi's Mi Push Service. + static const xiaomi = PushProvider('xiaomi'); + + /// Apple's Push Notification service. + static const apn = PushProvider('apn'); +} diff --git a/packages/stream_chat/lib/src/core/models/role.dart b/packages/stream_chat/lib/src/core/models/role.dart new file mode 100644 index 0000000000..a8bd26815a --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/role.dart @@ -0,0 +1,36 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'role.freezed.dart'; + +/// A role that can be granted to a user or a channel member, returned by [StreamChatClient.searchRoles]. +@freezed +class Role with _$Role { + /// Creates a new [Role]. + const Role({ + required this.createdAt, + required this.custom, + required this.name, + required this.scopes, + required this.updatedAt, + }); + + /// The date when the role was created. + @override + final DateTime createdAt; + + /// Whether the role is a custom role (true) or a built-in role (false). + @override + final bool custom; + + /// The unique name of the role. + @override + final String name; + + /// The list of permission-grant scopes the role currently appears in. + @override + final List scopes; + + /// The date when the role was last updated. + @override + final DateTime updatedAt; +} diff --git a/packages/stream_chat/lib/src/core/models/role.freezed.dart b/packages/stream_chat/lib/src/core/models/role.freezed.dart new file mode 100644 index 0000000000..955e94bbbc --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/role.freezed.dart @@ -0,0 +1,100 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'role.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$Role { + DateTime get createdAt; + bool get custom; + String get name; + List get scopes; + DateTime get updatedAt; + + /// Create a copy of Role + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $RoleCopyWith get copyWith => _$RoleCopyWithImpl(this as Role, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is Role && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.custom, custom) || other.custom == custom) && + (identical(other.name, name) || other.name == name) && + const DeepCollectionEquality().equals(other.scopes, scopes) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)); + } + + @override + int get hashCode => + Object.hash(runtimeType, createdAt, custom, name, const DeepCollectionEquality().hash(scopes), updatedAt); + + @override + String toString() { + return 'Role(createdAt: $createdAt, custom: $custom, name: $name, scopes: $scopes, updatedAt: $updatedAt)'; + } +} + +/// @nodoc +abstract mixin class $RoleCopyWith<$Res> { + factory $RoleCopyWith(Role value, $Res Function(Role) _then) = _$RoleCopyWithImpl; + @useResult + $Res call({DateTime createdAt, bool custom, String name, List scopes, DateTime updatedAt}); +} + +/// @nodoc +class _$RoleCopyWithImpl<$Res> implements $RoleCopyWith<$Res> { + _$RoleCopyWithImpl(this._self, this._then); + + final Role _self; + final $Res Function(Role) _then; + + /// Create a copy of Role + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? createdAt = null, + Object? custom = null, + Object? name = null, + Object? scopes = null, + Object? updatedAt = null, + }) { + return _then( + Role( + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as bool, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + scopes: null == scopes + ? _self.scopes + : scopes // ignore: cast_nullable_to_non_nullable + as List, + updatedAt: null == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + ), + ); + } +} diff --git a/packages/stream_chat/lib/src/core/models/search_roles_response.dart b/packages/stream_chat/lib/src/core/models/search_roles_response.dart new file mode 100644 index 0000000000..5f95abb36c --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/search_roles_response.dart @@ -0,0 +1,23 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +import 'role.dart'; + +part 'search_roles_response.freezed.dart'; + +/// The roles matching a search, returned by [StreamChatClient.searchRoles]. +@freezed +class SearchRolesResponse with _$SearchRolesResponse { + /// Creates a new [SearchRolesResponse]. + const SearchRolesResponse({ + required this.duration, + this.roles = const [], + }); + + /// How long the server took to handle the request, such as `4.21ms`. + @override + final String duration; + + /// The roles whose names match the search, in the order the server returned them. + @override + final List roles; +} diff --git a/packages/stream_chat/lib/src/core/models/search_roles_response.freezed.dart b/packages/stream_chat/lib/src/core/models/search_roles_response.freezed.dart new file mode 100644 index 0000000000..529132d1ce --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/search_roles_response.freezed.dart @@ -0,0 +1,77 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'search_roles_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$SearchRolesResponse { + String get duration; + List get roles; + + /// Create a copy of SearchRolesResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $SearchRolesResponseCopyWith get copyWith => + _$SearchRolesResponseCopyWithImpl(this as SearchRolesResponse, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is SearchRolesResponse && + (identical(other.duration, duration) || other.duration == duration) && + const DeepCollectionEquality().equals(other.roles, roles)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration, const DeepCollectionEquality().hash(roles)); + + @override + String toString() { + return 'SearchRolesResponse(duration: $duration, roles: $roles)'; + } +} + +/// @nodoc +abstract mixin class $SearchRolesResponseCopyWith<$Res> { + factory $SearchRolesResponseCopyWith(SearchRolesResponse value, $Res Function(SearchRolesResponse) _then) = + _$SearchRolesResponseCopyWithImpl; + @useResult + $Res call({String duration, List roles}); +} + +/// @nodoc +class _$SearchRolesResponseCopyWithImpl<$Res> implements $SearchRolesResponseCopyWith<$Res> { + _$SearchRolesResponseCopyWithImpl(this._self, this._then); + + final SearchRolesResponse _self; + final $Res Function(SearchRolesResponse) _then; + + /// Create a copy of SearchRolesResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? roles = null}) { + return _then( + SearchRolesResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + roles: null == roles + ? _self.roles + : roles // ignore: cast_nullable_to_non_nullable + as List, + ), + ); + } +} diff --git a/packages/stream_chat/lib/src/repository/devices_repository.dart b/packages/stream_chat/lib/src/repository/devices_repository.dart index c55b6760fc..f07a3a93d7 100644 --- a/packages/stream_chat/lib/src/repository/devices_repository.dart +++ b/packages/stream_chat/lib/src/repository/devices_repository.dart @@ -1,14 +1,17 @@ -import 'package:stream_core/stream_core.dart' show Result; +import 'package:stream_core/stream_core.dart' show PatternMatching, Result; -import '../../open_api/api.dart' show DefaultApi; -import '../../open_api/models.dart' show CreateDeviceRequest, CreateDeviceRequestPushProvider, ListDevicesResponse; +import '../../open_api/api.dart' as api; +import '../core/models/list_devices_response.dart'; +import '../core/models/push_provider.dart'; +import 'mapper/devices_mapper.dart'; +import 'mapper/result_mapper.dart'; /// Repository dedicated to device operations. class DevicesRepository { /// Initialize a new devices repository. const DevicesRepository(this._api); - final DefaultApi _api; + final api.DefaultApi _api; /// Registers a device to receive push notifications. /// @@ -18,22 +21,32 @@ class DevicesRepository { /// [pushProvider] to use, for apps that have more than one. Future> addDevice( String id, - CreateDeviceRequestPushProvider pushProvider, { + PushProvider pushProvider, { String? pushProviderName, - }) => _api.createDevice( - createDeviceRequest: CreateDeviceRequest( - id: id, - pushProvider: pushProvider, - pushProviderName: switch (pushProviderName) { - final name? when name.isNotEmpty => name, - _ => null, - }, - ), - ); + }) async { + final result = await _api.createDevice( + createDeviceRequest: api.CreateDeviceRequest( + id: id, + pushProvider: pushProvider.toRequest(), + pushProviderName: switch (pushProviderName) { + final name? when name.isNotEmpty => name, + _ => null, + }, + ), + ); + + return result.ignoreValue(); + } /// Lists the devices registered for the current user. - Future> getDevices() => _api.listDevices(); + Future> getDevices() async { + final result = await _api.listDevices(); + return result.map((response) => response.toModel()); + } /// Removes a registered device, stopping push notifications to it. - Future> removeDevice(String id) => _api.deleteDevice(id: id); + Future> removeDevice(String id) async { + final result = await _api.deleteDevice(id: id); + return result.ignoreValue(); + } } diff --git a/packages/stream_chat/lib/src/repository/mapper/devices_mapper.dart b/packages/stream_chat/lib/src/repository/mapper/devices_mapper.dart new file mode 100644 index 0000000000..eb7d470a72 --- /dev/null +++ b/packages/stream_chat/lib/src/repository/mapper/devices_mapper.dart @@ -0,0 +1,25 @@ +import '../../../open_api/api.dart' as api; +import '../../core/models/device.dart'; +import '../../core/models/list_devices_response.dart'; +import '../../core/models/push_provider.dart'; + +/// Maps a generated [api.DeviceResponse] to a [Device]. +extension DeviceResponseMapper on api.DeviceResponse { + /// Converts this response into a [Device]. + Device toModel() => Device(id: id, pushProvider: PushProvider(pushProvider)); +} + +/// Maps a generated [api.ListDevicesResponse] to a [ListDevicesResponse]. +extension ListDevicesResponseMapper on api.ListDevicesResponse { + /// Converts this response into a [ListDevicesResponse]. + ListDevicesResponse toModel() => ListDevicesResponse( + duration: duration, + devices: [for (final device in devices) device.toModel()], + ); +} + +/// Maps a [PushProvider] to the generated request enum. +extension PushProviderMapper on PushProvider { + /// Converts this provider into an [api.CreateDeviceRequestPushProvider]. + api.CreateDeviceRequestPushProvider toRequest() => api.CreateDeviceRequestPushProvider.fromJson(rawType); +} diff --git a/packages/stream_chat/lib/src/repository/mapper/result_mapper.dart b/packages/stream_chat/lib/src/repository/mapper/result_mapper.dart new file mode 100644 index 0000000000..47cedfeab5 --- /dev/null +++ b/packages/stream_chat/lib/src/repository/mapper/result_mapper.dart @@ -0,0 +1,9 @@ +import 'package:stream_core/stream_core.dart' show PatternMatching, Result; + +/// Maps a [Result] to one that carries no value. +extension ResultMapper on Result { + /// Converts this result into a [Result] with no value. + /// + /// A failure is returned as it is, with its error and stack trace. + Result ignoreValue() => map((_) {}); +} diff --git a/packages/stream_chat/lib/src/repository/mapper/roles_mapper.dart b/packages/stream_chat/lib/src/repository/mapper/roles_mapper.dart new file mode 100644 index 0000000000..1b217ba9a7 --- /dev/null +++ b/packages/stream_chat/lib/src/repository/mapper/roles_mapper.dart @@ -0,0 +1,24 @@ +import '../../../open_api/api.dart' as api; +import '../../core/models/role.dart'; +import '../../core/models/search_roles_response.dart'; + +/// Maps a generated [api.Role] to a [Role]. +extension RoleMapper on api.Role { + /// Converts this generated role into a [Role]. + Role toModel() => Role( + createdAt: createdAt, + custom: custom, + name: name, + scopes: scopes, + updatedAt: updatedAt, + ); +} + +/// Maps a generated [api.SearchRolesResponse] to a [SearchRolesResponse]. +extension SearchRolesResponseMapper on api.SearchRolesResponse { + /// Converts this response into a [SearchRolesResponse]. + SearchRolesResponse toModel() => SearchRolesResponse( + duration: duration, + roles: [for (final role in roles) role.toModel()], + ); +} diff --git a/packages/stream_chat/lib/src/repository/roles_repository.dart b/packages/stream_chat/lib/src/repository/roles_repository.dart index aa5095b3eb..18dcaa539b 100644 --- a/packages/stream_chat/lib/src/repository/roles_repository.dart +++ b/packages/stream_chat/lib/src/repository/roles_repository.dart @@ -1,18 +1,24 @@ -import 'package:stream_core/stream_core.dart' show Result; +import 'package:stream_core/stream_core.dart' show PatternMatching, Result; -import '../../open_api/api.dart' show DefaultApi; -import '../../open_api/models.dart' show SearchRolesResponse; +import '../../open_api/api.dart' as api; import '../core/models/role_type.dart'; +import '../core/models/search_roles_response.dart'; +import 'mapper/roles_mapper.dart'; /// Repository dedicated to roles operations. class RolesRepository { /// Initialize a new roles repository. const RolesRepository(this._api); - final DefaultApi _api; + final api.DefaultApi _api; /// Searches roles by name prefix (autocomplete). /// + /// [limit] caps how many roles come back in one page. + /// + /// [nameGt] is a cursor: only roles ordering after this name are returned. + /// Pass the last name of the previous page to read the next one. + /// /// [roleType] filters to user-assignable ([RoleType.user]) or /// channel-assignable ([RoleType.channel]) roles when set; both kinds are /// returned when omitted. @@ -25,11 +31,15 @@ class RolesRepository { String? nameGt, RoleType? roleType, bool? includeGlobalRoles, - }) => _api.searchRoles( - query: query, - limit: limit, - nameGt: nameGt, - roleType: roleType, - includeGlobalRoles: includeGlobalRoles, - ); + }) async { + final result = await _api.searchRoles( + query: query, + limit: limit, + nameGt: nameGt, + roleType: roleType, + includeGlobalRoles: includeGlobalRoles, + ); + + return result.map((response) => response.toModel()); + } } diff --git a/packages/stream_chat/lib/stream_chat.dart b/packages/stream_chat/lib/stream_chat.dart index 79778a77b7..ea575e4a0f 100644 --- a/packages/stream_chat/lib/stream_chat.dart +++ b/packages/stream_chat/lib/stream_chat.dart @@ -63,12 +63,8 @@ export 'package:stream_core/stream_core.dart' UserToken, UserTokenLoader, WsEvent; - export 'package:uuid/uuid.dart'; -export 'open_api/models.dart' - show CreateDeviceRequestPushProvider, DeviceResponse, ListDevicesResponse, Role, SearchRolesResponse; - export 'src/client/channel/channel.dart'; export 'src/client/channel/channel_capability_check.dart'; export 'src/client/channel/channel_client_state.dart'; @@ -96,8 +92,10 @@ export 'src/core/models/channel_mute.dart'; export 'src/core/models/channel_state.dart'; export 'src/core/models/chat_preferences.dart'; export 'src/core/models/command.dart'; +export 'src/core/models/device.dart'; export 'src/core/models/draft.dart'; export 'src/core/models/draft_message.dart'; +export 'src/core/models/list_devices_response.dart'; export 'src/core/models/location.dart'; export 'src/core/models/member.dart'; export 'src/core/models/message.dart'; @@ -116,10 +114,13 @@ export 'src/core/models/predefined_filter.dart'; export 'src/core/models/privacy_settings.dart'; export 'src/core/models/push_level.dart'; export 'src/core/models/push_preference.dart'; +export 'src/core/models/push_provider.dart'; export 'src/core/models/reaction.dart'; export 'src/core/models/reaction_group.dart'; export 'src/core/models/read.dart'; +export 'src/core/models/role.dart'; export 'src/core/models/role_type.dart'; +export 'src/core/models/search_roles_response.dart'; export 'src/core/models/thread.dart'; export 'src/core/models/thread_participant.dart'; export 'src/core/models/unread_counts.dart'; diff --git a/packages/stream_chat/test/src/client/client_test.dart b/packages/stream_chat/test/src/client/client_test.dart index f55a8616be..3f1afeb361 100644 --- a/packages/stream_chat/test/src/client/client_test.dart +++ b/packages/stream_chat/test/src/client/client_test.dart @@ -3,8 +3,7 @@ import 'dart:async'; import 'package:mocktail/mocktail.dart'; -import 'package:stream_chat/open_api/api.dart' - show CreateDeviceRequest, CreateDeviceRequestPushProvider, DurationResponse; +import 'package:stream_chat/open_api/api.dart' as api; import 'package:stream_chat/src/ws/events/events.dart'; import 'package:stream_chat/stream_chat.dart'; import 'package:test/test.dart'; @@ -18,7 +17,7 @@ import '../ws/fake_chat_server.dart'; void main() { group('Fake web-socket connection functions', () { const apiKey = 'test-api-key'; - late final api = FakeChatApi(); + late final fakeChatApi = FakeChatApi(); late StreamChatClient client; @@ -29,7 +28,7 @@ void main() { setUp(() { final ws = FakeChatServer(); - client = StreamChatClient(apiKey, wsProvider: ws.connect, chatApi: api); + client = StreamChatClient(apiKey, wsProvider: ws.connect, chatApi: fakeChatApi); }); tearDown(() { @@ -74,7 +73,7 @@ void main() { final user = User(id: 'test-user-id'); final token = testUserToken(user.id).rawValue; - when(() => api.guest.getGuestUser(any(that: isSameUserAs(user)))).thenAnswer( + when(() => fakeChatApi.guest.getGuestUser(any(that: isSameUserAs(user)))).thenAnswer( (_) async => ConnectGuestUserResponse() ..user = user ..accessToken = token, @@ -91,7 +90,7 @@ void main() { expect(res, isSameUserAs(user)); verify( - () => api.guest.getGuestUser(any(that: isSameUserAs(user))), + () => fakeChatApi.guest.getGuestUser(any(that: isSameUserAs(user))), ).called(1); }); @@ -99,7 +98,7 @@ void main() { final user = User(id: 'test-user-id'); when( - () => api.guest.getGuestUser(any(that: isSameUserAs(user))), + () => fakeChatApi.guest.getGuestUser(any(that: isSameUserAs(user))), ).thenThrow(apiException(code: StreamErrorCode.inputError, statusCode: 400)); expectLater( @@ -117,7 +116,7 @@ void main() { ); verify( - () => api.guest.getGuestUser(any(that: isSameUserAs(user))), + () => fakeChatApi.guest.getGuestUser(any(that: isSameUserAs(user))), ).called(1); }); }); @@ -183,7 +182,7 @@ void main() { group('Fake web-socket connection functions failure', () { const apiKey = 'test-api-key'; - late final api = FakeChatApi(); + late final fakeChatApi = FakeChatApi(); late StreamChatClient client; @@ -194,7 +193,7 @@ void main() { setUp(() { final ws = FakeChatServer()..handshakeFails = true; - client = StreamChatClient(apiKey, chatApi: api, wsProvider: ws.connect); + client = StreamChatClient(apiKey, chatApi: fakeChatApi, wsProvider: ws.connect); }); tearDown(() { @@ -231,7 +230,7 @@ void main() { final user = User(id: 'test-user-id'); final token = testUserToken(user.id).rawValue; - when(() => api.guest.getGuestUser(any(that: isSameUserAs(user)))).thenAnswer( + when(() => fakeChatApi.guest.getGuestUser(any(that: isSameUserAs(user)))).thenAnswer( (_) async => ConnectGuestUserResponse() ..user = user ..accessToken = token, @@ -242,7 +241,7 @@ void main() { throwsA(isA()), ); verify( - () => api.guest.getGuestUser(any(that: isSameUserAs(user))), + () => fakeChatApi.guest.getGuestUser(any(that: isSameUserAs(user))), ).called(1); }); @@ -259,7 +258,7 @@ void main() { group('Connect user calls with `connectWebSocket`: false', () { const apiKey = 'test-api-key'; - late final api = FakeChatApi(); + late final fakeChatApi = FakeChatApi(); late StreamChatClient client; @@ -269,7 +268,7 @@ void main() { }); setUp(() { - client = StreamChatClient(apiKey, chatApi: api); + client = StreamChatClient(apiKey, chatApi: fakeChatApi); }); tearDown(() { @@ -312,7 +311,7 @@ void main() { final user = User(id: 'test-user-id'); final token = testUserToken(user.id).rawValue; - when(() => api.guest.getGuestUser(any(that: isSameUserAs(user)))).thenAnswer( + when(() => fakeChatApi.guest.getGuestUser(any(that: isSameUserAs(user)))).thenAnswer( (_) async => ConnectGuestUserResponse() ..user = user ..accessToken = token, @@ -326,7 +325,7 @@ void main() { expect(res, isSameUserAs(user)); expect(client.connectionStatus, ConnectionStatus.disconnected); verify( - () => api.guest.getGuestUser(any(that: isSameUserAs(user))), + () => fakeChatApi.guest.getGuestUser(any(that: isSameUserAs(user))), ).called(1); }); @@ -345,7 +344,7 @@ void main() { group('Fake web-socket connection function with failure and persistence', () { const apiKey = 'test-api-key'; - late final api = FakeChatApi(); + late final fakeChatApi = FakeChatApi(); late final persistence = MockPersistenceClient(); late StreamChatClient client; @@ -357,7 +356,8 @@ void main() { setUp(() { final ws = FakeChatServer()..handshakeFails = true; - client = StreamChatClient(apiKey, chatApi: api, wsProvider: ws.connect)..chatPersistenceClient = persistence; + client = StreamChatClient(apiKey, chatApi: fakeChatApi, wsProvider: ws.connect) + ..chatPersistenceClient = persistence; }); tearDown(() { @@ -424,7 +424,7 @@ void main() { ); when(persistence.getConnectionInfo).thenAnswer((_) async => event); - when(() => api.guest.getGuestUser(any(that: isSameUserAs(user)))).thenAnswer( + when(() => fakeChatApi.guest.getGuestUser(any(that: isSameUserAs(user)))).thenAnswer( (_) async => ConnectGuestUserResponse() ..user = user ..accessToken = token, @@ -436,8 +436,8 @@ void main() { verify(persistence.getConnectionInfo).called(1); verifyNoMoreInteractions(persistence); - verify(() => api.guest.getGuestUser(any(that: isSameUserAs(user)))).called(1); - verifyNoMoreInteractions(api.guest); + verify(() => fakeChatApi.guest.getGuestUser(any(that: isSameUserAs(user)))).called(1); + verifyNoMoreInteractions(fakeChatApi.guest); }, ); @@ -465,7 +465,7 @@ void main() { group('Client with connected user with persistence', () { const apiKey = 'test-api-key'; - late final api = FakeChatApi(); + late final fakeChatApi = FakeChatApi(); late final persistence = MockPersistenceClient(); final user = User(id: 'test-user-id'); @@ -488,7 +488,8 @@ void main() { // connection info before any test has had a chance to stub it. when(() => persistence.updateConnectionInfo(any())).thenAnswer((_) => Future.value()); final ws = FakeChatServer(); - client = StreamChatClient(apiKey, chatApi: api, wsProvider: ws.connect)..chatPersistenceClient = persistence; + client = StreamChatClient(apiKey, chatApi: fakeChatApi, wsProvider: ws.connect) + ..chatPersistenceClient = persistence; await client.connectUser(user, token); await delay(300); expect(client.persistenceEnabled, isTrue); @@ -521,7 +522,7 @@ void main() { reset(persistence); const cids = ['test-cid-1', 'test-cid-2', 'test-cid-3']; final lastSyncAt = DateTime.now(); - when(() => api.general.sync(cids, lastSyncAt)).thenAnswer( + when(() => fakeChatApi.general.sync(cids, lastSyncAt)).thenAnswer( (_) async => SyncResponse() ..events = [ Event( @@ -537,7 +538,7 @@ void main() { await client.sync(cids: cids, lastSyncAt: lastSyncAt); verify(() => persistence.updateLastSyncAt(any())).called(1); - verify(() => api.general.sync(cids, lastSyncAt)).called(1); + verify(() => fakeChatApi.general.sync(cids, lastSyncAt)).called(1); }, ); @@ -554,7 +555,7 @@ void main() { when(persistence.getChannelCids).thenAnswer((_) async => cids); when(persistence.getLastSyncAt).thenAnswer((_) async => lastSyncAt); - when(() => api.general.sync(cids, lastSyncAt)).thenAnswer( + when(() => fakeChatApi.general.sync(cids, lastSyncAt)).thenAnswer( (_) async => SyncResponse() ..events = [ Event( @@ -570,7 +571,7 @@ void main() { await client.sync(); verify(() => persistence.updateLastSyncAt(any())).called(1); - verify(() => api.general.sync(cids, lastSyncAt)).called(1); + verify(() => fakeChatApi.general.sync(cids, lastSyncAt)).called(1); verify(persistence.getChannelCids).called(1); verify(persistence.getLastSyncAt).called(1); }, @@ -608,7 +609,7 @@ void main() { ); when( - () => api.channel.queryChannels( + () => fakeChatApi.channel.queryChannels( filter: any(named: 'filter'), sort: any(named: 'sort'), state: any(named: 'state'), @@ -679,7 +680,7 @@ void main() { ).called(1); verify( - () => api.channel.queryChannels( + () => fakeChatApi.channel.queryChannels( filter: any(named: 'filter'), sort: any(named: 'sort'), state: any(named: 'state'), @@ -733,7 +734,7 @@ void main() { ).thenAnswer((_) async => QueryChannelsResponse()..channels = persistentChannelStates); when( - () => api.channel.queryChannels( + () => fakeChatApi.channel.queryChannels( filter: any(named: 'filter'), sort: any(named: 'sort'), state: any(named: 'state'), @@ -787,7 +788,7 @@ void main() { ).called(1); verify( - () => api.channel.queryChannels( + () => fakeChatApi.channel.queryChannels( filter: any(named: 'filter'), sort: any(named: 'sort'), state: any(named: 'state'), @@ -816,7 +817,7 @@ void main() { ); when( - () => api.channel.queryChannels( + () => fakeChatApi.channel.queryChannels( filter: filter, state: any(named: 'state'), watch: any(named: 'watch'), @@ -887,7 +888,7 @@ void main() { final resolvedSort = [ChannelSort.desc(ChannelSortField.lastMessageAt)]; when( - () => api.channel.queryChannels( + () => fakeChatApi.channel.queryChannels( predefinedFilter: filterName, filterValues: filterValues, sortValues: sortValues, @@ -1024,7 +1025,7 @@ void main() { ).thenAnswer((_) async => QueryChannelsResponse()..channels = const []); when( - () => api.channel.queryChannels( + () => fakeChatApi.channel.queryChannels( filter: any(named: 'filter'), sort: any(named: 'sort'), state: any(named: 'state'), @@ -1100,7 +1101,7 @@ void main() { ).thenAnswer((_) async => QueryChannelsResponse()..channels = const []); when( - () => api.channel.queryChannels( + () => fakeChatApi.channel.queryChannels( predefinedFilter: filterName, filterValues: filterValues, sortValues: sortValues, @@ -1175,7 +1176,7 @@ void main() { group('Client with connected user without persistence', () { const apiKey = 'test-api-key'; const userId = 'test-user-id'; - late final api = FakeChatApi(); + late final fakeChatApi = FakeChatApi(); late final defaultApi = MockDefaultApi(); final user = User(id: userId); @@ -1194,14 +1195,14 @@ void main() { setUp(() async { // Clear any accumulated interactions from a previous test so that - // verifyNoMoreInteractions on api.general stays accurate. - clearInteractions(api.general); + // verifyNoMoreInteractions on fakeChatApi.general stays accurate. + clearInteractions(fakeChatApi.general); clearInteractions(defaultApi); final ws = FakeChatServer(); - client = StreamChatClient(apiKey, chatApi: api, defaultApi: defaultApi, wsProvider: ws.connect); + client = StreamChatClient(apiKey, chatApi: fakeChatApi, defaultApi: defaultApi, wsProvider: ws.connect); // Stub getAppSettings so the background fetch after connectUser succeeds. - when(() => api.general.getAppSettings()).thenAnswer( + when(() => fakeChatApi.general.getAppSettings()).thenAnswer( (_) async => GetAppSettingsResponse()..app = const AppSettings(name: 'test'), ); await client.connectUser(user, token); @@ -1219,7 +1220,7 @@ void main() { const cids = ['test-cid-1', 'test-cid-2', 'test-cid-3']; final lastSyncAt = DateTime.now(); - when(() => api.general.sync(cids, lastSyncAt)).thenAnswer( + when(() => fakeChatApi.general.sync(cids, lastSyncAt)).thenAnswer( (_) async => SyncResponse() ..events = [ Event( @@ -1238,17 +1239,17 @@ void main() { await client.sync(cids: cids, lastSyncAt: lastSyncAt); - verify(() => api.general.sync(cids, lastSyncAt)).called(1); + verify(() => fakeChatApi.general.sync(cids, lastSyncAt)).called(1); }); test('should return if `cids` is not available', () async { expect(client.sync, returnsNormally); - verifyNever(() => api.general.sync(any(), any())); + verifyNever(() => fakeChatApi.general.sync(any(), any())); }); test('should return if `lastSyncAt` is not available', () async { expect(() => client.sync(cids: ['test-cid-1']), returnsNormally); - verifyNever(() => api.general.sync(any(), any())); + verifyNever(() => fakeChatApi.general.sync(any(), any())); }); }); @@ -1262,7 +1263,7 @@ void main() { ); when( - () => api.channel.queryChannels( + () => fakeChatApi.channel.queryChannels( filter: any(named: 'filter'), sort: any(named: 'sort'), state: any(named: 'state'), @@ -1286,7 +1287,7 @@ void main() { await delay(300); verify( - () => api.channel.queryChannels( + () => fakeChatApi.channel.queryChannels( filter: any(named: 'filter'), sort: any(named: 'sort'), state: any(named: 'state'), @@ -1303,7 +1304,7 @@ void main() { '''should rethrow if `.queryChannelsOnline` throws and persistence channels are empty''', () async { when( - () => api.channel.queryChannels( + () => fakeChatApi.channel.queryChannels( filter: any(named: 'filter'), sort: any(named: 'sort'), state: any(named: 'state'), @@ -1325,7 +1326,7 @@ void main() { await delay(300); verify( - () => api.channel.queryChannels( + () => fakeChatApi.channel.queryChannels( filter: any(named: 'filter'), sort: any(named: 'sort'), state: any(named: 'state'), @@ -1360,7 +1361,7 @@ void main() { // Slow down the API so all concurrent callers are guaranteed to be // in flight at the same time when the cache write happens. when( - () => api.channel.queryChannels( + () => fakeChatApi.channel.queryChannels( filter: any(named: 'filter'), sort: any(named: 'sort'), state: any(named: 'state'), @@ -1388,7 +1389,7 @@ void main() { // But only ONE HTTP request should have been issued. verify( - () => api.channel.queryChannels( + () => fakeChatApi.channel.queryChannels( filter: any(named: 'filter'), sort: any(named: 'sort'), state: any(named: 'state'), @@ -1416,7 +1417,7 @@ void main() { ); when( - () => api.channel.queryChannels( + () => fakeChatApi.channel.queryChannels( filter: any(named: 'filter'), sort: any(named: 'sort'), state: any(named: 'state'), @@ -1434,7 +1435,7 @@ void main() { await client.queryChannels().toList(); verify( - () => api.channel.queryChannels( + () => fakeChatApi.channel.queryChannels( filter: any(named: 'filter'), sort: any(named: 'sort'), state: any(named: 'state'), @@ -1454,7 +1455,7 @@ void main() { // The cache is keyed on a hash of the query parameters. Callers // with different filters/limits must each fire their own request. when( - () => api.channel.queryChannels( + () => fakeChatApi.channel.queryChannels( filter: any(named: 'filter'), sort: any(named: 'sort'), state: any(named: 'state'), @@ -1475,7 +1476,7 @@ void main() { ]); verify( - () => api.channel.queryChannels( + () => fakeChatApi.channel.queryChannels( filter: any(named: 'filter'), sort: any(named: 'sort'), state: any(named: 'state'), @@ -1496,7 +1497,7 @@ void main() { // awaiting the shared future should see the same error rather than // each firing its own retry request. when( - () => api.channel.queryChannels( + () => fakeChatApi.channel.queryChannels( filter: any(named: 'filter'), sort: any(named: 'sort'), state: any(named: 'state'), @@ -1530,7 +1531,7 @@ void main() { // But only ONE HTTP request was made — the rest piggybacked. verify( - () => api.channel.queryChannels( + () => fakeChatApi.channel.queryChannels( filter: any(named: 'filter'), sort: any(named: 'sort'), state: any(named: 'state'), @@ -1552,7 +1553,7 @@ void main() { ); when( - () => api.user.queryUsers( + () => fakeChatApi.user.queryUsers( presence: any(named: 'presence'), filter: any(named: 'filter'), sort: any(named: 'sort'), @@ -1573,14 +1574,14 @@ void main() { expect(res.users.length, users.length); verify( - () => api.user.queryUsers( + () => fakeChatApi.user.queryUsers( presence: any(named: 'presence'), filter: any(named: 'filter'), sort: any(named: 'sort'), pagination: any(named: 'pagination'), ), ).called(1); - verifyNoMoreInteractions(api.user); + verifyNoMoreInteractions(fakeChatApi.user); }); test('`.queryBannedUsers`', () async { @@ -1596,7 +1597,7 @@ void main() { final filter = BannedUserFilter.equal(BannedUserFilterField.channelCid, cid); when( - () => api.moderation.queryBannedUsers( + () => fakeChatApi.moderation.queryBannedUsers( filter: filter, sort: any(named: 'sort'), pagination: any(named: 'pagination'), @@ -1608,13 +1609,13 @@ void main() { expect(res.bans.length, bans.length); verify( - () => api.moderation.queryBannedUsers( + () => fakeChatApi.moderation.queryBannedUsers( filter: filter, sort: any(named: 'sort'), pagination: any(named: 'pagination'), ), ).called(1); - verifyNoMoreInteractions(api.moderation); + verifyNoMoreInteractions(fakeChatApi.moderation); }); test('`.search`', () async { @@ -1629,7 +1630,7 @@ void main() { ); when( - () => api.general.searchMessages( + () => fakeChatApi.general.searchMessages( filter, query: any(named: 'query'), sort: any(named: 'sort'), @@ -1643,7 +1644,7 @@ void main() { expect(res.results.length, messages.length); verify( - () => api.general.searchMessages( + () => fakeChatApi.general.searchMessages( filter, query: any(named: 'query'), sort: any(named: 'sort'), @@ -1651,8 +1652,8 @@ void main() { messageFilters: any(named: 'messageFilters'), ), ).called(1); - verify(() => api.general.getAppSettings()).called(1); - verifyNoMoreInteractions(api.general); + verify(() => fakeChatApi.general.getAppSettings()).called(1); + verifyNoMoreInteractions(fakeChatApi.general); }); test('`.sendFile`', () async { @@ -1663,15 +1664,15 @@ void main() { const fileUrl = 'test-file-url'; when( - () => api.fileUploader.sendFile(file, channelId, channelType), + () => fakeChatApi.fileUploader.sendFile(file, channelId, channelType), ).thenAnswer((_) async => SendFileResponse()..file = fileUrl); final res = await client.sendFile(file, channelId, channelType); expect(res, isNotNull); expect(res.file, fileUrl); - verify(() => api.fileUploader.sendFile(file, channelId, channelType)).called(1); - verifyNoMoreInteractions(api.fileUploader); + verify(() => fakeChatApi.fileUploader.sendFile(file, channelId, channelType)).called(1); + verifyNoMoreInteractions(fakeChatApi.fileUploader); }); test('`.sendImage`', () async { @@ -1682,15 +1683,15 @@ void main() { const fileUrl = 'test-image-url'; when( - () => api.fileUploader.sendImage(image, channelId, channelType), + () => fakeChatApi.fileUploader.sendImage(image, channelId, channelType), ).thenAnswer((_) async => SendImageResponse()..file = fileUrl); final res = await client.sendImage(image, channelId, channelType); expect(res, isNotNull); expect(res.file, fileUrl); - verify(() => api.fileUploader.sendImage(image, channelId, channelType)).called(1); - verifyNoMoreInteractions(api.fileUploader); + verify(() => fakeChatApi.fileUploader.sendImage(image, channelId, channelType)).called(1); + verifyNoMoreInteractions(fakeChatApi.fileUploader); }); test('`.deleteFile`', () async { @@ -1698,13 +1699,15 @@ void main() { const channelType = 'test-channel-type'; const fileUrl = 'test-file-url'; - when(() => api.fileUploader.deleteFile(fileUrl, channelId, channelType)).thenAnswer((_) async => EmptyResponse()); + when( + () => fakeChatApi.fileUploader.deleteFile(fileUrl, channelId, channelType), + ).thenAnswer((_) async => EmptyResponse()); final res = await client.deleteFile(fileUrl, channelId, channelType); expect(res, isNotNull); - verify(() => api.fileUploader.deleteFile(fileUrl, channelId, channelType)).called(1); - verifyNoMoreInteractions(api.fileUploader); + verify(() => fakeChatApi.fileUploader.deleteFile(fileUrl, channelId, channelType)).called(1); + verifyNoMoreInteractions(fakeChatApi.fileUploader); }); test('`.deleteImage`', () async { @@ -1713,68 +1716,72 @@ void main() { const imageUrl = 'test-image-url'; when( - () => api.fileUploader.deleteImage(imageUrl, channelId, channelType), + () => fakeChatApi.fileUploader.deleteImage(imageUrl, channelId, channelType), ).thenAnswer((_) async => EmptyResponse()); final res = await client.deleteImage(imageUrl, channelId, channelType); expect(res, isNotNull); verify( - () => api.fileUploader.deleteImage(imageUrl, channelId, channelType), + () => fakeChatApi.fileUploader.deleteImage(imageUrl, channelId, channelType), ).called(1); - verifyNoMoreInteractions(api.fileUploader); + verifyNoMoreInteractions(fakeChatApi.fileUploader); }); test('`.uploadImage`', () async { final image = AttachmentFile(size: 33, path: 'test-image-path'); const fileUrl = 'test-image-url'; - when(() => api.fileUploader.uploadImage(image)).thenAnswer((_) async => UploadImageResponse()..file = fileUrl); + when( + () => fakeChatApi.fileUploader.uploadImage(image), + ).thenAnswer((_) async => UploadImageResponse()..file = fileUrl); final res = await client.uploadImage(image); expect(res, isNotNull); expect(res.file, fileUrl); - verify(() => api.fileUploader.uploadImage(image)).called(1); - verifyNoMoreInteractions(api.fileUploader); + verify(() => fakeChatApi.fileUploader.uploadImage(image)).called(1); + verifyNoMoreInteractions(fakeChatApi.fileUploader); }); test('`.uploadFile`', () async { final file = AttachmentFile(size: 33, path: 'test-file-path'); const fileUrl = 'test-file-url'; - when(() => api.fileUploader.uploadFile(file)).thenAnswer((_) async => UploadFileResponse()..file = fileUrl); + when( + () => fakeChatApi.fileUploader.uploadFile(file), + ).thenAnswer((_) async => UploadFileResponse()..file = fileUrl); final res = await client.uploadFile(file); expect(res, isNotNull); expect(res.file, fileUrl); - verify(() => api.fileUploader.uploadFile(file)).called(1); - verifyNoMoreInteractions(api.fileUploader); + verify(() => fakeChatApi.fileUploader.uploadFile(file)).called(1); + verifyNoMoreInteractions(fakeChatApi.fileUploader); }); test('`.removeImage`', () async { const imageUrl = 'test-image-url'; - when(() => api.fileUploader.removeImage(imageUrl)).thenAnswer((_) async => EmptyResponse()); + when(() => fakeChatApi.fileUploader.removeImage(imageUrl)).thenAnswer((_) async => EmptyResponse()); final res = await client.removeImage(imageUrl); expect(res, isNotNull); - verify(() => api.fileUploader.removeImage(imageUrl)).called(1); - verifyNoMoreInteractions(api.fileUploader); + verify(() => fakeChatApi.fileUploader.removeImage(imageUrl)).called(1); + verifyNoMoreInteractions(fakeChatApi.fileUploader); }); test('`.removeFile`', () async { const fileUrl = 'test-file-url'; - when(() => api.fileUploader.removeFile(fileUrl)).thenAnswer((_) async => EmptyResponse()); + when(() => fakeChatApi.fileUploader.removeFile(fileUrl)).thenAnswer((_) async => EmptyResponse()); final res = await client.removeFile(fileUrl); expect(res, isNotNull); - verify(() => api.fileUploader.removeFile(fileUrl)).called(1); - verifyNoMoreInteractions(api.fileUploader); + verify(() => fakeChatApi.fileUploader.removeFile(fileUrl)).called(1); + verifyNoMoreInteractions(fakeChatApi.fileUploader); }); test('`.updateChannel`', () async { @@ -1782,7 +1789,7 @@ void main() { const channelType = 'test-channel-type'; const data = {'name': 'test-channel'}; - when(() => api.channel.updateChannel(channelId, channelType, data)).thenAnswer( + when(() => fakeChatApi.channel.updateChannel(channelId, channelType, data)).thenAnswer( (invocation) async => UpdateChannelResponse() ..channel = ChannelModel( id: channelId, @@ -1796,8 +1803,8 @@ void main() { expect(res.channel.cid, '$channelType:$channelId'); expect(res.channel.extraData['name'], 'test-channel'); - verify(() => api.channel.updateChannel(channelId, channelType, data)).called(1); - verifyNoMoreInteractions(api.channel); + verify(() => fakeChatApi.channel.updateChannel(channelId, channelType, data)).called(1); + verifyNoMoreInteractions(fakeChatApi.channel); }); test('`.updateChannelPartial`', () async { @@ -1809,7 +1816,7 @@ void main() { }; const unset = ['tag', 'last_name']; - when(() => api.channel.updateChannelPartial(channelId, channelType, set: set, unset: unset)).thenAnswer( + when(() => fakeChatApi.channel.updateChannelPartial(channelId, channelType, set: set, unset: unset)).thenAnswer( (invocation) async => PartialUpdateChannelResponse() ..channel = ChannelModel( id: channelId, @@ -1828,20 +1835,22 @@ void main() { expect(res.channel.cid, '$channelType:$channelId'); expect(res.channel.extraData, set); - verify(() => api.channel.updateChannelPartial(channelId, channelType, set: set, unset: unset)).called(1); - verifyNoMoreInteractions(api.channel); + verify(() => fakeChatApi.channel.updateChannelPartial(channelId, channelType, set: set, unset: unset)).called(1); + verifyNoMoreInteractions(fakeChatApi.channel); }); test('`.addDevice should work`', () async { const id = 'test-device-id'; - const provider = CreateDeviceRequestPushProvider.firebase; - const request = CreateDeviceRequest(id: id, pushProvider: provider); + const request = api.CreateDeviceRequest( + id: id, + pushProvider: api.CreateDeviceRequestPushProvider.firebase, + ); when(() => defaultApi.createDevice(createDeviceRequest: request)).thenAnswer( - (_) async => const Result.success(DurationResponse(duration: '0.01ms')), + (_) async => const Result.success(api.DurationResponse(duration: '0.01ms')), ); - final res = await client.addDevice(id, provider); + final res = await client.addDevice(id, PushProvider.firebase); expect(res.isSuccess, isTrue); verify(() => defaultApi.createDevice(createDeviceRequest: request)).called(1); @@ -1850,19 +1859,18 @@ void main() { test('`.addDevice should work with pushProviderName`', () async { const id = 'test-device-id'; - const provider = CreateDeviceRequestPushProvider.firebase; const pushProviderName = 'my-custom-config'; - const request = CreateDeviceRequest( + const request = api.CreateDeviceRequest( id: id, - pushProvider: provider, + pushProvider: api.CreateDeviceRequestPushProvider.firebase, pushProviderName: pushProviderName, ); when(() => defaultApi.createDevice(createDeviceRequest: request)).thenAnswer( - (_) async => const Result.success(DurationResponse(duration: '0.01ms')), + (_) async => const Result.success(api.DurationResponse(duration: '0.01ms')), ); - final res = await client.addDevice(id, provider, pushProviderName: pushProviderName); + final res = await client.addDevice(id, PushProvider.firebase, pushProviderName: pushProviderName); expect(res.isSuccess, isTrue); verify(() => defaultApi.createDevice(createDeviceRequest: request)).called(1); @@ -1871,16 +1879,16 @@ void main() { test('`.addDevice` surfaces a failure without throwing', () async { const error = StreamClientException(message: 'boom'); - const request = CreateDeviceRequest( + const request = api.CreateDeviceRequest( id: 'test-device-id', - pushProvider: CreateDeviceRequestPushProvider.firebase, + pushProvider: api.CreateDeviceRequestPushProvider.firebase, ); when(() => defaultApi.createDevice(createDeviceRequest: request)).thenAnswer( (_) async => const Result.failure(error), ); - final res = await client.addDevice('test-device-id', CreateDeviceRequestPushProvider.firebase); + final res = await client.addDevice('test-device-id', PushProvider.firebase); expect(res.isFailure, isTrue); expect(res.exceptionOrNull(), error); @@ -1889,20 +1897,20 @@ void main() { test('`.getDevices`', () async { final devices = List.generate( 3, - (index) => DeviceResponse( + (index) => api.DeviceResponse( id: 'test-device-id-$index', - pushProvider: CreateDeviceRequestPushProvider.firebase, + pushProvider: api.CreateDeviceRequestPushProvider.firebase, createdAt: DateTime.utc(2024), userId: userId, ), ); when(defaultApi.listDevices).thenAnswer( - (_) async => Result.success(ListDevicesResponse(duration: '0.01ms', devices: devices)), + (_) async => Result.success(api.ListDevicesResponse(duration: '0.01ms', devices: devices)), ); final res = await client.getDevices(); - expect(res.getOrNull()?.devices, devices); + expect(res.getOrNull()?.devices.map((it) => it.id), [for (final device in devices) device.id]); verify(defaultApi.listDevices).called(1); verifyNoMoreInteractions(defaultApi); @@ -1912,7 +1920,7 @@ void main() { const deviceId = 'test-device-id'; when(() => defaultApi.deleteDevice(id: deviceId)).thenAnswer( - (_) async => const Result.success(DurationResponse(duration: '0.01ms')), + (_) async => const Result.success(api.DurationResponse(duration: '0.01ms')), ); final res = await client.removeDevice(deviceId); @@ -1936,7 +1944,7 @@ void main() { const preferences = [pushPreferenceInput, channelPreferenceInput]; final currentUser = client.state.currentUser; - when(() => api.pushPreferences.setPushPreferences(preferences)).thenAnswer( + when(() => fakeChatApi.pushPreferences.setPushPreferences(preferences)).thenAnswer( (_) async => UpsertPushPreferencesResponse() ..userPreferences = { '${currentUser?.id}': PushPreference( @@ -1971,8 +1979,8 @@ void main() { final res = await client.setPushPreferences(preferences); expect(res, isNotNull); - verify(() => api.pushPreferences.setPushPreferences(preferences)).called(1); - verifyNoMoreInteractions(api.pushPreferences); + verify(() => fakeChatApi.pushPreferences.setPushPreferences(preferences)).called(1); + verifyNoMoreInteractions(fakeChatApi.pushPreferences); }); test('should handle push_preference.updated event', () async { @@ -2011,7 +2019,7 @@ void main() { const teamId = 'test-team-id'; when( - () => api.userGroups.listUserGroups( + () => fakeChatApi.userGroups.listUserGroups( limit: limit, idGt: idGt, createdAtGt: createdAtGt, @@ -2028,14 +2036,14 @@ void main() { expect(res, isNotNull); verify( - () => api.userGroups.listUserGroups( + () => fakeChatApi.userGroups.listUserGroups( limit: limit, idGt: idGt, createdAtGt: createdAtGt, teamId: teamId, ), ).called(1); - verifyNoMoreInteractions(api.userGroups); + verifyNoMoreInteractions(fakeChatApi.userGroups); }); test('`.searchUserGroups`', () async { @@ -2046,7 +2054,7 @@ void main() { const teamId = 'test-team-id'; when( - () => api.userGroups.searchUserGroups( + () => fakeChatApi.userGroups.searchUserGroups( query, limit: limit, nameGt: nameGt, @@ -2065,7 +2073,7 @@ void main() { expect(res, isNotNull); verify( - () => api.userGroups.searchUserGroups( + () => fakeChatApi.userGroups.searchUserGroups( query, limit: limit, nameGt: nameGt, @@ -2073,14 +2081,14 @@ void main() { teamId: teamId, ), ).called(1); - verifyNoMoreInteractions(api.userGroups); + verifyNoMoreInteractions(fakeChatApi.userGroups); }); test('`.getUserGroup`', () async { const id = 'test-group-id'; const teamId = 'test-team-id'; - when(() => api.userGroups.getUserGroup(id, teamId: teamId)).thenAnswer( + when(() => fakeChatApi.userGroups.getUserGroup(id, teamId: teamId)).thenAnswer( (_) async => GetUserGroupResponse() ..userGroup = UserGroup( id: id, @@ -2094,8 +2102,8 @@ void main() { expect(res, isNotNull); expect(res.userGroup.id, id); - verify(() => api.userGroups.getUserGroup(id, teamId: teamId)).called(1); - verifyNoMoreInteractions(api.userGroups); + verify(() => fakeChatApi.userGroups.getUserGroup(id, teamId: teamId)).called(1); + verifyNoMoreInteractions(fakeChatApi.userGroups); }); test('`.createUserGroup`', () async { @@ -2106,7 +2114,7 @@ void main() { const memberIds = ['user-1', 'user-2']; when( - () => api.userGroups.createUserGroup( + () => fakeChatApi.userGroups.createUserGroup( name, id: id, description: description, @@ -2136,7 +2144,7 @@ void main() { expect(res.userGroup.id, id); verify( - () => api.userGroups.createUserGroup( + () => fakeChatApi.userGroups.createUserGroup( name, id: id, description: description, @@ -2144,7 +2152,7 @@ void main() { memberIds: memberIds, ), ).called(1); - verifyNoMoreInteractions(api.userGroups); + verifyNoMoreInteractions(fakeChatApi.userGroups); }); test('`.updateUserGroup`', () async { @@ -2154,7 +2162,7 @@ void main() { const teamId = 'test-team-id'; when( - () => api.userGroups.updateUserGroup( + () => fakeChatApi.userGroups.updateUserGroup( id, name: name, description: description, @@ -2182,29 +2190,29 @@ void main() { expect(res.userGroup.name, name); verify( - () => api.userGroups.updateUserGroup( + () => fakeChatApi.userGroups.updateUserGroup( id, name: name, description: description, teamId: teamId, ), ).called(1); - verifyNoMoreInteractions(api.userGroups); + verifyNoMoreInteractions(fakeChatApi.userGroups); }); test('`.deleteUserGroup`', () async { const id = 'test-group-id'; const teamId = 'test-team-id'; - when(() => api.userGroups.deleteUserGroup(id, teamId: teamId)).thenAnswer( + when(() => fakeChatApi.userGroups.deleteUserGroup(id, teamId: teamId)).thenAnswer( (_) async => EmptyResponse(), ); final res = await client.deleteUserGroup(id, teamId: teamId); expect(res, isNotNull); - verify(() => api.userGroups.deleteUserGroup(id, teamId: teamId)).called(1); - verifyNoMoreInteractions(api.userGroups); + verify(() => fakeChatApi.userGroups.deleteUserGroup(id, teamId: teamId)).called(1); + verifyNoMoreInteractions(fakeChatApi.userGroups); }); test('`.addUserGroupMembers`', () async { @@ -2214,7 +2222,7 @@ void main() { const teamId = 'test-team-id'; when( - () => api.userGroups.addUserGroupMembers( + () => fakeChatApi.userGroups.addUserGroupMembers( id, memberIds, asAdmin: asAdmin, @@ -2239,14 +2247,14 @@ void main() { expect(res, isNotNull); verify( - () => api.userGroups.addUserGroupMembers( + () => fakeChatApi.userGroups.addUserGroupMembers( id, memberIds, asAdmin: asAdmin, teamId: teamId, ), ).called(1); - verifyNoMoreInteractions(api.userGroups); + verifyNoMoreInteractions(fakeChatApi.userGroups); }); test('`.removeUserGroupMembers`', () async { @@ -2255,7 +2263,7 @@ void main() { const teamId = 'test-team-id'; when( - () => api.userGroups.removeUserGroupMembers( + () => fakeChatApi.userGroups.removeUserGroupMembers( id, memberIds, teamId: teamId, @@ -2278,13 +2286,13 @@ void main() { expect(res, isNotNull); verify( - () => api.userGroups.removeUserGroupMembers( + () => fakeChatApi.userGroups.removeUserGroupMembers( id, memberIds, teamId: teamId, ), ).called(1); - verifyNoMoreInteractions(api.userGroups); + verifyNoMoreInteractions(fakeChatApi.userGroups); }); test('`.searchRoles`', () async { @@ -2303,7 +2311,7 @@ void main() { includeGlobalRoles: includeGlobalRoles, ), ).thenAnswer( - (_) async => const Result.success(SearchRolesResponse(duration: '0.01ms', roles: [])), + (_) async => const Result.success(api.SearchRolesResponse(duration: '0.01ms', roles: [])), ); final res = await client.searchRoles( @@ -2313,7 +2321,8 @@ void main() { roleType: roleType, includeGlobalRoles: includeGlobalRoles, ); - expect(res, const Result.success(SearchRolesResponse(duration: '0.01ms', roles: []))); + expect(res.getOrNull()?.duration, '0.01ms'); + expect(res.getOrNull()?.roles, isEmpty); verify( () => defaultApi.searchRoles( @@ -2377,7 +2386,7 @@ void main() { ); when( - () => api.channel.queryChannel( + () => fakeChatApi.channel.queryChannel( channelType, channelId: channelId, channelData: channelData, @@ -2403,7 +2412,7 @@ void main() { expect(newChannel, channel); verify( - () => api.channel.queryChannel( + () => fakeChatApi.channel.queryChannel( channelType, channelId: channelId, channelData: channelData, @@ -2429,7 +2438,7 @@ void main() { ); when( - () => api.channel.queryChannel( + () => fakeChatApi.channel.queryChannel( channelType, channelId: channelId, channelData: channelData, @@ -2457,7 +2466,7 @@ void main() { expect(channel.extraData, channelData); verify( - () => api.channel.queryChannel( + () => fakeChatApi.channel.queryChannel( channelType, channelId: channelId, channelData: channelData, @@ -2469,7 +2478,7 @@ void main() { watchersPagination: any(named: 'watchersPagination'), ), ).called(1); - verifyNoMoreInteractions(api.channel); + verifyNoMoreInteractions(fakeChatApi.channel); }); test('`.watchChannel`', () async { @@ -2483,7 +2492,7 @@ void main() { ); when( - () => api.channel.queryChannel( + () => fakeChatApi.channel.queryChannel( channelType, channelId: channelId, channelData: channelData, @@ -2511,7 +2520,7 @@ void main() { expect(channel.extraData, channelData); verify( - () => api.channel.queryChannel( + () => fakeChatApi.channel.queryChannel( channelType, channelId: channelId, channelData: channelData, @@ -2523,7 +2532,7 @@ void main() { watchersPagination: any(named: 'watchersPagination'), ), ).called(1); - verifyNoMoreInteractions(api.channel); + verifyNoMoreInteractions(fakeChatApi.channel); }); test('`.queryChannel`', () async { @@ -2537,7 +2546,7 @@ void main() { ); when( - () => api.channel.queryChannel( + () => fakeChatApi.channel.queryChannel( channelType, channelId: channelId, channelData: channelData, @@ -2565,7 +2574,7 @@ void main() { expect(channel.extraData, channelData); verify( - () => api.channel.queryChannel( + () => fakeChatApi.channel.queryChannel( channelType, channelId: channelId, channelData: channelData, @@ -2577,7 +2586,7 @@ void main() { watchersPagination: any(named: 'watchersPagination'), ), ).called(1); - verifyNoMoreInteractions(api.channel); + verifyNoMoreInteractions(fakeChatApi.channel); }); test('`.queryMembers`', () async { @@ -2588,7 +2597,7 @@ void main() { (index) => Member(userId: 'test-user-id-$index'), ); - when(() => api.general.queryMembers(channelType)).thenAnswer( + when(() => fakeChatApi.general.queryMembers(channelType)).thenAnswer( (_) async => QueryMembersResponse()..members = members, ); @@ -2596,67 +2605,67 @@ void main() { expect(res, isNotNull); expect(res.members.length, members.length); - verify(() => api.general.queryMembers(channelType)).called(1); - verify(() => api.general.getAppSettings()).called(1); - verifyNoMoreInteractions(api.general); + verify(() => fakeChatApi.general.queryMembers(channelType)).called(1); + verify(() => fakeChatApi.general.getAppSettings()).called(1); + verifyNoMoreInteractions(fakeChatApi.general); }); test('`.hideChannel`', () async { const channelType = 'test-channel-type'; const channelId = 'test-channel-id'; - when(() => api.channel.hideChannel(channelId, channelType)).thenAnswer((_) async => EmptyResponse()); + when(() => fakeChatApi.channel.hideChannel(channelId, channelType)).thenAnswer((_) async => EmptyResponse()); final res = await client.hideChannel(channelId, channelType); expect(res, isNotNull); - verify(() => api.channel.hideChannel(channelId, channelType)).called(1); - verifyNoMoreInteractions(api.channel); + verify(() => fakeChatApi.channel.hideChannel(channelId, channelType)).called(1); + verifyNoMoreInteractions(fakeChatApi.channel); }); test('`.showChannel`', () async { const channelType = 'test-channel-type'; const channelId = 'test-channel-id'; - when(() => api.channel.showChannel(channelId, channelType)).thenAnswer((_) async => EmptyResponse()); + when(() => fakeChatApi.channel.showChannel(channelId, channelType)).thenAnswer((_) async => EmptyResponse()); final res = await client.showChannel(channelId, channelType); expect(res, isNotNull); - verify(() => api.channel.showChannel(channelId, channelType)).called(1); - verifyNoMoreInteractions(api.channel); + verify(() => fakeChatApi.channel.showChannel(channelId, channelType)).called(1); + verifyNoMoreInteractions(fakeChatApi.channel); }); test('`.deleteChannel`', () async { const channelType = 'test-channel-type'; const channelId = 'test-channel-id'; - when(() => api.channel.deleteChannel(channelId, channelType)).thenAnswer((_) async => EmptyResponse()); + when(() => fakeChatApi.channel.deleteChannel(channelId, channelType)).thenAnswer((_) async => EmptyResponse()); final res = await client.deleteChannel(channelId, channelType); expect(res, isNotNull); - verify(() => api.channel.deleteChannel(channelId, channelType)).called(1); - verifyNoMoreInteractions(api.channel); + verify(() => fakeChatApi.channel.deleteChannel(channelId, channelType)).called(1); + verifyNoMoreInteractions(fakeChatApi.channel); }); test('`.truncateChannel`', () async { const channelType = 'test-channel-type'; const channelId = 'test-channel-id'; - when(() => api.channel.truncateChannel(channelId, channelType)).thenAnswer((_) async => EmptyResponse()); + when(() => fakeChatApi.channel.truncateChannel(channelId, channelType)).thenAnswer((_) async => EmptyResponse()); final res = await client.truncateChannel(channelId, channelType); expect(res, isNotNull); verify( - () => api.channel.truncateChannel(channelId, channelType), + () => fakeChatApi.channel.truncateChannel(channelId, channelType), ).called(1); - verifyNoMoreInteractions(api.channel); + verifyNoMoreInteractions(fakeChatApi.channel); }); test('`.muteChannel`', () async { @@ -2664,14 +2673,14 @@ void main() { const channelId = 'test-channel-id'; const channelCid = '$channelType:$channelId'; - when(() => api.moderation.muteChannel(channelCid)).thenAnswer((_) async => EmptyResponse()); + when(() => fakeChatApi.moderation.muteChannel(channelCid)).thenAnswer((_) async => EmptyResponse()); final res = await client.muteChannel(channelCid); expect(res, isNotNull); - verify(() => api.moderation.muteChannel(channelCid)).called(1); - verifyNoMoreInteractions(api.moderation); + verify(() => fakeChatApi.moderation.muteChannel(channelCid)).called(1); + verifyNoMoreInteractions(fakeChatApi.moderation); }); test('`.unmuteChannel`', () async { @@ -2679,14 +2688,14 @@ void main() { const channelId = 'test-channel-id'; const channelCid = '$channelType:$channelId'; - when(() => api.moderation.unmuteChannel(channelCid)).thenAnswer((_) async => EmptyResponse()); + when(() => fakeChatApi.moderation.unmuteChannel(channelCid)).thenAnswer((_) async => EmptyResponse()); final res = await client.unmuteChannel(channelCid); expect(res, isNotNull); - verify(() => api.moderation.unmuteChannel(channelCid)).called(1); - verifyNoMoreInteractions(api.moderation); + verify(() => fakeChatApi.moderation.unmuteChannel(channelCid)).called(1); + verifyNoMoreInteractions(fakeChatApi.moderation); }); test('`.partialMemberUpdate with userId`', () async { @@ -2697,7 +2706,7 @@ void main() { const unset = ['pinned']; when( - () => api.channel.updateMemberPartial( + () => fakeChatApi.channel.updateMemberPartial( channelId: channelId, channelType: channelType, set: set, @@ -2720,14 +2729,14 @@ void main() { expect(res.channelMember.userId, otherUserId); verify( - () => api.channel.updateMemberPartial( + () => fakeChatApi.channel.updateMemberPartial( channelId: channelId, channelType: channelType, set: set, unset: unset, ), ).called(1); - verifyNoMoreInteractions(api.channel); + verifyNoMoreInteractions(fakeChatApi.channel); }); test('`.partialMemberUpdate with current user`', () async { @@ -2737,7 +2746,7 @@ void main() { const unset = ['pinned']; when( - () => api.channel.updateMemberPartial( + () => fakeChatApi.channel.updateMemberPartial( channelId: channelId, channelType: channelType, set: set, @@ -2759,14 +2768,14 @@ void main() { expect(res, isNotNull); expect(res.channelMember.userId, userId); verify( - () => api.channel.updateMemberPartial( + () => fakeChatApi.channel.updateMemberPartial( channelId: channelId, channelType: channelType, set: set, unset: unset, ), ).called(1); - verifyNoMoreInteractions(api.channel); + verifyNoMoreInteractions(fakeChatApi.channel); }); test('`.pinChannel`', () async { @@ -2774,7 +2783,7 @@ void main() { const channelId = 'test-channel-id'; when( - () => api.channel.updateMemberPartial( + () => fakeChatApi.channel.updateMemberPartial( channelId: channelId, channelType: channelType, set: const MemberUpdatePayload(pinned: true).toJson(), @@ -2793,13 +2802,13 @@ void main() { expect(res, isNotNull); verify( - () => api.channel.updateMemberPartial( + () => fakeChatApi.channel.updateMemberPartial( channelId: channelId, channelType: channelType, set: const MemberUpdatePayload(pinned: true).toJson(), ), ).called(1); - verifyNoMoreInteractions(api.channel); + verifyNoMoreInteractions(fakeChatApi.channel); }); test('`.unpinChannel`', () async { @@ -2807,7 +2816,7 @@ void main() { const channelId = 'test-channel-id'; when( - () => api.channel.updateMemberPartial( + () => fakeChatApi.channel.updateMemberPartial( channelId: channelId, channelType: channelType, unset: [MemberUpdateType.pinned.name], @@ -2826,13 +2835,13 @@ void main() { expect(res, isNotNull); verify( - () => api.channel.updateMemberPartial( + () => fakeChatApi.channel.updateMemberPartial( channelId: channelId, channelType: channelType, unset: [MemberUpdateType.pinned.name], ), ).called(1); - verifyNoMoreInteractions(api.channel); + verifyNoMoreInteractions(fakeChatApi.channel); }); test('`.archiveChannel`', () async { @@ -2840,7 +2849,7 @@ void main() { const channelId = 'test-channel-id'; when( - () => api.channel.updateMemberPartial( + () => fakeChatApi.channel.updateMemberPartial( channelId: channelId, channelType: channelType, set: const MemberUpdatePayload(archived: true).toJson(), @@ -2859,13 +2868,13 @@ void main() { expect(res, isNotNull); verify( - () => api.channel.updateMemberPartial( + () => fakeChatApi.channel.updateMemberPartial( channelId: channelId, channelType: channelType, set: const MemberUpdatePayload(archived: true).toJson(), ), ).called(1); - verifyNoMoreInteractions(api.channel); + verifyNoMoreInteractions(fakeChatApi.channel); }); test('`.unarchiveChannel`', () async { @@ -2873,7 +2882,7 @@ void main() { const channelId = 'test-channel-id'; when( - () => api.channel.updateMemberPartial( + () => fakeChatApi.channel.updateMemberPartial( channelId: channelId, channelType: channelType, unset: [MemberUpdateType.archived.name], @@ -2892,13 +2901,13 @@ void main() { expect(res, isNotNull); verify( - () => api.channel.updateMemberPartial( + () => fakeChatApi.channel.updateMemberPartial( channelId: channelId, channelType: channelType, unset: [MemberUpdateType.archived.name], ), ).called(1); - verifyNoMoreInteractions(api.channel); + verifyNoMoreInteractions(fakeChatApi.channel); }); test('`.acceptChannelInvite`', () async { @@ -2907,15 +2916,15 @@ void main() { const channelCid = '$channelType:$channelId'; when( - () => api.channel.acceptChannelInvite(channelId, channelType), + () => fakeChatApi.channel.acceptChannelInvite(channelId, channelType), ).thenAnswer((_) async => AcceptInviteResponse()..channel = ChannelModel(cid: channelCid)); final res = await client.acceptChannelInvite(channelId, channelType); expect(res, isNotNull); expect(res.channel.cid, channelCid); - verify(() => api.channel.acceptChannelInvite(channelId, channelType)).called(1); - verifyNoMoreInteractions(api.channel); + verify(() => fakeChatApi.channel.acceptChannelInvite(channelId, channelType)).called(1); + verifyNoMoreInteractions(fakeChatApi.channel); }); test('`.rejectChannelInvite`', () async { @@ -2924,15 +2933,15 @@ void main() { const channelCid = '$channelType:$channelId'; when( - () => api.channel.rejectChannelInvite(channelId, channelType), + () => fakeChatApi.channel.rejectChannelInvite(channelId, channelType), ).thenAnswer((_) async => RejectInviteResponse()..channel = ChannelModel(cid: channelCid)); final res = await client.rejectChannelInvite(channelId, channelType); expect(res, isNotNull); expect(res.channel.cid, channelCid); - verify(() => api.channel.rejectChannelInvite(channelId, channelType)).called(1); - verifyNoMoreInteractions(api.channel); + verify(() => fakeChatApi.channel.rejectChannelInvite(channelId, channelType)).called(1); + verifyNoMoreInteractions(fakeChatApi.channel); }); test('`.addChannelMembers`', () async { @@ -2947,7 +2956,7 @@ void main() { final memberIds = members.map((e) => e.userId!).toList(growable: false); - when(() => api.channel.addMembers(channelId, channelType, memberIds)).thenAnswer( + when(() => fakeChatApi.channel.addMembers(channelId, channelType, memberIds)).thenAnswer( (_) async => AddMembersResponse() ..channel = ChannelModel(cid: channelCid) ..members = members, @@ -2964,9 +2973,9 @@ void main() { expect(res.members.length, memberIds.length); verify( - () => api.channel.addMembers(channelId, channelType, memberIds), + () => fakeChatApi.channel.addMembers(channelId, channelType, memberIds), ).called(1); - verifyNoMoreInteractions(api.channel); + verifyNoMoreInteractions(fakeChatApi.channel); }); test('`.addChannelMembers` with hideHistoryBefore', () async { @@ -2983,7 +2992,7 @@ void main() { final hideHistoryBefore = DateTime.parse('2024-01-01T00:00:00Z'); when( - () => api.channel.addMembers( + () => fakeChatApi.channel.addMembers( channelId, channelType, memberIds, @@ -3007,14 +3016,14 @@ void main() { expect(res.members.length, memberIds.length); verify( - () => api.channel.addMembers( + () => fakeChatApi.channel.addMembers( channelId, channelType, memberIds, hideHistoryBefore: hideHistoryBefore, ), ).called(1); - verifyNoMoreInteractions(api.channel); + verifyNoMoreInteractions(fakeChatApi.channel); }); test('`.removeChannelMembers`', () async { @@ -3029,7 +3038,7 @@ void main() { final memberIds = members.map((e) => e.userId!).toList(growable: false); - when(() => api.channel.removeMembers(channelId, channelType, memberIds)).thenAnswer( + when(() => fakeChatApi.channel.removeMembers(channelId, channelType, memberIds)).thenAnswer( (_) async => RemoveMembersResponse() ..channel = ChannelModel(cid: channelCid) ..members = members, @@ -3046,9 +3055,9 @@ void main() { expect(res.members.length, memberIds.length); verify( - () => api.channel.removeMembers(channelId, channelType, memberIds), + () => fakeChatApi.channel.removeMembers(channelId, channelType, memberIds), ).called(1); - verifyNoMoreInteractions(api.channel); + verifyNoMoreInteractions(fakeChatApi.channel); }); test('`.inviteChannelMembers`', () async { @@ -3063,7 +3072,7 @@ void main() { final memberIds = members.map((e) => e.userId!).toList(growable: false); - when(() => api.channel.inviteChannelMembers(channelId, channelType, memberIds)).thenAnswer( + when(() => fakeChatApi.channel.inviteChannelMembers(channelId, channelType, memberIds)).thenAnswer( (_) async => InviteMembersResponse() ..channel = ChannelModel(cid: channelCid) ..members = members, @@ -3079,21 +3088,21 @@ void main() { expect(res.channel.cid, channelCid); expect(res.members.length, memberIds.length); - verify(() => api.channel.inviteChannelMembers(channelId, channelType, memberIds)).called(1); - verifyNoMoreInteractions(api.channel); + verify(() => fakeChatApi.channel.inviteChannelMembers(channelId, channelType, memberIds)).called(1); + verifyNoMoreInteractions(fakeChatApi.channel); }); test('`.stopChannelWatching`', () async { const channelType = 'test-channel-type'; const channelId = 'test-channel-id'; - when(() => api.channel.stopWatching(channelId, channelType)).thenAnswer((_) async => EmptyResponse()); + when(() => fakeChatApi.channel.stopWatching(channelId, channelType)).thenAnswer((_) async => EmptyResponse()); final res = await client.stopChannelWatching(channelId, channelType); expect(res, isNotNull); - verify(() => api.channel.stopWatching(channelId, channelType)).called(1); - verifyNoMoreInteractions(api.channel); + verify(() => fakeChatApi.channel.stopWatching(channelId, channelType)).called(1); + verifyNoMoreInteractions(fakeChatApi.channel); }); test('`.sendAction`', () async { @@ -3103,7 +3112,7 @@ void main() { const formData = {'key': 'value'}; when( - () => api.message.sendAction(channelId, channelType, messageId, formData), + () => fakeChatApi.message.sendAction(channelId, channelType, messageId, formData), ).thenAnswer((_) async => SendActionResponse()); final res = await client.sendAction( @@ -3115,22 +3124,22 @@ void main() { expect(res, isNotNull); - verify(() => api.message.sendAction(channelId, channelType, messageId, formData)).called(1); - verifyNoMoreInteractions(api.message); + verify(() => fakeChatApi.message.sendAction(channelId, channelType, messageId, formData)).called(1); + verifyNoMoreInteractions(fakeChatApi.message); }); test('`.markChannelRead`', () async { const channelType = 'test-channel-type'; const channelId = 'test-channel-id'; - when(() => api.channel.markRead(channelId, channelType)).thenAnswer((_) async => EmptyResponse()); + when(() => fakeChatApi.channel.markRead(channelId, channelType)).thenAnswer((_) async => EmptyResponse()); final res = await client.markChannelRead(channelId, channelType); expect(res, isNotNull); - verify(() => api.channel.markRead(channelId, channelType)).called(1); - verifyNoMoreInteractions(api.channel); + verify(() => fakeChatApi.channel.markRead(channelId, channelType)).called(1); + verifyNoMoreInteractions(fakeChatApi.channel); }); test('`.markChannelUnread`', () async { @@ -3138,7 +3147,9 @@ void main() { const channelId = 'test-channel-id'; const messageId = 'test-message-id'; - when(() => api.channel.markUnread(channelId, channelType, messageId)).thenAnswer((_) async => EmptyResponse()); + when( + () => fakeChatApi.channel.markUnread(channelId, channelType, messageId), + ).thenAnswer((_) async => EmptyResponse()); final res = await client.markChannelUnread( channelId, @@ -3148,8 +3159,8 @@ void main() { expect(res, isNotNull); - verify(() => api.channel.markUnread(channelId, channelType, messageId)).called(1); - verifyNoMoreInteractions(api.channel); + verify(() => fakeChatApi.channel.markUnread(channelId, channelType, messageId)).called(1); + verifyNoMoreInteractions(fakeChatApi.channel); }); test('`.markChannelUnreadByTimestamp`', () async { @@ -3158,7 +3169,7 @@ void main() { final timestamp = DateTime.parse('2024-01-01T00:00:00Z'); when( - () => api.channel.markUnreadByTimestamp( + () => fakeChatApi.channel.markUnreadByTimestamp( channelId, channelType, timestamp, @@ -3174,13 +3185,13 @@ void main() { expect(res, isNotNull); verify( - () => api.channel.markUnreadByTimestamp( + () => fakeChatApi.channel.markUnreadByTimestamp( channelId, channelType, timestamp, ), ).called(1); - verifyNoMoreInteractions(api.channel); + verifyNoMoreInteractions(fakeChatApi.channel); }); test('`.createPoll`', () async { @@ -3192,7 +3203,7 @@ void main() { ], ); - when(() => api.polls.createPoll(poll)).thenAnswer( + when(() => fakeChatApi.polls.createPoll(poll)).thenAnswer( (_) async => CreatePollResponse()..poll = poll, ); @@ -3200,8 +3211,8 @@ void main() { expect(res, isNotNull); expect(res.poll, poll); - verify(() => api.polls.createPoll(poll)).called(1); - verifyNoMoreInteractions(api.polls); + verify(() => fakeChatApi.polls.createPoll(poll)).called(1); + verifyNoMoreInteractions(fakeChatApi.polls); }); test('`.getPoll`', () async { @@ -3215,7 +3226,7 @@ void main() { ], ); - when(() => api.polls.getPoll(pollId)).thenAnswer( + when(() => fakeChatApi.polls.getPoll(pollId)).thenAnswer( (_) async => GetPollResponse()..poll = poll, ); @@ -3223,8 +3234,8 @@ void main() { expect(res, isNotNull); expect(res.poll, poll); - verify(() => api.polls.getPoll(pollId)).called(1); - verifyNoMoreInteractions(api.polls); + verify(() => fakeChatApi.polls.getPoll(pollId)).called(1); + verifyNoMoreInteractions(fakeChatApi.polls); }); test('`.updatePoll`', () async { @@ -3237,7 +3248,7 @@ void main() { ], ); - when(() => api.polls.updatePoll(poll)).thenAnswer( + when(() => fakeChatApi.polls.updatePoll(poll)).thenAnswer( (_) async => UpdatePollResponse()..poll = poll, ); @@ -3245,8 +3256,8 @@ void main() { expect(res, isNotNull); expect(res.poll, poll); - verify(() => api.polls.updatePoll(poll)).called(1); - verifyNoMoreInteractions(api.polls); + verify(() => fakeChatApi.polls.updatePoll(poll)).called(1); + verifyNoMoreInteractions(fakeChatApi.polls); }); test('`.partialUpdatePoll`', () async { @@ -3264,7 +3275,7 @@ void main() { ); when( - () => api.polls.partialUpdatePoll(pollId, set: set, unset: unset), + () => fakeChatApi.polls.partialUpdatePoll(pollId, set: set, unset: unset), ).thenAnswer((_) async => UpdatePollResponse()..poll = poll); final res = await client.partialUpdatePoll(pollId, set: set, unset: unset); @@ -3272,34 +3283,34 @@ void main() { expect(res.poll.id, pollId); expect(res.poll.name, set['name']); - verify(() => api.polls.partialUpdatePoll(pollId, set: set, unset: unset)).called(1); - verifyNoMoreInteractions(api.polls); + verify(() => fakeChatApi.polls.partialUpdatePoll(pollId, set: set, unset: unset)).called(1); + verifyNoMoreInteractions(fakeChatApi.polls); }); test('`.deletePoll`', () async { const pollId = 'test-poll-id'; - when(() => api.polls.deletePoll(pollId)).thenAnswer((_) async => EmptyResponse()); + when(() => fakeChatApi.polls.deletePoll(pollId)).thenAnswer((_) async => EmptyResponse()); final res = await client.deletePoll(pollId); expect(res, isNotNull); - verify(() => api.polls.deletePoll(pollId)).called(1); - verifyNoMoreInteractions(api.polls); + verify(() => fakeChatApi.polls.deletePoll(pollId)).called(1); + verifyNoMoreInteractions(fakeChatApi.polls); }); test('`.closePoll`', () async { const pollId = 'test-poll-id'; when( - () => api.polls.partialUpdatePoll(pollId, set: {'is_closed': true}), + () => fakeChatApi.polls.partialUpdatePoll(pollId, set: {'is_closed': true}), ).thenAnswer((_) async => UpdatePollResponse()); final res = await client.closePoll(pollId); expect(res, isNotNull); - verify(() => api.polls.partialUpdatePoll(pollId, set: {'is_closed': true})).called(1); - verifyNoMoreInteractions(api.polls); + verify(() => fakeChatApi.polls.partialUpdatePoll(pollId, set: {'is_closed': true})).called(1); + verifyNoMoreInteractions(fakeChatApi.polls); }); test('`.createPollOption`', () async { @@ -3307,15 +3318,15 @@ void main() { const option = PollOption(text: 'Red'); when( - () => api.polls.createPollOption(pollId, option), + () => fakeChatApi.polls.createPollOption(pollId, option), ).thenAnswer((_) async => CreatePollOptionResponse()..pollOption = option); final res = await client.createPollOption(pollId, option); expect(res, isNotNull); expect(res.pollOption, option); - verify(() => api.polls.createPollOption(pollId, option)).called(1); - verifyNoMoreInteractions(api.polls); + verify(() => fakeChatApi.polls.createPollOption(pollId, option)).called(1); + verifyNoMoreInteractions(fakeChatApi.polls); }); test('`.getPollOption`', () async { @@ -3324,15 +3335,15 @@ void main() { const option = PollOption(id: optionId, text: 'Red'); when( - () => api.polls.getPollOption(pollId, optionId), + () => fakeChatApi.polls.getPollOption(pollId, optionId), ).thenAnswer((_) async => GetPollOptionResponse()..pollOption = option); final res = await client.getPollOption(pollId, optionId); expect(res, isNotNull); expect(res.pollOption, option); - verify(() => api.polls.getPollOption(pollId, optionId)).called(1); - verifyNoMoreInteractions(api.polls); + verify(() => fakeChatApi.polls.getPollOption(pollId, optionId)).called(1); + verifyNoMoreInteractions(fakeChatApi.polls); }); test('`.updatePollOption`', () async { @@ -3340,28 +3351,28 @@ void main() { const option = PollOption(id: 'test-option-id', text: 'Red'); when( - () => api.polls.updatePollOption(pollId, option), + () => fakeChatApi.polls.updatePollOption(pollId, option), ).thenAnswer((_) async => UpdatePollOptionResponse()..pollOption = option); final res = await client.updatePollOption(pollId, option); expect(res, isNotNull); expect(res.pollOption, option); - verify(() => api.polls.updatePollOption(pollId, option)).called(1); - verifyNoMoreInteractions(api.polls); + verify(() => fakeChatApi.polls.updatePollOption(pollId, option)).called(1); + verifyNoMoreInteractions(fakeChatApi.polls); }); test('`.deletePollOption`', () async { const pollId = 'test-poll-id'; const optionId = 'test-option-id'; - when(() => api.polls.deletePollOption(pollId, optionId)).thenAnswer((_) async => EmptyResponse()); + when(() => fakeChatApi.polls.deletePollOption(pollId, optionId)).thenAnswer((_) async => EmptyResponse()); final res = await client.deletePollOption(pollId, optionId); expect(res, isNotNull); - verify(() => api.polls.deletePollOption(pollId, optionId)).called(1); - verifyNoMoreInteractions(api.polls); + verify(() => fakeChatApi.polls.deletePollOption(pollId, optionId)).called(1); + verifyNoMoreInteractions(fakeChatApi.polls); }); test('`.castPollVote`', () async { @@ -3377,15 +3388,15 @@ void main() { ); when( - () => api.polls.castPollVote(messageId, pollId, any(that: matchesVoteOption(optionId))), + () => fakeChatApi.polls.castPollVote(messageId, pollId, any(that: matchesVoteOption(optionId))), ).thenAnswer((_) async => CastPollVoteResponse()..vote = vote); final res = await client.castPollVote(messageId, pollId, optionId: optionId); expect(res, isNotNull); expect(res.vote, vote); - verify(() => api.polls.castPollVote(messageId, pollId, any(that: matchesVoteOption(optionId)))).called(1); - verifyNoMoreInteractions(api.polls); + verify(() => fakeChatApi.polls.castPollVote(messageId, pollId, any(that: matchesVoteOption(optionId)))).called(1); + verifyNoMoreInteractions(fakeChatApi.polls); }); test('`.addPollAnswer`', () async { @@ -3401,15 +3412,17 @@ void main() { ); when( - () => api.polls.castPollVote(messageId, pollId, any(that: matchesVoteAnswer(answerText))), + () => fakeChatApi.polls.castPollVote(messageId, pollId, any(that: matchesVoteAnswer(answerText))), ).thenAnswer((_) async => CastPollVoteResponse()..vote = vote); final res = await client.addPollAnswer(messageId, pollId, answerText: answerText); expect(res, isNotNull); expect(res.vote, vote); - verify(() => api.polls.castPollVote(messageId, pollId, any(that: matchesVoteAnswer(answerText)))).called(1); - verifyNoMoreInteractions(api.polls); + verify( + () => fakeChatApi.polls.castPollVote(messageId, pollId, any(that: matchesVoteAnswer(answerText))), + ).called(1); + verifyNoMoreInteractions(fakeChatApi.polls); }); test('`.removePollVote`', () async { @@ -3417,13 +3430,15 @@ void main() { const pollId = 'test-poll-id'; const voteId = 'test-vote-id'; - when(() => api.polls.removePollVote(messageId, pollId, voteId)).thenAnswer((_) async => RemovePollVoteResponse()); + when( + () => fakeChatApi.polls.removePollVote(messageId, pollId, voteId), + ).thenAnswer((_) async => RemovePollVoteResponse()); final res = await client.removePollVote(messageId, pollId, voteId); expect(res, isNotNull); - verify(() => api.polls.removePollVote(messageId, pollId, voteId)).called(1); - verifyNoMoreInteractions(api.polls); + verify(() => fakeChatApi.polls.removePollVote(messageId, pollId, voteId)).called(1); + verifyNoMoreInteractions(fakeChatApi.polls); }); test('`.queryPolls`', () async { @@ -3444,7 +3459,7 @@ void main() { ); when( - () => api.polls.queryPolls( + () => fakeChatApi.polls.queryPolls( filter: filter, sort: sort, pagination: pagination, @@ -3462,13 +3477,13 @@ void main() { expect(res.polls.length, polls.length); verify( - () => api.polls.queryPolls( + () => fakeChatApi.polls.queryPolls( filter: filter, sort: sort, pagination: pagination, ), ).called(1); - verifyNoMoreInteractions(api.polls); + verifyNoMoreInteractions(fakeChatApi.polls); }); test('`.queryPollVotes`', () async { @@ -3483,7 +3498,7 @@ void main() { ); when( - () => api.polls.queryPollVotes( + () => fakeChatApi.polls.queryPollVotes( pollId, filter: filter, sort: sort, @@ -3503,14 +3518,14 @@ void main() { expect(res.votes.length, votes.length); verify( - () => api.polls.queryPollVotes( + () => fakeChatApi.polls.queryPollVotes( pollId, filter: filter, sort: sort, pagination: pagination, ), ).called(1); - verifyNoMoreInteractions(api.polls); + verifyNoMoreInteractions(fakeChatApi.polls); }); test('`.updateUser`', () async { @@ -3519,15 +3534,17 @@ void main() { extraData: const {'name': 'test-user'}, ); - when(() => api.user.updateUsers([user])).thenAnswer((_) async => UpdateUsersResponse()..users = {user.id: user}); + when( + () => fakeChatApi.user.updateUsers([user]), + ).thenAnswer((_) async => UpdateUsersResponse()..users = {user.id: user}); final res = await client.updateUser(user); expect(res, isNotNull); expect(res.users, {user.id: user}); - verify(() => api.user.updateUsers([user])).called(1); - verifyNoMoreInteractions(api.user); + verify(() => fakeChatApi.user.updateUsers([user])).called(1); + verifyNoMoreInteractions(fakeChatApi.user); }); test('`.partialUpdateUser`', () async { @@ -3547,7 +3564,7 @@ void main() { extraData: {'color': set['color']}, ); - when(() => api.user.partialUpdateUsers([partialUpdateRequest])).thenAnswer( + when(() => fakeChatApi.user.partialUpdateUsers([partialUpdateRequest])).thenAnswer( (_) async => UpdateUsersResponse() ..users = { updatedUser.id: updatedUser, @@ -3564,16 +3581,16 @@ void main() { expect(res.users, {updatedUser.id: updatedUser}); verify( - () => api.user.partialUpdateUsers([partialUpdateRequest]), + () => fakeChatApi.user.partialUpdateUsers([partialUpdateRequest]), ).called(1); - verifyNoMoreInteractions(api.user); + verifyNoMoreInteractions(fakeChatApi.user); }); test('`.banUser`', () async { const userId = 'test-user-id'; when( - () => api.moderation.banUser(userId, options: any(named: 'options')), + () => fakeChatApi.moderation.banUser(userId, options: any(named: 'options')), ).thenAnswer((_) async => EmptyResponse()); final res = await client.banUser(userId); @@ -3581,16 +3598,16 @@ void main() { expect(res, isNotNull); verify( - () => api.moderation.banUser(userId, options: any(named: 'options')), + () => fakeChatApi.moderation.banUser(userId, options: any(named: 'options')), ).called(1); - verifyNoMoreInteractions(api.moderation); + verifyNoMoreInteractions(fakeChatApi.moderation); }); test('`.unbanUser`', () async { const userId = 'test-user-id'; when( - () => api.moderation.unbanUser(userId, options: any(named: 'options')), + () => fakeChatApi.moderation.unbanUser(userId, options: any(named: 'options')), ).thenAnswer((_) async => EmptyResponse()); final res = await client.unbanUser(userId); @@ -3598,15 +3615,15 @@ void main() { expect(res, isNotNull); verify( - () => api.moderation.unbanUser(userId, options: any(named: 'options')), + () => fakeChatApi.moderation.unbanUser(userId, options: any(named: 'options')), ).called(1); - verifyNoMoreInteractions(api.moderation); + verifyNoMoreInteractions(fakeChatApi.moderation); }); test('`.blockUser`', () async { const userId = 'test-user-id'; - when(() => api.user.blockUser(userId)).thenAnswer( + when(() => fakeChatApi.user.blockUser(userId)).thenAnswer( (_) async => UserBlockResponse.fromJson({ 'blocked_by_user_id': 'deven', 'blocked_user_id': 'jaap', @@ -3619,24 +3636,24 @@ void main() { expect(res, isNotNull); verify( - () => api.user.blockUser(userId), + () => fakeChatApi.user.blockUser(userId), ).called(1); - verifyNoMoreInteractions(api.user); + verifyNoMoreInteractions(fakeChatApi.user); }); test('`.unblockUser`', () async { const userId = 'test-user-id'; - when(() => api.user.unblockUser(userId)).thenAnswer((_) async => EmptyResponse()); + when(() => fakeChatApi.user.unblockUser(userId)).thenAnswer((_) async => EmptyResponse()); final res = await client.unblockUser(userId); expect(res, isNotNull); verify( - () => api.user.unblockUser(userId), + () => fakeChatApi.user.unblockUser(userId), ).called(1); - verifyNoMoreInteractions(api.user); + verifyNoMoreInteractions(fakeChatApi.user); }); test('`.queryBlockedUsers`', () async { @@ -3645,7 +3662,7 @@ void main() { (index) => User(id: 'test-user-id-$index'), ); - when(() => api.user.queryBlockedUsers()).thenAnswer( + when(() => fakeChatApi.user.queryBlockedUsers()).thenAnswer( (_) async => BlockedUsersResponse() ..blocks = [ UserBlock(user: users[0], blockedUser: users[1]), @@ -3657,8 +3674,8 @@ void main() { expect(res, isNotNull); expect(res.blocks.length, 2); - verify(() => api.user.queryBlockedUsers()).called(1); - verifyNoMoreInteractions(api.user); + verify(() => fakeChatApi.user.queryBlockedUsers()).called(1); + verifyNoMoreInteractions(fakeChatApi.user); }); group('Block user state management', () { @@ -3669,7 +3686,7 @@ void main() { // Verify initial state expect(client.state.currentUser?.blockedUserIds, isEmpty); - when(() => api.user.blockUser(userId)).thenAnswer( + when(() => fakeChatApi.user.blockUser(userId)).thenAnswer( (_) async => UserBlockResponse() ..blockedUserId = userId ..blockedByUserId = testUser.id @@ -3680,8 +3697,8 @@ void main() { // Verify - should now include the blocked user ID expect(client.state.currentUser?.blockedUserIds, contains(userId)); - verify(() => api.user.blockUser(userId)).called(1); - verifyNoMoreInteractions(api.user); + verify(() => fakeChatApi.user.blockUser(userId)).called(1); + verifyNoMoreInteractions(fakeChatApi.user); }); test( @@ -3693,7 +3710,7 @@ void main() { // Verify the user is already in the blocked list expect(client.state.currentUser?.blockedUserIds, contains(userId)); - when(() => api.user.blockUser(userId)).thenAnswer( + when(() => fakeChatApi.user.blockUser(userId)).thenAnswer( (_) async => UserBlockResponse() ..blockedUserId = userId ..blockedByUserId = client.state.currentUser!.id @@ -3705,8 +3722,8 @@ void main() { // Verify - should still have only one entry expect(client.state.currentUser?.blockedUserIds, contains(userId)); expect(client.state.currentUser?.blockedUserIds.length, 1); - verify(() => api.user.blockUser(userId)).called(1); - verifyNoMoreInteractions(api.user); + verify(() => fakeChatApi.user.blockUser(userId)).called(1); + verifyNoMoreInteractions(fakeChatApi.user); }, ); @@ -3721,7 +3738,7 @@ void main() { containsAll([blockedUserId, otherBlockedId]), ); - when(() => api.user.unblockUser(blockedUserId)).thenAnswer( + when(() => fakeChatApi.user.unblockUser(blockedUserId)).thenAnswer( (_) async => EmptyResponse(), ); @@ -3738,8 +3755,8 @@ void main() { isNot(contains(blockedUserId)), ); - verify(() => api.user.unblockUser(blockedUserId)).called(1); - verifyNoMoreInteractions(api.user); + verify(() => fakeChatApi.user.unblockUser(blockedUserId)).called(1); + verifyNoMoreInteractions(fakeChatApi.user); }); test( @@ -3760,7 +3777,7 @@ void main() { isNot(contains(nonBlockedUserId)), ); - when(() => api.user.unblockUser(nonBlockedUserId)).thenAnswer( + when(() => fakeChatApi.user.unblockUser(nonBlockedUserId)).thenAnswer( (_) async => EmptyResponse(), ); @@ -3769,8 +3786,8 @@ void main() { // Verify - should remain unchanged expect(client.state.currentUser?.blockedUserIds, contains(otherBlockedId)); expect(client.state.currentUser?.blockedUserIds, isNot(contains(nonBlockedUserId))); - verify(() => api.user.unblockUser(nonBlockedUserId)).called(1); - verifyNoMoreInteractions(api.user); + verify(() => fakeChatApi.user.unblockUser(nonBlockedUserId)).called(1); + verifyNoMoreInteractions(fakeChatApi.user); }, ); @@ -3788,7 +3805,7 @@ void main() { final blockedUser2 = User(id: 'blocked-user-2'); // Mock the queryBlockedUsers API call - when(() => api.user.queryBlockedUsers()).thenAnswer( + when(() => fakeChatApi.user.queryBlockedUsers()).thenAnswer( (_) async => BlockedUsersResponse() ..blocks = [ UserBlock( @@ -3814,14 +3831,14 @@ void main() { containsAll([blockedId1, blockedId2]), ); - verify(() => api.user.queryBlockedUsers()).called(1); - verifyNoMoreInteractions(api.user); + verify(() => fakeChatApi.user.queryBlockedUsers()).called(1); + verifyNoMoreInteractions(fakeChatApi.user); }, ); }); test('`.getUnreadCount`', () async { - when(() => api.user.getUnreadCount()).thenAnswer( + when(() => fakeChatApi.user.getUnreadCount()).thenAnswer( (_) async => GetUnreadCountResponse() ..totalUnreadCount = 42 ..totalUnreadThreadsCount = 8 @@ -3860,14 +3877,14 @@ void main() { expect(res.totalUnreadCount, 42); expect(res.totalUnreadThreadsCount, 8); - verify(() => api.user.getUnreadCount()).called(1); - verifyNoMoreInteractions(api.user); + verify(() => fakeChatApi.user.getUnreadCount()).called(1); + verifyNoMoreInteractions(fakeChatApi.user); }); test( '`.getUnreadCount` should also update user unread count as a side effect', () async { - when(() => api.user.getUnreadCount()).thenAnswer( + when(() => fakeChatApi.user.getUnreadCount()).thenAnswer( (_) async => GetUnreadCountResponse() ..totalUnreadCount = 25 ..totalUnreadThreadsCount = 2 @@ -3909,117 +3926,121 @@ void main() { expect(client.state.currentUser?.unreadChannels, 2); // channels.length expect(client.state.currentUser?.unreadThreads, 2); // threads.length - verify(() => api.user.getUnreadCount()).called(1); - verifyNoMoreInteractions(api.user); + verify(() => fakeChatApi.user.getUnreadCount()).called(1); + verifyNoMoreInteractions(fakeChatApi.user); }, ); test('`.shadowBan`', () async { const userId = 'test-user-id'; - when(() => api.moderation.banUser(userId, options: {'shadow': true})).thenAnswer((_) async => EmptyResponse()); + when( + () => fakeChatApi.moderation.banUser(userId, options: {'shadow': true}), + ).thenAnswer((_) async => EmptyResponse()); final res = await client.shadowBan(userId); expect(res, isNotNull); verify( - () => api.moderation.banUser(userId, options: {'shadow': true}), + () => fakeChatApi.moderation.banUser(userId, options: {'shadow': true}), ).called(1); - verifyNoMoreInteractions(api.moderation); + verifyNoMoreInteractions(fakeChatApi.moderation); }); test('`.removeShadowBan`', () async { const userId = 'test-user-id'; - when(() => api.moderation.unbanUser(userId, options: {'shadow': true})).thenAnswer((_) async => EmptyResponse()); + when( + () => fakeChatApi.moderation.unbanUser(userId, options: {'shadow': true}), + ).thenAnswer((_) async => EmptyResponse()); final res = await client.removeShadowBan(userId); expect(res, isNotNull); verify( - () => api.moderation.unbanUser(userId, options: {'shadow': true}), + () => fakeChatApi.moderation.unbanUser(userId, options: {'shadow': true}), ).called(1); - verifyNoMoreInteractions(api.moderation); + verifyNoMoreInteractions(fakeChatApi.moderation); }); test('`.muteUser`', () async { const userId = 'test-user-id'; - when(() => api.moderation.muteUser(userId)).thenAnswer((_) async => EmptyResponse()); + when(() => fakeChatApi.moderation.muteUser(userId)).thenAnswer((_) async => EmptyResponse()); final res = await client.muteUser(userId); expect(res, isNotNull); - verify(() => api.moderation.muteUser(userId)).called(1); - verifyNoMoreInteractions(api.moderation); + verify(() => fakeChatApi.moderation.muteUser(userId)).called(1); + verifyNoMoreInteractions(fakeChatApi.moderation); }); test('`.unmuteUser`', () async { const userId = 'test-user-id'; - when(() => api.moderation.unmuteUser(userId)).thenAnswer((_) async => EmptyResponse()); + when(() => fakeChatApi.moderation.unmuteUser(userId)).thenAnswer((_) async => EmptyResponse()); final res = await client.unmuteUser(userId); expect(res, isNotNull); - verify(() => api.moderation.unmuteUser(userId)).called(1); - verifyNoMoreInteractions(api.moderation); + verify(() => fakeChatApi.moderation.unmuteUser(userId)).called(1); + verifyNoMoreInteractions(fakeChatApi.moderation); }); test('`.flagMessage`', () async { const messageId = 'test-message-id'; - when(() => api.moderation.flagMessage(messageId)).thenAnswer((_) async => EmptyResponse()); + when(() => fakeChatApi.moderation.flagMessage(messageId)).thenAnswer((_) async => EmptyResponse()); final res = await client.flagMessage(messageId); expect(res, isNotNull); - verify(() => api.moderation.flagMessage(messageId)).called(1); - verifyNoMoreInteractions(api.moderation); + verify(() => fakeChatApi.moderation.flagMessage(messageId)).called(1); + verifyNoMoreInteractions(fakeChatApi.moderation); }); test('`.unflagMessage`', () async { const messageId = 'test-message-id'; - when(() => api.moderation.unflagMessage(messageId)).thenAnswer((_) async => EmptyResponse()); + when(() => fakeChatApi.moderation.unflagMessage(messageId)).thenAnswer((_) async => EmptyResponse()); final res = await client.unflagMessage(messageId); expect(res, isNotNull); - verify(() => api.moderation.unflagMessage(messageId)).called(1); - verifyNoMoreInteractions(api.moderation); + verify(() => fakeChatApi.moderation.unflagMessage(messageId)).called(1); + verifyNoMoreInteractions(fakeChatApi.moderation); }); test('`.flagUser`', () async { const userId = 'test-message-id'; - when(() => api.moderation.flagUser(userId)).thenAnswer((_) async => EmptyResponse()); + when(() => fakeChatApi.moderation.flagUser(userId)).thenAnswer((_) async => EmptyResponse()); final res = await client.flagUser(userId); expect(res, isNotNull); - verify(() => api.moderation.flagUser(userId)).called(1); - verifyNoMoreInteractions(api.moderation); + verify(() => fakeChatApi.moderation.flagUser(userId)).called(1); + verifyNoMoreInteractions(fakeChatApi.moderation); }); test('`.unflagUser`', () async { const userId = 'test-message-id'; - when(() => api.moderation.unflagUser(userId)).thenAnswer((_) async => EmptyResponse()); + when(() => fakeChatApi.moderation.unflagUser(userId)).thenAnswer((_) async => EmptyResponse()); final res = await client.unflagUser(userId); expect(res, isNotNull); - verify(() => api.moderation.unflagUser(userId)).called(1); - verifyNoMoreInteractions(api.moderation); + verify(() => fakeChatApi.moderation.unflagUser(userId)).called(1); + verifyNoMoreInteractions(fakeChatApi.moderation); }); test('`.getActiveLiveLocations`', () async { @@ -4038,7 +4059,7 @@ void main() { ), ]; - when(() => api.user.getActiveLiveLocations()).thenAnswer( + when(() => fakeChatApi.user.getActiveLiveLocations()).thenAnswer( (_) async => GetActiveLiveLocationsResponse() // ..activeLiveLocations = locations, @@ -4054,8 +4075,8 @@ void main() { expect(res.activeLiveLocations, equals(locations)); expect(client.state.activeLiveLocations, equals(locations)); - verify(() => api.user.getActiveLiveLocations()).called(1); - verifyNoMoreInteractions(api.user); + verify(() => fakeChatApi.user.getActiveLiveLocations()).called(1); + verifyNoMoreInteractions(fakeChatApi.user); }); test('`.updateLiveLocation`', () async { @@ -4075,7 +4096,7 @@ void main() { ); when( - () => api.user.updateLiveLocation( + () => fakeChatApi.user.updateLiveLocation( messageId: messageId, createdByDeviceId: createdByDeviceId, location: location, @@ -4094,14 +4115,14 @@ void main() { expect(res, equals(expectedLocation)); verify( - () => api.user.updateLiveLocation( + () => fakeChatApi.user.updateLiveLocation( messageId: messageId, createdByDeviceId: createdByDeviceId, location: location, endAt: endAt, ), ).called(1); - verifyNoMoreInteractions(api.user); + verifyNoMoreInteractions(fakeChatApi.user); }); test('`.stopLiveLocation`', () async { @@ -4116,7 +4137,7 @@ void main() { ); when( - () => api.user.updateLiveLocation( + () => fakeChatApi.user.updateLiveLocation( messageId: messageId, createdByDeviceId: createdByDeviceId, endAt: any(named: 'endAt'), @@ -4132,13 +4153,13 @@ void main() { expect(res, equals(expectedLocation)); verify( - () => api.user.updateLiveLocation( + () => fakeChatApi.user.updateLiveLocation( messageId: messageId, createdByDeviceId: createdByDeviceId, endAt: any(named: 'endAt'), ), ).called(1); - verifyNoMoreInteractions(api.user); + verifyNoMoreInteractions(fakeChatApi.user); }); group('Live Location Event Handling', () { @@ -4413,13 +4434,13 @@ void main() { }); test('`.markAllRead`', () async { - when(() => api.channel.markAllRead()).thenAnswer((_) async => EmptyResponse()); + when(() => fakeChatApi.channel.markAllRead()).thenAnswer((_) async => EmptyResponse()); final res = await client.markAllRead(); expect(res, isNotNull); - verify(() => api.channel.markAllRead()).called(1); - verifyNoMoreInteractions(api.channel); + verify(() => fakeChatApi.channel.markAllRead()).called(1); + verifyNoMoreInteractions(fakeChatApi.channel); }); test('`.markChannelsDelivered`', () async { @@ -4434,13 +4455,13 @@ void main() { ), ]; - when(() => api.channel.markChannelsDelivered(deliveries)).thenAnswer((_) async => EmptyResponse()); + when(() => fakeChatApi.channel.markChannelsDelivered(deliveries)).thenAnswer((_) async => EmptyResponse()); final res = await client.markChannelsDelivered(deliveries); expect(res, isNotNull); - verify(() => api.channel.markChannelsDelivered(deliveries)).called(1); - verifyNoMoreInteractions(api.channel); + verify(() => fakeChatApi.channel.markChannelsDelivered(deliveries)).called(1); + verifyNoMoreInteractions(fakeChatApi.channel); }); test('`.sendEvent`', () async { @@ -4449,7 +4470,7 @@ void main() { final event = Event(type: EventType.any); when( - () => api.channel.sendEvent( + () => fakeChatApi.channel.sendEvent( channelId, channelType, any(that: isSameEventAs(event)), @@ -4460,13 +4481,13 @@ void main() { expect(res, isNotNull); verify( - () => api.channel.sendEvent( + () => fakeChatApi.channel.sendEvent( channelId, channelType, any(that: isSameEventAs(event)), ), ).called(1); - verifyNoMoreInteractions(api.channel); + verifyNoMoreInteractions(fakeChatApi.channel); }); test('`.sendReaction`', () async { @@ -4482,7 +4503,7 @@ void main() { score: score, ); - when(() => api.message.sendReaction(messageId, reaction)).thenAnswer( + when(() => fakeChatApi.message.sendReaction(messageId, reaction)).thenAnswer( (_) async => SendReactionResponse() ..message = Message(id: messageId) ..reaction = reaction, @@ -4496,23 +4517,23 @@ void main() { expect(res.reaction.score, score); expect(res.reaction.messageId, messageId); - verify(() => api.message.sendReaction(messageId, reaction)).called(1); - verifyNoMoreInteractions(api.message); + verify(() => fakeChatApi.message.sendReaction(messageId, reaction)).called(1); + verifyNoMoreInteractions(fakeChatApi.message); }); test('`.deleteReaction`', () async { const messageId = 'test-message-id'; const reactionType = 'like'; - when(() => api.message.deleteReaction(messageId, reactionType)).thenAnswer((_) async => EmptyResponse()); + when(() => fakeChatApi.message.deleteReaction(messageId, reactionType)).thenAnswer((_) async => EmptyResponse()); final res = await client.deleteReaction(messageId, reactionType); expect(res, isNotNull); verify( - () => api.message.deleteReaction(messageId, reactionType), + () => fakeChatApi.message.deleteReaction(messageId, reactionType), ).called(1); - verifyNoMoreInteractions(api.message); + verifyNoMoreInteractions(fakeChatApi.message); }); test('`.sendMessage`', () async { @@ -4521,7 +4542,7 @@ void main() { const channelType = 'test-channel-type'; when( - () => api.message.sendMessage(channelId, channelType, any(that: isSameMessageAs(message))), + () => fakeChatApi.message.sendMessage(channelId, channelType, any(that: isSameMessageAs(message))), ).thenAnswer((_) async => SendMessageResponse()..message = message); final res = await client.sendMessage(message, channelId, channelType); @@ -4529,13 +4550,13 @@ void main() { expect(res.message, isSameMessageAs(message)); verify( - () => api.message.sendMessage( + () => fakeChatApi.message.sendMessage( channelId, channelType, any(that: isSameMessageAs(message)), ), ).called(1); - verifyNoMoreInteractions(api.message); + verifyNoMoreInteractions(fakeChatApi.message); }); test('`.createDraft`', () async { @@ -4544,7 +4565,7 @@ void main() { const channelType = 'test-channel-type'; when( - () => api.message.createDraft( + () => fakeChatApi.message.createDraft( channelId, channelType, any(that: isSameDraftMessageAs(message)), @@ -4568,27 +4589,27 @@ void main() { expect(res.draft.message, isSameDraftMessageAs(message)); verify( - () => api.message.createDraft( + () => fakeChatApi.message.createDraft( channelId, channelType, any(that: isSameDraftMessageAs(message)), ), ).called(1); - verifyNoMoreInteractions(api.message); + verifyNoMoreInteractions(fakeChatApi.message); }); test('`.deleteDraft`', () async { const channelId = 'test-channel-id'; const channelType = 'test-channel-type'; - when(() => api.message.deleteDraft(channelId, channelType)).thenAnswer((_) async => EmptyResponse()); + when(() => fakeChatApi.message.deleteDraft(channelId, channelType)).thenAnswer((_) async => EmptyResponse()); final res = await client.deleteDraft(channelId, channelType); expect(res, isNotNull); - verify(() => api.message.deleteDraft(channelId, channelType)); - verifyNoMoreInteractions(api.message); + verify(() => fakeChatApi.message.deleteDraft(channelId, channelType)); + verifyNoMoreInteractions(fakeChatApi.message); }); test('`.getDraft`', () async { @@ -4597,7 +4618,7 @@ void main() { final message = DraftMessage(id: 'test-message-id', text: 'Hello!'); - when(() => api.message.getDraft(channelId, channelType)).thenAnswer( + when(() => fakeChatApi.message.getDraft(channelId, channelType)).thenAnswer( (_) async => GetDraftResponse() ..draft = Draft( channelCid: '$channelType:$channelId', @@ -4611,8 +4632,8 @@ void main() { expect(res, isNotNull); expect(res.draft.message, isSameDraftMessageAs(message)); - verify(() => api.message.getDraft(channelId, channelType)); - verifyNoMoreInteractions(api.message); + verify(() => fakeChatApi.message.getDraft(channelId, channelType)); + verifyNoMoreInteractions(fakeChatApi.message); }); test('`.queryDrafts`', () async { @@ -4632,7 +4653,7 @@ void main() { ]; when( - () => api.message.queryDrafts( + () => fakeChatApi.message.queryDrafts( filter: filter, sort: sort, pagination: pagination, @@ -4649,13 +4670,13 @@ void main() { expect(res.drafts.length, drafts.length); verify( - () => api.message.queryDrafts( + () => fakeChatApi.message.queryDrafts( filter: filter, sort: sort, pagination: pagination, ), ).called(1); - verifyNoMoreInteractions(api.message); + verifyNoMoreInteractions(fakeChatApi.message); }); test('`.getReplies`', () async { @@ -4666,14 +4687,16 @@ void main() { (index) => Message(id: 'test-message-id-$index'), ); - when(() => api.message.getReplies(parentId)).thenAnswer((_) async => QueryRepliesResponse()..messages = messages); + when( + () => fakeChatApi.message.getReplies(parentId), + ).thenAnswer((_) async => QueryRepliesResponse()..messages = messages); final res = await client.getReplies(parentId); expect(res, isNotNull); expect(res.messages.length, messages.length); - verify(() => api.message.getReplies(parentId)).called(1); - verifyNoMoreInteractions(api.message); + verify(() => fakeChatApi.message.getReplies(parentId)).called(1); + verifyNoMoreInteractions(fakeChatApi.message); }); test('`.getReactions`', () async { @@ -4688,7 +4711,7 @@ void main() { ); when( - () => api.message.getReactions(messageId), + () => fakeChatApi.message.getReactions(messageId), ).thenAnswer((_) async => QueryReactionsResponse()..reactions = reactions); final res = await client.getReactions(messageId); @@ -4696,8 +4719,8 @@ void main() { expect(res.reactions.length, reactions.length); expect(res.reactions.every((it) => it.messageId == messageId), isTrue); - verify(() => api.message.getReactions(messageId)).called(1); - verifyNoMoreInteractions(api.message); + verify(() => fakeChatApi.message.getReactions(messageId)).called(1); + verifyNoMoreInteractions(fakeChatApi.message); }); test('`.queryReactions`', () async { @@ -4712,7 +4735,7 @@ void main() { ); when( - () => api.message.queryReactions(messageId), + () => fakeChatApi.message.queryReactions(messageId), ).thenAnswer( (_) async => QueryReactionsResponse() ..reactions = reactions @@ -4724,15 +4747,15 @@ void main() { expect(res.reactions.length, reactions.length); expect(res.reactions.every((it) => it.messageId == messageId), isTrue); - verify(() => api.message.queryReactions(messageId)).called(1); - verifyNoMoreInteractions(api.message); + verify(() => fakeChatApi.message.queryReactions(messageId)).called(1); + verifyNoMoreInteractions(fakeChatApi.message); }); test('`.updateMessage`', () async { final message = Message(id: 'test-message-id', text: 'Hello!'); when( - () => api.message.updateMessage(any(that: isSameMessageAs(message))), + () => fakeChatApi.message.updateMessage(any(that: isSameMessageAs(message))), ).thenAnswer((_) async => UpdateMessageResponse()..message = message); final res = await client.updateMessage(message); @@ -4740,47 +4763,51 @@ void main() { expect(res.message, isSameMessageAs(message)); verify( - () => api.message.updateMessage(any(that: isSameMessageAs(message))), + () => fakeChatApi.message.updateMessage(any(that: isSameMessageAs(message))), ).called(1); - verifyNoMoreInteractions(api.message); + verifyNoMoreInteractions(fakeChatApi.message); }); test('`.deleteMessage`', () async { const messageId = 'test-message-id'; - when(() => api.message.deleteMessage(messageId, hard: false)).thenAnswer((_) async => EmptyResponse()); + when(() => fakeChatApi.message.deleteMessage(messageId, hard: false)).thenAnswer((_) async => EmptyResponse()); final res = await client.deleteMessage(messageId); expect(res, isNotNull); - verify(() => api.message.deleteMessage(messageId, hard: false)).called(1); - verifyNoMoreInteractions(api.message); + verify(() => fakeChatApi.message.deleteMessage(messageId, hard: false)).called(1); + verifyNoMoreInteractions(fakeChatApi.message); }); test('`.deleteMessageForMe`', () async { const messageId = 'test-message-id'; - when(() => api.message.deleteMessage(messageId, deleteForMe: true)).thenAnswer((_) async => EmptyResponse()); + when( + () => fakeChatApi.message.deleteMessage(messageId, deleteForMe: true), + ).thenAnswer((_) async => EmptyResponse()); final res = await client.deleteMessageForMe(messageId); expect(res, isNotNull); - verify(() => api.message.deleteMessage(messageId, deleteForMe: true)).called(1); - verifyNoMoreInteractions(api.message); + verify(() => fakeChatApi.message.deleteMessage(messageId, deleteForMe: true)).called(1); + verifyNoMoreInteractions(fakeChatApi.message); }); test('`.getMessage`', () async { const messageId = 'test-message-id'; final message = Message(id: messageId); - when(() => api.message.getMessage(messageId)).thenAnswer((_) async => GetMessageResponse()..message = message); + when( + () => fakeChatApi.message.getMessage(messageId), + ).thenAnswer((_) async => GetMessageResponse()..message = message); final res = await client.getMessage(messageId); expect(res, isNotNull); expect(res.message.id, messageId); - verify(() => api.message.getMessage(messageId)).called(1); - verifyNoMoreInteractions(api.message); + verify(() => fakeChatApi.message.getMessage(messageId)).called(1); + verifyNoMoreInteractions(fakeChatApi.message); }); test('`.getMessagesById`', () async { @@ -4791,7 +4818,7 @@ void main() { final messages = messageIds.map((id) => Message(id: id)).toList(); when( - () => api.message.getMessagesById(channelId, channelType, messageIds), + () => fakeChatApi.message.getMessagesById(channelId, channelType, messageIds), ).thenAnswer((_) async => GetMessagesByIdResponse()..messages = messages); final res = await client.getMessagesById( @@ -4803,9 +4830,9 @@ void main() { expect(res.messages.length, messageIds.length); verify( - () => api.message.getMessagesById(channelId, channelType, messageIds), + () => fakeChatApi.message.getMessagesById(channelId, channelType, messageIds), ).called(1); - verifyNoMoreInteractions(api.message); + verifyNoMoreInteractions(fakeChatApi.message); }); test('`.translateMessage`', () async { @@ -4818,7 +4845,7 @@ void main() { }, ); - when(() => api.message.translateMessage(messageId, language)).thenAnswer( + when(() => fakeChatApi.message.translateMessage(messageId, language)).thenAnswer( (_) async => TranslateMessageResponse()..message = translatedMessage, ); @@ -4827,8 +4854,8 @@ void main() { expect(res, isNotNull); expect(res.message.i18n, translatedMessage.i18n); - verify(() => api.message.translateMessage(messageId, language)).called(1); - verifyNoMoreInteractions(api.message); + verify(() => fakeChatApi.message.translateMessage(messageId, language)).called(1); + verifyNoMoreInteractions(fakeChatApi.message); }); test('`.partialUpdateMessage`', () async { @@ -4842,7 +4869,7 @@ void main() { ..message = message.copyWith(text: set['text'], pinExpires: null); when( - () => api.message.partialUpdateMessage( + () => fakeChatApi.message.partialUpdateMessage( message.id, set: set, unset: unset, @@ -4862,13 +4889,13 @@ void main() { expect(res.message.pinExpires, isNull); verify( - () => api.message.partialUpdateMessage( + () => fakeChatApi.message.partialUpdateMessage( message.id, set: set, unset: unset, ), ).called(1); - verifyNoMoreInteractions(api.message); + verifyNoMoreInteractions(fakeChatApi.message); }); group('`.pinMessage`', () { @@ -4877,7 +4904,7 @@ void main() { final message = Message(id: messageId); when( - () => api.message.partialUpdateMessage( + () => fakeChatApi.message.partialUpdateMessage( messageId, set: any(named: 'set'), unset: any(named: 'unset'), @@ -4898,13 +4925,13 @@ void main() { expect(res.message.pinExpires, isNull); verify( - () => api.message.partialUpdateMessage( + () => fakeChatApi.message.partialUpdateMessage( messageId, set: any(named: 'set'), unset: any(named: 'unset'), ), ).called(1); - verifyNoMoreInteractions(api.message); + verifyNoMoreInteractions(fakeChatApi.message); }); test( @@ -4915,7 +4942,7 @@ void main() { const timeoutOrExpirationDate = 300; // 300 seconds when( - () => api.message.partialUpdateMessage( + () => fakeChatApi.message.partialUpdateMessage( message.id, set: any(named: 'set'), unset: any(named: 'unset'), @@ -4941,13 +4968,13 @@ void main() { expect(res.message.pinExpires, isNotNull); verify( - () => api.message.partialUpdateMessage( + () => fakeChatApi.message.partialUpdateMessage( messageId, set: any(named: 'set'), unset: any(named: 'unset'), ), ).called(1); - verifyNoMoreInteractions(api.message); + verifyNoMoreInteractions(fakeChatApi.message); }, ); @@ -4959,7 +4986,7 @@ void main() { final timeoutOrExpirationDate = DateTime.now().add(const Duration(days: 3)); // 3 days when( - () => api.message.partialUpdateMessage( + () => fakeChatApi.message.partialUpdateMessage( messageId, set: any(named: 'set'), unset: any(named: 'unset'), @@ -4984,13 +5011,13 @@ void main() { expect(res.message.pinExpires, timeoutOrExpirationDate.toUtc()); verify( - () => api.message.partialUpdateMessage( + () => fakeChatApi.message.partialUpdateMessage( messageId, set: any(named: 'set'), unset: any(named: 'unset'), ), ).called(1); - verifyNoMoreInteractions(api.message); + verifyNoMoreInteractions(fakeChatApi.message); }, ); @@ -5018,7 +5045,7 @@ void main() { final message = Message(id: messageId, pinned: true); when( - () => api.message.partialUpdateMessage( + () => fakeChatApi.message.partialUpdateMessage( messageId, set: {'pinned': false}, ), @@ -5036,18 +5063,18 @@ void main() { expect(res.message.pinned, isFalse); verify( - () => api.message.partialUpdateMessage( + () => fakeChatApi.message.partialUpdateMessage( messageId, set: {'pinned': false}, ), ).called(1); - verifyNoMoreInteractions(api.message); + verifyNoMoreInteractions(fakeChatApi.message); }); test('`.enrichUrl`', () async { const url = 'https://www.techyourchance.com/finite-state-machine-with-unit-tests-real-world-example'; - when(() => api.general.enrichUrl(url)).thenAnswer( + when(() => fakeChatApi.general.enrichUrl(url)).thenAnswer( (_) async => OGAttachmentResponse() ..type = 'image' ..ogScrapeUrl = url @@ -5066,9 +5093,9 @@ void main() { 'Finite State Machine with Unit Tests: Real World Example', ); - verify(() => api.general.enrichUrl(url)).called(1); - verify(() => api.general.getAppSettings()).called(1); - verifyNoMoreInteractions(api.general); + verify(() => fakeChatApi.general.enrichUrl(url)).called(1); + verify(() => fakeChatApi.general.getAppSettings()).called(1); + verifyNoMoreInteractions(fakeChatApi.general); }); test( @@ -5096,7 +5123,7 @@ void main() { group('PersistenceConnectionTests', () { const apiKey = 'test-api-key'; - late final api = FakeChatApi(); + late final fakeChatApi = FakeChatApi(); final user = User(id: 'test-user-id'); final token = testUserToken(user.id).rawValue; @@ -5105,7 +5132,7 @@ void main() { setUp(() async { final ws = FakeChatServer(); - client = StreamChatClient(apiKey, chatApi: api, wsProvider: ws.connect); + client = StreamChatClient(apiKey, chatApi: fakeChatApi, wsProvider: ws.connect); expect(client.persistenceEnabled, isFalse); }); @@ -5230,13 +5257,13 @@ void main() { ); client.chatPersistenceClient = fakeClient; - when(() => api.general.sync(cids, lastSyncAt)).thenAnswer( + when(() => fakeChatApi.general.sync(cids, lastSyncAt)).thenAnswer( (_) async => SyncResponse()..events = [], ); await client.sync(); - verify(() => api.general.sync(cids, lastSyncAt)).called(1); + verify(() => fakeChatApi.general.sync(cids, lastSyncAt)).called(1); final newLastSyncAt = await fakeClient.getLastSyncAt(); expect(newLastSyncAt?.isAfter(lastSyncAt), isTrue); @@ -5254,7 +5281,7 @@ void main() { await client.sync(); expectLater(fakeClient.getLastSyncAt(), completion(isNotNull)); - verifyNever(() => api.general.sync(any(), any())); + verifyNever(() => fakeChatApi.general.sync(any(), any())); }); test('should flush persistence client on 400 error', () async { @@ -5268,7 +5295,7 @@ void main() { client.chatPersistenceClient = fakeClient; // What `/sync` answers when `lastSyncAt` is too old, or the channel // list or event count is oversized. - when(() => api.general.sync(cids, lastSyncAt)).thenThrow( + when(() => fakeChatApi.general.sync(cids, lastSyncAt)).thenThrow( apiException( code: StreamErrorCode.inputError, statusCode: 400, @@ -5280,7 +5307,7 @@ void main() { expect(await fakeClient.getChannelCids(), isEmpty); // Should be flushed - verify(() => api.general.sync(cids, lastSyncAt)).called(1); + verify(() => fakeChatApi.general.sync(cids, lastSyncAt)).called(1); }); test( @@ -5303,7 +5330,7 @@ void main() { createdAt: lastSyncAt.add(Duration(seconds: index + 1)), ), ); - when(() => api.general.sync(cids, lastSyncAt)).thenAnswer( + when(() => fakeChatApi.general.sync(cids, lastSyncAt)).thenAnswer( (_) async => SyncResponse()..events = events, ); @@ -5314,7 +5341,7 @@ void main() { await client.sync(); await pumpEventQueue(); - verify(() => api.general.sync(cids, lastSyncAt)).called(1); + verify(() => fakeChatApi.general.sync(cids, lastSyncAt)).called(1); // Within the limit, every event is replayed through the event handler. expect(replayed, hasLength(events.length)); // lastSyncAt advances to the newest replayed event date. @@ -5343,12 +5370,12 @@ void main() { createdAt: lastSyncAt.add(Duration(seconds: index + 1)), ), ); - when(() => api.general.sync(cids, lastSyncAt)).thenAnswer( + when(() => fakeChatApi.general.sync(cids, lastSyncAt)).thenAnswer( (_) async => SyncResponse()..events = events, ); when( - () => api.channel.queryChannels( + () => fakeChatApi.channel.queryChannels( filter: any(named: 'filter'), sort: any(named: 'sort'), state: any(named: 'state'), @@ -5365,17 +5392,17 @@ void main() { addTearDown(sub.cancel); // The group shares one api mock, so only count this test's calls. - clearInteractions(api.channel); + clearInteractions(fakeChatApi.channel); await client.sync(); await pumpEventQueue(); - verify(() => api.general.sync(cids, lastSyncAt)).called(1); + verify(() => fakeChatApi.general.sync(cids, lastSyncAt)).called(1); // Replay is skipped; no events are dispatched through the handler. expect(replayed, isEmpty); // The channels the payload covered are refreshed in its place. verify( - () => api.channel.queryChannels( + () => fakeChatApi.channel.queryChannels( filter: any(named: 'filter', that: isSameFilterAs(ChannelFilter.in_(ChannelFilterField.cid, cids))), sort: any(named: 'sort'), state: any(named: 'state'), @@ -5399,7 +5426,7 @@ void main() { final user = User(id: 'test-user-id'); final token = testUserToken(user.id).rawValue; - late FakeChatApi api; + late FakeChatApi fakeChatApi; late FakeChatServer ws; late StreamChatClient client; @@ -5409,14 +5436,14 @@ void main() { }); setUp(() { - api = FakeChatApi(); + fakeChatApi = FakeChatApi(); ws = FakeChatServer(); // Stub queryChannels for every test — it's the API the recovery path // calls when enabled, and a missing stub would surface as an unhandled // async error inside the connection-status listener. when( - () => api.channel.queryChannels( + () => fakeChatApi.channel.queryChannels( filter: any(named: 'filter'), sort: any(named: 'sort'), state: any(named: 'state'), @@ -5452,7 +5479,7 @@ void main() { test('should re-query active channels on reconnect when enabled (default)', () async { // Setup: connect with default flag, register two channels. - client = StreamChatClient(apiKey, chatApi: api, wsProvider: ws.connect); + client = StreamChatClient(apiKey, chatApi: fakeChatApi, wsProvider: ws.connect); await client.connectUser(user, token); await delay(300); @@ -5464,13 +5491,13 @@ void main() { // Drop interactions from the initial connect's (empty-channel) recovery // so we only count the reconnect call. - clearInteractions(api.channel); + clearInteractions(fakeChatApi.channel); await simulateReconnect(); // The re-query asks for exactly the channels it lists, a page at a time. verify( - () => api.channel.queryChannels( + () => fakeChatApi.channel.queryChannels( filter: any( named: 'filter', that: isSameFilterAs(ChannelFilter.in_(ChannelFilterField.cid, const ['messaging:c1', 'messaging:c2'])), @@ -5487,18 +5514,18 @@ void main() { }); test('should skip the re-query on reconnect when disabled', () async { - client = StreamChatClient(apiKey, chatApi: api, wsProvider: ws.connect, recoverStateOnReconnect: false); + client = StreamChatClient(apiKey, chatApi: fakeChatApi, wsProvider: ws.connect, recoverStateOnReconnect: false); await client.connectUser(user, token); await delay(300); final channel = Channel.fromState(client, ChannelState(channel: ChannelModel(cid: 'messaging:c1'))); client.state.addChannels({'messaging:c1': channel}); - clearInteractions(api.channel); + clearInteractions(fakeChatApi.channel); await simulateReconnect(); verifyNever( - () => api.channel.queryChannels( + () => fakeChatApi.channel.queryChannels( filter: any(named: 'filter'), sort: any(named: 'sort'), state: any(named: 'state'), @@ -5512,7 +5539,7 @@ void main() { }); test('should still emit `connectionRecovered` when disabled', () async { - client = StreamChatClient(apiKey, chatApi: api, wsProvider: ws.connect, recoverStateOnReconnect: false); + client = StreamChatClient(apiKey, chatApi: fakeChatApi, wsProvider: ws.connect, recoverStateOnReconnect: false); await client.connectUser(user, token); await delay(300); @@ -5535,7 +5562,7 @@ void main() { // and must not stop `connectionRecovered` from firing. test('should not surface an error when the re-query fails', () async { when( - () => api.channel.queryChannels( + () => fakeChatApi.channel.queryChannels( filter: any(named: 'filter'), sort: any(named: 'sort'), state: any(named: 'state'), @@ -5547,7 +5574,7 @@ void main() { ), ).thenThrow(StateError('queryChannels needs an active connection. Call `connectUser` first.')); - client = StreamChatClient(apiKey, chatApi: api, wsProvider: ws.connect); + client = StreamChatClient(apiKey, chatApi: fakeChatApi, wsProvider: ws.connect); await client.connectUser(user, token); await delay(300); @@ -5566,17 +5593,17 @@ void main() { }); test('should skip the re-query when no active channels are tracked', () async { - client = StreamChatClient(apiKey, chatApi: api, wsProvider: ws.connect); + client = StreamChatClient(apiKey, chatApi: fakeChatApi, wsProvider: ws.connect); await client.connectUser(user, token); await delay(300); // No channels added — the cids.isNotEmpty guard should short-circuit. - clearInteractions(api.channel); + clearInteractions(fakeChatApi.channel); await simulateReconnect(); verifyNever( - () => api.channel.queryChannels( + () => fakeChatApi.channel.queryChannels( filter: any(named: 'filter'), sort: any(named: 'sort'), state: any(named: 'state'), @@ -5592,7 +5619,7 @@ void main() { // Skipping event replay leaves the state of the synced channels behind, so // the skip refreshes them itself, whatever this flag is set to. test('should re-query active channels when the sync skipped event replay', () async { - client = StreamChatClient(apiKey, chatApi: api, wsProvider: ws.connect, recoverStateOnReconnect: false); + client = StreamChatClient(apiKey, chatApi: fakeChatApi, wsProvider: ws.connect, recoverStateOnReconnect: false); await client.connectUser(user, token); await delay(300); @@ -5616,16 +5643,16 @@ void main() { createdAt: lastSyncAt.add(Duration(seconds: index + 1)), ), ); - when(() => api.general.sync(const [cid], lastSyncAt)).thenAnswer( + when(() => fakeChatApi.general.sync(const [cid], lastSyncAt)).thenAnswer( (_) async => SyncResponse()..events = events, ); - clearInteractions(api.channel); + clearInteractions(fakeChatApi.channel); await simulateReconnect(); verify( - () => api.channel.queryChannels( + () => fakeChatApi.channel.queryChannels( filter: any(named: 'filter', that: isSameFilterAs(ChannelFilter.in_(ChannelFilterField.cid, const [cid]))), sort: any(named: 'sort'), state: any(named: 'state'), @@ -5645,7 +5672,7 @@ void main() { // A failed sync applied nothing and moved nothing, so the configured // recovery still runs and the window stays outstanding for the next sync. test('should re-query active channels when the sync fails, keeping lastSyncAt', () async { - client = StreamChatClient(apiKey, chatApi: api, wsProvider: ws.connect); + client = StreamChatClient(apiKey, chatApi: fakeChatApi, wsProvider: ws.connect); await client.connectUser(user, token); await delay(300); @@ -5659,7 +5686,7 @@ void main() { await client.openPersistenceConnection(user); addTearDown(() => client.chatPersistenceClient = null); - when(() => api.general.sync(const [cid], lastSyncAt)).thenThrow( + when(() => fakeChatApi.general.sync(const [cid], lastSyncAt)).thenThrow( const StreamApiException( code: StreamErrorCode.internalError, message: 'Something goes wrong in the system', @@ -5667,12 +5694,12 @@ void main() { ), ); - clearInteractions(api.channel); + clearInteractions(fakeChatApi.channel); await simulateReconnect(); verify( - () => api.channel.queryChannels( + () => fakeChatApi.channel.queryChannels( filter: any(named: 'filter', that: isSameFilterAs(ChannelFilter.in_(ChannelFilterField.cid, const [cid]))), sort: any(named: 'sort'), state: any(named: 'state'), @@ -5691,7 +5718,7 @@ void main() { // so a failed refresh keeps the checkpoint and the range is asked for again. test('should keep lastSyncAt when the refresh after a skipped replay fails', () async { when( - () => api.channel.queryChannels( + () => fakeChatApi.channel.queryChannels( filter: any(named: 'filter'), sort: any(named: 'sort'), state: any(named: 'state'), @@ -5703,7 +5730,7 @@ void main() { ), ).thenThrow(StateError('queryChannels needs an active connection. Call `connectUser` first.')); - client = StreamChatClient(apiKey, chatApi: api, wsProvider: ws.connect, recoverStateOnReconnect: false); + client = StreamChatClient(apiKey, chatApi: fakeChatApi, wsProvider: ws.connect, recoverStateOnReconnect: false); await client.connectUser(user, token); await delay(300); @@ -5727,7 +5754,7 @@ void main() { createdAt: lastSyncAt.add(Duration(seconds: index + 1)), ), ); - when(() => api.general.sync(const [cid], lastSyncAt)).thenAnswer( + when(() => fakeChatApi.general.sync(const [cid], lastSyncAt)).thenAnswer( (_) async => SyncResponse()..events = events, ); @@ -5737,7 +5764,7 @@ void main() { }); test('should re-query in batches when more channels are active than fit in one page', () async { - client = StreamChatClient(apiKey, chatApi: api, wsProvider: ws.connect, recoverStateOnReconnect: false); + client = StreamChatClient(apiKey, chatApi: fakeChatApi, wsProvider: ws.connect, recoverStateOnReconnect: false); await client.connectUser(user, token); await delay(300); @@ -5763,16 +5790,16 @@ void main() { createdAt: lastSyncAt.add(Duration(seconds: index + 1)), ), ); - when(() => api.general.sync(cids, lastSyncAt)).thenAnswer( + when(() => fakeChatApi.general.sync(cids, lastSyncAt)).thenAnswer( (_) async => SyncResponse()..events = events, ); - clearInteractions(api.channel); + clearInteractions(fakeChatApi.channel); await simulateReconnect(); verify( - () => api.channel.queryChannels( + () => fakeChatApi.channel.queryChannels( filter: any( named: 'filter', that: isSameFilterAs(ChannelFilter.in_(ChannelFilterField.cid, cids.take(30).toList())), @@ -5788,7 +5815,7 @@ void main() { ).called(1); verify( - () => api.channel.queryChannels( + () => fakeChatApi.channel.queryChannels( filter: any( named: 'filter', that: isSameFilterAs(ChannelFilter.in_(ChannelFilterField.cid, cids.skip(30).toList())), @@ -5809,7 +5836,7 @@ void main() { // it fires. Emitting it before the catch-up finishes would have them act // on state the sync has not written yet. test('should finish recovering before `connectionRecovered` fires', () async { - client = StreamChatClient(apiKey, chatApi: api, wsProvider: ws.connect); + client = StreamChatClient(apiKey, chatApi: fakeChatApi, wsProvider: ws.connect); await client.connectUser(user, token); await delay(300); @@ -5823,12 +5850,12 @@ void main() { addTearDown(() => client.chatPersistenceClient = null); final calls = []; - when(() => api.general.sync(const [cid], lastSyncAt)).thenAnswer((_) async { + when(() => fakeChatApi.general.sync(const [cid], lastSyncAt)).thenAnswer((_) async { calls.add('sync'); return SyncResponse()..events = []; }); when( - () => api.channel.queryChannels( + () => fakeChatApi.channel.queryChannels( filter: any(named: 'filter'), sort: any(named: 'sort'), state: any(named: 'state'), @@ -5855,7 +5882,7 @@ void main() { // One page failing says nothing about the others, so the rest are still // attempted — the channels that can be refreshed are. test('should attempt every page when one of them fails', () async { - client = StreamChatClient(apiKey, chatApi: api, wsProvider: ws.connect, recoverStateOnReconnect: false); + client = StreamChatClient(apiKey, chatApi: fakeChatApi, wsProvider: ws.connect, recoverStateOnReconnect: false); await client.connectUser(user, token); await delay(300); @@ -5882,13 +5909,13 @@ void main() { createdAt: lastSyncAt.add(Duration(seconds: index + 1)), ), ); - when(() => api.general.sync(cids, lastSyncAt)).thenAnswer( + when(() => fakeChatApi.general.sync(cids, lastSyncAt)).thenAnswer( (_) async => SyncResponse()..events = events, ); // The first page fails, the second one succeeds. when( - () => api.channel.queryChannels( + () => fakeChatApi.channel.queryChannels( filter: any( named: 'filter', that: isSameFilterAs(ChannelFilter.in_(ChannelFilterField.cid, cids.take(30).toList())), @@ -5903,13 +5930,13 @@ void main() { ), ).thenThrow(StateError('Failed to query channels')); - clearInteractions(api.channel); + clearInteractions(fakeChatApi.channel); await simulateReconnect(); // Both pages are asked for, even though the first one failed. verify( - () => api.channel.queryChannels( + () => fakeChatApi.channel.queryChannels( filter: any( named: 'filter', that: isSameFilterAs(ChannelFilter.in_(ChannelFilterField.cid, cids.skip(30).toList())), @@ -5929,19 +5956,19 @@ void main() { }); test('should respect runtime toggling via the setter', () async { - client = StreamChatClient(apiKey, chatApi: api, wsProvider: ws.connect); + client = StreamChatClient(apiKey, chatApi: fakeChatApi, wsProvider: ws.connect); await client.connectUser(user, token); await delay(300); final channel = Channel.fromState(client, ChannelState(channel: ChannelModel(cid: 'messaging:c1'))); client.state.addChannels({'messaging:c1': channel}); - clearInteractions(api.channel); + clearInteractions(fakeChatApi.channel); // Disable mid-flight → no re-query on reconnect. client.recoverStateOnReconnect = false; await simulateReconnect(); verifyNever( - () => api.channel.queryChannels( + () => fakeChatApi.channel.queryChannels( filter: any(named: 'filter'), sort: any(named: 'sort'), state: any(named: 'state'), @@ -5957,7 +5984,7 @@ void main() { client.recoverStateOnReconnect = true; await simulateReconnect(); verify( - () => api.channel.queryChannels( + () => fakeChatApi.channel.queryChannels( filter: any(named: 'filter'), sort: any(named: 'sort'), state: any(named: 'state'), @@ -5976,7 +6003,7 @@ void main() { final user = User(id: 'test-user-id'); final token = testUserToken(user.id).rawValue; - late FakeChatApi api; + late FakeChatApi fakeChatApi; late FakeChatServer ws; late StreamChatClient client; var disposed = false; @@ -5987,7 +6014,7 @@ void main() { }); setUp(() { - api = FakeChatApi(); + fakeChatApi = FakeChatApi(); ws = FakeChatServer(); disposed = false; }); @@ -6005,7 +6032,7 @@ void main() { // mid-recovery at the moment it is disposed. final pendingQuery = Completer(); when( - () => api.channel.queryChannels( + () => fakeChatApi.channel.queryChannels( filter: any(named: 'filter'), sort: any(named: 'sort'), state: any(named: 'state'), @@ -6017,7 +6044,7 @@ void main() { ), ).thenAnswer((_) => pendingQuery.future); - client = StreamChatClient(apiKey, chatApi: api, wsProvider: ws.connect); + client = StreamChatClient(apiKey, chatApi: fakeChatApi, wsProvider: ws.connect); await client.connectUser(user, token); await delay(300); @@ -6208,12 +6235,12 @@ void main() { group('ClientState mutation guards', () { const apiKey = 'test-api-key'; - late final api = FakeChatApi(); + late final fakeChatApi = FakeChatApi(); late StreamChatClient client; setUp(() { final ws = FakeChatServer(); - client = StreamChatClient(apiKey, wsProvider: ws.connect, chatApi: api); + client = StreamChatClient(apiKey, wsProvider: ws.connect, chatApi: fakeChatApi); }); tearDown(() { @@ -6508,9 +6535,9 @@ void main() { }); test('should answer both callers connecting the same user at once with one connection', () async { - final api = FakeChatApi(); + final fakeChatApi = FakeChatApi(); final server = FakeChatServer(user: OwnUser.fromUser(user)); - final client = StreamChatClient(apiKey, chatApi: api, wsProvider: server.connect); + final client = StreamChatClient(apiKey, chatApi: fakeChatApi, wsProvider: server.connect); addTearDown(client.dispose); // The second lands while the first is still opening, which is where the status cannot tell a @@ -6525,7 +6552,7 @@ void main() { // One sign-in, not two alongside each other: what it does for the user behind the connection // is done for the pair rather than once each. await pumpEventQueue(); - verify(() => api.general.getAppSettings()).called(1); + verify(() => fakeChatApi.general.getAppSettings()).called(1); }); test('should leave nobody signed in when connecting a user fails', () async { @@ -6615,13 +6642,13 @@ void main() { // Whether the channels can be watched is read when the request is sent, not when the query is // made, so one that waited for a connection still watches what it loads. test('should watch the channels it loads when the connection lands mid-query', () async { - final api = FakeChatApi(); + final fakeChatApi = FakeChatApi(); final ws = FakeChatServer(user: OwnUser.fromUser(user)); - final client = StreamChatClient(apiKey, chatApi: api, wsProvider: ws.connect); + final client = StreamChatClient(apiKey, chatApi: fakeChatApi, wsProvider: ws.connect); addTearDown(client.dispose); when( - () => api.channel.queryChannels( + () => fakeChatApi.channel.queryChannels( filter: any(named: 'filter'), sort: any(named: 'sort'), state: any(named: 'state'), @@ -6641,7 +6668,7 @@ void main() { await queried; final watched = verify( - () => api.channel.queryChannels( + () => fakeChatApi.channel.queryChannels( filter: any(named: 'filter'), sort: any(named: 'sort'), state: any(named: 'state'), diff --git a/packages/stream_chat/test/src/core/models/converters/v1_json_converters_test.dart b/packages/stream_chat/test/src/core/models/converters/v1_json_converters_test.dart new file mode 100644 index 0000000000..e8487a3e9a --- /dev/null +++ b/packages/stream_chat/test/src/core/models/converters/v1_json_converters_test.dart @@ -0,0 +1,39 @@ +import 'package:stream_chat/src/core/models/converters/v1_json_converters.dart'; +import 'package:stream_chat/src/core/models/device.dart'; +import 'package:stream_chat/src/core/models/push_provider.dart'; +import 'package:test/test.dart'; + +void main() { + test('DeviceV1JsonConverter.fromJson reads a v1 device, ignoring the fields a Device does not carry', () { + const converter = DeviceV1JsonConverter(); + + final device = converter.fromJson({ + 'id': 'device-id', + 'push_provider': 'firebase', + 'push_provider_name': 'staging', + 'user_id': 'user-id', + 'created_at': '2020-04-23T14:36:21.838196Z', + 'disabled': false, + }); + + expect(device, const Device(id: 'device-id', pushProvider: PushProvider.firebase)); + }); + + test('DeviceV1JsonConverter.toJson writes the device under its wire keys', () { + const converter = DeviceV1JsonConverter(); + + final json = converter.toJson(const Device(id: 'device-id', pushProvider: PushProvider.apn)); + + expect(json, {'id': 'device-id', 'push_provider': 'apn'}); + }); + + test('DeviceV1JsonConverter.fromJson reads back what toJson writes', () { + const converter = DeviceV1JsonConverter(); + + final device = converter.fromJson( + converter.toJson(const Device(id: 'device-id', pushProvider: PushProvider.huawei)), + ); + + expect(device, const Device(id: 'device-id', pushProvider: PushProvider.huawei)); + }); +} diff --git a/packages/stream_chat/test/src/core/models/own_user_test.dart b/packages/stream_chat/test/src/core/models/own_user_test.dart index fc2dad3f0b..1a88fb439a 100644 --- a/packages/stream_chat/test/src/core/models/own_user_test.dart +++ b/packages/stream_chat/test/src/core/models/own_user_test.dart @@ -10,7 +10,7 @@ class MockMute extends Mock implements Mute {} class ChannelMockMute extends Mock implements ChannelMute {} -class MockDevice extends Mock implements DeviceResponse {} +class MockDevice extends Mock implements Device {} void main() { final devices = [MockDevice(), MockDevice()]; @@ -35,13 +35,6 @@ void main() { final device = ownUser.devices.single; expect(device.id, startsWith('cRS8elU4Q-qqdCAvHR2kSa:')); expect(device.pushProvider, 'firebase'); - expect(device.userId, 'super-band-9'); - expect(device.createdAt, DateTime.parse('2020-04-23T14:36:21.838196Z')); - expect(device.pushProviderName, isNull); - expect(device.hardwareId, isNull); - expect(device.voip, isNull); - expect(device.disabled, isNull); - expect(device.disabledReason, isNull); expect(ownUser.mutes.length, 0); expect(ownUser.channelMutes.length, 1); expect(ownUser.totalUnreadCount, 0); @@ -52,11 +45,39 @@ void main() { expect(ownUser.extraData['username'], 'Rioland'); }); - test('should fail to decode a device missing a field the server always sends', () { + test('OwnUser.toJson writes each device under its id and push_provider keys', () { + final ownUser = OwnUser( + id: 'user-id', + devices: const [ + Device(id: 'device-1', pushProvider: PushProvider.firebase), + Device(id: 'device-2', pushProvider: PushProvider.apn), + ], + ); + + final json = ownUser.toJson(); + + expect(json['devices'], [ + {'id': 'device-1', 'push_provider': 'firebase'}, + {'id': 'device-2', 'push_provider': 'apn'}, + ]); + }); + + test('OwnUser.fromJson reads back the devices OwnUser.toJson wrote', () { + final json = OwnUser( + id: 'user-id', + devices: const [Device(id: 'device-1', pushProvider: PushProvider.firebase)], + ).toJson(); + + final decoded = OwnUser.fromJson(json); + + expect(decoded.devices.map((it) => (it.id, it.pushProvider)), [('device-1', 'firebase')]); + }); + + test('OwnUser.fromJson fails on a device missing its id or push provider', () { final json = jsonFixture('own_user.json'); final device = Map.from((json['devices']! as List).single as Map); - for (final field in ['id', 'push_provider', 'created_at', 'user_id']) { + for (final field in ['id', 'push_provider']) { final incomplete = Map.from(device)..remove(field); expect( @@ -451,12 +472,10 @@ void main() { 'department': 'Engineering', 'custom_field': 'custom_value', }, - devices: [ - DeviceResponse( + devices: const [ + Device( id: 'device-1', - pushProvider: 'firebase', - createdAt: DateTime.utc(2024), - userId: 'test-user-id', + pushProvider: PushProvider.firebase, ), ], totalUnreadCount: 10, @@ -512,18 +531,14 @@ void main() { 'location': 'Amsterdam', 'is_verified': true, }, - devices: [ - DeviceResponse( + devices: const [ + Device( id: 'device-1', - pushProvider: 'firebase', - createdAt: DateTime.utc(2024), - userId: 'test-user-id', + pushProvider: PushProvider.firebase, ), - DeviceResponse( + Device( id: 'device-2', - pushProvider: 'apn', - createdAt: DateTime.utc(2024), - userId: 'test-user-id', + pushProvider: PushProvider.apn, ), ], totalUnreadCount: 25, diff --git a/packages/stream_chat/test/src/core/models/push_provider_test.dart b/packages/stream_chat/test/src/core/models/push_provider_test.dart new file mode 100644 index 0000000000..fd6155de6f --- /dev/null +++ b/packages/stream_chat/test/src/core/models/push_provider_test.dart @@ -0,0 +1,25 @@ +import 'package:stream_chat/stream_chat.dart' show PushProvider; +import 'package:test/test.dart'; + +void main() { + test('PushProvider carries its wire value', () { + expect(PushProvider.firebase, 'firebase'); + expect(PushProvider.huawei, 'huawei'); + expect(PushProvider.xiaomi, 'xiaomi'); + expect(PushProvider.apn, 'apn'); + }); + + test('PushProvider interchanges with a raw string', () { + const raw = 'firebase'; + + expect(PushProvider.firebase, raw); + expect(PushProvider.firebase.rawType, raw); + expect([PushProvider.firebase, PushProvider.apn], ['firebase', 'apn']); + }); + + test('PushProvider accepts a value the SDK does not name', () { + const unknown = PushProvider('onesignal'); + + expect(unknown, 'onesignal'); + }); +} diff --git a/packages/stream_chat/test/src/core/models/role_type_test.dart b/packages/stream_chat/test/src/core/models/role_type_test.dart index f977cc62e6..a5f013bf0a 100644 --- a/packages/stream_chat/test/src/core/models/role_type_test.dart +++ b/packages/stream_chat/test/src/core/models/role_type_test.dart @@ -2,24 +2,22 @@ import 'package:stream_chat/stream_chat.dart' show RoleType; import 'package:test/test.dart'; void main() { - group('src/models/role_type', () { - test('should carry its wire value', () { - expect(RoleType.user, 'user'); - expect(RoleType.channel, 'channel'); - }); + test('RoleType carries its wire value', () { + expect(RoleType.user, 'user'); + expect(RoleType.channel, 'channel'); + }); - test('should interchange with a raw string', () { - const raw = 'user'; + test('RoleType interchanges with a raw string', () { + const raw = 'user'; - expect(RoleType.user, raw); - expect(RoleType.user.rawType, raw); - expect([RoleType.user, RoleType.channel], ['user', 'channel']); - }); + expect(RoleType.user, raw); + expect(RoleType.user.rawType, raw); + expect([RoleType.user, RoleType.channel], ['user', 'channel']); + }); - test('should accept a value the SDK does not name', () { - const unknown = RoleType('team'); + test('RoleType accepts a value the SDK does not name', () { + const unknown = RoleType('team'); - expect(unknown, 'team'); - }); + expect(unknown, 'team'); }); } diff --git a/packages/stream_chat/test/src/repository/devices_repository_test.dart b/packages/stream_chat/test/src/repository/devices_repository_test.dart index 9401e2f02d..9ec5b9b7b2 100644 --- a/packages/stream_chat/test/src/repository/devices_repository_test.dart +++ b/packages/stream_chat/test/src/repository/devices_repository_test.dart @@ -1,5 +1,8 @@ import 'package:mocktail/mocktail.dart'; -import 'package:stream_chat/open_api/api.dart'; +import 'package:stream_chat/open_api/api.dart' as api; +import 'package:stream_chat/src/core/models/device.dart'; +import 'package:stream_chat/src/core/models/list_devices_response.dart'; +import 'package:stream_chat/src/core/models/push_provider.dart'; import 'package:stream_chat/src/repository/devices_repository.dart'; import 'package:stream_core/stream_core.dart'; import 'package:test/test.dart'; @@ -7,173 +10,149 @@ import 'package:test/test.dart'; import '../mocks.dart'; void main() { - late MockDefaultApi api; - late DevicesRepository repository; + test('DevicesRepository.addDevice forwards the id and provider without a name', () async { + final defaultApi = MockDefaultApi(); + const request = api.CreateDeviceRequest( + id: 'device-id', + pushProvider: api.CreateDeviceRequestPushProvider.firebase, + ); + _stubCreateDevice(defaultApi, request); + + await DevicesRepository(defaultApi).addDevice('device-id', PushProvider.firebase); + + verify(() => defaultApi.createDevice(createDeviceRequest: request)).called(1); + verifyNoMoreInteractions(defaultApi); + }); + + test('DevicesRepository.addDevice forwards the provider name when given', () async { + final defaultApi = MockDefaultApi(); + const request = api.CreateDeviceRequest( + id: 'device-id', + pushProvider: api.CreateDeviceRequestPushProvider.apn, + pushProviderName: 'staging', + ); + _stubCreateDevice(defaultApi, request); + + await DevicesRepository(defaultApi).addDevice('device-id', PushProvider.apn, pushProviderName: 'staging'); + + verify(() => defaultApi.createDevice(createDeviceRequest: request)).called(1); + verifyNoMoreInteractions(defaultApi); + }); + + test('DevicesRepository.addDevice sends an empty provider name as no name', () async { + final defaultApi = MockDefaultApi(); + const request = api.CreateDeviceRequest( + id: 'device-id', + pushProvider: api.CreateDeviceRequestPushProvider.apn, + ); + _stubCreateDevice(defaultApi, request); + + await DevicesRepository(defaultApi).addDevice('device-id', PushProvider.apn, pushProviderName: ''); + + verify(() => defaultApi.createDevice(createDeviceRequest: request)).called(1); + verifyNoMoreInteractions(defaultApi); + }); + + test('DevicesRepository.addDevice returns a success with no value when the server accepts the device', () async { + final defaultApi = MockDefaultApi(); + const request = api.CreateDeviceRequest( + id: 'device-id', + pushProvider: api.CreateDeviceRequestPushProvider.firebase, + ); + _stubCreateDevice(defaultApi, request); - setUp(() { - api = MockDefaultApi(); - repository = DevicesRepository(api); + final res = await DevicesRepository(defaultApi).addDevice('device-id', PushProvider.firebase); + + expect(res, const Result.success(null)); }); - group('addDevice', () { - test('should forward the id and provider without a name', () async { - const request = CreateDeviceRequest( - id: 'device-id', - pushProvider: CreateDeviceRequestPushProvider.firebase, - ); - - when(() => api.createDevice(createDeviceRequest: request)).thenAnswer( - (_) async => const Result.success(DurationResponse(duration: '0.01ms')), - ); - - final res = await repository.addDevice( - 'device-id', - CreateDeviceRequestPushProvider.firebase, - ); - - expect(res.isSuccess, isTrue); - verify(() => api.createDevice(createDeviceRequest: request)).called(1); - verifyNoMoreInteractions(api); - }); - - test('should forward the provider name when given', () async { - const request = CreateDeviceRequest( - id: 'device-id', - pushProvider: CreateDeviceRequestPushProvider.apn, - pushProviderName: 'staging', - ); - - when(() => api.createDevice(createDeviceRequest: request)).thenAnswer( - (_) async => const Result.success(DurationResponse(duration: '0.01ms')), - ); - - await repository.addDevice( - 'device-id', - CreateDeviceRequestPushProvider.apn, - pushProviderName: 'staging', - ); - - verify(() => api.createDevice(createDeviceRequest: request)).called(1); - verifyNoMoreInteractions(api); - }); - - test('should send an empty provider name as no name', () async { - const request = CreateDeviceRequest( - id: 'device-id', - pushProvider: CreateDeviceRequestPushProvider.apn, - ); - - when(() => api.createDevice(createDeviceRequest: request)).thenAnswer( - (_) async => const Result.success(DurationResponse(duration: '0.01ms')), - ); - - await repository.addDevice( - 'device-id', - CreateDeviceRequestPushProvider.apn, - pushProviderName: '', - ); - - verify(() => api.createDevice(createDeviceRequest: request)).called(1); - verifyNoMoreInteractions(api); - }); - - test('should send every provider under its wire value', () async { - const providers = { - CreateDeviceRequestPushProvider.apn: 'apn', - CreateDeviceRequestPushProvider.firebase: 'firebase', - CreateDeviceRequestPushProvider.huawei: 'huawei', - CreateDeviceRequestPushProvider.xiaomi: 'xiaomi', - }; - - for (final MapEntry(key: provider, value: wireValue) in providers.entries) { - final request = CreateDeviceRequest(id: 'device-id', pushProvider: provider); - - when(() => api.createDevice(createDeviceRequest: request)).thenAnswer( - (_) async => const Result.success(DurationResponse(duration: '0.01ms')), - ); - - await repository.addDevice('device-id', provider); - - expect(provider, wireValue); - verify(() => api.createDevice(createDeviceRequest: request)).called(1); - } - - verifyNoMoreInteractions(api); - }); - - test('should return the failure without throwing', () async { - const error = StreamClientException(message: 'boom'); - const request = CreateDeviceRequest( - id: 'device-id', - pushProvider: CreateDeviceRequestPushProvider.firebase, - ); - - when(() => api.createDevice(createDeviceRequest: request)).thenAnswer( - (_) async => const Result.failure(error), - ); - - final res = await repository.addDevice( - 'device-id', - CreateDeviceRequestPushProvider.firebase, - ); - - expect(res.isFailure, isTrue); - expect(res.exceptionOrNull(), error); - }); + test('DevicesRepository.addDevice returns the failure without throwing', () async { + final defaultApi = MockDefaultApi(); + const error = StreamClientException(message: 'boom'); + const request = api.CreateDeviceRequest( + id: 'device-id', + pushProvider: api.CreateDeviceRequestPushProvider.firebase, + ); + when( + () => defaultApi.createDevice(createDeviceRequest: request), + ).thenAnswer((_) async => const Result.failure(error)); + + final res = await DevicesRepository(defaultApi).addDevice('device-id', PushProvider.firebase); + + expect(res.exceptionOrNull(), error); }); - group('getDevices', () { - test('should pass the response through untouched', () async { - final device = DeviceResponse( - id: 'device-id', - pushProvider: 'firebase', - createdAt: DateTime.utc(2024), - userId: 'user-id', - ); + test('DevicesRepository.getDevices returns the mapped response', () async { + final defaultApi = MockDefaultApi(); + final device = api.DeviceResponse( + id: 'device-id', + pushProvider: 'firebase', + createdAt: DateTime.utc(2024), + userId: 'user-id', + ); + when(defaultApi.listDevices).thenAnswer( + (_) async => Result.success(api.ListDevicesResponse(duration: '0.02ms', devices: [device])), + ); + + final res = await DevicesRepository(defaultApi).getDevices(); + + expect( + res.getOrNull(), + const ListDevicesResponse( + duration: '0.02ms', + devices: [Device(id: 'device-id', pushProvider: PushProvider.firebase)], + ), + ); + }); - when(api.listDevices).thenAnswer( - (_) async => Result.success(ListDevicesResponse(duration: '0.01ms', devices: [device])), - ); + test('DevicesRepository.getDevices returns the failure without throwing', () async { + final defaultApi = MockDefaultApi(); + const error = StreamClientException(message: 'boom'); + when(defaultApi.listDevices).thenAnswer((_) async => const Result.failure(error)); - final res = await repository.getDevices(); + final res = await DevicesRepository(defaultApi).getDevices(); - expect(res.getOrNull()?.devices.single, device); - verify(api.listDevices).called(1); - verifyNoMoreInteractions(api); - }); + expect(res.exceptionOrNull(), error); + }); - test('should return the failure without throwing', () async { - const error = StreamClientException(message: 'boom'); - when(api.listDevices).thenAnswer((_) async => const Result.failure(error)); + test('DevicesRepository.removeDevice forwards the id', () async { + final defaultApi = MockDefaultApi(); + _stubDeleteDevice(defaultApi, 'device-id'); - final res = await repository.getDevices(); + await DevicesRepository(defaultApi).removeDevice('device-id'); - expect(res.isFailure, isTrue); - expect(res.exceptionOrNull(), error); - }); + verify(() => defaultApi.deleteDevice(id: 'device-id')).called(1); + verifyNoMoreInteractions(defaultApi); }); - group('removeDevice', () { - test('should forward the id', () async { - when(() => api.deleteDevice(id: 'device-id')).thenAnswer( - (_) async => const Result.success(DurationResponse(duration: '0.01ms')), - ); + test('DevicesRepository.removeDevice returns a success with no value when the server removes the device', () async { + final defaultApi = MockDefaultApi(); + _stubDeleteDevice(defaultApi, 'device-id'); - final res = await repository.removeDevice('device-id'); + final res = await DevicesRepository(defaultApi).removeDevice('device-id'); - expect(res.isSuccess, isTrue); - verify(() => api.deleteDevice(id: 'device-id')).called(1); - verifyNoMoreInteractions(api); - }); + expect(res, const Result.success(null)); + }); - test('should return the failure without throwing', () async { - const error = StreamClientException(message: 'boom'); - when(() => api.deleteDevice(id: 'device-id')).thenAnswer((_) async => const Result.failure(error)); + test('DevicesRepository.removeDevice returns the failure without throwing', () async { + final defaultApi = MockDefaultApi(); + const error = StreamClientException(message: 'boom'); + when(() => defaultApi.deleteDevice(id: 'device-id')).thenAnswer((_) async => const Result.failure(error)); - final res = await repository.removeDevice('device-id'); + final res = await DevicesRepository(defaultApi).removeDevice('device-id'); - expect(res.isFailure, isTrue); - expect(res.exceptionOrNull(), error); - }); + expect(res.exceptionOrNull(), error); }); } + +void _stubCreateDevice(MockDefaultApi defaultApi, api.CreateDeviceRequest request) { + when(() => defaultApi.createDevice(createDeviceRequest: request)).thenAnswer( + (_) async => const Result.success(api.DurationResponse(duration: '0.01ms')), + ); +} + +void _stubDeleteDevice(MockDefaultApi defaultApi, String id) { + when(() => defaultApi.deleteDevice(id: id)).thenAnswer( + (_) async => const Result.success(api.DurationResponse(duration: '0.01ms')), + ); +} diff --git a/packages/stream_chat/test/src/repository/mapper/devices_mapper_test.dart b/packages/stream_chat/test/src/repository/mapper/devices_mapper_test.dart new file mode 100644 index 0000000000..b3bc7235dd --- /dev/null +++ b/packages/stream_chat/test/src/repository/mapper/devices_mapper_test.dart @@ -0,0 +1,76 @@ +import 'package:stream_chat/open_api/api.dart' as api; +import 'package:stream_chat/src/core/models/device.dart'; +import 'package:stream_chat/src/core/models/push_provider.dart'; +import 'package:stream_chat/src/repository/mapper/devices_mapper.dart'; +import 'package:test/test.dart'; + +void main() { + test('DeviceResponse.toModel keeps the id and push provider of a fully populated response', () { + final response = api.DeviceResponse( + id: 'device-id', + pushProvider: 'firebase', + pushProviderName: 'staging', + createdAt: DateTime.utc(2024), + userId: 'user-id', + disabled: true, + disabledReason: 'expired', + hardwareId: 'hardware-id', + voip: false, + ); + + expect(response.toModel(), const Device(id: 'device-id', pushProvider: PushProvider.firebase)); + }); + + test('ListDevicesResponse.toModel keeps the duration', () { + const response = api.ListDevicesResponse(duration: '0.02ms', devices: []); + + expect(response.toModel().duration, '0.02ms'); + }); + + test('ListDevicesResponse.toModel maps every device in order', () { + final response = api.ListDevicesResponse( + duration: '0.01ms', + devices: [ + _deviceResponse(id: 'device-1', pushProvider: 'firebase'), + _deviceResponse(id: 'device-2', pushProvider: 'apn'), + _deviceResponse(id: 'device-3', pushProvider: 'huawei'), + ], + ); + + expect(response.toModel().devices, const [ + Device(id: 'device-1', pushProvider: PushProvider.firebase), + Device(id: 'device-2', pushProvider: PushProvider.apn), + Device(id: 'device-3', pushProvider: PushProvider.huawei), + ]); + }); + + test('PushProvider.toRequest carries the wire value of every provider, named or not', () { + const providers = [ + PushProvider.firebase, + PushProvider.huawei, + PushProvider.xiaomi, + PushProvider.apn, + PushProvider('onesignal'), + ]; + + expect( + [for (final provider in providers) provider.toRequest()], + [ + api.CreateDeviceRequestPushProvider.firebase, + api.CreateDeviceRequestPushProvider.huawei, + api.CreateDeviceRequestPushProvider.xiaomi, + api.CreateDeviceRequestPushProvider.apn, + api.CreateDeviceRequestPushProvider.fromJson('onesignal'), + ], + ); + }); +} + +api.DeviceResponse _deviceResponse({required String id, required String pushProvider}) { + return api.DeviceResponse( + id: id, + pushProvider: pushProvider, + createdAt: DateTime.utc(2024), + userId: 'user-id', + ); +} diff --git a/packages/stream_chat/test/src/repository/mapper/result_mapper_test.dart b/packages/stream_chat/test/src/repository/mapper/result_mapper_test.dart new file mode 100644 index 0000000000..ef4d07084b --- /dev/null +++ b/packages/stream_chat/test/src/repository/mapper/result_mapper_test.dart @@ -0,0 +1,23 @@ +import 'package:stream_chat/open_api/api.dart' as api; +import 'package:stream_chat/src/repository/mapper/result_mapper.dart'; +import 'package:stream_core/stream_core.dart'; +import 'package:test/test.dart'; + +void main() { + test('Result.ignoreValue turns a success into a success with no value', () { + const result = Result.success(api.DurationResponse(duration: '0.01ms')); + + final ignored = result.ignoreValue(); + + expect(ignored, const Result.success(null)); + expect(ignored, isNot(isA>())); + }); + + test('Result.ignoreValue keeps the error and stack trace of a failure', () { + final error = StateError('boom'); + final stackTrace = StackTrace.current; + final result = Result.failure(error, stackTrace); + + expect(result.ignoreValue(), Result.failure(error, stackTrace)); + }); +} diff --git a/packages/stream_chat/test/src/repository/mapper/roles_mapper_test.dart b/packages/stream_chat/test/src/repository/mapper/roles_mapper_test.dart new file mode 100644 index 0000000000..78835c2511 --- /dev/null +++ b/packages/stream_chat/test/src/repository/mapper/roles_mapper_test.dart @@ -0,0 +1,54 @@ +import 'package:stream_chat/open_api/api.dart' as api; +import 'package:stream_chat/src/core/models/role.dart'; +import 'package:stream_chat/src/repository/mapper/roles_mapper.dart'; +import 'package:test/test.dart'; + +void main() { + test('Role.toModel maps every field of the generated role', () { + final generated = api.Role( + name: 'moderator', + custom: true, + scopes: const ['.app', 'messaging'], + createdAt: DateTime.utc(2024, 1, 2), + updatedAt: DateTime.utc(2024, 3, 4), + ); + + expect( + generated.toModel(), + Role( + name: 'moderator', + custom: true, + scopes: const ['.app', 'messaging'], + createdAt: DateTime.utc(2024, 1, 2), + updatedAt: DateTime.utc(2024, 3, 4), + ), + ); + }); + + test('SearchRolesResponse.toModel keeps the duration', () { + const response = api.SearchRolesResponse(duration: '0.02ms', roles: []); + + expect(response.toModel().duration, '0.02ms'); + }); + + test('SearchRolesResponse.toModel maps every role in order', () { + final response = api.SearchRolesResponse( + duration: '0.01ms', + roles: [_role('admin'), _role('moderator'), _role('user')], + ); + + final roles = response.toModel().roles; + + expect(roles.map((it) => it.name), ['admin', 'moderator', 'user']); + }); +} + +api.Role _role(String name) { + return api.Role( + name: name, + custom: false, + scopes: const ['.app'], + createdAt: DateTime.utc(2024), + updatedAt: DateTime.utc(2024), + ); +} diff --git a/packages/stream_chat/test/src/repository/roles_repository_test.dart b/packages/stream_chat/test/src/repository/roles_repository_test.dart index 78f9ae89d8..9ab3f984a8 100644 --- a/packages/stream_chat/test/src/repository/roles_repository_test.dart +++ b/packages/stream_chat/test/src/repository/roles_repository_test.dart @@ -1,7 +1,7 @@ // ignore_for_file: avoid_redundant_argument_values import 'package:mocktail/mocktail.dart'; -import 'package:stream_chat/open_api/api.dart'; +import 'package:stream_chat/open_api/api.dart' as api; import 'package:stream_chat/src/core/models/role_type.dart'; import 'package:stream_chat/src/repository/roles_repository.dart'; import 'package:stream_core/stream_core.dart'; @@ -10,37 +10,22 @@ import 'package:test/test.dart'; import '../mocks.dart'; void main() { - late MockDefaultApi api; - late RolesRepository repository; - - Role role(String name) => Role( - name: name, - custom: false, - scopes: const ['.app'], - createdAt: DateTime.utc(2024), - updatedAt: DateTime.utc(2024), - ); - - setUp(() { - api = MockDefaultApi(); - repository = RolesRepository(api); - }); - - test('should forward only the query when nothing else is passed', () async { - when(() => api.searchRoles(query: 'adm')).thenAnswer( - (_) async => const Result.success(SearchRolesResponse(duration: '0.01ms', roles: [])), + test('RolesRepository.searchRoles forwards only the query when nothing else is passed', () async { + final defaultApi = MockDefaultApi(); + when(() => defaultApi.searchRoles(query: 'adm')).thenAnswer( + (_) async => const Result.success(api.SearchRolesResponse(duration: '0.01ms', roles: [])), ); - final res = await repository.searchRoles('adm'); + await RolesRepository(defaultApi).searchRoles('adm'); - expect(res.getOrNull()?.roles, isEmpty); - verify(() => api.searchRoles(query: 'adm')).called(1); - verifyNoMoreInteractions(api); + verify(() => defaultApi.searchRoles(query: 'adm')).called(1); + verifyNoMoreInteractions(defaultApi); }); - test('should forward every parameter to the generated client', () async { + test('RolesRepository.searchRoles forwards every parameter to the generated client', () async { + final defaultApi = MockDefaultApi(); when( - () => api.searchRoles( + () => defaultApi.searchRoles( query: 'adm', limit: 10, nameGt: 'admin', @@ -48,10 +33,10 @@ void main() { includeGlobalRoles: true, ), ).thenAnswer( - (_) async => Result.success(SearchRolesResponse(duration: '0.01ms', roles: [role('admin')])), + (_) async => const Result.success(api.SearchRolesResponse(duration: '0.01ms', roles: [])), ); - final res = await repository.searchRoles( + await RolesRepository(defaultApi).searchRoles( 'adm', limit: 10, nameGt: 'admin', @@ -59,9 +44,8 @@ void main() { includeGlobalRoles: true, ); - expect(res.getOrNull()?.roles.single.name, 'admin'); verify( - () => api.searchRoles( + () => defaultApi.searchRoles( query: 'adm', limit: 10, nameGt: 'admin', @@ -69,16 +53,27 @@ void main() { includeGlobalRoles: true, ), ).called(1); - verifyNoMoreInteractions(api); + verifyNoMoreInteractions(defaultApi); + }); + + test('RolesRepository.searchRoles returns the mapped response', () async { + final defaultApi = MockDefaultApi(); + when(() => defaultApi.searchRoles(query: 'mod')).thenAnswer( + (_) async => const Result.success(api.SearchRolesResponse(duration: '0.02ms', roles: [])), + ); + + final res = await RolesRepository(defaultApi).searchRoles('mod'); + + expect(res.getOrNull()?.duration, '0.02ms'); }); - test('should return the failure without throwing', () async { + test('RolesRepository.searchRoles returns the failure without throwing', () async { + final defaultApi = MockDefaultApi(); const error = StreamClientException(message: 'boom'); - when(() => api.searchRoles(query: 'adm')).thenAnswer((_) async => const Result.failure(error)); + when(() => defaultApi.searchRoles(query: 'adm')).thenAnswer((_) async => const Result.failure(error)); - final res = await repository.searchRoles('adm'); + final res = await RolesRepository(defaultApi).searchRoles('adm'); - expect(res.isFailure, isTrue); expect(res.exceptionOrNull(), error); }); } diff --git a/sample_app/lib/auth/auth_controller.dart b/sample_app/lib/auth/auth_controller.dart index c2d9287664..1dcf4f4ce8 100644 --- a/sample_app/lib/auth/auth_controller.dart +++ b/sample_app/lib/auth/auth_controller.dart @@ -4,7 +4,7 @@ import 'package:firebase_crashlytics/firebase_crashlytics.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/scheduler.dart'; import 'package:flutter_secure_storage/flutter_secure_storage.dart'; -import 'package:stream_chat_flutter/stream_chat_flutter.dart'; +import 'package:stream_chat_flutter/stream_chat_flutter.dart' hide PushProvider; import 'package:stream_chat_persistence/stream_chat_persistence.dart'; import '../push/push_provider.dart'; diff --git a/sample_app/lib/push/push_provider.dart b/sample_app/lib/push/push_provider.dart index 092ba679e6..3ce184994e 100644 --- a/sample_app/lib/push/push_provider.dart +++ b/sample_app/lib/push/push_provider.dart @@ -15,7 +15,7 @@ class PushProvider { const PushProvider.firebase({ required this.name, this._tokenStreamProvider = _firebaseTokenProvider, - }) : type = chat.CreateDeviceRequestPushProvider.firebase; + }) : type = chat.PushProvider.firebase; /// Raw Apple Push Notification service. /// @@ -26,7 +26,7 @@ class PushProvider { const PushProvider.apn({ required this.name, this._tokenStreamProvider = _apnTokenProvider, - }) : type = chat.CreateDeviceRequestPushProvider.apn; + }) : type = chat.PushProvider.apn; static Stream _firebaseTokenProvider() async* { // On iOS, `getToken()` throws if the APNs token isn't registered with @@ -77,7 +77,7 @@ class PushProvider { final String name; /// The Stream Chat provider type (FCM or APNs). - final chat.CreateDeviceRequestPushProvider type; + final chat.PushProvider type; /// Returns the current push token, or throws [TimeoutException] if /// the token isn't available within [timeout]. diff --git a/sample_app/lib/push/push_token_manager.dart b/sample_app/lib/push/push_token_manager.dart index bec5f45d1c..a77b6e7397 100644 --- a/sample_app/lib/push/push_token_manager.dart +++ b/sample_app/lib/push/push_token_manager.dart @@ -1,7 +1,7 @@ import 'dart:async'; import 'package:flutter/foundation.dart' show debugPrint; -import 'package:stream_chat_flutter/stream_chat_flutter.dart'; +import 'package:stream_chat_flutter/stream_chat_flutter.dart' hide PushProvider; import 'push_provider.dart'; From 9e67fa12adb1238b9bb4667d13e53a30c2a0e2ad Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Mon, 28 Sep 2026 15:36:45 +0200 Subject: [PATCH 23/36] chore(repo): build the generator from chat's tools/openapi (#3014) Co-authored-by: Claude Opus 5.5 (1M context) --- scripts/generate.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/generate.sh b/scripts/generate.sh index b1e0a5e2d9..8237f21a69 100755 --- a/scripts/generate.sh +++ b/scripts/generate.sh @@ -80,6 +80,8 @@ git_stamp() { # ---------- validation ---------- [[ -d "$CHAT_BACKEND_DIR" ]] || { echo "❌ CHAT_BACKEND_DIR not found: $CHAT_BACKEND_DIR"; exit 1; } +GENERATOR_DIR="$CHAT_BACKEND_DIR/tools/openapi" +[[ -d "$GENERATOR_DIR" ]] || { echo "❌ Generator not found: $GENERATOR_DIR (pull GetStream/chat)"; exit 1; } command -v go >/dev/null || { echo "❌ 'go' is required in PATH"; exit 1; } command -v dart >/dev/null || { echo "❌ 'dart' is required in PATH"; exit 1; } command -v python3 >/dev/null || { echo "❌ 'python3' is required in PATH"; exit 1; } @@ -210,9 +212,9 @@ else # Generate a fresh spec (YAML + JSON) from the backend monolith ( set -o pipefail - cd "$CHAT_BACKEND_DIR/projects/chat-manager" + cd "$GENERATOR_DIR" - go run . openapi generate-spec \ + go run . generate-spec \ -products "$PRODUCTS" \ -version "$API_VERSION" \ --clientside \ @@ -250,9 +252,9 @@ mkdir -p "$OUTPUT_DIR" # Generate the Dart client into the package's lib/open_api directory ( set -o pipefail - cd "$CHAT_BACKEND_DIR/projects/chat-manager" + cd "$GENERATOR_DIR" - go run . openapi generate-client \ + go run . generate-client \ --language dart \ --spec "$SPEC_FILE" \ --output "$OUTPUT_DIR" From 1b0f88db4368e3b05af34bcf5450d95ccee0ab8d Mon Sep 17 00:00:00 2001 From: Petar Velikov Date: Mon, 28 Sep 2026 16:07:45 +0200 Subject: [PATCH 24/36] refactor(llc, ui)!: route `enrichUrl` through the generated client (#2996) * refactor(llc, ui)!: keep the generated OG response off the public API Co-Authored-By: Claude Opus 5.5 * docs(repo): record the enrichUrl migration against domain models Co-Authored-By: Claude Opus 5.5 * refactor(llc): move OGAttachmentResponse into models/response Co-Authored-By: Claude Opus 5.5 * refactor(ui): drop the unreachable enrichUrl error handler in the composer Co-Authored-By: Claude Opus 5.5 * refactor(llc, ui): keep OGAttachmentResponse.ogScrapeUrl non-null Co-Authored-By: Claude Opus 5.5 * test(llc): cover enrichUrl through the public client only Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: Claude Opus 5.5 --- migrations/v11-migration.md | 34 ++++ openapi-migration/04-roles-guest-and-app.md | 17 +- openapi-migration/10-messages.md | 1 + openapi-migration/README.md | 4 +- openapi-migration/tool/generate_plan.py | 20 ++- packages/stream_chat/CHANGELOG.md | 5 +- .../stream_chat/lib/src/client/client.dart | 11 +- .../lib/src/core/api/general_api.dart | 12 -- .../lib/src/core/api/responses.dart | 39 ---- .../lib/src/core/api/responses.g.dart | 15 -- .../lib/src/core/models/attachment.dart | 2 +- .../response/og_attachment_response.dart | 68 +++++++ .../og_attachment_response.freezed.dart | 168 ++++++++++++++++++ .../src/repository/general_repository.dart | 23 +++ .../src/repository/mapper/general_mapper.dart | 22 +++ packages/stream_chat/lib/stream_chat.dart | 1 + .../test/src/client/client_test.dart | 128 +++++++++++-- .../test/src/core/api/general_api_test.dart | 41 ----- .../mapper/devices_mapper_test.dart | 7 +- .../stream_message_composer.dart | 38 ++-- .../message_composer_url_enrichment_test.dart | 70 +++++++- 21 files changed, 562 insertions(+), 164 deletions(-) create mode 100644 packages/stream_chat/lib/src/core/models/response/og_attachment_response.dart create mode 100644 packages/stream_chat/lib/src/core/models/response/og_attachment_response.freezed.dart create mode 100644 packages/stream_chat/lib/src/repository/general_repository.dart create mode 100644 packages/stream_chat/lib/src/repository/mapper/general_mapper.dart diff --git a/migrations/v11-migration.md b/migrations/v11-migration.md index a6d2fe4c9e..bece8e5ec3 100644 --- a/migrations/v11-migration.md +++ b/migrations/v11-migration.md @@ -27,6 +27,7 @@ onto Stream's OpenAPI-generated API client. - [Sorting](#sorting) - [Roles](#roles) - [Devices](#devices) + - [Link Previews](#link-previews) - [Migration Checklist](#migration-checklist) - [For AI Agents](#for-ai-agents) - [Contributing to this guide](#contributing-to-this-guide) @@ -162,6 +163,12 @@ search-and-replace you can apply directly. `Kind` is one of `renamed`, `removed` | `Device` / `ListDevicesResponse` / `SearchRolesResponse` identity `==` | value `==`, plus `copyWith` | `retyped` | Two instances with the same fields are now equal | | `Role extends Equatable`, `Role.props` | `Role` (value `==`, `copyWith`) | `removed` | Equality is unchanged; `props` is gone and `Role` is no longer an `Equatable` | | `StreamChatApi.device` | `StreamChatApi.pushPreferences` | `renamed` | The class handles only `setPushPreferences` now; device calls moved to the generated client | +| `StreamChatClient.enrichUrl` → `Future` | `Future>` | `retyped` | Returns a `Result` instead of throwing | +| `OGAttachmentResponse.fromJson` | — | `removed` | The response is a plain class; construct it directly | +| `OGAttachmentResponse()..ogScrapeUrl = …` and its other setters | `OGAttachmentResponse(duration: …, ogScrapeUrl: …)` | `retyped` | A plain class with a const constructor and final fields | +| `OGAttachmentResponse.duration` (`String?`) | `String` | `retyped` | Always present; drop any `!` or `?? ''` | +| `OGAttachmentResponse` identity `==` | value `==`, plus `copyWith` | `retyped` | Two instances with the same fields are now equal | +| `StreamChatApi.general.enrichUrl` | `StreamChatClient.enrichUrl` | `removed` | The endpoint moved to the generated client | | _(more added per feature as PRs land)_ | | | | --- @@ -479,6 +486,33 @@ final device = Device(id: token, pushProvider: PushProvider.firebase); A `switch` over a `PushProvider` is no longer exhaustive; give it a default case. +### Link Previews + +**`enrichUrl` returns a `Result` instead of throwing.** `OGAttachmentResponse` keeps its name and fields, and +`Attachment.fromOGAttachment` still takes it. + +```dart +// v10 +try { + final og = await client.enrichUrl(url); + showPreview(Attachment.fromOGAttachment(og)); +} on StreamChatException catch (e) { + report(e); +} + +// v11 +final result = await client.enrichUrl(url); +result.fold( + onSuccess: (og) => showPreview(Attachment.fromOGAttachment(og)), + onFailure: (error, _) => report(error), +); +``` + +**`OGAttachmentResponse` no longer decodes JSON.** It is a plain class; build it with its constructor — +`OGAttachmentResponse(duration: '0ms', ogScrapeUrl: url)` where v10 wrote `OGAttachmentResponse()..ogScrapeUrl = url`. + +**`duration` is a non-nullable `String`**, where v10 typed it `String?`. + --- ## Migration Checklist diff --git a/openapi-migration/04-roles-guest-and-app.md b/openapi-migration/04-roles-guest-and-app.md index 3d323983c4..266a322974 100644 --- a/openapi-migration/04-roles-guest-and-app.md +++ b/openapi-migration/04-roles-guest-and-app.md @@ -2,7 +2,7 @@ **Goal:** Sweep up the singletons — one-method families that share no state and can land in one PR. -**Size:** 3 hand-written method(s) across 2 file(s) → 5 generated operation(s). +**Size:** 2 hand-written method(s) across 2 file(s) → 5 generated operation(s). > Tables are generated by `openapi-migration/tool/generate_plan.py`. Edit the prose, not the tables. @@ -13,7 +13,6 @@ | File | Method | Returns | | --- | --- | --- | | `guest_api.dart` | `getGuestUser` | `ConnectGuestUserResponse` | -| `general_api.dart` | `enrichUrl` | `OGAttachmentResponse` | | `general_api.dart` | `getAppSettings` | `GetAppSettingsResponse` | ### Generated operations that cover it @@ -50,10 +49,22 @@ The trade-off, for the record: no `.values`, no exhaustive `switch`, and `RoleType('nonsense')` is constructible and reaches the wire. That matches the four extension types this package already ships. +- **`OGAttachmentResponse` stays our public type, with its v10 name and fields,** as a plain class with no + JSON, mapped from the generated `GetOGResponse` in `lib/src/repository/mapper/general_mapper.dart`. + `enrichUrl` routes through `getOG` via `GeneralRepository`. The v10 name is kept although the generated + one differs: it is the name customers already use. +- **`ogScrapeUrl` stays non-null, as in v10.** The server sets it on every successful scrape; the spec marks + it optional only because the response embeds the shared attachment payload. The mapper falls back to the + requested URL, which cannot happen in practice. +- **The twelve fields the generated response adds are not exposed** (`actions`, `author_icon`, `color`, + `custom`, `fallback`, `fields`, `footer`, `footer_icon`, `giphy`, `original_height`, `original_width`, + `pretext`). Adding them later is non-breaking. `Attachment.fromOGAttachment` is unchanged. +- **`Action` is left alone.** `OGAttachmentResponse` carries no actions, so nothing here needs it; it is + converted with its parent `Attachment` in [group 10](10-messages.md). ## Risks -- `general_api.dart` is split across four groups — only `enrichUrl` and `getAppSettings` belong here. `sync` and `queryMembers` go to group 11, `searchMessages` to group 10. Do not migrate the file as a unit. +- `general_api.dart` is split across three groups — only `getAppSettings` is left here. `sync` and `queryMembers` go to group 11, `searchMessages` to group 10. Do not migrate the file as a unit. ## Definition of done diff --git a/openapi-migration/10-messages.md b/openapi-migration/10-messages.md index 133b1040f8..3cd461ff1a 100644 --- a/openapi-migration/10-messages.md +++ b/openapi-migration/10-messages.md @@ -48,6 +48,7 @@ - `Message` is public, persisted, WebSocket-delivered and the most customised type in the SDK. Keep ours; treat the generated `MessageResponse` as a mapping source only. - `Attachment`: the generated model defines fields our `extraData` currently absorbs. Decide the promotion rules before writing the mapper. +- `Action` is still the v10 json_serializable class, embedded in `Attachment.actions`, which `Attachment.toJson` writes when sending and `toData` writes to persistence. It becomes a plain model with `Attachment`; group 04 left it alone. ## Risks diff --git a/openapi-migration/README.md b/openapi-migration/README.md index 0a00f23eb8..edf7750ca5 100644 --- a/openapi-migration/README.md +++ b/openapi-migration/README.md @@ -15,7 +15,7 @@ generated operations in scope, the decisions that group has to make, its risks, | [01](01-foundation.md) | Foundation — `DefaultApi` wiring, `User` shape | — | — | ☐ | | [02](02-devices.md) | Devices | 0 | 3 | ☑ | | [03](03-user-groups.md) | User Groups | 8 | 8 | ☐ | -| [04](04-roles-guest-and-app.md) | Roles, Guest & App Settings | 3 | 5 | ☐ | +| [04](04-roles-guest-and-app.md) | Roles, Guest & App Settings | 2 | 5 | ☐ | | [05](05-polls.md) | Polls | 13 | 13 | ☐ | | [06](06-reminders.md) | Message Reminders | 4 | 4 | ☐ | | [07](07-threads-and-drafts.md) | Threads & Drafts | 7 | 7 | ☐ | @@ -26,7 +26,7 @@ generated operations in scope, the decisions that group has to make, its risks, | [12](12-uploads-cdn.md) | Uploads (CDN) | 8 | 8 | ☐ | | [13](13-push-preferences.md) | Push Preferences | 1 | 1 | ☐ | -**Coverage:** 105 hand-written methods across 12 files, and all 128 generated operations, each claimed by exactly +**Coverage:** 104 hand-written methods across 12 files, and all 129 generated operations, each claimed by exactly one group. Verified mechanically — see [Keeping this plan honest](#keeping-this-plan-honest). ## Goals diff --git a/openapi-migration/tool/generate_plan.py b/openapi-migration/tool/generate_plan.py index 01d89d4244..add56d6523 100644 --- a/openapi-migration/tool/generate_plan.py +++ b/openapi-migration/tool/generate_plan.py @@ -184,8 +184,7 @@ def match(path): ), dict( num='04', slug='roles-guest-and-app', title='Roles, Guest & App Settings', - hand=['guest_api.dart', - 'general_api.dart::enrichUrl', 'general_api.dart::getAppSettings'], + hand=['guest_api.dart', 'general_api.dart::getAppSettings'], match=owns('/api/v2/roles', '/api/v2/guest', '/api/v2/app', '/api/v2/og', '/api/v2/longpoll'), goal='Sweep up the singletons — one-method families that share no state and can land in one PR.', decisions=[ @@ -211,9 +210,21 @@ def match(path): The trade-off, for the record: no `.values`, no exhaustive `switch`, and `RoleType('nonsense')` is constructible and reaches the wire. That matches the four extension types this package already ships. + - **`OGAttachmentResponse` stays our public type, with its v10 name and fields,** as a plain class with no + JSON, mapped from the generated `GetOGResponse` in `lib/src/repository/mapper/general_mapper.dart`. + `enrichUrl` routes through `getOG` via `GeneralRepository`. The v10 name is kept although the generated + one differs: it is the name customers already use. + - **`ogScrapeUrl` stays non-null, as in v10.** The server sets it on every successful scrape; the spec marks + it optional only because the response embeds the shared attachment payload. The mapper falls back to the + requested URL, which cannot happen in practice. + - **The twelve fields the generated response adds are not exposed** (`actions`, `author_icon`, `color`, + `custom`, `fallback`, `fields`, `footer`, `footer_icon`, `giphy`, `original_height`, `original_width`, + `pretext`). Adding them later is non-breaking. `Attachment.fromOGAttachment` is unchanged. + - **`Action` is left alone.** `OGAttachmentResponse` carries no actions, so nothing here needs it; it is + converted with its parent `Attachment` in [group 10](10-messages.md). """), risks=[ - '`general_api.dart` is split across four groups — only `enrichUrl` and `getAppSettings` belong here. ' + '`general_api.dart` is split across three groups — only `getAppSettings` is left here. ' '`sync` and `queryMembers` go to group 11, `searchMessages` to group 10. Do not migrate the file as a ' 'unit.', ], @@ -317,6 +328,9 @@ def match(path): 'ours; treat the generated `MessageResponse` as a mapping source only.', '`Attachment`: the generated model defines fields our `extraData` currently absorbs. Decide the ' 'promotion rules before writing the mapper.', + '`Action` is still the v10 json_serializable class, embedded in `Attachment.actions`, which ' + '`Attachment.toJson` writes when sending and `toData` writes to persistence. It becomes a plain model ' + 'with `Attachment`; group 04 left it alone.', ], risks=[ '`message_api.dart` also holds the four draft methods, which belong to group 07 — leave them alone ' diff --git a/packages/stream_chat/CHANGELOG.md b/packages/stream_chat/CHANGELOG.md index 0946ca9c6a..b0e2dd153e 100644 --- a/packages/stream_chat/CHANGELOG.md +++ b/packages/stream_chat/CHANGELOG.md @@ -50,9 +50,12 @@ - `Device`, `Role`, `ListDevicesResponse` and `SearchRolesResponse` no longer decode from or encode to JSON. - `PushProvider` is an extension type over its wire string instead of an enum, and `Device.pushProvider` is typed `PushProvider` instead of `String`. - `ListDevicesResponse` and `SearchRolesResponse` are immutable, built through a const constructor, and their `duration` is a non-nullable `String`. -- `Device`, `ListDevicesResponse` and `SearchRolesResponse` compare by value and gain `copyWith`. +- `Device`, `ListDevicesResponse`, `SearchRolesResponse` and `OGAttachmentResponse` compare by value and gain `copyWith`. - `Role` no longer extends `Equatable`, so `props` is removed; it still compares by value and gains `copyWith`. - `StreamChatApi.device` is renamed `StreamChatApi.pushPreferences` and handles only `setPushPreferences`. +- `StreamChatClient.enrichUrl` returns a `Result` instead of throwing. +- `OGAttachmentResponse` no longer decodes from JSON, is built through a const constructor, and its `duration` is a non-nullable `String`. +- `StreamChatApi.general.enrichUrl` is removed; call `StreamChatClient.enrichUrl` instead. 🐞 Fixed diff --git a/packages/stream_chat/lib/src/client/client.dart b/packages/stream_chat/lib/src/client/client.dart index 2adedc75d1..57fd9d52f0 100644 --- a/packages/stream_chat/lib/src/client/client.dart +++ b/packages/stream_chat/lib/src/client/client.dart @@ -58,6 +58,7 @@ import '../core/models/poll_vote.dart'; import '../core/models/push_preference.dart'; import '../core/models/push_provider.dart'; import '../core/models/reaction.dart'; +import '../core/models/response/og_attachment_response.dart'; import '../core/models/role_type.dart'; import '../core/models/search_roles_response.dart'; import '../core/models/thread.dart'; @@ -69,6 +70,7 @@ import '../core/util/utils.dart'; import '../db/chat_persistence_client.dart'; import '../event_type.dart'; import '../repository/devices_repository.dart'; +import '../repository/general_repository.dart'; import '../repository/roles_repository.dart'; import '../ws/connect_request.dart'; import '../ws/connection_manager.dart'; @@ -167,6 +169,7 @@ class StreamChatClient { final api = defaultApi ?? DefaultApi(httpClient); _rolesRepository = RolesRepository(api); _devicesRepository = DevicesRepository(api); + _generalRepository = GeneralRepository(api); _connection = ConnectionManager( request: ConnectRequest.forApi( @@ -202,6 +205,7 @@ class StreamChatClient { late final StreamChatApi _chatApi; late final RolesRepository _rolesRepository; late final DevicesRepository _devicesRepository; + late final GeneralRepository _generalRepository; late final ConnectionManager _connection; StreamSubscription? _wsEventSubscription; @@ -2219,8 +2223,11 @@ class StreamChatClient { }, ); - /// Get OpenGraph data of the given [url]. - Future enrichUrl(String url) => _chatApi.general.enrichUrl(url); + /// Scrapes `url` for the OpenGraph metadata a link preview is built from. + /// + /// The server fetches the page itself, so a URL it cannot scrape comes back + /// as a failure. + Future> enrichUrl(String url) => _generalRepository.enrichUrl(url); /// Re-fetches the [AppSettings] and updates [appSettings]. /// diff --git a/packages/stream_chat/lib/src/core/api/general_api.dart b/packages/stream_chat/lib/src/core/api/general_api.dart index 8fc1bb2e76..7a47199aa3 100644 --- a/packages/stream_chat/lib/src/core/api/general_api.dart +++ b/packages/stream_chat/lib/src/core/api/general_api.dart @@ -94,18 +94,6 @@ class GeneralApi { return QueryMembersResponse.fromJson(response.data); } - /// Get OpenGraph data of the given [url]. - Future enrichUrl(String url) async { - final response = await _client.get( - '/og', - queryParameters: { - 'url': url, - }, - ); - - return OGAttachmentResponse.fromJson(response.data); - } - /// Fetches the app settings from the `GET /app` endpoint. Future getAppSettings() async { final response = await _client.get('/app'); diff --git a/packages/stream_chat/lib/src/core/api/responses.dart b/packages/stream_chat/lib/src/core/api/responses.dart index 9ef0c2f6ea..74eb25937c 100644 --- a/packages/stream_chat/lib/src/core/api/responses.dart +++ b/packages/stream_chat/lib/src/core/api/responses.dart @@ -454,45 +454,6 @@ class ChannelStateResponse extends _BaseResponse { static ChannelStateResponse fromJson(Map json) => _$ChannelStateResponseFromJson(json); } -/// Model response for [Client.enrichUrl] api call. -@JsonSerializable(createToJson: false) -class OGAttachmentResponse extends _BaseResponse { - /// The URL of the page that was scraped. - late String ogScrapeUrl; - - /// The URL of the asset. - String? assetUrl; - - /// The URL of the author. - String? authorLink; - - /// The name of the author. - String? authorName; - - /// The URL of the image. - String? imageUrl; - - /// The text of the attachment. - String? text; - - /// The URL of the thumbnail. - String? thumbUrl; - - /// The title of the attachment. - String? title; - - /// The URL of the title. - String? titleLink; - - /// The type of the attachment. - /// - /// 'video' | 'audio' | 'image' - String? type; - - /// Create a new instance from a [json]. - static OGAttachmentResponse fromJson(Map json) => _$OGAttachmentResponseFromJson(json); -} - /// Contains information about a [User] that was banned from a [Channel] or App. @JsonSerializable(createToJson: false) class UserBlockResponse extends _BaseResponse { diff --git a/packages/stream_chat/lib/src/core/api/responses.g.dart b/packages/stream_chat/lib/src/core/api/responses.g.dart index f75c5f87f2..4502e2dda4 100644 --- a/packages/stream_chat/lib/src/core/api/responses.g.dart +++ b/packages/stream_chat/lib/src/core/api/responses.g.dart @@ -221,21 +221,6 @@ ChannelStateResponse _$ChannelStateResponseFromJson( ..watcherCount = (json['watcher_count'] as num?)?.toInt() ?? 0 ..read = (json['read'] as List?)?.map((e) => Read.fromJson(e as Map)).toList() ?? []; -OGAttachmentResponse _$OGAttachmentResponseFromJson( - Map json, -) => OGAttachmentResponse() - ..duration = json['duration'] as String? - ..ogScrapeUrl = json['og_scrape_url'] as String - ..assetUrl = json['asset_url'] as String? - ..authorLink = json['author_link'] as String? - ..authorName = json['author_name'] as String? - ..imageUrl = json['image_url'] as String? - ..text = json['text'] as String? - ..thumbUrl = json['thumb_url'] as String? - ..title = json['title'] as String? - ..titleLink = json['title_link'] as String? - ..type = json['type'] as String?; - UserBlockResponse _$UserBlockResponseFromJson(Map json) => UserBlockResponse() ..duration = json['duration'] as String? ..blockedByUserId = json['blocked_by_user_id'] as String? ?? '' diff --git a/packages/stream_chat/lib/src/core/models/attachment.dart b/packages/stream_chat/lib/src/core/models/attachment.dart index 8d37339bef..91e46e23b3 100644 --- a/packages/stream_chat/lib/src/core/models/attachment.dart +++ b/packages/stream_chat/lib/src/core/models/attachment.dart @@ -4,10 +4,10 @@ import 'package:equatable/equatable.dart'; import 'package:json_annotation/json_annotation.dart'; import 'package:uuid/uuid.dart'; -import '../api/responses.dart'; import '../util/serializer.dart'; import 'action.dart'; import 'attachment_file.dart'; +import 'response/og_attachment_response.dart'; part 'attachment.g.dart'; diff --git a/packages/stream_chat/lib/src/core/models/response/og_attachment_response.dart b/packages/stream_chat/lib/src/core/models/response/og_attachment_response.dart new file mode 100644 index 0000000000..0d99002bee --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/response/og_attachment_response.dart @@ -0,0 +1,68 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'og_attachment_response.freezed.dart'; + +/// The OpenGraph metadata scraped for a URL, returned by [StreamChatClient.enrichUrl]. +/// +/// [Attachment.fromOGAttachment] builds a link preview attachment from it. +@freezed +class OGAttachmentResponse with _$OGAttachmentResponse { + /// Creates a new [OGAttachmentResponse]. + const OGAttachmentResponse({ + required this.duration, + required this.ogScrapeUrl, + this.assetUrl, + this.authorLink, + this.authorName, + this.imageUrl, + this.text, + this.thumbUrl, + this.title, + this.titleLink, + this.type, + }); + + /// How long the server took to handle the request, such as `4.21ms`. + @override + final String duration; + + /// The URL of the page that was scraped. + @override + final String ogScrapeUrl; + + /// The URL of the audio, video or image the page links to. + @override + final String? assetUrl; + + /// The URL of the page's author. + @override + final String? authorLink; + + /// The name of the page's author, such as the site it was published on. + @override + final String? authorName; + + /// The URL of the image the page is previewed with. + @override + final String? imageUrl; + + /// The description of the page. + @override + final String? text; + + /// The URL of a thumbnail of the page's image. + @override + final String? thumbUrl; + + /// The title of the page. + @override + final String? title; + + /// The URL the title links to. + @override + final String? titleLink; + + /// The kind of media the page carries, such as `image`, `video` or `audio`. + @override + final String? type; +} diff --git a/packages/stream_chat/lib/src/core/models/response/og_attachment_response.freezed.dart b/packages/stream_chat/lib/src/core/models/response/og_attachment_response.freezed.dart new file mode 100644 index 0000000000..69b99789ef --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/response/og_attachment_response.freezed.dart @@ -0,0 +1,168 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'og_attachment_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$OGAttachmentResponse { + String get duration; + String get ogScrapeUrl; + String? get assetUrl; + String? get authorLink; + String? get authorName; + String? get imageUrl; + String? get text; + String? get thumbUrl; + String? get title; + String? get titleLink; + String? get type; + + /// Create a copy of OGAttachmentResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $OGAttachmentResponseCopyWith get copyWith => + _$OGAttachmentResponseCopyWithImpl(this as OGAttachmentResponse, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is OGAttachmentResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.ogScrapeUrl, ogScrapeUrl) || other.ogScrapeUrl == ogScrapeUrl) && + (identical(other.assetUrl, assetUrl) || other.assetUrl == assetUrl) && + (identical(other.authorLink, authorLink) || other.authorLink == authorLink) && + (identical(other.authorName, authorName) || other.authorName == authorName) && + (identical(other.imageUrl, imageUrl) || other.imageUrl == imageUrl) && + (identical(other.text, text) || other.text == text) && + (identical(other.thumbUrl, thumbUrl) || other.thumbUrl == thumbUrl) && + (identical(other.title, title) || other.title == title) && + (identical(other.titleLink, titleLink) || other.titleLink == titleLink) && + (identical(other.type, type) || other.type == type)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + duration, + ogScrapeUrl, + assetUrl, + authorLink, + authorName, + imageUrl, + text, + thumbUrl, + title, + titleLink, + type, + ); + + @override + String toString() { + return 'OGAttachmentResponse(duration: $duration, ogScrapeUrl: $ogScrapeUrl, assetUrl: $assetUrl, authorLink: $authorLink, authorName: $authorName, imageUrl: $imageUrl, text: $text, thumbUrl: $thumbUrl, title: $title, titleLink: $titleLink, type: $type)'; + } +} + +/// @nodoc +abstract mixin class $OGAttachmentResponseCopyWith<$Res> { + factory $OGAttachmentResponseCopyWith(OGAttachmentResponse value, $Res Function(OGAttachmentResponse) _then) = + _$OGAttachmentResponseCopyWithImpl; + @useResult + $Res call({ + String duration, + String ogScrapeUrl, + String? assetUrl, + String? authorLink, + String? authorName, + String? imageUrl, + String? text, + String? thumbUrl, + String? title, + String? titleLink, + String? type, + }); +} + +/// @nodoc +class _$OGAttachmentResponseCopyWithImpl<$Res> implements $OGAttachmentResponseCopyWith<$Res> { + _$OGAttachmentResponseCopyWithImpl(this._self, this._then); + + final OGAttachmentResponse _self; + final $Res Function(OGAttachmentResponse) _then; + + /// Create a copy of OGAttachmentResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? duration = null, + Object? ogScrapeUrl = null, + Object? assetUrl = freezed, + Object? authorLink = freezed, + Object? authorName = freezed, + Object? imageUrl = freezed, + Object? text = freezed, + Object? thumbUrl = freezed, + Object? title = freezed, + Object? titleLink = freezed, + Object? type = freezed, + }) { + return _then( + OGAttachmentResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + ogScrapeUrl: null == ogScrapeUrl + ? _self.ogScrapeUrl + : ogScrapeUrl // ignore: cast_nullable_to_non_nullable + as String, + assetUrl: freezed == assetUrl + ? _self.assetUrl + : assetUrl // ignore: cast_nullable_to_non_nullable + as String?, + authorLink: freezed == authorLink + ? _self.authorLink + : authorLink // ignore: cast_nullable_to_non_nullable + as String?, + authorName: freezed == authorName + ? _self.authorName + : authorName // ignore: cast_nullable_to_non_nullable + as String?, + imageUrl: freezed == imageUrl + ? _self.imageUrl + : imageUrl // ignore: cast_nullable_to_non_nullable + as String?, + text: freezed == text + ? _self.text + : text // ignore: cast_nullable_to_non_nullable + as String?, + thumbUrl: freezed == thumbUrl + ? _self.thumbUrl + : thumbUrl // ignore: cast_nullable_to_non_nullable + as String?, + title: freezed == title + ? _self.title + : title // ignore: cast_nullable_to_non_nullable + as String?, + titleLink: freezed == titleLink + ? _self.titleLink + : titleLink // ignore: cast_nullable_to_non_nullable + as String?, + type: freezed == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/src/repository/general_repository.dart b/packages/stream_chat/lib/src/repository/general_repository.dart new file mode 100644 index 0000000000..1b5b23ef2e --- /dev/null +++ b/packages/stream_chat/lib/src/repository/general_repository.dart @@ -0,0 +1,23 @@ +import 'package:stream_core/stream_core.dart' show PatternMatching, Result; + +import '../../open_api/api.dart' as api; +import '../core/models/response/og_attachment_response.dart'; +import 'mapper/general_mapper.dart'; + +/// Repository dedicated to operations that belong to no single feature. +class GeneralRepository { + /// Initialize a new general repository. + const GeneralRepository(this._api); + + final api.DefaultApi _api; + + /// Scrapes `url` for the OpenGraph metadata a link preview is built from. + /// + /// The server fetches the page itself, so a URL it cannot scrape comes back + /// as a failure. + Future> enrichUrl(String url) async { + final result = await _api.getOG(url: url); + + return result.map((response) => response.toModel(requestedUrl: url)); + } +} diff --git a/packages/stream_chat/lib/src/repository/mapper/general_mapper.dart b/packages/stream_chat/lib/src/repository/mapper/general_mapper.dart new file mode 100644 index 0000000000..8cd6c0cf70 --- /dev/null +++ b/packages/stream_chat/lib/src/repository/mapper/general_mapper.dart @@ -0,0 +1,22 @@ +import '../../../open_api/api.dart' as api; +import '../../core/models/response/og_attachment_response.dart'; + +/// Maps a generated [api.GetOGResponse] to an [OGAttachmentResponse]. +extension GetOGResponseMapper on api.GetOGResponse { + /// Converts this response into an [OGAttachmentResponse]. + /// + /// The [requestedUrl] stands in for `og_scrape_url` if the response leaves it out. + OGAttachmentResponse toModel({required String requestedUrl}) => OGAttachmentResponse( + duration: duration, + ogScrapeUrl: ogScrapeUrl ?? requestedUrl, + assetUrl: assetUrl, + authorLink: authorLink, + authorName: authorName, + imageUrl: imageUrl, + text: text, + thumbUrl: thumbUrl, + title: title, + titleLink: titleLink, + type: type, + ); +} diff --git a/packages/stream_chat/lib/stream_chat.dart b/packages/stream_chat/lib/stream_chat.dart index ea575e4a0f..6aab1c6203 100644 --- a/packages/stream_chat/lib/stream_chat.dart +++ b/packages/stream_chat/lib/stream_chat.dart @@ -118,6 +118,7 @@ export 'src/core/models/push_provider.dart'; export 'src/core/models/reaction.dart'; export 'src/core/models/reaction_group.dart'; export 'src/core/models/read.dart'; +export 'src/core/models/response/og_attachment_response.dart'; export 'src/core/models/role.dart'; export 'src/core/models/role_type.dart'; export 'src/core/models/search_roles_response.dart'; diff --git a/packages/stream_chat/test/src/client/client_test.dart b/packages/stream_chat/test/src/client/client_test.dart index 3f1afeb361..42bbfa911a 100644 --- a/packages/stream_chat/test/src/client/client_test.dart +++ b/packages/stream_chat/test/src/client/client_test.dart @@ -5071,31 +5071,127 @@ void main() { verifyNoMoreInteractions(fakeChatApi.message); }); - test('`.enrichUrl`', () async { + test('StreamChatClient.enrichUrl returns the scraped metadata of the url', () async { const url = 'https://www.techyourchance.com/finite-state-machine-with-unit-tests-real-world-example'; - when(() => fakeChatApi.general.enrichUrl(url)).thenAnswer( - (_) async => OGAttachmentResponse() - ..type = 'image' - ..ogScrapeUrl = url - ..authorName = 'TechYourChance' - ..title = 'Finite State Machine with Unit Tests: Real World Example', + when(() => defaultApi.getOG(url: url)).thenAnswer( + (_) async => const Result.success( + api.GetOGResponse( + duration: '0.01ms', + custom: {}, + type: 'image', + ogScrapeUrl: url, + authorName: 'TechYourChance', + title: 'Finite State Machine with Unit Tests: Real World Example', + ), + ), ); final res = await client.enrichUrl(url); + expect( + res.getOrNull(), + const OGAttachmentResponse( + duration: '0.01ms', + type: 'image', + ogScrapeUrl: url, + authorName: 'TechYourChance', + title: 'Finite State Machine with Unit Tests: Real World Example', + ), + ); - expect(res, isNotNull); - expect(res.type, 'image'); - expect(res.ogScrapeUrl, url); - expect(res.authorName, 'TechYourChance'); + verify(() => defaultApi.getOG(url: url)).called(1); + verifyNoMoreInteractions(defaultApi); + }); + + test('StreamChatClient.enrichUrl maps every field of a fully populated response', () async { + const url = 'https://getstream.io/chat'; + const image = api.ImageData( + frames: '1', + height: '200', + size: '1024', + url: 'https://giphy.com/1.gif', + width: '200', + ); + when(() => defaultApi.getOG(url: url)).thenAnswer( + (_) async => const Result.success( + api.GetOGResponse( + duration: '0.01ms', + ogScrapeUrl: 'https://getstream.io/chat/', + assetUrl: 'https://getstream.io/chat/intro.mp4', + authorIcon: 'https://getstream.io/favicon.ico', + authorLink: 'https://getstream.io', + authorName: 'Stream', + color: '#005fff', + custom: {'campaign': 'launch'}, + fallback: 'Stream Chat link preview', + footer: 'getstream.io', + footerIcon: 'https://getstream.io/footer.png', + imageUrl: 'https://getstream.io/chat/og.png', + originalHeight: 630, + originalWidth: 1200, + pretext: 'Stream Chat', + text: 'Build real-time chat in less time.', + thumbUrl: 'https://getstream.io/chat/og-thumb.png', + title: 'Chat API & SDKs', + titleLink: 'https://getstream.io/chat/?utm_source=og', + type: 'video', + actions: [api.Action(name: 'image_action', text: 'Send', type: 'button', style: 'primary', value: 'send')], + fields: [api.Field(short: true, title: 'Plan', value: 'Free')], + giphy: api.Images( + fixedHeight: image, + fixedHeightDownsampled: image, + fixedHeightStill: image, + fixedWidth: image, + fixedWidthDownsampled: image, + fixedWidthStill: image, + original: image, + ), + ), + ), + ); + + final res = await client.enrichUrl(url); expect( - res.title, - 'Finite State Machine with Unit Tests: Real World Example', + res.getOrNull(), + const OGAttachmentResponse( + duration: '0.01ms', + ogScrapeUrl: 'https://getstream.io/chat/', + assetUrl: 'https://getstream.io/chat/intro.mp4', + authorLink: 'https://getstream.io', + authorName: 'Stream', + imageUrl: 'https://getstream.io/chat/og.png', + text: 'Build real-time chat in less time.', + thumbUrl: 'https://getstream.io/chat/og-thumb.png', + title: 'Chat API & SDKs', + titleLink: 'https://getstream.io/chat/?utm_source=og', + type: 'video', + ), ); + }); - verify(() => fakeChatApi.general.enrichUrl(url)).called(1); - verify(() => fakeChatApi.general.getAppSettings()).called(1); - verifyNoMoreInteractions(fakeChatApi.general); + test('StreamChatClient.enrichUrl falls back to the requested url when the response has no scraped url', () async { + const url = 'https://getstream.io/chat/'; + when(() => defaultApi.getOG(url: url)).thenAnswer( + (_) async => const Result.success(api.GetOGResponse(duration: '0.01ms', custom: {}, title: 'Chat API & SDKs')), + ); + + final res = await client.enrichUrl(url); + + expect(res.getOrNull()?.ogScrapeUrl, url); + }); + + test('StreamChatClient.enrichUrl returns the failure without throwing', () async { + const url = 'https://unreachable.example'; + const error = StreamApiException( + code: StreamErrorCode.inputError, + message: 'could not find any opengraph data for the given URL', + statusCode: 400, + ); + when(() => defaultApi.getOG(url: url)).thenAnswer((_) async => const Result.failure(error)); + + final res = await client.enrichUrl(url); + + expect(res.exceptionOrNull(), error); }); test( diff --git a/packages/stream_chat/test/src/core/api/general_api_test.dart b/packages/stream_chat/test/src/core/api/general_api_test.dart index c0f0f698fd..09cbbb18c4 100644 --- a/packages/stream_chat/test/src/core/api/general_api_test.dart +++ b/packages/stream_chat/test/src/core/api/general_api_test.dart @@ -296,47 +296,6 @@ void main() { }); }); - test('enrichUrl', () async { - const path = '/og'; - const url = 'https://www.techyourchance.com/finite-state-machine-with-unit-tests-real-world-example'; - - when( - () => client.get( - path, - queryParameters: {'url': url}, - ), - ).thenAnswer( - (_) async => successResponse( - path, - data: { - 'type': 'image', - 'og_scrape_url': url, - 'author_name': 'TechYourChance', - 'title': 'Finite State Machine with Unit Tests: Real World Example', - }, - ), - ); - - final res = await generalApi.enrichUrl(url); - - expect(res, isNotNull); - expect(res.type, 'image'); - expect(res.ogScrapeUrl, url); - expect(res.authorName, 'TechYourChance'); - expect( - res.title, - 'Finite State Machine with Unit Tests: Real World Example', - ); - - verify( - () => client.get( - path, - queryParameters: {'url': url}, - ), - ).called(1); - verifyNoMoreInteractions(client); - }); - test('getAppSettings calls GET /app and parses response', () async { const path = '/app'; final fixture = jsonFixture('app_settings.json'); diff --git a/packages/stream_chat/test/src/repository/mapper/devices_mapper_test.dart b/packages/stream_chat/test/src/repository/mapper/devices_mapper_test.dart index b3bc7235dd..e342622b02 100644 --- a/packages/stream_chat/test/src/repository/mapper/devices_mapper_test.dart +++ b/packages/stream_chat/test/src/repository/mapper/devices_mapper_test.dart @@ -5,17 +5,12 @@ import 'package:stream_chat/src/repository/mapper/devices_mapper.dart'; import 'package:test/test.dart'; void main() { - test('DeviceResponse.toModel keeps the id and push provider of a fully populated response', () { + test('DeviceResponse.toModel maps the id and push provider', () { final response = api.DeviceResponse( id: 'device-id', pushProvider: 'firebase', - pushProviderName: 'staging', createdAt: DateTime.utc(2024), userId: 'user-id', - disabled: true, - disabledReason: 'expired', - hardwareId: 'hardware-id', - voip: false, ); expect(response.toModel(), const Device(id: 'device-id', pushProvider: PushProvider.firebase)); diff --git a/packages/stream_chat_flutter/lib/src/message_input/stream_message_composer.dart b/packages/stream_chat_flutter/lib/src/message_input/stream_message_composer.dart index fb51232add..a2db6d1e0e 100644 --- a/packages/stream_chat_flutter/lib/src/message_input/stream_message_composer.dart +++ b/packages/stream_chat_flutter/lib/src/message_input/stream_message_composer.dart @@ -1401,34 +1401,32 @@ class DefaultStreamMessageComposerState extends State result.fold( + onSuccess: (ogAttachment) { + final attachment = Attachment.fromOGAttachment(ogAttachment); + _effectiveController.setOGAttachment(attachment); + }, + onFailure: _handleEnrichUrlError, + ), ); } + void _handleEnrichUrlError(Object error, StackTrace? stackTrace) { + // Reset the ogAttachment if there was an error + _effectiveController.clearOGAttachment(); + widget.props.onError?.call(error, stackTrace); + } + final _ogAttachmentCache = {}; - Future _enrichUrl( + Future> _enrichUrl( String url, StreamChatClient client, ) async { - var response = _ogAttachmentCache[url]; - if (response == null) { - try { - response = await client.enrichUrl(url); - _ogAttachmentCache[url] = response; - } catch (e, stk) { - return Future.error(e, stk); - } - } - return response; + if (_ogAttachmentCache[url] case final cached?) return Result.success(cached); + + final result = await client.enrichUrl(url); + return result.onSuccess((response) => _ogAttachmentCache[url] = response); } // Validates [attachments] and adds the passing ones to the message diff --git a/packages/stream_chat_flutter/test/src/message_input/message_composer_url_enrichment_test.dart b/packages/stream_chat_flutter/test/src/message_input/message_composer_url_enrichment_test.dart index edab59c317..5183b1a2c8 100644 --- a/packages/stream_chat_flutter/test/src/message_input/message_composer_url_enrichment_test.dart +++ b/packages/stream_chat_flutter/test/src/message_input/message_composer_url_enrichment_test.dart @@ -44,11 +44,15 @@ void main() { when(channel.getRemainingCooldown).thenReturn(0); when(() => client.enrichUrl(any())).thenAnswer( - (invocation) async => OGAttachmentResponse()..ogScrapeUrl = invocation.positionalArguments.first as String, + (invocation) async => Result.success(_ogResponse(invocation.positionalArguments.first as String)), ); }); - Future enrichUrlFrom(WidgetTester tester, String text) async { + Future pumpComposer( + WidgetTester tester, { + StreamMessageComposerController? controller, + ErrorListener? onError, + }) async { await tester.pumpWidget( MaterialApp( home: StreamChat( @@ -56,17 +60,26 @@ void main() { connectivityStream: Stream.value([ConnectivityResult.mobile]), child: StreamChannel( channel: channel, - child: Scaffold(body: StreamMessageComposer()), + child: Scaffold( + body: StreamMessageComposer(messageComposerController: controller, onError: onError), + ), ), ), ), ); await tester.pumpAndSettle(); + } + Future typeAndWaitForEnrichment(WidgetTester tester, String text) async { await tester.enterText(find.byType(TextField), text); // Enrichment runs behind a 350ms debounce; advance past it. await tester.pump(const Duration(milliseconds: 500)); await tester.pumpAndSettle(); + } + + Future enrichUrlFrom(WidgetTester tester, String text) async { + await pumpComposer(tester); + await typeAndWaitForEnrichment(tester, text); return verify(() => client.enrichUrl(captureAny())).captured.single; } @@ -103,5 +116,56 @@ void main() { expect(await enrichUrlFrom(tester, input), expected); }); } + + testWidgets('a scraped url becomes the link preview', (tester) async { + final controller = StreamMessageComposerController(); + addTearDown(controller.dispose); + await pumpComposer(tester, controller: controller); + + await typeAndWaitForEnrichment(tester, 'https://example.com'); + + expect(controller.ogAttachment?.ogScrapeUrl, 'https://example.com'); + }); + + testWidgets('a failed scrape clears the existing link preview', (tester) async { + const error = StreamApiException(code: StreamErrorCode.inputError, message: 'unreachable', statusCode: 400); + when(() => client.enrichUrl('https://unreachable.example')).thenAnswer((_) async => const Result.failure(error)); + final controller = StreamMessageComposerController(); + addTearDown(controller.dispose); + await pumpComposer(tester, controller: controller); + await typeAndWaitForEnrichment(tester, 'https://example.com'); + + await typeAndWaitForEnrichment(tester, 'https://unreachable.example'); + + expect(controller.ogAttachment, isNull); + }); + + testWidgets('a failed scrape reports the error to onError', (tester) async { + const error = StreamApiException(code: StreamErrorCode.inputError, message: 'unreachable', statusCode: 400); + when(() => client.enrichUrl('https://unreachable.example')).thenAnswer((_) async => const Result.failure(error)); + final errors = []; + await pumpComposer(tester, onError: (error, _) => errors.add(error)); + + await typeAndWaitForEnrichment(tester, 'https://unreachable.example'); + + expect(errors, [error]); + }); + + testWidgets('a url scraped earlier is previewed again without a second request', (tester) async { + final controller = StreamMessageComposerController(); + addTearDown(controller.dispose); + await pumpComposer(tester, controller: controller); + + await typeAndWaitForEnrichment(tester, 'https://example.com'); + await typeAndWaitForEnrichment(tester, 'no link here'); + await typeAndWaitForEnrichment(tester, 'https://example.com'); + + expect(controller.ogAttachment?.ogScrapeUrl, 'https://example.com'); + verify(() => client.enrichUrl('https://example.com')).called(1); + }); }); } + +OGAttachmentResponse _ogResponse(String url) { + return OGAttachmentResponse(duration: '0.01ms', ogScrapeUrl: url, titleLink: url); +} From 81498a0eccf20068665dbbadcf0557ddf84172dd Mon Sep 17 00:00:00 2001 From: Petar Velikov Date: Mon, 28 Sep 2026 16:37:58 +0200 Subject: [PATCH 25/36] refactor(llc)!: route user groups through the generated client (#2978) * test(llc): name the device and role client tests by behavior Co-Authored-By: Claude Opus 5.5 * refactor(llc)!: keep the generated user group models off the public API Co-Authored-By: Claude Opus 5.5 * docs(repo): record the user groups migration against domain models Co-Authored-By: Claude Opus 5.5 * refactor(llc): generate the user group storage codec Co-Authored-By: Claude Opus 5.5 * refactor(persistence): store mentioned groups through the generated codec Co-Authored-By: Claude Opus 5.5 * docs(repo): allow @DataSerializable as the temporary storage codec Co-Authored-By: Claude Opus 5.5 * docs(repo): teach the migration skill when to use @DataSerializable Co-Authored-By: Claude Opus 5.5 * docs(llc): record fromData and toData as the offline storage format Co-Authored-By: Claude Opus 5.5 * docs(repo): drop the annotation check from the migration plan tool * docs(llc): move the v1 group decoding comment onto its function Co-Authored-By: Claude Opus 5.5 * test(llc): cover reading mentioned groups from v1 and v2 payloads Co-Authored-By: Claude Opus 5.5 * docs(llc): restore the user group method contracts on StreamChatClient Co-Authored-By: Claude Opus 5.5 * docs(repo): say which cached rows the user group codec stays compatible with Co-Authored-By: Claude Opus 5.5 * refactor(llc): move the response envelopes into models/response Co-Authored-By: Claude Opus 5.5 * docs(llc): describe the user group cursors as pairs and split the member docs Co-Authored-By: Claude Opus 5.5 * test(llc): cover the user group failure path on the client and drop duplicate repository tests Co-Authored-By: Claude Opus 5.5 * docs(llc): fold the user group changelog entries Co-Authored-By: Claude Opus 5.5 * docs(repo): name the v11 write path the user group codec matches Co-Authored-By: Claude Opus 5.5 * test(llc): name the remaining user group client tests by what they check Co-Authored-By: Claude Opus 5.5 * test(llc): decode mentioned groups with epoch-nanosecond dates through Message.fromJson Co-Authored-By: Claude Opus 5.5 * docs(llc): keep the user group changelog clear that model equality is unchanged Co-Authored-By: Claude Opus 5.5 * test(llc): name the device and role client tests by what they check Co-Authored-By: Claude Opus 5.5 * docs(repo): drop the stale helpers reference from the user groups plan Co-Authored-By: Claude Opus 5.5 * docs(llc): state the user group equality change once in the changelog Co-Authored-By: Claude Opus 5.5 * test(llc): drop the epoch-nanosecond group test that Message.fromJson already covers Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: Claude Opus 5.5 --- .claude/skills/openapi-migration/SKILL.md | 89 ++- migrations/v11-migration.md | 55 ++ openapi-migration/03-user-groups.md | 69 ++- openapi-migration/10-messages.md | 1 + openapi-migration/README.md | 23 +- openapi-migration/tool/generate_plan.py | 57 +- packages/stream_chat/CHANGELOG.md | 6 + .../stream_chat/lib/src/client/client.dart | 64 ++- .../lib/src/core/api/responses.dart | 74 --- .../lib/src/core/api/responses.g.dart | 44 -- .../lib/src/core/api/stream_chat_api.dart | 5 - .../lib/src/core/api/user_groups_api.dart | 162 ------ .../models/converters/v1_json_converters.dart | 37 ++ .../lib/src/core/models/message.dart | 3 +- .../lib/src/core/models/message.g.dart | 4 +- .../add_user_group_members_response.dart | 23 + ...d_user_group_members_response.freezed.dart | 82 +++ .../response/create_user_group_response.dart | 23 + .../create_user_group_response.freezed.dart | 82 +++ .../response/get_user_group_response.dart | 23 + .../get_user_group_response.freezed.dart | 82 +++ .../{ => response}/list_devices_response.dart | 2 +- .../list_devices_response.freezed.dart | 0 .../response/list_user_groups_response.dart | 23 + .../list_user_groups_response.freezed.dart | 89 +++ .../remove_user_group_members_response.dart | 23 + ...e_user_group_members_response.freezed.dart | 82 +++ .../{ => response}/search_roles_response.dart | 2 +- .../search_roles_response.freezed.dart | 0 .../response/search_user_groups_response.dart | 23 + .../search_user_groups_response.freezed.dart | 89 +++ .../response/update_user_group_response.dart | 23 + .../update_user_group_response.freezed.dart | 82 +++ .../lib/src/core/models/user_group.dart | 55 +- .../src/core/models/user_group.freezed.dart | 139 +++++ .../lib/src/core/models/user_group.g.dart | 6 +- .../src/core/models/user_group_member.dart | 40 +- .../models/user_group_member.freezed.dart | 98 ++++ .../lib/src/db/data_serializable.dart | 7 + .../src/repository/devices_repository.dart | 2 +- .../src/repository/mapper/devices_mapper.dart | 2 +- .../src/repository/mapper/roles_mapper.dart | 2 +- .../repository/mapper/user_groups_mapper.dart | 101 ++++ .../lib/src/repository/roles_repository.dart | 2 +- .../repository/user_groups_repository.dart | 170 ++++++ packages/stream_chat/lib/stream_chat.dart | 11 +- .../test/src/client/client_test.dart | 321 ++++------- .../test/src/core/api/responses_test.dart | 246 -------- .../src/core/api/user_groups_api_test.dart | 523 ------------------ .../converters/v1_json_converters_test.dart | 76 +++ .../core/models/user_group_member_test.dart | 30 +- .../test/src/core/models/user_group_test.dart | 107 ++-- packages/stream_chat/test/src/fakes.dart | 6 - packages/stream_chat/test/src/mocks.dart | 3 - .../repository/devices_repository_test.dart | 2 +- .../mapper/user_groups_mapper_test.dart | 210 +++++++ .../user_groups_repository_test.dart | 174 ++++++ .../stream_mention_autocomplete_options.dart | 11 +- ...eam_mention_autocomplete_options_test.dart | 58 +- .../lib/src/mapper/message_mapper.dart | 4 +- .../test/src/dao/message_dao_test.dart | 24 + .../test/src/mapper/message_mapper_test.dart | 56 +- 62 files changed, 2448 insertions(+), 1484 deletions(-) delete mode 100644 packages/stream_chat/lib/src/core/api/user_groups_api.dart create mode 100644 packages/stream_chat/lib/src/core/models/response/add_user_group_members_response.dart create mode 100644 packages/stream_chat/lib/src/core/models/response/add_user_group_members_response.freezed.dart create mode 100644 packages/stream_chat/lib/src/core/models/response/create_user_group_response.dart create mode 100644 packages/stream_chat/lib/src/core/models/response/create_user_group_response.freezed.dart create mode 100644 packages/stream_chat/lib/src/core/models/response/get_user_group_response.dart create mode 100644 packages/stream_chat/lib/src/core/models/response/get_user_group_response.freezed.dart rename packages/stream_chat/lib/src/core/models/{ => response}/list_devices_response.dart (96%) rename packages/stream_chat/lib/src/core/models/{ => response}/list_devices_response.freezed.dart (100%) create mode 100644 packages/stream_chat/lib/src/core/models/response/list_user_groups_response.dart create mode 100644 packages/stream_chat/lib/src/core/models/response/list_user_groups_response.freezed.dart create mode 100644 packages/stream_chat/lib/src/core/models/response/remove_user_group_members_response.dart create mode 100644 packages/stream_chat/lib/src/core/models/response/remove_user_group_members_response.freezed.dart rename packages/stream_chat/lib/src/core/models/{ => response}/search_roles_response.dart (96%) rename packages/stream_chat/lib/src/core/models/{ => response}/search_roles_response.freezed.dart (100%) create mode 100644 packages/stream_chat/lib/src/core/models/response/search_user_groups_response.dart create mode 100644 packages/stream_chat/lib/src/core/models/response/search_user_groups_response.freezed.dart create mode 100644 packages/stream_chat/lib/src/core/models/response/update_user_group_response.dart create mode 100644 packages/stream_chat/lib/src/core/models/response/update_user_group_response.freezed.dart create mode 100644 packages/stream_chat/lib/src/core/models/user_group.freezed.dart create mode 100644 packages/stream_chat/lib/src/core/models/user_group_member.freezed.dart create mode 100644 packages/stream_chat/lib/src/db/data_serializable.dart create mode 100644 packages/stream_chat/lib/src/repository/mapper/user_groups_mapper.dart create mode 100644 packages/stream_chat/lib/src/repository/user_groups_repository.dart delete mode 100644 packages/stream_chat/test/src/core/api/user_groups_api_test.dart create mode 100644 packages/stream_chat/test/src/repository/mapper/user_groups_mapper_test.dart create mode 100644 packages/stream_chat/test/src/repository/user_groups_repository_test.dart diff --git a/.claude/skills/openapi-migration/SKILL.md b/.claude/skills/openapi-migration/SKILL.md index f55dd77ef1..5dd915ab4e 100644 --- a/.claude/skills/openapi-migration/SKILL.md +++ b/.claude/skills/openapi-migration/SKILL.md @@ -125,7 +125,11 @@ Phase 2 is therefore not "keep or adopt" but, per type: - **Which v10 type it maps to**, and whether that type is embedded in a model that still decodes v1 JSON with json_serializable. If it is, the parent's field needs a temporary converter (README rule 7) — add it to the adapters table with the group that removes it. -- **Whether persistence stores it as JSON text.** If so, the Drift mapper gets its own private helpers (rule 8). +- **Whether persistence stores it as JSON text,** alone or nested inside another persisted model. Look for + `jsonEncode`, `fromJson`, `toJson` or `toData` on the type in + `stream_chat_persistence/lib/src/{mapper,converter,dao}`. If it is, the model gets the temporary + `@DataSerializable` codec (rule 8; see [Persisted models](#persisted-models-the-dataserializable-codec)). A model + stored as a table row, mapped column by column like `User` in `users`, needs no codec. - **Which request enums need a hand-written public type** (rule 6). Generated types are wire shapes — nullable wherever the spec is loose, with per-operation extension types instead @@ -137,7 +141,8 @@ a public signature. - **The error contract:** public methods return `Result` instead of throwing (below). - **Duration-only writes answer nothing:** a write whose generated response is `DurationResponse` returns `Result`, not `EmptyResponse`. -- **No JSON on public models or envelopes:** their `fromJson` and `toJson` are removed. +- **No JSON on public models or envelopes:** their `fromJson` and `toJson` are removed. A model persistence stores + as JSON text gains `fromData` and `toData` instead; that is additive, not a break. - **Envelopes are immutable:** they are built through a const constructor with final fields, not a no-argument constructor and `late` setters. - **`duration` is a non-nullable `String`** on every envelope; v10 typed it `String?`. @@ -261,6 +266,83 @@ comm -12 \ | sed "s|.*/\([a-z_]*\)\.dart';|\1|" | sort) ``` +### Persisted models: the `@DataSerializable` codec + +`DataSerializable` (`packages/stream_chat/lib/src/db/data_serializable.dart`) is a typedef for `JsonSerializable`, +so json_serializable generates the storage codec and the model exposes it as `fromData`/`toData`. It is the only +JSON annotation a migrated model may carry, and it is temporary: group 10 decides what replaces it. + +**Use it** when `stream_chat_persistence` stores the model in a JSON text column, or nests it inside a model that +is. Today that covers `messages.mentioned_groups` (`UserGroup`); the remaining JSON columns belong to later groups +(`mentioned_users`, `attachments`, `reaction_groups`, `channels.config`, `polls.options`, +`connection_events.own_user`). + +**Don't use it** for: + +- envelopes, which are never persisted; +- a model persistence stores as a table row; +- decoding the wire, which goes through the repository mappers or a rule-7 converter. + +**Where it doesn't fit:** + +- **freezed unions** (`MessageState`, `UploadState`, `MessageDeleteScope`). freezed only generates union JSON from + a factory named `fromJson`, so a union whose factory is renamed to `fromData` gets no JSON at all. These + local-only unions keep their freezed `fromJson`/`toJson` until the user decides how to handle them. This comes + from freezed's documented behaviour and hasn't been tried in this repo, so test it before relying on it. +- **Deeply nested models get expensive.** json_serializable hardcodes the names `fromJson`/`toJson` for nested + types (`json_serializable/lib/src/type_helpers/json_helper.dart`), so every field holding a plain model needs a + hand-written `@JsonKey(fromJson: ..., toJson: ...)` pair, and every nested model needs its own annotation. The + cost grows with the depth of the graph. `OwnUser` is the worst case: `Device`, `Mute` (two `User`s), + `ChannelMute` (a `User` and a full `ChannelModel`), `PushPreference` and `PrivacySettings`. Before annotating a + graph like that, raise the alternative of storing less with the user: rows in existing tables plus ids. + +The pattern, from `UserGroup`: + +```dart +@freezed +// TODO(openapi-migration): remove in group 10 +@DataSerializable(includeIfNull: false) +class UserGroup with _$UserGroup { + const UserGroup({...}); + + /// Creates a [UserGroup] from data stored by [toData]. + factory UserGroup.fromData(Map json) => _$UserGroupFromJson(json); + + @override + @JsonKey(fromJson: _membersFromData, toJson: _membersToData) + final List? members; + + /// Serializes this group for local storage. + Map toData() => _$UserGroupToJson(this); +} + +List? _membersFromData(List? data) => + data?.map((it) => UserGroupMember.fromData(it as Map)).toList(); + +List>? _membersToData(List? members) => + members?.map((it) => it.toData()).toList(); +``` + +- **Tag every use** with `// TODO(openapi-migration): remove in group 10` and add the models to the adapters table. + The typedef carries the same tag, so `generate_plan.py --check` fails while it outlives group 10, and deleting it + breaks every remaining use at compile time. +- **A field holding another plain model needs a `@JsonKey(fromJson: ..., toJson: ...)` pair** calling the nested + model's `fromData`/`toData`, as `members` does above, and the nested model needs its own annotation. Without the + pair the generated code calls a `fromJson`/`toJson` that doesn't exist and fails to compile. +- **`stream_chat`'s `build.yaml` already sets `field_rename: snake` and `explicit_to_json: true`,** and + `includeIfNull: false` leaves out null keys. Extension-type fields such as `PushLevel` pass through as their + representation, and `DateTime` is stored as an ISO-8601 string. +- **Decide whether the stored format changes.** The generated codec stores `extraData` nested under `extra_data`, + where v10 flattened custom fields into the root. If the bytes differ from what the column holds today, bump + `schemaVersion` in `drift_chat_database.dart` in the same PR; the upgrade is destructive, so the cache is simply + rebuilt. If they are identical, prove it with a test against the old format and leave the version alone. +- **A model that already has storage methods** (`Attachment.fromData`/`toData`) switches them to the generated + functions rather than adding a second pair. +- **In persistence,** replace the model's `fromJson`/`toJson` calls, including an implicit `jsonEncode(model)`, + with `fromData`/`toData`. +- **Generate with a full `dart run build_runner build`** in `packages/stream_chat`, then `dart format`, and commit + only the new `.g.dart` files. `--build-filter` deletes every generated output outside the filter. + ### Documenting the public surface Write these as you write the code. `public_member_api_docs` only checks a doc *exists*, so a placeholder survives @@ -291,6 +373,9 @@ Budget for this: on a typical feature it is most of the diff, and none of it is - `test/src/core/api/responses_test.dart` round-trips the DTO from JSON — delete those cases with the DTO's JSON. - **Test each mapper from a fully populated generated response,** so a field the mapper drops fails an assertion. - **Test each temporary converter,** both on its own and wired through its parent's `fromJson`/`toJson`. +- **Test each `@DataSerializable` model's stored format:** pin `toData()` to a literal map, so a rename that changes + the stored keys fails; round-trip `fromData(toData())`; cover null versus empty for nullable lists. Extend the + existing persistence mapper and DAO tests with the field rather than writing tests scoped to it. Rewrite onto `TESTING.md` rather than carrying the old file's habits across. What breaks most often: diff --git a/migrations/v11-migration.md b/migrations/v11-migration.md index bece8e5ec3..38168ae71d 100644 --- a/migrations/v11-migration.md +++ b/migrations/v11-migration.md @@ -27,6 +27,7 @@ onto Stream's OpenAPI-generated API client. - [Sorting](#sorting) - [Roles](#roles) - [Devices](#devices) + - [User Groups](#user-groups) - [Link Previews](#link-previews) - [Migration Checklist](#migration-checklist) - [For AI Agents](#for-ai-agents) @@ -163,6 +164,15 @@ search-and-replace you can apply directly. `Kind` is one of `renamed`, `removed` | `Device` / `ListDevicesResponse` / `SearchRolesResponse` identity `==` | value `==`, plus `copyWith` | `retyped` | Two instances with the same fields are now equal | | `Role extends Equatable`, `Role.props` | `Role` (value `==`, `copyWith`) | `removed` | Equality is unchanged; `props` is gone and `Role` is no longer an `Equatable` | | `StreamChatApi.device` | `StreamChatApi.pushPreferences` | `renamed` | The class handles only `setPushPreferences` now; device calls moved to the generated client | +| `StreamChatClient.listUserGroups` / `searchUserGroups` / `getUserGroup` / `createUserGroup` / `updateUserGroup` / `addUserGroupMembers` / `removeUserGroupMembers` → `Future` | `Future>` | `retyped` | Returns a `Result` instead of throwing | +| `StreamChatClient.deleteUserGroup` → `Future` | `Future>` | `retyped` | Returns a `Result` instead of throwing, and carries no value on success | +| `UserGroup.fromJson` / `toJson`, `UserGroupMember.fromJson` / `toJson`, the user group responses' `fromJson` | — | `removed` | The models are plain classes; construct them directly. `fromData` / `toData` are the offline database's format, not API JSON | +| `ListUserGroupsResponse()..userGroups = …` and the other user group responses' `late` setters | `ListUserGroupsResponse(duration: …, userGroups: …)` | `retyped` | The responses are plain classes with a const constructor and final fields | +| The user group responses' `duration` (`String?`) | `String` | `retyped` | Always present; drop any `!` or `?? ''` | +| `GetUserGroupResponse` / `CreateUserGroupResponse` / `UpdateUserGroupResponse` / `AddUserGroupMembersResponse` / `RemoveUserGroupMembersResponse`.`userGroup` (`UserGroup`) | `UserGroup?` | `retyped` | The API does not guarantee the group in the response; handle `null` | +| `UserGroup` / `UserGroupMember extends Equatable`, `.props` | value `==`, plus `copyWith` | `removed` | Equality is unchanged; `props` is gone | +| The user group responses' identity `==` | value `==`, plus `copyWith` | `retyped` | Two instances with the same fields are now equal | +| `StreamChatApi.userGroups` | `StreamChatClient` user group methods | `removed` | The endpoints moved to the generated client | | `StreamChatClient.enrichUrl` → `Future` | `Future>` | `retyped` | Returns a `Result` instead of throwing | | `OGAttachmentResponse.fromJson` | — | `removed` | The response is a plain class; construct it directly | | `OGAttachmentResponse()..ogScrapeUrl = …` and its other setters | `OGAttachmentResponse(duration: …, ogScrapeUrl: …)` | `retyped` | A plain class with a const constructor and final fields | @@ -486,6 +496,51 @@ final device = Device(id: token, pushProvider: PushProvider.firebase); A `switch` over a `PushProvider` is no longer exhaustive; give it a default case. +### User Groups + +**The eight user group methods return a `Result` instead of throwing.** `deleteUserGroup` carries no value on +success. `UserGroup`, `UserGroupMember` and the seven responses keep their names and fields. + +```dart +// v10 +try { + final response = await client.searchUserGroups('eng'); + showGroups(response.userGroups); +} on StreamChatException catch (e) { + report(e); +} + +// v11 +final result = await client.searchUserGroups('eng'); +result.fold( + onSuccess: (response) => showGroups(response.userGroups), + onFailure: (error, _) => report(error), +); +``` + +**`userGroup` is nullable on the five single-group responses** — `GetUserGroupResponse`, `CreateUserGroupResponse`, +`UpdateUserGroupResponse`, `AddUserGroupMembersResponse` and `RemoveUserGroupMembersResponse`. The API does not +guarantee the group in the response, so handle `null`: + +```dart +// v10 +final group = (await client.getUserGroup(id)).userGroup; + +// v11 +final group = (await client.getUserGroup(id)).getOrNull()?.userGroup; +if (group == null) return; +``` + +**`UserGroup`, `UserGroupMember` and the responses no longer decode JSON.** They are plain classes; build them with +their constructors — `ListUserGroupsResponse(duration: '0ms', userGroups: [group])` where v10 wrote +`ListUserGroupsResponse()..userGroups = [group]`. `Message.mentionedGroups` still decodes from the same keys. +`UserGroup.fromData` and `toData` read and write the format the offline database stores; they are not a way to +decode API responses. + +**The responses' `duration` is a non-nullable `String`**, where v10 typed it `String?`. + +**`StreamChatApi.userGroups` is removed.** Call the user group methods on `StreamChatClient` instead. + ### Link Previews **`enrichUrl` returns a `Result` instead of throwing.** `OGAttachmentResponse` keeps its name and fields, and diff --git a/openapi-migration/03-user-groups.md b/openapi-migration/03-user-groups.md index 6613a6f575..1d66723bc5 100644 --- a/openapi-migration/03-user-groups.md +++ b/openapi-migration/03-user-groups.md @@ -1,8 +1,8 @@ # 03 — User Groups -**Goal:** A clean 1:1 group — eight methods against eight generated operations, no client state, no persistence. +**Goal:** A clean 1:1 group — eight methods against eight generated operations, no client state, and one persisted field (`messages.mentioned_groups`). -**Size:** 8 hand-written method(s) across 1 file(s) → 8 generated operation(s). +**Size:** 0 hand-written method(s) across 0 file(s) → 8 generated operation(s). > Tables are generated by `openapi-migration/tool/generate_plan.py`. Edit the prose, not the tables. @@ -12,14 +12,6 @@ | File | Method | Returns | | --- | --- | --- | -| `user_groups_api.dart` | `listUserGroups` | `ListUserGroupsResponse` | -| `user_groups_api.dart` | `searchUserGroups` | `SearchUserGroupsResponse` | -| `user_groups_api.dart` | `getUserGroup` | `GetUserGroupResponse` | -| `user_groups_api.dart` | `createUserGroup` | `CreateUserGroupResponse` | -| `user_groups_api.dart` | `updateUserGroup` | `UpdateUserGroupResponse` | -| `user_groups_api.dart` | `deleteUserGroup` | `EmptyResponse` | -| `user_groups_api.dart` | `addUserGroupMembers` | `AddUserGroupMembersResponse` | -| `user_groups_api.dart` | `removeUserGroupMembers` | `RemoveUserGroupMembersResponse` | ### Generated operations that cover it @@ -34,28 +26,59 @@ | `GET` | `/api/v2/usergroups/search` | `searchUserGroups` | `SearchUserGroupsResponse` | | `PUT` | `/api/v2/usergroups/{id}` | `updateUserGroup` | `UpdateUserGroupResponse` | -## Decisions to make +## Decisions taken -- Follows the [domain-model rules](README.md#domain-models): `UserGroup`, `UserGroupMember` and the seven v10 response envelopes stay public in their v10 shapes, as plain classes, mapped from the generated types in the repository. -- `Message.mentionedGroups` still decodes v1 JSON, so it needs a temporary `UserGroupV1JsonConverter` (removed by group 10), and the persistence mapper serializes `mentioned_groups` itself. +Follows the [domain-model rules](README.md#domain-models). + +- **`UserGroup` and `UserGroupMember` stay our public types, with their current fields,** as plain + classes whose only JSON is the temporary storage codec below. The generated + `UserGroupMember.appPk` — the app's internal id, the same for every member — is not exposed; adding + it later is non-breaking. +- **The seven responses keep their names,** one file per class. `ListUserGroupsResponse` and + `SearchUserGroupsResponse` carry a non-nullable `userGroups`, as the generated types do. +- **`userGroup` is nullable on the five single-group responses** (`Get`, `Create`, `Update`, + `AddUserGroupMembers`, `RemoveUserGroupMembers`), where v10 declared it non-null. The spec marks it + optional, so the public type says what the API promises instead of turning a missing group into a + failure the server never reported. A break outside the sanctioned list, taken deliberately. +- **A missing list is never mapped to an empty one.** The only nullable generated list, + `UserGroupResponse.members`, stays `null` when the response leaves it out (list and search do), + which is not the same as a group with no members. +- **`deleteUserGroup` returns `Result`,** through `ignoreValue()`, per the duration-only rule. +- **`StreamChatApi.userGroups` is removed** with `user_groups_api.dart`; every method now routes + through `DefaultApi`. +- **All mapping lives in `mapper/user_groups_mapper.dart`,** entity and response mappers together. +- **`Message.mentionedGroups` decodes through `userGroupsFromV1Json`,** a temporary decode-only function + rather than a `JsonConverter`: `Message.toJson` never writes the field, so a `toJson` would be dead + code. It reads the v1 keys directly instead of through `api.UserGroupResponse.fromJson`, whose + members require `app_pk` — a payload without it should not fail the whole message. Dates go through + `StreamDateTimeConverter`: v1 sends ISO-8601 strings, but v2 sends epoch nanoseconds, which a live + check against the demo app caught. Removed by [group 10](10-messages.md). +- **Persistence stores `mentioned_groups` through `UserGroup.fromData` and `toData`,** generated by the + temporary `@DataSerializable` typedef ([rule 8](README.md#domain-models)). `includeIfNull: false` + keeps the stored JSON identical to what earlier v11 builds wrote through `UserGroup.toJson`, so no + `schemaVersion` bump is needed; upgrading from v10 rebuilds the cache anyway, because the schema + version differs. `members` needs a `@JsonKey` pair calling `UserGroupMember.fromData` and `toData`. + Removed by [group 10](10-messages.md). +- **The mention UI keeps `UserGroup`.** `StreamMentionAutocompleteOptions` reads the `Result` the way it + already reads `searchRoles`; no UI type changes. ## Risks -- `UserGroup` and `UserGroupMember` collide by name with generated types. Import the generated code with a prefix; the generated types are never exported. +- **`updateUserGroup` sends explicit nulls — verified harmless.** `UpdateUserGroupRequest.toJson` emits `"description": null` where the hand-written path omitted the key, and v10 documented an omitted `description` as "leave unchanged". A live check confirmed a `null` still leaves it unchanged. ## Definition of done -- [ ] Every method above either routes through `DefaultApi` or is listed here as deliberately left +- [x] Every method above either routes through `DefaultApi` or is listed here as deliberately left hand-written, with the reason. -- [ ] Public methods return `Future>`; no `getOrThrow()` inside the SDK. -- [ ] Hand-written request/response DTOs for this group are deleted, or their retention is justified. -- [ ] `melos run analyze` clean, `melos run test:dart` green, persistence tests green if this group +- [x] Public methods return `Future>`; no `getOrThrow()` inside the SDK. +- [x] Hand-written request/response DTOs for this group are deleted, or their retention is justified. +- [x] `melos run analyze` clean, `melos run test:dart` green, persistence tests green if this group persists anything. -- [ ] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. -- [ ] CHANGELOG entry under `🛑️ Breaking` for each break; PR title `refactor(llc)!:`. -- [ ] Decisions recorded in this file, and the status box ticked in `README.md`. -- [ ] Public dartdoc follows [`STYLE_GUIDE.md` § Documentation](../STYLE_GUIDE.md#documentation) +- [x] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. +- [x] CHANGELOG entry under `🛑️ Breaking` for each break; PR title `refactor(llc)!:`. +- [x] Decisions recorded in this file, and the status box ticked in `README.md`. +- [x] Public dartdoc follows [`STYLE_GUIDE.md` § Documentation](../STYLE_GUIDE.md#documentation) and [`EFFECTIVE_DART_DOC.md`](../EFFECTIVE_DART_DOC.md), including on symbols this group retyped but whose docs it left alone. -- [ ] Tests follow [`TESTING.md`](../TESTING.md): no `group` organizing a file by method, each +- [x] Tests follow [`TESTING.md`](../TESTING.md): no `group` organizing a file by method, each name states its subject and behaviour. diff --git a/openapi-migration/10-messages.md b/openapi-migration/10-messages.md index 3cd461ff1a..01ae86a8a2 100644 --- a/openapi-migration/10-messages.md +++ b/openapi-migration/10-messages.md @@ -48,6 +48,7 @@ - `Message` is public, persisted, WebSocket-delivered and the most customised type in the SDK. Keep ours; treat the generated `MessageResponse` as a mapping source only. - `Attachment`: the generated model defines fields our `extraData` currently absorbs. Decide the promotion rules before writing the mapper. +- Replace the temporary `@DataSerializable` storage codec (`UserGroup`, `UserGroupMember`): decide between dedicated tables and codecs owned by `stream_chat_persistence` before `Message` and `Attachment` become plain models, then delete the typedef and every `fromData`/`toData` it generates. - `Action` is still the v10 json_serializable class, embedded in `Attachment.actions`, which `Attachment.toJson` writes when sending and `toData` writes to persistence. It becomes a plain model with `Attachment`; group 04 left it alone. ## Risks diff --git a/openapi-migration/README.md b/openapi-migration/README.md index edf7750ca5..62329e4820 100644 --- a/openapi-migration/README.md +++ b/openapi-migration/README.md @@ -14,7 +14,7 @@ generated operations in scope, the decisions that group has to make, its risks, | --- | --- | --- | --- | --- | | [01](01-foundation.md) | Foundation — `DefaultApi` wiring, `User` shape | — | — | ☐ | | [02](02-devices.md) | Devices | 0 | 3 | ☑ | -| [03](03-user-groups.md) | User Groups | 8 | 8 | ☐ | +| [03](03-user-groups.md) | User Groups | 0 | 8 | ☑ | | [04](04-roles-guest-and-app.md) | Roles, Guest & App Settings | 2 | 5 | ☐ | | [05](05-polls.md) | Polls | 13 | 13 | ☐ | | [06](06-reminders.md) | Message Reminders | 4 | 4 | ☐ | @@ -80,7 +80,7 @@ Each ships with a CHANGELOG entry and a Symbol Map row like any other break. other package or the sample app imports it. `generate_plan.py --check` enforces both. 2. **Public models keep their v10 names, fields, nullability and defaults,** as `@freezed` classes (value equality, `copyWith`, `toString`) with no `fromJson`, `toJson` or json_serializable. A field the server adds is exposed later, as an additive - change. + change. The one exception is the temporary `@DataSerializable` storage codec in rule 8. 3. **Responses keep their v10 envelopes,** as `@freezed` classes carrying a non-nullable `duration` and the payload, one file per class under `lib/src/core/models/`. A write whose response carries only `duration` returns `Result`: `EmptyResponse` stays behind for the unmigrated APIs. @@ -93,19 +93,27 @@ Each ships with a CHANGELOG entry and a Symbol Map row like any other break. 6. **Request enums are hand-written** and mapped to the generated enum in the repository (`PushProvider` → `CreateDeviceRequestPushProvider`). 7. **A plain model embedded in a json_serializable parent gets a temporary converter.** Some parents still decode - v1 REST or WebSocket JSON with json_serializable; their field gets a `JsonConverter` in + v1 REST or WebSocket JSON with json_serializable; their field gets a `JsonConverter` — or a decode-only + `fromJson` function when the parent never writes the field — in `lib/src/core/models/converters/v1_json_converters.dart`, marked `// TODO(openapi-migration): remove in group NN` and listed below. The group that migrates the parent deletes it, and `generate_plan.py --check` fails if a ticked group leaves one behind. -8. **Persistence serializes our models itself.** A Drift mapper that stores a model as JSON text uses private - helpers in `stream_chat_persistence`, never a model's `fromJson` or `toJson`. The cache is disposable, so the - stored format is ours to choose. +8. **Persistence stores a model as JSON text through its `@DataSerializable` codec.** `DataSerializable` + (`lib/src/db/data_serializable.dart`) is a typedef for `JsonSerializable`, and the only class-level json_serializable + annotation a public model may carry. The model exposes the generated code as `fromData` and `toData`, which only + `stream_chat_persistence` calls; it never gains `fromJson` or `toJson`. A field holding another plain model + needs `@JsonKey(fromJson: ..., toJson: ...)` functions that call the nested `fromData` and `toData`, because + json_serializable only looks for `fromJson` and `toJson` on nested types. The codec is temporary: every use is + marked `// TODO(openapi-migration): remove in group 10` and listed below, and group 10 decides what replaces + it. The cache is disposable, so the stored format is ours to choose. ### Temporary adapters | Adapter | Field | Removed by | | --- | --- | --- | | `DeviceV1JsonConverter` | `OwnUser.devices` | [09](09-users.md) | +| `userGroupsFromV1Json` | `Message.mentionedGroups` | [10](10-messages.md) | +| `DataSerializable` | `UserGroup`, `UserGroupMember` (`fromData`, `toData`) | [10](10-messages.md) | Before group 09 starts, decide how v1 events decode a parent once it becomes a plain model: through the generated types plus a shim that rebuilds `custom` from the flattened v1 keys, or through a private v1 decoder in @@ -119,7 +127,8 @@ the WebSocket layer. Record the answer in [01-foundation](01-foundation.md). The order runs from smallest and most isolated to largest and most entangled, so the pattern is proven on cheap surfaces before it reaches `Message` and `ChannelState`: -- **02–04** have no persistence and almost no public model surface. Group 02 is the pattern-proving slice. +- **02–04** have almost no persistence (03 stores mentioned groups) and almost no public model surface. Group 02 + is the pattern-proving slice. - **05–07** introduce persisted models and WebSocket-delivered updates, one at a time. - **08** is where we decide what *not* to expose: 34 generated operations against 11 hand-written methods. - **09** freezes the `User` mapping that everything else already depends on (the *decision* is made in 01; this diff --git a/openapi-migration/tool/generate_plan.py b/openapi-migration/tool/generate_plan.py index add56d6523..cb41ef33ec 100644 --- a/openapi-migration/tool/generate_plan.py +++ b/openapi-migration/tool/generate_plan.py @@ -166,21 +166,53 @@ def match(path): ), dict( num='03', slug='user-groups', title='User Groups', - hand=['user_groups_api.dart'], + hand=[], match=owns('/api/v2/usergroups'), goal='A clean 1:1 group — eight methods against eight generated operations, no client state, ' - 'no persistence.', - decisions=[ - 'Follows the [domain-model rules](README.md#domain-models): `UserGroup`, `UserGroupMember` and the ' - 'seven v10 response envelopes stay public in their v10 shapes, as plain classes, mapped from the ' - 'generated types in the repository.', - '`Message.mentionedGroups` still decodes v1 JSON, so it needs a temporary `UserGroupV1JsonConverter` ' - '(removed by group 10), and the persistence mapper serializes `mentioned_groups` itself.', - ], + 'and one persisted field (`messages.mentioned_groups`).', + decisions=[], + taken=textwrap.dedent("""\ + Follows the [domain-model rules](README.md#domain-models). + + - **`UserGroup` and `UserGroupMember` stay our public types, with their current fields,** as plain + classes whose only JSON is the temporary storage codec below. The generated + `UserGroupMember.appPk` — the app's internal id, the same for every member — is not exposed; adding + it later is non-breaking. + - **The seven responses keep their names,** one file per class. `ListUserGroupsResponse` and + `SearchUserGroupsResponse` carry a non-nullable `userGroups`, as the generated types do. + - **`userGroup` is nullable on the five single-group responses** (`Get`, `Create`, `Update`, + `AddUserGroupMembers`, `RemoveUserGroupMembers`), where v10 declared it non-null. The spec marks it + optional, so the public type says what the API promises instead of turning a missing group into a + failure the server never reported. A break outside the sanctioned list, taken deliberately. + - **A missing list is never mapped to an empty one.** The only nullable generated list, + `UserGroupResponse.members`, stays `null` when the response leaves it out (list and search do), + which is not the same as a group with no members. + - **`deleteUserGroup` returns `Result`,** through `ignoreValue()`, per the duration-only rule. + - **`StreamChatApi.userGroups` is removed** with `user_groups_api.dart`; every method now routes + through `DefaultApi`. + - **All mapping lives in `mapper/user_groups_mapper.dart`,** entity and response mappers together. + - **`Message.mentionedGroups` decodes through `userGroupsFromV1Json`,** a temporary decode-only function + rather than a `JsonConverter`: `Message.toJson` never writes the field, so a `toJson` would be dead + code. It reads the v1 keys directly instead of through `api.UserGroupResponse.fromJson`, whose + members require `app_pk` — a payload without it should not fail the whole message. Dates go through + `StreamDateTimeConverter`: v1 sends ISO-8601 strings, but v2 sends epoch nanoseconds, which a live + check against the demo app caught. Removed by [group 10](10-messages.md). + - **Persistence stores `mentioned_groups` through `UserGroup.fromData` and `toData`,** generated by the + temporary `@DataSerializable` typedef ([rule 8](README.md#domain-models)). `includeIfNull: false` + keeps the stored JSON identical to what earlier v11 builds wrote through `UserGroup.toJson`, so no + `schemaVersion` bump is needed; upgrading from v10 rebuilds the cache anyway, because the schema + version differs. `members` needs a `@JsonKey` pair calling `UserGroupMember.fromData` and `toData`. + Removed by [group 10](10-messages.md). + - **The mention UI keeps `UserGroup`.** `StreamMentionAutocompleteOptions` reads the `Result` the way it + already reads `searchRoles`; no UI type changes. + """), risks=[ - '`UserGroup` and `UserGroupMember` collide by name with generated types. Import the generated code ' - 'with a prefix; the generated types are never exported.', + '**`updateUserGroup` sends explicit nulls — verified harmless.** `UpdateUserGroupRequest.toJson` ' + 'emits `"description": null` where the hand-written path omitted the key, and v10 documented an ' + 'omitted `description` as "leave unchanged". A live check confirmed a `null` still leaves it ' + 'unchanged.', ], + done=DONE.replace('- [ ]', '- [x]'), ), dict( num='04', slug='roles-guest-and-app', title='Roles, Guest & App Settings', @@ -328,6 +360,9 @@ def match(path): 'ours; treat the generated `MessageResponse` as a mapping source only.', '`Attachment`: the generated model defines fields our `extraData` currently absorbs. Decide the ' 'promotion rules before writing the mapper.', + 'Replace the temporary `@DataSerializable` storage codec (`UserGroup`, `UserGroupMember`): decide ' + 'between dedicated tables and codecs owned by `stream_chat_persistence` before `Message` and ' + '`Attachment` become plain models, then delete the typedef and every `fromData`/`toData` it generates.', '`Action` is still the v10 json_serializable class, embedded in `Attachment.actions`, which ' '`Attachment.toJson` writes when sending and `toData` writes to persistence. It becomes a plain model ' 'with `Attachment`; group 04 left it alone.', diff --git a/packages/stream_chat/CHANGELOG.md b/packages/stream_chat/CHANGELOG.md index b0e2dd153e..d95a65263b 100644 --- a/packages/stream_chat/CHANGELOG.md +++ b/packages/stream_chat/CHANGELOG.md @@ -53,6 +53,12 @@ - `Device`, `ListDevicesResponse`, `SearchRolesResponse` and `OGAttachmentResponse` compare by value and gain `copyWith`. - `Role` no longer extends `Equatable`, so `props` is removed; it still compares by value and gains `copyWith`. - `StreamChatApi.device` is renamed `StreamChatApi.pushPreferences` and handles only `setPushPreferences`. +- `StreamChatClient`'s user group methods return a `Result` instead of throwing; `deleteUserGroup` returns a `Result`. +- `UserGroup`, `UserGroupMember` and the user group responses no longer decode from or encode to JSON; `UserGroup` and `UserGroupMember` gain `fromData` and `toData`, which read and write only the format `stream_chat_persistence` stores them in. +- The user group responses are immutable, built through a const constructor, and their `duration` is a non-nullable `String`. +- `userGroup` is nullable on `GetUserGroupResponse`, `CreateUserGroupResponse`, `UpdateUserGroupResponse`, `AddUserGroupMembersResponse` and `RemoveUserGroupMembersResponse`. +- `UserGroup`, `UserGroupMember` and the user group responses gain `copyWith`; the responses now compare by value, and `UserGroup` and `UserGroupMember` no longer extend `Equatable`, so `props` is removed. +- `StreamChatApi.userGroups` is removed; its endpoints are reached through `StreamChatClient`. - `StreamChatClient.enrichUrl` returns a `Result` instead of throwing. - `OGAttachmentResponse` no longer decodes from JSON, is built through a const constructor, and its `duration` is a non-nullable `String`. - `StreamChatApi.general.enrichUrl` is removed; call `StreamChatClient.enrichUrl` instead. diff --git a/packages/stream_chat/lib/src/client/client.dart b/packages/stream_chat/lib/src/client/client.dart index 57fd9d52f0..ccbe2cfe36 100644 --- a/packages/stream_chat/lib/src/client/client.dart +++ b/packages/stream_chat/lib/src/client/client.dart @@ -45,7 +45,6 @@ import '../core/models/banned_user.dart'; import '../core/models/channel_state.dart'; import '../core/models/draft.dart'; import '../core/models/draft_message.dart'; -import '../core/models/list_devices_response.dart'; import '../core/models/location.dart'; import '../core/models/member.dart'; import '../core/models/message.dart'; @@ -58,9 +57,17 @@ import '../core/models/poll_vote.dart'; import '../core/models/push_preference.dart'; import '../core/models/push_provider.dart'; import '../core/models/reaction.dart'; +import '../core/models/response/add_user_group_members_response.dart'; +import '../core/models/response/create_user_group_response.dart'; +import '../core/models/response/get_user_group_response.dart'; +import '../core/models/response/list_devices_response.dart'; +import '../core/models/response/list_user_groups_response.dart'; import '../core/models/response/og_attachment_response.dart'; +import '../core/models/response/remove_user_group_members_response.dart'; +import '../core/models/response/search_roles_response.dart'; +import '../core/models/response/search_user_groups_response.dart'; +import '../core/models/response/update_user_group_response.dart'; import '../core/models/role_type.dart'; -import '../core/models/search_roles_response.dart'; import '../core/models/thread.dart'; import '../core/models/user.dart'; import '../core/util/event_controller.dart'; @@ -72,6 +79,7 @@ import '../event_type.dart'; import '../repository/devices_repository.dart'; import '../repository/general_repository.dart'; import '../repository/roles_repository.dart'; +import '../repository/user_groups_repository.dart'; import '../ws/connect_request.dart'; import '../ws/connection_manager.dart'; import '../ws/connection_status.dart'; @@ -169,6 +177,7 @@ class StreamChatClient { final api = defaultApi ?? DefaultApi(httpClient); _rolesRepository = RolesRepository(api); _devicesRepository = DevicesRepository(api); + _userGroupsRepository = UserGroupsRepository(api); _generalRepository = GeneralRepository(api); _connection = ConnectionManager( @@ -205,6 +214,7 @@ class StreamChatClient { late final StreamChatApi _chatApi; late final RolesRepository _rolesRepository; late final DevicesRepository _devicesRepository; + late final UserGroupsRepository _userGroupsRepository; late final GeneralRepository _generalRepository; late final ConnectionManager _connection; StreamSubscription? _wsEventSubscription; @@ -2394,12 +2404,15 @@ class StreamChatClient { } /// Lists user groups with cursor-based pagination. - Future listUserGroups({ + /// + /// [createdAtGt] and [idGt] form one cursor: pass the `createdAt` and `id` of + /// the last group on the previous page to get the next one. Either alone is ignored. + Future> listUserGroups({ int? limit, String? idGt, DateTime? createdAtGt, String? teamId, - }) => _chatApi.userGroups.listUserGroups( + }) => _userGroupsRepository.listUserGroups( limit: limit, idGt: idGt, createdAtGt: createdAtGt, @@ -2407,13 +2420,16 @@ class StreamChatClient { ); /// Searches user groups by name prefix (autocomplete). - Future searchUserGroups( + /// + /// [nameGt] and [idGt] form one cursor: pass the `name` and `id` of the last + /// group on the previous page to get the next one. Either alone is ignored. + Future> searchUserGroups( String query, { int? limit, String? nameGt, String? idGt, String? teamId, - }) => _chatApi.userGroups.searchUserGroups( + }) => _userGroupsRepository.searchUserGroups( query, limit: limit, nameGt: nameGt, @@ -2422,19 +2438,21 @@ class StreamChatClient { ); /// Gets a user group by ID, including its members. - Future getUserGroup( + Future> getUserGroup( String id, { String? teamId, - }) => _chatApi.userGroups.getUserGroup(id, teamId: teamId); + }) => _userGroupsRepository.getUserGroup(id, teamId: teamId); /// Creates a new user group, optionally with initial members. - Future createUserGroup( + /// + /// [id] is generated by the server when omitted. + Future> createUserGroup( String name, { String? id, String? description, String? teamId, List? memberIds, - }) => _chatApi.userGroups.createUserGroup( + }) => _userGroupsRepository.createUserGroup( name, id: id, description: description, @@ -2444,13 +2462,17 @@ class StreamChatClient { /// Updates a user group's name and/or description. /// + /// At least one of [name] / [description] must be provided. Passing + /// `description: ''` clears the description; passing `null` (or omitting) + /// leaves it unchanged. + /// /// [teamId] scopes the lookup; a group's team cannot be changed. - Future updateUserGroup( + Future> updateUserGroup( String id, { String? name, String? description, String? teamId, - }) => _chatApi.userGroups.updateUserGroup( + }) => _userGroupsRepository.updateUserGroup( id, name: name, description: description, @@ -2458,18 +2480,22 @@ class StreamChatClient { ); /// Deletes a user group and all its memberships. - Future deleteUserGroup( + Future> deleteUserGroup( String id, { String? teamId, - }) => _chatApi.userGroups.deleteUserGroup(id, teamId: teamId); + }) => _userGroupsRepository.deleteUserGroup(id, teamId: teamId); /// Adds members to a user group. - Future addUserGroupMembers( + /// + /// All user IDs must exist; if any does not, no member is added. + /// + /// [asAdmin] defaults to `false` — a regular member — when not given. + Future> addUserGroupMembers( String id, List memberIds, { bool? asAdmin, String? teamId, - }) => _chatApi.userGroups.addUserGroupMembers( + }) => _userGroupsRepository.addUserGroupMembers( id, memberIds, asAdmin: asAdmin, @@ -2477,11 +2503,13 @@ class StreamChatClient { ); /// Removes members from a user group. - Future removeUserGroupMembers( + /// + /// User IDs that are not members of the group are ignored. + Future> removeUserGroupMembers( String id, List memberIds, { String? teamId, - }) => _chatApi.userGroups.removeUserGroupMembers( + }) => _userGroupsRepository.removeUserGroupMembers( id, memberIds, teamId: teamId, diff --git a/packages/stream_chat/lib/src/core/api/responses.dart b/packages/stream_chat/lib/src/core/api/responses.dart index 74eb25937c..23127ae048 100644 --- a/packages/stream_chat/lib/src/core/api/responses.dart +++ b/packages/stream_chat/lib/src/core/api/responses.dart @@ -21,7 +21,6 @@ import '../models/thread.dart'; import '../models/unread_counts.dart'; import '../models/user.dart'; import '../models/user_block.dart'; -import '../models/user_group.dart'; part 'responses.g.dart'; @@ -756,79 +755,6 @@ class GetActiveLiveLocationsResponse extends _BaseResponse { _$GetActiveLiveLocationsResponseFromJson(json); } -/// Model response for [StreamChatClient.listUserGroups] api call -@JsonSerializable(createToJson: false) -class ListUserGroupsResponse extends _BaseResponse { - /// List of user groups returned by the api call - @JsonKey(defaultValue: []) - late List userGroups; - - /// Create a new instance from a json - static ListUserGroupsResponse fromJson(Map json) => _$ListUserGroupsResponseFromJson(json); -} - -/// Model response for [StreamChatClient.searchUserGroups] api call -@JsonSerializable(createToJson: false) -class SearchUserGroupsResponse extends _BaseResponse { - /// List of user groups returned by the api call - @JsonKey(defaultValue: []) - late List userGroups; - - /// Create a new instance from a json - static SearchUserGroupsResponse fromJson(Map json) => _$SearchUserGroupsResponseFromJson(json); -} - -/// Model response for [StreamChatClient.createUserGroup] api call -@JsonSerializable(createToJson: false) -class CreateUserGroupResponse extends _BaseResponse { - /// Created user group - late UserGroup userGroup; - - /// Create a new instance from a json - static CreateUserGroupResponse fromJson(Map json) => _$CreateUserGroupResponseFromJson(json); -} - -/// Model response for [StreamChatClient.getUserGroup] api call -@JsonSerializable(createToJson: false) -class GetUserGroupResponse extends _BaseResponse { - /// Fetched user group - late UserGroup userGroup; - - /// Create a new instance from a json - static GetUserGroupResponse fromJson(Map json) => _$GetUserGroupResponseFromJson(json); -} - -/// Model response for [StreamChatClient.updateUserGroup] api call -@JsonSerializable(createToJson: false) -class UpdateUserGroupResponse extends _BaseResponse { - /// Fetched user group - late UserGroup userGroup; - - /// Create a new instance from a json - static UpdateUserGroupResponse fromJson(Map json) => _$UpdateUserGroupResponseFromJson(json); -} - -/// Model response for [StreamChatClient.addUserGroupMembers] api call -@JsonSerializable(createToJson: false) -class AddUserGroupMembersResponse extends _BaseResponse { - /// Fetched user group - late UserGroup userGroup; - - /// Create a new instance from a json - static AddUserGroupMembersResponse fromJson(Map json) => _$AddUserGroupMembersResponseFromJson(json); -} - -/// Model response for [StreamChatClient.removeUserGroupMembers] api call -@JsonSerializable(createToJson: false) -class RemoveUserGroupMembersResponse extends _BaseResponse { - /// Fetched user group - late UserGroup userGroup; - - /// Create a new instance from a json - static RemoveUserGroupMembersResponse fromJson(Map json) => - _$RemoveUserGroupMembersResponseFromJson(json); -} - /// Model response for [StreamChatClient.getAppSettings] api call. @JsonSerializable(createToJson: false) class GetAppSettingsResponse extends _BaseResponse { diff --git a/packages/stream_chat/lib/src/core/api/responses.g.dart b/packages/stream_chat/lib/src/core/api/responses.g.dart index 4502e2dda4..9a2b121d48 100644 --- a/packages/stream_chat/lib/src/core/api/responses.g.dart +++ b/packages/stream_chat/lib/src/core/api/responses.g.dart @@ -397,50 +397,6 @@ GetActiveLiveLocationsResponse _$GetActiveLiveLocationsResponseFromJson( .map((e) => Location.fromJson(e as Map)) .toList(); -ListUserGroupsResponse _$ListUserGroupsResponseFromJson( - Map json, -) => ListUserGroupsResponse() - ..duration = json['duration'] as String? - ..userGroups = - (json['user_groups'] as List?)?.map((e) => UserGroup.fromJson(e as Map)).toList() ?? []; - -SearchUserGroupsResponse _$SearchUserGroupsResponseFromJson( - Map json, -) => SearchUserGroupsResponse() - ..duration = json['duration'] as String? - ..userGroups = - (json['user_groups'] as List?)?.map((e) => UserGroup.fromJson(e as Map)).toList() ?? []; - -CreateUserGroupResponse _$CreateUserGroupResponseFromJson( - Map json, -) => CreateUserGroupResponse() - ..duration = json['duration'] as String? - ..userGroup = UserGroup.fromJson(json['user_group'] as Map); - -GetUserGroupResponse _$GetUserGroupResponseFromJson( - Map json, -) => GetUserGroupResponse() - ..duration = json['duration'] as String? - ..userGroup = UserGroup.fromJson(json['user_group'] as Map); - -UpdateUserGroupResponse _$UpdateUserGroupResponseFromJson( - Map json, -) => UpdateUserGroupResponse() - ..duration = json['duration'] as String? - ..userGroup = UserGroup.fromJson(json['user_group'] as Map); - -AddUserGroupMembersResponse _$AddUserGroupMembersResponseFromJson( - Map json, -) => AddUserGroupMembersResponse() - ..duration = json['duration'] as String? - ..userGroup = UserGroup.fromJson(json['user_group'] as Map); - -RemoveUserGroupMembersResponse _$RemoveUserGroupMembersResponseFromJson( - Map json, -) => RemoveUserGroupMembersResponse() - ..duration = json['duration'] as String? - ..userGroup = UserGroup.fromJson(json['user_group'] as Map); - GetAppSettingsResponse _$GetAppSettingsResponseFromJson( Map json, ) => GetAppSettingsResponse() diff --git a/packages/stream_chat/lib/src/core/api/stream_chat_api.dart b/packages/stream_chat/lib/src/core/api/stream_chat_api.dart index 2f12bf28e3..b02e7cc26a 100644 --- a/packages/stream_chat/lib/src/core/api/stream_chat_api.dart +++ b/packages/stream_chat/lib/src/core/api/stream_chat_api.dart @@ -13,7 +13,6 @@ import 'push_preferences_api.dart'; import 'reminders_api.dart'; import 'threads_api.dart'; import 'user_api.dart'; -import 'user_groups_api.dart'; /// ApiClient that wraps every other specific api class StreamChatApi { @@ -80,10 +79,6 @@ class StreamChatApi { RemindersApi get reminders => _reminders ??= RemindersApi(_client); RemindersApi? _reminders; - /// Api dedicated to user groups operations - UserGroupsApi get userGroups => _userGroups ??= UserGroupsApi(_client); - UserGroupsApi? _userGroups; - /// Api dedicated to general operations GeneralApi get general => _general ??= GeneralApi(_client); GeneralApi? _general; diff --git a/packages/stream_chat/lib/src/core/api/user_groups_api.dart b/packages/stream_chat/lib/src/core/api/user_groups_api.dart deleted file mode 100644 index bd105a3960..0000000000 --- a/packages/stream_chat/lib/src/core/api/user_groups_api.dart +++ /dev/null @@ -1,162 +0,0 @@ -import '../http/stream_http_client.dart'; -import 'responses.dart'; - -/// Defines the API dedicated to user groups operations. -class UserGroupsApi { - /// Initialize a new user groups API. - const UserGroupsApi(this._client); - - final StreamHttpClient _client; - - /// Lists user groups with cursor-based pagination. - Future listUserGroups({ - int? limit, - String? idGt, - DateTime? createdAtGt, - String? teamId, - }) async { - final response = await _client.get( - '/usergroups', - queryParameters: { - if (limit != null) 'limit': limit, - if (idGt != null) 'id_gt': idGt, - if (createdAtGt != null) 'created_at_gt': createdAtGt.toUtc().toIso8601String(), - if (teamId != null) 'team_id': teamId, - }, - ); - return ListUserGroupsResponse.fromJson(response.data); - } - - /// Searches user groups by name prefix (autocomplete). - Future searchUserGroups( - String query, { - int? limit, - String? nameGt, - String? idGt, - String? teamId, - }) async { - final response = await _client.get( - '/usergroups/search', - queryParameters: { - 'query': query, - if (limit != null) 'limit': limit, - if (nameGt != null) 'name_gt': nameGt, - if (idGt != null) 'id_gt': idGt, - if (teamId != null) 'team_id': teamId, - }, - ); - return SearchUserGroupsResponse.fromJson(response.data); - } - - /// Gets a user group by ID, including its members. - Future getUserGroup( - String id, { - String? teamId, - }) async { - final response = await _client.get( - '/usergroups/$id', - queryParameters: { - if (teamId != null) 'team_id': teamId, - }, - ); - return GetUserGroupResponse.fromJson(response.data); - } - - /// Creates a new user group, optionally with initial members. - Future createUserGroup( - String name, { - String? id, - String? description, - String? teamId, - List? memberIds, - }) async { - final response = await _client.post( - '/usergroups', - data: { - 'name': name, - if (id != null) 'id': id, - if (description != null) 'description': description, - if (teamId != null) 'team_id': teamId, - if (memberIds != null) 'member_ids': memberIds, - }, - ); - return CreateUserGroupResponse.fromJson(response.data); - } - - /// Updates a user group's name and/or description. - /// - /// At least one of [name] / [description] must be provided. Passing - /// `description: ''` clears the description; passing `null` (or omitting) - /// leaves it unchanged. - /// - /// [teamId] scopes the lookup; a group's team cannot be changed. - Future updateUserGroup( - String id, { - String? name, - String? description, - String? teamId, - }) async { - final response = await _client.put( - '/usergroups/$id', - data: { - if (name != null) 'name': name, - if (description != null) 'description': description, - if (teamId != null) 'team_id': teamId, - }, - ); - return UpdateUserGroupResponse.fromJson(response.data); - } - - /// Deletes a user group and all its memberships. - Future deleteUserGroup( - String id, { - String? teamId, - }) async { - final response = await _client.delete( - '/usergroups/$id', - queryParameters: { - if (teamId != null) 'team_id': teamId, - }, - ); - return EmptyResponse.fromJson(response.data); - } - - /// Adds members to a user group. All user IDs must exist - /// (operation is all-or-nothing). - /// - /// [asAdmin] is omitted from the request when null; the server defaults - /// to `false` (regular member). - Future addUserGroupMembers( - String id, - List memberIds, { - bool? asAdmin, - String? teamId, - }) async { - final response = await _client.post( - '/usergroups/$id/members', - data: { - 'member_ids': memberIds, - if (asAdmin != null) 'as_admin': asAdmin, - if (teamId != null) 'team_id': teamId, - }, - ); - return AddUserGroupMembersResponse.fromJson(response.data); - } - - /// Removes members from a user group. User IDs not currently members - /// are silently ignored. - Future removeUserGroupMembers( - String id, - List memberIds, { - String? teamId, - }) async { - final response = await _client.post( - '/usergroups/$id/members/delete', - data: { - 'member_ids': memberIds, - if (teamId != null) 'team_id': teamId, - }, - ); - return RemoveUserGroupMembersResponse.fromJson(response.data); - } -} diff --git a/packages/stream_chat/lib/src/core/models/converters/v1_json_converters.dart b/packages/stream_chat/lib/src/core/models/converters/v1_json_converters.dart index d77ca0742a..ea45f042f5 100644 --- a/packages/stream_chat/lib/src/core/models/converters/v1_json_converters.dart +++ b/packages/stream_chat/lib/src/core/models/converters/v1_json_converters.dart @@ -1,8 +1,11 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' show StreamDateTimeConverter; import '../device.dart'; import '../push_provider.dart'; +import '../user_group.dart'; +import '../user_group_member.dart'; // Converters for plain models embedded in json_serializable models that still decode v1 JSON. Each one is deleted // by the migration group that turns its parent into a plain model. @@ -28,3 +31,37 @@ class DeviceV1JsonConverter implements JsonConverter? userGroupsFromV1Json(List? json) { + return json?.map((group) => _userGroupFromV1Json(group as Map)).toList(); +} + +// Dates arrive as ISO-8601 strings on v1 and as epoch nanoseconds on v2; the converter reads both. +const _dateTime = StreamDateTimeConverter(); + +// Reads the keys directly rather than through the generated group type, whose members require `app_pk`: a payload +// without it should not fail the whole message. +UserGroup _userGroupFromV1Json(Map json) => UserGroup( + createdAt: _dateTime.fromJson(json['created_at'] as Object), + createdBy: json['created_by'] as String?, + description: json['description'] as String?, + id: json['id'] as String, + members: (json['members'] as List?) + ?.map((member) => _userGroupMemberFromV1Json(member as Map)) + .toList(), + name: json['name'] as String, + teamId: json['team_id'] as String?, + updatedAt: _dateTime.fromJson(json['updated_at'] as Object), +); + +UserGroupMember _userGroupMemberFromV1Json(Map json) => UserGroupMember( + createdAt: _dateTime.fromJson(json['created_at'] as Object), + groupId: json['group_id'] as String, + isAdmin: json['is_admin'] as bool, + userId: json['user_id'] as String, +); diff --git a/packages/stream_chat/lib/src/core/models/message.dart b/packages/stream_chat/lib/src/core/models/message.dart index 3994cf9264..ef7e6c94a0 100644 --- a/packages/stream_chat/lib/src/core/models/message.dart +++ b/packages/stream_chat/lib/src/core/models/message.dart @@ -7,6 +7,7 @@ import 'package:uuid/uuid.dart'; import '../util/extension.dart'; import '../util/serializer.dart'; import 'attachment.dart'; +import 'converters/v1_json_converters.dart'; import 'draft.dart'; import 'location.dart'; import 'message_reminder.dart'; @@ -137,7 +138,7 @@ class Message extends Equatable { /// The list of groups mentioned in the message, hydrated by the server from /// [mentionedGroupIds]. - @JsonKey(includeToJson: false) + @JsonKey(includeToJson: false, fromJson: userGroupsFromV1Json) final List? mentionedGroups; /// Boolean indicator if the message contains a "@here" mention. diff --git a/packages/stream_chat/lib/src/core/models/message.g.dart b/packages/stream_chat/lib/src/core/models/message.g.dart index a21f7b2673..b5d5d2b59d 100644 --- a/packages/stream_chat/lib/src/core/models/message.g.dart +++ b/packages/stream_chat/lib/src/core/models/message.g.dart @@ -15,9 +15,7 @@ Message _$MessageFromJson(Map json) => Message( const [], mentionedChannel: json['mentioned_channel'] as bool?, mentionedGroupIds: (json['mentioned_group_ids'] as List?)?.map((e) => e as String).toList(), - mentionedGroups: (json['mentioned_groups'] as List?) - ?.map((e) => UserGroup.fromJson(e as Map)) - .toList(), + mentionedGroups: userGroupsFromV1Json(json['mentioned_groups'] as List?), mentionedHere: json['mentioned_here'] as bool?, mentionedRoles: (json['mentioned_roles'] as List?)?.map((e) => e as String).toList(), mentionedUsers: diff --git a/packages/stream_chat/lib/src/core/models/response/add_user_group_members_response.dart b/packages/stream_chat/lib/src/core/models/response/add_user_group_members_response.dart new file mode 100644 index 0000000000..28a5e33fb6 --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/response/add_user_group_members_response.dart @@ -0,0 +1,23 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +import '../user_group.dart'; + +part 'add_user_group_members_response.freezed.dart'; + +/// The user group returned by [StreamChatClient.addUserGroupMembers]. +@freezed +class AddUserGroupMembersResponse with _$AddUserGroupMembersResponse { + /// Creates a new [AddUserGroupMembersResponse]. + const AddUserGroupMembersResponse({ + required this.duration, + this.userGroup, + }); + + /// How long the server took to handle the request, such as `4.21ms`. + @override + final String duration; + + /// The user group, with the added members. + @override + final UserGroup? userGroup; +} diff --git a/packages/stream_chat/lib/src/core/models/response/add_user_group_members_response.freezed.dart b/packages/stream_chat/lib/src/core/models/response/add_user_group_members_response.freezed.dart new file mode 100644 index 0000000000..e88e0fb7bf --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/response/add_user_group_members_response.freezed.dart @@ -0,0 +1,82 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'add_user_group_members_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$AddUserGroupMembersResponse { + String get duration; + UserGroup? get userGroup; + + /// Create a copy of AddUserGroupMembersResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $AddUserGroupMembersResponseCopyWith get copyWith => + _$AddUserGroupMembersResponseCopyWithImpl( + this as AddUserGroupMembersResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is AddUserGroupMembersResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.userGroup, userGroup) || other.userGroup == userGroup)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration, userGroup); + + @override + String toString() { + return 'AddUserGroupMembersResponse(duration: $duration, userGroup: $userGroup)'; + } +} + +/// @nodoc +abstract mixin class $AddUserGroupMembersResponseCopyWith<$Res> { + factory $AddUserGroupMembersResponseCopyWith( + AddUserGroupMembersResponse value, + $Res Function(AddUserGroupMembersResponse) _then, + ) = _$AddUserGroupMembersResponseCopyWithImpl; + @useResult + $Res call({String duration, UserGroup? userGroup}); +} + +/// @nodoc +class _$AddUserGroupMembersResponseCopyWithImpl<$Res> implements $AddUserGroupMembersResponseCopyWith<$Res> { + _$AddUserGroupMembersResponseCopyWithImpl(this._self, this._then); + + final AddUserGroupMembersResponse _self; + final $Res Function(AddUserGroupMembersResponse) _then; + + /// Create a copy of AddUserGroupMembersResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? userGroup = freezed}) { + return _then( + AddUserGroupMembersResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + userGroup: freezed == userGroup + ? _self.userGroup + : userGroup // ignore: cast_nullable_to_non_nullable + as UserGroup?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/src/core/models/response/create_user_group_response.dart b/packages/stream_chat/lib/src/core/models/response/create_user_group_response.dart new file mode 100644 index 0000000000..df71e0c234 --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/response/create_user_group_response.dart @@ -0,0 +1,23 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +import '../user_group.dart'; + +part 'create_user_group_response.freezed.dart'; + +/// The user group created by [StreamChatClient.createUserGroup]. +@freezed +class CreateUserGroupResponse with _$CreateUserGroupResponse { + /// Creates a new [CreateUserGroupResponse]. + const CreateUserGroupResponse({ + required this.duration, + this.userGroup, + }); + + /// How long the server took to handle the request, such as `4.21ms`. + @override + final String duration; + + /// The created user group. + @override + final UserGroup? userGroup; +} diff --git a/packages/stream_chat/lib/src/core/models/response/create_user_group_response.freezed.dart b/packages/stream_chat/lib/src/core/models/response/create_user_group_response.freezed.dart new file mode 100644 index 0000000000..0948e8567b --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/response/create_user_group_response.freezed.dart @@ -0,0 +1,82 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'create_user_group_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$CreateUserGroupResponse { + String get duration; + UserGroup? get userGroup; + + /// Create a copy of CreateUserGroupResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $CreateUserGroupResponseCopyWith get copyWith => + _$CreateUserGroupResponseCopyWithImpl( + this as CreateUserGroupResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is CreateUserGroupResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.userGroup, userGroup) || other.userGroup == userGroup)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration, userGroup); + + @override + String toString() { + return 'CreateUserGroupResponse(duration: $duration, userGroup: $userGroup)'; + } +} + +/// @nodoc +abstract mixin class $CreateUserGroupResponseCopyWith<$Res> { + factory $CreateUserGroupResponseCopyWith( + CreateUserGroupResponse value, + $Res Function(CreateUserGroupResponse) _then, + ) = _$CreateUserGroupResponseCopyWithImpl; + @useResult + $Res call({String duration, UserGroup? userGroup}); +} + +/// @nodoc +class _$CreateUserGroupResponseCopyWithImpl<$Res> implements $CreateUserGroupResponseCopyWith<$Res> { + _$CreateUserGroupResponseCopyWithImpl(this._self, this._then); + + final CreateUserGroupResponse _self; + final $Res Function(CreateUserGroupResponse) _then; + + /// Create a copy of CreateUserGroupResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? userGroup = freezed}) { + return _then( + CreateUserGroupResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + userGroup: freezed == userGroup + ? _self.userGroup + : userGroup // ignore: cast_nullable_to_non_nullable + as UserGroup?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/src/core/models/response/get_user_group_response.dart b/packages/stream_chat/lib/src/core/models/response/get_user_group_response.dart new file mode 100644 index 0000000000..80ebcdf5c2 --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/response/get_user_group_response.dart @@ -0,0 +1,23 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +import '../user_group.dart'; + +part 'get_user_group_response.freezed.dart'; + +/// The user group fetched by [StreamChatClient.getUserGroup]. +@freezed +class GetUserGroupResponse with _$GetUserGroupResponse { + /// Creates a new [GetUserGroupResponse]. + const GetUserGroupResponse({ + required this.duration, + this.userGroup, + }); + + /// How long the server took to handle the request, such as `4.21ms`. + @override + final String duration; + + /// The fetched user group. + @override + final UserGroup? userGroup; +} diff --git a/packages/stream_chat/lib/src/core/models/response/get_user_group_response.freezed.dart b/packages/stream_chat/lib/src/core/models/response/get_user_group_response.freezed.dart new file mode 100644 index 0000000000..af34e5b15d --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/response/get_user_group_response.freezed.dart @@ -0,0 +1,82 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'get_user_group_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$GetUserGroupResponse { + String get duration; + UserGroup? get userGroup; + + /// Create a copy of GetUserGroupResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $GetUserGroupResponseCopyWith get copyWith => + _$GetUserGroupResponseCopyWithImpl( + this as GetUserGroupResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is GetUserGroupResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.userGroup, userGroup) || other.userGroup == userGroup)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration, userGroup); + + @override + String toString() { + return 'GetUserGroupResponse(duration: $duration, userGroup: $userGroup)'; + } +} + +/// @nodoc +abstract mixin class $GetUserGroupResponseCopyWith<$Res> { + factory $GetUserGroupResponseCopyWith( + GetUserGroupResponse value, + $Res Function(GetUserGroupResponse) _then, + ) = _$GetUserGroupResponseCopyWithImpl; + @useResult + $Res call({String duration, UserGroup? userGroup}); +} + +/// @nodoc +class _$GetUserGroupResponseCopyWithImpl<$Res> implements $GetUserGroupResponseCopyWith<$Res> { + _$GetUserGroupResponseCopyWithImpl(this._self, this._then); + + final GetUserGroupResponse _self; + final $Res Function(GetUserGroupResponse) _then; + + /// Create a copy of GetUserGroupResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? userGroup = freezed}) { + return _then( + GetUserGroupResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + userGroup: freezed == userGroup + ? _self.userGroup + : userGroup // ignore: cast_nullable_to_non_nullable + as UserGroup?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/src/core/models/list_devices_response.dart b/packages/stream_chat/lib/src/core/models/response/list_devices_response.dart similarity index 96% rename from packages/stream_chat/lib/src/core/models/list_devices_response.dart rename to packages/stream_chat/lib/src/core/models/response/list_devices_response.dart index 85a6164ff7..84f92afa50 100644 --- a/packages/stream_chat/lib/src/core/models/list_devices_response.dart +++ b/packages/stream_chat/lib/src/core/models/response/list_devices_response.dart @@ -1,6 +1,6 @@ import 'package:freezed_annotation/freezed_annotation.dart'; -import 'device.dart'; +import '../device.dart'; part 'list_devices_response.freezed.dart'; diff --git a/packages/stream_chat/lib/src/core/models/list_devices_response.freezed.dart b/packages/stream_chat/lib/src/core/models/response/list_devices_response.freezed.dart similarity index 100% rename from packages/stream_chat/lib/src/core/models/list_devices_response.freezed.dart rename to packages/stream_chat/lib/src/core/models/response/list_devices_response.freezed.dart diff --git a/packages/stream_chat/lib/src/core/models/response/list_user_groups_response.dart b/packages/stream_chat/lib/src/core/models/response/list_user_groups_response.dart new file mode 100644 index 0000000000..ae3b652734 --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/response/list_user_groups_response.dart @@ -0,0 +1,23 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +import '../user_group.dart'; + +part 'list_user_groups_response.freezed.dart'; + +/// The user groups of the app, returned by [StreamChatClient.listUserGroups]. +@freezed +class ListUserGroupsResponse with _$ListUserGroupsResponse { + /// Creates a new [ListUserGroupsResponse]. + const ListUserGroupsResponse({ + required this.duration, + this.userGroups = const [], + }); + + /// How long the server took to handle the request, such as `4.21ms`. + @override + final String duration; + + /// The user groups on this page. + @override + final List userGroups; +} diff --git a/packages/stream_chat/lib/src/core/models/response/list_user_groups_response.freezed.dart b/packages/stream_chat/lib/src/core/models/response/list_user_groups_response.freezed.dart new file mode 100644 index 0000000000..0b6d5b8f06 --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/response/list_user_groups_response.freezed.dart @@ -0,0 +1,89 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'list_user_groups_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ListUserGroupsResponse { + String get duration; + List get userGroups; + + /// Create a copy of ListUserGroupsResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ListUserGroupsResponseCopyWith get copyWith => + _$ListUserGroupsResponseCopyWithImpl( + this as ListUserGroupsResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ListUserGroupsResponse && + (identical(other.duration, duration) || other.duration == duration) && + const DeepCollectionEquality().equals( + other.userGroups, + userGroups, + )); + } + + @override + int get hashCode => Object.hash( + runtimeType, + duration, + const DeepCollectionEquality().hash(userGroups), + ); + + @override + String toString() { + return 'ListUserGroupsResponse(duration: $duration, userGroups: $userGroups)'; + } +} + +/// @nodoc +abstract mixin class $ListUserGroupsResponseCopyWith<$Res> { + factory $ListUserGroupsResponseCopyWith( + ListUserGroupsResponse value, + $Res Function(ListUserGroupsResponse) _then, + ) = _$ListUserGroupsResponseCopyWithImpl; + @useResult + $Res call({String duration, List userGroups}); +} + +/// @nodoc +class _$ListUserGroupsResponseCopyWithImpl<$Res> implements $ListUserGroupsResponseCopyWith<$Res> { + _$ListUserGroupsResponseCopyWithImpl(this._self, this._then); + + final ListUserGroupsResponse _self; + final $Res Function(ListUserGroupsResponse) _then; + + /// Create a copy of ListUserGroupsResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? userGroups = null}) { + return _then( + ListUserGroupsResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + userGroups: null == userGroups + ? _self.userGroups + : userGroups // ignore: cast_nullable_to_non_nullable + as List, + ), + ); + } +} diff --git a/packages/stream_chat/lib/src/core/models/response/remove_user_group_members_response.dart b/packages/stream_chat/lib/src/core/models/response/remove_user_group_members_response.dart new file mode 100644 index 0000000000..781459c706 --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/response/remove_user_group_members_response.dart @@ -0,0 +1,23 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +import '../user_group.dart'; + +part 'remove_user_group_members_response.freezed.dart'; + +/// The user group returned by [StreamChatClient.removeUserGroupMembers]. +@freezed +class RemoveUserGroupMembersResponse with _$RemoveUserGroupMembersResponse { + /// Creates a new [RemoveUserGroupMembersResponse]. + const RemoveUserGroupMembersResponse({ + required this.duration, + this.userGroup, + }); + + /// How long the server took to handle the request, such as `4.21ms`. + @override + final String duration; + + /// The user group, without the removed members. + @override + final UserGroup? userGroup; +} diff --git a/packages/stream_chat/lib/src/core/models/response/remove_user_group_members_response.freezed.dart b/packages/stream_chat/lib/src/core/models/response/remove_user_group_members_response.freezed.dart new file mode 100644 index 0000000000..9607a8fce1 --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/response/remove_user_group_members_response.freezed.dart @@ -0,0 +1,82 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'remove_user_group_members_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$RemoveUserGroupMembersResponse { + String get duration; + UserGroup? get userGroup; + + /// Create a copy of RemoveUserGroupMembersResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $RemoveUserGroupMembersResponseCopyWith get copyWith => + _$RemoveUserGroupMembersResponseCopyWithImpl( + this as RemoveUserGroupMembersResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is RemoveUserGroupMembersResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.userGroup, userGroup) || other.userGroup == userGroup)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration, userGroup); + + @override + String toString() { + return 'RemoveUserGroupMembersResponse(duration: $duration, userGroup: $userGroup)'; + } +} + +/// @nodoc +abstract mixin class $RemoveUserGroupMembersResponseCopyWith<$Res> { + factory $RemoveUserGroupMembersResponseCopyWith( + RemoveUserGroupMembersResponse value, + $Res Function(RemoveUserGroupMembersResponse) _then, + ) = _$RemoveUserGroupMembersResponseCopyWithImpl; + @useResult + $Res call({String duration, UserGroup? userGroup}); +} + +/// @nodoc +class _$RemoveUserGroupMembersResponseCopyWithImpl<$Res> implements $RemoveUserGroupMembersResponseCopyWith<$Res> { + _$RemoveUserGroupMembersResponseCopyWithImpl(this._self, this._then); + + final RemoveUserGroupMembersResponse _self; + final $Res Function(RemoveUserGroupMembersResponse) _then; + + /// Create a copy of RemoveUserGroupMembersResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? userGroup = freezed}) { + return _then( + RemoveUserGroupMembersResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + userGroup: freezed == userGroup + ? _self.userGroup + : userGroup // ignore: cast_nullable_to_non_nullable + as UserGroup?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/src/core/models/search_roles_response.dart b/packages/stream_chat/lib/src/core/models/response/search_roles_response.dart similarity index 96% rename from packages/stream_chat/lib/src/core/models/search_roles_response.dart rename to packages/stream_chat/lib/src/core/models/response/search_roles_response.dart index 5f95abb36c..070832d7ab 100644 --- a/packages/stream_chat/lib/src/core/models/search_roles_response.dart +++ b/packages/stream_chat/lib/src/core/models/response/search_roles_response.dart @@ -1,6 +1,6 @@ import 'package:freezed_annotation/freezed_annotation.dart'; -import 'role.dart'; +import '../role.dart'; part 'search_roles_response.freezed.dart'; diff --git a/packages/stream_chat/lib/src/core/models/search_roles_response.freezed.dart b/packages/stream_chat/lib/src/core/models/response/search_roles_response.freezed.dart similarity index 100% rename from packages/stream_chat/lib/src/core/models/search_roles_response.freezed.dart rename to packages/stream_chat/lib/src/core/models/response/search_roles_response.freezed.dart diff --git a/packages/stream_chat/lib/src/core/models/response/search_user_groups_response.dart b/packages/stream_chat/lib/src/core/models/response/search_user_groups_response.dart new file mode 100644 index 0000000000..c87f3a8136 --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/response/search_user_groups_response.dart @@ -0,0 +1,23 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +import '../user_group.dart'; + +part 'search_user_groups_response.freezed.dart'; + +/// The user groups matching a search, returned by [StreamChatClient.searchUserGroups]. +@freezed +class SearchUserGroupsResponse with _$SearchUserGroupsResponse { + /// Creates a new [SearchUserGroupsResponse]. + const SearchUserGroupsResponse({ + required this.duration, + this.userGroups = const [], + }); + + /// How long the server took to handle the request, such as `4.21ms`. + @override + final String duration; + + /// The user groups matching the search. + @override + final List userGroups; +} diff --git a/packages/stream_chat/lib/src/core/models/response/search_user_groups_response.freezed.dart b/packages/stream_chat/lib/src/core/models/response/search_user_groups_response.freezed.dart new file mode 100644 index 0000000000..d10ba8c5cf --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/response/search_user_groups_response.freezed.dart @@ -0,0 +1,89 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'search_user_groups_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$SearchUserGroupsResponse { + String get duration; + List get userGroups; + + /// Create a copy of SearchUserGroupsResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $SearchUserGroupsResponseCopyWith get copyWith => + _$SearchUserGroupsResponseCopyWithImpl( + this as SearchUserGroupsResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is SearchUserGroupsResponse && + (identical(other.duration, duration) || other.duration == duration) && + const DeepCollectionEquality().equals( + other.userGroups, + userGroups, + )); + } + + @override + int get hashCode => Object.hash( + runtimeType, + duration, + const DeepCollectionEquality().hash(userGroups), + ); + + @override + String toString() { + return 'SearchUserGroupsResponse(duration: $duration, userGroups: $userGroups)'; + } +} + +/// @nodoc +abstract mixin class $SearchUserGroupsResponseCopyWith<$Res> { + factory $SearchUserGroupsResponseCopyWith( + SearchUserGroupsResponse value, + $Res Function(SearchUserGroupsResponse) _then, + ) = _$SearchUserGroupsResponseCopyWithImpl; + @useResult + $Res call({String duration, List userGroups}); +} + +/// @nodoc +class _$SearchUserGroupsResponseCopyWithImpl<$Res> implements $SearchUserGroupsResponseCopyWith<$Res> { + _$SearchUserGroupsResponseCopyWithImpl(this._self, this._then); + + final SearchUserGroupsResponse _self; + final $Res Function(SearchUserGroupsResponse) _then; + + /// Create a copy of SearchUserGroupsResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? userGroups = null}) { + return _then( + SearchUserGroupsResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + userGroups: null == userGroups + ? _self.userGroups + : userGroups // ignore: cast_nullable_to_non_nullable + as List, + ), + ); + } +} diff --git a/packages/stream_chat/lib/src/core/models/response/update_user_group_response.dart b/packages/stream_chat/lib/src/core/models/response/update_user_group_response.dart new file mode 100644 index 0000000000..134b6f7264 --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/response/update_user_group_response.dart @@ -0,0 +1,23 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +import '../user_group.dart'; + +part 'update_user_group_response.freezed.dart'; + +/// The user group updated by [StreamChatClient.updateUserGroup]. +@freezed +class UpdateUserGroupResponse with _$UpdateUserGroupResponse { + /// Creates a new [UpdateUserGroupResponse]. + const UpdateUserGroupResponse({ + required this.duration, + this.userGroup, + }); + + /// How long the server took to handle the request, such as `4.21ms`. + @override + final String duration; + + /// The updated user group. + @override + final UserGroup? userGroup; +} diff --git a/packages/stream_chat/lib/src/core/models/response/update_user_group_response.freezed.dart b/packages/stream_chat/lib/src/core/models/response/update_user_group_response.freezed.dart new file mode 100644 index 0000000000..c69111aedc --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/response/update_user_group_response.freezed.dart @@ -0,0 +1,82 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'update_user_group_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpdateUserGroupResponse { + String get duration; + UserGroup? get userGroup; + + /// Create a copy of UpdateUserGroupResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpdateUserGroupResponseCopyWith get copyWith => + _$UpdateUserGroupResponseCopyWithImpl( + this as UpdateUserGroupResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpdateUserGroupResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.userGroup, userGroup) || other.userGroup == userGroup)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration, userGroup); + + @override + String toString() { + return 'UpdateUserGroupResponse(duration: $duration, userGroup: $userGroup)'; + } +} + +/// @nodoc +abstract mixin class $UpdateUserGroupResponseCopyWith<$Res> { + factory $UpdateUserGroupResponseCopyWith( + UpdateUserGroupResponse value, + $Res Function(UpdateUserGroupResponse) _then, + ) = _$UpdateUserGroupResponseCopyWithImpl; + @useResult + $Res call({String duration, UserGroup? userGroup}); +} + +/// @nodoc +class _$UpdateUserGroupResponseCopyWithImpl<$Res> implements $UpdateUserGroupResponseCopyWith<$Res> { + _$UpdateUserGroupResponseCopyWithImpl(this._self, this._then); + + final UpdateUserGroupResponse _self; + final $Res Function(UpdateUserGroupResponse) _then; + + /// Create a copy of UpdateUserGroupResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? userGroup = freezed}) { + return _then( + UpdateUserGroupResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + userGroup: freezed == userGroup + ? _self.userGroup + : userGroup // ignore: cast_nullable_to_non_nullable + as UserGroup?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/src/core/models/user_group.dart b/packages/stream_chat/lib/src/core/models/user_group.dart index 87ffc87a59..8648ea9edf 100644 --- a/packages/stream_chat/lib/src/core/models/user_group.dart +++ b/packages/stream_chat/lib/src/core/models/user_group.dart @@ -1,13 +1,17 @@ -import 'package:equatable/equatable.dart'; -import 'package:json_annotation/json_annotation.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; + +import '../../db/data_serializable.dart'; import 'user_group_member.dart'; +part 'user_group.freezed.dart'; part 'user_group.g.dart'; -/// Class that defines a user group. -@JsonSerializable(includeIfNull: false) -class UserGroup extends Equatable { - /// Create a new instance of [UserGroup]. +/// A named group of users that can be mentioned together in a message. +@freezed +// TODO(openapi-migration): remove in group 10 +@DataSerializable(includeIfNull: false) +class UserGroup with _$UserGroup { + /// Creates a new [UserGroup]. const UserGroup({ required this.createdAt, this.createdBy, @@ -19,46 +23,53 @@ class UserGroup extends Equatable { required this.updatedAt, }); - /// Create a new instance from a json. - factory UserGroup.fromJson(Map json) => _$UserGroupFromJson(json); + /// Creates a [UserGroup] from the offline-database format written by [toData]. + /// + /// It is not a codec for API payloads. + factory UserGroup.fromData(Map json) => _$UserGroupFromJson(json); /// The date when the group was created. + @override final DateTime createdAt; /// The id of the user that created the group /// (null when group is created server-side). + @override final String? createdBy; /// The description of the group (optional). + @override final String? description; /// The unique identifier of the group. + @override final String id; /// The members of the group (null when listing/searching user groups). + @override + @JsonKey(fromJson: _membersFromData, toJson: _membersToData) final List? members; /// The name of the group. + @override final String name; /// The id of the team the group belongs to (null if no team). + @override final String? teamId; /// The date when the group was last updated. + @override final DateTime updatedAt; - /// Serialize model to json. - Map toJson() => _$UserGroupToJson(this); - - @override - List get props => [ - createdAt, - createdBy, - description, - id, - members, - name, - teamId, - updatedAt, - ]; + /// Serializes this group to the format `stream_chat_persistence` stores. + /// + /// It is not a codec for API payloads. + Map toData() => _$UserGroupToJson(this); } + +List? _membersFromData(List? data) => + data?.map((it) => UserGroupMember.fromData(it as Map)).toList(); + +List>? _membersToData(List? members) => + members?.map((it) => it.toData()).toList(); diff --git a/packages/stream_chat/lib/src/core/models/user_group.freezed.dart b/packages/stream_chat/lib/src/core/models/user_group.freezed.dart new file mode 100644 index 0000000000..bf427f2d70 --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/user_group.freezed.dart @@ -0,0 +1,139 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'user_group.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UserGroup { + DateTime get createdAt; + String? get createdBy; + String? get description; + String get id; + List? get members; + String get name; + String? get teamId; + DateTime get updatedAt; + + /// Create a copy of UserGroup + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UserGroupCopyWith get copyWith => _$UserGroupCopyWithImpl(this as UserGroup, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UserGroup && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.createdBy, createdBy) || other.createdBy == createdBy) && + (identical(other.description, description) || other.description == description) && + (identical(other.id, id) || other.id == id) && + const DeepCollectionEquality().equals(other.members, members) && + (identical(other.name, name) || other.name == name) && + (identical(other.teamId, teamId) || other.teamId == teamId) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + createdAt, + createdBy, + description, + id, + const DeepCollectionEquality().hash(members), + name, + teamId, + updatedAt, + ); + + @override + String toString() { + return 'UserGroup(createdAt: $createdAt, createdBy: $createdBy, description: $description, id: $id, members: $members, name: $name, teamId: $teamId, updatedAt: $updatedAt)'; + } +} + +/// @nodoc +abstract mixin class $UserGroupCopyWith<$Res> { + factory $UserGroupCopyWith(UserGroup value, $Res Function(UserGroup) _then) = _$UserGroupCopyWithImpl; + @useResult + $Res call({ + DateTime createdAt, + String? createdBy, + String? description, + String id, + List? members, + String name, + String? teamId, + DateTime updatedAt, + }); +} + +/// @nodoc +class _$UserGroupCopyWithImpl<$Res> implements $UserGroupCopyWith<$Res> { + _$UserGroupCopyWithImpl(this._self, this._then); + + final UserGroup _self; + final $Res Function(UserGroup) _then; + + /// Create a copy of UserGroup + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? createdAt = null, + Object? createdBy = freezed, + Object? description = freezed, + Object? id = null, + Object? members = freezed, + Object? name = null, + Object? teamId = freezed, + Object? updatedAt = null, + }) { + return _then( + UserGroup( + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + createdBy: freezed == createdBy + ? _self.createdBy + : createdBy // ignore: cast_nullable_to_non_nullable + as String?, + description: freezed == description + ? _self.description + : description // ignore: cast_nullable_to_non_nullable + as String?, + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + members: freezed == members + ? _self.members + : members // ignore: cast_nullable_to_non_nullable + as List?, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + teamId: freezed == teamId + ? _self.teamId + : teamId // ignore: cast_nullable_to_non_nullable + as String?, + updatedAt: null == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + ), + ); + } +} diff --git a/packages/stream_chat/lib/src/core/models/user_group.g.dart b/packages/stream_chat/lib/src/core/models/user_group.g.dart index d96020285f..b5455c4a9a 100644 --- a/packages/stream_chat/lib/src/core/models/user_group.g.dart +++ b/packages/stream_chat/lib/src/core/models/user_group.g.dart @@ -11,9 +11,7 @@ UserGroup _$UserGroupFromJson(Map json) => UserGroup( createdBy: json['created_by'] as String?, description: json['description'] as String?, id: json['id'] as String, - members: (json['members'] as List?) - ?.map((e) => UserGroupMember.fromJson(e as Map)) - .toList(), + members: _membersFromData(json['members'] as List?), name: json['name'] as String, teamId: json['team_id'] as String?, updatedAt: DateTime.parse(json['updated_at'] as String), @@ -24,7 +22,7 @@ Map _$UserGroupToJson(UserGroup instance) => { 'created_by': ?instance.createdBy, 'description': ?instance.description, 'id': instance.id, - 'members': ?instance.members?.map((e) => e.toJson()).toList(), + 'members': ?_membersToData(instance.members), 'name': instance.name, 'team_id': ?instance.teamId, 'updated_at': instance.updatedAt.toIso8601String(), diff --git a/packages/stream_chat/lib/src/core/models/user_group_member.dart b/packages/stream_chat/lib/src/core/models/user_group_member.dart index 6396ca0c47..1e40a1ba0f 100644 --- a/packages/stream_chat/lib/src/core/models/user_group_member.dart +++ b/packages/stream_chat/lib/src/core/models/user_group_member.dart @@ -1,12 +1,16 @@ -import 'package:equatable/equatable.dart'; -import 'package:json_annotation/json_annotation.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; +import '../../db/data_serializable.dart'; + +part 'user_group_member.freezed.dart'; part 'user_group_member.g.dart'; -/// Class that defines a member of a user group. -@JsonSerializable(includeIfNull: false) -class UserGroupMember extends Equatable { - /// Create a new instance of [UserGroupMember]. +/// A user's membership in a [UserGroup]. +@freezed +// TODO(openapi-migration): remove in group 10 +@DataSerializable(includeIfNull: false) +class UserGroupMember with _$UserGroupMember { + /// Creates a new [UserGroupMember]. const UserGroupMember({ required this.createdAt, required this.groupId, @@ -14,29 +18,29 @@ class UserGroupMember extends Equatable { required this.userId, }); - /// Create a new instance from a json. - factory UserGroupMember.fromJson(Map json) => _$UserGroupMemberFromJson(json); + /// Creates a [UserGroupMember] from the offline-database format written by [toData]. + /// + /// It is not a codec for API payloads. + factory UserGroupMember.fromData(Map json) => _$UserGroupMemberFromJson(json); /// The date when the member was added to the group. + @override final DateTime createdAt; /// The id of the group the member belongs to. + @override final String groupId; /// Whether the member is an admin of the group. + @override final bool isAdmin; /// The id of the member. + @override final String userId; - /// Serialize model to json. - Map toJson() => _$UserGroupMemberToJson(this); - - @override - List get props => [ - createdAt, - groupId, - isAdmin, - userId, - ]; + /// Serializes this member to the format `stream_chat_persistence` stores. + /// + /// It is not a codec for API payloads. + Map toData() => _$UserGroupMemberToJson(this); } diff --git a/packages/stream_chat/lib/src/core/models/user_group_member.freezed.dart b/packages/stream_chat/lib/src/core/models/user_group_member.freezed.dart new file mode 100644 index 0000000000..5ca6f60668 --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/user_group_member.freezed.dart @@ -0,0 +1,98 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'user_group_member.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UserGroupMember { + DateTime get createdAt; + String get groupId; + bool get isAdmin; + String get userId; + + /// Create a copy of UserGroupMember + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UserGroupMemberCopyWith get copyWith => _$UserGroupMemberCopyWithImpl( + this as UserGroupMember, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UserGroupMember && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.groupId, groupId) || other.groupId == groupId) && + (identical(other.isAdmin, isAdmin) || other.isAdmin == isAdmin) && + (identical(other.userId, userId) || other.userId == userId)); + } + + @override + int get hashCode => Object.hash(runtimeType, createdAt, groupId, isAdmin, userId); + + @override + String toString() { + return 'UserGroupMember(createdAt: $createdAt, groupId: $groupId, isAdmin: $isAdmin, userId: $userId)'; + } +} + +/// @nodoc +abstract mixin class $UserGroupMemberCopyWith<$Res> { + factory $UserGroupMemberCopyWith( + UserGroupMember value, + $Res Function(UserGroupMember) _then, + ) = _$UserGroupMemberCopyWithImpl; + @useResult + $Res call({DateTime createdAt, String groupId, bool isAdmin, String userId}); +} + +/// @nodoc +class _$UserGroupMemberCopyWithImpl<$Res> implements $UserGroupMemberCopyWith<$Res> { + _$UserGroupMemberCopyWithImpl(this._self, this._then); + + final UserGroupMember _self; + final $Res Function(UserGroupMember) _then; + + /// Create a copy of UserGroupMember + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? createdAt = null, + Object? groupId = null, + Object? isAdmin = null, + Object? userId = null, + }) { + return _then( + UserGroupMember( + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + groupId: null == groupId + ? _self.groupId + : groupId // ignore: cast_nullable_to_non_nullable + as String, + isAdmin: null == isAdmin + ? _self.isAdmin + : isAdmin // ignore: cast_nullable_to_non_nullable + as bool, + userId: null == userId + ? _self.userId + : userId // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/src/db/data_serializable.dart b/packages/stream_chat/lib/src/db/data_serializable.dart new file mode 100644 index 0000000000..fb403b1326 --- /dev/null +++ b/packages/stream_chat/lib/src/db/data_serializable.dart @@ -0,0 +1,7 @@ +import 'package:json_annotation/json_annotation.dart'; + +/// Marks a model as serializable for the offline database, not for API payloads. +/// +/// The annotated class exposes the generated code as `fromData` and `toData`. +// TODO(openapi-migration): remove in group 10 +typedef DataSerializable = JsonSerializable; diff --git a/packages/stream_chat/lib/src/repository/devices_repository.dart b/packages/stream_chat/lib/src/repository/devices_repository.dart index f07a3a93d7..ef30ec3194 100644 --- a/packages/stream_chat/lib/src/repository/devices_repository.dart +++ b/packages/stream_chat/lib/src/repository/devices_repository.dart @@ -1,8 +1,8 @@ import 'package:stream_core/stream_core.dart' show PatternMatching, Result; import '../../open_api/api.dart' as api; -import '../core/models/list_devices_response.dart'; import '../core/models/push_provider.dart'; +import '../core/models/response/list_devices_response.dart'; import 'mapper/devices_mapper.dart'; import 'mapper/result_mapper.dart'; diff --git a/packages/stream_chat/lib/src/repository/mapper/devices_mapper.dart b/packages/stream_chat/lib/src/repository/mapper/devices_mapper.dart index eb7d470a72..0de090a582 100644 --- a/packages/stream_chat/lib/src/repository/mapper/devices_mapper.dart +++ b/packages/stream_chat/lib/src/repository/mapper/devices_mapper.dart @@ -1,7 +1,7 @@ import '../../../open_api/api.dart' as api; import '../../core/models/device.dart'; -import '../../core/models/list_devices_response.dart'; import '../../core/models/push_provider.dart'; +import '../../core/models/response/list_devices_response.dart'; /// Maps a generated [api.DeviceResponse] to a [Device]. extension DeviceResponseMapper on api.DeviceResponse { diff --git a/packages/stream_chat/lib/src/repository/mapper/roles_mapper.dart b/packages/stream_chat/lib/src/repository/mapper/roles_mapper.dart index 1b217ba9a7..d6c9609701 100644 --- a/packages/stream_chat/lib/src/repository/mapper/roles_mapper.dart +++ b/packages/stream_chat/lib/src/repository/mapper/roles_mapper.dart @@ -1,6 +1,6 @@ import '../../../open_api/api.dart' as api; +import '../../core/models/response/search_roles_response.dart'; import '../../core/models/role.dart'; -import '../../core/models/search_roles_response.dart'; /// Maps a generated [api.Role] to a [Role]. extension RoleMapper on api.Role { diff --git a/packages/stream_chat/lib/src/repository/mapper/user_groups_mapper.dart b/packages/stream_chat/lib/src/repository/mapper/user_groups_mapper.dart new file mode 100644 index 0000000000..4788c03e18 --- /dev/null +++ b/packages/stream_chat/lib/src/repository/mapper/user_groups_mapper.dart @@ -0,0 +1,101 @@ +import '../../../open_api/api.dart' as api; +import '../../core/models/response/add_user_group_members_response.dart'; +import '../../core/models/response/create_user_group_response.dart'; +import '../../core/models/response/get_user_group_response.dart'; +import '../../core/models/response/list_user_groups_response.dart'; +import '../../core/models/response/remove_user_group_members_response.dart'; +import '../../core/models/response/search_user_groups_response.dart'; +import '../../core/models/response/update_user_group_response.dart'; +import '../../core/models/user_group.dart'; +import '../../core/models/user_group_member.dart'; + +/// Maps a generated [api.UserGroupResponse] to a [UserGroup]. +extension UserGroupResponseMapper on api.UserGroupResponse { + /// Converts this response into a [UserGroup]. + /// + /// [UserGroup.members] stays `null` when the response leaves the members out. + UserGroup toModel() => UserGroup( + createdAt: createdAt, + createdBy: createdBy, + description: description, + id: id, + members: members?.map((member) => member.toModel()).toList(), + name: name, + teamId: teamId, + updatedAt: updatedAt, + ); +} + +/// Maps a generated [api.UserGroupMember] to a [UserGroupMember]. +extension UserGroupMemberMapper on api.UserGroupMember { + /// Converts this generated member into a [UserGroupMember]. + UserGroupMember toModel() => UserGroupMember( + createdAt: createdAt, + groupId: groupId, + isAdmin: isAdmin, + userId: userId, + ); +} + +/// Maps a generated [api.ListUserGroupsResponse] to a [ListUserGroupsResponse]. +extension ListUserGroupsResponseMapper on api.ListUserGroupsResponse { + /// Converts this response into a [ListUserGroupsResponse]. + ListUserGroupsResponse toModel() => ListUserGroupsResponse( + duration: duration, + userGroups: [for (final userGroup in userGroups) userGroup.toModel()], + ); +} + +/// Maps a generated [api.SearchUserGroupsResponse] to a [SearchUserGroupsResponse]. +extension SearchUserGroupsResponseMapper on api.SearchUserGroupsResponse { + /// Converts this response into a [SearchUserGroupsResponse]. + SearchUserGroupsResponse toModel() => SearchUserGroupsResponse( + duration: duration, + userGroups: [for (final userGroup in userGroups) userGroup.toModel()], + ); +} + +/// Maps a generated [api.GetUserGroupResponse] to a [GetUserGroupResponse]. +extension GetUserGroupResponseMapper on api.GetUserGroupResponse { + /// Converts this response into a [GetUserGroupResponse]. + GetUserGroupResponse toModel() => GetUserGroupResponse( + duration: duration, + userGroup: userGroup?.toModel(), + ); +} + +/// Maps a generated [api.CreateUserGroupResponse] to a [CreateUserGroupResponse]. +extension CreateUserGroupResponseMapper on api.CreateUserGroupResponse { + /// Converts this response into a [CreateUserGroupResponse]. + CreateUserGroupResponse toModel() => CreateUserGroupResponse( + duration: duration, + userGroup: userGroup?.toModel(), + ); +} + +/// Maps a generated [api.UpdateUserGroupResponse] to an [UpdateUserGroupResponse]. +extension UpdateUserGroupResponseMapper on api.UpdateUserGroupResponse { + /// Converts this response into an [UpdateUserGroupResponse]. + UpdateUserGroupResponse toModel() => UpdateUserGroupResponse( + duration: duration, + userGroup: userGroup?.toModel(), + ); +} + +/// Maps a generated [api.AddUserGroupMembersResponse] to an [AddUserGroupMembersResponse]. +extension AddUserGroupMembersResponseMapper on api.AddUserGroupMembersResponse { + /// Converts this response into an [AddUserGroupMembersResponse]. + AddUserGroupMembersResponse toModel() => AddUserGroupMembersResponse( + duration: duration, + userGroup: userGroup?.toModel(), + ); +} + +/// Maps a generated [api.RemoveUserGroupMembersResponse] to a [RemoveUserGroupMembersResponse]. +extension RemoveUserGroupMembersResponseMapper on api.RemoveUserGroupMembersResponse { + /// Converts this response into a [RemoveUserGroupMembersResponse]. + RemoveUserGroupMembersResponse toModel() => RemoveUserGroupMembersResponse( + duration: duration, + userGroup: userGroup?.toModel(), + ); +} diff --git a/packages/stream_chat/lib/src/repository/roles_repository.dart b/packages/stream_chat/lib/src/repository/roles_repository.dart index 18dcaa539b..e649e7489e 100644 --- a/packages/stream_chat/lib/src/repository/roles_repository.dart +++ b/packages/stream_chat/lib/src/repository/roles_repository.dart @@ -1,8 +1,8 @@ import 'package:stream_core/stream_core.dart' show PatternMatching, Result; import '../../open_api/api.dart' as api; +import '../core/models/response/search_roles_response.dart'; import '../core/models/role_type.dart'; -import '../core/models/search_roles_response.dart'; import 'mapper/roles_mapper.dart'; /// Repository dedicated to roles operations. diff --git a/packages/stream_chat/lib/src/repository/user_groups_repository.dart b/packages/stream_chat/lib/src/repository/user_groups_repository.dart new file mode 100644 index 0000000000..7314777d30 --- /dev/null +++ b/packages/stream_chat/lib/src/repository/user_groups_repository.dart @@ -0,0 +1,170 @@ +import 'package:stream_core/stream_core.dart' show PatternMatching, Result; + +import '../../open_api/api.dart' as api; +import '../core/models/response/add_user_group_members_response.dart'; +import '../core/models/response/create_user_group_response.dart'; +import '../core/models/response/get_user_group_response.dart'; +import '../core/models/response/list_user_groups_response.dart'; +import '../core/models/response/remove_user_group_members_response.dart'; +import '../core/models/response/search_user_groups_response.dart'; +import '../core/models/response/update_user_group_response.dart'; +import 'mapper/result_mapper.dart'; +import 'mapper/user_groups_mapper.dart'; + +/// Repository dedicated to user group operations. +class UserGroupsRepository { + /// Initialize a new user groups repository. + const UserGroupsRepository(this._api); + + final api.DefaultApi _api; + + /// Lists user groups with cursor-based pagination. + /// + /// [createdAtGt] and [idGt] form one cursor: pass the `createdAt` and `id` of + /// the last group on the previous page to get the next one. Either alone is ignored. + Future> listUserGroups({ + int? limit, + String? idGt, + DateTime? createdAtGt, + String? teamId, + }) async { + final result = await _api.listUserGroups( + limit: limit, + idGt: idGt, + createdAtGt: createdAtGt?.toUtc().toIso8601String(), + teamId: teamId, + ); + + return result.map((response) => response.toModel()); + } + + /// Searches user groups by name prefix (autocomplete). + /// + /// [nameGt] and [idGt] form one cursor: pass the `name` and `id` of the last + /// group on the previous page to get the next one. Either alone is ignored. + Future> searchUserGroups( + String query, { + int? limit, + String? nameGt, + String? idGt, + String? teamId, + }) async { + final result = await _api.searchUserGroups( + query: query, + limit: limit, + nameGt: nameGt, + idGt: idGt, + teamId: teamId, + ); + + return result.map((response) => response.toModel()); + } + + /// Gets a user group by ID, including its members. + Future> getUserGroup( + String id, { + String? teamId, + }) async { + final result = await _api.getUserGroup(id: id, teamId: teamId); + return result.map((response) => response.toModel()); + } + + /// Creates a new user group, optionally with initial members. + /// + /// [id] is generated by the server when omitted. + Future> createUserGroup( + String name, { + String? id, + String? description, + String? teamId, + List? memberIds, + }) async { + final result = await _api.createUserGroup( + createUserGroupRequest: api.CreateUserGroupRequest( + name: name, + id: id, + description: description, + teamId: teamId, + memberIds: memberIds, + ), + ); + + return result.map((response) => response.toModel()); + } + + /// Updates a user group's name and/or description. + /// + /// At least one of [name] / [description] must be provided. Passing + /// `description: ''` clears the description; passing `null` (or omitting) + /// leaves it unchanged. + /// + /// [teamId] scopes the lookup; a group's team cannot be changed. + Future> updateUserGroup( + String id, { + String? name, + String? description, + String? teamId, + }) async { + final result = await _api.updateUserGroup( + id: id, + updateUserGroupRequest: api.UpdateUserGroupRequest( + name: name, + description: description, + teamId: teamId, + ), + ); + + return result.map((response) => response.toModel()); + } + + /// Deletes a user group and all its memberships. + Future> deleteUserGroup( + String id, { + String? teamId, + }) async { + final result = await _api.deleteUserGroup(id: id, teamId: teamId); + return result.ignoreValue(); + } + + /// Adds members to a user group. + /// + /// All user IDs must exist; if any does not, no member is added. + /// + /// [asAdmin] defaults to `false` — a regular member — when not given. + Future> addUserGroupMembers( + String id, + List memberIds, { + bool? asAdmin, + String? teamId, + }) async { + final result = await _api.addUserGroupMembers( + id: id, + addUserGroupMembersRequest: api.AddUserGroupMembersRequest( + memberIds: memberIds, + asAdmin: asAdmin, + teamId: teamId, + ), + ); + + return result.map((response) => response.toModel()); + } + + /// Removes members from a user group. + /// + /// User IDs that are not members of the group are ignored. + Future> removeUserGroupMembers( + String id, + List memberIds, { + String? teamId, + }) async { + final result = await _api.removeUserGroupMembers( + id: id, + removeUserGroupMembersRequest: api.RemoveUserGroupMembersRequest( + memberIds: memberIds, + teamId: teamId, + ), + ); + + return result.map((response) => response.toModel()); + } +} diff --git a/packages/stream_chat/lib/stream_chat.dart b/packages/stream_chat/lib/stream_chat.dart index 6aab1c6203..f52031c6d9 100644 --- a/packages/stream_chat/lib/stream_chat.dart +++ b/packages/stream_chat/lib/stream_chat.dart @@ -95,7 +95,6 @@ export 'src/core/models/command.dart'; export 'src/core/models/device.dart'; export 'src/core/models/draft.dart'; export 'src/core/models/draft_message.dart'; -export 'src/core/models/list_devices_response.dart'; export 'src/core/models/location.dart'; export 'src/core/models/member.dart'; export 'src/core/models/message.dart'; @@ -118,10 +117,18 @@ export 'src/core/models/push_provider.dart'; export 'src/core/models/reaction.dart'; export 'src/core/models/reaction_group.dart'; export 'src/core/models/read.dart'; +export 'src/core/models/response/add_user_group_members_response.dart'; +export 'src/core/models/response/create_user_group_response.dart'; +export 'src/core/models/response/get_user_group_response.dart'; +export 'src/core/models/response/list_devices_response.dart'; +export 'src/core/models/response/list_user_groups_response.dart'; export 'src/core/models/response/og_attachment_response.dart'; +export 'src/core/models/response/remove_user_group_members_response.dart'; +export 'src/core/models/response/search_roles_response.dart'; +export 'src/core/models/response/search_user_groups_response.dart'; +export 'src/core/models/response/update_user_group_response.dart'; export 'src/core/models/role.dart'; export 'src/core/models/role_type.dart'; -export 'src/core/models/search_roles_response.dart'; export 'src/core/models/thread.dart'; export 'src/core/models/thread_participant.dart'; export 'src/core/models/unread_counts.dart'; diff --git a/packages/stream_chat/test/src/client/client_test.dart b/packages/stream_chat/test/src/client/client_test.dart index 42bbfa911a..3dd7736d4a 100644 --- a/packages/stream_chat/test/src/client/client_test.dart +++ b/packages/stream_chat/test/src/client/client_test.dart @@ -1839,7 +1839,7 @@ void main() { verifyNoMoreInteractions(fakeChatApi.channel); }); - test('`.addDevice should work`', () async { + test('StreamChatClient.addDevice sends the device and returns a success', () async { const id = 'test-device-id'; const request = api.CreateDeviceRequest( id: id, @@ -1857,7 +1857,7 @@ void main() { verifyNoMoreInteractions(defaultApi); }); - test('`.addDevice should work with pushProviderName`', () async { + test('StreamChatClient.addDevice forwards the push provider name', () async { const id = 'test-device-id'; const pushProviderName = 'my-custom-config'; const request = api.CreateDeviceRequest( @@ -1877,7 +1877,7 @@ void main() { verifyNoMoreInteractions(defaultApi); }); - test('`.addDevice` surfaces a failure without throwing', () async { + test('StreamChatClient.addDevice returns the failure without throwing', () async { const error = StreamClientException(message: 'boom'); const request = api.CreateDeviceRequest( id: 'test-device-id', @@ -1894,7 +1894,7 @@ void main() { expect(res.exceptionOrNull(), error); }); - test('`.getDevices`', () async { + test('StreamChatClient.getDevices returns the registered devices', () async { final devices = List.generate( 3, (index) => api.DeviceResponse( @@ -1916,7 +1916,7 @@ void main() { verifyNoMoreInteractions(defaultApi); }); - test('`.removeDevice`', () async { + test('StreamChatClient.removeDevice sends the device id and returns a success', () async { const deviceId = 'test-device-id'; when(() => defaultApi.deleteDevice(id: deviceId)).thenAnswer( @@ -2012,41 +2012,40 @@ void main() { expect(pushPreferences?.disabledUntil, pushPreference.disabledUntil); }); - test('`.listUserGroups`', () async { + test('StreamChatClient.listUserGroups sends the pagination arguments and returns the mapped groups', () async { const limit = 10; const idGt = 'cursor-group-id'; final createdAtGt = DateTime.utc(2024, 6, 15, 12); const teamId = 'test-team-id'; when( - () => fakeChatApi.userGroups.listUserGroups( + () => defaultApi.listUserGroups( limit: limit, idGt: idGt, - createdAtGt: createdAtGt, + createdAtGt: '2024-06-15T12:00:00.000Z', teamId: teamId, ), - ).thenAnswer((_) async => ListUserGroupsResponse()..userGroups = const []); - - final res = await client.listUserGroups( - limit: limit, - idGt: idGt, - createdAtGt: createdAtGt, - teamId: teamId, + ).thenAnswer( + (_) async => Result.success( + api.ListUserGroupsResponse(duration: '0.01ms', userGroups: [_generatedUserGroup('group-id')]), + ), ); - expect(res, isNotNull); + + final res = await client.listUserGroups(limit: limit, idGt: idGt, createdAtGt: createdAtGt, teamId: teamId); + expect(res.getOrNull()?.userGroups, [_userGroup('group-id')]); verify( - () => fakeChatApi.userGroups.listUserGroups( + () => defaultApi.listUserGroups( limit: limit, idGt: idGt, - createdAtGt: createdAtGt, + createdAtGt: '2024-06-15T12:00:00.000Z', teamId: teamId, ), ).called(1); - verifyNoMoreInteractions(fakeChatApi.userGroups); + verifyNoMoreInteractions(defaultApi); }); - test('`.searchUserGroups`', () async { + test('StreamChatClient.searchUserGroups sends the query and returns the mapped groups', () async { const query = 'eng'; const limit = 10; const nameGt = 'engineering'; @@ -2054,83 +2053,54 @@ void main() { const teamId = 'test-team-id'; when( - () => fakeChatApi.userGroups.searchUserGroups( - query, - limit: limit, - nameGt: nameGt, - idGt: idGt, - teamId: teamId, + () => defaultApi.searchUserGroups(query: query, limit: limit, nameGt: nameGt, idGt: idGt, teamId: teamId), + ).thenAnswer( + (_) async => Result.success( + api.SearchUserGroupsResponse(duration: '0.01ms', userGroups: [_generatedUserGroup('group-id')]), ), - ).thenAnswer((_) async => SearchUserGroupsResponse()..userGroups = const []); - - final res = await client.searchUserGroups( - query, - limit: limit, - nameGt: nameGt, - idGt: idGt, - teamId: teamId, ); - expect(res, isNotNull); + + final res = await client.searchUserGroups(query, limit: limit, nameGt: nameGt, idGt: idGt, teamId: teamId); + expect(res.getOrNull()?.userGroups, [_userGroup('group-id')]); verify( - () => fakeChatApi.userGroups.searchUserGroups( - query, - limit: limit, - nameGt: nameGt, - idGt: idGt, - teamId: teamId, - ), + () => defaultApi.searchUserGroups(query: query, limit: limit, nameGt: nameGt, idGt: idGt, teamId: teamId), ).called(1); - verifyNoMoreInteractions(fakeChatApi.userGroups); + verifyNoMoreInteractions(defaultApi); }); - test('`.getUserGroup`', () async { + test('StreamChatClient.getUserGroup sends the id and team and returns the mapped group', () async { const id = 'test-group-id'; const teamId = 'test-team-id'; - when(() => fakeChatApi.userGroups.getUserGroup(id, teamId: teamId)).thenAnswer( - (_) async => GetUserGroupResponse() - ..userGroup = UserGroup( - id: id, - name: 'test-group-name', - createdAt: DateTime.utc(2024, 1, 1), - updatedAt: DateTime.utc(2024, 1, 2), - ), + when(() => defaultApi.getUserGroup(id: id, teamId: teamId)).thenAnswer( + (_) async => Result.success(api.GetUserGroupResponse(duration: '0.01ms', userGroup: _generatedUserGroup(id))), ); final res = await client.getUserGroup(id, teamId: teamId); - expect(res, isNotNull); - expect(res.userGroup.id, id); + expect(res.getOrNull()?.userGroup, _userGroup(id)); - verify(() => fakeChatApi.userGroups.getUserGroup(id, teamId: teamId)).called(1); - verifyNoMoreInteractions(fakeChatApi.userGroups); + verify(() => defaultApi.getUserGroup(id: id, teamId: teamId)).called(1); + verifyNoMoreInteractions(defaultApi); }); - test('`.createUserGroup`', () async { + test('StreamChatClient.createUserGroup sends the arguments and returns the mapped group', () async { const name = 'Engineering'; - const id = 'eng'; - const description = 'Engineering team'; + const id = 'test-group-id'; + const description = 'The engineers'; const teamId = 'test-team-id'; - const memberIds = ['user-1', 'user-2']; + const memberIds = ['test-user-id']; + const request = api.CreateUserGroupRequest( + name: name, + id: id, + description: description, + teamId: teamId, + memberIds: memberIds, + ); - when( - () => fakeChatApi.userGroups.createUserGroup( - name, - id: id, - description: description, - teamId: teamId, - memberIds: memberIds, - ), - ).thenAnswer( - (_) async => CreateUserGroupResponse() - ..userGroup = UserGroup( - id: id, - name: name, - description: description, - teamId: teamId, - createdAt: DateTime.utc(2024, 1, 1), - updatedAt: DateTime.utc(2024, 1, 2), - ), + when(() => defaultApi.createUserGroup(createUserGroupRequest: request)).thenAnswer( + (_) async => + Result.success(api.CreateUserGroupResponse(duration: '0.01ms', userGroup: _generatedUserGroup(id))), ); final res = await client.createUserGroup( @@ -2140,162 +2110,95 @@ void main() { teamId: teamId, memberIds: memberIds, ); - expect(res, isNotNull); - expect(res.userGroup.id, id); + expect(res.getOrNull()?.userGroup, _userGroup(id)); - verify( - () => fakeChatApi.userGroups.createUserGroup( - name, - id: id, - description: description, - teamId: teamId, - memberIds: memberIds, - ), - ).called(1); - verifyNoMoreInteractions(fakeChatApi.userGroups); + verify(() => defaultApi.createUserGroup(createUserGroupRequest: request)).called(1); + verifyNoMoreInteractions(defaultApi); }); - test('`.updateUserGroup`', () async { + test('StreamChatClient.updateUserGroup sends the arguments and returns the mapped group', () async { const id = 'test-group-id'; - const name = 'New Name'; - const description = 'New description'; + const name = 'Engineering'; + const description = 'The engineers'; const teamId = 'test-team-id'; + const request = api.UpdateUserGroupRequest(name: name, description: description, teamId: teamId); - when( - () => fakeChatApi.userGroups.updateUserGroup( - id, - name: name, - description: description, - teamId: teamId, - ), - ).thenAnswer( - (_) async => UpdateUserGroupResponse() - ..userGroup = UserGroup( - id: id, - name: name, - description: description, - teamId: teamId, - createdAt: DateTime.utc(2024, 1, 1), - updatedAt: DateTime.utc(2024, 1, 2), - ), + when(() => defaultApi.updateUserGroup(id: id, updateUserGroupRequest: request)).thenAnswer( + (_) async => + Result.success(api.UpdateUserGroupResponse(duration: '0.01ms', userGroup: _generatedUserGroup(id))), ); - final res = await client.updateUserGroup( - id, - name: name, - description: description, - teamId: teamId, - ); - expect(res, isNotNull); - expect(res.userGroup.name, name); + final res = await client.updateUserGroup(id, name: name, description: description, teamId: teamId); + expect(res.getOrNull()?.userGroup, _userGroup(id)); - verify( - () => fakeChatApi.userGroups.updateUserGroup( - id, - name: name, - description: description, - teamId: teamId, - ), - ).called(1); - verifyNoMoreInteractions(fakeChatApi.userGroups); + verify(() => defaultApi.updateUserGroup(id: id, updateUserGroupRequest: request)).called(1); + verifyNoMoreInteractions(defaultApi); }); - test('`.deleteUserGroup`', () async { + test('StreamChatClient.deleteUserGroup sends the id and team and returns a success with no value', () async { const id = 'test-group-id'; const teamId = 'test-team-id'; - when(() => fakeChatApi.userGroups.deleteUserGroup(id, teamId: teamId)).thenAnswer( - (_) async => EmptyResponse(), - ); + when( + () => defaultApi.deleteUserGroup(id: id, teamId: teamId), + ).thenAnswer((_) async => const Result.success(api.DurationResponse(duration: '0.01ms'))); final res = await client.deleteUserGroup(id, teamId: teamId); - expect(res, isNotNull); + expect(res, const Result.success(null)); - verify(() => fakeChatApi.userGroups.deleteUserGroup(id, teamId: teamId)).called(1); - verifyNoMoreInteractions(fakeChatApi.userGroups); + verify(() => defaultApi.deleteUserGroup(id: id, teamId: teamId)).called(1); + verifyNoMoreInteractions(defaultApi); }); - test('`.addUserGroupMembers`', () async { + test('StreamChatClient.addUserGroupMembers sends the members and returns the mapped group', () async { const id = 'test-group-id'; - const memberIds = ['user-1', 'user-2']; - const asAdmin = true; + const memberIds = ['test-user-id']; const teamId = 'test-team-id'; + const request = api.AddUserGroupMembersRequest(memberIds: memberIds, asAdmin: true, teamId: teamId); - when( - () => fakeChatApi.userGroups.addUserGroupMembers( - id, - memberIds, - asAdmin: asAdmin, - teamId: teamId, - ), - ).thenAnswer( - (_) async => AddUserGroupMembersResponse() - ..userGroup = UserGroup( - id: id, - name: 'test-group-name', - createdAt: DateTime.utc(2024, 1, 1), - updatedAt: DateTime.utc(2024, 1, 2), - ), + when(() => defaultApi.addUserGroupMembers(id: id, addUserGroupMembersRequest: request)).thenAnswer( + (_) async => + Result.success(api.AddUserGroupMembersResponse(duration: '0.01ms', userGroup: _generatedUserGroup(id))), ); - final res = await client.addUserGroupMembers( - id, - memberIds, - asAdmin: asAdmin, - teamId: teamId, - ); - expect(res, isNotNull); + final res = await client.addUserGroupMembers(id, memberIds, asAdmin: true, teamId: teamId); + expect(res.getOrNull()?.userGroup, _userGroup(id)); - verify( - () => fakeChatApi.userGroups.addUserGroupMembers( - id, - memberIds, - asAdmin: asAdmin, - teamId: teamId, - ), - ).called(1); - verifyNoMoreInteractions(fakeChatApi.userGroups); + verify(() => defaultApi.addUserGroupMembers(id: id, addUserGroupMembersRequest: request)).called(1); + verifyNoMoreInteractions(defaultApi); }); - test('`.removeUserGroupMembers`', () async { + test('StreamChatClient.removeUserGroupMembers sends the members and returns the mapped group', () async { const id = 'test-group-id'; - const memberIds = ['user-1', 'user-2']; + const memberIds = ['test-user-id']; const teamId = 'test-team-id'; + const request = api.RemoveUserGroupMembersRequest(memberIds: memberIds, teamId: teamId); - when( - () => fakeChatApi.userGroups.removeUserGroupMembers( - id, - memberIds, - teamId: teamId, - ), - ).thenAnswer( - (_) async => RemoveUserGroupMembersResponse() - ..userGroup = UserGroup( - id: id, - name: 'test-group-name', - createdAt: DateTime.utc(2024, 1, 1), - updatedAt: DateTime.utc(2024, 1, 2), - ), + when(() => defaultApi.removeUserGroupMembers(id: id, removeUserGroupMembersRequest: request)).thenAnswer( + (_) async => + Result.success(api.RemoveUserGroupMembersResponse(duration: '0.01ms', userGroup: _generatedUserGroup(id))), ); - final res = await client.removeUserGroupMembers( - id, - memberIds, - teamId: teamId, - ); - expect(res, isNotNull); + final res = await client.removeUserGroupMembers(id, memberIds, teamId: teamId); + expect(res.getOrNull()?.userGroup, _userGroup(id)); - verify( - () => fakeChatApi.userGroups.removeUserGroupMembers( - id, - memberIds, - teamId: teamId, - ), - ).called(1); - verifyNoMoreInteractions(fakeChatApi.userGroups); + verify(() => defaultApi.removeUserGroupMembers(id: id, removeUserGroupMembersRequest: request)).called(1); + verifyNoMoreInteractions(defaultApi); + }); + + test('StreamChatClient.searchUserGroups returns the failure without throwing', () async { + const error = StreamClientException(message: 'boom'); + + when( + () => defaultApi.searchUserGroups(query: 'eng'), + ).thenAnswer((_) async => const Result.failure(error)); + + final res = await client.searchUserGroups('eng'); + + expect(res.exceptionOrNull(), error); }); - test('`.searchRoles`', () async { + test('StreamChatClient.searchRoles sends the query and returns the mapped response', () async { const query = 'adm'; const limit = 10; const nameGt = 'admin'; @@ -2336,7 +2239,7 @@ void main() { verifyNoMoreInteractions(defaultApi); }); - test('`.searchRoles` surfaces a failure without throwing', () async { + test('StreamChatClient.searchRoles returns the failure without throwing', () async { const query = 'adm'; const error = StreamClientException(message: 'boom'); @@ -6794,3 +6697,21 @@ void main() { }); }); } + +api.UserGroupResponse _generatedUserGroup(String id) { + return api.UserGroupResponse( + createdAt: DateTime.utc(2024), + id: id, + name: 'name-$id', + updatedAt: DateTime.utc(2024), + ); +} + +UserGroup _userGroup(String id) { + return UserGroup( + createdAt: DateTime.utc(2024), + id: id, + name: 'name-$id', + updatedAt: DateTime.utc(2024), + ); +} diff --git a/packages/stream_chat/test/src/core/api/responses_test.dart b/packages/stream_chat/test/src/core/api/responses_test.dart index 986868f4a4..b281d2fdbc 100644 --- a/packages/stream_chat/test/src/core/api/responses_test.dart +++ b/packages/stream_chat/test/src/core/api/responses_test.dart @@ -4479,251 +4479,5 @@ void main() { final channel3Prefs = user2ChannelPrefs['channel3']!; expect(channel3Prefs.chatLevel, ChatLevel.mentions); }); - - test('ListUserGroupsResponse', () { - const jsonExample = ''' - { - "user_groups": [ - { - "id": "g1", - "name": "Group 1", - "description": "First group", - "team_id": "team-1", - "created_by": "user-1", - "created_at": "2024-01-01T00:00:00Z", - "updated_at": "2024-01-02T00:00:00Z" - }, - { - "id": "g2", - "name": "Group 2", - "created_at": "2024-02-01T00:00:00Z", - "updated_at": "2024-02-02T00:00:00Z" - } - ], - "duration": "0.35ms" - }'''; - final response = ListUserGroupsResponse.fromJson(json.decode(jsonExample)); - expect(response.userGroups, isA>()); - expect(response.userGroups, hasLength(2)); - - final first = response.userGroups.first; - expect(first.id, 'g1'); - expect(first.name, 'Group 1'); - expect(first.description, 'First group'); - expect(first.teamId, 'team-1'); - expect(first.createdBy, 'user-1'); - expect(first.members, isNull); - expect(first.createdAt, DateTime.parse('2024-01-01T00:00:00Z')); - expect(first.updatedAt, DateTime.parse('2024-01-02T00:00:00Z')); - - final last = response.userGroups.last; - expect(last.id, 'g2'); - expect(last.name, 'Group 2'); - expect(last.description, isNull); - expect(last.teamId, isNull); - expect(last.createdBy, isNull); - }); - - test('SearchUserGroupsResponse', () { - const jsonExample = ''' - { - "user_groups": [ - { - "id": "g1", - "name": "Group 1", - "description": "First group", - "team_id": "team-1", - "created_by": "user-1", - "created_at": "2024-01-01T00:00:00Z", - "updated_at": "2024-01-02T00:00:00Z" - } - ], - "duration": "0.35ms" - }'''; - final response = SearchUserGroupsResponse.fromJson(json.decode(jsonExample)); - expect(response.userGroups, isA>()); - expect(response.userGroups, hasLength(1)); - - final group = response.userGroups.first; - expect(group.id, 'g1'); - expect(group.name, 'Group 1'); - expect(group.description, 'First group'); - expect(group.teamId, 'team-1'); - expect(group.createdBy, 'user-1'); - expect(group.members, isNull); - expect(group.createdAt, DateTime.parse('2024-01-01T00:00:00Z')); - expect(group.updatedAt, DateTime.parse('2024-01-02T00:00:00Z')); - }); - - test('GetUserGroupResponse', () { - const jsonExample = ''' - { - "user_group": { - "id": "g1", - "name": "Group 1", - "description": "First group", - "team_id": "team-1", - "created_by": "user-1", - "members": [ - { - "group_id": "g1", - "user_id": "user-1", - "is_admin": true, - "created_at": "2024-01-03T00:00:00Z" - } - ], - "created_at": "2024-01-01T00:00:00Z", - "updated_at": "2024-01-02T00:00:00Z" - }, - "duration": "0.35ms" - }'''; - final response = GetUserGroupResponse.fromJson(json.decode(jsonExample)); - expect(response.userGroup, isA()); - - final group = response.userGroup; - expect(group.id, 'g1'); - expect(group.name, 'Group 1'); - expect(group.description, 'First group'); - expect(group.teamId, 'team-1'); - expect(group.createdBy, 'user-1'); - expect(group.createdAt, DateTime.parse('2024-01-01T00:00:00Z')); - expect(group.updatedAt, DateTime.parse('2024-01-02T00:00:00Z')); - - expect(group.members, isA>()); - expect(group.members, hasLength(1)); - final member = group.members!.first; - expect(member.groupId, 'g1'); - expect(member.userId, 'user-1'); - expect(member.isAdmin, isTrue); - expect(member.createdAt, DateTime.parse('2024-01-03T00:00:00Z')); - }); - - test('CreateUserGroupResponse', () { - const jsonExample = ''' - { - "user_group": { - "id": "g1", - "name": "Group 1", - "description": "First group", - "team_id": "team-1", - "created_by": "user-1", - "created_at": "2024-01-01T00:00:00Z", - "updated_at": "2024-01-02T00:00:00Z" - }, - "duration": "0.35ms" - }'''; - final response = CreateUserGroupResponse.fromJson(json.decode(jsonExample)); - expect(response.userGroup, isA()); - - final group = response.userGroup; - expect(group.id, 'g1'); - expect(group.name, 'Group 1'); - expect(group.description, 'First group'); - expect(group.teamId, 'team-1'); - expect(group.createdBy, 'user-1'); - expect(group.members, isNull); - expect(group.createdAt, DateTime.parse('2024-01-01T00:00:00Z')); - expect(group.updatedAt, DateTime.parse('2024-01-02T00:00:00Z')); - }); - - test('UpdateUserGroupResponse', () { - const jsonExample = ''' - { - "user_group": { - "id": "g1", - "name": "Renamed Group", - "description": "Updated description", - "team_id": "team-1", - "created_by": "user-1", - "created_at": "2024-01-01T00:00:00Z", - "updated_at": "2024-01-03T00:00:00Z" - }, - "duration": "0.35ms" - }'''; - final response = UpdateUserGroupResponse.fromJson(json.decode(jsonExample)); - expect(response.userGroup, isA()); - - final group = response.userGroup; - expect(group.id, 'g1'); - expect(group.name, 'Renamed Group'); - expect(group.description, 'Updated description'); - expect(group.teamId, 'team-1'); - expect(group.createdBy, 'user-1'); - expect(group.members, isNull); - expect(group.createdAt, DateTime.parse('2024-01-01T00:00:00Z')); - expect(group.updatedAt, DateTime.parse('2024-01-03T00:00:00Z')); - }); - - test('AddUserGroupMembersResponse', () { - const jsonExample = ''' - { - "user_group": { - "id": "g1", - "name": "Group 1", - "team_id": "team-1", - "created_by": "user-1", - "members": [ - { - "group_id": "g1", - "user_id": "user-1", - "is_admin": false, - "created_at": "2024-01-03T00:00:00Z" - }, - { - "group_id": "g1", - "user_id": "user-2", - "is_admin": true, - "created_at": "2024-01-03T00:00:00Z" - } - ], - "created_at": "2024-01-01T00:00:00Z", - "updated_at": "2024-01-03T00:00:00Z" - }, - "duration": "0.35ms" - }'''; - final response = AddUserGroupMembersResponse.fromJson(json.decode(jsonExample)); - expect(response.userGroup, isA()); - - final group = response.userGroup; - expect(group.id, 'g1'); - expect(group.name, 'Group 1'); - expect(group.teamId, 'team-1'); - expect(group.createdBy, 'user-1'); - expect(group.createdAt, DateTime.parse('2024-01-01T00:00:00Z')); - expect(group.updatedAt, DateTime.parse('2024-01-03T00:00:00Z')); - - expect(group.members, hasLength(2)); - expect(group.members!.first.userId, 'user-1'); - expect(group.members!.first.isAdmin, isFalse); - expect(group.members!.last.userId, 'user-2'); - expect(group.members!.last.isAdmin, isTrue); - }); - - test('RemoveUserGroupMembersResponse', () { - const jsonExample = ''' - { - "user_group": { - "id": "g1", - "name": "Group 1", - "team_id": "team-1", - "created_by": "user-1", - "members": [], - "created_at": "2024-01-01T00:00:00Z", - "updated_at": "2024-01-04T00:00:00Z" - }, - "duration": "0.35ms" - }'''; - final response = RemoveUserGroupMembersResponse.fromJson(json.decode(jsonExample)); - expect(response.userGroup, isA()); - - final group = response.userGroup; - expect(group.id, 'g1'); - expect(group.name, 'Group 1'); - expect(group.teamId, 'team-1'); - expect(group.createdBy, 'user-1'); - expect(group.members, isEmpty); - expect(group.createdAt, DateTime.parse('2024-01-01T00:00:00Z')); - expect(group.updatedAt, DateTime.parse('2024-01-04T00:00:00Z')); - }); }); } diff --git a/packages/stream_chat/test/src/core/api/user_groups_api_test.dart b/packages/stream_chat/test/src/core/api/user_groups_api_test.dart deleted file mode 100644 index 5807d3eb48..0000000000 --- a/packages/stream_chat/test/src/core/api/user_groups_api_test.dart +++ /dev/null @@ -1,523 +0,0 @@ -// ignore_for_file: avoid_redundant_argument_values - -import 'package:dio/dio.dart'; -import 'package:mocktail/mocktail.dart'; -import 'package:stream_chat/src/core/api/user_groups_api.dart'; -import 'package:test/test.dart'; - -import '../../mocks.dart'; - -void main() { - Response successResponse(String path, {Object? data}) => Response( - data: data, - requestOptions: RequestOptions(path: path), - statusCode: 200, - ); - - Map userGroupJson({ - String id = 'test-group-id', - String name = 'test-group-name', - String? description, - String? teamId, - String? createdBy, - List>? members, - }) => { - 'id': id, - 'name': name, - if (description != null) 'description': description, - if (teamId != null) 'team_id': teamId, - if (createdBy != null) 'created_by': createdBy, - if (members != null) 'members': members, - 'created_at': '2024-01-01T00:00:00Z', - 'updated_at': '2024-01-02T00:00:00Z', - }; - - Map userGroupMemberJson({ - String groupId = 'test-group-id', - String userId = 'test-user-id', - bool isAdmin = false, - }) => { - 'group_id': groupId, - 'user_id': userId, - 'is_admin': isAdmin, - 'created_at': '2024-01-01T00:00:00Z', - }; - - late final client = MockHttpClient(); - late UserGroupsApi userGroupsApi; - - setUp(() { - userGroupsApi = UserGroupsApi(client); - }); - - group('listUserGroups', () { - test('should list with no parameters', () async { - const path = '/usergroups'; - - when(() => client.get(path, queryParameters: {})).thenAnswer( - (_) async => successResponse(path, data: {'user_groups': []}), - ); - - final res = await userGroupsApi.listUserGroups(); - - expect(res, isNotNull); - expect(res.userGroups, isEmpty); - - verify( - () => client.get(path, queryParameters: any(named: 'queryParameters')), - ).called(1); - verifyNoMoreInteractions(client); - }); - - test('should list with all parameters', () async { - const path = '/usergroups'; - const limit = 25; - const idGt = 'cursor-group-id'; - // Intentionally non-UTC so we exercise `.toUtc().toIso8601String()`. - final createdAtGt = DateTime.utc(2024, 6, 15, 12).toLocal(); - const teamId = 'test-team-id'; - - final expectedQueryParameters = { - 'limit': limit, - 'id_gt': idGt, - 'created_at_gt': createdAtGt.toUtc().toIso8601String(), - 'team_id': teamId, - }; - - when(() => client.get(path, queryParameters: expectedQueryParameters)).thenAnswer( - (_) async => successResponse( - path, - data: { - 'user_groups': [userGroupJson()], - }, - ), - ); - - final res = await userGroupsApi.listUserGroups( - limit: limit, - idGt: idGt, - createdAtGt: createdAtGt, - teamId: teamId, - ); - - expect(res, isNotNull); - expect(res.userGroups, hasLength(1)); - - verify( - () => client.get(path, queryParameters: expectedQueryParameters), - ).called(1); - verifyNoMoreInteractions(client); - }); - }); - - group('searchUserGroups', () { - test('should search with query only', () async { - const path = '/usergroups/search'; - const query = 'eng'; - - when(() => client.get(path, queryParameters: {'query': query})).thenAnswer( - (_) async => successResponse(path, data: {'user_groups': []}), - ); - - final res = await userGroupsApi.searchUserGroups(query); - - expect(res, isNotNull); - expect(res.userGroups, isEmpty); - - verify( - () => client.get(path, queryParameters: {'query': query}), - ).called(1); - verifyNoMoreInteractions(client); - }); - - test('should search with all parameters', () async { - const path = '/usergroups/search'; - const query = 'eng'; - const limit = 10; - const nameGt = 'engineering'; - const idGt = 'cursor-group-id'; - const teamId = 'test-team-id'; - - final expectedQueryParameters = { - 'query': query, - 'limit': limit, - 'name_gt': nameGt, - 'id_gt': idGt, - 'team_id': teamId, - }; - - when(() => client.get(path, queryParameters: expectedQueryParameters)).thenAnswer( - (_) async => successResponse( - path, - data: { - 'user_groups': [userGroupJson()], - }, - ), - ); - - final res = await userGroupsApi.searchUserGroups( - query, - limit: limit, - nameGt: nameGt, - idGt: idGt, - teamId: teamId, - ); - - expect(res, isNotNull); - expect(res.userGroups, hasLength(1)); - - verify( - () => client.get(path, queryParameters: expectedQueryParameters), - ).called(1); - verifyNoMoreInteractions(client); - }); - }); - - group('getUserGroup', () { - test('should get with id only', () async { - const id = 'test-group-id'; - const path = '/usergroups/$id'; - - when(() => client.get(path, queryParameters: {})).thenAnswer( - (_) async => successResponse( - path, - data: { - 'user_group': userGroupJson( - id: id, - members: [userGroupMemberJson(groupId: id)], - ), - }, - ), - ); - - final res = await userGroupsApi.getUserGroup(id); - - expect(res, isNotNull); - expect(res.userGroup.id, id); - expect(res.userGroup.members, isNotNull); - expect(res.userGroup.members, hasLength(1)); - - verify( - () => client.get(path, queryParameters: any(named: 'queryParameters')), - ).called(1); - verifyNoMoreInteractions(client); - }); - - test('should get with teamId', () async { - const id = 'test-group-id'; - const teamId = 'test-team-id'; - const path = '/usergroups/$id'; - - when(() => client.get(path, queryParameters: {'team_id': teamId})).thenAnswer( - (_) async => successResponse( - path, - data: { - 'user_group': userGroupJson(id: id, teamId: teamId), - }, - ), - ); - - final res = await userGroupsApi.getUserGroup(id, teamId: teamId); - - expect(res, isNotNull); - expect(res.userGroup.id, id); - expect(res.userGroup.teamId, teamId); - - verify( - () => client.get(path, queryParameters: {'team_id': teamId}), - ).called(1); - verifyNoMoreInteractions(client); - }); - }); - - group('createUserGroup', () { - test('should create with name only', () async { - const path = '/usergroups'; - const name = 'Engineering'; - - when(() => client.post(path, data: {'name': name})).thenAnswer( - (_) async => successResponse( - path, - data: { - 'user_group': userGroupJson(name: name), - }, - ), - ); - - final res = await userGroupsApi.createUserGroup(name); - - expect(res, isNotNull); - expect(res.userGroup.name, name); - - verify(() => client.post(path, data: {'name': name})).called(1); - verifyNoMoreInteractions(client); - }); - - test('should create with all parameters', () async { - const path = '/usergroups'; - const name = 'Engineering'; - const id = 'eng'; - const description = 'Engineering team'; - const teamId = 'test-team-id'; - const memberIds = ['user-1', 'user-2']; - - final expectedData = { - 'name': name, - 'id': id, - 'description': description, - 'team_id': teamId, - 'member_ids': memberIds, - }; - - when(() => client.post(path, data: expectedData)).thenAnswer( - (_) async => successResponse( - path, - data: { - 'user_group': userGroupJson( - id: id, - name: name, - description: description, - teamId: teamId, - ), - }, - ), - ); - - final res = await userGroupsApi.createUserGroup( - name, - id: id, - description: description, - teamId: teamId, - memberIds: memberIds, - ); - - expect(res, isNotNull); - expect(res.userGroup.id, id); - expect(res.userGroup.description, description); - - verify(() => client.post(path, data: expectedData)).called(1); - verifyNoMoreInteractions(client); - }); - }); - - group('updateUserGroup', () { - test('should update with name only', () async { - const id = 'test-group-id'; - const path = '/usergroups/$id'; - const name = 'New Name'; - - when(() => client.put(path, data: {'name': name})).thenAnswer( - (_) async => successResponse( - path, - data: { - 'user_group': userGroupJson(id: id, name: name), - }, - ), - ); - - final res = await userGroupsApi.updateUserGroup(id, name: name); - - expect(res, isNotNull); - expect(res.userGroup.name, name); - - verify(() => client.put(path, data: {'name': name})).called(1); - verifyNoMoreInteractions(client); - }); - - test('should update with all parameters (empty description clears it)', () async { - const id = 'test-group-id'; - const path = '/usergroups/$id'; - const name = 'New Name'; - // Empty string is forwarded to the server (which uses it to clear the - // description); null would omit the key entirely. - const description = ''; - const teamId = 'test-team-id'; - - final expectedData = { - 'name': name, - 'description': description, - 'team_id': teamId, - }; - - when(() => client.put(path, data: expectedData)).thenAnswer( - (_) async => successResponse( - path, - data: { - 'user_group': userGroupJson(id: id, name: name, teamId: teamId), - }, - ), - ); - - final res = await userGroupsApi.updateUserGroup( - id, - name: name, - description: description, - teamId: teamId, - ); - - expect(res, isNotNull); - expect(res.userGroup.name, name); - - verify(() => client.put(path, data: expectedData)).called(1); - verifyNoMoreInteractions(client); - }); - }); - - group('deleteUserGroup', () { - test('should delete with id only', () async { - const id = 'test-group-id'; - const path = '/usergroups/$id'; - - when(() => client.delete(path, queryParameters: {})).thenAnswer( - (_) async => successResponse(path, data: {}), - ); - - final res = await userGroupsApi.deleteUserGroup(id); - - expect(res, isNotNull); - - verify( - () => client.delete(path, queryParameters: any(named: 'queryParameters')), - ).called(1); - verifyNoMoreInteractions(client); - }); - - test('should delete with teamId', () async { - const id = 'test-group-id'; - const teamId = 'test-team-id'; - const path = '/usergroups/$id'; - - when(() => client.delete(path, queryParameters: {'team_id': teamId})).thenAnswer( - (_) async => successResponse(path, data: {}), - ); - - final res = await userGroupsApi.deleteUserGroup(id, teamId: teamId); - - expect(res, isNotNull); - - verify( - () => client.delete(path, queryParameters: {'team_id': teamId}), - ).called(1); - verifyNoMoreInteractions(client); - }); - }); - - group('addUserGroupMembers', () { - test('should add members with required arguments only', () async { - const id = 'test-group-id'; - const path = '/usergroups/$id/members'; - const memberIds = ['user-1', 'user-2']; - - when(() => client.post(path, data: {'member_ids': memberIds})).thenAnswer( - (_) async => successResponse( - path, - data: { - 'user_group': userGroupJson( - id: id, - members: memberIds.map((it) => userGroupMemberJson(groupId: id, userId: it)).toList(), - ), - }, - ), - ); - - final res = await userGroupsApi.addUserGroupMembers(id, memberIds); - - expect(res, isNotNull); - expect(res.userGroup.members, hasLength(memberIds.length)); - - verify(() => client.post(path, data: {'member_ids': memberIds})).called(1); - verifyNoMoreInteractions(client); - }); - - test('should add members with asAdmin and teamId', () async { - const id = 'test-group-id'; - const path = '/usergroups/$id/members'; - const memberIds = ['user-1', 'user-2']; - const asAdmin = true; - const teamId = 'test-team-id'; - - final expectedData = { - 'member_ids': memberIds, - 'as_admin': asAdmin, - 'team_id': teamId, - }; - - when(() => client.post(path, data: expectedData)).thenAnswer( - (_) async => successResponse( - path, - data: { - 'user_group': userGroupJson(id: id, teamId: teamId), - }, - ), - ); - - final res = await userGroupsApi.addUserGroupMembers( - id, - memberIds, - asAdmin: asAdmin, - teamId: teamId, - ); - - expect(res, isNotNull); - - verify(() => client.post(path, data: expectedData)).called(1); - verifyNoMoreInteractions(client); - }); - }); - - group('removeUserGroupMembers', () { - test('should remove members with required arguments only', () async { - const id = 'test-group-id'; - const path = '/usergroups/$id/members/delete'; - const memberIds = ['user-1', 'user-2']; - - when(() => client.post(path, data: {'member_ids': memberIds})).thenAnswer( - (_) async => successResponse( - path, - data: { - 'user_group': userGroupJson(id: id), - }, - ), - ); - - final res = await userGroupsApi.removeUserGroupMembers(id, memberIds); - - expect(res, isNotNull); - - verify(() => client.post(path, data: {'member_ids': memberIds})).called(1); - verifyNoMoreInteractions(client); - }); - - test('should remove members with teamId', () async { - const id = 'test-group-id'; - const path = '/usergroups/$id/members/delete'; - const memberIds = ['user-1', 'user-2']; - const teamId = 'test-team-id'; - - final expectedData = { - 'member_ids': memberIds, - 'team_id': teamId, - }; - - when(() => client.post(path, data: expectedData)).thenAnswer( - (_) async => successResponse( - path, - data: { - 'user_group': userGroupJson(id: id, teamId: teamId), - }, - ), - ); - - final res = await userGroupsApi.removeUserGroupMembers( - id, - memberIds, - teamId: teamId, - ); - - expect(res, isNotNull); - - verify(() => client.post(path, data: expectedData)).called(1); - verifyNoMoreInteractions(client); - }); - }); -} diff --git a/packages/stream_chat/test/src/core/models/converters/v1_json_converters_test.dart b/packages/stream_chat/test/src/core/models/converters/v1_json_converters_test.dart index e8487a3e9a..c8354353f7 100644 --- a/packages/stream_chat/test/src/core/models/converters/v1_json_converters_test.dart +++ b/packages/stream_chat/test/src/core/models/converters/v1_json_converters_test.dart @@ -1,6 +1,9 @@ import 'package:stream_chat/src/core/models/converters/v1_json_converters.dart'; import 'package:stream_chat/src/core/models/device.dart'; +import 'package:stream_chat/src/core/models/message.dart'; import 'package:stream_chat/src/core/models/push_provider.dart'; +import 'package:stream_chat/src/core/models/user_group.dart'; +import 'package:stream_chat/src/core/models/user_group_member.dart'; import 'package:test/test.dart'; void main() { @@ -36,4 +39,77 @@ void main() { expect(device, const Device(id: 'device-id', pushProvider: PushProvider.huawei)); }); + + test('userGroupsFromV1Json reads a group with ISO-8601 dates', () { + final groups = userGroupsFromV1Json([ + { + 'id': 'g1', + 'name': 'Engineering', + 'description': 'Engineering team', + 'team_id': 'team-1', + 'created_by': 'creator-id', + 'created_at': '2024-01-01T00:00:00.000Z', + 'updated_at': '2024-01-02T00:00:00.000Z', + }, + ]); + + expect(groups, [ + UserGroup( + createdAt: DateTime.utc(2024, 1, 1), + createdBy: 'creator-id', + description: 'Engineering team', + id: 'g1', + name: 'Engineering', + teamId: 'team-1', + updatedAt: DateTime.utc(2024, 1, 2), + ), + ]); + }); + + test('Message.fromJson reads mentioned groups whose dates are sent as epoch nanoseconds', () { + final message = Message.fromJson(const { + 'id': 'message-id', + 'mentioned_groups': [ + {'id': 'g1', 'name': 'Engineering', 'created_at': 1704067200123456000, 'updated_at': 1704153600000000000}, + ], + }); + + expect(message.mentionedGroups!.single.createdAt, DateTime.utc(2024, 1, 1, 0, 0, 0, 123, 456)); + expect(message.mentionedGroups!.single.updatedAt, DateTime.utc(2024, 1, 2)); + }); + + test('userGroupsFromV1Json reads members that carry no app_pk', () { + final groups = userGroupsFromV1Json([ + { + 'id': 'g1', + 'name': 'Engineering', + 'created_at': '2024-01-01T00:00:00.000Z', + 'updated_at': '2024-01-02T00:00:00.000Z', + 'members': [ + {'group_id': 'g1', 'user_id': 'user-1', 'is_admin': true, 'created_at': '2024-01-03T00:00:00.000Z'}, + ], + }, + ]); + + expect(groups!.single.members, [ + UserGroupMember(createdAt: DateTime.utc(2024, 1, 3), groupId: 'g1', isAdmin: true, userId: 'user-1'), + ]); + }); + + test('userGroupsFromV1Json leaves members null when the group carries none', () { + final groups = userGroupsFromV1Json([ + { + 'id': 'g1', + 'name': 'Engineering', + 'created_at': '2024-01-01T00:00:00.000Z', + 'updated_at': '2024-01-02T00:00:00.000Z', + }, + ]); + + expect(groups!.single.members, isNull); + }); + + test('userGroupsFromV1Json returns null when the message carries no groups', () { + expect(userGroupsFromV1Json(null), isNull); + }); } diff --git a/packages/stream_chat/test/src/core/models/user_group_member_test.dart b/packages/stream_chat/test/src/core/models/user_group_member_test.dart index 3090c380f3..34b0d4e3e5 100644 --- a/packages/stream_chat/test/src/core/models/user_group_member_test.dart +++ b/packages/stream_chat/test/src/core/models/user_group_member_test.dart @@ -2,19 +2,25 @@ import 'package:stream_chat/src/core/models/user_group_member.dart'; import 'package:test/test.dart'; void main() { - group('src/models/user_group_member', () { - test('should parse json correctly', () { - final member = UserGroupMember.fromJson(const { - 'group_id': 'g1', - 'user_id': 'user-1', - 'is_admin': true, - 'created_at': '2024-01-03T00:00:00Z', - }); + test('UserGroupMember.toData writes snake_case keys and an ISO date', () { + final member = UserGroupMember(createdAt: DateTime.utc(2024, 1, 3), groupId: 'g1', isAdmin: true, userId: 'user-1'); - expect(member.groupId, 'g1'); - expect(member.userId, 'user-1'); - expect(member.isAdmin, isTrue); - expect(member.createdAt, DateTime.parse('2024-01-03T00:00:00Z')); + expect(member.toData(), { + 'created_at': '2024-01-03T00:00:00.000Z', + 'group_id': 'g1', + 'is_admin': true, + 'user_id': 'user-1', }); }); + + test('UserGroupMember.fromData reads back the member written by toData', () { + final member = UserGroupMember( + createdAt: DateTime.utc(2024, 1, 3), + groupId: 'g1', + isAdmin: false, + userId: 'user-1', + ); + + expect(UserGroupMember.fromData(member.toData()), member); + }); } diff --git a/packages/stream_chat/test/src/core/models/user_group_test.dart b/packages/stream_chat/test/src/core/models/user_group_test.dart index 9f052ea0b4..c4c94635e6 100644 --- a/packages/stream_chat/test/src/core/models/user_group_test.dart +++ b/packages/stream_chat/test/src/core/models/user_group_test.dart @@ -3,46 +3,73 @@ import 'package:stream_chat/src/core/models/user_group_member.dart'; import 'package:test/test.dart'; void main() { - group('src/models/user_group', () { - test('should parse json correctly', () { - final group = UserGroup.fromJson(const { - 'id': 'g1', - 'name': 'Group 1', - 'description': 'Engineering team', - 'team_id': 'team-1', - 'created_by': 'creator-id', - 'members': [ - { - 'group_id': 'g1', - 'user_id': 'user-1', - 'is_admin': true, - 'created_at': '2024-01-03T00:00:00Z', - }, - { - 'group_id': 'g1', - 'user_id': 'user-2', - 'is_admin': false, - 'created_at': '2024-01-04T00:00:00Z', - }, - ], - 'created_at': '2024-01-01T00:00:00Z', - 'updated_at': '2024-01-02T00:00:00Z', - }); - - expect(group.id, 'g1'); - expect(group.name, 'Group 1'); - expect(group.description, 'Engineering team'); - expect(group.teamId, 'team-1'); - expect(group.createdBy, 'creator-id'); - expect(group.createdAt, DateTime.parse('2024-01-01T00:00:00Z')); - expect(group.updatedAt, DateTime.parse('2024-01-02T00:00:00Z')); - - expect(group.members, isA>()); - expect(group.members, hasLength(2)); - expect(group.members!.first.userId, 'user-1'); - expect(group.members!.first.isAdmin, isTrue); - expect(group.members!.last.userId, 'user-2'); - expect(group.members!.last.isAdmin, isFalse); + test('UserGroup.toData writes snake_case keys, ISO dates and nested members', () { + final group = UserGroup( + createdAt: DateTime.utc(2024, 1, 1), + createdBy: 'creator-id', + description: 'Engineering team', + id: 'g1', + members: [UserGroupMember(createdAt: DateTime.utc(2024, 1, 3), groupId: 'g1', isAdmin: true, userId: 'user-1')], + name: 'Group 1', + teamId: 'team-1', + updatedAt: DateTime.utc(2024, 1, 2), + ); + + expect(group.toData(), { + 'created_at': '2024-01-01T00:00:00.000Z', + 'created_by': 'creator-id', + 'description': 'Engineering team', + 'id': 'g1', + 'members': [ + {'created_at': '2024-01-03T00:00:00.000Z', 'group_id': 'g1', 'is_admin': true, 'user_id': 'user-1'}, + ], + 'name': 'Group 1', + 'team_id': 'team-1', + 'updated_at': '2024-01-02T00:00:00.000Z', + }); + }); + + test('UserGroup.toData leaves out the fields that are null', () { + final group = UserGroup(createdAt: DateTime.utc(2024), id: 'g1', name: 'Group 1', updatedAt: DateTime.utc(2024)); + + expect(group.toData().keys, unorderedEquals(['created_at', 'id', 'name', 'updated_at'])); + }); + + test('UserGroup.toData keeps an empty member list', () { + final group = UserGroup( + createdAt: DateTime.utc(2024), + id: 'g1', + members: const [], + name: 'Group 1', + updatedAt: DateTime.utc(2024), + ); + + expect(group.toData()['members'], isEmpty); + }); + + test('UserGroup.fromData reads back the group written by toData', () { + final group = UserGroup( + createdAt: DateTime.utc(2024, 1, 1), + createdBy: 'creator-id', + description: 'Engineering team', + id: 'g1', + members: [UserGroupMember(createdAt: DateTime.utc(2024, 1, 3), groupId: 'g1', isAdmin: true, userId: 'user-1')], + name: 'Group 1', + teamId: 'team-1', + updatedAt: DateTime.utc(2024, 1, 2), + ); + + expect(UserGroup.fromData(group.toData()), group); + }); + + test('UserGroup.fromData reads a group stored without members as having no member list', () { + final group = UserGroup.fromData(const { + 'created_at': '2024-01-01T00:00:00.000Z', + 'id': 'g1', + 'name': 'Group 1', + 'updated_at': '2024-01-02T00:00:00.000Z', }); + + expect(group.members, isNull); }); } diff --git a/packages/stream_chat/test/src/fakes.dart b/packages/stream_chat/test/src/fakes.dart index 8974496e6d..5e26a9a09f 100644 --- a/packages/stream_chat/test/src/fakes.dart +++ b/packages/stream_chat/test/src/fakes.dart @@ -9,7 +9,6 @@ import 'package:stream_chat/src/core/api/moderation_api.dart'; import 'package:stream_chat/src/core/api/polls_api.dart'; import 'package:stream_chat/src/core/api/push_preferences_api.dart'; import 'package:stream_chat/src/core/api/user_api.dart'; -import 'package:stream_chat/src/core/api/user_groups_api.dart'; import 'package:stream_chat/stream_chat.dart'; import 'mocks.dart'; @@ -160,11 +159,6 @@ class FakeChatApi extends Fake implements StreamChatApi { @override ModerationApi get moderation => _moderation ??= MockModerationApi(); - UserGroupsApi? _userGroups; - - @override - UserGroupsApi get userGroups => _userGroups ??= MockUserGroupsApi(); - GeneralApi? _general; @override diff --git a/packages/stream_chat/test/src/mocks.dart b/packages/stream_chat/test/src/mocks.dart index e8d27e8ce0..6d442b9eb1 100644 --- a/packages/stream_chat/test/src/mocks.dart +++ b/packages/stream_chat/test/src/mocks.dart @@ -13,7 +13,6 @@ import 'package:stream_chat/src/core/api/moderation_api.dart'; import 'package:stream_chat/src/core/api/polls_api.dart'; import 'package:stream_chat/src/core/api/push_preferences_api.dart'; import 'package:stream_chat/src/core/api/user_api.dart'; -import 'package:stream_chat/src/core/api/user_groups_api.dart'; import 'package:stream_chat/src/core/http/stream_http_client.dart'; import 'package:stream_chat/src/core/models/channel_config.dart'; import 'package:stream_chat/src/core/util/event_controller.dart'; @@ -57,8 +56,6 @@ class MockPushPreferencesApi extends Mock implements PushPreferencesApi {} class MockModerationApi extends Mock implements ModerationApi {} -class MockUserGroupsApi extends Mock implements UserGroupsApi {} - class MockDefaultApi extends Mock implements DefaultApi {} class MockGeneralApi extends Mock implements GeneralApi {} diff --git a/packages/stream_chat/test/src/repository/devices_repository_test.dart b/packages/stream_chat/test/src/repository/devices_repository_test.dart index 9ec5b9b7b2..3ca77e72e4 100644 --- a/packages/stream_chat/test/src/repository/devices_repository_test.dart +++ b/packages/stream_chat/test/src/repository/devices_repository_test.dart @@ -1,8 +1,8 @@ import 'package:mocktail/mocktail.dart'; import 'package:stream_chat/open_api/api.dart' as api; import 'package:stream_chat/src/core/models/device.dart'; -import 'package:stream_chat/src/core/models/list_devices_response.dart'; import 'package:stream_chat/src/core/models/push_provider.dart'; +import 'package:stream_chat/src/core/models/response/list_devices_response.dart'; import 'package:stream_chat/src/repository/devices_repository.dart'; import 'package:stream_core/stream_core.dart'; import 'package:test/test.dart'; diff --git a/packages/stream_chat/test/src/repository/mapper/user_groups_mapper_test.dart b/packages/stream_chat/test/src/repository/mapper/user_groups_mapper_test.dart new file mode 100644 index 0000000000..86b4bed736 --- /dev/null +++ b/packages/stream_chat/test/src/repository/mapper/user_groups_mapper_test.dart @@ -0,0 +1,210 @@ +import 'package:stream_chat/open_api/api.dart' as api; +import 'package:stream_chat/src/core/models/response/add_user_group_members_response.dart'; +import 'package:stream_chat/src/core/models/response/create_user_group_response.dart'; +import 'package:stream_chat/src/core/models/response/get_user_group_response.dart'; +import 'package:stream_chat/src/core/models/response/list_user_groups_response.dart'; +import 'package:stream_chat/src/core/models/response/remove_user_group_members_response.dart'; +import 'package:stream_chat/src/core/models/response/search_user_groups_response.dart'; +import 'package:stream_chat/src/core/models/response/update_user_group_response.dart'; +import 'package:stream_chat/src/core/models/user_group.dart'; +import 'package:stream_chat/src/core/models/user_group_member.dart'; +import 'package:stream_chat/src/repository/mapper/user_groups_mapper.dart'; +import 'package:test/test.dart'; + +void main() { + test('UserGroupResponse.toModel maps every field of a fully populated response', () { + final response = api.UserGroupResponse( + createdAt: DateTime.utc(2024, 1, 2), + createdBy: 'user-id', + description: 'Everyone on call this week', + id: 'group-id', + members: [ + _generatedMember(userId: 'user-1', isAdmin: true), + _generatedMember(userId: 'user-2', isAdmin: false), + ], + name: 'on-call', + teamId: 'team-id', + updatedAt: DateTime.utc(2024, 3, 4), + ); + + expect( + response.toModel(), + UserGroup( + createdAt: DateTime.utc(2024, 1, 2), + createdBy: 'user-id', + description: 'Everyone on call this week', + id: 'group-id', + members: [ + _member(userId: 'user-1', isAdmin: true), + _member(userId: 'user-2', isAdmin: false), + ], + name: 'on-call', + teamId: 'team-id', + updatedAt: DateTime.utc(2024, 3, 4), + ), + ); + }); + + test('UserGroupResponse.toModel keeps members null when the response leaves them out', () { + final response = _generatedGroupWithMembers(null); + + expect(response.toModel().members, isNull); + }); + + test('UserGroupResponse.toModel keeps an empty member list empty', () { + final response = _generatedGroupWithMembers(const []); + + expect(response.toModel().members, isEmpty); + }); + + test('UserGroupMember.toModel maps every field except the app id', () { + final member = api.UserGroupMember( + appPk: 42, + createdAt: DateTime.utc(2024, 5, 6), + groupId: 'group-id', + isAdmin: true, + userId: 'user-id', + ); + + expect( + member.toModel(), + UserGroupMember( + createdAt: DateTime.utc(2024, 5, 6), + groupId: 'group-id', + isAdmin: true, + userId: 'user-id', + ), + ); + }); + + test('ListUserGroupsResponse.toModel maps the duration and every group in order', () { + final response = api.ListUserGroupsResponse( + duration: '0.01ms', + userGroups: [_generatedGroup('group-1'), _generatedGroup('group-2')], + ); + + expect( + response.toModel(), + ListUserGroupsResponse(duration: '0.01ms', userGroups: [_group('group-1'), _group('group-2')]), + ); + }); + + test('SearchUserGroupsResponse.toModel maps the duration and every group in order', () { + final response = api.SearchUserGroupsResponse( + duration: '0.01ms', + userGroups: [_generatedGroup('group-1'), _generatedGroup('group-2')], + ); + + expect( + response.toModel(), + SearchUserGroupsResponse(duration: '0.01ms', userGroups: [_group('group-1'), _group('group-2')]), + ); + }); + + test('GetUserGroupResponse.toModel maps the duration and the group', () { + final response = api.GetUserGroupResponse(duration: '0.01ms', userGroup: _generatedGroup('group-id')); + + expect(response.toModel(), GetUserGroupResponse(duration: '0.01ms', userGroup: _group('group-id'))); + }); + + test('GetUserGroupResponse.toModel keeps a missing group null', () { + const response = api.GetUserGroupResponse(duration: '0.01ms'); + + expect(response.toModel().userGroup, isNull); + }); + + test('CreateUserGroupResponse.toModel maps the duration and the group', () { + final response = api.CreateUserGroupResponse(duration: '0.01ms', userGroup: _generatedGroup('group-id')); + + expect(response.toModel(), CreateUserGroupResponse(duration: '0.01ms', userGroup: _group('group-id'))); + }); + + test('CreateUserGroupResponse.toModel keeps a missing group null', () { + const response = api.CreateUserGroupResponse(duration: '0.01ms'); + + expect(response.toModel().userGroup, isNull); + }); + + test('UpdateUserGroupResponse.toModel maps the duration and the group', () { + final response = api.UpdateUserGroupResponse(duration: '0.01ms', userGroup: _generatedGroup('group-id')); + + expect(response.toModel(), UpdateUserGroupResponse(duration: '0.01ms', userGroup: _group('group-id'))); + }); + + test('UpdateUserGroupResponse.toModel keeps a missing group null', () { + const response = api.UpdateUserGroupResponse(duration: '0.01ms'); + + expect(response.toModel().userGroup, isNull); + }); + + test('AddUserGroupMembersResponse.toModel maps the duration and the group', () { + final response = api.AddUserGroupMembersResponse(duration: '0.01ms', userGroup: _generatedGroup('group-id')); + + expect(response.toModel(), AddUserGroupMembersResponse(duration: '0.01ms', userGroup: _group('group-id'))); + }); + + test('AddUserGroupMembersResponse.toModel keeps a missing group null', () { + const response = api.AddUserGroupMembersResponse(duration: '0.01ms'); + + expect(response.toModel().userGroup, isNull); + }); + + test('RemoveUserGroupMembersResponse.toModel maps the duration and the group', () { + final response = api.RemoveUserGroupMembersResponse(duration: '0.01ms', userGroup: _generatedGroup('group-id')); + + expect(response.toModel(), RemoveUserGroupMembersResponse(duration: '0.01ms', userGroup: _group('group-id'))); + }); + + test('RemoveUserGroupMembersResponse.toModel keeps a missing group null', () { + const response = api.RemoveUserGroupMembersResponse(duration: '0.01ms'); + + expect(response.toModel().userGroup, isNull); + }); +} + +api.UserGroupResponse _generatedGroup(String id) { + return api.UserGroupResponse( + createdAt: DateTime.utc(2024), + id: id, + name: 'name-$id', + updatedAt: DateTime.utc(2024), + ); +} + +UserGroup _group(String id) { + return UserGroup( + createdAt: DateTime.utc(2024), + id: id, + name: 'name-$id', + updatedAt: DateTime.utc(2024), + ); +} + +api.UserGroupResponse _generatedGroupWithMembers(List? members) { + return api.UserGroupResponse( + createdAt: DateTime.utc(2024), + id: 'group-id', + members: members, + name: 'on-call', + updatedAt: DateTime.utc(2024), + ); +} + +api.UserGroupMember _generatedMember({required String userId, required bool isAdmin}) { + return api.UserGroupMember( + appPk: 1, + createdAt: DateTime.utc(2024), + groupId: 'group-id', + isAdmin: isAdmin, + userId: userId, + ); +} + +UserGroupMember _member({required String userId, required bool isAdmin}) { + return UserGroupMember( + createdAt: DateTime.utc(2024), + groupId: 'group-id', + isAdmin: isAdmin, + userId: userId, + ); +} diff --git a/packages/stream_chat/test/src/repository/user_groups_repository_test.dart b/packages/stream_chat/test/src/repository/user_groups_repository_test.dart new file mode 100644 index 0000000000..a648620a27 --- /dev/null +++ b/packages/stream_chat/test/src/repository/user_groups_repository_test.dart @@ -0,0 +1,174 @@ +import 'package:mocktail/mocktail.dart'; +import 'package:stream_chat/open_api/api.dart' as api; +import 'package:stream_chat/src/repository/user_groups_repository.dart'; +import 'package:stream_core/stream_core.dart'; +import 'package:test/test.dart'; + +import '../mocks.dart'; + +const _error = StreamClientException(message: 'boom'); + +void main() { + setUpAll(() { + registerFallbackValue(const api.CreateUserGroupRequest(name: 'name')); + registerFallbackValue(const api.UpdateUserGroupRequest()); + registerFallbackValue(const api.AddUserGroupMembersRequest(memberIds: [])); + registerFallbackValue(const api.RemoveUserGroupMembersRequest(memberIds: [])); + }); + + test('UserGroupsRepository.listUserGroups sends createdAtGt as a UTC timestamp', () async { + final defaultApi = MockDefaultApi(); + _stubListUserGroups(defaultApi, const Result.success(api.ListUserGroupsResponse(duration: '0ms', userGroups: []))); + final createdAtGt = DateTime.utc(2024, 6, 15, 12).toLocal(); + + await UserGroupsRepository(defaultApi).listUserGroups(createdAtGt: createdAtGt); + + verify(() => defaultApi.listUserGroups(createdAtGt: '2024-06-15T12:00:00.000Z')).called(1); + }); + + test('UserGroupsRepository.listUserGroups returns the failure without throwing', () async { + final defaultApi = MockDefaultApi(); + _stubListUserGroups(defaultApi, const Result.failure(_error)); + + final res = await UserGroupsRepository(defaultApi).listUserGroups(); + + expect(res.exceptionOrNull(), _error); + }); + + test('UserGroupsRepository.searchUserGroups returns the failure without throwing', () async { + final defaultApi = MockDefaultApi(); + _stubSearchUserGroups(defaultApi, const Result.failure(_error)); + + final res = await UserGroupsRepository(defaultApi).searchUserGroups('eng'); + + expect(res.exceptionOrNull(), _error); + }); + + test('UserGroupsRepository.getUserGroup returns the failure without throwing', () async { + final defaultApi = MockDefaultApi(); + _stubGetUserGroup(defaultApi, const Result.failure(_error)); + + final res = await UserGroupsRepository(defaultApi).getUserGroup('group-id'); + + expect(res.exceptionOrNull(), _error); + }); + + test('UserGroupsRepository.createUserGroup returns the failure without throwing', () async { + final defaultApi = MockDefaultApi(); + _stubCreateUserGroup(defaultApi, const Result.failure(_error)); + + final res = await UserGroupsRepository(defaultApi).createUserGroup('Engineering'); + + expect(res.exceptionOrNull(), _error); + }); + + test('UserGroupsRepository.updateUserGroup returns the failure without throwing', () async { + final defaultApi = MockDefaultApi(); + _stubUpdateUserGroup(defaultApi, const Result.failure(_error)); + + final res = await UserGroupsRepository(defaultApi).updateUserGroup('group-id', name: 'Engineering'); + + expect(res.exceptionOrNull(), _error); + }); + + test('UserGroupsRepository.deleteUserGroup returns the failure without throwing', () async { + final defaultApi = MockDefaultApi(); + _stubDeleteUserGroup(defaultApi, const Result.failure(_error)); + + final res = await UserGroupsRepository(defaultApi).deleteUserGroup('group-id'); + + expect(res.exceptionOrNull(), _error); + }); + + test('UserGroupsRepository.addUserGroupMembers returns the failure without throwing', () async { + final defaultApi = MockDefaultApi(); + _stubAddUserGroupMembers(defaultApi, const Result.failure(_error)); + + final res = await UserGroupsRepository(defaultApi).addUserGroupMembers('group-id', ['user-id']); + + expect(res.exceptionOrNull(), _error); + }); + + test('UserGroupsRepository.removeUserGroupMembers returns the failure without throwing', () async { + final defaultApi = MockDefaultApi(); + _stubRemoveUserGroupMembers(defaultApi, const Result.failure(_error)); + + final res = await UserGroupsRepository(defaultApi).removeUserGroupMembers('group-id', ['user-id']); + + expect(res.exceptionOrNull(), _error); + }); +} + +void _stubListUserGroups(MockDefaultApi defaultApi, Result result) { + when( + () => defaultApi.listUserGroups( + limit: any(named: 'limit'), + idGt: any(named: 'idGt'), + createdAtGt: any(named: 'createdAtGt'), + teamId: any(named: 'teamId'), + ), + ).thenAnswer((_) async => result); +} + +void _stubSearchUserGroups(MockDefaultApi defaultApi, Result result) { + when( + () => defaultApi.searchUserGroups( + query: any(named: 'query'), + limit: any(named: 'limit'), + nameGt: any(named: 'nameGt'), + idGt: any(named: 'idGt'), + teamId: any(named: 'teamId'), + ), + ).thenAnswer((_) async => result); +} + +void _stubGetUserGroup(MockDefaultApi defaultApi, Result result) { + when( + () => defaultApi.getUserGroup( + id: any(named: 'id'), + teamId: any(named: 'teamId'), + ), + ).thenAnswer((_) async => result); +} + +void _stubCreateUserGroup(MockDefaultApi defaultApi, Result result) { + when( + () => defaultApi.createUserGroup(createUserGroupRequest: any(named: 'createUserGroupRequest')), + ).thenAnswer((_) async => result); +} + +void _stubUpdateUserGroup(MockDefaultApi defaultApi, Result result) { + when( + () => defaultApi.updateUserGroup( + id: any(named: 'id'), + updateUserGroupRequest: any(named: 'updateUserGroupRequest'), + ), + ).thenAnswer((_) async => result); +} + +void _stubDeleteUserGroup(MockDefaultApi defaultApi, Result result) { + when( + () => defaultApi.deleteUserGroup( + id: any(named: 'id'), + teamId: any(named: 'teamId'), + ), + ).thenAnswer((_) async => result); +} + +void _stubAddUserGroupMembers(MockDefaultApi defaultApi, Result result) { + when( + () => defaultApi.addUserGroupMembers( + id: any(named: 'id'), + addUserGroupMembersRequest: any(named: 'addUserGroupMembersRequest'), + ), + ).thenAnswer((_) async => result); +} + +void _stubRemoveUserGroupMembers(MockDefaultApi defaultApi, Result result) { + when( + () => defaultApi.removeUserGroupMembers( + id: any(named: 'id'), + removeUserGroupMembersRequest: any(named: 'removeUserGroupMembersRequest'), + ), + ).thenAnswer((_) async => result); +} diff --git a/packages/stream_chat_flutter/lib/src/autocomplete/stream_mention_autocomplete_options.dart b/packages/stream_chat_flutter/lib/src/autocomplete/stream_mention_autocomplete_options.dart index 2cf4ba22dd..9e65db434d 100644 --- a/packages/stream_chat_flutter/lib/src/autocomplete/stream_mention_autocomplete_options.dart +++ b/packages/stream_chat_flutter/lib/src/autocomplete/stream_mention_autocomplete_options.dart @@ -227,15 +227,8 @@ class _StreamMentionAutocompleteOptionsState extends State> _fetchUserGroups(String query) async { if (query.isEmpty || !widget.channel.canNotifyGroup) return const []; - try { - final response = await widget.channel.client.searchUserGroups( - query, - teamId: widget.channel.team, - ); - return response.userGroups; - } catch (_) { - return const []; - } + final result = await widget.channel.client.searchUserGroups(query, teamId: widget.channel.team); + return result.map((it) => it.userGroups).getOrDefault(const []); } Future> _fetchUsers(String query) async { diff --git a/packages/stream_chat_flutter/test/src/autocomplete/stream_mention_autocomplete_options_test.dart b/packages/stream_chat_flutter/test/src/autocomplete/stream_mention_autocomplete_options_test.dart index fafb662ba3..74a37f8335 100644 --- a/packages/stream_chat_flutter/test/src/autocomplete/stream_mention_autocomplete_options_test.dart +++ b/packages/stream_chat_flutter/test/src/autocomplete/stream_mention_autocomplete_options_test.dart @@ -391,7 +391,7 @@ void main() { ); when( () => mocks.client.searchUserGroups(any(), teamId: any(named: 'teamId')), - ).thenAnswer((_) async => SearchUserGroupsResponse()..userGroups = []); + ).thenAnswer((_) async => const Result.success(SearchUserGroupsResponse(duration: '0ms'))); await _pumpMentionOptions( tester, @@ -412,7 +412,7 @@ void main() { final mocks = _setupMocks(ownCapabilities: const []); when( () => mocks.client.searchUserGroups(any(), teamId: any(named: 'teamId')), - ).thenAnswer((_) async => SearchUserGroupsResponse()..userGroups = []); + ).thenAnswer((_) async => const Result.success(SearchUserGroupsResponse(duration: '0ms'))); await _pumpMentionOptions( tester, @@ -436,7 +436,8 @@ void main() { when( () => mocks.client.searchUserGroups('eng', teamId: any(named: 'teamId')), ).thenAnswer( - (_) async => SearchUserGroupsResponse()..userGroups = [buildUserGroup('engineering')], + (_) async => + Result.success(SearchUserGroupsResponse(duration: '0ms', userGroups: [buildUserGroup('engineering')])), ); await _pumpMentionOptions( @@ -463,7 +464,8 @@ void main() { when( () => mocks.client.searchUserGroups('eng', teamId: any(named: 'teamId')), ).thenAnswer( - (_) async => SearchUserGroupsResponse()..userGroups = [buildUserGroup('engineering')], + (_) async => + Result.success(SearchUserGroupsResponse(duration: '0ms', userGroups: [buildUserGroup('engineering')])), ); await _pumpMentionOptions( @@ -480,7 +482,7 @@ void main() { ); testWidgets( - 'searchUserGroups error is swallowed and does not blank the list', + 'searchUserGroups failure is swallowed and does not blank the list', (tester) async { final mocks = _setupMocks( ownCapabilities: const [ @@ -490,7 +492,7 @@ void main() { ); when( () => mocks.client.searchUserGroups(any(), teamId: any(named: 'teamId')), - ).thenThrow(StateError('test error')); + ).thenAnswer((_) async => const Result.failure(StreamClientException(message: 'test error'))); await _pumpMentionOptions( tester, @@ -802,15 +804,19 @@ void main() { when( () => mocks.client.searchUserGroups('h', teamId: any(named: 'teamId')), ).thenAnswer( - (_) async => SearchUserGroupsResponse() - ..userGroups = [ - UserGroup( - id: 'hr-id', - name: 'hr', - createdAt: DateTime.utc(2024), - updatedAt: DateTime.utc(2024), - ), - ], + (_) async => Result.success( + SearchUserGroupsResponse( + duration: '0ms', + userGroups: [ + UserGroup( + id: 'hr-id', + name: 'hr', + createdAt: DateTime.utc(2024), + updatedAt: DateTime.utc(2024), + ), + ], + ), + ), ); await _pumpMentionOptions( @@ -889,15 +895,19 @@ void main() { when( () => mocks.client.searchUserGroups('h', teamId: any(named: 'teamId')), ).thenAnswer( - (_) async => SearchUserGroupsResponse() - ..userGroups = [ - UserGroup( - id: 'hr-id', - name: 'hr', - createdAt: DateTime.utc(2024), - updatedAt: DateTime.utc(2024), - ), - ], + (_) async => Result.success( + SearchUserGroupsResponse( + duration: '0ms', + userGroups: [ + UserGroup( + id: 'hr-id', + name: 'hr', + createdAt: DateTime.utc(2024), + updatedAt: DateTime.utc(2024), + ), + ], + ), + ), ); return MaterialAppWrapper( home: _buildMentionOptionsBody( diff --git a/packages/stream_chat_persistence/lib/src/mapper/message_mapper.dart b/packages/stream_chat_persistence/lib/src/mapper/message_mapper.dart index 2ea3ba0749..5670d6f7c7 100644 --- a/packages/stream_chat_persistence/lib/src/mapper/message_mapper.dart +++ b/packages/stream_chat_persistence/lib/src/mapper/message_mapper.dart @@ -53,7 +53,7 @@ extension MessageEntityX on MessageEntity { pinnedBy: pinnedBy, mentionedChannel: mentionedChannel, mentionedGroupIds: mentionedGroupIds, - mentionedGroups: mentionedGroups?.map((e) => UserGroup.fromJson(jsonDecode(e))).toList(), + mentionedGroups: mentionedGroups?.map((e) => UserGroup.fromData(jsonDecode(e))).toList(), mentionedHere: mentionedHere, mentionedRoles: mentionedRoles, mentionedUsers: mentionedUsers.map((e) => User.fromJson(jsonDecode(e))).toList(), @@ -84,7 +84,7 @@ extension MessageX on Message { reactionGroups: reactionGroups, mentionedChannel: mentionedChannel, mentionedGroupIds: mentionedGroupIds, - mentionedGroups: mentionedGroups?.map(jsonEncode).toList(), + mentionedGroups: mentionedGroups?.map((e) => jsonEncode(e.toData())).toList(), mentionedHere: mentionedHere, mentionedRoles: mentionedRoles, mentionedUsers: mentionedUsers.map(jsonEncode).toList(), diff --git a/packages/stream_chat_persistence/test/src/dao/message_dao_test.dart b/packages/stream_chat_persistence/test/src/dao/message_dao_test.dart index 8dbe40e6e2..daf6c4d32f 100644 --- a/packages/stream_chat_persistence/test/src/dao/message_dao_test.dart +++ b/packages/stream_chat_persistence/test/src/dao/message_dao_test.dart @@ -53,6 +53,29 @@ void main() { 'testType': ReactionGroup(count: 3, sumScores: 10), 'testType2': ReactionGroup(count: 5, sumScores: 20), }, + mentionedGroupIds: const ['testGroupId1', 'testGroupId2'], + mentionedGroups: [ + UserGroup( + createdAt: DateTime.utc(2024, 1, 1), + id: 'testGroupId1', + members: [ + UserGroupMember( + createdAt: DateTime.utc(2024, 1, 3), + groupId: 'testGroupId1', + isAdmin: true, + userId: 'u1', + ), + ], + name: 'Engineering', + updatedAt: DateTime.utc(2024, 1, 2), + ), + UserGroup( + createdAt: DateTime.utc(2024, 1, 1), + id: 'testGroupId2', + name: 'Design', + updatedAt: DateTime.utc(2024, 1, 2), + ), + ], i18n: { 'en_text': 'Hello #$index', 'hi_text': 'नमस्ते #$index', @@ -256,6 +279,7 @@ void main() { final fetchedMessage = await messageDao.getMessageById(id); expect(fetchedMessage, isNotNull); expect(fetchedMessage!.id, insertedMessages.first.id); + expect(fetchedMessage.mentionedGroups, insertedMessages.first.mentionedGroups); }); test('getThreadMessages', () async { diff --git a/packages/stream_chat_persistence/test/src/mapper/message_mapper_test.dart b/packages/stream_chat_persistence/test/src/mapper/message_mapper_test.dart index 52ea5a888e..94f5e8a994 100644 --- a/packages/stream_chat_persistence/test/src/mapper/message_mapper_test.dart +++ b/packages/stream_chat_persistence/test/src/mapper/message_mapper_test.dart @@ -72,14 +72,16 @@ void main() { mentionedChannel: true, mentionedGroupIds: const ['testGroupId1', 'testGroupId2'], mentionedGroups: [ - jsonEncode( - UserGroup( - id: 'testGroupId1', - name: 'Engineering', - createdAt: DateTime.now(), - updatedAt: DateTime.now(), - ), - ), + jsonEncode({ + 'created_at': '2024-01-02T00:00:00.000Z', + 'description': 'The engineers', + 'id': 'testGroupId1', + 'members': [ + {'created_at': '2024-01-03T00:00:00.000Z', 'group_id': 'testGroupId1', 'is_admin': true, 'user_id': 'u1'}, + ], + 'name': 'Engineering', + 'updated_at': '2024-01-04T00:00:00.000Z', + }), ], mentionedHere: false, mentionedRoles: const ['admin', 'moderator'], @@ -130,11 +132,18 @@ void main() { expect(message.showInChannel, entity.showInChannel); expect(message.mentionedChannel, entity.mentionedChannel); expect(message.mentionedGroupIds, entity.mentionedGroupIds); - for (var i = 0; i < (message.mentionedGroups?.length ?? 0); i++) { - final entityMentionedGroup = UserGroup.fromJson(jsonDecode(entity.mentionedGroups![i])); - expect(message.mentionedGroups![i].id, entityMentionedGroup.id); - expect(message.mentionedGroups![i].name, entityMentionedGroup.name); - } + expect(message.mentionedGroups, [ + UserGroup( + createdAt: DateTime.utc(2024, 1, 2), + description: 'The engineers', + id: 'testGroupId1', + members: [ + UserGroupMember(createdAt: DateTime.utc(2024, 1, 3), groupId: 'testGroupId1', isAdmin: true, userId: 'u1'), + ], + name: 'Engineering', + updatedAt: DateTime.utc(2024, 1, 4), + ), + ]); expect(message.mentionedHere, entity.mentionedHere); expect(message.mentionedRoles, entity.mentionedRoles); for (var i = 0; i < message.mentionedUsers.length; i++) { @@ -223,10 +232,14 @@ void main() { mentionedGroupIds: const ['testGroupId1', 'testGroupId2'], mentionedGroups: [ UserGroup( + createdAt: DateTime.utc(2024, 1, 2), + description: 'The engineers', id: 'testGroupId1', + members: [ + UserGroupMember(createdAt: DateTime.utc(2024, 1, 3), groupId: 'testGroupId1', isAdmin: true, userId: 'u1'), + ], name: 'Engineering', - createdAt: DateTime.now(), - updatedAt: DateTime.now(), + updatedAt: DateTime.utc(2024, 1, 4), ), ], mentionedHere: false, @@ -285,7 +298,18 @@ void main() { expect(entity.replyCount, message.replyCount); expect(entity.mentionedChannel, message.mentionedChannel); expect(entity.mentionedGroupIds, message.mentionedGroupIds); - expect(entity.mentionedGroups, message.mentionedGroups?.map(jsonEncode).toList()); + expect(entity.mentionedGroups?.map(jsonDecode), [ + { + 'created_at': '2024-01-02T00:00:00.000Z', + 'description': 'The engineers', + 'id': 'testGroupId1', + 'members': [ + {'created_at': '2024-01-03T00:00:00.000Z', 'group_id': 'testGroupId1', 'is_admin': true, 'user_id': 'u1'}, + ], + 'name': 'Engineering', + 'updated_at': '2024-01-04T00:00:00.000Z', + }, + ]); expect(entity.mentionedHere, message.mentionedHere); expect(entity.mentionedRoles, message.mentionedRoles); expect(entity.mentionedUsers, message.mentionedUsers.map(jsonEncode).toList()); From 7e6959ec63888fd5ee04e69a318fe40c9cf0325f Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Tue, 29 Sep 2026 13:04:27 +0200 Subject: [PATCH 26/36] refactor(llc, core)!: route moderation through the generated API client (#2992) Co-authored-by: Claude Opus 5 (1M context) Co-authored-by: Claude Opus 5 --- .claude/skills/openapi-migration/SKILL.md | 102 +++- CLAUDE.md | 42 +- STYLE_GUIDE.md | 108 ++++ migrations/v11-migration.md | 97 ++++ openapi-migration/02-devices.md | 3 +- openapi-migration/03-user-groups.md | 3 +- openapi-migration/04-roles-guest-and-app.md | 3 +- openapi-migration/05-polls.md | 3 +- openapi-migration/06-reminders.md | 3 +- openapi-migration/07-threads-and-drafts.md | 3 +- .../08-moderation-and-blocklists.md | 160 +++++- openapi-migration/09-users.md | 4 +- openapi-migration/10-messages.md | 4 +- openapi-migration/11-channels-and-members.md | 4 +- openapi-migration/12-uploads-cdn.md | 3 +- openapi-migration/13-push-preferences.md | 3 +- openapi-migration/14-banned-users.md | 57 ++ openapi-migration/README.md | 17 +- openapi-migration/tool/generate_plan.py | 179 ++++++- packages/stream_chat/CHANGELOG.md | 12 + .../lib/src/client/channel/channel.dart | 108 ++-- .../stream_chat/lib/src/client/client.dart | 94 +--- .../lib/src/client/moderation_client.dart | 173 ++++++ .../lib/src/core/api/moderation_api.dart | 118 ----- .../lib/src/core/models/delete_type.dart | 14 + .../core/models/response/flag_response.dart | 24 + .../response/flag_response.freezed.dart | 81 +++ .../models/response/mute_users_response.dart | 23 + .../response/mute_users_response.freezed.dart | 88 ++++ .../response/unmute_users_response.dart | 23 + .../unmute_users_response.freezed.dart | 88 ++++ .../repository/mapper/moderation_mapper.dart | 38 ++ .../src/repository/moderation_repository.dart | 193 +++++++ packages/stream_chat/lib/stream_chat.dart | 5 + .../test/src/client/channel/channel_test.dart | 131 +++-- .../test/src/client/client_test.dart | 176 ------- .../src/client/moderation_client_test.dart | 493 ++++++++++++++++++ .../src/core/api/moderation_api_test.dart | 246 --------- packages/stream_chat/test/src/mocks.dart | 3 + .../example/lib/debug/actions/ban_user.dart | 5 +- .../example/lib/debug/actions/mute_user.dart | 5 +- .../lib/debug/actions/remove_shadow_ban.dart | 41 -- .../example/lib/debug/actions/shadow_ban.dart | 5 +- .../example/lib/debug/actions/unban_user.dart | 5 +- .../lib/debug/actions/unmute_user.dart | 5 +- .../example/lib/debug/channel_page.dart | 3 - .../message_widget/stream_message_item.dart | 8 +- .../stream_chat_flutter_core/CHANGELOG.md | 1 + .../src/stream_channel_list_controller.dart | 14 +- .../stream_channel_list_controller_test.dart | 24 + sample_app/lib/widgets/all_members_sheet.dart | 4 +- sample_app/lib/widgets/channel_list.dart | 4 +- 52 files changed, 2214 insertions(+), 839 deletions(-) create mode 100644 openapi-migration/14-banned-users.md create mode 100644 packages/stream_chat/lib/src/client/moderation_client.dart create mode 100644 packages/stream_chat/lib/src/core/models/delete_type.dart create mode 100644 packages/stream_chat/lib/src/core/models/response/flag_response.dart create mode 100644 packages/stream_chat/lib/src/core/models/response/flag_response.freezed.dart create mode 100644 packages/stream_chat/lib/src/core/models/response/mute_users_response.dart create mode 100644 packages/stream_chat/lib/src/core/models/response/mute_users_response.freezed.dart create mode 100644 packages/stream_chat/lib/src/core/models/response/unmute_users_response.dart create mode 100644 packages/stream_chat/lib/src/core/models/response/unmute_users_response.freezed.dart create mode 100644 packages/stream_chat/lib/src/repository/mapper/moderation_mapper.dart create mode 100644 packages/stream_chat/lib/src/repository/moderation_repository.dart create mode 100644 packages/stream_chat/test/src/client/moderation_client_test.dart delete mode 100644 packages/stream_chat/test/src/core/api/moderation_api_test.dart delete mode 100644 packages/stream_chat_flutter/example/lib/debug/actions/remove_shadow_ban.dart diff --git a/.claude/skills/openapi-migration/SKILL.md b/.claude/skills/openapi-migration/SKILL.md index 5dd915ab4e..1fb151e7d1 100644 --- a/.claude/skills/openapi-migration/SKILL.md +++ b/.claude/skills/openapi-migration/SKILL.md @@ -79,8 +79,41 @@ The inventory needs five lists: 5. **Tests** — `test/src/core/api/_api_test.dart`, the feature's cases in `test/src/client/client_test.dart`, and its round-trips in `test/src/core/api/responses_test.dart`. -Close the phase by checking for a **blocking mismatch**: if the generated payload omits a field our current request -sends, that endpoint stays hand-written and the inventory says why. Migrating it would silently drop behaviour. +Close the phase with three checks. Any of them can take an endpoint off the table. + +**1. Blocking mismatch.** If the generated payload omits a field our current request sends, that endpoint stays +hand-written and the inventory says why. Migrating it would silently drop behaviour — but check the newest spec +before concluding it is permanent; see the ladder below. + +**2. Is the generated operation even the same endpoint?** A matching name is not proof. Our hand-written client +calls `baseUrl` + a bare path, which is the **chat v1** surface; a generated operation under `/api/v2//` +may belong to a *different product* with its own handler. Moderation is the live example: `muteUser` called the +chat v1 route that `lib/chat/routes.go` mounts at the root and comments as deprecated, while the generated `mute` +is `/api/v2/moderation/mute` in `lib/moderation/routes.go`. The paths look like a rename; the services are not. + +Compare the two handlers in the backend checkout and answer one question — does the generated one write the same +state and emit the same WS events the SDK already depends on? + +```bash +# the route tables, to see which product owns each path +grep -n '/mute' "$CHAT_BACKEND_DIR"/lib/chat/routes.go "$CHAT_BACKEND_DIR"/lib//routes.go +# then read both controllers side by side +``` + +Equivalent handlers make the switch safe. Divergent ones mean the endpoint stays hand-written, with the reason +recorded. + +**3. Is it gated or in beta?** A generated operation can be fully present and still refused at runtime. Check the +controller for `FeatureFlagEnabled` and `Beta: true`: + +```bash +grep -n "FeatureFlagEnabled\|Beta:" "$CHAT_BACKEND_DIR"/lib//controller/.go +``` + +`monolith/server/base.go` rejects a gated endpoint with `NotAllowedError("this endpoint needs a feature flag…")`, +so migrating onto one changes who can call it. Read the flag's default before judging — moderation v2's +`ModerationV2Enabled()` returns true when unset, so only apps that explicitly opted out are affected. Either way it +is a behavioural break for the CHANGELOG and the migration guide, not a silent detail. ### When the type or operation isn't in the generated client @@ -100,6 +133,21 @@ Work the ladder in order — the answer changes depending on *where* it's missin contort the call site around a broken signature. 3. **In a newer spec than the one our tree was generated from.** Regenerate — its own PR, never folded into a feature slice. Also `openapi-codegen`. + + **Check this before declaring anything blocked**, including a phase-1 blocking mismatch. The committed tree can + be many spec versions behind, and both kinds of gap close the same way. Compare against the newest released + spec, not against another SDK's generated output — a sibling's tree is just as likely to be stale: + + ```bash + python3 -c "import json,sys; s=json.load(open(sys.argv[1])); print(s['info']['version']); \ + print('\n'.join(p for p in s['paths'] if 'unban' in p))" \ + "$PROTOCOL_DIR"/openapi/v2/chat-clientside-api.json + head -5 packages/stream_chat/lib/open_api/api.dart # what our tree was generated from + ``` + + Group 08 hit both at once: `unban` was absent, and `QueryBannedUsersPayload` dropped four `created_at_*` cursors + the server reads off an embedded pager. Both looked permanent against the committed tree; regenerating from + `v237.2.0` to `v239.10.0` fixed both, and turned a two-method-blocked group into one. 4. **Absent from the clientside spec entirely.** It is server-side only, deprecated (spec generation skips deprecated operations), or not yet exposed on v2. Confirm against the spec before concluding: @@ -152,6 +200,20 @@ a public signature. Anything else a migration would change about what the caller holds needs its own reason. A server field our v10 model lacks is exposed later, as an additive change, not by swapping in the generated type. +**Establish a claim before you rely on it, and know which source answers which question.** + +- **What the API actually does** — the backend is the authority, and the only external source this skill reaches + for. Route tables, request payload structs and controller code answer units, validation, deprecation and + gating. Verify there rather than inferring from a field name or from the spec's prose. +- **What our public API should look like** — the backend cannot answer this, and neither can this skill. When the + shape is a genuine judgement call — whether a convenience method earns its place, whether to expose a generated + type, whether a break is worth it — **put the options to the user with the trade-offs and let them decide**. + Do not settle it by copying another Stream SDK: their constraints differ, their trees go stale, and a claim + about one is not verifiable from this repo. + +Whatever is decided goes in the PR body, never in a doc comment — see `STYLE_GUIDE.md` +§ *No server or transport details in docs or comments*. + When you do break, four things ship in the same PR: a `refactor(scope)!:` commit/PR title, a `🛑️ Breaking` CHANGELOG entry naming the old and new symbol, a Symbol Map row plus feature section in `migrations/v11-migration.md` (that guide is written as we go, not reconstructed at release), and the decision @@ -246,11 +308,17 @@ conversion lives in `StreamHttpClient._parseError`, which only its own `get`/`po `DefaultApi` goes straight to `_dio.fetch` and bypasses it. Hand the `Result` to the caller instead; `getOrThrow()` is a tool for *consumers* migrating incrementally, not for us. -Two data-shape traps while mapping: +Three data-shape traps while mapping: - **`custom` vs `extraData`** (channel / message / user features). The wire puts extra fields in `custom`; hand-written models flatten them into `extraData`. Write that promotion explicitly, including which keys are excluded. +- **Units on anything that takes a `Duration`.** The wire carries a bare integer and the field name rarely says + in what. Read the Go payload type: `commonpayloads.DurationInMinutes` and `DurationMilliseconds` sit on sibling + endpoints in the same feature — `ban.timeout` and `mute.timeout` are minutes, `muteChannel.expiration` is + milliseconds. Getting it wrong is silent, and `Duration.inMinutes` truncates, so a sub-minute value arrives as + `0` — which `DurationInMinutes.ToTime()` reads as *no expiry*, turning a short ban permanent. Test that edge, + not just the round number. - **`DateTime` on anything that also arrives over the WebSocket.** Generated models decode through `StreamDateTimeConverter` (epoch nanoseconds *or* RFC3339); hand-written models use `DateTime.parse`. A model fed by both REST v2 and WS events must tolerate both. @@ -405,6 +473,34 @@ The PR body carries the group's scope, the phase 2 decisions with their reasons, hand-written and why. Then close the loop in the plan: tick the definition-of-done boxes in the group's file and its status box in `openapi-migration/README.md`, so the next person sees where the migration actually stands. +**Write the group's record into `openapi-migration/tool/generate_plan.py`, not into the `0N-*.md` file.** Those +files are generated in full — goal, decisions, risks and definition of done all come from the `GROUPS` list in the +generator. Editing the markdown works until the next regeneration silently reverts it. Add a `taken=textwrap.dedent(...)` +block and a `done=DONE.replace('- [ ]', '- [x]')` to the group's entry, then re-run the script. + +**When a method cannot move, split it into its own group rather than leaving one partly done.** Phase 1's three +checks exist to find those, and the first definition-of-done box allows an endpoint to be "deliberately left +hand-written, with the reason" — but a group sitting at nine-of-ten is a status nobody can act on, and the reason +decays into a footnote. Give the remainder a group of its own, with its own blocker, decisions and definition of +done: + +- add it to `GROUPS` in `generate_plan.py` claiming the method explicitly (`'moderation_api.dart::queryBannedUsers'`) + and owning its generated path; the parent group's file-level claim covers the remainder automatically; +- number it at the end and say in `README.md` what it was split from and what it waits on — plan order is + dependency order, not file order; +- say in `migrations/v11-migration.md` that it still throws. Two groups where one returns `Result` and the other + does not is a mixed error contract, and consumers must not discover it by catching; +- leave its `*_api.dart` in place with only that method, and its `StreamChatApi` getter. Reviewers look for the + deleted file — the new group's file is what explains why it survived. + +Both groups then read as true: one done, one not started. Group 08 (moderation) and 14 (banned users) are the +worked example. + +What is *not* acceptable is splitting a **pair**. `banUser` migrating while `unbanUser` stays hand-written leaves +consumers writing one call each way, which the plan's README rightly calls worse than not migrating. If half a +pair is blocked, either unblock it (usually a regeneration) or hold both. Split on what the *caller* thinks of +separately — a read versus a set of writes — never on what happens to be easy. + Landing a break means four artifacts in the same PR: the `refactor(scope)!:` title, the `🛑️ Breaking` CHANGELOG entry, the `migrations/v11-migration.md` Symbol Map row plus feature section (template lives at the bottom of that guide), and the reason in the PR body. A break with no guide entry is unfinished — the guide is what consumers diff --git a/CLAUDE.md b/CLAUDE.md index ef46b85cb7..89a1d5d91f 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -123,12 +123,52 @@ Optional local persistence using Drift (SQLite). Implements `ChatPersistenceClie - Line length: **120 characters** (configured in `analysis_options.yaml`) - Imports: inside a package's own `lib/`, use relative imports (`prefer_relative_imports`); use `package:` imports for anything from another package -- All public APIs **must** have doc comments (`public_member_api_docs`) +- All public APIs **must** have doc comments (`public_member_api_docs`) — see + [Writing dartdoc](#writing-dartdoc) below, because that lint only checks one exists - Sort constructors first, unnamed constructors before named - Prefer `const` constructors, `final` locals, single quotes - Trailing commas: `preserve` (formatter setting) - Generated files (`.g.dart`, `.freezed.dart`) are excluded from analysis +### Writing dartdoc + +`public_member_api_docs` only checks a doc **exists** — a placeholder passes +`melos run analyze`. Nothing in CI reads what a doc says, so read +[`STYLE_GUIDE.md` § Documentation](STYLE_GUIDE.md#documentation) and +[`EFFECTIVE_DART_DOC.md`](EFFECTIVE_DART_DOC.md) before writing any. Two rules break +most often: + +**Never restate the signature, and describe behaviour rather than listing parameters.** +A paragraph per parameter, each starting with that parameter's name, is `@param` with +the tag deleted — it reads like Java. Weave them into sentences about what happens, the +way `dart:core` does (*"Creates a new string with the first occurrence of [from] +replaced by [to]"*), using "If [x] …" for conditions and "The [x] …" for constraints: + +```dart +// BAD: +/// Mutes the user with the given [userId] for the current user. +/// +/// [timeout] expires the mute, applied in whole minutes. Omitted, it lasts until +/// removed. + +// GOOD: +/// Mutes [userId] for the current user. +/// +/// The mute lasts until it is removed. A [timeout] expires it after that long, +/// applied in whole minutes and never less than one. +``` + +One paragraph per distinct concern — avoiding the roll call is not a reason to merge +unrelated behaviours into one block. + +**No server or transport details**, in dartdoc or in `//` comments: no endpoints or +paths, no wire field names, no claims about what "the server" does or whether +something is deprecated, beta or feature-flagged. An integrator cannot verify any of +it and it goes stale the moment the API changes — describe what the caller observes +instead. That information belongs in `CHANGELOG.md`, `migrations/*.md` and the PR +body, which are read once next to a version. See +[`STYLE_GUIDE.md`](STYLE_GUIDE.md#no-server-or-transport-details-in-docs-or-comments). + ## Breaking Changes This is a published SDK: every symbol exported from a package's barrel diff --git a/STYLE_GUIDE.md b/STYLE_GUIDE.md index 3d940327be..b9dbb8b8bf 100644 --- a/STYLE_GUIDE.md +++ b/STYLE_GUIDE.md @@ -456,6 +456,93 @@ Stream> get membersStream; Stream> get membersStream; ``` +### Document parameters in prose, not a roll call + +Effective Dart says to explain parameters in prose rather than `@param` tags. Writing +one paragraph per parameter, each starting with the parameter's own name, is still +`@param` — just with the tag deleted. It reads like Java and it buries the behaviour, +because the reader gets a list of pieces instead of a description of what the call does. + +Weave parameters into sentences about what happens, the way `dart:core` does — +*"Creates a new string with the first occurrence of [from] replaced by [to]"* — and use +"If [x] …" for conditions, "The [x] …" for constraints. + +```dart +// BAD — one paragraph per parameter, subject first: + +/// Bans [userID] from this channel. +/// +/// [timeout] expires the ban, applied in whole minutes. +/// +/// [shadow] hides their messages without telling them, [ipBan] also bans their +/// address, and [deleteMessages] handles the messages they sent. + +// GOOD — parameters inside sentences about the behaviour, one concern per paragraph: + +/// Bans [userID] from this channel. +/// +/// The ban lasts until it is removed. A [timeout] expires it after that long, +/// applied in whole minutes and never less than one. +/// +/// If [shadow] is true, their messages stop reaching anyone else and they are +/// not told. +/// +/// If [ipBan] is true, the address they connected from is banned as well. +/// +/// [deleteMessages] decides what happens to the messages they already sent, +/// and [reason] is recorded with the ban. +``` + +**One paragraph per distinct concern.** Avoiding the roll call does not mean merging +unrelated behaviours into one block — a reader looking for what `ipBan` does should not +have to read four sentences to find it. `dart:io`'s `Process.start` gives each `mode` +value its own paragraph for the same reason. + +Group by behaviour, not by signature order: parameters that describe *one* thing share a +paragraph (`deleteMessages` and `reason` above), and a parameter needing only a clause +gets a clause rather than a paragraph of its own. + +### No server or transport details in docs or comments + +The same rule applies to everything on the far side of the network. An integrator +reads the SDK's contract, not ours with the API. Keep out of dartdoc — and out of +`//` comments: + +- Endpoints, paths, verbs and API versions (`POST /moderation/flag`, "the v2 endpoint") +- Wire field names, request and response type names, and how a value is serialized + (`entity_type`, "sent as `target_ids`", "the wire models this as an open string") +- What "the server" or "the backend" does with a value, and whether an endpoint is + deprecated, in beta, or behind a feature flag + +Describe the same thing as observable behaviour instead. A caller cannot verify a +claim about the server, and the claim goes stale the moment the API changes — but +they can observe what their own call does: + +```dart +// BAD: + +/// [timeout] lifts the ban once it elapses. +/// +/// Sent as `timeout` in minutes; the server applies it with minute granularity. + +// GOOD: + +/// [timeout] lifts the ban once it elapses; the ban lasts until it is removed +/// when omitted. It is applied in whole minutes and never less than one. +``` + +Two things this does **not** forbid: + +- **Naming a concept the API owns and the caller works in** — a channel `cid`, a + user's `role`, a `team`. Those are domain vocabulary, not transport details. +- **Saying so where the reader is a consumer deciding whether to upgrade.** Which + endpoint moved, what is in beta, and what a feature flag gates belong in + `CHANGELOG.md`, `migrations/*.md` and the PR body — those are read once, alongside + a version, and are expected to date. + +When the wire shape genuinely explains a piece of code, put it in the plan or the PR, +and leave the code saying what it does. + ### No cross-framework justification in comments Do not justify code by cross-referencing Flutter framework internals ("matching @@ -1525,6 +1612,27 @@ and internal implementation notes. Reviewers reading a release should understand changed without reading the diff; details that only matter to the person writing the PR belong in the PR description, not here. +### An entry describes the change since the last *release* + +A changelog is read by someone upgrading from a published version, so an entry only +earns its place if it describes a difference they can observe. Churn within an +unreleased section is invisible to them. + +So on a long-lived unreleased branch — a `v11` beta, or anything accumulating under +`Upcoming` — write the entry against the last release, not against the previous commit: + +- **Never add an entry for something that branch itself introduced and then changed.** + A method added under `Upcoming` and later renamed gets **one** entry, describing where + it landed. A bug introduced and fixed on the same unreleased branch gets **none** — it + never shipped, so there is nothing to fix from a reader's point of view. Edit the + existing entry instead of appending a second. +- **Check what the last release actually shipped** before claiming prior state. + `git tag --contains ` answers it. "Was already deprecated" is only true if a + released version carried the deprecation. +- **File by what the change is to a consumer, not by how it felt to write.** A new + optional parameter is `✅ Added` even when the PR around it is breaking, and belongs + in the `✅ Added` section rather than buried among the breaks. + ### Cross-package PRs If a PR touches multiple packages, update each package's `CHANGELOG.md` separately. diff --git a/migrations/v11-migration.md b/migrations/v11-migration.md index 38168ae71d..1f9836b970 100644 --- a/migrations/v11-migration.md +++ b/migrations/v11-migration.md @@ -27,6 +27,7 @@ onto Stream's OpenAPI-generated API client. - [Sorting](#sorting) - [Roles](#roles) - [Devices](#devices) + - [Moderation](#moderation) - [User Groups](#user-groups) - [Link Previews](#link-previews) - [Migration Checklist](#migration-checklist) @@ -70,6 +71,7 @@ from the spec, so don't subclass them or depend on their private constructors. | Feature Area | Key Changes | | --- | --- | | [**Error Handling**](#error-handling) | Failures carry `stream_core`'s sealed `StreamException` family instead of `StreamChatNetworkError`; `ChatErrorCode` → `StreamErrorCode`. API calls will return `Result` rather than throwing, endpoint by endpoint | +| [**Moderation**](#moderation) | Muting, banning and flagging return a `Result` and call the moderation v2 API; `banUser`'s options map becomes named parameters; `unflagMessage`, `unflagUser` and `removeShadowBan` are removed | | _(filled in per feature as PRs land)_ | | --- @@ -93,6 +95,7 @@ search-and-replace you can apply directly. `Kind` is one of `renamed`, `removed` | `RetryPolicy.shouldRetry`'s `StreamChatError?` | `StreamChatException?` | `retyped` | | | `UploadState`'s `Preparing` / `InProgress` / `Success` / `Failed` | `UploadStatePreparing` / `UploadStateInProgress` / `UploadStateSuccess` / `UploadStateFailed` | `renamed` | Frees `Success` for `Result` | | `PagedValue.error(StreamChatError)` (`stream_chat_flutter_core`) | `PagedValue.error(StreamChatException)` | `retyped` | | +| `StreamChannelListController.muteChannel` / `unmuteChannel` → `Future` (`stream_chat_flutter_core`) | `Future>` | `retyped` | Returns a `Result` instead of throwing, so a `try`/`catch` around either no longer catches a failed call. A subclass overriding one needs the new return type | | `errorBuilder: Function(BuildContext, StreamChatError)` (scroll views) | `Function(BuildContext, StreamChatException)` | `retyped` | | | `StreamAttachmentValidator.validate()` / `.validateCount()` returning `StreamChatError?` | returning `AttachmentValidationError?` | `retyped` | `stream_chat_flutter`. They always returned rather than threw; the return type now says so | | `AttachmentLimitReachedError` / `AttachmentTooLargeError` / `AttachmentBlockedError` extending `StreamChatError` | extending `sealed AttachmentValidationError` | `retyped` | A refused attachment is not a failed call, so it is no longer one of the `StreamException` kinds. `switch` over them is exhaustive | @@ -157,6 +160,22 @@ search-and-replace you can apply directly. `Kind` is one of `renamed`, `removed` | `StreamChatClient.searchRoles` → `Future` | `Future>` | `retyped` | Returns a `Result` instead of throwing | | `StreamChatClient.addDevice` / `removeDevice` → `Future` | `Future>` | `retyped` | Returns a `Result` instead of throwing, and carries no value on success | | `StreamChatClient.getDevices` → `Future` | `Future>` | `retyped` | Returns a `Result` instead of throwing | +| `StreamChatClient.muteUser` → `Future` | `Future>` | `retyped` | Returns a `Result` instead of throwing, and carries no value | +| — | `muteUser(timeout:)` | `added` | Expires the mute after that long. v10 took only the user id | +| — | `moderation.muteUsers` / `unmuteUsers` | `added` | Mute or unmute several users in one call. `MuteUsersResponse.nonExistingUsers` names the ids that matched no user; the single-id methods carry no value, because a call where no id matches fails instead | +| `StreamChatClient.unmuteUser` → `Future` | `Future>` | `retyped` | Same | +| `StreamChatClient.muteChannel` / `unmuteChannel` → `Future` | `Future>` | `retyped` | Returns a `Result` instead of throwing, and carries no value on success | +| `StreamChatClient.flagMessage` / `flagUser` → `Future` | `Future>` | `retyped` | Plus optional `reason` and `custom` arguments. `FlagResponse.itemId` identifies the review queue item | +| `StreamChatClient.banUser(id, Map options)` | `banUser(id, {channelCid, timeout, reason, shadow, ipBan, deleteMessages})` | `retyped` | Named parameters mirroring the endpoint's options. `timeout` is a `Duration` applied with minute granularity | +| `StreamChatClient.unbanUser(id, Map options)` | `unbanUser(id, {channelCid})` | `retyped` | `remove_future_channels_ban` and `reason` are gone — the moderation v2 unban endpoint has neither | +| `StreamChatClient.shadowBan(id, Map options)` | `shadowBan(id, {channelCid, timeout, reason, ipBan, deleteMessages})` | `retyped` | Same options as `banUser`, minus `shadow` | +| `StreamChatClient.removeShadowBan` / `Channel.removeShadowBan` | `moderation.unbanUser` / `Channel.unbanMember` | `removed` | It sent `shadow: true` to unban, which no version of that endpoint reads, so it always did what `unbanUser` does | +| `StreamChatClient.unflagMessage` / `unflagUser` | — | `removed` | `POST /moderation/unflag` has no v2 endpoint and the v1 one removed no flag | +| `Channel.banMember(id, Map options)` / `shadowBan(id, Map options)` | `banMember(id, {timeout, reason, shadow, ipBan, deleteMessages})` / `shadowBan(id, {…})` | `retyped` | The channel supplies its own `channelCid`; the `type` + `id` pair it used to send is deprecated server-side | +| `Channel.mute` / `unmute` / `unbanMember` → `Future` | `Future>` | `retyped` | Returns a `Result` instead of throwing | +| — | `MuteUsersResponse` / `UnmuteUsersResponse` / `FlagResponse` | `added` | What the mute, unmute and flag calls answer with | +| — | `DeleteType` | `added` | Extension type over `String` with `soft` / `pruning` / `hard`, for `banUser(deleteMessages:)`. A value it does not name still carries: `DeleteType('...')` | +| `StreamChatClient.muteUser` / `unmuteUser` / `muteChannel` / `unmuteChannel` / `banUser` / `unbanUser` / `shadowBan` / `flagMessage` / `flagUser` | `StreamChatClient.moderation.` | `moved` | Grouped onto a `ModerationClient`. `Channel`'s moderation methods keep their place | | `Device.fromJson` / `toJson`, `Role.fromJson` | — | `removed` | The models are plain classes; construct them directly | | `PushProvider` (enum), `Device.pushProvider` (`String`) | `PushProvider` (extension type over `String`), `Device.pushProvider` (`PushProvider`) | `retyped` | Same four constants and wire values, and still usable as a `String`. `.name` and `.values` are gone and a `switch` over it needs a default; wrap a raw value as `PushProvider('firebase')` | | `ListDevicesResponse.fromJson`, `SearchRolesResponse.fromJson`, `ListDevicesResponse()..devices = …` | `ListDevicesResponse(duration: …, devices: …)` | `retyped` | The responses are plain classes with a const constructor and final fields | @@ -568,6 +587,84 @@ result.fold( **`duration` is a non-nullable `String`**, where v10 typed it `String?`. +### Moderation + +**Muting, banning and flagging return a `Result` instead of throwing**, on both `StreamChatClient` +and `Channel`. `muteUser` and `unmuteUser` answer with the ids that matched no user, and the flag +methods with the review queue item the flag created; the rest carry no value. `OwnUser.mutes` follows +the `notification.mutes_updated` event and `OwnUser.channelMutes` the +`notification.channel_mutes_updated` event, as they always did. + +```dart +// v10 +try { + await client.banUser(userId, {'timeout': 30, 'reason': 'spam'}); +} on StreamChatException catch (e) { + report(e); +} + +// v11 +final result = await client.moderation.banUser( + userId, + timeout: const Duration(minutes: 30), + reason: 'spam', +); +result.fold( + onSuccess: (_) => showBanned(), + onFailure: (error, _) => report(error), +); +``` + +**`banUser`'s options map becomes named parameters**, mirroring the endpoint: `channelCid`, +`timeout`, `reason`, `shadow`, `ipBan` and `deleteMessages`. `timeout` is a `Duration` applied with +minute granularity, and never as less than one minute — a shorter one would mean no expiry at all. +On `Channel`, `banMember` and `shadowBan` take the same set +minus `channelCid`, which the channel supplies itself — so the `{'type': ..., 'id': ...}` pair those +methods used to send is gone, and with it a pair the API deprecated in favour of `channel_cid`. + +**`unbanUser` takes only `channelCid`.** `remove_future_channels_ban` and `reason` were accepted by +the v1 endpoint and are not by its replacement. If you passed either through the options map, they no +longer reach the server. + +**`removeShadowBan` is removed** from both `StreamChatClient.moderation` and `Channel`. It passed +`shadow: true` to unban, which no version of that endpoint has ever read, so it did exactly what +`unbanUser` and `Channel.unbanMember` do. Call those — they lift a shadow ban like any other. + +**`unflagMessage` and `unflagUser` are removed**, rather than returning a `Result`. There is no v2 +endpoint for them, and the v1 one stopped removing flags: it validated the request, answered +successfully, and left the flag in place. Both were deprecated here for that reason before v11. To +act on a flag, use the review queue through `DefaultApi.submitAction`. + +**`flagMessage` and `flagUser` gain `reason` and `custom`,** which the endpoint stores alongside the +flag for whoever reviews it. + +**These endpoints moved to the moderation v2 API.** `muteUser`, `unmuteUser`, `banUser`, `unbanUser` +and the flag methods now call `/api/v2/moderation/`, where our other SDKs already call them. Those +endpoints are in beta and are refused for an app explicitly pinned to the v1 moderation flow +(`moderation_enabled: false`) — contact support to enable moderation v2 if your app is one of them. +Muting and unmuting a *channel* are unaffected: they were already the endpoint the generated client +calls. + +**The client's moderation methods moved to `client.moderation`.** They are now grouped on a +`ModerationClient`, reached through one field: + +```dart +// v10 +await client.muteUser(userId); + +// v11 +await client.moderation.muteUser(userId); +``` + +`Channel`'s moderation methods — `banMember`, `unbanMember`, `shadowBan`, `mute`, `unmute` +and `queryBannedUsers` — keep their place, because they are scoped to that channel. +`queryBannedUsers` stays on the client too. + +**`queryBannedUsers` is unchanged and still throws**, on both the client and the channel. It is the +only moderation call that answers with a model, and the `User` and `ChannelModel` shapes it embeds +are decided by later groups in this migration; it moves when they do. See +[Endpoints that still throw](#endpoints-that-still-throw). + --- ## Migration Checklist diff --git a/openapi-migration/02-devices.md b/openapi-migration/02-devices.md index bfd88e5cc6..91fc462042 100644 --- a/openapi-migration/02-devices.md +++ b/openapi-migration/02-devices.md @@ -4,7 +4,8 @@ **Size:** 0 hand-written method(s) across 0 file(s) → 3 generated operation(s). -> Tables are generated by `openapi-migration/tool/generate_plan.py`. Edit the prose, not the tables. +> This whole file is generated by `openapi-migration/tool/generate_plan.py`, prose included. +> Edit its `GROUPS` entry and re-run the script — edits made here are lost on the next run. ## Scope diff --git a/openapi-migration/03-user-groups.md b/openapi-migration/03-user-groups.md index 1d66723bc5..36c1e01060 100644 --- a/openapi-migration/03-user-groups.md +++ b/openapi-migration/03-user-groups.md @@ -4,7 +4,8 @@ **Size:** 0 hand-written method(s) across 0 file(s) → 8 generated operation(s). -> Tables are generated by `openapi-migration/tool/generate_plan.py`. Edit the prose, not the tables. +> This whole file is generated by `openapi-migration/tool/generate_plan.py`, prose included. +> Edit its `GROUPS` entry and re-run the script — edits made here are lost on the next run. ## Scope diff --git a/openapi-migration/04-roles-guest-and-app.md b/openapi-migration/04-roles-guest-and-app.md index 266a322974..8decf67721 100644 --- a/openapi-migration/04-roles-guest-and-app.md +++ b/openapi-migration/04-roles-guest-and-app.md @@ -4,7 +4,8 @@ **Size:** 2 hand-written method(s) across 2 file(s) → 5 generated operation(s). -> Tables are generated by `openapi-migration/tool/generate_plan.py`. Edit the prose, not the tables. +> This whole file is generated by `openapi-migration/tool/generate_plan.py`, prose included. +> Edit its `GROUPS` entry and re-run the script — edits made here are lost on the next run. ## Scope diff --git a/openapi-migration/05-polls.md b/openapi-migration/05-polls.md index 293285306a..f66979f8a8 100644 --- a/openapi-migration/05-polls.md +++ b/openapi-migration/05-polls.md @@ -4,7 +4,8 @@ **Size:** 13 hand-written method(s) across 1 file(s) → 13 generated operation(s). -> Tables are generated by `openapi-migration/tool/generate_plan.py`. Edit the prose, not the tables. +> This whole file is generated by `openapi-migration/tool/generate_plan.py`, prose included. +> Edit its `GROUPS` entry and re-run the script — edits made here are lost on the next run. ## Scope diff --git a/openapi-migration/06-reminders.md b/openapi-migration/06-reminders.md index f0671e8695..f2ccb1b74e 100644 --- a/openapi-migration/06-reminders.md +++ b/openapi-migration/06-reminders.md @@ -4,7 +4,8 @@ **Size:** 4 hand-written method(s) across 1 file(s) → 4 generated operation(s). -> Tables are generated by `openapi-migration/tool/generate_plan.py`. Edit the prose, not the tables. +> This whole file is generated by `openapi-migration/tool/generate_plan.py`, prose included. +> Edit its `GROUPS` entry and re-run the script — edits made here are lost on the next run. ## Scope diff --git a/openapi-migration/07-threads-and-drafts.md b/openapi-migration/07-threads-and-drafts.md index 1d45acb2f8..b325ae5e0d 100644 --- a/openapi-migration/07-threads-and-drafts.md +++ b/openapi-migration/07-threads-and-drafts.md @@ -4,7 +4,8 @@ **Size:** 7 hand-written method(s) across 2 file(s) → 7 generated operation(s). -> Tables are generated by `openapi-migration/tool/generate_plan.py`. Edit the prose, not the tables. +> This whole file is generated by `openapi-migration/tool/generate_plan.py`, prose included. +> Edit its `GROUPS` entry and re-run the script — edits made here are lost on the next run. ## Scope diff --git a/openapi-migration/08-moderation-and-blocklists.md b/openapi-migration/08-moderation-and-blocklists.md index 387d5ea7e1..35e3686252 100644 --- a/openapi-migration/08-moderation-and-blocklists.md +++ b/openapi-migration/08-moderation-and-blocklists.md @@ -2,9 +2,10 @@ **Goal:** The largest generated surface relative to ours — decide what stays unexposed. -**Size:** 11 hand-written method(s) across 1 file(s) → 35 generated operation(s). +**Size:** 0 hand-written method(s) across 0 file(s) → 34 generated operation(s). -> Tables are generated by `openapi-migration/tool/generate_plan.py`. Edit the prose, not the tables. +> This whole file is generated by `openapi-migration/tool/generate_plan.py`, prose included. +> Edit its `GROUPS` entry and re-run the script — edits made here are lost on the next run. ## Scope @@ -12,17 +13,6 @@ | File | Method | Returns | | --- | --- | --- | -| `moderation_api.dart` | `muteUser` | `EmptyResponse` | -| `moderation_api.dart` | `unmuteUser` | `EmptyResponse` | -| `moderation_api.dart` | `muteChannel` | `EmptyResponse` | -| `moderation_api.dart` | `unmuteChannel` | `EmptyResponse` | -| `moderation_api.dart` | `flagMessage` | `EmptyResponse` | -| `moderation_api.dart` | `unflagMessage` | `EmptyResponse` | -| `moderation_api.dart` | `flagUser` | `EmptyResponse` | -| `moderation_api.dart` | `unflagUser` | `EmptyResponse` | -| `moderation_api.dart` | `banUser` | `EmptyResponse` | -| `moderation_api.dart` | `unbanUser` | `EmptyResponse` | -| `moderation_api.dart` | `queryBannedUsers` | `QueryBannedUsersResponse` | ### Generated operations that cover it @@ -50,7 +40,6 @@ | `POST` | `/api/v2/moderation/mute` | `mute` | `MuteResponse` | | `POST` | `/api/v2/chat/moderation/mute/channel` | `muteChannel` | `MuteChannelResponse` | | `POST` | `/api/v2/moderation/appeals` | `queryAppeals` | `QueryAppealsResponse` | -| `GET` | `/api/v2/chat/query_banned_users` | `queryBannedUsers` | `QueryBannedUsersResponse` | | `GET` | `/api/v2/chat/query_future_channel_bans` | `queryFutureChannelBans` | `QueryFutureChannelBansResponse` | | `GET` | `/api/v2/chat/moderation/flags/message` | `queryMessageFlags` | `QueryMessageFlagsResponse` | | `POST` | `/api/v2/moderation/configs` | `queryModerationConfigs` | `QueryModerationConfigsResponse` | @@ -66,26 +55,145 @@ ## Decisions to make -- Most generated moderation operations have no hand-written counterpart. Decide explicitly which we expose now and which stay internal; do not surface ~20 new public methods as a side effect of migrating 11. -- Flag/unflag was deprecated recently on our side — check its current state before mapping it. +- None outstanding. `queryBannedUsers` is the one method still hand-written; see below for when it moves. + +## Decisions taken + +- **The moderation *writes* are this group; the one *read* was split into + [14](14-banned-users.md).** Every method here answers with nothing we keep, so none of them needs + model mapping — which is why they moved together and cleanly. `queryBannedUsers` answers with + `BanResponse`, whose `UserResponse` and `ChannelResponse` belong to groups 09 and 11, so it became + its own group rather than an asterisk on this one. + +- **`muteUser`, `unmuteUser`, `banUser` and the flag methods change service, not just shape.** Ours + called the chat v1 routes `lib/chat/routes.go` mounts at the root and comments as deprecated; the + generated operations are the moderation product under `/api/v2/moderation/`. The handlers are + equivalent — `moderation/controller/mute.go` uses the same `state.InsertUserMutes` and emits the + same `notification.mutes_updated` and `user.muted` events as `chat/controller/v1/mute_user.go`. + They are `Beta: true` and gated on `FeatureFlagEnabled -> app.ModerationV2Enabled()`, which defaults + on (`moderation_enabled` unset means enabled); an app explicitly pinned to the v1 flow gets + `"this endpoint needs a feature flag"`. + +- **A method answers with whatever the call actually carries.** `muteUser` and `unmuteUser` return + the ids that matched no user; the flag methods return the review-queue item the flag created. + Three hand-written models in `core/models/response/` carry them, exported from the barrel, and + `ModerationClient` returns them unchanged rather than discarding them. Widening a `Result` + this way is not a source break, because `void` is a top type and `Result` is covariant: every + existing call site in this repo compiled untouched. + +- **The rest answer with nothing worth returning, and stay `Result`.** `ban` and `unban` + answer with only `duration`, which is group 02's envelope-only precedent. `unmuteChannel` reuses the same + response type as `unmuteUser` but the handler never fills it in, so it is an envelope too. The + rest is blocked rather than unwanted: `mute.mutes`, `mute.ownUser` and everything on + `muteChannel` need `UserResponse` and `ChannelResponse` mapped first, which is groups 09 and 11 + — and the `User` shape is group 01's to decide, not this group's. No `UserResponse` mapper + exists yet, so nothing here could have been mapped without pre-empting that decision. + +- **`removeShadowBan` is removed outright, without a deprecation cycle.** Unlike the unflag + pair, neither this package nor the backend ever deprecated it: v10.4.0 shipped it as plain + public API, and `unflag` is the only moderation route the server marks `Deprecated: true` + (`lib/chat/controller/v1/unflag.go:23`). Keeping it as a deprecated alias was tried and + rejected — it does nothing `unbanUser` does not, so a cycle would only prolong the suggestion + that shadow bans are lifted differently. A v10 caller gets a compile error and one Symbol Map + row rather than a release of ambiguity. + +- **`unflagMessage` and `unflagUser` are removed, not migrated.** `POST /moderation/unflag` has no v2 + operation and is a chat-v1-only route the server no longer acts on: it validates the request, + answers successfully, and leaves the flag in place. Both were already deprecated here for that + reason, in a released version. + +- **`banUser`'s `Map options` becomes typed parameters**, mirroring the generated + `BanRequest`. This drops `remove_future_channels_ban` and `reason` on *unban*, which chat v1 + accepted and the moderation v2 `UnbanRequest` does not, and it fixes `Channel.banMember` / + `unbanMember`, which sent the `type` + `id` pair chat v1 deprecates in favour of `channel_cid`. + `timeout` is a `Duration` raised to at least one minute, because the value the conversion would + otherwise truncate to means no expiry at all. + +- **`deleteMessages` is a hand-written `DeleteType`, not the generated enum.** The generated + `BanRequestDeleteMessages` is already a correct extension type over `String` with the same three + values, so this is not about quality — it is about the name. A caller writing + `BanRequestDeleteMessages.hard` is naming our request DTO rather than the concept, and the type + is what hovers show. This follows `PushProvider`, which group 02 first adopted from the + generated side and [#3004](https://github.com/GetStream/stream-chat-flutter/pull/3004) replaced + with a hand-written one for exactly that reason, and it settles the rule group 02 left open: + **adopt a generated type only when its name names the concept.** It also leaves the barrel with + no generated exports, which is what `--check` asserts. + +- **`ipBan` is kept although the endpoint discards it.** `lib/chat/controller/v1/ban_user.go:198` + passed it through; the v2 handler at `lib/moderation/controller/ban.go:87-94` builds its action + from `Timeout`, `Reason`, `Shadow` and `DeleteMessages` only, so the flag is accepted and + dropped. The parameter and the dartdoc that describes it are kept by decision, so that the day + the handler wires it through nothing here changes. A channel-scoped ban never honoured it + either — `ban_user.go:107-108` rejects `ip_ban` together with a channel outright. + +- **`StreamChannelListController.muteChannel` and `unmuteChannel` return `Result`.** They + were `Future` awaiting a call that now answers with a `Result`, so a caller's `try`/`catch` + stopped firing with no compile error. Returning the `Result` makes the failure reachable again. + It is breaking rather than a fix: the controller is subclassable, and an override declared + `Future` no longer satisfies the base. + +- **`nonExistingUsers` is on the plural methods only.** The handler answers with the ids that + matched no user, but only ever some of them: if none match it fails instead + (`lib/moderation/controller/mute.go:106`). A single-id call therefore either succeeds with an + empty list or fails, so `muteUser` and `unmuteUser` return `Result` and only `muteUsers` + and `unmuteUsers` answer with the model. Swift draws the same line — its singular calls return + nothing and its plural ones return a response — and its demo app renders the field after a + batch mute, so this is a field with a demonstrated consumer rather than one exposed on spec. + +- **Users are batched, channels are not.** `muteUsers` and `unmuteUsers` take a list, because + the endpoints have always been batch endpoints — `target_ids` is a list validated + `required,max=1000` — and because the response names the ids that matched no user, which is only + worth reading when more than one was sent. The singular methods stay as they are. Swift exposes + the same pair and no channel equivalent, and `muteChannel` answers with nothing we keep, so a + plural there would return `Result` and be sugar for a loop. Do not add one for symmetry. + +- **The type is named `DeleteType`, not for the ban parameter that first needed it.** Soft, + pruning and hard are how thoroughly anything is deleted, not something about bans: the backend + declares them once as `DeleteType` in `lib/core/event/delete_type.go` and reuses them for user + deletion, message deletion and the `user.deleted` event, and the JS client exports the same + `DeleteType` union. The generated client already carries four copies of the same three values — + on `BanRequest`, `BanOptions`, `BanActionRequestPayload` and `DeleteUserMessagesRequestPayload` + — each named after the request it hangs off. One hand-written type covers all four, so the + later groups that migrate message and user deletion reuse it instead of adding their own. + +- **None of the other generated operations are exposed, and not because they are server-side.** + That was the original reason recorded here and it is wrong: the spec this client is generated + from is built with `-clientside`, which drops every route the backend marks `ServerSideOnly`. + Moderation's genuinely server-side surfaces — moderation logs, queue and moderator stats, flag + counts, rules and tasks — are filtered out before generation, so nothing reachable through + `DefaultApi` needs a secret. The remaining 28 are callable from an app; a caller without the + permission gets refused at runtime, per user, which is a different gate from this one. + + **This group ships the nine methods it migrated and nothing more**, pending agreement with the + other SDK teams on what a chat client should carry. The surfaces disagree today: two of them + publish the whole generated moderation API, one publishes part of it, and two publish none of + it, so there is no shared answer to copy. That conversation decides the scope, and it has not + happened yet. + + The cost is not the method count either. Each operation needs its own hand-written model here — + queues, moderation configs and action configs alone are around a dozen model families — and + eight of the operations embed `UserResponse`, `ChannelResponse` or `MessageResponse`, so they + wait on groups 09, 10 and 11 exactly as [14](14-banned-users.md) does. Whether that cost applies + at all depends on whether this package keeps mapping generated responses to its own models; + settle that before sizing a group around these operations. ## Risks -- `query_banned_users` may omit the `created_at_after` / `created_at_before` filters our request sends; verify before migrating or those filters silently disappear. +- ~~`query_banned_users` may omit the `created_at_after` / `created_at_before` filters our request sends~~ — resolved. It did, at `openapi-v237.2.0`: the server reads them off an embedded `*types.BansPager` in `GetPager()` and the spec did not flatten the embed. `openapi-v239.10.0` does, so `QueryBannedUsersPayload` now carries all four cursors. Regenerating also added `unban`, without which `banUser` would have migrated while `unbanUser` did not. ## Definition of done -- [ ] Every method above either routes through `DefaultApi` or is listed here as deliberately left +- [x] Every method above either routes through `DefaultApi` or is listed here as deliberately left hand-written, with the reason. -- [ ] Public methods return `Future>`; no `getOrThrow()` inside the SDK. -- [ ] Hand-written request/response DTOs for this group are deleted, or their retention is justified. -- [ ] `melos run analyze` clean, `melos run test:dart` green, persistence tests green if this group +- [x] Public methods return `Future>`; no `getOrThrow()` inside the SDK. +- [x] Hand-written request/response DTOs for this group are deleted, or their retention is justified. +- [x] `melos run analyze` clean, `melos run test:dart` green, persistence tests green if this group persists anything. -- [ ] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. -- [ ] CHANGELOG entry under `🛑️ Breaking` for each break; PR title `refactor(llc)!:`. -- [ ] Decisions recorded in this file, and the status box ticked in `README.md`. -- [ ] Public dartdoc follows [`STYLE_GUIDE.md` § Documentation](../STYLE_GUIDE.md#documentation) +- [x] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. +- [x] CHANGELOG entry under `🛑️ Breaking` for each break; PR title `refactor(llc)!:`. +- [x] Decisions recorded in this file, and the status box ticked in `README.md`. +- [x] Public dartdoc follows [`STYLE_GUIDE.md` § Documentation](../STYLE_GUIDE.md#documentation) and [`EFFECTIVE_DART_DOC.md`](../EFFECTIVE_DART_DOC.md), including on symbols this group retyped but whose docs it left alone. -- [ ] Tests follow [`TESTING.md`](../TESTING.md): no `group` organizing a file by method, each +- [x] Tests follow [`TESTING.md`](../TESTING.md): no `group` organizing a file by method, each name states its subject and behaviour. diff --git a/openapi-migration/09-users.md b/openapi-migration/09-users.md index 8c7ccda3ce..ed4e8f4999 100644 --- a/openapi-migration/09-users.md +++ b/openapi-migration/09-users.md @@ -4,7 +4,8 @@ **Size:** 9 hand-written method(s) across 1 file(s) → 9 generated operation(s). -> Tables are generated by `openapi-migration/tool/generate_plan.py`. Edit the prose, not the tables. +> This whole file is generated by `openapi-migration/tool/generate_plan.py`, prose included. +> Edit its `GROUPS` entry and re-run the script — edits made here are lost on the next run. ## Scope @@ -45,6 +46,7 @@ - Every other group depends on the `User` decision. - User data arrives over the WebSocket on nearly every event. +- Landing `UserResponse` -> `User` unblocks the two fields [08](08-moderation-and-blocklists.md) had to drop from `MuteUsersResponse`: the `mutes` the call created and the `ownUser` it left behind. Adding them is additive for anyone reading the response, so revisit them here rather than leaving them dropped for good. ## Definition of done diff --git a/openapi-migration/10-messages.md b/openapi-migration/10-messages.md index 01ae86a8a2..7a5d1ea5cc 100644 --- a/openapi-migration/10-messages.md +++ b/openapi-migration/10-messages.md @@ -4,7 +4,8 @@ **Size:** 14 hand-written method(s) across 2 file(s) → 12 generated operation(s). -> Tables are generated by `openapi-migration/tool/generate_plan.py`. Edit the prose, not the tables. +> This whole file is generated by `openapi-migration/tool/generate_plan.py`, prose included. +> Edit its `GROUPS` entry and re-run the script — edits made here are lost on the next run. ## Scope @@ -56,6 +57,7 @@ - `message_api.dart` also holds the four draft methods, which belong to group 07 — leave them alone here. - Attachment `custom`/`extraData` promotion is the known hard part of the whole migration. - Message send has offline and retry paths through `stream_chat_persistence` that must keep working. +- `MessageDeleteScope` has to be reconciled with `DeleteType`, which [08](08-moderation-and-blocklists.md) added. It is named for the scope of a delete — `deleteForMe` vs `deleteForAll` — but carries a `hard` bool, which is the same axis `DeleteType` models, in the same words, minus `pruning`. `deleteMessage(hard: true)` therefore cannot express a pruning delete at all, and `softDeleteForAll` / `hardDeleteForAll` read as two spellings of `DeleteType.soft` / `DeleteType.hard`. Decide whether the scope keeps a `DeleteType` field or the two stay separate arguments; either way the public type changes, so it belongs in this group rather than a later fix. ## Definition of done diff --git a/openapi-migration/11-channels-and-members.md b/openapi-migration/11-channels-and-members.md index dee5f57a7e..ba18c48dd2 100644 --- a/openapi-migration/11-channels-and-members.md +++ b/openapi-migration/11-channels-and-members.md @@ -4,7 +4,8 @@ **Size:** 27 hand-written method(s) across 2 file(s) → 24 generated operation(s). -> Tables are generated by `openapi-migration/tool/generate_plan.py`. Edit the prose, not the tables. +> This whole file is generated by `openapi-migration/tool/generate_plan.py`, prose included. +> Edit its `GROUPS` entry and re-run the script — edits made here are lost on the next run. ## Scope @@ -80,6 +81,7 @@ - `sync` and `queryMembers` live in `general_api.dart`, not `channel_api.dart` — this group reaches into that file. - `queryChannels` drives the channel list controllers and the offline cache; a shape change here is felt everywhere. - Channel `custom`/`extraData` promotion, same class of problem as messages. +- Landing `ChannelResponse` -> `ChannelModel` is the last thing blocking [08](08-moderation-and-blocklists.md)'s `muteChannel`, which drops `channelMute`, `channelMutes` and `ownUser` because the generated `ChannelMute` carries a `ChannelResponse?` and a `UserResponse?` where ours needs a non-nullable `ChannelModel` and `User`. It needs 09 as well. Decide the null case there too — ours are non-nullable, the generated ones are not, the same question [14](14-banned-users.md) records for `BanResponse.user`. ## Definition of done diff --git a/openapi-migration/12-uploads-cdn.md b/openapi-migration/12-uploads-cdn.md index ea7410dc64..fc9ee4cadb 100644 --- a/openapi-migration/12-uploads-cdn.md +++ b/openapi-migration/12-uploads-cdn.md @@ -4,7 +4,8 @@ **Size:** 8 hand-written method(s) across 1 file(s) → 8 generated operation(s). -> Tables are generated by `openapi-migration/tool/generate_plan.py`. Edit the prose, not the tables. +> This whole file is generated by `openapi-migration/tool/generate_plan.py`, prose included. +> Edit its `GROUPS` entry and re-run the script — edits made here are lost on the next run. ## Scope diff --git a/openapi-migration/13-push-preferences.md b/openapi-migration/13-push-preferences.md index b488020584..55b14189c8 100644 --- a/openapi-migration/13-push-preferences.md +++ b/openapi-migration/13-push-preferences.md @@ -4,7 +4,8 @@ **Size:** 1 hand-written method(s) across 1 file(s) → 1 generated operation(s). -> Tables are generated by `openapi-migration/tool/generate_plan.py`. Edit the prose, not the tables. +> This whole file is generated by `openapi-migration/tool/generate_plan.py`, prose included. +> Edit its `GROUPS` entry and re-run the script — edits made here are lost on the next run. ## Scope diff --git a/openapi-migration/14-banned-users.md b/openapi-migration/14-banned-users.md new file mode 100644 index 0000000000..e6f0ea918f --- /dev/null +++ b/openapi-migration/14-banned-users.md @@ -0,0 +1,57 @@ +# 14 — Banned Users + +**Goal:** Migrate the one method group 08 left behind — the only moderation call that answers with a model. + +**Size:** 1 hand-written method(s) across 1 file(s) → 1 generated operation(s). + +> This whole file is generated by `openapi-migration/tool/generate_plan.py`, prose included. +> Edit its `GROUPS` entry and re-run the script — edits made here are lost on the next run. + +## Scope + +### Hand-written today + +| File | Method | Returns | +| --- | --- | --- | +| `moderation_api.dart` | `queryBannedUsers` | `QueryBannedUsersResponse` | + +### Generated operations that cover it + +| Verb | Path | Operation | Response | +| --- | --- | --- | --- | +| `GET` | `/api/v2/chat/query_banned_users` | `queryBannedUsers` | `QueryBannedUsersResponse` | + +## Decisions to make + +- **What `BannedUser` becomes.** Keep it and map `BanResponse` at the boundary, or adopt `BanResponse` and re-parameterise `BannedUserFilter` / `BannedUserSort` onto it. The answer follows group 09's `User` decision — it is not a free choice here. +- **What to do with a `BanResponse` whose `user` is null.** Ours is non-nullable; skip the entry or fail the decode, but decide it rather than reaching for `!`. + +## Decisions taken + +- **This is a group, not an asterisk on [08](08-moderation-and-blocklists.md).** Every other + moderation method answers with nothing we keep, so they needed no mapping and moved together. + This one cannot move until the shapes it embeds are decided, and a group that is *mostly* done + hides that from the next reader. Splitting it keeps both records honest. + +## Risks + +- `BannedUser` is the type parameter for `BannedUserFilter` and `BannedUserSort`, whose fields read values off it (`it.user.id`, `it.bannedBy?.id`, `it.channel?.cid`, `it.createdAt`). Retyping the response retypes that registry too. +- `UserResponse.custom` → `User.extraData` drops `name` and `image` unless the mapper promotes them: they arrive as root fields, `Serializer.moveToExtraDataFromRoot` normally moves them, and `User.name` falls back to `id`. A mapper that misses this makes every banned user's name their id, and passes any test that does not assert on `.name`. +- It is the last method in `moderation_api.dart`. Closing this group deletes that file and the `StreamChatApi.moderation` getter. + +## Definition of done + +- [ ] Every method above either routes through `DefaultApi` or is listed here as deliberately left + hand-written, with the reason. +- [ ] Public methods return `Future>`; no `getOrThrow()` inside the SDK. +- [ ] Hand-written request/response DTOs for this group are deleted, or their retention is justified. +- [ ] `melos run analyze` clean, `melos run test:dart` green, persistence tests green if this group + persists anything. +- [ ] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. +- [ ] CHANGELOG entry under `🛑️ Breaking` for each break; PR title `refactor(llc)!:`. +- [ ] Decisions recorded in this file, and the status box ticked in `README.md`. +- [ ] Public dartdoc follows [`STYLE_GUIDE.md` § Documentation](../STYLE_GUIDE.md#documentation) + and [`EFFECTIVE_DART_DOC.md`](../EFFECTIVE_DART_DOC.md), including on symbols this group + retyped but whose docs it left alone. +- [ ] Tests follow [`TESTING.md`](../TESTING.md): no `group` organizing a file by method, each + name states its subject and behaviour. diff --git a/openapi-migration/README.md b/openapi-migration/README.md index 62329e4820..d6fcfd5f54 100644 --- a/openapi-migration/README.md +++ b/openapi-migration/README.md @@ -19,16 +19,18 @@ generated operations in scope, the decisions that group has to make, its risks, | [05](05-polls.md) | Polls | 13 | 13 | ☐ | | [06](06-reminders.md) | Message Reminders | 4 | 4 | ☐ | | [07](07-threads-and-drafts.md) | Threads & Drafts | 7 | 7 | ☐ | -| [08](08-moderation-and-blocklists.md) | Moderation & Blocklists | 11 | 34 | ☐ | +| [08](08-moderation-and-blocklists.md) | Moderation & Blocklists | 0 | 34 | ☑ | | [09](09-users.md) | Users | 9 | 9 | ☐ | | [10](10-messages.md) | Messages & Search | 14 | 12 | ☐ | | [11](11-channels-and-members.md) | Channels, Members & Sync | 27 | 24 | ☐ | | [12](12-uploads-cdn.md) | Uploads (CDN) | 8 | 8 | ☐ | | [13](13-push-preferences.md) | Push Preferences | 1 | 1 | ☐ | +| [14](14-banned-users.md) | Banned Users — split out of 08 | 1 | 1 | ☐ | -**Coverage:** 104 hand-written methods across 12 files, and all 129 generated operations, each claimed by exactly +**Coverage:** 86 hand-written methods across 11 files, and all 129 generated operations, each claimed by exactly one group. Verified mechanically — see [Keeping this plan honest](#keeping-this-plan-honest). + ## Goals 1. **One API layer, not two.** Every endpoint the SDK calls goes through the generated client, so new API surface @@ -130,7 +132,9 @@ surfaces before it reaches `Message` and `ChannelState`: - **02–04** have almost no persistence (03 stores mentioned groups) and almost no public model surface. Group 02 is the pattern-proving slice. - **05–07** introduce persisted models and WebSocket-delivered updates, one at a time. -- **08** is where we decide what *not* to expose: 34 generated operations against 11 hand-written methods. +- **08** is where we decide what *not* to expose: 34 generated operations against 10 hand-written methods. +- **14** is `queryBannedUsers`, split out of 08 because it is the only moderation call that answers with a + model. It waits on 09, so it sorts after the groups that decide the shapes it embeds. - **09** freezes the `User` mapping that everything else already depends on (the *decision* is made in 01; this group executes it). - **10–11** are the core of the SDK, and carry the `custom` / `extraData` promotion problem. @@ -174,4 +178,9 @@ though they sit under `/chat/messages/...`, and draft operations belong to Threa under `/chat/channels/...`. Re-run it after a regeneration adds or renames operations, and treat a reported problem as a plan bug rather -than a script bug. Prose sections are hand-written and survive regeneration. +than a script bug. + +**The group files are generated in full, prose included.** Goal, decisions, risks and the definition +of done live in the `GROUPS` list inside `generate_plan.py`, not in the markdown — editing a `0N-*.md` +file directly works until the next person regenerates, then it is silently lost. Record a group's decisions +in the generator and re-run it. diff --git a/openapi-migration/tool/generate_plan.py b/openapi-migration/tool/generate_plan.py index cb41ef33ec..f853e5d07b 100644 --- a/openapi-migration/tool/generate_plan.py +++ b/openapi-migration/tool/generate_plan.py @@ -315,18 +315,139 @@ def match(path): num='08', slug='moderation-and-blocklists', title='Moderation & Blocklists', hand=['moderation_api.dart'], match=owns('/api/v2/moderation', '/api/v2/chat/moderation', '/api/v2/blocklists', - '/api/v2/chat/query_banned_users', '/api/v2/chat/query_future_channel_bans'), + '/api/v2/chat/query_future_channel_bans'), goal='The largest generated surface relative to ours — decide what stays unexposed.', decisions=[ - 'Most generated moderation operations have no hand-written counterpart. Decide explicitly which we ' - 'expose now and which stay internal; do not surface ~20 new public methods as a side effect of ' - 'migrating 11.', - 'Flag/unflag was deprecated recently on our side — check its current state before mapping it.', + 'None outstanding. `queryBannedUsers` is the one method still hand-written; see below for when it ' + 'moves.', ], + taken=textwrap.dedent("""\ + - **The moderation *writes* are this group; the one *read* was split into + [14](14-banned-users.md).** Every method here answers with nothing we keep, so none of them needs + model mapping — which is why they moved together and cleanly. `queryBannedUsers` answers with + `BanResponse`, whose `UserResponse` and `ChannelResponse` belong to groups 09 and 11, so it became + its own group rather than an asterisk on this one. + + - **`muteUser`, `unmuteUser`, `banUser` and the flag methods change service, not just shape.** Ours + called the chat v1 routes `lib/chat/routes.go` mounts at the root and comments as deprecated; the + generated operations are the moderation product under `/api/v2/moderation/`. The handlers are + equivalent — `moderation/controller/mute.go` uses the same `state.InsertUserMutes` and emits the + same `notification.mutes_updated` and `user.muted` events as `chat/controller/v1/mute_user.go`. + They are `Beta: true` and gated on `FeatureFlagEnabled -> app.ModerationV2Enabled()`, which defaults + on (`moderation_enabled` unset means enabled); an app explicitly pinned to the v1 flow gets + `"this endpoint needs a feature flag"`. + + - **A method answers with whatever the call actually carries.** `muteUser` and `unmuteUser` return + the ids that matched no user; the flag methods return the review-queue item the flag created. + Three hand-written models in `core/models/response/` carry them, exported from the barrel, and + `ModerationClient` returns them unchanged rather than discarding them. Widening a `Result` + this way is not a source break, because `void` is a top type and `Result` is covariant: every + existing call site in this repo compiled untouched. + + - **The rest answer with nothing worth returning, and stay `Result`.** `ban` and `unban` + answer with only `duration`, which is group 02's envelope-only precedent. `unmuteChannel` reuses the same + response type as `unmuteUser` but the handler never fills it in, so it is an envelope too. The + rest is blocked rather than unwanted: `mute.mutes`, `mute.ownUser` and everything on + `muteChannel` need `UserResponse` and `ChannelResponse` mapped first, which is groups 09 and 11 + — and the `User` shape is group 01's to decide, not this group's. No `UserResponse` mapper + exists yet, so nothing here could have been mapped without pre-empting that decision. + + - **`removeShadowBan` is removed outright, without a deprecation cycle.** Unlike the unflag + pair, neither this package nor the backend ever deprecated it: v10.4.0 shipped it as plain + public API, and `unflag` is the only moderation route the server marks `Deprecated: true` + (`lib/chat/controller/v1/unflag.go:23`). Keeping it as a deprecated alias was tried and + rejected — it does nothing `unbanUser` does not, so a cycle would only prolong the suggestion + that shadow bans are lifted differently. A v10 caller gets a compile error and one Symbol Map + row rather than a release of ambiguity. + + - **`unflagMessage` and `unflagUser` are removed, not migrated.** `POST /moderation/unflag` has no v2 + operation and is a chat-v1-only route the server no longer acts on: it validates the request, + answers successfully, and leaves the flag in place. Both were already deprecated here for that + reason, in a released version. + + - **`banUser`'s `Map options` becomes typed parameters**, mirroring the generated + `BanRequest`. This drops `remove_future_channels_ban` and `reason` on *unban*, which chat v1 + accepted and the moderation v2 `UnbanRequest` does not, and it fixes `Channel.banMember` / + `unbanMember`, which sent the `type` + `id` pair chat v1 deprecates in favour of `channel_cid`. + `timeout` is a `Duration` raised to at least one minute, because the value the conversion would + otherwise truncate to means no expiry at all. + + - **`deleteMessages` is a hand-written `DeleteType`, not the generated enum.** The generated + `BanRequestDeleteMessages` is already a correct extension type over `String` with the same three + values, so this is not about quality — it is about the name. A caller writing + `BanRequestDeleteMessages.hard` is naming our request DTO rather than the concept, and the type + is what hovers show. This follows `PushProvider`, which group 02 first adopted from the + generated side and [#3004](https://github.com/GetStream/stream-chat-flutter/pull/3004) replaced + with a hand-written one for exactly that reason, and it settles the rule group 02 left open: + **adopt a generated type only when its name names the concept.** It also leaves the barrel with + no generated exports, which is what `--check` asserts. + + - **`ipBan` is kept although the endpoint discards it.** `lib/chat/controller/v1/ban_user.go:198` + passed it through; the v2 handler at `lib/moderation/controller/ban.go:87-94` builds its action + from `Timeout`, `Reason`, `Shadow` and `DeleteMessages` only, so the flag is accepted and + dropped. The parameter and the dartdoc that describes it are kept by decision, so that the day + the handler wires it through nothing here changes. A channel-scoped ban never honoured it + either — `ban_user.go:107-108` rejects `ip_ban` together with a channel outright. + + - **`StreamChannelListController.muteChannel` and `unmuteChannel` return `Result`.** They + were `Future` awaiting a call that now answers with a `Result`, so a caller's `try`/`catch` + stopped firing with no compile error. Returning the `Result` makes the failure reachable again. + It is breaking rather than a fix: the controller is subclassable, and an override declared + `Future` no longer satisfies the base. + + - **`nonExistingUsers` is on the plural methods only.** The handler answers with the ids that + matched no user, but only ever some of them: if none match it fails instead + (`lib/moderation/controller/mute.go:106`). A single-id call therefore either succeeds with an + empty list or fails, so `muteUser` and `unmuteUser` return `Result` and only `muteUsers` + and `unmuteUsers` answer with the model. Swift draws the same line — its singular calls return + nothing and its plural ones return a response — and its demo app renders the field after a + batch mute, so this is a field with a demonstrated consumer rather than one exposed on spec. + + - **Users are batched, channels are not.** `muteUsers` and `unmuteUsers` take a list, because + the endpoints have always been batch endpoints — `target_ids` is a list validated + `required,max=1000` — and because the response names the ids that matched no user, which is only + worth reading when more than one was sent. The singular methods stay as they are. Swift exposes + the same pair and no channel equivalent, and `muteChannel` answers with nothing we keep, so a + plural there would return `Result` and be sugar for a loop. Do not add one for symmetry. + + - **The type is named `DeleteType`, not for the ban parameter that first needed it.** Soft, + pruning and hard are how thoroughly anything is deleted, not something about bans: the backend + declares them once as `DeleteType` in `lib/core/event/delete_type.go` and reuses them for user + deletion, message deletion and the `user.deleted` event, and the JS client exports the same + `DeleteType` union. The generated client already carries four copies of the same three values — + on `BanRequest`, `BanOptions`, `BanActionRequestPayload` and `DeleteUserMessagesRequestPayload` + — each named after the request it hangs off. One hand-written type covers all four, so the + later groups that migrate message and user deletion reuse it instead of adding their own. + + - **None of the other generated operations are exposed, and not because they are server-side.** + That was the original reason recorded here and it is wrong: the spec this client is generated + from is built with `-clientside`, which drops every route the backend marks `ServerSideOnly`. + Moderation's genuinely server-side surfaces — moderation logs, queue and moderator stats, flag + counts, rules and tasks — are filtered out before generation, so nothing reachable through + `DefaultApi` needs a secret. The remaining 28 are callable from an app; a caller without the + permission gets refused at runtime, per user, which is a different gate from this one. + + **This group ships the nine methods it migrated and nothing more**, pending agreement with the + other SDK teams on what a chat client should carry. The surfaces disagree today: two of them + publish the whole generated moderation API, one publishes part of it, and two publish none of + it, so there is no shared answer to copy. That conversation decides the scope, and it has not + happened yet. + + The cost is not the method count either. Each operation needs its own hand-written model here — + queues, moderation configs and action configs alone are around a dozen model families — and + eight of the operations embed `UserResponse`, `ChannelResponse` or `MessageResponse`, so they + wait on groups 09, 10 and 11 exactly as [14](14-banned-users.md) does. Whether that cost applies + at all depends on whether this package keeps mapping generated responses to its own models; + settle that before sizing a group around these operations. + """), risks=[ - '`query_banned_users` may omit the `created_at_after` / `created_at_before` filters our request sends; ' - 'verify before migrating or those filters silently disappear.', + '~~`query_banned_users` may omit the `created_at_after` / `created_at_before` filters our request ' + 'sends~~ — resolved. It did, at `openapi-v237.2.0`: the server reads them off an embedded ' + '`*types.BansPager` in `GetPager()` and the spec did not flatten the embed. `openapi-v239.10.0` does, ' + 'so `QueryBannedUsersPayload` now carries all four cursors. Regenerating also added `unban`, without ' + 'which `banUser` would have migrated while `unbanUser` did not.', ], + done=DONE.replace('- [ ]', '- [x]'), ), dict( num='09', slug='users', title='Users', @@ -342,6 +463,10 @@ def match(path): risks=[ 'Every other group depends on the `User` decision.', 'User data arrives over the WebSocket on nearly every event.', + 'Landing `UserResponse` -> `User` unblocks the two fields [08](08-moderation-and-blocklists.md) ' + 'had to drop from `MuteUsersResponse`: the `mutes` the call created and the `ownUser` it left ' + 'behind. Adding them is additive for anyone reading the response, so revisit them here rather ' + 'than leaving them dropped for good.', ], done=DONE + ( '- [ ] Temporary adapters owned by this group (`DeviceV1JsonConverter`) are deleted and removed from\n' @@ -372,6 +497,7 @@ def match(path): 'here.', 'Attachment `custom`/`extraData` promotion is the known hard part of the whole migration.', 'Message send has offline and retry paths through `stream_chat_persistence` that must keep working.', + '`MessageDeleteScope` has to be reconciled with `DeleteType`, which [08](08-moderation-and-blocklists.md) added. It is named for the scope of a delete — `deleteForMe` vs `deleteForAll` — but carries a `hard` bool, which is the same axis `DeleteType` models, in the same words, minus `pruning`. `deleteMessage(hard: true)` therefore cannot express a pruning delete at all, and `softDeleteForAll` / `hardDeleteForAll` read as two spellings of `DeleteType.soft` / `DeleteType.hard`. Decide whether the scope keeps a `DeleteType` field or the two stay separate arguments; either way the public type changes, so it belongs in this group rather than a later fix.', ], ), dict( @@ -401,6 +527,12 @@ def match(path): '`queryChannels` drives the channel list controllers and the offline cache; a shape change here is ' 'felt everywhere.', 'Channel `custom`/`extraData` promotion, same class of problem as messages.', + 'Landing `ChannelResponse` -> `ChannelModel` is the last thing blocking ' + '[08](08-moderation-and-blocklists.md)\'s `muteChannel`, which drops `channelMute`, `channelMutes` ' + 'and `ownUser` because the generated `ChannelMute` carries a `ChannelResponse?` and a ' + '`UserResponse?` where ours needs a non-nullable `ChannelModel` and `User`. It needs 09 as well. ' + 'Decide the null case there too — ours are non-nullable, the generated ones are not, the same ' + 'question [14](14-banned-users.md) records for `BanResponse.user`.', ], ), dict( @@ -465,6 +597,36 @@ def match(path): '`ChannelState.pushPreferences` is **not** persisted — checked, no entity, DAO or mapper.', ], ), + dict( + num='14', slug='banned-users', title='Banned Users', + hand=['moderation_api.dart::queryBannedUsers'], + match=owns('/api/v2/chat/query_banned_users'), + goal='Migrate the one method group 08 left behind — the only moderation call that answers with a model.', + decisions=[ + '**What `BannedUser` becomes.** Keep it and map `BanResponse` at the boundary, or adopt `BanResponse` ' + 'and re-parameterise `BannedUserFilter` / `BannedUserSort` onto it. The answer follows group 09\'s ' + '`User` decision — it is not a free choice here.', + '**What to do with a `BanResponse` whose `user` is null.** Ours is non-nullable; skip the entry or ' + 'fail the decode, but decide it rather than reaching for `!`.', + ], + taken=textwrap.dedent("""\ + - **This is a group, not an asterisk on [08](08-moderation-and-blocklists.md).** Every other + moderation method answers with nothing we keep, so they needed no mapping and moved together. + This one cannot move until the shapes it embeds are decided, and a group that is *mostly* done + hides that from the next reader. Splitting it keeps both records honest. + """), + risks=[ + '`BannedUser` is the type parameter for `BannedUserFilter` and `BannedUserSort`, whose fields read ' + 'values off it (`it.user.id`, `it.bannedBy?.id`, `it.channel?.cid`, `it.createdAt`). Retyping the ' + 'response retypes that registry too.', + '`UserResponse.custom` → `User.extraData` drops `name` and `image` unless the mapper promotes them: ' + 'they arrive as root fields, `Serializer.moveToExtraDataFromRoot` normally moves them, and ' + '`User.name` falls back to `id`. A mapper that misses this makes every banned user\'s name their ' + 'id, and passes any test that does not assert on `.name`.', + 'It is the last method in `moderation_api.dart`. Closing this group deletes that file and the ' + '`StreamChatApi.moderation` getter.', + ], + ), ] @@ -491,7 +653,8 @@ def render(g, hand, ops): f"**Goal:** {g['goal']}\n", f"**Size:** {len(hand_methods)} hand-written method(s) across " f"{len({f for f, _, _ in hand_methods})} file(s) → {len(gops)} generated operation(s).\n", - '> Tables are generated by `openapi-migration/tool/generate_plan.py`. Edit the prose, not the tables.\n', + '> This whole file is generated by `openapi-migration/tool/generate_plan.py`, prose included.\n' + '> Edit its `GROUPS` entry and re-run the script — edits made here are lost on the next run.\n', '## Scope\n', '### Hand-written today\n', '| File | Method | Returns |', diff --git a/packages/stream_chat/CHANGELOG.md b/packages/stream_chat/CHANGELOG.md index d95a65263b..1c352004f4 100644 --- a/packages/stream_chat/CHANGELOG.md +++ b/packages/stream_chat/CHANGELOG.md @@ -2,6 +2,15 @@ 🛑️ Breaking +- The moderation methods move from `StreamChatClient` to `StreamChatClient.moderation`: `client.muteUser(id)` becomes `client.moderation.muteUser(id)`. `Channel`'s own moderation methods are unchanged. +- Moderation calls return a `Result` instead of throwing, on both `client.moderation` and `Channel`. +- `muteUser`, `unmuteUser`, `banUser`, `unbanUser` and the flag methods move to the moderation v2 API, which is in beta and refuses an app pinned to the v1 moderation flow. Muting a *channel* is unaffected. +- `banUser`'s options map becomes named parameters: `channelCid`, `timeout`, `reason`, `shadow`, `ipBan`, `deleteMessages` (a `DeleteType`). `Channel.banMember` and `shadowBan` take the same, minus `channelCid`. +- `unbanUser` takes `channelCid` and no longer accepts `remove_future_channels_ban` or `reason`, which its replacement has neither of. +- `removeShadowBan` is removed from `StreamChatClient.moderation` and `Channel`. It was an alias of `unbanUser` and `Channel.unbanMember` — use those. +- `unflagMessage` and `unflagUser` are removed. They removed no flag, which is why both were already deprecated. +- `StreamChatApi.moderation` handles only `queryBannedUsers`; the other ten methods moved off it. + - Logging is rebuilt. `logLevel` and `logHandlerFunction` become one `logConfig`, `client.logger` is a `StreamLogger`, and `detachedLogger`, `defaultLogHandler` and `LogHandlerFunction` are removed along with the `package:logging` re-export. The default is unchanged: warnings and errors to the console. Supply a `StreamLogHandler` to route records into your own facility. - `LoggingInterceptor`, `InterceptStep` and `LogPrint` are no longer exported. The interceptor is installed by default and writes through the configured `StreamLogHandler`, so routing its output is a `logConfig` concern now. - The token layer is retyped. `Token` becomes `UserToken`, and `TokenProvider` becomes an interface rather than a `Future Function(String)` typedef — pass `TokenProvider.dynamic(myLoader)` where you passed a closure, and note a loader now returns a `UserToken`. `TokenManager.loadToken` becomes `getToken`, `isStatic` becomes `usesStaticProvider`, and `setTokenOrProvider` becomes `setTokenProvider`. @@ -84,6 +93,9 @@ - Added the message sort fields the JS client already exposed: `text`, `type`, `parentId`, `replyCount` and `pinned`. - Added `MemberSortField.updatedAt`. - Added `UserSortField.language` and `UserSortField.teams`. +- Added optional `reason` and `custom` arguments to `flagMessage` and `flagUser`, recorded with the flag. +- Added an optional `timeout` to `StreamChatClient.moderation.muteUser` that expires the mute. +- Added `StreamChatClient.moderation.muteUsers` and `unmuteUsers`, which mute and unmute several users in one call and report the ids that matched no user. 🔒 Security diff --git a/packages/stream_chat/lib/src/client/channel/channel.dart b/packages/stream_chat/lib/src/client/channel/channel.dart index 0341bf341a..3df5d842bc 100644 --- a/packages/stream_chat/lib/src/client/channel/channel.dart +++ b/packages/stream_chat/lib/src/client/channel/channel.dart @@ -2267,8 +2267,11 @@ class Channel { // state when the mute expires. Timer? _muteExpirationTimer; - /// Mutes the channel. - Future mute({Duration? expiration}) { + /// Mutes this channel for the current user. + /// + /// The mute lasts until it is removed. An [expiration] expires it after + /// that long, and a zero one removes it straight away. + Future> mute({Duration? expiration}) { _checkInitialized(); // If there is a expiration set, we will set a timer to automatically unmute @@ -2278,64 +2281,83 @@ class Channel { _muteExpirationTimer = Timer(expiration, unmute); } - return _client.muteChannel(cid!, expiration: expiration); + return _client.moderation.muteChannel(cid!, expiration: expiration); } - /// Unmute the channel. - Future unmute() { + /// Removes the current user's mute on this channel. + Future> unmute() { _checkInitialized(); // Cancel the mute expiration timer if it is set. _muteExpirationTimer?.cancel(); _muteExpirationTimer = null; - return _client.unmuteChannel(cid!); - } - - /// Bans the member with given [userID] from the channel. - Future banMember( - String userID, - Map options, - ) async { - _checkInitialized(); - final opts = Map.from(options) - ..addAll({ - 'type': type, - 'id': id, - }); - return _client.banUser(userID, opts); + return _client.moderation.unmuteChannel(cid!); } - /// Remove the ban for the member with given [userID] in the channel. - Future unbanMember(String userID) async { + /// Bans [userID] from this channel. + /// + /// The ban lasts until it is removed. A [timeout] expires it after that + /// long, applied in whole minutes and never less than one. + /// + /// If [shadow] is true, their messages stop reaching anyone else and they + /// are not told. + /// + /// If [ipBan] is true, the address they connected from is banned as well. + /// + /// [deleteMessages] decides what happens to the messages they already + /// sent, which are left alone when it is omitted. [reason] is recorded + /// with the ban. + Future> banMember( + String userID, { + Duration? timeout, + String? reason, + bool? shadow, + bool? ipBan, + DeleteType? deleteMessages, + }) { _checkInitialized(); - return _client.unbanUser(userID, { - 'type': type, - 'id': id, - }); + return _client.moderation.banUser( + userID, + channelCid: cid, + timeout: timeout, + reason: reason, + shadow: shadow, + ipBan: ipBan, + deleteMessages: deleteMessages, + ); } - /// Shadow bans the user with the given [userID] from the channel. - Future shadowBan( - String userID, - Map options, - ) async { + /// Removes the ban on [userID] in this channel. + /// + /// A shadow ban lifts the same way as any other. + Future> unbanMember(String userID) { _checkInitialized(); - final opts = Map.from(options) - ..addAll({ - 'type': type, - 'id': id, - }); - return _client.shadowBan(userID, opts); + return _client.moderation.unbanUser(userID, channelCid: cid); } - /// Remove the shadow ban for the user with the given [userID] in the channel. - Future removeShadowBan(String userID) async { + /// Bans [userID] without telling them, hiding their messages. + /// + /// The same as [banMember] with `shadow` set, and the other arguments + /// behave the same way. + /// + /// Remove it with [unbanMember]. + Future> shadowBan( + String userID, { + Duration? timeout, + String? reason, + bool? ipBan, + DeleteType? deleteMessages, + }) { _checkInitialized(); - return _client.removeShadowBan(userID, { - 'type': type, - 'id': id, - }); + return _client.moderation.shadowBan( + userID, + channelCid: cid, + timeout: timeout, + reason: reason, + ipBan: ipBan, + deleteMessages: deleteMessages, + ); } /// Hides the channel from [StreamChatClient.queryChannels] for the user diff --git a/packages/stream_chat/lib/src/client/client.dart b/packages/stream_chat/lib/src/client/client.dart index ccbe2cfe36..8421cc9fc2 100644 --- a/packages/stream_chat/lib/src/client/client.dart +++ b/packages/stream_chat/lib/src/client/client.dart @@ -78,6 +78,7 @@ import '../db/chat_persistence_client.dart'; import '../event_type.dart'; import '../repository/devices_repository.dart'; import '../repository/general_repository.dart'; +import '../repository/moderation_repository.dart'; import '../repository/roles_repository.dart'; import '../repository/user_groups_repository.dart'; import '../ws/connect_request.dart'; @@ -89,6 +90,7 @@ import '../ws/events/events.dart'; import 'channel/channel.dart'; import 'channel_delivery_reporter.dart'; import 'live_location_expiration_scheduler.dart'; +import 'moderation_client.dart'; import 'query_channels_result.dart'; import 'retry_policy.dart'; import 'sync_manager.dart'; @@ -175,10 +177,14 @@ class StreamChatClient { ); final api = defaultApi ?? DefaultApi(httpClient); + _rolesRepository = RolesRepository(api); _devicesRepository = DevicesRepository(api); _userGroupsRepository = UserGroupsRepository(api); _generalRepository = GeneralRepository(api); + _moderationRepository = ModerationRepository(api); + + moderation = ModerationClient(_moderationRepository); _connection = ConnectionManager( request: ConnectRequest.forApi( @@ -212,10 +218,16 @@ class StreamChatClient { } late final StreamChatApi _chatApi; + late final RolesRepository _rolesRepository; late final DevicesRepository _devicesRepository; late final UserGroupsRepository _userGroupsRepository; late final GeneralRepository _generalRepository; + late final ModerationRepository _moderationRepository; + + /// Muting, banning and flagging, for the connected user. + late final ModerationClient moderation; + late final ConnectionManager _connection; StreamSubscription? _wsEventSubscription; @@ -1446,18 +1458,6 @@ class StreamChatClient { truncatedAt: truncatedAt, ); - /// Mutes the channel - Future muteChannel( - String channelCid, { - Duration? expiration, - }) => _chatApi.moderation.muteChannel( - channelCid, - expiration: expiration, - ); - - /// Unmutes the channel - Future unmuteChannel(String channelCid) => _chatApi.moderation.unmuteChannel(channelCid); - /// Accept invitation to the channel Future acceptChannelInvite( String channelId, @@ -1747,42 +1747,6 @@ class StreamChatClient { List users, ) => _chatApi.user.partialUpdateUsers(users); - /// Bans a user from all channels - Future banUser( - String targetUserId, [ - Map options = const {}, - ]) => _chatApi.moderation.banUser( - targetUserId, - options: options, - ); - - /// Remove global ban for a user - Future unbanUser( - String targetUserId, [ - Map options = const {}, - ]) => _chatApi.moderation.unbanUser( - targetUserId, - options: options, - ); - - /// Shadow bans a user - Future shadowBan( - String targetID, [ - Map options = const {}, - ]) => banUser(targetID, { - 'shadow': true, - ...options, - }); - - /// Removes shadow ban from a user - Future removeShadowBan( - String targetID, [ - Map options = const {}, - ]) => unbanUser(targetID, { - 'shadow': true, - ...options, - }); - final _userBlockLock = Lock(); /// Blocks a user with the provided [userId]. @@ -1862,40 +1826,6 @@ class StreamChatClient { return response; } - /// Mutes a user - Future muteUser(String userId) => _chatApi.moderation.muteUser(userId); - - /// Unmutes a user - Future unmuteUser(String userId) => _chatApi.moderation.unmuteUser(userId); - - /// Flag a message - Future flagMessage(String messageId) => _chatApi.moderation.flagMessage(messageId); - - /// Unflag a message. - /// - /// The `/moderation/unflag` endpoint is no longer processed by the server: - /// the request is validated and an empty response is returned, but no flag - /// is removed. - @Deprecated( - 'The /moderation/unflag endpoint is no longer supported by the server. ' - 'This will be removed in a future major release', - ) - Future unflagMessage(String messageId) => _chatApi.moderation.unflagMessage(messageId); - - /// Flag a user - Future flagUser(String userId) => _chatApi.moderation.flagUser(userId); - - /// Unflag a user. - /// - /// The `/moderation/unflag` endpoint is no longer processed by the server: - /// the request is validated and an empty response is returned, but no flag - /// is removed. - @Deprecated( - 'The /moderation/unflag endpoint is no longer supported by the server. ' - 'This will be removed in a future major release', - ) - Future unflagUser(String userId) => _chatApi.moderation.unflagUser(userId); - /// Mark all channels for this user as read Future markAllRead() => _chatApi.channel.markAllRead(); diff --git a/packages/stream_chat/lib/src/client/moderation_client.dart b/packages/stream_chat/lib/src/client/moderation_client.dart new file mode 100644 index 0000000000..8258a97102 --- /dev/null +++ b/packages/stream_chat/lib/src/client/moderation_client.dart @@ -0,0 +1,173 @@ +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' show Result; + +import '../core/models/delete_type.dart'; +import '../core/models/response/flag_response.dart'; +import '../core/models/response/mute_users_response.dart'; +import '../core/models/response/unmute_users_response.dart'; +import '../repository/mapper/result_mapper.dart'; +import '../repository/moderation_repository.dart'; + +/// Muting, banning and flagging, for the connected user. +/// +/// Obtained via [StreamChatClient.moderation]. Not intended to be constructed +/// directly. +/// +/// See also: +/// +/// * [Channel.banMember], which bans someone from one channel. +/// * [StreamChatClient.queryBannedUsers], which lists who is banned. +class ModerationClient { + /// Creates a new moderation client. + @internal + const ModerationClient(this._repository); + + final ModerationRepository _repository; + + /// Mutes [userId] for the current user. + /// + /// The mute lasts until it is removed. A [timeout] expires it after that + /// long, applied in whole minutes and never less than one. + Future> muteUser( + String userId, { + Duration? timeout, + }) async { + final result = await muteUsers([userId], timeout: timeout); + return result.ignoreValue(); + } + + /// Mutes every id in [userIds] for the current user. + /// + /// The mute lasts until it is removed. A [timeout] expires it after that + /// long, applied in whole minutes and never less than one. + /// + /// At least one id is required. + /// + /// Returns the ids among [userIds] that matched no user. + Future> muteUsers( + List userIds, { + Duration? timeout, + }) => _repository.muteUsers(userIds, timeout: timeout); + + /// Removes the current user's mute on [userId]. + Future> unmuteUser( + String userId, + ) async { + final result = await unmuteUsers([userId]); + return result.ignoreValue(); + } + + /// Removes the current user's mute on every id in [userIds]. + /// + /// At least one id is required. + /// + /// Returns the ids among [userIds] that matched no user. + Future> unmuteUsers( + List userIds, + ) => _repository.unmuteUsers(userIds); + + /// Mutes the channel [channelCid] for the current user. + /// + /// The mute lasts until it is removed. An [expiration] expires it after + /// that long, and a zero one removes it straight away. + Future> muteChannel( + String channelCid, { + Duration? expiration, + }) => _repository.muteChannel(channelCid, expiration: expiration); + + /// Removes the current user's mute on the channel [channelCid]. + Future> unmuteChannel( + String channelCid, + ) => _repository.unmuteChannel(channelCid); + + /// Bans [targetUserId]. + /// + /// The ban covers the whole app, or only [channelCid] if one is given. + /// + /// It lasts until it is removed. A [timeout] expires it after that long, + /// applied in whole minutes and never less than one. + /// + /// If [shadow] is true, their messages stop reaching anyone else and they + /// are not told. + /// + /// If [ipBan] is true, the address they connected from is banned as well. + /// + /// [deleteMessages] decides what happens to the messages they already + /// sent, which are left alone when it is omitted. [reason] is recorded + /// with the ban. + Future> banUser( + String targetUserId, { + String? channelCid, + Duration? timeout, + String? reason, + bool? shadow, + bool? ipBan, + DeleteType? deleteMessages, + }) => _repository.banUser( + targetUserId, + channelCid: channelCid, + timeout: timeout, + reason: reason, + shadow: shadow, + ipBan: ipBan, + deleteMessages: deleteMessages, + ); + + /// Removes the ban on [targetUserId]. + /// + /// Lifts the app-wide ban, or the ban on [channelCid] if one is given. + /// + /// A shadow ban lifts the same way as any other. + Future> unbanUser( + String targetUserId, { + String? channelCid, + }) => _repository.unbanUser( + targetUserId, + channelCid: channelCid, + ); + + /// Bans [targetUserId] without telling them, hiding their messages. + /// + /// The same as [banUser] with `shadow` set, and the other arguments behave + /// the same way. + /// + /// Remove it with [unbanUser]. + Future> shadowBan( + String targetUserId, { + String? channelCid, + Duration? timeout, + String? reason, + bool? ipBan, + DeleteType? deleteMessages, + }) => banUser( + targetUserId, + channelCid: channelCid, + timeout: timeout, + reason: reason, + shadow: true, + ipBan: ipBan, + deleteMessages: deleteMessages, + ); + + /// Flags [messageId] for moderator review. + /// + /// [reason] and [custom] are recorded with the flag. + /// + /// Returns the id of the flagged item in the review queue. + Future> flagMessage( + String messageId, { + String? reason, + Map? custom, + }) => _repository.flagMessage(messageId, reason: reason, custom: custom); + + /// Flags [userId] for moderator review. + /// + /// [reason] and [custom] are recorded with the flag. + /// + /// Returns the id of the flagged item in the review queue. + Future> flagUser( + String userId, { + String? reason, + Map? custom, + }) => _repository.flagUser(userId, reason: reason, custom: custom); +} diff --git a/packages/stream_chat/lib/src/core/api/moderation_api.dart b/packages/stream_chat/lib/src/core/api/moderation_api.dart index 175799451e..aeaf4b3679 100644 --- a/packages/stream_chat/lib/src/core/api/moderation_api.dart +++ b/packages/stream_chat/lib/src/core/api/moderation_api.dart @@ -9,124 +9,6 @@ class ModerationApi { final StreamHttpClient _client; - /// Mutes a user - Future muteUser(String userId) async { - final response = await _client.post( - '/moderation/mute', - data: {'target_id': userId}, - ); - return EmptyResponse.fromJson(response.data); - } - - /// Unmutes a user - Future unmuteUser(String userId) async { - final response = await _client.post( - '/moderation/unmute', - data: {'target_id': userId}, - ); - return EmptyResponse.fromJson(response.data); - } - - /// Mutes the channel - Future muteChannel( - String channelCid, { - Duration? expiration, - }) async { - final response = await _client.post( - '/moderation/mute/channel', - data: { - 'channel_cid': channelCid, - if (expiration != null) 'expiration': expiration.inMilliseconds, - }, - ); - return EmptyResponse.fromJson(response.data); - } - - /// Unmutes the channel - Future unmuteChannel( - String channelCid, - ) async { - final response = await _client.post( - '/moderation/unmute/channel', - data: {'channel_cid': channelCid}, - ); - return EmptyResponse.fromJson(response.data); - } - - /// Flag a message - Future flagMessage( - String messageId, - ) async { - final response = await _client.post( - '/moderation/flag', - data: {'target_message_id': messageId}, - ); - return EmptyResponse.fromJson(response.data); - } - - /// Unflag a message - Future unflagMessage( - String messageId, - ) async { - final response = await _client.post( - '/moderation/unflag', - data: {'target_message_id': messageId}, - ); - return EmptyResponse.fromJson(response.data); - } - - /// Flag a user - Future flagUser( - String userId, - ) async { - final response = await _client.post( - '/moderation/flag', - data: {'target_user_id': userId}, - ); - return EmptyResponse.fromJson(response.data); - } - - /// Unflag a user - Future unflagUser( - String userId, - ) async { - final response = await _client.post( - '/moderation/unflag', - data: {'target_user_id': userId}, - ); - return EmptyResponse.fromJson(response.data); - } - - /// Bans a user from all channels - Future banUser( - String targetUserId, { - Map? options, - }) async { - final response = await _client.post( - '/moderation/ban', - data: { - 'target_user_id': targetUserId, - if (options != null) ...options, - }, - ); - return EmptyResponse.fromJson(response.data); - } - - /// Remove global ban for a user - Future unbanUser( - String targetUserId, { - Map? options, - }) async { - final response = await _client.delete( - '/moderation/ban', - queryParameters: { - 'target_user_id': targetUserId, - if (options != null) ...options, - }, - ); - return EmptyResponse.fromJson(response.data); - } - /// Queries banned users. Future queryBannedUsers({ BannedUserFilter? filter, diff --git a/packages/stream_chat/lib/src/core/models/delete_type.dart b/packages/stream_chat/lib/src/core/models/delete_type.dart new file mode 100644 index 0000000000..b73a008946 --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/delete_type.dart @@ -0,0 +1,14 @@ +/// How thoroughly something is deleted. +/// +/// A delete type without a constant here can still be named by wrapping its +/// value: `DeleteType('soft')`. +extension type const DeleteType(String rawType) implements String { + /// Marked deleted, and can be restored. + static const soft = DeleteType('soft'); + + /// Marked deleted, and its content discarded. + static const pruning = DeleteType('pruning'); + + /// Removed for good. + static const hard = DeleteType('hard'); +} diff --git a/packages/stream_chat/lib/src/core/models/response/flag_response.dart b/packages/stream_chat/lib/src/core/models/response/flag_response.dart new file mode 100644 index 0000000000..7ccf7ad639 --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/response/flag_response.dart @@ -0,0 +1,24 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'flag_response.freezed.dart'; + +/// The outcome of flagging a message or a user for moderator review. +@freezed +class FlagResponse with _$FlagResponse { + /// Creates a new [FlagResponse]. + const FlagResponse({ + required this.duration, + required this.itemId, + }); + + /// How long the request took to handle, such as `4.21ms`. + @override + final String duration; + + /// Identifies the flagged item in the review queue. + /// + /// Moderator-facing review actions are addressed to this id rather than to + /// the message or user that was flagged. + @override + final String itemId; +} diff --git a/packages/stream_chat/lib/src/core/models/response/flag_response.freezed.dart b/packages/stream_chat/lib/src/core/models/response/flag_response.freezed.dart new file mode 100644 index 0000000000..09862a12d5 --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/response/flag_response.freezed.dart @@ -0,0 +1,81 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'flag_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$FlagResponse { + String get duration; + String get itemId; + + /// Create a copy of FlagResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $FlagResponseCopyWith get copyWith => _$FlagResponseCopyWithImpl( + this as FlagResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is FlagResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.itemId, itemId) || other.itemId == itemId)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration, itemId); + + @override + String toString() { + return 'FlagResponse(duration: $duration, itemId: $itemId)'; + } +} + +/// @nodoc +abstract mixin class $FlagResponseCopyWith<$Res> { + factory $FlagResponseCopyWith( + FlagResponse value, + $Res Function(FlagResponse) _then, + ) = _$FlagResponseCopyWithImpl; + @useResult + $Res call({String duration, String itemId}); +} + +/// @nodoc +class _$FlagResponseCopyWithImpl<$Res> implements $FlagResponseCopyWith<$Res> { + _$FlagResponseCopyWithImpl(this._self, this._then); + + final FlagResponse _self; + final $Res Function(FlagResponse) _then; + + /// Create a copy of FlagResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? itemId = null}) { + return _then( + FlagResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + itemId: null == itemId + ? _self.itemId + : itemId // ignore: cast_nullable_to_non_nullable + as String, + ), + ); + } +} diff --git a/packages/stream_chat/lib/src/core/models/response/mute_users_response.dart b/packages/stream_chat/lib/src/core/models/response/mute_users_response.dart new file mode 100644 index 0000000000..7ff0bffa88 --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/response/mute_users_response.dart @@ -0,0 +1,23 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'mute_users_response.freezed.dart'; + +/// The outcome of muting one or more users for the current user. +@freezed +class MuteUsersResponse with _$MuteUsersResponse { + /// Creates a new [MuteUsersResponse]. + const MuteUsersResponse({ + required this.duration, + this.nonExistingUsers = const [], + }); + + /// How long the request took to handle, such as `4.21ms`. + @override + final String duration; + + /// The ids that matched no user, so nothing was muted for them. + /// + /// Never all of them: a call where no id matches fails instead. + @override + final List nonExistingUsers; +} diff --git a/packages/stream_chat/lib/src/core/models/response/mute_users_response.freezed.dart b/packages/stream_chat/lib/src/core/models/response/mute_users_response.freezed.dart new file mode 100644 index 0000000000..960a98d8f6 --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/response/mute_users_response.freezed.dart @@ -0,0 +1,88 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'mute_users_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$MuteUsersResponse { + String get duration; + List get nonExistingUsers; + + /// Create a copy of MuteUsersResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $MuteResponseCopyWith get copyWith => _$MuteResponseCopyWithImpl( + this as MuteUsersResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is MuteUsersResponse && + (identical(other.duration, duration) || other.duration == duration) && + const DeepCollectionEquality().equals( + other.nonExistingUsers, + nonExistingUsers, + )); + } + + @override + int get hashCode => Object.hash( + runtimeType, + duration, + const DeepCollectionEquality().hash(nonExistingUsers), + ); + + @override + String toString() { + return 'MuteUsersResponse(duration: $duration, nonExistingUsers: $nonExistingUsers)'; + } +} + +/// @nodoc +abstract mixin class $MuteResponseCopyWith<$Res> { + factory $MuteResponseCopyWith( + MuteUsersResponse value, + $Res Function(MuteUsersResponse) _then, + ) = _$MuteResponseCopyWithImpl; + @useResult + $Res call({String duration, List nonExistingUsers}); +} + +/// @nodoc +class _$MuteResponseCopyWithImpl<$Res> implements $MuteResponseCopyWith<$Res> { + _$MuteResponseCopyWithImpl(this._self, this._then); + + final MuteUsersResponse _self; + final $Res Function(MuteUsersResponse) _then; + + /// Create a copy of MuteUsersResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? nonExistingUsers = null}) { + return _then( + MuteUsersResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + nonExistingUsers: null == nonExistingUsers + ? _self.nonExistingUsers + : nonExistingUsers // ignore: cast_nullable_to_non_nullable + as List, + ), + ); + } +} diff --git a/packages/stream_chat/lib/src/core/models/response/unmute_users_response.dart b/packages/stream_chat/lib/src/core/models/response/unmute_users_response.dart new file mode 100644 index 0000000000..712a1dc12c --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/response/unmute_users_response.dart @@ -0,0 +1,23 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'unmute_users_response.freezed.dart'; + +/// The outcome of removing the current user's mute on one or more users. +@freezed +class UnmuteUsersResponse with _$UnmuteUsersResponse { + /// Creates a new [UnmuteUsersResponse]. + const UnmuteUsersResponse({ + required this.duration, + this.nonExistingUsers = const [], + }); + + /// How long the request took to handle, such as `4.21ms`. + @override + final String duration; + + /// The ids that matched no user, so nothing was unmuted for them. + /// + /// Never all of them: a call where no id matches fails instead. + @override + final List nonExistingUsers; +} diff --git a/packages/stream_chat/lib/src/core/models/response/unmute_users_response.freezed.dart b/packages/stream_chat/lib/src/core/models/response/unmute_users_response.freezed.dart new file mode 100644 index 0000000000..5eea8ef5f0 --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/response/unmute_users_response.freezed.dart @@ -0,0 +1,88 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'unmute_users_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UnmuteUsersResponse { + String get duration; + List get nonExistingUsers; + + /// Create a copy of UnmuteUsersResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UnmuteResponseCopyWith get copyWith => _$UnmuteResponseCopyWithImpl( + this as UnmuteUsersResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UnmuteUsersResponse && + (identical(other.duration, duration) || other.duration == duration) && + const DeepCollectionEquality().equals( + other.nonExistingUsers, + nonExistingUsers, + )); + } + + @override + int get hashCode => Object.hash( + runtimeType, + duration, + const DeepCollectionEquality().hash(nonExistingUsers), + ); + + @override + String toString() { + return 'UnmuteUsersResponse(duration: $duration, nonExistingUsers: $nonExistingUsers)'; + } +} + +/// @nodoc +abstract mixin class $UnmuteResponseCopyWith<$Res> { + factory $UnmuteResponseCopyWith( + UnmuteUsersResponse value, + $Res Function(UnmuteUsersResponse) _then, + ) = _$UnmuteResponseCopyWithImpl; + @useResult + $Res call({String duration, List nonExistingUsers}); +} + +/// @nodoc +class _$UnmuteResponseCopyWithImpl<$Res> implements $UnmuteResponseCopyWith<$Res> { + _$UnmuteResponseCopyWithImpl(this._self, this._then); + + final UnmuteUsersResponse _self; + final $Res Function(UnmuteUsersResponse) _then; + + /// Create a copy of UnmuteUsersResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? nonExistingUsers = null}) { + return _then( + UnmuteUsersResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + nonExistingUsers: null == nonExistingUsers + ? _self.nonExistingUsers + : nonExistingUsers // ignore: cast_nullable_to_non_nullable + as List, + ), + ); + } +} diff --git a/packages/stream_chat/lib/src/repository/mapper/moderation_mapper.dart b/packages/stream_chat/lib/src/repository/mapper/moderation_mapper.dart new file mode 100644 index 0000000000..bc55e12eb3 --- /dev/null +++ b/packages/stream_chat/lib/src/repository/mapper/moderation_mapper.dart @@ -0,0 +1,38 @@ +import '../../../open_api/api.dart' as api; +import '../../core/models/delete_type.dart'; +import '../../core/models/response/flag_response.dart'; +import '../../core/models/response/mute_users_response.dart'; +import '../../core/models/response/unmute_users_response.dart'; + +/// Maps a generated [api.MuteResponse] to a [MuteUsersResponse]. +extension MuteResponseMapper on api.MuteResponse { + /// Converts this response into a [MuteUsersResponse]. + MuteUsersResponse toModel() => MuteUsersResponse( + duration: duration, + nonExistingUsers: nonExistingUsers ?? const [], + ); +} + +/// Maps a generated [api.UnmuteResponse] to an [UnmuteUsersResponse]. +extension UnmuteResponseMapper on api.UnmuteResponse { + /// Converts this response into an [UnmuteUsersResponse]. + UnmuteUsersResponse toModel() => UnmuteUsersResponse( + duration: duration, + nonExistingUsers: nonExistingUsers ?? const [], + ); +} + +/// Maps a generated [api.FlagItemResponse] to a [FlagResponse]. +extension FlagItemResponseMapper on api.FlagItemResponse { + /// Converts this response into a [FlagResponse]. + FlagResponse toModel() => FlagResponse( + duration: duration, + itemId: itemId, + ); +} + +/// Maps a [DeleteType] to the generated request type. +extension DeleteTypeMapper on DeleteType { + /// Converts this treatment into an [api.BanRequestDeleteMessages]. + api.BanRequestDeleteMessages toRequest() => api.BanRequestDeleteMessages.fromJson(rawType); +} diff --git a/packages/stream_chat/lib/src/repository/moderation_repository.dart b/packages/stream_chat/lib/src/repository/moderation_repository.dart new file mode 100644 index 0000000000..7be39d5459 --- /dev/null +++ b/packages/stream_chat/lib/src/repository/moderation_repository.dart @@ -0,0 +1,193 @@ +import 'dart:math' as math; + +import 'package:stream_core/stream_core.dart' show PatternMatching, Result; + +import '../../open_api/api.dart' as api; +import '../core/models/delete_type.dart'; +import '../core/models/response/flag_response.dart'; +import '../core/models/response/mute_users_response.dart'; +import '../core/models/response/unmute_users_response.dart'; +import 'mapper/moderation_mapper.dart'; +import 'mapper/result_mapper.dart'; + +int? _inMinutesAtLeastOne( + Duration? timeout, +) => timeout == null ? null : math.max(timeout.inMinutes, 1); + +/// Repository dedicated to moderation operations. +class ModerationRepository { + /// Creates a new moderation repository. + const ModerationRepository(this._api); + + final api.DefaultApi _api; + + /// Mutes every id in [userIds] for the current user. + /// + /// The mute lasts until it is removed. A [timeout] expires it after that + /// long, applied in whole minutes and never less than one. + /// + /// At least one id is required. + /// + /// Returns the ids among [userIds] that matched no user. + Future> muteUsers( + List userIds, { + Duration? timeout, + }) async { + final result = await _api.mute( + muteRequest: api.MuteRequest( + targetIds: userIds, + timeout: _inMinutesAtLeastOne(timeout), + ), + ); + + return result.map((response) => response.toModel()); + } + + /// Removes the current user's mute on every id in [userIds]. + /// + /// At least one id is required. + /// + /// Returns the ids among [userIds] that matched no user. + Future> unmuteUsers( + List userIds, + ) async { + final result = await _api.unmute( + unmuteRequest: api.UnmuteRequest( + targetIds: userIds, + ), + ); + + return result.map((response) => response.toModel()); + } + + /// Mutes the channel [channelCid] for the current user. + /// + /// The mute lasts until it is removed. An [expiration] expires it after + /// that long, and a zero one removes it straight away. + Future> muteChannel( + String channelCid, { + Duration? expiration, + }) async { + final result = await _api.muteChannel( + muteChannelRequest: api.MuteChannelRequest( + channelCids: [channelCid], + expiration: expiration?.inMilliseconds, + ), + ); + + return result.ignoreValue(); + } + + /// Removes the current user's mute on the channel [channelCid]. + Future> unmuteChannel( + String channelCid, + ) async { + final result = await _api.unmuteChannel( + unmuteChannelRequest: api.UnmuteChannelRequest( + channelCids: [channelCid], + ), + ); + + return result.ignoreValue(); + } + + /// Bans [targetUserId]. + /// + /// The ban covers the whole app, or only [channelCid] if one is given. + /// + /// It lasts until it is removed. A [timeout] expires it after that long, + /// applied in whole minutes and never less than one. + /// + /// If [shadow] is true, their messages stop reaching anyone else and they + /// are not told. + /// + /// If [ipBan] is true, the address they connected from is banned as well. + /// + /// [deleteMessages] decides what happens to the messages they already + /// sent, which are left alone when it is omitted. [reason] is recorded + /// with the ban. + Future> banUser( + String targetUserId, { + String? channelCid, + Duration? timeout, + String? reason, + bool? shadow, + bool? ipBan, + DeleteType? deleteMessages, + }) async { + final result = await _api.ban( + banRequest: api.BanRequest( + targetUserId: targetUserId, + channelCid: channelCid, + timeout: _inMinutesAtLeastOne(timeout), + reason: reason, + shadow: shadow, + ipBan: ipBan, + deleteMessages: deleteMessages?.toRequest(), + ), + ); + + return result.ignoreValue(); + } + + /// Removes the ban on [targetUserId]. + /// + /// Lifts the app-wide ban, or the ban on [channelCid] if one is given. + /// + /// A shadow ban lifts the same way as any other. + Future> unbanUser( + String targetUserId, { + String? channelCid, + }) async { + final result = await _api.unban( + targetUserId: targetUserId, + channelCid: channelCid, + ); + + return result.ignoreValue(); + } + + /// Flags [messageId] for moderator review. + /// + /// [reason] and [custom] are recorded with the flag. + /// + /// Returns the id of the flagged item in the review queue. + Future> flagMessage( + String messageId, { + String? reason, + Map? custom, + }) async { + final result = await _api.flag( + flagRequest: api.FlagRequest( + entityType: 'stream:chat:v1:message', + entityId: messageId, + reason: reason, + custom: custom, + ), + ); + + return result.map((response) => response.toModel()); + } + + /// Flags [userId] for moderator review. + /// + /// [reason] and [custom] are recorded with the flag. + /// + /// Returns the id of the flagged item in the review queue. + Future> flagUser( + String userId, { + String? reason, + Map? custom, + }) async { + final result = await _api.flag( + flagRequest: api.FlagRequest( + entityType: 'stream:user', + entityId: userId, + reason: reason, + custom: custom, + ), + ); + + return result.map((response) => response.toModel()); + } +} diff --git a/packages/stream_chat/lib/stream_chat.dart b/packages/stream_chat/lib/stream_chat.dart index f52031c6d9..29b9c47624 100644 --- a/packages/stream_chat/lib/stream_chat.dart +++ b/packages/stream_chat/lib/stream_chat.dart @@ -72,6 +72,7 @@ export 'src/client/channel/channel_read_helper.dart'; export 'src/client/channel_delivery_reporter.dart'; export 'src/client/client.dart'; export 'src/client/key_stroke_handler.dart'; +export 'src/client/moderation_client.dart'; export 'src/client/query_channels_result.dart'; export 'src/client/retry_policy.dart'; export 'src/core/api/attachment_file_uploader.dart'; @@ -92,6 +93,7 @@ export 'src/core/models/channel_mute.dart'; export 'src/core/models/channel_state.dart'; export 'src/core/models/chat_preferences.dart'; export 'src/core/models/command.dart'; +export 'src/core/models/delete_type.dart'; export 'src/core/models/device.dart'; export 'src/core/models/draft.dart'; export 'src/core/models/draft_message.dart'; @@ -119,13 +121,16 @@ export 'src/core/models/reaction_group.dart'; export 'src/core/models/read.dart'; export 'src/core/models/response/add_user_group_members_response.dart'; export 'src/core/models/response/create_user_group_response.dart'; +export 'src/core/models/response/flag_response.dart'; export 'src/core/models/response/get_user_group_response.dart'; export 'src/core/models/response/list_devices_response.dart'; export 'src/core/models/response/list_user_groups_response.dart'; +export 'src/core/models/response/mute_users_response.dart'; export 'src/core/models/response/og_attachment_response.dart'; export 'src/core/models/response/remove_user_group_members_response.dart'; export 'src/core/models/response/search_roles_response.dart'; export 'src/core/models/response/search_user_groups_response.dart'; +export 'src/core/models/response/unmute_users_response.dart'; export 'src/core/models/response/update_user_group_response.dart'; export 'src/core/models/role.dart'; export 'src/core/models/role_type.dart'; diff --git a/packages/stream_chat/test/src/client/channel/channel_test.dart b/packages/stream_chat/test/src/client/channel/channel_test.dart index 0b80d0e3b1..5a2223e697 100644 --- a/packages/stream_chat/test/src/client/channel/channel_test.dart +++ b/packages/stream_chat/test/src/client/channel/channel_test.dart @@ -38,6 +38,7 @@ void main() { group('Non-Initialized Channel', () { late final client = MockStreamChatClient(); + late final moderationClient = MockModerationClient(); const channelId = 'test-channel-id'; const channelType = 'test-channel-type'; late Channel channel; @@ -49,6 +50,7 @@ void main() { }); setUp(() { + when(() => client.moderation).thenReturn(moderationClient); channel = Channel(client, channelType, channelId); }); @@ -185,6 +187,7 @@ void main() { group('Initialized Channel', () { late final client = MockStreamChatClient(); + late final moderationClient = MockModerationClient(); const channelId = 'test-channel-id'; const channelType = 'test-channel-type'; const channelCid = '$channelType:$channelId'; @@ -214,6 +217,7 @@ void main() { // Setting up a initialized channel setUp(() { + when(() => client.moderation).thenReturn(moderationClient); final channelState = _generateChannelState( channelId, channelType, @@ -4531,44 +4535,44 @@ void main() { ).called(1); }); - test('`.mute`', () async { + test('`.mute` mutes the channel by cid', () async { when( - () => client.muteChannel( + () => moderationClient.muteChannel( channelCid, expiration: any(named: 'expiration'), ), - ).thenAnswer((_) async => EmptyResponse()); + ).thenAnswer((_) async => const Result.success(null)); final res = await channel.mute(); - expect(res, isNotNull); + expect(res.isSuccess, isTrue); verify( - () => client.muteChannel( + () => moderationClient.muteChannel( channelCid, expiration: any(named: 'expiration'), ), ).called(1); }); - test('`.mute with expiration`', () async { + test('`.mute` unmutes the channel once the expiration elapses', () async { const expiration = Duration(seconds: 3); when( - () => client.muteChannel( + () => moderationClient.muteChannel( channelCid, expiration: expiration, ), - ).thenAnswer((_) async => EmptyResponse()); + ).thenAnswer((_) async => const Result.success(null)); - when(() => client.unmuteChannel(channelCid)).thenAnswer((_) async => EmptyResponse()); + when(() => moderationClient.unmuteChannel(channelCid)).thenAnswer((_) async => const Result.success(null)); final res = await channel.mute(expiration: expiration); - expect(res, isNotNull); + expect(res.isSuccess, isTrue); verify( - () => client.muteChannel( + () => moderationClient.muteChannel( channelCid, expiration: expiration, ), @@ -4576,20 +4580,20 @@ void main() { // wait for expiration await Future.delayed(expiration); - verify(() => client.unmuteChannel(channelCid)).called(1); + verify(() => moderationClient.unmuteChannel(channelCid)).called(1); }); - test('`.unmute`', () async { + test('`.unmute` unmutes the channel by cid', () async { when( - () => client.unmuteChannel(channelCid), - ).thenAnswer((_) async => EmptyResponse()); + () => moderationClient.unmuteChannel(channelCid), + ).thenAnswer((_) async => const Result.success(null)); final res = await channel.unmute(); - expect(res, isNotNull); + expect(res.isSuccess, isTrue); verify( - () => client.unmuteChannel(channelCid), + () => moderationClient.unmuteChannel(channelCid), ).called(1); }); @@ -4641,74 +4645,85 @@ void main() { verify(() => client.disableSlowdown(channelId, channelType)).called(1); }); - test('`.banUser`', () async { + test('`.banMember` scopes the ban to the channel cid', () async { const userId = 'test-user-id'; - const options = {'key': 'value'}; when( - () => client.banUser( - userId, - {'type': channelType, 'id': channelId, ...options}, - ), - ).thenAnswer((_) async => EmptyResponse()); + () => moderationClient.banUser(userId, channelCid: channelCid, reason: 'spam'), + ).thenAnswer((_) async => const Result.success(null)); - final res = await channel.banMember(userId, options); + final res = await channel.banMember(userId, reason: 'spam'); - expect(res, isNotNull); + expect(res.isSuccess, isTrue); verify( - () => client.banUser( - userId, - {'type': channelType, 'id': channelId, ...options}, - ), + () => moderationClient.banUser(userId, channelCid: channelCid, reason: 'spam'), ).called(1); }); - test('`.unbanUser`', () async { + test('`.banMember` forwards every option to the client', () async { const userId = 'test-user-id'; + const timeout = Duration(minutes: 30); - when(() => client.unbanUser(userId, any())).thenAnswer((_) async => EmptyResponse()); - - final res = await channel.unbanMember(userId); + when( + () => moderationClient.banUser( + userId, + channelCid: channelCid, + timeout: timeout, + reason: 'spam', + shadow: true, + deleteMessages: DeleteType.hard, + ), + ).thenAnswer((_) async => const Result.success(null)); + + final res = await channel.banMember( + userId, + timeout: timeout, + reason: 'spam', + shadow: true, + deleteMessages: DeleteType.hard, + ); - expect(res, isNotNull); + expect(res.isSuccess, isTrue); - verify(() => client.unbanUser(userId, any())).called(1); + verify( + () => moderationClient.banUser( + userId, + channelCid: channelCid, + timeout: timeout, + reason: 'spam', + shadow: true, + deleteMessages: DeleteType.hard, + ), + ).called(1); }); - test('`.shadowBan`', () async { + test('`.unbanMember` scopes the unban to the channel cid', () async { const userId = 'test-user-id'; - const options = {'key': 'value'}; when( - () => client.shadowBan( - userId, - {'type': channelType, 'id': channelId, ...options}, - ), - ).thenAnswer((_) async => EmptyResponse()); + () => moderationClient.unbanUser(userId, channelCid: channelCid), + ).thenAnswer((_) async => const Result.success(null)); - final res = await channel.shadowBan(userId, options); + final res = await channel.unbanMember(userId); - expect(res, isNotNull); + expect(res.isSuccess, isTrue); - verify( - () => client.shadowBan( - userId, - {'type': channelType, 'id': channelId, ...options}, - ), - ).called(1); + verify(() => moderationClient.unbanUser(userId, channelCid: channelCid)).called(1); }); - test('`.removeShadowBan`', () async { + test('`.shadowBan` scopes the shadow ban to the channel cid', () async { const userId = 'test-user-id'; - when(() => client.removeShadowBan(userId, any())).thenAnswer((_) async => EmptyResponse()); + when( + () => moderationClient.shadowBan(userId, channelCid: channelCid), + ).thenAnswer((_) async => const Result.success(null)); - final res = await channel.removeShadowBan(userId); + final res = await channel.shadowBan(userId); - expect(res, isNotNull); + expect(res.isSuccess, isTrue); - verify(() => client.removeShadowBan(userId, any())).called(1); + verify(() => moderationClient.shadowBan(userId, channelCid: channelCid)).called(1); }); test('`.hide`', () async { @@ -4972,6 +4987,7 @@ void main() { group('Channel State Validation and Cooldown', () { late final client = MockStreamChatClient(); + late final moderationClient = MockModerationClient(); const channelId = 'test-channel-id'; const channelType = 'test-channel-type'; @@ -5022,6 +5038,7 @@ void main() { late Channel channel; setUp(() { + when(() => client.moderation).thenReturn(moderationClient); final channelState = _generateChannelState(channelId, channelType); channel = Channel.fromState(client, channelState); }); @@ -6348,6 +6365,7 @@ void main() { group('Retry functionality with parameter preservation', () { late final client = MockStreamChatClient(); + late final moderationClient = MockModerationClient(); const channelId = 'test-channel-id'; const channelType = 'test-channel-type'; late Channel channel; @@ -6367,6 +6385,7 @@ void main() { }); setUp(() { + when(() => client.moderation).thenReturn(moderationClient); final channelState = _generateChannelState(channelId, channelType); channel = Channel.fromState(client, channelState); }); diff --git a/packages/stream_chat/test/src/client/client_test.dart b/packages/stream_chat/test/src/client/client_test.dart index 3dd7736d4a..486405e07b 100644 --- a/packages/stream_chat/test/src/client/client_test.dart +++ b/packages/stream_chat/test/src/client/client_test.dart @@ -2571,36 +2571,6 @@ void main() { verifyNoMoreInteractions(fakeChatApi.channel); }); - test('`.muteChannel`', () async { - const channelType = 'test-channel-type'; - const channelId = 'test-channel-id'; - const channelCid = '$channelType:$channelId'; - - when(() => fakeChatApi.moderation.muteChannel(channelCid)).thenAnswer((_) async => EmptyResponse()); - - final res = await client.muteChannel(channelCid); - - expect(res, isNotNull); - - verify(() => fakeChatApi.moderation.muteChannel(channelCid)).called(1); - verifyNoMoreInteractions(fakeChatApi.moderation); - }); - - test('`.unmuteChannel`', () async { - const channelType = 'test-channel-type'; - const channelId = 'test-channel-id'; - const channelCid = '$channelType:$channelId'; - - when(() => fakeChatApi.moderation.unmuteChannel(channelCid)).thenAnswer((_) async => EmptyResponse()); - - final res = await client.unmuteChannel(channelCid); - - expect(res, isNotNull); - - verify(() => fakeChatApi.moderation.unmuteChannel(channelCid)).called(1); - verifyNoMoreInteractions(fakeChatApi.moderation); - }); - test('`.partialMemberUpdate with userId`', () async { const channelType = 'test-channel-type'; const channelId = 'test-channel-id'; @@ -3489,40 +3459,6 @@ void main() { verifyNoMoreInteractions(fakeChatApi.user); }); - test('`.banUser`', () async { - const userId = 'test-user-id'; - - when( - () => fakeChatApi.moderation.banUser(userId, options: any(named: 'options')), - ).thenAnswer((_) async => EmptyResponse()); - - final res = await client.banUser(userId); - - expect(res, isNotNull); - - verify( - () => fakeChatApi.moderation.banUser(userId, options: any(named: 'options')), - ).called(1); - verifyNoMoreInteractions(fakeChatApi.moderation); - }); - - test('`.unbanUser`', () async { - const userId = 'test-user-id'; - - when( - () => fakeChatApi.moderation.unbanUser(userId, options: any(named: 'options')), - ).thenAnswer((_) async => EmptyResponse()); - - final res = await client.unbanUser(userId); - - expect(res, isNotNull); - - verify( - () => fakeChatApi.moderation.unbanUser(userId, options: any(named: 'options')), - ).called(1); - verifyNoMoreInteractions(fakeChatApi.moderation); - }); - test('`.blockUser`', () async { const userId = 'test-user-id'; @@ -3834,118 +3770,6 @@ void main() { }, ); - test('`.shadowBan`', () async { - const userId = 'test-user-id'; - - when( - () => fakeChatApi.moderation.banUser(userId, options: {'shadow': true}), - ).thenAnswer((_) async => EmptyResponse()); - - final res = await client.shadowBan(userId); - - expect(res, isNotNull); - - verify( - () => fakeChatApi.moderation.banUser(userId, options: {'shadow': true}), - ).called(1); - verifyNoMoreInteractions(fakeChatApi.moderation); - }); - - test('`.removeShadowBan`', () async { - const userId = 'test-user-id'; - - when( - () => fakeChatApi.moderation.unbanUser(userId, options: {'shadow': true}), - ).thenAnswer((_) async => EmptyResponse()); - - final res = await client.removeShadowBan(userId); - - expect(res, isNotNull); - - verify( - () => fakeChatApi.moderation.unbanUser(userId, options: {'shadow': true}), - ).called(1); - verifyNoMoreInteractions(fakeChatApi.moderation); - }); - - test('`.muteUser`', () async { - const userId = 'test-user-id'; - - when(() => fakeChatApi.moderation.muteUser(userId)).thenAnswer((_) async => EmptyResponse()); - - final res = await client.muteUser(userId); - - expect(res, isNotNull); - - verify(() => fakeChatApi.moderation.muteUser(userId)).called(1); - verifyNoMoreInteractions(fakeChatApi.moderation); - }); - - test('`.unmuteUser`', () async { - const userId = 'test-user-id'; - - when(() => fakeChatApi.moderation.unmuteUser(userId)).thenAnswer((_) async => EmptyResponse()); - - final res = await client.unmuteUser(userId); - - expect(res, isNotNull); - - verify(() => fakeChatApi.moderation.unmuteUser(userId)).called(1); - verifyNoMoreInteractions(fakeChatApi.moderation); - }); - - test('`.flagMessage`', () async { - const messageId = 'test-message-id'; - - when(() => fakeChatApi.moderation.flagMessage(messageId)).thenAnswer((_) async => EmptyResponse()); - - final res = await client.flagMessage(messageId); - - expect(res, isNotNull); - - verify(() => fakeChatApi.moderation.flagMessage(messageId)).called(1); - verifyNoMoreInteractions(fakeChatApi.moderation); - }); - - test('`.unflagMessage`', () async { - const messageId = 'test-message-id'; - - when(() => fakeChatApi.moderation.unflagMessage(messageId)).thenAnswer((_) async => EmptyResponse()); - - final res = await client.unflagMessage(messageId); - - expect(res, isNotNull); - - verify(() => fakeChatApi.moderation.unflagMessage(messageId)).called(1); - verifyNoMoreInteractions(fakeChatApi.moderation); - }); - - test('`.flagUser`', () async { - const userId = 'test-message-id'; - - when(() => fakeChatApi.moderation.flagUser(userId)).thenAnswer((_) async => EmptyResponse()); - - final res = await client.flagUser(userId); - - expect(res, isNotNull); - - verify(() => fakeChatApi.moderation.flagUser(userId)).called(1); - verifyNoMoreInteractions(fakeChatApi.moderation); - }); - - test('`.unflagUser`', () async { - const userId = 'test-message-id'; - - when(() => fakeChatApi.moderation.unflagUser(userId)).thenAnswer((_) async => EmptyResponse()); - - final res = await client.unflagUser(userId); - - expect(res, isNotNull); - - verify(() => fakeChatApi.moderation.unflagUser(userId)).called(1); - verifyNoMoreInteractions(fakeChatApi.moderation); - }); - test('`.getActiveLiveLocations`', () async { final locations = [ Location( diff --git a/packages/stream_chat/test/src/client/moderation_client_test.dart b/packages/stream_chat/test/src/client/moderation_client_test.dart new file mode 100644 index 0000000000..1093f63429 --- /dev/null +++ b/packages/stream_chat/test/src/client/moderation_client_test.dart @@ -0,0 +1,493 @@ +import 'package:mocktail/mocktail.dart'; +import 'package:stream_chat/open_api/api.dart' as api; +import 'package:stream_chat/stream_chat.dart'; +import 'package:test/test.dart'; + +import '../mocks.dart'; + +void main() { + late MockDefaultApi defaultApi; + late StreamChatClient client; + + setUpAll(() { + registerFallbackValue(const api.MuteRequest(targetIds: [])); + registerFallbackValue(const api.UnmuteRequest(targetIds: [])); + registerFallbackValue(const api.MuteChannelRequest()); + registerFallbackValue(const api.UnmuteChannelRequest()); + registerFallbackValue(const api.BanRequest(targetUserId: '')); + registerFallbackValue(const api.FlagRequest(entityId: '', entityType: '')); + }); + + setUp(() { + defaultApi = MockDefaultApi(); + client = StreamChatClient('test-api-key', defaultApi: defaultApi); + }); + + test('StreamChatClient.moderation.muteUser sends the user id and returns a success', () async { + const request = api.MuteRequest(targetIds: ['test-user-id']); + + when(() => defaultApi.mute(muteRequest: request)).thenAnswer( + (_) async => const Result.success(api.MuteResponse(duration: '0.01ms')), + ); + + final res = await client.moderation.muteUser('test-user-id'); + + expect(res.isSuccess, isTrue); + verify(() => defaultApi.mute(muteRequest: request)).called(1); + verifyNoMoreInteractions(defaultApi); + }); + + test('StreamChatClient.moderation.muteUser sends the timeout in whole minutes', () async { + const request = api.MuteRequest(targetIds: ['test-user-id'], timeout: 90); + + when(() => defaultApi.mute(muteRequest: request)).thenAnswer( + (_) async => const Result.success(api.MuteResponse(duration: '0.01ms')), + ); + + await client.moderation.muteUser('test-user-id', timeout: const Duration(minutes: 90)); + + verify(() => defaultApi.mute(muteRequest: request)).called(1); + }); + + test('StreamChatClient.moderation.muteUser raises a sub-minute timeout to one minute', () async { + const request = api.MuteRequest(targetIds: ['test-user-id'], timeout: 1); + + when(() => defaultApi.mute(muteRequest: request)).thenAnswer( + (_) async => const Result.success(api.MuteResponse(duration: '0.01ms')), + ); + + await client.moderation.muteUser('test-user-id', timeout: const Duration(seconds: 30)); + + verify(() => defaultApi.mute(muteRequest: request)).called(1); + }); + + test('StreamChatClient.moderation.muteUser raises a zero timeout to one minute', () async { + const request = api.MuteRequest(targetIds: ['test-user-id'], timeout: 1); + + when(() => defaultApi.mute(muteRequest: request)).thenAnswer( + (_) async => const Result.success(api.MuteResponse(duration: '0.01ms')), + ); + + await client.moderation.muteUser('test-user-id', timeout: Duration.zero); + + verify(() => defaultApi.mute(muteRequest: request)).called(1); + }); + + test('StreamChatClient.moderation.muteUser omits the timeout when none is given', () async { + when(() => defaultApi.mute(muteRequest: any(named: 'muteRequest'))).thenAnswer( + (_) async => const Result.success(api.MuteResponse(duration: '0.01ms')), + ); + + await client.moderation.muteUser('test-user-id'); + + final sent = verify(() => defaultApi.mute(muteRequest: captureAny(named: 'muteRequest'))).captured.single; + expect((sent as api.MuteRequest).timeout, isNull); + }); + + test('StreamChatClient.moderation.muteUser returns the failure without throwing', () async { + const error = StreamClientException(message: 'boom'); + + when(() => defaultApi.mute(muteRequest: any(named: 'muteRequest'))).thenAnswer( + (_) async => const Result.failure(error), + ); + + final res = await client.moderation.muteUser('test-user-id'); + + expect(res.isFailure, isTrue); + expect(res.exceptionOrNull(), error); + }); + + test('StreamChatClient.moderation.muteUsers sends every id in one request', () async { + const request = api.MuteRequest(targetIds: ['jane', 'john'], timeout: 30); + + when(() => defaultApi.mute(muteRequest: request)).thenAnswer( + (_) async => const Result.success( + api.MuteResponse(duration: '0.01ms', nonExistingUsers: ['john']), + ), + ); + + final res = await client.moderation.muteUsers( + ['jane', 'john'], + timeout: const Duration(minutes: 30), + ); + + expect(res.getOrNull()?.nonExistingUsers, ['john']); + verify(() => defaultApi.mute(muteRequest: request)).called(1); + verifyNoMoreInteractions(defaultApi); + }); + + test('StreamChatClient.moderation.muteUsers returns the failure without throwing', () async { + const error = StreamClientException(message: 'boom'); + + when(() => defaultApi.mute(muteRequest: any(named: 'muteRequest'))).thenAnswer( + (_) async => const Result.failure(error), + ); + + final res = await client.moderation.muteUsers(['jane', 'john']); + + expect(res.exceptionOrNull(), error); + }); + + test('StreamChatClient.moderation.unmuteUser sends the user id and returns a success', () async { + const request = api.UnmuteRequest(targetIds: ['test-user-id']); + + when(() => defaultApi.unmute(unmuteRequest: request)).thenAnswer( + (_) async => const Result.success(api.UnmuteResponse(duration: '0.01ms')), + ); + + final res = await client.moderation.unmuteUser('test-user-id'); + + expect(res.isSuccess, isTrue); + verify(() => defaultApi.unmute(unmuteRequest: request)).called(1); + verifyNoMoreInteractions(defaultApi); + }); + + test('StreamChatClient.moderation.unmuteUser returns the failure without throwing', () async { + const error = StreamClientException(message: 'boom'); + + when(() => defaultApi.unmute(unmuteRequest: any(named: 'unmuteRequest'))).thenAnswer( + (_) async => const Result.failure(error), + ); + + final res = await client.moderation.unmuteUser('test-user-id'); + + expect(res.exceptionOrNull(), error); + }); + + test('StreamChatClient.moderation.unmuteUsers sends every id in one request', () async { + const request = api.UnmuteRequest(targetIds: ['jane', 'john']); + + when(() => defaultApi.unmute(unmuteRequest: request)).thenAnswer( + (_) async => const Result.success( + api.UnmuteResponse(duration: '0.01ms', nonExistingUsers: ['john']), + ), + ); + + final res = await client.moderation.unmuteUsers(['jane', 'john']); + + expect(res.getOrNull()?.nonExistingUsers, ['john']); + verify(() => defaultApi.unmute(unmuteRequest: request)).called(1); + verifyNoMoreInteractions(defaultApi); + }); + + test('StreamChatClient.moderation.unmuteUsers returns the failure without throwing', () async { + const error = StreamClientException(message: 'boom'); + + when(() => defaultApi.unmute(unmuteRequest: any(named: 'unmuteRequest'))).thenAnswer( + (_) async => const Result.failure(error), + ); + + final res = await client.moderation.unmuteUsers(['jane', 'john']); + + expect(res.exceptionOrNull(), error); + }); + + test('StreamChatClient.moderation.muteChannel sends the cid and returns a success', () async { + const request = api.MuteChannelRequest(channelCids: ['messaging:general']); + + when(() => defaultApi.muteChannel(muteChannelRequest: request)).thenAnswer( + (_) async => const Result.success(api.MuteChannelResponse(duration: '0.01ms')), + ); + + final res = await client.moderation.muteChannel('messaging:general'); + + expect(res.isSuccess, isTrue); + verify(() => defaultApi.muteChannel(muteChannelRequest: request)).called(1); + verifyNoMoreInteractions(defaultApi); + }); + + test('StreamChatClient.moderation.muteChannel sends the expiration in milliseconds', () async { + const request = api.MuteChannelRequest(channelCids: ['messaging:general'], expiration: 60000); + + when(() => defaultApi.muteChannel(muteChannelRequest: request)).thenAnswer( + (_) async => const Result.success(api.MuteChannelResponse(duration: '0.01ms')), + ); + + await client.moderation.muteChannel('messaging:general', expiration: const Duration(minutes: 1)); + + verify(() => defaultApi.muteChannel(muteChannelRequest: request)).called(1); + }); + + test('StreamChatClient.moderation.muteChannel returns the failure without throwing', () async { + const error = StreamClientException(message: 'boom'); + + when(() => defaultApi.muteChannel(muteChannelRequest: any(named: 'muteChannelRequest'))).thenAnswer( + (_) async => const Result.failure(error), + ); + + final res = await client.moderation.muteChannel('messaging:general'); + + expect(res.exceptionOrNull(), error); + }); + + test('StreamChatClient.moderation.unmuteChannel sends the cid and returns a success', () async { + const request = api.UnmuteChannelRequest(channelCids: ['messaging:general']); + + when(() => defaultApi.unmuteChannel(unmuteChannelRequest: request)).thenAnswer( + (_) async => const Result.success(api.UnmuteResponse(duration: '0.01ms')), + ); + + final res = await client.moderation.unmuteChannel('messaging:general'); + + expect(res.isSuccess, isTrue); + verify(() => defaultApi.unmuteChannel(unmuteChannelRequest: request)).called(1); + verifyNoMoreInteractions(defaultApi); + }); + + test('StreamChatClient.moderation.unmuteChannel returns the failure without throwing', () async { + const error = StreamClientException(message: 'boom'); + + when(() => defaultApi.unmuteChannel(unmuteChannelRequest: any(named: 'unmuteChannelRequest'))).thenAnswer( + (_) async => const Result.failure(error), + ); + + final res = await client.moderation.unmuteChannel('messaging:general'); + + expect(res.exceptionOrNull(), error); + }); + + test('StreamChatClient.moderation.banUser sends only the target when nothing else is given', () async { + const request = api.BanRequest(targetUserId: 'test-user-id'); + + when(() => defaultApi.ban(banRequest: request)).thenAnswer( + (_) async => const Result.success(api.ModerationBanResponse(duration: '0.01ms')), + ); + + final res = await client.moderation.banUser('test-user-id'); + + expect(res.isSuccess, isTrue); + verify(() => defaultApi.ban(banRequest: request)).called(1); + verifyNoMoreInteractions(defaultApi); + }); + + test('StreamChatClient.moderation.banUser sends every option to the generated request', () async { + const request = api.BanRequest( + targetUserId: 'test-user-id', + channelCid: 'messaging:general', + timeout: 30, + reason: 'spam', + shadow: true, + ipBan: true, + deleteMessages: api.BanRequestDeleteMessages.hard, + ); + + when(() => defaultApi.ban(banRequest: request)).thenAnswer( + (_) async => const Result.success(api.ModerationBanResponse(duration: '0.01ms')), + ); + + await client.moderation.banUser( + 'test-user-id', + channelCid: 'messaging:general', + timeout: const Duration(minutes: 30), + reason: 'spam', + shadow: true, + ipBan: true, + deleteMessages: DeleteType.hard, + ); + + verify(() => defaultApi.ban(banRequest: request)).called(1); + }); + + test('StreamChatClient.moderation.banUser sends a delete type it does not name', () async { + when(() => defaultApi.ban(banRequest: any(named: 'banRequest'))).thenAnswer( + (_) async => const Result.success(api.ModerationBanResponse(duration: '0.01ms')), + ); + + await client.moderation.banUser('test-user-id', deleteMessages: const DeleteType('quarantine')); + + final sent = verify(() => defaultApi.ban(banRequest: captureAny(named: 'banRequest'))).captured.single; + expect((sent as api.BanRequest).deleteMessages, 'quarantine'); + }); + + test('StreamChatClient.moderation.banUser raises a sub-minute timeout to one minute', () async { + const request = api.BanRequest(targetUserId: 'test-user-id', timeout: 1); + + when(() => defaultApi.ban(banRequest: request)).thenAnswer( + (_) async => const Result.success(api.ModerationBanResponse(duration: '0.01ms')), + ); + + await client.moderation.banUser('test-user-id', timeout: const Duration(seconds: 30)); + + verify(() => defaultApi.ban(banRequest: request)).called(1); + }); + + test('StreamChatClient.moderation.banUser returns the failure without throwing', () async { + const error = StreamClientException(message: 'boom'); + + when(() => defaultApi.ban(banRequest: any(named: 'banRequest'))).thenAnswer( + (_) async => const Result.failure(error), + ); + + final res = await client.moderation.banUser('test-user-id'); + + expect(res.isFailure, isTrue); + expect(res.exceptionOrNull(), error); + }); + + test('StreamChatClient.moderation.shadowBan sets the shadow flag on the ban', () async { + const request = api.BanRequest(targetUserId: 'test-user-id', shadow: true); + + when(() => defaultApi.ban(banRequest: request)).thenAnswer( + (_) async => const Result.success(api.ModerationBanResponse(duration: '0.01ms')), + ); + + final res = await client.moderation.shadowBan('test-user-id'); + + expect(res.isSuccess, isTrue); + verify(() => defaultApi.ban(banRequest: request)).called(1); + verifyNoMoreInteractions(defaultApi); + }); + + test('StreamChatClient.moderation.shadowBan returns the failure without throwing', () async { + const error = StreamClientException(message: 'boom'); + + when(() => defaultApi.ban(banRequest: any(named: 'banRequest'))).thenAnswer( + (_) async => const Result.failure(error), + ); + + final res = await client.moderation.shadowBan('test-user-id'); + + expect(res.exceptionOrNull(), error); + }); + + test('StreamChatClient.moderation.unbanUser sends the target as a query parameter', () async { + when(() => defaultApi.unban(targetUserId: 'test-user-id')).thenAnswer( + (_) async => const Result.success(api.UnbanResponse(duration: '0.01ms')), + ); + + final res = await client.moderation.unbanUser('test-user-id'); + + expect(res.isSuccess, isTrue); + verify(() => defaultApi.unban(targetUserId: 'test-user-id')).called(1); + verifyNoMoreInteractions(defaultApi); + }); + + test('StreamChatClient.moderation.unbanUser scopes the unban to a channel when a cid is given', () async { + when( + () => defaultApi.unban(targetUserId: 'test-user-id', channelCid: 'messaging:general'), + ).thenAnswer((_) async => const Result.success(api.UnbanResponse(duration: '0.01ms'))); + + await client.moderation.unbanUser('test-user-id', channelCid: 'messaging:general'); + + verify( + () => defaultApi.unban(targetUserId: 'test-user-id', channelCid: 'messaging:general'), + ).called(1); + }); + + test('StreamChatClient.moderation.unbanUser returns the failure without throwing', () async { + const error = StreamClientException(message: 'boom'); + + when(() => defaultApi.unban(targetUserId: any(named: 'targetUserId'))).thenAnswer( + (_) async => const Result.failure(error), + ); + + final res = await client.moderation.unbanUser('test-user-id'); + + expect(res.exceptionOrNull(), error); + }); + + test('StreamChatClient.moderation.flagMessage flags the message entity and returns the item', () async { + const request = api.FlagRequest( + entityType: 'stream:chat:v1:message', + entityId: 'test-message-id', + ); + + when(() => defaultApi.flag(flagRequest: request)).thenAnswer( + (_) async => const Result.success( + api.FlagItemResponse(duration: '0.01ms', itemId: 'review-item-7'), + ), + ); + + final res = await client.moderation.flagMessage('test-message-id'); + + expect(res.getOrNull(), const FlagResponse(duration: '0.01ms', itemId: 'review-item-7')); + verify(() => defaultApi.flag(flagRequest: request)).called(1); + verifyNoMoreInteractions(defaultApi); + }); + + test('StreamChatClient.moderation.flagMessage sends the reason and custom data', () async { + const request = api.FlagRequest( + entityType: 'stream:chat:v1:message', + entityId: 'test-message-id', + reason: 'spam', + custom: {'source': 'long-press'}, + ); + + when(() => defaultApi.flag(flagRequest: request)).thenAnswer( + (_) async => const Result.success( + api.FlagItemResponse(duration: '0.01ms', itemId: 'review-item-7'), + ), + ); + + await client.moderation.flagMessage( + 'test-message-id', + reason: 'spam', + custom: const {'source': 'long-press'}, + ); + + verify(() => defaultApi.flag(flagRequest: request)).called(1); + }); + + test('StreamChatClient.moderation.flagMessage returns the failure without throwing', () async { + const error = StreamClientException(message: 'boom'); + + when(() => defaultApi.flag(flagRequest: any(named: 'flagRequest'))).thenAnswer( + (_) async => const Result.failure(error), + ); + + final res = await client.moderation.flagMessage('test-message-id'); + + expect(res.exceptionOrNull(), error); + }); + + test('StreamChatClient.moderation.flagUser flags the user entity and returns the item', () async { + const request = api.FlagRequest(entityType: 'stream:user', entityId: 'test-user-id'); + + when(() => defaultApi.flag(flagRequest: request)).thenAnswer( + (_) async => const Result.success( + api.FlagItemResponse(duration: '0.01ms', itemId: 'review-item-9'), + ), + ); + + final res = await client.moderation.flagUser('test-user-id'); + + expect(res.getOrNull(), const FlagResponse(duration: '0.01ms', itemId: 'review-item-9')); + verify(() => defaultApi.flag(flagRequest: request)).called(1); + verifyNoMoreInteractions(defaultApi); + }); + + test('StreamChatClient.moderation.flagUser sends the reason and custom data', () async { + const request = api.FlagRequest( + entityType: 'stream:user', + entityId: 'test-user-id', + reason: 'harassment', + custom: {'source': 'profile'}, + ); + + when(() => defaultApi.flag(flagRequest: request)).thenAnswer( + (_) async => const Result.success( + api.FlagItemResponse(duration: '0.01ms', itemId: 'review-item-9'), + ), + ); + + await client.moderation.flagUser( + 'test-user-id', + reason: 'harassment', + custom: const {'source': 'profile'}, + ); + + verify(() => defaultApi.flag(flagRequest: request)).called(1); + }); + + test('StreamChatClient.moderation.flagUser returns the failure without throwing', () async { + const error = StreamClientException(message: 'boom'); + + when(() => defaultApi.flag(flagRequest: any(named: 'flagRequest'))).thenAnswer( + (_) async => const Result.failure(error), + ); + + final res = await client.moderation.flagUser('test-user-id'); + + expect(res.exceptionOrNull(), error); + }); +} diff --git a/packages/stream_chat/test/src/core/api/moderation_api_test.dart b/packages/stream_chat/test/src/core/api/moderation_api_test.dart deleted file mode 100644 index c5c9cfccfc..0000000000 --- a/packages/stream_chat/test/src/core/api/moderation_api_test.dart +++ /dev/null @@ -1,246 +0,0 @@ -import 'package:dio/dio.dart'; -import 'package:mocktail/mocktail.dart'; -import 'package:stream_chat/src/core/api/moderation_api.dart'; -import 'package:test/test.dart'; - -import '../../mocks.dart'; - -void main() { - Response successResponse(String path, {Object? data}) => Response( - data: data, - requestOptions: RequestOptions(path: path), - statusCode: 200, - ); - - late final client = MockHttpClient(); - late ModerationApi moderationApi; - - setUp(() { - moderationApi = ModerationApi(client); - }); - - test('muteUser', () async { - const userId = 'test-user-id'; - - const path = '/moderation/mute'; - - when( - () => client.post( - path, - data: {'target_id': userId}, - ), - ).thenAnswer((_) async => successResponse(path, data: {})); - - final res = await moderationApi.muteUser(userId); - - expect(res, isNotNull); - - verify(() => client.post(path, data: any(named: 'data'))).called(1); - verifyNoMoreInteractions(client); - }); - - test('unmuteUser', () async { - const userId = 'test-user-id'; - - const path = '/moderation/unmute'; - - when( - () => client.post( - path, - data: {'target_id': userId}, - ), - ).thenAnswer((_) async => successResponse(path, data: {})); - - final res = await moderationApi.unmuteUser(userId); - - expect(res, isNotNull); - - verify(() => client.post(path, data: any(named: 'data'))).called(1); - verifyNoMoreInteractions(client); - }); - - test('muteChannel', () async { - const channelCid = 'test-channel-cid'; - const expiration = Duration(days: 3); - - const path = '/moderation/mute/channel'; - - when( - () => client.post( - path, - data: { - 'channel_cid': channelCid, - 'expiration': expiration.inMilliseconds, - }, - ), - ).thenAnswer((_) async => successResponse(path, data: {})); - - final res = await moderationApi.muteChannel( - channelCid, - expiration: expiration, - ); - - expect(res, isNotNull); - - verify(() => client.post(path, data: any(named: 'data'))).called(1); - verifyNoMoreInteractions(client); - }); - - test('unmuteChannel', () async { - const channelCid = 'test-channel-cid'; - - const path = '/moderation/unmute/channel'; - - when( - () => client.post( - path, - data: {'channel_cid': channelCid}, - ), - ).thenAnswer((_) async => successResponse(path, data: {})); - - final res = await moderationApi.unmuteChannel(channelCid); - - expect(res, isNotNull); - - verify(() => client.post(path, data: any(named: 'data'))).called(1); - verifyNoMoreInteractions(client); - }); - - test('flagMessage', () async { - const messageId = 'test-message-id'; - - const path = '/moderation/flag'; - - when( - () => client.post( - path, - data: { - 'target_message_id': messageId, - }, - ), - ).thenAnswer((_) async => successResponse(path, data: {})); - - final res = await moderationApi.flagMessage(messageId); - - expect(res, isNotNull); - - verify(() => client.post(path, data: any(named: 'data'))).called(1); - verifyNoMoreInteractions(client); - }); - - test('unflagMessage', () async { - const messageId = 'test-message-id'; - - const path = '/moderation/unflag'; - - when( - () => client.post( - path, - data: { - 'target_message_id': messageId, - }, - ), - ).thenAnswer((_) async => successResponse(path, data: {})); - - final res = await moderationApi.unflagMessage(messageId); - - expect(res, isNotNull); - - verify(() => client.post(path, data: any(named: 'data'))).called(1); - verifyNoMoreInteractions(client); - }); - - test('flagUser', () async { - const userId = 'test-message-id'; - - const path = '/moderation/flag'; - - when( - () => client.post( - path, - data: { - 'target_user_id': userId, - }, - ), - ).thenAnswer((_) async => successResponse(path, data: {})); - - final res = await moderationApi.flagUser(userId); - - expect(res, isNotNull); - - verify(() => client.post(path, data: any(named: 'data'))).called(1); - verifyNoMoreInteractions(client); - }); - - test('unflagUser', () async { - const userId = 'test-message-id'; - - const path = '/moderation/unflag'; - - when( - () => client.post( - path, - data: { - 'target_user_id': userId, - }, - ), - ).thenAnswer((_) async => successResponse(path, data: {})); - - final res = await moderationApi.unflagUser(userId); - - expect(res, isNotNull); - - verify(() => client.post(path, data: any(named: 'data'))).called(1); - verifyNoMoreInteractions(client); - }); - - test('banUser', () async { - const targetUserId = 'test-target-user-id'; - const options = {'key': 'value'}; - - const path = '/moderation/ban'; - - when( - () => client.post( - path, - data: { - 'target_user_id': targetUserId, - ...options, - }, - ), - ).thenAnswer((_) async => successResponse(path, data: {})); - - final res = await moderationApi.banUser(targetUserId, options: options); - - expect(res, isNotNull); - - verify(() => client.post(path, data: any(named: 'data'))).called(1); - verifyNoMoreInteractions(client); - }); - - test('unbanUser', () async { - const targetUserId = 'test-target-user-id'; - const options = {'key': 'value'}; - - const path = '/moderation/ban'; - - when( - () => client.delete( - path, - queryParameters: { - 'target_user_id': targetUserId, - ...options, - }, - ), - ).thenAnswer((_) async => successResponse(path, data: {})); - - final res = await moderationApi.unbanUser(targetUserId, options: options); - - expect(res, isNotNull); - - verify( - () => client.delete(path, queryParameters: any(named: 'queryParameters')), - ).called(1); - verifyNoMoreInteractions(client); - }); -} diff --git a/packages/stream_chat/test/src/mocks.dart b/packages/stream_chat/test/src/mocks.dart index 6d442b9eb1..f222d2608e 100644 --- a/packages/stream_chat/test/src/mocks.dart +++ b/packages/stream_chat/test/src/mocks.dart @@ -4,6 +4,7 @@ import 'package:stream_chat/open_api/api.dart'; import 'package:stream_chat/src/client/channel/channel.dart'; import 'package:stream_chat/src/client/channel_delivery_reporter.dart'; import 'package:stream_chat/src/client/client.dart'; +import 'package:stream_chat/src/client/moderation_client.dart'; import 'package:stream_chat/src/core/api/attachment_file_uploader.dart'; import 'package:stream_chat/src/core/api/channel_api.dart'; import 'package:stream_chat/src/core/api/general_api.dart'; @@ -58,6 +59,8 @@ class MockModerationApi extends Mock implements ModerationApi {} class MockDefaultApi extends Mock implements DefaultApi {} +class MockModerationClient extends Mock implements ModerationClient {} + class MockGeneralApi extends Mock implements GeneralApi {} class MockAttachmentFileUploader extends Mock implements AttachmentFileUploader {} diff --git a/packages/stream_chat_flutter/example/lib/debug/actions/ban_user.dart b/packages/stream_chat_flutter/example/lib/debug/actions/ban_user.dart index 95869e154a..1c64677e72 100644 --- a/packages/stream_chat_flutter/example/lib/debug/actions/ban_user.dart +++ b/packages/stream_chat_flutter/example/lib/debug/actions/ban_user.dart @@ -28,8 +28,11 @@ class DebugBanUser extends StatelessWidget { final userId = value.trim(); try { debugPrint('[banUser] userId: $userId'); - final result = await client.banUser(userId); + final result = await client.moderation.banUser(userId); debugPrint('[banUser] completed: $result'); + if (result.exceptionOrNull() case final error?) { + showErrorDialog(context, error, 'Ban User'); + } } catch (e) { debugPrint('[banUser] failed: $e'); showErrorDialog(context, e, 'Ban User'); diff --git a/packages/stream_chat_flutter/example/lib/debug/actions/mute_user.dart b/packages/stream_chat_flutter/example/lib/debug/actions/mute_user.dart index e5ce8b726c..195d2855f1 100644 --- a/packages/stream_chat_flutter/example/lib/debug/actions/mute_user.dart +++ b/packages/stream_chat_flutter/example/lib/debug/actions/mute_user.dart @@ -28,8 +28,11 @@ class DebugMuteUser extends StatelessWidget { final userId = value.trim(); try { debugPrint('[muteUser] userId: $userId'); - final result = await client.muteUser(userId); + final result = await client.moderation.muteUser(userId); debugPrint('[muteUser] completed: $result'); + if (result.exceptionOrNull() case final error?) { + showErrorDialog(context, error, 'Mute User'); + } } catch (e) { debugPrint('[muteUser] failed: $e'); showErrorDialog(context, e, 'Mute User'); diff --git a/packages/stream_chat_flutter/example/lib/debug/actions/remove_shadow_ban.dart b/packages/stream_chat_flutter/example/lib/debug/actions/remove_shadow_ban.dart deleted file mode 100644 index 88a256e78c..0000000000 --- a/packages/stream_chat_flutter/example/lib/debug/actions/remove_shadow_ban.dart +++ /dev/null @@ -1,41 +0,0 @@ -// ignore_for_file: public_member_api_docs - -import 'package:flutter/material.dart'; -import 'package:stream_chat_flutter/stream_chat_flutter.dart'; - -import '../error_dialog.dart'; - -class DebugRemoveShadowBan extends StatelessWidget { - const DebugRemoveShadowBan({ - super.key, - required this.client, - }); - - final StreamChatClient client; - - @override - Widget build(BuildContext context) { - return Padding( - padding: const EdgeInsets.all(8), - child: TextField( - decoration: const InputDecoration( - labelText: 'Remove Shadow Ban', - hintText: 'User Id', - isDense: true, - border: OutlineInputBorder(), - ), - onSubmitted: (value) async { - final userId = value.trim(); - try { - debugPrint('[removeShadowBan] userId: $userId'); - final result = await client.removeShadowBan(userId); - debugPrint('[removeShadowBan] result: $result'); - } catch (e) { - debugPrint('[removeShadowBan] failed: $e'); - showErrorDialog(context, e, 'Remove Shadow Ban'); - } - }, - ), - ); - } -} diff --git a/packages/stream_chat_flutter/example/lib/debug/actions/shadow_ban.dart b/packages/stream_chat_flutter/example/lib/debug/actions/shadow_ban.dart index a5d01ff19a..1237ac0234 100644 --- a/packages/stream_chat_flutter/example/lib/debug/actions/shadow_ban.dart +++ b/packages/stream_chat_flutter/example/lib/debug/actions/shadow_ban.dart @@ -28,8 +28,11 @@ class DebugShadowBan extends StatelessWidget { final userId = value.trim(); try { debugPrint('[shadowBan] userId: $userId'); - final result = await client.shadowBan(userId); + final result = await client.moderation.shadowBan(userId); debugPrint('[shadowBan] completed: $result'); + if (result.exceptionOrNull() case final error?) { + showErrorDialog(context, error, 'Shadow Ban'); + } } catch (e) { debugPrint('[shadowBan] failed: $e'); showErrorDialog(context, e, 'Shadow Ban'); diff --git a/packages/stream_chat_flutter/example/lib/debug/actions/unban_user.dart b/packages/stream_chat_flutter/example/lib/debug/actions/unban_user.dart index de6b8489c9..59d798bda7 100644 --- a/packages/stream_chat_flutter/example/lib/debug/actions/unban_user.dart +++ b/packages/stream_chat_flutter/example/lib/debug/actions/unban_user.dart @@ -28,8 +28,11 @@ class DebugUnbanUser extends StatelessWidget { final userId = value.trim(); try { debugPrint('[unbanUser] userId: $userId'); - final result = await client.unbanUser(userId); + final result = await client.moderation.unbanUser(userId); debugPrint('[unbanUser] completed: $result'); + if (result.exceptionOrNull() case final error?) { + showErrorDialog(context, error, 'Unban User'); + } } catch (e) { debugPrint('[unbanUser] failed: $e'); showErrorDialog(context, e, 'Unban User'); diff --git a/packages/stream_chat_flutter/example/lib/debug/actions/unmute_user.dart b/packages/stream_chat_flutter/example/lib/debug/actions/unmute_user.dart index 55f7240062..8712012a23 100644 --- a/packages/stream_chat_flutter/example/lib/debug/actions/unmute_user.dart +++ b/packages/stream_chat_flutter/example/lib/debug/actions/unmute_user.dart @@ -28,8 +28,11 @@ class DebugUnmuteUser extends StatelessWidget { final userId = value.trim(); try { debugPrint('[unmuteUser] userId: $userId'); - final result = await client.unmuteUser(userId); + final result = await client.moderation.unmuteUser(userId); debugPrint('[unmuteUser] completed: $result'); + if (result.exceptionOrNull() case final error?) { + showErrorDialog(context, error, 'Unmute User'); + } } catch (e) { debugPrint('[unmuteUser] failed: $e'); showErrorDialog(context, e, 'Unmute User'); diff --git a/packages/stream_chat_flutter/example/lib/debug/channel_page.dart b/packages/stream_chat_flutter/example/lib/debug/channel_page.dart index 2de3ad701c..8a2f0a9d51 100644 --- a/packages/stream_chat_flutter/example/lib/debug/channel_page.dart +++ b/packages/stream_chat_flutter/example/lib/debug/channel_page.dart @@ -7,7 +7,6 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart'; import 'actions/add_user.dart'; import 'actions/ban_user.dart'; import 'actions/mute_user.dart'; -import 'actions/remove_shadow_ban.dart'; import 'actions/remove_user.dart'; import 'actions/shadow_ban.dart'; import 'actions/unban_user.dart'; @@ -80,8 +79,6 @@ class _DebugChannelPageState extends State { const SizedBox(height: 8), DebugShadowBan(client: _channel.client), const SizedBox(height: 8), - DebugRemoveShadowBan(client: _channel.client), - const SizedBox(height: 8), DebugAddUser(client: _channel.client, channel: _channel), const SizedBox(height: 8), DebugRemoveUser(client: _channel.client, channel: _channel), diff --git a/packages/stream_chat_flutter/lib/src/message_widget/stream_message_item.dart b/packages/stream_chat_flutter/lib/src/message_widget/stream_message_item.dart index 06d0ff07f1..9c7cd17266 100644 --- a/packages/stream_chat_flutter/lib/src/message_widget/stream_message_item.dart +++ b/packages/stream_chat_flutter/lib/src/message_widget/stream_message_item.dart @@ -967,8 +967,8 @@ class DefaultStreamMessageItem extends StatelessWidget { EditMessage() => props.onEditMessageTap?.call(action.message), FlagMessage() => _maybeFlagMessage(context, action.message, channel), MarkUnread() => channel.markUnread(action.message.id), - MuteUser() => channel.client.muteUser(action.user.id), - UnmuteUser() => channel.client.unmuteUser(action.user.id), + MuteUser() => channel.client.moderation.muteUser(action.user.id), + UnmuteUser() => channel.client.moderation.unmuteUser(action.user.id), BlockUser() => channel.client.blockUser(action.user.id), UnblockUser() => channel.client.unblockUser(action.user.id), PinMessage() => channel.pinMessage(action.message), @@ -1014,7 +1014,7 @@ class DefaultStreamMessageItem extends StatelessWidget { } // Shows a confirmation dialog before flagging the message. - Future _maybeFlagMessage( + Future?> _maybeFlagMessage( BuildContext context, Message message, Channel channel, @@ -1033,7 +1033,7 @@ class DefaultStreamMessageItem extends StatelessWidget { if (confirmFlag != true) return null; final messageId = message.id; - return channel.client.flagMessage(messageId); + return channel.client.moderation.flagMessage(messageId); } // Toggles a reaction: removes it if already present, otherwise sends it. diff --git a/packages/stream_chat_flutter_core/CHANGELOG.md b/packages/stream_chat_flutter_core/CHANGELOG.md index 5ec7132608..d9685299c1 100644 --- a/packages/stream_chat_flutter_core/CHANGELOG.md +++ b/packages/stream_chat_flutter_core/CHANGELOG.md @@ -7,6 +7,7 @@ - `StreamMessageSearchListController.messageFilter` is a `MessageSearchFilter?`, distinct from the `ChannelFilter` its `filter` takes. - The sort argument on every list controller is typed `List`, `List` and so on, rather than `SortOrder`. On the controllers that have a default, the `sort` property is non-nullable: leaving it unset selects that default, and `ChannelSort.empty` / `MemberSort.empty` / … query with the ordering the API applies on its own. - `defaultChannelListSort`, `defaultMemberListSort`, `defaultUserListSort`, `defaultDraftListSort`, `defaultMessageReminderListSort` and `defaultPollVoteListSort` are removed. Use `ChannelSort.defaultSort`, `MemberSort.defaultSort` and so on from `stream_chat`. Leaving a controller's sort unset still applies the same ordering. +- `StreamChannelListController.muteChannel` and `unmuteChannel` return a `Result` instead of throwing. 🐞 Fixed diff --git a/packages/stream_chat_flutter_core/lib/src/stream_channel_list_controller.dart b/packages/stream_chat_flutter_core/lib/src/stream_channel_list_controller.dart index f4a7a60967..aa7d81f943 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_channel_list_controller.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_channel_list_controller.dart @@ -286,15 +286,13 @@ class StreamChannelListController extends PagedValueNotifier { await channel.delete(); } - /// Mutes the [channel] and updates the list. - Future muteChannel(Channel channel) async { - await channel.mute(); - } + /// Mutes the [channel] for the current user. + /// + /// The mute lasts until it is removed. + Future> muteChannel(Channel channel) => channel.mute(); - /// Un-mutes the [channel] and updates the list. - Future unmuteChannel(Channel channel) async { - await channel.unmute(); - } + /// Removes the current user's mute on the [channel]. + Future> unmuteChannel(Channel channel) => channel.unmute(); /// Event listener, which can be set in order to listen /// [client] web-socket events. diff --git a/packages/stream_chat_flutter_core/test/stream_channel_list_controller_test.dart b/packages/stream_chat_flutter_core/test/stream_channel_list_controller_test.dart index 54fd77a481..0486a58d14 100644 --- a/packages/stream_chat_flutter_core/test/stream_channel_list_controller_test.dart +++ b/packages/stream_chat_flutter_core/test/stream_channel_list_controller_test.dart @@ -446,4 +446,28 @@ void main() { expect(controller.value.isSuccess, isTrue); }); + + test('muteChannel passes on the failure instead of throwing', () async { + const error = StreamClientException(message: 'boom'); + final channel = MockChannel(); + when(channel.mute).thenAnswer((_) async => const Result.failure(error)); + + final controller = StreamChannelListController(client: client); + final res = await controller.muteChannel(channel); + + expect(res.isFailure, isTrue); + expect(res.exceptionOrNull(), error); + }); + + test('unmuteChannel passes on the failure instead of throwing', () async { + const error = StreamClientException(message: 'boom'); + final channel = MockChannel(); + when(channel.unmute).thenAnswer((_) async => const Result.failure(error)); + + final controller = StreamChannelListController(client: client); + final res = await controller.unmuteChannel(channel); + + expect(res.isFailure, isTrue); + expect(res.exceptionOrNull(), error); + }); } diff --git a/sample_app/lib/widgets/all_members_sheet.dart b/sample_app/lib/widgets/all_members_sheet.dart index c61767d482..36f73dabe4 100644 --- a/sample_app/lib/widgets/all_members_sheet.dart +++ b/sample_app/lib/widgets/all_members_sheet.dart @@ -393,8 +393,8 @@ Future _onContactDetailAction( ContactDetailAction action, ) async => switch (action) { SendDirectMessage(:final user) => _openDirectChannel(context, user), - MuteUser(:final user) => StreamChat.of(context).client.muteUser(user.id), - UnmuteUser(:final user) => StreamChat.of(context).client.unmuteUser(user.id), + MuteUser(:final user) => StreamChat.of(context).client.moderation.muteUser(user.id), + UnmuteUser(:final user) => StreamChat.of(context).client.moderation.unmuteUser(user.id), BlockUser(:final user) => StreamChat.of(context).client.blockUser(user.id), }; diff --git a/sample_app/lib/widgets/channel_list.dart b/sample_app/lib/widgets/channel_list.dart index 096fad8003..e44e454182 100644 --- a/sample_app/lib/widgets/channel_list.dart +++ b/sample_app/lib/widgets/channel_list.dart @@ -228,8 +228,8 @@ Future _onChannelDetailAction( ViewChannelInfo(:final user) => _pushChannelInfo(context, channel, user), PinChannel() => channel.pin(), UnpinChannel() => channel.unpin(), - MuteChannelMember(:final user) => client.muteUser(user.id), - UnmuteChannelMember(:final user) => client.unmuteUser(user.id), + MuteChannelMember(:final user) => client.moderation.muteUser(user.id), + UnmuteChannelMember(:final user) => client.moderation.unmuteUser(user.id), BlockChannelMember(:final user) => client.blockUser(user.id), LeaveChannel() => _maybeLeaveChannel(context, channel), DeleteChannel() => _maybeDeleteChannel(context, channel), From ef92b237f9d00379342442562f84d224d180b47f Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Tue, 29 Sep 2026 13:35:25 +0200 Subject: [PATCH 27/36] docs(llc): describe what a caller observes, not what the server does (#3018) Co-authored-by: Claude Opus 5 --- STYLE_GUIDE.md | 7 ++++- .../lib/src/client/channel/channel.dart | 25 +++++++-------- .../channel/channel_capability_check.dart | 4 +-- .../client/channel/channel_client_state.dart | 23 +++++++------- .../channel/channel_state_mutations.dart | 4 +-- .../src/client/channel_delivery_reporter.dart | 6 ++-- .../stream_chat/lib/src/client/client.dart | 23 +++++++------- .../lib/src/client/query_channels_result.dart | 7 ++--- .../lib/src/client/sync_manager.dart | 27 ++++++++-------- .../lib/src/core/api/channel_api.dart | 5 +-- .../lib/src/core/api/general_api.dart | 2 +- .../lib/src/core/api/moderation_api.dart | 3 +- .../lib/src/core/api/responses.dart | 11 +++---- .../lib/src/core/api/user_api.dart | 4 +-- .../src/core/error/stream_chat_exception.dart | 4 +-- .../lib/src/core/models/attachment.dart | 4 +-- .../lib/src/core/models/banned_user.dart | 4 +-- .../lib/src/core/models/channel_config.dart | 4 +-- .../lib/src/core/models/channel_state.dart | 10 +++--- .../lib/src/core/models/chat_preferences.dart | 3 +- .../lib/src/core/models/command.dart | 8 ++--- .../lib/src/core/models/draft.dart | 4 +-- .../lib/src/core/models/draft_message.dart | 5 +-- .../lib/src/core/models/location.dart | 2 +- .../lib/src/core/models/member.dart | 4 +-- .../lib/src/core/models/message.dart | 16 +++++----- .../lib/src/core/models/message_reminder.dart | 4 +-- .../stream_chat/lib/src/core/models/poll.dart | 4 +-- .../lib/src/core/models/poll_vote.dart | 4 +-- .../src/core/models/predefined_filter.dart | 31 +++++++++---------- .../lib/src/core/models/push_provider.dart | 4 +-- .../lib/src/core/models/reaction.dart | 4 +-- .../add_user_group_members_response.dart | 4 +-- .../response/create_user_group_response.dart | 4 +-- .../response/get_user_group_response.dart | 4 +-- .../response/list_devices_response.dart | 4 +-- .../response/list_user_groups_response.dart | 4 +-- .../response/og_attachment_response.dart | 6 ++-- .../remove_user_group_members_response.dart | 4 +-- .../response/search_roles_response.dart | 6 ++-- .../response/search_user_groups_response.dart | 4 +-- .../response/update_user_group_response.dart | 4 +-- .../lib/src/core/models/role_type.dart | 4 +-- .../lib/src/core/models/thread.dart | 8 ++--- .../stream_chat/lib/src/core/models/user.dart | 4 +-- .../lib/src/core/models/user_group.dart | 3 +- .../lib/src/core/util/message_merging.dart | 2 +- .../lib/src/db/chat_persistence_client.dart | 12 +++---- packages/stream_chat/lib/src/event_type.dart | 2 +- .../lib/src/repository/roles_repository.dart | 2 +- .../repository/user_groups_repository.dart | 2 +- .../lib/src/ws/connect_request.dart | 2 +- .../lib/src/ws/connection_manager.dart | 22 ++++++------- 53 files changed, 184 insertions(+), 193 deletions(-) diff --git a/STYLE_GUIDE.md b/STYLE_GUIDE.md index b9dbb8b8bf..ad42b129b1 100644 --- a/STYLE_GUIDE.md +++ b/STYLE_GUIDE.md @@ -531,7 +531,7 @@ they can observe what their own call does: /// when omitted. It is applied in whole minutes and never less than one. ``` -Two things this does **not** forbid: +Three things this does **not** forbid: - **Naming a concept the API owns and the caller works in** — a channel `cid`, a user's `role`, a `team`. Those are domain vocabulary, not transport details. @@ -539,6 +539,11 @@ Two things this does **not** forbid: endpoint moved, what is in beta, and what a feature flag gates belong in `CHANGELOG.md`, `migrations/*.md` and the PR body — those are read once, alongside a version, and are expected to date. +- **Where the work happens, when the caller can see the difference.** *"The server + fetches the page itself, so a URL it cannot scrape comes back as a failure"* is why + an intranet URL fails — checkable in one call, and no change to the endpoint makes + it untrue. Apply the rule's own reasoning as the test: if the caller cannot observe + the difference, or an API redesign would falsify the sentence, this is not it. When the wire shape genuinely explains a piece of code, put it in the plan or the PR, and leave the code saying what it does. diff --git a/packages/stream_chat/lib/src/client/channel/channel.dart b/packages/stream_chat/lib/src/client/channel/channel.dart index 3df5d842bc..05c70a1908 100644 --- a/packages/stream_chat/lib/src/client/channel/channel.dart +++ b/packages/stream_chat/lib/src/client/channel/channel.dart @@ -821,7 +821,7 @@ class Channel { } } - // Validate the final message before sending it to the server. + // Validate the final message before sending it. if (MessageRules.canUpload(message) != true) { _logger.w(() => 'Message is not valid for sending, removing it'); @@ -1033,9 +1033,9 @@ class Channel { /// Deletes the [message] for everyone. /// - /// If [hard] is true, the message is permanently deleted from the server - /// and cannot be recovered. In this case, any attachments associated with the - /// message are also deleted from the server. + /// If [hard] is true, the message is permanently deleted and cannot be + /// recovered. In this case, any attachments associated with the message are + /// deleted as well. Future deleteMessage(Message message, {bool hard = false}) { final deletionScope = MessageDeleteScope.deleteForAll(hard: hard); @@ -1057,13 +1057,12 @@ class Channel { // The [scope] defines whether to delete the message for everyone or just // for the current user. // - // If the message is a local message (not yet sent to the server) or a bounced + // If the message is a local message (not yet sent) or a bounced // error message, it is deleted locally without making an API call. // // If the message is deleted for everyone and [scope.hard] is true, the - // message is permanently deleted from the server and cannot be recovered. - // In this case, any attachments associated with the message are also deleted - // from the server. + // message is permanently deleted and cannot be recovered. In this case, any + // attachments associated with the message are deleted as well. Future _deleteMessage( Message message, { required MessageDeleteScope scope, @@ -1071,7 +1070,7 @@ class Channel { _checkInitialized(); // Directly deleting the local messages and bounced error messages as they - // are not available on the server. + // were never sent. if (message.remoteCreatedAt == null || message.isBouncedWithError) { _deleteLocalMessage(message); // Returning empty response to mark the api call as success. @@ -1104,7 +1103,7 @@ class Channel { ); state?.deleteMessage(deletedMessage, hardDelete: scope.hard); - // If hard delete, also delete the attachments from the server. + // If hard delete, also delete the uploaded attachments. if (scope.hard) _deleteMessageAttachments(deletedMessage); return response; @@ -1124,7 +1123,7 @@ class Channel { } } - // Deletes a local [message] that is not yet sent to the server. + // Deletes a local [message] that is not yet sent. // // This is typically called when a user wants to delete a message that they // have composed but not yet sent, or if a message failed to send and the user @@ -1147,8 +1146,8 @@ class Channel { ); } - // Deletes all the attachments associated with the given [message] - // from the server. This is typically called when a message is hard deleted. + // Deletes all the uploaded attachments associated with the given [message]. + // This is typically called when a message is hard deleted. Future _deleteMessageAttachments(Message message) async { final attachments = message.attachments; final deleteFutures = attachments.map((it) async { diff --git a/packages/stream_chat/lib/src/client/channel/channel_capability_check.dart b/packages/stream_chat/lib/src/client/channel/channel_capability_check.dart index c79245ac4f..00816ae2f3 100644 --- a/packages/stream_chat/lib/src/client/channel/channel_capability_check.dart +++ b/packages/stream_chat/lib/src/client/channel/channel_capability_check.dart @@ -154,12 +154,12 @@ extension ChannelCapabilityCheck on Channel { } /// True, if unread counts for this channel should be tracked locally, - /// on-device, rather than relying on the server. + /// on-device. /// /// This is the case when [StreamChatClient.isLocalUnreadCountEnabled] is /// enabled and the channel doesn't support read receipts (for example, /// livestream channel types that disable read events). Channels that - /// support read receipts always rely on server-driven unread counts. + /// support read receipts never track them locally. bool get usesLocalUnreadCount { return client.isLocalUnreadCountEnabled && !canUseReadReceipts; } diff --git a/packages/stream_chat/lib/src/client/channel/channel_client_state.dart b/packages/stream_chat/lib/src/client/channel/channel_client_state.dart index 06baebe80e..59cdecfd56 100644 --- a/packages/stream_chat/lib/src/client/channel/channel_client_state.dart +++ b/packages/stream_chat/lib/src/client/channel/channel_client_state.dart @@ -410,8 +410,8 @@ class ChannelClientState { /// Records whether the current user has an outstanding manual mark-unread. /// - /// Only meant for [ChannelEventHandler], which applies the read events the - /// server sends for the current user. + /// Only meant for [ChannelEventHandler], which applies the current user's + /// read events. @internal set isMarkedAsUnread(bool markedAsUnread) => _isMarkedAsUnread = markedAsUnread; @@ -420,14 +420,15 @@ class ChannelClientState { /// Marks the channel as read locally, without making a network request. /// /// Used for channels that track unread counts locally (see - /// [Channel.usesLocalUnreadCount]), since the server rejects the mark-read - /// endpoint for channels that have read events disabled. + /// [Channel.usesLocalUnreadCount]), since marking read fails for channels + /// that have read events disabled. /// /// [messageId] only sets the resulting [Read.lastReadMessageId]; it does not /// narrow which messages stay unread. The count always drops to zero and /// [Read.lastRead] is always `now`, so messages newer than [messageId] are - /// marked read as well. This differs from the server, which recomputes the - /// count as the number of messages after [messageId], and from + /// marked read as well. This differs from [Channel.markRead] on a channel + /// with read events enabled, which recomputes the count as the number of + /// messages after [messageId], and from /// [markUnreadLocally], which does recompute from the locally-known /// messages. Callers that need a partial boundary should use /// [markUnreadLocally] instead. @@ -453,7 +454,7 @@ class ChannelClientState { // new read boundary just made ineligible. `delivery_events` is configured // independently of `read_events`, so a channel tracking unread counts // locally can still have delivery receipts enabled. Mirrors what the - // `message.read` event listener does for server-driven channels. + // `message.read` event listener does for channels with read events enabled. _client.channelDeliveryReporter.reconcileDelivery([_channel]); _isMarkedAsUnread = false; @@ -467,8 +468,8 @@ class ChannelClientState { /// as unread. /// /// Used for channels that track unread counts locally (see - /// [Channel.usesLocalUnreadCount]), since the server rejects the - /// mark-unread endpoint for channels that have read events disabled. + /// [Channel.usesLocalUnreadCount]), since marking unread fails for channels + /// that have read events disabled. void markUnreadLocally({ required DateTime lastRead, String? lastReadMessageId, @@ -580,8 +581,8 @@ class ChannelClientState { ); } - /// Applies a [remoteState] received from the server or offline storage - /// (e.g. a `query`/`watch` response), merging it into local state. + /// Applies a [remoteState] from a `query`/`watch` response or offline + /// storage, merging it into local state. /// /// Unlike [updateChannelState], this preserves the current user's /// locally-tracked read state for channels that track unread counts diff --git a/packages/stream_chat/lib/src/client/channel/channel_state_mutations.dart b/packages/stream_chat/lib/src/client/channel/channel_state_mutations.dart index e7abb05848..0f01a96697 100644 --- a/packages/stream_chat/lib/src/client/channel/channel_state_mutations.dart +++ b/packages/stream_chat/lib/src/client/channel/channel_state_mutations.dart @@ -60,8 +60,8 @@ class ChannelStateMutations { // Decrement the locally-tracked unread count for hard-deleted // messages that would have counted as unread. Soft-deleted messages // keep their slot. Only applies to channels that track unread counts - // locally (see [Channel.usesLocalUnreadCount]) — server-driven - // channels get corrected counts from server read events instead. + // locally (see [Channel.usesLocalUnreadCount]) — other channels get + // corrected counts from read events instead. if (hardDelete && _channel.usesLocalUnreadCount && MessageRules.canCountAsUnread(message, _channel)) { _state.unreadCount = math.max(0, _state.unreadCount - 1); } diff --git a/packages/stream_chat/lib/src/client/channel_delivery_reporter.dart b/packages/stream_chat/lib/src/client/channel_delivery_reporter.dart index fe379390e1..ff4ec969a6 100644 --- a/packages/stream_chat/lib/src/client/channel_delivery_reporter.dart +++ b/packages/stream_chat/lib/src/client/channel_delivery_reporter.dart @@ -18,13 +18,13 @@ typedef MarkChannelsDelivered = /// Manages the delivery reporting for channel messages. /// -/// Collects channels that need delivery acknowledgments and efficiently -/// reports them to the server. +/// Collects channels that need delivery acknowledgments and reports them in +/// batches. class ChannelDeliveryReporter { /// Creates a new channel delivery reporter. /// /// The [onMarkChannelsDelivered] callback is invoked when delivery receipts - /// are ready to be sent to the server. + /// are ready to be sent. /// /// The [throttleDuration] controls how frequently delivery receipts are sent. /// diff --git a/packages/stream_chat/lib/src/client/client.dart b/packages/stream_chat/lib/src/client/client.dart index 8421cc9fc2..83045af969 100644 --- a/packages/stream_chat/lib/src/client/client.dart +++ b/packages/stream_chat/lib/src/client/client.dart @@ -103,7 +103,7 @@ import 'sync_manager.dart'; /// You can sign up for a Stream account at https://getstream.io/chat/ /// /// The Chat client will manage API call, event handling and manage the -/// websocket connection to Stream Chat servers. +/// WebSocket connection to Stream Chat. /// /// ```dart /// final client = StreamChatClient("stream-chat-api-key"); @@ -306,14 +306,13 @@ class StreamChatClient { /// types). /// /// Channels with read events disabled never receive `message.read` / - /// `notification.mark_*` events from the server, and reject the mark-read - /// endpoint, so their unread count is always `0` by default. + /// `notification.mark_*` events, and marking them read fails, so their + /// unread count is always `0` by default. /// /// When this is `true`, [Channel.unreadCount] is instead incremented /// locally as new messages arrive and reset locally (with no network /// request) when [Channel.markRead] is called, for those channels only. - /// Channels with read events enabled are unaffected and keep relying on - /// server-driven unread counts. + /// Channels with read events enabled are unaffected. final bool isLocalUnreadCountEnabled; /// Returns `True` if the [chatPersistenceClient] is available and connected. @@ -328,8 +327,8 @@ class StreamChatClient { /// The retry policy options getter RetryPolicy get retryPolicy => _retryPolicy; - /// Whether the client should automatically refresh local state from the - /// server when the WebSocket connection recovers. + /// Whether the client should automatically refresh local state when the + /// WebSocket connection recovers. /// /// When `true` (default), the client re-queries the channels that were /// active before the connection was lost. @@ -706,8 +705,8 @@ class StreamChatClient { /// identifier (optionally interpolated with [filterValues] and [sortValues]) /// can be supplied. /// - /// Use [queryChannelsWithResult] if you also need the server-resolved - /// [PredefinedFilter] spec. + /// Use [queryChannelsWithResult] if you also need the resolved + /// [PredefinedFilter]. Stream> queryChannels({ ChannelFilter? filter, List? channelStateSort, @@ -737,8 +736,8 @@ class StreamChatClient { ).map((result) => result.channels); /// Requests channels with a given query, yielding a [QueryChannelsResult] - /// that carries both the live channel list and the server-resolved - /// [PredefinedFilter] spec (when one is associated with the query). + /// that carries both the live channel list and the resolved + /// [PredefinedFilter] (when the query names one). /// /// Yields the offline-cached result first (when available), followed by /// the online result. Concurrent identical online queries are coalesced @@ -2375,7 +2374,7 @@ class StreamChatClient { /// Creates a new user group, optionally with initial members. /// - /// [id] is generated by the server when omitted. + /// An [id] is generated when omitted. Future> createUserGroup( String name, { String? id, diff --git a/packages/stream_chat/lib/src/client/query_channels_result.dart b/packages/stream_chat/lib/src/client/query_channels_result.dart index c28e3740e0..c81659ac7a 100644 --- a/packages/stream_chat/lib/src/client/query_channels_result.dart +++ b/packages/stream_chat/lib/src/client/query_channels_result.dart @@ -4,8 +4,7 @@ import 'channel/channel.dart'; /// The result of a `queryChannelsWithResult` call on [StreamChatClient]. /// /// Carries the live [Channel] instances matching the query alongside the -/// server-resolved [PredefinedFilter] spec (when one is associated with the -/// query). +/// [PredefinedFilter] the query named, as resolved for it. class QueryChannelsResult { /// Creates a new [QueryChannelsResult]. const QueryChannelsResult({ @@ -16,7 +15,7 @@ class QueryChannelsResult { /// The live [Channel] instances matching the query. final List channels; - /// The server-resolved predefined-filter spec, or null when the query did - /// not use a `predefinedFilter`. + /// The predefined filter the query named, as resolved for it, or null when + /// the query named none. final PredefinedFilter? predefinedFilter; } diff --git a/packages/stream_chat/lib/src/client/sync_manager.dart b/packages/stream_chat/lib/src/client/sync_manager.dart index 49c8ef78cb..adbb7c24c7 100644 --- a/packages/stream_chat/lib/src/client/sync_manager.dart +++ b/packages/stream_chat/lib/src/client/sync_manager.dart @@ -29,7 +29,8 @@ class SyncManager { String tag = 'SCh:Sync', }) : _logger = StreamLogger(tag); - // The endpoint rejects more than 255, counted before duplicates collapse. + // A sync over more than 255 channels is refused, counted before duplicates + // collapse. // // Capped rather than left to the refusal: unlike one refused for its age or // its events, a window refused for its size is refused again next time, and @@ -39,7 +40,7 @@ class SyncManager { // them as they were. static const _maxSyncCids = 255; - // The endpoint returns up to 2000 events. Replaying that many runs a state + // A sync returns up to 2000 events. Replaying that many runs a state // update and a persistence write for each, on the reconnect path, while the // app is trying to render. static const _defaultMaxReplayEvents = 250; @@ -50,8 +51,8 @@ class SyncManager { /// The client this manager catches up. final StreamChatClient client; - /// Fetches the missed events, passed separately because the client does not - /// expose the endpoint itself. + /// Fetches the missed events, passed separately because the client has no + /// method for it. final FetchMissedEvents fetchMissedEvents; /// How many events may be replayed from one window before it is given up on @@ -98,9 +99,9 @@ class SyncManager { /// Replays the events missed since [lastSyncAt] for [cids], both falling back /// to the values held by the persistence client. /// - /// A window that cannot be replayed — too many events, or refused by the - /// server — is given up on, and the channels it covered are refreshed in its - /// place. Does nothing when there are no channels to catch up on. + /// A window that cannot be replayed — too many events, or refused — is given + /// up on, and the channels it covered are refreshed in its place. Does + /// nothing when there are no channels to catch up on. /// /// Those channels are returned so a caller doing its own recovery can skip /// them; the set is empty when the events were replayed normally. @@ -186,7 +187,7 @@ class SyncManager { // covered in full rather than truncated. // // Every page is attempted: one failing says nothing about the others. Returns - // the channels the server answered with — fewer when one is deleted or no + // the channels that came back — fewer when one is deleted or no // longer visible, which is not a failure — and the first request that failed. Future<(Set, (Object, StackTrace)?)> _refreshPages(List cids) async { final refreshed = {}; @@ -216,8 +217,8 @@ class SyncManager { // back. [sync] has already decided there is a window worth asking for, and // holds the lock while this runs. Future> _performSync(List cids, DateTime lastSyncAt) async { - // Deduplicated before capping: the endpoint counts duplicates against its - // own limit, so leaving them in would spend slots on nothing. + // Deduplicated before capping: duplicates count against the limit, so + // leaving them in would spend slots on nothing. final cappedCids = cids.toSet().take(_maxSyncCids).toList(); _logger ..i(() => 'Syncing events since $lastSyncAt for ${cappedCids.length} channels') @@ -230,8 +231,8 @@ class SyncManager { events = res.events.sortedBy((it) => it.createdAt); } catch (error, stk) { // A 400 means the window is too old, or held too many events to return. - // The two are indistinguishable, and either way the server refusing it is - // the signal that local state is too far behind to reconcile — so the + // The two are indistinguishable, and either way the refusal is the + // signal that local state is too far behind to reconcile — so the // store is dropped and repopulated rather than reconciled. if (error is StreamApiException && error.statusCode == 400) { _logger.w( @@ -303,7 +304,7 @@ class SyncManager { return refreshed; } - // Gives up on a window the server would not serve. + // Gives up on a window that was refused. // // The store is dropped and repopulated from the refresh, as it is for an // oversized window. Only the checkpoint differs: it has nowhere to go back diff --git a/packages/stream_chat/lib/src/core/api/channel_api.dart b/packages/stream_chat/lib/src/core/api/channel_api.dart index 75dc12a7e3..0971a61cc6 100644 --- a/packages/stream_chat/lib/src/core/api/channel_api.dart +++ b/packages/stream_chat/lib/src/core/api/channel_api.dart @@ -50,8 +50,9 @@ class ChannelApi { /// /// Either an inline [filter]/[sort] pair or a [predefinedFilter] identifier /// (optionally interpolated with [filterValues] and [sortValues]) can be - /// provided. When a predefined filter is used, the server resolves it and - /// returns the materialized filter/sort on [QueryChannelsResponse]. + /// provided. When a predefined filter is used, + /// [QueryChannelsResponse.predefinedFilter] carries the filter and sort it + /// resolved to. Future queryChannels({ ChannelFilter? filter, List? sort, diff --git a/packages/stream_chat/lib/src/core/api/general_api.dart b/packages/stream_chat/lib/src/core/api/general_api.dart index 7a47199aa3..4166e93bf1 100644 --- a/packages/stream_chat/lib/src/core/api/general_api.dart +++ b/packages/stream_chat/lib/src/core/api/general_api.dart @@ -94,7 +94,7 @@ class GeneralApi { return QueryMembersResponse.fromJson(response.data); } - /// Fetches the app settings from the `GET /app` endpoint. + /// Fetches the app settings. Future getAppSettings() async { final response = await _client.get('/app'); return GetAppSettingsResponse.fromJson(response.data); diff --git a/packages/stream_chat/lib/src/core/api/moderation_api.dart b/packages/stream_chat/lib/src/core/api/moderation_api.dart index aeaf4b3679..634d965a93 100644 --- a/packages/stream_chat/lib/src/core/api/moderation_api.dart +++ b/packages/stream_chat/lib/src/core/api/moderation_api.dart @@ -20,7 +20,8 @@ class ModerationApi { queryParameters: { 'payload': jsonEncode({ if (sort != null) 'sort': sort, - // Required by the endpoint, the same way `queryUsers` requires it. + // Sent even when empty, as in `queryUsers`: a query without it is + // rejected. 'filter_conditions': filter ?? const {}, if (pagination != null) ...pagination.toJson(), }), diff --git a/packages/stream_chat/lib/src/core/api/responses.dart b/packages/stream_chat/lib/src/core/api/responses.dart index 23127ae048..9a98e95e48 100644 --- a/packages/stream_chat/lib/src/core/api/responses.dart +++ b/packages/stream_chat/lib/src/core/api/responses.dart @@ -31,13 +31,13 @@ class _BaseResponse { /// The error payload the API returns on a failed request. @JsonSerializable() class ErrorResponse extends _BaseResponse { - /// The http error code + /// The error code identifying why the request failed. int? code; /// The message associated to the error code String? message; - /// The backend error code + /// The HTTP status of the failed request. @JsonKey(name: 'StatusCode') int? statusCode; @@ -76,10 +76,9 @@ class QueryChannelsResponse extends _BaseResponse { @JsonKey(defaultValue: []) late List channels; - /// Predefined filter spec as resolved by the server. + /// The predefined filter the query named, as resolved for it. /// - /// Populated when the request used `predefined_filter`. Contains the - /// preset name and the materialized `filter`/`sort` that were applied. + /// Null when the query named no predefined filter. @JsonKey(name: 'predefined_filter') PredefinedFilter? predefinedFilter; @@ -723,7 +722,7 @@ class UpsertPushPreferencesResponse extends _BaseResponse { /// Mapping of user IDs to their push preferences. /// /// Users whose user-global preferences were not touched by the upsert call - /// (the server returns `null` for them) are omitted from this map. + /// are omitted from this map. @JsonKey(fromJson: _userPreferencesFromJson) late Map userPreferences; diff --git a/packages/stream_chat/lib/src/core/api/user_api.dart b/packages/stream_chat/lib/src/core/api/user_api.dart index e10821081d..44fb959526 100644 --- a/packages/stream_chat/lib/src/core/api/user_api.dart +++ b/packages/stream_chat/lib/src/core/api/user_api.dart @@ -28,8 +28,8 @@ class UserApi { 'payload': jsonEncode({ 'presence': presence, if (sort != null) 'sort': sort, - // Sent even when empty: the endpoint declares `filter_conditions` - // required, and an omitted key is rejected where `{}` is accepted. + // Sent even when empty: a query without it is rejected, where `{}` + // is accepted. 'filter_conditions': filter ?? const {}, if (pagination != null) ...pagination.toJson(), }), diff --git a/packages/stream_chat/lib/src/core/error/stream_chat_exception.dart b/packages/stream_chat/lib/src/core/error/stream_chat_exception.dart index 3e928c7171..9e3354d5fe 100644 --- a/packages/stream_chat/lib/src/core/error/stream_chat_exception.dart +++ b/packages/stream_chat/lib/src/core/error/stream_chat_exception.dart @@ -26,10 +26,10 @@ extension StreamChatExceptionRetries on StreamChatException { /// is idempotent here, since the id is client-generated. /// /// A `true` says nothing about *when*. Honour - /// [StreamApiException.retryAfter] where the server named a wait, and back + /// [StreamApiException.retryAfter] where the failure names a wait, and back /// off otherwise. bool get isRetriable => switch (this) { - // The server said retrying will not help, and it is authoritative. + // The failure is marked unrecoverable, and that verdict is authoritative. StreamApiException(unrecoverable: true) => false, // About the moment rather than the request: the wait heals it. diff --git a/packages/stream_chat/lib/src/core/models/attachment.dart b/packages/stream_chat/lib/src/core/models/attachment.dart index 91e46e23b3..6f1c7d7409 100644 --- a/packages/stream_chat/lib/src/core/models/attachment.dart +++ b/packages/stream_chat/lib/src/core/models/attachment.dart @@ -337,11 +337,11 @@ class Attachment extends Equatable { /// A type of attachment that determines how the attachment is displayed and /// handled by the system. /// -/// It can be one of the backend-specified types (image, file, giphy, video, +/// It can be one of the built-in types (image, file, giphy, video, /// audio, voiceRecording) or application custom types like urlPreview. /// {@endtemplate} extension type const AttachmentType(String rawType) implements String { - /// Backend specified types. + /// Built-in types. static const image = AttachmentType('image'); static const file = AttachmentType('file'); static const giphy = AttachmentType('giphy'); diff --git a/packages/stream_chat/lib/src/core/models/banned_user.dart b/packages/stream_chat/lib/src/core/models/banned_user.dart index 2bf6eb56a4..23d228c1f4 100644 --- a/packages/stream_chat/lib/src/core/models/banned_user.dart +++ b/packages/stream_chat/lib/src/core/models/banned_user.dart @@ -93,7 +93,7 @@ typedef BannedUserFilter = Filter; /// Represents a field that banned-user queries can be filtered on. class BannedUserFilterField extends FilterField { - /// Creates a banned-user filter field named [remote] on the wire, reading + /// Creates a banned-user filter field named [remote] in queries, reading /// its value off an instance with [value]. BannedUserFilterField(super.remote, super.value); @@ -166,7 +166,7 @@ class BannedUserSort extends Sort { /// Represents a field that banned-user queries can be sorted on. class BannedUserSortField extends SortField { - /// Creates a field named [remote] on the wire, reading its value off an + /// Creates a field named [remote] in queries, reading its value off an /// instance with `localValue`. /// /// For a name the SDK has not modelled; prefer the fields declared here. diff --git a/packages/stream_chat/lib/src/core/models/channel_config.dart b/packages/stream_chat/lib/src/core/models/channel_config.dart index cbfadb55ad..ce9d31d3eb 100644 --- a/packages/stream_chat/lib/src/core/models/channel_config.dart +++ b/packages/stream_chat/lib/src/core/models/channel_config.dart @@ -81,8 +81,8 @@ class ChannelConfig { /// The push level for this channel. /// - /// Mutually exclusive with [chatPreferences] — when [chatPreferences] is set - /// on the backend, the coarse level is cleared and vice versa. + /// Mutually exclusive with [chatPreferences] — when [chatPreferences] is set, + /// the coarse level is cleared and vice versa. final PushLevel? pushLevel; /// True if this channel type supports push notifications. diff --git a/packages/stream_chat/lib/src/core/models/channel_state.dart b/packages/stream_chat/lib/src/core/models/channel_state.dart index 15da022ebe..2695aea380 100644 --- a/packages/stream_chat/lib/src/core/models/channel_state.dart +++ b/packages/stream_chat/lib/src/core/models/channel_state.dart @@ -142,15 +142,15 @@ typedef ChannelFilter = Filter; /// Represents a field that channel queries can be filtered on. class ChannelFilterField extends FilterField { - /// Creates a channel filter field named [remote] on the wire, reading its + /// Creates a channel filter field named [remote] in queries, reading its /// value off an instance with [value]. ChannelFilterField(super.remote, super.value); /// Creates a field the SDK does not model, read from [ChannelModel.extraData]. /// - /// The fields the server computes per request — `joined`, `has_unread`, - /// `invite`, `distinct` and `app_banned` — are reached this way. The server - /// resolves them against the caller; a local match cannot. + /// The fields that depend on the calling user — `joined`, `has_unread`, + /// `invite`, `distinct` and `app_banned` — are reached this way. They are + /// resolved for the caller, so a local match cannot reproduce them. /// /// **Supported operators:** `$eq`, `$in`, `$gt`, `$gte`, `$lt`, `$lte`, `$exists`, /// `$contains`, `$q`, `$autocomplete` @@ -433,7 +433,7 @@ class ChannelSort extends Sort { /// Represents a field that channel queries can be sorted on. class ChannelSortField extends SortField { - /// Creates a field named [remote] on the wire, reading its value off an + /// Creates a field named [remote] in queries, reading its value off an /// instance with `localValue`. /// /// For a name the SDK has not modelled; prefer the fields declared here. diff --git a/packages/stream_chat/lib/src/core/models/chat_preferences.dart b/packages/stream_chat/lib/src/core/models/chat_preferences.dart index fffff8d48e..dad9e9af6d 100644 --- a/packages/stream_chat/lib/src/core/models/chat_preferences.dart +++ b/packages/stream_chat/lib/src/core/models/chat_preferences.dart @@ -19,8 +19,7 @@ extension type const ChatPreferenceLevel(String rawType) implements String { /// /// Set on a [ChannelConfig], a user-level push preference, or a per-channel /// push preference. Mutually exclusive with the coarse `chatLevel` / -/// `pushLevel` field at the same tier — setting one clears the other on the -/// backend. +/// `pushLevel` field at the same tier — setting one clears the other. @JsonSerializable(includeIfNull: false) class ChatPreferences extends Equatable { /// Creates a new chat preferences instance. diff --git a/packages/stream_chat/lib/src/core/models/command.dart b/packages/stream_chat/lib/src/core/models/command.dart index daaa292918..d193f768d1 100644 --- a/packages/stream_chat/lib/src/core/models/command.dart +++ b/packages/stream_chat/lib/src/core/models/command.dart @@ -46,12 +46,10 @@ class Command { Map toJson() => _$CommandToJson(this); } -/// Wire identifier for a [Command]'s set, returned by the backend on the -/// `set` field. +/// The set a [Command] belongs to. /// -/// Implemented as an extension type over [String] so it serializes for free -/// and accepts custom values defined per-application, while exposing the -/// built-in sets as named constants. +/// The built-in sets are named constants. A set an application defines can +/// still be named by wrapping its value: `CommandSet('my_set')`. extension type const CommandSet(String _) implements String { /// Compositional commands (e.g. `/giphy`) that operate on the user's text /// and remain valid alongside a quoted message. diff --git a/packages/stream_chat/lib/src/core/models/draft.dart b/packages/stream_chat/lib/src/core/models/draft.dart index b619aafee6..04fa66abc0 100644 --- a/packages/stream_chat/lib/src/core/models/draft.dart +++ b/packages/stream_chat/lib/src/core/models/draft.dart @@ -98,7 +98,7 @@ typedef DraftFilter = Filter; /// Represents a field that draft queries can be filtered on. class DraftFilterField extends FilterField { - /// Creates a draft filter field named [remote] on the wire, reading its + /// Creates a draft filter field named [remote] in queries, reading its /// value off an instance with [value]. DraftFilterField(super.remote, super.value); @@ -164,7 +164,7 @@ class DraftSort extends Sort { /// Represents a field that draft queries can be sorted on. class DraftSortField extends SortField { - /// Creates a field named [remote] on the wire, reading its value off an + /// Creates a field named [remote] in queries, reading its value off an /// instance with `localValue`. /// /// For a name the SDK has not modelled; prefer the fields declared here. diff --git a/packages/stream_chat/lib/src/core/models/draft_message.dart b/packages/stream_chat/lib/src/core/models/draft_message.dart index d4863c82d7..000bb9f168 100644 --- a/packages/stream_chat/lib/src/core/models/draft_message.dart +++ b/packages/stream_chat/lib/src/core/models/draft_message.dart @@ -182,10 +182,7 @@ class DraftMessage extends Equatable { /// Extension on [Message] to convert it to a [DraftMessage]. extension MessageToDraftMessage on Message { - /// Converts this [DraftMessage] to a [Message]. - /// - /// This is useful when you want to convert a message to a draft message - /// before sending it to the server. + /// Converts this [Message] to a [DraftMessage]. DraftMessage toDraftMessage() { // Only include attachments that have been successfully uploaded. final uploadedAttachments = attachments.where((it) { diff --git a/packages/stream_chat/lib/src/core/models/location.dart b/packages/stream_chat/lib/src/core/models/location.dart index d4457e489d..a4721ecc1a 100644 --- a/packages/stream_chat/lib/src/core/models/location.dart +++ b/packages/stream_chat/lib/src/core/models/location.dart @@ -41,7 +41,7 @@ class Location extends Equatable { /// The channel CID where the message exists. /// - /// This is only available if the location is coming from server response. + /// Only set on a location that has been received, not on one built locally. @JsonKey(includeToJson: false) final String? channelCid; diff --git a/packages/stream_chat/lib/src/core/models/member.dart b/packages/stream_chat/lib/src/core/models/member.dart index aa354a5974..5b46017ee4 100644 --- a/packages/stream_chat/lib/src/core/models/member.dart +++ b/packages/stream_chat/lib/src/core/models/member.dart @@ -187,7 +187,7 @@ typedef MemberFilter = Filter; /// Represents a field that member queries can be filtered on. class MemberFilterField extends FilterField { - /// Creates a member filter field named [remote] on the wire, reading its + /// Creates a member filter field named [remote] in queries, reading its /// value off an instance with [value]. MemberFilterField(super.remote, super.value); @@ -352,7 +352,7 @@ class MemberSort extends Sort { /// Represents a field that member queries can be sorted on. class MemberSortField extends SortField { - /// Creates a field named [remote] on the wire, reading its value off an + /// Creates a field named [remote] in queries, reading its value off an /// instance with `localValue`. /// /// For a name the SDK has not modelled; prefer the fields declared here. diff --git a/packages/stream_chat/lib/src/core/models/message.dart b/packages/stream_chat/lib/src/core/models/message.dart index ef7e6c94a0..c1d92247e9 100644 --- a/packages/stream_chat/lib/src/core/models/message.dart +++ b/packages/stream_chat/lib/src/core/models/message.dart @@ -136,8 +136,7 @@ class Message extends Equatable { @JsonKey(includeIfNull: false) final List? mentionedGroupIds; - /// The list of groups mentioned in the message, hydrated by the server from - /// [mentionedGroupIds]. + /// The groups mentioned in the message, resolved from [mentionedGroupIds]. @JsonKey(includeToJson: false, fromJson: userGroupsFromV1Json) final List? mentionedGroups; @@ -633,8 +632,7 @@ class Message extends Equatable { final shouldPromoteDeletedForMe = preservedDeletedForMe == true && other.deletedForMe != true; return other.copyWith( - // Local-only timestamps — the server cannot know about these, - // so they are always taken from this instance. + // Local-only timestamps, so they are always taken from this instance. localCreatedAt: localCreatedAt, localUpdatedAt: localUpdatedAt, localDeletedAt: localDeletedAt, @@ -642,7 +640,7 @@ class Message extends Equatable { type: shouldPromoteDeletedForMe ? MessageType.deleted : null, state: shouldPromoteDeletedForMe ? MessageState.deletedForMe : null, // Preserve enrichment from this instance when [other] omits these - // fields, as the backend may strip them on partial payloads. + // fields, as a partial payload may leave them out. poll: other.poll ?? poll, sharedLocation: other.sharedLocation ?? sharedLocation, ownReactions: other.ownReactions ?? ownReactions, @@ -652,7 +650,7 @@ class Message extends Equatable { (final incoming?, final local?) when incoming.id == local.id => local.updateWith(incoming), // Different target — trust the new payload. (final incoming?, _) => incoming, - // Server omitted the nested quote — keep the locally-known copy. + // The payload omitted the nested quote — keep the locally-known copy. (_, final local) => local, }, ); @@ -662,7 +660,7 @@ class Message extends Equatable { /// changes from [other]. /// /// The argument convention is the inverse of [updateWith]: here `this` is - /// the server payload and [other] is the locally-known message. + /// the incoming payload and [other] is the locally-known message. /// `serverResponse.syncWith(localMessage)` is equivalent to /// `localMessage.updateWith(serverResponse)`. /// @@ -741,7 +739,7 @@ typedef MessageSearchFilter = Filter; /// Represents a field that a message search can be filtered on. class MessageSearchFilterField extends FilterField { - /// Creates a message filter field named [remote] on the wire, reading its + /// Creates a message filter field named [remote] in queries, reading its /// value off an instance with [value]. MessageSearchFilterField(super.remote, super.value); @@ -882,7 +880,7 @@ class MessageSearchSort extends Sort { /// Represents a field that message queries can be sorted on. class MessageSearchSortField extends SortField { - /// Creates a field named [remote] on the wire, reading its value off an + /// Creates a field named [remote] in queries, reading its value off an /// instance with `localValue`. /// /// For a name the SDK has not modelled; prefer the fields declared here. diff --git a/packages/stream_chat/lib/src/core/models/message_reminder.dart b/packages/stream_chat/lib/src/core/models/message_reminder.dart index 5f34c99bd4..77cee97e67 100644 --- a/packages/stream_chat/lib/src/core/models/message_reminder.dart +++ b/packages/stream_chat/lib/src/core/models/message_reminder.dart @@ -150,7 +150,7 @@ typedef MessageReminderFilter = Filter; /// Represents a field that reminder queries can be filtered on. class MessageReminderFilterField extends FilterField { - /// Creates a reminder filter field named [remote] on the wire, reading its + /// Creates a reminder filter field named [remote] in queries, reading its /// value off an instance with [value]. MessageReminderFilterField(super.remote, super.value); @@ -226,7 +226,7 @@ class MessageReminderSort extends Sort { /// Represents a field that reminder queries can be sorted on. class MessageReminderSortField extends SortField { - /// Creates a field named [remote] on the wire, reading its value off an + /// Creates a field named [remote] in queries, reading its value off an /// instance with `localValue`. /// /// For a name the SDK has not modelled; prefer the fields declared here. diff --git a/packages/stream_chat/lib/src/core/models/poll.dart b/packages/stream_chat/lib/src/core/models/poll.dart index 47d96e8b61..9a4365aa8e 100644 --- a/packages/stream_chat/lib/src/core/models/poll.dart +++ b/packages/stream_chat/lib/src/core/models/poll.dart @@ -281,7 +281,7 @@ typedef PollFilter = Filter; /// Represents a field that poll queries can be filtered on. class PollFilterField extends FilterField { - /// Creates a poll filter field named [remote] on the wire, reading its value + /// Creates a poll filter field named [remote] in queries, reading its value /// off an instance with [value]. PollFilterField(super.remote, super.value); @@ -411,7 +411,7 @@ class PollSort extends Sort { /// Represents a field that poll queries can be sorted on. class PollSortField extends SortField { - /// Creates a field named [remote] on the wire, reading its value off an + /// Creates a field named [remote] in queries, reading its value off an /// instance with `localValue`. /// /// For a name the SDK has not modelled; prefer the fields declared here. diff --git a/packages/stream_chat/lib/src/core/models/poll_vote.dart b/packages/stream_chat/lib/src/core/models/poll_vote.dart index f1e6dd21e2..013e746215 100644 --- a/packages/stream_chat/lib/src/core/models/poll_vote.dart +++ b/packages/stream_chat/lib/src/core/models/poll_vote.dart @@ -117,7 +117,7 @@ typedef PollVoteFilter = Filter; /// Represents a field that poll vote queries can be filtered on. class PollVoteFilterField extends FilterField { - /// Creates a poll vote filter field named [remote] on the wire, reading its + /// Creates a poll vote filter field named [remote] in queries, reading its /// value off an instance with [value]. PollVoteFilterField(super.remote, super.value); @@ -215,7 +215,7 @@ class PollVoteSort extends Sort { /// Represents a field that poll-vote queries can be sorted on. class PollVoteSortField extends SortField { - /// Creates a field named [remote] on the wire, reading its value off an + /// Creates a field named [remote] in queries, reading its value off an /// instance with `localValue`. /// /// For a name the SDK has not modelled; prefer the fields declared here. diff --git a/packages/stream_chat/lib/src/core/models/predefined_filter.dart b/packages/stream_chat/lib/src/core/models/predefined_filter.dart index 75e9e7c7a2..f54ee97a32 100644 --- a/packages/stream_chat/lib/src/core/models/predefined_filter.dart +++ b/packages/stream_chat/lib/src/core/models/predefined_filter.dart @@ -3,12 +3,11 @@ import 'channel_state.dart'; part 'predefined_filter.g.dart'; -/// The resolved predefined filter spec returned by the server. +/// A predefined filter, resolved for one channel query. /// -/// When `predefined_filter` is provided on a `queryChannels` request, the -/// server resolves the template (interpolating any `filter_values` and -/// `sort_values`) and echoes the materialized `filter` and `sort` on the -/// response under this key. +/// When a channel query names a predefined filter, its template is filled in +/// with the filter and sort values the query supplies, and the filter and sort +/// it resolves to come back with the channels. @JsonSerializable(createToJson: false) class PredefinedFilter { /// Creates a new instance. @@ -21,32 +20,32 @@ class PredefinedFilter { /// Create a new instance from a json. factory PredefinedFilter.fromJson(Map json) => _$PredefinedFilterFromJson(json); - /// Identifier of the predefined filter on the server. + /// The name of the predefined filter. final String name; - /// Filter conditions as resolved by the server. + /// The filter conditions the predefined filter resolved to. /// - /// Wrapped in [ChannelFilter.raw], since the server authors it and may use an + /// Wrapped in [ChannelFilter.raw], since it is not authored here and may use an /// operator this package does not model. Read it with [ChannelFilter.toJson]; /// [ChannelFilter.matches] throws for it. @JsonKey(fromJson: _filterFromJson) final ChannelFilter filter; - /// Sort specification as resolved by the server. + /// The sort the predefined filter resolved to, if it names one. final List? sort; - /// Sort to apply locally, matching what the server applies for this - /// predefined filter — the echoed [sort], or a default derived from - /// [filter] when [sort] is null. + /// The sort that reproduces this predefined filter's ordering locally. + /// + /// This is [sort], or a default derived from [filter] when [sort] is null. List get effectiveSort => sort ?? _defaultSortFor(filter); static ChannelFilter _filterFromJson(Map json) => ChannelFilter.raw(json); } -// Mirrors the server's fallback for a channel query that carries no sort, so -// the field is written out rather than taken from [ChannelSort.defaultSort]: -// the two agree today, but one is the ordering this SDK picks and the other is -// the ordering the server falls back to, and either may change alone. +// Mirrors the ordering a channel query with no sort falls back to, so the field +// is written out rather than taken from [ChannelSort.defaultSort]: the two agree +// today, but one is the ordering this SDK picks and the other is the query's +// fallback, and either may change alone. List _defaultSortFor(ChannelFilter filter) { final lastMessageAt = ChannelSortField.lastMessageAt; if (_mapTouchesField(filter.toJson(), lastMessageAt.remote)) { diff --git a/packages/stream_chat/lib/src/core/models/push_provider.dart b/packages/stream_chat/lib/src/core/models/push_provider.dart index 5dc401d862..5a0277f35f 100644 --- a/packages/stream_chat/lib/src/core/models/push_provider.dart +++ b/packages/stream_chat/lib/src/core/models/push_provider.dart @@ -1,7 +1,7 @@ /// A service that delivers push notifications to a device. /// -/// Any provider the server supports can be named, including one without a -/// constant here, by wrapping its wire value: `PushProvider('firebase')`. +/// A provider without a constant here can still be named by wrapping its +/// value: `PushProvider('firebase')`. extension type const PushProvider(String rawType) implements String { /// Google's Firebase Cloud Messaging. static const firebase = PushProvider('firebase'); diff --git a/packages/stream_chat/lib/src/core/models/reaction.dart b/packages/stream_chat/lib/src/core/models/reaction.dart index afd0db335f..2b0cf5f3e3 100644 --- a/packages/stream_chat/lib/src/core/models/reaction.dart +++ b/packages/stream_chat/lib/src/core/models/reaction.dart @@ -145,7 +145,7 @@ typedef ReactionFilter = Filter; /// Represents a field that reaction queries can be filtered on. class ReactionFilterField extends FilterField { - /// Creates a reaction filter field named [remote] on the wire, reading its + /// Creates a reaction filter field named [remote] in queries, reading its /// value off an instance with [value]. ReactionFilterField(super.remote, super.value); @@ -209,7 +209,7 @@ class ReactionSort extends Sort { /// Represents a field that reaction queries can be sorted on. class ReactionSortField extends SortField { - /// Creates a field named [remote] on the wire, reading its value off an + /// Creates a field named [remote] in queries, reading its value off an /// instance with `localValue`. /// /// For a name the SDK has not modelled; prefer the fields declared here. diff --git a/packages/stream_chat/lib/src/core/models/response/add_user_group_members_response.dart b/packages/stream_chat/lib/src/core/models/response/add_user_group_members_response.dart index 28a5e33fb6..0c27e5124b 100644 --- a/packages/stream_chat/lib/src/core/models/response/add_user_group_members_response.dart +++ b/packages/stream_chat/lib/src/core/models/response/add_user_group_members_response.dart @@ -4,7 +4,7 @@ import '../user_group.dart'; part 'add_user_group_members_response.freezed.dart'; -/// The user group returned by [StreamChatClient.addUserGroupMembers]. +/// A user group after members were added to it. @freezed class AddUserGroupMembersResponse with _$AddUserGroupMembersResponse { /// Creates a new [AddUserGroupMembersResponse]. @@ -13,7 +13,7 @@ class AddUserGroupMembersResponse with _$AddUserGroupMembersResponse { this.userGroup, }); - /// How long the server took to handle the request, such as `4.21ms`. + /// How long the request took to handle, such as `4.21ms`. @override final String duration; diff --git a/packages/stream_chat/lib/src/core/models/response/create_user_group_response.dart b/packages/stream_chat/lib/src/core/models/response/create_user_group_response.dart index df71e0c234..262301078c 100644 --- a/packages/stream_chat/lib/src/core/models/response/create_user_group_response.dart +++ b/packages/stream_chat/lib/src/core/models/response/create_user_group_response.dart @@ -4,7 +4,7 @@ import '../user_group.dart'; part 'create_user_group_response.freezed.dart'; -/// The user group created by [StreamChatClient.createUserGroup]. +/// A newly created user group. @freezed class CreateUserGroupResponse with _$CreateUserGroupResponse { /// Creates a new [CreateUserGroupResponse]. @@ -13,7 +13,7 @@ class CreateUserGroupResponse with _$CreateUserGroupResponse { this.userGroup, }); - /// How long the server took to handle the request, such as `4.21ms`. + /// How long the request took to handle, such as `4.21ms`. @override final String duration; diff --git a/packages/stream_chat/lib/src/core/models/response/get_user_group_response.dart b/packages/stream_chat/lib/src/core/models/response/get_user_group_response.dart index 80ebcdf5c2..6d6384cd1f 100644 --- a/packages/stream_chat/lib/src/core/models/response/get_user_group_response.dart +++ b/packages/stream_chat/lib/src/core/models/response/get_user_group_response.dart @@ -4,7 +4,7 @@ import '../user_group.dart'; part 'get_user_group_response.freezed.dart'; -/// The user group fetched by [StreamChatClient.getUserGroup]. +/// The result of looking up a single user group. @freezed class GetUserGroupResponse with _$GetUserGroupResponse { /// Creates a new [GetUserGroupResponse]. @@ -13,7 +13,7 @@ class GetUserGroupResponse with _$GetUserGroupResponse { this.userGroup, }); - /// How long the server took to handle the request, such as `4.21ms`. + /// How long the request took to handle, such as `4.21ms`. @override final String duration; diff --git a/packages/stream_chat/lib/src/core/models/response/list_devices_response.dart b/packages/stream_chat/lib/src/core/models/response/list_devices_response.dart index 84f92afa50..81cce13f88 100644 --- a/packages/stream_chat/lib/src/core/models/response/list_devices_response.dart +++ b/packages/stream_chat/lib/src/core/models/response/list_devices_response.dart @@ -4,7 +4,7 @@ import '../device.dart'; part 'list_devices_response.freezed.dart'; -/// The devices registered for the current user, returned by [StreamChatClient.getDevices]. +/// The devices registered for the current user. @freezed class ListDevicesResponse with _$ListDevicesResponse { /// Creates a new [ListDevicesResponse]. @@ -13,7 +13,7 @@ class ListDevicesResponse with _$ListDevicesResponse { this.devices = const [], }); - /// How long the server took to handle the request, such as `4.21ms`. + /// How long the request took to handle, such as `4.21ms`. @override final String duration; diff --git a/packages/stream_chat/lib/src/core/models/response/list_user_groups_response.dart b/packages/stream_chat/lib/src/core/models/response/list_user_groups_response.dart index ae3b652734..fa01d19cca 100644 --- a/packages/stream_chat/lib/src/core/models/response/list_user_groups_response.dart +++ b/packages/stream_chat/lib/src/core/models/response/list_user_groups_response.dart @@ -4,7 +4,7 @@ import '../user_group.dart'; part 'list_user_groups_response.freezed.dart'; -/// The user groups of the app, returned by [StreamChatClient.listUserGroups]. +/// The user groups of the app. @freezed class ListUserGroupsResponse with _$ListUserGroupsResponse { /// Creates a new [ListUserGroupsResponse]. @@ -13,7 +13,7 @@ class ListUserGroupsResponse with _$ListUserGroupsResponse { this.userGroups = const [], }); - /// How long the server took to handle the request, such as `4.21ms`. + /// How long the request took to handle, such as `4.21ms`. @override final String duration; diff --git a/packages/stream_chat/lib/src/core/models/response/og_attachment_response.dart b/packages/stream_chat/lib/src/core/models/response/og_attachment_response.dart index 0d99002bee..2cecfa99ec 100644 --- a/packages/stream_chat/lib/src/core/models/response/og_attachment_response.dart +++ b/packages/stream_chat/lib/src/core/models/response/og_attachment_response.dart @@ -2,9 +2,7 @@ import 'package:freezed_annotation/freezed_annotation.dart'; part 'og_attachment_response.freezed.dart'; -/// The OpenGraph metadata scraped for a URL, returned by [StreamChatClient.enrichUrl]. -/// -/// [Attachment.fromOGAttachment] builds a link preview attachment from it. +/// The OpenGraph metadata scraped from a URL. @freezed class OGAttachmentResponse with _$OGAttachmentResponse { /// Creates a new [OGAttachmentResponse]. @@ -22,7 +20,7 @@ class OGAttachmentResponse with _$OGAttachmentResponse { this.type, }); - /// How long the server took to handle the request, such as `4.21ms`. + /// How long the request took to handle, such as `4.21ms`. @override final String duration; diff --git a/packages/stream_chat/lib/src/core/models/response/remove_user_group_members_response.dart b/packages/stream_chat/lib/src/core/models/response/remove_user_group_members_response.dart index 781459c706..4de1e4074e 100644 --- a/packages/stream_chat/lib/src/core/models/response/remove_user_group_members_response.dart +++ b/packages/stream_chat/lib/src/core/models/response/remove_user_group_members_response.dart @@ -4,7 +4,7 @@ import '../user_group.dart'; part 'remove_user_group_members_response.freezed.dart'; -/// The user group returned by [StreamChatClient.removeUserGroupMembers]. +/// A user group after members were removed from it. @freezed class RemoveUserGroupMembersResponse with _$RemoveUserGroupMembersResponse { /// Creates a new [RemoveUserGroupMembersResponse]. @@ -13,7 +13,7 @@ class RemoveUserGroupMembersResponse with _$RemoveUserGroupMembersResponse { this.userGroup, }); - /// How long the server took to handle the request, such as `4.21ms`. + /// How long the request took to handle, such as `4.21ms`. @override final String duration; diff --git a/packages/stream_chat/lib/src/core/models/response/search_roles_response.dart b/packages/stream_chat/lib/src/core/models/response/search_roles_response.dart index 070832d7ab..fb27b0dba7 100644 --- a/packages/stream_chat/lib/src/core/models/response/search_roles_response.dart +++ b/packages/stream_chat/lib/src/core/models/response/search_roles_response.dart @@ -4,7 +4,7 @@ import '../role.dart'; part 'search_roles_response.freezed.dart'; -/// The roles matching a search, returned by [StreamChatClient.searchRoles]. +/// The roles matching a search. @freezed class SearchRolesResponse with _$SearchRolesResponse { /// Creates a new [SearchRolesResponse]. @@ -13,11 +13,11 @@ class SearchRolesResponse with _$SearchRolesResponse { this.roles = const [], }); - /// How long the server took to handle the request, such as `4.21ms`. + /// How long the request took to handle, such as `4.21ms`. @override final String duration; - /// The roles whose names match the search, in the order the server returned them. + /// The roles whose names match the search, in the order the search returned them. @override final List roles; } diff --git a/packages/stream_chat/lib/src/core/models/response/search_user_groups_response.dart b/packages/stream_chat/lib/src/core/models/response/search_user_groups_response.dart index c87f3a8136..c80280d248 100644 --- a/packages/stream_chat/lib/src/core/models/response/search_user_groups_response.dart +++ b/packages/stream_chat/lib/src/core/models/response/search_user_groups_response.dart @@ -4,7 +4,7 @@ import '../user_group.dart'; part 'search_user_groups_response.freezed.dart'; -/// The user groups matching a search, returned by [StreamChatClient.searchUserGroups]. +/// The user groups matching a search. @freezed class SearchUserGroupsResponse with _$SearchUserGroupsResponse { /// Creates a new [SearchUserGroupsResponse]. @@ -13,7 +13,7 @@ class SearchUserGroupsResponse with _$SearchUserGroupsResponse { this.userGroups = const [], }); - /// How long the server took to handle the request, such as `4.21ms`. + /// How long the request took to handle, such as `4.21ms`. @override final String duration; diff --git a/packages/stream_chat/lib/src/core/models/response/update_user_group_response.dart b/packages/stream_chat/lib/src/core/models/response/update_user_group_response.dart index 134b6f7264..c20df6218c 100644 --- a/packages/stream_chat/lib/src/core/models/response/update_user_group_response.dart +++ b/packages/stream_chat/lib/src/core/models/response/update_user_group_response.dart @@ -4,7 +4,7 @@ import '../user_group.dart'; part 'update_user_group_response.freezed.dart'; -/// The user group updated by [StreamChatClient.updateUserGroup]. +/// A user group after it was updated. @freezed class UpdateUserGroupResponse with _$UpdateUserGroupResponse { /// Creates a new [UpdateUserGroupResponse]. @@ -13,7 +13,7 @@ class UpdateUserGroupResponse with _$UpdateUserGroupResponse { this.userGroup, }); - /// How long the server took to handle the request, such as `4.21ms`. + /// How long the request took to handle, such as `4.21ms`. @override final String duration; diff --git a/packages/stream_chat/lib/src/core/models/role_type.dart b/packages/stream_chat/lib/src/core/models/role_type.dart index 026d82dffc..b074a089ff 100644 --- a/packages/stream_chat/lib/src/core/models/role_type.dart +++ b/packages/stream_chat/lib/src/core/models/role_type.dart @@ -1,8 +1,8 @@ /// The type of role used to filter results in /// [StreamChatClient.searchRoles]. /// -/// The server accepts only [user] or [channel]; any other value -/// returns a validation error. +/// Only [user] and [channel] are accepted; any other value fails the +/// search. extension type const RoleType(String rawType) implements String { /// Restricts results to roles valid as a user-level assignment /// (e.g. `user`, `admin`, `anonymous`). diff --git a/packages/stream_chat/lib/src/core/models/thread.dart b/packages/stream_chat/lib/src/core/models/thread.dart index 562501a7dc..f7a5df87cc 100644 --- a/packages/stream_chat/lib/src/core/models/thread.dart +++ b/packages/stream_chat/lib/src/core/models/thread.dart @@ -242,14 +242,14 @@ typedef ThreadFilter = Filter; /// Represents a field that thread queries can be filtered on. class ThreadFilterField extends FilterField { - /// Creates a thread filter field named [remote] on the wire, reading its + /// Creates a thread filter field named [remote] in queries, reading its /// value off an instance with [value]. ThreadFilterField(super.remote, super.value); /// Creates a field the SDK does not model, read from [Thread.extraData]. /// - /// `has_unread` is reached this way. The server resolves it against the - /// caller's read state; a local match cannot. + /// `has_unread` is reached this way. It depends on the caller's read state, + /// so a local match cannot reproduce it. /// /// **Supported operators:** `$eq`, `$in`, `$gt`, `$gte`, `$lt`, `$lte`, /// `$exists`, `$contains`, `$q`, `$autocomplete` @@ -391,7 +391,7 @@ class ThreadSort extends Sort { /// Represents a field that thread queries can be sorted on. class ThreadSortField extends SortField { - /// Creates a field named [remote] on the wire, reading its value off an + /// Creates a field named [remote] in queries, reading its value off an /// instance with `localValue`. /// /// For a name the SDK has not modelled; prefer the fields declared here. diff --git a/packages/stream_chat/lib/src/core/models/user.dart b/packages/stream_chat/lib/src/core/models/user.dart index 212ad30b30..4719012b2e 100644 --- a/packages/stream_chat/lib/src/core/models/user.dart +++ b/packages/stream_chat/lib/src/core/models/user.dart @@ -227,7 +227,7 @@ typedef UserFilter = Filter; /// Represents a field that user queries can be filtered on. class UserFilterField extends FilterField { - /// Creates a user filter field named [remote] on the wire, reading its value + /// Creates a user filter field named [remote] in queries, reading its value /// off an instance with [value]. UserFilterField(super.remote, super.value); @@ -383,7 +383,7 @@ class UserSort extends Sort { /// Represents a field that user queries can be sorted on. class UserSortField extends SortField { - /// Creates a field named [remote] on the wire, reading its value off an + /// Creates a field named [remote] in queries, reading its value off an /// instance with `localValue`. /// /// For a name the SDK has not modelled; prefer the fields declared here. diff --git a/packages/stream_chat/lib/src/core/models/user_group.dart b/packages/stream_chat/lib/src/core/models/user_group.dart index 8648ea9edf..1fc179ec20 100644 --- a/packages/stream_chat/lib/src/core/models/user_group.dart +++ b/packages/stream_chat/lib/src/core/models/user_group.dart @@ -32,8 +32,7 @@ class UserGroup with _$UserGroup { @override final DateTime createdAt; - /// The id of the user that created the group - /// (null when group is created server-side). + /// The id of the user that created the group, or null when no user did. @override final String? createdBy; diff --git a/packages/stream_chat/lib/src/core/util/message_merging.dart b/packages/stream_chat/lib/src/core/util/message_merging.dart index 7280c44663..c96f78717d 100644 --- a/packages/stream_chat/lib/src/core/util/message_merging.dart +++ b/packages/stream_chat/lib/src/core/util/message_merging.dart @@ -95,7 +95,7 @@ class MessageMerging { final existingList = existing is List ? existing : existing.toList(); var toMergeList = toMerge is List ? toMerge : toMerge.toList(); - // Single-message fast path. The hot ingest path (server echoes, edits, + // Single-message fast path. The hot ingest path (sent-message echoes, edits, // reactions, read receipts) always lands here, and `lastIndexWhere` + // `sortedUpsertAt` skips the O(N) keymap build that the two-pointer // merge would otherwise do up front. diff --git a/packages/stream_chat/lib/src/db/chat_persistence_client.dart b/packages/stream_chat/lib/src/db/chat_persistence_client.dart index 0410e0998a..6875da6c71 100644 --- a/packages/stream_chat/lib/src/db/chat_persistence_client.dart +++ b/packages/stream_chat/lib/src/db/chat_persistence_client.dart @@ -157,12 +157,12 @@ abstract class ChatPersistenceClient { /// - [sort] — the sort order applied to the cached channel states. /// /// **Predefined filter mode** (`predefinedFilter != null`): - /// - [predefinedFilter] — the server-side filter template name. + /// - [predefinedFilter] — the name of the predefined filter. /// - [filterValues] / [sortValues] — interpolation maps that, together /// with the template name, identify the cached query. /// - The returned [QueryChannelsResponse.predefinedFilter] carries the - /// server-resolved filter + sort spec persisted on the last online - /// query, so the caller can apply the same order the server applied. + /// filter and sort the predefined filter resolved to on the last online + /// query, so the caller can apply the same order. /// /// Both modes: /// - [messageLimit] limits messages per channel. @@ -204,11 +204,11 @@ abstract class ChatPersistenceClient { /// are ignored in this mode. /// /// **Predefined filter mode** (`predefinedFilter != null`): - /// - [predefinedFilter] — the server-side filter template name. + /// - [predefinedFilter] — the name of the predefined filter. /// - [filterValues] / [sortValues] — interpolation maps used together /// with the template name to key the cache. - /// - [resolvedFilter] / [resolvedSort] — the server-resolved spec - /// returned in the query response. Persisted alongside [cids] so + /// - [resolvedFilter] / [resolvedSort] — the filter and sort the + /// predefined filter resolved to. Persisted alongside [cids] so /// subsequent offline reads can reconstruct the same filter and /// order. [filter] / [sort] are ignored in this mode. Future saveChannelQueries({ diff --git a/packages/stream_chat/lib/src/event_type.dart b/packages/stream_chat/lib/src/event_type.dart index 79dfd884f6..1044421f8f 100644 --- a/packages/stream_chat/lib/src/event_type.dart +++ b/packages/stream_chat/lib/src/event_type.dart @@ -102,7 +102,7 @@ class EventType { /// Event sent when the connection is recovered static const String connectionRecovered = 'connection.recovered'; - /// Event sent when the server refuses or ends the connection + /// Event sent when the connection is refused, or closed with an error. static const String connectionError = 'connection.error'; /// Event sent when the user is accepts an invite diff --git a/packages/stream_chat/lib/src/repository/roles_repository.dart b/packages/stream_chat/lib/src/repository/roles_repository.dart index e649e7489e..5f90439182 100644 --- a/packages/stream_chat/lib/src/repository/roles_repository.dart +++ b/packages/stream_chat/lib/src/repository/roles_repository.dart @@ -24,7 +24,7 @@ class RolesRepository { /// returned when omitted. /// /// [includeGlobalRoles] includes roles prefixed `global_` when set to - /// `true`. Defaults to `false` on the server. + /// `true`, and leaves them out when omitted. Future> searchRoles( String query, { int? limit, diff --git a/packages/stream_chat/lib/src/repository/user_groups_repository.dart b/packages/stream_chat/lib/src/repository/user_groups_repository.dart index 7314777d30..56b9f7d4a9 100644 --- a/packages/stream_chat/lib/src/repository/user_groups_repository.dart +++ b/packages/stream_chat/lib/src/repository/user_groups_repository.dart @@ -71,7 +71,7 @@ class UserGroupsRepository { /// Creates a new user group, optionally with initial members. /// - /// [id] is generated by the server when omitted. + /// An [id] is generated when omitted. Future> createUserGroup( String name, { String? id, diff --git a/packages/stream_chat/lib/src/ws/connect_request.dart b/packages/stream_chat/lib/src/ws/connect_request.dart index 3d4c176d07..dbda20ab69 100644 --- a/packages/stream_chat/lib/src/ws/connect_request.dart +++ b/packages/stream_chat/lib/src/ws/connect_request.dart @@ -60,7 +60,7 @@ class ConnectRequest { /// The options that open a connection for [user], presenting [token]. /// /// Set [includeUserDetails] to send the user's full details rather than their id alone, which - /// creates or updates them server-side. + /// creates or updates the user. WebSocketOptions build({ required OwnUser user, required UserToken token, diff --git a/packages/stream_chat/lib/src/ws/connection_manager.dart b/packages/stream_chat/lib/src/ws/connection_manager.dart index f7d7959806..0b8ede65e7 100644 --- a/packages/stream_chat/lib/src/ws/connection_manager.dart +++ b/packages/stream_chat/lib/src/ws/connection_manager.dart @@ -10,12 +10,12 @@ import 'stream_chat_ws_event.dart'; /// The connection a `StreamChatClient` works over. /// -/// Opens and closes the connection, answers for the id the server issues it, and reopens one that +/// Opens and closes the connection, answers for the connection id it is issued, and reopens one that /// drops. Obtained via `StreamChatClient`; not constructed directly. class ConnectionManager with Disposable { /// Creates a [ConnectionManager] that connects with [request]. /// - /// [wsProvider] stands in for the socket, for tests that drive one without a server. + /// [wsProvider] stands in for the socket, for tests that drive one without a real connection. /// /// Reports under [tag], and the socket and recovery handler it owns under `:Ws` and /// `:Recovery`, so one prefix selects the whole family. @@ -55,7 +55,7 @@ class ConnectionManager with Disposable { // The attempt everyone opening a connection waits on, while one is under way. final _opening = InFlightCache(); - /// Every frame the server has sent, as it arrives. + /// Every frame received on the connection, as it arrives. EventEmitter get events => _ws.events; /// The state of the connection, reported on listen and again on every change. @@ -99,13 +99,12 @@ class ConnectionManager with Disposable { /// Opens a connection for [user], completing with the health check that established it. /// - /// Set [includeUserDetails] to send the user's full details, which creates or updates them - /// server-side. + /// Set [includeUserDetails] to send the user's full details, which creates or updates the user. /// /// Completes with the attempt already under way when there is one for [user]. /// /// Throws a [StateError] when a connection is already open, or one is being opened for another - /// user, and a [StreamChatException] when the server refuses the connection. + /// user, and a [StreamChatException] when the connection is refused. Future connect( OwnUser user, { bool includeUserDetails = false, @@ -123,8 +122,7 @@ class ConnectionManager with Disposable { ); } - // Answered with the frame that opened the connection, the only one naming the user the server - // signed in. + // Answered with the frame that opened the connection, the only one naming the signed-in user. if (connectionState.value case Connected()) { if (_session case final open? when open.user.id == user.id) { if (open.established case final established?) return established; @@ -166,7 +164,7 @@ class ConnectionManager with Disposable { final session = _session; // Subscribed before connecting: the frame that establishes the connection is the first health - // check, and the only one carrying the user the server signed in. + // check, and the only one carrying the signed-in user. final established = events.waitFor(); // Not awaited: the state has moved on by the time this returns, so the closure waited on @@ -189,7 +187,7 @@ class ConnectionManager with Disposable { }, ); - // Raises why the server would not open a connection, the way a rejected request is raised. + // Raises why a connection was refused, the way a rejected request is raised. Never _refuse(OwnUser user, DisconnectionSource source) { _logger.w(() => 'connect ${user.id} failed: ${source.closeReason}', error: source.cause); @@ -204,7 +202,7 @@ class ConnectionManager with Disposable { final session = _session; if (session == null) throw StateError('No user is connected.'); - // Drop the token the server refused, so the load below asks for another. A provider with no + // Drop the refused token, so the load below asks for another. A provider with no // other to give ends the session instead of presenting the same one forever. if (previousError case final refused? when refused.isTokenExpired) { _tokenManager.expireToken(); @@ -249,7 +247,7 @@ class _Session { HealthCheckEvent? get established => _established; HealthCheckEvent? _established; - // Whether an attempt names the user in full, which creates or updates them server-side. + // Whether an attempt names the user in full, which creates or updates the user. bool get includeUserDetails => _includeUserDetails; bool _includeUserDetails; From e45bc113e811e5188e8e7bd6e14bfebb3a1c683d Mon Sep 17 00:00:00 2001 From: Petar Velikov Date: Tue, 29 Sep 2026 13:38:53 +0200 Subject: [PATCH 28/36] test(llc): cover the migrated endpoints through the public client (#3015) * test(llc): cover the migrated endpoints through the public client Co-Authored-By: Claude Opus 5.5 * test(llc): restore the empty-member, provider-name and query-only checks Co-Authored-By: Claude Opus 5.5 * docs(repo): test mapping through the public client in the migration plan Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: Claude Opus 5.5 --- .claude/skills/openapi-migration/SKILL.md | 4 +- openapi-migration/02-devices.md | 5 +- openapi-migration/tool/generate_plan.py | 5 +- .../test/src/client/client_test.dart | 504 ++++++++++++++---- .../repository/devices_repository_test.dart | 158 ------ .../mapper/devices_mapper_test.dart | 71 --- .../repository/mapper/roles_mapper_test.dart | 54 -- .../mapper/user_groups_mapper_test.dart | 210 -------- .../src/repository/roles_repository_test.dart | 79 --- .../user_groups_repository_test.dart | 174 ------ 10 files changed, 408 insertions(+), 856 deletions(-) delete mode 100644 packages/stream_chat/test/src/repository/devices_repository_test.dart delete mode 100644 packages/stream_chat/test/src/repository/mapper/devices_mapper_test.dart delete mode 100644 packages/stream_chat/test/src/repository/mapper/roles_mapper_test.dart delete mode 100644 packages/stream_chat/test/src/repository/mapper/user_groups_mapper_test.dart delete mode 100644 packages/stream_chat/test/src/repository/roles_repository_test.dart delete mode 100644 packages/stream_chat/test/src/repository/user_groups_repository_test.dart diff --git a/.claude/skills/openapi-migration/SKILL.md b/.claude/skills/openapi-migration/SKILL.md index 1fb151e7d1..7c4bde750a 100644 --- a/.claude/skills/openapi-migration/SKILL.md +++ b/.claude/skills/openapi-migration/SKILL.md @@ -439,7 +439,9 @@ Budget for this: on a typical feature it is most of the diff, and none of it is (`ListDevicesResponse()..devices = …`). Stubs of `DefaultApi` now answer generated types, and the restored envelopes are plain classes with const constructors, so those fixtures must be rewritten. - `test/src/core/api/responses_test.dart` round-trips the DTO from JSON — delete those cases with the DTO's JSON. -- **Test each mapper from a fully populated generated response,** so a field the mapper drops fails an assertion. +- **Test mapping through the public client method,** from a generated response that sets every field the model + carries with a distinct value, so a field the mapper drops or swaps fails an assertion. No separate repository or + mapper tests. - **Test each temporary converter,** both on its own and wired through its parent's `fromJson`/`toJson`. - **Test each `@DataSerializable` model's stored format:** pin `toData()` to a literal map, so a rename that changes the stored keys fails; round-trip `fromData(toData())`; cover null versus empty for nullable lists. Extend the diff --git a/openapi-migration/02-devices.md b/openapi-migration/02-devices.md index 91fc462042..71e2e9abeb 100644 --- a/openapi-migration/02-devices.md +++ b/openapi-migration/02-devices.md @@ -69,8 +69,9 @@ Revisited after landing: the group first adopted the generated `DeviceResponse`, covered: a regeneration that moved a parameter between query and body would pass CI. **This is the testing precedent for every later group** — mock at the `DefaultApi` seam, and let the generated client own the transport. -- **Mapping is tested from a fully populated generated response,** so a field the mapper drops shows - up as a failing assertion rather than a silent loss. +- **Test mapping through the public client method,** from a generated response that sets every field the + model carries with a distinct value, so a field the mapper drops or swaps fails an assertion. No separate + repository or mapper tests. - **`setPushPreferences` did not come along,** so `device_api.dart` was renamed `push_preferences_api.dart` (`DeviceApi` → `PushPreferencesApi`, `StreamChatApi.device` → `StreamChatApi.pushPreferences`) rather than deleted — the file split rather than migrating whole. diff --git a/openapi-migration/tool/generate_plan.py b/openapi-migration/tool/generate_plan.py index f853e5d07b..1ad1237b10 100644 --- a/openapi-migration/tool/generate_plan.py +++ b/openapi-migration/tool/generate_plan.py @@ -142,8 +142,9 @@ def match(path): covered: a regeneration that moved a parameter between query and body would pass CI. **This is the testing precedent for every later group** — mock at the `DefaultApi` seam, and let the generated client own the transport. - - **Mapping is tested from a fully populated generated response,** so a field the mapper drops shows - up as a failing assertion rather than a silent loss. + - **Test mapping through the public client method,** from a generated response that sets every field the + model carries with a distinct value, so a field the mapper drops or swaps fails an assertion. No separate + repository or mapper tests. - **`setPushPreferences` did not come along,** so `device_api.dart` was renamed `push_preferences_api.dart` (`DeviceApi` → `PushPreferencesApi`, `StreamChatApi.device` → `StreamChatApi.pushPreferences`) rather than deleted — the file split rather than migrating whole. diff --git a/packages/stream_chat/test/src/client/client_test.dart b/packages/stream_chat/test/src/client/client_test.dart index 486405e07b..4c441550e7 100644 --- a/packages/stream_chat/test/src/client/client_test.dart +++ b/packages/stream_chat/test/src/client/client_test.dart @@ -1851,13 +1851,30 @@ void main() { ); final res = await client.addDevice(id, PushProvider.firebase); - expect(res.isSuccess, isTrue); + expect(res, const Result.success(null)); + + verify(() => defaultApi.createDevice(createDeviceRequest: request)).called(1); + verifyNoMoreInteractions(defaultApi); + }); + + test('StreamChatClient.addDevice sends a provider without a constant by its wire value', () async { + const id = 'test-device-id'; + final request = api.CreateDeviceRequest( + id: id, + pushProvider: api.CreateDeviceRequestPushProvider.fromJson('onesignal'), + ); + + when(() => defaultApi.createDevice(createDeviceRequest: request)).thenAnswer( + (_) async => const Result.success(api.DurationResponse(duration: '0.01ms')), + ); + + await client.addDevice(id, const PushProvider('onesignal')); verify(() => defaultApi.createDevice(createDeviceRequest: request)).called(1); verifyNoMoreInteractions(defaultApi); }); - test('StreamChatClient.addDevice forwards the push provider name', () async { + test('StreamChatClient.addDevice sends the push provider name', () async { const id = 'test-device-id'; const pushProviderName = 'my-custom-config'; const request = api.CreateDeviceRequest( @@ -1870,8 +1887,24 @@ void main() { (_) async => const Result.success(api.DurationResponse(duration: '0.01ms')), ); - final res = await client.addDevice(id, PushProvider.firebase, pushProviderName: pushProviderName); - expect(res.isSuccess, isTrue); + await client.addDevice(id, PushProvider.firebase, pushProviderName: pushProviderName); + + verify(() => defaultApi.createDevice(createDeviceRequest: request)).called(1); + verifyNoMoreInteractions(defaultApi); + }); + + test('StreamChatClient.addDevice sends an empty provider name as no name', () async { + const id = 'test-device-id'; + const request = api.CreateDeviceRequest( + id: id, + pushProvider: api.CreateDeviceRequestPushProvider.apn, + ); + + when(() => defaultApi.createDevice(createDeviceRequest: request)).thenAnswer( + (_) async => const Result.success(api.DurationResponse(duration: '0.01ms')), + ); + + await client.addDevice(id, PushProvider.apn, pushProviderName: ''); verify(() => defaultApi.createDevice(createDeviceRequest: request)).called(1); verifyNoMoreInteractions(defaultApi); @@ -1890,32 +1923,49 @@ void main() { final res = await client.addDevice('test-device-id', PushProvider.firebase); - expect(res.isFailure, isTrue); expect(res.exceptionOrNull(), error); }); test('StreamChatClient.getDevices returns the registered devices', () async { - final devices = List.generate( - 3, - (index) => api.DeviceResponse( - id: 'test-device-id-$index', - pushProvider: api.CreateDeviceRequestPushProvider.firebase, - createdAt: DateTime.utc(2024), - userId: userId, - ), - ); - when(defaultApi.listDevices).thenAnswer( - (_) async => Result.success(api.ListDevicesResponse(duration: '0.01ms', devices: devices)), + (_) async => Result.success( + api.ListDevicesResponse( + duration: '0.01ms', + devices: [ + _generatedDevice(id: 'device-1', pushProvider: 'firebase'), + _generatedDevice(id: 'device-2', pushProvider: 'apn'), + _generatedDevice(id: 'device-3', pushProvider: 'huawei'), + ], + ), + ), ); final res = await client.getDevices(); - expect(res.getOrNull()?.devices.map((it) => it.id), [for (final device in devices) device.id]); + expect( + res.getOrNull(), + const ListDevicesResponse( + duration: '0.01ms', + devices: [ + Device(id: 'device-1', pushProvider: PushProvider.firebase), + Device(id: 'device-2', pushProvider: PushProvider.apn), + Device(id: 'device-3', pushProvider: PushProvider.huawei), + ], + ), + ); verify(defaultApi.listDevices).called(1); verifyNoMoreInteractions(defaultApi); }); + test('StreamChatClient.getDevices returns the failure without throwing', () async { + const error = StreamClientException(message: 'boom'); + when(defaultApi.listDevices).thenAnswer((_) async => const Result.failure(error)); + + final res = await client.getDevices(); + + expect(res.exceptionOrNull(), error); + }); + test('StreamChatClient.removeDevice sends the device id and returns a success', () async { const deviceId = 'test-device-id'; @@ -1924,12 +1974,21 @@ void main() { ); final res = await client.removeDevice(deviceId); - expect(res.isSuccess, isTrue); + expect(res, const Result.success(null)); verify(() => defaultApi.deleteDevice(id: deviceId)).called(1); verifyNoMoreInteractions(defaultApi); }); + test('StreamChatClient.removeDevice returns the failure without throwing', () async { + const error = StreamClientException(message: 'boom'); + when(() => defaultApi.deleteDevice(id: 'test-device-id')).thenAnswer((_) async => const Result.failure(error)); + + final res = await client.removeDevice('test-device-id'); + + expect(res.exceptionOrNull(), error); + }); + test('`.setPushPreferences`', () async { const pushPreferenceInput = PushPreferenceInput( chatLevel: ChatLevel.mentions, @@ -2012,10 +2071,10 @@ void main() { expect(pushPreferences?.disabledUntil, pushPreference.disabledUntil); }); - test('StreamChatClient.listUserGroups sends the pagination arguments and returns the mapped groups', () async { + test('StreamChatClient.listUserGroups sends the pagination arguments and returns the listed groups', () async { const limit = 10; const idGt = 'cursor-group-id'; - final createdAtGt = DateTime.utc(2024, 6, 15, 12); + final createdAtGt = DateTime.utc(2024, 6, 15, 12).toLocal(); const teamId = 'test-team-id'; when( @@ -2027,12 +2086,18 @@ void main() { ), ).thenAnswer( (_) async => Result.success( - api.ListUserGroupsResponse(duration: '0.01ms', userGroups: [_generatedUserGroup('group-id')]), + api.ListUserGroupsResponse( + duration: '0.01ms', + userGroups: [_generatedUserGroup('group-1'), _generatedUserGroup('group-2')], + ), ), ); final res = await client.listUserGroups(limit: limit, idGt: idGt, createdAtGt: createdAtGt, teamId: teamId); - expect(res.getOrNull()?.userGroups, [_userGroup('group-id')]); + expect( + res.getOrNull(), + ListUserGroupsResponse(duration: '0.01ms', userGroups: [_userGroup('group-1'), _userGroup('group-2')]), + ); verify( () => defaultApi.listUserGroups( @@ -2045,7 +2110,16 @@ void main() { verifyNoMoreInteractions(defaultApi); }); - test('StreamChatClient.searchUserGroups sends the query and returns the mapped groups', () async { + test('StreamChatClient.listUserGroups returns the failure without throwing', () async { + const error = StreamClientException(message: 'boom'); + when(() => defaultApi.listUserGroups()).thenAnswer((_) async => const Result.failure(error)); + + final res = await client.listUserGroups(); + + expect(res.exceptionOrNull(), error); + }); + + test('StreamChatClient.searchUserGroups sends the query and returns the matching groups', () async { const query = 'eng'; const limit = 10; const nameGt = 'engineering'; @@ -2056,12 +2130,18 @@ void main() { () => defaultApi.searchUserGroups(query: query, limit: limit, nameGt: nameGt, idGt: idGt, teamId: teamId), ).thenAnswer( (_) async => Result.success( - api.SearchUserGroupsResponse(duration: '0.01ms', userGroups: [_generatedUserGroup('group-id')]), + api.SearchUserGroupsResponse( + duration: '0.01ms', + userGroups: [_generatedUserGroup('group-1'), _generatedUserGroup('group-2')], + ), ), ); final res = await client.searchUserGroups(query, limit: limit, nameGt: nameGt, idGt: idGt, teamId: teamId); - expect(res.getOrNull()?.userGroups, [_userGroup('group-id')]); + expect( + res.getOrNull(), + SearchUserGroupsResponse(duration: '0.01ms', userGroups: [_userGroup('group-1'), _userGroup('group-2')]), + ); verify( () => defaultApi.searchUserGroups(query: query, limit: limit, nameGt: nameGt, idGt: idGt, teamId: teamId), @@ -2069,22 +2149,141 @@ void main() { verifyNoMoreInteractions(defaultApi); }); - test('StreamChatClient.getUserGroup sends the id and team and returns the mapped group', () async { + test('StreamChatClient.searchUserGroups returns the failure without throwing', () async { + const error = StreamClientException(message: 'boom'); + when(() => defaultApi.searchUserGroups(query: 'eng')).thenAnswer((_) async => const Result.failure(error)); + + final res = await client.searchUserGroups('eng'); + + expect(res.exceptionOrNull(), error); + }); + + test('StreamChatClient.getUserGroup sends the id and team and returns the group', () async { const id = 'test-group-id'; const teamId = 'test-team-id'; when(() => defaultApi.getUserGroup(id: id, teamId: teamId)).thenAnswer( - (_) async => Result.success(api.GetUserGroupResponse(duration: '0.01ms', userGroup: _generatedUserGroup(id))), + (_) async => Result.success( + api.GetUserGroupResponse( + duration: '0.01ms', + userGroup: api.UserGroupResponse( + createdAt: DateTime.utc(2024, 1, 2), + createdBy: 'test-creator-id', + description: 'Everyone on call this week', + id: id, + members: [ + api.UserGroupMember( + appPk: 42, + createdAt: DateTime.utc(2024, 5, 6), + groupId: id, + isAdmin: true, + userId: 'test-user-1', + ), + api.UserGroupMember( + appPk: 42, + createdAt: DateTime.utc(2024, 7, 8), + groupId: id, + isAdmin: false, + userId: 'test-user-2', + ), + ], + name: 'on-call', + teamId: teamId, + updatedAt: DateTime.utc(2024, 3, 4), + ), + ), + ), ); final res = await client.getUserGroup(id, teamId: teamId); - expect(res.getOrNull()?.userGroup, _userGroup(id)); + expect( + res.getOrNull(), + GetUserGroupResponse( + duration: '0.01ms', + userGroup: UserGroup( + createdAt: DateTime.utc(2024, 1, 2), + createdBy: 'test-creator-id', + description: 'Everyone on call this week', + id: id, + members: [ + UserGroupMember( + createdAt: DateTime.utc(2024, 5, 6), + groupId: id, + isAdmin: true, + userId: 'test-user-1', + ), + UserGroupMember( + createdAt: DateTime.utc(2024, 7, 8), + groupId: id, + isAdmin: false, + userId: 'test-user-2', + ), + ], + name: 'on-call', + teamId: teamId, + updatedAt: DateTime.utc(2024, 3, 4), + ), + ), + ); verify(() => defaultApi.getUserGroup(id: id, teamId: teamId)).called(1); verifyNoMoreInteractions(defaultApi); }); - test('StreamChatClient.createUserGroup sends the arguments and returns the mapped group', () async { + test('StreamChatClient.getUserGroup keeps the members null when the response leaves them out', () async { + const id = 'test-group-id'; + when(() => defaultApi.getUserGroup(id: id)).thenAnswer( + (_) async => Result.success(api.GetUserGroupResponse(duration: '0.01ms', userGroup: _generatedUserGroup(id))), + ); + + final res = await client.getUserGroup(id); + + expect(res.getOrNull()!.userGroup!.members, isNull); + }); + + test('StreamChatClient.getUserGroup keeps an empty member list empty', () async { + const id = 'test-group-id'; + when(() => defaultApi.getUserGroup(id: id)).thenAnswer( + (_) async => Result.success( + api.GetUserGroupResponse( + duration: '0.01ms', + userGroup: api.UserGroupResponse( + createdAt: DateTime.utc(2024), + id: id, + members: const [], + name: 'name-$id', + updatedAt: DateTime.utc(2024), + ), + ), + ), + ); + + final res = await client.getUserGroup(id); + + expect(res.getOrNull()!.userGroup!.members, isEmpty); + }); + + test('StreamChatClient.getUserGroup returns a null group when the response has none', () async { + const id = 'test-group-id'; + when(() => defaultApi.getUserGroup(id: id)).thenAnswer( + (_) async => const Result.success(api.GetUserGroupResponse(duration: '0.01ms')), + ); + + final res = await client.getUserGroup(id); + + expect(res, const Result.success(GetUserGroupResponse(duration: '0.01ms'))); + }); + + test('StreamChatClient.getUserGroup returns the failure without throwing', () async { + const error = StreamClientException(message: 'boom'); + when(() => defaultApi.getUserGroup(id: 'test-group-id')).thenAnswer((_) async => const Result.failure(error)); + + final res = await client.getUserGroup('test-group-id'); + + expect(res.exceptionOrNull(), error); + }); + + test('StreamChatClient.createUserGroup sends the arguments and returns the created group', () async { const name = 'Engineering'; const id = 'test-group-id'; const description = 'The engineers'; @@ -2110,13 +2309,36 @@ void main() { teamId: teamId, memberIds: memberIds, ); - expect(res.getOrNull()?.userGroup, _userGroup(id)); + expect(res.getOrNull(), CreateUserGroupResponse(duration: '0.01ms', userGroup: _userGroup(id))); verify(() => defaultApi.createUserGroup(createUserGroupRequest: request)).called(1); verifyNoMoreInteractions(defaultApi); }); - test('StreamChatClient.updateUserGroup sends the arguments and returns the mapped group', () async { + test('StreamChatClient.createUserGroup returns a null group when the response has none', () async { + const request = api.CreateUserGroupRequest(name: 'Engineering'); + when(() => defaultApi.createUserGroup(createUserGroupRequest: request)).thenAnswer( + (_) async => const Result.success(api.CreateUserGroupResponse(duration: '0.01ms')), + ); + + final res = await client.createUserGroup('Engineering'); + + expect(res, const Result.success(CreateUserGroupResponse(duration: '0.01ms'))); + }); + + test('StreamChatClient.createUserGroup returns the failure without throwing', () async { + const error = StreamClientException(message: 'boom'); + const request = api.CreateUserGroupRequest(name: 'Engineering'); + when( + () => defaultApi.createUserGroup(createUserGroupRequest: request), + ).thenAnswer((_) async => const Result.failure(error)); + + final res = await client.createUserGroup('Engineering'); + + expect(res.exceptionOrNull(), error); + }); + + test('StreamChatClient.updateUserGroup sends the arguments and returns the updated group', () async { const id = 'test-group-id'; const name = 'Engineering'; const description = 'The engineers'; @@ -2129,13 +2351,36 @@ void main() { ); final res = await client.updateUserGroup(id, name: name, description: description, teamId: teamId); - expect(res.getOrNull()?.userGroup, _userGroup(id)); + expect(res.getOrNull(), UpdateUserGroupResponse(duration: '0.01ms', userGroup: _userGroup(id))); verify(() => defaultApi.updateUserGroup(id: id, updateUserGroupRequest: request)).called(1); verifyNoMoreInteractions(defaultApi); }); - test('StreamChatClient.deleteUserGroup sends the id and team and returns a success with no value', () async { + test('StreamChatClient.updateUserGroup returns a null group when the response has none', () async { + const id = 'test-group-id'; + when( + () => defaultApi.updateUserGroup(id: id, updateUserGroupRequest: const api.UpdateUserGroupRequest()), + ).thenAnswer((_) async => const Result.success(api.UpdateUserGroupResponse(duration: '0.01ms'))); + + final res = await client.updateUserGroup(id); + + expect(res, const Result.success(UpdateUserGroupResponse(duration: '0.01ms'))); + }); + + test('StreamChatClient.updateUserGroup returns the failure without throwing', () async { + const id = 'test-group-id'; + const error = StreamClientException(message: 'boom'); + when( + () => defaultApi.updateUserGroup(id: id, updateUserGroupRequest: const api.UpdateUserGroupRequest()), + ).thenAnswer((_) async => const Result.failure(error)); + + final res = await client.updateUserGroup(id); + + expect(res.exceptionOrNull(), error); + }); + + test('StreamChatClient.deleteUserGroup sends the id and team and returns a success', () async { const id = 'test-group-id'; const teamId = 'test-team-id'; @@ -2150,7 +2395,16 @@ void main() { verifyNoMoreInteractions(defaultApi); }); - test('StreamChatClient.addUserGroupMembers sends the members and returns the mapped group', () async { + test('StreamChatClient.deleteUserGroup returns the failure without throwing', () async { + const error = StreamClientException(message: 'boom'); + when(() => defaultApi.deleteUserGroup(id: 'test-group-id')).thenAnswer((_) async => const Result.failure(error)); + + final res = await client.deleteUserGroup('test-group-id'); + + expect(res.exceptionOrNull(), error); + }); + + test('StreamChatClient.addUserGroupMembers sends the members and returns the updated group', () async { const id = 'test-group-id'; const memberIds = ['test-user-id']; const teamId = 'test-team-id'; @@ -2162,13 +2416,38 @@ void main() { ); final res = await client.addUserGroupMembers(id, memberIds, asAdmin: true, teamId: teamId); - expect(res.getOrNull()?.userGroup, _userGroup(id)); + expect(res.getOrNull(), AddUserGroupMembersResponse(duration: '0.01ms', userGroup: _userGroup(id))); verify(() => defaultApi.addUserGroupMembers(id: id, addUserGroupMembersRequest: request)).called(1); verifyNoMoreInteractions(defaultApi); }); - test('StreamChatClient.removeUserGroupMembers sends the members and returns the mapped group', () async { + test('StreamChatClient.addUserGroupMembers returns a null group when the response has none', () async { + const id = 'test-group-id'; + const request = api.AddUserGroupMembersRequest(memberIds: ['test-user-id']); + when(() => defaultApi.addUserGroupMembers(id: id, addUserGroupMembersRequest: request)).thenAnswer( + (_) async => const Result.success(api.AddUserGroupMembersResponse(duration: '0.01ms')), + ); + + final res = await client.addUserGroupMembers(id, const ['test-user-id']); + + expect(res, const Result.success(AddUserGroupMembersResponse(duration: '0.01ms'))); + }); + + test('StreamChatClient.addUserGroupMembers returns the failure without throwing', () async { + const id = 'test-group-id'; + const error = StreamClientException(message: 'boom'); + const request = api.AddUserGroupMembersRequest(memberIds: ['test-user-id']); + when( + () => defaultApi.addUserGroupMembers(id: id, addUserGroupMembersRequest: request), + ).thenAnswer((_) async => const Result.failure(error)); + + final res = await client.addUserGroupMembers(id, const ['test-user-id']); + + expect(res.exceptionOrNull(), error); + }); + + test('StreamChatClient.removeUserGroupMembers sends the members and returns the updated group', () async { const id = 'test-group-id'; const memberIds = ['test-user-id']; const teamId = 'test-team-id'; @@ -2180,25 +2459,38 @@ void main() { ); final res = await client.removeUserGroupMembers(id, memberIds, teamId: teamId); - expect(res.getOrNull()?.userGroup, _userGroup(id)); + expect(res.getOrNull(), RemoveUserGroupMembersResponse(duration: '0.01ms', userGroup: _userGroup(id))); verify(() => defaultApi.removeUserGroupMembers(id: id, removeUserGroupMembersRequest: request)).called(1); verifyNoMoreInteractions(defaultApi); }); - test('StreamChatClient.searchUserGroups returns the failure without throwing', () async { - const error = StreamClientException(message: 'boom'); + test('StreamChatClient.removeUserGroupMembers returns a null group when the response has none', () async { + const id = 'test-group-id'; + const request = api.RemoveUserGroupMembersRequest(memberIds: ['test-user-id']); + when(() => defaultApi.removeUserGroupMembers(id: id, removeUserGroupMembersRequest: request)).thenAnswer( + (_) async => const Result.success(api.RemoveUserGroupMembersResponse(duration: '0.01ms')), + ); + + final res = await client.removeUserGroupMembers(id, const ['test-user-id']); + + expect(res, const Result.success(RemoveUserGroupMembersResponse(duration: '0.01ms'))); + }); + test('StreamChatClient.removeUserGroupMembers returns the failure without throwing', () async { + const id = 'test-group-id'; + const error = StreamClientException(message: 'boom'); + const request = api.RemoveUserGroupMembersRequest(memberIds: ['test-user-id']); when( - () => defaultApi.searchUserGroups(query: 'eng'), + () => defaultApi.removeUserGroupMembers(id: id, removeUserGroupMembersRequest: request), ).thenAnswer((_) async => const Result.failure(error)); - final res = await client.searchUserGroups('eng'); + final res = await client.removeUserGroupMembers(id, const ['test-user-id']); expect(res.exceptionOrNull(), error); }); - test('StreamChatClient.searchRoles sends the query and returns the mapped response', () async { + test('StreamChatClient.searchRoles sends the query and returns the matching roles', () async { const query = 'adm'; const limit = 10; const nameGt = 'admin'; @@ -2214,7 +2506,27 @@ void main() { includeGlobalRoles: includeGlobalRoles, ), ).thenAnswer( - (_) async => const Result.success(api.SearchRolesResponse(duration: '0.01ms', roles: [])), + (_) async => Result.success( + api.SearchRolesResponse( + duration: '0.01ms', + roles: [ + api.Role( + name: 'admin', + custom: false, + scopes: const ['.app'], + createdAt: DateTime.utc(2024, 1, 2), + updatedAt: DateTime.utc(2024, 3, 4), + ), + api.Role( + name: 'admin_lite', + custom: true, + scopes: const ['messaging'], + createdAt: DateTime.utc(2024, 5, 6), + updatedAt: DateTime.utc(2024, 7, 8), + ), + ], + ), + ), ); final res = await client.searchRoles( @@ -2224,8 +2536,28 @@ void main() { roleType: roleType, includeGlobalRoles: includeGlobalRoles, ); - expect(res.getOrNull()?.duration, '0.01ms'); - expect(res.getOrNull()?.roles, isEmpty); + expect( + res.getOrNull(), + SearchRolesResponse( + duration: '0.01ms', + roles: [ + Role( + name: 'admin', + custom: false, + scopes: const ['.app'], + createdAt: DateTime.utc(2024, 1, 2), + updatedAt: DateTime.utc(2024, 3, 4), + ), + Role( + name: 'admin_lite', + custom: true, + scopes: const ['messaging'], + createdAt: DateTime.utc(2024, 5, 6), + updatedAt: DateTime.utc(2024, 7, 8), + ), + ], + ), + ); verify( () => defaultApi.searchRoles( @@ -2249,10 +2581,22 @@ void main() { final res = await client.searchRoles(query); - expect(res.isFailure, isTrue); expect(res.exceptionOrNull(), error); }); + test('StreamChatClient.searchRoles sends only the query when nothing else is given', () async { + const query = 'adm'; + + when( + () => defaultApi.searchRoles(query: query), + ).thenAnswer((_) async => const Result.success(api.SearchRolesResponse(duration: '0.01ms', roles: []))); + + await client.searchRoles(query); + + verify(() => defaultApi.searchRoles(query: query)).called(1); + verifyNoMoreInteractions(defaultApi); + }); + group('`.channel`', () { test('should return back a new channel instance', () { const channelType = 'test-channel-type'; @@ -4798,81 +5142,24 @@ void main() { verifyNoMoreInteractions(fakeChatApi.message); }); - test('StreamChatClient.enrichUrl returns the scraped metadata of the url', () async { - const url = 'https://www.techyourchance.com/finite-state-machine-with-unit-tests-real-world-example'; + test('StreamChatClient.enrichUrl sends the url and returns the scraped metadata', () async { + const url = 'https://getstream.io/chat'; when(() => defaultApi.getOG(url: url)).thenAnswer( (_) async => const Result.success( api.GetOGResponse( duration: '0.01ms', custom: {}, - type: 'image', - ogScrapeUrl: url, - authorName: 'TechYourChance', - title: 'Finite State Machine with Unit Tests: Real World Example', - ), - ), - ); - - final res = await client.enrichUrl(url); - expect( - res.getOrNull(), - const OGAttachmentResponse( - duration: '0.01ms', - type: 'image', - ogScrapeUrl: url, - authorName: 'TechYourChance', - title: 'Finite State Machine with Unit Tests: Real World Example', - ), - ); - - verify(() => defaultApi.getOG(url: url)).called(1); - verifyNoMoreInteractions(defaultApi); - }); - - test('StreamChatClient.enrichUrl maps every field of a fully populated response', () async { - const url = 'https://getstream.io/chat'; - const image = api.ImageData( - frames: '1', - height: '200', - size: '1024', - url: 'https://giphy.com/1.gif', - width: '200', - ); - when(() => defaultApi.getOG(url: url)).thenAnswer( - (_) async => const Result.success( - api.GetOGResponse( - duration: '0.01ms', ogScrapeUrl: 'https://getstream.io/chat/', assetUrl: 'https://getstream.io/chat/intro.mp4', - authorIcon: 'https://getstream.io/favicon.ico', authorLink: 'https://getstream.io', authorName: 'Stream', - color: '#005fff', - custom: {'campaign': 'launch'}, - fallback: 'Stream Chat link preview', - footer: 'getstream.io', - footerIcon: 'https://getstream.io/footer.png', imageUrl: 'https://getstream.io/chat/og.png', - originalHeight: 630, - originalWidth: 1200, - pretext: 'Stream Chat', text: 'Build real-time chat in less time.', thumbUrl: 'https://getstream.io/chat/og-thumb.png', title: 'Chat API & SDKs', titleLink: 'https://getstream.io/chat/?utm_source=og', type: 'video', - actions: [api.Action(name: 'image_action', text: 'Send', type: 'button', style: 'primary', value: 'send')], - fields: [api.Field(short: true, title: 'Plan', value: 'Free')], - giphy: api.Images( - fixedHeight: image, - fixedHeightDownsampled: image, - fixedHeightStill: image, - fixedWidth: image, - fixedWidthDownsampled: image, - fixedWidthStill: image, - original: image, - ), ), ), ); @@ -4894,6 +5181,9 @@ void main() { type: 'video', ), ); + + verify(() => defaultApi.getOG(url: url)).called(1); + verifyNoMoreInteractions(defaultApi); }); test('StreamChatClient.enrichUrl falls back to the requested url when the response has no scraped url', () async { @@ -6539,3 +6829,7 @@ UserGroup _userGroup(String id) { updatedAt: DateTime.utc(2024), ); } + +api.DeviceResponse _generatedDevice({required String id, required String pushProvider}) { + return api.DeviceResponse(id: id, pushProvider: pushProvider, createdAt: DateTime.utc(2024), userId: 'test-user-id'); +} diff --git a/packages/stream_chat/test/src/repository/devices_repository_test.dart b/packages/stream_chat/test/src/repository/devices_repository_test.dart deleted file mode 100644 index 3ca77e72e4..0000000000 --- a/packages/stream_chat/test/src/repository/devices_repository_test.dart +++ /dev/null @@ -1,158 +0,0 @@ -import 'package:mocktail/mocktail.dart'; -import 'package:stream_chat/open_api/api.dart' as api; -import 'package:stream_chat/src/core/models/device.dart'; -import 'package:stream_chat/src/core/models/push_provider.dart'; -import 'package:stream_chat/src/core/models/response/list_devices_response.dart'; -import 'package:stream_chat/src/repository/devices_repository.dart'; -import 'package:stream_core/stream_core.dart'; -import 'package:test/test.dart'; - -import '../mocks.dart'; - -void main() { - test('DevicesRepository.addDevice forwards the id and provider without a name', () async { - final defaultApi = MockDefaultApi(); - const request = api.CreateDeviceRequest( - id: 'device-id', - pushProvider: api.CreateDeviceRequestPushProvider.firebase, - ); - _stubCreateDevice(defaultApi, request); - - await DevicesRepository(defaultApi).addDevice('device-id', PushProvider.firebase); - - verify(() => defaultApi.createDevice(createDeviceRequest: request)).called(1); - verifyNoMoreInteractions(defaultApi); - }); - - test('DevicesRepository.addDevice forwards the provider name when given', () async { - final defaultApi = MockDefaultApi(); - const request = api.CreateDeviceRequest( - id: 'device-id', - pushProvider: api.CreateDeviceRequestPushProvider.apn, - pushProviderName: 'staging', - ); - _stubCreateDevice(defaultApi, request); - - await DevicesRepository(defaultApi).addDevice('device-id', PushProvider.apn, pushProviderName: 'staging'); - - verify(() => defaultApi.createDevice(createDeviceRequest: request)).called(1); - verifyNoMoreInteractions(defaultApi); - }); - - test('DevicesRepository.addDevice sends an empty provider name as no name', () async { - final defaultApi = MockDefaultApi(); - const request = api.CreateDeviceRequest( - id: 'device-id', - pushProvider: api.CreateDeviceRequestPushProvider.apn, - ); - _stubCreateDevice(defaultApi, request); - - await DevicesRepository(defaultApi).addDevice('device-id', PushProvider.apn, pushProviderName: ''); - - verify(() => defaultApi.createDevice(createDeviceRequest: request)).called(1); - verifyNoMoreInteractions(defaultApi); - }); - - test('DevicesRepository.addDevice returns a success with no value when the server accepts the device', () async { - final defaultApi = MockDefaultApi(); - const request = api.CreateDeviceRequest( - id: 'device-id', - pushProvider: api.CreateDeviceRequestPushProvider.firebase, - ); - _stubCreateDevice(defaultApi, request); - - final res = await DevicesRepository(defaultApi).addDevice('device-id', PushProvider.firebase); - - expect(res, const Result.success(null)); - }); - - test('DevicesRepository.addDevice returns the failure without throwing', () async { - final defaultApi = MockDefaultApi(); - const error = StreamClientException(message: 'boom'); - const request = api.CreateDeviceRequest( - id: 'device-id', - pushProvider: api.CreateDeviceRequestPushProvider.firebase, - ); - when( - () => defaultApi.createDevice(createDeviceRequest: request), - ).thenAnswer((_) async => const Result.failure(error)); - - final res = await DevicesRepository(defaultApi).addDevice('device-id', PushProvider.firebase); - - expect(res.exceptionOrNull(), error); - }); - - test('DevicesRepository.getDevices returns the mapped response', () async { - final defaultApi = MockDefaultApi(); - final device = api.DeviceResponse( - id: 'device-id', - pushProvider: 'firebase', - createdAt: DateTime.utc(2024), - userId: 'user-id', - ); - when(defaultApi.listDevices).thenAnswer( - (_) async => Result.success(api.ListDevicesResponse(duration: '0.02ms', devices: [device])), - ); - - final res = await DevicesRepository(defaultApi).getDevices(); - - expect( - res.getOrNull(), - const ListDevicesResponse( - duration: '0.02ms', - devices: [Device(id: 'device-id', pushProvider: PushProvider.firebase)], - ), - ); - }); - - test('DevicesRepository.getDevices returns the failure without throwing', () async { - final defaultApi = MockDefaultApi(); - const error = StreamClientException(message: 'boom'); - when(defaultApi.listDevices).thenAnswer((_) async => const Result.failure(error)); - - final res = await DevicesRepository(defaultApi).getDevices(); - - expect(res.exceptionOrNull(), error); - }); - - test('DevicesRepository.removeDevice forwards the id', () async { - final defaultApi = MockDefaultApi(); - _stubDeleteDevice(defaultApi, 'device-id'); - - await DevicesRepository(defaultApi).removeDevice('device-id'); - - verify(() => defaultApi.deleteDevice(id: 'device-id')).called(1); - verifyNoMoreInteractions(defaultApi); - }); - - test('DevicesRepository.removeDevice returns a success with no value when the server removes the device', () async { - final defaultApi = MockDefaultApi(); - _stubDeleteDevice(defaultApi, 'device-id'); - - final res = await DevicesRepository(defaultApi).removeDevice('device-id'); - - expect(res, const Result.success(null)); - }); - - test('DevicesRepository.removeDevice returns the failure without throwing', () async { - final defaultApi = MockDefaultApi(); - const error = StreamClientException(message: 'boom'); - when(() => defaultApi.deleteDevice(id: 'device-id')).thenAnswer((_) async => const Result.failure(error)); - - final res = await DevicesRepository(defaultApi).removeDevice('device-id'); - - expect(res.exceptionOrNull(), error); - }); -} - -void _stubCreateDevice(MockDefaultApi defaultApi, api.CreateDeviceRequest request) { - when(() => defaultApi.createDevice(createDeviceRequest: request)).thenAnswer( - (_) async => const Result.success(api.DurationResponse(duration: '0.01ms')), - ); -} - -void _stubDeleteDevice(MockDefaultApi defaultApi, String id) { - when(() => defaultApi.deleteDevice(id: id)).thenAnswer( - (_) async => const Result.success(api.DurationResponse(duration: '0.01ms')), - ); -} diff --git a/packages/stream_chat/test/src/repository/mapper/devices_mapper_test.dart b/packages/stream_chat/test/src/repository/mapper/devices_mapper_test.dart deleted file mode 100644 index e342622b02..0000000000 --- a/packages/stream_chat/test/src/repository/mapper/devices_mapper_test.dart +++ /dev/null @@ -1,71 +0,0 @@ -import 'package:stream_chat/open_api/api.dart' as api; -import 'package:stream_chat/src/core/models/device.dart'; -import 'package:stream_chat/src/core/models/push_provider.dart'; -import 'package:stream_chat/src/repository/mapper/devices_mapper.dart'; -import 'package:test/test.dart'; - -void main() { - test('DeviceResponse.toModel maps the id and push provider', () { - final response = api.DeviceResponse( - id: 'device-id', - pushProvider: 'firebase', - createdAt: DateTime.utc(2024), - userId: 'user-id', - ); - - expect(response.toModel(), const Device(id: 'device-id', pushProvider: PushProvider.firebase)); - }); - - test('ListDevicesResponse.toModel keeps the duration', () { - const response = api.ListDevicesResponse(duration: '0.02ms', devices: []); - - expect(response.toModel().duration, '0.02ms'); - }); - - test('ListDevicesResponse.toModel maps every device in order', () { - final response = api.ListDevicesResponse( - duration: '0.01ms', - devices: [ - _deviceResponse(id: 'device-1', pushProvider: 'firebase'), - _deviceResponse(id: 'device-2', pushProvider: 'apn'), - _deviceResponse(id: 'device-3', pushProvider: 'huawei'), - ], - ); - - expect(response.toModel().devices, const [ - Device(id: 'device-1', pushProvider: PushProvider.firebase), - Device(id: 'device-2', pushProvider: PushProvider.apn), - Device(id: 'device-3', pushProvider: PushProvider.huawei), - ]); - }); - - test('PushProvider.toRequest carries the wire value of every provider, named or not', () { - const providers = [ - PushProvider.firebase, - PushProvider.huawei, - PushProvider.xiaomi, - PushProvider.apn, - PushProvider('onesignal'), - ]; - - expect( - [for (final provider in providers) provider.toRequest()], - [ - api.CreateDeviceRequestPushProvider.firebase, - api.CreateDeviceRequestPushProvider.huawei, - api.CreateDeviceRequestPushProvider.xiaomi, - api.CreateDeviceRequestPushProvider.apn, - api.CreateDeviceRequestPushProvider.fromJson('onesignal'), - ], - ); - }); -} - -api.DeviceResponse _deviceResponse({required String id, required String pushProvider}) { - return api.DeviceResponse( - id: id, - pushProvider: pushProvider, - createdAt: DateTime.utc(2024), - userId: 'user-id', - ); -} diff --git a/packages/stream_chat/test/src/repository/mapper/roles_mapper_test.dart b/packages/stream_chat/test/src/repository/mapper/roles_mapper_test.dart deleted file mode 100644 index 78835c2511..0000000000 --- a/packages/stream_chat/test/src/repository/mapper/roles_mapper_test.dart +++ /dev/null @@ -1,54 +0,0 @@ -import 'package:stream_chat/open_api/api.dart' as api; -import 'package:stream_chat/src/core/models/role.dart'; -import 'package:stream_chat/src/repository/mapper/roles_mapper.dart'; -import 'package:test/test.dart'; - -void main() { - test('Role.toModel maps every field of the generated role', () { - final generated = api.Role( - name: 'moderator', - custom: true, - scopes: const ['.app', 'messaging'], - createdAt: DateTime.utc(2024, 1, 2), - updatedAt: DateTime.utc(2024, 3, 4), - ); - - expect( - generated.toModel(), - Role( - name: 'moderator', - custom: true, - scopes: const ['.app', 'messaging'], - createdAt: DateTime.utc(2024, 1, 2), - updatedAt: DateTime.utc(2024, 3, 4), - ), - ); - }); - - test('SearchRolesResponse.toModel keeps the duration', () { - const response = api.SearchRolesResponse(duration: '0.02ms', roles: []); - - expect(response.toModel().duration, '0.02ms'); - }); - - test('SearchRolesResponse.toModel maps every role in order', () { - final response = api.SearchRolesResponse( - duration: '0.01ms', - roles: [_role('admin'), _role('moderator'), _role('user')], - ); - - final roles = response.toModel().roles; - - expect(roles.map((it) => it.name), ['admin', 'moderator', 'user']); - }); -} - -api.Role _role(String name) { - return api.Role( - name: name, - custom: false, - scopes: const ['.app'], - createdAt: DateTime.utc(2024), - updatedAt: DateTime.utc(2024), - ); -} diff --git a/packages/stream_chat/test/src/repository/mapper/user_groups_mapper_test.dart b/packages/stream_chat/test/src/repository/mapper/user_groups_mapper_test.dart deleted file mode 100644 index 86b4bed736..0000000000 --- a/packages/stream_chat/test/src/repository/mapper/user_groups_mapper_test.dart +++ /dev/null @@ -1,210 +0,0 @@ -import 'package:stream_chat/open_api/api.dart' as api; -import 'package:stream_chat/src/core/models/response/add_user_group_members_response.dart'; -import 'package:stream_chat/src/core/models/response/create_user_group_response.dart'; -import 'package:stream_chat/src/core/models/response/get_user_group_response.dart'; -import 'package:stream_chat/src/core/models/response/list_user_groups_response.dart'; -import 'package:stream_chat/src/core/models/response/remove_user_group_members_response.dart'; -import 'package:stream_chat/src/core/models/response/search_user_groups_response.dart'; -import 'package:stream_chat/src/core/models/response/update_user_group_response.dart'; -import 'package:stream_chat/src/core/models/user_group.dart'; -import 'package:stream_chat/src/core/models/user_group_member.dart'; -import 'package:stream_chat/src/repository/mapper/user_groups_mapper.dart'; -import 'package:test/test.dart'; - -void main() { - test('UserGroupResponse.toModel maps every field of a fully populated response', () { - final response = api.UserGroupResponse( - createdAt: DateTime.utc(2024, 1, 2), - createdBy: 'user-id', - description: 'Everyone on call this week', - id: 'group-id', - members: [ - _generatedMember(userId: 'user-1', isAdmin: true), - _generatedMember(userId: 'user-2', isAdmin: false), - ], - name: 'on-call', - teamId: 'team-id', - updatedAt: DateTime.utc(2024, 3, 4), - ); - - expect( - response.toModel(), - UserGroup( - createdAt: DateTime.utc(2024, 1, 2), - createdBy: 'user-id', - description: 'Everyone on call this week', - id: 'group-id', - members: [ - _member(userId: 'user-1', isAdmin: true), - _member(userId: 'user-2', isAdmin: false), - ], - name: 'on-call', - teamId: 'team-id', - updatedAt: DateTime.utc(2024, 3, 4), - ), - ); - }); - - test('UserGroupResponse.toModel keeps members null when the response leaves them out', () { - final response = _generatedGroupWithMembers(null); - - expect(response.toModel().members, isNull); - }); - - test('UserGroupResponse.toModel keeps an empty member list empty', () { - final response = _generatedGroupWithMembers(const []); - - expect(response.toModel().members, isEmpty); - }); - - test('UserGroupMember.toModel maps every field except the app id', () { - final member = api.UserGroupMember( - appPk: 42, - createdAt: DateTime.utc(2024, 5, 6), - groupId: 'group-id', - isAdmin: true, - userId: 'user-id', - ); - - expect( - member.toModel(), - UserGroupMember( - createdAt: DateTime.utc(2024, 5, 6), - groupId: 'group-id', - isAdmin: true, - userId: 'user-id', - ), - ); - }); - - test('ListUserGroupsResponse.toModel maps the duration and every group in order', () { - final response = api.ListUserGroupsResponse( - duration: '0.01ms', - userGroups: [_generatedGroup('group-1'), _generatedGroup('group-2')], - ); - - expect( - response.toModel(), - ListUserGroupsResponse(duration: '0.01ms', userGroups: [_group('group-1'), _group('group-2')]), - ); - }); - - test('SearchUserGroupsResponse.toModel maps the duration and every group in order', () { - final response = api.SearchUserGroupsResponse( - duration: '0.01ms', - userGroups: [_generatedGroup('group-1'), _generatedGroup('group-2')], - ); - - expect( - response.toModel(), - SearchUserGroupsResponse(duration: '0.01ms', userGroups: [_group('group-1'), _group('group-2')]), - ); - }); - - test('GetUserGroupResponse.toModel maps the duration and the group', () { - final response = api.GetUserGroupResponse(duration: '0.01ms', userGroup: _generatedGroup('group-id')); - - expect(response.toModel(), GetUserGroupResponse(duration: '0.01ms', userGroup: _group('group-id'))); - }); - - test('GetUserGroupResponse.toModel keeps a missing group null', () { - const response = api.GetUserGroupResponse(duration: '0.01ms'); - - expect(response.toModel().userGroup, isNull); - }); - - test('CreateUserGroupResponse.toModel maps the duration and the group', () { - final response = api.CreateUserGroupResponse(duration: '0.01ms', userGroup: _generatedGroup('group-id')); - - expect(response.toModel(), CreateUserGroupResponse(duration: '0.01ms', userGroup: _group('group-id'))); - }); - - test('CreateUserGroupResponse.toModel keeps a missing group null', () { - const response = api.CreateUserGroupResponse(duration: '0.01ms'); - - expect(response.toModel().userGroup, isNull); - }); - - test('UpdateUserGroupResponse.toModel maps the duration and the group', () { - final response = api.UpdateUserGroupResponse(duration: '0.01ms', userGroup: _generatedGroup('group-id')); - - expect(response.toModel(), UpdateUserGroupResponse(duration: '0.01ms', userGroup: _group('group-id'))); - }); - - test('UpdateUserGroupResponse.toModel keeps a missing group null', () { - const response = api.UpdateUserGroupResponse(duration: '0.01ms'); - - expect(response.toModel().userGroup, isNull); - }); - - test('AddUserGroupMembersResponse.toModel maps the duration and the group', () { - final response = api.AddUserGroupMembersResponse(duration: '0.01ms', userGroup: _generatedGroup('group-id')); - - expect(response.toModel(), AddUserGroupMembersResponse(duration: '0.01ms', userGroup: _group('group-id'))); - }); - - test('AddUserGroupMembersResponse.toModel keeps a missing group null', () { - const response = api.AddUserGroupMembersResponse(duration: '0.01ms'); - - expect(response.toModel().userGroup, isNull); - }); - - test('RemoveUserGroupMembersResponse.toModel maps the duration and the group', () { - final response = api.RemoveUserGroupMembersResponse(duration: '0.01ms', userGroup: _generatedGroup('group-id')); - - expect(response.toModel(), RemoveUserGroupMembersResponse(duration: '0.01ms', userGroup: _group('group-id'))); - }); - - test('RemoveUserGroupMembersResponse.toModel keeps a missing group null', () { - const response = api.RemoveUserGroupMembersResponse(duration: '0.01ms'); - - expect(response.toModel().userGroup, isNull); - }); -} - -api.UserGroupResponse _generatedGroup(String id) { - return api.UserGroupResponse( - createdAt: DateTime.utc(2024), - id: id, - name: 'name-$id', - updatedAt: DateTime.utc(2024), - ); -} - -UserGroup _group(String id) { - return UserGroup( - createdAt: DateTime.utc(2024), - id: id, - name: 'name-$id', - updatedAt: DateTime.utc(2024), - ); -} - -api.UserGroupResponse _generatedGroupWithMembers(List? members) { - return api.UserGroupResponse( - createdAt: DateTime.utc(2024), - id: 'group-id', - members: members, - name: 'on-call', - updatedAt: DateTime.utc(2024), - ); -} - -api.UserGroupMember _generatedMember({required String userId, required bool isAdmin}) { - return api.UserGroupMember( - appPk: 1, - createdAt: DateTime.utc(2024), - groupId: 'group-id', - isAdmin: isAdmin, - userId: userId, - ); -} - -UserGroupMember _member({required String userId, required bool isAdmin}) { - return UserGroupMember( - createdAt: DateTime.utc(2024), - groupId: 'group-id', - isAdmin: isAdmin, - userId: userId, - ); -} diff --git a/packages/stream_chat/test/src/repository/roles_repository_test.dart b/packages/stream_chat/test/src/repository/roles_repository_test.dart deleted file mode 100644 index 9ab3f984a8..0000000000 --- a/packages/stream_chat/test/src/repository/roles_repository_test.dart +++ /dev/null @@ -1,79 +0,0 @@ -// ignore_for_file: avoid_redundant_argument_values - -import 'package:mocktail/mocktail.dart'; -import 'package:stream_chat/open_api/api.dart' as api; -import 'package:stream_chat/src/core/models/role_type.dart'; -import 'package:stream_chat/src/repository/roles_repository.dart'; -import 'package:stream_core/stream_core.dart'; -import 'package:test/test.dart'; - -import '../mocks.dart'; - -void main() { - test('RolesRepository.searchRoles forwards only the query when nothing else is passed', () async { - final defaultApi = MockDefaultApi(); - when(() => defaultApi.searchRoles(query: 'adm')).thenAnswer( - (_) async => const Result.success(api.SearchRolesResponse(duration: '0.01ms', roles: [])), - ); - - await RolesRepository(defaultApi).searchRoles('adm'); - - verify(() => defaultApi.searchRoles(query: 'adm')).called(1); - verifyNoMoreInteractions(defaultApi); - }); - - test('RolesRepository.searchRoles forwards every parameter to the generated client', () async { - final defaultApi = MockDefaultApi(); - when( - () => defaultApi.searchRoles( - query: 'adm', - limit: 10, - nameGt: 'admin', - roleType: RoleType.user, - includeGlobalRoles: true, - ), - ).thenAnswer( - (_) async => const Result.success(api.SearchRolesResponse(duration: '0.01ms', roles: [])), - ); - - await RolesRepository(defaultApi).searchRoles( - 'adm', - limit: 10, - nameGt: 'admin', - roleType: RoleType.user, - includeGlobalRoles: true, - ); - - verify( - () => defaultApi.searchRoles( - query: 'adm', - limit: 10, - nameGt: 'admin', - roleType: RoleType.user, - includeGlobalRoles: true, - ), - ).called(1); - verifyNoMoreInteractions(defaultApi); - }); - - test('RolesRepository.searchRoles returns the mapped response', () async { - final defaultApi = MockDefaultApi(); - when(() => defaultApi.searchRoles(query: 'mod')).thenAnswer( - (_) async => const Result.success(api.SearchRolesResponse(duration: '0.02ms', roles: [])), - ); - - final res = await RolesRepository(defaultApi).searchRoles('mod'); - - expect(res.getOrNull()?.duration, '0.02ms'); - }); - - test('RolesRepository.searchRoles returns the failure without throwing', () async { - final defaultApi = MockDefaultApi(); - const error = StreamClientException(message: 'boom'); - when(() => defaultApi.searchRoles(query: 'adm')).thenAnswer((_) async => const Result.failure(error)); - - final res = await RolesRepository(defaultApi).searchRoles('adm'); - - expect(res.exceptionOrNull(), error); - }); -} diff --git a/packages/stream_chat/test/src/repository/user_groups_repository_test.dart b/packages/stream_chat/test/src/repository/user_groups_repository_test.dart deleted file mode 100644 index a648620a27..0000000000 --- a/packages/stream_chat/test/src/repository/user_groups_repository_test.dart +++ /dev/null @@ -1,174 +0,0 @@ -import 'package:mocktail/mocktail.dart'; -import 'package:stream_chat/open_api/api.dart' as api; -import 'package:stream_chat/src/repository/user_groups_repository.dart'; -import 'package:stream_core/stream_core.dart'; -import 'package:test/test.dart'; - -import '../mocks.dart'; - -const _error = StreamClientException(message: 'boom'); - -void main() { - setUpAll(() { - registerFallbackValue(const api.CreateUserGroupRequest(name: 'name')); - registerFallbackValue(const api.UpdateUserGroupRequest()); - registerFallbackValue(const api.AddUserGroupMembersRequest(memberIds: [])); - registerFallbackValue(const api.RemoveUserGroupMembersRequest(memberIds: [])); - }); - - test('UserGroupsRepository.listUserGroups sends createdAtGt as a UTC timestamp', () async { - final defaultApi = MockDefaultApi(); - _stubListUserGroups(defaultApi, const Result.success(api.ListUserGroupsResponse(duration: '0ms', userGroups: []))); - final createdAtGt = DateTime.utc(2024, 6, 15, 12).toLocal(); - - await UserGroupsRepository(defaultApi).listUserGroups(createdAtGt: createdAtGt); - - verify(() => defaultApi.listUserGroups(createdAtGt: '2024-06-15T12:00:00.000Z')).called(1); - }); - - test('UserGroupsRepository.listUserGroups returns the failure without throwing', () async { - final defaultApi = MockDefaultApi(); - _stubListUserGroups(defaultApi, const Result.failure(_error)); - - final res = await UserGroupsRepository(defaultApi).listUserGroups(); - - expect(res.exceptionOrNull(), _error); - }); - - test('UserGroupsRepository.searchUserGroups returns the failure without throwing', () async { - final defaultApi = MockDefaultApi(); - _stubSearchUserGroups(defaultApi, const Result.failure(_error)); - - final res = await UserGroupsRepository(defaultApi).searchUserGroups('eng'); - - expect(res.exceptionOrNull(), _error); - }); - - test('UserGroupsRepository.getUserGroup returns the failure without throwing', () async { - final defaultApi = MockDefaultApi(); - _stubGetUserGroup(defaultApi, const Result.failure(_error)); - - final res = await UserGroupsRepository(defaultApi).getUserGroup('group-id'); - - expect(res.exceptionOrNull(), _error); - }); - - test('UserGroupsRepository.createUserGroup returns the failure without throwing', () async { - final defaultApi = MockDefaultApi(); - _stubCreateUserGroup(defaultApi, const Result.failure(_error)); - - final res = await UserGroupsRepository(defaultApi).createUserGroup('Engineering'); - - expect(res.exceptionOrNull(), _error); - }); - - test('UserGroupsRepository.updateUserGroup returns the failure without throwing', () async { - final defaultApi = MockDefaultApi(); - _stubUpdateUserGroup(defaultApi, const Result.failure(_error)); - - final res = await UserGroupsRepository(defaultApi).updateUserGroup('group-id', name: 'Engineering'); - - expect(res.exceptionOrNull(), _error); - }); - - test('UserGroupsRepository.deleteUserGroup returns the failure without throwing', () async { - final defaultApi = MockDefaultApi(); - _stubDeleteUserGroup(defaultApi, const Result.failure(_error)); - - final res = await UserGroupsRepository(defaultApi).deleteUserGroup('group-id'); - - expect(res.exceptionOrNull(), _error); - }); - - test('UserGroupsRepository.addUserGroupMembers returns the failure without throwing', () async { - final defaultApi = MockDefaultApi(); - _stubAddUserGroupMembers(defaultApi, const Result.failure(_error)); - - final res = await UserGroupsRepository(defaultApi).addUserGroupMembers('group-id', ['user-id']); - - expect(res.exceptionOrNull(), _error); - }); - - test('UserGroupsRepository.removeUserGroupMembers returns the failure without throwing', () async { - final defaultApi = MockDefaultApi(); - _stubRemoveUserGroupMembers(defaultApi, const Result.failure(_error)); - - final res = await UserGroupsRepository(defaultApi).removeUserGroupMembers('group-id', ['user-id']); - - expect(res.exceptionOrNull(), _error); - }); -} - -void _stubListUserGroups(MockDefaultApi defaultApi, Result result) { - when( - () => defaultApi.listUserGroups( - limit: any(named: 'limit'), - idGt: any(named: 'idGt'), - createdAtGt: any(named: 'createdAtGt'), - teamId: any(named: 'teamId'), - ), - ).thenAnswer((_) async => result); -} - -void _stubSearchUserGroups(MockDefaultApi defaultApi, Result result) { - when( - () => defaultApi.searchUserGroups( - query: any(named: 'query'), - limit: any(named: 'limit'), - nameGt: any(named: 'nameGt'), - idGt: any(named: 'idGt'), - teamId: any(named: 'teamId'), - ), - ).thenAnswer((_) async => result); -} - -void _stubGetUserGroup(MockDefaultApi defaultApi, Result result) { - when( - () => defaultApi.getUserGroup( - id: any(named: 'id'), - teamId: any(named: 'teamId'), - ), - ).thenAnswer((_) async => result); -} - -void _stubCreateUserGroup(MockDefaultApi defaultApi, Result result) { - when( - () => defaultApi.createUserGroup(createUserGroupRequest: any(named: 'createUserGroupRequest')), - ).thenAnswer((_) async => result); -} - -void _stubUpdateUserGroup(MockDefaultApi defaultApi, Result result) { - when( - () => defaultApi.updateUserGroup( - id: any(named: 'id'), - updateUserGroupRequest: any(named: 'updateUserGroupRequest'), - ), - ).thenAnswer((_) async => result); -} - -void _stubDeleteUserGroup(MockDefaultApi defaultApi, Result result) { - when( - () => defaultApi.deleteUserGroup( - id: any(named: 'id'), - teamId: any(named: 'teamId'), - ), - ).thenAnswer((_) async => result); -} - -void _stubAddUserGroupMembers(MockDefaultApi defaultApi, Result result) { - when( - () => defaultApi.addUserGroupMembers( - id: any(named: 'id'), - addUserGroupMembersRequest: any(named: 'addUserGroupMembersRequest'), - ), - ).thenAnswer((_) async => result); -} - -void _stubRemoveUserGroupMembers(MockDefaultApi defaultApi, Result result) { - when( - () => defaultApi.removeUserGroupMembers( - id: any(named: 'id'), - removeUserGroupMembersRequest: any(named: 'removeUserGroupMembersRequest'), - ), - ).thenAnswer((_) async => result); -} From 879439ee82b1cdd2d082f7d84191f9c1930c2aa1 Mon Sep 17 00:00:00 2001 From: Petar Velikov Date: Tue, 29 Sep 2026 14:04:42 +0200 Subject: [PATCH 29/36] refactor(llc)!: route app settings through the generated client (#2993) * refactor(llc)!: route app settings through the generated client Co-Authored-By: Claude Opus 5.5 * docs(repo): record the app settings migration against domain models Co-Authored-By: Claude Opus 5.5 * refactor(llc): move the response models into models/response Co-Authored-By: Claude Opus 5.5 * test(llc): cover app settings through the client and the manager Co-Authored-By: Claude Opus 5.5 * test(llc): name the app settings client test after its outcome Co-Authored-By: Claude Opus 5.5 * refactor(llc)!: rename GetAppSettingsResponse to AppSettingsResponse Co-Authored-By: Claude Opus 5.5 * docs(llc): use an before AppSettingsResponse in the mapper docs Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: Claude Opus 5.5 --- migrations/v11-migration.md | 45 +++ openapi-migration/04-roles-guest-and-app.md | 25 +- openapi-migration/README.md | 4 +- openapi-migration/tool/generate_plan.py | 28 +- packages/stream_chat/CHANGELOG.md | 6 + .../http => client}/app_settings_manager.dart | 44 +-- .../stream_chat/lib/src/client/client.dart | 15 +- .../lib/src/core/api/general_api.dart | 6 - .../lib/src/core/api/responses.dart | 11 - .../lib/src/core/api/responses.g.dart | 6 - .../lib/src/core/models/app_settings.dart | 99 +------ .../src/core/models/app_settings.freezed.dart | 115 ++++++++ .../lib/src/core/models/app_settings.g.dart | 31 -- .../response/app_settings_response.dart | 23 ++ .../app_settings_response.freezed.dart | 77 +++++ .../lib/src/core/models/upload_config.dart | 62 ++++ .../core/models/upload_config.freezed.dart | 113 ++++++++ .../repository/app_settings_repository.dart | 20 ++ .../mapper/app_settings_mapper.dart | 37 +++ packages/stream_chat/lib/stream_chat.dart | 2 + .../test/fixtures/app_settings.json | 22 -- .../src/client/app_settings_manager_test.dart | 129 +++++++++ .../src/client/client_connection_id_test.dart | 10 +- .../test/src/client/client_test.dart | 267 +++++++++++++++--- .../test/src/core/api/general_api_test.dart | 21 -- .../core/http/app_settings_manager_test.dart | 113 -------- .../src/core/models/app_settings_test.dart | 60 ---- packages/stream_chat/test/src/fakes.dart | 31 ++ 28 files changed, 979 insertions(+), 443 deletions(-) rename packages/stream_chat/lib/src/{core/http => client}/app_settings_manager.dart (53%) create mode 100644 packages/stream_chat/lib/src/core/models/app_settings.freezed.dart delete mode 100644 packages/stream_chat/lib/src/core/models/app_settings.g.dart create mode 100644 packages/stream_chat/lib/src/core/models/response/app_settings_response.dart create mode 100644 packages/stream_chat/lib/src/core/models/response/app_settings_response.freezed.dart create mode 100644 packages/stream_chat/lib/src/core/models/upload_config.dart create mode 100644 packages/stream_chat/lib/src/core/models/upload_config.freezed.dart create mode 100644 packages/stream_chat/lib/src/repository/app_settings_repository.dart create mode 100644 packages/stream_chat/lib/src/repository/mapper/app_settings_mapper.dart delete mode 100644 packages/stream_chat/test/fixtures/app_settings.json create mode 100644 packages/stream_chat/test/src/client/app_settings_manager_test.dart delete mode 100644 packages/stream_chat/test/src/core/http/app_settings_manager_test.dart delete mode 100644 packages/stream_chat/test/src/core/models/app_settings_test.dart diff --git a/migrations/v11-migration.md b/migrations/v11-migration.md index 1f9836b970..e021982c89 100644 --- a/migrations/v11-migration.md +++ b/migrations/v11-migration.md @@ -28,6 +28,7 @@ onto Stream's OpenAPI-generated API client. - [Roles](#roles) - [Devices](#devices) - [Moderation](#moderation) + - [App Settings](#app-settings) - [User Groups](#user-groups) - [Link Previews](#link-previews) - [Migration Checklist](#migration-checklist) @@ -72,6 +73,7 @@ from the spec, so don't subclass them or depend on their private constructors. | --- | --- | | [**Error Handling**](#error-handling) | Failures carry `stream_core`'s sealed `StreamException` family instead of `StreamChatNetworkError`; `ChatErrorCode` → `StreamErrorCode`. API calls will return `Result` rather than throwing, endpoint by endpoint | | [**Moderation**](#moderation) | Muting, banning and flagging return a `Result` and call the moderation v2 API; `banUser`'s options map becomes named parameters; `unflagMessage`, `unflagUser` and `removeShadowBan` are removed | +| [**App Settings**](#app-settings) | `getAppSettings` returns a `Result` instead of throwing; `GetAppSettingsResponse` is renamed `AppSettingsResponse` | | _(filled in per feature as PRs land)_ | | --- @@ -198,6 +200,14 @@ search-and-replace you can apply directly. `Kind` is one of `renamed`, `removed` | `OGAttachmentResponse.duration` (`String?`) | `String` | `retyped` | Always present; drop any `!` or `?? ''` | | `OGAttachmentResponse` identity `==` | value `==`, plus `copyWith` | `retyped` | Two instances with the same fields are now equal | | `StreamChatApi.general.enrichUrl` | `StreamChatClient.enrichUrl` | `removed` | The endpoint moved to the generated client | +| `StreamChatClient.getAppSettings` → `Future` | `Future>` | `retyped` | Returns a `Result` instead of throwing, and answers the whole response: read the settings off `.app`. `client.appSettings` is unchanged | +| `GetAppSettingsResponse` | `AppSettingsResponse` | `renamed` | Same fields: `duration` and `app` | +| `AppSettings.fromJson`, `UploadConfig.fromJson` | — | `removed` | The models are plain classes; construct them directly | +| `GetAppSettingsResponse.fromJson`, `GetAppSettingsResponse()..app = …` | `AppSettingsResponse(duration: …, app: …)` | `retyped` | The response is a plain class with a const constructor and final fields | +| `GetAppSettingsResponse.duration` (`String?`) | `String` | `retyped` | Always present; drop any `!` or `?? ''` | +| `GetAppSettingsResponse` identity `==` | value `==`, plus `copyWith` | `retyped` | Two instances with the same fields are now equal | +| `AppSettings extends Equatable` / `UploadConfig extends Equatable`, `props` | `AppSettings` / `UploadConfig` (value `==`, `copyWith`) | `removed` | Equality is unchanged; `props` is gone and neither is an `Equatable` any more | +| `StreamChatApi.general.getAppSettings()` | `StreamChatClient.getAppSettings()` | `removed` | The call moved to the generated client | | _(more added per feature as PRs land)_ | | | | --- @@ -665,6 +675,41 @@ only moderation call that answers with a model, and the `User` and `ChannelModel are decided by later groups in this migration; it moves when they do. See [Endpoints that still throw](#endpoints-that-still-throw). +### App Settings + +**`getAppSettings` returns a `Result` instead of throwing, and answers the whole response** rather than the +settings alone, so read them off `.app`. `AppSettings` and `UploadConfig` keep their fields and defaults, and +`client.appSettings` — the copy `connectUser` loads — is unchanged. + +```dart +// v10 +try { + final settings = await client.getAppSettings(); + useSettings(settings); +} on StreamChatException catch (e) { + report(e); +} + +// v11 +final result = await client.getAppSettings(); +result.fold( + onSuccess: (response) => useSettings(response.app), + onFailure: (error, _) => report(error), +); +``` + +**`GetAppSettingsResponse` is renamed `AppSettingsResponse`,** with the same `duration` and `app` fields. + +**`AppSettings`, `UploadConfig` and `AppSettingsResponse` no longer decode JSON.** All three are plain classes; +build them with their constructors — `AppSettingsResponse(duration: '0ms', app: settings)` where v10 wrote +`GetAppSettingsResponse()..app = settings`. `const AppSettings()`, `const UploadConfig()` and +`UploadConfig.defaultSizeLimit` are unchanged. + +**`AppSettingsResponse.duration` is a non-nullable `String`**, where v10 typed it `String?`. + +**`AppSettings` and `UploadConfig` no longer extend `Equatable`.** They still compare by value, `props` is +gone, and both gain `copyWith`. + --- ## Migration Checklist diff --git a/openapi-migration/04-roles-guest-and-app.md b/openapi-migration/04-roles-guest-and-app.md index 8decf67721..568cc7e099 100644 --- a/openapi-migration/04-roles-guest-and-app.md +++ b/openapi-migration/04-roles-guest-and-app.md @@ -2,7 +2,7 @@ **Goal:** Sweep up the singletons — one-method families that share no state and can land in one PR. -**Size:** 2 hand-written method(s) across 2 file(s) → 5 generated operation(s). +**Size:** 1 hand-written method(s) across 1 file(s) → 5 generated operation(s). > This whole file is generated by `openapi-migration/tool/generate_plan.py`, prose included. > Edit its `GROUPS` entry and re-run the script — edits made here are lost on the next run. @@ -14,7 +14,6 @@ | File | Method | Returns | | --- | --- | --- | | `guest_api.dart` | `getGuestUser` | `ConnectGuestUserResponse` | -| `general_api.dart` | `getAppSettings` | `GetAppSettingsResponse` | ### Generated operations that cover it @@ -26,10 +25,6 @@ | `GET` | `/api/v2/longpoll` | `longPoll` | `void` | | `GET` | `/api/v2/roles/search` | `searchRoles` | `SearchRolesResponse` | -## Decisions to make - -- `AppSettings` is public and hand-shaped; the generated `AppResponseFields` is the wire shape. Keep ours unless the generated one is genuinely better. - ## Decisions taken - **`Role` and `SearchRolesResponse` stay our public types, in their v10 shapes,** as plain classes @@ -62,10 +57,26 @@ `pretext`). Adding them later is non-breaking. `Attachment.fromOGAttachment` is unchanged. - **`Action` is left alone.** `OGAttachmentResponse` carries no actions, so nothing here needs it; it is converted with its parent `Attachment` in [group 10](10-messages.md). +- **`AppSettings` and `UploadConfig` stay our public types, in their v10 shapes,** as plain classes with + no JSON, and the envelope is `AppSettingsResponse`, renamed from v10's `GetAppSettingsResponse`. They + are mapped from the generated `AppResponseFields`, `FileUploadConfig` and `GetApplicationResponse` in + `lib/src/repository/mapper/app_settings_mapper.dart`. `AppResponseFields.id` and `placement` are not + exposed. This settles the group's open question. +- **`getAppSettings` answers the envelope,** `Result`, where v10 answered the + bare `AppSettings`. This is a break beyond the [sanctioned ones](README.md#domain-models), approved for + this group so that every migrated read answers its envelope. `client.appSettings` stays a + non-nullable `AppSettings` that reads `const AppSettings()` until the load `connectUser` starts + succeeds. +- **The other public names stay v10's.** Renaming them to the generated `getApp`, + `GetApplicationResponse` and `FileUploadConfig` was considered and rejected: each would be a rename + break with no change in behaviour. Only the envelope drops its `Get` prefix. +- **An unset size limit stays `0`.** The server reports one as `size_limit: 0`, and + `UploadConfig.sizeLimit` passes it through as v10 did; `StreamAttachmentValidator` applies + `UploadConfig.defaultSizeLimit` in that case. No `effectiveSizeLimit` getter was added. ## Risks -- `general_api.dart` is split across three groups — only `getAppSettings` is left here. `sync` and `queryMembers` go to group 11, `searchMessages` to group 10. Do not migrate the file as a unit. +- `general_api.dart` has no methods left in this group — `sync` and `queryMembers` go to group 11, `searchMessages` to group 10. Do not migrate the file as a unit. ## Definition of done diff --git a/openapi-migration/README.md b/openapi-migration/README.md index d6fcfd5f54..602582e873 100644 --- a/openapi-migration/README.md +++ b/openapi-migration/README.md @@ -15,7 +15,7 @@ generated operations in scope, the decisions that group has to make, its risks, | [01](01-foundation.md) | Foundation — `DefaultApi` wiring, `User` shape | — | — | ☐ | | [02](02-devices.md) | Devices | 0 | 3 | ☑ | | [03](03-user-groups.md) | User Groups | 0 | 8 | ☑ | -| [04](04-roles-guest-and-app.md) | Roles, Guest & App Settings | 2 | 5 | ☐ | +| [04](04-roles-guest-and-app.md) | Roles, Guest & App Settings | 1 | 5 | ☐ | | [05](05-polls.md) | Polls | 13 | 13 | ☐ | | [06](06-reminders.md) | Message Reminders | 4 | 4 | ☐ | | [07](07-threads-and-drafts.md) | Threads & Drafts | 7 | 7 | ☐ | @@ -27,7 +27,7 @@ generated operations in scope, the decisions that group has to make, its risks, | [13](13-push-preferences.md) | Push Preferences | 1 | 1 | ☐ | | [14](14-banned-users.md) | Banned Users — split out of 08 | 1 | 1 | ☐ | -**Coverage:** 86 hand-written methods across 11 files, and all 129 generated operations, each claimed by exactly +**Coverage:** 85 hand-written methods across 11 files, and all 129 generated operations, each claimed by exactly one group. Verified mechanically — see [Keeping this plan honest](#keeping-this-plan-honest). diff --git a/openapi-migration/tool/generate_plan.py b/openapi-migration/tool/generate_plan.py index 1ad1237b10..131b76a074 100644 --- a/openapi-migration/tool/generate_plan.py +++ b/openapi-migration/tool/generate_plan.py @@ -217,13 +217,10 @@ def match(path): ), dict( num='04', slug='roles-guest-and-app', title='Roles, Guest & App Settings', - hand=['guest_api.dart', 'general_api.dart::getAppSettings'], + hand=['guest_api.dart'], match=owns('/api/v2/roles', '/api/v2/guest', '/api/v2/app', '/api/v2/og', '/api/v2/longpoll'), goal='Sweep up the singletons — one-method families that share no state and can land in one PR.', - decisions=[ - '`AppSettings` is public and hand-shaped; the generated `AppResponseFields` is the wire shape. Keep ' - 'ours unless the generated one is genuinely better.', - ], + decisions=[], taken=textwrap.dedent("""\ - **`Role` and `SearchRolesResponse` stay our public types, in their v10 shapes,** as plain classes with no JSON, mapped from the generated types in `lib/src/repository/mapper/roles_mapper.dart`. The @@ -255,11 +252,26 @@ def match(path): `pretext`). Adding them later is non-breaking. `Attachment.fromOGAttachment` is unchanged. - **`Action` is left alone.** `OGAttachmentResponse` carries no actions, so nothing here needs it; it is converted with its parent `Attachment` in [group 10](10-messages.md). + - **`AppSettings` and `UploadConfig` stay our public types, in their v10 shapes,** as plain classes with + no JSON, and the envelope is `AppSettingsResponse`, renamed from v10's `GetAppSettingsResponse`. They + are mapped from the generated `AppResponseFields`, `FileUploadConfig` and `GetApplicationResponse` in + `lib/src/repository/mapper/app_settings_mapper.dart`. `AppResponseFields.id` and `placement` are not + exposed. This settles the group's open question. + - **`getAppSettings` answers the envelope,** `Result`, where v10 answered the + bare `AppSettings`. This is a break beyond the [sanctioned ones](README.md#domain-models), approved for + this group so that every migrated read answers its envelope. `client.appSettings` stays a + non-nullable `AppSettings` that reads `const AppSettings()` until the load `connectUser` starts + succeeds. + - **The other public names stay v10's.** Renaming them to the generated `getApp`, + `GetApplicationResponse` and `FileUploadConfig` was considered and rejected: each would be a rename + break with no change in behaviour. Only the envelope drops its `Get` prefix. + - **An unset size limit stays `0`.** The server reports one as `size_limit: 0`, and + `UploadConfig.sizeLimit` passes it through as v10 did; `StreamAttachmentValidator` applies + `UploadConfig.defaultSizeLimit` in that case. No `effectiveSizeLimit` getter was added. """), risks=[ - '`general_api.dart` is split across three groups — only `getAppSettings` is left here. ' - '`sync` and `queryMembers` go to group 11, `searchMessages` to group 10. Do not migrate the file as a ' - 'unit.', + '`general_api.dart` has no methods left in this group — `sync` and `queryMembers` go to group 11, ' + '`searchMessages` to group 10. Do not migrate the file as a unit.', ], ), dict( diff --git a/packages/stream_chat/CHANGELOG.md b/packages/stream_chat/CHANGELOG.md index 1c352004f4..ab42c80aaf 100644 --- a/packages/stream_chat/CHANGELOG.md +++ b/packages/stream_chat/CHANGELOG.md @@ -71,6 +71,12 @@ - `StreamChatClient.enrichUrl` returns a `Result` instead of throwing. - `OGAttachmentResponse` no longer decodes from JSON, is built through a const constructor, and its `duration` is a non-nullable `String`. - `StreamChatApi.general.enrichUrl` is removed; call `StreamChatClient.enrichUrl` instead. +- `StreamChatClient.getAppSettings` returns a `Result` instead of an `AppSettings`, and no longer throws. +- `GetAppSettingsResponse` is renamed `AppSettingsResponse`. +- `AppSettings`, `UploadConfig` and `AppSettingsResponse` no longer decode from JSON. +- `AppSettingsResponse` is immutable, built through a const constructor, compares by value, gains `copyWith`, and its `duration` is a non-nullable `String`. +- `AppSettings` and `UploadConfig` no longer extend `Equatable`, so `props` is removed; they still compare by value and gain `copyWith`. +- `StreamChatApi.general.getAppSettings` is removed; call `StreamChatClient.getAppSettings` instead. 🐞 Fixed diff --git a/packages/stream_chat/lib/src/core/http/app_settings_manager.dart b/packages/stream_chat/lib/src/client/app_settings_manager.dart similarity index 53% rename from packages/stream_chat/lib/src/core/http/app_settings_manager.dart rename to packages/stream_chat/lib/src/client/app_settings_manager.dart index 1169bd2f93..446e2b5a17 100644 --- a/packages/stream_chat/lib/src/core/http/app_settings_manager.dart +++ b/packages/stream_chat/lib/src/client/app_settings_manager.dart @@ -1,7 +1,8 @@ -import 'package:meta/meta.dart'; -import 'package:stream_core/stream_core.dart' show StreamLogger; -import '../api/general_api.dart'; -import '../models/app_settings.dart'; +import 'package:stream_core/stream_core.dart' show Failure, Result, StreamLogger, Success; + +import '../core/models/app_settings.dart'; +import '../core/models/response/app_settings_response.dart'; +import '../repository/app_settings_repository.dart'; /// {@template appSettingsManager} /// Holds the [AppSettings] for the current connection. @@ -14,15 +15,14 @@ import '../models/app_settings.dart'; /// /// * [StreamChatClient.appSettings], for the public entry point. /// {@endtemplate} -@internal class AppSettingsManager { /// {@macro appSettingsManager} AppSettingsManager( - this._api, { + this._repository, { String tag = 'SCh:AppSettings', }) : _logger = StreamLogger(tag); - final GeneralApi _api; + final AppSettingsRepository _repository; final StreamLogger _logger; /// The cached [AppSettings]. @@ -34,26 +34,28 @@ class AppSettingsManager { /// Performs the initial load of [AppSettings]. /// - /// No-op when a cached value already exists. Errors are logged and - /// suppressed so the caller is never blocked; use [refresh] when - /// errors should propagate. + /// No-op when a cached value already exists. Failures are logged and + /// suppressed so the caller is never blocked; use [refresh] when a + /// failure should reach the caller. Future loadAppSettings() async { if (_appSettings != null) return; - try { - final response = await _api.getAppSettings(); - _appSettings = response.app; - } catch (e, stk) { - _logger.w(() => 'Failed to load app settings', error: e, stackTrace: stk); + + switch (await _repository.getAppSettings()) { + case Success(:final data): + _appSettings = data.app; + case Failure(:final error, :final stackTrace): + _logger.w(() => 'Failed to load app settings', error: error, stackTrace: stackTrace); } } - /// Re-fetches and replaces the cached [AppSettings]. + /// Re-fetches the [AppSettings] and replaces the cached value. /// - /// Returns the newly fetched value, or throws when the request fails. - Future refresh() async { - final response = await _api.getAppSettings(); - _appSettings = response.app; - return response.app; + /// The cached value is replaced only on success, so a failed refresh + /// leaves it as it was. + Future> refresh() async { + final result = await _repository.getAppSettings(); + if (result case Success(:final data)) _appSettings = data.app; + return result; } /// Clears the cached [AppSettings]. diff --git a/packages/stream_chat/lib/src/client/client.dart b/packages/stream_chat/lib/src/client/client.dart index 83045af969..032d0b3c59 100644 --- a/packages/stream_chat/lib/src/client/client.dart +++ b/packages/stream_chat/lib/src/client/client.dart @@ -36,7 +36,6 @@ import '../core/api/requests.dart'; import '../core/api/responses.dart'; import '../core/api/stream_chat_api.dart'; import '../core/error/stream_chat_exception.dart'; -import '../core/http/app_settings_manager.dart'; import '../core/http/interceptor/additional_headers_interceptor.dart'; import '../core/http/stream_http_client.dart'; import '../core/models/app_settings.dart'; @@ -58,6 +57,7 @@ import '../core/models/push_preference.dart'; import '../core/models/push_provider.dart'; import '../core/models/reaction.dart'; import '../core/models/response/add_user_group_members_response.dart'; +import '../core/models/response/app_settings_response.dart'; import '../core/models/response/create_user_group_response.dart'; import '../core/models/response/get_user_group_response.dart'; import '../core/models/response/list_devices_response.dart'; @@ -76,6 +76,7 @@ import '../core/util/immutable_collection_subjects.dart'; import '../core/util/utils.dart'; import '../db/chat_persistence_client.dart'; import '../event_type.dart'; +import '../repository/app_settings_repository.dart'; import '../repository/devices_repository.dart'; import '../repository/general_repository.dart'; import '../repository/moderation_repository.dart'; @@ -87,6 +88,7 @@ import '../ws/connection_status.dart'; import '../ws/events/event.dart'; import '../ws/events/event_resolvers.dart' as event_resolvers; import '../ws/events/events.dart'; +import 'app_settings_manager.dart'; import 'channel/channel.dart'; import 'channel_delivery_reporter.dart'; import 'live_location_expiration_scheduler.dart'; @@ -183,6 +185,7 @@ class StreamChatClient { _userGroupsRepository = UserGroupsRepository(api); _generalRepository = GeneralRepository(api); _moderationRepository = ModerationRepository(api); + _appSettingsManager = AppSettingsManager(AppSettingsRepository(api)); moderation = ModerationClient(_moderationRepository); @@ -224,6 +227,7 @@ class StreamChatClient { late final UserGroupsRepository _userGroupsRepository; late final GeneralRepository _generalRepository; late final ModerationRepository _moderationRepository; + late final AppSettingsManager _appSettingsManager; /// Muting, banning and flagging, for the connected user. late final ModerationClient moderation; @@ -243,7 +247,6 @@ class StreamChatClient { late ClientState state; final _tokenManager = TokenManager.unconfigured(); - late final _appSettingsManager = AppSettingsManager(_chatApi.general); static final _systemEnvironmentManager = SystemEnvironmentManager( environment: SystemEnvironment( sdkName: 'stream-chat', @@ -2168,13 +2171,13 @@ class StreamChatClient { /// as a failure. Future> enrichUrl(String url) => _generalRepository.enrichUrl(url); - /// Re-fetches the [AppSettings] and updates [appSettings]. + /// Re-fetches the [AppSettings]. + /// + /// [appSettings] is replaced on success and left as it was on failure. /// /// [connectUser] populates the cache automatically, so calling this is /// only needed to pick up changes made during an active session. - /// - /// Returns the newly fetched value, or throws when the request fails. - Future getAppSettings() => _appSettingsManager.refresh(); + Future> getAppSettings() => _appSettingsManager.refresh(); /// Queries threads with the given [options] and [pagination] params. /// diff --git a/packages/stream_chat/lib/src/core/api/general_api.dart b/packages/stream_chat/lib/src/core/api/general_api.dart index 4166e93bf1..5e1fb61e57 100644 --- a/packages/stream_chat/lib/src/core/api/general_api.dart +++ b/packages/stream_chat/lib/src/core/api/general_api.dart @@ -93,10 +93,4 @@ class GeneralApi { return QueryMembersResponse.fromJson(response.data); } - - /// Fetches the app settings. - Future getAppSettings() async { - final response = await _client.get('/app'); - return GetAppSettingsResponse.fromJson(response.data); - } } diff --git a/packages/stream_chat/lib/src/core/api/responses.dart b/packages/stream_chat/lib/src/core/api/responses.dart index 9a98e95e48..3baaca0989 100644 --- a/packages/stream_chat/lib/src/core/api/responses.dart +++ b/packages/stream_chat/lib/src/core/api/responses.dart @@ -1,7 +1,6 @@ import 'package:json_annotation/json_annotation.dart'; import '../../client/client.dart'; import '../../ws/events/event.dart'; -import '../models/app_settings.dart'; import '../models/banned_user.dart'; import '../models/channel_model.dart'; import '../models/channel_state.dart'; @@ -753,13 +752,3 @@ class GetActiveLiveLocationsResponse extends _BaseResponse { static GetActiveLiveLocationsResponse fromJson(Map json) => _$GetActiveLiveLocationsResponseFromJson(json); } - -/// Model response for [StreamChatClient.getAppSettings] api call. -@JsonSerializable(createToJson: false) -class GetAppSettingsResponse extends _BaseResponse { - /// The app settings. - late AppSettings app; - - /// Creates a new instance from a json. - static GetAppSettingsResponse fromJson(Map json) => _$GetAppSettingsResponseFromJson(json); -} diff --git a/packages/stream_chat/lib/src/core/api/responses.g.dart b/packages/stream_chat/lib/src/core/api/responses.g.dart index 9a2b121d48..afd5aef5b0 100644 --- a/packages/stream_chat/lib/src/core/api/responses.g.dart +++ b/packages/stream_chat/lib/src/core/api/responses.g.dart @@ -396,9 +396,3 @@ GetActiveLiveLocationsResponse _$GetActiveLiveLocationsResponseFromJson( ..activeLiveLocations = (json['active_live_locations'] as List) .map((e) => Location.fromJson(e as Map)) .toList(); - -GetAppSettingsResponse _$GetAppSettingsResponseFromJson( - Map json, -) => GetAppSettingsResponse() - ..duration = json['duration'] as String? - ..app = AppSettings.fromJson(json['app'] as Map); diff --git a/packages/stream_chat/lib/src/core/models/app_settings.dart b/packages/stream_chat/lib/src/core/models/app_settings.dart index 767f4cc673..2a3acb33f2 100644 --- a/packages/stream_chat/lib/src/core/models/app_settings.dart +++ b/packages/stream_chat/lib/src/core/models/app_settings.dart @@ -1,7 +1,8 @@ -import 'package:equatable/equatable.dart'; -import 'package:json_annotation/json_annotation.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; -part 'app_settings.g.dart'; +import 'upload_config.dart'; + +part 'app_settings.freezed.dart'; /// {@template appSettings} /// The configuration of a Stream Chat application. @@ -15,8 +16,8 @@ part 'app_settings.g.dart'; /// * [StreamChatClient.appSettings], for the cached value held by the /// client. /// {@endtemplate} -@JsonSerializable(createToJson: false) -class AppSettings extends Equatable { +@freezed +class AppSettings with _$AppSettings { /// {@macro appSettings} const AppSettings({ this.name = '', @@ -26,101 +27,23 @@ class AppSettings extends Equatable { this.asyncUrlEnrichEnabled = false, }); - /// Creates a new instance from a json. - factory AppSettings.fromJson(Map json) => _$AppSettingsFromJson(json); - /// The display name of the application. + @override final String name; /// The upload rules applied to non-image attachments. + @override final UploadConfig fileUploadConfig; /// The upload rules applied to image attachments. + @override final UploadConfig imageUploadConfig; /// Whether automatic message translation is enabled for the app. + @override final bool autoTranslationEnabled; /// Whether asynchronous URL enrichment is enabled for the app. - final bool asyncUrlEnrichEnabled; - @override - List get props => [ - name, - fileUploadConfig, - imageUploadConfig, - autoTranslationEnabled, - asyncUrlEnrichEnabled, - ]; -} - -/// {@template uploadConfig} -/// The upload rules for a single category of attachment. -/// -/// Each instance is paired with one category — see -/// [AppSettings.fileUploadConfig] and [AppSettings.imageUploadConfig]. -/// -/// An upload is accepted only when it satisfies every populated list and -/// stays within [sizeLimit]: -/// -/// * [allowedFileExtensions] — when non-empty, the file's extension must -/// appear in the list. -/// * [blockedFileExtensions] — the file's extension must not appear in -/// the list. -/// * [allowedMimeTypes] — when non-empty, the file's MIME type must -/// appear in the list. -/// * [blockedMimeTypes] — the file's MIME type must not appear in the -/// list. -/// {@endtemplate} -@JsonSerializable(createToJson: false) -class UploadConfig extends Equatable { - /// {@macro uploadConfig} - const UploadConfig({ - this.sizeLimit = defaultSizeLimit, - this.allowedFileExtensions = const [], - this.blockedFileExtensions = const [], - this.allowedMimeTypes = const [], - this.blockedMimeTypes = const [], - }); - - /// Creates a new instance from a json. - factory UploadConfig.fromJson(Map json) => _$UploadConfigFromJson(json); - - /// The fallback used for [sizeLimit] when no explicit value is provided. - static const defaultSizeLimit = 100 * 1024 * 1024; - - /// The maximum upload size, in bytes. - /// - /// Defaults to [defaultSizeLimit]. - @JsonKey(defaultValue: defaultSizeLimit) - final int sizeLimit; - - /// The file extensions explicitly permitted, e.g. `['.pdf', '.csv']`. - /// - /// When non-empty, only listed extensions pass. - @JsonKey(defaultValue: []) - final List allowedFileExtensions; - - /// The file extensions explicitly blocked. - @JsonKey(defaultValue: []) - final List blockedFileExtensions; - - /// The MIME types explicitly permitted, e.g. `['text/csv', 'image/png']`. - /// - /// When non-empty, only listed MIME types pass. - @JsonKey(defaultValue: []) - final List allowedMimeTypes; - - /// The MIME types explicitly blocked. - @JsonKey(defaultValue: []) - final List blockedMimeTypes; - - @override - List get props => [ - sizeLimit, - allowedFileExtensions, - blockedFileExtensions, - allowedMimeTypes, - blockedMimeTypes, - ]; + final bool asyncUrlEnrichEnabled; } diff --git a/packages/stream_chat/lib/src/core/models/app_settings.freezed.dart b/packages/stream_chat/lib/src/core/models/app_settings.freezed.dart new file mode 100644 index 0000000000..edb0a9c465 --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/app_settings.freezed.dart @@ -0,0 +1,115 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'app_settings.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$AppSettings { + String get name; + UploadConfig get fileUploadConfig; + UploadConfig get imageUploadConfig; + bool get autoTranslationEnabled; + bool get asyncUrlEnrichEnabled; + + /// Create a copy of AppSettings + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $AppSettingsCopyWith get copyWith => + _$AppSettingsCopyWithImpl(this as AppSettings, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is AppSettings && + (identical(other.name, name) || other.name == name) && + (identical(other.fileUploadConfig, fileUploadConfig) || other.fileUploadConfig == fileUploadConfig) && + (identical(other.imageUploadConfig, imageUploadConfig) || other.imageUploadConfig == imageUploadConfig) && + (identical(other.autoTranslationEnabled, autoTranslationEnabled) || + other.autoTranslationEnabled == autoTranslationEnabled) && + (identical(other.asyncUrlEnrichEnabled, asyncUrlEnrichEnabled) || + other.asyncUrlEnrichEnabled == asyncUrlEnrichEnabled)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + name, + fileUploadConfig, + imageUploadConfig, + autoTranslationEnabled, + asyncUrlEnrichEnabled, + ); + + @override + String toString() { + return 'AppSettings(name: $name, fileUploadConfig: $fileUploadConfig, imageUploadConfig: $imageUploadConfig, autoTranslationEnabled: $autoTranslationEnabled, asyncUrlEnrichEnabled: $asyncUrlEnrichEnabled)'; + } +} + +/// @nodoc +abstract mixin class $AppSettingsCopyWith<$Res> { + factory $AppSettingsCopyWith(AppSettings value, $Res Function(AppSettings) _then) = _$AppSettingsCopyWithImpl; + @useResult + $Res call({ + String name, + UploadConfig fileUploadConfig, + UploadConfig imageUploadConfig, + bool autoTranslationEnabled, + bool asyncUrlEnrichEnabled, + }); +} + +/// @nodoc +class _$AppSettingsCopyWithImpl<$Res> implements $AppSettingsCopyWith<$Res> { + _$AppSettingsCopyWithImpl(this._self, this._then); + + final AppSettings _self; + final $Res Function(AppSettings) _then; + + /// Create a copy of AppSettings + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? name = null, + Object? fileUploadConfig = null, + Object? imageUploadConfig = null, + Object? autoTranslationEnabled = null, + Object? asyncUrlEnrichEnabled = null, + }) { + return _then( + AppSettings( + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + fileUploadConfig: null == fileUploadConfig + ? _self.fileUploadConfig + : fileUploadConfig // ignore: cast_nullable_to_non_nullable + as UploadConfig, + imageUploadConfig: null == imageUploadConfig + ? _self.imageUploadConfig + : imageUploadConfig // ignore: cast_nullable_to_non_nullable + as UploadConfig, + autoTranslationEnabled: null == autoTranslationEnabled + ? _self.autoTranslationEnabled + : autoTranslationEnabled // ignore: cast_nullable_to_non_nullable + as bool, + asyncUrlEnrichEnabled: null == asyncUrlEnrichEnabled + ? _self.asyncUrlEnrichEnabled + : asyncUrlEnrichEnabled // ignore: cast_nullable_to_non_nullable + as bool, + ), + ); + } +} diff --git a/packages/stream_chat/lib/src/core/models/app_settings.g.dart b/packages/stream_chat/lib/src/core/models/app_settings.g.dart deleted file mode 100644 index a57ead05c7..0000000000 --- a/packages/stream_chat/lib/src/core/models/app_settings.g.dart +++ /dev/null @@ -1,31 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'app_settings.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -AppSettings _$AppSettingsFromJson(Map json) => AppSettings( - name: json['name'] as String? ?? '', - fileUploadConfig: json['file_upload_config'] == null - ? const UploadConfig() - : UploadConfig.fromJson( - json['file_upload_config'] as Map, - ), - imageUploadConfig: json['image_upload_config'] == null - ? const UploadConfig() - : UploadConfig.fromJson( - json['image_upload_config'] as Map, - ), - autoTranslationEnabled: json['auto_translation_enabled'] as bool? ?? false, - asyncUrlEnrichEnabled: json['async_url_enrich_enabled'] as bool? ?? false, -); - -UploadConfig _$UploadConfigFromJson(Map json) => UploadConfig( - sizeLimit: (json['size_limit'] as num?)?.toInt() ?? 104857600, - allowedFileExtensions: (json['allowed_file_extensions'] as List?)?.map((e) => e as String).toList() ?? [], - blockedFileExtensions: (json['blocked_file_extensions'] as List?)?.map((e) => e as String).toList() ?? [], - allowedMimeTypes: (json['allowed_mime_types'] as List?)?.map((e) => e as String).toList() ?? [], - blockedMimeTypes: (json['blocked_mime_types'] as List?)?.map((e) => e as String).toList() ?? [], -); diff --git a/packages/stream_chat/lib/src/core/models/response/app_settings_response.dart b/packages/stream_chat/lib/src/core/models/response/app_settings_response.dart new file mode 100644 index 0000000000..a300b31fa7 --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/response/app_settings_response.dart @@ -0,0 +1,23 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +import '../app_settings.dart'; + +part 'app_settings_response.freezed.dart'; + +/// The settings of the application, returned by [StreamChatClient.getAppSettings]. +@freezed +class AppSettingsResponse with _$AppSettingsResponse { + /// Creates a new [AppSettingsResponse]. + const AppSettingsResponse({ + required this.duration, + required this.app, + }); + + /// How long the server took to handle the request, such as `4.21ms`. + @override + final String duration; + + /// The settings configured for the application. + @override + final AppSettings app; +} diff --git a/packages/stream_chat/lib/src/core/models/response/app_settings_response.freezed.dart b/packages/stream_chat/lib/src/core/models/response/app_settings_response.freezed.dart new file mode 100644 index 0000000000..522d945314 --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/response/app_settings_response.freezed.dart @@ -0,0 +1,77 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'app_settings_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$AppSettingsResponse { + String get duration; + AppSettings get app; + + /// Create a copy of AppSettingsResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $AppSettingsResponseCopyWith get copyWith => + _$AppSettingsResponseCopyWithImpl(this as AppSettingsResponse, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is AppSettingsResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.app, app) || other.app == app)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration, app); + + @override + String toString() { + return 'AppSettingsResponse(duration: $duration, app: $app)'; + } +} + +/// @nodoc +abstract mixin class $AppSettingsResponseCopyWith<$Res> { + factory $AppSettingsResponseCopyWith(AppSettingsResponse value, $Res Function(AppSettingsResponse) _then) = + _$AppSettingsResponseCopyWithImpl; + @useResult + $Res call({String duration, AppSettings app}); +} + +/// @nodoc +class _$AppSettingsResponseCopyWithImpl<$Res> implements $AppSettingsResponseCopyWith<$Res> { + _$AppSettingsResponseCopyWithImpl(this._self, this._then); + + final AppSettingsResponse _self; + final $Res Function(AppSettingsResponse) _then; + + /// Create a copy of AppSettingsResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? app = null}) { + return _then( + AppSettingsResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + app: null == app + ? _self.app + : app // ignore: cast_nullable_to_non_nullable + as AppSettings, + ), + ); + } +} diff --git a/packages/stream_chat/lib/src/core/models/upload_config.dart b/packages/stream_chat/lib/src/core/models/upload_config.dart new file mode 100644 index 0000000000..ecd709727a --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/upload_config.dart @@ -0,0 +1,62 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'upload_config.freezed.dart'; + +/// {@template uploadConfig} +/// The upload rules for a single category of attachment. +/// +/// Each instance is paired with one category — see +/// [AppSettings.fileUploadConfig] and [AppSettings.imageUploadConfig]. +/// +/// An upload is accepted only when it satisfies every populated list and +/// stays within [sizeLimit]: +/// +/// * [allowedFileExtensions] — when non-empty, the file's extension must +/// appear in the list. +/// * [blockedFileExtensions] — the file's extension must not appear in +/// the list. +/// * [allowedMimeTypes] — when non-empty, the file's MIME type must +/// appear in the list. +/// * [blockedMimeTypes] — the file's MIME type must not appear in the +/// list. +/// {@endtemplate} +@freezed +class UploadConfig with _$UploadConfig { + /// {@macro uploadConfig} + const UploadConfig({ + this.sizeLimit = defaultSizeLimit, + this.allowedFileExtensions = const [], + this.blockedFileExtensions = const [], + this.allowedMimeTypes = const [], + this.blockedMimeTypes = const [], + }); + + /// The fallback used for [sizeLimit] when no explicit value is provided. + static const defaultSizeLimit = 100 * 1024 * 1024; + + /// The maximum upload size, in bytes. + /// + /// Defaults to [defaultSizeLimit]. + @override + final int sizeLimit; + + /// The file extensions explicitly permitted, e.g. `['.pdf', '.csv']`. + /// + /// When non-empty, only listed extensions pass. + @override + final List allowedFileExtensions; + + /// The file extensions explicitly blocked. + @override + final List blockedFileExtensions; + + /// The MIME types explicitly permitted, e.g. `['text/csv', 'image/png']`. + /// + /// When non-empty, only listed MIME types pass. + @override + final List allowedMimeTypes; + + /// The MIME types explicitly blocked. + @override + final List blockedMimeTypes; +} diff --git a/packages/stream_chat/lib/src/core/models/upload_config.freezed.dart b/packages/stream_chat/lib/src/core/models/upload_config.freezed.dart new file mode 100644 index 0000000000..7546623d65 --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/upload_config.freezed.dart @@ -0,0 +1,113 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'upload_config.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UploadConfig { + int get sizeLimit; + List get allowedFileExtensions; + List get blockedFileExtensions; + List get allowedMimeTypes; + List get blockedMimeTypes; + + /// Create a copy of UploadConfig + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UploadConfigCopyWith get copyWith => + _$UploadConfigCopyWithImpl(this as UploadConfig, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UploadConfig && + (identical(other.sizeLimit, sizeLimit) || other.sizeLimit == sizeLimit) && + const DeepCollectionEquality().equals(other.allowedFileExtensions, allowedFileExtensions) && + const DeepCollectionEquality().equals(other.blockedFileExtensions, blockedFileExtensions) && + const DeepCollectionEquality().equals(other.allowedMimeTypes, allowedMimeTypes) && + const DeepCollectionEquality().equals(other.blockedMimeTypes, blockedMimeTypes)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + sizeLimit, + const DeepCollectionEquality().hash(allowedFileExtensions), + const DeepCollectionEquality().hash(blockedFileExtensions), + const DeepCollectionEquality().hash(allowedMimeTypes), + const DeepCollectionEquality().hash(blockedMimeTypes), + ); + + @override + String toString() { + return 'UploadConfig(sizeLimit: $sizeLimit, allowedFileExtensions: $allowedFileExtensions, blockedFileExtensions: $blockedFileExtensions, allowedMimeTypes: $allowedMimeTypes, blockedMimeTypes: $blockedMimeTypes)'; + } +} + +/// @nodoc +abstract mixin class $UploadConfigCopyWith<$Res> { + factory $UploadConfigCopyWith(UploadConfig value, $Res Function(UploadConfig) _then) = _$UploadConfigCopyWithImpl; + @useResult + $Res call({ + int sizeLimit, + List allowedFileExtensions, + List blockedFileExtensions, + List allowedMimeTypes, + List blockedMimeTypes, + }); +} + +/// @nodoc +class _$UploadConfigCopyWithImpl<$Res> implements $UploadConfigCopyWith<$Res> { + _$UploadConfigCopyWithImpl(this._self, this._then); + + final UploadConfig _self; + final $Res Function(UploadConfig) _then; + + /// Create a copy of UploadConfig + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? sizeLimit = null, + Object? allowedFileExtensions = null, + Object? blockedFileExtensions = null, + Object? allowedMimeTypes = null, + Object? blockedMimeTypes = null, + }) { + return _then( + UploadConfig( + sizeLimit: null == sizeLimit + ? _self.sizeLimit + : sizeLimit // ignore: cast_nullable_to_non_nullable + as int, + allowedFileExtensions: null == allowedFileExtensions + ? _self.allowedFileExtensions + : allowedFileExtensions // ignore: cast_nullable_to_non_nullable + as List, + blockedFileExtensions: null == blockedFileExtensions + ? _self.blockedFileExtensions + : blockedFileExtensions // ignore: cast_nullable_to_non_nullable + as List, + allowedMimeTypes: null == allowedMimeTypes + ? _self.allowedMimeTypes + : allowedMimeTypes // ignore: cast_nullable_to_non_nullable + as List, + blockedMimeTypes: null == blockedMimeTypes + ? _self.blockedMimeTypes + : blockedMimeTypes // ignore: cast_nullable_to_non_nullable + as List, + ), + ); + } +} diff --git a/packages/stream_chat/lib/src/repository/app_settings_repository.dart b/packages/stream_chat/lib/src/repository/app_settings_repository.dart new file mode 100644 index 0000000000..b89f017019 --- /dev/null +++ b/packages/stream_chat/lib/src/repository/app_settings_repository.dart @@ -0,0 +1,20 @@ +import 'package:stream_core/stream_core.dart' show PatternMatching, Result; + +import '../../open_api/api.dart' as api; +import '../core/models/response/app_settings_response.dart'; +import 'mapper/app_settings_mapper.dart'; + +/// Repository dedicated to application settings operations. +class AppSettingsRepository { + /// Creates a new [AppSettingsRepository]. + const AppSettingsRepository(this._api); + + final api.DefaultApi _api; + + /// Fetches the settings configured for the application. + Future> getAppSettings() async { + final result = await _api.getApp(); + + return result.map((response) => response.toModel()); + } +} diff --git a/packages/stream_chat/lib/src/repository/mapper/app_settings_mapper.dart b/packages/stream_chat/lib/src/repository/mapper/app_settings_mapper.dart new file mode 100644 index 0000000000..1c2f2baae3 --- /dev/null +++ b/packages/stream_chat/lib/src/repository/mapper/app_settings_mapper.dart @@ -0,0 +1,37 @@ +import '../../../open_api/api.dart' as api; +import '../../core/models/app_settings.dart'; +import '../../core/models/response/app_settings_response.dart'; +import '../../core/models/upload_config.dart'; + +/// Maps a generated [api.FileUploadConfig] to an [UploadConfig]. +extension FileUploadConfigMapper on api.FileUploadConfig { + /// Converts this config into an [UploadConfig]. + UploadConfig toModel() => UploadConfig( + sizeLimit: sizeLimit, + allowedFileExtensions: allowedFileExtensions, + blockedFileExtensions: blockedFileExtensions, + allowedMimeTypes: allowedMimeTypes, + blockedMimeTypes: blockedMimeTypes, + ); +} + +/// Maps a generated [api.AppResponseFields] to an [AppSettings]. +extension AppResponseFieldsMapper on api.AppResponseFields { + /// Converts these fields into an [AppSettings]. + AppSettings toModel() => AppSettings( + name: name, + fileUploadConfig: fileUploadConfig.toModel(), + imageUploadConfig: imageUploadConfig.toModel(), + autoTranslationEnabled: autoTranslationEnabled, + asyncUrlEnrichEnabled: asyncUrlEnrichEnabled, + ); +} + +/// Maps a generated [api.GetApplicationResponse] to an [AppSettingsResponse]. +extension GetApplicationResponseMapper on api.GetApplicationResponse { + /// Converts this response into an [AppSettingsResponse]. + AppSettingsResponse toModel() => AppSettingsResponse( + duration: duration, + app: app.toModel(), + ); +} diff --git a/packages/stream_chat/lib/stream_chat.dart b/packages/stream_chat/lib/stream_chat.dart index 29b9c47624..65c2364419 100644 --- a/packages/stream_chat/lib/stream_chat.dart +++ b/packages/stream_chat/lib/stream_chat.dart @@ -120,6 +120,7 @@ export 'src/core/models/reaction.dart'; export 'src/core/models/reaction_group.dart'; export 'src/core/models/read.dart'; export 'src/core/models/response/add_user_group_members_response.dart'; +export 'src/core/models/response/app_settings_response.dart'; export 'src/core/models/response/create_user_group_response.dart'; export 'src/core/models/response/flag_response.dart'; export 'src/core/models/response/get_user_group_response.dart'; @@ -137,6 +138,7 @@ export 'src/core/models/role_type.dart'; export 'src/core/models/thread.dart'; export 'src/core/models/thread_participant.dart'; export 'src/core/models/unread_counts.dart'; +export 'src/core/models/upload_config.dart'; export 'src/core/models/user.dart'; export 'src/core/models/user_block.dart'; export 'src/core/models/user_group.dart'; diff --git a/packages/stream_chat/test/fixtures/app_settings.json b/packages/stream_chat/test/fixtures/app_settings.json deleted file mode 100644 index 83d757094d..0000000000 --- a/packages/stream_chat/test/fixtures/app_settings.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "app": { - "name": "test-app", - "auto_translation_enabled": false, - "async_url_enrich_enabled": true, - "file_upload_config": { - "size_limit": 10485760, - "allowed_file_extensions": [".csv", ".pdf"], - "blocked_file_extensions": [".exe"], - "allowed_mime_types": ["text/csv", "application/pdf"], - "blocked_mime_types": ["application/x-msdownload"] - }, - "image_upload_config": { - "size_limit": 5242880, - "allowed_file_extensions": [], - "blocked_file_extensions": [], - "allowed_mime_types": ["image/png", "image/jpeg"], - "blocked_mime_types": [] - } - }, - "duration": "10ms" -} diff --git a/packages/stream_chat/test/src/client/app_settings_manager_test.dart b/packages/stream_chat/test/src/client/app_settings_manager_test.dart new file mode 100644 index 0000000000..311482c753 --- /dev/null +++ b/packages/stream_chat/test/src/client/app_settings_manager_test.dart @@ -0,0 +1,129 @@ +import 'package:mocktail/mocktail.dart'; +import 'package:stream_chat/src/client/app_settings_manager.dart'; +import 'package:stream_chat/src/repository/app_settings_repository.dart'; +import 'package:stream_chat/stream_chat.dart'; +import 'package:test/test.dart'; + +class MockAppSettingsRepository extends Mock implements AppSettingsRepository {} + +void main() { + test('AppSettingsManager.appSettings is the default until a load completes', () { + final repository = MockAppSettingsRepository(); + final manager = AppSettingsManager(repository); + expect(manager.appSettings, const AppSettings()); + }); + + test('AppSettingsManager.loadAppSettings caches the fetched settings', () async { + final repository = MockAppSettingsRepository(); + final manager = AppSettingsManager(repository); + when(repository.getAppSettings).thenAnswer((_) async => Result.success(_response())); + + await manager.loadAppSettings(); + + expect(manager.appSettings, _response().app); + }); + + test('AppSettingsManager.loadAppSettings does not fetch again once settings are cached', () async { + final repository = MockAppSettingsRepository(); + final manager = AppSettingsManager(repository); + when(repository.getAppSettings).thenAnswer((_) async => Result.success(_response())); + + await manager.loadAppSettings(); + await manager.loadAppSettings(); + + verify(repository.getAppSettings).called(1); + }); + + test('AppSettingsManager.loadAppSettings keeps the default when the request fails', () async { + final repository = MockAppSettingsRepository(); + final manager = AppSettingsManager(repository); + when(repository.getAppSettings).thenAnswer((_) async => const Result.failure(_error)); + + await manager.loadAppSettings(); + + expect(manager.appSettings, const AppSettings()); + }); + + test('AppSettingsManager.loadAppSettings fetches again after a failed attempt', () async { + final repository = MockAppSettingsRepository(); + final manager = AppSettingsManager(repository); + var calls = 0; + when(repository.getAppSettings).thenAnswer((_) async { + calls++; + if (calls == 1) return const Result.failure(_error); + return Result.success(_response()); + }); + + await manager.loadAppSettings(); + await manager.loadAppSettings(); + + expect(manager.appSettings, _response().app); + }); + + test('AppSettingsManager.refresh replaces the cached settings', () async { + final repository = MockAppSettingsRepository(); + final manager = AppSettingsManager(repository); + when(repository.getAppSettings).thenAnswer((_) async => Result.success(_response(name: 'stale'))); + await manager.loadAppSettings(); + + when(repository.getAppSettings).thenAnswer((_) async => Result.success(_response(name: 'fresh'))); + await manager.refresh(); + + expect(manager.appSettings.name, 'fresh'); + }); + + test('AppSettingsManager.refresh fetches even when settings are cached', () async { + final repository = MockAppSettingsRepository(); + final manager = AppSettingsManager(repository); + when(repository.getAppSettings).thenAnswer((_) async => Result.success(_response())); + + await manager.loadAppSettings(); + await manager.refresh(); + + verify(repository.getAppSettings).called(2); + }); + + test('AppSettingsManager.refresh keeps the cached settings when it fails', () async { + final repository = MockAppSettingsRepository(); + final manager = AppSettingsManager(repository); + when(repository.getAppSettings).thenAnswer((_) async => Result.success(_response())); + await manager.loadAppSettings(); + + when(repository.getAppSettings).thenAnswer((_) async => const Result.failure(_error)); + await manager.refresh(); + + expect(manager.appSettings, _response().app); + }); + + test('AppSettingsManager.clear resets appSettings to the default', () async { + final repository = MockAppSettingsRepository(); + final manager = AppSettingsManager(repository); + when(repository.getAppSettings).thenAnswer((_) async => Result.success(_response())); + await manager.loadAppSettings(); + + manager.clear(); + + expect(manager.appSettings, const AppSettings()); + }); + + test('AppSettingsManager.clear makes the next load fetch again', () async { + final repository = MockAppSettingsRepository(); + final manager = AppSettingsManager(repository); + when(repository.getAppSettings).thenAnswer((_) async => Result.success(_response())); + + await manager.loadAppSettings(); + manager.clear(); + await manager.loadAppSettings(); + + verify(repository.getAppSettings).called(2); + }); +} + +const _error = StreamClientException(message: 'boom'); + +AppSettingsResponse _response({String name = 'test-app'}) { + return AppSettingsResponse( + duration: '0.01ms', + app: AppSettings(name: name), + ); +} diff --git a/packages/stream_chat/test/src/client/client_connection_id_test.dart b/packages/stream_chat/test/src/client/client_connection_id_test.dart index b614048ac5..dfcf547e4b 100644 --- a/packages/stream_chat/test/src/client/client_connection_id_test.dart +++ b/packages/stream_chat/test/src/client/client_connection_id_test.dart @@ -3,6 +3,7 @@ import 'package:mocktail/mocktail.dart'; import 'package:stream_chat/stream_chat.dart'; import 'package:test/test.dart'; +import '../fakes.dart'; import '../utils.dart'; import '../ws/fake_chat_server.dart'; @@ -24,7 +25,14 @@ void main() { ); ws = FakeChatServer(); - client = StreamChatClient('test-api-key', wsProvider: ws.connect, httpClientAdapter: adapter); + // Faked: the generated client shares this adapter, and its connect-time + // request would land among the ones captured below. + client = StreamChatClient( + 'test-api-key', + defaultApi: FakeDefaultApi(), + wsProvider: ws.connect, + httpClientAdapter: adapter, + ); }); tearDown(() => client.dispose()); diff --git a/packages/stream_chat/test/src/client/client_test.dart b/packages/stream_chat/test/src/client/client_test.dart index 4c441550e7..fd698b9f60 100644 --- a/packages/stream_chat/test/src/client/client_test.dart +++ b/packages/stream_chat/test/src/client/client_test.dart @@ -28,7 +28,7 @@ void main() { setUp(() { final ws = FakeChatServer(); - client = StreamChatClient(apiKey, wsProvider: ws.connect, chatApi: fakeChatApi); + client = StreamChatClient(apiKey, defaultApi: FakeDefaultApi(), wsProvider: ws.connect, chatApi: fakeChatApi); }); tearDown(() { @@ -193,7 +193,7 @@ void main() { setUp(() { final ws = FakeChatServer()..handshakeFails = true; - client = StreamChatClient(apiKey, chatApi: fakeChatApi, wsProvider: ws.connect); + client = StreamChatClient(apiKey, defaultApi: FakeDefaultApi(), chatApi: fakeChatApi, wsProvider: ws.connect); }); tearDown(() { @@ -268,7 +268,7 @@ void main() { }); setUp(() { - client = StreamChatClient(apiKey, chatApi: fakeChatApi); + client = StreamChatClient(apiKey, defaultApi: FakeDefaultApi(), chatApi: fakeChatApi); }); tearDown(() { @@ -356,7 +356,7 @@ void main() { setUp(() { final ws = FakeChatServer()..handshakeFails = true; - client = StreamChatClient(apiKey, chatApi: fakeChatApi, wsProvider: ws.connect) + client = StreamChatClient(apiKey, defaultApi: FakeDefaultApi(), chatApi: fakeChatApi, wsProvider: ws.connect) ..chatPersistenceClient = persistence; }); @@ -488,7 +488,7 @@ void main() { // connection info before any test has had a chance to stub it. when(() => persistence.updateConnectionInfo(any())).thenAnswer((_) => Future.value()); final ws = FakeChatServer(); - client = StreamChatClient(apiKey, chatApi: fakeChatApi, wsProvider: ws.connect) + client = StreamChatClient(apiKey, defaultApi: FakeDefaultApi(), chatApi: fakeChatApi, wsProvider: ws.connect) ..chatPersistenceClient = persistence; await client.connectUser(user, token); await delay(300); @@ -1171,6 +1171,14 @@ void main() { expect(client.state.currentUser, isNull); expect(client.connectionStatus, ConnectionStatus.disconnected); }); + + test('`.disconnectUser` resets appSettings to the default', () async { + expect(client.appSettings.name, 'test-app'); + + await client.disconnectUser(flushChatPersistence: true); + + expect(client.appSettings, const AppSettings()); + }); }); group('Client with connected user without persistence', () { @@ -1197,18 +1205,19 @@ void main() { // Clear any accumulated interactions from a previous test so that // verifyNoMoreInteractions on fakeChatApi.general stays accurate. clearInteractions(fakeChatApi.general); - clearInteractions(defaultApi); final ws = FakeChatServer(); client = StreamChatClient(apiKey, chatApi: fakeChatApi, defaultApi: defaultApi, wsProvider: ws.connect); - // Stub getAppSettings so the background fetch after connectUser succeeds. - when(() => fakeChatApi.general.getAppSettings()).thenAnswer( - (_) async => GetAppSettingsResponse()..app = const AppSettings(name: 'test'), - ); + // Stub getApp so the background fetch after connectUser succeeds. + when(defaultApi.getApp).thenAnswer((_) async => Result.success(fakeGetApplicationResponse())); await client.connectUser(user, token); await delay(300); expect(client.persistenceEnabled, isFalse); expect(client.connectionStatus, ConnectionStatus.connected); + + // Cleared after connecting, so the background getApp does not trip the + // verifyNoMoreInteractions(defaultApi) checks below. + clearInteractions(defaultApi); }); tearDown(() async { @@ -1652,7 +1661,6 @@ void main() { messageFilters: any(named: 'messageFilters'), ), ).called(1); - verify(() => fakeChatApi.general.getAppSettings()).called(1); verifyNoMoreInteractions(fakeChatApi.general); }); @@ -2597,6 +2605,99 @@ void main() { verifyNoMoreInteractions(defaultApi); }); + test('StreamChatClient.getAppSettings returns the app settings', () async { + when(defaultApi.getApp).thenAnswer( + (_) async => const Result.success( + api.GetApplicationResponse( + duration: '0.01ms', + app: api.AppResponseFields( + id: 42, + name: 'test-app', + placement: 'us-east', + autoTranslationEnabled: true, + asyncUrlEnrichEnabled: false, + fileUploadConfig: api.FileUploadConfig( + sizeLimit: 10485760, + allowedFileExtensions: ['.csv'], + blockedFileExtensions: ['.exe'], + allowedMimeTypes: ['text/csv'], + blockedMimeTypes: ['application/x-msdownload'], + ), + imageUploadConfig: api.FileUploadConfig( + sizeLimit: 5242880, + allowedFileExtensions: ['.png'], + blockedFileExtensions: ['.gif'], + allowedMimeTypes: ['image/png'], + blockedMimeTypes: ['image/gif'], + ), + ), + ), + ), + ); + + final res = await client.getAppSettings(); + expect( + res.getOrNull(), + const AppSettingsResponse( + duration: '0.01ms', + app: AppSettings( + name: 'test-app', + autoTranslationEnabled: true, + fileUploadConfig: UploadConfig( + sizeLimit: 10485760, + allowedFileExtensions: ['.csv'], + blockedFileExtensions: ['.exe'], + allowedMimeTypes: ['text/csv'], + blockedMimeTypes: ['application/x-msdownload'], + ), + imageUploadConfig: UploadConfig( + sizeLimit: 5242880, + allowedFileExtensions: ['.png'], + blockedFileExtensions: ['.gif'], + allowedMimeTypes: ['image/png'], + blockedMimeTypes: ['image/gif'], + ), + ), + ), + ); + + verify(defaultApi.getApp).called(1); + verifyNoMoreInteractions(defaultApi); + }); + + test('StreamChatClient.getAppSettings returns the failure without throwing', () async { + const error = StreamClientException(message: 'boom'); + when(defaultApi.getApp).thenAnswer((_) async => const Result.failure(error)); + + final res = await client.getAppSettings(); + + expect(res.exceptionOrNull(), error); + }); + + test('StreamChatClient.getAppSettings replaces appSettings on success', () async { + when(defaultApi.getApp).thenAnswer((_) async => Result.success(fakeGetApplicationResponse(name: 'fresh'))); + + await client.getAppSettings(); + + expect(client.appSettings.name, 'fresh'); + }); + + test('StreamChatClient.getAppSettings keeps appSettings when it fails', () async { + when(defaultApi.getApp).thenAnswer((_) async => const Result.failure(StreamClientException(message: 'boom'))); + + await client.getAppSettings(); + + expect(client.appSettings.name, 'test-app'); + }); + + test('StreamChatClient.getAppSettings passes an unset size limit through as 0', () async { + when(defaultApi.getApp).thenAnswer((_) async => Result.success(fakeGetApplicationResponse())); + + final res = await client.getAppSettings(); + + expect(res.getOrNull()?.app.fileUploadConfig.sizeLimit, 0); + }); + group('`.channel`', () { test('should return back a new channel instance', () { const channelType = 'test-channel-type'; @@ -2853,7 +2954,6 @@ void main() { expect(res.members.length, members.length); verify(() => fakeChatApi.general.queryMembers(channelType)).called(1); - verify(() => fakeChatApi.general.getAppSettings()).called(1); verifyNoMoreInteractions(fakeChatApi.general); }); @@ -5245,7 +5345,7 @@ void main() { setUp(() async { final ws = FakeChatServer(); - client = StreamChatClient(apiKey, chatApi: fakeChatApi, wsProvider: ws.connect); + client = StreamChatClient(apiKey, defaultApi: FakeDefaultApi(), chatApi: fakeChatApi, wsProvider: ws.connect); expect(client.persistenceEnabled, isFalse); }); @@ -5592,7 +5692,7 @@ void main() { test('should re-query active channels on reconnect when enabled (default)', () async { // Setup: connect with default flag, register two channels. - client = StreamChatClient(apiKey, chatApi: fakeChatApi, wsProvider: ws.connect); + client = StreamChatClient(apiKey, defaultApi: FakeDefaultApi(), chatApi: fakeChatApi, wsProvider: ws.connect); await client.connectUser(user, token); await delay(300); @@ -5627,7 +5727,13 @@ void main() { }); test('should skip the re-query on reconnect when disabled', () async { - client = StreamChatClient(apiKey, chatApi: fakeChatApi, wsProvider: ws.connect, recoverStateOnReconnect: false); + client = StreamChatClient( + apiKey, + defaultApi: FakeDefaultApi(), + chatApi: fakeChatApi, + wsProvider: ws.connect, + recoverStateOnReconnect: false, + ); await client.connectUser(user, token); await delay(300); @@ -5652,7 +5758,13 @@ void main() { }); test('should still emit `connectionRecovered` when disabled', () async { - client = StreamChatClient(apiKey, chatApi: fakeChatApi, wsProvider: ws.connect, recoverStateOnReconnect: false); + client = StreamChatClient( + apiKey, + defaultApi: FakeDefaultApi(), + chatApi: fakeChatApi, + wsProvider: ws.connect, + recoverStateOnReconnect: false, + ); await client.connectUser(user, token); await delay(300); @@ -5687,7 +5799,7 @@ void main() { ), ).thenThrow(StateError('queryChannels needs an active connection. Call `connectUser` first.')); - client = StreamChatClient(apiKey, chatApi: fakeChatApi, wsProvider: ws.connect); + client = StreamChatClient(apiKey, defaultApi: FakeDefaultApi(), chatApi: fakeChatApi, wsProvider: ws.connect); await client.connectUser(user, token); await delay(300); @@ -5706,7 +5818,7 @@ void main() { }); test('should skip the re-query when no active channels are tracked', () async { - client = StreamChatClient(apiKey, chatApi: fakeChatApi, wsProvider: ws.connect); + client = StreamChatClient(apiKey, defaultApi: FakeDefaultApi(), chatApi: fakeChatApi, wsProvider: ws.connect); await client.connectUser(user, token); await delay(300); @@ -5732,7 +5844,13 @@ void main() { // Skipping event replay leaves the state of the synced channels behind, so // the skip refreshes them itself, whatever this flag is set to. test('should re-query active channels when the sync skipped event replay', () async { - client = StreamChatClient(apiKey, chatApi: fakeChatApi, wsProvider: ws.connect, recoverStateOnReconnect: false); + client = StreamChatClient( + apiKey, + defaultApi: FakeDefaultApi(), + chatApi: fakeChatApi, + wsProvider: ws.connect, + recoverStateOnReconnect: false, + ); await client.connectUser(user, token); await delay(300); @@ -5785,7 +5903,7 @@ void main() { // A failed sync applied nothing and moved nothing, so the configured // recovery still runs and the window stays outstanding for the next sync. test('should re-query active channels when the sync fails, keeping lastSyncAt', () async { - client = StreamChatClient(apiKey, chatApi: fakeChatApi, wsProvider: ws.connect); + client = StreamChatClient(apiKey, defaultApi: FakeDefaultApi(), chatApi: fakeChatApi, wsProvider: ws.connect); await client.connectUser(user, token); await delay(300); @@ -5843,7 +5961,13 @@ void main() { ), ).thenThrow(StateError('queryChannels needs an active connection. Call `connectUser` first.')); - client = StreamChatClient(apiKey, chatApi: fakeChatApi, wsProvider: ws.connect, recoverStateOnReconnect: false); + client = StreamChatClient( + apiKey, + defaultApi: FakeDefaultApi(), + chatApi: fakeChatApi, + wsProvider: ws.connect, + recoverStateOnReconnect: false, + ); await client.connectUser(user, token); await delay(300); @@ -5877,7 +6001,13 @@ void main() { }); test('should re-query in batches when more channels are active than fit in one page', () async { - client = StreamChatClient(apiKey, chatApi: fakeChatApi, wsProvider: ws.connect, recoverStateOnReconnect: false); + client = StreamChatClient( + apiKey, + defaultApi: FakeDefaultApi(), + chatApi: fakeChatApi, + wsProvider: ws.connect, + recoverStateOnReconnect: false, + ); await client.connectUser(user, token); await delay(300); @@ -5949,7 +6079,7 @@ void main() { // it fires. Emitting it before the catch-up finishes would have them act // on state the sync has not written yet. test('should finish recovering before `connectionRecovered` fires', () async { - client = StreamChatClient(apiKey, chatApi: fakeChatApi, wsProvider: ws.connect); + client = StreamChatClient(apiKey, defaultApi: FakeDefaultApi(), chatApi: fakeChatApi, wsProvider: ws.connect); await client.connectUser(user, token); await delay(300); @@ -5995,7 +6125,13 @@ void main() { // One page failing says nothing about the others, so the rest are still // attempted — the channels that can be refreshed are. test('should attempt every page when one of them fails', () async { - client = StreamChatClient(apiKey, chatApi: fakeChatApi, wsProvider: ws.connect, recoverStateOnReconnect: false); + client = StreamChatClient( + apiKey, + defaultApi: FakeDefaultApi(), + chatApi: fakeChatApi, + wsProvider: ws.connect, + recoverStateOnReconnect: false, + ); await client.connectUser(user, token); await delay(300); @@ -6069,7 +6205,7 @@ void main() { }); test('should respect runtime toggling via the setter', () async { - client = StreamChatClient(apiKey, chatApi: fakeChatApi, wsProvider: ws.connect); + client = StreamChatClient(apiKey, defaultApi: FakeDefaultApi(), chatApi: fakeChatApi, wsProvider: ws.connect); await client.connectUser(user, token); await delay(300); @@ -6157,7 +6293,7 @@ void main() { ), ).thenAnswer((_) => pendingQuery.future); - client = StreamChatClient(apiKey, chatApi: fakeChatApi, wsProvider: ws.connect); + client = StreamChatClient(apiKey, defaultApi: FakeDefaultApi(), chatApi: fakeChatApi, wsProvider: ws.connect); await client.connectUser(user, token); await delay(300); @@ -6193,7 +6329,7 @@ void main() { setUp(() async { final ws = FakeChatServer(); - client = StreamChatClient('test-api-key', wsProvider: ws.connect); + client = StreamChatClient('test-api-key', defaultApi: FakeDefaultApi(), wsProvider: ws.connect); final user = User(id: 'test-user-id'); final token = testUserToken(user.id).rawValue; @@ -6353,7 +6489,7 @@ void main() { setUp(() { final ws = FakeChatServer(); - client = StreamChatClient(apiKey, wsProvider: ws.connect, chatApi: fakeChatApi); + client = StreamChatClient(apiKey, defaultApi: FakeDefaultApi(), wsProvider: ws.connect, chatApi: fakeChatApi); }); tearDown(() { @@ -6468,7 +6604,12 @@ void main() { // Recovering after an outage replays the events missed over `/sync`, not over the socket, so // one carrying a poll has to be reported the same way as one that arrived live. test('should report a poll message recovered after an outage as a poll created event', () async { - final client = StreamChatClient('test-api-key', chatApi: FakeChatApi(), wsProvider: FakeChatServer().connect); + final client = StreamChatClient( + 'test-api-key', + defaultApi: FakeDefaultApi(), + chatApi: FakeChatApi(), + wsProvider: FakeChatServer().connect, + ); addTearDown(client.dispose); final poll = Poll( @@ -6493,7 +6634,12 @@ void main() { Future<(StreamChatClient, FakeChatServer)> connectedClient() async { final server = FakeChatServer(user: OwnUser.fromUser(user)); - final client = StreamChatClient(apiKey, chatApi: FakeChatApi(), wsProvider: server.connect); + final client = StreamChatClient( + apiKey, + defaultApi: FakeDefaultApi(), + chatApi: FakeChatApi(), + wsProvider: server.connect, + ); addTearDown(client.dispose); await client.connectUser(user, token); @@ -6539,7 +6685,12 @@ void main() { test('should report a first attempt that failed as disconnected', () async { final server = FakeChatServer(user: OwnUser.fromUser(user))..handshakeFails = true; - final client = StreamChatClient(apiKey, chatApi: FakeChatApi(), wsProvider: server.connect); + final client = StreamChatClient( + apiKey, + defaultApi: FakeDefaultApi(), + chatApi: FakeChatApi(), + wsProvider: server.connect, + ); addTearDown(client.dispose); await expectLater(client.connectUser(user, token), throwsA(isA())); @@ -6589,7 +6740,12 @@ void main() { test('should wait on the attempt in flight rather than open a second connection', () async { final server = FakeChatServer(user: OwnUser.fromUser(user)); - final client = StreamChatClient(apiKey, chatApi: FakeChatApi(), wsProvider: server.connect); + final client = StreamChatClient( + apiKey, + defaultApi: FakeDefaultApi(), + chatApi: FakeChatApi(), + wsProvider: server.connect, + ); addTearDown(client.dispose); // Reported the same way as a connection waiting out a delay, which is what makes asking to @@ -6648,9 +6804,15 @@ void main() { }); test('should answer both callers connecting the same user at once with one connection', () async { - final fakeChatApi = FakeChatApi(); + final defaultApi = MockDefaultApi(); + when(defaultApi.getApp).thenAnswer((_) async => Result.success(fakeGetApplicationResponse())); final server = FakeChatServer(user: OwnUser.fromUser(user)); - final client = StreamChatClient(apiKey, chatApi: fakeChatApi, wsProvider: server.connect); + final client = StreamChatClient( + apiKey, + defaultApi: defaultApi, + chatApi: FakeChatApi(), + wsProvider: server.connect, + ); addTearDown(client.dispose); // The second lands while the first is still opening, which is where the status cannot tell a @@ -6665,12 +6827,17 @@ void main() { // One sign-in, not two alongside each other: what it does for the user behind the connection // is done for the pair rather than once each. await pumpEventQueue(); - verify(() => fakeChatApi.general.getAppSettings()).called(1); + verify(defaultApi.getApp).called(1); }); test('should leave nobody signed in when connecting a user fails', () async { final server = FakeChatServer()..handshakeFails = true; - final client = StreamChatClient(apiKey, chatApi: FakeChatApi(), wsProvider: server.connect); + final client = StreamChatClient( + apiKey, + defaultApi: FakeDefaultApi(), + chatApi: FakeChatApi(), + wsProvider: server.connect, + ); addTearDown(client.dispose); await expectLater(client.connectUser(user, token), throwsA(isA())); @@ -6680,7 +6847,12 @@ void main() { test('should connect another user after connecting one failed', () async { final server = FakeChatServer()..handshakeFails = true; - final client = StreamChatClient(apiKey, chatApi: FakeChatApi(), wsProvider: server.connect); + final client = StreamChatClient( + apiKey, + defaultApi: FakeDefaultApi(), + chatApi: FakeChatApi(), + wsProvider: server.connect, + ); addTearDown(client.dispose); await expectLater(client.connectUser(user, token), throwsA(isA())); @@ -6745,7 +6917,12 @@ void main() { // A client that never connected has nothing to wait for, so the query says so rather than // waiting on a connection nobody asked for. test('should throw when no connection was ever opened', () async { - final client = StreamChatClient(apiKey, chatApi: FakeChatApi(), wsProvider: FakeChatServer().connect); + final client = StreamChatClient( + apiKey, + defaultApi: FakeDefaultApi(), + chatApi: FakeChatApi(), + wsProvider: FakeChatServer().connect, + ); addTearDown(client.dispose); expect(client.connectionStatus, ConnectionStatus.disconnected); @@ -6757,7 +6934,12 @@ void main() { test('should watch the channels it loads when the connection lands mid-query', () async { final fakeChatApi = FakeChatApi(); final ws = FakeChatServer(user: OwnUser.fromUser(user)); - final client = StreamChatClient(apiKey, chatApi: fakeChatApi, wsProvider: ws.connect); + final client = StreamChatClient( + apiKey, + defaultApi: FakeDefaultApi(), + chatApi: fakeChatApi, + wsProvider: ws.connect, + ); addTearDown(client.dispose); when( @@ -6800,7 +6982,12 @@ void main() { // leave the caller waiting on a connection nothing is opening any more. test('should throw rather than hang when the connection being opened fails', () async { final ws = FakeChatServer()..handshakeFails = true; - final client = StreamChatClient(apiKey, chatApi: FakeChatApi(), wsProvider: ws.connect); + final client = StreamChatClient( + apiKey, + defaultApi: FakeDefaultApi(), + chatApi: FakeChatApi(), + wsProvider: ws.connect, + ); addTearDown(client.dispose); // Not awaited: the query below has to arrive while the attempt is still in flight. diff --git a/packages/stream_chat/test/src/core/api/general_api_test.dart b/packages/stream_chat/test/src/core/api/general_api_test.dart index 09cbbb18c4..22fb613c29 100644 --- a/packages/stream_chat/test/src/core/api/general_api_test.dart +++ b/packages/stream_chat/test/src/core/api/general_api_test.dart @@ -7,7 +7,6 @@ import 'package:stream_chat/stream_chat.dart'; import 'package:test/test.dart'; import '../../mocks.dart'; -import '../../utils.dart'; void main() { Response successResponse(String path, {Object? data}) => Response( @@ -295,24 +294,4 @@ void main() { verifyNoMoreInteractions(client); }); }); - - test('getAppSettings calls GET /app and parses response', () async { - const path = '/app'; - final fixture = jsonFixture('app_settings.json'); - - when(() => client.get(path)).thenAnswer( - (_) async => successResponse(path, data: fixture), - ); - - final res = await generalApi.getAppSettings(); - - expect(res, isNotNull); - expect(res.app.name, 'test-app'); - expect(res.app.fileUploadConfig.sizeLimit, 10485760); - expect(res.app.imageUploadConfig.sizeLimit, 5242880); - expect(res.app.fileUploadConfig.allowedFileExtensions, ['.csv', '.pdf']); - - verify(() => client.get(path)).called(1); - verifyNoMoreInteractions(client); - }); } diff --git a/packages/stream_chat/test/src/core/http/app_settings_manager_test.dart b/packages/stream_chat/test/src/core/http/app_settings_manager_test.dart deleted file mode 100644 index 4442d3de85..0000000000 --- a/packages/stream_chat/test/src/core/http/app_settings_manager_test.dart +++ /dev/null @@ -1,113 +0,0 @@ -import 'package:mocktail/mocktail.dart'; -import 'package:stream_chat/src/core/http/app_settings_manager.dart'; -import 'package:stream_chat/stream_chat.dart'; -import 'package:test/test.dart'; - -import '../../mocks.dart'; -import '../../utils.dart'; - -void main() { - late MockGeneralApi api; - late AppSettingsManager manager; - - GetAppSettingsResponse responseFromFixture() { - return GetAppSettingsResponse.fromJson(jsonFixture('app_settings.json')); - } - - setUp(() { - api = MockGeneralApi(); - manager = AppSettingsManager(api); - }); - - group('appSettings', () { - test('returns a default AppSettings before any load', () { - expect(manager.appSettings, const AppSettings()); - }); - }); - - group('loadAppSettings', () { - test('fetches and caches on first call', () async { - final response = responseFromFixture(); - when(() => api.getAppSettings()).thenAnswer((_) async => response); - - await manager.loadAppSettings(); - - expect(manager.appSettings, response.app); - verify(() => api.getAppSettings()).called(1); - }); - - test('is a no-op when a cached value already exists', () async { - when(() => api.getAppSettings()).thenAnswer((_) async => responseFromFixture()); - - await manager.loadAppSettings(); - await manager.loadAppSettings(); - - verify(() => api.getAppSettings()).called(1); - }); - - test('swallows errors and leaves appSettings at the default', () async { - when(() => api.getAppSettings()).thenThrow(Exception('boom')); - - await manager.loadAppSettings(); - - expect(manager.appSettings, const AppSettings()); - }); - - test('retries on the next call when the previous attempt failed', () async { - final response = responseFromFixture(); - var calls = 0; - when(() => api.getAppSettings()).thenAnswer((_) async { - calls++; - if (calls == 1) throw Exception('boom'); - return response; - }); - - await manager.loadAppSettings(); - await manager.loadAppSettings(); - - expect(manager.appSettings, response.app); - verify(() => api.getAppSettings()).called(2); - }); - }); - - group('refresh', () { - test('always re-fetches and returns the new value', () async { - final response = responseFromFixture(); - when(() => api.getAppSettings()).thenAnswer((_) async => response); - - await manager.loadAppSettings(); - final refreshed = await manager.refresh(); - - expect(refreshed, response.app); - expect(manager.appSettings, response.app); - verify(() => api.getAppSettings()).called(2); - }); - - test('propagates errors instead of swallowing them', () async { - when(() => api.getAppSettings()).thenThrow(Exception('boom')); - - await expectLater(manager.refresh(), throwsA(isA())); - }); - }); - - group('clear', () { - test('drops the cache so the next load re-fetches', () async { - when(() => api.getAppSettings()).thenAnswer((_) async => responseFromFixture()); - - await manager.loadAppSettings(); - manager.clear(); - await manager.loadAppSettings(); - - verify(() => api.getAppSettings()).called(2); - }); - - test('resets appSettings back to the default', () async { - when(() => api.getAppSettings()).thenAnswer((_) async => responseFromFixture()); - - await manager.loadAppSettings(); - manager.clear(); - - expect(manager.appSettings, const AppSettings()); - }); - }); -} diff --git a/packages/stream_chat/test/src/core/models/app_settings_test.dart b/packages/stream_chat/test/src/core/models/app_settings_test.dart deleted file mode 100644 index c3dd11a6ed..0000000000 --- a/packages/stream_chat/test/src/core/models/app_settings_test.dart +++ /dev/null @@ -1,60 +0,0 @@ -import 'package:stream_chat/stream_chat.dart'; -import 'package:test/test.dart'; - -import '../../utils.dart'; - -void main() { - group('AppSettings', () { - late AppSettings appSettings; - - setUp(() { - final json = jsonFixture('app_settings.json'); - appSettings = AppSettings.fromJson(json['app'] as Map); - }); - - test('parses name', () { - expect(appSettings.name, 'test-app'); - }); - - test('parses top-level booleans', () { - expect(appSettings.autoTranslationEnabled, false); - expect(appSettings.asyncUrlEnrichEnabled, true); - }); - - test('parses fileUploadConfig size_limit', () { - expect(appSettings.fileUploadConfig.sizeLimit, 10485760); - }); - - test('parses imageUploadConfig size_limit', () { - expect(appSettings.imageUploadConfig.sizeLimit, 5242880); - }); - - test('parses fileUploadConfig extension lists', () { - expect(appSettings.fileUploadConfig.allowedFileExtensions, ['.csv', '.pdf']); - expect(appSettings.fileUploadConfig.blockedFileExtensions, ['.exe']); - }); - - test('parses fileUploadConfig mime lists', () { - expect(appSettings.fileUploadConfig.allowedMimeTypes, ['text/csv', 'application/pdf']); - expect(appSettings.fileUploadConfig.blockedMimeTypes, ['application/x-msdownload']); - }); - - test('parses imageUploadConfig with empty lists', () { - expect(appSettings.imageUploadConfig.allowedFileExtensions, isEmpty); - expect(appSettings.imageUploadConfig.blockedFileExtensions, isEmpty); - }); - - test('defaults to empty lists when fields are absent', () { - final config = UploadConfig.fromJson(const {'size_limit': 0}); - expect(config.allowedFileExtensions, isEmpty); - expect(config.blockedFileExtensions, isEmpty); - expect(config.allowedMimeTypes, isEmpty); - expect(config.blockedMimeTypes, isEmpty); - }); - - test('defaults sizeLimit to defaultSizeLimit when absent', () { - final config = UploadConfig.fromJson(const {}); - expect(config.sizeLimit, UploadConfig.defaultSizeLimit); - }); - }); -} diff --git a/packages/stream_chat/test/src/fakes.dart b/packages/stream_chat/test/src/fakes.dart index 5e26a9a09f..20d3acd40c 100644 --- a/packages/stream_chat/test/src/fakes.dart +++ b/packages/stream_chat/test/src/fakes.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'package:mocktail/mocktail.dart'; +import 'package:stream_chat/open_api/api.dart' as api; import 'package:stream_chat/src/core/api/channel_api.dart'; import 'package:stream_chat/src/core/api/general_api.dart'; import 'package:stream_chat/src/core/api/guest_api.dart'; @@ -170,6 +171,36 @@ class FakeChatApi extends Fake implements StreamChatApi { AttachmentFileUploader get fileUploader => _fileUploader ??= MockAttachmentFileUploader(); } +/// Answers the `getApp` call `connectUser` makes on the generated client. +class FakeDefaultApi extends Fake implements api.DefaultApi { + @override + Future> getApp() async => Result.success(fakeGetApplicationResponse()); +} + +/// A generated application response, for tests that need `getApp` to answer. +api.GetApplicationResponse fakeGetApplicationResponse({String name = 'test-app'}) { + const unrestricted = api.FileUploadConfig( + allowedFileExtensions: [], + allowedMimeTypes: [], + blockedFileExtensions: [], + blockedMimeTypes: [], + sizeLimit: 0, + ); + + return api.GetApplicationResponse( + duration: '0.01ms', + app: api.AppResponseFields( + id: 42, + name: name, + placement: 'us-east', + asyncUrlEnrichEnabled: false, + autoTranslationEnabled: false, + fileUploadConfig: unrestricted, + imageUploadConfig: unrestricted, + ), + ); +} + class FakeClientState extends Fake implements ClientState { FakeClientState({ this._currentUser, From 2143a2f9687e992961859d31c9d1bd31d5402aff Mon Sep 17 00:00:00 2001 From: Petar Velikov Date: Tue, 29 Sep 2026 15:02:48 +0200 Subject: [PATCH 30/36] docs(repo): align the openapi-migration skill with the domain-model structure (#3012) * test(llc): name the device and role client tests by behavior Co-Authored-By: Claude Opus 5.5 * refactor(llc)!: keep the generated user group models off the public API Co-Authored-By: Claude Opus 5.5 * docs(repo): record the user groups migration against domain models Co-Authored-By: Claude Opus 5.5 * refactor(llc): generate the user group storage codec Co-Authored-By: Claude Opus 5.5 * refactor(persistence): store mentioned groups through the generated codec Co-Authored-By: Claude Opus 5.5 * docs(repo): allow @DataSerializable as the temporary storage codec Co-Authored-By: Claude Opus 5.5 * docs(repo): teach the migration skill when to use @DataSerializable Co-Authored-By: Claude Opus 5.5 * docs(llc): record fromData and toData as the offline storage format Co-Authored-By: Claude Opus 5.5 * docs(repo): drop the annotation check from the migration plan tool * docs(llc): move the v1 group decoding comment onto its function Co-Authored-By: Claude Opus 5.5 * test(llc): cover reading mentioned groups from v1 and v2 payloads Co-Authored-By: Claude Opus 5.5 * docs(llc): restore the user group method contracts on StreamChatClient Co-Authored-By: Claude Opus 5.5 * docs(repo): say which cached rows the user group codec stays compatible with Co-Authored-By: Claude Opus 5.5 * refactor(llc): move the response envelopes into models/response Co-Authored-By: Claude Opus 5.5 * docs(repo): teach the migration skill the domain-model layout Co-Authored-By: Claude Opus 5.5 * docs(repo): sanction the envelope and nullability breaks in the migration plan Co-Authored-By: Claude Opus 5.5 * docs(repo): note the shared poll responses in the polls plan Co-Authored-By: Claude Opus 5.5 * docs(llc): describe the user group cursors as pairs and split the member docs Co-Authored-By: Claude Opus 5.5 * test(llc): cover the user group failure path on the client and drop duplicate repository tests Co-Authored-By: Claude Opus 5.5 * docs(llc): fold the user group changelog entries Co-Authored-By: Claude Opus 5.5 * docs(repo): name the v11 write path the user group codec matches Co-Authored-By: Claude Opus 5.5 * test(llc): name the remaining user group client tests by what they check Co-Authored-By: Claude Opus 5.5 * test(llc): decode mentioned groups with epoch-nanosecond dates through Message.fromJson Co-Authored-By: Claude Opus 5.5 * docs(llc): keep the user group changelog clear that model equality is unchanged Co-Authored-By: Claude Opus 5.5 * test(llc): name the device and role client tests by what they check Co-Authored-By: Claude Opus 5.5 * docs(repo): drop the stale helpers reference from the user groups plan Co-Authored-By: Claude Opus 5.5 * docs(llc): state the user group equality change once in the changelog Co-Authored-By: Claude Opus 5.5 * docs(repo): address review remarks on the openapi-migration skill Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: Claude Opus 5.5 --- .claude/skills/openapi-migration/SKILL.md | 364 ++++++++++++---------- openapi-migration/05-polls.md | 1 + openapi-migration/README.md | 74 +++-- openapi-migration/tool/generate_plan.py | 5 + 4 files changed, 263 insertions(+), 181 deletions(-) diff --git a/.claude/skills/openapi-migration/SKILL.md b/.claude/skills/openapi-migration/SKILL.md index 7c4bde750a..5e47c55c2a 100644 --- a/.claude/skills/openapi-migration/SKILL.md +++ b/.claude/skills/openapi-migration/SKILL.md @@ -23,19 +23,25 @@ process for planning and landing one of them. Two documents bracket this work, and you should read both before starting: -- **`openapi-migration/`** — the plan. Its `README.md` has the group order, sizes and status; each numbered file - is one feature group with its scope tables (hand-written methods ↔ generated operations), decisions, risks and - definition of done. `01-foundation.md` holds the cross-cutting decisions every group inherits. **Start from your - group's file** rather than re-deriving the inventory — phase 1 below is largely done there already. +- **`openapi-migration/`** — the plan. Its `README.md` has the group order and status, and the + [domain-model rules](../../../openapi-migration/README.md#domain-models) every group follows, including the only + list of breaks a migration may make. Each numbered file is one feature group with its scope tables (hand-written + methods ↔ generated operations), decisions, risks and definition of done. **Start from your group's file** + rather than re-deriving the inventory — phase 1 below is largely done there already. - **`migrations/v11-migration.md`** — the consumer upgrade guide, written *as* features land rather than reconstructed at release. Read its Symbol Map and Error Handling sections before designing a change: they define the shape consumers have already been promised. **`STYLE_GUIDE.md`** (§ Documentation, § Testing), **`EFFECTIVE_DART_DOC.md`** and **`TESTING.md`** are the repo's conventions, and a migration follows them like any other change. `EFFECTIVE_DART_DOC.md` is Effective -Dart's documentation guide vendored into the repo; the style guide wins where the two disagree. Phases 4 and 5 -name the rules migrations keep breaking; that is a shortlist, not a substitute for the guides. Where they -disagree with this skill, the guides win. +Dart's documentation guide vendored into the repo; the style guide wins where the two disagree, and the guides +win over this skill. Phases 4 and 5 name the rules migrations keep breaking; that is a shortlist, not a substitute +for the guides. + +**The code already migrated shows the layout.** Devices (group 02), user groups (03) and every part of group 04 +but the guest user are done; copy the file structure of their repositories, mappers and envelopes (paths in +[Where each piece lives](#where-each-piece-lives)). Check docs and tests against the guides rather than copying +them from these files: precedent is what drifts. Work the phases in order. Most of the cost is in phases 1–2 — the code is mechanical once the inventory and the shape decisions exist. @@ -70,8 +76,8 @@ The inventory needs five lists: `updatePushNotificationPreferences`. Record paths too; not every v2 path is under `/chat/` (device ops are `/api/v2/devices` and `/api/v2/push_preferences`). 2. **Types** — the DTOs in `lib/src/core/api/{requests,responses}.dart` and any `lib/src/core/models/` types the - feature returns, against their generated counterparts. Write operations usually return `DurationResponse` (just - `duration`), which is what `EmptyResponse` corresponds to. + feature returns, against their generated counterparts. Note each operation's generated response type: one + answering the shared `DurationResponse` becomes `Result` (phase 2). 3. **Call sites** — everything above the api layer: `StreamChatClient`, `Channel`, and whether the response lands in client state or in `stream_chat_persistence`. 4. **Public exports** — which of those types `lib/stream_chat.dart` exports, since that is what makes a change @@ -84,6 +90,8 @@ Close the phase with three checks. Any of them can take an endpoint off the tabl **1. Blocking mismatch.** If the generated payload omits a field our current request sends, that endpoint stays hand-written and the inventory says why. Migrating it would silently drop behaviour — but check the newest spec before concluding it is permanent; see the ladder below. +Check the other direction too: a field a v10 model or envelope exposes that the generated response lacks can no +longer be filled, so raise it with the user before deciding the shape. **2. Is the generated operation even the same endpoint?** A matching name is not proof. Our hand-written client calls `baseUrl` + a bare path, which is the **chat v1** surface; a generated operation under `/api/v2//` @@ -128,9 +136,10 @@ Work the ladder in order — the answer changes depending on *where* it's missin grep -in "device" packages/stream_chat/lib/open_api/api/default_api.dart | head ``` 2. **Present in the spec, but the generated form is unusable.** Multipart uploads are the known case: the spec says - `multipart/form-data`, the generated method takes a JSON `@Body()`. Hand-write that one call with retrofit over - the generated *response* models, and open a generator fix upstream — see the `openapi-codegen` skill. Don't - contort the call site around a broken signature. + `multipart/form-data`, but the generated `uploadFile` / `uploadChannelFile` take a JSON `@Body()` with no + progress or cancellation. Hand-write that call with retrofit over the generated *response* models, keep + `AttachmentFileUploader` off `DefaultApi`, and open a generator fix upstream — see the `openapi-codegen` skill. + Don't contort the call site around a broken signature. 3. **In a newer spec than the one our tree was generated from.** Regenerate — its own PR, never folded into a feature slice. Also `openapi-codegen`. @@ -157,6 +166,7 @@ Work the ladder in order — the answer changes depending on *where* it's missin /path/to/protocol/openapi/v2/chat-clientside-api.json ``` + The spec lives in a checkout of the protocol repo; the `openapi-codegen` skill's `PROTOCOL_DIR` points at it. Then leave the endpoint hand-written, record it in the inventory with the reason, and raise it with the backend team so the spec grows. Never invent a generated model to fill the hole. @@ -165,40 +175,48 @@ silently — which is exactly why fixes belong in the generator or in your own c ## Phase 2 — decide the shape of each symbol -The generated models stay private. Follow the domain-model rules in -[`openapi-migration/README.md`](../../../openapi-migration/README.md#domain-models): the public API keeps the v10 -models, names and response envelopes as plain classes without JSON, and the repository maps generated → ours. -Phase 2 is therefore not "keep or adopt" but, per type: - -- **Which v10 type it maps to**, and whether that type is embedded in a model that still decodes v1 JSON with - json_serializable. If it is, the parent's field needs a temporary converter (README rule 7) — add it to the - adapters table with the group that removes it. -- **Whether persistence stores it as JSON text,** alone or nested inside another persisted model. Look for - `jsonEncode`, `fromJson`, `toJson` or `toData` on the type in - `stream_chat_persistence/lib/src/{mapper,converter,dao}`. If it is, the model gets the temporary - `@DataSerializable` codec (rule 8; see [Persisted models](#persisted-models-the-dataserializable-codec)). A model - stored as a table row, mapped column by column like `User` in `users`, needs no codec. -- **Which request enums need a hand-written public type** (rule 6). +The generated models stay private: the public API keeps our models, and a repository maps the generated types onto +them. The rules are the [domain-model rules](../../../openapi-migration/README.md#domain-models) in the plan's +README, and **its list of breaks is the only one**: a migration makes those breaks against v10 and no others. +Anything else it would change about what the caller holds needs its own reason and the user's approval. Generated types are wire shapes — nullable wherever the spec is loose, with per-operation extension types instead of shared enums (`CreateDeviceRequestPushProvider` rather than one `PushProvider`) — which is why they never reach a public signature. -**A migration makes exactly these breaks, and no others:** +**Per type, decide:** + +- **Which v10 type it maps to, and under what name.** The v10 name is the default, even where the generated one + differs (`OGAttachmentResponse` for `GetOGResponse`, `AppSettings` for `AppResponseFields`). It is not a + requirement: the user may ask for another name, and you may propose one that fits clearly better. Renaming a + v10 type is a break, so propose it with the reason and wait for approval. +- **Which fields it exposes.** v10's fields, with v10's defaults. A field only the generated type has + (`AppResponseFields.id`, the twelve extra fields on `GetOGResponse`) stays out; exposing it later is additive. A + field the spec marks optional is nullable by default, even if v10 typed it non-null; keeping it non-null needs a + recorded reason and a mapper fallback, as `OGAttachmentResponse.ogScrapeUrl` has in group 04. +- **Whether it is embedded in a model that still decodes v1 JSON** with json_serializable. If it is, the parent's + field needs a temporary converter (README rule 7) — add it to the adapters table with the group that removes it. +- **Whether persistence stores it as JSON text,** alone, as the elements of a list column, or nested inside + another persisted model. Search `stream_chat_persistence/lib/src/{mapper,converter,dao}` for `jsonEncode`, + `fromJson`, `toJson` and `toData`, and trace each hit to the type it encodes: a search on the type's name misses + `options.map(jsonEncode)`, which is how `polls.options` stores `PollOption`. If it is stored as JSON text, the + model gets the temporary `@DataSerializable` codec (rule 8; see + [Persisted models](#persisted-models-the-dataserializable-codec)). A model stored only as a table row, mapped + column by column like `Poll` in `polls`, needs no codec. +- **Which request enums need a hand-written public type** (rule 6). -- **The error contract:** public methods return `Result` instead of throwing (below). -- **Duration-only writes answer nothing:** a write whose generated response is `DurationResponse` returns - `Result`, not `EmptyResponse`. -- **No JSON on public models or envelopes:** their `fromJson` and `toJson` are removed. A model persistence stores - as JSON text gains `fromData` and `toData` instead; that is additive, not a break. -- **Envelopes are immutable:** they are built through a const constructor with final fields, not a no-argument - constructor and `late` setters. -- **`duration` is a non-nullable `String`** on every envelope; v10 typed it `String?`. -- **Models and envelopes are `@freezed`:** they compare by value, and one that extended `Equatable` in v10 loses - `props`. +**Per method, decide what it returns:** -Anything else a migration would change about what the caller holds needs its own reason. A server field our v10 -model lacks is exposed later, as an additive change, not by swapping in the generated type. +| Generated response | Public return | Example | +| --- | --- | --- | +| `DurationResponse` | `Result`, through `result.ignoreValue()` | `deleteUserGroup` | +| any other `*Response`, read or write | `Result` | `getUserGroup` → `Result` | + +The second row holds even where v10 returned the bare payload (`StreamChatClient.getAppSettings` returned +`AppSettings`, now `AppSettingsResponse`), `EmptyResponse` (`hideChannel` → `HideChannelResponse`) or a bare +model, and even when the response carries only `duration` today. Only `DurationResponse` can never gain a field; +README § Domain models gives the reason. When v10 had no envelope to keep, propose the new envelope's name and +wait for approval. **Establish a claim before you rely on it, and know which source answers which question.** @@ -214,70 +232,68 @@ model lacks is exposed later, as an additive change, not by swapping in the gene Whatever is decided goes in the PR body, never in a doc comment — see `STYLE_GUIDE.md` § *No server or transport details in docs or comments*. -When you do break, four things ship in the same PR: a `refactor(scope)!:` commit/PR title, a `🛑️ Breaking` -CHANGELOG entry naming the old and new symbol, a Symbol Map row plus feature section in -`migrations/v11-migration.md` (that guide is written as we go, not reconstructed at release), and the decision -*with its reason* in the PR body. - -**The error contract is decided: a migrated API returns `Future>` and does not throw.** This matches -`stream_feeds`, which exports `stream_core` from its barrel and returns `Future>` from its -client methods — so it clears both halves of the bar above: one error convention across our SDKs, and no -hand-written error-translation layer to keep in step with the spec. - -Two details that are settled, so don't re-decide them per feature: - -- **What rides inside `Failure`: always a `StreamException`.** `stream_core`'s error layer is a sealed family — - `StreamApiException`, `StreamNetworkException`, `StreamAuthenticationException`, `StreamClientException` — so a - migrated method needs no error handling of its own. Do not translate to `StreamChatNetworkError`; that is the - hand-written layer this migration deletes. -- **What guarantees it: `runApiSafely`.** Core's call wrapper maps a `DioException` through - `toStreamException()`, keeps a `StreamException` as raised, and wraps anything else — *including a `TypeError` - from a response body that would not decode* — in a `StreamClientException` with the original as its `cause`. - That last branch matters: with the older `runSafely`, a payload mismatch surfaced as a bare `TypeError` after a - successful HTTP call, and no `is StreamException` check would have caught it. +### Where each piece lives ```text -Failure.error → StreamException (sealed) - ├── StreamApiException statusCode, code (StreamErrorCode), moreInfo, unrecoverable, - │ retryAfter, apiError + isTokenExpired / isRateLimited / … - ├── StreamNetworkException isCancelled, isTimeout, closeCode - ├── StreamAuthenticationException - └── StreamClientException our own bug, or an undecodable body (cause preserved) +packages/stream_chat/lib/src/ +├── core/models/.dart plain model, one class per file, file named after the class +├── core/models/response/_response.dart envelope — every class suffixed Response +├── core/models/request/.dart public request type or request parameter +└── repository/ + ├── _repository.dart one per feature; GeneralRepository for endpoints with no feature + └── mapper/ + ├── _mapper.dart every mapper the feature needs, in one file + └── result_mapper.dart ignoreValue(), for Result ``` -`StreamException.tryFrom(Object?)` normalizes anything already in hand, and `StreamErrorCode` is an -`extension type const StreamErrorCode(int) implements int` with named constants (`apiKeyInvalid`, `inputError`, -`rateLimited`, `internalError`, …). The root is `sealed`, so a `switch` over it is exhaustive and no new direct -subtype can appear outside core; the four subtypes are `base`, so chat can extend one if a case ever needs it but -cannot implement it. - -**This supersedes our `ChatErrorCode`.** Core now owns the code vocabulary, so the plan is to drop ours rather -than re-express it as an extension. Check `StreamErrorCode` for a constant before adding one here. +- **The role decides the folder.** An envelope goes in `response/` (`CreateUserGroupResponse`). A type the caller + passes in to shape a request goes in `request/`, whatever its name: `PartialUpdateUserRequest`, and also + `PaginationParams`, `ThreadOptions` and `MemberUpdatePayload`. Every other model stays in `models/` + (`UserGroup`). No `request/` type exists yet: the first arrives when a group migrates one out of + `lib/src/core/api/requests.dart`. +- **Models and envelopes** are `@freezed` classes with a const constructor and `@override final` fields. Copy + `lib/src/core/models/user_group.dart` and `lib/src/core/models/response/create_user_group_response.dart`. + Envelopes carry `required this.duration`, documented with an example value such as `4.21ms`, plus one field per + payload, nullable when the spec doesn't guarantee it (`final UserGroup? userGroup`). +- **The barrel** (`lib/stream_chat.dart`) exports the models and envelopes. It never exports a repository, a + mapper or anything under `open_api/`. +- **A repository** is `const Repository(this._api)` over a `final api.DefaultApi _api`, one method per + operation. `StreamChatClient` builds it from the shared `api` beside the others (`_userGroupsRepository = + UserGroupsRepository(api)`) and delegates each public method to it. Copy + `lib/src/repository/user_groups_repository.dart`. +- **A mapper** is an extension named after the type it extends, one per direction: `extension + Mapper on api.` with `toModel()` from generated to ours, and `extension Mapper on + ` with `toRequest()` from ours to a generated request (`PushProviderMapper on PushProvider` in + `devices_mapper.dart`). A nested type gets its own extension that the parents call (`FileUploadConfigMapper` + serves both upload configs of `AppSettings`). Copy `lib/src/repository/mapper/user_groups_mapper.dart`. +- **One generated response can feed several v10 envelopes.** `PollResponse` answers `createPoll`, `getPoll`, + `updatePoll` and `updatePollPartial`, where v10 has `CreatePollResponse`, `GetPollResponse` and + `UpdatePollResponse`, so a single `toModel()` cannot serve them. `PollOptionResponse` (create, get and update + an option) and `PollVoteResponse` (cast and remove a vote) have the same shape. The v10 envelopes stay; how the + mapper names its conversions is still open, and is decided with the user when group 05 is migrated. + +### The error contract + +It is decided in [`core-migration/03-errors.md`](../../../core-migration/03-errors.md): a migrated method returns +`Future>` and never throws, and `Failure.error` is always a `StreamException` (`StreamApiException`, +`StreamNetworkException`, `StreamAuthenticationException` or `StreamClientException`). `ApiErrorInterceptor` on +the client's Dio shapes HTTP errors, and the generated call adapter's `runApiSafely` wraps anything else — +including a `TypeError` from a body that would not decode — in a `StreamClientException` with the original as its +`cause`. So a migrated method has no error handling of its own: don't translate to `StreamChatNetworkError`, and +check `StreamErrorCode` for a constant before adding an error code here. ## Phase 3 — sequence the work -Inside the feature: request bodies first (no public surface, no persistence), then responses, then models. Three -things can block a feature and are cheaper to resolve before starting: - -- **`ApiErrorInterceptor` on the Dio behind `DefaultApi`, and `runApiSafely` in the call adapter.** One-time - setup, and together they are what make every `Failure` carry a `StreamException`. Without them you get raw - `DioException`s and every method is tempted to re-derive error details. There is no error-translation helper to - write. -- **`Result` has to reach consumers.** Re-export it from `lib/stream_chat.dart` with a `show` allowlist — - `show Result, Success, Failure, StreamException, StreamApiException, StreamNetworkException, - StreamAuthenticationException, StreamClientException, StreamApiError, StreamErrorCode` — not feeds' wholesale - `export 'package:stream_core/stream_core.dart';`. - `stream_core` re-exports all of dio plus its own `AttachmentFile`, which collides by name with the - `AttachmentFile` our barrel already exports, so a blanket export fails to compile. An allowlist is also the - pattern `stream_chat_flutter` already uses for core re-exports. -- **Where `DefaultApi` is constructed.** It needs a `Dio`, and `StreamHttpClient.httpClient` is - `@visibleForTesting` while `StreamHttpClient` itself is publicly exported — so `DefaultApi(client.httpClient)` - fails `melos run analyze` (`dart analyze --fatal-infos`) with `invalid_use_of_visible_for_testing_member`. Add an - `@internal` accessor, or build `DefaultApi` once in `StreamChatApi` and inject it. Decide once, apply everywhere. -- **Multipart uploads cannot come from the generated client.** The spec declares uploads as `multipart/form-data`, - but the generated `uploadFile` / `uploadChannelFile` take a JSON `@Body()` with no progress or cancellation. That - feature needs hand-written retrofit multipart calls over the generated response models — don't route - `AttachmentFileUploader` through `DefaultApi`. +Inside the feature: internal request bodies first (no public surface, no persistence), then public request +types and responses, then models. + +The wiring every feature needs is already in place; add to it, don't rebuild it: + +- `StreamChatClient` builds one `DefaultApi` from its Dio, which carries `ApiErrorInterceptor`, and passes it to + every repository. Tests replace it through the `@internal` `defaultApi:` constructor parameter. +- `lib/stream_chat.dart` re-exports `Result`, `Success`, `Failure` and the `StreamException` family from + `stream_core` with a `show` allowlist. Add a type to that list when you need one; never export `stream_core` + wholesale, because it re-exports all of dio plus an `AttachmentFile` that collides with ours. `EmptyResponse` has ~250 references and is shared by every feature, so it is retired last, after the features are. Moving the WebSocket to v2 is its own project — v2 sends different event shapes; never fold it into a feature PR. @@ -285,28 +301,40 @@ Moving the WebSocket to v2 is its own project — v2 sends different event shape ## Phase 4 — implement ```dart -import '../../open_api/api.dart' as api; // the generated names collide with ours -import 'mapper/devices_mapper.dart'; +import 'package:stream_core/stream_core.dart' show PatternMatching, Result; + +import '../../open_api/api.dart' as api; // the generated names collide with ours +import '../core/models/response/get_user_group_response.dart'; +import 'mapper/result_mapper.dart'; +import 'mapper/user_groups_mapper.dart'; + +class UserGroupsRepository { + const UserGroupsRepository(this._api); + + final api.DefaultApi _api; + + Future> getUserGroup(String id, {String? teamId}) async { + final result = await _api.getUserGroup(id: id, teamId: teamId); // Result + return result.map((response) => response.toModel()); // maps Success, passes Failure through untouched + } -Future> getDevices() async { - final result = await _api.listDevices(); // Future> - return result.map((response) => response.toModel()); // transforms Success, passes Failure through untouched + Future> deleteUserGroup(String id, {String? teamId}) async { + final result = await _api.deleteUserGroup(id: id, teamId: teamId); // Result + return result.ignoreValue(); + } } ``` -`Result.map` is the whole pattern: the error side needs no code, because `ApiErrorInterceptor` already shaped it. -Reach for `fold` only when a method genuinely has to inspect the failure. `Result.success(value)` and -`Result.failure(error, [stackTrace])` exist as public factories for the cases that build a `Result` directly — -`Success` and `Failure` have private constructors. +`Result.map` is the whole pattern: the error side needs no code. Reach for `fold` only when a method genuinely has +to inspect the failure. `Result.success(value)` and `Result.failure(error, [stackTrace])` are the public factories +for building a `Result` directly — `Success` and `Failure` have private constructors. `Result.fold` is +`({required R Function(T) onSuccess, required R Function(Object, StackTrace?) onFailure})`; `getOrThrow`, +`getOrElse`, `map` and `flatMap` also exist (`stream_core`, `lib/src/utils/result.dart`). -`Result.fold` is `({required R Function(T) onSuccess, required R Function(Object, StackTrace?) onFailure})`; -`getOrThrow`, `getOrElse`, `map` and `flatMap` also exist (`stream_core`, `lib/src/utils/result.dart`). - -**Don't unwrap inside the SDK.** `getOrThrow()` on a migrated path re-throws the `StreamException`, and -`Failure.error` is a plain `Object` — in practice the raw `DioException`, because `StreamChatNetworkError` -conversion lives in `StreamHttpClient._parseError`, which only its own `get`/`post`/`delete` wrappers call. -`DefaultApi` goes straight to `_dio.fetch` and bypasses it. Hand the `Result` to the caller instead; `getOrThrow()` -is a tool for *consumers* migrating incrementally, not for us. +**Don't unwrap inside the SDK.** `getOrThrow()` turns the `Result` back into a thrown `StreamException`, which is +the contract this migration removes. Return the `Result` to the caller; SDK code that consumes one, such as the +composer calling `enrichUrl`, branches on it instead. `getOrThrow()` is a tool for *consumers* migrating +incrementally, not for us. Three data-shape traps while mapping: @@ -325,12 +353,13 @@ Three data-shape traps while mapping: Many generated types shadow ours by name, which is why repositories and mappers import the generated code with a prefix. The prefix is permanent: the generated types are never exported. List the current overlaps with (it prints -file names, so `channel_mute` means the generated `ChannelMute` shadows ours): +file names, so `channel_mute` means the generated `ChannelMute` shadows ours; envelopes such as +`list_devices_response` share their generated counterpart's name on purpose): ```bash comm -12 \ <(ls packages/stream_chat/lib/open_api/model/ | grep -v '\.\(g\|freezed\)\.dart$' | sed 's/\.dart$//' | sort) \ - <(grep -oE "^export 'src/core/(models|api)/[a-z_]+\.dart';" packages/stream_chat/lib/stream_chat.dart \ + <(grep -oE "^export 'src/core/(models|api)/[a-z_/]+\.dart';" packages/stream_chat/lib/stream_chat.dart \ | sed "s|.*/\([a-z_]*\)\.dart';|\1|" | sort) ``` @@ -338,12 +367,21 @@ comm -12 \ `DataSerializable` (`packages/stream_chat/lib/src/db/data_serializable.dart`) is a typedef for `JsonSerializable`, so json_serializable generates the storage codec and the model exposes it as `fromData`/`toData`. It is the only -JSON annotation a migrated model may carry, and it is temporary: group 10 decides what replaces it. - -**Use it** when `stream_chat_persistence` stores the model in a JSON text column, or nests it inside a model that -is. Today that covers `messages.mentioned_groups` (`UserGroup`); the remaining JSON columns belong to later groups -(`mentioned_users`, `attachments`, `reaction_groups`, `channels.config`, `polls.options`, -`connection_events.own_user`). +class-level json_serializable annotation a public model may carry — field-level `@JsonKey` pairs are expected, +see below — and it is temporary: group 10 decides what replaces it. + +**Use it** when `stream_chat_persistence` stores a plain model in a JSON text column, as the elements of a list +column (`polls.options` holds one JSON string per `PollOption`), or nested inside another plain model that is. +Today that covers `messages.mentioned_groups` (`UserGroup`). The group that makes a stored model plain adds its +codec: `PollOption` in `polls.options` (05); `User` in the `mentioned_users` columns of `messages`, +`pinned_messages` and `draft_messages`, and `OwnUser` in `connection_events.own_user` (09). `Attachment` and the +reaction groups (`attachments`, `reaction_groups`) become plain in group 10 itself, and `channels.config` (11) +lands after it, so those use whatever group 10 puts in the codec's place. `channel_queries_metadata.filter` and +`.sort` store `ChannelFilter` and `ChannelSort`, which are query objects rather than models, so they need no codec. + +A plain model nested in a parent that is **still json_serializable** needs no codec: the parent's rule-7 converter +already writes it, in both directions if the parent is stored. `Device` inside `OwnUser` is stored this way, +through `DeviceV1JsonConverter`. **Don't use it** for: @@ -364,7 +402,7 @@ is. Today that covers `messages.mentioned_groups` (`UserGroup`); the remaining J `ChannelMute` (a `User` and a full `ChannelModel`), `PushPreference` and `PrivacySettings`. Before annotating a graph like that, raise the alternative of storing less with the user: rows in existing tables plus ids. -The pattern, from `UserGroup`: +The pattern, from `lib/src/core/models/user_group.dart`: ```dart @freezed @@ -373,14 +411,18 @@ The pattern, from `UserGroup`: class UserGroup with _$UserGroup { const UserGroup({...}); - /// Creates a [UserGroup] from data stored by [toData]. + /// Creates a [UserGroup] from the offline-database format written by [toData]. + /// + /// It is not a codec for API payloads. factory UserGroup.fromData(Map json) => _$UserGroupFromJson(json); @override @JsonKey(fromJson: _membersFromData, toJson: _membersToData) final List? members; - /// Serializes this group for local storage. + /// Serializes this group to the format `stream_chat_persistence` stores. + /// + /// It is not a codec for API payloads. Map toData() => _$UserGroupToJson(this); } @@ -391,12 +433,14 @@ List>? _membersToData(List? members) => members?.map((it) => it.toData()).toList(); ``` -- **Tag every use** with `// TODO(openapi-migration): remove in group 10` and add the models to the adapters table. - The typedef carries the same tag, so `generate_plan.py --check` fails while it outlives group 10, and deleting it - breaks every remaining use at compile time. +- **Tag every use** on the model in `stream_chat` with `// TODO(openapi-migration): remove in group 10`, and add + the models to the adapters table. Group 10 replaces every use and deletes the typedef, so no group after it adds + one. The typedef carries the same tag, so `generate_plan.py --check` (which scans `packages/stream_chat/lib`) + fails while it outlives group 10, and deleting it breaks every remaining use at compile time. - **A field holding another plain model needs a `@JsonKey(fromJson: ..., toJson: ...)` pair** calling the nested - model's `fromData`/`toData`, as `members` does above, and the nested model needs its own annotation. Without the - pair the generated code calls a `fromJson`/`toJson` that doesn't exist and fails to compile. + model's `fromData`/`toData`, as `members` does above. Both models carry `@DataSerializable`: the parent for its + own codec, the nested model for the one the pair calls. Without the pair the generated code calls a + `fromJson`/`toJson` that doesn't exist and fails to compile. - **`stream_chat`'s `build.yaml` already sets `field_rename: snake` and `explicit_to_json: true`,** and `includeIfNull: false` leaves out null keys. Extension-type fields such as `PushLevel` pass through as their representation, and `DateTime` is stored as an ISO-8601 string. @@ -408,16 +452,16 @@ List>? _membersToData(List? members) => functions rather than adding a second pair. - **In persistence,** replace the model's `fromJson`/`toJson` calls, including an implicit `jsonEncode(model)`, with `fromData`/`toData`. -- **Generate with a full `dart run build_runner build`** in `packages/stream_chat`, then `dart format`, and commit - only the new `.g.dart` files. `--build-filter` deletes every generated output outside the filter. +- **Generate with a full `dart run build_runner build`** in `packages/stream_chat`, then `dart format`. Commit the + `.g.dart` and `.freezed.dart` files of the models you changed; `--build-filter` deletes every generated output + outside the filter, so never use it. ### Documenting the public surface Write these as you write the code. `public_member_api_docs` only checks a doc *exists*, so a placeholder survives -`melos run analyze`. The rules are `STYLE_GUIDE.md` § Documentation over `EFFECTIVE_DART_DOC.md` — the latter -covers dartdoc form (single-sentence first paragraph, "Whether…" for booleans, noun phrases for properties, -square brackets for in-scope identifiers), the former wins where they disagree. Three things migrations get -wrong on top of that: +`melos run analyze`. `EFFECTIVE_DART_DOC.md` covers dartdoc form (single-sentence first paragraph, "Whether…" +for booleans, noun phrases for properties, square brackets for in-scope identifiers) and `STYLE_GUIDE.md` +§ Documentation the repo's rules on top. Three things migrations get wrong beyond both: - **Scope is the surface the group touches**, not just the new repository. The `StreamChatClient` delegates duplicate its docs verbatim, so a fix belongs in both. @@ -432,17 +476,18 @@ Stop at docs the migration neither touched nor invalidated; one feature group pe Budget for this: on a typical feature it is most of the diff, and none of it is mechanical. -- `test/src/core/api/_api_test.dart` asserts on `client.post('/devices', data: …)` against a - `MockHttpClient`. Routing through `DefaultApi` moves the mock seam to `Dio`/`DefaultApi`; the old assertions - cannot survive. +- `test/src/core/api/_api_test.dart` asserts on `client.post('/polls', data: …)` against a + `MockHttpClient`. Routing through `DefaultApi` moves the mock seam to `MockDefaultApi` (`test/src/mocks.dart`), + passed to `StreamChatClient` through `defaultApi:`. Test every behaviour through the public client; don't add + repository or mapper tests. The old assertions cannot survive. - `test/src/client/client_test.dart` builds fixtures in the `late`-mutable style the hand-written DTOs allow - (`ListDevicesResponse()..devices = …`). Stubs of `DefaultApi` now answer generated types, and the restored - envelopes are plain classes with const constructors, so those fixtures must be rewritten. + (`CreatePollResponse()..poll = …`). Stubs of `DefaultApi` now answer generated types, and the envelopes are + const-constructed `@freezed` classes, so those fixtures must be rewritten. - `test/src/core/api/responses_test.dart` round-trips the DTO from JSON — delete those cases with the DTO's JSON. -- **Test mapping through the public client method,** from a generated response that sets every field the model - carries with a distinct value, so a field the mapper drops or swaps fails an assertion. No separate repository or - mapper tests. -- **Test each temporary converter,** both on its own and wired through its parent's `fromJson`/`toJson`. +- **Stub each generated response with every field our model carries,** each with a distinct value, and compare + the whole returned envelope, so a field the mapper drops or swaps fails an assertion. Give every method a + failure test too. +- **Test each temporary converter through its parent's `fromJson`/`toJson`.** - **Test each `@DataSerializable` model's stored format:** pin `toData()` to a literal map, so a rename that changes the stored keys fails; round-trip `fromData(toData())`; cover null versus empty for nullable lists. Extend the existing persistence mapper and DAO tests with the field rather than writing tests scoped to it. @@ -450,10 +495,10 @@ Budget for this: on a typical feature it is most of the diff, and none of it is Rewrite onto `TESTING.md` rather than carrying the old file's habits across. What breaks most often: - **No `group` organizing a file by method.** `group('addDevice')`, `group('getDevices')` is the shape a migrated - repository test falls into, and `TESTING.md` names it an anti-pattern. A `group` states a shared precondition; + test falls into, and `TESTING.md` names it an anti-pattern. A `group` states a shared precondition; anything else belongs in a separate file. - **Each name states subject and behaviour**, so `dart test` output says what broke: - `searchRoles forwards only the query when nothing else is given`. + `StreamChatClient.searchRoles sends only the query when nothing else is given`. - **No two tests share a name**, which dropping the groups is what exposes — three identical `returns the failure without throwing`. - **One behaviour per test.** @@ -461,24 +506,32 @@ Rewrite onto `TESTING.md` rather than carrying the old file's habits across. Wha ## Phase 6 — verify and land `melos run analyze`, `melos run test:dart`, plus `stream_chat_persistence`'s tests if the feature's responses feed -persistence. +persistence, and `python3 openapi-migration/tool/generate_plan.py --check`. **`melos run analyze` does not cover the generated client's own output.** `analysis_options.yaml` excludes -`**/*.g.dart` and `**/*.freezed.dart` repo-wide, so the retrofit `default_api.g.dart` and ~490 generated +`**/*.g.dart` and `**/*.freezed.dart` repo-wide, so the retrofit `default_api.g.dart` and the generated models' `.freezed.dart` files are never analyzed. Exercising the code in a test is what actually compiles it. **Neither does it cover the guides.** `--fatal-infos` checks a public member *has* a doc, never what it says or how a test is named. Re-read the diff against `STYLE_GUIDE.md` § Documentation, `EFFECTIVE_DART_DOC.md` and `TESTING.md` before opening the PR — that read is what the last two definition-of-done boxes stand for. -The PR body carries the group's scope, the phase 2 decisions with their reasons, and any endpoint left -hand-written and why. Then close the loop in the plan: tick the definition-of-done boxes in the group's file and -its status box in `openapi-migration/README.md`, so the next person sees where the migration actually stands. +**Every break ships four artifacts in the same PR:** the `refactor()!:` title (usually `llc`), a +`🛑️ Breaking` CHANGELOG entry naming the old and new symbol, the three edits `migrations/v11-migration.md` asks +for in its closing section (Symbol Map rows, a Quick Reference row for a new feature area, a feature section), and +the reason in the PR body. A +break with no guide entry is unfinished — the guide is what consumers actually upgrade against, and it cannot be +reconstructed later. + +The PR body carries the group's scope, a table mapping each generated name to the public one (including the +repository and any type that kept its v10 name), the phase 2 decisions with their reasons, and any endpoint left +hand-written and why. **Write the group's record into `openapi-migration/tool/generate_plan.py`, not into the `0N-*.md` file.** Those files are generated in full — goal, decisions, risks and definition of done all come from the `GROUPS` list in the generator. Editing the markdown works until the next regeneration silently reverts it. Add a `taken=textwrap.dedent(...)` -block and a `done=DONE.replace('- [ ]', '- [x]')` to the group's entry, then re-run the script. +block and a `done=DONE.replace('- [ ]', '- [x]')` to the group's entry, then re-run the script. Then tick the +group's status box in `openapi-migration/README.md`, so the next person sees where the migration actually stands. **When a method cannot move, split it into its own group rather than leaving one partly done.** Phase 1's three checks exist to find those, and the first definition-of-done box allows an endpoint to be "deliberately left @@ -503,11 +556,6 @@ consumers writing one call each way, which the plan's README rightly calls worse pair is blocked, either unblock it (usually a regeneration) or hold both. Split on what the *caller* thinks of separately — a read versus a set of writes — never on what happens to be easy. -Landing a break means four artifacts in the same PR: the `refactor(scope)!:` title, the `🛑️ Breaking` CHANGELOG -entry, the `migrations/v11-migration.md` Symbol Map row plus feature section (template lives at the bottom of that -guide), and the reason in the PR body. A break with no guide entry is unfinished — the guide is what consumers -actually upgrade against, and it cannot be reconstructed later. - ## Layout reference ``` @@ -515,7 +563,7 @@ packages/stream_chat/lib/open_api/ ├── api.dart # barrel ├── models.dart # barrel (also re-exports StreamApiError, StreamDateTimeConverter, WsEvent) ├── api/default_api.dart # ONE retrofit interface — every operation lives here -└── model/ # 493 models +└── model/ # every model the spec defines ``` Don't reach for the generator to get a type — that tree holds every model and operation the spec defines. The repo diff --git a/openapi-migration/05-polls.md b/openapi-migration/05-polls.md index f66979f8a8..39991be852 100644 --- a/openapi-migration/05-polls.md +++ b/openapi-migration/05-polls.md @@ -49,6 +49,7 @@ - `Poll`, `PollOption` and `PollVote` are public and persisted; adopting generated shapes means touching `stream_chat_persistence` in the same PR. - `VotingVisibility` is ours; the generated equivalent is an inline per-operation enum. +- One generated `PollResponse` answers `createPoll`, `getPoll`, `updatePoll` and `updatePollPartial`, where v10 has `CreatePollResponse`, `GetPollResponse` and `UpdatePollResponse`. The v10 envelopes stay; decide with the user how the mapper names its conversions, since one `toModel()` cannot return three types. `PollOptionResponse` (create, get, update an option) and `PollVoteResponse` (cast, remove a vote) have the same shape. ## Risks diff --git a/openapi-migration/README.md b/openapi-migration/README.md index 602582e873..d68320540c 100644 --- a/openapi-migration/README.md +++ b/openapi-migration/README.md @@ -54,10 +54,11 @@ one group. Verified mechanically — see [Keeping this plan honest](#keeping-thi - **One feature group per PR.** A group is a set of endpoints a caller thinks of together, and it moves across completely — half-migrated features are worse than unmigrated ones. -- **Keep our shape.** The public API keeps the v10 models, names and envelopes. Beyond `Result`, the only +- **Keep our shape.** The public API keeps the v10 models and envelopes, and their names by default. The only sanctioned breaks are the ones [Domain models](#domain-models) lists. -- **Every break ships four artifacts**: `refactor(llc)!:` title, `🛑️ Breaking` CHANGELOG entry, a Symbol Map row - plus feature section in `migrations/v11-migration.md`, and the reason in the PR body. +- **Every break ships four artifacts**: `refactor()!:` title (usually `llc`), `🛑️ Breaking` CHANGELOG + entry, the edits `migrations/v11-migration.md` asks for (Symbol Map row, Quick Reference row, feature section), + and the reason in the PR body. - **Decide once, at the right level.** The `User` shape is decided in [01-foundation](01-foundation.md), not re-argued per group. Errors and `Result` are decided in [`core-migration/03-errors.md`](../core-migration/03-errors.md). @@ -68,32 +69,56 @@ The generated client is an implementation detail. Every group follows these rule breaks against v10: - public methods return `Result` instead of throwing; -- a write whose response carries only `duration` returns `Result` rather than `EmptyResponse`; +- a write whose generated response is `DurationResponse` returns `Result` rather than `EmptyResponse`; +- a read returns its envelope, even where v10 returned the bare payload (`getAppSettings` now answers + `AppSettingsResponse`, not `AppSettings`); a new envelope's name is proposed case by case; +- a write whose generated response is a named `*Response` returns that envelope, even where v10 returned + `EmptyResponse` or a bare model (`hideChannel` answers `HideChannelResponse`); +- a field the spec marks optional is nullable by default, even where v10 typed it non-null + (`CreateUserGroupResponse.userGroup`); keeping one non-null needs a recorded reason and a mapper fallback, as + group 04 does for `OGAttachmentResponse.ogScrapeUrl`; - public models and envelopes lose `fromJson` and `toJson`; - envelopes are immutable, built through a const constructor rather than `late` setters; - `duration` is a non-nullable `String` on every envelope, where v10 typed it `String?`; - public models and envelopes are `@freezed`, so they compare by value; one that extended `Equatable` in v10 no longer does, and loses `props`. -Each ships with a CHANGELOG entry and a Symbol Map row like any other break. +Each ships the four artifacts listed under [Principles](#principles), like any other break. +**Why `DurationResponse` becomes `void`, and nothing else does.** `DurationResponse` is the base response every +other response embeds, so no field is ever added to it and dropping it loses nothing. An endpoint that later needs +to return data moves to its own named response: a spec change, and a break taken then. Every other response can +gain fields, so the caller gets its envelope and a field the server adds later is an additive change. That +includes a named response that carries only `duration` today, such as `HideChannelResponse` or +`DeleteReminderResponse`. 1. **No generated type in a public signature.** `lib/stream_chat.dart` exports nothing from `open_api/`, and no other package or the sample app imports it. `generate_plan.py --check` enforces both. -2. **Public models keep their v10 names, fields, nullability and defaults,** as `@freezed` classes (value - equality, `copyWith`, `toString`) with no `fromJson`, `toJson` or json_serializable. A field the server adds is exposed later, as an additive - change. The one exception is the temporary `@DataSerializable` storage codec in rule 8. +2. **Public models keep their v10 fields and defaults,** as `@freezed` classes (value equality, `copyWith`, + `toString`) with no `fromJson`, `toJson` or json_serializable. Nullability follows v10 unless the spec is looser + (see the breaks above). A field the server adds is exposed later, as an additive change. The one exception to + "no JSON" is the temporary `@DataSerializable` storage codec in rule 8. + + **Names default to v10's,** even where the generated name differs: `OGAttachmentResponse` rather than + `GetOGResponse`, `AppSettings` rather than `AppResponseFields`, `UploadConfig` rather than `FileUploadConfig`. + That is a default, not a requirement. The user may ask for another name, or a migration may propose one that + fits clearly better; renaming a v10 type is a break, so it needs approval and a Symbol Map row. 3. **Responses keep their v10 envelopes,** as `@freezed` classes carrying a non-nullable `duration` and the - payload, one file per class under `lib/src/core/models/`. A write whose response carries only - `duration` returns `Result`: `EmptyResponse` stays behind for the unmigrated APIs. + payload. Every envelope lives in `lib/src/core/models/response/`, and every public type a caller passes in to + shape a request — a `*Request` class, or a parameter type such as `PaginationParams` or `ThreadOptions` — in + `lib/src/core/models/request/`, one file per class. Every other model stays in `lib/src/core/models/`. + `EmptyResponse` stays behind for the unmigrated APIs. 4. **Public methods return `Result`,** per [`core-migration/03-errors.md`](../core-migration/03-errors.md). 5. **Mapping happens in the repository,** on the `Result` the generated call returns - (`result.map((response) => response.toModel())`), through extensions in - `lib/src/repository/mapper/_mapper.dart`. The mappers are package-internal so later groups can compose - them. Repositories import the generated code with a prefix (`as api`), which keeps its names from colliding - with ours. -6. **Request enums are hand-written** and mapped to the generated enum in the repository (`PushProvider` → - `CreateDeviceRequestPushProvider`). + (`result.map((response) => response.toModel())`, or `result.ignoreValue()` from + `lib/src/repository/mapper/result_mapper.dart` for `Result`), through extensions in + `lib/src/repository/mapper/_mapper.dart`: `toModel()` from a generated type to ours, `toRequest()` + from ours to a generated request. The mappers are package-internal so later groups can compose them. + Repositories import the generated code with a prefix (`as api`), which keeps its names from colliding with + ours. +6. **Request enums are hand-written extension types** over the wire string, per `STYLE_GUIDE.md` § Prefer + extension types over enums for server-defined values, and mapped to the generated type in the repository + (`PushProvider` → `CreateDeviceRequestPushProvider`). 7. **A plain model embedded in a json_serializable parent gets a temporary converter.** Some parents still decode v1 REST or WebSocket JSON with json_serializable; their field gets a `JsonConverter` — or a decode-only `fromJson` function when the parent never writes the field — in @@ -105,9 +130,11 @@ Each ships with a CHANGELOG entry and a Symbol Map row like any other break. annotation a public model may carry. The model exposes the generated code as `fromData` and `toData`, which only `stream_chat_persistence` calls; it never gains `fromJson` or `toJson`. A field holding another plain model needs `@JsonKey(fromJson: ..., toJson: ...)` functions that call the nested `fromData` and `toData`, because - json_serializable only looks for `fromJson` and `toJson` on nested types. The codec is temporary: every use is - marked `// TODO(openapi-migration): remove in group 10` and listed below, and group 10 decides what replaces - it. The cache is disposable, so the stored format is ours to choose. + json_serializable only looks for `fromJson` and `toJson` on nested types; the parent then carries + `@DataSerializable` too. A plain model nested in a parent that is still json_serializable needs no codec: the + parent's rule-7 converter writes it. The codec is temporary: every use is marked + `// TODO(openapi-migration): remove in group 10` and listed below, and group 10 replaces every use and deletes + the typedef, so no later group adds one. The cache is disposable, so the stored format is ours to choose. ### Temporary adapters @@ -138,7 +165,8 @@ surfaces before it reaches `Message` and `ChannelState`: - **09** freezes the `User` mapping that everything else already depends on (the *decision* is made in 01; this group executes it). - **10–11** are the core of the SDK, and carry the `custom` / `extraData` promotion problem. -- **12** is last because it needs its own hand-written multipart client and is the highest-traffic path in the SDK. +- **12** comes late because it needs its own hand-written multipart client and is the highest-traffic path in the + SDK. ## Prerequisites @@ -154,9 +182,9 @@ tests → verify). Use **`openapi-codegen`** when a type or operation is missing Consumer-facing changes go in `migrations/v11-migration.md` in the same PR that makes them. A migration follows [`STYLE_GUIDE.md`](../STYLE_GUIDE.md), [`EFFECTIVE_DART_DOC.md`](../EFFECTIVE_DART_DOC.md) -and [`TESTING.md`](../TESTING.md) like any other change. Nothing in CI checks either — `dart analyze --fatal-infos` checks a public member *has* a doc, never what -it says or how a test is named — so the last two boxes of every definition of done stand for reading the diff -against them. +and [`TESTING.md`](../TESTING.md) like any other change. Nothing in CI checks them — `dart analyze --fatal-infos` +checks a public member *has* a doc, never what it says or how a test is named — so the last two boxes of every +definition of done stand for reading the diff against them. ## Keeping this plan honest diff --git a/openapi-migration/tool/generate_plan.py b/openapi-migration/tool/generate_plan.py index 131b76a074..972ef80c9e 100644 --- a/openapi-migration/tool/generate_plan.py +++ b/openapi-migration/tool/generate_plan.py @@ -283,6 +283,11 @@ def match(path): '`Poll`, `PollOption` and `PollVote` are public and persisted; adopting generated shapes means ' 'touching `stream_chat_persistence` in the same PR.', '`VotingVisibility` is ours; the generated equivalent is an inline per-operation enum.', + 'One generated `PollResponse` answers `createPoll`, `getPoll`, `updatePoll` and `updatePollPartial`, ' + 'where v10 has `CreatePollResponse`, `GetPollResponse` and `UpdatePollResponse`. The v10 envelopes ' + 'stay; decide with the user how the mapper names its conversions, since one `toModel()` cannot return ' + 'three types. `PollOptionResponse` (create, get, update an option) and `PollVoteResponse` (cast, remove ' + 'a vote) have the same shape.', ], risks=[ 'Vote operations live under `/chat/messages/{message_id}/polls/...`, not `/polls` — easy to miss when ' From 9a9a705e89cde78d8dbfb19b0b5af1b06247c2ff Mon Sep 17 00:00:00 2001 From: Petar Velikov Date: Thu, 1 Oct 2026 13:44:33 +0200 Subject: [PATCH 31/36] fix(llc): keep the signed-in user authenticated when connectGuestUser refuses a guest (#3032) Co-authored-by: Claude Opus 5.5 --- packages/stream_chat/CHANGELOG.md | 2 + .../stream_chat/lib/src/client/client.dart | 11 +++ .../test/src/client/client_test.dart | 70 +++++++++++++++++++ 3 files changed, 83 insertions(+) diff --git a/packages/stream_chat/CHANGELOG.md b/packages/stream_chat/CHANGELOG.md index f7fe043b66..f2359236c7 100644 --- a/packages/stream_chat/CHANGELOG.md +++ b/packages/stream_chat/CHANGELOG.md @@ -84,6 +84,8 @@ - A message that fails because its attachments did not upload now says which ones and what each reported, instead of `Failed to upload one or more attachments`. +- `connectGuestUser` no longer leaves the signed-in user unauthenticated when it refuses to connect a guest over them. + 🔄 Changed - Failed messages now retry on server errors. The retry policy is now explicit: retry a request that never reached the server, a 5xx, a 429 and a 408; never another 4xx, a cancelled request, broken credentials, or anything the server marked unrecoverable. Previously only failures without a parseable error body retried, so a 500 or a 429 did not. diff --git a/packages/stream_chat/lib/src/client/client.dart b/packages/stream_chat/lib/src/client/client.dart index 032d0b3c59..7595947aea 100644 --- a/packages/stream_chat/lib/src/client/client.dart +++ b/packages/stream_chat/lib/src/client/client.dart @@ -445,10 +445,21 @@ class StreamChatClient { /// Connects the current user as guest, this triggers a connection to the API. /// It returns a [Future] that resolves when the connection is setup. + /// + /// Throws a [StateError] if a user is already signed in; call [disconnectUser] first. Future connectGuestUser( User user, { bool connectWebSocket = true, }) async { + // A guest is always given an id of its own, so whoever is signed in is another user, and the + // exchange below would authenticate in their place. + if (state.currentUser case final signedIn?) { + throw StateError( + 'Cannot connect guest ${user.id} while ${signedIn.id} is signed in. ' + 'Call `disconnectUser` before connecting a different user.', + ); + } + // The exchange itself is authenticated anonymously: the guest has no token // yet, and the server assigns the identity it answers with. final anonymousToken = UserToken.anonymous(); diff --git a/packages/stream_chat/test/src/client/client_test.dart b/packages/stream_chat/test/src/client/client_test.dart index 9548dfe297..9d6ce0bbd5 100644 --- a/packages/stream_chat/test/src/client/client_test.dart +++ b/packages/stream_chat/test/src/client/client_test.dart @@ -6907,6 +6907,76 @@ void main() { }); }); + group('when a user is signed in', () { + const apiKey = 'test-api-key'; + final user = User(id: 'test-user-id'); + final token = testUserToken(user.id).rawValue; + + // A client with [user] signed in, whose guest exchange for [requested] answers the way a real + // one does: with an id of the guest's own. + Future<(StreamChatClient, FakeChatApi)> signedInClient({required User requested}) async { + final chatApi = FakeChatApi(); + final client = StreamChatClient( + apiKey, + defaultApi: FakeDefaultApi(), + chatApi: chatApi, + wsProvider: FakeChatServer(user: OwnUser.fromUser(user)).connect, + ); + addTearDown(client.dispose); + await client.connectUser(user, token); + + final guest = User(id: 'guest-1234-${requested.id}'); + when(() => chatApi.guest.getGuestUser(requested)).thenAnswer( + (_) async => ConnectGuestUserResponse() + ..user = guest + ..accessToken = testUserToken(guest.id).rawValue, + ); + + return (client, chatApi); + } + + test('should refuse a connectGuestUser without asking for a guest', () async { + final requested = User(id: 'someone-else'); + final (client, chatApi) = await signedInClient(requested: requested); + + await expectLater( + client.connectGuestUser(requested, connectWebSocket: false), + throwsA( + isA().having( + (it) => it.message, + 'message', + allOf(contains(requested.id), contains('${user.id} is signed in'), contains('disconnectUser')), + ), + ), + ); + verifyNever(() => chatApi.guest.getGuestUser(requested)); + }); + + test('should refuse a connectGuestUser under the id of the user signed in', () async { + // The guest would still be another user, so this is refused like any other. + final requested = User(id: user.id); + final (client, chatApi) = await signedInClient(requested: requested); + + await expectLater( + client.connectGuestUser(requested, connectWebSocket: false), + throwsA(isA().having((it) => it.message, 'message', contains('${user.id} is signed in'))), + ); + verifyNever(() => chatApi.guest.getGuestUser(requested)); + }); + + test('should leave the signed-in user authenticated after refusing a connectGuestUser', () async { + final requested = User(id: 'someone-else'); + final (client, _) = await signedInClient(requested: requested); + await expectLater(client.connectGuestUser(requested, connectWebSocket: false), throwsA(isA())); + + // Reopening authenticates with the token the signed-in user connected with. + await client.closeConnection(); + await client.openConnection(); + + expect(client.connectionStatus, ConnectionStatus.connected); + }); + }); + group('`queryChannels` with `waitForConnect`', () { const apiKey = 'test-api-key'; final user = User(id: 'test-user-id'); From bb52ba59261c73f536ef43f8982936b06668951e Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Thu, 1 Oct 2026 14:01:09 +0200 Subject: [PATCH 32/36] feat(llc): regenerate the OpenAPI client at protocol v239.44.1 (#3033) Co-authored-by: Claude Opus 5.5 (1M context) --- packages/stream_chat/lib/open_api/api.dart | 8 +- .../lib/open_api/model/action.dart | 2 +- .../open_api/model/action_log_response.dart | 2 +- .../lib/open_api/model/action_sequence.dart | 2 +- .../model/add_user_group_members_request.dart | 2 +- .../add_user_group_members_response.dart | 2 +- .../model/ai_audio_config_request.dart | 2 +- .../model/ai_audio_config_response.dart | 2 +- .../lib/open_api/model/ai_image_config.dart | 2 +- .../model/ai_image_label_definition.dart | 2 +- .../model/ai_indicator_clear_event.dart | 2 +- .../model/ai_indicator_stop_event.dart | 2 +- .../model/ai_indicator_update_event.dart | 2 +- .../lib/open_api/model/ai_text_config.dart | 2 +- .../model/ai_video_config_request.dart | 2 +- .../model/ai_video_config_response.dart | 2 +- .../open_api/model/app_event_response.dart | 2 +- .../open_api/model/app_response_fields.dart | 2 +- .../lib/open_api/model/app_updated_event.dart | 2 +- .../open_api/model/appeal_item_response.dart | 2 +- .../lib/open_api/model/appeal_request.dart | 2 +- .../lib/open_api/model/appeal_response.dart | 2 +- .../lib/open_api/model/attachment.dart | 2 +- .../model/automod_details_response.dart | 2 +- ...automod_platform_circumvention_config.dart | 2 +- .../lib/open_api/model/automod_rule.dart | 2 +- .../automod_semantic_filters_config.dart | 2 +- .../model/automod_semantic_filters_rule.dart | 2 +- .../model/automod_toxicity_config.dart | 2 +- .../open_api/model/aws_rekognition_rule.dart | 2 +- .../model/ban_action_request_payload.dart | 2 +- .../lib/open_api/model/ban_info_response.dart | 2 +- .../lib/open_api/model/ban_options.dart | 2 +- .../lib/open_api/model/ban_request.dart | 2 +- .../lib/open_api/model/ban_response.dart | 2 +- .../model/block_action_request_payload.dart | 2 +- .../lib/open_api/model/block_list_config.dart | 2 +- .../open_api/model/block_list_options.dart | 2 +- .../open_api/model/block_list_response.dart | 2 +- .../lib/open_api/model/block_list_rule.dart | 2 +- .../open_api/model/block_users_request.dart | 2 +- .../open_api/model/block_users_response.dart | 2 +- .../open_api/model/blocked_user_response.dart | 2 +- .../model/bodyguard_profile_summary.dart | 2 +- .../lib/open_api/model/bodyguard_rule.dart | 2 +- .../model/bodyguard_severity_rule.dart | 2 +- .../model/bulk_action_appeals_request.dart | 3 +- .../model/bulk_action_appeals_response.dart | 2 +- .../lib/open_api/model/bulk_appeal_error.dart | 2 +- .../open_api/model/bulk_appeal_result.dart | 2 +- .../bulk_delete_action_config_request.dart | 2 +- .../bulk_delete_action_config_response.dart | 2 +- .../bulk_upsert_action_config_request.dart | 2 +- .../bulk_upsert_action_config_response.dart | 2 +- .../open_api/model/bypass_action_request.dart | 2 +- .../open_api/model/call_action_options.dart | 2 +- .../call_custom_property_parameters.dart | 2 +- .../model/call_rule_action_sequence.dart | 2 +- .../model/call_type_rule_parameters.dart | 2 +- .../call_violation_count_parameters.dart | 2 +- .../model/cast_poll_vote_request.dart | 2 +- .../model/channel_config_overrides.dart | 3 +- .../model/channel_config_with_info.dart | 3 +- .../model/channel_context_response.dart | 2 +- .../open_api/model/channel_created_event.dart | 2 +- .../open_api/model/channel_deleted_event.dart | 2 +- .../open_api/model/channel_frozen_event.dart | 2 +- .../model/channel_get_or_create_request.dart | 2 +- .../open_api/model/channel_hidden_event.dart | 2 +- .../lib/open_api/model/channel_input.dart | 2 +- .../open_api/model/channel_input_request.dart | 2 +- .../open_api/model/channel_kicked_event.dart | 2 +- .../channel_member_partial_response.dart | 2 +- .../model/channel_member_request.dart | 2 +- .../model/channel_member_response.dart | 2 +- ...channel_message_count_rule_parameters.dart | 2 +- .../lib/open_api/model/channel_metadata.dart | 2 +- .../lib/open_api/model/channel_mute.dart | 2 +- .../model/channel_own_capability.dart | 2 +- .../channel_push_preferences_response.dart | 2 +- .../lib/open_api/model/channel_response.dart | 2 +- .../model/channel_state_response.dart | 2 +- .../model/channel_state_response_fields.dart | 2 +- .../model/channel_truncated_event.dart | 2 +- .../model/channel_un_frozen_event.dart | 2 +- .../open_api/model/channel_updated_event.dart | 2 +- .../open_api/model/channel_visible_event.dart | 2 +- .../model/chat_draft_payload_response.dart | 2 +- .../open_api/model/chat_draft_response.dart | 2 +- .../open_api/model/chat_message_response.dart | 2 +- .../model/chat_moderation_v2_response.dart | 2 +- .../lib/open_api/model/chat_preferences.dart | 2 +- .../model/chat_preferences_input.dart | 2 +- .../model/chat_preferences_response.dart | 2 +- .../model/chat_reaction_group_response.dart | 2 +- .../chat_reaction_group_user_response.dart | 2 +- .../model/chat_reaction_response.dart | 2 +- .../model/chat_reminder_response_data.dart | 2 +- .../chat_shared_location_response_data.dart | 2 +- .../model/closed_caption_rule_parameters.dart | 2 +- .../lib/open_api/model/command.dart | 2 +- .../model/config_overrides_request.dart | 3 +- .../lib/open_api/model/config_response.dart | 7 +- .../model/config_response.freezed.dart | 11 +- .../lib/open_api/model/config_response.g.dart | 6 + .../model/content_count_rule_parameters.dart | 2 +- ...tent_custom_property_count_parameters.dart | 2 +- .../content_custom_property_parameters.dart | 2 +- .../model/create_block_list_request.dart | 3 +- .../model/create_block_list_response.dart | 2 +- .../open_api/model/create_device_request.dart | 2 +- .../open_api/model/create_draft_request.dart | 2 +- .../open_api/model/create_draft_response.dart | 2 +- .../open_api/model/create_guest_request.dart | 2 +- .../open_api/model/create_guest_response.dart | 2 +- .../model/create_poll_option_request.dart | 2 +- .../open_api/model/create_poll_request.dart | 7 +- .../model/create_poll_request.freezed.dart | 11 +- .../open_api/model/create_poll_request.g.dart | 2 + .../open_api/model/create_queue_request.dart | 2 +- .../model/create_reminder_request.dart | 8 +- .../create_reminder_request.freezed.dart | 14 +- .../model/create_reminder_request.g.dart | 8 + .../model/create_reminder_response.dart | 2 +- .../model/create_user_group_request.dart | 2 +- .../model/create_user_group_response.dart | 2 +- .../model/custom_action_request_payload.dart | 2 +- .../lib/open_api/model/custom_event.dart | 2 +- .../stream_chat/lib/open_api/model/data.dart | 2 +- .../model/delete_action_config_response.dart | 2 +- .../delete_activity_request_payload.dart | 2 +- .../model/delete_channel_response.dart | 2 +- .../model/delete_channels_request.dart | 2 +- .../model/delete_channels_response.dart | 2 +- .../delete_channels_result_response.dart | 2 +- .../model/delete_comment_request_payload.dart | 2 +- .../model/delete_message_request_payload.dart | 2 +- .../model/delete_message_response.dart | 2 +- .../delete_moderation_config_response.dart | 2 +- .../delete_reaction_request_payload.dart | 2 +- .../model/delete_reaction_response.dart | 2 +- .../model/delete_reminder_response.dart | 2 +- .../delete_user_messages_request_payload.dart | 2 +- .../model/delete_user_request_payload.dart | 2 +- .../model/delivered_message_payload.dart | 2 +- .../model/delivery_receipts_response.dart | 2 +- .../lib/open_api/model/device_response.dart | 2 +- .../open_api/model/draft_deleted_event.dart | 2 +- .../model/draft_payload_response.dart | 2 +- .../lib/open_api/model/draft_response.dart | 2 +- .../open_api/model/draft_updated_event.dart | 2 +- .../lib/open_api/model/duration_response.dart | 2 +- .../lib/open_api/model/enriched_activity.dart | 2 +- .../lib/open_api/model/enriched_reaction.dart | 2 +- .../model/entity_creator_response.dart | 2 +- .../lib/open_api/model/escalate_payload.dart | 2 +- .../open_api/model/escalation_metadata.dart | 2 +- .../lib/open_api/model/event_request.dart | 2 +- .../lib/open_api/model/event_response.dart | 2 +- .../model/feeds_activity_location.dart | 2 +- .../model/feeds_bookmark_response.dart | 2 +- .../feeds_enriched_collection_response.dart | 2 +- .../open_api/model/feeds_feed_response.dart | 2 +- .../model/feeds_notification_comment.dart | 2 +- .../model/feeds_notification_context.dart | 2 +- .../feeds_notification_parent_activity.dart | 2 +- .../model/feeds_notification_target.dart | 2 +- .../model/feeds_notification_trigger.dart | 2 +- .../lib/open_api/model/feeds_preferences.dart | 2 +- .../model/feeds_preferences_response.dart | 2 +- .../model/feeds_reaction_group_response.dart | 2 +- .../model/feeds_reaction_response.dart | 2 +- .../open_api/model/feeds_share_response.dart | 2 +- .../model/feeds_v3_activity_response.dart | 2 +- .../model/feeds_v3_comment_response.dart | 2 +- .../stream_chat/lib/open_api/model/field.dart | 2 +- .../open_api/model/file_upload_config.dart | 2 +- .../open_api/model/file_upload_request.dart | 2 +- .../open_api/model/file_upload_response.dart | 2 +- .../model/filter_config_response.dart | 7 +- .../model/filter_config_response.freezed.dart | 14 +- .../model/filter_config_response.g.dart | 2 + .../model/flag_count_rule_parameters.dart | 2 +- .../open_api/model/flag_details_response.dart | 2 +- .../model/flag_feedback_response.dart | 2 +- .../open_api/model/flag_item_response.dart | 2 +- .../model/flag_message_details_response.dart | 2 +- .../lib/open_api/model/flag_request.dart | 2 +- .../lib/open_api/model/flag_user_options.dart | 2 +- .../lib/open_api/model/flood_config.dart | 2 +- .../model/flood_identical_config.dart | 2 +- .../flood_identical_rule_parameters.dart | 2 +- .../open_api/model/flood_similar_config.dart | 2 +- .../model/flood_similar_rule_parameters.dart | 7 +- ...flood_similar_rule_parameters.freezed.dart | 11 +- .../flood_similar_rule_parameters.g.dart | 2 + .../open_api/model/full_user_response.dart | 3 +- .../model/future_channel_ban_response.dart | 2 +- .../model/get_action_config_response.dart | 2 +- .../open_api/model/get_appeal_response.dart | 2 +- .../model/get_application_response.dart | 2 +- .../model/get_blocked_users_response.dart | 2 +- .../open_api/model/get_config_response.dart | 2 +- .../open_api/model/get_draft_response.dart | 2 +- .../model/get_many_messages_response.dart | 2 +- .../open_api/model/get_message_response.dart | 2 +- .../lib/open_api/model/get_og_response.dart | 2 +- .../model/get_pinned_messages_response.dart | 2 +- .../model/get_reactions_response.dart | 2 +- .../open_api/model/get_replies_response.dart | 2 +- .../open_api/model/get_thread_response.dart | 2 +- .../model/get_user_group_response.dart | 2 +- .../open_api/model/google_vision_config.dart | 2 +- .../model/grouped_channels_bucket.dart | 2 +- .../model/grouped_channels_group_request.dart | 2 +- .../model/grouped_query_channels_request.dart | 2 +- .../grouped_query_channels_response.dart | 2 +- .../lib/open_api/model/harm_config.dart | 2 +- .../open_api/model/hide_channel_request.dart | 2 +- .../open_api/model/hide_channel_response.dart | 2 +- .../model/image_content_parameters.dart | 2 +- .../lib/open_api/model/image_data.dart | 2 +- .../open_api/model/image_rule_parameters.dart | 2 +- .../lib/open_api/model/image_size.dart | 2 +- .../open_api/model/image_upload_request.dart | 2 +- .../open_api/model/image_upload_response.dart | 2 +- .../lib/open_api/model/images.dart | 2 +- .../model/import_block_list_request.dart | 2 +- .../model/import_block_list_response.dart | 2 +- .../open_api/model/intent_config_request.dart | 31 ++++ .../model/intent_config_request.freezed.dart | 76 ++++++++++ .../model/intent_config_request.g.dart | 19 +++ .../model/intent_config_response.dart | 31 ++++ .../model/intent_config_response.freezed.dart | 76 ++++++++++ .../model/intent_config_response.g.dart | 21 +++ .../open_api/model/intent_topic_request.dart | 61 ++++++++ .../model/intent_topic_request.freezed.dart | 141 +++++++++++++++++ .../model/intent_topic_request.g.dart | 27 ++++ .../open_api/model/intent_topic_response.dart | 61 ++++++++ .../model/intent_topic_response.freezed.dart | 142 ++++++++++++++++++ .../model/intent_topic_response.g.dart | 29 ++++ .../ip_content_count_rule_parameters.dart | 2 +- .../model/ip_flag_count_rule_parameters.dart | 2 +- .../model/keyframe_ocr_rule_parameters.dart | 2 +- .../model/keyframe_rule_parameters.dart | 2 +- .../lib/open_api/model/label_response.dart | 2 +- .../lib/open_api/model/label_thresholds.dart | 2 +- .../model/list_block_list_response.dart | 2 +- .../open_api/model/list_devices_response.dart | 2 +- .../open_api/model/list_queues_response.dart | 2 +- .../model/list_user_groups_response.dart | 2 +- .../lib/open_api/model/llm_config.dart | 2 +- .../lib/open_api/model/llm_rule.dart | 2 +- .../model/mark_channels_read_request.dart | 2 +- .../model/mark_delivered_request.dart | 2 +- .../model/mark_delivered_response.dart | 2 +- .../lib/open_api/model/mark_read_request.dart | 2 +- .../open_api/model/mark_read_response.dart | 2 +- .../model/mark_read_response_event.dart | 2 +- .../model/mark_reviewed_request_payload.dart | 2 +- .../open_api/model/mark_unread_request.dart | 2 +- .../model/max_streak_changed_event.dart | 2 +- .../open_api/model/member_added_event.dart | 2 +- .../open_api/model/member_removed_event.dart | 2 +- .../open_api/model/member_updated_event.dart | 2 +- .../open_api/model/member_user_request.dart | 2 +- .../lib/open_api/model/members_response.dart | 2 +- .../model/message_action_request.dart | 2 +- .../model/message_action_response.dart | 2 +- .../open_api/model/message_change_set.dart | 2 +- .../open_api/model/message_deleted_event.dart | 2 +- .../model/message_delivered_event.dart | 2 +- .../open_api/model/message_flag_response.dart | 2 +- .../model/message_moderation_result.dart | 2 +- .../lib/open_api/model/message_new_event.dart | 2 +- .../lib/open_api/model/message_options.dart | 2 +- .../model/message_pagination_params.dart | 2 +- .../open_api/model/message_read_event.dart | 2 +- .../lib/open_api/model/message_request.dart | 2 +- .../lib/open_api/model/message_response.dart | 2 +- .../model/message_undeleted_event.dart | 2 +- .../lib/open_api/model/message_update.dart | 2 +- .../open_api/model/message_updated_event.dart | 2 +- .../model/message_with_channel_response.dart | 2 +- .../moderation_action_config_response.dart | 2 +- .../model/moderation_ban_response.dart | 2 +- .../model/moderation_call_response.dart | 2 +- .../model/moderation_custom_action_event.dart | 2 +- .../model/moderation_flag_response.dart | 2 +- .../model/moderation_flagged_event.dart | 2 +- .../model/moderation_mark_reviewed_event.dart | 2 +- .../open_api/model/moderation_payload.dart | 2 +- .../model/moderation_payload_response.dart | 2 +- .../model/moderation_queue_response.dart | 2 +- .../open_api/model/moderation_response.dart | 2 +- .../model/moderation_v2_response.dart | 2 +- .../open_api/model/mute_channel_request.dart | 2 +- .../open_api/model/mute_channel_response.dart | 2 +- .../lib/open_api/model/mute_request.dart | 2 +- .../lib/open_api/model/mute_response.dart | 2 +- .../notification_added_to_channel_event.dart | 2 +- .../notification_channel_deleted_event.dart | 2 +- ...ification_channel_mutes_updated_event.dart | 2 +- .../notification_channel_truncated_event.dart | 2 +- .../notification_invite_accepted_event.dart | 2 +- .../notification_invite_rejected_event.dart | 2 +- .../model/notification_invited_event.dart | 2 +- .../model/notification_mark_read_event.dart | 2 +- .../model/notification_mark_unread_event.dart | 2 +- .../notification_mutes_updated_event.dart | 2 +- .../model/notification_new_message_event.dart | 2 +- ...tification_removed_from_channel_event.dart | 2 +- ...notification_thread_message_new_event.dart | 2 +- .../model/ocr_content_parameters.dart | 2 +- .../lib/open_api/model/ocr_rule.dart | 2 +- .../lib/open_api/model/only_user_id.dart | 2 +- .../lib/open_api/model/own_user_response.dart | 3 +- .../lib/open_api/model/pagination_params.dart | 2 +- .../parsed_predefined_filter_response.dart | 2 +- .../open_api/model/pending_message_event.dart | 2 +- .../model/pending_message_response.dart | 2 +- .../lib/open_api/model/poll_closed_event.dart | 2 +- .../open_api/model/poll_deleted_event.dart | 2 +- .../lib/open_api/model/poll_option_input.dart | 2 +- .../open_api/model/poll_option_request.dart | 2 +- .../open_api/model/poll_option_response.dart | 2 +- .../model/poll_option_response_data.dart | 2 +- .../lib/open_api/model/poll_response.dart | 2 +- .../open_api/model/poll_response_data.dart | 2 +- .../open_api/model/poll_updated_event.dart | 2 +- .../model/poll_vote_casted_event.dart | 2 +- .../model/poll_vote_changed_event.dart | 2 +- .../model/poll_vote_removed_event.dart | 2 +- .../open_api/model/poll_vote_response.dart | 2 +- .../model/poll_vote_response_data.dart | 2 +- .../open_api/model/poll_votes_response.dart | 2 +- .../model/privacy_settings_response.dart | 2 +- .../open_api/model/push_preference_input.dart | 3 +- .../model/push_preferences_response.dart | 2 +- .../open_api/model/query_appeals_request.dart | 2 +- .../model/query_appeals_response.dart | 2 +- .../model/query_banned_users_payload.dart | 2 +- .../model/query_banned_users_response.dart | 2 +- .../model/query_channels_request.dart | 2 +- .../model/query_channels_response.dart | 2 +- .../open_api/model/query_drafts_request.dart | 2 +- .../open_api/model/query_drafts_response.dart | 2 +- .../query_future_channel_bans_payload.dart | 2 +- .../query_future_channel_bans_response.dart | 2 +- .../open_api/model/query_members_payload.dart | 2 +- .../model/query_message_flags_payload.dart | 2 +- .../model/query_message_flags_response.dart | 2 +- .../query_moderation_configs_request.dart | 2 +- .../query_moderation_configs_response.dart | 2 +- .../model/query_poll_votes_request.dart | 2 +- .../open_api/model/query_polls_request.dart | 2 +- .../open_api/model/query_polls_response.dart | 2 +- .../model/query_reactions_request.dart | 2 +- .../model/query_reactions_response.dart | 2 +- .../model/query_reminders_request.dart | 2 +- .../model/query_reminders_response.dart | 2 +- .../model/query_review_queue_request.dart | 2 +- .../model/query_review_queue_response.dart | 2 +- .../open_api/model/query_threads_request.dart | 2 +- .../model/query_threads_response.dart | 2 +- .../open_api/model/query_users_payload.dart | 2 +- .../open_api/model/query_users_response.dart | 2 +- .../lib/open_api/model/queue_response.dart | 2 +- .../lib/open_api/model/reaction.dart | 2 +- .../model/reaction_deleted_event.dart | 2 +- .../model/reaction_group_response.dart | 2 +- .../model/reaction_group_user_response.dart | 2 +- .../open_api/model/reaction_new_event.dart | 2 +- .../lib/open_api/model/reaction_request.dart | 2 +- .../lib/open_api/model/reaction_response.dart | 2 +- .../model/reaction_updated_event.dart | 2 +- .../model/read_receipts_response.dart | 2 +- .../open_api/model/read_state_response.dart | 2 +- .../model/reject_appeal_request_payload.dart | 2 +- .../model/reminder_created_event.dart | 2 +- .../model/reminder_deleted_event.dart | 2 +- .../model/reminder_notification_event.dart | 2 +- .../model/reminder_response_data.dart | 8 +- .../model/reminder_response_data.freezed.dart | 11 +- .../model/reminder_response_data.g.dart | 8 + .../model/reminder_updated_event.dart | 2 +- .../remove_user_group_members_request.dart | 2 +- .../remove_user_group_members_response.dart | 2 +- .../model/restore_action_request_payload.dart | 2 +- .../model/review_queue_item_response.dart | 2 +- .../stream_chat/lib/open_api/model/role.dart | 2 +- .../open_api/model/rule_builder_action.dart | 2 +- .../model/rule_builder_condition.dart | 7 +- .../model/rule_builder_condition.freezed.dart | 12 +- .../model/rule_builder_condition.g.dart | 6 + .../model/rule_builder_condition_group.dart | 2 +- .../open_api/model/rule_builder_config.dart | 2 +- .../lib/open_api/model/rule_builder_rule.dart | 2 +- .../lib/open_api/model/search_payload.dart | 2 +- .../lib/open_api/model/search_response.dart | 2 +- .../lib/open_api/model/search_result.dart | 2 +- .../open_api/model/search_result_message.dart | 2 +- .../open_api/model/search_roles_response.dart | 2 +- .../model/search_user_groups_response.dart | 2 +- .../lib/open_api/model/search_warning.dart | 2 +- .../open_api/model/send_event_request.dart | 2 +- .../open_api/model/send_message_request.dart | 2 +- .../open_api/model/send_message_response.dart | 2 +- .../open_api/model/send_reaction_request.dart | 2 +- .../model/send_reaction_response.dart | 2 +- .../shadow_block_action_request_payload.dart | 2 +- .../lib/open_api/model/shared_location.dart | 2 +- .../model/shared_location_response.dart | 2 +- .../model/shared_location_response_data.dart | 2 +- .../model/shared_locations_response.dart | 2 +- .../open_api/model/show_channel_response.dart | 2 +- .../open_api/model/sort_param_request.dart | 2 +- .../open_api/model/submit_action_request.dart | 3 +- .../model/submit_action_response.dart | 2 +- .../lib/open_api/model/sync_request.dart | 2 +- .../lib/open_api/model/sync_response.dart | 2 +- .../model/text_content_parameters.dart | 2 +- .../open_api/model/text_rule_parameters.dart | 2 +- .../open_api/model/thread_participant.dart | 2 +- .../lib/open_api/model/thread_response.dart | 2 +- .../open_api/model/thread_state_response.dart | 2 +- .../open_api/model/thread_updated_event.dart | 2 +- .../lib/open_api/model/thresholds.dart | 2 +- .../model/translate_message_request.dart | 2 +- .../model/translate_message_response.dart | 2 +- .../model/truncate_channel_request.dart | 2 +- .../model/truncate_channel_response.dart | 2 +- .../model/typing_indicators_response.dart | 2 +- .../open_api/model/typing_start_event.dart | 2 +- .../lib/open_api/model/typing_stop_event.dart | 2 +- .../model/unban_action_request_payload.dart | 2 +- .../lib/open_api/model/unban_response.dart | 2 +- .../model/unblock_action_request_payload.dart | 2 +- .../open_api/model/unblock_users_request.dart | 2 +- .../model/unblock_users_response.dart | 2 +- .../model/unmute_channel_request.dart | 2 +- .../lib/open_api/model/unmute_request.dart | 2 +- .../lib/open_api/model/unmute_response.dart | 2 +- .../open_api/model/unread_counts_channel.dart | 2 +- .../model/unread_counts_channel_type.dart | 2 +- .../open_api/model/unread_counts_thread.dart | 2 +- .../model/update_block_list_request.dart | 2 +- .../model/update_block_list_response.dart | 2 +- .../model/update_channel_partial_request.dart | 2 +- .../update_channel_partial_response.dart | 2 +- .../model/update_channel_request.dart | 2 +- .../model/update_channel_response.dart | 2 +- .../model/update_live_location_request.dart | 2 +- .../model/update_member_partial_request.dart | 2 +- .../model/update_member_partial_response.dart | 2 +- .../model/update_message_partial_request.dart | 2 +- .../update_message_partial_response.dart | 2 +- .../model/update_message_request.dart | 2 +- .../model/update_message_response.dart | 2 +- .../model/update_poll_option_request.dart | 2 +- .../model/update_poll_partial_request.dart | 2 +- .../open_api/model/update_poll_request.dart | 2 +- .../open_api/model/update_queue_request.dart | 2 +- .../model/update_reminder_request.dart | 8 +- .../update_reminder_request.freezed.dart | 14 +- .../model/update_reminder_request.g.dart | 8 + .../model/update_reminder_response.dart | 2 +- .../model/update_thread_partial_request.dart | 2 +- .../model/update_thread_partial_response.dart | 2 +- .../model/update_user_group_request.dart | 2 +- .../model/update_user_group_response.dart | 2 +- .../model/update_user_partial_request.dart | 2 +- .../model/update_users_partial_request.dart | 2 +- .../open_api/model/update_users_request.dart | 2 +- .../open_api/model/update_users_response.dart | 6 +- .../model/upload_channel_file_request.dart | 2 +- .../model/upload_channel_file_response.dart | 2 +- .../model/upload_channel_request.dart | 2 +- .../model/upload_channel_response.dart | 2 +- .../model/upsert_action_config_item.dart | 2 +- .../model/upsert_action_config_request.dart | 2 +- .../model/upsert_action_config_response.dart | 2 +- .../open_api/model/upsert_config_request.dart | 7 +- .../model/upsert_config_request.freezed.dart | 11 +- .../model/upsert_config_request.g.dart | 6 + .../model/upsert_config_response.dart | 2 +- .../upsert_push_preferences_request.dart | 2 +- .../upsert_push_preferences_response.dart | 2 +- .../stream_chat/lib/open_api/model/user.dart | 2 +- .../lib/open_api/model/user_banned_event.dart | 2 +- .../user_channel_count_rule_parameters.dart | 37 +++++ ...channel_count_rule_parameters.freezed.dart | 82 ++++++++++ .../user_channel_count_rule_parameters.g.dart | 21 +++ .../model/user_created_within_parameters.dart | 2 +- .../user_custom_property_parameters.dart | 2 +- .../model/user_deactivated_event.dart | 2 +- .../open_api/model/user_deleted_event.dart | 2 +- .../lib/open_api/model/user_group.dart | 2 +- .../model/user_group_created_event.dart | 2 +- .../model/user_group_deleted_event.dart | 2 +- .../lib/open_api/model/user_group_member.dart | 2 +- .../model/user_group_member_added_event.dart | 2 +- .../user_group_member_removed_event.dart | 2 +- .../open_api/model/user_group_response.dart | 2 +- .../model/user_group_updated_event.dart | 2 +- ...er_identical_content_count_parameters.dart | 2 +- ...user_identical_image_count_parameters.dart | 2 +- .../model/user_messages_deleted_event.dart | 2 +- .../open_api/model/user_mute_response.dart | 2 +- .../lib/open_api/model/user_muted_event.dart | 2 +- .../model/user_presence_changed_event.dart | 2 +- .../user_reaction_count_rule_parameters.dart | 2 +- .../model/user_reactivated_event.dart | 2 +- .../lib/open_api/model/user_request.dart | 2 +- .../lib/open_api/model/user_response.dart | 2 +- .../model/user_response_common_fields.dart | 2 +- .../model/user_response_privacy_fields.dart | 2 +- .../open_api/model/user_role_parameters.dart | 2 +- .../open_api/model/user_rule_parameters.dart | 2 +- .../open_api/model/user_unbanned_event.dart | 2 +- .../open_api/model/user_updated_event.dart | 2 +- .../model/user_watching_start_event.dart | 2 +- .../model/user_watching_stop_event.dart | 2 +- .../model/velocity_filter_config.dart | 2 +- .../model/velocity_filter_config_rule.dart | 2 +- .../model/video_call_rule_config.dart | 2 +- .../model/video_content_parameters.dart | 2 +- .../open_api/model/video_rule_parameters.dart | 2 +- .../lib/open_api/model/vote_data.dart | 2 +- .../model/wrapped_unread_counts_response.dart | 2 +- .../lib/open_api/model/ws_auth_message.dart | 2 +- packages/stream_chat/lib/open_api/models.dart | 5 + 532 files changed, 1563 insertions(+), 517 deletions(-) create mode 100644 packages/stream_chat/lib/open_api/model/intent_config_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/intent_config_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/intent_config_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/intent_config_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/intent_config_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/intent_config_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/intent_topic_request.dart create mode 100644 packages/stream_chat/lib/open_api/model/intent_topic_request.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/intent_topic_request.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/intent_topic_response.dart create mode 100644 packages/stream_chat/lib/open_api/model/intent_topic_response.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/intent_topic_response.g.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_channel_count_rule_parameters.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_channel_count_rule_parameters.freezed.dart create mode 100644 packages/stream_chat/lib/open_api/model/user_channel_count_rule_parameters.g.dart diff --git a/packages/stream_chat/lib/open_api/api.dart b/packages/stream_chat/lib/open_api/api.dart index 2584af86a2..573099edd8 100644 --- a/packages/stream_chat/lib/open_api/api.dart +++ b/packages/stream_chat/lib/open_api/api.dart @@ -1,9 +1,9 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // -// Spec: chat-clientside-api (API v239.10.0) -// Source: protocol @ openapi-v239.10.0 -// Checksum: 2fc3e366d0163482a2a71991e7f0dc675da1a45c848b4fff02b0c820100d42d6 -// Generator: GetStream/chat @ v237.25.0-22-g5d6378be28 +// Spec: chat-clientside-api (API v239.44.1) +// Source: protocol @ openapi-v239.44.1 +// Checksum: 6219cc7928894656eb5710263eb971607a124203ff0e4c694f48a61c907e2aca +// Generator: GetStream/chat @ v239.44.1-22-g2a92b14e14 // ignore_for_file: directives_ordering diff --git a/packages/stream_chat/lib/open_api/model/action.dart b/packages/stream_chat/lib/open_api/model/action.dart index 316b6458e0..965b14defe 100644 --- a/packages/stream_chat/lib/open_api/model/action.dart +++ b/packages/stream_chat/lib/open_api/model/action.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/action_log_response.dart b/packages/stream_chat/lib/open_api/model/action_log_response.dart index 01c80c1a37..8fedb75169 100644 --- a/packages/stream_chat/lib/open_api/model/action_log_response.dart +++ b/packages/stream_chat/lib/open_api/model/action_log_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/action_sequence.dart b/packages/stream_chat/lib/open_api/model/action_sequence.dart index 40919c757f..e49539da49 100644 --- a/packages/stream_chat/lib/open_api/model/action_sequence.dart +++ b/packages/stream_chat/lib/open_api/model/action_sequence.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/add_user_group_members_request.dart b/packages/stream_chat/lib/open_api/model/add_user_group_members_request.dart index 4e05dbedcf..a4b909d9fa 100644 --- a/packages/stream_chat/lib/open_api/model/add_user_group_members_request.dart +++ b/packages/stream_chat/lib/open_api/model/add_user_group_members_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/add_user_group_members_response.dart b/packages/stream_chat/lib/open_api/model/add_user_group_members_response.dart index 6566c81760..6b3aeab22b 100644 --- a/packages/stream_chat/lib/open_api/model/add_user_group_members_response.dart +++ b/packages/stream_chat/lib/open_api/model/add_user_group_members_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/ai_audio_config_request.dart b/packages/stream_chat/lib/open_api/model/ai_audio_config_request.dart index 61b4d34a02..978cb307fb 100644 --- a/packages/stream_chat/lib/open_api/model/ai_audio_config_request.dart +++ b/packages/stream_chat/lib/open_api/model/ai_audio_config_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/ai_audio_config_response.dart b/packages/stream_chat/lib/open_api/model/ai_audio_config_response.dart index 553d5d7f4a..7a9ba3b1d9 100644 --- a/packages/stream_chat/lib/open_api/model/ai_audio_config_response.dart +++ b/packages/stream_chat/lib/open_api/model/ai_audio_config_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/ai_image_config.dart b/packages/stream_chat/lib/open_api/model/ai_image_config.dart index 3ddf2fb1e8..a8c9b74c28 100644 --- a/packages/stream_chat/lib/open_api/model/ai_image_config.dart +++ b/packages/stream_chat/lib/open_api/model/ai_image_config.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/ai_image_label_definition.dart b/packages/stream_chat/lib/open_api/model/ai_image_label_definition.dart index e93fbe5986..3eaffd753b 100644 --- a/packages/stream_chat/lib/open_api/model/ai_image_label_definition.dart +++ b/packages/stream_chat/lib/open_api/model/ai_image_label_definition.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/ai_indicator_clear_event.dart b/packages/stream_chat/lib/open_api/model/ai_indicator_clear_event.dart index 8fda138aa1..e1a0261b58 100644 --- a/packages/stream_chat/lib/open_api/model/ai_indicator_clear_event.dart +++ b/packages/stream_chat/lib/open_api/model/ai_indicator_clear_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/ai_indicator_stop_event.dart b/packages/stream_chat/lib/open_api/model/ai_indicator_stop_event.dart index 93f7fe9c5a..ef5aafe0fc 100644 --- a/packages/stream_chat/lib/open_api/model/ai_indicator_stop_event.dart +++ b/packages/stream_chat/lib/open_api/model/ai_indicator_stop_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/ai_indicator_update_event.dart b/packages/stream_chat/lib/open_api/model/ai_indicator_update_event.dart index 820ef520b3..5304d5bef0 100644 --- a/packages/stream_chat/lib/open_api/model/ai_indicator_update_event.dart +++ b/packages/stream_chat/lib/open_api/model/ai_indicator_update_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/ai_text_config.dart b/packages/stream_chat/lib/open_api/model/ai_text_config.dart index 20bbc3de8e..a7008cf36e 100644 --- a/packages/stream_chat/lib/open_api/model/ai_text_config.dart +++ b/packages/stream_chat/lib/open_api/model/ai_text_config.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/ai_video_config_request.dart b/packages/stream_chat/lib/open_api/model/ai_video_config_request.dart index 461154a7d1..e081029651 100644 --- a/packages/stream_chat/lib/open_api/model/ai_video_config_request.dart +++ b/packages/stream_chat/lib/open_api/model/ai_video_config_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/ai_video_config_response.dart b/packages/stream_chat/lib/open_api/model/ai_video_config_response.dart index 9df3ae7eda..41b81b6e12 100644 --- a/packages/stream_chat/lib/open_api/model/ai_video_config_response.dart +++ b/packages/stream_chat/lib/open_api/model/ai_video_config_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/app_event_response.dart b/packages/stream_chat/lib/open_api/model/app_event_response.dart index 7796121459..d58f7b5cf9 100644 --- a/packages/stream_chat/lib/open_api/model/app_event_response.dart +++ b/packages/stream_chat/lib/open_api/model/app_event_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/app_response_fields.dart b/packages/stream_chat/lib/open_api/model/app_response_fields.dart index 798161f1be..9818e16279 100644 --- a/packages/stream_chat/lib/open_api/model/app_response_fields.dart +++ b/packages/stream_chat/lib/open_api/model/app_response_fields.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/app_updated_event.dart b/packages/stream_chat/lib/open_api/model/app_updated_event.dart index d83ca31052..940f4e7852 100644 --- a/packages/stream_chat/lib/open_api/model/app_updated_event.dart +++ b/packages/stream_chat/lib/open_api/model/app_updated_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/appeal_item_response.dart b/packages/stream_chat/lib/open_api/model/appeal_item_response.dart index 4ef425e5c7..1c8f7e9122 100644 --- a/packages/stream_chat/lib/open_api/model/appeal_item_response.dart +++ b/packages/stream_chat/lib/open_api/model/appeal_item_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/appeal_request.dart b/packages/stream_chat/lib/open_api/model/appeal_request.dart index 9f3fda25a6..14bbc8f65b 100644 --- a/packages/stream_chat/lib/open_api/model/appeal_request.dart +++ b/packages/stream_chat/lib/open_api/model/appeal_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/appeal_response.dart b/packages/stream_chat/lib/open_api/model/appeal_response.dart index b4a0104131..e138503e2d 100644 --- a/packages/stream_chat/lib/open_api/model/appeal_response.dart +++ b/packages/stream_chat/lib/open_api/model/appeal_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/attachment.dart b/packages/stream_chat/lib/open_api/model/attachment.dart index 061fac17e8..35aa25df4b 100644 --- a/packages/stream_chat/lib/open_api/model/attachment.dart +++ b/packages/stream_chat/lib/open_api/model/attachment.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/automod_details_response.dart b/packages/stream_chat/lib/open_api/model/automod_details_response.dart index 21d5c483bb..8b942d9017 100644 --- a/packages/stream_chat/lib/open_api/model/automod_details_response.dart +++ b/packages/stream_chat/lib/open_api/model/automod_details_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/automod_platform_circumvention_config.dart b/packages/stream_chat/lib/open_api/model/automod_platform_circumvention_config.dart index 9f706f11cc..09ce52edff 100644 --- a/packages/stream_chat/lib/open_api/model/automod_platform_circumvention_config.dart +++ b/packages/stream_chat/lib/open_api/model/automod_platform_circumvention_config.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/automod_rule.dart b/packages/stream_chat/lib/open_api/model/automod_rule.dart index b7ad7af7e3..4d76612c08 100644 --- a/packages/stream_chat/lib/open_api/model/automod_rule.dart +++ b/packages/stream_chat/lib/open_api/model/automod_rule.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/automod_semantic_filters_config.dart b/packages/stream_chat/lib/open_api/model/automod_semantic_filters_config.dart index 1d50436b4a..8a261e66c5 100644 --- a/packages/stream_chat/lib/open_api/model/automod_semantic_filters_config.dart +++ b/packages/stream_chat/lib/open_api/model/automod_semantic_filters_config.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/automod_semantic_filters_rule.dart b/packages/stream_chat/lib/open_api/model/automod_semantic_filters_rule.dart index 662a98f743..4d1ffd8078 100644 --- a/packages/stream_chat/lib/open_api/model/automod_semantic_filters_rule.dart +++ b/packages/stream_chat/lib/open_api/model/automod_semantic_filters_rule.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/automod_toxicity_config.dart b/packages/stream_chat/lib/open_api/model/automod_toxicity_config.dart index 6007f1faae..36271128e4 100644 --- a/packages/stream_chat/lib/open_api/model/automod_toxicity_config.dart +++ b/packages/stream_chat/lib/open_api/model/automod_toxicity_config.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/aws_rekognition_rule.dart b/packages/stream_chat/lib/open_api/model/aws_rekognition_rule.dart index 7bc7b4a9ee..22b3d208a1 100644 --- a/packages/stream_chat/lib/open_api/model/aws_rekognition_rule.dart +++ b/packages/stream_chat/lib/open_api/model/aws_rekognition_rule.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/ban_action_request_payload.dart b/packages/stream_chat/lib/open_api/model/ban_action_request_payload.dart index 86ae929537..1b5143f3ab 100644 --- a/packages/stream_chat/lib/open_api/model/ban_action_request_payload.dart +++ b/packages/stream_chat/lib/open_api/model/ban_action_request_payload.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/ban_info_response.dart b/packages/stream_chat/lib/open_api/model/ban_info_response.dart index c4a5baf683..485af649ae 100644 --- a/packages/stream_chat/lib/open_api/model/ban_info_response.dart +++ b/packages/stream_chat/lib/open_api/model/ban_info_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/ban_options.dart b/packages/stream_chat/lib/open_api/model/ban_options.dart index 2ff0857a23..b8ce4244a2 100644 --- a/packages/stream_chat/lib/open_api/model/ban_options.dart +++ b/packages/stream_chat/lib/open_api/model/ban_options.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/ban_request.dart b/packages/stream_chat/lib/open_api/model/ban_request.dart index 9c87c7b894..ecfe278880 100644 --- a/packages/stream_chat/lib/open_api/model/ban_request.dart +++ b/packages/stream_chat/lib/open_api/model/ban_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/ban_response.dart b/packages/stream_chat/lib/open_api/model/ban_response.dart index 32b8084d59..73e0e26b57 100644 --- a/packages/stream_chat/lib/open_api/model/ban_response.dart +++ b/packages/stream_chat/lib/open_api/model/ban_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/block_action_request_payload.dart b/packages/stream_chat/lib/open_api/model/block_action_request_payload.dart index a85447c713..15cfe4e3eb 100644 --- a/packages/stream_chat/lib/open_api/model/block_action_request_payload.dart +++ b/packages/stream_chat/lib/open_api/model/block_action_request_payload.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/block_list_config.dart b/packages/stream_chat/lib/open_api/model/block_list_config.dart index 7fb37b8916..d4b2420201 100644 --- a/packages/stream_chat/lib/open_api/model/block_list_config.dart +++ b/packages/stream_chat/lib/open_api/model/block_list_config.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/block_list_options.dart b/packages/stream_chat/lib/open_api/model/block_list_options.dart index a6c700c29d..8bb04843c4 100644 --- a/packages/stream_chat/lib/open_api/model/block_list_options.dart +++ b/packages/stream_chat/lib/open_api/model/block_list_options.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/block_list_response.dart b/packages/stream_chat/lib/open_api/model/block_list_response.dart index 820620cdf2..2074ea75f7 100644 --- a/packages/stream_chat/lib/open_api/model/block_list_response.dart +++ b/packages/stream_chat/lib/open_api/model/block_list_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/block_list_rule.dart b/packages/stream_chat/lib/open_api/model/block_list_rule.dart index 00cf6cc295..bb04e14cb6 100644 --- a/packages/stream_chat/lib/open_api/model/block_list_rule.dart +++ b/packages/stream_chat/lib/open_api/model/block_list_rule.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/block_users_request.dart b/packages/stream_chat/lib/open_api/model/block_users_request.dart index b02f909de1..32eee45cee 100644 --- a/packages/stream_chat/lib/open_api/model/block_users_request.dart +++ b/packages/stream_chat/lib/open_api/model/block_users_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/block_users_response.dart b/packages/stream_chat/lib/open_api/model/block_users_response.dart index fd53b97dc5..07e135617d 100644 --- a/packages/stream_chat/lib/open_api/model/block_users_response.dart +++ b/packages/stream_chat/lib/open_api/model/block_users_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/blocked_user_response.dart b/packages/stream_chat/lib/open_api/model/blocked_user_response.dart index 8bf2fb36c7..942dbf930e 100644 --- a/packages/stream_chat/lib/open_api/model/blocked_user_response.dart +++ b/packages/stream_chat/lib/open_api/model/blocked_user_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/bodyguard_profile_summary.dart b/packages/stream_chat/lib/open_api/model/bodyguard_profile_summary.dart index 07002a7f11..4ef22fdf79 100644 --- a/packages/stream_chat/lib/open_api/model/bodyguard_profile_summary.dart +++ b/packages/stream_chat/lib/open_api/model/bodyguard_profile_summary.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/bodyguard_rule.dart b/packages/stream_chat/lib/open_api/model/bodyguard_rule.dart index 3073d93755..c5ebbaa47c 100644 --- a/packages/stream_chat/lib/open_api/model/bodyguard_rule.dart +++ b/packages/stream_chat/lib/open_api/model/bodyguard_rule.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/bodyguard_severity_rule.dart b/packages/stream_chat/lib/open_api/model/bodyguard_severity_rule.dart index 1b7e3f9b46..f88b0ae4e4 100644 --- a/packages/stream_chat/lib/open_api/model/bodyguard_severity_rule.dart +++ b/packages/stream_chat/lib/open_api/model/bodyguard_severity_rule.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/bulk_action_appeals_request.dart b/packages/stream_chat/lib/open_api/model/bulk_action_appeals_request.dart index 4021cfe961..7f6058d315 100644 --- a/packages/stream_chat/lib/open_api/model/bulk_action_appeals_request.dart +++ b/packages/stream_chat/lib/open_api/model/bulk_action_appeals_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; @@ -64,6 +64,7 @@ class BulkActionAppealsRequest with _$BulkActionAppealsRequest { final UnbanActionRequestPayload? unban; @override + @Deprecated('Use restore instead, which now also reverses a block or shadow block.') @JsonKey(name: 'unblock') final UnblockActionRequestPayload? unblock; diff --git a/packages/stream_chat/lib/open_api/model/bulk_action_appeals_response.dart b/packages/stream_chat/lib/open_api/model/bulk_action_appeals_response.dart index 4714b0188d..73136db501 100644 --- a/packages/stream_chat/lib/open_api/model/bulk_action_appeals_response.dart +++ b/packages/stream_chat/lib/open_api/model/bulk_action_appeals_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/bulk_appeal_error.dart b/packages/stream_chat/lib/open_api/model/bulk_appeal_error.dart index 6f71645383..37b2a01234 100644 --- a/packages/stream_chat/lib/open_api/model/bulk_appeal_error.dart +++ b/packages/stream_chat/lib/open_api/model/bulk_appeal_error.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/bulk_appeal_result.dart b/packages/stream_chat/lib/open_api/model/bulk_appeal_result.dart index 44242ed5da..37c901d94c 100644 --- a/packages/stream_chat/lib/open_api/model/bulk_appeal_result.dart +++ b/packages/stream_chat/lib/open_api/model/bulk_appeal_result.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/bulk_delete_action_config_request.dart b/packages/stream_chat/lib/open_api/model/bulk_delete_action_config_request.dart index 03c956cef4..4192ec9dc2 100644 --- a/packages/stream_chat/lib/open_api/model/bulk_delete_action_config_request.dart +++ b/packages/stream_chat/lib/open_api/model/bulk_delete_action_config_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/bulk_delete_action_config_response.dart b/packages/stream_chat/lib/open_api/model/bulk_delete_action_config_response.dart index 1314c92387..016e701db8 100644 --- a/packages/stream_chat/lib/open_api/model/bulk_delete_action_config_response.dart +++ b/packages/stream_chat/lib/open_api/model/bulk_delete_action_config_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/bulk_upsert_action_config_request.dart b/packages/stream_chat/lib/open_api/model/bulk_upsert_action_config_request.dart index 7d8c56c064..a166cf71d3 100644 --- a/packages/stream_chat/lib/open_api/model/bulk_upsert_action_config_request.dart +++ b/packages/stream_chat/lib/open_api/model/bulk_upsert_action_config_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/bulk_upsert_action_config_response.dart b/packages/stream_chat/lib/open_api/model/bulk_upsert_action_config_response.dart index 898d7b366a..69897c06ce 100644 --- a/packages/stream_chat/lib/open_api/model/bulk_upsert_action_config_response.dart +++ b/packages/stream_chat/lib/open_api/model/bulk_upsert_action_config_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/bypass_action_request.dart b/packages/stream_chat/lib/open_api/model/bypass_action_request.dart index e665f413a2..514c64b5fa 100644 --- a/packages/stream_chat/lib/open_api/model/bypass_action_request.dart +++ b/packages/stream_chat/lib/open_api/model/bypass_action_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/call_action_options.dart b/packages/stream_chat/lib/open_api/model/call_action_options.dart index acb1dbe55a..ef4837a8b3 100644 --- a/packages/stream_chat/lib/open_api/model/call_action_options.dart +++ b/packages/stream_chat/lib/open_api/model/call_action_options.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/call_custom_property_parameters.dart b/packages/stream_chat/lib/open_api/model/call_custom_property_parameters.dart index af5743c776..f24dea1d25 100644 --- a/packages/stream_chat/lib/open_api/model/call_custom_property_parameters.dart +++ b/packages/stream_chat/lib/open_api/model/call_custom_property_parameters.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/call_rule_action_sequence.dart b/packages/stream_chat/lib/open_api/model/call_rule_action_sequence.dart index e1422acbe4..ec34cfcce4 100644 --- a/packages/stream_chat/lib/open_api/model/call_rule_action_sequence.dart +++ b/packages/stream_chat/lib/open_api/model/call_rule_action_sequence.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/call_type_rule_parameters.dart b/packages/stream_chat/lib/open_api/model/call_type_rule_parameters.dart index bb8b3da168..c924e76943 100644 --- a/packages/stream_chat/lib/open_api/model/call_type_rule_parameters.dart +++ b/packages/stream_chat/lib/open_api/model/call_type_rule_parameters.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/call_violation_count_parameters.dart b/packages/stream_chat/lib/open_api/model/call_violation_count_parameters.dart index 1569417069..ca4925c68d 100644 --- a/packages/stream_chat/lib/open_api/model/call_violation_count_parameters.dart +++ b/packages/stream_chat/lib/open_api/model/call_violation_count_parameters.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/cast_poll_vote_request.dart b/packages/stream_chat/lib/open_api/model/cast_poll_vote_request.dart index fde368df9a..9c7296cab3 100644 --- a/packages/stream_chat/lib/open_api/model/cast_poll_vote_request.dart +++ b/packages/stream_chat/lib/open_api/model/cast_poll_vote_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/channel_config_overrides.dart b/packages/stream_chat/lib/open_api/model/channel_config_overrides.dart index dc260179b9..4e54139911 100644 --- a/packages/stream_chat/lib/open_api/model/channel_config_overrides.dart +++ b/packages/stream_chat/lib/open_api/model/channel_config_overrides.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; @@ -27,6 +27,7 @@ extension type const ChannelConfigOverridesPushLevel._(String _) implements Stri static const all = ChannelConfigOverridesPushLevel._('all'); static const allMentions = ChannelConfigOverridesPushLevel._('all_mentions'); static const directMentions = ChannelConfigOverridesPushLevel._('direct_mentions'); + @Deprecated('Use directMentions instead.') static const mentions = ChannelConfigOverridesPushLevel._('mentions'); static const none = ChannelConfigOverridesPushLevel._('none'); diff --git a/packages/stream_chat/lib/open_api/model/channel_config_with_info.dart b/packages/stream_chat/lib/open_api/model/channel_config_with_info.dart index 0b22b00596..bceee047f0 100644 --- a/packages/stream_chat/lib/open_api/model/channel_config_with_info.dart +++ b/packages/stream_chat/lib/open_api/model/channel_config_with_info.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; @@ -48,6 +48,7 @@ extension type const ChannelConfigWithInfoPushLevel._(String _) implements Strin static const all = ChannelConfigWithInfoPushLevel._('all'); static const allMentions = ChannelConfigWithInfoPushLevel._('all_mentions'); static const directMentions = ChannelConfigWithInfoPushLevel._('direct_mentions'); + @Deprecated('Use directMentions instead.') static const mentions = ChannelConfigWithInfoPushLevel._('mentions'); static const none = ChannelConfigWithInfoPushLevel._('none'); diff --git a/packages/stream_chat/lib/open_api/model/channel_context_response.dart b/packages/stream_chat/lib/open_api/model/channel_context_response.dart index bff7d27c78..1833c1da9f 100644 --- a/packages/stream_chat/lib/open_api/model/channel_context_response.dart +++ b/packages/stream_chat/lib/open_api/model/channel_context_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/channel_created_event.dart b/packages/stream_chat/lib/open_api/model/channel_created_event.dart index df52825935..d709db2858 100644 --- a/packages/stream_chat/lib/open_api/model/channel_created_event.dart +++ b/packages/stream_chat/lib/open_api/model/channel_created_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/channel_deleted_event.dart b/packages/stream_chat/lib/open_api/model/channel_deleted_event.dart index 2c67c4c7ea..a4f3ab8880 100644 --- a/packages/stream_chat/lib/open_api/model/channel_deleted_event.dart +++ b/packages/stream_chat/lib/open_api/model/channel_deleted_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/channel_frozen_event.dart b/packages/stream_chat/lib/open_api/model/channel_frozen_event.dart index 846e31da94..4cbc11bcbe 100644 --- a/packages/stream_chat/lib/open_api/model/channel_frozen_event.dart +++ b/packages/stream_chat/lib/open_api/model/channel_frozen_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/channel_get_or_create_request.dart b/packages/stream_chat/lib/open_api/model/channel_get_or_create_request.dart index fc7064feee..3c438e7a7f 100644 --- a/packages/stream_chat/lib/open_api/model/channel_get_or_create_request.dart +++ b/packages/stream_chat/lib/open_api/model/channel_get_or_create_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/channel_hidden_event.dart b/packages/stream_chat/lib/open_api/model/channel_hidden_event.dart index ff175474d0..10d110959d 100644 --- a/packages/stream_chat/lib/open_api/model/channel_hidden_event.dart +++ b/packages/stream_chat/lib/open_api/model/channel_hidden_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/channel_input.dart b/packages/stream_chat/lib/open_api/model/channel_input.dart index bac59312b8..5f01d7a251 100644 --- a/packages/stream_chat/lib/open_api/model/channel_input.dart +++ b/packages/stream_chat/lib/open_api/model/channel_input.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/channel_input_request.dart b/packages/stream_chat/lib/open_api/model/channel_input_request.dart index c2308c36cd..d611e0df3b 100644 --- a/packages/stream_chat/lib/open_api/model/channel_input_request.dart +++ b/packages/stream_chat/lib/open_api/model/channel_input_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/channel_kicked_event.dart b/packages/stream_chat/lib/open_api/model/channel_kicked_event.dart index b94546220b..a1ead5a922 100644 --- a/packages/stream_chat/lib/open_api/model/channel_kicked_event.dart +++ b/packages/stream_chat/lib/open_api/model/channel_kicked_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/channel_member_partial_response.dart b/packages/stream_chat/lib/open_api/model/channel_member_partial_response.dart index 20cb9ba264..3ac8ab4a83 100644 --- a/packages/stream_chat/lib/open_api/model/channel_member_partial_response.dart +++ b/packages/stream_chat/lib/open_api/model/channel_member_partial_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/channel_member_request.dart b/packages/stream_chat/lib/open_api/model/channel_member_request.dart index a2db75d203..ba99eff884 100644 --- a/packages/stream_chat/lib/open_api/model/channel_member_request.dart +++ b/packages/stream_chat/lib/open_api/model/channel_member_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/channel_member_response.dart b/packages/stream_chat/lib/open_api/model/channel_member_response.dart index 7faccd68f2..a67368d83c 100644 --- a/packages/stream_chat/lib/open_api/model/channel_member_response.dart +++ b/packages/stream_chat/lib/open_api/model/channel_member_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/channel_message_count_rule_parameters.dart b/packages/stream_chat/lib/open_api/model/channel_message_count_rule_parameters.dart index 6329648079..71f344cd6e 100644 --- a/packages/stream_chat/lib/open_api/model/channel_message_count_rule_parameters.dart +++ b/packages/stream_chat/lib/open_api/model/channel_message_count_rule_parameters.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/channel_metadata.dart b/packages/stream_chat/lib/open_api/model/channel_metadata.dart index b0ab505f05..e44a99ff00 100644 --- a/packages/stream_chat/lib/open_api/model/channel_metadata.dart +++ b/packages/stream_chat/lib/open_api/model/channel_metadata.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/channel_mute.dart b/packages/stream_chat/lib/open_api/model/channel_mute.dart index 5ea67cfcf6..be43dac891 100644 --- a/packages/stream_chat/lib/open_api/model/channel_mute.dart +++ b/packages/stream_chat/lib/open_api/model/channel_mute.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/channel_own_capability.dart b/packages/stream_chat/lib/open_api/model/channel_own_capability.dart index f6ea09c45d..e167dfb45c 100644 --- a/packages/stream_chat/lib/open_api/model/channel_own_capability.dart +++ b/packages/stream_chat/lib/open_api/model/channel_own_capability.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import '../models.dart'; diff --git a/packages/stream_chat/lib/open_api/model/channel_push_preferences_response.dart b/packages/stream_chat/lib/open_api/model/channel_push_preferences_response.dart index a0ac50a63f..bebd51a3df 100644 --- a/packages/stream_chat/lib/open_api/model/channel_push_preferences_response.dart +++ b/packages/stream_chat/lib/open_api/model/channel_push_preferences_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/channel_response.dart b/packages/stream_chat/lib/open_api/model/channel_response.dart index 9839dc913b..50e69aa135 100644 --- a/packages/stream_chat/lib/open_api/model/channel_response.dart +++ b/packages/stream_chat/lib/open_api/model/channel_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/channel_state_response.dart b/packages/stream_chat/lib/open_api/model/channel_state_response.dart index 8717392977..960fe39926 100644 --- a/packages/stream_chat/lib/open_api/model/channel_state_response.dart +++ b/packages/stream_chat/lib/open_api/model/channel_state_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/channel_state_response_fields.dart b/packages/stream_chat/lib/open_api/model/channel_state_response_fields.dart index b0c3e9a97c..f407a95f27 100644 --- a/packages/stream_chat/lib/open_api/model/channel_state_response_fields.dart +++ b/packages/stream_chat/lib/open_api/model/channel_state_response_fields.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/channel_truncated_event.dart b/packages/stream_chat/lib/open_api/model/channel_truncated_event.dart index 21f7970c9c..1139bec470 100644 --- a/packages/stream_chat/lib/open_api/model/channel_truncated_event.dart +++ b/packages/stream_chat/lib/open_api/model/channel_truncated_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/channel_un_frozen_event.dart b/packages/stream_chat/lib/open_api/model/channel_un_frozen_event.dart index 9a93290851..bdaf379bd3 100644 --- a/packages/stream_chat/lib/open_api/model/channel_un_frozen_event.dart +++ b/packages/stream_chat/lib/open_api/model/channel_un_frozen_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/channel_updated_event.dart b/packages/stream_chat/lib/open_api/model/channel_updated_event.dart index 99fe1ceb8a..97449f274c 100644 --- a/packages/stream_chat/lib/open_api/model/channel_updated_event.dart +++ b/packages/stream_chat/lib/open_api/model/channel_updated_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/channel_visible_event.dart b/packages/stream_chat/lib/open_api/model/channel_visible_event.dart index 535ad1c1e9..c60f63c768 100644 --- a/packages/stream_chat/lib/open_api/model/channel_visible_event.dart +++ b/packages/stream_chat/lib/open_api/model/channel_visible_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/chat_draft_payload_response.dart b/packages/stream_chat/lib/open_api/model/chat_draft_payload_response.dart index a5cabd3f10..36db80fd8f 100644 --- a/packages/stream_chat/lib/open_api/model/chat_draft_payload_response.dart +++ b/packages/stream_chat/lib/open_api/model/chat_draft_payload_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/chat_draft_response.dart b/packages/stream_chat/lib/open_api/model/chat_draft_response.dart index c2f5b73b74..0c29a2b662 100644 --- a/packages/stream_chat/lib/open_api/model/chat_draft_response.dart +++ b/packages/stream_chat/lib/open_api/model/chat_draft_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/chat_message_response.dart b/packages/stream_chat/lib/open_api/model/chat_message_response.dart index 78f86c27f9..83f3570a9f 100644 --- a/packages/stream_chat/lib/open_api/model/chat_message_response.dart +++ b/packages/stream_chat/lib/open_api/model/chat_message_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/chat_moderation_v2_response.dart b/packages/stream_chat/lib/open_api/model/chat_moderation_v2_response.dart index b3d58e8a00..52178746c0 100644 --- a/packages/stream_chat/lib/open_api/model/chat_moderation_v2_response.dart +++ b/packages/stream_chat/lib/open_api/model/chat_moderation_v2_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/chat_preferences.dart b/packages/stream_chat/lib/open_api/model/chat_preferences.dart index 7b18a8865d..7ecd1163b5 100644 --- a/packages/stream_chat/lib/open_api/model/chat_preferences.dart +++ b/packages/stream_chat/lib/open_api/model/chat_preferences.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/chat_preferences_input.dart b/packages/stream_chat/lib/open_api/model/chat_preferences_input.dart index b4fee21c75..e01830e61c 100644 --- a/packages/stream_chat/lib/open_api/model/chat_preferences_input.dart +++ b/packages/stream_chat/lib/open_api/model/chat_preferences_input.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/chat_preferences_response.dart b/packages/stream_chat/lib/open_api/model/chat_preferences_response.dart index eb36cb543d..8c46bc8506 100644 --- a/packages/stream_chat/lib/open_api/model/chat_preferences_response.dart +++ b/packages/stream_chat/lib/open_api/model/chat_preferences_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/chat_reaction_group_response.dart b/packages/stream_chat/lib/open_api/model/chat_reaction_group_response.dart index 315a74ddf0..e3bec9a61d 100644 --- a/packages/stream_chat/lib/open_api/model/chat_reaction_group_response.dart +++ b/packages/stream_chat/lib/open_api/model/chat_reaction_group_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/chat_reaction_group_user_response.dart b/packages/stream_chat/lib/open_api/model/chat_reaction_group_user_response.dart index a9398658dd..6383e24072 100644 --- a/packages/stream_chat/lib/open_api/model/chat_reaction_group_user_response.dart +++ b/packages/stream_chat/lib/open_api/model/chat_reaction_group_user_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/chat_reaction_response.dart b/packages/stream_chat/lib/open_api/model/chat_reaction_response.dart index d6632a94ac..139a762dc9 100644 --- a/packages/stream_chat/lib/open_api/model/chat_reaction_response.dart +++ b/packages/stream_chat/lib/open_api/model/chat_reaction_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/chat_reminder_response_data.dart b/packages/stream_chat/lib/open_api/model/chat_reminder_response_data.dart index 102bea80d0..bb0ff1e9a7 100644 --- a/packages/stream_chat/lib/open_api/model/chat_reminder_response_data.dart +++ b/packages/stream_chat/lib/open_api/model/chat_reminder_response_data.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/chat_shared_location_response_data.dart b/packages/stream_chat/lib/open_api/model/chat_shared_location_response_data.dart index d01b11d408..318b6e42bb 100644 --- a/packages/stream_chat/lib/open_api/model/chat_shared_location_response_data.dart +++ b/packages/stream_chat/lib/open_api/model/chat_shared_location_response_data.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/closed_caption_rule_parameters.dart b/packages/stream_chat/lib/open_api/model/closed_caption_rule_parameters.dart index 7e97140fa4..1788951f84 100644 --- a/packages/stream_chat/lib/open_api/model/closed_caption_rule_parameters.dart +++ b/packages/stream_chat/lib/open_api/model/closed_caption_rule_parameters.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/command.dart b/packages/stream_chat/lib/open_api/model/command.dart index 57017c5038..76e644a341 100644 --- a/packages/stream_chat/lib/open_api/model/command.dart +++ b/packages/stream_chat/lib/open_api/model/command.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/config_overrides_request.dart b/packages/stream_chat/lib/open_api/model/config_overrides_request.dart index a201e0f4f2..3e7dc0fa28 100644 --- a/packages/stream_chat/lib/open_api/model/config_overrides_request.dart +++ b/packages/stream_chat/lib/open_api/model/config_overrides_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; @@ -27,6 +27,7 @@ extension type const ConfigOverridesRequestPushLevel._(String _) implements Stri static const all = ConfigOverridesRequestPushLevel._('all'); static const allMentions = ConfigOverridesRequestPushLevel._('all_mentions'); static const directMentions = ConfigOverridesRequestPushLevel._('direct_mentions'); + @Deprecated('Use directMentions instead.') static const mentions = ConfigOverridesRequestPushLevel._('mentions'); static const none = ConfigOverridesRequestPushLevel._('none'); diff --git a/packages/stream_chat/lib/open_api/model/config_response.dart b/packages/stream_chat/lib/open_api/model/config_response.dart index 2936e17562..20df649642 100644 --- a/packages/stream_chat/lib/open_api/model/config_response.dart +++ b/packages/stream_chat/lib/open_api/model/config_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; @@ -32,6 +32,7 @@ class ConfigResponse with _$ConfigResponse { this.blockListConfig, required this.createdAt, this.floodConfig, + this.intentConfig, required this.key, this.llmConfig, required this.supportedVideoCallHarmTypes, @@ -98,6 +99,10 @@ class ConfigResponse with _$ConfigResponse { @JsonKey(name: 'flood_config') final FloodConfig? floodConfig; + @override + @JsonKey(name: 'intent_config') + final IntentConfigResponse? intentConfig; + @override @JsonKey(name: 'key') final String key; diff --git a/packages/stream_chat/lib/open_api/model/config_response.freezed.dart b/packages/stream_chat/lib/open_api/model/config_response.freezed.dart index 54ea2417be..b52ad4e524 100644 --- a/packages/stream_chat/lib/open_api/model/config_response.freezed.dart +++ b/packages/stream_chat/lib/open_api/model/config_response.freezed.dart @@ -27,6 +27,7 @@ mixin _$ConfigResponse { BlockListConfig? get blockListConfig; DateTime get createdAt; FloodConfig? get floodConfig; + IntentConfigResponse? get intentConfig; String get key; LLMConfig? get llmConfig; List get supportedVideoCallHarmTypes; @@ -81,6 +82,7 @@ mixin _$ConfigResponse { (identical(other.blockListConfig, blockListConfig) || other.blockListConfig == blockListConfig) && (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && (identical(other.floodConfig, floodConfig) || other.floodConfig == floodConfig) && + (identical(other.intentConfig, intentConfig) || other.intentConfig == intentConfig) && (identical(other.key, key) || other.key == key) && (identical(other.llmConfig, llmConfig) || other.llmConfig == llmConfig) && const DeepCollectionEquality().equals( @@ -112,6 +114,7 @@ mixin _$ConfigResponse { blockListConfig, createdAt, floodConfig, + intentConfig, key, llmConfig, const DeepCollectionEquality().hash(supportedVideoCallHarmTypes), @@ -123,7 +126,7 @@ mixin _$ConfigResponse { @override String toString() { - return 'ConfigResponse(aiAudioConfig: $aiAudioConfig, aiImageConfig: $aiImageConfig, aiImageLabelDefinitions: $aiImageLabelDefinitions, aiImageSubclassifications: $aiImageSubclassifications, aiTextConfig: $aiTextConfig, aiVideoConfig: $aiVideoConfig, async: $async, automodPlatformCircumventionConfig: $automodPlatformCircumventionConfig, automodSemanticFiltersConfig: $automodSemanticFiltersConfig, automodToxicityConfig: $automodToxicityConfig, availableBodyguardProfiles: $availableBodyguardProfiles, blockListConfig: $blockListConfig, createdAt: $createdAt, floodConfig: $floodConfig, key: $key, llmConfig: $llmConfig, supportedVideoCallHarmTypes: $supportedVideoCallHarmTypes, team: $team, updatedAt: $updatedAt, velocityFilterConfig: $velocityFilterConfig, videoCallRuleConfig: $videoCallRuleConfig)'; + return 'ConfigResponse(aiAudioConfig: $aiAudioConfig, aiImageConfig: $aiImageConfig, aiImageLabelDefinitions: $aiImageLabelDefinitions, aiImageSubclassifications: $aiImageSubclassifications, aiTextConfig: $aiTextConfig, aiVideoConfig: $aiVideoConfig, async: $async, automodPlatformCircumventionConfig: $automodPlatformCircumventionConfig, automodSemanticFiltersConfig: $automodSemanticFiltersConfig, automodToxicityConfig: $automodToxicityConfig, availableBodyguardProfiles: $availableBodyguardProfiles, blockListConfig: $blockListConfig, createdAt: $createdAt, floodConfig: $floodConfig, intentConfig: $intentConfig, key: $key, llmConfig: $llmConfig, supportedVideoCallHarmTypes: $supportedVideoCallHarmTypes, team: $team, updatedAt: $updatedAt, velocityFilterConfig: $velocityFilterConfig, videoCallRuleConfig: $videoCallRuleConfig)'; } } @@ -149,6 +152,7 @@ abstract mixin class $ConfigResponseCopyWith<$Res> { BlockListConfig? blockListConfig, DateTime createdAt, FloodConfig? floodConfig, + IntentConfigResponse? intentConfig, String key, LLMConfig? llmConfig, List supportedVideoCallHarmTypes, @@ -185,6 +189,7 @@ class _$ConfigResponseCopyWithImpl<$Res> implements $ConfigResponseCopyWith<$Res Object? blockListConfig = freezed, Object? createdAt = null, Object? floodConfig = freezed, + Object? intentConfig = freezed, Object? key = null, Object? llmConfig = freezed, Object? supportedVideoCallHarmTypes = null, @@ -251,6 +256,10 @@ class _$ConfigResponseCopyWithImpl<$Res> implements $ConfigResponseCopyWith<$Res ? _self.floodConfig : floodConfig // ignore: cast_nullable_to_non_nullable as FloodConfig?, + intentConfig: freezed == intentConfig + ? _self.intentConfig + : intentConfig // ignore: cast_nullable_to_non_nullable + as IntentConfigResponse?, key: null == key ? _self.key : key // ignore: cast_nullable_to_non_nullable diff --git a/packages/stream_chat/lib/open_api/model/config_response.g.dart b/packages/stream_chat/lib/open_api/model/config_response.g.dart index 8aea3abbeb..ba5622d6a3 100644 --- a/packages/stream_chat/lib/open_api/model/config_response.g.dart +++ b/packages/stream_chat/lib/open_api/model/config_response.g.dart @@ -63,6 +63,11 @@ ConfigResponse _$ConfigResponseFromJson( json['created_at'] as Object, ), floodConfig: json['flood_config'] == null ? null : FloodConfig.fromJson(json['flood_config'] as Map), + intentConfig: json['intent_config'] == null + ? null + : IntentConfigResponse.fromJson( + json['intent_config'] as Map, + ), key: json['key'] as String, llmConfig: json['llm_config'] == null ? null : LLMConfig.fromJson(json['llm_config'] as Map), supportedVideoCallHarmTypes: (json['supported_video_call_harm_types'] as List) @@ -99,6 +104,7 @@ Map _$ConfigResponseToJson(ConfigResponse instance) => CreateBlockListRequestType._(json); diff --git a/packages/stream_chat/lib/open_api/model/create_block_list_response.dart b/packages/stream_chat/lib/open_api/model/create_block_list_response.dart index be016349e9..341fb2ad6d 100644 --- a/packages/stream_chat/lib/open_api/model/create_block_list_response.dart +++ b/packages/stream_chat/lib/open_api/model/create_block_list_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/create_device_request.dart b/packages/stream_chat/lib/open_api/model/create_device_request.dart index 18140d898d..d1a205b575 100644 --- a/packages/stream_chat/lib/open_api/model/create_device_request.dart +++ b/packages/stream_chat/lib/open_api/model/create_device_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/create_draft_request.dart b/packages/stream_chat/lib/open_api/model/create_draft_request.dart index 0f734b4359..88fd5d51ef 100644 --- a/packages/stream_chat/lib/open_api/model/create_draft_request.dart +++ b/packages/stream_chat/lib/open_api/model/create_draft_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/create_draft_response.dart b/packages/stream_chat/lib/open_api/model/create_draft_response.dart index af02c90192..e47e81f7ac 100644 --- a/packages/stream_chat/lib/open_api/model/create_draft_response.dart +++ b/packages/stream_chat/lib/open_api/model/create_draft_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/create_guest_request.dart b/packages/stream_chat/lib/open_api/model/create_guest_request.dart index 3204e83836..a21b7aee59 100644 --- a/packages/stream_chat/lib/open_api/model/create_guest_request.dart +++ b/packages/stream_chat/lib/open_api/model/create_guest_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/create_guest_response.dart b/packages/stream_chat/lib/open_api/model/create_guest_response.dart index c4b9d8ae58..ede0a78a64 100644 --- a/packages/stream_chat/lib/open_api/model/create_guest_response.dart +++ b/packages/stream_chat/lib/open_api/model/create_guest_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/create_poll_option_request.dart b/packages/stream_chat/lib/open_api/model/create_poll_option_request.dart index dbb35844a4..c518c789f5 100644 --- a/packages/stream_chat/lib/open_api/model/create_poll_option_request.dart +++ b/packages/stream_chat/lib/open_api/model/create_poll_option_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/create_poll_request.dart b/packages/stream_chat/lib/open_api/model/create_poll_request.dart index a45d523ec0..2246c24b44 100644 --- a/packages/stream_chat/lib/open_api/model/create_poll_request.dart +++ b/packages/stream_chat/lib/open_api/model/create_poll_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; @@ -37,6 +37,7 @@ class CreatePollRequest with _$CreatePollRequest { this.maxVotesAllowed, required this.name, this.options, + this.team, this.votingVisibility, }); @@ -80,6 +81,10 @@ class CreatePollRequest with _$CreatePollRequest { @JsonKey(name: 'options') final List? options; + @override + @JsonKey(name: 'team') + final String? team; + @override @JsonKey(name: 'voting_visibility') final CreatePollRequestVotingVisibility? votingVisibility; diff --git a/packages/stream_chat/lib/open_api/model/create_poll_request.freezed.dart b/packages/stream_chat/lib/open_api/model/create_poll_request.freezed.dart index 64928a07b3..6e70434a56 100644 --- a/packages/stream_chat/lib/open_api/model/create_poll_request.freezed.dart +++ b/packages/stream_chat/lib/open_api/model/create_poll_request.freezed.dart @@ -23,6 +23,7 @@ mixin _$CreatePollRequest { int? get maxVotesAllowed; String get name; List? get options; + String? get team; CreatePollRequestVotingVisibility? get votingVisibility; /// Create a copy of CreatePollRequest @@ -53,6 +54,7 @@ mixin _$CreatePollRequest { (identical(other.maxVotesAllowed, maxVotesAllowed) || other.maxVotesAllowed == maxVotesAllowed) && (identical(other.name, name) || other.name == name) && const DeepCollectionEquality().equals(other.options, options) && + (identical(other.team, team) || other.team == team) && (identical(other.votingVisibility, votingVisibility) || other.votingVisibility == votingVisibility)); } @@ -69,12 +71,13 @@ mixin _$CreatePollRequest { maxVotesAllowed, name, const DeepCollectionEquality().hash(options), + team, votingVisibility, ); @override String toString() { - return 'CreatePollRequest(allowAnswers: $allowAnswers, allowUserSuggestedOptions: $allowUserSuggestedOptions, custom: $custom, description: $description, enforceUniqueVote: $enforceUniqueVote, id: $id, isClosed: $isClosed, maxVotesAllowed: $maxVotesAllowed, name: $name, options: $options, votingVisibility: $votingVisibility)'; + return 'CreatePollRequest(allowAnswers: $allowAnswers, allowUserSuggestedOptions: $allowUserSuggestedOptions, custom: $custom, description: $description, enforceUniqueVote: $enforceUniqueVote, id: $id, isClosed: $isClosed, maxVotesAllowed: $maxVotesAllowed, name: $name, options: $options, team: $team, votingVisibility: $votingVisibility)'; } } @@ -96,6 +99,7 @@ abstract mixin class $CreatePollRequestCopyWith<$Res> { int? maxVotesAllowed, String name, List? options, + String? team, CreatePollRequestVotingVisibility? votingVisibility, }); } @@ -122,6 +126,7 @@ class _$CreatePollRequestCopyWithImpl<$Res> implements $CreatePollRequestCopyWit Object? maxVotesAllowed = freezed, Object? name = null, Object? options = freezed, + Object? team = freezed, Object? votingVisibility = freezed, }) { return _then( @@ -166,6 +171,10 @@ class _$CreatePollRequestCopyWithImpl<$Res> implements $CreatePollRequestCopyWit ? _self.options : options // ignore: cast_nullable_to_non_nullable as List?, + team: freezed == team + ? _self.team + : team // ignore: cast_nullable_to_non_nullable + as String?, votingVisibility: freezed == votingVisibility ? _self.votingVisibility : votingVisibility // ignore: cast_nullable_to_non_nullable diff --git a/packages/stream_chat/lib/open_api/model/create_poll_request.g.dart b/packages/stream_chat/lib/open_api/model/create_poll_request.g.dart index e6595ef130..929f9fcade 100644 --- a/packages/stream_chat/lib/open_api/model/create_poll_request.g.dart +++ b/packages/stream_chat/lib/open_api/model/create_poll_request.g.dart @@ -19,6 +19,7 @@ CreatePollRequest _$CreatePollRequestFromJson(Map json) => Crea options: (json['options'] as List?) ?.map((e) => PollOptionInput.fromJson(e as Map)) .toList(), + team: json['team'] as String?, votingVisibility: json['voting_visibility'] == null ? null : CreatePollRequestVotingVisibility.fromJson( @@ -37,5 +38,6 @@ Map _$CreatePollRequestToJson(CreatePollRequest instance) => e.toJson()).toList(), + 'team': instance.team, 'voting_visibility': instance.votingVisibility?.toJson(), }; diff --git a/packages/stream_chat/lib/open_api/model/create_queue_request.dart b/packages/stream_chat/lib/open_api/model/create_queue_request.dart index 48399f7991..5a17806ca8 100644 --- a/packages/stream_chat/lib/open_api/model/create_queue_request.dart +++ b/packages/stream_chat/lib/open_api/model/create_queue_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/create_reminder_request.dart b/packages/stream_chat/lib/open_api/model/create_reminder_request.dart index 8a364f98e2..111b1d1f3b 100644 --- a/packages/stream_chat/lib/open_api/model/create_reminder_request.dart +++ b/packages/stream_chat/lib/open_api/model/create_reminder_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; @@ -18,9 +18,15 @@ part 'create_reminder_request.freezed.dart'; @JsonSerializable() class CreateReminderRequest with _$CreateReminderRequest { const CreateReminderRequest({ + this.expiresAt, this.remindAt, }); + @override + @StreamDateTimeConverter() + @JsonKey(name: 'expires_at') + final DateTime? expiresAt; + @override @StreamDateTimeConverter() @JsonKey(name: 'remind_at') diff --git a/packages/stream_chat/lib/open_api/model/create_reminder_request.freezed.dart b/packages/stream_chat/lib/open_api/model/create_reminder_request.freezed.dart index fdf6eaf682..af4803b420 100644 --- a/packages/stream_chat/lib/open_api/model/create_reminder_request.freezed.dart +++ b/packages/stream_chat/lib/open_api/model/create_reminder_request.freezed.dart @@ -13,6 +13,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$CreateReminderRequest { + DateTime? get expiresAt; DateTime? get remindAt; /// Create a copy of CreateReminderRequest @@ -30,15 +31,16 @@ mixin _$CreateReminderRequest { return identical(this, other) || (other.runtimeType == runtimeType && other is CreateReminderRequest && + (identical(other.expiresAt, expiresAt) || other.expiresAt == expiresAt) && (identical(other.remindAt, remindAt) || other.remindAt == remindAt)); } @override - int get hashCode => Object.hash(runtimeType, remindAt); + int get hashCode => Object.hash(runtimeType, expiresAt, remindAt); @override String toString() { - return 'CreateReminderRequest(remindAt: $remindAt)'; + return 'CreateReminderRequest(expiresAt: $expiresAt, remindAt: $remindAt)'; } } @@ -49,7 +51,7 @@ abstract mixin class $CreateReminderRequestCopyWith<$Res> { $Res Function(CreateReminderRequest) _then, ) = _$CreateReminderRequestCopyWithImpl; @useResult - $Res call({DateTime? remindAt}); + $Res call({DateTime? expiresAt, DateTime? remindAt}); } /// @nodoc @@ -63,9 +65,13 @@ class _$CreateReminderRequestCopyWithImpl<$Res> implements $CreateReminderReques /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? remindAt = freezed}) { + $Res call({Object? expiresAt = freezed, Object? remindAt = freezed}) { return _then( CreateReminderRequest( + expiresAt: freezed == expiresAt + ? _self.expiresAt + : expiresAt // ignore: cast_nullable_to_non_nullable + as DateTime?, remindAt: freezed == remindAt ? _self.remindAt : remindAt // ignore: cast_nullable_to_non_nullable diff --git a/packages/stream_chat/lib/open_api/model/create_reminder_request.g.dart b/packages/stream_chat/lib/open_api/model/create_reminder_request.g.dart index e344056046..d614523a85 100644 --- a/packages/stream_chat/lib/open_api/model/create_reminder_request.g.dart +++ b/packages/stream_chat/lib/open_api/model/create_reminder_request.g.dart @@ -9,6 +9,10 @@ part of 'create_reminder_request.dart'; CreateReminderRequest _$CreateReminderRequestFromJson( Map json, ) => CreateReminderRequest( + expiresAt: _$JsonConverterFromJson( + json['expires_at'], + const StreamDateTimeConverter().fromJson, + ), remindAt: _$JsonConverterFromJson( json['remind_at'], const StreamDateTimeConverter().fromJson, @@ -18,6 +22,10 @@ CreateReminderRequest _$CreateReminderRequestFromJson( Map _$CreateReminderRequestToJson( CreateReminderRequest instance, ) => { + 'expires_at': _$JsonConverterToJson( + instance.expiresAt, + const StreamDateTimeConverter().toJson, + ), 'remind_at': _$JsonConverterToJson( instance.remindAt, const StreamDateTimeConverter().toJson, diff --git a/packages/stream_chat/lib/open_api/model/create_reminder_response.dart b/packages/stream_chat/lib/open_api/model/create_reminder_response.dart index 97b8f2e645..5f46078a11 100644 --- a/packages/stream_chat/lib/open_api/model/create_reminder_response.dart +++ b/packages/stream_chat/lib/open_api/model/create_reminder_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/create_user_group_request.dart b/packages/stream_chat/lib/open_api/model/create_user_group_request.dart index f2a48ba9ab..ca31132840 100644 --- a/packages/stream_chat/lib/open_api/model/create_user_group_request.dart +++ b/packages/stream_chat/lib/open_api/model/create_user_group_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/create_user_group_response.dart b/packages/stream_chat/lib/open_api/model/create_user_group_response.dart index 4a8e2c72a2..de6c346ea5 100644 --- a/packages/stream_chat/lib/open_api/model/create_user_group_response.dart +++ b/packages/stream_chat/lib/open_api/model/create_user_group_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/custom_action_request_payload.dart b/packages/stream_chat/lib/open_api/model/custom_action_request_payload.dart index cc01026c08..1358443f80 100644 --- a/packages/stream_chat/lib/open_api/model/custom_action_request_payload.dart +++ b/packages/stream_chat/lib/open_api/model/custom_action_request_payload.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/custom_event.dart b/packages/stream_chat/lib/open_api/model/custom_event.dart index 57bab936a8..324296ae74 100644 --- a/packages/stream_chat/lib/open_api/model/custom_event.dart +++ b/packages/stream_chat/lib/open_api/model/custom_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/data.dart b/packages/stream_chat/lib/open_api/model/data.dart index 949398d05f..3c5d9bd2c9 100644 --- a/packages/stream_chat/lib/open_api/model/data.dart +++ b/packages/stream_chat/lib/open_api/model/data.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/delete_action_config_response.dart b/packages/stream_chat/lib/open_api/model/delete_action_config_response.dart index bbd0fdaebd..372782073c 100644 --- a/packages/stream_chat/lib/open_api/model/delete_action_config_response.dart +++ b/packages/stream_chat/lib/open_api/model/delete_action_config_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/delete_activity_request_payload.dart b/packages/stream_chat/lib/open_api/model/delete_activity_request_payload.dart index 59bef0a048..819832b854 100644 --- a/packages/stream_chat/lib/open_api/model/delete_activity_request_payload.dart +++ b/packages/stream_chat/lib/open_api/model/delete_activity_request_payload.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/delete_channel_response.dart b/packages/stream_chat/lib/open_api/model/delete_channel_response.dart index 724596a33e..ee425d3944 100644 --- a/packages/stream_chat/lib/open_api/model/delete_channel_response.dart +++ b/packages/stream_chat/lib/open_api/model/delete_channel_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/delete_channels_request.dart b/packages/stream_chat/lib/open_api/model/delete_channels_request.dart index 9424ba41de..d21dc67c02 100644 --- a/packages/stream_chat/lib/open_api/model/delete_channels_request.dart +++ b/packages/stream_chat/lib/open_api/model/delete_channels_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/delete_channels_response.dart b/packages/stream_chat/lib/open_api/model/delete_channels_response.dart index 107056bba1..fde717bcd5 100644 --- a/packages/stream_chat/lib/open_api/model/delete_channels_response.dart +++ b/packages/stream_chat/lib/open_api/model/delete_channels_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/delete_channels_result_response.dart b/packages/stream_chat/lib/open_api/model/delete_channels_result_response.dart index 86516129ff..1ded992658 100644 --- a/packages/stream_chat/lib/open_api/model/delete_channels_result_response.dart +++ b/packages/stream_chat/lib/open_api/model/delete_channels_result_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/delete_comment_request_payload.dart b/packages/stream_chat/lib/open_api/model/delete_comment_request_payload.dart index 7071767b5e..d1660997e7 100644 --- a/packages/stream_chat/lib/open_api/model/delete_comment_request_payload.dart +++ b/packages/stream_chat/lib/open_api/model/delete_comment_request_payload.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/delete_message_request_payload.dart b/packages/stream_chat/lib/open_api/model/delete_message_request_payload.dart index 81fee020f7..3aa9d7f8cb 100644 --- a/packages/stream_chat/lib/open_api/model/delete_message_request_payload.dart +++ b/packages/stream_chat/lib/open_api/model/delete_message_request_payload.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/delete_message_response.dart b/packages/stream_chat/lib/open_api/model/delete_message_response.dart index e7e8380c44..04d34264d0 100644 --- a/packages/stream_chat/lib/open_api/model/delete_message_response.dart +++ b/packages/stream_chat/lib/open_api/model/delete_message_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/delete_moderation_config_response.dart b/packages/stream_chat/lib/open_api/model/delete_moderation_config_response.dart index 9176d1d02b..4dbeeff4fa 100644 --- a/packages/stream_chat/lib/open_api/model/delete_moderation_config_response.dart +++ b/packages/stream_chat/lib/open_api/model/delete_moderation_config_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/delete_reaction_request_payload.dart b/packages/stream_chat/lib/open_api/model/delete_reaction_request_payload.dart index ba472e5802..e657d65997 100644 --- a/packages/stream_chat/lib/open_api/model/delete_reaction_request_payload.dart +++ b/packages/stream_chat/lib/open_api/model/delete_reaction_request_payload.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/delete_reaction_response.dart b/packages/stream_chat/lib/open_api/model/delete_reaction_response.dart index 1da3a1ab56..120a7d3b9f 100644 --- a/packages/stream_chat/lib/open_api/model/delete_reaction_response.dart +++ b/packages/stream_chat/lib/open_api/model/delete_reaction_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/delete_reminder_response.dart b/packages/stream_chat/lib/open_api/model/delete_reminder_response.dart index d70411ce67..c2dc469298 100644 --- a/packages/stream_chat/lib/open_api/model/delete_reminder_response.dart +++ b/packages/stream_chat/lib/open_api/model/delete_reminder_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/delete_user_messages_request_payload.dart b/packages/stream_chat/lib/open_api/model/delete_user_messages_request_payload.dart index e2cd2fc6d8..79758c6e73 100644 --- a/packages/stream_chat/lib/open_api/model/delete_user_messages_request_payload.dart +++ b/packages/stream_chat/lib/open_api/model/delete_user_messages_request_payload.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/delete_user_request_payload.dart b/packages/stream_chat/lib/open_api/model/delete_user_request_payload.dart index ef1439c4e8..54d737ecc4 100644 --- a/packages/stream_chat/lib/open_api/model/delete_user_request_payload.dart +++ b/packages/stream_chat/lib/open_api/model/delete_user_request_payload.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/delivered_message_payload.dart b/packages/stream_chat/lib/open_api/model/delivered_message_payload.dart index 375ac981d7..b453a916fc 100644 --- a/packages/stream_chat/lib/open_api/model/delivered_message_payload.dart +++ b/packages/stream_chat/lib/open_api/model/delivered_message_payload.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/delivery_receipts_response.dart b/packages/stream_chat/lib/open_api/model/delivery_receipts_response.dart index be475a37b8..897dde3c0f 100644 --- a/packages/stream_chat/lib/open_api/model/delivery_receipts_response.dart +++ b/packages/stream_chat/lib/open_api/model/delivery_receipts_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/device_response.dart b/packages/stream_chat/lib/open_api/model/device_response.dart index 70f55cc1ab..260817ed09 100644 --- a/packages/stream_chat/lib/open_api/model/device_response.dart +++ b/packages/stream_chat/lib/open_api/model/device_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/draft_deleted_event.dart b/packages/stream_chat/lib/open_api/model/draft_deleted_event.dart index 077ba42362..299b990fcd 100644 --- a/packages/stream_chat/lib/open_api/model/draft_deleted_event.dart +++ b/packages/stream_chat/lib/open_api/model/draft_deleted_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/draft_payload_response.dart b/packages/stream_chat/lib/open_api/model/draft_payload_response.dart index 6f3c0c3cc6..fb63e453fa 100644 --- a/packages/stream_chat/lib/open_api/model/draft_payload_response.dart +++ b/packages/stream_chat/lib/open_api/model/draft_payload_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/draft_response.dart b/packages/stream_chat/lib/open_api/model/draft_response.dart index 68d3c11e40..34c52bcbf3 100644 --- a/packages/stream_chat/lib/open_api/model/draft_response.dart +++ b/packages/stream_chat/lib/open_api/model/draft_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/draft_updated_event.dart b/packages/stream_chat/lib/open_api/model/draft_updated_event.dart index ace9cbfcf0..422578e741 100644 --- a/packages/stream_chat/lib/open_api/model/draft_updated_event.dart +++ b/packages/stream_chat/lib/open_api/model/draft_updated_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/duration_response.dart b/packages/stream_chat/lib/open_api/model/duration_response.dart index 6128a95243..f195f6b6b2 100644 --- a/packages/stream_chat/lib/open_api/model/duration_response.dart +++ b/packages/stream_chat/lib/open_api/model/duration_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/enriched_activity.dart b/packages/stream_chat/lib/open_api/model/enriched_activity.dart index 78904c25f1..ba9ec7e088 100644 --- a/packages/stream_chat/lib/open_api/model/enriched_activity.dart +++ b/packages/stream_chat/lib/open_api/model/enriched_activity.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/enriched_reaction.dart b/packages/stream_chat/lib/open_api/model/enriched_reaction.dart index 324e9ce048..fb41bd64d5 100644 --- a/packages/stream_chat/lib/open_api/model/enriched_reaction.dart +++ b/packages/stream_chat/lib/open_api/model/enriched_reaction.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/entity_creator_response.dart b/packages/stream_chat/lib/open_api/model/entity_creator_response.dart index 5fc7b999d3..50ddf7a9c9 100644 --- a/packages/stream_chat/lib/open_api/model/entity_creator_response.dart +++ b/packages/stream_chat/lib/open_api/model/entity_creator_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/escalate_payload.dart b/packages/stream_chat/lib/open_api/model/escalate_payload.dart index 39195a19c4..80d7811e22 100644 --- a/packages/stream_chat/lib/open_api/model/escalate_payload.dart +++ b/packages/stream_chat/lib/open_api/model/escalate_payload.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/escalation_metadata.dart b/packages/stream_chat/lib/open_api/model/escalation_metadata.dart index 9cd638bff9..695c1d5261 100644 --- a/packages/stream_chat/lib/open_api/model/escalation_metadata.dart +++ b/packages/stream_chat/lib/open_api/model/escalation_metadata.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/event_request.dart b/packages/stream_chat/lib/open_api/model/event_request.dart index a349d35da3..bdb62675bc 100644 --- a/packages/stream_chat/lib/open_api/model/event_request.dart +++ b/packages/stream_chat/lib/open_api/model/event_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/event_response.dart b/packages/stream_chat/lib/open_api/model/event_response.dart index 080c46e9de..ccdc8a6bc4 100644 --- a/packages/stream_chat/lib/open_api/model/event_response.dart +++ b/packages/stream_chat/lib/open_api/model/event_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/feeds_activity_location.dart b/packages/stream_chat/lib/open_api/model/feeds_activity_location.dart index 230aed947b..4432873b3c 100644 --- a/packages/stream_chat/lib/open_api/model/feeds_activity_location.dart +++ b/packages/stream_chat/lib/open_api/model/feeds_activity_location.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/feeds_bookmark_response.dart b/packages/stream_chat/lib/open_api/model/feeds_bookmark_response.dart index bbd4fe4e81..4920e04df4 100644 --- a/packages/stream_chat/lib/open_api/model/feeds_bookmark_response.dart +++ b/packages/stream_chat/lib/open_api/model/feeds_bookmark_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/feeds_enriched_collection_response.dart b/packages/stream_chat/lib/open_api/model/feeds_enriched_collection_response.dart index 34a98030ec..8376a7a577 100644 --- a/packages/stream_chat/lib/open_api/model/feeds_enriched_collection_response.dart +++ b/packages/stream_chat/lib/open_api/model/feeds_enriched_collection_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/feeds_feed_response.dart b/packages/stream_chat/lib/open_api/model/feeds_feed_response.dart index 4e6d1f4d4d..7f4c39ea5d 100644 --- a/packages/stream_chat/lib/open_api/model/feeds_feed_response.dart +++ b/packages/stream_chat/lib/open_api/model/feeds_feed_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/feeds_notification_comment.dart b/packages/stream_chat/lib/open_api/model/feeds_notification_comment.dart index e22d56e3a9..168d22ac28 100644 --- a/packages/stream_chat/lib/open_api/model/feeds_notification_comment.dart +++ b/packages/stream_chat/lib/open_api/model/feeds_notification_comment.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/feeds_notification_context.dart b/packages/stream_chat/lib/open_api/model/feeds_notification_context.dart index fd2d42bc31..0b98740b4f 100644 --- a/packages/stream_chat/lib/open_api/model/feeds_notification_context.dart +++ b/packages/stream_chat/lib/open_api/model/feeds_notification_context.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/feeds_notification_parent_activity.dart b/packages/stream_chat/lib/open_api/model/feeds_notification_parent_activity.dart index db07de0ba5..feee2e14d5 100644 --- a/packages/stream_chat/lib/open_api/model/feeds_notification_parent_activity.dart +++ b/packages/stream_chat/lib/open_api/model/feeds_notification_parent_activity.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/feeds_notification_target.dart b/packages/stream_chat/lib/open_api/model/feeds_notification_target.dart index cbffa044ec..5853a69171 100644 --- a/packages/stream_chat/lib/open_api/model/feeds_notification_target.dart +++ b/packages/stream_chat/lib/open_api/model/feeds_notification_target.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/feeds_notification_trigger.dart b/packages/stream_chat/lib/open_api/model/feeds_notification_trigger.dart index 9ca94b00f4..f0db9e752f 100644 --- a/packages/stream_chat/lib/open_api/model/feeds_notification_trigger.dart +++ b/packages/stream_chat/lib/open_api/model/feeds_notification_trigger.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/feeds_preferences.dart b/packages/stream_chat/lib/open_api/model/feeds_preferences.dart index 750f87f94a..f38bd69cb1 100644 --- a/packages/stream_chat/lib/open_api/model/feeds_preferences.dart +++ b/packages/stream_chat/lib/open_api/model/feeds_preferences.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/feeds_preferences_response.dart b/packages/stream_chat/lib/open_api/model/feeds_preferences_response.dart index 82cf1e74b1..299437144d 100644 --- a/packages/stream_chat/lib/open_api/model/feeds_preferences_response.dart +++ b/packages/stream_chat/lib/open_api/model/feeds_preferences_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/feeds_reaction_group_response.dart b/packages/stream_chat/lib/open_api/model/feeds_reaction_group_response.dart index ea671135d7..c0f3ec91bd 100644 --- a/packages/stream_chat/lib/open_api/model/feeds_reaction_group_response.dart +++ b/packages/stream_chat/lib/open_api/model/feeds_reaction_group_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/feeds_reaction_response.dart b/packages/stream_chat/lib/open_api/model/feeds_reaction_response.dart index fec7096685..688f1ee20b 100644 --- a/packages/stream_chat/lib/open_api/model/feeds_reaction_response.dart +++ b/packages/stream_chat/lib/open_api/model/feeds_reaction_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/feeds_share_response.dart b/packages/stream_chat/lib/open_api/model/feeds_share_response.dart index 73fda8b801..996d53d581 100644 --- a/packages/stream_chat/lib/open_api/model/feeds_share_response.dart +++ b/packages/stream_chat/lib/open_api/model/feeds_share_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/feeds_v3_activity_response.dart b/packages/stream_chat/lib/open_api/model/feeds_v3_activity_response.dart index 057b7736ee..391ca74642 100644 --- a/packages/stream_chat/lib/open_api/model/feeds_v3_activity_response.dart +++ b/packages/stream_chat/lib/open_api/model/feeds_v3_activity_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/feeds_v3_comment_response.dart b/packages/stream_chat/lib/open_api/model/feeds_v3_comment_response.dart index 043277fafb..5b71b8e0d5 100644 --- a/packages/stream_chat/lib/open_api/model/feeds_v3_comment_response.dart +++ b/packages/stream_chat/lib/open_api/model/feeds_v3_comment_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/field.dart b/packages/stream_chat/lib/open_api/model/field.dart index f9f14ce48e..f43f8b83a5 100644 --- a/packages/stream_chat/lib/open_api/model/field.dart +++ b/packages/stream_chat/lib/open_api/model/field.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/file_upload_config.dart b/packages/stream_chat/lib/open_api/model/file_upload_config.dart index 7676de0bd2..391622909e 100644 --- a/packages/stream_chat/lib/open_api/model/file_upload_config.dart +++ b/packages/stream_chat/lib/open_api/model/file_upload_config.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/file_upload_request.dart b/packages/stream_chat/lib/open_api/model/file_upload_request.dart index bd4d8e4dac..e53ab6a52a 100644 --- a/packages/stream_chat/lib/open_api/model/file_upload_request.dart +++ b/packages/stream_chat/lib/open_api/model/file_upload_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/file_upload_response.dart b/packages/stream_chat/lib/open_api/model/file_upload_response.dart index e59aa77268..614135fe49 100644 --- a/packages/stream_chat/lib/open_api/model/file_upload_response.dart +++ b/packages/stream_chat/lib/open_api/model/file_upload_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/filter_config_response.dart b/packages/stream_chat/lib/open_api/model/filter_config_response.dart index 5c153be9df..7d32461a99 100644 --- a/packages/stream_chat/lib/open_api/model/filter_config_response.dart +++ b/packages/stream_chat/lib/open_api/model/filter_config_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; @@ -19,6 +19,7 @@ part 'filter_config_response.freezed.dart'; class FilterConfigResponse with _$FilterConfigResponse { const FilterConfigResponse({ this.aiImageLabels, + this.aiImageOcrLabels, this.aiImageTaxonomy, this.aiTextLabels, this.configKeys, @@ -31,6 +32,10 @@ class FilterConfigResponse with _$FilterConfigResponse { @JsonKey(name: 'ai_image_labels') final List? aiImageLabels; + @override + @JsonKey(name: 'ai_image_ocr_labels') + final List? aiImageOcrLabels; + @override @JsonKey(name: 'ai_image_taxonomy') final Map>? aiImageTaxonomy; diff --git a/packages/stream_chat/lib/open_api/model/filter_config_response.freezed.dart b/packages/stream_chat/lib/open_api/model/filter_config_response.freezed.dart index 8f99a16360..637912ed43 100644 --- a/packages/stream_chat/lib/open_api/model/filter_config_response.freezed.dart +++ b/packages/stream_chat/lib/open_api/model/filter_config_response.freezed.dart @@ -14,6 +14,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$FilterConfigResponse { List? get aiImageLabels; + List? get aiImageOcrLabels; Map>? get aiImageTaxonomy; List? get aiTextLabels; List? get configKeys; @@ -40,6 +41,10 @@ mixin _$FilterConfigResponse { other.aiImageLabels, aiImageLabels, ) && + const DeepCollectionEquality().equals( + other.aiImageOcrLabels, + aiImageOcrLabels, + ) && const DeepCollectionEquality().equals( other.aiImageTaxonomy, aiImageTaxonomy, @@ -64,6 +69,7 @@ mixin _$FilterConfigResponse { int get hashCode => Object.hash( runtimeType, const DeepCollectionEquality().hash(aiImageLabels), + const DeepCollectionEquality().hash(aiImageOcrLabels), const DeepCollectionEquality().hash(aiImageTaxonomy), const DeepCollectionEquality().hash(aiTextLabels), const DeepCollectionEquality().hash(configKeys), @@ -74,7 +80,7 @@ mixin _$FilterConfigResponse { @override String toString() { - return 'FilterConfigResponse(aiImageLabels: $aiImageLabels, aiImageTaxonomy: $aiImageTaxonomy, aiTextLabels: $aiTextLabels, configKeys: $configKeys, filterableCustomKeys: $filterableCustomKeys, llmLabels: $llmLabels, ruleNames: $ruleNames)'; + return 'FilterConfigResponse(aiImageLabels: $aiImageLabels, aiImageOcrLabels: $aiImageOcrLabels, aiImageTaxonomy: $aiImageTaxonomy, aiTextLabels: $aiTextLabels, configKeys: $configKeys, filterableCustomKeys: $filterableCustomKeys, llmLabels: $llmLabels, ruleNames: $ruleNames)'; } } @@ -87,6 +93,7 @@ abstract mixin class $FilterConfigResponseCopyWith<$Res> { @useResult $Res call({ List? aiImageLabels, + List? aiImageOcrLabels, Map>? aiImageTaxonomy, List? aiTextLabels, List? configKeys, @@ -109,6 +116,7 @@ class _$FilterConfigResponseCopyWithImpl<$Res> implements $FilterConfigResponseC @override $Res call({ Object? aiImageLabels = freezed, + Object? aiImageOcrLabels = freezed, Object? aiImageTaxonomy = freezed, Object? aiTextLabels = freezed, Object? configKeys = freezed, @@ -122,6 +130,10 @@ class _$FilterConfigResponseCopyWithImpl<$Res> implements $FilterConfigResponseC ? _self.aiImageLabels : aiImageLabels // ignore: cast_nullable_to_non_nullable as List?, + aiImageOcrLabels: freezed == aiImageOcrLabels + ? _self.aiImageOcrLabels + : aiImageOcrLabels // ignore: cast_nullable_to_non_nullable + as List?, aiImageTaxonomy: freezed == aiImageTaxonomy ? _self.aiImageTaxonomy : aiImageTaxonomy // ignore: cast_nullable_to_non_nullable diff --git a/packages/stream_chat/lib/open_api/model/filter_config_response.g.dart b/packages/stream_chat/lib/open_api/model/filter_config_response.g.dart index d9513aee4c..7a306c0e31 100644 --- a/packages/stream_chat/lib/open_api/model/filter_config_response.g.dart +++ b/packages/stream_chat/lib/open_api/model/filter_config_response.g.dart @@ -10,6 +10,7 @@ FilterConfigResponse _$FilterConfigResponseFromJson( Map json, ) => FilterConfigResponse( aiImageLabels: (json['ai_image_labels'] as List?)?.map((e) => e as String).toList(), + aiImageOcrLabels: (json['ai_image_ocr_labels'] as List?)?.map((e) => e as String).toList(), aiImageTaxonomy: (json['ai_image_taxonomy'] as Map?)?.map( (k, e) => MapEntry(k, (e as List).map((e) => e as String).toList()), ), @@ -24,6 +25,7 @@ Map _$FilterConfigResponseToJson( FilterConfigResponse instance, ) => { 'ai_image_labels': instance.aiImageLabels, + 'ai_image_ocr_labels': instance.aiImageOcrLabels, 'ai_image_taxonomy': instance.aiImageTaxonomy, 'ai_text_labels': instance.aiTextLabels, 'config_keys': instance.configKeys, diff --git a/packages/stream_chat/lib/open_api/model/flag_count_rule_parameters.dart b/packages/stream_chat/lib/open_api/model/flag_count_rule_parameters.dart index 8fffe5be62..817b28ef59 100644 --- a/packages/stream_chat/lib/open_api/model/flag_count_rule_parameters.dart +++ b/packages/stream_chat/lib/open_api/model/flag_count_rule_parameters.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/flag_details_response.dart b/packages/stream_chat/lib/open_api/model/flag_details_response.dart index a00eeaf3c4..1079fad43d 100644 --- a/packages/stream_chat/lib/open_api/model/flag_details_response.dart +++ b/packages/stream_chat/lib/open_api/model/flag_details_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/flag_feedback_response.dart b/packages/stream_chat/lib/open_api/model/flag_feedback_response.dart index 5a8beba58a..3959991706 100644 --- a/packages/stream_chat/lib/open_api/model/flag_feedback_response.dart +++ b/packages/stream_chat/lib/open_api/model/flag_feedback_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/flag_item_response.dart b/packages/stream_chat/lib/open_api/model/flag_item_response.dart index bc065d9043..c8c1211115 100644 --- a/packages/stream_chat/lib/open_api/model/flag_item_response.dart +++ b/packages/stream_chat/lib/open_api/model/flag_item_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/flag_message_details_response.dart b/packages/stream_chat/lib/open_api/model/flag_message_details_response.dart index 3cd20a9ac8..c1ee50baf2 100644 --- a/packages/stream_chat/lib/open_api/model/flag_message_details_response.dart +++ b/packages/stream_chat/lib/open_api/model/flag_message_details_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/flag_request.dart b/packages/stream_chat/lib/open_api/model/flag_request.dart index 04f8f5706a..8ebfebb9e2 100644 --- a/packages/stream_chat/lib/open_api/model/flag_request.dart +++ b/packages/stream_chat/lib/open_api/model/flag_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/flag_user_options.dart b/packages/stream_chat/lib/open_api/model/flag_user_options.dart index a424c62a4a..17143573af 100644 --- a/packages/stream_chat/lib/open_api/model/flag_user_options.dart +++ b/packages/stream_chat/lib/open_api/model/flag_user_options.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/flood_config.dart b/packages/stream_chat/lib/open_api/model/flood_config.dart index 5985b3137d..b116786980 100644 --- a/packages/stream_chat/lib/open_api/model/flood_config.dart +++ b/packages/stream_chat/lib/open_api/model/flood_config.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/flood_identical_config.dart b/packages/stream_chat/lib/open_api/model/flood_identical_config.dart index e04e07056d..1ea6c05be1 100644 --- a/packages/stream_chat/lib/open_api/model/flood_identical_config.dart +++ b/packages/stream_chat/lib/open_api/model/flood_identical_config.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/flood_identical_rule_parameters.dart b/packages/stream_chat/lib/open_api/model/flood_identical_rule_parameters.dart index dd5a8c732d..d1274e2a5d 100644 --- a/packages/stream_chat/lib/open_api/model/flood_identical_rule_parameters.dart +++ b/packages/stream_chat/lib/open_api/model/flood_identical_rule_parameters.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/flood_similar_config.dart b/packages/stream_chat/lib/open_api/model/flood_similar_config.dart index 4b020cb5a1..9d231d8a82 100644 --- a/packages/stream_chat/lib/open_api/model/flood_similar_config.dart +++ b/packages/stream_chat/lib/open_api/model/flood_similar_config.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/flood_similar_rule_parameters.dart b/packages/stream_chat/lib/open_api/model/flood_similar_rule_parameters.dart index 5623660569..cfa0111a69 100644 --- a/packages/stream_chat/lib/open_api/model/flood_similar_rule_parameters.dart +++ b/packages/stream_chat/lib/open_api/model/flood_similar_rule_parameters.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; @@ -19,6 +19,7 @@ part 'flood_similar_rule_parameters.freezed.dart'; class FloodSimilarRuleParameters with _$FloodSimilarRuleParameters { const FloodSimilarRuleParameters({ this.allowlist, + this.minTextLength, this.similarityDistance, this.threshold, this.timeWindow, @@ -28,6 +29,10 @@ class FloodSimilarRuleParameters with _$FloodSimilarRuleParameters { @JsonKey(name: 'allowlist') final List? allowlist; + @override + @JsonKey(name: 'min_text_length') + final int? minTextLength; + @override @JsonKey(name: 'similarity_distance') final int? similarityDistance; diff --git a/packages/stream_chat/lib/open_api/model/flood_similar_rule_parameters.freezed.dart b/packages/stream_chat/lib/open_api/model/flood_similar_rule_parameters.freezed.dart index 495e3cfbbd..f434ba2143 100644 --- a/packages/stream_chat/lib/open_api/model/flood_similar_rule_parameters.freezed.dart +++ b/packages/stream_chat/lib/open_api/model/flood_similar_rule_parameters.freezed.dart @@ -14,6 +14,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$FloodSimilarRuleParameters { List? get allowlist; + int? get minTextLength; int? get similarityDistance; int? get threshold; String? get timeWindow; @@ -34,6 +35,7 @@ mixin _$FloodSimilarRuleParameters { (other.runtimeType == runtimeType && other is FloodSimilarRuleParameters && const DeepCollectionEquality().equals(other.allowlist, allowlist) && + (identical(other.minTextLength, minTextLength) || other.minTextLength == minTextLength) && (identical(other.similarityDistance, similarityDistance) || other.similarityDistance == similarityDistance) && (identical(other.threshold, threshold) || other.threshold == threshold) && @@ -44,6 +46,7 @@ mixin _$FloodSimilarRuleParameters { int get hashCode => Object.hash( runtimeType, const DeepCollectionEquality().hash(allowlist), + minTextLength, similarityDistance, threshold, timeWindow, @@ -51,7 +54,7 @@ mixin _$FloodSimilarRuleParameters { @override String toString() { - return 'FloodSimilarRuleParameters(allowlist: $allowlist, similarityDistance: $similarityDistance, threshold: $threshold, timeWindow: $timeWindow)'; + return 'FloodSimilarRuleParameters(allowlist: $allowlist, minTextLength: $minTextLength, similarityDistance: $similarityDistance, threshold: $threshold, timeWindow: $timeWindow)'; } } @@ -64,6 +67,7 @@ abstract mixin class $FloodSimilarRuleParametersCopyWith<$Res> { @useResult $Res call({ List? allowlist, + int? minTextLength, int? similarityDistance, int? threshold, String? timeWindow, @@ -83,6 +87,7 @@ class _$FloodSimilarRuleParametersCopyWithImpl<$Res> implements $FloodSimilarRul @override $Res call({ Object? allowlist = freezed, + Object? minTextLength = freezed, Object? similarityDistance = freezed, Object? threshold = freezed, Object? timeWindow = freezed, @@ -93,6 +98,10 @@ class _$FloodSimilarRuleParametersCopyWithImpl<$Res> implements $FloodSimilarRul ? _self.allowlist : allowlist // ignore: cast_nullable_to_non_nullable as List?, + minTextLength: freezed == minTextLength + ? _self.minTextLength + : minTextLength // ignore: cast_nullable_to_non_nullable + as int?, similarityDistance: freezed == similarityDistance ? _self.similarityDistance : similarityDistance // ignore: cast_nullable_to_non_nullable diff --git a/packages/stream_chat/lib/open_api/model/flood_similar_rule_parameters.g.dart b/packages/stream_chat/lib/open_api/model/flood_similar_rule_parameters.g.dart index 6f0f3c7de3..68b1bdb6aa 100644 --- a/packages/stream_chat/lib/open_api/model/flood_similar_rule_parameters.g.dart +++ b/packages/stream_chat/lib/open_api/model/flood_similar_rule_parameters.g.dart @@ -10,6 +10,7 @@ FloodSimilarRuleParameters _$FloodSimilarRuleParametersFromJson( Map json, ) => FloodSimilarRuleParameters( allowlist: (json['allowlist'] as List?)?.map((e) => e as String).toList(), + minTextLength: (json['min_text_length'] as num?)?.toInt(), similarityDistance: (json['similarity_distance'] as num?)?.toInt(), threshold: (json['threshold'] as num?)?.toInt(), timeWindow: json['time_window'] as String?, @@ -19,6 +20,7 @@ Map _$FloodSimilarRuleParametersToJson( FloodSimilarRuleParameters instance, ) => { 'allowlist': instance.allowlist, + 'min_text_length': instance.minTextLength, 'similarity_distance': instance.similarityDistance, 'threshold': instance.threshold, 'time_window': instance.timeWindow, diff --git a/packages/stream_chat/lib/open_api/model/full_user_response.dart b/packages/stream_chat/lib/open_api/model/full_user_response.dart index 9031ae6d40..d6b844f1f3 100644 --- a/packages/stream_chat/lib/open_api/model/full_user_response.dart +++ b/packages/stream_chat/lib/open_api/model/full_user_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; @@ -165,6 +165,7 @@ class FullUserResponse with _$FullUserResponse { final int unreadChannels; @override + @Deprecated('Use totalUnreadCount instead.') @JsonKey(name: 'unread_count') final int unreadCount; diff --git a/packages/stream_chat/lib/open_api/model/future_channel_ban_response.dart b/packages/stream_chat/lib/open_api/model/future_channel_ban_response.dart index 9dcaa4c78c..67aaa5d4b7 100644 --- a/packages/stream_chat/lib/open_api/model/future_channel_ban_response.dart +++ b/packages/stream_chat/lib/open_api/model/future_channel_ban_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/get_action_config_response.dart b/packages/stream_chat/lib/open_api/model/get_action_config_response.dart index 8a29fc09d0..570cda6ecc 100644 --- a/packages/stream_chat/lib/open_api/model/get_action_config_response.dart +++ b/packages/stream_chat/lib/open_api/model/get_action_config_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/get_appeal_response.dart b/packages/stream_chat/lib/open_api/model/get_appeal_response.dart index cf25bf6780..8cb12b7a4e 100644 --- a/packages/stream_chat/lib/open_api/model/get_appeal_response.dart +++ b/packages/stream_chat/lib/open_api/model/get_appeal_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/get_application_response.dart b/packages/stream_chat/lib/open_api/model/get_application_response.dart index 893e1c7e4d..1454c5bc33 100644 --- a/packages/stream_chat/lib/open_api/model/get_application_response.dart +++ b/packages/stream_chat/lib/open_api/model/get_application_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/get_blocked_users_response.dart b/packages/stream_chat/lib/open_api/model/get_blocked_users_response.dart index db6b1d2353..9954175f2a 100644 --- a/packages/stream_chat/lib/open_api/model/get_blocked_users_response.dart +++ b/packages/stream_chat/lib/open_api/model/get_blocked_users_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/get_config_response.dart b/packages/stream_chat/lib/open_api/model/get_config_response.dart index 87de0a2d3e..73bc7015c9 100644 --- a/packages/stream_chat/lib/open_api/model/get_config_response.dart +++ b/packages/stream_chat/lib/open_api/model/get_config_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/get_draft_response.dart b/packages/stream_chat/lib/open_api/model/get_draft_response.dart index 8bac3a1d52..c45a7c638d 100644 --- a/packages/stream_chat/lib/open_api/model/get_draft_response.dart +++ b/packages/stream_chat/lib/open_api/model/get_draft_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/get_many_messages_response.dart b/packages/stream_chat/lib/open_api/model/get_many_messages_response.dart index 744b0a2e07..c5242242f6 100644 --- a/packages/stream_chat/lib/open_api/model/get_many_messages_response.dart +++ b/packages/stream_chat/lib/open_api/model/get_many_messages_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/get_message_response.dart b/packages/stream_chat/lib/open_api/model/get_message_response.dart index a0a8f26f1a..98f6b2f779 100644 --- a/packages/stream_chat/lib/open_api/model/get_message_response.dart +++ b/packages/stream_chat/lib/open_api/model/get_message_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/get_og_response.dart b/packages/stream_chat/lib/open_api/model/get_og_response.dart index 147ef00395..57398bdfe0 100644 --- a/packages/stream_chat/lib/open_api/model/get_og_response.dart +++ b/packages/stream_chat/lib/open_api/model/get_og_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/get_pinned_messages_response.dart b/packages/stream_chat/lib/open_api/model/get_pinned_messages_response.dart index 821e416020..2aa601f97a 100644 --- a/packages/stream_chat/lib/open_api/model/get_pinned_messages_response.dart +++ b/packages/stream_chat/lib/open_api/model/get_pinned_messages_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/get_reactions_response.dart b/packages/stream_chat/lib/open_api/model/get_reactions_response.dart index 50c1ac5374..f53f594a95 100644 --- a/packages/stream_chat/lib/open_api/model/get_reactions_response.dart +++ b/packages/stream_chat/lib/open_api/model/get_reactions_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/get_replies_response.dart b/packages/stream_chat/lib/open_api/model/get_replies_response.dart index be6abc33f3..4329c2e6aa 100644 --- a/packages/stream_chat/lib/open_api/model/get_replies_response.dart +++ b/packages/stream_chat/lib/open_api/model/get_replies_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/get_thread_response.dart b/packages/stream_chat/lib/open_api/model/get_thread_response.dart index e106b93502..09034d6ce9 100644 --- a/packages/stream_chat/lib/open_api/model/get_thread_response.dart +++ b/packages/stream_chat/lib/open_api/model/get_thread_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/get_user_group_response.dart b/packages/stream_chat/lib/open_api/model/get_user_group_response.dart index db2451f03a..c2a5de243b 100644 --- a/packages/stream_chat/lib/open_api/model/get_user_group_response.dart +++ b/packages/stream_chat/lib/open_api/model/get_user_group_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/google_vision_config.dart b/packages/stream_chat/lib/open_api/model/google_vision_config.dart index fa7d37766b..a104d25537 100644 --- a/packages/stream_chat/lib/open_api/model/google_vision_config.dart +++ b/packages/stream_chat/lib/open_api/model/google_vision_config.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/grouped_channels_bucket.dart b/packages/stream_chat/lib/open_api/model/grouped_channels_bucket.dart index 7c78dc1519..6b82f389ae 100644 --- a/packages/stream_chat/lib/open_api/model/grouped_channels_bucket.dart +++ b/packages/stream_chat/lib/open_api/model/grouped_channels_bucket.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/grouped_channels_group_request.dart b/packages/stream_chat/lib/open_api/model/grouped_channels_group_request.dart index b60d7faa9b..a0f64424f4 100644 --- a/packages/stream_chat/lib/open_api/model/grouped_channels_group_request.dart +++ b/packages/stream_chat/lib/open_api/model/grouped_channels_group_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/grouped_query_channels_request.dart b/packages/stream_chat/lib/open_api/model/grouped_query_channels_request.dart index d68ce2c02c..1767e9ceb9 100644 --- a/packages/stream_chat/lib/open_api/model/grouped_query_channels_request.dart +++ b/packages/stream_chat/lib/open_api/model/grouped_query_channels_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/grouped_query_channels_response.dart b/packages/stream_chat/lib/open_api/model/grouped_query_channels_response.dart index 1274b02beb..b56413e65e 100644 --- a/packages/stream_chat/lib/open_api/model/grouped_query_channels_response.dart +++ b/packages/stream_chat/lib/open_api/model/grouped_query_channels_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/harm_config.dart b/packages/stream_chat/lib/open_api/model/harm_config.dart index 16658229e8..a3d697a811 100644 --- a/packages/stream_chat/lib/open_api/model/harm_config.dart +++ b/packages/stream_chat/lib/open_api/model/harm_config.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/hide_channel_request.dart b/packages/stream_chat/lib/open_api/model/hide_channel_request.dart index 3a6b484daf..b15e3aaa62 100644 --- a/packages/stream_chat/lib/open_api/model/hide_channel_request.dart +++ b/packages/stream_chat/lib/open_api/model/hide_channel_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/hide_channel_response.dart b/packages/stream_chat/lib/open_api/model/hide_channel_response.dart index 2b88680711..8fc38f00d0 100644 --- a/packages/stream_chat/lib/open_api/model/hide_channel_response.dart +++ b/packages/stream_chat/lib/open_api/model/hide_channel_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/image_content_parameters.dart b/packages/stream_chat/lib/open_api/model/image_content_parameters.dart index 7b49956ba8..443ba30132 100644 --- a/packages/stream_chat/lib/open_api/model/image_content_parameters.dart +++ b/packages/stream_chat/lib/open_api/model/image_content_parameters.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/image_data.dart b/packages/stream_chat/lib/open_api/model/image_data.dart index 1894b4d4b1..04a8fa1605 100644 --- a/packages/stream_chat/lib/open_api/model/image_data.dart +++ b/packages/stream_chat/lib/open_api/model/image_data.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/image_rule_parameters.dart b/packages/stream_chat/lib/open_api/model/image_rule_parameters.dart index 260e3be95b..5072b737a8 100644 --- a/packages/stream_chat/lib/open_api/model/image_rule_parameters.dart +++ b/packages/stream_chat/lib/open_api/model/image_rule_parameters.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/image_size.dart b/packages/stream_chat/lib/open_api/model/image_size.dart index 61355c41f1..ecaee9724f 100644 --- a/packages/stream_chat/lib/open_api/model/image_size.dart +++ b/packages/stream_chat/lib/open_api/model/image_size.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/image_upload_request.dart b/packages/stream_chat/lib/open_api/model/image_upload_request.dart index ac33ec6d26..2643b701f5 100644 --- a/packages/stream_chat/lib/open_api/model/image_upload_request.dart +++ b/packages/stream_chat/lib/open_api/model/image_upload_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/image_upload_response.dart b/packages/stream_chat/lib/open_api/model/image_upload_response.dart index c2c5e736f3..dcef44a702 100644 --- a/packages/stream_chat/lib/open_api/model/image_upload_response.dart +++ b/packages/stream_chat/lib/open_api/model/image_upload_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/images.dart b/packages/stream_chat/lib/open_api/model/images.dart index 11cc77fe0e..50111e514f 100644 --- a/packages/stream_chat/lib/open_api/model/images.dart +++ b/packages/stream_chat/lib/open_api/model/images.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/import_block_list_request.dart b/packages/stream_chat/lib/open_api/model/import_block_list_request.dart index faaf2e1e7a..4119183894 100644 --- a/packages/stream_chat/lib/open_api/model/import_block_list_request.dart +++ b/packages/stream_chat/lib/open_api/model/import_block_list_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/import_block_list_response.dart b/packages/stream_chat/lib/open_api/model/import_block_list_response.dart index 27daaf76e2..c2665b684f 100644 --- a/packages/stream_chat/lib/open_api/model/import_block_list_response.dart +++ b/packages/stream_chat/lib/open_api/model/import_block_list_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/intent_config_request.dart b/packages/stream_chat/lib/open_api/model/intent_config_request.dart new file mode 100644 index 0000000000..6ba4e750a1 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/intent_config_request.dart @@ -0,0 +1,31 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'intent_config_request.g.dart'; +part 'intent_config_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class IntentConfigRequest with _$IntentConfigRequest { + const IntentConfigRequest({ + this.topics, + }); + + @override + @JsonKey(name: 'topics') + final List? topics; + + Map toJson() => _$IntentConfigRequestToJson(this); + + static IntentConfigRequest fromJson(Map json) => _$IntentConfigRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/intent_config_request.freezed.dart b/packages/stream_chat/lib/open_api/model/intent_config_request.freezed.dart new file mode 100644 index 0000000000..fec15f04df --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/intent_config_request.freezed.dart @@ -0,0 +1,76 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'intent_config_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$IntentConfigRequest { + List? get topics; + + /// Create a copy of IntentConfigRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $IntentConfigRequestCopyWith get copyWith => + _$IntentConfigRequestCopyWithImpl( + this as IntentConfigRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is IntentConfigRequest && + const DeepCollectionEquality().equals(other.topics, topics)); + } + + @override + int get hashCode => Object.hash(runtimeType, const DeepCollectionEquality().hash(topics)); + + @override + String toString() { + return 'IntentConfigRequest(topics: $topics)'; + } +} + +/// @nodoc +abstract mixin class $IntentConfigRequestCopyWith<$Res> { + factory $IntentConfigRequestCopyWith( + IntentConfigRequest value, + $Res Function(IntentConfigRequest) _then, + ) = _$IntentConfigRequestCopyWithImpl; + @useResult + $Res call({List? topics}); +} + +/// @nodoc +class _$IntentConfigRequestCopyWithImpl<$Res> implements $IntentConfigRequestCopyWith<$Res> { + _$IntentConfigRequestCopyWithImpl(this._self, this._then); + + final IntentConfigRequest _self; + final $Res Function(IntentConfigRequest) _then; + + /// Create a copy of IntentConfigRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? topics = freezed}) { + return _then( + IntentConfigRequest( + topics: freezed == topics + ? _self.topics + : topics // ignore: cast_nullable_to_non_nullable + as List?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/intent_config_request.g.dart b/packages/stream_chat/lib/open_api/model/intent_config_request.g.dart new file mode 100644 index 0000000000..e05376670e --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/intent_config_request.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'intent_config_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +IntentConfigRequest _$IntentConfigRequestFromJson(Map json) => IntentConfigRequest( + topics: (json['topics'] as List?) + ?.map((e) => IntentTopicRequest.fromJson(e as Map)) + .toList(), +); + +Map _$IntentConfigRequestToJson( + IntentConfigRequest instance, +) => { + 'topics': instance.topics?.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/intent_config_response.dart b/packages/stream_chat/lib/open_api/model/intent_config_response.dart new file mode 100644 index 0000000000..8e031029d2 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/intent_config_response.dart @@ -0,0 +1,31 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'intent_config_response.g.dart'; +part 'intent_config_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class IntentConfigResponse with _$IntentConfigResponse { + const IntentConfigResponse({ + required this.topics, + }); + + @override + @JsonKey(name: 'topics') + final List topics; + + Map toJson() => _$IntentConfigResponseToJson(this); + + static IntentConfigResponse fromJson(Map json) => _$IntentConfigResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/intent_config_response.freezed.dart b/packages/stream_chat/lib/open_api/model/intent_config_response.freezed.dart new file mode 100644 index 0000000000..d1c9092275 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/intent_config_response.freezed.dart @@ -0,0 +1,76 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'intent_config_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$IntentConfigResponse { + List get topics; + + /// Create a copy of IntentConfigResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $IntentConfigResponseCopyWith get copyWith => + _$IntentConfigResponseCopyWithImpl( + this as IntentConfigResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is IntentConfigResponse && + const DeepCollectionEquality().equals(other.topics, topics)); + } + + @override + int get hashCode => Object.hash(runtimeType, const DeepCollectionEquality().hash(topics)); + + @override + String toString() { + return 'IntentConfigResponse(topics: $topics)'; + } +} + +/// @nodoc +abstract mixin class $IntentConfigResponseCopyWith<$Res> { + factory $IntentConfigResponseCopyWith( + IntentConfigResponse value, + $Res Function(IntentConfigResponse) _then, + ) = _$IntentConfigResponseCopyWithImpl; + @useResult + $Res call({List topics}); +} + +/// @nodoc +class _$IntentConfigResponseCopyWithImpl<$Res> implements $IntentConfigResponseCopyWith<$Res> { + _$IntentConfigResponseCopyWithImpl(this._self, this._then); + + final IntentConfigResponse _self; + final $Res Function(IntentConfigResponse) _then; + + /// Create a copy of IntentConfigResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? topics = null}) { + return _then( + IntentConfigResponse( + topics: null == topics + ? _self.topics + : topics // ignore: cast_nullable_to_non_nullable + as List, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/intent_config_response.g.dart b/packages/stream_chat/lib/open_api/model/intent_config_response.g.dart new file mode 100644 index 0000000000..d24c272352 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/intent_config_response.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'intent_config_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +IntentConfigResponse _$IntentConfigResponseFromJson( + Map json, +) => IntentConfigResponse( + topics: (json['topics'] as List) + .map((e) => IntentTopicResponse.fromJson(e as Map)) + .toList(), +); + +Map _$IntentConfigResponseToJson( + IntentConfigResponse instance, +) => { + 'topics': instance.topics.map((e) => e.toJson()).toList(), +}; diff --git a/packages/stream_chat/lib/open_api/model/intent_topic_request.dart b/packages/stream_chat/lib/open_api/model/intent_topic_request.dart new file mode 100644 index 0000000000..e4297287ce --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/intent_topic_request.dart @@ -0,0 +1,61 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'intent_topic_request.g.dart'; +part 'intent_topic_request.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class IntentTopicRequest with _$IntentTopicRequest { + const IntentTopicRequest({ + this.analysisCooldownSeconds, + this.description, + this.enabled, + required this.label, + this.maxCapturedItems, + this.refireCooldownSeconds, + this.scoreThreshold, + }); + + @override + @JsonKey(name: 'analysis_cooldown_seconds') + final int? analysisCooldownSeconds; + + @override + @JsonKey(name: 'description') + final String? description; + + @override + @JsonKey(name: 'enabled') + final bool? enabled; + + @override + @JsonKey(name: 'label') + final String label; + + @override + @JsonKey(name: 'max_captured_items') + final int? maxCapturedItems; + + @override + @JsonKey(name: 'refire_cooldown_seconds') + final int? refireCooldownSeconds; + + @override + @JsonKey(name: 'score_threshold') + final double? scoreThreshold; + + Map toJson() => _$IntentTopicRequestToJson(this); + + static IntentTopicRequest fromJson(Map json) => _$IntentTopicRequestFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/intent_topic_request.freezed.dart b/packages/stream_chat/lib/open_api/model/intent_topic_request.freezed.dart new file mode 100644 index 0000000000..11e3c35d5b --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/intent_topic_request.freezed.dart @@ -0,0 +1,141 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'intent_topic_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$IntentTopicRequest { + int? get analysisCooldownSeconds; + String? get description; + bool? get enabled; + String get label; + int? get maxCapturedItems; + int? get refireCooldownSeconds; + double? get scoreThreshold; + + /// Create a copy of IntentTopicRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $IntentTopicRequestCopyWith get copyWith => _$IntentTopicRequestCopyWithImpl( + this as IntentTopicRequest, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is IntentTopicRequest && + (identical( + other.analysisCooldownSeconds, + analysisCooldownSeconds, + ) || + other.analysisCooldownSeconds == analysisCooldownSeconds) && + (identical(other.description, description) || other.description == description) && + (identical(other.enabled, enabled) || other.enabled == enabled) && + (identical(other.label, label) || other.label == label) && + (identical(other.maxCapturedItems, maxCapturedItems) || other.maxCapturedItems == maxCapturedItems) && + (identical(other.refireCooldownSeconds, refireCooldownSeconds) || + other.refireCooldownSeconds == refireCooldownSeconds) && + (identical(other.scoreThreshold, scoreThreshold) || other.scoreThreshold == scoreThreshold)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + analysisCooldownSeconds, + description, + enabled, + label, + maxCapturedItems, + refireCooldownSeconds, + scoreThreshold, + ); + + @override + String toString() { + return 'IntentTopicRequest(analysisCooldownSeconds: $analysisCooldownSeconds, description: $description, enabled: $enabled, label: $label, maxCapturedItems: $maxCapturedItems, refireCooldownSeconds: $refireCooldownSeconds, scoreThreshold: $scoreThreshold)'; + } +} + +/// @nodoc +abstract mixin class $IntentTopicRequestCopyWith<$Res> { + factory $IntentTopicRequestCopyWith( + IntentTopicRequest value, + $Res Function(IntentTopicRequest) _then, + ) = _$IntentTopicRequestCopyWithImpl; + @useResult + $Res call({ + int? analysisCooldownSeconds, + String? description, + bool? enabled, + String label, + int? maxCapturedItems, + int? refireCooldownSeconds, + double? scoreThreshold, + }); +} + +/// @nodoc +class _$IntentTopicRequestCopyWithImpl<$Res> implements $IntentTopicRequestCopyWith<$Res> { + _$IntentTopicRequestCopyWithImpl(this._self, this._then); + + final IntentTopicRequest _self; + final $Res Function(IntentTopicRequest) _then; + + /// Create a copy of IntentTopicRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? analysisCooldownSeconds = freezed, + Object? description = freezed, + Object? enabled = freezed, + Object? label = null, + Object? maxCapturedItems = freezed, + Object? refireCooldownSeconds = freezed, + Object? scoreThreshold = freezed, + }) { + return _then( + IntentTopicRequest( + analysisCooldownSeconds: freezed == analysisCooldownSeconds + ? _self.analysisCooldownSeconds + : analysisCooldownSeconds // ignore: cast_nullable_to_non_nullable + as int?, + description: freezed == description + ? _self.description + : description // ignore: cast_nullable_to_non_nullable + as String?, + enabled: freezed == enabled + ? _self.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool?, + label: null == label + ? _self.label + : label // ignore: cast_nullable_to_non_nullable + as String, + maxCapturedItems: freezed == maxCapturedItems + ? _self.maxCapturedItems + : maxCapturedItems // ignore: cast_nullable_to_non_nullable + as int?, + refireCooldownSeconds: freezed == refireCooldownSeconds + ? _self.refireCooldownSeconds + : refireCooldownSeconds // ignore: cast_nullable_to_non_nullable + as int?, + scoreThreshold: freezed == scoreThreshold + ? _self.scoreThreshold + : scoreThreshold // ignore: cast_nullable_to_non_nullable + as double?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/intent_topic_request.g.dart b/packages/stream_chat/lib/open_api/model/intent_topic_request.g.dart new file mode 100644 index 0000000000..57605181f5 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/intent_topic_request.g.dart @@ -0,0 +1,27 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'intent_topic_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +IntentTopicRequest _$IntentTopicRequestFromJson(Map json) => IntentTopicRequest( + analysisCooldownSeconds: (json['analysis_cooldown_seconds'] as num?)?.toInt(), + description: json['description'] as String?, + enabled: json['enabled'] as bool?, + label: json['label'] as String, + maxCapturedItems: (json['max_captured_items'] as num?)?.toInt(), + refireCooldownSeconds: (json['refire_cooldown_seconds'] as num?)?.toInt(), + scoreThreshold: (json['score_threshold'] as num?)?.toDouble(), +); + +Map _$IntentTopicRequestToJson(IntentTopicRequest instance) => { + 'analysis_cooldown_seconds': instance.analysisCooldownSeconds, + 'description': instance.description, + 'enabled': instance.enabled, + 'label': instance.label, + 'max_captured_items': instance.maxCapturedItems, + 'refire_cooldown_seconds': instance.refireCooldownSeconds, + 'score_threshold': instance.scoreThreshold, +}; diff --git a/packages/stream_chat/lib/open_api/model/intent_topic_response.dart b/packages/stream_chat/lib/open_api/model/intent_topic_response.dart new file mode 100644 index 0000000000..953c35fa26 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/intent_topic_response.dart @@ -0,0 +1,61 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'intent_topic_response.g.dart'; +part 'intent_topic_response.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class IntentTopicResponse with _$IntentTopicResponse { + const IntentTopicResponse({ + required this.analysisCooldownSeconds, + this.description, + required this.enabled, + required this.label, + required this.maxCapturedItems, + this.refireCooldownSeconds, + required this.scoreThreshold, + }); + + @override + @JsonKey(name: 'analysis_cooldown_seconds') + final int analysisCooldownSeconds; + + @override + @JsonKey(name: 'description') + final String? description; + + @override + @JsonKey(name: 'enabled') + final bool enabled; + + @override + @JsonKey(name: 'label') + final String label; + + @override + @JsonKey(name: 'max_captured_items') + final int maxCapturedItems; + + @override + @JsonKey(name: 'refire_cooldown_seconds') + final int? refireCooldownSeconds; + + @override + @JsonKey(name: 'score_threshold') + final double scoreThreshold; + + Map toJson() => _$IntentTopicResponseToJson(this); + + static IntentTopicResponse fromJson(Map json) => _$IntentTopicResponseFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/intent_topic_response.freezed.dart b/packages/stream_chat/lib/open_api/model/intent_topic_response.freezed.dart new file mode 100644 index 0000000000..d14f8f13e4 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/intent_topic_response.freezed.dart @@ -0,0 +1,142 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'intent_topic_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$IntentTopicResponse { + int get analysisCooldownSeconds; + String? get description; + bool get enabled; + String get label; + int get maxCapturedItems; + int? get refireCooldownSeconds; + double get scoreThreshold; + + /// Create a copy of IntentTopicResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $IntentTopicResponseCopyWith get copyWith => + _$IntentTopicResponseCopyWithImpl( + this as IntentTopicResponse, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is IntentTopicResponse && + (identical( + other.analysisCooldownSeconds, + analysisCooldownSeconds, + ) || + other.analysisCooldownSeconds == analysisCooldownSeconds) && + (identical(other.description, description) || other.description == description) && + (identical(other.enabled, enabled) || other.enabled == enabled) && + (identical(other.label, label) || other.label == label) && + (identical(other.maxCapturedItems, maxCapturedItems) || other.maxCapturedItems == maxCapturedItems) && + (identical(other.refireCooldownSeconds, refireCooldownSeconds) || + other.refireCooldownSeconds == refireCooldownSeconds) && + (identical(other.scoreThreshold, scoreThreshold) || other.scoreThreshold == scoreThreshold)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + analysisCooldownSeconds, + description, + enabled, + label, + maxCapturedItems, + refireCooldownSeconds, + scoreThreshold, + ); + + @override + String toString() { + return 'IntentTopicResponse(analysisCooldownSeconds: $analysisCooldownSeconds, description: $description, enabled: $enabled, label: $label, maxCapturedItems: $maxCapturedItems, refireCooldownSeconds: $refireCooldownSeconds, scoreThreshold: $scoreThreshold)'; + } +} + +/// @nodoc +abstract mixin class $IntentTopicResponseCopyWith<$Res> { + factory $IntentTopicResponseCopyWith( + IntentTopicResponse value, + $Res Function(IntentTopicResponse) _then, + ) = _$IntentTopicResponseCopyWithImpl; + @useResult + $Res call({ + int analysisCooldownSeconds, + String? description, + bool enabled, + String label, + int maxCapturedItems, + int? refireCooldownSeconds, + double scoreThreshold, + }); +} + +/// @nodoc +class _$IntentTopicResponseCopyWithImpl<$Res> implements $IntentTopicResponseCopyWith<$Res> { + _$IntentTopicResponseCopyWithImpl(this._self, this._then); + + final IntentTopicResponse _self; + final $Res Function(IntentTopicResponse) _then; + + /// Create a copy of IntentTopicResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? analysisCooldownSeconds = null, + Object? description = freezed, + Object? enabled = null, + Object? label = null, + Object? maxCapturedItems = null, + Object? refireCooldownSeconds = freezed, + Object? scoreThreshold = null, + }) { + return _then( + IntentTopicResponse( + analysisCooldownSeconds: null == analysisCooldownSeconds + ? _self.analysisCooldownSeconds + : analysisCooldownSeconds // ignore: cast_nullable_to_non_nullable + as int, + description: freezed == description + ? _self.description + : description // ignore: cast_nullable_to_non_nullable + as String?, + enabled: null == enabled + ? _self.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool, + label: null == label + ? _self.label + : label // ignore: cast_nullable_to_non_nullable + as String, + maxCapturedItems: null == maxCapturedItems + ? _self.maxCapturedItems + : maxCapturedItems // ignore: cast_nullable_to_non_nullable + as int, + refireCooldownSeconds: freezed == refireCooldownSeconds + ? _self.refireCooldownSeconds + : refireCooldownSeconds // ignore: cast_nullable_to_non_nullable + as int?, + scoreThreshold: null == scoreThreshold + ? _self.scoreThreshold + : scoreThreshold // ignore: cast_nullable_to_non_nullable + as double, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/intent_topic_response.g.dart b/packages/stream_chat/lib/open_api/model/intent_topic_response.g.dart new file mode 100644 index 0000000000..7538b3dd67 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/intent_topic_response.g.dart @@ -0,0 +1,29 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'intent_topic_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +IntentTopicResponse _$IntentTopicResponseFromJson(Map json) => IntentTopicResponse( + analysisCooldownSeconds: (json['analysis_cooldown_seconds'] as num).toInt(), + description: json['description'] as String?, + enabled: json['enabled'] as bool, + label: json['label'] as String, + maxCapturedItems: (json['max_captured_items'] as num).toInt(), + refireCooldownSeconds: (json['refire_cooldown_seconds'] as num?)?.toInt(), + scoreThreshold: (json['score_threshold'] as num).toDouble(), +); + +Map _$IntentTopicResponseToJson( + IntentTopicResponse instance, +) => { + 'analysis_cooldown_seconds': instance.analysisCooldownSeconds, + 'description': instance.description, + 'enabled': instance.enabled, + 'label': instance.label, + 'max_captured_items': instance.maxCapturedItems, + 'refire_cooldown_seconds': instance.refireCooldownSeconds, + 'score_threshold': instance.scoreThreshold, +}; diff --git a/packages/stream_chat/lib/open_api/model/ip_content_count_rule_parameters.dart b/packages/stream_chat/lib/open_api/model/ip_content_count_rule_parameters.dart index b44e932de7..9e6d51e7bb 100644 --- a/packages/stream_chat/lib/open_api/model/ip_content_count_rule_parameters.dart +++ b/packages/stream_chat/lib/open_api/model/ip_content_count_rule_parameters.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/ip_flag_count_rule_parameters.dart b/packages/stream_chat/lib/open_api/model/ip_flag_count_rule_parameters.dart index 8799e61b4e..e1c0c30323 100644 --- a/packages/stream_chat/lib/open_api/model/ip_flag_count_rule_parameters.dart +++ b/packages/stream_chat/lib/open_api/model/ip_flag_count_rule_parameters.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/keyframe_ocr_rule_parameters.dart b/packages/stream_chat/lib/open_api/model/keyframe_ocr_rule_parameters.dart index 91512186f7..33e1d3ac3e 100644 --- a/packages/stream_chat/lib/open_api/model/keyframe_ocr_rule_parameters.dart +++ b/packages/stream_chat/lib/open_api/model/keyframe_ocr_rule_parameters.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/keyframe_rule_parameters.dart b/packages/stream_chat/lib/open_api/model/keyframe_rule_parameters.dart index 327fda3941..3d5a6193c6 100644 --- a/packages/stream_chat/lib/open_api/model/keyframe_rule_parameters.dart +++ b/packages/stream_chat/lib/open_api/model/keyframe_rule_parameters.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/label_response.dart b/packages/stream_chat/lib/open_api/model/label_response.dart index 67428f625f..0033275727 100644 --- a/packages/stream_chat/lib/open_api/model/label_response.dart +++ b/packages/stream_chat/lib/open_api/model/label_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/label_thresholds.dart b/packages/stream_chat/lib/open_api/model/label_thresholds.dart index be5bee259d..c95ca870f9 100644 --- a/packages/stream_chat/lib/open_api/model/label_thresholds.dart +++ b/packages/stream_chat/lib/open_api/model/label_thresholds.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/list_block_list_response.dart b/packages/stream_chat/lib/open_api/model/list_block_list_response.dart index eca6807095..e634847383 100644 --- a/packages/stream_chat/lib/open_api/model/list_block_list_response.dart +++ b/packages/stream_chat/lib/open_api/model/list_block_list_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/list_devices_response.dart b/packages/stream_chat/lib/open_api/model/list_devices_response.dart index ef18ccf808..3f4c1a18fb 100644 --- a/packages/stream_chat/lib/open_api/model/list_devices_response.dart +++ b/packages/stream_chat/lib/open_api/model/list_devices_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/list_queues_response.dart b/packages/stream_chat/lib/open_api/model/list_queues_response.dart index c7e0e8e580..9628898669 100644 --- a/packages/stream_chat/lib/open_api/model/list_queues_response.dart +++ b/packages/stream_chat/lib/open_api/model/list_queues_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/list_user_groups_response.dart b/packages/stream_chat/lib/open_api/model/list_user_groups_response.dart index f7952dddbd..5ef879dc8b 100644 --- a/packages/stream_chat/lib/open_api/model/list_user_groups_response.dart +++ b/packages/stream_chat/lib/open_api/model/list_user_groups_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/llm_config.dart b/packages/stream_chat/lib/open_api/model/llm_config.dart index 175ff6f779..c345ec8410 100644 --- a/packages/stream_chat/lib/open_api/model/llm_config.dart +++ b/packages/stream_chat/lib/open_api/model/llm_config.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/llm_rule.dart b/packages/stream_chat/lib/open_api/model/llm_rule.dart index 2e869f2861..d24738c762 100644 --- a/packages/stream_chat/lib/open_api/model/llm_rule.dart +++ b/packages/stream_chat/lib/open_api/model/llm_rule.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/mark_channels_read_request.dart b/packages/stream_chat/lib/open_api/model/mark_channels_read_request.dart index 1639576383..f08ce7eacd 100644 --- a/packages/stream_chat/lib/open_api/model/mark_channels_read_request.dart +++ b/packages/stream_chat/lib/open_api/model/mark_channels_read_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/mark_delivered_request.dart b/packages/stream_chat/lib/open_api/model/mark_delivered_request.dart index 54c6925f48..43b219a7d7 100644 --- a/packages/stream_chat/lib/open_api/model/mark_delivered_request.dart +++ b/packages/stream_chat/lib/open_api/model/mark_delivered_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/mark_delivered_response.dart b/packages/stream_chat/lib/open_api/model/mark_delivered_response.dart index bc20f4a7b2..fc3882fa2b 100644 --- a/packages/stream_chat/lib/open_api/model/mark_delivered_response.dart +++ b/packages/stream_chat/lib/open_api/model/mark_delivered_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/mark_read_request.dart b/packages/stream_chat/lib/open_api/model/mark_read_request.dart index 8a6c8ce2ad..a3c25c7bd5 100644 --- a/packages/stream_chat/lib/open_api/model/mark_read_request.dart +++ b/packages/stream_chat/lib/open_api/model/mark_read_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/mark_read_response.dart b/packages/stream_chat/lib/open_api/model/mark_read_response.dart index 5e88ca7143..8f67257750 100644 --- a/packages/stream_chat/lib/open_api/model/mark_read_response.dart +++ b/packages/stream_chat/lib/open_api/model/mark_read_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/mark_read_response_event.dart b/packages/stream_chat/lib/open_api/model/mark_read_response_event.dart index d6c4bfe552..14aedb3ea1 100644 --- a/packages/stream_chat/lib/open_api/model/mark_read_response_event.dart +++ b/packages/stream_chat/lib/open_api/model/mark_read_response_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/mark_reviewed_request_payload.dart b/packages/stream_chat/lib/open_api/model/mark_reviewed_request_payload.dart index 6ee817d3f0..70d7e5b8e3 100644 --- a/packages/stream_chat/lib/open_api/model/mark_reviewed_request_payload.dart +++ b/packages/stream_chat/lib/open_api/model/mark_reviewed_request_payload.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/mark_unread_request.dart b/packages/stream_chat/lib/open_api/model/mark_unread_request.dart index 83e62df858..3b9c8528be 100644 --- a/packages/stream_chat/lib/open_api/model/mark_unread_request.dart +++ b/packages/stream_chat/lib/open_api/model/mark_unread_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/max_streak_changed_event.dart b/packages/stream_chat/lib/open_api/model/max_streak_changed_event.dart index 3c84442f2d..232d224af7 100644 --- a/packages/stream_chat/lib/open_api/model/max_streak_changed_event.dart +++ b/packages/stream_chat/lib/open_api/model/max_streak_changed_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/member_added_event.dart b/packages/stream_chat/lib/open_api/model/member_added_event.dart index 51356e20c3..7e594916f6 100644 --- a/packages/stream_chat/lib/open_api/model/member_added_event.dart +++ b/packages/stream_chat/lib/open_api/model/member_added_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/member_removed_event.dart b/packages/stream_chat/lib/open_api/model/member_removed_event.dart index e67536ad2e..89cc71eec1 100644 --- a/packages/stream_chat/lib/open_api/model/member_removed_event.dart +++ b/packages/stream_chat/lib/open_api/model/member_removed_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/member_updated_event.dart b/packages/stream_chat/lib/open_api/model/member_updated_event.dart index 4105dc0f5f..0b61b8589f 100644 --- a/packages/stream_chat/lib/open_api/model/member_updated_event.dart +++ b/packages/stream_chat/lib/open_api/model/member_updated_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/member_user_request.dart b/packages/stream_chat/lib/open_api/model/member_user_request.dart index 0faed382fc..7b8a0ae314 100644 --- a/packages/stream_chat/lib/open_api/model/member_user_request.dart +++ b/packages/stream_chat/lib/open_api/model/member_user_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/members_response.dart b/packages/stream_chat/lib/open_api/model/members_response.dart index cc15628523..cfe4ea6759 100644 --- a/packages/stream_chat/lib/open_api/model/members_response.dart +++ b/packages/stream_chat/lib/open_api/model/members_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/message_action_request.dart b/packages/stream_chat/lib/open_api/model/message_action_request.dart index 07e3aae81a..41195d2b10 100644 --- a/packages/stream_chat/lib/open_api/model/message_action_request.dart +++ b/packages/stream_chat/lib/open_api/model/message_action_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/message_action_response.dart b/packages/stream_chat/lib/open_api/model/message_action_response.dart index 4b323c61c1..ffe65cd39c 100644 --- a/packages/stream_chat/lib/open_api/model/message_action_response.dart +++ b/packages/stream_chat/lib/open_api/model/message_action_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/message_change_set.dart b/packages/stream_chat/lib/open_api/model/message_change_set.dart index dc894ff466..16735f1583 100644 --- a/packages/stream_chat/lib/open_api/model/message_change_set.dart +++ b/packages/stream_chat/lib/open_api/model/message_change_set.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/message_deleted_event.dart b/packages/stream_chat/lib/open_api/model/message_deleted_event.dart index 8a9e7fcd5a..55d40059b2 100644 --- a/packages/stream_chat/lib/open_api/model/message_deleted_event.dart +++ b/packages/stream_chat/lib/open_api/model/message_deleted_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/message_delivered_event.dart b/packages/stream_chat/lib/open_api/model/message_delivered_event.dart index fa682eee33..8336aea797 100644 --- a/packages/stream_chat/lib/open_api/model/message_delivered_event.dart +++ b/packages/stream_chat/lib/open_api/model/message_delivered_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/message_flag_response.dart b/packages/stream_chat/lib/open_api/model/message_flag_response.dart index 0434f33b7c..96db144881 100644 --- a/packages/stream_chat/lib/open_api/model/message_flag_response.dart +++ b/packages/stream_chat/lib/open_api/model/message_flag_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/message_moderation_result.dart b/packages/stream_chat/lib/open_api/model/message_moderation_result.dart index da93ee4223..1e07d299f5 100644 --- a/packages/stream_chat/lib/open_api/model/message_moderation_result.dart +++ b/packages/stream_chat/lib/open_api/model/message_moderation_result.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/message_new_event.dart b/packages/stream_chat/lib/open_api/model/message_new_event.dart index 124a8cdc32..c7ec851774 100644 --- a/packages/stream_chat/lib/open_api/model/message_new_event.dart +++ b/packages/stream_chat/lib/open_api/model/message_new_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/message_options.dart b/packages/stream_chat/lib/open_api/model/message_options.dart index db31d6df0a..73033ce271 100644 --- a/packages/stream_chat/lib/open_api/model/message_options.dart +++ b/packages/stream_chat/lib/open_api/model/message_options.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/message_pagination_params.dart b/packages/stream_chat/lib/open_api/model/message_pagination_params.dart index 5c7c8f770c..bc1ec251d6 100644 --- a/packages/stream_chat/lib/open_api/model/message_pagination_params.dart +++ b/packages/stream_chat/lib/open_api/model/message_pagination_params.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/message_read_event.dart b/packages/stream_chat/lib/open_api/model/message_read_event.dart index b78b39c885..7d81adb111 100644 --- a/packages/stream_chat/lib/open_api/model/message_read_event.dart +++ b/packages/stream_chat/lib/open_api/model/message_read_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/message_request.dart b/packages/stream_chat/lib/open_api/model/message_request.dart index da729c19fe..8ab846cd2c 100644 --- a/packages/stream_chat/lib/open_api/model/message_request.dart +++ b/packages/stream_chat/lib/open_api/model/message_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/message_response.dart b/packages/stream_chat/lib/open_api/model/message_response.dart index a2826dbcdb..d4c350c902 100644 --- a/packages/stream_chat/lib/open_api/model/message_response.dart +++ b/packages/stream_chat/lib/open_api/model/message_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/message_undeleted_event.dart b/packages/stream_chat/lib/open_api/model/message_undeleted_event.dart index 18bce36dcd..54dffe78a2 100644 --- a/packages/stream_chat/lib/open_api/model/message_undeleted_event.dart +++ b/packages/stream_chat/lib/open_api/model/message_undeleted_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/message_update.dart b/packages/stream_chat/lib/open_api/model/message_update.dart index 8451f33aff..1a9e615741 100644 --- a/packages/stream_chat/lib/open_api/model/message_update.dart +++ b/packages/stream_chat/lib/open_api/model/message_update.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/message_updated_event.dart b/packages/stream_chat/lib/open_api/model/message_updated_event.dart index e3040fa71a..5fe4f2d617 100644 --- a/packages/stream_chat/lib/open_api/model/message_updated_event.dart +++ b/packages/stream_chat/lib/open_api/model/message_updated_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/message_with_channel_response.dart b/packages/stream_chat/lib/open_api/model/message_with_channel_response.dart index 898bb7b37f..4a52c83687 100644 --- a/packages/stream_chat/lib/open_api/model/message_with_channel_response.dart +++ b/packages/stream_chat/lib/open_api/model/message_with_channel_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/moderation_action_config_response.dart b/packages/stream_chat/lib/open_api/model/moderation_action_config_response.dart index d3c105f3ab..442bf21ad2 100644 --- a/packages/stream_chat/lib/open_api/model/moderation_action_config_response.dart +++ b/packages/stream_chat/lib/open_api/model/moderation_action_config_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/moderation_ban_response.dart b/packages/stream_chat/lib/open_api/model/moderation_ban_response.dart index 0a7ba432fe..b3c17d9590 100644 --- a/packages/stream_chat/lib/open_api/model/moderation_ban_response.dart +++ b/packages/stream_chat/lib/open_api/model/moderation_ban_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/moderation_call_response.dart b/packages/stream_chat/lib/open_api/model/moderation_call_response.dart index a5e523e542..d8e7fcb2d9 100644 --- a/packages/stream_chat/lib/open_api/model/moderation_call_response.dart +++ b/packages/stream_chat/lib/open_api/model/moderation_call_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/moderation_custom_action_event.dart b/packages/stream_chat/lib/open_api/model/moderation_custom_action_event.dart index 1ebf19770a..e5c5bfef2f 100644 --- a/packages/stream_chat/lib/open_api/model/moderation_custom_action_event.dart +++ b/packages/stream_chat/lib/open_api/model/moderation_custom_action_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/moderation_flag_response.dart b/packages/stream_chat/lib/open_api/model/moderation_flag_response.dart index ca82630a53..f86cb73189 100644 --- a/packages/stream_chat/lib/open_api/model/moderation_flag_response.dart +++ b/packages/stream_chat/lib/open_api/model/moderation_flag_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/moderation_flagged_event.dart b/packages/stream_chat/lib/open_api/model/moderation_flagged_event.dart index 7fe5615200..a088f03546 100644 --- a/packages/stream_chat/lib/open_api/model/moderation_flagged_event.dart +++ b/packages/stream_chat/lib/open_api/model/moderation_flagged_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/moderation_mark_reviewed_event.dart b/packages/stream_chat/lib/open_api/model/moderation_mark_reviewed_event.dart index a841e49f26..8814513add 100644 --- a/packages/stream_chat/lib/open_api/model/moderation_mark_reviewed_event.dart +++ b/packages/stream_chat/lib/open_api/model/moderation_mark_reviewed_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/moderation_payload.dart b/packages/stream_chat/lib/open_api/model/moderation_payload.dart index 9a58f591e0..0eaa208e62 100644 --- a/packages/stream_chat/lib/open_api/model/moderation_payload.dart +++ b/packages/stream_chat/lib/open_api/model/moderation_payload.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/moderation_payload_response.dart b/packages/stream_chat/lib/open_api/model/moderation_payload_response.dart index e075ce946a..3fd532acd3 100644 --- a/packages/stream_chat/lib/open_api/model/moderation_payload_response.dart +++ b/packages/stream_chat/lib/open_api/model/moderation_payload_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/moderation_queue_response.dart b/packages/stream_chat/lib/open_api/model/moderation_queue_response.dart index 7c173649bb..8ff65c1bbb 100644 --- a/packages/stream_chat/lib/open_api/model/moderation_queue_response.dart +++ b/packages/stream_chat/lib/open_api/model/moderation_queue_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/moderation_response.dart b/packages/stream_chat/lib/open_api/model/moderation_response.dart index f562e0637a..00a27933d0 100644 --- a/packages/stream_chat/lib/open_api/model/moderation_response.dart +++ b/packages/stream_chat/lib/open_api/model/moderation_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/moderation_v2_response.dart b/packages/stream_chat/lib/open_api/model/moderation_v2_response.dart index 5c1544b8be..7103bb9549 100644 --- a/packages/stream_chat/lib/open_api/model/moderation_v2_response.dart +++ b/packages/stream_chat/lib/open_api/model/moderation_v2_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/mute_channel_request.dart b/packages/stream_chat/lib/open_api/model/mute_channel_request.dart index be4aabfceb..fa15466043 100644 --- a/packages/stream_chat/lib/open_api/model/mute_channel_request.dart +++ b/packages/stream_chat/lib/open_api/model/mute_channel_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/mute_channel_response.dart b/packages/stream_chat/lib/open_api/model/mute_channel_response.dart index 066bfeac9a..e8e6e06a3a 100644 --- a/packages/stream_chat/lib/open_api/model/mute_channel_response.dart +++ b/packages/stream_chat/lib/open_api/model/mute_channel_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/mute_request.dart b/packages/stream_chat/lib/open_api/model/mute_request.dart index 5608503ffb..3e0e2a9d1c 100644 --- a/packages/stream_chat/lib/open_api/model/mute_request.dart +++ b/packages/stream_chat/lib/open_api/model/mute_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/mute_response.dart b/packages/stream_chat/lib/open_api/model/mute_response.dart index f9eede2862..76328a875a 100644 --- a/packages/stream_chat/lib/open_api/model/mute_response.dart +++ b/packages/stream_chat/lib/open_api/model/mute_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/notification_added_to_channel_event.dart b/packages/stream_chat/lib/open_api/model/notification_added_to_channel_event.dart index e26ab1f383..4eed2455f5 100644 --- a/packages/stream_chat/lib/open_api/model/notification_added_to_channel_event.dart +++ b/packages/stream_chat/lib/open_api/model/notification_added_to_channel_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/notification_channel_deleted_event.dart b/packages/stream_chat/lib/open_api/model/notification_channel_deleted_event.dart index 21c2e609b1..5a136bfee2 100644 --- a/packages/stream_chat/lib/open_api/model/notification_channel_deleted_event.dart +++ b/packages/stream_chat/lib/open_api/model/notification_channel_deleted_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/notification_channel_mutes_updated_event.dart b/packages/stream_chat/lib/open_api/model/notification_channel_mutes_updated_event.dart index 48208ab996..5414756c5d 100644 --- a/packages/stream_chat/lib/open_api/model/notification_channel_mutes_updated_event.dart +++ b/packages/stream_chat/lib/open_api/model/notification_channel_mutes_updated_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/notification_channel_truncated_event.dart b/packages/stream_chat/lib/open_api/model/notification_channel_truncated_event.dart index cec3bf4557..937cfe4b5f 100644 --- a/packages/stream_chat/lib/open_api/model/notification_channel_truncated_event.dart +++ b/packages/stream_chat/lib/open_api/model/notification_channel_truncated_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/notification_invite_accepted_event.dart b/packages/stream_chat/lib/open_api/model/notification_invite_accepted_event.dart index cddf2b983d..06a4754a09 100644 --- a/packages/stream_chat/lib/open_api/model/notification_invite_accepted_event.dart +++ b/packages/stream_chat/lib/open_api/model/notification_invite_accepted_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/notification_invite_rejected_event.dart b/packages/stream_chat/lib/open_api/model/notification_invite_rejected_event.dart index fa841cc1a6..e642630f59 100644 --- a/packages/stream_chat/lib/open_api/model/notification_invite_rejected_event.dart +++ b/packages/stream_chat/lib/open_api/model/notification_invite_rejected_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/notification_invited_event.dart b/packages/stream_chat/lib/open_api/model/notification_invited_event.dart index ab238ee0f9..4cab56b5d3 100644 --- a/packages/stream_chat/lib/open_api/model/notification_invited_event.dart +++ b/packages/stream_chat/lib/open_api/model/notification_invited_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/notification_mark_read_event.dart b/packages/stream_chat/lib/open_api/model/notification_mark_read_event.dart index 73b6719837..d7ffc15661 100644 --- a/packages/stream_chat/lib/open_api/model/notification_mark_read_event.dart +++ b/packages/stream_chat/lib/open_api/model/notification_mark_read_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/notification_mark_unread_event.dart b/packages/stream_chat/lib/open_api/model/notification_mark_unread_event.dart index c4e2664132..39cdc96f5d 100644 --- a/packages/stream_chat/lib/open_api/model/notification_mark_unread_event.dart +++ b/packages/stream_chat/lib/open_api/model/notification_mark_unread_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/notification_mutes_updated_event.dart b/packages/stream_chat/lib/open_api/model/notification_mutes_updated_event.dart index e914622c6d..9063b0d91e 100644 --- a/packages/stream_chat/lib/open_api/model/notification_mutes_updated_event.dart +++ b/packages/stream_chat/lib/open_api/model/notification_mutes_updated_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/notification_new_message_event.dart b/packages/stream_chat/lib/open_api/model/notification_new_message_event.dart index 6fc9fad4fe..bd4014fbad 100644 --- a/packages/stream_chat/lib/open_api/model/notification_new_message_event.dart +++ b/packages/stream_chat/lib/open_api/model/notification_new_message_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/notification_removed_from_channel_event.dart b/packages/stream_chat/lib/open_api/model/notification_removed_from_channel_event.dart index 23ef78b09c..0fd4b82c80 100644 --- a/packages/stream_chat/lib/open_api/model/notification_removed_from_channel_event.dart +++ b/packages/stream_chat/lib/open_api/model/notification_removed_from_channel_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/notification_thread_message_new_event.dart b/packages/stream_chat/lib/open_api/model/notification_thread_message_new_event.dart index 3702a4e258..b74ca709f9 100644 --- a/packages/stream_chat/lib/open_api/model/notification_thread_message_new_event.dart +++ b/packages/stream_chat/lib/open_api/model/notification_thread_message_new_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/ocr_content_parameters.dart b/packages/stream_chat/lib/open_api/model/ocr_content_parameters.dart index 07838b3b21..8e47dbc58d 100644 --- a/packages/stream_chat/lib/open_api/model/ocr_content_parameters.dart +++ b/packages/stream_chat/lib/open_api/model/ocr_content_parameters.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/ocr_rule.dart b/packages/stream_chat/lib/open_api/model/ocr_rule.dart index 48c863d19d..a2a5ccba7f 100644 --- a/packages/stream_chat/lib/open_api/model/ocr_rule.dart +++ b/packages/stream_chat/lib/open_api/model/ocr_rule.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/only_user_id.dart b/packages/stream_chat/lib/open_api/model/only_user_id.dart index 2a1ff01bb2..00de47a97a 100644 --- a/packages/stream_chat/lib/open_api/model/only_user_id.dart +++ b/packages/stream_chat/lib/open_api/model/only_user_id.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/own_user_response.dart b/packages/stream_chat/lib/open_api/model/own_user_response.dart index bebb607fd5..7469256304 100644 --- a/packages/stream_chat/lib/open_api/model/own_user_response.dart +++ b/packages/stream_chat/lib/open_api/model/own_user_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; @@ -164,6 +164,7 @@ class OwnUserResponse with _$OwnUserResponse { final int unreadChannels; @override + @Deprecated('Use totalUnreadCount instead.') @JsonKey(name: 'unread_count') final int unreadCount; diff --git a/packages/stream_chat/lib/open_api/model/pagination_params.dart b/packages/stream_chat/lib/open_api/model/pagination_params.dart index bde9a1510e..80bc99e0cc 100644 --- a/packages/stream_chat/lib/open_api/model/pagination_params.dart +++ b/packages/stream_chat/lib/open_api/model/pagination_params.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/parsed_predefined_filter_response.dart b/packages/stream_chat/lib/open_api/model/parsed_predefined_filter_response.dart index 9ee4e8eb3e..d97d4a8011 100644 --- a/packages/stream_chat/lib/open_api/model/parsed_predefined_filter_response.dart +++ b/packages/stream_chat/lib/open_api/model/parsed_predefined_filter_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/pending_message_event.dart b/packages/stream_chat/lib/open_api/model/pending_message_event.dart index 7fd5d0c8b7..8a9d56ddce 100644 --- a/packages/stream_chat/lib/open_api/model/pending_message_event.dart +++ b/packages/stream_chat/lib/open_api/model/pending_message_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/pending_message_response.dart b/packages/stream_chat/lib/open_api/model/pending_message_response.dart index 759214c061..6de3ff19fb 100644 --- a/packages/stream_chat/lib/open_api/model/pending_message_response.dart +++ b/packages/stream_chat/lib/open_api/model/pending_message_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/poll_closed_event.dart b/packages/stream_chat/lib/open_api/model/poll_closed_event.dart index 7e235b5da9..e583df4570 100644 --- a/packages/stream_chat/lib/open_api/model/poll_closed_event.dart +++ b/packages/stream_chat/lib/open_api/model/poll_closed_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/poll_deleted_event.dart b/packages/stream_chat/lib/open_api/model/poll_deleted_event.dart index b5a6da96d8..3193668e52 100644 --- a/packages/stream_chat/lib/open_api/model/poll_deleted_event.dart +++ b/packages/stream_chat/lib/open_api/model/poll_deleted_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/poll_option_input.dart b/packages/stream_chat/lib/open_api/model/poll_option_input.dart index 8807668e65..e930a2ac4c 100644 --- a/packages/stream_chat/lib/open_api/model/poll_option_input.dart +++ b/packages/stream_chat/lib/open_api/model/poll_option_input.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/poll_option_request.dart b/packages/stream_chat/lib/open_api/model/poll_option_request.dart index 2de85d6a69..d6192c0ac5 100644 --- a/packages/stream_chat/lib/open_api/model/poll_option_request.dart +++ b/packages/stream_chat/lib/open_api/model/poll_option_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/poll_option_response.dart b/packages/stream_chat/lib/open_api/model/poll_option_response.dart index c7956f0b47..6ffbed168f 100644 --- a/packages/stream_chat/lib/open_api/model/poll_option_response.dart +++ b/packages/stream_chat/lib/open_api/model/poll_option_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/poll_option_response_data.dart b/packages/stream_chat/lib/open_api/model/poll_option_response_data.dart index ed087d4c0e..5da55e7707 100644 --- a/packages/stream_chat/lib/open_api/model/poll_option_response_data.dart +++ b/packages/stream_chat/lib/open_api/model/poll_option_response_data.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/poll_response.dart b/packages/stream_chat/lib/open_api/model/poll_response.dart index bff4241421..dc6adfba01 100644 --- a/packages/stream_chat/lib/open_api/model/poll_response.dart +++ b/packages/stream_chat/lib/open_api/model/poll_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/poll_response_data.dart b/packages/stream_chat/lib/open_api/model/poll_response_data.dart index dc82736dbe..0bbae01cb7 100644 --- a/packages/stream_chat/lib/open_api/model/poll_response_data.dart +++ b/packages/stream_chat/lib/open_api/model/poll_response_data.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/poll_updated_event.dart b/packages/stream_chat/lib/open_api/model/poll_updated_event.dart index f38eafa933..f04c6681fa 100644 --- a/packages/stream_chat/lib/open_api/model/poll_updated_event.dart +++ b/packages/stream_chat/lib/open_api/model/poll_updated_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/poll_vote_casted_event.dart b/packages/stream_chat/lib/open_api/model/poll_vote_casted_event.dart index 54acae4a93..a18c364ac4 100644 --- a/packages/stream_chat/lib/open_api/model/poll_vote_casted_event.dart +++ b/packages/stream_chat/lib/open_api/model/poll_vote_casted_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/poll_vote_changed_event.dart b/packages/stream_chat/lib/open_api/model/poll_vote_changed_event.dart index 7c7132549a..705c521fc4 100644 --- a/packages/stream_chat/lib/open_api/model/poll_vote_changed_event.dart +++ b/packages/stream_chat/lib/open_api/model/poll_vote_changed_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/poll_vote_removed_event.dart b/packages/stream_chat/lib/open_api/model/poll_vote_removed_event.dart index 0218dc017d..13d871cc30 100644 --- a/packages/stream_chat/lib/open_api/model/poll_vote_removed_event.dart +++ b/packages/stream_chat/lib/open_api/model/poll_vote_removed_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/poll_vote_response.dart b/packages/stream_chat/lib/open_api/model/poll_vote_response.dart index 815335daee..2da419ff2a 100644 --- a/packages/stream_chat/lib/open_api/model/poll_vote_response.dart +++ b/packages/stream_chat/lib/open_api/model/poll_vote_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/poll_vote_response_data.dart b/packages/stream_chat/lib/open_api/model/poll_vote_response_data.dart index ab2765b2ad..a4dd751481 100644 --- a/packages/stream_chat/lib/open_api/model/poll_vote_response_data.dart +++ b/packages/stream_chat/lib/open_api/model/poll_vote_response_data.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/poll_votes_response.dart b/packages/stream_chat/lib/open_api/model/poll_votes_response.dart index bdf6fbd0b9..8b5a0a3b97 100644 --- a/packages/stream_chat/lib/open_api/model/poll_votes_response.dart +++ b/packages/stream_chat/lib/open_api/model/poll_votes_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/privacy_settings_response.dart b/packages/stream_chat/lib/open_api/model/privacy_settings_response.dart index 5ec839a1e2..f64135b39f 100644 --- a/packages/stream_chat/lib/open_api/model/privacy_settings_response.dart +++ b/packages/stream_chat/lib/open_api/model/privacy_settings_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/push_preference_input.dart b/packages/stream_chat/lib/open_api/model/push_preference_input.dart index 5c10b6a5dd..5fccbf483e 100644 --- a/packages/stream_chat/lib/open_api/model/push_preference_input.dart +++ b/packages/stream_chat/lib/open_api/model/push_preference_input.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; @@ -28,6 +28,7 @@ extension type const PushPreferenceInputChatLevel._(String _) implements String static const allMentions = PushPreferenceInputChatLevel._('all_mentions'); static const default_ = PushPreferenceInputChatLevel._('default'); static const directMentions = PushPreferenceInputChatLevel._('direct_mentions'); + @Deprecated('Use directMentions instead.') static const mentions = PushPreferenceInputChatLevel._('mentions'); static const none = PushPreferenceInputChatLevel._('none'); diff --git a/packages/stream_chat/lib/open_api/model/push_preferences_response.dart b/packages/stream_chat/lib/open_api/model/push_preferences_response.dart index f6f7e5b5af..794da69642 100644 --- a/packages/stream_chat/lib/open_api/model/push_preferences_response.dart +++ b/packages/stream_chat/lib/open_api/model/push_preferences_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/query_appeals_request.dart b/packages/stream_chat/lib/open_api/model/query_appeals_request.dart index bd56b76061..77b5486f09 100644 --- a/packages/stream_chat/lib/open_api/model/query_appeals_request.dart +++ b/packages/stream_chat/lib/open_api/model/query_appeals_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/query_appeals_response.dart b/packages/stream_chat/lib/open_api/model/query_appeals_response.dart index 11a34755f4..990ce0c2f5 100644 --- a/packages/stream_chat/lib/open_api/model/query_appeals_response.dart +++ b/packages/stream_chat/lib/open_api/model/query_appeals_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/query_banned_users_payload.dart b/packages/stream_chat/lib/open_api/model/query_banned_users_payload.dart index abb7a7d99b..112e2ca587 100644 --- a/packages/stream_chat/lib/open_api/model/query_banned_users_payload.dart +++ b/packages/stream_chat/lib/open_api/model/query_banned_users_payload.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/query_banned_users_response.dart b/packages/stream_chat/lib/open_api/model/query_banned_users_response.dart index 68efac4db2..5a8d33fa44 100644 --- a/packages/stream_chat/lib/open_api/model/query_banned_users_response.dart +++ b/packages/stream_chat/lib/open_api/model/query_banned_users_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/query_channels_request.dart b/packages/stream_chat/lib/open_api/model/query_channels_request.dart index 6c10ca7ad3..ca33d53a7d 100644 --- a/packages/stream_chat/lib/open_api/model/query_channels_request.dart +++ b/packages/stream_chat/lib/open_api/model/query_channels_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/query_channels_response.dart b/packages/stream_chat/lib/open_api/model/query_channels_response.dart index 26593b8904..69eae7c0f8 100644 --- a/packages/stream_chat/lib/open_api/model/query_channels_response.dart +++ b/packages/stream_chat/lib/open_api/model/query_channels_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/query_drafts_request.dart b/packages/stream_chat/lib/open_api/model/query_drafts_request.dart index 4dbbee4e6f..de2b80f142 100644 --- a/packages/stream_chat/lib/open_api/model/query_drafts_request.dart +++ b/packages/stream_chat/lib/open_api/model/query_drafts_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/query_drafts_response.dart b/packages/stream_chat/lib/open_api/model/query_drafts_response.dart index dee738b40e..fe52c67e1c 100644 --- a/packages/stream_chat/lib/open_api/model/query_drafts_response.dart +++ b/packages/stream_chat/lib/open_api/model/query_drafts_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/query_future_channel_bans_payload.dart b/packages/stream_chat/lib/open_api/model/query_future_channel_bans_payload.dart index 980e917573..aaa38bfccc 100644 --- a/packages/stream_chat/lib/open_api/model/query_future_channel_bans_payload.dart +++ b/packages/stream_chat/lib/open_api/model/query_future_channel_bans_payload.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/query_future_channel_bans_response.dart b/packages/stream_chat/lib/open_api/model/query_future_channel_bans_response.dart index 2b4fea4a0e..9e406bfcaf 100644 --- a/packages/stream_chat/lib/open_api/model/query_future_channel_bans_response.dart +++ b/packages/stream_chat/lib/open_api/model/query_future_channel_bans_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/query_members_payload.dart b/packages/stream_chat/lib/open_api/model/query_members_payload.dart index 7e90ac9ebc..7787b10b3c 100644 --- a/packages/stream_chat/lib/open_api/model/query_members_payload.dart +++ b/packages/stream_chat/lib/open_api/model/query_members_payload.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/query_message_flags_payload.dart b/packages/stream_chat/lib/open_api/model/query_message_flags_payload.dart index 9ab7fef067..4e6ecd9bf4 100644 --- a/packages/stream_chat/lib/open_api/model/query_message_flags_payload.dart +++ b/packages/stream_chat/lib/open_api/model/query_message_flags_payload.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/query_message_flags_response.dart b/packages/stream_chat/lib/open_api/model/query_message_flags_response.dart index 61dee74cf4..a528a64e64 100644 --- a/packages/stream_chat/lib/open_api/model/query_message_flags_response.dart +++ b/packages/stream_chat/lib/open_api/model/query_message_flags_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/query_moderation_configs_request.dart b/packages/stream_chat/lib/open_api/model/query_moderation_configs_request.dart index f71004bd47..463577f473 100644 --- a/packages/stream_chat/lib/open_api/model/query_moderation_configs_request.dart +++ b/packages/stream_chat/lib/open_api/model/query_moderation_configs_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/query_moderation_configs_response.dart b/packages/stream_chat/lib/open_api/model/query_moderation_configs_response.dart index 372025d2a8..e782c667ba 100644 --- a/packages/stream_chat/lib/open_api/model/query_moderation_configs_response.dart +++ b/packages/stream_chat/lib/open_api/model/query_moderation_configs_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/query_poll_votes_request.dart b/packages/stream_chat/lib/open_api/model/query_poll_votes_request.dart index ccd5f91267..7034ea2f83 100644 --- a/packages/stream_chat/lib/open_api/model/query_poll_votes_request.dart +++ b/packages/stream_chat/lib/open_api/model/query_poll_votes_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/query_polls_request.dart b/packages/stream_chat/lib/open_api/model/query_polls_request.dart index 52c3a7981c..4c27dfaadb 100644 --- a/packages/stream_chat/lib/open_api/model/query_polls_request.dart +++ b/packages/stream_chat/lib/open_api/model/query_polls_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/query_polls_response.dart b/packages/stream_chat/lib/open_api/model/query_polls_response.dart index d545205a13..14fd2e9f13 100644 --- a/packages/stream_chat/lib/open_api/model/query_polls_response.dart +++ b/packages/stream_chat/lib/open_api/model/query_polls_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/query_reactions_request.dart b/packages/stream_chat/lib/open_api/model/query_reactions_request.dart index 8484877db2..737a0fca38 100644 --- a/packages/stream_chat/lib/open_api/model/query_reactions_request.dart +++ b/packages/stream_chat/lib/open_api/model/query_reactions_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/query_reactions_response.dart b/packages/stream_chat/lib/open_api/model/query_reactions_response.dart index 93a78a1285..fceb932903 100644 --- a/packages/stream_chat/lib/open_api/model/query_reactions_response.dart +++ b/packages/stream_chat/lib/open_api/model/query_reactions_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/query_reminders_request.dart b/packages/stream_chat/lib/open_api/model/query_reminders_request.dart index 7c60d35e5d..8c804d8f4c 100644 --- a/packages/stream_chat/lib/open_api/model/query_reminders_request.dart +++ b/packages/stream_chat/lib/open_api/model/query_reminders_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/query_reminders_response.dart b/packages/stream_chat/lib/open_api/model/query_reminders_response.dart index 83505b13f6..15b188c469 100644 --- a/packages/stream_chat/lib/open_api/model/query_reminders_response.dart +++ b/packages/stream_chat/lib/open_api/model/query_reminders_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/query_review_queue_request.dart b/packages/stream_chat/lib/open_api/model/query_review_queue_request.dart index ec1dc7797b..370656c6ff 100644 --- a/packages/stream_chat/lib/open_api/model/query_review_queue_request.dart +++ b/packages/stream_chat/lib/open_api/model/query_review_queue_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/query_review_queue_response.dart b/packages/stream_chat/lib/open_api/model/query_review_queue_response.dart index d980dcb5b0..e3feb8c6da 100644 --- a/packages/stream_chat/lib/open_api/model/query_review_queue_response.dart +++ b/packages/stream_chat/lib/open_api/model/query_review_queue_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/query_threads_request.dart b/packages/stream_chat/lib/open_api/model/query_threads_request.dart index 98ca0fb1bf..252e69cc70 100644 --- a/packages/stream_chat/lib/open_api/model/query_threads_request.dart +++ b/packages/stream_chat/lib/open_api/model/query_threads_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/query_threads_response.dart b/packages/stream_chat/lib/open_api/model/query_threads_response.dart index 4c8e85b738..3fd38eab92 100644 --- a/packages/stream_chat/lib/open_api/model/query_threads_response.dart +++ b/packages/stream_chat/lib/open_api/model/query_threads_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/query_users_payload.dart b/packages/stream_chat/lib/open_api/model/query_users_payload.dart index 1b0efbcf7b..ca3c6168a4 100644 --- a/packages/stream_chat/lib/open_api/model/query_users_payload.dart +++ b/packages/stream_chat/lib/open_api/model/query_users_payload.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/query_users_response.dart b/packages/stream_chat/lib/open_api/model/query_users_response.dart index 2ee4cbd0d5..056cfb2778 100644 --- a/packages/stream_chat/lib/open_api/model/query_users_response.dart +++ b/packages/stream_chat/lib/open_api/model/query_users_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/queue_response.dart b/packages/stream_chat/lib/open_api/model/queue_response.dart index 18d607fbfc..00dffeb9de 100644 --- a/packages/stream_chat/lib/open_api/model/queue_response.dart +++ b/packages/stream_chat/lib/open_api/model/queue_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/reaction.dart b/packages/stream_chat/lib/open_api/model/reaction.dart index 36f0787f54..0c4940a41d 100644 --- a/packages/stream_chat/lib/open_api/model/reaction.dart +++ b/packages/stream_chat/lib/open_api/model/reaction.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/reaction_deleted_event.dart b/packages/stream_chat/lib/open_api/model/reaction_deleted_event.dart index d708e4352d..fd0dbf3f05 100644 --- a/packages/stream_chat/lib/open_api/model/reaction_deleted_event.dart +++ b/packages/stream_chat/lib/open_api/model/reaction_deleted_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/reaction_group_response.dart b/packages/stream_chat/lib/open_api/model/reaction_group_response.dart index ea8e8dfe76..3e22283e89 100644 --- a/packages/stream_chat/lib/open_api/model/reaction_group_response.dart +++ b/packages/stream_chat/lib/open_api/model/reaction_group_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/reaction_group_user_response.dart b/packages/stream_chat/lib/open_api/model/reaction_group_user_response.dart index 45fa5c49c3..d2260e70a0 100644 --- a/packages/stream_chat/lib/open_api/model/reaction_group_user_response.dart +++ b/packages/stream_chat/lib/open_api/model/reaction_group_user_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/reaction_new_event.dart b/packages/stream_chat/lib/open_api/model/reaction_new_event.dart index 927a881232..141e74ece3 100644 --- a/packages/stream_chat/lib/open_api/model/reaction_new_event.dart +++ b/packages/stream_chat/lib/open_api/model/reaction_new_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/reaction_request.dart b/packages/stream_chat/lib/open_api/model/reaction_request.dart index 67addc9a97..da891d6f84 100644 --- a/packages/stream_chat/lib/open_api/model/reaction_request.dart +++ b/packages/stream_chat/lib/open_api/model/reaction_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/reaction_response.dart b/packages/stream_chat/lib/open_api/model/reaction_response.dart index c35e77ae0e..2d6d6d21be 100644 --- a/packages/stream_chat/lib/open_api/model/reaction_response.dart +++ b/packages/stream_chat/lib/open_api/model/reaction_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/reaction_updated_event.dart b/packages/stream_chat/lib/open_api/model/reaction_updated_event.dart index 2b0113cc9f..77b274df4f 100644 --- a/packages/stream_chat/lib/open_api/model/reaction_updated_event.dart +++ b/packages/stream_chat/lib/open_api/model/reaction_updated_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/read_receipts_response.dart b/packages/stream_chat/lib/open_api/model/read_receipts_response.dart index 5ee15b3d00..9f1d7f693e 100644 --- a/packages/stream_chat/lib/open_api/model/read_receipts_response.dart +++ b/packages/stream_chat/lib/open_api/model/read_receipts_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/read_state_response.dart b/packages/stream_chat/lib/open_api/model/read_state_response.dart index b2a7466cbc..8d2c0479f6 100644 --- a/packages/stream_chat/lib/open_api/model/read_state_response.dart +++ b/packages/stream_chat/lib/open_api/model/read_state_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/reject_appeal_request_payload.dart b/packages/stream_chat/lib/open_api/model/reject_appeal_request_payload.dart index ed3902d8ed..fd2fbc3207 100644 --- a/packages/stream_chat/lib/open_api/model/reject_appeal_request_payload.dart +++ b/packages/stream_chat/lib/open_api/model/reject_appeal_request_payload.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/reminder_created_event.dart b/packages/stream_chat/lib/open_api/model/reminder_created_event.dart index 91ae7776c3..5ce70c9206 100644 --- a/packages/stream_chat/lib/open_api/model/reminder_created_event.dart +++ b/packages/stream_chat/lib/open_api/model/reminder_created_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/reminder_deleted_event.dart b/packages/stream_chat/lib/open_api/model/reminder_deleted_event.dart index 3b01fc85d4..f7607c9917 100644 --- a/packages/stream_chat/lib/open_api/model/reminder_deleted_event.dart +++ b/packages/stream_chat/lib/open_api/model/reminder_deleted_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/reminder_notification_event.dart b/packages/stream_chat/lib/open_api/model/reminder_notification_event.dart index 57a49a6a93..27f11f8946 100644 --- a/packages/stream_chat/lib/open_api/model/reminder_notification_event.dart +++ b/packages/stream_chat/lib/open_api/model/reminder_notification_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/reminder_response_data.dart b/packages/stream_chat/lib/open_api/model/reminder_response_data.dart index ce17841493..885efb5908 100644 --- a/packages/stream_chat/lib/open_api/model/reminder_response_data.dart +++ b/packages/stream_chat/lib/open_api/model/reminder_response_data.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; @@ -21,6 +21,7 @@ class ReminderResponseData with _$ReminderResponseData { this.channel, required this.channelCid, required this.createdAt, + this.expiresAt, this.message, required this.messageId, this.remindAt, @@ -42,6 +43,11 @@ class ReminderResponseData with _$ReminderResponseData { @JsonKey(name: 'created_at') final DateTime createdAt; + @override + @StreamDateTimeConverter() + @JsonKey(name: 'expires_at') + final DateTime? expiresAt; + @override @JsonKey(name: 'message') final MessageResponse? message; diff --git a/packages/stream_chat/lib/open_api/model/reminder_response_data.freezed.dart b/packages/stream_chat/lib/open_api/model/reminder_response_data.freezed.dart index 4b4c1bb0b2..975626a5e8 100644 --- a/packages/stream_chat/lib/open_api/model/reminder_response_data.freezed.dart +++ b/packages/stream_chat/lib/open_api/model/reminder_response_data.freezed.dart @@ -16,6 +16,7 @@ mixin _$ReminderResponseData { ChannelResponse? get channel; String get channelCid; DateTime get createdAt; + DateTime? get expiresAt; MessageResponse? get message; String get messageId; DateTime? get remindAt; @@ -41,6 +42,7 @@ mixin _$ReminderResponseData { (identical(other.channel, channel) || other.channel == channel) && (identical(other.channelCid, channelCid) || other.channelCid == channelCid) && (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.expiresAt, expiresAt) || other.expiresAt == expiresAt) && (identical(other.message, message) || other.message == message) && (identical(other.messageId, messageId) || other.messageId == messageId) && (identical(other.remindAt, remindAt) || other.remindAt == remindAt) && @@ -55,6 +57,7 @@ mixin _$ReminderResponseData { channel, channelCid, createdAt, + expiresAt, message, messageId, remindAt, @@ -65,7 +68,7 @@ mixin _$ReminderResponseData { @override String toString() { - return 'ReminderResponseData(channel: $channel, channelCid: $channelCid, createdAt: $createdAt, message: $message, messageId: $messageId, remindAt: $remindAt, updatedAt: $updatedAt, user: $user, userId: $userId)'; + return 'ReminderResponseData(channel: $channel, channelCid: $channelCid, createdAt: $createdAt, expiresAt: $expiresAt, message: $message, messageId: $messageId, remindAt: $remindAt, updatedAt: $updatedAt, user: $user, userId: $userId)'; } } @@ -80,6 +83,7 @@ abstract mixin class $ReminderResponseDataCopyWith<$Res> { ChannelResponse? channel, String channelCid, DateTime createdAt, + DateTime? expiresAt, MessageResponse? message, String messageId, DateTime? remindAt, @@ -104,6 +108,7 @@ class _$ReminderResponseDataCopyWithImpl<$Res> implements $ReminderResponseDataC Object? channel = freezed, Object? channelCid = null, Object? createdAt = null, + Object? expiresAt = freezed, Object? message = freezed, Object? messageId = null, Object? remindAt = freezed, @@ -125,6 +130,10 @@ class _$ReminderResponseDataCopyWithImpl<$Res> implements $ReminderResponseDataC ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable as DateTime, + expiresAt: freezed == expiresAt + ? _self.expiresAt + : expiresAt // ignore: cast_nullable_to_non_nullable + as DateTime?, message: freezed == message ? _self.message : message // ignore: cast_nullable_to_non_nullable diff --git a/packages/stream_chat/lib/open_api/model/reminder_response_data.g.dart b/packages/stream_chat/lib/open_api/model/reminder_response_data.g.dart index 16ea4abd9a..af920763e7 100644 --- a/packages/stream_chat/lib/open_api/model/reminder_response_data.g.dart +++ b/packages/stream_chat/lib/open_api/model/reminder_response_data.g.dart @@ -14,6 +14,10 @@ ReminderResponseData _$ReminderResponseDataFromJson( createdAt: const StreamDateTimeConverter().fromJson( json['created_at'] as Object, ), + expiresAt: _$JsonConverterFromJson( + json['expires_at'], + const StreamDateTimeConverter().fromJson, + ), message: json['message'] == null ? null : MessageResponse.fromJson(json['message'] as Map), messageId: json['message_id'] as String, remindAt: _$JsonConverterFromJson( @@ -33,6 +37,10 @@ Map _$ReminderResponseDataToJson( 'channel': instance.channel?.toJson(), 'channel_cid': instance.channelCid, 'created_at': const StreamDateTimeConverter().toJson(instance.createdAt), + 'expires_at': _$JsonConverterToJson( + instance.expiresAt, + const StreamDateTimeConverter().toJson, + ), 'message': instance.message?.toJson(), 'message_id': instance.messageId, 'remind_at': _$JsonConverterToJson( diff --git a/packages/stream_chat/lib/open_api/model/reminder_updated_event.dart b/packages/stream_chat/lib/open_api/model/reminder_updated_event.dart index 95008ddb6a..d130772c10 100644 --- a/packages/stream_chat/lib/open_api/model/reminder_updated_event.dart +++ b/packages/stream_chat/lib/open_api/model/reminder_updated_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/remove_user_group_members_request.dart b/packages/stream_chat/lib/open_api/model/remove_user_group_members_request.dart index ef5a658ab1..7ff49c4855 100644 --- a/packages/stream_chat/lib/open_api/model/remove_user_group_members_request.dart +++ b/packages/stream_chat/lib/open_api/model/remove_user_group_members_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/remove_user_group_members_response.dart b/packages/stream_chat/lib/open_api/model/remove_user_group_members_response.dart index 5a3fc4c8df..fbe7df368d 100644 --- a/packages/stream_chat/lib/open_api/model/remove_user_group_members_response.dart +++ b/packages/stream_chat/lib/open_api/model/remove_user_group_members_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/restore_action_request_payload.dart b/packages/stream_chat/lib/open_api/model/restore_action_request_payload.dart index 1b290a9839..6dacd54e31 100644 --- a/packages/stream_chat/lib/open_api/model/restore_action_request_payload.dart +++ b/packages/stream_chat/lib/open_api/model/restore_action_request_payload.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/review_queue_item_response.dart b/packages/stream_chat/lib/open_api/model/review_queue_item_response.dart index a9355cd61c..79544a0dc4 100644 --- a/packages/stream_chat/lib/open_api/model/review_queue_item_response.dart +++ b/packages/stream_chat/lib/open_api/model/review_queue_item_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/role.dart b/packages/stream_chat/lib/open_api/model/role.dart index 9ce34e5f72..c77ae3623d 100644 --- a/packages/stream_chat/lib/open_api/model/role.dart +++ b/packages/stream_chat/lib/open_api/model/role.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/rule_builder_action.dart b/packages/stream_chat/lib/open_api/model/rule_builder_action.dart index 2490623bec..87cbbada24 100644 --- a/packages/stream_chat/lib/open_api/model/rule_builder_action.dart +++ b/packages/stream_chat/lib/open_api/model/rule_builder_action.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/rule_builder_condition.dart b/packages/stream_chat/lib/open_api/model/rule_builder_condition.dart index cea93679ad..d78a72b7e2 100644 --- a/packages/stream_chat/lib/open_api/model/rule_builder_condition.dart +++ b/packages/stream_chat/lib/open_api/model/rule_builder_condition.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; @@ -40,6 +40,7 @@ class RuleBuilderCondition with _$RuleBuilderCondition { this.textContentParams, this.textRuleParams, this.type, + this.userChannelCountParams, this.userCreatedWithinParams, this.userCustomPropertyParams, this.userFlagCountRuleParams, @@ -140,6 +141,10 @@ class RuleBuilderCondition with _$RuleBuilderCondition { @JsonKey(name: 'type') final String? type; + @override + @JsonKey(name: 'user_channel_count_params') + final UserChannelCountRuleParameters? userChannelCountParams; + @override @JsonKey(name: 'user_created_within_params') final UserCreatedWithinParameters? userCreatedWithinParams; diff --git a/packages/stream_chat/lib/open_api/model/rule_builder_condition.freezed.dart b/packages/stream_chat/lib/open_api/model/rule_builder_condition.freezed.dart index cc05b2fe7c..76d55e46e5 100644 --- a/packages/stream_chat/lib/open_api/model/rule_builder_condition.freezed.dart +++ b/packages/stream_chat/lib/open_api/model/rule_builder_condition.freezed.dart @@ -35,6 +35,7 @@ mixin _$RuleBuilderCondition { TextContentParameters? get textContentParams; TextRuleParameters? get textRuleParams; String? get type; + UserChannelCountRuleParameters? get userChannelCountParams; UserCreatedWithinParameters? get userCreatedWithinParams; UserCustomPropertyParameters? get userCustomPropertyParams; FlagCountRuleParameters? get userFlagCountRuleParams; @@ -123,6 +124,8 @@ mixin _$RuleBuilderCondition { (identical(other.textContentParams, textContentParams) || other.textContentParams == textContentParams) && (identical(other.textRuleParams, textRuleParams) || other.textRuleParams == textRuleParams) && (identical(other.type, type) || other.type == type) && + (identical(other.userChannelCountParams, userChannelCountParams) || + other.userChannelCountParams == userChannelCountParams) && (identical( other.userCreatedWithinParams, userCreatedWithinParams, @@ -185,6 +188,7 @@ mixin _$RuleBuilderCondition { textContentParams, textRuleParams, type, + userChannelCountParams, userCreatedWithinParams, userCustomPropertyParams, userFlagCountRuleParams, @@ -199,7 +203,7 @@ mixin _$RuleBuilderCondition { @override String toString() { - return 'RuleBuilderCondition(callCustomPropertyParams: $callCustomPropertyParams, callTypeRuleParams: $callTypeRuleParams, callViolationCountParams: $callViolationCountParams, channelMessageCountRuleParams: $channelMessageCountRuleParams, closedCaptionRuleParams: $closedCaptionRuleParams, confidence: $confidence, contentCountRuleParams: $contentCountRuleParams, contentCustomPropertyCountParams: $contentCustomPropertyCountParams, contentCustomPropertyParams: $contentCustomPropertyParams, contentFlagCountRuleParams: $contentFlagCountRuleParams, floodIdenticalParams: $floodIdenticalParams, floodSimilarParams: $floodSimilarParams, imageContentParams: $imageContentParams, imageRuleParams: $imageRuleParams, ipContentCountRuleParams: $ipContentCountRuleParams, ipFlagCountRuleParams: $ipFlagCountRuleParams, keyframeOcrRuleParams: $keyframeOcrRuleParams, keyframeRuleParams: $keyframeRuleParams, ocrContentParams: $ocrContentParams, textContentParams: $textContentParams, textRuleParams: $textRuleParams, type: $type, userCreatedWithinParams: $userCreatedWithinParams, userCustomPropertyParams: $userCustomPropertyParams, userFlagCountRuleParams: $userFlagCountRuleParams, userIdenticalContentCountParams: $userIdenticalContentCountParams, userIdenticalImageCountParams: $userIdenticalImageCountParams, userReactionCountParams: $userReactionCountParams, userRoleParams: $userRoleParams, userRuleParams: $userRuleParams, videoContentParams: $videoContentParams, videoRuleParams: $videoRuleParams)'; + return 'RuleBuilderCondition(callCustomPropertyParams: $callCustomPropertyParams, callTypeRuleParams: $callTypeRuleParams, callViolationCountParams: $callViolationCountParams, channelMessageCountRuleParams: $channelMessageCountRuleParams, closedCaptionRuleParams: $closedCaptionRuleParams, confidence: $confidence, contentCountRuleParams: $contentCountRuleParams, contentCustomPropertyCountParams: $contentCustomPropertyCountParams, contentCustomPropertyParams: $contentCustomPropertyParams, contentFlagCountRuleParams: $contentFlagCountRuleParams, floodIdenticalParams: $floodIdenticalParams, floodSimilarParams: $floodSimilarParams, imageContentParams: $imageContentParams, imageRuleParams: $imageRuleParams, ipContentCountRuleParams: $ipContentCountRuleParams, ipFlagCountRuleParams: $ipFlagCountRuleParams, keyframeOcrRuleParams: $keyframeOcrRuleParams, keyframeRuleParams: $keyframeRuleParams, ocrContentParams: $ocrContentParams, textContentParams: $textContentParams, textRuleParams: $textRuleParams, type: $type, userChannelCountParams: $userChannelCountParams, userCreatedWithinParams: $userCreatedWithinParams, userCustomPropertyParams: $userCustomPropertyParams, userFlagCountRuleParams: $userFlagCountRuleParams, userIdenticalContentCountParams: $userIdenticalContentCountParams, userIdenticalImageCountParams: $userIdenticalImageCountParams, userReactionCountParams: $userReactionCountParams, userRoleParams: $userRoleParams, userRuleParams: $userRuleParams, videoContentParams: $videoContentParams, videoRuleParams: $videoRuleParams)'; } } @@ -233,6 +237,7 @@ abstract mixin class $RuleBuilderConditionCopyWith<$Res> { TextContentParameters? textContentParams, TextRuleParameters? textRuleParams, String? type, + UserChannelCountRuleParameters? userChannelCountParams, UserCreatedWithinParameters? userCreatedWithinParams, UserCustomPropertyParameters? userCustomPropertyParams, FlagCountRuleParameters? userFlagCountRuleParams, @@ -280,6 +285,7 @@ class _$RuleBuilderConditionCopyWithImpl<$Res> implements $RuleBuilderConditionC Object? textContentParams = freezed, Object? textRuleParams = freezed, Object? type = freezed, + Object? userChannelCountParams = freezed, Object? userCreatedWithinParams = freezed, Object? userCustomPropertyParams = freezed, Object? userFlagCountRuleParams = freezed, @@ -381,6 +387,10 @@ class _$RuleBuilderConditionCopyWithImpl<$Res> implements $RuleBuilderConditionC ? _self.type : type // ignore: cast_nullable_to_non_nullable as String?, + userChannelCountParams: freezed == userChannelCountParams + ? _self.userChannelCountParams + : userChannelCountParams // ignore: cast_nullable_to_non_nullable + as UserChannelCountRuleParameters?, userCreatedWithinParams: freezed == userCreatedWithinParams ? _self.userCreatedWithinParams : userCreatedWithinParams // ignore: cast_nullable_to_non_nullable diff --git a/packages/stream_chat/lib/open_api/model/rule_builder_condition.g.dart b/packages/stream_chat/lib/open_api/model/rule_builder_condition.g.dart index 57eff04419..805c8fdf47 100644 --- a/packages/stream_chat/lib/open_api/model/rule_builder_condition.g.dart +++ b/packages/stream_chat/lib/open_api/model/rule_builder_condition.g.dart @@ -111,6 +111,11 @@ RuleBuilderCondition _$RuleBuilderConditionFromJson( json['text_rule_params'] as Map, ), type: json['type'] as String?, + userChannelCountParams: json['user_channel_count_params'] == null + ? null + : UserChannelCountRuleParameters.fromJson( + json['user_channel_count_params'] as Map, + ), userCreatedWithinParams: json['user_created_within_params'] == null ? null : UserCreatedWithinParameters.fromJson( @@ -188,6 +193,7 @@ Map _$RuleBuilderConditionToJson( 'text_content_params': instance.textContentParams?.toJson(), 'text_rule_params': instance.textRuleParams?.toJson(), 'type': instance.type, + 'user_channel_count_params': instance.userChannelCountParams?.toJson(), 'user_created_within_params': instance.userCreatedWithinParams?.toJson(), 'user_custom_property_params': instance.userCustomPropertyParams?.toJson(), 'user_flag_count_rule_params': instance.userFlagCountRuleParams?.toJson(), diff --git a/packages/stream_chat/lib/open_api/model/rule_builder_condition_group.dart b/packages/stream_chat/lib/open_api/model/rule_builder_condition_group.dart index fc6ff03ed4..b00882db12 100644 --- a/packages/stream_chat/lib/open_api/model/rule_builder_condition_group.dart +++ b/packages/stream_chat/lib/open_api/model/rule_builder_condition_group.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/rule_builder_config.dart b/packages/stream_chat/lib/open_api/model/rule_builder_config.dart index 16e2444928..b185b00a9f 100644 --- a/packages/stream_chat/lib/open_api/model/rule_builder_config.dart +++ b/packages/stream_chat/lib/open_api/model/rule_builder_config.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/rule_builder_rule.dart b/packages/stream_chat/lib/open_api/model/rule_builder_rule.dart index 75297c1e88..f3d7bcfd08 100644 --- a/packages/stream_chat/lib/open_api/model/rule_builder_rule.dart +++ b/packages/stream_chat/lib/open_api/model/rule_builder_rule.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/search_payload.dart b/packages/stream_chat/lib/open_api/model/search_payload.dart index aa6fd41520..47e53bb74f 100644 --- a/packages/stream_chat/lib/open_api/model/search_payload.dart +++ b/packages/stream_chat/lib/open_api/model/search_payload.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/search_response.dart b/packages/stream_chat/lib/open_api/model/search_response.dart index 1b7bc9205b..264cb28d04 100644 --- a/packages/stream_chat/lib/open_api/model/search_response.dart +++ b/packages/stream_chat/lib/open_api/model/search_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/search_result.dart b/packages/stream_chat/lib/open_api/model/search_result.dart index dd5134f246..1b3547749c 100644 --- a/packages/stream_chat/lib/open_api/model/search_result.dart +++ b/packages/stream_chat/lib/open_api/model/search_result.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/search_result_message.dart b/packages/stream_chat/lib/open_api/model/search_result_message.dart index e15f72bb7b..770d926833 100644 --- a/packages/stream_chat/lib/open_api/model/search_result_message.dart +++ b/packages/stream_chat/lib/open_api/model/search_result_message.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/search_roles_response.dart b/packages/stream_chat/lib/open_api/model/search_roles_response.dart index df61c4df27..9526fdbcb7 100644 --- a/packages/stream_chat/lib/open_api/model/search_roles_response.dart +++ b/packages/stream_chat/lib/open_api/model/search_roles_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/search_user_groups_response.dart b/packages/stream_chat/lib/open_api/model/search_user_groups_response.dart index 8f19ed4a24..49df4fe771 100644 --- a/packages/stream_chat/lib/open_api/model/search_user_groups_response.dart +++ b/packages/stream_chat/lib/open_api/model/search_user_groups_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/search_warning.dart b/packages/stream_chat/lib/open_api/model/search_warning.dart index c126ab0783..e95838ef6d 100644 --- a/packages/stream_chat/lib/open_api/model/search_warning.dart +++ b/packages/stream_chat/lib/open_api/model/search_warning.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/send_event_request.dart b/packages/stream_chat/lib/open_api/model/send_event_request.dart index a74cbe92a1..711b992572 100644 --- a/packages/stream_chat/lib/open_api/model/send_event_request.dart +++ b/packages/stream_chat/lib/open_api/model/send_event_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/send_message_request.dart b/packages/stream_chat/lib/open_api/model/send_message_request.dart index 246296205d..23966cc747 100644 --- a/packages/stream_chat/lib/open_api/model/send_message_request.dart +++ b/packages/stream_chat/lib/open_api/model/send_message_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/send_message_response.dart b/packages/stream_chat/lib/open_api/model/send_message_response.dart index ef30ec1575..1d9725446d 100644 --- a/packages/stream_chat/lib/open_api/model/send_message_response.dart +++ b/packages/stream_chat/lib/open_api/model/send_message_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/send_reaction_request.dart b/packages/stream_chat/lib/open_api/model/send_reaction_request.dart index a6b17471e7..6eef8f51a7 100644 --- a/packages/stream_chat/lib/open_api/model/send_reaction_request.dart +++ b/packages/stream_chat/lib/open_api/model/send_reaction_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/send_reaction_response.dart b/packages/stream_chat/lib/open_api/model/send_reaction_response.dart index d304d61ea9..3fce47a194 100644 --- a/packages/stream_chat/lib/open_api/model/send_reaction_response.dart +++ b/packages/stream_chat/lib/open_api/model/send_reaction_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/shadow_block_action_request_payload.dart b/packages/stream_chat/lib/open_api/model/shadow_block_action_request_payload.dart index 56c8b47215..c40f841394 100644 --- a/packages/stream_chat/lib/open_api/model/shadow_block_action_request_payload.dart +++ b/packages/stream_chat/lib/open_api/model/shadow_block_action_request_payload.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/shared_location.dart b/packages/stream_chat/lib/open_api/model/shared_location.dart index c6d25979d5..a82bdec01d 100644 --- a/packages/stream_chat/lib/open_api/model/shared_location.dart +++ b/packages/stream_chat/lib/open_api/model/shared_location.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/shared_location_response.dart b/packages/stream_chat/lib/open_api/model/shared_location_response.dart index 0e4bec09eb..124cbf0c6b 100644 --- a/packages/stream_chat/lib/open_api/model/shared_location_response.dart +++ b/packages/stream_chat/lib/open_api/model/shared_location_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/shared_location_response_data.dart b/packages/stream_chat/lib/open_api/model/shared_location_response_data.dart index ae3be3980d..2ba47f6920 100644 --- a/packages/stream_chat/lib/open_api/model/shared_location_response_data.dart +++ b/packages/stream_chat/lib/open_api/model/shared_location_response_data.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/shared_locations_response.dart b/packages/stream_chat/lib/open_api/model/shared_locations_response.dart index 421ed3d6d1..c7e16a9a7b 100644 --- a/packages/stream_chat/lib/open_api/model/shared_locations_response.dart +++ b/packages/stream_chat/lib/open_api/model/shared_locations_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/show_channel_response.dart b/packages/stream_chat/lib/open_api/model/show_channel_response.dart index 376c73c0c9..02f0467819 100644 --- a/packages/stream_chat/lib/open_api/model/show_channel_response.dart +++ b/packages/stream_chat/lib/open_api/model/show_channel_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/sort_param_request.dart b/packages/stream_chat/lib/open_api/model/sort_param_request.dart index 95a1bdf997..e57fd13bbc 100644 --- a/packages/stream_chat/lib/open_api/model/sort_param_request.dart +++ b/packages/stream_chat/lib/open_api/model/sort_param_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/submit_action_request.dart b/packages/stream_chat/lib/open_api/model/submit_action_request.dart index d34eac06ec..89a9ac9e05 100644 --- a/packages/stream_chat/lib/open_api/model/submit_action_request.dart +++ b/packages/stream_chat/lib/open_api/model/submit_action_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; @@ -151,6 +151,7 @@ class SubmitActionRequest with _$SubmitActionRequest { final UnbanActionRequestPayload? unban; @override + @Deprecated('Use restore instead, which now also reverses a block or shadow block.') @JsonKey(name: 'unblock') final UnblockActionRequestPayload? unblock; diff --git a/packages/stream_chat/lib/open_api/model/submit_action_response.dart b/packages/stream_chat/lib/open_api/model/submit_action_response.dart index fd08baf917..ffd0179d0e 100644 --- a/packages/stream_chat/lib/open_api/model/submit_action_response.dart +++ b/packages/stream_chat/lib/open_api/model/submit_action_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/sync_request.dart b/packages/stream_chat/lib/open_api/model/sync_request.dart index fa8558cda3..96cf92eba9 100644 --- a/packages/stream_chat/lib/open_api/model/sync_request.dart +++ b/packages/stream_chat/lib/open_api/model/sync_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/sync_response.dart b/packages/stream_chat/lib/open_api/model/sync_response.dart index 649756538b..c5bcf9be45 100644 --- a/packages/stream_chat/lib/open_api/model/sync_response.dart +++ b/packages/stream_chat/lib/open_api/model/sync_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/text_content_parameters.dart b/packages/stream_chat/lib/open_api/model/text_content_parameters.dart index 47c347ff00..4c8283ccf2 100644 --- a/packages/stream_chat/lib/open_api/model/text_content_parameters.dart +++ b/packages/stream_chat/lib/open_api/model/text_content_parameters.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/text_rule_parameters.dart b/packages/stream_chat/lib/open_api/model/text_rule_parameters.dart index d04276675d..43d2660f7f 100644 --- a/packages/stream_chat/lib/open_api/model/text_rule_parameters.dart +++ b/packages/stream_chat/lib/open_api/model/text_rule_parameters.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/thread_participant.dart b/packages/stream_chat/lib/open_api/model/thread_participant.dart index 3b84372347..276355e6b2 100644 --- a/packages/stream_chat/lib/open_api/model/thread_participant.dart +++ b/packages/stream_chat/lib/open_api/model/thread_participant.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/thread_response.dart b/packages/stream_chat/lib/open_api/model/thread_response.dart index e6cf3b0f07..6a7926e9b0 100644 --- a/packages/stream_chat/lib/open_api/model/thread_response.dart +++ b/packages/stream_chat/lib/open_api/model/thread_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/thread_state_response.dart b/packages/stream_chat/lib/open_api/model/thread_state_response.dart index 107b6372a0..3302ede310 100644 --- a/packages/stream_chat/lib/open_api/model/thread_state_response.dart +++ b/packages/stream_chat/lib/open_api/model/thread_state_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/thread_updated_event.dart b/packages/stream_chat/lib/open_api/model/thread_updated_event.dart index e975788203..22288ddaa1 100644 --- a/packages/stream_chat/lib/open_api/model/thread_updated_event.dart +++ b/packages/stream_chat/lib/open_api/model/thread_updated_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/thresholds.dart b/packages/stream_chat/lib/open_api/model/thresholds.dart index 3420d68e9d..0b6a55b7ca 100644 --- a/packages/stream_chat/lib/open_api/model/thresholds.dart +++ b/packages/stream_chat/lib/open_api/model/thresholds.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/translate_message_request.dart b/packages/stream_chat/lib/open_api/model/translate_message_request.dart index b9d0497582..f0c69af560 100644 --- a/packages/stream_chat/lib/open_api/model/translate_message_request.dart +++ b/packages/stream_chat/lib/open_api/model/translate_message_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/translate_message_response.dart b/packages/stream_chat/lib/open_api/model/translate_message_response.dart index 296eb272ce..15b7e403fc 100644 --- a/packages/stream_chat/lib/open_api/model/translate_message_response.dart +++ b/packages/stream_chat/lib/open_api/model/translate_message_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/truncate_channel_request.dart b/packages/stream_chat/lib/open_api/model/truncate_channel_request.dart index 4cf38fc25d..80f84b09b3 100644 --- a/packages/stream_chat/lib/open_api/model/truncate_channel_request.dart +++ b/packages/stream_chat/lib/open_api/model/truncate_channel_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/truncate_channel_response.dart b/packages/stream_chat/lib/open_api/model/truncate_channel_response.dart index 325c91a1cf..1c9f9fa571 100644 --- a/packages/stream_chat/lib/open_api/model/truncate_channel_response.dart +++ b/packages/stream_chat/lib/open_api/model/truncate_channel_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/typing_indicators_response.dart b/packages/stream_chat/lib/open_api/model/typing_indicators_response.dart index ece87a8fb9..0fbaeeb93d 100644 --- a/packages/stream_chat/lib/open_api/model/typing_indicators_response.dart +++ b/packages/stream_chat/lib/open_api/model/typing_indicators_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/typing_start_event.dart b/packages/stream_chat/lib/open_api/model/typing_start_event.dart index fbae839694..978d188495 100644 --- a/packages/stream_chat/lib/open_api/model/typing_start_event.dart +++ b/packages/stream_chat/lib/open_api/model/typing_start_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/typing_stop_event.dart b/packages/stream_chat/lib/open_api/model/typing_stop_event.dart index 8f04454363..b82ce2810a 100644 --- a/packages/stream_chat/lib/open_api/model/typing_stop_event.dart +++ b/packages/stream_chat/lib/open_api/model/typing_stop_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/unban_action_request_payload.dart b/packages/stream_chat/lib/open_api/model/unban_action_request_payload.dart index 098e6d0326..67b22a6d5a 100644 --- a/packages/stream_chat/lib/open_api/model/unban_action_request_payload.dart +++ b/packages/stream_chat/lib/open_api/model/unban_action_request_payload.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/unban_response.dart b/packages/stream_chat/lib/open_api/model/unban_response.dart index d549b53939..61c7fdea86 100644 --- a/packages/stream_chat/lib/open_api/model/unban_response.dart +++ b/packages/stream_chat/lib/open_api/model/unban_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/unblock_action_request_payload.dart b/packages/stream_chat/lib/open_api/model/unblock_action_request_payload.dart index fb39f834b2..05d3a466ad 100644 --- a/packages/stream_chat/lib/open_api/model/unblock_action_request_payload.dart +++ b/packages/stream_chat/lib/open_api/model/unblock_action_request_payload.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/unblock_users_request.dart b/packages/stream_chat/lib/open_api/model/unblock_users_request.dart index 41ab3e8415..2aad765ce0 100644 --- a/packages/stream_chat/lib/open_api/model/unblock_users_request.dart +++ b/packages/stream_chat/lib/open_api/model/unblock_users_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/unblock_users_response.dart b/packages/stream_chat/lib/open_api/model/unblock_users_response.dart index 96985cd271..4b55f30110 100644 --- a/packages/stream_chat/lib/open_api/model/unblock_users_response.dart +++ b/packages/stream_chat/lib/open_api/model/unblock_users_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/unmute_channel_request.dart b/packages/stream_chat/lib/open_api/model/unmute_channel_request.dart index 8707307575..5560fbee8e 100644 --- a/packages/stream_chat/lib/open_api/model/unmute_channel_request.dart +++ b/packages/stream_chat/lib/open_api/model/unmute_channel_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/unmute_request.dart b/packages/stream_chat/lib/open_api/model/unmute_request.dart index cae355383a..7f8811dfde 100644 --- a/packages/stream_chat/lib/open_api/model/unmute_request.dart +++ b/packages/stream_chat/lib/open_api/model/unmute_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/unmute_response.dart b/packages/stream_chat/lib/open_api/model/unmute_response.dart index a60349102e..4665b84497 100644 --- a/packages/stream_chat/lib/open_api/model/unmute_response.dart +++ b/packages/stream_chat/lib/open_api/model/unmute_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/unread_counts_channel.dart b/packages/stream_chat/lib/open_api/model/unread_counts_channel.dart index 7f2f40b4f8..b7d5697534 100644 --- a/packages/stream_chat/lib/open_api/model/unread_counts_channel.dart +++ b/packages/stream_chat/lib/open_api/model/unread_counts_channel.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/unread_counts_channel_type.dart b/packages/stream_chat/lib/open_api/model/unread_counts_channel_type.dart index f0f0cf6e56..9bf05a83c4 100644 --- a/packages/stream_chat/lib/open_api/model/unread_counts_channel_type.dart +++ b/packages/stream_chat/lib/open_api/model/unread_counts_channel_type.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/unread_counts_thread.dart b/packages/stream_chat/lib/open_api/model/unread_counts_thread.dart index 4382d4f024..74455ebb63 100644 --- a/packages/stream_chat/lib/open_api/model/unread_counts_thread.dart +++ b/packages/stream_chat/lib/open_api/model/unread_counts_thread.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/update_block_list_request.dart b/packages/stream_chat/lib/open_api/model/update_block_list_request.dart index 464ea7a92b..6dda9b428a 100644 --- a/packages/stream_chat/lib/open_api/model/update_block_list_request.dart +++ b/packages/stream_chat/lib/open_api/model/update_block_list_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/update_block_list_response.dart b/packages/stream_chat/lib/open_api/model/update_block_list_response.dart index 97d236b734..cc08e5ce66 100644 --- a/packages/stream_chat/lib/open_api/model/update_block_list_response.dart +++ b/packages/stream_chat/lib/open_api/model/update_block_list_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/update_channel_partial_request.dart b/packages/stream_chat/lib/open_api/model/update_channel_partial_request.dart index 487a1ab38a..fb8cd7778d 100644 --- a/packages/stream_chat/lib/open_api/model/update_channel_partial_request.dart +++ b/packages/stream_chat/lib/open_api/model/update_channel_partial_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/update_channel_partial_response.dart b/packages/stream_chat/lib/open_api/model/update_channel_partial_response.dart index e21b05b0d7..573e0f6352 100644 --- a/packages/stream_chat/lib/open_api/model/update_channel_partial_response.dart +++ b/packages/stream_chat/lib/open_api/model/update_channel_partial_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/update_channel_request.dart b/packages/stream_chat/lib/open_api/model/update_channel_request.dart index cb83c5b085..c816205232 100644 --- a/packages/stream_chat/lib/open_api/model/update_channel_request.dart +++ b/packages/stream_chat/lib/open_api/model/update_channel_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/update_channel_response.dart b/packages/stream_chat/lib/open_api/model/update_channel_response.dart index 81a99d9bc8..72c233c6cc 100644 --- a/packages/stream_chat/lib/open_api/model/update_channel_response.dart +++ b/packages/stream_chat/lib/open_api/model/update_channel_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/update_live_location_request.dart b/packages/stream_chat/lib/open_api/model/update_live_location_request.dart index fa57561656..f1117db572 100644 --- a/packages/stream_chat/lib/open_api/model/update_live_location_request.dart +++ b/packages/stream_chat/lib/open_api/model/update_live_location_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/update_member_partial_request.dart b/packages/stream_chat/lib/open_api/model/update_member_partial_request.dart index 29bfae37ba..7cc7774011 100644 --- a/packages/stream_chat/lib/open_api/model/update_member_partial_request.dart +++ b/packages/stream_chat/lib/open_api/model/update_member_partial_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/update_member_partial_response.dart b/packages/stream_chat/lib/open_api/model/update_member_partial_response.dart index 12bff111af..9bb6368143 100644 --- a/packages/stream_chat/lib/open_api/model/update_member_partial_response.dart +++ b/packages/stream_chat/lib/open_api/model/update_member_partial_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/update_message_partial_request.dart b/packages/stream_chat/lib/open_api/model/update_message_partial_request.dart index b30b64d3ab..6cbc170ca8 100644 --- a/packages/stream_chat/lib/open_api/model/update_message_partial_request.dart +++ b/packages/stream_chat/lib/open_api/model/update_message_partial_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/update_message_partial_response.dart b/packages/stream_chat/lib/open_api/model/update_message_partial_response.dart index 45d5741eb1..82dcf0c901 100644 --- a/packages/stream_chat/lib/open_api/model/update_message_partial_response.dart +++ b/packages/stream_chat/lib/open_api/model/update_message_partial_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/update_message_request.dart b/packages/stream_chat/lib/open_api/model/update_message_request.dart index 77a3333512..4430294f94 100644 --- a/packages/stream_chat/lib/open_api/model/update_message_request.dart +++ b/packages/stream_chat/lib/open_api/model/update_message_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/update_message_response.dart b/packages/stream_chat/lib/open_api/model/update_message_response.dart index 2e2f296571..7c9a6d8e4e 100644 --- a/packages/stream_chat/lib/open_api/model/update_message_response.dart +++ b/packages/stream_chat/lib/open_api/model/update_message_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/update_poll_option_request.dart b/packages/stream_chat/lib/open_api/model/update_poll_option_request.dart index 348300d7fe..88939d3652 100644 --- a/packages/stream_chat/lib/open_api/model/update_poll_option_request.dart +++ b/packages/stream_chat/lib/open_api/model/update_poll_option_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/update_poll_partial_request.dart b/packages/stream_chat/lib/open_api/model/update_poll_partial_request.dart index 0072c941c1..57c8f3c808 100644 --- a/packages/stream_chat/lib/open_api/model/update_poll_partial_request.dart +++ b/packages/stream_chat/lib/open_api/model/update_poll_partial_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/update_poll_request.dart b/packages/stream_chat/lib/open_api/model/update_poll_request.dart index bf9964d3cc..fa9522ec3d 100644 --- a/packages/stream_chat/lib/open_api/model/update_poll_request.dart +++ b/packages/stream_chat/lib/open_api/model/update_poll_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/update_queue_request.dart b/packages/stream_chat/lib/open_api/model/update_queue_request.dart index 7ba9bc55ab..45db3294de 100644 --- a/packages/stream_chat/lib/open_api/model/update_queue_request.dart +++ b/packages/stream_chat/lib/open_api/model/update_queue_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/update_reminder_request.dart b/packages/stream_chat/lib/open_api/model/update_reminder_request.dart index f362b16928..4d5497a5b3 100644 --- a/packages/stream_chat/lib/open_api/model/update_reminder_request.dart +++ b/packages/stream_chat/lib/open_api/model/update_reminder_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; @@ -18,9 +18,15 @@ part 'update_reminder_request.freezed.dart'; @JsonSerializable() class UpdateReminderRequest with _$UpdateReminderRequest { const UpdateReminderRequest({ + this.expiresAt, this.remindAt, }); + @override + @StreamDateTimeConverter() + @JsonKey(name: 'expires_at') + final DateTime? expiresAt; + @override @StreamDateTimeConverter() @JsonKey(name: 'remind_at') diff --git a/packages/stream_chat/lib/open_api/model/update_reminder_request.freezed.dart b/packages/stream_chat/lib/open_api/model/update_reminder_request.freezed.dart index 9cf38c02ef..10513dd224 100644 --- a/packages/stream_chat/lib/open_api/model/update_reminder_request.freezed.dart +++ b/packages/stream_chat/lib/open_api/model/update_reminder_request.freezed.dart @@ -13,6 +13,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$UpdateReminderRequest { + DateTime? get expiresAt; DateTime? get remindAt; /// Create a copy of UpdateReminderRequest @@ -30,15 +31,16 @@ mixin _$UpdateReminderRequest { return identical(this, other) || (other.runtimeType == runtimeType && other is UpdateReminderRequest && + (identical(other.expiresAt, expiresAt) || other.expiresAt == expiresAt) && (identical(other.remindAt, remindAt) || other.remindAt == remindAt)); } @override - int get hashCode => Object.hash(runtimeType, remindAt); + int get hashCode => Object.hash(runtimeType, expiresAt, remindAt); @override String toString() { - return 'UpdateReminderRequest(remindAt: $remindAt)'; + return 'UpdateReminderRequest(expiresAt: $expiresAt, remindAt: $remindAt)'; } } @@ -49,7 +51,7 @@ abstract mixin class $UpdateReminderRequestCopyWith<$Res> { $Res Function(UpdateReminderRequest) _then, ) = _$UpdateReminderRequestCopyWithImpl; @useResult - $Res call({DateTime? remindAt}); + $Res call({DateTime? expiresAt, DateTime? remindAt}); } /// @nodoc @@ -63,9 +65,13 @@ class _$UpdateReminderRequestCopyWithImpl<$Res> implements $UpdateReminderReques /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override - $Res call({Object? remindAt = freezed}) { + $Res call({Object? expiresAt = freezed, Object? remindAt = freezed}) { return _then( UpdateReminderRequest( + expiresAt: freezed == expiresAt + ? _self.expiresAt + : expiresAt // ignore: cast_nullable_to_non_nullable + as DateTime?, remindAt: freezed == remindAt ? _self.remindAt : remindAt // ignore: cast_nullable_to_non_nullable diff --git a/packages/stream_chat/lib/open_api/model/update_reminder_request.g.dart b/packages/stream_chat/lib/open_api/model/update_reminder_request.g.dart index ed16046677..493aff7407 100644 --- a/packages/stream_chat/lib/open_api/model/update_reminder_request.g.dart +++ b/packages/stream_chat/lib/open_api/model/update_reminder_request.g.dart @@ -9,6 +9,10 @@ part of 'update_reminder_request.dart'; UpdateReminderRequest _$UpdateReminderRequestFromJson( Map json, ) => UpdateReminderRequest( + expiresAt: _$JsonConverterFromJson( + json['expires_at'], + const StreamDateTimeConverter().fromJson, + ), remindAt: _$JsonConverterFromJson( json['remind_at'], const StreamDateTimeConverter().fromJson, @@ -18,6 +22,10 @@ UpdateReminderRequest _$UpdateReminderRequestFromJson( Map _$UpdateReminderRequestToJson( UpdateReminderRequest instance, ) => { + 'expires_at': _$JsonConverterToJson( + instance.expiresAt, + const StreamDateTimeConverter().toJson, + ), 'remind_at': _$JsonConverterToJson( instance.remindAt, const StreamDateTimeConverter().toJson, diff --git a/packages/stream_chat/lib/open_api/model/update_reminder_response.dart b/packages/stream_chat/lib/open_api/model/update_reminder_response.dart index 8eb129d40d..b8df7f1928 100644 --- a/packages/stream_chat/lib/open_api/model/update_reminder_response.dart +++ b/packages/stream_chat/lib/open_api/model/update_reminder_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/update_thread_partial_request.dart b/packages/stream_chat/lib/open_api/model/update_thread_partial_request.dart index 03c3a3a059..effdef6b55 100644 --- a/packages/stream_chat/lib/open_api/model/update_thread_partial_request.dart +++ b/packages/stream_chat/lib/open_api/model/update_thread_partial_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/update_thread_partial_response.dart b/packages/stream_chat/lib/open_api/model/update_thread_partial_response.dart index bc346b7bce..08616ee3d7 100644 --- a/packages/stream_chat/lib/open_api/model/update_thread_partial_response.dart +++ b/packages/stream_chat/lib/open_api/model/update_thread_partial_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/update_user_group_request.dart b/packages/stream_chat/lib/open_api/model/update_user_group_request.dart index 9d4f920933..e621a60c5d 100644 --- a/packages/stream_chat/lib/open_api/model/update_user_group_request.dart +++ b/packages/stream_chat/lib/open_api/model/update_user_group_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/update_user_group_response.dart b/packages/stream_chat/lib/open_api/model/update_user_group_response.dart index e5e9bba8da..811cf7c94b 100644 --- a/packages/stream_chat/lib/open_api/model/update_user_group_response.dart +++ b/packages/stream_chat/lib/open_api/model/update_user_group_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/update_user_partial_request.dart b/packages/stream_chat/lib/open_api/model/update_user_partial_request.dart index 28acdfb9aa..a88f6d35d7 100644 --- a/packages/stream_chat/lib/open_api/model/update_user_partial_request.dart +++ b/packages/stream_chat/lib/open_api/model/update_user_partial_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/update_users_partial_request.dart b/packages/stream_chat/lib/open_api/model/update_users_partial_request.dart index c21dfc5ec8..3ecd805f6d 100644 --- a/packages/stream_chat/lib/open_api/model/update_users_partial_request.dart +++ b/packages/stream_chat/lib/open_api/model/update_users_partial_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/update_users_request.dart b/packages/stream_chat/lib/open_api/model/update_users_request.dart index 7d35964b79..f36d7b73db 100644 --- a/packages/stream_chat/lib/open_api/model/update_users_request.dart +++ b/packages/stream_chat/lib/open_api/model/update_users_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/update_users_response.dart b/packages/stream_chat/lib/open_api/model/update_users_response.dart index 3c48d33cd9..b524589097 100644 --- a/packages/stream_chat/lib/open_api/model/update_users_response.dart +++ b/packages/stream_chat/lib/open_api/model/update_users_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; @@ -28,7 +28,9 @@ class UpdateUsersResponse with _$UpdateUsersResponse { final String duration; @override - @Deprecated('This field is deprecated.') + @Deprecated( + "Always empty. Removing a user from a team no longer deletes their memberships in that team's channels, so there is no task to poll.", + ) @JsonKey(name: 'membership_deletion_task_id') final String membershipDeletionTaskId; diff --git a/packages/stream_chat/lib/open_api/model/upload_channel_file_request.dart b/packages/stream_chat/lib/open_api/model/upload_channel_file_request.dart index 05ee20de13..bdd523094b 100644 --- a/packages/stream_chat/lib/open_api/model/upload_channel_file_request.dart +++ b/packages/stream_chat/lib/open_api/model/upload_channel_file_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/upload_channel_file_response.dart b/packages/stream_chat/lib/open_api/model/upload_channel_file_response.dart index b435f40f35..ad21e6fb42 100644 --- a/packages/stream_chat/lib/open_api/model/upload_channel_file_response.dart +++ b/packages/stream_chat/lib/open_api/model/upload_channel_file_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/upload_channel_request.dart b/packages/stream_chat/lib/open_api/model/upload_channel_request.dart index 4ee6bcc269..7b71f4b9b9 100644 --- a/packages/stream_chat/lib/open_api/model/upload_channel_request.dart +++ b/packages/stream_chat/lib/open_api/model/upload_channel_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/upload_channel_response.dart b/packages/stream_chat/lib/open_api/model/upload_channel_response.dart index fbb987166a..4aab2166ef 100644 --- a/packages/stream_chat/lib/open_api/model/upload_channel_response.dart +++ b/packages/stream_chat/lib/open_api/model/upload_channel_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/upsert_action_config_item.dart b/packages/stream_chat/lib/open_api/model/upsert_action_config_item.dart index ac22eb0485..c15de893f4 100644 --- a/packages/stream_chat/lib/open_api/model/upsert_action_config_item.dart +++ b/packages/stream_chat/lib/open_api/model/upsert_action_config_item.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/upsert_action_config_request.dart b/packages/stream_chat/lib/open_api/model/upsert_action_config_request.dart index bafec88b0f..68d49edaa2 100644 --- a/packages/stream_chat/lib/open_api/model/upsert_action_config_request.dart +++ b/packages/stream_chat/lib/open_api/model/upsert_action_config_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/upsert_action_config_response.dart b/packages/stream_chat/lib/open_api/model/upsert_action_config_response.dart index a413175ce6..43c66a59e1 100644 --- a/packages/stream_chat/lib/open_api/model/upsert_action_config_response.dart +++ b/packages/stream_chat/lib/open_api/model/upsert_action_config_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/upsert_config_request.dart b/packages/stream_chat/lib/open_api/model/upsert_config_request.dart index e336287c5e..c30cfaba88 100644 --- a/packages/stream_chat/lib/open_api/model/upsert_config_request.dart +++ b/packages/stream_chat/lib/open_api/model/upsert_config_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; @@ -31,6 +31,7 @@ class UpsertConfigRequest with _$UpsertConfigRequest { this.bodyguardConfig, this.floodConfig, this.googleVisionConfig, + this.intentConfig, required this.key, this.llmConfig, this.ruleBuilderConfig, @@ -91,6 +92,10 @@ class UpsertConfigRequest with _$UpsertConfigRequest { @JsonKey(name: 'google_vision_config') final GoogleVisionConfig? googleVisionConfig; + @override + @JsonKey(name: 'intent_config') + final IntentConfigRequest? intentConfig; + @override @JsonKey(name: 'key') final String key; diff --git a/packages/stream_chat/lib/open_api/model/upsert_config_request.freezed.dart b/packages/stream_chat/lib/open_api/model/upsert_config_request.freezed.dart index f43fe74a8c..b93381aaf6 100644 --- a/packages/stream_chat/lib/open_api/model/upsert_config_request.freezed.dart +++ b/packages/stream_chat/lib/open_api/model/upsert_config_request.freezed.dart @@ -26,6 +26,7 @@ mixin _$UpsertConfigRequest { AITextConfig? get bodyguardConfig; FloodConfig? get floodConfig; GoogleVisionConfig? get googleVisionConfig; + IntentConfigRequest? get intentConfig; String get key; LLMConfig? get llmConfig; RuleBuilderConfig? get ruleBuilderConfig; @@ -72,6 +73,7 @@ mixin _$UpsertConfigRequest { (identical(other.floodConfig, floodConfig) || other.floodConfig == floodConfig) && (identical(other.googleVisionConfig, googleVisionConfig) || other.googleVisionConfig == googleVisionConfig) && + (identical(other.intentConfig, intentConfig) || other.intentConfig == intentConfig) && (identical(other.key, key) || other.key == key) && (identical(other.llmConfig, llmConfig) || other.llmConfig == llmConfig) && (identical(other.ruleBuilderConfig, ruleBuilderConfig) || other.ruleBuilderConfig == ruleBuilderConfig) && @@ -98,6 +100,7 @@ mixin _$UpsertConfigRequest { bodyguardConfig, floodConfig, googleVisionConfig, + intentConfig, key, llmConfig, ruleBuilderConfig, @@ -108,7 +111,7 @@ mixin _$UpsertConfigRequest { @override String toString() { - return 'UpsertConfigRequest(aiAudioConfig: $aiAudioConfig, aiImageConfig: $aiImageConfig, aiTextConfig: $aiTextConfig, aiVideoConfig: $aiVideoConfig, async: $async, automodPlatformCircumventionConfig: $automodPlatformCircumventionConfig, automodSemanticFiltersConfig: $automodSemanticFiltersConfig, automodToxicityConfig: $automodToxicityConfig, awsRekognitionConfig: $awsRekognitionConfig, blockListConfig: $blockListConfig, bodyguardConfig: $bodyguardConfig, floodConfig: $floodConfig, googleVisionConfig: $googleVisionConfig, key: $key, llmConfig: $llmConfig, ruleBuilderConfig: $ruleBuilderConfig, team: $team, velocityFilterConfig: $velocityFilterConfig, videoCallRuleConfig: $videoCallRuleConfig)'; + return 'UpsertConfigRequest(aiAudioConfig: $aiAudioConfig, aiImageConfig: $aiImageConfig, aiTextConfig: $aiTextConfig, aiVideoConfig: $aiVideoConfig, async: $async, automodPlatformCircumventionConfig: $automodPlatformCircumventionConfig, automodSemanticFiltersConfig: $automodSemanticFiltersConfig, automodToxicityConfig: $automodToxicityConfig, awsRekognitionConfig: $awsRekognitionConfig, blockListConfig: $blockListConfig, bodyguardConfig: $bodyguardConfig, floodConfig: $floodConfig, googleVisionConfig: $googleVisionConfig, intentConfig: $intentConfig, key: $key, llmConfig: $llmConfig, ruleBuilderConfig: $ruleBuilderConfig, team: $team, velocityFilterConfig: $velocityFilterConfig, videoCallRuleConfig: $videoCallRuleConfig)'; } } @@ -133,6 +136,7 @@ abstract mixin class $UpsertConfigRequestCopyWith<$Res> { AITextConfig? bodyguardConfig, FloodConfig? floodConfig, GoogleVisionConfig? googleVisionConfig, + IntentConfigRequest? intentConfig, String key, LLMConfig? llmConfig, RuleBuilderConfig? ruleBuilderConfig, @@ -167,6 +171,7 @@ class _$UpsertConfigRequestCopyWithImpl<$Res> implements $UpsertConfigRequestCop Object? bodyguardConfig = freezed, Object? floodConfig = freezed, Object? googleVisionConfig = freezed, + Object? intentConfig = freezed, Object? key = null, Object? llmConfig = freezed, Object? ruleBuilderConfig = freezed, @@ -228,6 +233,10 @@ class _$UpsertConfigRequestCopyWithImpl<$Res> implements $UpsertConfigRequestCop ? _self.googleVisionConfig : googleVisionConfig // ignore: cast_nullable_to_non_nullable as GoogleVisionConfig?, + intentConfig: freezed == intentConfig + ? _self.intentConfig + : intentConfig // ignore: cast_nullable_to_non_nullable + as IntentConfigRequest?, key: null == key ? _self.key : key // ignore: cast_nullable_to_non_nullable diff --git a/packages/stream_chat/lib/open_api/model/upsert_config_request.g.dart b/packages/stream_chat/lib/open_api/model/upsert_config_request.g.dart index 88df7e0bdd..5687662295 100644 --- a/packages/stream_chat/lib/open_api/model/upsert_config_request.g.dart +++ b/packages/stream_chat/lib/open_api/model/upsert_config_request.g.dart @@ -60,6 +60,11 @@ UpsertConfigRequest _$UpsertConfigRequestFromJson( : GoogleVisionConfig.fromJson( json['google_vision_config'] as Map, ), + intentConfig: json['intent_config'] == null + ? null + : IntentConfigRequest.fromJson( + json['intent_config'] as Map, + ), key: json['key'] as String, llmConfig: json['llm_config'] == null ? null : LLMConfig.fromJson(json['llm_config'] as Map), ruleBuilderConfig: json['rule_builder_config'] == null @@ -96,6 +101,7 @@ Map _$UpsertConfigRequestToJson( 'bodyguard_config': instance.bodyguardConfig?.toJson(), 'flood_config': instance.floodConfig?.toJson(), 'google_vision_config': instance.googleVisionConfig?.toJson(), + 'intent_config': instance.intentConfig?.toJson(), 'key': instance.key, 'llm_config': instance.llmConfig?.toJson(), 'rule_builder_config': instance.ruleBuilderConfig?.toJson(), diff --git a/packages/stream_chat/lib/open_api/model/upsert_config_response.dart b/packages/stream_chat/lib/open_api/model/upsert_config_response.dart index 64a933ddc2..18862ca584 100644 --- a/packages/stream_chat/lib/open_api/model/upsert_config_response.dart +++ b/packages/stream_chat/lib/open_api/model/upsert_config_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/upsert_push_preferences_request.dart b/packages/stream_chat/lib/open_api/model/upsert_push_preferences_request.dart index b58878c1a1..d9dd57e74e 100644 --- a/packages/stream_chat/lib/open_api/model/upsert_push_preferences_request.dart +++ b/packages/stream_chat/lib/open_api/model/upsert_push_preferences_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/upsert_push_preferences_response.dart b/packages/stream_chat/lib/open_api/model/upsert_push_preferences_response.dart index 1d85bcea3a..c7ea78b6a3 100644 --- a/packages/stream_chat/lib/open_api/model/upsert_push_preferences_response.dart +++ b/packages/stream_chat/lib/open_api/model/upsert_push_preferences_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/user.dart b/packages/stream_chat/lib/open_api/model/user.dart index f954b8ef81..7ba7ae75f5 100644 --- a/packages/stream_chat/lib/open_api/model/user.dart +++ b/packages/stream_chat/lib/open_api/model/user.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/user_banned_event.dart b/packages/stream_chat/lib/open_api/model/user_banned_event.dart index b689ad7961..afb477f6d0 100644 --- a/packages/stream_chat/lib/open_api/model/user_banned_event.dart +++ b/packages/stream_chat/lib/open_api/model/user_banned_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/user_channel_count_rule_parameters.dart b/packages/stream_chat/lib/open_api/model/user_channel_count_rule_parameters.dart new file mode 100644 index 0000000000..f7da5e3b21 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_channel_count_rule_parameters.dart @@ -0,0 +1,37 @@ +// Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. + +// coverage:ignore-file +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' as core; + +import '../models.dart'; + +part 'user_channel_count_rule_parameters.g.dart'; +part 'user_channel_count_rule_parameters.freezed.dart'; + +@freezed +@immutable +@JsonSerializable() +class UserChannelCountRuleParameters with _$UserChannelCountRuleParameters { + const UserChannelCountRuleParameters({ + this.threshold, + this.timeWindow, + }); + + @override + @JsonKey(name: 'threshold') + final int? threshold; + + @override + @JsonKey(name: 'time_window') + final String? timeWindow; + + Map toJson() => _$UserChannelCountRuleParametersToJson(this); + + static UserChannelCountRuleParameters fromJson(Map json) => + _$UserChannelCountRuleParametersFromJson(json); +} diff --git a/packages/stream_chat/lib/open_api/model/user_channel_count_rule_parameters.freezed.dart b/packages/stream_chat/lib/open_api/model/user_channel_count_rule_parameters.freezed.dart new file mode 100644 index 0000000000..0cb3e43f45 --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_channel_count_rule_parameters.freezed.dart @@ -0,0 +1,82 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'user_channel_count_rule_parameters.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UserChannelCountRuleParameters { + int? get threshold; + String? get timeWindow; + + /// Create a copy of UserChannelCountRuleParameters + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UserChannelCountRuleParametersCopyWith get copyWith => + _$UserChannelCountRuleParametersCopyWithImpl( + this as UserChannelCountRuleParameters, + _$identity, + ); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UserChannelCountRuleParameters && + (identical(other.threshold, threshold) || other.threshold == threshold) && + (identical(other.timeWindow, timeWindow) || other.timeWindow == timeWindow)); + } + + @override + int get hashCode => Object.hash(runtimeType, threshold, timeWindow); + + @override + String toString() { + return 'UserChannelCountRuleParameters(threshold: $threshold, timeWindow: $timeWindow)'; + } +} + +/// @nodoc +abstract mixin class $UserChannelCountRuleParametersCopyWith<$Res> { + factory $UserChannelCountRuleParametersCopyWith( + UserChannelCountRuleParameters value, + $Res Function(UserChannelCountRuleParameters) _then, + ) = _$UserChannelCountRuleParametersCopyWithImpl; + @useResult + $Res call({int? threshold, String? timeWindow}); +} + +/// @nodoc +class _$UserChannelCountRuleParametersCopyWithImpl<$Res> implements $UserChannelCountRuleParametersCopyWith<$Res> { + _$UserChannelCountRuleParametersCopyWithImpl(this._self, this._then); + + final UserChannelCountRuleParameters _self; + final $Res Function(UserChannelCountRuleParameters) _then; + + /// Create a copy of UserChannelCountRuleParameters + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? threshold = freezed, Object? timeWindow = freezed}) { + return _then( + UserChannelCountRuleParameters( + threshold: freezed == threshold + ? _self.threshold + : threshold // ignore: cast_nullable_to_non_nullable + as int?, + timeWindow: freezed == timeWindow + ? _self.timeWindow + : timeWindow // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/open_api/model/user_channel_count_rule_parameters.g.dart b/packages/stream_chat/lib/open_api/model/user_channel_count_rule_parameters.g.dart new file mode 100644 index 0000000000..90e2d262eb --- /dev/null +++ b/packages/stream_chat/lib/open_api/model/user_channel_count_rule_parameters.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'user_channel_count_rule_parameters.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UserChannelCountRuleParameters _$UserChannelCountRuleParametersFromJson( + Map json, +) => UserChannelCountRuleParameters( + threshold: (json['threshold'] as num?)?.toInt(), + timeWindow: json['time_window'] as String?, +); + +Map _$UserChannelCountRuleParametersToJson( + UserChannelCountRuleParameters instance, +) => { + 'threshold': instance.threshold, + 'time_window': instance.timeWindow, +}; diff --git a/packages/stream_chat/lib/open_api/model/user_created_within_parameters.dart b/packages/stream_chat/lib/open_api/model/user_created_within_parameters.dart index 24fc09c6e5..0d41123fdb 100644 --- a/packages/stream_chat/lib/open_api/model/user_created_within_parameters.dart +++ b/packages/stream_chat/lib/open_api/model/user_created_within_parameters.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/user_custom_property_parameters.dart b/packages/stream_chat/lib/open_api/model/user_custom_property_parameters.dart index 29cdd9b804..20dd6eae52 100644 --- a/packages/stream_chat/lib/open_api/model/user_custom_property_parameters.dart +++ b/packages/stream_chat/lib/open_api/model/user_custom_property_parameters.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/user_deactivated_event.dart b/packages/stream_chat/lib/open_api/model/user_deactivated_event.dart index 8f760470a9..161f5bf3e7 100644 --- a/packages/stream_chat/lib/open_api/model/user_deactivated_event.dart +++ b/packages/stream_chat/lib/open_api/model/user_deactivated_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/user_deleted_event.dart b/packages/stream_chat/lib/open_api/model/user_deleted_event.dart index 23a4d823ed..7f6b6f1418 100644 --- a/packages/stream_chat/lib/open_api/model/user_deleted_event.dart +++ b/packages/stream_chat/lib/open_api/model/user_deleted_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/user_group.dart b/packages/stream_chat/lib/open_api/model/user_group.dart index c883522cb4..e93e3219e9 100644 --- a/packages/stream_chat/lib/open_api/model/user_group.dart +++ b/packages/stream_chat/lib/open_api/model/user_group.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/user_group_created_event.dart b/packages/stream_chat/lib/open_api/model/user_group_created_event.dart index 13d10b762a..8e36d6c602 100644 --- a/packages/stream_chat/lib/open_api/model/user_group_created_event.dart +++ b/packages/stream_chat/lib/open_api/model/user_group_created_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/user_group_deleted_event.dart b/packages/stream_chat/lib/open_api/model/user_group_deleted_event.dart index bbb031f9b1..cb4f7befbc 100644 --- a/packages/stream_chat/lib/open_api/model/user_group_deleted_event.dart +++ b/packages/stream_chat/lib/open_api/model/user_group_deleted_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/user_group_member.dart b/packages/stream_chat/lib/open_api/model/user_group_member.dart index f2eb961587..9cfd4869cc 100644 --- a/packages/stream_chat/lib/open_api/model/user_group_member.dart +++ b/packages/stream_chat/lib/open_api/model/user_group_member.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/user_group_member_added_event.dart b/packages/stream_chat/lib/open_api/model/user_group_member_added_event.dart index 13f31c45ae..a7d3eca655 100644 --- a/packages/stream_chat/lib/open_api/model/user_group_member_added_event.dart +++ b/packages/stream_chat/lib/open_api/model/user_group_member_added_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/user_group_member_removed_event.dart b/packages/stream_chat/lib/open_api/model/user_group_member_removed_event.dart index 4a19310c2a..1e567e275e 100644 --- a/packages/stream_chat/lib/open_api/model/user_group_member_removed_event.dart +++ b/packages/stream_chat/lib/open_api/model/user_group_member_removed_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/user_group_response.dart b/packages/stream_chat/lib/open_api/model/user_group_response.dart index 702952f9a9..e12e1f4da2 100644 --- a/packages/stream_chat/lib/open_api/model/user_group_response.dart +++ b/packages/stream_chat/lib/open_api/model/user_group_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/user_group_updated_event.dart b/packages/stream_chat/lib/open_api/model/user_group_updated_event.dart index 3d013952b2..d29e4243ff 100644 --- a/packages/stream_chat/lib/open_api/model/user_group_updated_event.dart +++ b/packages/stream_chat/lib/open_api/model/user_group_updated_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/user_identical_content_count_parameters.dart b/packages/stream_chat/lib/open_api/model/user_identical_content_count_parameters.dart index 3bf4b58542..d085f3f89f 100644 --- a/packages/stream_chat/lib/open_api/model/user_identical_content_count_parameters.dart +++ b/packages/stream_chat/lib/open_api/model/user_identical_content_count_parameters.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/user_identical_image_count_parameters.dart b/packages/stream_chat/lib/open_api/model/user_identical_image_count_parameters.dart index 121d5f8f0e..052efdf55e 100644 --- a/packages/stream_chat/lib/open_api/model/user_identical_image_count_parameters.dart +++ b/packages/stream_chat/lib/open_api/model/user_identical_image_count_parameters.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/user_messages_deleted_event.dart b/packages/stream_chat/lib/open_api/model/user_messages_deleted_event.dart index 19ccd50d1e..de1cd1e41e 100644 --- a/packages/stream_chat/lib/open_api/model/user_messages_deleted_event.dart +++ b/packages/stream_chat/lib/open_api/model/user_messages_deleted_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/user_mute_response.dart b/packages/stream_chat/lib/open_api/model/user_mute_response.dart index 45647197ba..1626b22e3a 100644 --- a/packages/stream_chat/lib/open_api/model/user_mute_response.dart +++ b/packages/stream_chat/lib/open_api/model/user_mute_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/user_muted_event.dart b/packages/stream_chat/lib/open_api/model/user_muted_event.dart index 5cacf2368f..76e256b04f 100644 --- a/packages/stream_chat/lib/open_api/model/user_muted_event.dart +++ b/packages/stream_chat/lib/open_api/model/user_muted_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/user_presence_changed_event.dart b/packages/stream_chat/lib/open_api/model/user_presence_changed_event.dart index fd1789382a..31d51091ca 100644 --- a/packages/stream_chat/lib/open_api/model/user_presence_changed_event.dart +++ b/packages/stream_chat/lib/open_api/model/user_presence_changed_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/user_reaction_count_rule_parameters.dart b/packages/stream_chat/lib/open_api/model/user_reaction_count_rule_parameters.dart index 6511c05c01..ebb038e776 100644 --- a/packages/stream_chat/lib/open_api/model/user_reaction_count_rule_parameters.dart +++ b/packages/stream_chat/lib/open_api/model/user_reaction_count_rule_parameters.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/user_reactivated_event.dart b/packages/stream_chat/lib/open_api/model/user_reactivated_event.dart index 3e7650102c..fecc8b5f38 100644 --- a/packages/stream_chat/lib/open_api/model/user_reactivated_event.dart +++ b/packages/stream_chat/lib/open_api/model/user_reactivated_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/user_request.dart b/packages/stream_chat/lib/open_api/model/user_request.dart index 7e21db05d2..ff31d5f037 100644 --- a/packages/stream_chat/lib/open_api/model/user_request.dart +++ b/packages/stream_chat/lib/open_api/model/user_request.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/user_response.dart b/packages/stream_chat/lib/open_api/model/user_response.dart index 2767df949a..cc273cefe4 100644 --- a/packages/stream_chat/lib/open_api/model/user_response.dart +++ b/packages/stream_chat/lib/open_api/model/user_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/user_response_common_fields.dart b/packages/stream_chat/lib/open_api/model/user_response_common_fields.dart index f68930889c..5da12dfeaf 100644 --- a/packages/stream_chat/lib/open_api/model/user_response_common_fields.dart +++ b/packages/stream_chat/lib/open_api/model/user_response_common_fields.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/user_response_privacy_fields.dart b/packages/stream_chat/lib/open_api/model/user_response_privacy_fields.dart index 88e7a6f04c..c13084e3bf 100644 --- a/packages/stream_chat/lib/open_api/model/user_response_privacy_fields.dart +++ b/packages/stream_chat/lib/open_api/model/user_response_privacy_fields.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/user_role_parameters.dart b/packages/stream_chat/lib/open_api/model/user_role_parameters.dart index e21b4a48cd..ec3d872881 100644 --- a/packages/stream_chat/lib/open_api/model/user_role_parameters.dart +++ b/packages/stream_chat/lib/open_api/model/user_role_parameters.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/user_rule_parameters.dart b/packages/stream_chat/lib/open_api/model/user_rule_parameters.dart index 8a8f3029a5..9b2331492d 100644 --- a/packages/stream_chat/lib/open_api/model/user_rule_parameters.dart +++ b/packages/stream_chat/lib/open_api/model/user_rule_parameters.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/user_unbanned_event.dart b/packages/stream_chat/lib/open_api/model/user_unbanned_event.dart index f908f4b496..2ec338b7ea 100644 --- a/packages/stream_chat/lib/open_api/model/user_unbanned_event.dart +++ b/packages/stream_chat/lib/open_api/model/user_unbanned_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/user_updated_event.dart b/packages/stream_chat/lib/open_api/model/user_updated_event.dart index 35d66c2a85..8ca9f4dc18 100644 --- a/packages/stream_chat/lib/open_api/model/user_updated_event.dart +++ b/packages/stream_chat/lib/open_api/model/user_updated_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/user_watching_start_event.dart b/packages/stream_chat/lib/open_api/model/user_watching_start_event.dart index 2332210e1c..4d44572479 100644 --- a/packages/stream_chat/lib/open_api/model/user_watching_start_event.dart +++ b/packages/stream_chat/lib/open_api/model/user_watching_start_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/user_watching_stop_event.dart b/packages/stream_chat/lib/open_api/model/user_watching_stop_event.dart index c0683d091b..e391e45ee0 100644 --- a/packages/stream_chat/lib/open_api/model/user_watching_stop_event.dart +++ b/packages/stream_chat/lib/open_api/model/user_watching_stop_event.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/velocity_filter_config.dart b/packages/stream_chat/lib/open_api/model/velocity_filter_config.dart index 7725e8441b..d9abca529e 100644 --- a/packages/stream_chat/lib/open_api/model/velocity_filter_config.dart +++ b/packages/stream_chat/lib/open_api/model/velocity_filter_config.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/velocity_filter_config_rule.dart b/packages/stream_chat/lib/open_api/model/velocity_filter_config_rule.dart index c7bb4851bd..5bfdf8a621 100644 --- a/packages/stream_chat/lib/open_api/model/velocity_filter_config_rule.dart +++ b/packages/stream_chat/lib/open_api/model/velocity_filter_config_rule.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/video_call_rule_config.dart b/packages/stream_chat/lib/open_api/model/video_call_rule_config.dart index 0732ca385f..55177d2a41 100644 --- a/packages/stream_chat/lib/open_api/model/video_call_rule_config.dart +++ b/packages/stream_chat/lib/open_api/model/video_call_rule_config.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/video_content_parameters.dart b/packages/stream_chat/lib/open_api/model/video_content_parameters.dart index 956ace86e2..d843e747ae 100644 --- a/packages/stream_chat/lib/open_api/model/video_content_parameters.dart +++ b/packages/stream_chat/lib/open_api/model/video_content_parameters.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/video_rule_parameters.dart b/packages/stream_chat/lib/open_api/model/video_rule_parameters.dart index 6e17455360..b86bdd505c 100644 --- a/packages/stream_chat/lib/open_api/model/video_rule_parameters.dart +++ b/packages/stream_chat/lib/open_api/model/video_rule_parameters.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/vote_data.dart b/packages/stream_chat/lib/open_api/model/vote_data.dart index fcf452db15..cffd8def00 100644 --- a/packages/stream_chat/lib/open_api/model/vote_data.dart +++ b/packages/stream_chat/lib/open_api/model/vote_data.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/wrapped_unread_counts_response.dart b/packages/stream_chat/lib/open_api/model/wrapped_unread_counts_response.dart index 0d3c151209..66316a4549 100644 --- a/packages/stream_chat/lib/open_api/model/wrapped_unread_counts_response.dart +++ b/packages/stream_chat/lib/open_api/model/wrapped_unread_counts_response.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/model/ws_auth_message.dart b/packages/stream_chat/lib/open_api/model/ws_auth_message.dart index e239c32835..a1ab001eae 100644 --- a/packages/stream_chat/lib/open_api/model/ws_auth_message.dart +++ b/packages/stream_chat/lib/open_api/model/ws_auth_message.dart @@ -1,7 +1,7 @@ // Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT. // coverage:ignore-file -// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first +// ignore_for_file: unused_import, unnecessary_import, prefer_single_quotes, require_trailing_commas, unnecessary_raw_strings, public_member_api_docs, sort_constructors_first, provide_deprecation_message import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:json_annotation/json_annotation.dart'; diff --git a/packages/stream_chat/lib/open_api/models.dart b/packages/stream_chat/lib/open_api/models.dart index 0103ba1f1e..2322b9653e 100644 --- a/packages/stream_chat/lib/open_api/models.dart +++ b/packages/stream_chat/lib/open_api/models.dart @@ -222,6 +222,10 @@ export 'model/image_upload_response.dart'; export 'model/images.dart'; export 'model/import_block_list_request.dart'; export 'model/import_block_list_response.dart'; +export 'model/intent_config_request.dart'; +export 'model/intent_config_response.dart'; +export 'model/intent_topic_request.dart'; +export 'model/intent_topic_response.dart'; export 'model/keyframe_ocr_rule_parameters.dart'; export 'model/keyframe_rule_parameters.dart'; export 'model/llm_config.dart'; @@ -461,6 +465,7 @@ export 'model/upsert_push_preferences_request.dart'; export 'model/upsert_push_preferences_response.dart'; export 'model/user.dart'; export 'model/user_banned_event.dart'; +export 'model/user_channel_count_rule_parameters.dart'; export 'model/user_created_within_parameters.dart'; export 'model/user_custom_property_parameters.dart'; export 'model/user_deactivated_event.dart'; From ce2ba7e00866c3c9fe48892d6dc01e6df4775c09 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Fri, 2 Oct 2026 18:32:08 +0200 Subject: [PATCH 33/36] refactor(llc)!: route uploads through a v2 multipart client (#3040) Co-authored-by: Claude Opus 5.5 (1M context) --- .claude/skills/openapi-migration/SKILL.md | 5 +- core-migration/09-uploads.md | 122 ++++- migrations/v11-migration.md | 49 +- openapi-migration/12-uploads-cdn.md | 68 ++- openapi-migration/README.md | 2 +- openapi-migration/tool/generate_plan.py | 54 +- packages/stream_chat/CHANGELOG.md | 5 + packages/stream_chat/lib/src/cdn/cdn_api.dart | 90 ++++ .../stream_chat/lib/src/cdn/cdn_api.g.dart | 476 ++++++++++++++++++ .../lib/src/client/channel/channel.dart | 127 +++-- .../stream_chat/lib/src/client/client.dart | 74 ++- .../core/api/attachment_file_uploader.dart | 228 ++++----- .../lib/src/core/api/responses.dart | 31 -- .../lib/src/core/api/responses.g.dart | 11 - .../lib/src/core/api/stream_chat_api.dart | 10 +- .../src/repository/mapper/uploads_mapper.dart | 27 + packages/stream_chat/lib/stream_chat.dart | 1 + .../test/src/client/channel/channel_test.dart | 142 +++++- .../test/src/client/client_test.dart | 128 ----- ...ttachment_file_uploader_requests_test.dart | 98 ++++ .../api/attachment_file_uploader_test.dart | 383 +++++++------- .../test/src/core/api/responses_test.dart | 18 - .../src/core/api/stream_chat_api_test.dart | 4 - packages/stream_chat/test/src/fakes.dart | 5 - sample_app/lib/widgets/edit_group_sheet.dart | 18 +- 25 files changed, 1467 insertions(+), 709 deletions(-) create mode 100644 packages/stream_chat/lib/src/cdn/cdn_api.dart create mode 100644 packages/stream_chat/lib/src/cdn/cdn_api.g.dart create mode 100644 packages/stream_chat/lib/src/repository/mapper/uploads_mapper.dart create mode 100644 packages/stream_chat/test/src/core/api/attachment_file_uploader_requests_test.dart diff --git a/.claude/skills/openapi-migration/SKILL.md b/.claude/skills/openapi-migration/SKILL.md index 5e47c55c2a..df25e3d946 100644 --- a/.claude/skills/openapi-migration/SKILL.md +++ b/.claude/skills/openapi-migration/SKILL.md @@ -137,8 +137,9 @@ Work the ladder in order — the answer changes depending on *where* it's missin ``` 2. **Present in the spec, but the generated form is unusable.** Multipart uploads are the known case: the spec says `multipart/form-data`, but the generated `uploadFile` / `uploadChannelFile` take a JSON `@Body()` with no - progress or cancellation. Hand-write that call with retrofit over the generated *response* models, keep - `AttachmentFileUploader` off `DefaultApi`, and open a generator fix upstream — see the `openapi-codegen` skill. + progress or cancellation. Group 12 hand-wrote them as `lib/src/cdn/cdn_api.dart`, mirroring the generated + operations over their *response* models; a new multipart endpoint belongs there, not on `DefaultApi`. Open a + generator fix upstream too — see the `openapi-codegen` skill. Don't contort the call site around a broken signature. 3. **In a newer spec than the one our tree was generated from.** Regenerate — its own PR, never folded into a feature slice. Also `openapi-codegen`. diff --git a/core-migration/09-uploads.md b/core-migration/09-uploads.md index 70b12870a6..65b05eb49a 100644 --- a/core-migration/09-uploads.md +++ b/core-migration/09-uploads.md @@ -102,12 +102,130 @@ Do the same. `openapi-migration/12-uploads-cdn.md` already reaches this conclusi phase that acts on it. A generator fix is worth filing upstream (see the `openapi-codegen` skill) but is not a prerequisite. +**Group 12 landed it** as `lib/src/cdn/cdn_api.dart`, used by `StreamAttachmentFileUploader`. The +public changes: uploads return `Result` and deletes `Result`; the provider +receives a `Dio`; `StreamChatApi.fileUploader` is gone. The [Symbol Map](../migrations/v11-migration.md#symbol-map) lists them. This phase builds on +that client rather than writing another. + +## Design worked out for a later PR + +Group 12 (FLU-885) first went further than the endpoints: it adopted `stream_core`'s upload types +end to end. That was pulled out to keep the endpoint migration small, and is recorded here so this +phase can pick it up. + +### What the backend does, which shaped everything else + +- **Channel and standalone uploads are a permission boundary, not two copies of one endpoint.** + `/channels/{type}/{id}/file|image` checks the channel's `uploads` flag and its + `UploadAttachment` permission, and runs image moderation; `/uploads/file|image` checks the user's + `UploadAttachmentGlobal` permission (`monolith/utils/upload/upload.go:205-230`). The global routes + live in `lib/core/api/file`, are tagged product `common` on v2, and are granted next to the feeds + permissions, so they arrived for feeds and chat adopted them later (JS: "CHA-926 add global + file/image upload methods"). Message attachments must stay on the channel routes. +- **A standalone URL stays valid only as a user's or channel's image.** The docs say it is re-signed + only in an `image` / `image_url` field and expires anywhere else. +- **v1 and v2 are the same handlers**, the routes are neither gated nor deprecated, and neither + reads a form field beyond `file`, `user` (server-side only) and `upload_sizes` — so chat's + `extraData` parameter has never been sent. +- **A cid is `^[\w-]+:(!members-)?[\w-]+$`** (`ValidChannelCIDRe`): exactly one colon. + +### Shape arrived at + +```dart +client.fileUploader // StreamFileUploader, @internal constructor, like ModerationClient + └─ CdnApi // internal; the client takes an @internal CdnApi for tests, like DefaultApi + +class StreamFileUploader implements CdnClient { + Future> uploadImage(AttachmentFile image, {ChannelCid? channel, ...}); + Future> uploadFile(AttachmentFile file, {ChannelCid? channel, ...}); + Future> deleteImage(String url, {ChannelCid? channel, ...}); + Future> deleteFile(String url, {ChannelCid? channel, ...}); +} + +Channel.sendImage/sendFile/deleteImage/deleteFile // unchanged names; pass ChannelCid.from(...) +``` + +- **One class, routing on the channel.** A null `channel` uses `/uploads`, a given one the channel + routes. Android's `StreamFileUploader` and iOS's `StreamCDNStorage` are one class too, and internal. +- **It `implements` core's `CdnClient`.** Dart lets an override add optional parameters, so the + channel is an extra optional parameter on core's four methods. Core's `StreamAttachmentUploader` + can then drive it; called through `CdnClient` it cannot pass the channel, so message attachments + need a channel-bound `CdnClient` adapter — verified with a probe: through `client.fileUploader` a + message image reached `/uploads`, through a channel-bound client it reached the channel route and + went `Queued → Preparing → InProgress → Success`, and `task.cancel()` settled `UploadCancelled`. +- **No custom-CDN seam.** `AttachmentFileUploader` and its provider go; an app storing files + elsewhere uploads them itself and sends the attachment with its URL set. Android (`FileUploader`) + and iOS (`CDNStorage`) keep such a seam, so this is a real loss: adding one back later is an + interface `StreamFileUploader` implements, without a break. +- **`ChannelCid` and `ChannelType`** (`lib/src/core/models/channel_cid.dart`), both extension types + over `String`: + - `ChannelCid(String cid)` validates the shape — one colon, non-blank type and id — as iOS's + `ChannelId(cid:)` does; it leaves characters to the server rather than copying its regex, so it + can never reject a cid the backend accepts. `ChannelCid.from({required ChannelType type, + required String id})` builds one, typed so `type: .messaging` reads as a dot shorthand. + - `ChannelType` carries the five built-in types (`channel_config.go`) as constants and wraps any + custom one, following STYLE_GUIDE's "Prefer extension types over enums for server-defined values" + and the `PushProvider` precedent. iOS has the same set plus `.custom`. + - Neither retypes the 78 existing `String` cid members; a `ChannelCid` is a `String`, so retyping a + getter later is non-breaking, but retyping a parameter is not. + +### Alternatives considered and set aside + +| Alternative | Why not | +| --- | --- | +| Core's `CdnClient` alone as the seam | Cannot carry the channel, so every upload loses the channel's permission check | +| `StreamCdnClient` + `ChannelCdnClient` | Two classes for one concept; one class with an optional channel does the same | +| An `UploadsClient` facade in front of the uploader | A second public type that only renamed calls; the uploader itself is the field | +| A chat-owned `FileUploader` interface with a `ChannelUploadContext` | Context class replaced by `ChannelCid`; interface dropped with the custom seam | +| `ChannelCid.messaging(id)` and friends | Duplicates `ChannelType`'s list and does not cover custom types | +| `ChannelCid.from(type: String)` | Accepts any string, but loses the dot shorthand and the typo check | + +### Moving `Attachment.file` onto core's `AttachmentFile` + +Required for `StreamAttachmentUploader`, whose `StreamAttachment` carries core's file. Worked out: + +- **Persistence** goes through a `@DataSerializable` `AttachmentFileData` (`path`, `name`, + `mime_type`), restoring `AttachmentFile(path)` or `null` for a file made from bytes or picked on + the web; `schemaVersion` bumps because the stored bytes change. +- **`file_size`** is no longer derived from the file (core's `size` is async): every builder of an + attachment sets it in `extraData`, or `StreamAttachmentValidator`'s size limit silently passes. +- **Equality**: core's file has no `==`, so `file` leaves `Attachment.props`. +- **UI**: thumbnails read the path — a blob URL on the web, a file elsewhere (the picker caches + every composer attachment to a temp file) — instead of synchronous bytes. + +It surfaced three `stream_core` bugs, fixed in GetStream/stream-core-flutter#194: + +- `toMultipartFile` guarded the async `MultipartFile.fromFile` with `runSafelySync`, so its bytes + fallback never ran and a file made from bytes failed to upload on mobile and desktop. +- `AttachmentFile.fromData` lost its `name` on mobile and desktop: `XFile.fromData` ignores it + there, documented as working as intended (flutter/flutter#147361, #87812). With it went the MIME + type and extension, which broke keyboard-inserted images. +- `extension` returned the whole name for one without an extension (the same fix chat made in + #3008). + +### `cross_file` 0.4 + +`cross_file` 0.4.0 (flutter/packages#11010) removes `XFile.fromData`, `path`, `mimeType` and +`saveTo`, makes `name` async, and turns the package into a Flutter plugin. `stream_core` is pure +Dart and `image_picker` / `file_picker` still require 0.3, so core stays on `^0.3.4+2` for now. When +the pickers move, the plan is to stop exposing `cross_file` from core: + +1. Core owns `AttachmentFile.path`, `.bytes` and `.source({name, mimeType, length, openRead})`, with + a synchronous `name` and a streamed `toMultipartFile`; `source` covers Android `content://` and + iOS security-scoped files. +2. An `XFile` → `AttachmentFile` adapter moves to the Flutter layer, the only code that changes + when the pickers move; core's `AttachmentFile.fromXFile` is deprecated, then removed with the + `cross_file` dependency. +3. Chat's stored form grows a `kind` and a `uri` for scoped-storage files. + ## Decisions to make Option A is settled, above. What is left: -- Whether `AttachmentFileUploaderProvider` stays as it is or is replaced by a `CdnClient` injection - point à la `FeedsConfig.cdnClient`. +- ~~Whether `AttachmentFileUploaderProvider` stays as it is or is replaced by a `CdnClient` injection + point à la `FeedsConfig.cdnClient`.~~ **Answered by group 12:** the typedef is + `AttachmentFileUploader Function(Dio dio)`, given the `Dio` `DefaultApi` runs on, so it no longer + names `StreamHttpClient` and 05's last open item is unblocked. The history below is kept for why. **This decision changed shape, because phase [05](05-http-client.md) landed differently than assumed here.** The original framing was "retyped to `AttachmentFileUploader Function(Dio)` once diff --git a/migrations/v11-migration.md b/migrations/v11-migration.md index e021982c89..fbc4d311ec 100644 --- a/migrations/v11-migration.md +++ b/migrations/v11-migration.md @@ -29,6 +29,7 @@ onto Stream's OpenAPI-generated API client. - [Devices](#devices) - [Moderation](#moderation) - [App Settings](#app-settings) + - [File Upload](#file-upload) - [User Groups](#user-groups) - [Link Previews](#link-previews) - [Migration Checklist](#migration-checklist) @@ -74,6 +75,7 @@ from the spec, so don't subclass them or depend on their private constructors. | [**Error Handling**](#error-handling) | Failures carry `stream_core`'s sealed `StreamException` family instead of `StreamChatNetworkError`; `ChatErrorCode` → `StreamErrorCode`. API calls will return `Result` rather than throwing, endpoint by endpoint | | [**Moderation**](#moderation) | Muting, banning and flagging return a `Result` and call the moderation v2 API; `banUser`'s options map becomes named parameters; `unflagMessage`, `unflagUser` and `removeShadowBan` are removed | | [**App Settings**](#app-settings) | `getAppSettings` returns a `Result` instead of throwing; `GetAppSettingsResponse` is renamed `AppSettingsResponse` | +| [**File Upload**](#file-upload) | Uploads return a `Result` and deletes a `Result` instead of throwing; `AttachmentFileUploaderProvider` receives a `Dio` | | _(filled in per feature as PRs land)_ | | --- @@ -208,6 +210,11 @@ search-and-replace you can apply directly. `Kind` is one of `renamed`, `removed` | `GetAppSettingsResponse` identity `==` | value `==`, plus `copyWith` | `retyped` | Two instances with the same fields are now equal | | `AppSettings extends Equatable` / `UploadConfig extends Equatable`, `props` | `AppSettings` / `UploadConfig` (value `==`, `copyWith`) | `removed` | Equality is unchanged; `props` is gone and neither is an `Equatable` any more | | `StreamChatApi.general.getAppSettings()` | `StreamChatClient.getAppSettings()` | `removed` | The call moved to the generated client | +| `sendImage` / `sendFile` / `uploadImage` / `uploadFile` → `Future` and siblings | `Future>` | `retyped` | On `StreamChatClient`, `Channel` and `AttachmentFileUploader`. Returns a `Result` instead of throwing | +| `deleteImage` / `deleteFile` / `removeImage` / `removeFile` → `Future` | `Future>` | `retyped` | On `StreamChatClient`, `Channel` and `AttachmentFileUploader`. Returns a `Result` instead of throwing | +| `SendAttachmentResponse`, `SendFileResponse`, `SendImageResponse`, `UploadImageResponse`, `UploadFileResponse` | `UploadedFile` (`stream_core`) | `removed` | `.file` becomes `.fileUrl`; `.thumbUrl` is unchanged; `duration` is gone | +| `AttachmentFileUploaderProvider` = `AttachmentFileUploader Function(StreamHttpClient)` | `AttachmentFileUploader Function(Dio)` | `retyped` | Receives the client's `Dio`; `StreamAttachmentFileUploader(dio)` builds the default | +| `StreamChatApi.fileUploader`, `StreamChatApi(attachmentFileUploaderProvider:)` | `StreamChatClient(attachmentFileUploaderProvider:)` | `removed` | The uploader belongs to `StreamChatClient` | | _(more added per feature as PRs land)_ | | | | --- @@ -710,6 +717,46 @@ build them with their constructors — `AppSettingsResponse(duration: '0ms', app **`AppSettings` and `UploadConfig` no longer extend `Equatable`.** They still compare by value, `props` is gone, and both gain `copyWith`. +### File Upload + +**Uploads and deletes return a `Result` instead of throwing.** `sendImage`, `sendFile`, `uploadImage` and +`uploadFile` answer an `UploadedFile`, and the deletes carry no value on success. That holds on `Channel` and on +`AttachmentFileUploader`. A canceled upload is a failure whose error is a `StreamNetworkException` with +`isCancelled` set. + +```dart +// v10 +try { + final response = await channel.sendImage(file); + setImage(response.file); +} on StreamChatException catch (e) { + report(e); +} + +// v11 +final result = await channel.sendImage(file); +result.fold( + onSuccess: (uploaded) => setImage(uploaded.fileUrl), + onFailure: (error, _) => report(error), +); +``` + +**The response types are replaced by `UploadedFile`**, from `stream_core` and exported by this package. +`file` becomes `fileUrl`; `thumbUrl`, set for a video, is unchanged; `duration` is gone. Build one with +`UploadedFile(fileUrl: url)` where v10 wrote `SendFileResponse()..file = url`. + +**A custom uploader returns a `Result`, and its provider receives a `Dio`.** Implement the same eight methods, +returning `Result`s, and build the uploader from the `Dio` the provider hands it — the client's own, with its +authentication and error handling. + +```dart +// v10 +StreamChatClient(apiKey, attachmentFileUploaderProvider: (httpClient) => MyUploader(httpClient)); + +// v11 +StreamChatClient(apiKey, attachmentFileUploaderProvider: (dio) => MyUploader(dio)); +``` + --- ## Migration Checklist @@ -724,7 +771,7 @@ Work top to bottom; each item is independently verifiable. - [ ] Replace `ChatErrorCode` comparisons with `StreamErrorCode` constants - [ ] Apply every row of the [Symbol Map](#symbol-map) - [ ] Re-check custom data access: fields that used to arrive in `extraData` may now be typed properties -- [ ] If you implement `AttachmentFileUploader`, review its section under [Feature Areas](#feature-areas) +- [ ] If you implement `AttachmentFileUploader`, return a `Result` from it — see [File Upload](#file-upload) - [ ] If you persist models yourself, re-check nullability as endpoints move to the generated types, which are nullable wherever the API allows it - [ ] Replace `sort: null` on any list controller with `XSort.empty` if you relied on server ordering — see [Sorting](#sorting) diff --git a/openapi-migration/12-uploads-cdn.md b/openapi-migration/12-uploads-cdn.md index fc9ee4cadb..3b5c2b0fa9 100644 --- a/openapi-migration/12-uploads-cdn.md +++ b/openapi-migration/12-uploads-cdn.md @@ -13,14 +13,14 @@ | File | Method | Returns | | --- | --- | --- | -| `attachment_file_uploader.dart` | `sendImage` | `SendImageResponse` | -| `attachment_file_uploader.dart` | `sendFile` | `SendFileResponse` | -| `attachment_file_uploader.dart` | `deleteImage` | `EmptyResponse` | -| `attachment_file_uploader.dart` | `deleteFile` | `EmptyResponse` | -| `attachment_file_uploader.dart` | `uploadImage` | `UploadImageResponse` | -| `attachment_file_uploader.dart` | `uploadFile` | `UploadFileResponse` | -| `attachment_file_uploader.dart` | `removeImage` | `EmptyResponse` | -| `attachment_file_uploader.dart` | `removeFile` | `EmptyResponse` | +| `attachment_file_uploader.dart` | `sendImage` | `Result` | +| `attachment_file_uploader.dart` | `sendFile` | `Result` | +| `attachment_file_uploader.dart` | `deleteImage` | `Result` | +| `attachment_file_uploader.dart` | `deleteFile` | `Result` | +| `attachment_file_uploader.dart` | `uploadImage` | `Result` | +| `attachment_file_uploader.dart` | `uploadFile` | `Result` | +| `attachment_file_uploader.dart` | `removeImage` | `Result` | +| `attachment_file_uploader.dart` | `removeFile` | `Result` | ### Generated operations that cover it @@ -35,32 +35,52 @@ | `POST` | `/api/v2/uploads/file` | `uploadFile` | `FileUploadResponse` | | `POST` | `/api/v2/uploads/image` | `uploadImage` | `ImageUploadResponse` | -## Decisions to make +## Decisions taken -- **Adopt core's uploader, or keep ours?** `stream_core` is reworking uploads around `StreamAttachmentUploader`, which takes a `CdnClient` and returns an `AttachmentUploadTask` — a lifecycle `state` stream, a `cancel()`, and a `result` that never throws ([core#170](https://github.com/GetStream/stream-core-flutter/pull/170)). Our `AttachmentFileUploader` spreads the same three things across a `Future`, a `ProgressCallback` and a `CancelToken`. Adopting it is a bigger break than migrating the endpoints, and the strongest cross-product-consistency case in the whole plan. -- Whichever shape wins, the hand-written `CdnApi` should implement core's `CdnClient` (`uploadFile` / `uploadImage` -> `Future>`, `deleteFile` / `deleteImage` -> `Future>`) so it plugs into `StreamAttachmentUploader` — that is exactly how `stream_feeds` wires `FeedsCdnClient`. -- `AttachmentFileUploader` is public and pluggable through `attachmentFileUploaderProvider`; changing its signature is a break that needs the usual justification. -- The v2 multipart schema defines only `file`, `upload_sizes` and `user`, but our public `sendImage` / `sendFile` accept `extraData`. Decide: drop the parameter, or keep those two calls on v1. +- **The eight methods stay hand-written, over a hand-written multipart client.** The generated + `uploadFile`, `uploadImage`, `uploadChannelFile` and `uploadChannelImage` take a JSON `@Body()` + with no progress or cancellation, because the Dart `operation.tpl` ignores + `Operation.RequestContentType`. `lib/src/cdn/cdn_api.dart` mirrors the generated operations — + names, paths, parameters, and each request model's fields as parts — adding only the file part, + progress and cancellation, so a template that emits multipart can replace it as is. It leaves + out the `user` part, which only a server-side request sets. + `StreamAttachmentFileUploader` calls it instead of `StreamHttpClient.postFile`. +- **The v2 routes are the v1 handlers.** `lib/chat/routes.go` mounts the channel routes in the shared + `coreRoutes` under both surfaces, and `lib/core/api/routes_saas.go` does the same for `/uploads`; + only the JSON encoder differs. None is gated, in beta or deprecated. +- **The public shape stays v10's.** `AttachmentFileUploader` keeps its eight methods, chat's + `AttachmentFile` and its parameters, including the `extraData` neither surface reads; only the + return types change, to `Result`. Taking `stream_core`'s `CdnClient` and `AttachmentFile` is + deliberately left out; see [`core-migration/09`](../core-migration/09-uploads.md#design-worked-out-for-a-later-pr). +- **The provider receives the client's `Dio`.** `StreamHttpClient`'s `Dio` is `@visibleForTesting` + and is not the one `DefaultApi` uses, so `AttachmentFileUploaderProvider` takes the `Dio` the + generated client runs on, and the uploader moves from `StreamChatApi` to `StreamChatClient`. +- **Uploads answer `stream_core`'s `UploadedFile`** (`fileUrl`, `thumbUrl`) instead of v10's five + response types. A break beyond the domain-model list, taken here because every upload call site + already changes for `Result` — replacing the types later would break the same lines twice — and + because it is what core's `CdnClient` and feeds' `FeedsCdnClient` answer. `duration` goes with + them; it is server timing no integrator acts on, the reasoning behind `Result` for + duration-only writes. +- **A file that cannot be read answers a `Failure`,** through `runSafely` around the multipart + conversion. ## Risks -- Core's `CdnClient` has no channel-scoped operations — it is `uploadFile` / `uploadImage` only — while half of chat's uploads are `/chat/channels/{type}/{id}/file`. Either our implementation closes over the channel, or core's interface needs a variant. Settle this before writing the client. - Attachment upload is the highest-traffic path in the SDK; a regression is immediately visible to end users. -- The generated `uploadFile` / `uploadChannelFile` take a JSON body with no progress or cancellation, so this group cannot use them — it needs its own `CdnApi`. ## Definition of done -- [ ] Every method above either routes through `DefaultApi` or is listed here as deliberately left +- [x] Every method above either routes through `DefaultApi` or is listed here as deliberately left hand-written, with the reason. -- [ ] Public methods return `Future>`; no `getOrThrow()` inside the SDK. -- [ ] Hand-written request/response DTOs for this group are deleted, or their retention is justified. -- [ ] `melos run analyze` clean, `melos run test:dart` green, persistence tests green if this group +- [x] Public methods return `Future>`; no `getOrThrow()` inside the SDK. +- [x] Hand-written request/response DTOs for this group are deleted, or their retention is justified. +- [x] `melos run analyze` clean, `melos run test:dart` green, persistence tests green if this group persists anything. -- [ ] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. -- [ ] CHANGELOG entry under `🛑️ Breaking` for each break; PR title `refactor(llc)!:`. -- [ ] Decisions recorded in this file, and the status box ticked in `README.md`. -- [ ] Public dartdoc follows [`STYLE_GUIDE.md` § Documentation](../STYLE_GUIDE.md#documentation) +- [x] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. +- [x] CHANGELOG entry under `🛑️ Breaking` for each break; PR title `refactor(llc)!:`. +- [x] Decisions recorded in this file, and the status box ticked in `README.md`. +- [x] Public dartdoc follows [`STYLE_GUIDE.md` § Documentation](../STYLE_GUIDE.md#documentation) and [`EFFECTIVE_DART_DOC.md`](../EFFECTIVE_DART_DOC.md), including on symbols this group retyped but whose docs it left alone. -- [ ] Tests follow [`TESTING.md`](../TESTING.md): no `group` organizing a file by method, each +- [x] Tests follow [`TESTING.md`](../TESTING.md): no `group` organizing a file by method, each name states its subject and behaviour. diff --git a/openapi-migration/README.md b/openapi-migration/README.md index d68320540c..1fac60ee10 100644 --- a/openapi-migration/README.md +++ b/openapi-migration/README.md @@ -23,7 +23,7 @@ generated operations in scope, the decisions that group has to make, its risks, | [09](09-users.md) | Users | 9 | 9 | ☐ | | [10](10-messages.md) | Messages & Search | 14 | 12 | ☐ | | [11](11-channels-and-members.md) | Channels, Members & Sync | 27 | 24 | ☐ | -| [12](12-uploads-cdn.md) | Uploads (CDN) | 8 | 8 | ☐ | +| [12](12-uploads-cdn.md) | Uploads (CDN) | 8 | 8 | ☑ | | [13](13-push-preferences.md) | Push Preferences | 1 | 1 | ☐ | | [14](14-banned-users.md) | Banned Users — split out of 08 | 1 | 1 | ☐ | diff --git a/openapi-migration/tool/generate_plan.py b/openapi-migration/tool/generate_plan.py index 972ef80c9e..df779e0ea2 100644 --- a/openapi-migration/tool/generate_plan.py +++ b/openapi-migration/tool/generate_plan.py @@ -45,7 +45,7 @@ def read_handwritten(): for f in sources: methods = [ (m.group(2), m.group(1)) - for m in re.finditer(r'\n Future<([^>]+)>\s+(\w+)\(', f.read_text()) + for m in re.finditer(r'\n Future<([^\n]+?)>\s+(\w+)\(', f.read_text()) ] if f.name == 'attachment_file_uploader.dart': # the abstract interface declares each method, the impl repeats it @@ -559,32 +559,40 @@ def match(path): match=owns('/api/v2/uploads', '/api/v2/chat/channels/{type}/{id}/file', '/api/v2/chat/channels/{type}/{id}/image'), goal='Move file and image uploads to v2 behind a hand-written retrofit multipart client.', - decisions=[ - '**Adopt core\'s uploader, or keep ours?** `stream_core` is reworking uploads around ' - '`StreamAttachmentUploader`, which takes a `CdnClient` and returns an `AttachmentUploadTask` — a ' - 'lifecycle `state` stream, a `cancel()`, and a `result` that never throws ' - '([core#170](https://github.com/GetStream/stream-core-flutter/pull/170)). Our ' - '`AttachmentFileUploader` spreads the same three things across a `Future`, a `ProgressCallback` and a ' - '`CancelToken`. Adopting it is a bigger break than migrating the endpoints, and the strongest ' - 'cross-product-consistency case in the whole plan.', - 'Whichever shape wins, the hand-written `CdnApi` should implement core\'s `CdnClient` ' - '(`uploadFile` / `uploadImage` -> `Future>`, `deleteFile` / `deleteImage` -> ' - '`Future>`) so it plugs into `StreamAttachmentUploader` — that is exactly how ' - '`stream_feeds` wires `FeedsCdnClient`.', - '`AttachmentFileUploader` is public and pluggable through `attachmentFileUploaderProvider`; changing ' - 'its signature is a break that needs the usual justification.', - 'The v2 multipart schema defines only `file`, `upload_sizes` and `user`, but our public `sendImage` / ' - '`sendFile` accept `extraData`. Decide: drop the parameter, or keep those two calls on v1.', - ], + decisions=[], + taken=textwrap.dedent("""\ + - **The eight methods stay hand-written, over a hand-written multipart client.** The generated + `uploadFile`, `uploadImage`, `uploadChannelFile` and `uploadChannelImage` take a JSON `@Body()` + with no progress or cancellation, because the Dart `operation.tpl` ignores + `Operation.RequestContentType`. `lib/src/cdn/cdn_api.dart` mirrors the generated operations — + names, paths, parameters, and each request model's fields as parts — adding only the file part, + progress and cancellation, so a template that emits multipart can replace it as is. It leaves + out the `user` part, which only a server-side request sets. + `StreamAttachmentFileUploader` calls it instead of `StreamHttpClient.postFile`. + - **The v2 routes are the v1 handlers.** `lib/chat/routes.go` mounts the channel routes in the shared + `coreRoutes` under both surfaces, and `lib/core/api/routes_saas.go` does the same for `/uploads`; + only the JSON encoder differs. None is gated, in beta or deprecated. + - **The public shape stays v10's.** `AttachmentFileUploader` keeps its eight methods, chat's + `AttachmentFile` and its parameters, including the `extraData` neither surface reads; only the + return types change, to `Result`. Taking `stream_core`'s `CdnClient` and `AttachmentFile` is + deliberately left out; see [`core-migration/09`](../core-migration/09-uploads.md#design-worked-out-for-a-later-pr). + - **The provider receives the client's `Dio`.** `StreamHttpClient`'s `Dio` is `@visibleForTesting` + and is not the one `DefaultApi` uses, so `AttachmentFileUploaderProvider` takes the `Dio` the + generated client runs on, and the uploader moves from `StreamChatApi` to `StreamChatClient`. + - **Uploads answer `stream_core`'s `UploadedFile`** (`fileUrl`, `thumbUrl`) instead of v10's five + response types. A break beyond the domain-model list, taken here because every upload call site + already changes for `Result` — replacing the types later would break the same lines twice — and + because it is what core's `CdnClient` and feeds' `FeedsCdnClient` answer. `duration` goes with + them; it is server timing no integrator acts on, the reasoning behind `Result` for + duration-only writes. + - **A file that cannot be read answers a `Failure`,** through `runSafely` around the multipart + conversion. + """), risks=[ - "Core's `CdnClient` has no channel-scoped operations — it is `uploadFile` / `uploadImage` only — while " - 'half of chat\'s uploads are `/chat/channels/{type}/{id}/file`. Either our implementation closes over ' - 'the channel, or core\'s interface needs a variant. Settle this before writing the client.', 'Attachment upload is the highest-traffic path in the SDK; a regression is immediately visible to end ' 'users.', - 'The generated `uploadFile` / `uploadChannelFile` take a JSON body with no progress or cancellation, ' - 'so this group cannot use them — it needs its own `CdnApi`.', ], + done=DONE.replace('- [ ]', '- [x]'), ), dict( num='13', slug='push-preferences', title='Push Preferences', diff --git a/packages/stream_chat/CHANGELOG.md b/packages/stream_chat/CHANGELOG.md index f2359236c7..e3466a167a 100644 --- a/packages/stream_chat/CHANGELOG.md +++ b/packages/stream_chat/CHANGELOG.md @@ -77,6 +77,11 @@ - `AppSettingsResponse` is immutable, built through a const constructor, compares by value, gains `copyWith`, and its `duration` is a non-nullable `String`. - `AppSettings` and `UploadConfig` no longer extend `Equatable`, so `props` is removed; they still compare by value and gain `copyWith`. - `StreamChatApi.general.getAppSettings` is removed; call `StreamChatClient.getAppSettings` instead. +- `sendImage`, `sendFile`, `uploadImage` and `uploadFile`, on `StreamChatClient`, `Channel` and `AttachmentFileUploader`, return a `Result` instead of throwing; read the URL from `fileUrl` and a video's thumbnail from `thumbUrl`. +- `deleteImage`, `deleteFile`, `removeImage` and `removeFile` return a `Result` instead of throwing, and carry no value on success. +- `SendAttachmentResponse`, `SendFileResponse`, `SendImageResponse`, `UploadImageResponse` and `UploadFileResponse` are removed in favor of `UploadedFile`. +- `AttachmentFileUploaderProvider` receives the client's `Dio` instead of a `StreamHttpClient`, and `StreamAttachmentFileUploader` is built from one. +- `StreamChatApi.fileUploader` and `StreamChatApi`'s `attachmentFileUploaderProvider` are removed; pass `attachmentFileUploaderProvider` to `StreamChatClient` instead. 🐞 Fixed diff --git a/packages/stream_chat/lib/src/cdn/cdn_api.dart b/packages/stream_chat/lib/src/cdn/cdn_api.dart new file mode 100644 index 0000000000..cc92be8f37 --- /dev/null +++ b/packages/stream_chat/lib/src/cdn/cdn_api.dart @@ -0,0 +1,90 @@ +// ignore_for_file: public_member_api_docs + +import 'dart:convert'; + +import 'package:dio/dio.dart'; +import 'package:retrofit/retrofit.dart'; +import 'package:stream_core/stream_core.dart' show Result, runApiSafely; + +import '../../open_api/models.dart'; + +part 'cdn_api.g.dart'; + +@RestApi(callAdapter: _ResultCallAdapter) +abstract interface class CdnApi { + factory CdnApi( + Dio dio, { + String? baseUrl, + }) = _CdnApi; + + @MultiPart() + @POST('/api/v2/uploads/file') + Future> uploadFile({ + @Part(name: 'file') MultipartFile? file, + @SendProgress() ProgressCallback? onUploadProgress, + @CancelRequest() CancelToken? cancelToken, + }); + + @DELETE('/api/v2/uploads/file') + Future> deleteFile({ + @Query('url') String? url, + @CancelRequest() CancelToken? cancelToken, + }); + + @MultiPart() + @POST('/api/v2/uploads/image') + Future> uploadImage({ + @Part(name: 'file') MultipartFile? file, + @Part(name: 'upload_sizes') List? uploadSizes, + @SendProgress() ProgressCallback? onUploadProgress, + @CancelRequest() CancelToken? cancelToken, + }); + + @DELETE('/api/v2/uploads/image') + Future> deleteImage({ + @Query('url') String? url, + @CancelRequest() CancelToken? cancelToken, + }); + + @MultiPart() + @POST('/api/v2/chat/channels/{type}/{id}/file') + Future> uploadChannelFile({ + @Path('type') required String type, + @Path('id') required String id, + @Part(name: 'file') MultipartFile? file, + @SendProgress() ProgressCallback? onUploadProgress, + @CancelRequest() CancelToken? cancelToken, + }); + + @DELETE('/api/v2/chat/channels/{type}/{id}/file') + Future> deleteChannelFile({ + @Path('type') required String type, + @Path('id') required String id, + @Query('url') String? url, + @CancelRequest() CancelToken? cancelToken, + }); + + @MultiPart() + @POST('/api/v2/chat/channels/{type}/{id}/image') + Future> uploadChannelImage({ + @Path('type') required String type, + @Path('id') required String id, + @Part(name: 'file') MultipartFile? file, + @Part(name: 'upload_sizes') List? uploadSizes, + @SendProgress() ProgressCallback? onUploadProgress, + @CancelRequest() CancelToken? cancelToken, + }); + + @DELETE('/api/v2/chat/channels/{type}/{id}/image') + Future> deleteChannelImage({ + @Path('type') required String type, + @Path('id') required String id, + @Query('url') String? url, + @CancelRequest() CancelToken? cancelToken, + }); +} + +class _ResultCallAdapter extends CallAdapter, Future>> { + @override + Future> adapt(Future Function() call) => runApiSafely(call); +} diff --git a/packages/stream_chat/lib/src/cdn/cdn_api.g.dart b/packages/stream_chat/lib/src/cdn/cdn_api.g.dart new file mode 100644 index 0000000000..a5175f87de --- /dev/null +++ b/packages/stream_chat/lib/src/cdn/cdn_api.g.dart @@ -0,0 +1,476 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'cdn_api.dart'; + +// dart format off + +// ************************************************************************** +// RetrofitGenerator +// ************************************************************************** + +// ignore_for_file: unnecessary_brace_in_string_interps,no_leading_underscores_for_local_identifiers,unused_element,unnecessary_string_interpolations,unused_element_parameter,avoid_unused_constructor_parameters,unreachable_from_main,avoid_redundant_argument_values + +class _CdnApi implements CdnApi { + _CdnApi(this._dio, {this.baseUrl, this.errorLogger}); + + final Dio _dio; + + String? baseUrl; + + final ParseErrorLogger? errorLogger; + + Future _uploadFile({ + MultipartFile? file, + void Function(int, int)? onUploadProgress, + CancelToken? cancelToken, + }) async { + final _extra = {}; + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = FormData(); + if (file != null) { + _data.files.add(MapEntry('file', file)); + } + final _options = _setStreamType>( + Options( + method: 'POST', + headers: _headers, + extra: _extra, + contentType: 'multipart/form-data', + ) + .compose( + _dio.options, + '/api/v2/uploads/file', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onUploadProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late FileUploadResponse _value; + try { + _value = FileUploadResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> uploadFile({ + MultipartFile? file, + void Function(int, int)? onUploadProgress, + CancelToken? cancelToken, + }) { + return _ResultCallAdapter().adapt( + () => _uploadFile( + file: file, + onUploadProgress: onUploadProgress, + cancelToken: cancelToken, + ), + ); + } + + Future _deleteFile({ + String? url, + CancelToken? cancelToken, + }) async { + final _extra = {}; + final queryParameters = {r'url': url}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'DELETE', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/uploads/file', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late DurationResponse _value; + try { + _value = DurationResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> deleteFile({ + String? url, + CancelToken? cancelToken, + }) { + return _ResultCallAdapter().adapt( + () => _deleteFile(url: url, cancelToken: cancelToken), + ); + } + + Future _uploadImage({ + MultipartFile? file, + List? uploadSizes, + void Function(int, int)? onUploadProgress, + CancelToken? cancelToken, + }) async { + final _extra = {}; + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = FormData(); + if (file != null) { + _data.files.add(MapEntry('file', file)); + } + _data.fields.add(MapEntry('upload_sizes', jsonEncode(uploadSizes))); + final _options = _setStreamType>( + Options( + method: 'POST', + headers: _headers, + extra: _extra, + contentType: 'multipart/form-data', + ) + .compose( + _dio.options, + '/api/v2/uploads/image', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onUploadProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late ImageUploadResponse _value; + try { + _value = ImageUploadResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> uploadImage({ + MultipartFile? file, + List? uploadSizes, + void Function(int, int)? onUploadProgress, + CancelToken? cancelToken, + }) { + return _ResultCallAdapter().adapt( + () => _uploadImage( + file: file, + uploadSizes: uploadSizes, + onUploadProgress: onUploadProgress, + cancelToken: cancelToken, + ), + ); + } + + Future _deleteImage({ + String? url, + CancelToken? cancelToken, + }) async { + final _extra = {}; + final queryParameters = {r'url': url}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'DELETE', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/uploads/image', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late DurationResponse _value; + try { + _value = DurationResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> deleteImage({ + String? url, + CancelToken? cancelToken, + }) { + return _ResultCallAdapter().adapt( + () => _deleteImage(url: url, cancelToken: cancelToken), + ); + } + + Future _uploadChannelFile({ + required String type, + required String id, + MultipartFile? file, + void Function(int, int)? onUploadProgress, + CancelToken? cancelToken, + }) async { + final _extra = {}; + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = FormData(); + if (file != null) { + _data.files.add(MapEntry('file', file)); + } + final _options = _setStreamType>( + Options( + method: 'POST', + headers: _headers, + extra: _extra, + contentType: 'multipart/form-data', + ) + .compose( + _dio.options, + '/api/v2/chat/channels/${type}/${id}/file', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onUploadProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late UploadChannelFileResponse _value; + try { + _value = UploadChannelFileResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> uploadChannelFile({ + required String type, + required String id, + MultipartFile? file, + void Function(int, int)? onUploadProgress, + CancelToken? cancelToken, + }) { + return _ResultCallAdapter().adapt( + () => _uploadChannelFile( + type: type, + id: id, + file: file, + onUploadProgress: onUploadProgress, + cancelToken: cancelToken, + ), + ); + } + + Future _deleteChannelFile({ + required String type, + required String id, + String? url, + CancelToken? cancelToken, + }) async { + final _extra = {}; + final queryParameters = {r'url': url}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'DELETE', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/channels/${type}/${id}/file', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late DurationResponse _value; + try { + _value = DurationResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> deleteChannelFile({ + required String type, + required String id, + String? url, + CancelToken? cancelToken, + }) { + return _ResultCallAdapter().adapt( + () => _deleteChannelFile( + type: type, + id: id, + url: url, + cancelToken: cancelToken, + ), + ); + } + + Future _uploadChannelImage({ + required String type, + required String id, + MultipartFile? file, + List? uploadSizes, + void Function(int, int)? onUploadProgress, + CancelToken? cancelToken, + }) async { + final _extra = {}; + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = FormData(); + if (file != null) { + _data.files.add(MapEntry('file', file)); + } + _data.fields.add(MapEntry('upload_sizes', jsonEncode(uploadSizes))); + final _options = _setStreamType>( + Options( + method: 'POST', + headers: _headers, + extra: _extra, + contentType: 'multipart/form-data', + ) + .compose( + _dio.options, + '/api/v2/chat/channels/${type}/${id}/image', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onUploadProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late UploadChannelResponse _value; + try { + _value = UploadChannelResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> uploadChannelImage({ + required String type, + required String id, + MultipartFile? file, + List? uploadSizes, + void Function(int, int)? onUploadProgress, + CancelToken? cancelToken, + }) { + return _ResultCallAdapter().adapt( + () => _uploadChannelImage( + type: type, + id: id, + file: file, + uploadSizes: uploadSizes, + onUploadProgress: onUploadProgress, + cancelToken: cancelToken, + ), + ); + } + + Future _deleteChannelImage({ + required String type, + required String id, + String? url, + CancelToken? cancelToken, + }) async { + final _extra = {}; + final queryParameters = {r'url': url}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'DELETE', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/v2/chat/channels/${type}/${id}/image', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late DurationResponse _value; + try { + _value = DurationResponse.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options, response: _result); + rethrow; + } + return _value; + } + + @override + Future> deleteChannelImage({ + required String type, + required String id, + String? url, + CancelToken? cancelToken, + }) { + return _ResultCallAdapter().adapt( + () => _deleteChannelImage( + type: type, + id: id, + url: url, + cancelToken: cancelToken, + ), + ); + } + + RequestOptions _setStreamType(RequestOptions requestOptions) { + if (T != dynamic && + !(requestOptions.responseType == ResponseType.bytes || + requestOptions.responseType == ResponseType.stream)) { + if (T == String) { + requestOptions.responseType = ResponseType.plain; + } else { + requestOptions.responseType = ResponseType.json; + } + } + return requestOptions; + } + + String _combineBaseUrls(String dioBaseUrl, String? baseUrl) { + if (baseUrl == null || baseUrl.trim().isEmpty) { + return dioBaseUrl; + } + + final url = Uri.parse(baseUrl); + + if (url.isAbsolute) { + return url.toString(); + } + + return Uri.parse(dioBaseUrl).resolveUri(url).toString(); + } +} + +// dart format on diff --git a/packages/stream_chat/lib/src/client/channel/channel.dart b/packages/stream_chat/lib/src/client/channel/channel.dart index 05c70a1908..84f41d684c 100644 --- a/packages/stream_chat/lib/src/client/channel/channel.dart +++ b/packages/stream_chat/lib/src/client/channel/channel.dart @@ -671,7 +671,7 @@ class Channel { } return Future.wait( - attachments.map((it) { + attachments.map((it) async { _logger.d(() => 'Uploading ${it.id} attachment...'); final throttledUpdateAttachment = updateAttachment.throttled( @@ -686,67 +686,45 @@ class Channel { ]); } - final isImage = it.type == AttachmentType.image; final cancelToken = CancelToken(); - Future future; - if (isImage) { - future = sendImage( - it.file!, - onSendProgress: onSendProgress, - cancelToken: cancelToken, - extraData: it.extraData, - ); - } else { - future = sendFile( - it.file!, - onSendProgress: onSendProgress, - cancelToken: cancelToken, - extraData: it.extraData, + _cancelableAttachmentUploadRequest[it.id] = cancelToken; + + final isImage = it.type == AttachmentType.image; + final upload = isImage ? sendImage : sendFile; + + final result = await upload( + it.file!, + onSendProgress: onSendProgress, + cancelToken: cancelToken, + extraData: it.extraData, + ); + + throttledUpdateAttachment.cancel(); + _cancelableAttachmentUploadRequest.remove(it.id); + + if (result case Success(data: final uploaded)) { + _logger.d(() => 'Attachment ${it.id} uploaded successfully...'); + updateAttachment( + it.copyWith( + imageUrl: isImage ? uploaded.fileUrl : null, + assetUrl: isImage ? null : uploaded.fileUrl, + thumbUrl: uploaded.thumbUrl, + uploadState: const UploadState.success(), + ), ); + return; + } + + if (result case Failure(error: StreamNetworkException(isCancelled: true))) { + _logger.d(() => 'Attachment ${it.id} upload cancelled'); + updateAttachment(it, remove: true); + return; + } + + if (result case Failure(:final error, :final stackTrace)) { + _logger.e(() => 'error uploading the attachment', error: error, stackTrace: stackTrace); + updateAttachment(it.copyWith(uploadState: UploadState.failed(error: error.toString()))); } - _cancelableAttachmentUploadRequest[it.id] = cancelToken; - return future - .then((response) { - _logger.d(() => 'Attachment ${it.id} uploaded successfully...'); - - // If the response is SendFileResponse, then we might also be getting - // thumbUrl in case of video. So we need to update the attachment with - // both the assetUrl and thumbUrl. - if (response is SendFileResponse) { - updateAttachment( - it.copyWith( - assetUrl: response.file, - thumbUrl: response.thumbUrl, - uploadState: const UploadState.success(), - ), - ); - } else { - updateAttachment( - it.copyWith( - imageUrl: response.file, - uploadState: const UploadState.success(), - ), - ); - } - }) - .catchError((e, stk) { - if (e is StreamNetworkException && e.isCancelled) { - _logger.d(() => 'Attachment ${it.id} upload cancelled'); - - // remove attachment from message if cancelled. - updateAttachment(it, remove: true); - return; - } - - _logger.e(() => 'error uploading the attachment', error: e, stackTrace: stk); - updateAttachment( - it.copyWith(uploadState: UploadState.failed(error: e.toString())), - ); - }) - .whenComplete(() { - throttledUpdateAttachment.cancel(); - _cancelableAttachmentUploadRequest.remove(it.id); - }); }), ).whenComplete(() { final completer = _messageAttachmentsUploadCompleter.remove(messageId); @@ -1149,16 +1127,23 @@ class Channel { // Deletes all the uploaded attachments associated with the given [message]. // This is typically called when a message is hard deleted. Future _deleteMessageAttachments(Message message) async { + if (!_isInitialized) return; + final attachments = message.attachments; final deleteFutures = attachments.map((it) async { if (it.imageUrl case final url?) return deleteImage(url); if (it.assetUrl case final url?) return deleteFile(url); }); - try { - await Future.wait(deleteFutures); - } catch (e, stk) { - _logger.w(() => 'Error deleting message attachments', error: e, stackTrace: stk); + final results = await Future.wait(deleteFutures); + for (final result in results) { + if (result case Failure(:final error, :final stackTrace)) { + _logger.w( + () => 'Error deleting message attachments', + error: error, + stackTrace: stackTrace, + ); + } } } @@ -1351,8 +1336,8 @@ class Channel { return sendMessage(locationMessage); } - /// Send a file to this channel. - Future sendFile( + /// Uploads [file] to this channel. + Future> sendFile( AttachmentFile file, { ProgressCallback? onSendProgress, CancelToken? cancelToken, @@ -1369,8 +1354,8 @@ class Channel { ); } - /// Send an image to this channel. - Future sendImage( + /// Uploads [file] as an image to this channel. + Future> sendImage( AttachmentFile file, { ProgressCallback? onSendProgress, CancelToken? cancelToken, @@ -1404,8 +1389,8 @@ class Channel { ); } - /// Delete a file from this channel. - Future deleteFile( + /// Deletes the file at [url] from this channel. + Future> deleteFile( String url, { CancelToken? cancelToken, Map? extraData, @@ -1420,8 +1405,8 @@ class Channel { ); } - /// Delete an image from this channel. - Future deleteImage( + /// Deletes the image at [url] from this channel. + Future> deleteImage( String url, { CancelToken? cancelToken, Map? extraData, diff --git a/packages/stream_chat/lib/src/client/client.dart b/packages/stream_chat/lib/src/client/client.dart index 7595947aea..985bd79848 100644 --- a/packages/stream_chat/lib/src/client/client.dart +++ b/packages/stream_chat/lib/src/client/client.dart @@ -24,6 +24,7 @@ import 'package:stream_core/stream_core.dart' SystemEnvironmentManager, TokenManager, TokenProvider, + UploadedFile, UserToken, WebSocketProvider, WsEvent; @@ -149,7 +150,6 @@ class StreamChatClient { tokenManager: _tokenManager, connectionId: () => _connection.connectionId, systemEnvironmentManager: _systemEnvironmentManager, - attachmentFileUploaderProvider: attachmentFileUploaderProvider, interceptors: chatApiInterceptors, httpClientAdapter: httpClientAdapter, ); @@ -179,6 +179,7 @@ class StreamChatClient { ); final api = defaultApi ?? DefaultApi(httpClient); + _fileUploader = attachmentFileUploaderProvider(httpClient); _rolesRepository = RolesRepository(api); _devicesRepository = DevicesRepository(api); @@ -221,6 +222,7 @@ class StreamChatClient { } late final StreamChatApi _chatApi; + late final AttachmentFileUploader _fileUploader; late final RolesRepository _rolesRepository; late final DevicesRepository _devicesRepository; @@ -1090,15 +1092,17 @@ class StreamChatClient { messageFilters: messageFilters, ); - /// Send a [file] to the [channelId] of type [channelType] - Future sendFile( + /// Uploads [file] to the channel [channelId] of type [channelType]. + /// + /// Progress is reported to [onSendProgress], and a [cancelToken] cancels the upload. + Future> sendFile( AttachmentFile file, String channelId, String channelType, { ProgressCallback? onSendProgress, CancelToken? cancelToken, Map? extraData, - }) => _chatApi.fileUploader.sendFile( + }) => _fileUploader.sendFile( file, channelId, channelType, @@ -1107,15 +1111,17 @@ class StreamChatClient { extraData: extraData, ); - /// Send a [image] to the [channelId] of type [channelType] - Future sendImage( + /// Uploads [image] to the channel [channelId] of type [channelType]. + /// + /// Progress is reported to [onSendProgress], and a [cancelToken] cancels the upload. + Future> sendImage( AttachmentFile image, String channelId, String channelType, { ProgressCallback? onSendProgress, CancelToken? cancelToken, Map? extraData, - }) => _chatApi.fileUploader.sendImage( + }) => _fileUploader.sendImage( image, channelId, channelType, @@ -1124,14 +1130,14 @@ class StreamChatClient { extraData: extraData, ); - /// Delete a file from this channel - Future deleteFile( + /// Deletes the file at [url] from the channel [channelId] of type [channelType]. + Future> deleteFile( String url, String channelId, String channelType, { CancelToken? cancelToken, Map? extraData, - }) => _chatApi.fileUploader.deleteFile( + }) => _fileUploader.deleteFile( url, channelId, channelType, @@ -1139,14 +1145,14 @@ class StreamChatClient { extraData: extraData, ); - /// Delete an image from this channel - Future deleteImage( + /// Deletes the image at [url] from the channel [channelId] of type [channelType]. + Future> deleteImage( String url, String channelId, String channelType, { CancelToken? cancelToken, Map? extraData, - }) => _chatApi.fileUploader.deleteImage( + }) => _fileUploader.deleteImage( url, channelId, channelType, @@ -1154,60 +1160,46 @@ class StreamChatClient { extraData: extraData, ); - /// Upload an image to the Stream CDN + /// Uploads [image] outside of any channel. /// - /// Upload progress can be tracked using [onProgress], and the operation can - /// be cancelled using [cancelToken]. - /// - /// Returns a [UploadImageResponse] once uploaded successfully. - Future uploadImage( + /// Progress is reported to [onUploadProgress], and a [cancelToken] cancels the upload. + Future> uploadImage( AttachmentFile image, { ProgressCallback? onUploadProgress, CancelToken? cancelToken, - }) => _chatApi.fileUploader.uploadImage( + }) => _fileUploader.uploadImage( image, onSendProgress: onUploadProgress, cancelToken: cancelToken, ); - /// Upload a file to the Stream CDN - /// - /// Upload progress can be tracked using [onProgress], and the operation can - /// be cancelled using [cancelToken]. + /// Uploads [file] outside of any channel. /// - /// Returns a [UploadFileResponse] once uploaded successfully. - Future uploadFile( + /// Progress is reported to [onUploadProgress], and a [cancelToken] cancels the upload. + Future> uploadFile( AttachmentFile file, { ProgressCallback? onUploadProgress, CancelToken? cancelToken, - }) => _chatApi.fileUploader.uploadFile( + }) => _fileUploader.uploadFile( file, onSendProgress: onUploadProgress, cancelToken: cancelToken, ); - /// Remove an image from the Stream CDN using its [url]. - /// - /// The operation can be cancelled using [cancelToken] if needed. - /// - /// Returns an [EmptyResponse] once removed successfully. - Future removeImage( + /// Deletes the image at [url], uploaded outside of any channel. + Future> removeImage( String url, { CancelToken? cancelToken, - }) => _chatApi.fileUploader.removeImage( + }) => _fileUploader.removeImage( url, cancelToken: cancelToken, ); - /// Remove a file from the Stream CDN using its [url]. - /// - /// The operation can be cancelled using [cancelToken] if needed. - /// - /// Returns an [EmptyResponse] once removed successfully. - Future removeFile( + /// Deletes the file at [url], uploaded outside of any channel. + Future> removeFile( String url, { CancelToken? cancelToken, - }) => _chatApi.fileUploader.removeFile( + }) => _fileUploader.removeFile( url, cancelToken: cancelToken, ); diff --git a/packages/stream_chat/lib/src/core/api/attachment_file_uploader.dart b/packages/stream_chat/lib/src/core/api/attachment_file_uploader.dart index 410cb1a2d4..67666de353 100644 --- a/packages/stream_chat/lib/src/core/api/attachment_file_uploader.dart +++ b/packages/stream_chat/lib/src/core/api/attachment_file_uploader.dart @@ -1,23 +1,25 @@ import 'package:dio/dio.dart'; +import 'package:meta/meta.dart'; +import 'package:stream_core/stream_core.dart' show PatternMatching, Result, UploadedFile, runSafely; -import '../http/stream_http_client.dart'; +import '../../cdn/cdn_api.dart'; +import '../../client/client.dart'; +import '../../repository/mapper/result_mapper.dart'; +import '../../repository/mapper/uploads_mapper.dart'; import '../models/attachment_file.dart'; -import 'responses.dart'; -/// Signature for a function which provides instance of [AttachmentFileUploader] -typedef AttachmentFileUploaderProvider = - AttachmentFileUploader Function( - StreamHttpClient httpClient, - ); +/// Signature for a function that builds an [AttachmentFileUploader] from the client's [Dio]. +typedef AttachmentFileUploaderProvider = AttachmentFileUploader Function(Dio dio); -/// Class responsible for uploading images and files to a given channel +/// Uploads and deletes of files and images, in a channel or standalone. +/// +/// [StreamChatClient] builds one and calls it from its upload methods. To replace it, consider implementing +/// this class and returning it from the `attachmentFileUploaderProvider` passed to [StreamChatClient.new]. abstract class AttachmentFileUploader { - /// Uploads a [image] to the given channel. - /// Returns [SendImageResponse] once sent successfully. + /// Uploads [image] to the channel [channelId] of type [channelType]. /// - /// Optionally, access upload progress using [onSendProgress] - /// and cancel the request using [cancelToken] - Future sendImage( + /// Progress is reported to [onSendProgress], and a [cancelToken] cancels the upload. + Future> sendImage( AttachmentFile image, String channelId, String channelType, { @@ -26,12 +28,10 @@ abstract class AttachmentFileUploader { Map? extraData, }); - /// Uploads a [file] to the given channel. - /// Returns [SendFileResponse] once sent successfully. + /// Uploads [file] to the channel [channelId] of type [channelType]. /// - /// Optionally, access upload progress using [onSendProgress] - /// and cancel the request using [cancelToken] - Future sendFile( + /// Progress is reported to [onSendProgress], and a [cancelToken] cancels the upload. + Future> sendFile( AttachmentFile file, String channelId, String channelType, { @@ -40,11 +40,9 @@ abstract class AttachmentFileUploader { Map? extraData, }); - /// Deletes a image using its [url] from the given channel. - /// Returns [EmptyResponse] once deleted successfully. - /// - /// Optionally, cancel the request using [cancelToken] - Future deleteImage( + /// Deletes the image at [url] from the channel [channelId] of type + /// [channelType]. + Future> deleteImage( String url, String channelId, String channelType, { @@ -52,11 +50,9 @@ abstract class AttachmentFileUploader { Map? extraData, }); - /// Deletes a file using its [url] from the given channel. - /// Returns [EmptyResponse] once deleted successfully. - /// - /// Optionally, cancel the request using [cancelToken] - Future deleteFile( + /// Deletes the file at [url] from the channel [channelId] of type + /// [channelType]. + Future> deleteFile( String url, String channelId, String channelType, { @@ -66,46 +62,32 @@ abstract class AttachmentFileUploader { // region Standalone upload methods - /// Uploads an image file to the CDN. + /// Uploads [image] outside of any channel. /// - /// Upload progress can be tracked using [onSendProgress], and the operation - /// can be cancelled using [cancelToken]. - /// - /// Returns a [UploadImageResponse] once uploaded successfully. - Future uploadImage( + /// Progress is reported to [onSendProgress], and a [cancelToken] cancels the upload. + Future> uploadImage( AttachmentFile image, { ProgressCallback? onSendProgress, CancelToken? cancelToken, }); - /// Uploads a file to the CDN. - /// - /// Upload progress can be tracked using [onSendProgress], and the operation - /// can be cancelled using [cancelToken]. + /// Uploads [file] outside of any channel. /// - /// Returns a [UploadFileResponse] once uploaded successfully. - Future uploadFile( + /// Progress is reported to [onSendProgress], and a [cancelToken] cancels the upload. + Future> uploadFile( AttachmentFile file, { ProgressCallback? onSendProgress, CancelToken? cancelToken, }); - /// Removes an image from the CDN using its [url]. - /// - /// The operation can be cancelled using [cancelToken] if needed. - /// - /// Returns a [EmptyResponse] once removed successfully. - Future removeImage( + /// Deletes the image at [url], uploaded outside of any channel. + Future> removeImage( String url, { CancelToken? cancelToken, }); - /// Removes a file from the CDN using its [url]. - /// - /// The operation can be cancelled using [cancelToken] if needed. - /// - /// Returns a [EmptyResponse] once removed successfully. - Future removeFile( + /// Deletes the file at [url], uploaded outside of any channel. + Future> removeFile( String url, { CancelToken? cancelToken, }); @@ -113,34 +95,42 @@ abstract class AttachmentFileUploader { // endregion } -/// Stream's default implementation of [AttachmentFileUploader] +/// The default [AttachmentFileUploader], used unless an `attachmentFileUploaderProvider` builds another. class StreamAttachmentFileUploader implements AttachmentFileUploader { - /// Creates a new [StreamAttachmentFileUploader] instance. - const StreamAttachmentFileUploader(this._client); + /// Creates an uploader that sends its requests through [dio]. + StreamAttachmentFileUploader(Dio dio) : this.fromApi(CdnApi(dio)); - final StreamHttpClient _client; + /// Creates an uploader that sends its requests through an existing API client. + @internal + const StreamAttachmentFileUploader.fromApi(this._api); + + final CdnApi _api; @override - Future sendImage( - AttachmentFile file, + Future> sendImage( + AttachmentFile image, String channelId, String channelType, { ProgressCallback? onSendProgress, CancelToken? cancelToken, Map? extraData, }) async { - final multiPartFile = await file.toMultipartFile(); - final response = await _client.postFile( - '/channels/$channelType/$channelId/image', - multiPartFile, - onSendProgress: onSendProgress, - cancelToken: cancelToken, - ); - return SendImageResponse.fromJson(response.data); + final multipart = await runSafely(image.toMultipartFile); + return multipart.flatMapAsync((multipartFile) async { + final result = await _api.uploadChannelImage( + type: channelType, + id: channelId, + file: multipartFile, + onUploadProgress: onSendProgress, + cancelToken: cancelToken, + ); + + return result.map((it) => it.toModel()); + }); } @override - Future sendFile( + Future> sendFile( AttachmentFile file, String channelId, String channelType, { @@ -148,103 +138,115 @@ class StreamAttachmentFileUploader implements AttachmentFileUploader { CancelToken? cancelToken, Map? extraData, }) async { - final multiPartFile = await file.toMultipartFile(); - final response = await _client.postFile( - '/channels/$channelType/$channelId/file', - multiPartFile, - onSendProgress: onSendProgress, - cancelToken: cancelToken, - ); - return SendFileResponse.fromJson(response.data); + final multipart = await runSafely(file.toMultipartFile); + return multipart.flatMapAsync((multipartFile) async { + final result = await _api.uploadChannelFile( + type: channelType, + id: channelId, + file: multipartFile, + onUploadProgress: onSendProgress, + cancelToken: cancelToken, + ); + + return result.map((it) => it.toModel()); + }); } @override - Future deleteImage( + Future> deleteImage( String url, String channelId, String channelType, { CancelToken? cancelToken, Map? extraData, }) async { - final response = await _client.delete( - '/channels/$channelType/$channelId/image', - queryParameters: {'url': url}, + final result = await _api.deleteChannelImage( + type: channelType, + id: channelId, + url: url, cancelToken: cancelToken, ); - return EmptyResponse.fromJson(response.data); + + return result.ignoreValue(); } @override - Future deleteFile( + Future> deleteFile( String url, String channelId, String channelType, { CancelToken? cancelToken, Map? extraData, }) async { - final response = await _client.delete( - '/channels/$channelType/$channelId/file', - queryParameters: {'url': url}, + final result = await _api.deleteChannelFile( + type: channelType, + id: channelId, + url: url, cancelToken: cancelToken, ); - return EmptyResponse.fromJson(response.data); + + return result.ignoreValue(); } @override - Future uploadImage( + Future> uploadImage( AttachmentFile image, { ProgressCallback? onSendProgress, CancelToken? cancelToken, }) async { - final multiPartFile = await image.toMultipartFile(); - final response = await _client.postFile( - '/uploads/image', - multiPartFile, - onSendProgress: onSendProgress, - cancelToken: cancelToken, - ); - return UploadImageResponse.fromJson(response.data); + final multipart = await runSafely(image.toMultipartFile); + return multipart.flatMapAsync((multipartFile) async { + final result = await _api.uploadImage( + file: multipartFile, + onUploadProgress: onSendProgress, + cancelToken: cancelToken, + ); + + return result.map((it) => it.toModel()); + }); } @override - Future uploadFile( + Future> uploadFile( AttachmentFile file, { ProgressCallback? onSendProgress, CancelToken? cancelToken, }) async { - final multiPartFile = await file.toMultipartFile(); - final response = await _client.postFile( - '/uploads/file', - multiPartFile, - onSendProgress: onSendProgress, - cancelToken: cancelToken, - ); - return UploadFileResponse.fromJson(response.data); + final multipart = await runSafely(file.toMultipartFile); + return multipart.flatMapAsync((multipartFile) async { + final result = await _api.uploadFile( + file: multipartFile, + onUploadProgress: onSendProgress, + cancelToken: cancelToken, + ); + + return result.map((it) => it.toModel()); + }); } @override - Future removeImage( + Future> removeImage( String url, { CancelToken? cancelToken, }) async { - final response = await _client.delete( - '/uploads/image', - queryParameters: {'url': url}, + final result = await _api.deleteImage( + url: url, cancelToken: cancelToken, ); - return EmptyResponse.fromJson(response.data); + + return result.ignoreValue(); } @override - Future removeFile( + Future> removeFile( String url, { CancelToken? cancelToken, }) async { - final response = await _client.delete( - '/uploads/file', - queryParameters: {'url': url}, + final result = await _api.deleteFile( + url: url, cancelToken: cancelToken, ); - return EmptyResponse.fromJson(response.data); + + return result.ignoreValue(); } } diff --git a/packages/stream_chat/lib/src/core/api/responses.dart b/packages/stream_chat/lib/src/core/api/responses.dart index 3baaca0989..4f784f8471 100644 --- a/packages/stream_chat/lib/src/core/api/responses.dart +++ b/packages/stream_chat/lib/src/core/api/responses.dart @@ -163,37 +163,6 @@ class QueryRepliesResponse extends _BaseResponse { static QueryRepliesResponse fromJson(Map json) => _$QueryRepliesResponseFromJson(json); } -/// Base Model response for [Channel.sendImage] and [Channel.sendFile] api call. -@JsonSerializable(createToJson: false) -class SendAttachmentResponse extends _BaseResponse { - /// The url of the uploaded attachment. - late String? file; - - /// Create a new instance from a json - static SendAttachmentResponse fromJson(Map json) => _$SendAttachmentResponseFromJson(json); -} - -/// Model response for [Channel.sendFile] api call -@JsonSerializable(createToJson: false) -class SendFileResponse extends SendAttachmentResponse { - /// The url of the uploaded video file. - /// - /// This is only present if the file is a video. - String? thumbUrl; - - /// Create a new instance from a json - static SendFileResponse fromJson(Map json) => _$SendFileResponseFromJson(json); -} - -/// Model response for [Channel.sendImage] api call -typedef SendImageResponse = SendAttachmentResponse; - -/// Model response for [StreamChatClient.uploadImage] api call -typedef UploadImageResponse = SendAttachmentResponse; - -/// Model response for [StreamChatClient.uploadFile] api call -typedef UploadFileResponse = SendAttachmentResponse; - /// Model response for [Channel.sendReaction] api call @JsonSerializable(createToJson: false) class SendReactionResponse extends MessageResponse { diff --git a/packages/stream_chat/lib/src/core/api/responses.g.dart b/packages/stream_chat/lib/src/core/api/responses.g.dart index afd5aef5b0..f5997bf67f 100644 --- a/packages/stream_chat/lib/src/core/api/responses.g.dart +++ b/packages/stream_chat/lib/src/core/api/responses.g.dart @@ -83,17 +83,6 @@ QueryRepliesResponse _$QueryRepliesResponseFromJson( ..messages = (json['messages'] as List?)?.map((e) => Message.fromJson(e as Map)).toList() ?? []; -SendAttachmentResponse _$SendAttachmentResponseFromJson( - Map json, -) => SendAttachmentResponse() - ..duration = json['duration'] as String? - ..file = json['file'] as String?; - -SendFileResponse _$SendFileResponseFromJson(Map json) => SendFileResponse() - ..duration = json['duration'] as String? - ..file = json['file'] as String? - ..thumbUrl = json['thumb_url'] as String?; - SendReactionResponse _$SendReactionResponseFromJson( Map json, ) => SendReactionResponse() diff --git a/packages/stream_chat/lib/src/core/api/stream_chat_api.dart b/packages/stream_chat/lib/src/core/api/stream_chat_api.dart index b02e7cc26a..51045e1bbe 100644 --- a/packages/stream_chat/lib/src/core/api/stream_chat_api.dart +++ b/packages/stream_chat/lib/src/core/api/stream_chat_api.dart @@ -2,7 +2,6 @@ import 'package:dio/dio.dart'; import 'package:stream_core/stream_core.dart' show ConnectionIdGetter, SystemEnvironmentManager, TokenManager; import '../http/stream_http_client.dart'; -import 'attachment_file_uploader.dart'; import 'channel_api.dart'; import 'general_api.dart'; import 'guest_api.dart'; @@ -24,11 +23,9 @@ class StreamChatApi { TokenManager? tokenManager, ConnectionIdGetter? connectionId, SystemEnvironmentManager? systemEnvironmentManager, - AttachmentFileUploaderProvider attachmentFileUploaderProvider = StreamAttachmentFileUploader.new, Iterable? interceptors, HttpClientAdapter? httpClientAdapter, - }) : _fileUploaderProvider = attachmentFileUploaderProvider, - _client = + }) : _client = client ?? StreamHttpClient( apiKey, @@ -41,7 +38,6 @@ class StreamChatApi { ); final StreamHttpClient _client; - final AttachmentFileUploaderProvider _fileUploaderProvider; /// Api dedicated to users operations UserApi get user => _user ??= UserApi(_client); @@ -82,8 +78,4 @@ class StreamChatApi { /// Api dedicated to general operations GeneralApi get general => _general ??= GeneralApi(_client); GeneralApi? _general; - - /// Class responsible for uploading images and files to a given channel - AttachmentFileUploader get fileUploader => _fileUploader ??= _fileUploaderProvider.call(_client); - AttachmentFileUploader? _fileUploader; } diff --git a/packages/stream_chat/lib/src/repository/mapper/uploads_mapper.dart b/packages/stream_chat/lib/src/repository/mapper/uploads_mapper.dart new file mode 100644 index 0000000000..15f618f8a2 --- /dev/null +++ b/packages/stream_chat/lib/src/repository/mapper/uploads_mapper.dart @@ -0,0 +1,27 @@ +import 'package:stream_core/stream_core.dart' show UploadedFile; + +import '../../../open_api/api.dart' as api; + +/// Maps a generated [api.UploadChannelResponse] to an [UploadedFile]. +extension UploadChannelResponseMapper on api.UploadChannelResponse { + /// Converts this response into an [UploadedFile]. + UploadedFile toModel() => UploadedFile(fileUrl: file, thumbUrl: thumbUrl); +} + +/// Maps a generated [api.UploadChannelFileResponse] to an [UploadedFile]. +extension UploadChannelFileResponseMapper on api.UploadChannelFileResponse { + /// Converts this response into an [UploadedFile]. + UploadedFile toModel() => UploadedFile(fileUrl: file, thumbUrl: thumbUrl); +} + +/// Maps a generated [api.ImageUploadResponse] to an [UploadedFile]. +extension ImageUploadResponseMapper on api.ImageUploadResponse { + /// Converts this response into an [UploadedFile]. + UploadedFile toModel() => UploadedFile(fileUrl: file, thumbUrl: thumbUrl); +} + +/// Maps a generated [api.FileUploadResponse] to an [UploadedFile]. +extension FileUploadResponseMapper on api.FileUploadResponse { + /// Converts this response into an [UploadedFile]. + UploadedFile toModel() => UploadedFile(fileUrl: file, thumbUrl: thumbUrl); +} diff --git a/packages/stream_chat/lib/stream_chat.dart b/packages/stream_chat/lib/stream_chat.dart index 65c2364419..a4877847c5 100644 --- a/packages/stream_chat/lib/stream_chat.dart +++ b/packages/stream_chat/lib/stream_chat.dart @@ -60,6 +60,7 @@ export 'package:stream_core/stream_core.dart' SystemEnvironment, TokenManager, TokenProvider, + UploadedFile, UserToken, UserTokenLoader, WsEvent; diff --git a/packages/stream_chat/test/src/client/channel/channel_test.dart b/packages/stream_chat/test/src/client/channel/channel_test.dart index 5a2223e697..e6838e2d60 100644 --- a/packages/stream_chat/test/src/client/channel/channel_test.dart +++ b/packages/stream_chat/test/src/client/channel/channel_test.dart @@ -661,8 +661,12 @@ void main() { attachments: attachments, ); - final sendImageResponse = SendImageResponse()..file = 'test-image-url'; - final sendFileResponse = SendFileResponse()..file = 'test-file-url'; + const sendImageResult = Result.success( + UploadedFile(fileUrl: 'test-image-url'), + ); + const sendFileResult = Result.success( + UploadedFile(fileUrl: 'test-file-url'), + ); when( () => client.sendImage( @@ -673,7 +677,7 @@ void main() { cancelToken: any(named: 'cancelToken'), extraData: any(named: 'extraData'), ), - ).thenAnswer((_) async => sendImageResponse); + ).thenAnswer((_) async => sendImageResult); when( () => client.sendFile( @@ -684,7 +688,7 @@ void main() { cancelToken: any(named: 'cancelToken'), extraData: any(named: 'extraData'), ), - ).thenAnswer((_) async => sendFileResponse); + ).thenAnswer((_) async => sendFileResult); when( () => client.sendMessage( @@ -822,6 +826,94 @@ void main() { ).called(1); }); + test('Channel.sendMessage sends an uploaded image with its URL as the imageUrl', () async { + final attachment = Attachment( + id: 'test-attachment-id', + type: 'image', + file: AttachmentFile(size: 100, path: 'test-file-path'), + ); + final message = Message(id: 'test-message-id', attachments: [attachment]); + + when( + () => client.sendImage( + any(), + channelId, + channelType, + onSendProgress: any(named: 'onSendProgress'), + cancelToken: any(named: 'cancelToken'), + extraData: any(named: 'extraData'), + ), + ).thenAnswer((_) async => const Result.success(UploadedFile(fileUrl: 'image-url'))); + when(() => client.sendMessage(any(), channelId, channelType)).thenAnswer( + (_) async => SendMessageResponse()..message = message.copyWith(state: MessageState.sent), + ); + + await channel.sendMessage(message); + + final sent = verify(() => client.sendMessage(captureAny(), channelId, channelType)).captured.single as Message; + expect(sent.attachments.single.imageUrl, 'image-url'); + }); + + test('Channel.sendMessage sends an uploaded file with its URL and thumbnail', () async { + final attachment = Attachment( + id: 'test-attachment-id', + type: 'video', + file: AttachmentFile(size: 100, path: 'test-file-path'), + ); + final message = Message(id: 'test-message-id', attachments: [attachment]); + + when( + () => client.sendFile( + any(), + channelId, + channelType, + onSendProgress: any(named: 'onSendProgress'), + cancelToken: any(named: 'cancelToken'), + extraData: any(named: 'extraData'), + ), + ).thenAnswer( + (_) async => const Result.success(UploadedFile(fileUrl: 'clip-url', thumbUrl: 'thumb-url')), + ); + when(() => client.sendMessage(any(), channelId, channelType)).thenAnswer( + (_) async => SendMessageResponse()..message = message.copyWith(state: MessageState.sent), + ); + + await channel.sendMessage(message); + + final sent = verify(() => client.sendMessage(captureAny(), channelId, channelType)).captured.single as Message; + expect( + sent.attachments.single, + isA() + .having((it) => it.assetUrl, 'assetUrl', 'clip-url') + .having((it) => it.thumbUrl, 'thumbUrl', 'thumb-url'), + ); + }); + + test('Channel.sendMessage marks an attachment failed when its upload fails', () async { + final attachment = Attachment( + id: 'test-attachment-id', + type: 'image', + file: AttachmentFile(size: 100, path: 'test-file-path'), + ); + final message = Message(id: 'test-message-id', attachments: [attachment]); + + when( + () => client.sendImage( + any(), + channelId, + channelType, + onSendProgress: any(named: 'onSendProgress'), + cancelToken: any(named: 'cancelToken'), + extraData: any(named: 'extraData'), + ), + ).thenAnswer((_) async => const Result.failure(StreamClientException(message: 'boom'))); + + await expectLater(channel.sendMessage(message), throwsA(isA())); + + final stored = channel.state!.messages.single.attachments.single; + expect(stored.uploadState, isA()); + }); + test('should not send if the message is invalid', () async { final message = Message(id: 'test-message-id'); @@ -846,7 +938,7 @@ void main() { // Holds the first send inside its attachment upload, so the second one // arrives while it is still in flight. - final upload = Completer(); + final upload = Completer>(); when( () => client.sendImage( any(), @@ -857,7 +949,9 @@ void main() { extraData: any(named: 'extraData'), ), ).thenAnswer((_) => upload.future); - addTearDown(() => upload.complete(SendImageResponse()..file = 'url')); + addTearDown( + () => upload.complete(const Result.success(UploadedFile(fileUrl: 'url'))), + ); final superseded = channel.sendMessage(message); await pumpEventQueue(); @@ -897,7 +991,7 @@ void main() { extraData: any(named: 'extraData'), ), ).thenAnswer( - (_) async => throw const StreamNetworkException(message: 'Request cancelled', isCancelled: true), + (_) async => const Result.failure(StreamNetworkException(message: 'Request cancelled', isCancelled: true)), ); expect( @@ -947,7 +1041,7 @@ void main() { extraData: any(named: 'extraData'), ), ).thenAnswer( - (_) async => throw const StreamNetworkException(message: 'Request cancelled', isCancelled: true), + (_) async => const Result.failure(StreamNetworkException(message: 'Request cancelled', isCancelled: true)), ); when( @@ -1020,7 +1114,7 @@ void main() { extraData: any(named: 'extraData'), ), ).thenAnswer( - (_) async => throw const StreamNetworkException(message: 'Request cancelled', isCancelled: true), + (_) async => const Result.failure(StreamNetworkException(message: 'Request cancelled', isCancelled: true)), ); when( @@ -1088,7 +1182,7 @@ void main() { extraData: any(named: 'extraData'), ), ).thenAnswer( - (_) async => throw const StreamNetworkException(message: 'Request cancelled', isCancelled: true), + (_) async => const Result.failure(StreamNetworkException(message: 'Request cancelled', isCancelled: true)), ); when( @@ -1535,8 +1629,12 @@ void main() { attachments: attachments, ); - final sendImageResponse = SendImageResponse()..file = 'test-image-url'; - final sendFileResponse = SendFileResponse()..file = 'test-file-url'; + const sendImageResult = Result.success( + UploadedFile(fileUrl: 'test-image-url'), + ); + const sendFileResult = Result.success( + UploadedFile(fileUrl: 'test-file-url'), + ); when( () => client.sendImage( @@ -1547,7 +1645,7 @@ void main() { cancelToken: any(named: 'cancelToken'), extraData: any(named: 'extraData'), ), - ).thenAnswer((_) async => sendImageResponse); + ).thenAnswer((_) async => sendImageResult); when( () => client.sendFile( @@ -1558,7 +1656,7 @@ void main() { cancelToken: any(named: 'cancelToken'), extraData: any(named: 'extraData'), ), - ).thenAnswer((_) async => sendFileResponse); + ).thenAnswer((_) async => sendFileResult); when( () => client.updateMessage( @@ -2441,11 +2539,11 @@ void main() { when( () => client.deleteImage(any(), channelId, channelType), - ).thenAnswer((_) async => EmptyResponse()); + ).thenAnswer((_) async => const Result.success(null)); when( () => client.deleteFile(any(), channelId, channelType), - ).thenAnswer((_) async => EmptyResponse()); + ).thenAnswer((_) async => const Result.success(null)); final res = await channel.deleteMessage(message, hard: true); expect(res, isNotNull); @@ -2883,13 +2981,15 @@ void main() { when( () => client.deleteFile(url, channelId, channelType, cancelToken: any(named: 'cancelToken')), - ).thenAnswer((_) async => EmptyResponse()); + ).thenAnswer((_) async => const Result.success(null)); final res = await channel.deleteFile(url); expect(res, isNotNull); - verify(() => client.deleteFile(url, channelId, channelType, cancelToken: any(named: 'cancelToken'))).called(1); + verify( + () => client.deleteFile(url, channelId, channelType, cancelToken: any(named: 'cancelToken')), + ).called(1); }); test('`.deleteImage`', () async { @@ -2897,13 +2997,15 @@ void main() { when( () => client.deleteImage(url, channelId, channelType, cancelToken: any(named: 'cancelToken')), - ).thenAnswer((_) async => EmptyResponse()); + ).thenAnswer((_) async => const Result.success(null)); final res = await channel.deleteImage(url); expect(res, isNotNull); - verify(() => client.deleteImage(url, channelId, channelType, cancelToken: any(named: 'cancelToken'))).called(1); + verify( + () => client.deleteImage(url, channelId, channelType, cancelToken: any(named: 'cancelToken')), + ).called(1); }); test('`.stopAIResponse`', () async { diff --git a/packages/stream_chat/test/src/client/client_test.dart b/packages/stream_chat/test/src/client/client_test.dart index 9d6ce0bbd5..8a8a4f0461 100644 --- a/packages/stream_chat/test/src/client/client_test.dart +++ b/packages/stream_chat/test/src/client/client_test.dart @@ -1664,134 +1664,6 @@ void main() { verifyNoMoreInteractions(fakeChatApi.general); }); - test('`.sendFile`', () async { - const channelId = 'test-channel-id'; - const channelType = 'test-channel-type'; - final file = AttachmentFile(size: 33, path: 'test-file-path'); - - const fileUrl = 'test-file-url'; - - when( - () => fakeChatApi.fileUploader.sendFile(file, channelId, channelType), - ).thenAnswer((_) async => SendFileResponse()..file = fileUrl); - - final res = await client.sendFile(file, channelId, channelType); - expect(res, isNotNull); - expect(res.file, fileUrl); - - verify(() => fakeChatApi.fileUploader.sendFile(file, channelId, channelType)).called(1); - verifyNoMoreInteractions(fakeChatApi.fileUploader); - }); - - test('`.sendImage`', () async { - const channelId = 'test-channel-id'; - const channelType = 'test-channel-type'; - final image = AttachmentFile(size: 33, path: 'test-image-path'); - - const fileUrl = 'test-image-url'; - - when( - () => fakeChatApi.fileUploader.sendImage(image, channelId, channelType), - ).thenAnswer((_) async => SendImageResponse()..file = fileUrl); - - final res = await client.sendImage(image, channelId, channelType); - expect(res, isNotNull); - expect(res.file, fileUrl); - - verify(() => fakeChatApi.fileUploader.sendImage(image, channelId, channelType)).called(1); - verifyNoMoreInteractions(fakeChatApi.fileUploader); - }); - - test('`.deleteFile`', () async { - const channelId = 'test-channel-id'; - const channelType = 'test-channel-type'; - const fileUrl = 'test-file-url'; - - when( - () => fakeChatApi.fileUploader.deleteFile(fileUrl, channelId, channelType), - ).thenAnswer((_) async => EmptyResponse()); - - final res = await client.deleteFile(fileUrl, channelId, channelType); - expect(res, isNotNull); - - verify(() => fakeChatApi.fileUploader.deleteFile(fileUrl, channelId, channelType)).called(1); - verifyNoMoreInteractions(fakeChatApi.fileUploader); - }); - - test('`.deleteImage`', () async { - const channelId = 'test-channel-id'; - const channelType = 'test-channel-type'; - const imageUrl = 'test-image-url'; - - when( - () => fakeChatApi.fileUploader.deleteImage(imageUrl, channelId, channelType), - ).thenAnswer((_) async => EmptyResponse()); - - final res = await client.deleteImage(imageUrl, channelId, channelType); - expect(res, isNotNull); - - verify( - () => fakeChatApi.fileUploader.deleteImage(imageUrl, channelId, channelType), - ).called(1); - verifyNoMoreInteractions(fakeChatApi.fileUploader); - }); - - test('`.uploadImage`', () async { - final image = AttachmentFile(size: 33, path: 'test-image-path'); - const fileUrl = 'test-image-url'; - - when( - () => fakeChatApi.fileUploader.uploadImage(image), - ).thenAnswer((_) async => UploadImageResponse()..file = fileUrl); - - final res = await client.uploadImage(image); - expect(res, isNotNull); - expect(res.file, fileUrl); - - verify(() => fakeChatApi.fileUploader.uploadImage(image)).called(1); - verifyNoMoreInteractions(fakeChatApi.fileUploader); - }); - - test('`.uploadFile`', () async { - final file = AttachmentFile(size: 33, path: 'test-file-path'); - const fileUrl = 'test-file-url'; - - when( - () => fakeChatApi.fileUploader.uploadFile(file), - ).thenAnswer((_) async => UploadFileResponse()..file = fileUrl); - - final res = await client.uploadFile(file); - expect(res, isNotNull); - expect(res.file, fileUrl); - - verify(() => fakeChatApi.fileUploader.uploadFile(file)).called(1); - verifyNoMoreInteractions(fakeChatApi.fileUploader); - }); - - test('`.removeImage`', () async { - const imageUrl = 'test-image-url'; - - when(() => fakeChatApi.fileUploader.removeImage(imageUrl)).thenAnswer((_) async => EmptyResponse()); - - final res = await client.removeImage(imageUrl); - expect(res, isNotNull); - - verify(() => fakeChatApi.fileUploader.removeImage(imageUrl)).called(1); - verifyNoMoreInteractions(fakeChatApi.fileUploader); - }); - - test('`.removeFile`', () async { - const fileUrl = 'test-file-url'; - - when(() => fakeChatApi.fileUploader.removeFile(fileUrl)).thenAnswer((_) async => EmptyResponse()); - - final res = await client.removeFile(fileUrl); - expect(res, isNotNull); - - verify(() => fakeChatApi.fileUploader.removeFile(fileUrl)).called(1); - verifyNoMoreInteractions(fakeChatApi.fileUploader); - }); - test('`.updateChannel`', () async { const channelId = 'test-channel-id'; const channelType = 'test-channel-type'; diff --git a/packages/stream_chat/test/src/core/api/attachment_file_uploader_requests_test.dart b/packages/stream_chat/test/src/core/api/attachment_file_uploader_requests_test.dart new file mode 100644 index 0000000000..b869d24064 --- /dev/null +++ b/packages/stream_chat/test/src/core/api/attachment_file_uploader_requests_test.dart @@ -0,0 +1,98 @@ +import 'dart:typed_data'; + +import 'package:dio/dio.dart'; +import 'package:mocktail/mocktail.dart'; +import 'package:stream_chat/stream_chat.dart'; +import 'package:test/test.dart'; + +import '../../fakes.dart'; +import '../../utils.dart'; +import '../../ws/fake_chat_server.dart'; + +void main() { + setUpAll(() => registerFallbackValue(RequestOptions())); + + test('StreamChatClient.sendImage posts the image to the channel it is given', () async { + final adapter = _adapterAnswering('{"duration":"1ms","file":"image-url"}'); + final client = await _connectedClient(adapter); + + final result = await client.sendImage(_file(), 'general', 'messaging'); + + expect(result.getOrNull()?.fileUrl, 'image-url'); + final request = _lastRequest(adapter); + expect(request.method, 'POST'); + expect(request.path, '/api/v2/chat/channels/messaging/general/image'); + expect((request.data as FormData).files.single.key, 'file'); + }); + + test('StreamChatClient.removeFile deletes the file at the url it is given', () async { + final adapter = _adapterAnswering('{"duration":"1ms"}'); + final client = await _connectedClient(adapter); + + final result = await client.removeFile('file-url'); + + expect(result.isSuccess, isTrue); + final request = _lastRequest(adapter); + expect(request.method, 'DELETE'); + expect(request.path, '/api/v2/uploads/file'); + expect(request.queryParameters, containsPair('url', 'file-url')); + }); + + test('StreamChatClient.sendFile answers a canceled upload with a cancellation', () async { + final adapter = _adapterAnswering('{"duration":"1ms","file":"file-url"}'); + final client = await _connectedClient(adapter); + final cancelToken = CancelToken()..cancel(); + + final result = await client.sendFile( + _file(), + 'general', + 'messaging', + cancelToken: cancelToken, + ); + + expect( + result.exceptionOrNull(), + isA().having((it) => it.isCancelled, 'isCancelled', isTrue), + ); + }); +} + +Future _connectedClient(HttpClientAdapter adapter) async { + final user = User(id: 'test-user-id'); + final ws = FakeChatServer()..user = OwnUser.fromUser(user); + final client = StreamChatClient( + 'test-api-key', + chatApi: FakeChatApi(), + defaultApi: FakeDefaultApi(), + wsProvider: ws.connect, + httpClientAdapter: adapter, + ); + addTearDown(client.dispose); + + await client.connectUser(user, testUserToken(user.id).rawValue); + return client; +} + +MockHttpClientAdapter _adapterAnswering(String body) { + final adapter = MockHttpClientAdapter(); + when(() => adapter.fetch(any(), any(), any())).thenAnswer( + (_) async => ResponseBody.fromString(body, 201, headers: _jsonHeaders), + ); + return adapter; +} + +RequestOptions _lastRequest(MockHttpClientAdapter adapter) { + final calls = verify(() => adapter.fetch(captureAny(), any(), any())).captured; + return calls.last as RequestOptions; +} + +AttachmentFile _file() { + final bytes = Uint8List.fromList([1, 2, 3]); + return AttachmentFile(size: bytes.length, bytes: bytes, name: 'photo.jpg'); +} + +const _jsonHeaders = { + Headers.contentTypeHeader: [Headers.jsonContentType], +}; + +class MockHttpClientAdapter extends Mock implements HttpClientAdapter {} diff --git a/packages/stream_chat/test/src/core/api/attachment_file_uploader_test.dart b/packages/stream_chat/test/src/core/api/attachment_file_uploader_test.dart index 1b319718e1..a4ccd27392 100644 --- a/packages/stream_chat/test/src/core/api/attachment_file_uploader_test.dart +++ b/packages/stream_chat/test/src/core/api/attachment_file_uploader_test.dart @@ -1,266 +1,253 @@ -import 'package:dio/dio.dart'; +import 'dart:typed_data'; + import 'package:mocktail/mocktail.dart'; -import 'package:stream_chat/src/core/api/attachment_file_uploader.dart'; -import 'package:stream_chat/src/core/models/attachment_file.dart'; +import 'package:stream_chat/open_api/api.dart' as api; +import 'package:stream_chat/src/cdn/cdn_api.dart'; +import 'package:stream_chat/stream_chat.dart'; import 'package:test/test.dart'; import '../../fakes.dart'; -import '../../matchers.dart'; import '../../mocks.dart'; -import '../../utils.dart'; void main() { - late final client = MockHttpClient(); - late StreamAttachmentFileUploader fileUploader; + const channelId = 'general'; + const channelType = 'messaging'; + const error = StreamClientException(message: 'boom'); + + late MockCdnApi cdnApi; + late StreamChatClient client; + + setUpAll(() => registerFallbackValue(MultipartFile.fromBytes(const []))); setUp(() { - fileUploader = StreamAttachmentFileUploader(client); - registerFallbackValue(FakeMultiPartFile()); + cdnApi = MockCdnApi(); + client = _client(cdnApi); }); - Response successResponse(String path, {Object? data}) => Response( - data: data, - requestOptions: RequestOptions(path: path), - statusCode: 200, - ); + test('StreamChatClient.sendImage answers with the URL the channel upload returns', () async { + _stubChannelImageUpload(cdnApi, const Result.success(api.UploadChannelResponse(duration: '1ms', file: 'url'))); - test('sendImage', () async { - const channelId = 'test-channel-id'; - const channelType = 'test-channel-type'; + final result = await client.sendImage(_file(), channelId, channelType); - const path = '/channels/$channelType/$channelId/image'; - final file = assetFile('test_image.jpeg'); - final attachmentFile = AttachmentFile( - size: 333, - path: file.path, - bytes: file.readAsBytesSync(), - ); - final multipartFile = await attachmentFile.toMultipartFile(); + expect(result.getOrNull()?.fileUrl, 'url'); + }); + test('StreamChatClient.sendImage reports upload progress to onSendProgress', () async { when( - () => client.postFile( - path, - any(that: isSameMultipartFileAs(multipartFile)), + () => cdnApi.uploadChannelImage( + type: any(named: 'type'), + id: any(named: 'id'), + file: any(named: 'file'), + onUploadProgress: any(named: 'onUploadProgress'), + cancelToken: any(named: 'cancelToken'), ), - ).thenAnswer( - (_) async => successResponse( - path, - data: { - 'file': 'test-file-url', - }, - ), - ); - - final res = await fileUploader.sendImage( - attachmentFile, + ).thenAnswer((invocation) async { + final onProgress = invocation.namedArguments[#onUploadProgress] as ProgressCallback; + onProgress(5, 10); + return const Result.success(api.UploadChannelResponse(duration: '1ms')); + }); + + final progress = <(int, int)>[]; + await client.sendImage( + _file(), channelId, channelType, + onSendProgress: (sent, total) => progress.add((sent, total)), ); - expect(res, isNotNull); - expect(res.file, isNotNull); - expect(res.file, isNotEmpty); - - verify( - () => client.postFile( - path, - any(that: isSameMultipartFileAs(multipartFile)), - ), - ).called(1); - verifyNoMoreInteractions(client); + expect(progress, [(5, 10)]); }); - test('sendFile', () async { - const channelId = 'test-channel-id'; - const channelType = 'test-channel-type'; - - const path = '/channels/$channelType/$channelId/file'; - final file = assetFile('example.pdf'); - final attachmentFile = AttachmentFile( - size: 333, - path: file.path, - bytes: file.readAsBytesSync(), - ); - final multipartFile = await attachmentFile.toMultipartFile(); - - when( - () => client.postFile( - path, - any(that: isSameMultipartFileAs(multipartFile)), - ), - ).thenAnswer( - (_) async => successResponse( - path, - data: { - 'file': 'test-file-url', - }, - ), - ); - - final res = await fileUploader.sendFile( - attachmentFile, - channelId, - channelType, - ); + test('StreamChatClient.sendImage passes the cancelToken it is given to the upload', () async { + _stubChannelImageUpload(cdnApi, const Result.success(api.UploadChannelResponse(duration: '1ms'))); + final cancelToken = CancelToken(); - expect(res, isNotNull); - expect(res.file, isNotNull); - expect(res.file, isNotEmpty); + await client.sendImage(_file(), channelId, channelType, cancelToken: cancelToken); verify( - () => client.postFile( - path, - any(that: isSameMultipartFileAs(multipartFile)), + () => cdnApi.uploadChannelImage( + type: any(named: 'type'), + id: any(named: 'id'), + file: any(named: 'file'), + onUploadProgress: any(named: 'onUploadProgress'), + cancelToken: cancelToken, ), ).called(1); - verifyNoMoreInteractions(client); }); - test('deleteImage', () async { - const channelId = 'test-channel-id'; - const channelType = 'test-channel-type'; - const path = '/channels/$channelType/$channelId/image'; + test('StreamChatClient.sendImage returns the failure without throwing', () async { + _stubChannelImageUpload(cdnApi, const Result.failure(error)); - const url = 'test-image-url'; + final result = await client.sendImage(_file(), channelId, channelType); - when( - () => client.delete(path, queryParameters: {'url': url}), - ).thenAnswer((_) async => successResponse(path, data: {})); + expect(result.exceptionOrNull(), error); + }); - final res = await fileUploader.deleteImage(url, channelId, channelType); + test('StreamChatClient.sendImage answers with a failure when the file cannot be read', () async { + final missing = AttachmentFile(size: 3, path: '/does/not/exist/photo.jpg'); - expect(res, isNotNull); + final result = await client.sendImage(missing, channelId, channelType); - verify(() => client.delete(path, queryParameters: {'url': url})).called(1); - verifyNoMoreInteractions(client); + expect(result.exceptionOrNull(), isA()); }); - test('deleteFile', () async { - const channelId = 'test-channel-id'; - const channelType = 'test-channel-type'; - const path = '/channels/$channelType/$channelId/file'; - - const url = 'test-file-url'; + test( + 'StreamChatClient.sendFile answers with the URL and thumbnail the channel upload returns', + () async { + when( + () => cdnApi.uploadChannelFile( + type: channelType, + id: channelId, + file: any(named: 'file'), + onUploadProgress: any(named: 'onUploadProgress'), + cancelToken: any(named: 'cancelToken'), + ), + ).thenAnswer( + (_) async => const Result.success( + api.UploadChannelFileResponse(duration: '1ms', file: 'clip-url', thumbUrl: 'thumb-url'), + ), + ); + + final result = await client.sendFile(_file(name: 'clip.mp4'), channelId, channelType); + + expect( + result.getOrNull(), + isA() + .having((it) => it.fileUrl, 'fileUrl', 'clip-url') + .having((it) => it.thumbUrl, 'thumbUrl', 'thumb-url'), + ); + }, + ); + test('StreamChatClient.deleteImage deletes the image from the channel it is given', () async { when( - () => client.delete(path, queryParameters: {'url': url}), - ).thenAnswer((_) async => successResponse(path, data: {})); - - final res = await fileUploader.deleteFile(url, channelId, channelType); + () => cdnApi.deleteChannelImage( + type: channelType, + id: channelId, + url: 'url', + cancelToken: any(named: 'cancelToken'), + ), + ).thenAnswer((_) async => const Result.success(api.DurationResponse(duration: '1ms'))); - expect(res, isNotNull); + final result = await client.deleteImage('url', channelId, channelType); - verify(() => client.delete(path, queryParameters: {'url': url})).called(1); - verifyNoMoreInteractions(client); + expect(result.isSuccess, isTrue); }); - test('uploadImage', () async { - const path = '/uploads/image'; - final file = assetFile('test_image.jpeg'); - final attachmentFile = AttachmentFile( - size: 333, - path: file.path, - bytes: file.readAsBytesSync(), - ); - final multipartFile = await attachmentFile.toMultipartFile(); - + test('StreamChatClient.deleteFile deletes the file from the channel it is given', () async { when( - () => client.postFile( - path, - any(that: isSameMultipartFileAs(multipartFile)), + () => cdnApi.deleteChannelFile( + type: channelType, + id: channelId, + url: 'url', + cancelToken: any(named: 'cancelToken'), ), - ).thenAnswer( - (_) async => successResponse( - path, - data: { - 'file': 'test-image-url', - }, - ), - ); + ).thenAnswer((_) async => const Result.success(api.DurationResponse(duration: '1ms'))); - final res = await fileUploader.uploadImage(attachmentFile); + final result = await client.deleteFile('url', channelId, channelType); - expect(res, isNotNull); - expect(res.file, isNotNull); - expect(res.file, isNotEmpty); + expect(result.isSuccess, isTrue); + }); - verify( - () => client.postFile( - path, - any(that: isSameMultipartFileAs(multipartFile)), + test('StreamChatClient.deleteFile returns the failure without throwing', () async { + when( + () => cdnApi.deleteChannelFile( + type: any(named: 'type'), + id: any(named: 'id'), + url: any(named: 'url'), + cancelToken: any(named: 'cancelToken'), ), - ).called(1); - verifyNoMoreInteractions(client); - }); + ).thenAnswer((_) async => const Result.failure(error)); - test('uploadFile', () async { - const path = '/uploads/file'; - final file = assetFile('example.pdf'); - final attachmentFile = AttachmentFile( - size: 333, - path: file.path, - bytes: file.readAsBytesSync(), - ); - final multipartFile = await attachmentFile.toMultipartFile(); + final result = await client.deleteFile('url', channelId, channelType); + expect(result.exceptionOrNull(), error); + }); + + test('StreamChatClient.uploadImage answers with the URL the standalone upload returns', () async { when( - () => client.postFile( - path, - any(that: isSameMultipartFileAs(multipartFile)), + () => cdnApi.uploadImage( + file: any(named: 'file'), + onUploadProgress: any(named: 'onUploadProgress'), + cancelToken: any(named: 'cancelToken'), ), - ).thenAnswer( - (_) async => successResponse( - path, - data: { - 'file': 'test-file-url', - }, - ), - ); + ).thenAnswer((_) async => const Result.success(api.ImageUploadResponse(duration: '1ms', file: 'avatar-url'))); - final res = await fileUploader.uploadFile(attachmentFile); + final result = await client.uploadImage(_file()); - expect(res, isNotNull); - expect(res.file, isNotNull); - expect(res.file, isNotEmpty); + expect(result.getOrNull()?.fileUrl, 'avatar-url'); + }); - verify( - () => client.postFile( - path, - any(that: isSameMultipartFileAs(multipartFile)), + test('StreamChatClient.uploadFile answers with the URL the standalone upload returns', () async { + when( + () => cdnApi.uploadFile( + file: any(named: 'file'), + onUploadProgress: any(named: 'onUploadProgress'), + cancelToken: any(named: 'cancelToken'), ), - ).called(1); - verifyNoMoreInteractions(client); - }); + ).thenAnswer((_) async => const Result.success(api.FileUploadResponse(duration: '1ms', file: 'doc-url'))); - test('removeImage', () async { - const path = '/uploads/image'; - const url = 'test-image-url'; + final result = await client.uploadFile(_file(name: 'doc.pdf')); - when( - () => client.delete(path, queryParameters: {'url': url}), - ).thenAnswer((_) async => successResponse(path, data: {})); + expect(result.getOrNull()?.fileUrl, 'doc-url'); + }); - final res = await fileUploader.removeImage(url); + test('StreamChatClient.removeImage deletes an image uploaded outside of any channel', () async { + when( + () => cdnApi.deleteImage( + url: 'url', + cancelToken: any(named: 'cancelToken'), + ), + ).thenAnswer((_) async => const Result.success(api.DurationResponse(duration: '1ms'))); - expect(res, isNotNull); + final result = await client.removeImage('url'); - verify(() => client.delete(path, queryParameters: {'url': url})).called(1); - verifyNoMoreInteractions(client); + expect(result.isSuccess, isTrue); }); - test('removeFile', () async { - const path = '/uploads/file'; - const url = 'test-file-url'; - + test('StreamChatClient uploads through the uploader its provider builds', () async { + final uploader = MockAttachmentFileUploader(); + final file = _file(); when( - () => client.delete(path, queryParameters: {'url': url}), - ).thenAnswer((_) async => successResponse(path, data: {})); + () => uploader.uploadImage(file), + ).thenAnswer((_) async => const Result.success(UploadedFile(fileUrl: 'custom-url'))); + + final client = StreamChatClient( + 'test-api-key', + chatApi: FakeChatApi(), + defaultApi: FakeDefaultApi(), + attachmentFileUploaderProvider: (_) => uploader, + ); + final result = await client.uploadImage(file); - final res = await fileUploader.removeFile(url); + expect(result.getOrNull()?.fileUrl, 'custom-url'); + }); +} - expect(res, isNotNull); +class MockCdnApi extends Mock implements CdnApi {} - verify(() => client.delete(path, queryParameters: {'url': url})).called(1); - verifyNoMoreInteractions(client); - }); +StreamChatClient _client(CdnApi cdnApi) { + return StreamChatClient( + 'test-api-key', + chatApi: FakeChatApi(), + defaultApi: FakeDefaultApi(), + attachmentFileUploaderProvider: (_) => StreamAttachmentFileUploader.fromApi(cdnApi), + ); +} + +AttachmentFile _file({String name = 'photo.jpg'}) { + final bytes = Uint8List.fromList([1, 2, 3]); + return AttachmentFile(size: bytes.length, bytes: bytes, name: name); +} + +void _stubChannelImageUpload(MockCdnApi cdnApi, Result result) { + when( + () => cdnApi.uploadChannelImage( + type: any(named: 'type'), + id: any(named: 'id'), + file: any(named: 'file'), + onUploadProgress: any(named: 'onUploadProgress'), + cancelToken: any(named: 'cancelToken'), + ), + ).thenAnswer((_) async => result); } diff --git a/packages/stream_chat/test/src/core/api/responses_test.dart b/packages/stream_chat/test/src/core/api/responses_test.dart index b281d2fdbc..a57b43510c 100644 --- a/packages/stream_chat/test/src/core/api/responses_test.dart +++ b/packages/stream_chat/test/src/core/api/responses_test.dart @@ -3415,24 +3415,6 @@ void main() { expect(response.results, isA>()); }); - test('SendFileResponse', () { - const jsonExample = '''{"file": "file-url","duration":"0.35ms"}'''; - final response = SendFileResponse.fromJson(json.decode(jsonExample)); - expect(response.file, isA()); - }); - - test('SendImageResponse', () { - const jsonExample = '''{"file": "file-url","duration":"0.35ms"}'''; - final response = SendImageResponse.fromJson(json.decode(jsonExample)); - expect(response.file, isA()); - }); - - test('SendImageResponse', () { - const jsonExample = '''{"file": "file-url","duration":"0.35ms"}'''; - final response = SendImageResponse.fromJson(json.decode(jsonExample)); - expect(response.file, isA()); - }); - test('EmptyResponse', () { const jsonExample = '''{"file": "file-url","duration":"0.35ms"}'''; final response = EmptyResponse.fromJson(json.decode(jsonExample)); diff --git a/packages/stream_chat/test/src/core/api/stream_chat_api_test.dart b/packages/stream_chat/test/src/core/api/stream_chat_api_test.dart index 31d1e96662..27c6296235 100644 --- a/packages/stream_chat/test/src/core/api/stream_chat_api_test.dart +++ b/packages/stream_chat/test/src/core/api/stream_chat_api_test.dart @@ -46,8 +46,4 @@ void main() { test('`.general`', () { expect(streamChatApi.general, isNotNull); }); - - test('`.fileUploader`', () { - expect(streamChatApi.fileUploader, isNotNull); - }); } diff --git a/packages/stream_chat/test/src/fakes.dart b/packages/stream_chat/test/src/fakes.dart index 20d3acd40c..85a2c2ce9a 100644 --- a/packages/stream_chat/test/src/fakes.dart +++ b/packages/stream_chat/test/src/fakes.dart @@ -164,11 +164,6 @@ class FakeChatApi extends Fake implements StreamChatApi { @override GeneralApi get general => _general ??= MockGeneralApi(); - - AttachmentFileUploader? _fileUploader; - - @override - AttachmentFileUploader get fileUploader => _fileUploader ??= MockAttachmentFileUploader(); } /// Answers the `getApp` call `connectUser` makes on the generated client. diff --git a/sample_app/lib/widgets/edit_group_sheet.dart b/sample_app/lib/widgets/edit_group_sheet.dart index a28cb0e353..b1779c98c1 100644 --- a/sample_app/lib/widgets/edit_group_sheet.dart +++ b/sample_app/lib/widgets/edit_group_sheet.dart @@ -218,19 +218,23 @@ class _EditGroupSheetState extends State { }); }, ); - final url = response.file; - if (url == null || !mounted) return; - _trackedUploads.add(url); - setState(() => _imageOverride = url); - } catch (e) { - if (mounted) { + if (!mounted) return; + + if (response case Failure(:final error)) { // Drop the local preview so the user sees the channel revert — // the snackbar tells them why and they can re-pick. setState(() => _pickedPath = null); ScaffoldMessenger.of(context).showSnackBar( - SnackBar(content: Text('Upload failed: $e')), + SnackBar(content: Text('Upload failed: $error')), ); + return; } + + final url = response.getOrNull()?.fileUrl; + if (url == null) return; + + _trackedUploads.add(url); + setState(() => _imageOverride = url); } finally { if (mounted) setState(() => _uploadProgress = null); } From 1b2b27ed49c50bb5dc21deeb1f67d4a5cec445b7 Mon Sep 17 00:00:00 2001 From: Petar Velikov Date: Sat, 3 Oct 2026 09:40:39 +0200 Subject: [PATCH 34/36] refactor(llc)!: route connectGuestUser through the generated client (#3019) * refactor(llc)!: route connectGuestUser through the generated client Co-Authored-By: Claude Opus 5.5 * refactor(llc): apply review remarks on connectGuestUser and the user mappers Co-Authored-By: Claude Opus 5.5 * refactor(llc): rename the internal guest envelope to CreateGuestUserResponse Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: Claude Opus 5.5 --- migrations/v11-migration.md | 19 ++ openapi-migration/01-foundation.md | 12 + openapi-migration/04-roles-guest-and-app.md | 51 ++- openapi-migration/09-users.md | 8 +- openapi-migration/README.md | 14 +- openapi-migration/tool/generate_plan.py | 52 +++- packages/stream_chat/CHANGELOG.md | 3 + .../stream_chat/lib/src/client/client.dart | 21 +- .../lib/src/core/api/guest_api.dart | 20 -- .../lib/src/core/api/responses.dart | 13 - .../lib/src/core/api/responses.g.dart | 7 - .../lib/src/core/api/stream_chat_api.dart | 5 - .../response/create_guest_user_response.dart | 28 ++ .../create_guest_user_response.freezed.dart | 85 +++++ .../src/repository/general_repository.dart | 14 + .../src/repository/mapper/user_mapper.dart | 93 ++++++ .../client_connect_guest_user_test.dart | 290 ++++++++++++++++++ .../test/src/client/client_test.dart | 170 ++-------- .../test/src/core/api/guest_api_test.dart | 53 ---- .../test/src/core/api/responses_test.dart | 8 - .../src/core/api/stream_chat_api_test.dart | 4 - packages/stream_chat/test/src/fakes.dart | 6 - packages/stream_chat/test/src/mocks.dart | 3 - 23 files changed, 697 insertions(+), 282 deletions(-) delete mode 100644 packages/stream_chat/lib/src/core/api/guest_api.dart create mode 100644 packages/stream_chat/lib/src/core/models/response/create_guest_user_response.dart create mode 100644 packages/stream_chat/lib/src/core/models/response/create_guest_user_response.freezed.dart create mode 100644 packages/stream_chat/lib/src/repository/mapper/user_mapper.dart create mode 100644 packages/stream_chat/test/src/client/client_connect_guest_user_test.dart delete mode 100644 packages/stream_chat/test/src/core/api/guest_api_test.dart diff --git a/migrations/v11-migration.md b/migrations/v11-migration.md index fbc4d311ec..022dbf1998 100644 --- a/migrations/v11-migration.md +++ b/migrations/v11-migration.md @@ -29,6 +29,7 @@ onto Stream's OpenAPI-generated API client. - [Devices](#devices) - [Moderation](#moderation) - [App Settings](#app-settings) + - [Guest Users](#guest-users) - [File Upload](#file-upload) - [User Groups](#user-groups) - [Link Previews](#link-previews) @@ -75,6 +76,7 @@ from the spec, so don't subclass them or depend on their private constructors. | [**Error Handling**](#error-handling) | Failures carry `stream_core`'s sealed `StreamException` family instead of `StreamChatNetworkError`; `ChatErrorCode` → `StreamErrorCode`. API calls will return `Result` rather than throwing, endpoint by endpoint | | [**Moderation**](#moderation) | Muting, banning and flagging return a `Result` and call the moderation v2 API; `banUser`'s options map becomes named parameters; `unflagMessage`, `unflagUser` and `removeShadowBan` are removed | | [**App Settings**](#app-settings) | `getAppSettings` returns a `Result` instead of throwing; `GetAppSettingsResponse` is renamed `AppSettingsResponse` | +| [**Guest Users**](#guest-users) | `connectGuestUser` is unchanged; `StreamChatApi.guest` and `ConnectGuestUserResponse` are removed | | [**File Upload**](#file-upload) | Uploads return a `Result` and deletes a `Result` instead of throwing; `AttachmentFileUploaderProvider` receives a `Dio` | | _(filled in per feature as PRs land)_ | | @@ -210,6 +212,8 @@ search-and-replace you can apply directly. `Kind` is one of `renamed`, `removed` | `GetAppSettingsResponse` identity `==` | value `==`, plus `copyWith` | `retyped` | Two instances with the same fields are now equal | | `AppSettings extends Equatable` / `UploadConfig extends Equatable`, `props` | `AppSettings` / `UploadConfig` (value `==`, `copyWith`) | `removed` | Equality is unchanged; `props` is gone and neither is an `Equatable` any more | | `StreamChatApi.general.getAppSettings()` | `StreamChatClient.getAppSettings()` | `removed` | The call moved to the generated client | +| `StreamChatApi.guest` (`GuestApi.getGuestUser`) | `StreamChatClient.connectGuestUser` | `removed` | The call moved to the generated client; `connectGuestUser` keeps its signature and still throws | +| `ConnectGuestUserResponse` | — | `removed` | Only `StreamChatApi.guest` returned it; `connectGuestUser` still returns the connected `OwnUser` | | `sendImage` / `sendFile` / `uploadImage` / `uploadFile` → `Future` and siblings | `Future>` | `retyped` | On `StreamChatClient`, `Channel` and `AttachmentFileUploader`. Returns a `Result` instead of throwing | | `deleteImage` / `deleteFile` / `removeImage` / `removeFile` → `Future` | `Future>` | `retyped` | On `StreamChatClient`, `Channel` and `AttachmentFileUploader`. Returns a `Result` instead of throwing | | `SendAttachmentResponse`, `SendFileResponse`, `SendImageResponse`, `UploadImageResponse`, `UploadFileResponse` | `UploadedFile` (`stream_core`) | `removed` | `.file` becomes `.fileUrl`; `.thumbUrl` is unchanged; `duration` is gone | @@ -717,6 +721,21 @@ build them with their constructors — `AppSettingsResponse(duration: '0ms', app **`AppSettings` and `UploadConfig` no longer extend `Equatable`.** They still compare by value, `props` is gone, and both gain `copyWith`. +### Guest Users + +**`connectGuestUser` is unchanged.** It still returns the connected `OwnUser`, and still throws a +`StreamException` when the guest cannot be created or the connection fails. + +**`StreamChatApi.guest` and `ConnectGuestUserResponse` are removed.** `connectGuestUser` creates the guest and +connects it in one call; there is no separate call that only creates one. + +**The guest no longer stores your client state as custom data.** v10 sent the whole user, so fields such as +`online`, `banned`, the unread counts, devices and push preferences were saved on the new guest as custom data, and +some came back: an `OwnUser`'s `pushPreferences` on the returned user and in `extraData` when the guest was +queried, and the unread counts when connecting with `connectWebSocket: false`. None of them was ever applied to the +guest. v11 sends its id, name, image, language, `invisible`, an `OwnUser`'s privacy settings, and your own +`extraData`. If you read one of those values back, store it as a custom field of your own instead. + ### File Upload **Uploads and deletes return a `Result` instead of throwing.** `sendImage`, `sendFile`, `uploadImage` and diff --git a/openapi-migration/01-foundation.md b/openapi-migration/01-foundation.md index 2ed4488be9..5b07650215 100644 --- a/openapi-migration/01-foundation.md +++ b/openapi-migration/01-foundation.md @@ -38,6 +38,18 @@ real fields is a break worth making in v11 if it is made at all, and it belongs whichever group happens to touch `User` first. Raised on [#2957](https://github.com/GetStream/stream-chat-flutter/pull/2957). +**Decided: map now, restructure last.** + +- **`User` and `OwnUser` are not restructured until group 09, which runs last.** They keep their v10 shape, + including their JSON, until every parent that embeds them has moved. +- **The mappers land with the first group that needs them.** `lib/src/repository/mapper/user_mapper.dart` + (`UserResponse.toModel()`, `User.toRequest()`) arrived with group 04 and maps the generated types onto today's + class. Later groups reuse it; they never write their own `User` mapping. It is kept, not deleted: group 09 points + it at the restructured class. +- **v1 JSON keeps decoding through `User.fromJson`** until then, including in a parent's rule-7 converter, with no + wrapper in between. Group 09 replaces those calls when it removes `fromJson`, and the compiler finds every one. +- **`name` and `image` stay open.** Promoting them to real fields changes only `user_mapper.dart`. + ## Prerequisites - **The generator's `client.tpl` calls `runApiSafely`, not `runSafely`.** Until it does, a regenerated client diff --git a/openapi-migration/04-roles-guest-and-app.md b/openapi-migration/04-roles-guest-and-app.md index 568cc7e099..e8df714c1d 100644 --- a/openapi-migration/04-roles-guest-and-app.md +++ b/openapi-migration/04-roles-guest-and-app.md @@ -2,7 +2,7 @@ **Goal:** Sweep up the singletons — one-method families that share no state and can land in one PR. -**Size:** 1 hand-written method(s) across 1 file(s) → 5 generated operation(s). +**Size:** 0 hand-written method(s) across 0 file(s) → 5 generated operation(s). > This whole file is generated by `openapi-migration/tool/generate_plan.py`, prose included. > Edit its `GROUPS` entry and re-run the script — edits made here are lost on the next run. @@ -13,7 +13,6 @@ | File | Method | Returns | | --- | --- | --- | -| `guest_api.dart` | `getGuestUser` | `ConnectGuestUserResponse` | ### Generated operations that cover it @@ -73,6 +72,36 @@ - **An unset size limit stays `0`.** The server reports one as `size_limit: 0`, and `UploadConfig.sizeLimit` passes it through as v10 did; `StreamAttachmentValidator` applies `UploadConfig.defaultSizeLimit` in that case. No `effectiveSizeLimit` getter was added. +- **`connectGuestUser` keeps its v10 signature and keeps throwing.** It returns `Future` and + throws a `StreamException`, like `connectUser`, `connectUserWithProvider` and `connectAnonymousUser`. + It unwraps `GeneralRepository.createGuest`'s `Result` with `getOrElse`, the one sanctioned unwrap + inside the SDK: a `Result` on a connect call could be ignored and hide a failed sign-in. +- **`createGuest` lives in `GeneralRepository`**, next to `enrichUrl`. Its mappers are in + `lib/src/repository/mapper/user_mapper.dart`, with the `User` mappers they use. +- **The envelope is the internal `CreateGuestUserResponse`:** a freezed envelope that only + `createGuest` returns. It replaces v10's public `ConnectGuestUserResponse`, whose only public reach was + `StreamChatApi.guest`, removed together with `GuestApi`. +- **The request carries every field the backend honours for a client-side guest:** id, name, image, + custom data, language, `invisible` and, for an `OwnUser`, privacy settings. `role`, `teams` and + `teams_role` are ignored for client-side calls and are not sent. +- **The rest of the user is no longer sent.** v10 sent the whole flattened user, and v1 filed every key + the request does not declare (`online`, `banned`, devices, unread counts, push preferences and so on) + into the guest's custom data, where some were echoed back: `pushPreferences` on the returned + `OwnUser` and in `queryUsers`' `extraData`, the unread counts when the socket is off, and `ban_expires` + in the raw `me`. None was ever applied. Verified live against the demo app and in the backend source; + recorded as a 🐞 Fixed entry. +- **`UserResponse.toModel()` leaves custom keys named like `OwnUser` fields (`OwnUser.topLevelFields`), + plus `deleted_at`, `deactivated_at` and `revoke_tokens_issued_before`, out of `extraData`.** v1's flat + user JSON shadowed them; v2 nests custom data, and without the guard a custom `online` string crashed + `OwnUser.fromUser`. `User.toRequest()` leaves the same keys out of the custom data it sends. +- **The three extra names are guarded because the socket connect refuses them.** A custom + `deleted_at`, `deactivated_at` or `revoke_tokens_issued_before` left in `extraData` is re-sent in the + connect's user details, and the backend answers 400 ("reserved field", or "expected date" for a + non-date value). v10's flat response shadowed them, so the same guest connected; confirmed live. +- **Not a regression: a custom `ban_expires` that isn't a date** fails the connect in v10 and now alike, + because the socket's `me` lets it through into `OwnUser.fromJson`. +- **`User` is not restructured here.** `user_mapper.dart` maps the generated types onto today's `User`, + following [01-foundation](01-foundation.md). ## Risks @@ -80,17 +109,17 @@ ## Definition of done -- [ ] Every method above either routes through `DefaultApi` or is listed here as deliberately left +- [x] Every method above either routes through `DefaultApi` or is listed here as deliberately left hand-written, with the reason. -- [ ] Public methods return `Future>`; no `getOrThrow()` inside the SDK. -- [ ] Hand-written request/response DTOs for this group are deleted, or their retention is justified. -- [ ] `melos run analyze` clean, `melos run test:dart` green, persistence tests green if this group +- [x] Public methods return `Future>`; no `getOrThrow()` inside the SDK. +- [x] Hand-written request/response DTOs for this group are deleted, or their retention is justified. +- [x] `melos run analyze` clean, `melos run test:dart` green, persistence tests green if this group persists anything. -- [ ] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. -- [ ] CHANGELOG entry under `🛑️ Breaking` for each break; PR title `refactor(llc)!:`. -- [ ] Decisions recorded in this file, and the status box ticked in `README.md`. -- [ ] Public dartdoc follows [`STYLE_GUIDE.md` § Documentation](../STYLE_GUIDE.md#documentation) +- [x] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. +- [x] CHANGELOG entry under `🛑️ Breaking` for each break; PR title `refactor(llc)!:`. +- [x] Decisions recorded in this file, and the status box ticked in `README.md`. +- [x] Public dartdoc follows [`STYLE_GUIDE.md` § Documentation](../STYLE_GUIDE.md#documentation) and [`EFFECTIVE_DART_DOC.md`](../EFFECTIVE_DART_DOC.md), including on symbols this group retyped but whose docs it left alone. -- [ ] Tests follow [`TESTING.md`](../TESTING.md): no `group` organizing a file by method, each +- [x] Tests follow [`TESTING.md`](../TESTING.md): no `group` organizing a file by method, each name states its subject and behaviour. diff --git a/openapi-migration/09-users.md b/openapi-migration/09-users.md index ed4e8f4999..3df0231010 100644 --- a/openapi-migration/09-users.md +++ b/openapi-migration/09-users.md @@ -39,8 +39,12 @@ ## Decisions to make -- `User` and `OwnUser` are public, persisted, and embedded in nearly every other response. The decision is made in 01-foundation and frozen there; this group executes it. +- `User` and `OwnUser` are public, persisted, and embedded in nearly every other response. This group restructures them, last: the mappers in `user_mapper.dart` already map the generated types onto the current class for every group before it, and stay. See [01-foundation](01-foundation.md). - `PrivacySettings` and the push-preference sub-shapes — decide per type. +- `UserResponse.toModel()` leaves `OwnUser.topLevelFields`, `deleted_at`, `deactivated_at` and `revoke_tokens_issued_before` out of every user's `extraData` (`_shadowedCustomKeys`), where v1 kept the `OwnUser`-only keys in a plain user's `extraData`. Revisit once the mapper serves plain users. +- `UserFilterField.shadowBanned` and `.bypassModeration` read `extraData`, which the generated `UserResponse` has no field to fill. +- `updateUsers` reuses `User.toRequest()`. It is a full upsert, and v10's flattened body filed the user's client state (`online`, `banned`, `created_at` and similar) into the stored custom data on every call, as it did for guests in [04](04-roles-guest-and-app.md). Decide the same way here, for real users rather than fresh guests, and record it in the CHANGELOG. +- The generated `UserRequest` sends explicit `null` for an unset `language` or `invisible`, where v10 left the key out. For a guest create that made no difference; for an upsert of an existing user, confirm live that a `null` does not reset a stored value differently from an omitted key. ## Risks @@ -66,3 +70,5 @@ name states its subject and behaviour. - [ ] Temporary adapters owned by this group (`DeviceV1JsonConverter`) are deleted and removed from the table in `README.md`. +- [ ] `user_mapper.dart` maps onto the restructured `User`, and its `TODO(openapi-migration)` note is + gone. diff --git a/openapi-migration/README.md b/openapi-migration/README.md index 1fac60ee10..25bf7b8325 100644 --- a/openapi-migration/README.md +++ b/openapi-migration/README.md @@ -15,7 +15,7 @@ generated operations in scope, the decisions that group has to make, its risks, | [01](01-foundation.md) | Foundation — `DefaultApi` wiring, `User` shape | — | — | ☐ | | [02](02-devices.md) | Devices | 0 | 3 | ☑ | | [03](03-user-groups.md) | User Groups | 0 | 8 | ☑ | -| [04](04-roles-guest-and-app.md) | Roles, Guest & App Settings | 1 | 5 | ☐ | +| [04](04-roles-guest-and-app.md) | Roles, Guest & App Settings | 0 | 5 | ☑ | | [05](05-polls.md) | Polls | 13 | 13 | ☐ | | [06](06-reminders.md) | Message Reminders | 4 | 4 | ☐ | | [07](07-threads-and-drafts.md) | Threads & Drafts | 7 | 7 | ☐ | @@ -143,10 +143,10 @@ includes a named response that carries only `duration` today, such as `HideChann | `DeviceV1JsonConverter` | `OwnUser.devices` | [09](09-users.md) | | `userGroupsFromV1Json` | `Message.mentionedGroups` | [10](10-messages.md) | | `DataSerializable` | `UserGroup`, `UserGroupMember` (`fromData`, `toData`) | [10](10-messages.md) | +| `user_mapper.dart` (kept, re-pointed) | today's `User`, which still reads and writes JSON | [09](09-users.md) | -Before group 09 starts, decide how v1 events decode a parent once it becomes a plain model: through the -generated types plus a shim that rebuilds `custom` from the flattened v1 keys, or through a private v1 decoder in -the WebSocket layer. Record the answer in [01-foundation](01-foundation.md). +How v1 JSON decodes `User` once it becomes a plain model is decided in [01-foundation](01-foundation.md): until +group 09 restructures it, v1 payloads keep decoding through `User.fromJson`. ## Order, and why @@ -161,12 +161,12 @@ surfaces before it reaches `Message` and `ChannelState`: - **05–07** introduce persisted models and WebSocket-delivered updates, one at a time. - **08** is where we decide what *not* to expose: 34 generated operations against 10 hand-written methods. - **14** is `queryBannedUsers`, split out of 08 because it is the only moderation call that answers with a - model. It waits on 09, so it sorts after the groups that decide the shapes it embeds. -- **09** freezes the `User` mapping that everything else already depends on (the *decision* is made in 01; this - group executes it). + model. The `User` mappers it needs landed with group 04. - **10–11** are the core of the SDK, and carry the `custom` / `extraData` promotion problem. - **12** comes late because it needs its own hand-written multipart client and is the highest-traffic path in the SDK. +- **09** is last. Every group before it maps users through `user_mapper.dart` onto today's `User`; 09 migrates the + user endpoints and restructures `User` and `OwnUser` themselves, when every parent that embeds them has moved. ## Prerequisites diff --git a/openapi-migration/tool/generate_plan.py b/openapi-migration/tool/generate_plan.py index df779e0ea2..151e2843f3 100644 --- a/openapi-migration/tool/generate_plan.py +++ b/openapi-migration/tool/generate_plan.py @@ -217,7 +217,7 @@ def match(path): ), dict( num='04', slug='roles-guest-and-app', title='Roles, Guest & App Settings', - hand=['guest_api.dart'], + hand=[], match=owns('/api/v2/roles', '/api/v2/guest', '/api/v2/app', '/api/v2/og', '/api/v2/longpoll'), goal='Sweep up the singletons — one-method families that share no state and can land in one PR.', decisions=[], @@ -268,7 +268,38 @@ def match(path): - **An unset size limit stays `0`.** The server reports one as `size_limit: 0`, and `UploadConfig.sizeLimit` passes it through as v10 did; `StreamAttachmentValidator` applies `UploadConfig.defaultSizeLimit` in that case. No `effectiveSizeLimit` getter was added. + - **`connectGuestUser` keeps its v10 signature and keeps throwing.** It returns `Future` and + throws a `StreamException`, like `connectUser`, `connectUserWithProvider` and `connectAnonymousUser`. + It unwraps `GeneralRepository.createGuest`'s `Result` with `getOrElse`, the one sanctioned unwrap + inside the SDK: a `Result` on a connect call could be ignored and hide a failed sign-in. + - **`createGuest` lives in `GeneralRepository`**, next to `enrichUrl`. Its mappers are in + `lib/src/repository/mapper/user_mapper.dart`, with the `User` mappers they use. + - **The envelope is the internal `CreateGuestUserResponse`:** a freezed envelope that only + `createGuest` returns. It replaces v10's public `ConnectGuestUserResponse`, whose only public reach was + `StreamChatApi.guest`, removed together with `GuestApi`. + - **The request carries every field the backend honours for a client-side guest:** id, name, image, + custom data, language, `invisible` and, for an `OwnUser`, privacy settings. `role`, `teams` and + `teams_role` are ignored for client-side calls and are not sent. + - **The rest of the user is no longer sent.** v10 sent the whole flattened user, and v1 filed every key + the request does not declare (`online`, `banned`, devices, unread counts, push preferences and so on) + into the guest's custom data, where some were echoed back: `pushPreferences` on the returned + `OwnUser` and in `queryUsers`' `extraData`, the unread counts when the socket is off, and `ban_expires` + in the raw `me`. None was ever applied. Verified live against the demo app and in the backend source; + recorded as a 🐞 Fixed entry. + - **`UserResponse.toModel()` leaves custom keys named like `OwnUser` fields (`OwnUser.topLevelFields`), + plus `deleted_at`, `deactivated_at` and `revoke_tokens_issued_before`, out of `extraData`.** v1's flat + user JSON shadowed them; v2 nests custom data, and without the guard a custom `online` string crashed + `OwnUser.fromUser`. `User.toRequest()` leaves the same keys out of the custom data it sends. + - **The three extra names are guarded because the socket connect refuses them.** A custom + `deleted_at`, `deactivated_at` or `revoke_tokens_issued_before` left in `extraData` is re-sent in the + connect's user details, and the backend answers 400 ("reserved field", or "expected date" for a + non-date value). v10's flat response shadowed them, so the same guest connected; confirmed live. + - **Not a regression: a custom `ban_expires` that isn't a date** fails the connect in v10 and now alike, + because the socket's `me` lets it through into `OwnUser.fromJson`. + - **`User` is not restructured here.** `user_mapper.dart` maps the generated types onto today's `User`, + following [01-foundation](01-foundation.md). """), + done=DONE.replace('- [ ]', '- [x]'), risks=[ '`general_api.dart` has no methods left in this group — `sync` and `queryMembers` go to group 11, ' '`searchMessages` to group 10. Do not migrate the file as a unit.', @@ -474,9 +505,22 @@ def match(path): goal='`User` is the most widely referenced public model in the SDK; this is where keep-vs-adopt costs the ' 'most.', decisions=[ - '`User` and `OwnUser` are public, persisted, and embedded in nearly every other response. The ' - 'decision is made in 01-foundation and frozen there; this group executes it.', + '`User` and `OwnUser` are public, persisted, and embedded in nearly every other response. This group ' + 'restructures them, last: the mappers in `user_mapper.dart` already map the generated types onto the ' + 'current class for every group before it, and stay. See [01-foundation](01-foundation.md).', '`PrivacySettings` and the push-preference sub-shapes — decide per type.', + '`UserResponse.toModel()` leaves `OwnUser.topLevelFields`, `deleted_at`, `deactivated_at` and ' + '`revoke_tokens_issued_before` out of every user\'s `extraData` (`_shadowedCustomKeys`), where v1 kept the ' + '`OwnUser`-only keys in a plain user\'s `extraData`. Revisit once the mapper serves plain users.', + '`UserFilterField.shadowBanned` and `.bypassModeration` read `extraData`, which the generated ' + '`UserResponse` has no field to fill.', + '`updateUsers` reuses `User.toRequest()`. It is a full upsert, and v10\'s flattened body filed the ' + 'user\'s client state (`online`, `banned`, `created_at` and similar) into the stored custom data on ' + 'every call, as it did for guests in [04](04-roles-guest-and-app.md). Decide the same way here, for real ' + 'users rather than fresh guests, and record it in the CHANGELOG.', + 'The generated `UserRequest` sends explicit `null` for an unset `language` or `invisible`, where v10 ' + 'left the key out. For a guest create that made no difference; for an upsert of an existing user, ' + 'confirm live that a `null` does not reset a stored value differently from an omitted key.', ], risks=[ 'Every other group depends on the `User` decision.', @@ -489,6 +533,8 @@ def match(path): done=DONE + ( '- [ ] Temporary adapters owned by this group (`DeviceV1JsonConverter`) are deleted and removed from\n' ' the table in `README.md`.\n' + '- [ ] `user_mapper.dart` maps onto the restructured `User`, and its `TODO(openapi-migration)` note is\n' + ' gone.\n' ), ), dict( diff --git a/packages/stream_chat/CHANGELOG.md b/packages/stream_chat/CHANGELOG.md index e3466a167a..09cca1ec02 100644 --- a/packages/stream_chat/CHANGELOG.md +++ b/packages/stream_chat/CHANGELOG.md @@ -77,6 +77,7 @@ - `AppSettingsResponse` is immutable, built through a const constructor, compares by value, gains `copyWith`, and its `duration` is a non-nullable `String`. - `AppSettings` and `UploadConfig` no longer extend `Equatable`, so `props` is removed; they still compare by value and gain `copyWith`. - `StreamChatApi.general.getAppSettings` is removed; call `StreamChatClient.getAppSettings` instead. +- `StreamChatApi.guest` and `ConnectGuestUserResponse` are removed; call `StreamChatClient.connectGuestUser` instead. - `sendImage`, `sendFile`, `uploadImage` and `uploadFile`, on `StreamChatClient`, `Channel` and `AttachmentFileUploader`, return a `Result` instead of throwing; read the URL from `fileUrl` and a video's thumbnail from `thumbUrl`. - `deleteImage`, `deleteFile`, `removeImage` and `removeFile` return a `Result` instead of throwing, and carry no value on success. - `SendAttachmentResponse`, `SendFileResponse`, `SendImageResponse`, `UploadImageResponse` and `UploadFileResponse` are removed in favor of `UploadedFile`. @@ -85,6 +86,8 @@ 🐞 Fixed +- `connectGuestUser` no longer copies the user's online status, ban, unread counts, devices and push preferences into the created guest's `extraData`. + - `queryChannels` no longer gives up watching the channels it loads when it is called before the connection is open. Whether they can be watched is read when the request is sent, which is after the query has waited for the connection. - A message that fails because its attachments did not upload now says which ones and what each reported, instead of `Failed to upload one or more attachments`. diff --git a/packages/stream_chat/lib/src/client/client.dart b/packages/stream_chat/lib/src/client/client.dart index 985bd79848..0880cc66b4 100644 --- a/packages/stream_chat/lib/src/client/client.dart +++ b/packages/stream_chat/lib/src/client/client.dart @@ -14,10 +14,13 @@ import 'package:stream_core/stream_core.dart' InFlightCache, LocationCoordinate, LoggingInterceptor, + PatternMatching, Result, SortedListExtensions, Standard, + StreamClientException, StreamCoreHttpClient, + StreamException, StreamLogConfig, StreamLogger, SystemEnvironment, @@ -445,10 +448,14 @@ class StreamChatClient { ); } - /// Connects the current user as guest, this triggers a connection to the API. - /// It returns a [Future] that resolves when the connection is setup. + /// Signs in a new guest created from [user] and returns it. + /// + /// The guest gets an id of its own and the guest role, so the returned user is not [user]. If [connectWebSocket] + /// is false, the guest is signed in without opening a connection. /// /// Throws a [StateError] if a user is already signed in; call [disconnectUser] first. + /// + /// Throws a [StreamException] if the guest cannot be created or the connection fails. Future connectGuestUser( User user, { bool connectWebSocket = true, @@ -470,7 +477,15 @@ class StreamChatClient { tokenProvider: .static(anonymousToken), ); - final guestUser = await _chatApi.guest.getGuestUser(user); + final result = await _generalRepository.createGuest(user); + + // A failed sign-in throws, like the other connect methods. + final guestUser = result.getOrElse((error, stackTrace) { + final exception = + StreamException.tryFrom(error) ?? + StreamClientException(message: 'Failed to create a guest user', cause: error); + Error.throwWithStackTrace(exception, stackTrace ?? StackTrace.current); + }); // resetting tokenManager after successful request _tokenManager.reset(); diff --git a/packages/stream_chat/lib/src/core/api/guest_api.dart b/packages/stream_chat/lib/src/core/api/guest_api.dart deleted file mode 100644 index 58f3b190c2..0000000000 --- a/packages/stream_chat/lib/src/core/api/guest_api.dart +++ /dev/null @@ -1,20 +0,0 @@ -import '../http/stream_http_client.dart'; -import '../models/user.dart'; -import 'responses.dart'; - -/// Defines the api dedicated to guest users operations -class GuestApi { - /// Initialize a new guest api - GuestApi(this._client); - - final StreamHttpClient _client; - - /// Returns the information about guest user - Future getGuestUser(User user) async { - final response = await _client.post( - '/guest', - data: {'user': user}, - ); - return ConnectGuestUserResponse.fromJson(response.data); - } -} diff --git a/packages/stream_chat/lib/src/core/api/responses.dart b/packages/stream_chat/lib/src/core/api/responses.dart index 4f784f8471..f288c9cf9f 100644 --- a/packages/stream_chat/lib/src/core/api/responses.dart +++ b/packages/stream_chat/lib/src/core/api/responses.dart @@ -173,19 +173,6 @@ class SendReactionResponse extends MessageResponse { static SendReactionResponse fromJson(Map json) => _$SendReactionResponseFromJson(json); } -/// Model response for [StreamChatClient.connectGuestUser] api call -@JsonSerializable(createToJson: false) -class ConnectGuestUserResponse extends _BaseResponse { - /// Guest user access token - late String accessToken; - - /// Guest user - late User user; - - /// Create a new instance from a json - static ConnectGuestUserResponse fromJson(Map json) => _$ConnectGuestUserResponseFromJson(json); -} - /// Model response for [StreamChatClient.updateUser] api call @JsonSerializable(createToJson: false) class UpdateUsersResponse extends _BaseResponse { diff --git a/packages/stream_chat/lib/src/core/api/responses.g.dart b/packages/stream_chat/lib/src/core/api/responses.g.dart index f5997bf67f..f7d5e36ba1 100644 --- a/packages/stream_chat/lib/src/core/api/responses.g.dart +++ b/packages/stream_chat/lib/src/core/api/responses.g.dart @@ -90,13 +90,6 @@ SendReactionResponse _$SendReactionResponseFromJson( ..message = Message.fromJson(json['message'] as Map) ..reaction = Reaction.fromJson(json['reaction'] as Map); -ConnectGuestUserResponse _$ConnectGuestUserResponseFromJson( - Map json, -) => ConnectGuestUserResponse() - ..duration = json['duration'] as String? - ..accessToken = json['access_token'] as String - ..user = User.fromJson(json['user'] as Map); - UpdateUsersResponse _$UpdateUsersResponseFromJson(Map json) => UpdateUsersResponse() ..duration = json['duration'] as String? ..users = diff --git a/packages/stream_chat/lib/src/core/api/stream_chat_api.dart b/packages/stream_chat/lib/src/core/api/stream_chat_api.dart index 51045e1bbe..1631e9c8cb 100644 --- a/packages/stream_chat/lib/src/core/api/stream_chat_api.dart +++ b/packages/stream_chat/lib/src/core/api/stream_chat_api.dart @@ -4,7 +4,6 @@ import 'package:stream_core/stream_core.dart' show ConnectionIdGetter, SystemEnv import '../http/stream_http_client.dart'; import 'channel_api.dart'; import 'general_api.dart'; -import 'guest_api.dart'; import 'message_api.dart'; import 'moderation_api.dart'; import 'polls_api.dart'; @@ -43,10 +42,6 @@ class StreamChatApi { UserApi get user => _user ??= UserApi(_client); UserApi? _user; - /// Api dedicated to guest operations - GuestApi get guest => _guest ??= GuestApi(_client); - GuestApi? _guest; - /// Api dedicated to message operations MessageApi get message => _message ??= MessageApi(_client); MessageApi? _message; diff --git a/packages/stream_chat/lib/src/core/models/response/create_guest_user_response.dart b/packages/stream_chat/lib/src/core/models/response/create_guest_user_response.dart new file mode 100644 index 0000000000..4b17e3f2aa --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/response/create_guest_user_response.dart @@ -0,0 +1,28 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +import '../user.dart'; + +part 'create_guest_user_response.freezed.dart'; + +/// A newly created guest and the token that authenticates it. +@freezed +class CreateGuestUserResponse with _$CreateGuestUserResponse { + /// Creates a new [CreateGuestUserResponse]. + const CreateGuestUserResponse({ + required this.duration, + required this.accessToken, + required this.user, + }); + + /// How long the request took to handle, such as `4.21ms`. + @override + final String duration; + + /// The token that authenticates [user]. + @override + final String accessToken; + + /// The created guest, which has an id of its own rather than the one requested. + @override + final User user; +} diff --git a/packages/stream_chat/lib/src/core/models/response/create_guest_user_response.freezed.dart b/packages/stream_chat/lib/src/core/models/response/create_guest_user_response.freezed.dart new file mode 100644 index 0000000000..ac5c6cbb5f --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/response/create_guest_user_response.freezed.dart @@ -0,0 +1,85 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'create_guest_user_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$CreateGuestUserResponse { + String get duration; + String get accessToken; + User get user; + + /// Create a copy of CreateGuestUserResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $CreateGuestUserResponseCopyWith get copyWith => + _$CreateGuestUserResponseCopyWithImpl(this as CreateGuestUserResponse, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is CreateGuestUserResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.accessToken, accessToken) || other.accessToken == accessToken) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration, accessToken, user); + + @override + String toString() { + return 'CreateGuestUserResponse(duration: $duration, accessToken: $accessToken, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $CreateGuestUserResponseCopyWith<$Res> { + factory $CreateGuestUserResponseCopyWith( + CreateGuestUserResponse value, + $Res Function(CreateGuestUserResponse) _then, + ) = _$CreateGuestUserResponseCopyWithImpl; + @useResult + $Res call({String duration, String accessToken, User user}); +} + +/// @nodoc +class _$CreateGuestUserResponseCopyWithImpl<$Res> implements $CreateGuestUserResponseCopyWith<$Res> { + _$CreateGuestUserResponseCopyWithImpl(this._self, this._then); + + final CreateGuestUserResponse _self; + final $Res Function(CreateGuestUserResponse) _then; + + /// Create a copy of CreateGuestUserResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? accessToken = null, Object? user = null}) { + return _then( + CreateGuestUserResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + accessToken: null == accessToken + ? _self.accessToken + : accessToken // ignore: cast_nullable_to_non_nullable + as String, + user: null == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as User, + ), + ); + } +} diff --git a/packages/stream_chat/lib/src/repository/general_repository.dart b/packages/stream_chat/lib/src/repository/general_repository.dart index 1b5b23ef2e..82ab18eceb 100644 --- a/packages/stream_chat/lib/src/repository/general_repository.dart +++ b/packages/stream_chat/lib/src/repository/general_repository.dart @@ -1,8 +1,11 @@ import 'package:stream_core/stream_core.dart' show PatternMatching, Result; import '../../open_api/api.dart' as api; +import '../core/models/response/create_guest_user_response.dart'; import '../core/models/response/og_attachment_response.dart'; +import '../core/models/user.dart'; import 'mapper/general_mapper.dart'; +import 'mapper/user_mapper.dart'; /// Repository dedicated to operations that belong to no single feature. class GeneralRepository { @@ -20,4 +23,15 @@ class GeneralRepository { return result.map((response) => response.toModel(requestedUrl: url)); } + + /// Creates a guest from [user] and returns it with the token that authenticates it. + /// + /// The returned guest has an id of its own and the `guest` role, rather than those of [user]. + Future> createGuest(User user) async { + final result = await _api.createGuest( + createGuestRequest: api.CreateGuestRequest(user: user.toRequest()), + ); + + return result.map((response) => response.toModel()); + } } diff --git a/packages/stream_chat/lib/src/repository/mapper/user_mapper.dart b/packages/stream_chat/lib/src/repository/mapper/user_mapper.dart new file mode 100644 index 0000000000..5a480ebb34 --- /dev/null +++ b/packages/stream_chat/lib/src/repository/mapper/user_mapper.dart @@ -0,0 +1,93 @@ +import '../../../open_api/api.dart' as api; +import '../../core/models/own_user.dart'; +import '../../core/models/privacy_settings.dart'; +import '../../core/models/response/create_guest_user_response.dart'; +import '../../core/models/user.dart'; +import '../../core/util/extension.dart'; + +// TODO(openapi-migration): re-point these mappers in group 09. + +/// Maps a generated [api.UserResponse] to a [User]. +extension UserResponseMapper on api.UserResponse { + // Custom keys named like one of the user's own fields, including the ones [User] does not model. + static const _shadowedCustomKeys = { + ...OwnUser.topLevelFields, + 'deleted_at', + 'deactivated_at', + 'revoke_tokens_issued_before', + }; + + /// Converts this response into a [User]. + /// + /// Custom data named like one of the user's own fields is left out of [User.extraData]. + User toModel() => User( + id: id, + role: role, + name: name, + image: image, + createdAt: createdAt, + updatedAt: updatedAt, + lastActive: lastActive, + online: online, + banned: banned, + teams: teams, + language: language, + teamsRole: teamsRole, + avgResponseTime: avgResponseTime, + extraData: {...custom}..removeWhere((key, _) => _shadowedCustomKeys.contains(key)), + ); +} + +/// Maps a [User] to the generated [api.UserRequest]. +extension UserRequestMapper on User { + /// Converts this user into an [api.UserRequest]. + /// + /// A user without a name or image converts to a request without one, rather than one named after [id]. The + /// privacy settings of an [OwnUser] are carried over. + /// + /// Custom data named like one of the user's own fields is left out. + api.UserRequest toRequest() => api.UserRequest( + id: id, + name: extraData['name'].safeCast(), + image: extraData['image'].safeCast(), + language: language, + invisible: invisible, + privacySettings: switch (this) { + OwnUser(:final privacySettings?) => privacySettings.toRequest(), + _ => null, + }, + custom: {...extraData} + ..remove('name') + ..remove('image') + ..removeWhere((key, _) => UserResponseMapper._shadowedCustomKeys.contains(key)), + ); +} + +/// Maps [PrivacySettings] to the generated [api.PrivacySettingsResponse]. +extension PrivacySettingsRequestMapper on PrivacySettings { + /// Converts these settings into an [api.PrivacySettingsResponse]. + api.PrivacySettingsResponse toRequest() => api.PrivacySettingsResponse( + typingIndicators: switch (typingIndicators) { + final it? => api.TypingIndicatorsResponse(enabled: it.enabled), + null => null, + }, + readReceipts: switch (readReceipts) { + final it? => api.ReadReceiptsResponse(enabled: it.enabled), + null => null, + }, + deliveryReceipts: switch (deliveryReceipts) { + final it? => api.DeliveryReceiptsResponse(enabled: it.enabled), + null => null, + }, + ); +} + +/// Maps a generated [api.CreateGuestResponse] to a [CreateGuestUserResponse]. +extension CreateGuestResponseMapper on api.CreateGuestResponse { + /// Converts this response into a [CreateGuestUserResponse]. + CreateGuestUserResponse toModel() => CreateGuestUserResponse( + duration: duration, + accessToken: accessToken, + user: user.toModel(), + ); +} diff --git a/packages/stream_chat/test/src/client/client_connect_guest_user_test.dart b/packages/stream_chat/test/src/client/client_connect_guest_user_test.dart new file mode 100644 index 0000000000..c5d5ef6ccd --- /dev/null +++ b/packages/stream_chat/test/src/client/client_connect_guest_user_test.dart @@ -0,0 +1,290 @@ +import 'package:mocktail/mocktail.dart'; +import 'package:stream_chat/open_api/api.dart' as api; +import 'package:stream_chat/stream_chat.dart'; +import 'package:test/test.dart'; + +import '../fakes.dart'; +import '../mocks.dart'; +import '../utils.dart'; +import '../ws/fake_chat_server.dart'; + +const _guestId = 'guest-1b2c3d4e-requested-id'; + +void main() { + test('StreamChatClient.connectGuestUser sends only the fields a guest takes from the user', () async { + final defaultApi = _defaultApiAnswering(Result.success(_createGuestResponse())); + final client = _client(defaultApi); + + await client.connectGuestUser(_fullyPopulatedUser(), connectWebSocket: false); + + final request = verify( + () => defaultApi.createGuest(createGuestRequest: captureAny(named: 'createGuestRequest')), + ).captured.single; + expect( + request, + const api.CreateGuestRequest( + user: api.UserRequest( + id: 'requested-id', + name: 'Requested Name', + image: 'https://example.com/requested.png', + language: 'fr', + invisible: true, + privacySettings: api.PrivacySettingsResponse( + typingIndicators: api.TypingIndicatorsResponse(enabled: false), + readReceipts: api.ReadReceiptsResponse(enabled: true), + deliveryReceipts: api.DeliveryReceiptsResponse(enabled: false), + ), + custom: {'favorite_color': 'blue'}, + ), + ), + ); + }); + + test('StreamChatClient.connectGuestUser returns the created guest', () async { + final client = _client(_defaultApiAnswering(Result.success(_createGuestResponse()))); + + final guest = await client.connectGuestUser(_fullyPopulatedUser(), connectWebSocket: false); + + expect(guest, OwnUser.fromUser(_createdGuest())); + // `User` equality leaves these two out. + expect(guest.createdAt, DateTime.utc(2026, 9, 1)); + expect(guest.updatedAt, DateTime.utc(2026, 9, 2)); + }); + + test( + "StreamChatClient.connectGuestUser sends no custom data named like one of the user's own fields", + () async { + final defaultApi = _defaultApiAnswering(Result.success(_createGuestResponse())); + final client = _client(defaultApi); + final user = User.fromJson(const { + 'id': 'requested-id', + 'deleted_at': '2026-01-01T00:00:00Z', + 'devices': [], + 'color': 'blue', + }); + + await client.connectGuestUser(user, connectWebSocket: false); + + final request = + verify( + () => defaultApi.createGuest(createGuestRequest: captureAny(named: 'createGuestRequest')), + ).captured.single + as api.CreateGuestRequest; + expect(request.user.custom, {'color': 'blue'}); + }, + ); + + test('StreamChatClient.connectGuestUser sends neither a name nor an image for a user without them', () async { + final defaultApi = _defaultApiAnswering(Result.success(_createGuestResponse())); + final client = _client(defaultApi); + + await client.connectGuestUser(User(id: 'requested-id'), connectWebSocket: false); + + final request = verify( + () => defaultApi.createGuest(createGuestRequest: captureAny(named: 'createGuestRequest')), + ).captured.single; + expect( + request, + const api.CreateGuestRequest( + user: api.UserRequest(id: 'requested-id', custom: {}), + ), + ); + }); + + test( + "StreamChatClient.connectGuestUser keeps custom fields named like the user's own fields out of the created guest", + () async { + final response = _createGuestResponse( + custom: const { + 'favorite_color': 'green', + 'online': 'custom-online', + 'blocked_user_ids': 'custom-blocked-user-ids', + 'privacy_settings': 'custom-privacy-settings', + 'deleted_at': 'custom-deleted-at', + 'deactivated_at': 'custom-deactivated-at', + 'revoke_tokens_issued_before': 'custom-revoke-tokens-issued-before', + }, + ); + final client = _client(_defaultApiAnswering(Result.success(response))); + + final guest = await client.connectGuestUser(_fullyPopulatedUser(), connectWebSocket: false); + + expect(guest.extraData, { + 'favorite_color': 'green', + 'name': 'Created Name', + 'image': 'https://example.com/created.png', + }); + }, + ); + + test('StreamChatClient.connectGuestUser connects the socket as the created guest', () async { + final defaultApi = _defaultApiAnswering(Result.success(_createGuestResponse())); + final client = _client( + defaultApi, + server: FakeChatServer(user: OwnUser(id: _guestId)), + ); + + await client.connectGuestUser(_fullyPopulatedUser()); + + expect(client.connectionStatus, ConnectionStatus.connected); + expect(client.state.currentUser?.id, _guestId); + }); + + test('StreamChatClient.connectGuestUser throws the failure when the guest cannot be created', () async { + final defaultApi = _defaultApiAnswering(Result.failure(apiException(statusCode: 403))); + final client = _client(defaultApi); + + await expectLater( + client.connectGuestUser(_fullyPopulatedUser()), + throwsA(isA().having((it) => it.statusCode, 'statusCode', 403)), + ); + }); + + test( + 'StreamChatClient.connectGuestUser throws a StreamClientException when the guest cannot be created for a reason ' + 'other than a StreamException', + () async { + final client = _client(_defaultApiAnswering(const Result.failure(FormatException('Unexpected response')))); + + await expectLater( + client.connectGuestUser(_fullyPopulatedUser()), + throwsA(isA().having((it) => it.cause, 'cause', isA())), + ); + }, + ); + + test('StreamChatClient.connectGuestUser throws when the connection fails', () async { + final client = _client( + _defaultApiAnswering(Result.success(_createGuestResponse())), + server: FakeChatServer()..handshakeFails = true, + ); + + await expectLater( + client.connectGuestUser(_fullyPopulatedUser()), + throwsA(isA()), + ); + }); + + test('StreamChatClient.connectGuestUser leaves the connection closed when connectWebSocket is false', () async { + final client = _client(_defaultApiAnswering(Result.success(_createGuestResponse()))); + + await client.connectGuestUser(_fullyPopulatedUser(), connectWebSocket: false); + + expect(client.connectionStatus, ConnectionStatus.disconnected); + }); +} + +StreamChatClient _client(api.DefaultApi defaultApi, {FakeChatServer? server}) { + final client = StreamChatClient( + 'test-api-key', + defaultApi: defaultApi, + wsProvider: (server ?? FakeChatServer()).connect, + ); + addTearDown(client.dispose); + return client; +} + +MockDefaultApi _defaultApiAnswering(Result result) { + registerFallbackValue(const api.CreateGuestRequest(user: api.UserRequest(id: 'fallback'))); + + final defaultApi = MockDefaultApi(); + when( + () => defaultApi.createGuest(createGuestRequest: any(named: 'createGuestRequest')), + ).thenAnswer((_) async => result); + // Connecting loads the app settings in the background. + when(defaultApi.getApp).thenAnswer((_) async => Result.success(fakeGetApplicationResponse())); + return defaultApi; +} + +// Carries a value in every field, so the request shows which of them a guest takes. +OwnUser _fullyPopulatedUser() => OwnUser( + id: 'requested-id', + role: 'admin', + name: 'Requested Name', + image: 'https://example.com/requested.png', + createdAt: DateTime.utc(2020, 1, 1), + updatedAt: DateTime.utc(2020, 1, 2), + lastActive: DateTime.utc(2020, 1, 3), + online: true, + banned: true, + banExpires: DateTime.utc(2030), + teams: const ['team-x'], + language: 'fr', + invisible: true, + teamsRole: const {'team-x': 'admin'}, + avgResponseTime: 7, + extraData: const {'favorite_color': 'blue'}, + devices: const [Device(id: 'device-1', pushProvider: PushProvider.firebase)], + mutes: [ + Mute( + user: User(id: 'requested-id'), + target: User(id: 'muted-user'), + createdAt: DateTime.utc(2020), + updatedAt: DateTime.utc(2020), + ), + ], + channelMutes: [ + ChannelMute( + user: User(id: 'requested-id'), + channel: ChannelModel(cid: 'messaging:muted'), + createdAt: DateTime.utc(2020), + updatedAt: DateTime.utc(2020), + ), + ], + totalUnreadCount: 5, + unreadChannels: 2, + unreadThreads: 1, + blockedUserIds: const ['blocked-user'], + pushPreferences: const PushPreference(chatLevel: ChatLevel.allMentions), + privacySettings: const PrivacySettings( + typingIndicators: TypingIndicators(enabled: false), + readReceipts: ReadReceipts(), + deliveryReceipts: DeliveryReceipts(enabled: false), + ), +); + +// Every field the server answers with, including the ones a [User] does not carry. +api.CreateGuestResponse _createGuestResponse({ + Map custom = const {'favorite_color': 'green'}, +}) => api.CreateGuestResponse( + duration: '3.20ms', + accessToken: testUserToken(_guestId).rawValue, + user: api.UserResponse( + id: _guestId, + role: 'guest', + name: 'Created Name', + image: 'https://example.com/created.png', + language: 'de', + online: true, + banned: true, + teams: const ['team-a'], + teamsRole: const {'team-a': 'member'}, + avgResponseTime: 42, + custom: custom, + blockedUserIds: const ['blocked-user'], + createdAt: DateTime.utc(2026, 9, 1), + updatedAt: DateTime.utc(2026, 9, 2), + lastActive: DateTime.utc(2026, 9, 3), + deactivatedAt: DateTime.utc(2026, 9, 4), + deletedAt: DateTime.utc(2026, 9, 5), + revokeTokensIssuedBefore: DateTime.utc(2026, 9, 6), + ), +); + +// The user [_createGuestResponse] carries. +User _createdGuest() => User( + id: _guestId, + role: 'guest', + name: 'Created Name', + image: 'https://example.com/created.png', + language: 'de', + online: true, + banned: true, + teams: const ['team-a'], + teamsRole: const {'team-a': 'member'}, + avgResponseTime: 42, + extraData: const {'favorite_color': 'green'}, + createdAt: DateTime.utc(2026, 9, 1), + updatedAt: DateTime.utc(2026, 9, 2), + lastActive: DateTime.utc(2026, 9, 3), +); diff --git a/packages/stream_chat/test/src/client/client_test.dart b/packages/stream_chat/test/src/client/client_test.dart index 8a8a4f0461..999294606d 100644 --- a/packages/stream_chat/test/src/client/client_test.dart +++ b/packages/stream_chat/test/src/client/client_test.dart @@ -68,59 +68,6 @@ void main() { expect(res, isSameUserAs(user)); }); - group('`.connectGuestUser`', () { - test('should work fine', () async { - final user = User(id: 'test-user-id'); - final token = testUserToken(user.id).rawValue; - - when(() => fakeChatApi.guest.getGuestUser(any(that: isSameUserAs(user)))).thenAnswer( - (_) async => ConnectGuestUserResponse() - ..user = user - ..accessToken = token, - ); - - expectLater( - // skipping first seed status -> ConnectionStatus.disconnected - client.connectionStatusStream.skip(1), - emitsInOrder([ConnectionStatus.connecting, ConnectionStatus.connected]), - ); - - final res = await client.connectGuestUser(user); - expect(res, isNotNull); - expect(res, isSameUserAs(user)); - - verify( - () => fakeChatApi.guest.getGuestUser(any(that: isSameUserAs(user))), - ).called(1); - }); - - test('should throw if `.getGuestUser` fails', () async { - final user = User(id: 'test-user-id'); - - when( - () => fakeChatApi.guest.getGuestUser(any(that: isSameUserAs(user))), - ).thenThrow(apiException(code: StreamErrorCode.inputError, statusCode: 400)); - - expectLater( - client.connectionStatusStream, - emitsInOrder([ - // only emits the seed -> disconnected status - // as the call never reaches `ws.connect` - ConnectionStatus.disconnected, - ]), - ); - - await expectLater( - client.connectGuestUser(user), - throwsA(isA()), - ); - - verify( - () => fakeChatApi.guest.getGuestUser(any(that: isSameUserAs(user))), - ).called(1); - }); - }); - test('`.connectAnonymousUser` should work fine', () async { expectLater( // skipping first seed status -> ConnectionStatus.disconnected @@ -226,25 +173,6 @@ void main() { }, ); - test('`.connectGuestUser` should throw if `ws.connect` fails', () async { - final user = User(id: 'test-user-id'); - final token = testUserToken(user.id).rawValue; - - when(() => fakeChatApi.guest.getGuestUser(any(that: isSameUserAs(user)))).thenAnswer( - (_) async => ConnectGuestUserResponse() - ..user = user - ..accessToken = token, - ); - - await expectLater( - client.connectGuestUser(user), - throwsA(isA()), - ); - verify( - () => fakeChatApi.guest.getGuestUser(any(that: isSameUserAs(user))), - ).called(1); - }); - test( '`.connectAnonymousUser` should throw if `ws.connect` fails', () async { @@ -307,28 +235,6 @@ void main() { }, ); - test('`.connectGuestUser` should succeed without connecting', () async { - final user = User(id: 'test-user-id'); - final token = testUserToken(user.id).rawValue; - - when(() => fakeChatApi.guest.getGuestUser(any(that: isSameUserAs(user)))).thenAnswer( - (_) async => ConnectGuestUserResponse() - ..user = user - ..accessToken = token, - ); - - final res = await client.connectGuestUser( - user, - connectWebSocket: false, - ); - - expect(res, isSameUserAs(user)); - expect(client.connectionStatus, ConnectionStatus.disconnected); - verify( - () => fakeChatApi.guest.getGuestUser(any(that: isSameUserAs(user))), - ).called(1); - }); - test( '`.connectAnonymousUser` should succeed without connecting', () async { @@ -411,36 +317,6 @@ void main() { }, ); - test( - '''`.connectGuestUser` should connect successfully if persistence contains event''', - () async { - final user = User(id: 'test-user-id'); - final token = testUserToken(user.id).rawValue; - - final event = Event( - type: EventType.healthCheck, - connectionId: 'test-connection-id', - me: OwnUser.fromUser(user), - ); - when(persistence.getConnectionInfo).thenAnswer((_) async => event); - - when(() => fakeChatApi.guest.getGuestUser(any(that: isSameUserAs(user)))).thenAnswer( - (_) async => ConnectGuestUserResponse() - ..user = user - ..accessToken = token, - ); - - final res = await client.connectGuestUser(user); - expect(res, isNotNull); - expect(res, isSameUserAs(user)); - - verify(persistence.getConnectionInfo).called(1); - verifyNoMoreInteractions(persistence); - verify(() => fakeChatApi.guest.getGuestUser(any(that: isSameUserAs(user)))).called(1); - verifyNoMoreInteractions(fakeChatApi.guest); - }, - ); - test( '''`.connectAnonymousUser` should connect successfully if persistence contains event''', () async { @@ -6786,30 +6662,48 @@ void main() { // A client with [user] signed in, whose guest exchange for [requested] answers the way a real // one does: with an id of the guest's own. - Future<(StreamChatClient, FakeChatApi)> signedInClient({required User requested}) async { - final chatApi = FakeChatApi(); + Future<(StreamChatClient, MockDefaultApi)> signedInClient({required User requested}) async { + registerFallbackValue(const api.CreateGuestRequest(user: api.UserRequest(id: 'fallback'))); + + final defaultApi = MockDefaultApi(); + when(defaultApi.getApp).thenAnswer((_) async => Result.success(fakeGetApplicationResponse())); final client = StreamChatClient( apiKey, - defaultApi: FakeDefaultApi(), - chatApi: chatApi, + defaultApi: defaultApi, + chatApi: FakeChatApi(), wsProvider: FakeChatServer(user: OwnUser.fromUser(user)).connect, ); addTearDown(client.dispose); await client.connectUser(user, token); - final guest = User(id: 'guest-1234-${requested.id}'); - when(() => chatApi.guest.getGuestUser(requested)).thenAnswer( - (_) async => ConnectGuestUserResponse() - ..user = guest - ..accessToken = testUserToken(guest.id).rawValue, + final guestId = 'guest-1234-${requested.id}'; + when(() => defaultApi.createGuest(createGuestRequest: any(named: 'createGuestRequest'))).thenAnswer( + (_) async => Result.success( + api.CreateGuestResponse( + duration: '3.20ms', + accessToken: testUserToken(guestId).rawValue, + user: api.UserResponse( + id: guestId, + role: 'guest', + language: 'en', + online: false, + banned: false, + teams: const [], + custom: const {}, + blockedUserIds: const [], + createdAt: DateTime.utc(2026), + updatedAt: DateTime.utc(2026), + ), + ), + ), ); - return (client, chatApi); + return (client, defaultApi); } test('should refuse a connectGuestUser without asking for a guest', () async { final requested = User(id: 'someone-else'); - final (client, chatApi) = await signedInClient(requested: requested); + final (client, defaultApi) = await signedInClient(requested: requested); await expectLater( client.connectGuestUser(requested, connectWebSocket: false), @@ -6821,19 +6715,19 @@ void main() { ), ), ); - verifyNever(() => chatApi.guest.getGuestUser(requested)); + verifyNever(() => defaultApi.createGuest(createGuestRequest: any(named: 'createGuestRequest'))); }); test('should refuse a connectGuestUser under the id of the user signed in', () async { // The guest would still be another user, so this is refused like any other. final requested = User(id: user.id); - final (client, chatApi) = await signedInClient(requested: requested); + final (client, defaultApi) = await signedInClient(requested: requested); await expectLater( client.connectGuestUser(requested, connectWebSocket: false), throwsA(isA().having((it) => it.message, 'message', contains('${user.id} is signed in'))), ); - verifyNever(() => chatApi.guest.getGuestUser(requested)); + verifyNever(() => defaultApi.createGuest(createGuestRequest: any(named: 'createGuestRequest'))); }); test('should leave the signed-in user authenticated after refusing a connectGuestUser', () async { diff --git a/packages/stream_chat/test/src/core/api/guest_api_test.dart b/packages/stream_chat/test/src/core/api/guest_api_test.dart deleted file mode 100644 index 40f83e7bee..0000000000 --- a/packages/stream_chat/test/src/core/api/guest_api_test.dart +++ /dev/null @@ -1,53 +0,0 @@ -import 'package:dio/dio.dart'; -import 'package:mocktail/mocktail.dart'; -import 'package:stream_chat/src/core/api/guest_api.dart'; -import 'package:stream_chat/stream_chat.dart'; -import 'package:test/test.dart'; - -import '../../mocks.dart'; - -void main() { - Response successResponse(String path, {Object? data}) => Response( - data: data, - requestOptions: RequestOptions(path: path), - statusCode: 200, - ); - - late final client = MockHttpClient(); - late GuestApi guestApi; - - setUp(() { - guestApi = GuestApi(client); - }); - - test('getGuestUser', () async { - const accessToken = 'test-guest-token'; - final user = User(id: 'test-user-id'); - - const path = '/guest'; - - when( - () => client.post( - path, - data: {'user': user}, - ), - ).thenAnswer( - (_) async => successResponse( - path, - data: { - 'access_token': accessToken, - 'user': user.toJson(), - }, - ), - ); - - final res = await guestApi.getGuestUser(user); - - expect(res, isNotNull); - expect(res.accessToken, accessToken); - expect(res.user.id, user.id); - - verify(() => client.post(path, data: any(named: 'data'))).called(1); - verifyNoMoreInteractions(client); - }); -} diff --git a/packages/stream_chat/test/src/core/api/responses_test.dart b/packages/stream_chat/test/src/core/api/responses_test.dart index a57b43510c..db68051eeb 100644 --- a/packages/stream_chat/test/src/core/api/responses_test.dart +++ b/packages/stream_chat/test/src/core/api/responses_test.dart @@ -3487,14 +3487,6 @@ void main() { expect(response.users, isA>()); }); - test('ConnectGuestUserResponse', () { - const jsonExample = - '''{"user":{"id":"guest-ac612aee-25fe-49fb-b1af-969e41f452a0-wild-breeze-7","role":"guest","created_at":"2020-02-03T10:19:01.538434Z","updated_at":"2020-02-03T10:19:01.539543Z","banned":false,"online":false},"access_token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiZ3Vlc3QtYWM2MTJhZWUtMjVmZS00OWZiLWIxYWYtOTY5ZTQxZjQ1MmEwLXdpbGQtYnJlZXplLTcifQ.mmoFGu7oJjpFsp7nFN78UbIpO7gowbuIbyoppsuvbXA","duration":"4.66ms"}'''; - final response = ConnectGuestUserResponse.fromJson(json.decode(jsonExample)); - expect(response.user, isA()); - expect(response.accessToken, isA()); - }); - test('GetMessagesByIdResponse', () { const jsonExample = r''' {"messages":[{ diff --git a/packages/stream_chat/test/src/core/api/stream_chat_api_test.dart b/packages/stream_chat/test/src/core/api/stream_chat_api_test.dart index 27c6296235..23ef98e53b 100644 --- a/packages/stream_chat/test/src/core/api/stream_chat_api_test.dart +++ b/packages/stream_chat/test/src/core/api/stream_chat_api_test.dart @@ -19,10 +19,6 @@ void main() { expect(streamChatApi.user, isNotNull); }); - test('`.guest`', () { - expect(streamChatApi.guest, isNotNull); - }); - test('`.message`', () { expect(streamChatApi.message, isNotNull); }); diff --git a/packages/stream_chat/test/src/fakes.dart b/packages/stream_chat/test/src/fakes.dart index 85a2c2ce9a..9021e9a1df 100644 --- a/packages/stream_chat/test/src/fakes.dart +++ b/packages/stream_chat/test/src/fakes.dart @@ -4,7 +4,6 @@ import 'package:mocktail/mocktail.dart'; import 'package:stream_chat/open_api/api.dart' as api; import 'package:stream_chat/src/core/api/channel_api.dart'; import 'package:stream_chat/src/core/api/general_api.dart'; -import 'package:stream_chat/src/core/api/guest_api.dart'; import 'package:stream_chat/src/core/api/message_api.dart'; import 'package:stream_chat/src/core/api/moderation_api.dart'; import 'package:stream_chat/src/core/api/polls_api.dart'; @@ -130,11 +129,6 @@ class FakeChatApi extends Fake implements StreamChatApi { @override UserApi get user => _user ??= MockUserApi(); - GuestApi? _guest; - - @override - GuestApi get guest => _guest ??= MockGuestApi(); - MessageApi? _message; @override diff --git a/packages/stream_chat/test/src/mocks.dart b/packages/stream_chat/test/src/mocks.dart index f222d2608e..004e7d7d64 100644 --- a/packages/stream_chat/test/src/mocks.dart +++ b/packages/stream_chat/test/src/mocks.dart @@ -8,7 +8,6 @@ import 'package:stream_chat/src/client/moderation_client.dart'; import 'package:stream_chat/src/core/api/attachment_file_uploader.dart'; import 'package:stream_chat/src/core/api/channel_api.dart'; import 'package:stream_chat/src/core/api/general_api.dart'; -import 'package:stream_chat/src/core/api/guest_api.dart'; import 'package:stream_chat/src/core/api/message_api.dart'; import 'package:stream_chat/src/core/api/moderation_api.dart'; import 'package:stream_chat/src/core/api/polls_api.dart'; @@ -45,8 +44,6 @@ class MockTokenManager extends Mock implements TokenManager {} class MockUserApi extends Mock implements UserApi {} -class MockGuestApi extends Mock implements GuestApi {} - class MockMessageApi extends Mock implements MessageApi {} class MockPollsApi extends Mock implements PollsApi {} From 8f4784e3dc31a32e51d1b511908e387d201fc796 Mon Sep 17 00:00:00 2001 From: Petar Velikov Date: Thu, 15 Oct 2026 12:17:44 +0200 Subject: [PATCH 35/36] refactor(llc)!: route polls through the generated client (#3037) * refactor(llc)!: route connectGuestUser through the generated client Co-Authored-By: Claude Opus 5.5 * refactor(llc)!: route polls through the generated client Co-Authored-By: Claude Opus 5.5 * refactor(llc): address review findings on the polls migration Co-Authored-By: Claude Opus 5.5 * refactor(llc): let the API reject poll updates with option ids missing Co-Authored-By: Claude Opus 5.5 * refactor(llc): keep the v10 copyWith on Poll, PollOption and PollVote Co-Authored-By: Claude Opus 5.5 * docs(repo): correct the poll getters row in the v11 migration guide Co-Authored-By: Claude Opus 5.5 * docs(repo): keep v10 copyWith semantics in the openapi-migration rules Co-Authored-By: Claude Opus 5.5 * refactor(llc): share the sort mapper and keep poll client tests in client_test Co-Authored-By: Claude Opus 5.5 * refactor(llc): apply review remarks on connectGuestUser and the user mappers Co-Authored-By: Claude Opus 5.5 * refactor(llc): rename the internal guest envelope to CreateGuestUserResponse Co-Authored-By: Claude Opus 5.5 * refactor(llc): leave custom data named like a poll field out of the poll requests Co-Authored-By: Claude Opus 5.5 * refactor(llc): tighten the poll docs, changelogs and tests Co-Authored-By: Claude Opus 5.5 * refactor(llc): switch the poll models to freezed's copyWith Co-Authored-By: Claude Fable 5.1 * refactor(llc): apply the polls review fixes and bump the cache schema Co-Authored-By: Claude Fable 5.1 * style(llc): format the poll vote test Co-Authored-By: Claude Fable 5.1 * refactor(llc)!: make poll custom data the wire's custom and rename it Co-Authored-By: Claude Fable 5.1 * refactor(llc): apply the polls review suggestions Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: Claude Opus 5.5 --- .claude/skills/openapi-migration/SKILL.md | 38 +- .../openapi-migration/copywith-audit.md | 88 +++ .../scripts/copywith_audit.py | 386 +++++++++++ CLAUDE.md | 3 +- STYLE_GUIDE.md | 14 +- migrations/v11-migration.md | 124 ++++ openapi-migration/02-devices.md | 2 + openapi-migration/03-user-groups.md | 2 + openapi-migration/04-roles-guest-and-app.md | 2 + openapi-migration/05-polls.md | 104 ++- openapi-migration/06-reminders.md | 2 + openapi-migration/07-threads-and-drafts.md | 3 + .../08-moderation-and-blocklists.md | 2 + openapi-migration/09-users.md | 8 +- openapi-migration/10-messages.md | 2 + openapi-migration/11-channels-and-members.md | 8 +- openapi-migration/12-uploads-cdn.md | 2 + openapi-migration/13-push-preferences.md | 2 + openapi-migration/14-banned-users.md | 2 + openapi-migration/15-custom-data.md | 43 ++ openapi-migration/README.md | 38 +- openapi-migration/tool/generate_plan.py | 155 ++++- packages/stream_chat/CHANGELOG.md | 14 + .../lib/src/client/channel/channel.dart | 105 ++- .../stream_chat/lib/src/client/client.dart | 170 +++-- .../lib/src/core/api/polls_api.dart | 197 ------ .../lib/src/core/api/responses.dart | 111 --- .../lib/src/core/api/responses.g.dart | 233 ++----- .../lib/src/core/api/stream_chat_api.dart | 5 - .../models/converters/v1_json_converters.dart | 176 +++++ .../lib/src/core/models/draft_message.dart | 2 + .../lib/src/core/models/draft_message.g.dart | 5 +- .../lib/src/core/models/message.dart | 1 + .../lib/src/core/models/message.g.dart | 13 +- .../stream_chat/lib/src/core/models/poll.dart | 277 +++----- .../lib/src/core/models/poll.freezed.dart | 308 +++++++++ .../lib/src/core/models/poll.g.dart | 76 --- .../lib/src/core/models/poll_option.dart | 82 +-- .../src/core/models/poll_option.freezed.dart | 106 +++ .../lib/src/core/models/poll_option.g.dart | 5 +- .../lib/src/core/models/poll_vote.dart | 114 ++-- .../src/core/models/poll_vote.freezed.dart | 151 ++++ .../lib/src/core/models/poll_vote.g.dart | 27 - .../models/response/poll_option_response.dart | 23 + .../poll_option_response.freezed.dart | 77 +++ .../core/models/response/poll_response.dart | 23 + .../response/poll_response.freezed.dart | 76 +++ .../models/response/poll_vote_response.dart | 23 + .../response/poll_vote_response.freezed.dart | 77 +++ .../response/query_poll_votes_response.dart | 33 + .../query_poll_votes_response.freezed.dart | 89 +++ .../models/response/query_polls_response.dart | 33 + .../query_polls_response.freezed.dart | 89 +++ .../src/core/models/voting_visibility.dart | 12 + .../src/repository/mapper/filter_mapper.dart | 7 + .../src/repository/mapper/polls_mapper.dart | 174 +++++ .../src/repository/mapper/sort_mapper.dart | 14 + .../lib/src/repository/polls_repository.dart | 191 ++++++ .../stream_chat/lib/src/ws/events/event.dart | 3 + .../lib/src/ws/events/event.g.dart | 28 +- packages/stream_chat/lib/stream_chat.dart | 6 + packages/stream_chat/test/fixtures/poll.json | 44 -- .../client/channel/channel_polls_test.dart | 334 +++++++++ .../test/src/client/client_polls_test.dart | 642 ++++++++++++++++++ .../test/src/client/client_test.dart | 334 --------- .../test/src/client/poll_fixtures.dart | 163 +++++ .../test/src/core/api/polls_api_test.dart | 495 -------------- .../src/core/api/stream_chat_api_test.dart | 4 - .../models/converters/poll_v1_json_test.dart | 316 +++++++++ .../src/core/models/poll_option_test.dart | 45 ++ .../test/src/core/models/poll_test.dart | 315 ++++----- .../test/src/core/models/poll_vote_test.dart | 75 +- packages/stream_chat/test/src/fakes.dart | 6 - packages/stream_chat/test/src/mocks.dart | 3 - .../channel/stream_message_preview_text.dart | 6 +- ...message_content_poll_translation_test.dart | 32 +- .../stream_chat_flutter_core/CHANGELOG.md | 1 + .../lib/src/stream_poll_controller.dart | 13 +- .../src/stream_poll_vote_list_controller.dart | 86 ++- .../test/stream_poll_controller_test.dart | 4 +- ...stream_poll_vote_list_controller_test.dart | 171 +++++ packages/stream_chat_persistence/CHANGELOG.md | 1 + .../voting_visibility_converter.dart | 22 +- .../lib/src/db/drift_chat_database.dart | 2 +- .../lib/src/db/drift_chat_database.g.dart | 99 ++- .../lib/src/entity/polls.dart | 4 +- .../lib/src/mapper/poll_mapper.dart | 13 +- .../voting_visibility_converter_test.dart | 7 +- .../test/src/dao/poll_dao_test.dart | 2 +- .../test/src/dao/poll_vote_dao_test.dart | 2 +- .../test/src/mapper/poll_mapper_test.dart | 40 +- 91 files changed, 5060 insertions(+), 2407 deletions(-) create mode 100644 .claude/skills/openapi-migration/copywith-audit.md create mode 100755 .claude/skills/openapi-migration/scripts/copywith_audit.py create mode 100644 openapi-migration/15-custom-data.md delete mode 100644 packages/stream_chat/lib/src/core/api/polls_api.dart create mode 100644 packages/stream_chat/lib/src/core/models/poll.freezed.dart delete mode 100644 packages/stream_chat/lib/src/core/models/poll.g.dart create mode 100644 packages/stream_chat/lib/src/core/models/poll_option.freezed.dart create mode 100644 packages/stream_chat/lib/src/core/models/poll_vote.freezed.dart delete mode 100644 packages/stream_chat/lib/src/core/models/poll_vote.g.dart create mode 100644 packages/stream_chat/lib/src/core/models/response/poll_option_response.dart create mode 100644 packages/stream_chat/lib/src/core/models/response/poll_option_response.freezed.dart create mode 100644 packages/stream_chat/lib/src/core/models/response/poll_response.dart create mode 100644 packages/stream_chat/lib/src/core/models/response/poll_response.freezed.dart create mode 100644 packages/stream_chat/lib/src/core/models/response/poll_vote_response.dart create mode 100644 packages/stream_chat/lib/src/core/models/response/poll_vote_response.freezed.dart create mode 100644 packages/stream_chat/lib/src/core/models/response/query_poll_votes_response.dart create mode 100644 packages/stream_chat/lib/src/core/models/response/query_poll_votes_response.freezed.dart create mode 100644 packages/stream_chat/lib/src/core/models/response/query_polls_response.dart create mode 100644 packages/stream_chat/lib/src/core/models/response/query_polls_response.freezed.dart create mode 100644 packages/stream_chat/lib/src/core/models/voting_visibility.dart create mode 100644 packages/stream_chat/lib/src/repository/mapper/filter_mapper.dart create mode 100644 packages/stream_chat/lib/src/repository/mapper/polls_mapper.dart create mode 100644 packages/stream_chat/lib/src/repository/mapper/sort_mapper.dart create mode 100644 packages/stream_chat/lib/src/repository/polls_repository.dart delete mode 100644 packages/stream_chat/test/fixtures/poll.json create mode 100644 packages/stream_chat/test/src/client/channel/channel_polls_test.dart create mode 100644 packages/stream_chat/test/src/client/client_polls_test.dart create mode 100644 packages/stream_chat/test/src/client/poll_fixtures.dart delete mode 100644 packages/stream_chat/test/src/core/api/polls_api_test.dart create mode 100644 packages/stream_chat/test/src/core/models/converters/poll_v1_json_test.dart create mode 100644 packages/stream_chat/test/src/core/models/poll_option_test.dart create mode 100644 packages/stream_chat_flutter_core/test/stream_poll_vote_list_controller_test.dart diff --git a/.claude/skills/openapi-migration/SKILL.md b/.claude/skills/openapi-migration/SKILL.md index df25e3d946..4447b9e876 100644 --- a/.claude/skills/openapi-migration/SKILL.md +++ b/.claude/skills/openapi-migration/SKILL.md @@ -205,6 +205,8 @@ a public signature. [Persisted models](#persisted-models-the-dataserializable-codec)). A model stored only as a table row, mapped column by column like `Poll` in `polls`, needs no codec. - **Which request enums need a hand-written public type** (rule 6). +- **Whether v10 has a `copyWith`.** If it has one, run `scripts/copywith_audit.py ` before deleting it; + [Replacing a v10 `copyWith`](#replacing-a-v10-copywith) says what to do with the report. **Per method, decide what it returns:** @@ -339,9 +341,13 @@ incrementally, not for us. Three data-shape traps while mapping: -- **`custom` vs `extraData`** (channel / message / user features). The wire puts extra fields in `custom`; - hand-written models flatten them into `extraData`. Write that promotion explicitly, including which keys are - excluded. +- **The model's `custom` is the wire's `custom`, verbatim** (README rule 9). A migrated model names it `custom` + — `extraData` on one whose group has not run — and the mapper copies the generated map into it and sends it + back as `custom`; never filter either. A typed wire field our model lacks is added as a field, with + approval, or left out — never parked in `extraData` behind a getter, as `ChannelModel.hidden` and `User.name` + still are until groups 11 and 09 promote them. A v1 decoder splits flat JSON by a key list — `topLevelFields` + while the model still has JSON, a private list beside the converter once it does not — and a v1 writer leaves a + custom entry named like a key out so it cannot overwrite the key. - **Units on anything that takes a `Duration`.** The wire carries a bare integer and the field name rarely says in what. Read the Go payload type: `commonpayloads.DurationInMinutes` and `DurationMilliseconds` sit on sibling endpoints in the same feature — `ban.timeout` and `mute.timeout` are minutes, `muteChannel.expiration` is @@ -457,6 +463,31 @@ List>? _membersToData(List? members) => `.g.dart` and `.freezed.dart` files of the models you changed; `--build-filter` deletes every generated output outside the filter, so never use it. +### Replacing a v10 `copyWith` + +A model moving onto `@freezed` gives up its hand-written `copyWith` for the generated one, and most of the +difference compiles cleanly: `null` clears a nullable field where v10 kept it, `null` re-runs a constructor default +(`id ?? Uuid().v4()`, `createdAt ?? DateTime.now()`), and a constructor parameter with no field of the same name +and type is not generated at all. [`copywith-audit.md`](copywith-audit.md) has the full table and the procedure; +`scripts/copywith_audit.py ` runs it, on a clean tree, and lists every call site in lib and tests whose +behaviour or compilation changes. + +- **Handle every site the report lists** (README rule 2): a compile break gets a local to carry flow analysis, or + a `?? model.field`; a site tagged "v10 kept on null; check" is rewritten as an explicit merge unless the value + is only ever null when the field already is (`Poll.withTranslationsOf`) or the clear is intended; a site tagged + "v10 sentinel, same result" needs nothing. +- **A verdict line means freezed cannot replace this method as it stands.** Keep `@Freezed(copyWith: false)` with + the hand-written method, or reshape the constructor so every parameter is a field of the same name and type, + which is a public API change of its own. `Message` is the known case. +- **Record the semantics change** in the CHANGELOG and the guide, listing the model's fields under the rows of the + audit's table that apply. A model with no v10 `copyWith` gains new API, which is not a break. +- **Mind what freezed counts as data.** For a class with a hand-written constructor, it puts every instance field + in `==`, `hashCode` and `toString`, private fields and `late final` caches included. + - A cache derived only from fields already compared (`Poll.ownVotes`, from `ownVotesAndAnswers`) changes no + result, so it can stay `late final`. + - A field v10 set in the constructor's initializer list from another field (`PollVote.isAnswer`) becomes a + getter. + ### Documenting the public surface Write these as you write the code. `public_member_api_docs` only checks a doc *exists*, so a placeholder survives @@ -488,6 +519,7 @@ Budget for this: on a typical feature it is most of the diff, and none of it is - **Stub each generated response with every field our model carries,** each with a distinct value, and compare the whole returned envelope, so a field the mapper drops or swaps fails an assertion. Give every method a failure test too. +- **Flip the tests that pinned a v10 `copyWith`'s `null` handling** to freezed's behaviour; the audit lists them. - **Test each temporary converter through its parent's `fromJson`/`toJson`.** - **Test each `@DataSerializable` model's stored format:** pin `toData()` to a literal map, so a rename that changes the stored keys fails; round-trip `fromData(toData())`; cover null versus empty for nullable lists. Extend the diff --git a/.claude/skills/openapi-migration/copywith-audit.md b/.claude/skills/openapi-migration/copywith-audit.md new file mode 100644 index 0000000000..bf491219c9 --- /dev/null +++ b/.claude/skills/openapi-migration/copywith-audit.md @@ -0,0 +1,88 @@ +# copyWith audit: moving a model to freezed's copyWith + +A model moving onto `@freezed` gives up its hand-written `copyWith` for the generated one. The two treat `null` +differently, freezed can't generate every parameter a hand-written method takes, and most of the difference +compiles cleanly. Run this audit per model before deleting the old method. It lists every call site, in lib and in +tests, whose behaviour or compilation changes, and tells you when freezed's `copyWith` can't replace the model's +at all. + +## What changes + +| Parameter | v10 hand-written | freezed | How it shows up | +| --- | --- | --- | --- | +| Non-nullable field (`String name`) | `String? name`, null keeps | `String name` | Compile error where a nullable value is passed | +| Nullable field, no sentinel (`String? description`) | null keeps | null clears | Silent: same code, field now wiped | +| Nullable field with `_nullConst` sentinel | null clears | null clears | No change | +| Nullable constructor parameter on a non-nullable field (`String? id` → `id ?? Uuid().v4()`) | null keeps | null runs the constructor default | Silent: a new id or `DateTime.now()` | +| Constructor parameter with no field of the same name (a getter, a private field, a renamed field) | accepted | not generated | Compile error at every call passing it | +| Constructor parameter whose type differs from its field's (`String type` → `MessageType type`) | the field's type | the parameter's type | Compile error where the field's type is passed | + +freezed builds `copyWith` from the class's constructor, and keeps a parameter only when a field (not a getter) has +the same name. That is why the last two rows exist. + +## Run it + +One model per run, named by its class, from anywhere in the repo after `melos bootstrap`: + +```bash +python3 .claude/skills/openapi-migration/scripts/copywith_audit.py Poll +``` + +When two packages declare the class, pass the file: `packages/stream_chat/lib/src/core/models/poll.dart:Poll`. By +default it analyzes every bootstrapped package; `--packages packages/stream_chat packages/stream_chat_flutter …` +narrows it. A run over five packages takes about half a minute. + +The model can be on `@Freezed(copyWith: false)` already, or not on freezed at all. For the second, the probe adds +`@freezed`, `with _$Model`, the `part` and the import for the run only. Either way it deletes the hand-written +`copyWith`, regenerates with the `.fvmrc`-pinned SDK, and analyzes twice: + +1. As generated. Every error is a compile break. +2. With the `?` dropped from the generated `copyWith` interface. Every new error is a call site passing a value + that may be null to a nullable parameter, which is exactly where "keeps" became "clears". + +**What it touches.** Only the model's file and the generated `*.freezed.dart` / `*.g.dart` files of the model's +package, all restored at the end, even on failure. It refuses to start while any of those has uncommitted changes. +Edits anywhere else, including while it runs, are left alone. + +## Read the report + +A verdict line appears when freezed's `copyWith` can't replace the model's as it stands, because parameters are +missing or retyped (`Message` is the example: `createdAt` is a getter over server and local timestamps, +`quotedMessageId` a private field with a fallback, `type` a `String` turned into a `MessageType`). Then either keep +`@Freezed(copyWith: false)` with the hand-written method, or reshape the constructor so every parameter is a field +of the same name and type, which is a public API change of its own. The sections below the verdict still show what +each option would cost. + +Nullable argument sites are tagged: + +* **v10 sentinel, same result**: no action. +* **v10 kept on null; check**: decide whether the value can be null at runtime while the field is set. If it is + only ever null when the field already is (`nameI18n: nameI18n ?? fallback`), the result is unchanged. Otherwise + the site needs `value ?? model.field`, or the clear is the intended new behaviour. + +Compile breaks in lib usually need a local to carry flow analysis (`translatedName(language)` called twice is not +promoted). Tests that pin the old "null keeps" behaviour flip to the new behaviour. + +For a model not yet on freezed, the report covers `copyWith` only. freezed also replaces `==`, `hashCode` and +`toString` (for example, every field counts in `==`, where `Equatable` compared only `props`); check those +separately. + +What a changed site means for apps goes in the changelog and the migration guide: list the model's fields under +the rows of the table that apply. + +## Known limits + +* It finds the hand-written `copyWith` by the shape `Type copyWith({`; a positional or oddly formatted one has to + be removed by hand first. +* A call through `dynamic` or a tear-off isn't type-checked, so it isn't reported. +* A generated file that is untracked and rewritten by the build can't be restored; commit generated files first. + +## Results on the poll models (PR #3037) + +* `Poll`: 1 compile break in lib (`stream_message_preview_text.dart:96`), `withTranslationsOf` unchanged, + sentinel sites unchanged, 1 test to rewrite (`poll_test.dart:40`). Constructor-default trap on `id`, + `createdAt`, `updatedAt`. +* `PollOption`: no lib changes; 1 test no longer compiles (`poll_option_test.dart:43`). +* `PollVote`: no lib changes; 1 test to rewrite (`poll_vote_test.dart:23`). +* Applying the `Poll` switch for real: analyze clean in all packages, and the only failing non-golden test is the + one pinning v10 behaviour. diff --git a/.claude/skills/openapi-migration/scripts/copywith_audit.py b/.claude/skills/openapi-migration/scripts/copywith_audit.py new file mode 100755 index 0000000000..00d03d6077 --- /dev/null +++ b/.claude/skills/openapi-migration/scripts/copywith_audit.py @@ -0,0 +1,386 @@ +#!/usr/bin/env python3 +"""Audit what breaks when one model's hand-written copyWith is replaced by freezed's. + +Usage: python3 .claude/skills/openapi-migration/scripts/copywith_audit.py [--packages ...] + + is a class name (`Poll`) or `path/to/file.dart:Poll`. Run it inside the repo, after `melos bootstrap`. + +The probe edits only the model's file and the generated `*.freezed.dart` / `*.g.dart` files of the model's package, +and restores exactly those at the end, even on failure. It refuses to start while any of them has uncommitted +changes, so nothing of yours is ever overwritten. +""" + +import argparse +import json +import os +import re +import subprocess +import sys +from pathlib import Path + + +def sh(cmd, cwd=None, env=None, check=False): + return subprocess.run(cmd, cwd=cwd or ROOT, env=env, text=True, capture_output=True, check=check) + + +ROOT = Path(subprocess.run(['git', 'rev-parse', '--show-toplevel'], text=True, capture_output=True).stdout.strip() + or Path.cwd()) +GENERATED = ('.freezed.dart', '.g.dart') + + +# --- Files the probe may touch ----------------------------------------------------------------------------------- + + +def managed_status(model: Path, pkg: Path): + """git status of the files the probe may touch: the model file and the package's generated files.""" + rel_pkg = os.path.relpath(pkg, ROOT) + out = sh(['git', 'status', '--porcelain', '--untracked-files=all', '--', f'{rel_pkg}/lib']).stdout + status = {} + for line in out.splitlines(): + path = line[3:].split(' -> ')[-1] + if path == str(model) or path.endswith(GENERATED): + status[path] = line[:2] + return status + + +def restore(model: Path, pkg: Path, untracked_before): + """Puts every managed file back as git has it; removes generated files the probe created.""" + for path, code in managed_status(model, pkg).items(): + if code == '??': + if path not in untracked_before: + (ROOT / path).unlink(missing_ok=True) + else: + sh(['git', 'checkout', '--', path]) + + +# --- Toolchain --------------------------------------------------------------------------------------------------- + + +def pinned_env(): + env = dict(os.environ) + fvmrc = ROOT / '.fvmrc' + if fvmrc.exists(): + pin = json.loads(fvmrc.read_text()).get('flutter') + bin_dir = Path.home() / 'fvm' / 'versions' / str(pin) / 'bin' + if bin_dir.exists(): + env['PATH'] = f'{bin_dir}{os.pathsep}{env["PATH"]}' + return env + + +def package_of(path: Path) -> Path: + for parent in (ROOT / path).resolve().parents: + if (parent / 'pubspec.yaml').exists(): + return parent + sys.exit(f'No pubspec.yaml above {path}') + + +def default_packages(): + out = sh(['git', 'ls-files', '*pubspec.yaml']).stdout.split() + return [ROOT / Path(p).parent for p in out + if (ROOT / Path(p).parent / '.dart_tool' / 'package_config.json').exists()] + + +# --- Locating and rewriting the model ---------------------------------------------------------------------------- + + +def find_model(spec): + if ':' in spec: + path, name = spec.rsplit(':', 1) + return Path(os.path.relpath(Path(path).resolve(), ROOT)), name + hits = [Path(p) for p in sh(['git', 'grep', '-lE', rf'^(abstract |final )*class {spec}( |<|$)', + '--', ':(glob)packages/*/lib/**/*.dart']).stdout.split() + if not p.endswith(GENERATED)] + if len(hits) != 1: + sys.exit(f'Found {len(hits)} files declaring `class {spec}`: {hits}. Pass `path/to/file.dart:{spec}`.') + return hits[0], spec + + +def match_close(src, i, open_ch, close_ch): + """Index just past the bracket that closes the one at src[i].""" + depth, quote = 0, None + while i < len(src): + c = src[i] + if quote: + if c == '\\': + i += 2 + continue + if c == quote: + quote = None + elif c in '\'"': + quote = c + elif c == open_ch: + depth += 1 + elif c == close_ch: + depth -= 1 + if depth == 0: + return i + 1 + i += 1 + raise ValueError('unbalanced brackets') + + +def class_span(src, name): + """(header_start, decl_start, body_start, body_end); the header is the doc comment and annotations.""" + m = re.compile(rf'^(?:abstract |final |sealed |base )*class {re.escape(name)}\b[^{{]*\{{', re.M).search(src) + if not m: + sys.exit(f'`class {name}` not found.') + body_start = m.end() - 1 + body_end = match_close(src, body_start, '{', '}') + lines = src[:m.start()].split('\n')[:-1] + while lines and re.match(r'\s*(///|//|@|\)|\w+:)', lines[-1]): + lines.pop() + header_start = len('\n'.join(lines)) + (1 if lines else 0) + return header_start, m.start(), body_start, body_end + + +def parse_params(params_src): + """{name: (type, has_sentinel)} for a `{...}` parameter list's text.""" + out = {} + for p in re.finditer(r'([\w<>?, ]+?)\s+(\w+)\s*(=\s*_nullConst)?\s*,', params_src + ','): + out[p.group(2)] = (p.group(1).replace('required ', '').strip(), bool(p.group(3))) + return out + + +def remove_copy_with(body): + """Strips the hand-written copyWith from a class body; returns (body, params).""" + m = re.search(r'^([ \t]+)[\w<>?, ]+\s+copyWith\(\{', body, re.M) + if not m: + return body, {} + lines = body[:m.start()].split('\n')[:-1] + while lines and re.match(r'\s*(///|@)', lines[-1]): + lines.pop() + start = len('\n'.join(lines)) + (1 if lines else 0) + + paren = body.index('(', m.start()) + params_end = match_close(body, paren, '(', ')') + params = parse_params(body[paren + 2:params_end - 1]) + rest = body[params_end:] + end = params_end + len(rest) - len(rest.lstrip()) + if body.startswith('=>', end): + while body[end] != ';': + c = body[end] + end = match_close(body, end, c, {'(': ')', '[': ']', '{': '}'}[c]) if c in '([{' else end + 1 + end += 1 + else: + end = match_close(body, end, '{', '}') + if body[end:end + 1] == '\n': + end += 1 + return body[:start] + body[end:], params + + +def put_on_freezed(src, name, header_start, decl_start): + """Makes the class generate freezed's copyWith; returns (src, was_already_freezed).""" + header, decl = src[header_start:decl_start], src[decl_start:] + if re.search(r'@Freezed\([^)]*copyWith:\s*false', header): + def fix(m): + args = re.sub(r'copyWith:\s*false\s*,?\s*', '', m.group(1)).strip().rstrip(',') + return '@freezed' if not args else f'@Freezed({args})' + + header = re.sub(r'@Freezed\(([^)]*copyWith:\s*false[^)]*)\)', fix, header) + return src[:header_start] + header + decl, True + if re.search(r'@(freezed|Freezed)\b', header): + return src, True + + # Not on freezed yet: annotate the class, mix in the generated code, and add the part and import. + header += '@freezed\n' + head_end = decl.index('{') + head = decl[:head_end] + if re.search(r'\bwith\b', head): + head = re.sub(r'\bwith\s+', f'with _${name}, ', head, count=1) + elif ' implements ' in head: + head = head.replace(' implements ', f' with _${name} implements ', 1) + else: + head = head.rstrip() + f' with _${name} ' + src = src[:header_start] + header + head + decl[head_end:] + + part = f"part '{MODEL.stem}.freezed.dart';" + if part not in src: + parts = list(re.finditer(r"^part '.*';\n", src, re.M)) + imports = list(re.finditer(r"^import '.*';\n", src, re.M)) + anchor = parts[-1].end() if parts else imports[-1].end() if imports else 0 + src = src[:anchor] + ('' if parts else '\n') + part + '\n' + src[anchor:] + if 'package:freezed_annotation/freezed_annotation.dart' not in src: + first_import = re.search(r"^import ", src, re.M) + at = first_import.start() if first_import else 0 + src = src[:at] + "import 'package:freezed_annotation/freezed_annotation.dart' show freezed;\n" + src[at:] + return src, False + + +# --- Generated code ---------------------------------------------------------------------------------------------- + + +def interface(freezed_src, name): + """The match of the generated `$Res call({...});` interface of the model's copyWith.""" + head = re.search(rf'class [_$]*{re.escape(name)}CopyWith<\$Res>', freezed_src) + if not head: + return None + return re.compile(r'\$Res call\(\{([^{}]*?)\}\);').search(freezed_src, head.end()) + + +def interface_params(body): + return {m.group(2): m.group(1) for m in re.finditer(r'^\s*(.+?)\s+(\w+),\s*$', body, re.M)} + + +def field_types(body): + return {m.group(2): m.group(1) for m in re.finditer(r'^\s+final\s+([\w<>?, ]+?)\s+(\w+);', body, re.M)} + + +def bare(type_): + return type_.strip().rstrip('?') + + +# --- Analysis ---------------------------------------------------------------------------------------------------- + + +def analyze(packages, env): + errors = {} + for pkg in packages: + out = sh(['dart', 'analyze', '--format=machine', '.'], cwd=pkg, env=env) + for line in (out.stdout + out.stderr).splitlines(): + parts = line.split('|') + if len(parts) >= 8 and parts[0] == 'ERROR': + errors[(os.path.relpath(parts[3], ROOT), int(parts[4]), int(parts[5]))] = (parts[2], parts[7]) + return errors + + +def arg_name(path, line, col, code, msg): + if code == 'UNDEFINED_NAMED_PARAMETER': + m = re.search(r"named parameter '(\w+)'", msg) + if m: + return m.group(1) + text = (ROOT / path).read_text().split('\n')[line - 1] + m = re.search(r'(\w+)\s*:\s*$', text[:col - 1]) + return m.group(1) if m else '?' + + +def source_line(path, line): + return (ROOT / path).read_text().split('\n')[line - 1].strip() + + +# --- Main -------------------------------------------------------------------------------------------------------- + + +def main(): + global MODEL + ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) + ap.add_argument('model', help='class name, or path/to/file.dart:ClassName') + ap.add_argument('--packages', nargs='*', help='package dirs to analyze (default: every bootstrapped package)') + args = ap.parse_args() + os.chdir(ROOT) + + MODEL, name = find_model(args.model) + pkg = package_of(MODEL) + before = managed_status(MODEL, pkg) + dirty = [p for p, code in before.items() if code != '??'] + if dirty: + sys.exit('These files have uncommitted changes and the probe would overwrite them; commit or stash first:\n' + + '\n'.join(f' {p}' for p in dirty)) + untracked_before = set(before) + + env = pinned_env() + packages = [ROOT / p for p in args.packages] if args.packages else default_packages() + freezed = MODEL.with_name(MODEL.stem + '.freezed.dart') + try: + src = MODEL.read_text() + header_start, decl_start, body_start, body_end = class_span(src, name) + body, v10_params = remove_copy_with(src[body_start:body_end]) + if not v10_params: + sys.exit(f'`{name}` has no hand-written copyWith; freezed\'s is new API, not a behaviour change.') + src = src[:body_start] + body + src[body_end:] + src, was_freezed = put_on_freezed(src, name, header_start, decl_start) + MODEL.write_text(src) + + # build_runner caches by input digest, and an earlier run's outputs were restored behind its back, so a + # rerun would keep them. Deleting the output forces the rebuild. + freezed.unlink(missing_ok=True) + rel = os.path.relpath((ROOT / MODEL).resolve(), pkg) + r = sh(['dart', 'run', 'build_runner', 'build', f'--build-filter={rel[:-5]}.*.dart'], cwd=pkg, env=env) + generated = freezed.read_text() if freezed.exists() else '' + call = interface(generated, name) + if r.returncode or not call: + sys.exit(f'build_runner did not generate a copyWith for `{name}`:\n{r.stdout[-3000:]}{r.stderr[-3000:]}') + # A filtered build deletes the package's other outputs; put them back before analyzing. + restore_deleted(pkg) + + generated_params = interface_params(call.group(1)) + fields = field_types(body) + missing = [p for p in v10_params if p not in generated_params] + retyped = [(p, t, fields[p]) for p, t in generated_params.items() + if p in fields and bare(t) != bare(fields[p])] + ctor_traps = [p for p, t in generated_params.items() + if t.endswith('?') and p in fields and not fields[p].endswith('?')] + + print(f'Analyzing `{name}` (pass 1: compile breaks)…', file=sys.stderr) + compile_errors = analyze(packages, env) + + stripped = re.sub(r'^(\s*)(.+?)\?(\s+\w+,)\s*$', r'\1\2\3', call.group(1), flags=re.M) + freezed.write_text(generated[:call.start(1)] + stripped + generated[call.end(1):]) + print(f'Analyzing `{name}` (pass 2: nullable arguments)…', file=sys.stderr) + nullable_errors = {k: v for k, v in analyze(packages, env).items() if k not in compile_errors} + + report(name, was_freezed, compile_errors, nullable_errors, v10_params, missing, retyped, ctor_traps) + finally: + restore(MODEL, pkg, untracked_before) + restore_deleted(pkg) + print('Restored the model and its package\'s generated files.', file=sys.stderr) + + +def restore_deleted(pkg): + rel_pkg = os.path.relpath(pkg, ROOT) + deleted = [p for p in sh(['git', 'ls-files', '--deleted', '--', f'{rel_pkg}/lib']).stdout.split() + if p.endswith(GENERATED)] + if deleted: + sh(['git', 'checkout', '--', *deleted]) + + +# --- Report ------------------------------------------------------------------------------------------------------ + + +def report(name, was_freezed, compile_errors, nullable_errors, v10_params, missing, retyped, ctor_traps): + def row(key, value, tag=''): + (file, line, col), (code, msg) = key, value + arg = arg_name(file, line, col, code, msg) + kind = 'test' if '/test/' in f'/{file}' else 'lib' + return arg, f'- [{kind}] `{file}:{line}` `{arg}:`{tag}\n `{source_line(file, line)}`\n {msg}' + + missing_rows, compile_rows = [], [] + for key, value in sorted(compile_errors.items()): + arg, text = row(key, value) + (missing_rows if value[0] == 'UNDEFINED_NAMED_PARAMETER' and arg in missing else compile_rows).append(text) + + nullable_rows = [] + for key, value in sorted(nullable_errors.items()): + arg = arg_name(*key, *value) + sentinel = v10_params.get(arg, (None, False))[1] + nullable_rows.append(row(key, value, ' — v10 sentinel, same result' if sentinel + else ' — **v10 kept on null; check**')[1]) + + def section(title, items, note=None): + print(f'\n## {title}\n') + if note and items: + print(note + '\n') + print('\n'.join(items) if items else 'None.') + + print(f'# freezed copyWith audit: `{name}` ({MODEL})') + if not was_freezed: + print(f'\n`{name}` is not on freezed yet; the probe added `@freezed` for this run only. It audits `copyWith`; ' + 'freezed would also replace `==`, `hashCode` and `toString`, which this does not check.') + if missing or retyped: + print('\n**Verdict: freezed\'s `copyWith` cannot replace this one as it stands.** freezed builds `copyWith` ' + 'from the constructor and keeps a parameter only when a field has the same name and type. Keep ' + '`@Freezed(copyWith: false)` with the hand-written method, or reshape the constructor first.') + section('Parameters freezed does not generate', [f'- `{p}`' for p in missing] + missing_rows, + 'A constructor parameter backed by a getter, a private field or a differently named field gets no ' + '`copyWith` parameter. Every call below stops compiling.') + section('Parameters whose type changes', [f'- `{p}`: `{t}` in `copyWith`, `{f}` on the field' for p, t, f in retyped], + 'freezed types the parameter from the constructor, not the field.') + section('Compile breaks (non-nullable parameter given a nullable value, or a retyped parameter)', compile_rows) + section('Nullable argument sites (null now clears instead of keeping)', nullable_rows) + section('Constructor-default trap (passing null regenerates the default)', [f'- `{p}`' for p in ctor_traps]) + sentinels = [f'`{p}`' for p, (_, s) in v10_params.items() if s] + section('v10 parameters with a `_nullConst` sentinel', [', '.join(sentinels)] if sentinels else []) + + +MODEL = Path() + +if __name__ == '__main__': + main() diff --git a/CLAUDE.md b/CLAUDE.md index 89a1d5d91f..9f82fac6d2 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -120,7 +120,8 @@ Optional local persistence using Drift (SQLite). Implements `ChatPersistenceClie ## Code Style -- Line length: **120 characters** (configured in `analysis_options.yaml`) +- Line length: **120 characters** for code (configured in `analysis_options.yaml`); wrap + docs and comments at **80** - Imports: inside a package's own `lib/`, use relative imports (`prefer_relative_imports`); use `package:` imports for anything from another package - All public APIs **must** have doc comments (`public_member_api_docs`) — see diff --git a/STYLE_GUIDE.md b/STYLE_GUIDE.md index 628dc64f2e..5a9ceb0f9c 100644 --- a/STYLE_GUIDE.md +++ b/STYLE_GUIDE.md @@ -60,8 +60,8 @@ document; the section link is provided. **Code** -- Line width: **120 characters** (configured in `analysis_options.yaml`). Comments and - docs follow the same limit. +- Line width: **120 characters** for code (configured in `analysis_options.yaml`). Wrap + comments and docs at **80**. - Single quotes, relative imports within a package's own `lib/`, trailing commas preserved, `const` wherever possible, `final` for locals that aren't reassigned. These are enforced by the linter — do not disable them. @@ -1377,10 +1377,12 @@ melos run lint:all # analyze + format, run this before opening a PR checked with the same settings. Do not invoke `dart format` on a single file with ad-hoc flags — the workspace-level config (line length, trailing commas) applies uniformly. -Line length is **120 characters** for both code and comments, configured in -`analysis_options.yaml`. Trailing commas are preserved rather than automatically added, -so include a trailing comma anywhere you want the formatter to break the argument list -onto multiple lines. +Line length is **120 characters** for code, configured in `analysis_options.yaml`. +Comments and docs wrap at **80**: prose that wide is easier to read in IDE hovers and +side-by-side diffs, and the formatter never reflows it, so wrap it by hand. + +Trailing commas are preserved rather than automatically added, so include a trailing +comma anywhere you want the formatter to break the argument list onto multiple lines. ### Constructors come first diff --git a/migrations/v11-migration.md b/migrations/v11-migration.md index 022dbf1998..f691a00331 100644 --- a/migrations/v11-migration.md +++ b/migrations/v11-migration.md @@ -30,6 +30,7 @@ onto Stream's OpenAPI-generated API client. - [Moderation](#moderation) - [App Settings](#app-settings) - [Guest Users](#guest-users) + - [Polls](#polls) - [File Upload](#file-upload) - [User Groups](#user-groups) - [Link Previews](#link-previews) @@ -77,6 +78,7 @@ from the spec, so don't subclass them or depend on their private constructors. | [**Moderation**](#moderation) | Muting, banning and flagging return a `Result` and call the moderation v2 API; `banUser`'s options map becomes named parameters; `unflagMessage`, `unflagUser` and `removeShadowBan` are removed | | [**App Settings**](#app-settings) | `getAppSettings` returns a `Result` instead of throwing; `GetAppSettingsResponse` is renamed `AppSettingsResponse` | | [**Guest Users**](#guest-users) | `connectGuestUser` is unchanged; `StreamChatApi.guest` and `ConnectGuestUserResponse` are removed | +| [**Polls**](#polls) | Poll calls return a `Result`; eight responses become `PollResponse`, `PollOptionResponse` and `PollVoteResponse`; queries take `limit`/`next`/`prev`; `VotingVisibility` is an extension type; `extraData` is `custom` | | [**File Upload**](#file-upload) | Uploads return a `Result` and deletes a `Result` instead of throwing; `AttachmentFileUploaderProvider` receives a `Dio` | | _(filled in per feature as PRs land)_ | | @@ -214,6 +216,26 @@ search-and-replace you can apply directly. `Kind` is one of `renamed`, `removed` | `StreamChatApi.general.getAppSettings()` | `StreamChatClient.getAppSettings()` | `removed` | The call moved to the generated client | | `StreamChatApi.guest` (`GuestApi.getGuestUser`) | `StreamChatClient.connectGuestUser` | `removed` | The call moved to the generated client; `connectGuestUser` keeps its signature and still throws | | `ConnectGuestUserResponse` | — | `removed` | Only `StreamChatApi.guest` returned it; `connectGuestUser` still returns the connected `OwnUser` | +| `StreamChatClient` poll methods → `Future` and the like | `Future>` and the like | `retyped` | `createPoll`, `getPoll`, `updatePoll`, `partialUpdatePoll`, `closePoll`, `createPollOption`, `getPollOption`, `updatePollOption`, `castPollVote`, `addPollAnswer`, `removePollVote`, `queryPolls` and `queryPollVotes` return a `Result` instead of throwing | +| `StreamChatClient.deletePoll` / `.deletePollOption` → `Future` | `Future>` | `retyped` | No value on success | +| `Channel.sendPoll` / `.updatePoll` / `.deletePoll` / `.closePoll` / `.createPollOption` / `.castPollVote` / `.addPollAnswer` / `.removePollVote` / `.queryPollVotes` | the same names, returning a `Result` | `retyped` | `sendPoll` also returns a failure when the message cannot be sent, rather than throwing | +| `CreatePollResponse` / `GetPollResponse` / `UpdatePollResponse` | `PollResponse` | `renamed` | Same fields: `duration` and `poll` | +| `CreatePollOptionResponse` / `GetPollOptionResponse` / `UpdatePollOptionResponse` | `PollOptionResponse` | `renamed` | Same fields: `duration` and `pollOption` | +| `CastPollVoteResponse` / `RemovePollVoteResponse` | `PollVoteResponse` | `renamed` | `vote` is nullable | +| `queryPolls(pagination: PaginationParams(limit: l, next: n))` / `queryPollVotes(…)` | `queryPolls(limit: l, next: n)` / `queryPollVotes(…)` | `retyped` | `limit` is still 10 when omitted. Pass a response's `prev` as `prev` to page backwards. The other `PaginationParams` fields never had an effect on these queries | +| `Channel.castPollVote` / `.removePollVote` throwing `ArgumentError` | a `Failure` carrying a `StreamClientException` | `retyped` | For an option or vote without an id | +| `Poll.copyWith` / `PollOption.copyWith` / `PollVote.copyWith` keeping a field passed as `null` | freezed's `copyWith` | `retyped` | `null` clears a nullable field and re-applies the constructor default of `Poll.id`, `createdAt` and `updatedAt`; `Poll.maxVotesAllowed` and `PollOption.id` already cleared | +| `Poll.extraData` / `PollOption.extraData` | `Poll.custom` / `PollOption.custom` | `renamed` | The wire's name for it; the first models to take it | +| `Poll.custom` / `PollOption.custom` entry named like one of the model's own fields | the same entry, as custom data | `retyped` | Sent and returned as custom data; v10's request body let it overwrite the field | +| `StreamPollController.addOption(extraData:)` / `.updateOption(extraData:)` (`stream_chat_flutter_core`) | `custom:` | `renamed` | Follows `PollOption.custom` | +| `Poll.topLevelFields` / `PollOption.topLevelFields` | — | `removed` | They listed the JSON keys of models that no longer have JSON | +| `VotingVisibility` (enum) | `VotingVisibility` (extension type over `String`) | `retyped` | `VotingVisibility.public` and `.anonymous` are unchanged; a `switch` needs a default arm, and `.name` / `.values` are gone — it is a `String`, so use it directly | +| `Poll.fromJson` / `.toJson`, `PollOption.fromJson` / `.toJson`, `PollVote.fromJson` / `.toJson` | — | `removed` | The models are plain classes; construct them directly. `Message.poll` and the poll events still decode from the same keys | +| — | `PollOption.fromData` / `.toData` | `added` | Read and write only the format the offline database stores; not a codec for API payloads | +| `CreatePollResponse()..poll = …` and the other response setters | `PollResponse(duration: …, poll: …)` | `retyped` | The responses are plain classes with a const constructor and final fields | +| poll responses' `duration` (`String?`) | `String` | `retyped` | Always present; drop any `!` or `?? ''` | +| `Poll` / `PollOption` / `PollVote extends Equatable`, `props` | value `==` | `removed` | `Poll` and `PollOption` now compare `custom` too | +| `StreamChatApi.polls` (`PollsApi`) | `StreamChatClient`'s poll methods | `removed` | The endpoints moved to the generated client | | `sendImage` / `sendFile` / `uploadImage` / `uploadFile` → `Future` and siblings | `Future>` | `retyped` | On `StreamChatClient`, `Channel` and `AttachmentFileUploader`. Returns a `Result` instead of throwing | | `deleteImage` / `deleteFile` / `removeImage` / `removeFile` → `Future` | `Future>` | `retyped` | On `StreamChatClient`, `Channel` and `AttachmentFileUploader`. Returns a `Result` instead of throwing | | `SendAttachmentResponse`, `SendFileResponse`, `SendImageResponse`, `UploadImageResponse`, `UploadFileResponse` | `UploadedFile` (`stream_core`) | `removed` | `.file` becomes `.fileUrl`; `.thumbUrl` is unchanged; `duration` is gone | @@ -736,6 +758,108 @@ queried, and the unread counts when connecting with `connectWebSocket: false`. N guest. v11 sends its id, name, image, language, `invisible`, an `OwnUser`'s privacy settings, and your own `extraData`. If you read one of those values back, store it as a custom field of your own instead. +### Polls + +**Every poll call returns a `Result` instead of throwing,** on `StreamChatClient` and on `Channel`. +`deletePoll` and `deletePollOption` carry no value on success. Calling a `Channel` method on a channel that is not +initialized still throws a `StateError`, as in v10. + +```dart +// v10 +try { + final response = await client.getPoll(pollId); + showPoll(response.poll); +} on StreamChatException catch (e) { + report(e); +} + +// v11 +final result = await client.getPoll(pollId); +result.fold( + onSuccess: (response) => showPoll(response.poll), + onFailure: (error, _) => report(error), +); +``` + +**`Channel.sendPoll` reports both of its steps through the `Result`.** It creates the poll and then sends it in a +message; a failure in either comes back as a `Failure`, where v10 threw. If the message fails, the poll stays created. + +**Eight responses become three.** Creating, fetching and updating a poll all answer a `PollResponse`; the same calls +on an option answer a `PollOptionResponse`; casting and removing a vote answer a `PollVoteResponse`. The fields are +unchanged, except that `PollVoteResponse.vote` is nullable. + +```dart +// v10 +final CreatePollResponse created = await client.createPoll(poll); + +// v11 +final Result created = await client.createPoll(poll); +``` + +**`queryPolls` and `queryPollVotes` take `limit`, `next` and `prev`** instead of a `PaginationParams`. `limit` is still +10 when omitted. The offset and id-based fields of `PaginationParams` never had an effect on these queries. The +responses now carry a `prev` cursor next to `next`; pass it as `prev` to fetch the page before. + +```dart +// v10 +await channel.queryPollVotes(pollId, pagination: PaginationParams(limit: 10, next: cursor)); + +// v11 +await channel.queryPollVotes(pollId, limit: 10, next: cursor); +``` + +**A missing id is a failure, not an `ArgumentError`.** `Channel.castPollVote` with an option that has no id, and +`removePollVote` with a vote that has none, return a `Failure` carrying a `StreamClientException`. + +**`VotingVisibility` is an extension type over its wire string.** `VotingVisibility.public` and +`VotingVisibility.anonymous` read the same, and a visibility the SDK does not name is kept rather than rejected. +A `switch` over it needs a default arm, and `.name` / `.values` are gone — it is a `String`, so use it directly. + +**`Poll`, `PollOption`, `PollVote` and the responses no longer decode JSON.** Build them with their constructors — +`PollResponse(duration: '0ms', poll: poll)` where v10 wrote `CreatePollResponse()..poll = poll`. `Message.poll` and +the poll events still decode from the same keys. `PollOption.fromData` and `toData` read and write the format the +offline database stores; they are not a way to decode API responses. `Poll.topLevelFields` and +`PollOption.topLevelFields`, which listed their JSON keys, are gone with the JSON. + +**`Poll`, `PollOption` and `PollVote` no longer extend `Equatable`.** They still compare by value and `props` is gone. +`Poll` and `PollOption` now include their custom data in `==`: two polls that differ only in custom data are no +longer equal, so neither are the messages that carry them, and a widget comparing them rebuilds when only custom +data changes. + +**`extraData` is renamed `custom`, and holds the poll's custom data verbatim.** `Poll.custom` and +`PollOption.custom` hold what the API returns as custom data, and the requests send it back as custom data; the +same rename applies to `StreamPollController.addOption` and `updateOption`. In v10 an entry named like one of the +poll's own fields — `name`, `is_closed`, an option's `text` — overwrote that field in the request body; it is now +stored as custom data under that name. + +```dart +// v10 +final topic = poll.extraData['topic']; +Poll(name: 'Lunch?', options: options, extraData: {'topic': 'food'}); + +// v11 +final topic = poll.custom['topic']; +Poll(name: 'Lunch?', options: options, custom: {'topic': 'food'}); +``` + +**`copyWith` on `Poll`, `PollOption` and `PollVote` is freezed's.** Passing `null` for a nullable field clears it, +where v10 kept the value: `description`, `nameI18n`, `descriptionI18n`, `createdById` and `createdBy` on `Poll`, +`textI18n` on `PollOption`, and every nullable field of `PollVote`. `Poll.maxVotesAllowed` and `PollOption.id` +already cleared. Passing `null` for `Poll.id`, `createdAt` or `updatedAt`, or a vote's `createdAt` or +`updatedAt`, applies the constructor default — a new id or the current time — instead of keeping the value. Omit +the argument to keep a value. + +```dart +// v10: description stays 'Pick one' +poll.copyWith(description: null); + +// v11: description is null; omit it to keep it +poll.copyWith(description: null); +poll.copyWith(name: 'Dinner?'); +``` + +**`StreamChatApi.polls` is removed.** Call the poll methods on `StreamChatClient` or `Channel` instead. + ### File Upload **Uploads and deletes return a `Result` instead of throwing.** `sendImage`, `sendFile`, `uploadImage` and diff --git a/openapi-migration/02-devices.md b/openapi-migration/02-devices.md index 71e2e9abeb..5bc5624a3b 100644 --- a/openapi-migration/02-devices.md +++ b/openapi-migration/02-devices.md @@ -89,6 +89,8 @@ Revisited after landing: the group first adopted the generated `DeviceResponse`, hand-written, with the reason. - [x] Public methods return `Future>`; no `getOrThrow()` inside the SDK. - [x] Hand-written request/response DTOs for this group are deleted, or their retention is justified. +- [x] `copywith_audit.py` was run for every model that loses a v10 `copyWith`, every site it reports is + handled, and the semantics change is in the CHANGELOG and the guide ([README rule 2](README.md#domain-models)). - [x] `melos run analyze` clean, `melos run test:dart` green, persistence tests green if this group persists anything. - [x] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. diff --git a/openapi-migration/03-user-groups.md b/openapi-migration/03-user-groups.md index 36c1e01060..e3f0cf9329 100644 --- a/openapi-migration/03-user-groups.md +++ b/openapi-migration/03-user-groups.md @@ -73,6 +73,8 @@ Follows the [domain-model rules](README.md#domain-models). hand-written, with the reason. - [x] Public methods return `Future>`; no `getOrThrow()` inside the SDK. - [x] Hand-written request/response DTOs for this group are deleted, or their retention is justified. +- [x] `copywith_audit.py` was run for every model that loses a v10 `copyWith`, every site it reports is + handled, and the semantics change is in the CHANGELOG and the guide ([README rule 2](README.md#domain-models)). - [x] `melos run analyze` clean, `melos run test:dart` green, persistence tests green if this group persists anything. - [x] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. diff --git a/openapi-migration/04-roles-guest-and-app.md b/openapi-migration/04-roles-guest-and-app.md index e8df714c1d..db99df5cf1 100644 --- a/openapi-migration/04-roles-guest-and-app.md +++ b/openapi-migration/04-roles-guest-and-app.md @@ -113,6 +113,8 @@ hand-written, with the reason. - [x] Public methods return `Future>`; no `getOrThrow()` inside the SDK. - [x] Hand-written request/response DTOs for this group are deleted, or their retention is justified. +- [x] `copywith_audit.py` was run for every model that loses a v10 `copyWith`, every site it reports is + handled, and the semantics change is in the CHANGELOG and the guide ([README rule 2](README.md#domain-models)). - [x] `melos run analyze` clean, `melos run test:dart` green, persistence tests green if this group persists anything. - [x] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. diff --git a/openapi-migration/05-polls.md b/openapi-migration/05-polls.md index 39991be852..80fb91249f 100644 --- a/openapi-migration/05-polls.md +++ b/openapi-migration/05-polls.md @@ -2,7 +2,7 @@ **Goal:** First group with real domain models and persistence behind it. -**Size:** 13 hand-written method(s) across 1 file(s) → 13 generated operation(s). +**Size:** 0 hand-written method(s) across 0 file(s) → 13 generated operation(s). > This whole file is generated by `openapi-migration/tool/generate_plan.py`, prose included. > Edit its `GROUPS` entry and re-run the script — edits made here are lost on the next run. @@ -13,19 +13,6 @@ | File | Method | Returns | | --- | --- | --- | -| `polls_api.dart` | `createPoll` | `CreatePollResponse` | -| `polls_api.dart` | `getPoll` | `GetPollResponse` | -| `polls_api.dart` | `updatePoll` | `UpdatePollResponse` | -| `polls_api.dart` | `partialUpdatePoll` | `UpdatePollResponse` | -| `polls_api.dart` | `deletePoll` | `EmptyResponse` | -| `polls_api.dart` | `createPollOption` | `CreatePollOptionResponse` | -| `polls_api.dart` | `getPollOption` | `GetPollOptionResponse` | -| `polls_api.dart` | `updatePollOption` | `UpdatePollOptionResponse` | -| `polls_api.dart` | `deletePollOption` | `EmptyResponse` | -| `polls_api.dart` | `castPollVote` | `CastPollVoteResponse` | -| `polls_api.dart` | `removePollVote` | `RemovePollVoteResponse` | -| `polls_api.dart` | `queryPolls` | `QueryPollsResponse` | -| `polls_api.dart` | `queryPollVotes` | `QueryPollVotesResponse` | ### Generated operations that cover it @@ -45,11 +32,72 @@ | `PUT` | `/api/v2/polls/{poll_id}/options` | `updatePollOption` | `PollOptionResponse` | | `PATCH` | `/api/v2/polls/{poll_id}` | `updatePollPartial` | `PollResponse` | -## Decisions to make +## Decisions taken -- `Poll`, `PollOption` and `PollVote` are public and persisted; adopting generated shapes means touching `stream_chat_persistence` in the same PR. -- `VotingVisibility` is ours; the generated equivalent is an inline per-operation enum. -- One generated `PollResponse` answers `createPoll`, `getPoll`, `updatePoll` and `updatePollPartial`, where v10 has `CreatePollResponse`, `GetPollResponse` and `UpdatePollResponse`. The v10 envelopes stay; decide with the user how the mapper names its conversions, since one `toModel()` cannot return three types. `PollOptionResponse` (create, get, update an option) and `PollVoteResponse` (cast, remove a vote) have the same shape. +- **`Poll`, `PollOption` and `PollVote` keep their v10 names, fields and defaults,** as `@freezed` + classes with no JSON, mapped from `PollResponseData`, `PollOptionResponseData` and + `PollVoteResponseData` in `lib/src/repository/mapper/polls_mapper.dart`. The uuid default `id` and the + `DateTime.now()` timestamps stay; `PollVote.isAnswer` becomes a getter, and `latestVotes`, `ownVotes` and + `ownAnswers` stay `late final` caches. +- **Equality now includes `extraData`.** v10's `Equatable` props left it out of `Poll` and `PollOption`; + freezed compares every field, and so does `Message`, whose props include its poll. Accepted as a + behavioural break and flagged for review. +- **The eight v10 envelopes collapse to the three the server returns:** `PollResponse` (create, get, + update, partial update), `PollOptionResponse` (create, get, update an option) and `PollVoteResponse` + (cast, remove a vote), each with one `toModel()`. `QueryPollsResponse` and `QueryPollVotesResponse` + keep their names. A rename break beyond the [sanctioned ones](README.md#domain-models), approved for + this group and flagged for review. `PollVoteResponse.vote` is nullable, as the spec marks it. +- **The fields only the generated types carry stay out:** the `*_i18n` maps, `is_answer` (derived from + `answerText`) and `PollVoteResponse.poll`. Adding them is additive. The i18n keys are known fields + (`topLevelFields`), so neither the mapper nor the v1 decoder puts them in `extraData`, and a poll + compares equal whichever path delivered it. +- **Write methods keep taking `Poll` and `PollOption`.** The mapper sends only the writable settings; + the vote summary, `createdBy` and timestamps are not sent. Dedicated request types were considered + and rejected: the draft a caller builds must stay a `Poll`, because a message carries one. Flagged + for review. +- **Option ids are not sent on create.** `PollOptionInput` has none; the server assigns them and + rejects a client id as reserved (confirmed live: v10 answered 400). **`updatePoll` and + `updatePollOption` send an option without an id with an empty one** and return the server's failure; + the SDK does not pre-check a rule the backend owns. +- **`queryPolls` and `queryPollVotes` take `limit`, `next` and `prev`** instead of `PaginationParams`. + The generated requests carry only those, and the backend never read the offset or id/date cursors on + these queries. `limit` defaults to 10, `PaginationParams`' default, so an omitted limit pages as in + v10. The responses expose `prev`, so the parameter is usable. Flagged for review. +- **`VotingVisibility` becomes an extension type over its wire string,** following `PushProvider`. An + unknown value is kept rather than rejected, in the mapper, the v1 decoder and persistence. +- **An answer's `optionId` stays `""`,** as the server sends it and v10 decoded it. +- **`custom` is `extraData`, verbatim, in both directions** (README rule 9). The response mappers copy the + generated `custom` map as is and the request mappers send `extraData` as `custom`; an entry named like + one of the model's own fields is custom data on v2, where v10's flattened body let it set the field. + The v1 converters own the key lists that split the flat JSON on read (`Poll.topLevelFields` and + `PollOption.topLevelFields` are removed), and leave such an entry out on write so it cannot overwrite + a key. +- **Every public poll method returns a `Result`,** on `StreamChatClient` and `Channel`. `deletePoll` and + `deletePollOption` answer `DurationResponse` and return `Result`. `closePoll` stays a + `partialUpdatePoll` that sets `is_closed`. +- **`Channel.sendPoll` returns `Result`.** A `createPoll` failure passes through + and no message is sent; a `StreamException` thrown by `sendMessage` (still v1) is caught into a + `Failure`. +- **A missing option or vote id is a `Failure(StreamClientException)`, not an `ArgumentError`,** in + `Channel.castPollVote` and `removePollVote`, matching the migrated never-throws contract. +- **v1 JSON keeps decoding through hand-written converters** (`PollV1JsonConverter`, + `PollVoteV1JsonConverter`) on `Message.poll`, `DraftMessage.poll`, `Event.poll` and `Event.pollVote`. + The WebSocket is v1-only and sends custom data flat, with no `custom` key, so the generated + `fromJson` would throw on it; the converters mirror v10's `fromJson` and tolerate missing keys. + `Event` writes these fields too, so its converters run both ways. +- **`PollOption` gets the `@DataSerializable` codec** for `polls.options`. The stored format nests + custom data under `extra_data` where v10 flattened it, so `schemaVersion` is bumped. +- **`Poll`, `PollOption` and `PollVote` use freezed's `copyWith`.** The audit found one lib site + (`stream_message_preview_text.dart`, a `String?` passed for `name`) and one test per model; the + merging of poll events in `channel_state_mutations.dart` and `Poll.withTranslationsOf` passes no + argument that is null while the field is set, so it is unchanged. `null` now clears a nullable field + and re-applies the `id` and timestamp defaults, recorded as a break. +- **`extraData` is renamed `custom` on `Poll` and `PollOption`,** the wire's name, with no deprecated + alias; `StreamPollController.addOption` and `updateOption` and the `polls.custom` column follow. + Every migrated model takes the name from here on (README rule 9); [group 15](15-custom-data.md) + renames whatever no group migrates. +- **Verified live** against the demo app with a before/after harness covering every endpoint, the + error cases and the WebSocket events, and in the sample app on web. ## Risks @@ -59,17 +107,19 @@ ## Definition of done -- [ ] Every method above either routes through `DefaultApi` or is listed here as deliberately left +- [x] Every method above either routes through `DefaultApi` or is listed here as deliberately left hand-written, with the reason. -- [ ] Public methods return `Future>`; no `getOrThrow()` inside the SDK. -- [ ] Hand-written request/response DTOs for this group are deleted, or their retention is justified. -- [ ] `melos run analyze` clean, `melos run test:dart` green, persistence tests green if this group +- [x] Public methods return `Future>`; no `getOrThrow()` inside the SDK. +- [x] Hand-written request/response DTOs for this group are deleted, or their retention is justified. +- [x] `copywith_audit.py` was run for every model that loses a v10 `copyWith`, every site it reports is + handled, and the semantics change is in the CHANGELOG and the guide ([README rule 2](README.md#domain-models)). +- [x] `melos run analyze` clean, `melos run test:dart` green, persistence tests green if this group persists anything. -- [ ] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. -- [ ] CHANGELOG entry under `🛑️ Breaking` for each break; PR title `refactor(llc)!:`. -- [ ] Decisions recorded in this file, and the status box ticked in `README.md`. -- [ ] Public dartdoc follows [`STYLE_GUIDE.md` § Documentation](../STYLE_GUIDE.md#documentation) +- [x] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. +- [x] CHANGELOG entry under `🛑️ Breaking` for each break; PR title `refactor(llc)!:`. +- [x] Decisions recorded in this file, and the status box ticked in `README.md`. +- [x] Public dartdoc follows [`STYLE_GUIDE.md` § Documentation](../STYLE_GUIDE.md#documentation) and [`EFFECTIVE_DART_DOC.md`](../EFFECTIVE_DART_DOC.md), including on symbols this group retyped but whose docs it left alone. -- [ ] Tests follow [`TESTING.md`](../TESTING.md): no `group` organizing a file by method, each +- [x] Tests follow [`TESTING.md`](../TESTING.md): no `group` organizing a file by method, each name states its subject and behaviour. diff --git a/openapi-migration/06-reminders.md b/openapi-migration/06-reminders.md index f2ccb1b74e..91be7b453e 100644 --- a/openapi-migration/06-reminders.md +++ b/openapi-migration/06-reminders.md @@ -41,6 +41,8 @@ hand-written, with the reason. - [ ] Public methods return `Future>`; no `getOrThrow()` inside the SDK. - [ ] Hand-written request/response DTOs for this group are deleted, or their retention is justified. +- [ ] `copywith_audit.py` was run for every model that loses a v10 `copyWith`, every site it reports is + handled, and the semantics change is in the CHANGELOG and the guide ([README rule 2](README.md#domain-models)). - [ ] `melos run analyze` clean, `melos run test:dart` green, persistence tests green if this group persists anything. - [ ] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. diff --git a/openapi-migration/07-threads-and-drafts.md b/openapi-migration/07-threads-and-drafts.md index b325ae5e0d..eb757b9e15 100644 --- a/openapi-migration/07-threads-and-drafts.md +++ b/openapi-migration/07-threads-and-drafts.md @@ -39,6 +39,7 @@ ## Risks +- `DraftMessage.poll` is never decoded from JSON: `poll` is not in `DraftMessage.topLevelFields`, so the key would land in `extraData`, and the draft payload carries `poll_id` only. Its `PollV1JsonConverter` exists so the generated code compiles. Decide here whether the field stays constructor-only or goes. - The four draft methods live in `message_api.dart`, not `threads_api.dart` — this group reaches into that file, and group 10 must leave those four alone. - `Draft` and `DraftMessage` are public, persisted, and read by `StreamDraftListController` in `stream_chat_flutter_core`. @@ -48,6 +49,8 @@ hand-written, with the reason. - [ ] Public methods return `Future>`; no `getOrThrow()` inside the SDK. - [ ] Hand-written request/response DTOs for this group are deleted, or their retention is justified. +- [ ] `copywith_audit.py` was run for every model that loses a v10 `copyWith`, every site it reports is + handled, and the semantics change is in the CHANGELOG and the guide ([README rule 2](README.md#domain-models)). - [ ] `melos run analyze` clean, `melos run test:dart` green, persistence tests green if this group persists anything. - [ ] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. diff --git a/openapi-migration/08-moderation-and-blocklists.md b/openapi-migration/08-moderation-and-blocklists.md index 35e3686252..660da8e4a8 100644 --- a/openapi-migration/08-moderation-and-blocklists.md +++ b/openapi-migration/08-moderation-and-blocklists.md @@ -187,6 +187,8 @@ hand-written, with the reason. - [x] Public methods return `Future>`; no `getOrThrow()` inside the SDK. - [x] Hand-written request/response DTOs for this group are deleted, or their retention is justified. +- [x] `copywith_audit.py` was run for every model that loses a v10 `copyWith`, every site it reports is + handled, and the semantics change is in the CHANGELOG and the guide ([README rule 2](README.md#domain-models)). - [x] `melos run analyze` clean, `melos run test:dart` green, persistence tests green if this group persists anything. - [x] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. diff --git a/openapi-migration/09-users.md b/openapi-migration/09-users.md index 3df0231010..1c6d0bf219 100644 --- a/openapi-migration/09-users.md +++ b/openapi-migration/09-users.md @@ -41,7 +41,7 @@ - `User` and `OwnUser` are public, persisted, and embedded in nearly every other response. This group restructures them, last: the mappers in `user_mapper.dart` already map the generated types onto the current class for every group before it, and stay. See [01-foundation](01-foundation.md). - `PrivacySettings` and the push-preference sub-shapes — decide per type. -- `UserResponse.toModel()` leaves `OwnUser.topLevelFields`, `deleted_at`, `deactivated_at` and `revoke_tokens_issued_before` out of every user's `extraData` (`_shadowedCustomKeys`), where v1 kept the `OwnUser`-only keys in a plain user's `extraData`. Revisit once the mapper serves plain users. +- **`User.name` and `image` become fields** (README rule 9): `UserResponse` types them, and the constructor stops writing them into `extraData`; decide whether `name` keeps its fallback to `id`. `deleted_at`, `deactivated_at`, `revoke_tokens_issued_before` and `blocked_user_ids`, which `UserResponse` types and v1 kept in a plain user's `extraData`, become fields or are dropped, never `extraData`. `UserResponse.toModel()` then copies `custom` verbatim into the field, renamed `custom`, and `UserRequestMapper` stops reading `extraData['name']` and `['image']`. - `UserFilterField.shadowBanned` and `.bypassModeration` read `extraData`, which the generated `UserResponse` has no field to fill. - `updateUsers` reuses `User.toRequest()`. It is a full upsert, and v10's flattened body filed the user's client state (`online`, `banned`, `created_at` and similar) into the stored custom data on every call, as it did for guests in [04](04-roles-guest-and-app.md). Decide the same way here, for real users rather than fresh guests, and record it in the CHANGELOG. - The generated `UserRequest` sends explicit `null` for an unset `language` or `invisible`, where v10 left the key out. For a guest create that made no difference; for an upsert of an existing user, confirm live that a `null` does not reset a stored value differently from an omitted key. @@ -51,6 +51,7 @@ - Every other group depends on the `User` decision. - User data arrives over the WebSocket on nearly every event. - Landing `UserResponse` -> `User` unblocks the two fields [08](08-moderation-and-blocklists.md) had to drop from `MuteUsersResponse`: the `mutes` the call created and the `ownUser` it left behind. Adding them is additive for anyone reading the response, so revisit them here rather than leaving them dropped for good. +- Until then, a user mapped from `UserResponse` and the same user decoded from v1 JSON carry different `extraData`: the v1 path keeps `blocked_user_ids`, `deleted_at`, `deactivated_at` and `revoke_tokens_issued_before`, the mapper drops them. Equality includes `extraData`, so a `Poll` from a REST call (its `createdBy`, its votes' `user`) and the same poll from an event compare unequal. ## Definition of done @@ -58,6 +59,8 @@ hand-written, with the reason. - [ ] Public methods return `Future>`; no `getOrThrow()` inside the SDK. - [ ] Hand-written request/response DTOs for this group are deleted, or their retention is justified. +- [ ] `copywith_audit.py` was run for every model that loses a v10 `copyWith`, every site it reports is + handled, and the semantics change is in the CHANGELOG and the guide ([README rule 2](README.md#domain-models)). - [ ] `melos run analyze` clean, `melos run test:dart` green, persistence tests green if this group persists anything. - [ ] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. @@ -72,3 +75,6 @@ the table in `README.md`. - [ ] `user_mapper.dart` maps onto the restructured `User`, and its `TODO(openapi-migration)` note is gone. +- [ ] A user mapped from `UserResponse` and the same user decoded from v1 / WebSocket JSON compare equal. +- [ ] `user_mapper.dart` has no `_shadowedCustomKeys`: `User.custom` is the wire's `custom`, verbatim, and + no typed field is written into it. diff --git a/openapi-migration/10-messages.md b/openapi-migration/10-messages.md index 7a5d1ea5cc..14b775439f 100644 --- a/openapi-migration/10-messages.md +++ b/openapi-migration/10-messages.md @@ -65,6 +65,8 @@ hand-written, with the reason. - [ ] Public methods return `Future>`; no `getOrThrow()` inside the SDK. - [ ] Hand-written request/response DTOs for this group are deleted, or their retention is justified. +- [ ] `copywith_audit.py` was run for every model that loses a v10 `copyWith`, every site it reports is + handled, and the semantics change is in the CHANGELOG and the guide ([README rule 2](README.md#domain-models)). - [ ] `melos run analyze` clean, `melos run test:dart` green, persistence tests green if this group persists anything. - [ ] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. diff --git a/openapi-migration/11-channels-and-members.md b/openapi-migration/11-channels-and-members.md index ba18c48dd2..b3a3766bad 100644 --- a/openapi-migration/11-channels-and-members.md +++ b/openapi-migration/11-channels-and-members.md @@ -73,14 +73,14 @@ ## Decisions to make - `ChannelState`, `ChannelModel` and `Member` are public, persisted, and rebuilt from WebSocket events. Keep ours and map. -- **Whether `ChannelModel` promotes its `extraData`-backed flags to real fields.** `disabled`, `hidden`, `muted`, `blocked` and `truncatedAt` all arrive as root fields on `ChannelResponse` but are pushed into `extraData` and read back through getters, which the constructor comment calls "for backwards compatibility". Promoting them is a break worth making in v11 if it is made at all, and it belongs with this group's model shape rather than with whichever phase happens to add the next flag. Raised on [#2958](https://github.com/GetStream/stream-chat-flutter/pull/2958). +- **`ChannelModel` promotes its `extraData`-backed flags to fields** (README rule 9). `disabled`, `hidden`, `muted`, `blocked` and `truncatedAt`, plus the keys the channel mapper parks today — `truncatedBy`, `muteExpiresAt`, `hideMessagesBefore`, `autoTranslationEnabled` and `autoTranslationLanguage` — become fields with persistence columns, and the constructor stops writing them into the custom data, which is renamed `custom`. `name` and `image` stay in it: `ChannelResponse` has no such fields. Raised on [#2958](https://github.com/GetStream/stream-chat-flutter/pull/2958). - `sync` returns `SyncResponse` — one of the two models that needed the WSEvent generator patch. Verify it decodes before relying on it. ## Risks - `sync` and `queryMembers` live in `general_api.dart`, not `channel_api.dart` — this group reaches into that file. - `queryChannels` drives the channel list controllers and the offline cache; a shape change here is felt everywhere. -- Channel `custom`/`extraData` promotion, same class of problem as messages. +- A consumer reading `channel.extraData['hidden']` and friends loses the key once the flags are fields; none in this repo. - Landing `ChannelResponse` -> `ChannelModel` is the last thing blocking [08](08-moderation-and-blocklists.md)'s `muteChannel`, which drops `channelMute`, `channelMutes` and `ownUser` because the generated `ChannelMute` carries a `ChannelResponse?` and a `UserResponse?` where ours needs a non-nullable `ChannelModel` and `User`. It needs 09 as well. Decide the null case there too — ours are non-nullable, the generated ones are not, the same question [14](14-banned-users.md) records for `BanResponse.user`. ## Definition of done @@ -89,6 +89,8 @@ hand-written, with the reason. - [ ] Public methods return `Future>`; no `getOrThrow()` inside the SDK. - [ ] Hand-written request/response DTOs for this group are deleted, or their retention is justified. +- [ ] `copywith_audit.py` was run for every model that loses a v10 `copyWith`, every site it reports is + handled, and the semantics change is in the CHANGELOG and the guide ([README rule 2](README.md#domain-models)). - [ ] `melos run analyze` clean, `melos run test:dart` green, persistence tests green if this group persists anything. - [ ] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. @@ -99,3 +101,5 @@ retyped but whose docs it left alone. - [ ] Tests follow [`TESTING.md`](../TESTING.md): no `group` organizing a file by method, each name states its subject and behaviour. +- [ ] `channel_mapper.dart` has no `_shadowedCustomKeys`: `ChannelModel.custom` is the wire's `custom`, + verbatim, and no flag is written into it. diff --git a/openapi-migration/12-uploads-cdn.md b/openapi-migration/12-uploads-cdn.md index 3b5c2b0fa9..d92b88f161 100644 --- a/openapi-migration/12-uploads-cdn.md +++ b/openapi-migration/12-uploads-cdn.md @@ -74,6 +74,8 @@ hand-written, with the reason. - [x] Public methods return `Future>`; no `getOrThrow()` inside the SDK. - [x] Hand-written request/response DTOs for this group are deleted, or their retention is justified. +- [x] `copywith_audit.py` was run for every model that loses a v10 `copyWith`, every site it reports is + handled, and the semantics change is in the CHANGELOG and the guide ([README rule 2](README.md#domain-models)). - [x] `melos run analyze` clean, `melos run test:dart` green, persistence tests green if this group persists anything. - [x] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. diff --git a/openapi-migration/13-push-preferences.md b/openapi-migration/13-push-preferences.md index 55b14189c8..a3eebd8aa8 100644 --- a/openapi-migration/13-push-preferences.md +++ b/openapi-migration/13-push-preferences.md @@ -38,6 +38,8 @@ hand-written, with the reason. - [ ] Public methods return `Future>`; no `getOrThrow()` inside the SDK. - [ ] Hand-written request/response DTOs for this group are deleted, or their retention is justified. +- [ ] `copywith_audit.py` was run for every model that loses a v10 `copyWith`, every site it reports is + handled, and the semantics change is in the CHANGELOG and the guide ([README rule 2](README.md#domain-models)). - [ ] `melos run analyze` clean, `melos run test:dart` green, persistence tests green if this group persists anything. - [ ] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. diff --git a/openapi-migration/14-banned-users.md b/openapi-migration/14-banned-users.md index e6f0ea918f..a5b5db0516 100644 --- a/openapi-migration/14-banned-users.md +++ b/openapi-migration/14-banned-users.md @@ -45,6 +45,8 @@ hand-written, with the reason. - [ ] Public methods return `Future>`; no `getOrThrow()` inside the SDK. - [ ] Hand-written request/response DTOs for this group are deleted, or their retention is justified. +- [ ] `copywith_audit.py` was run for every model that loses a v10 `copyWith`, every site it reports is + handled, and the semantics change is in the CHANGELOG and the guide ([README rule 2](README.md#domain-models)). - [ ] `melos run analyze` clean, `melos run test:dart` green, persistence tests green if this group persists anything. - [ ] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. diff --git a/openapi-migration/15-custom-data.md b/openapi-migration/15-custom-data.md new file mode 100644 index 0000000000..b04ed5afd8 --- /dev/null +++ b/openapi-migration/15-custom-data.md @@ -0,0 +1,43 @@ +# 15 — Custom Data + +**Goal:** Every public model's custom data is named `custom` and is exactly the wire's `custom`. + +**Size:** 0 hand-written method(s) across 0 file(s) → 0 generated operation(s). + +> This whole file is generated by `openapi-migration/tool/generate_plan.py`, prose included. +> Edit its `GROUPS` entry and re-run the script — edits made here are lost on the next run. + +## Scope + +### Hand-written today + +| File | Method | Returns | +| --- | --- | --- | + +### Generated operations that cover it + +| Verb | Path | Operation | Response | +| --- | --- | --- | --- | + +## Decisions to make + +- **Which models are left.** Each group renames the models it migrates, polls first; this pass renames whatever remains, and the persistence `extra_data` columns with them. +- **How to stage the remaining renames.** Polls did a hard rename; decide whether the widely used models (`Message`, `ChannelModel`, `User`) get a deprecated `extraData` alias for a release. +- **What replaces `topLevelFields` and `Serializer`.** The v1 decoders still split flat JSON by a key list until the WebSocket moves to v2. A model that loses its JSON drops `topLevelFields` and its converter owns the list, as polls did; decide where `Serializer` goes once the last decoder does. + +## Risks + +- `Serializer`, the models' `topLevelFields` and the persistence `extra_data` columns name the concept too. +- A consumer reading `channel.extraData['hidden']` or `user.extraData['name']` loses the key; none in this repo. Filter fields over custom keys (`UserFilterField.email`) are unaffected. +- Runs after groups 09 and 11 at the earliest, once `User` and `ChannelModel` promote their parked fields. + +## Definition of done + +- [ ] No mapper under `lib/src/repository/mapper/` filters `custom`: `grep -rn _shadowedCustomKeys` is empty. +- [ ] No model writes a typed field into `extraData`, and no getter reads a typed field out of it. +- [ ] No public model exposes `topLevelFields`; each v1 decoder owns its key list. +- [ ] Every public model names its custom data the same way, in the models, the mappers, the v1 + decoders and the persistence columns. +- [ ] `migrations/v11-migration.md`: Symbol Map rows plus a feature section. +- [ ] CHANGELOG entry under `🛑️ Breaking` for each break; PR title `refactor(llc)!:`. +- [ ] Decisions recorded in this file, and the status box ticked in `README.md`. diff --git a/openapi-migration/README.md b/openapi-migration/README.md index 25bf7b8325..3b6d92818b 100644 --- a/openapi-migration/README.md +++ b/openapi-migration/README.md @@ -16,7 +16,7 @@ generated operations in scope, the decisions that group has to make, its risks, | [02](02-devices.md) | Devices | 0 | 3 | ☑ | | [03](03-user-groups.md) | User Groups | 0 | 8 | ☑ | | [04](04-roles-guest-and-app.md) | Roles, Guest & App Settings | 0 | 5 | ☑ | -| [05](05-polls.md) | Polls | 13 | 13 | ☐ | +| [05](05-polls.md) | Polls | 0 | 13 | ☑ | | [06](06-reminders.md) | Message Reminders | 4 | 4 | ☐ | | [07](07-threads-and-drafts.md) | Threads & Drafts | 7 | 7 | ☐ | | [08](08-moderation-and-blocklists.md) | Moderation & Blocklists | 0 | 34 | ☑ | @@ -26,8 +26,9 @@ generated operations in scope, the decisions that group has to make, its risks, | [12](12-uploads-cdn.md) | Uploads (CDN) | 8 | 8 | ☑ | | [13](13-push-preferences.md) | Push Preferences | 1 | 1 | ☐ | | [14](14-banned-users.md) | Banned Users — split out of 08 | 1 | 1 | ☐ | +| [15](15-custom-data.md) | Custom Data — `extraData` is the wire's `custom`, then renamed | — | — | ☐ | -**Coverage:** 85 hand-written methods across 11 files, and all 129 generated operations, each claimed by exactly +**Coverage:** 71 hand-written methods across 9 files, and all 129 generated operations, each claimed by exactly one group. Verified mechanically — see [Keeping this plan honest](#keeping-this-plan-honest). @@ -81,7 +82,8 @@ breaks against v10: - envelopes are immutable, built through a const constructor rather than `late` setters; - `duration` is a non-nullable `String` on every envelope, where v10 typed it `String?`; - public models and envelopes are `@freezed`, so they compare by value; one that extended `Equatable` in v10 no - longer does, and loses `props`. + longer does, and loses `props`; +- a model's `extraData` is renamed `custom`, the wire's name for it (rule 9). Each ships the four artifacts listed under [Principles](#principles), like any other break. @@ -99,6 +101,18 @@ includes a named response that carries only `duration` today, such as `HideChann (see the breaks above). A field the server adds is exposed later, as an additive change. The one exception to "no JSON" is the temporary `@DataSerializable` storage codec in rule 8. + **A model uses freezed's `copyWith`.** It differs from a v10 hand-written one: `null` clears a nullable field + instead of keeping it, `null` re-runs a constructor default (`id ?? Uuid().v4()`), and a constructor parameter + with no field of the same name and type is not generated. Before deleting the v10 method, run the audit in + [`.claude/skills/openapi-migration/copywith-audit.md`](../.claude/skills/openapi-migration/copywith-audit.md) + and handle every site it reports: a compile break gets a local or a `?? model.field`; a "kept on null; check" + site is rewritten as an explicit merge (`?? this.x` at the caller, or an `@internal` merge method in the shape of + `Poll.withTranslationsOf`) unless the clear is the intended behaviour. When the audit's verdict says freezed + cannot replace the method — a parameter backed by a getter, a private field or a different type, as on + `Message` — keep `@Freezed(copyWith: false)` with the hand-written method, or reshape the constructor as a + public API change of its own. The semantics change goes in the CHANGELOG and the guide, listed per field under + the rows of the audit's table. + **Names default to v10's,** even where the generated name differs: `OGAttachmentResponse` rather than `GetOGResponse`, `AppSettings` rather than `AppResponseFields`, `UploadConfig` rather than `FileUploadConfig`. That is a default, not a requirement. The user may ask for another name, or a migration may propose one that @@ -135,6 +149,14 @@ includes a named response that carries only `duration` today, such as `HideChann parent's rule-7 converter writes it. The codec is temporary: every use is marked `// TODO(openapi-migration): remove in group 10` and listed below, and group 10 replaces every use and deletes the typedef, so no later group adds one. The cache is disposable, so the stored format is ours to choose. +9. **A migrated model names its custom data `custom`, and it is the wire's `custom`, verbatim, in both + directions.** A response mapper copies the generated `custom` map into it and a request mapper sends it back as + `custom`; neither filters it. A model whose group has not run still says `extraData`. A field the + generated response types is never parked in `extraData` behind a getter: it becomes a field on the model, as + the owning group's break, or stays out. `ChannelModel.hidden` and `User.name` are parked today, and groups 11 + and 09 promote them. `topLevelFields` and `Serializer` serve only the v1 decoders, which still split flat JSON + by a key list, and go with the WebSocket v2 move; a model that loses its JSON drops `topLevelFields` and its + converter owns the list. A v1 writer leaves a custom entry named like a key out so it cannot overwrite the key. ### Temporary adapters @@ -142,7 +164,9 @@ includes a named response that carries only `duration` today, such as `HideChann | --- | --- | --- | | `DeviceV1JsonConverter` | `OwnUser.devices` | [09](09-users.md) | | `userGroupsFromV1Json` | `Message.mentionedGroups` | [10](10-messages.md) | -| `DataSerializable` | `UserGroup`, `UserGroupMember` (`fromData`, `toData`) | [10](10-messages.md) | +| `DataSerializable` | `UserGroup`, `UserGroupMember`, `PollOption` (`fromData`, `toData`) | [10](10-messages.md) | +| `PollV1JsonConverter` | `Message.poll`, `DraftMessage.poll`, `Event.poll` | WebSocket v2 (no group) | +| `PollVoteV1JsonConverter` | `Event.pollVote` | WebSocket v2 (no group) | | `user_mapper.dart` (kept, re-pointed) | today's `User`, which still reads and writes JSON | [09](09-users.md) | How v1 JSON decodes `User` once it becomes a plain model is decided in [01-foundation](01-foundation.md): until @@ -162,11 +186,15 @@ surfaces before it reaches `Message` and `ChannelState`: - **08** is where we decide what *not* to expose: 34 generated operations against 10 hand-written methods. - **14** is `queryBannedUsers`, split out of 08 because it is the only moderation call that answers with a model. The `User` mappers it needs landed with group 04. -- **10–11** are the core of the SDK, and carry the `custom` / `extraData` promotion problem. +- **10–11** are the core of the SDK; 11 promotes the channel flags parked in `extraData` (rule 9). - **12** comes late because it needs its own hand-written multipart client and is the highest-traffic path in the SDK. - **09** is last. Every group before it maps users through `user_mapper.dart` onto today's `User`; 09 migrates the user endpoints and restructures `User` and `OwnUser` themselves, when every parent that embeds them has moved. +- **15** is the custom-data pass: every model's custom data is named `custom` and is the wire's `custom`, with no + mapper filtering it and no typed field parked in it. Each group renames the models it migrates (polls went + first); 15 renames whatever is left and the persistence columns, and runs after 09 and 11, which promote their + parked fields. ## Prerequisites diff --git a/openapi-migration/tool/generate_plan.py b/openapi-migration/tool/generate_plan.py index 151e2843f3..fdc87e02de 100644 --- a/openapi-migration/tool/generate_plan.py +++ b/openapi-migration/tool/generate_plan.py @@ -76,6 +76,8 @@ def match(path): hand-written, with the reason. - [ ] Public methods return `Future>`; no `getOrThrow()` inside the SDK. - [ ] Hand-written request/response DTOs for this group are deleted, or their retention is justified. + - [ ] `copywith_audit.py` was run for every model that loses a v10 `copyWith`, every site it reports is + handled, and the semantics change is in the CHANGELOG and the guide ([README rule 2](README.md#domain-models)). - [ ] `melos run analyze` clean, `melos run test:dart` green, persistence tests green if this group persists anything. - [ ] `migrations/v11-migration.md`: Symbol Map rows plus a feature section for every break. @@ -307,19 +309,77 @@ def match(path): ), dict( num='05', slug='polls', title='Polls', - hand=['polls_api.dart'], + hand=[], match=owns('/api/v2/polls', '/api/v2/chat/messages/{message_id}/polls'), goal='First group with real domain models and persistence behind it.', - decisions=[ - '`Poll`, `PollOption` and `PollVote` are public and persisted; adopting generated shapes means ' - 'touching `stream_chat_persistence` in the same PR.', - '`VotingVisibility` is ours; the generated equivalent is an inline per-operation enum.', - 'One generated `PollResponse` answers `createPoll`, `getPoll`, `updatePoll` and `updatePollPartial`, ' - 'where v10 has `CreatePollResponse`, `GetPollResponse` and `UpdatePollResponse`. The v10 envelopes ' - 'stay; decide with the user how the mapper names its conversions, since one `toModel()` cannot return ' - 'three types. `PollOptionResponse` (create, get, update an option) and `PollVoteResponse` (cast, remove ' - 'a vote) have the same shape.', - ], + decisions=[], + taken=textwrap.dedent("""\ + - **`Poll`, `PollOption` and `PollVote` keep their v10 names, fields and defaults,** as `@freezed` + classes with no JSON, mapped from `PollResponseData`, `PollOptionResponseData` and + `PollVoteResponseData` in `lib/src/repository/mapper/polls_mapper.dart`. The uuid default `id` and the + `DateTime.now()` timestamps stay; `PollVote.isAnswer` becomes a getter, and `latestVotes`, `ownVotes` and + `ownAnswers` stay `late final` caches. + - **Equality now includes `extraData`.** v10's `Equatable` props left it out of `Poll` and `PollOption`; + freezed compares every field, and so does `Message`, whose props include its poll. Accepted as a + behavioural break and flagged for review. + - **The eight v10 envelopes collapse to the three the server returns:** `PollResponse` (create, get, + update, partial update), `PollOptionResponse` (create, get, update an option) and `PollVoteResponse` + (cast, remove a vote), each with one `toModel()`. `QueryPollsResponse` and `QueryPollVotesResponse` + keep their names. A rename break beyond the [sanctioned ones](README.md#domain-models), approved for + this group and flagged for review. `PollVoteResponse.vote` is nullable, as the spec marks it. + - **The fields only the generated types carry stay out:** the `*_i18n` maps, `is_answer` (derived from + `answerText`) and `PollVoteResponse.poll`. Adding them is additive. The i18n keys are known fields + (`topLevelFields`), so neither the mapper nor the v1 decoder puts them in `extraData`, and a poll + compares equal whichever path delivered it. + - **Write methods keep taking `Poll` and `PollOption`.** The mapper sends only the writable settings; + the vote summary, `createdBy` and timestamps are not sent. Dedicated request types were considered + and rejected: the draft a caller builds must stay a `Poll`, because a message carries one. Flagged + for review. + - **Option ids are not sent on create.** `PollOptionInput` has none; the server assigns them and + rejects a client id as reserved (confirmed live: v10 answered 400). **`updatePoll` and + `updatePollOption` send an option without an id with an empty one** and return the server's failure; + the SDK does not pre-check a rule the backend owns. + - **`queryPolls` and `queryPollVotes` take `limit`, `next` and `prev`** instead of `PaginationParams`. + The generated requests carry only those, and the backend never read the offset or id/date cursors on + these queries. `limit` defaults to 10, `PaginationParams`' default, so an omitted limit pages as in + v10. The responses expose `prev`, so the parameter is usable. Flagged for review. + - **`VotingVisibility` becomes an extension type over its wire string,** following `PushProvider`. An + unknown value is kept rather than rejected, in the mapper, the v1 decoder and persistence. + - **An answer's `optionId` stays `""`,** as the server sends it and v10 decoded it. + - **`custom` is `extraData`, verbatim, in both directions** (README rule 9). The response mappers copy the + generated `custom` map as is and the request mappers send `extraData` as `custom`; an entry named like + one of the model's own fields is custom data on v2, where v10's flattened body let it set the field. + The v1 converters own the key lists that split the flat JSON on read (`Poll.topLevelFields` and + `PollOption.topLevelFields` are removed), and leave such an entry out on write so it cannot overwrite + a key. + - **Every public poll method returns a `Result`,** on `StreamChatClient` and `Channel`. `deletePoll` and + `deletePollOption` answer `DurationResponse` and return `Result`. `closePoll` stays a + `partialUpdatePoll` that sets `is_closed`. + - **`Channel.sendPoll` returns `Result`.** A `createPoll` failure passes through + and no message is sent; a `StreamException` thrown by `sendMessage` (still v1) is caught into a + `Failure`. + - **A missing option or vote id is a `Failure(StreamClientException)`, not an `ArgumentError`,** in + `Channel.castPollVote` and `removePollVote`, matching the migrated never-throws contract. + - **v1 JSON keeps decoding through hand-written converters** (`PollV1JsonConverter`, + `PollVoteV1JsonConverter`) on `Message.poll`, `DraftMessage.poll`, `Event.poll` and `Event.pollVote`. + The WebSocket is v1-only and sends custom data flat, with no `custom` key, so the generated + `fromJson` would throw on it; the converters mirror v10's `fromJson` and tolerate missing keys. + `Event` writes these fields too, so its converters run both ways. + - **`PollOption` gets the `@DataSerializable` codec** for `polls.options`. The stored format nests + custom data under `extra_data` where v10 flattened it, so `schemaVersion` is bumped. + - **`Poll`, `PollOption` and `PollVote` use freezed's `copyWith`.** The audit found one lib site + (`stream_message_preview_text.dart`, a `String?` passed for `name`) and one test per model; the + merging of poll events in `channel_state_mutations.dart` and `Poll.withTranslationsOf` passes no + argument that is null while the field is set, so it is unchanged. `null` now clears a nullable field + and re-applies the `id` and timestamp defaults, recorded as a break. + - **`extraData` is renamed `custom` on `Poll` and `PollOption`,** the wire's name, with no deprecated + alias; `StreamPollController.addOption` and `updateOption` and the `polls.custom` column follow. + Every migrated model takes the name from here on (README rule 9); [group 15](15-custom-data.md) + renames whatever no group migrates. + - **Verified live** against the demo app with a before/after harness covering every endpoint, the + error cases and the WebSocket events, and in the sample app on web. + """), + done=DONE.replace('- [ ]', '- [x]'), risks=[ 'Vote operations live under `/chat/messages/{message_id}/polls/...`, not `/polls` — easy to miss when ' 'grepping by path.', @@ -354,6 +414,9 @@ def match(path): 'because the two groups can otherwise disagree.', ], risks=[ + '`DraftMessage.poll` is never decoded from JSON: `poll` is not in `DraftMessage.topLevelFields`, so the key ' + 'would land in `extraData`, and the draft payload carries `poll_id` only. Its `PollV1JsonConverter` exists so ' + 'the generated code compiles. Decide here whether the field stays constructor-only or goes.', 'The four draft methods live in `message_api.dart`, not `threads_api.dart` — this group reaches into ' 'that file, and group 10 must leave those four alone.', '`Draft` and `DraftMessage` are public, persisted, and read by `StreamDraftListController` in ' @@ -509,9 +572,12 @@ def match(path): 'restructures them, last: the mappers in `user_mapper.dart` already map the generated types onto the ' 'current class for every group before it, and stay. See [01-foundation](01-foundation.md).', '`PrivacySettings` and the push-preference sub-shapes — decide per type.', - '`UserResponse.toModel()` leaves `OwnUser.topLevelFields`, `deleted_at`, `deactivated_at` and ' - '`revoke_tokens_issued_before` out of every user\'s `extraData` (`_shadowedCustomKeys`), where v1 kept the ' - '`OwnUser`-only keys in a plain user\'s `extraData`. Revisit once the mapper serves plain users.', + '**`User.name` and `image` become fields** (README rule 9): `UserResponse` types them, and the constructor ' + 'stops writing them into `extraData`; decide whether `name` keeps its fallback to `id`. `deleted_at`, ' + '`deactivated_at`, `revoke_tokens_issued_before` and `blocked_user_ids`, which `UserResponse` types and v1 ' + 'kept in a plain user\'s `extraData`, become fields or are dropped, never `extraData`. ' + '`UserResponse.toModel()` then copies `custom` verbatim into the field, renamed `custom`, and ' + '`UserRequestMapper` stops reading `extraData[\'name\']` and `[\'image\']`.', '`UserFilterField.shadowBanned` and `.bypassModeration` read `extraData`, which the generated ' '`UserResponse` has no field to fill.', '`updateUsers` reuses `User.toRequest()`. It is a full upsert, and v10\'s flattened body filed the ' @@ -529,12 +595,19 @@ def match(path): 'had to drop from `MuteUsersResponse`: the `mutes` the call created and the `ownUser` it left ' 'behind. Adding them is additive for anyone reading the response, so revisit them here rather ' 'than leaving them dropped for good.', + 'Until then, a user mapped from `UserResponse` and the same user decoded from v1 JSON carry different ' + '`extraData`: the v1 path keeps `blocked_user_ids`, `deleted_at`, `deactivated_at` and ' + '`revoke_tokens_issued_before`, the mapper drops them. Equality includes `extraData`, so a `Poll` from a ' + 'REST call (its `createdBy`, its votes\' `user`) and the same poll from an event compare unequal.', ], done=DONE + ( '- [ ] Temporary adapters owned by this group (`DeviceV1JsonConverter`) are deleted and removed from\n' ' the table in `README.md`.\n' '- [ ] `user_mapper.dart` maps onto the restructured `User`, and its `TODO(openapi-migration)` note is\n' ' gone.\n' + '- [ ] A user mapped from `UserResponse` and the same user decoded from v1 / WebSocket JSON compare equal.\n' + '- [ ] `user_mapper.dart` has no `_shadowedCustomKeys`: `User.custom` is the wire\'s `custom`, verbatim, and\n' + ' no typed field is written into it.\n' ), ), dict( @@ -575,13 +648,13 @@ def match(path): decisions=[ '`ChannelState`, `ChannelModel` and `Member` are public, persisted, and rebuilt from WebSocket ' 'events. Keep ours and map.', - '**Whether `ChannelModel` promotes its `extraData`-backed flags to real fields.** `disabled`, ' - '`hidden`, `muted`, `blocked` and `truncatedAt` all arrive as root fields on `ChannelResponse` but ' - 'are pushed into `extraData` and read back through getters, which the constructor comment calls ' - '"for backwards compatibility". Promoting them is a break worth making in v11 if it is made at ' - 'all, and it belongs with this group\'s model shape rather than with whichever phase happens to ' - 'add the next flag. Raised on ' - '[#2958](https://github.com/GetStream/stream-chat-flutter/pull/2958).', + '**`ChannelModel` promotes its `extraData`-backed flags to fields** (README rule 9). `disabled`, ' + '`hidden`, `muted`, `blocked` and `truncatedAt`, plus the keys the channel mapper parks today — ' + '`truncatedBy`, `muteExpiresAt`, `hideMessagesBefore`, `autoTranslationEnabled` and ' + '`autoTranslationLanguage` — become fields with persistence columns, and the constructor stops writing ' + 'them into the custom data, which is renamed `custom`. `name` and `image` stay in it: `ChannelResponse` ' + 'has no such fields. ' + 'Raised on [#2958](https://github.com/GetStream/stream-chat-flutter/pull/2958).', '`sync` returns `SyncResponse` — one of the two models that needed the WSEvent generator patch. ' 'Verify it decodes before relying on it.', ], @@ -590,7 +663,8 @@ def match(path): 'into that file.', '`queryChannels` drives the channel list controllers and the offline cache; a shape change here is ' 'felt everywhere.', - 'Channel `custom`/`extraData` promotion, same class of problem as messages.', + 'A consumer reading `channel.extraData[\'hidden\']` and friends loses the key once the flags are fields; ' + 'none in this repo.', 'Landing `ChannelResponse` -> `ChannelModel` is the last thing blocking ' '[08](08-moderation-and-blocklists.md)\'s `muteChannel`, which drops `channelMute`, `channelMutes` ' 'and `ownUser` because the generated `ChannelMute` carries a `ChannelResponse?` and a ' @@ -598,6 +672,10 @@ def match(path): 'Decide the null case there too — ours are non-nullable, the generated ones are not, the same ' 'question [14](14-banned-users.md) records for `BanResponse.user`.', ], + done=DONE + ( + '- [ ] `channel_mapper.dart` has no `_shadowedCustomKeys`: `ChannelModel.custom` is the wire\'s `custom`,\n' + ' verbatim, and no flag is written into it.\n' + ), ), dict( num='12', slug='uploads-cdn', title='Uploads (CDN)', @@ -699,6 +777,39 @@ def match(path): '`StreamChatApi.moderation` getter.', ], ), + dict( + num='15', slug='custom-data', title='Custom Data', + hand=[], + match=owns(), + goal='Every public model\'s custom data is named `custom` and is exactly the wire\'s `custom`.', + decisions=[ + '**Which models are left.** Each group renames the models it migrates, polls first; this pass renames ' + 'whatever remains, and the persistence `extra_data` columns with them.', + '**How to stage the remaining renames.** Polls did a hard rename; decide whether the widely used models ' + '(`Message`, `ChannelModel`, `User`) get a deprecated `extraData` alias for a release.', + '**What replaces `topLevelFields` and `Serializer`.** The v1 decoders still split flat JSON by a key ' + 'list until the WebSocket moves to v2. A model that loses its JSON drops `topLevelFields` and its ' + 'converter owns the list, as polls did; decide where `Serializer` goes once the last decoder does.', + ], + done=textwrap.dedent("""\ + - [ ] No mapper under `lib/src/repository/mapper/` filters `custom`: `grep -rn _shadowedCustomKeys` is empty. + - [ ] No model writes a typed field into `extraData`, and no getter reads a typed field out of it. + - [ ] No public model exposes `topLevelFields`; each v1 decoder owns its key list. + - [ ] Every public model names its custom data the same way, in the models, the mappers, the v1 + decoders and the persistence columns. + - [ ] `migrations/v11-migration.md`: Symbol Map rows plus a feature section. + - [ ] CHANGELOG entry under `🛑️ Breaking` for each break; PR title `refactor(llc)!:`. + - [ ] Decisions recorded in this file, and the status box ticked in `README.md`. + """), + risks=[ + '`Serializer`, the models\' `topLevelFields` and the persistence `extra_data` columns name the ' + 'concept too.', + 'A consumer reading `channel.extraData[\'hidden\']` or `user.extraData[\'name\']` loses the key; none in ' + 'this repo. Filter fields over custom keys (`UserFilterField.email`) are unaffected.', + 'Runs after groups 09 and 11 at the earliest, once `User` and `ChannelModel` promote their parked ' + 'fields.', + ], + ), ] diff --git a/packages/stream_chat/CHANGELOG.md b/packages/stream_chat/CHANGELOG.md index 35bbfb5d5e..a31e8f652a 100644 --- a/packages/stream_chat/CHANGELOG.md +++ b/packages/stream_chat/CHANGELOG.md @@ -78,6 +78,19 @@ - `AppSettings` and `UploadConfig` no longer extend `Equatable`, so `props` is removed; they still compare by value and gain `copyWith`. - `StreamChatApi.general.getAppSettings` is removed; call `StreamChatClient.getAppSettings` instead. - `StreamChatApi.guest` and `ConnectGuestUserResponse` are removed; call `StreamChatClient.connectGuestUser` instead. +- The poll calls on `StreamChatClient` and `Channel` return a `Result` instead of throwing. +- The eight poll response types are replaced by `PollResponse`, `PollOptionResponse` and `PollVoteResponse`. +- `queryPolls` and `queryPollVotes` take `limit` (10 when omitted) and `next` instead of `PaginationParams`. +- `Channel.castPollVote` and `removePollVote` return a failure instead of throwing an `ArgumentError` for an option or vote without an id. +- `VotingVisibility` is an extension type over its wire string instead of an enum. +- `Poll`, `PollOption`, `PollVote` and the poll responses no longer decode from or encode to JSON; `PollOption` gains `fromData` and `toData`, which read and write only the format `stream_chat_persistence` stores it in. +- The poll responses are immutable, built through a const constructor, and their `duration` is a non-nullable `String`; `PollVoteResponse.vote` is nullable. +- `Poll`, `PollOption` and `PollVote` no longer extend `Equatable`, so `props` is removed; they still compare by value, now including `custom`. +- `Poll.copyWith`, `PollOption.copyWith` and `PollVote.copyWith` set a nullable field passed as `null` to `null` instead of keeping its value, and give `Poll.id` and the `createdAt` and `updatedAt` timestamps a fresh default when passed `null`. +- `StreamChatApi.polls` is removed; its endpoints are reached through `StreamChatClient`. +- `Poll.topLevelFields` and `PollOption.topLevelFields` are removed. +- `Poll.extraData` and `PollOption.extraData` are renamed `custom`. +- `Poll.custom` and `PollOption.custom` hold the custom data exactly as the API returns it, and the poll and poll option requests send it back as custom data, so an entry named like one of the poll's or option's own fields no longer sets that field. - `sendImage`, `sendFile`, `uploadImage` and `uploadFile`, on `StreamChatClient`, `Channel` and `AttachmentFileUploader`, return a `Result` instead of throwing; read the URL from `fileUrl` and a video's thumbnail from `thumbUrl`. - `deleteImage`, `deleteFile`, `removeImage` and `removeFile` return a `Result` instead of throwing, and carry no value on success. - `SendAttachmentResponse`, `SendFileResponse`, `SendImageResponse`, `UploadImageResponse` and `UploadFileResponse` are removed in favor of `UploadedFile`. @@ -112,6 +125,7 @@ - Added optional `reason` and `custom` arguments to `flagMessage` and `flagUser`, recorded with the flag. - Added an optional `timeout` to `StreamChatClient.moderation.muteUser` that expires the mute. - Added `StreamChatClient.moderation.muteUsers` and `unmuteUsers`, which mute and unmute several users in one call and report the ids that matched no user. +- Added a `prev` argument to `queryPolls` and `queryPollVotes`, and a `prev` cursor on their responses, for paging backwards. 🔒 Security diff --git a/packages/stream_chat/lib/src/client/channel/channel.dart b/packages/stream_chat/lib/src/client/channel/channel.dart index 84f41d684c..62c7ac30dc 100644 --- a/packages/stream_chat/lib/src/client/channel/channel.dart +++ b/packages/stream_chat/lib/src/client/channel/channel.dart @@ -1429,44 +1429,63 @@ class Channel { final _pollLock = Lock(); - /// Send a message with a poll to this channel. + /// Creates [poll] and sends it to this channel in a new message. /// - /// Optionally provide a [messageText] to send a message along with the poll. - Future sendPoll( + /// The message carries [messageText] as its text, if given. + /// + /// If the poll cannot be created, no message is sent and the failure is + /// returned. If the message cannot be sent, the poll stays created and the + /// failure is returned. + Future> sendPoll( Poll poll, { String? messageText, }) async { _checkInitialized(); - final res = await _pollLock.synchronized(() => _client.createPoll(poll)); - return sendMessage( - Message( - text: messageText, - poll: res.poll, - pollId: res.poll.id, - ), - ); + final created = await _pollLock.synchronized(() => _client.createPoll(poll)); + return created.flatMapAsync((response) => _sendPollMessage(response.poll, messageText)); } - /// Updates the [poll] in this channel. - Future updatePoll(Poll poll) { + // TODO(openapi-migration): remove once sendMessage returns a Result + Future> _sendPollMessage(Poll poll, String? messageText) async { + try { + final message = Message(text: messageText, poll: poll, pollId: poll.id); + return Result.success(await sendMessage(message)); + } on StreamException catch (error, stackTrace) { + return Result.failure(error, stackTrace); + } catch (error, stackTrace) { + final exception = StreamClientException(message: 'Failed to send the poll message', cause: error); + return Result.failure(exception, stackTrace); + } + } + + /// Updates [poll] to match the settings and options it carries. + /// + /// [Poll.options] becomes the poll's full list of options, each matched by + /// its id, so an existing option missing from it is deleted. New options are + /// added through [createPollOption]. + /// + /// [Poll.enforceUniqueVote] is left as the poll was created. + Future> updatePoll(Poll poll) { _checkInitialized(); return _pollLock.synchronized(() => _client.updatePoll(poll)); } - /// Deletes the given [poll] from this channel. - Future deletePoll(Poll poll) { + /// Deletes [poll]. + Future> deletePoll(Poll poll) { _checkInitialized(); return _pollLock.synchronized(() => _client.deletePoll(poll.id)); } - /// Close the given [poll]. - Future closePoll(Poll poll) { + /// Closes [poll], so it accepts no more votes or answers. + Future> closePoll(Poll poll) { _checkInitialized(); return _pollLock.synchronized(() => _client.closePoll(poll.id)); } - /// Create a new poll option for the given [poll]. - Future createPollOption( + /// Adds [option] to [poll]. + /// + /// The option gets a new id, which the returned option carries. + Future> createPollOption( Poll poll, PollOption option, ) { @@ -1478,8 +1497,12 @@ class Channel { final _pollVoteLock = Lock(); - /// Cast a vote on the given [poll] with the given [option]. - Future castPollVote( + /// Votes for [option] of [poll], which was sent in [message]. + /// + /// If the poll allows only one vote per user, the vote replaces the previous + /// one. The [option] must carry its id; if it does not, the call returns a + /// failure without voting. + Future> castPollVote( Message message, Poll poll, PollOption option, @@ -1488,7 +1511,9 @@ class Channel { final optionId = option.id; if (optionId == null) { - throw ArgumentError('Option id cannot be null'); + return const Result.failure( + StreamClientException(message: 'The poll option has no id, so it cannot be voted for.'), + ); } return _pollVoteLock.synchronized( @@ -1500,8 +1525,10 @@ class Channel { ); } - /// Add a new answer to the given [poll]. - Future addPollAnswer( + /// Adds [answerText] as an answer to [poll], which was sent in [message]. + /// + /// Each user has one answer per poll; a new one replaces the previous one. + Future> addPollAnswer( Message message, Poll poll, { required String answerText, @@ -1516,17 +1543,20 @@ class Channel { ); } - /// Remove a vote on the given [poll] with the given [vote]. - Future removePollVote( + /// Removes [vote], a vote or answer on [poll], which was sent in [message]. + /// + /// The [vote] must carry its id; if it does not, the call returns a failure + /// without removing anything. + Future> removePollVote( Message message, Poll poll, PollVote vote, - ) { + ) async { _checkInitialized(); final voteId = vote.id; if (voteId == null) { - throw ArgumentError('Vote id cannot be null'); + return const Result.failure(StreamClientException(message: 'The poll vote has no id, so it cannot be removed.')); } return _pollVoteLock.synchronized( @@ -1538,20 +1568,29 @@ class Channel { ); } - /// Query the poll votes for the given [pollId] with the given [filter] and - /// [sort] options. - Future queryPollVotes( + /// Fetches one page of the votes and answers matching [filter] on the poll + /// with the id [pollId], ordered by [sort]. + /// + /// Up to [limit] votes are returned. The next page is fetched by passing a + /// response's [QueryPollVotesResponse.next] as [next], and the previous page + /// by passing its [QueryPollVotesResponse.prev] as [prev]. At most one of + /// [next] and [prev] may be given. + Future> queryPollVotes( String pollId, { PollVoteFilter? filter, List? sort, - PaginationParams pagination = const PaginationParams(), + int limit = 10, + String? next, + String? prev, }) { _checkInitialized(); return _client.queryPollVotes( pollId, filter: filter, sort: sort, - pagination: pagination, + limit: limit, + next: next, + prev: prev, ); } diff --git a/packages/stream_chat/lib/src/client/client.dart b/packages/stream_chat/lib/src/client/client.dart index c7085d23f4..ab60fc33b7 100644 --- a/packages/stream_chat/lib/src/client/client.dart +++ b/packages/stream_chat/lib/src/client/client.dart @@ -67,6 +67,11 @@ import '../core/models/response/get_user_group_response.dart'; import '../core/models/response/list_devices_response.dart'; import '../core/models/response/list_user_groups_response.dart'; import '../core/models/response/og_attachment_response.dart'; +import '../core/models/response/poll_option_response.dart'; +import '../core/models/response/poll_response.dart'; +import '../core/models/response/poll_vote_response.dart'; +import '../core/models/response/query_poll_votes_response.dart'; +import '../core/models/response/query_polls_response.dart'; import '../core/models/response/remove_user_group_members_response.dart'; import '../core/models/response/search_roles_response.dart'; import '../core/models/response/search_user_groups_response.dart'; @@ -84,6 +89,7 @@ import '../repository/app_settings_repository.dart'; import '../repository/devices_repository.dart'; import '../repository/general_repository.dart'; import '../repository/moderation_repository.dart'; +import '../repository/polls_repository.dart'; import '../repository/roles_repository.dart'; import '../repository/user_groups_repository.dart'; import '../ws/connect_request.dart'; @@ -187,6 +193,7 @@ class StreamChatClient { _rolesRepository = RolesRepository(api); _devicesRepository = DevicesRepository(api); _userGroupsRepository = UserGroupsRepository(api); + _pollsRepository = PollsRepository(api); _generalRepository = GeneralRepository(api); _moderationRepository = ModerationRepository(api); _appSettingsManager = AppSettingsManager(AppSettingsRepository(api)); @@ -230,6 +237,7 @@ class StreamChatClient { late final RolesRepository _rolesRepository; late final DevicesRepository _devicesRepository; late final UserGroupsRepository _userGroupsRepository; + late final PollsRepository _pollsRepository; late final GeneralRepository _generalRepository; late final ModerationRepository _moderationRepository; late final AppSettingsManager _appSettingsManager; @@ -1634,115 +1642,137 @@ class StreamChatClient { threadId, ); - /// Creates a new Poll - Future createPoll(Poll poll) => _chatApi.polls.createPoll(poll); + /// Creates [poll] with its settings and options. + /// + /// Any ids already set on the options are ignored; every option gets a new + /// one, which the returned poll carries. + /// + /// A poll is shown to the members of a channel once it is sent in a message; + /// [Channel.sendPoll] does both. + Future> createPoll(Poll poll) => _pollsRepository.createPoll(poll); - /// Retrieves a Poll by [pollId] - Future getPoll(String pollId) => _chatApi.polls.getPoll(pollId); + /// Fetches the poll with the id [pollId]. + Future> getPoll(String pollId) => _pollsRepository.getPoll(pollId); - /// Updates a Poll - Future updatePoll(Poll poll) => _chatApi.polls.updatePoll(poll); + /// Updates [poll] to match the settings and options it carries. + /// + /// [Poll.options] becomes the poll's full list of options, each matched by + /// its id, so an existing option missing from it is deleted. New options are + /// added through [createPollOption]. + /// + /// [Poll.enforceUniqueVote] is left as the poll was created. + Future> updatePoll(Poll poll) => _pollsRepository.updatePoll(poll); - /// Partially updates a Poll by [pollId]. + /// Changes some of the settings of the poll with the id [pollId], leaving the + /// others as they are. /// - /// Use [set] to define values to be set. - /// Use [unset] to define values to be unset. - Future partialUpdatePoll( + /// Only [Poll.name], [Poll.description], [Poll.votingVisibility], + /// [Poll.maxVotesAllowed], [Poll.allowAnswers] and [Poll.isClosed] can be + /// changed through [set]. Any other key, including those of the other + /// settings, is stored in the poll's custom data. + /// + /// The keys named in [unset] are removed from the custom data only. To remove + /// the vote limit, set it to null instead. + Future> partialUpdatePoll( String pollId, { Map? set, List? unset, - }) => _chatApi.polls.partialUpdatePoll( - pollId, - set: set, - unset: unset, - ); + }) => _pollsRepository.partialUpdatePoll(pollId, set: set, unset: unset); - /// Deletes the Poll by [pollId]. - Future deletePoll(String pollId) => _chatApi.polls.deletePoll(pollId); + /// Deletes the poll with the id [pollId]. + Future> deletePoll(String pollId) => _pollsRepository.deletePoll(pollId); - /// Marks the Poll [pollId] as closed. - Future closePoll(String pollId) => partialUpdatePoll( - pollId, - set: { - 'is_closed': true, - }, - ); + /// Closes the poll with the id [pollId], so it accepts no more votes or + /// answers. + Future> closePoll(String pollId) => partialUpdatePoll(pollId, set: {'is_closed': true}); - /// Creates a new Poll Option for the Poll [pollId]. - Future createPollOption( + /// Adds [option] to the poll with the id [pollId]. + /// + /// The option gets a new id, which the returned option carries. + Future> createPollOption( String pollId, PollOption option, - ) => _chatApi.polls.createPollOption(pollId, option); + ) => _pollsRepository.createPollOption(pollId, option); - /// Retrieves a Poll Option by [optionId] for the Poll [pollId]. - Future getPollOption( + /// Fetches an option of a poll, identified by [optionId] and [pollId]. + Future> getPollOption( String pollId, String optionId, - ) => _chatApi.polls.getPollOption(pollId, optionId); + ) => _pollsRepository.getPollOption(pollId, optionId); - /// Updates a Poll Option for the Poll [pollId]. - Future updatePollOption( + /// Replaces the text and custom data of [option], an existing option of the + /// poll with the id [pollId]. + /// + /// The [option] is found by its id. + Future> updatePollOption( String pollId, PollOption option, - ) => _chatApi.polls.updatePollOption(pollId, option); + ) => _pollsRepository.updatePollOption(pollId, option); - /// Deletes a Poll Option by [optionId] for the Poll [pollId]. - Future deletePollOption( + /// Removes an option from a poll, identified by [optionId] and [pollId]. + Future> deletePollOption( String pollId, String optionId, - ) => _chatApi.polls.deletePollOption(pollId, optionId); + ) => _pollsRepository.deletePollOption(pollId, optionId); - /// Cast a [vote] for the Poll [pollId]. - Future castPollVote( + /// Votes for an option of a poll sent in a message, identified by [optionId], + /// [pollId] and [messageId]. + /// + /// If the poll allows only one vote per user, the vote replaces the previous + /// one. + Future> castPollVote( String messageId, String pollId, { required String optionId, - }) { - final vote = PollVote(optionId: optionId); - return _chatApi.polls.castPollVote(messageId, pollId, vote); - } + }) => _pollsRepository.castPollVote(messageId, pollId, optionId: optionId); - /// Adds a answer with [answerText] for the Poll [pollId]. - Future addPollAnswer( + /// Adds [answerText] as an answer to a poll sent in a message, identified by + /// [pollId] and [messageId]. + /// + /// Each user has one answer per poll; a new one replaces the previous one. + Future> addPollAnswer( String messageId, String pollId, { required String answerText, - }) { - final vote = PollVote(answerText: answerText); - return _chatApi.polls.castPollVote(messageId, pollId, vote); - } + }) => _pollsRepository.addPollAnswer(messageId, pollId, answerText: answerText); - /// Removes a vote by [voteId] for the Poll [pollId]. - Future removePollVote( + /// Removes a vote or answer from a poll sent in a message, identified by + /// [voteId], [pollId] and [messageId]. + Future> removePollVote( String messageId, String pollId, String voteId, - ) => _chatApi.polls.removePollVote(messageId, pollId, voteId); + ) => _pollsRepository.removePollVote(messageId, pollId, voteId); - /// Queries Polls with the given [filter] and [sort] options. - Future queryPolls({ + /// Fetches one page of the polls matching [filter], ordered by [sort]. + /// + /// Up to [limit] polls are returned. The next page is fetched by passing a + /// response's [QueryPollsResponse.next] as [next], and the previous page by + /// passing its [QueryPollsResponse.prev] as [prev]. At most one of [next] and + /// [prev] may be given. + Future> queryPolls({ PollFilter? filter, List? sort, - PaginationParams pagination = const PaginationParams(), - }) => _chatApi.polls.queryPolls( - filter: filter, - sort: sort, - pagination: pagination, - ); - - /// Queries Poll Votes for the Poll [pollId] with the given [filter] - /// and [sort] options. - Future queryPollVotes( + int limit = 10, + String? next, + String? prev, + }) => _pollsRepository.queryPolls(filter: filter, sort: sort, limit: limit, next: next, prev: prev); + + /// Fetches one page of the votes and answers matching [filter] on the poll + /// with the id [pollId], ordered by [sort]. + /// + /// Up to [limit] votes are returned. The next page is fetched by passing a + /// response's [QueryPollVotesResponse.next] as [next], and the previous page + /// by passing its [QueryPollVotesResponse.prev] as [prev]. At most one of + /// [next] and [prev] may be given. + Future> queryPollVotes( String pollId, { PollVoteFilter? filter, List? sort, - PaginationParams pagination = const PaginationParams(), - }) => _chatApi.polls.queryPollVotes( - pollId, - filter: filter, - sort: sort, - pagination: pagination, - ); + int limit = 10, + String? next, + String? prev, + }) => _pollsRepository.queryPollVotes(pollId, filter: filter, sort: sort, limit: limit, next: next, prev: prev); /// Update or Create the given user object. Future updateUser(User user) => updateUsers([user]); diff --git a/packages/stream_chat/lib/src/core/api/polls_api.dart b/packages/stream_chat/lib/src/core/api/polls_api.dart deleted file mode 100644 index edb6059d6f..0000000000 --- a/packages/stream_chat/lib/src/core/api/polls_api.dart +++ /dev/null @@ -1,197 +0,0 @@ -import 'dart:convert'; - -import '../http/stream_http_client.dart'; -import '../models/poll.dart'; -import '../models/poll_option.dart'; -import '../models/poll_vote.dart'; -import 'requests.dart'; -import 'responses.dart'; - -/// Defines the api dedicated to polls operations -class PollsApi { - /// Initialize a new polls api - const PollsApi(this._client); - - final StreamHttpClient _client; - - /// Creates a new poll with the given [poll] data. - Future createPoll( - Poll poll, - ) async { - final response = await _client.post( - '/polls', - data: jsonEncode(poll), - ); - - return CreatePollResponse.fromJson(response.data); - } - - /// Retrieves a poll by its [id]. - Future getPoll( - String id, - ) async { - final response = await _client.get( - '/polls/$id', - ); - - return GetPollResponse.fromJson(response.data); - } - - /// Updates the poll with the given [poll] data. - Future updatePoll( - Poll poll, - ) async { - final response = await _client.put( - '/polls', - data: jsonEncode(poll), - ); - - return UpdatePollResponse.fromJson(response.data); - } - - /// Partially updates the poll with the given [id]. - /// - /// The [set] and [unset] parameters are used to update the poll. - Future partialUpdatePoll( - String id, { - Map? set, - List? unset, - }) async { - final response = await _client.patch( - '/polls/$id', - data: jsonEncode({ - if (set != null) 'set': set, - if (unset != null) 'unset': unset, - }), - ); - - return UpdatePollResponse.fromJson(response.data); - } - - /// Deletes the poll with the given [id]. - Future deletePoll(String id) async { - final response = await _client.delete( - '/polls/$id', - ); - - return EmptyResponse.fromJson(response.data); - } - - /// Creates a new poll option with the given [option] data. - Future createPollOption( - String pollId, - PollOption option, - ) async { - final response = await _client.post( - '/polls/$pollId/options', - data: jsonEncode(option), - ); - - return CreatePollOptionResponse.fromJson(response.data); - } - - /// Retrieves a poll option by its [optionId]. - Future getPollOption( - String pollId, - String optionId, - ) async { - final response = await _client.get( - '/polls/$pollId/options/$optionId', - ); - - return GetPollOptionResponse.fromJson(response.data); - } - - /// Updates the poll option with the given [option] data. - Future updatePollOption( - String pollId, - PollOption option, - ) async { - final response = await _client.put( - '/polls/$pollId/options', - data: jsonEncode(option), - ); - - return UpdatePollOptionResponse.fromJson(response.data); - } - - /// Removes the poll option with the given [optionId]. - Future deletePollOption( - String pollId, - String optionId, - ) async { - final response = await _client.delete( - '/polls/$pollId/options/$optionId', - ); - - return EmptyResponse.fromJson(response.data); - } - - /// Casts a vote on the poll with the given [pollId] and [vote] data. - Future castPollVote( - String messageId, - String pollId, - PollVote vote, - ) async { - final response = await _client.post( - '/messages/$messageId/polls/$pollId/vote', - data: jsonEncode({ - 'vote': vote, - }), - ); - - return CastPollVoteResponse.fromJson(response.data); - } - - /// Removes the vote with the given [voteId] from the poll with the - /// given [pollId]. - Future removePollVote( - String messageId, - String pollId, - String voteId, - ) async { - final response = await _client.delete( - '/messages/$messageId/polls/$pollId/vote/$voteId', - ); - - return RemovePollVoteResponse.fromJson(response.data); - } - - /// Queries polls with the given [filter], [sort], and [pagination] - /// parameters. - Future queryPolls({ - PollFilter? filter, - List? sort, - PaginationParams pagination = const PaginationParams(), - }) async { - final response = await _client.post( - '/polls/query', - data: jsonEncode({ - if (filter != null) 'filter': filter.toJson(), - if (sort != null) 'sort': sort.map((e) => e.toJson()).toList(), - ...pagination.toJson(), - }), - ); - - return QueryPollsResponse.fromJson(response.data); - } - - /// Queries poll votes with the given [pollId], [filter], [sort], and - Future queryPollVotes( - String pollId, { - PollVoteFilter? filter, - List? sort, - PaginationParams pagination = const PaginationParams(), - }) async { - final response = await _client.post( - '/polls/$pollId/votes', - data: jsonEncode({ - if (filter != null) 'filter': filter.toJson(), - if (sort != null) 'sort': sort.map((e) => e.toJson()).toList(), - ...pagination.toJson(), - }), - ); - - return QueryPollVotesResponse.fromJson(response.data); - } -} diff --git a/packages/stream_chat/lib/src/core/api/responses.dart b/packages/stream_chat/lib/src/core/api/responses.dart index f288c9cf9f..5e11c26205 100644 --- a/packages/stream_chat/lib/src/core/api/responses.dart +++ b/packages/stream_chat/lib/src/core/api/responses.dart @@ -9,9 +9,6 @@ import '../models/location.dart'; import '../models/member.dart'; import '../models/message.dart'; import '../models/message_reminder.dart'; -import '../models/poll.dart'; -import '../models/poll_option.dart'; -import '../models/poll_vote.dart'; import '../models/predefined_filter.dart'; import '../models/push_preference.dart'; import '../models/reaction.dart'; @@ -436,114 +433,6 @@ class BlockedUsersResponse extends _BaseResponse { static BlockedUsersResponse fromJson(Map json) => _$BlockedUsersResponseFromJson(json); } -/// Model response for [StreamChatClient.createPoll] api call -@JsonSerializable(createToJson: false) -class CreatePollResponse extends _BaseResponse { - /// Created poll - late Poll poll; - - /// Create a new instance from a json - static CreatePollResponse fromJson(Map json) => _$CreatePollResponseFromJson(json); -} - -/// Model response for [StreamChatClient.getPoll] api call -@JsonSerializable(createToJson: false) -class GetPollResponse extends _BaseResponse { - /// Fetched poll - late Poll poll; - - /// Create a new instance from a json - static GetPollResponse fromJson(Map json) => _$GetPollResponseFromJson(json); -} - -/// Model response for [StreamChatClient.updatePoll] api call -@JsonSerializable(createToJson: false) -class UpdatePollResponse extends _BaseResponse { - /// Updated poll - late Poll poll; - - /// Create a new instance from a json - static UpdatePollResponse fromJson(Map json) => _$UpdatePollResponseFromJson(json); -} - -/// Model response for [StreamChatClient.createPollOption] api call -@JsonSerializable(createToJson: false) -class CreatePollOptionResponse extends _BaseResponse { - /// Created poll option - late PollOption pollOption; - - /// Create a new instance from a json - static CreatePollOptionResponse fromJson(Map json) => _$CreatePollOptionResponseFromJson(json); -} - -/// Model response for [StreamChatClient.getPollOption] api call -@JsonSerializable(createToJson: false) -class GetPollOptionResponse extends _BaseResponse { - /// Fetched poll option - late PollOption pollOption; - - /// Create a new instance from a json - static GetPollOptionResponse fromJson(Map json) => _$GetPollOptionResponseFromJson(json); -} - -/// Model response for [StreamChatClient.updatePollOption] api call -@JsonSerializable(createToJson: false) -class UpdatePollOptionResponse extends _BaseResponse { - /// Updated poll option - late PollOption pollOption; - - /// Create a new instance from a json - static UpdatePollOptionResponse fromJson(Map json) => _$UpdatePollOptionResponseFromJson(json); -} - -/// Model response for [StreamChatClient.castPollVote] api call -@JsonSerializable(createToJson: false) -class CastPollVoteResponse extends _BaseResponse { - /// Casted vote - late PollVote vote; - - /// Create a new instance from a json - static CastPollVoteResponse fromJson(Map json) => _$CastPollVoteResponseFromJson(json); -} - -/// Model response for [StreamChatClient.removePollVote] api call -@JsonSerializable(createToJson: false) -class RemovePollVoteResponse extends EmptyResponse { - /// Deleted vote - late PollVote vote; - - /// Create a new instance from a json - static RemovePollVoteResponse fromJson(Map json) => _$RemovePollVoteResponseFromJson(json); -} - -/// Model response for [StreamChatClient.queryPolls] api call -@JsonSerializable(createToJson: false) -class QueryPollsResponse extends _BaseResponse { - /// List of polls returned by the query - @JsonKey(defaultValue: []) - late List polls; - - /// Poll id of where to start searching from for next [results] - late String? next; - - /// Create a new instance from a json - static QueryPollsResponse fromJson(Map json) => _$QueryPollsResponseFromJson(json); -} - -/// Model response for [StreamChatClient.queryPollVotes] api call -@JsonSerializable(createToJson: false) -class QueryPollVotesResponse extends _BaseResponse { - /// List of poll votes returned by the query - @JsonKey(defaultValue: []) - late List votes; - - /// Poll vote id of where to start searching from for next [results] - late String? next; - - /// Create a new instance from a json - static QueryPollVotesResponse fromJson(Map json) => _$QueryPollVotesResponseFromJson(json); -} - /// Model response for [StreamChatClient.getThread] api call @JsonSerializable(createToJson: false) class GetThreadResponse extends _BaseResponse { diff --git a/packages/stream_chat/lib/src/core/api/responses.g.dart b/packages/stream_chat/lib/src/core/api/responses.g.dart index f7d5e36ba1..1bf1e36e76 100644 --- a/packages/stream_chat/lib/src/core/api/responses.g.dart +++ b/packages/stream_chat/lib/src/core/api/responses.g.dart @@ -25,67 +25,48 @@ SyncResponse _$SyncResponseFromJson(Map json) => SyncResponse() ..duration = json['duration'] as String? ..events = (json['events'] as List?)?.map((e) => Event.fromJson(e as Map)).toList() ?? []; -QueryChannelsResponse _$QueryChannelsResponseFromJson( - Map json, -) => QueryChannelsResponse() +QueryChannelsResponse _$QueryChannelsResponseFromJson(Map json) => QueryChannelsResponse() ..duration = json['duration'] as String? ..channels = (json['channels'] as List?)?.map((e) => ChannelState.fromJson(e as Map)).toList() ?? [] ..predefinedFilter = json['predefined_filter'] == null ? null - : PredefinedFilter.fromJson( - json['predefined_filter'] as Map, - ); + : PredefinedFilter.fromJson(json['predefined_filter'] as Map); -TranslateMessageResponse _$TranslateMessageResponseFromJson( - Map json, -) => TranslateMessageResponse() +TranslateMessageResponse _$TranslateMessageResponseFromJson(Map json) => TranslateMessageResponse() ..duration = json['duration'] as String? ..message = Message.fromJson(json['message'] as Map); -QueryMembersResponse _$QueryMembersResponseFromJson( - Map json, -) => QueryMembersResponse() +QueryMembersResponse _$QueryMembersResponseFromJson(Map json) => QueryMembersResponse() ..duration = json['duration'] as String? ..members = (json['members'] as List?)?.map((e) => Member.fromJson(e as Map)).toList() ?? []; -PartialUpdateMemberResponse _$PartialUpdateMemberResponseFromJson( - Map json, -) => PartialUpdateMemberResponse() - ..duration = json['duration'] as String? - ..channelMember = Member.fromJson( - json['channel_member'] as Map, - ); +PartialUpdateMemberResponse _$PartialUpdateMemberResponseFromJson(Map json) => + PartialUpdateMemberResponse() + ..duration = json['duration'] as String? + ..channelMember = Member.fromJson(json['channel_member'] as Map); QueryUsersResponse _$QueryUsersResponseFromJson(Map json) => QueryUsersResponse() ..duration = json['duration'] as String? ..users = (json['users'] as List?)?.map((e) => User.fromJson(e as Map)).toList() ?? []; -QueryBannedUsersResponse _$QueryBannedUsersResponseFromJson( - Map json, -) => QueryBannedUsersResponse() +QueryBannedUsersResponse _$QueryBannedUsersResponseFromJson(Map json) => QueryBannedUsersResponse() ..duration = json['duration'] as String? ..bans = (json['bans'] as List?)?.map((e) => BannedUser.fromJson(e as Map)).toList() ?? []; -QueryReactionsResponse _$QueryReactionsResponseFromJson( - Map json, -) => QueryReactionsResponse() +QueryReactionsResponse _$QueryReactionsResponseFromJson(Map json) => QueryReactionsResponse() ..duration = json['duration'] as String? ..reactions = (json['reactions'] as List?)?.map((e) => Reaction.fromJson(e as Map)).toList() ?? [] ..next = json['next'] as String?; -QueryRepliesResponse _$QueryRepliesResponseFromJson( - Map json, -) => QueryRepliesResponse() +QueryRepliesResponse _$QueryRepliesResponseFromJson(Map json) => QueryRepliesResponse() ..duration = json['duration'] as String? ..messages = (json['messages'] as List?)?.map((e) => Message.fromJson(e as Map)).toList() ?? []; -SendReactionResponse _$SendReactionResponseFromJson( - Map json, -) => SendReactionResponse() +SendReactionResponse _$SendReactionResponseFromJson(Map json) => SendReactionResponse() ..duration = json['duration'] as String? ..message = Message.fromJson(json['message'] as Map) ..reaction = Reaction.fromJson(json['reaction'] as Map); @@ -93,14 +74,10 @@ SendReactionResponse _$SendReactionResponseFromJson( UpdateUsersResponse _$UpdateUsersResponseFromJson(Map json) => UpdateUsersResponse() ..duration = json['duration'] as String? ..users = - (json['users'] as Map?)?.map( - (k, e) => MapEntry(k, User.fromJson(e as Map)), - ) ?? + (json['users'] as Map?)?.map((k, e) => MapEntry(k, User.fromJson(e as Map))) ?? {}; -UpdateMessageResponse _$UpdateMessageResponseFromJson( - Map json, -) => UpdateMessageResponse() +UpdateMessageResponse _$UpdateMessageResponseFromJson(Map json) => UpdateMessageResponse() ..duration = json['duration'] as String? ..message = Message.fromJson(json['message'] as Map); @@ -113,9 +90,7 @@ GetMessageResponse _$GetMessageResponseFromJson(Map json) => Ge ..message = Message.fromJson(json['message'] as Map) ..channel = json['channel'] == null ? null : ChannelModel.fromJson(json['channel'] as Map); -SearchMessagesResponse _$SearchMessagesResponseFromJson( - Map json, -) => SearchMessagesResponse() +SearchMessagesResponse _$SearchMessagesResponseFromJson(Map json) => SearchMessagesResponse() ..duration = json['duration'] as String? ..results = (json['results'] as List?) @@ -125,39 +100,30 @@ SearchMessagesResponse _$SearchMessagesResponseFromJson( ..next = json['next'] as String? ..previous = json['previous'] as String?; -GetMessagesByIdResponse _$GetMessagesByIdResponseFromJson( - Map json, -) => GetMessagesByIdResponse() +GetMessagesByIdResponse _$GetMessagesByIdResponseFromJson(Map json) => GetMessagesByIdResponse() ..duration = json['duration'] as String? ..messages = (json['messages'] as List?)?.map((e) => Message.fromJson(e as Map)).toList() ?? []; -UpdateChannelResponse _$UpdateChannelResponseFromJson( - Map json, -) => UpdateChannelResponse() +UpdateChannelResponse _$UpdateChannelResponseFromJson(Map json) => UpdateChannelResponse() ..duration = json['duration'] as String? ..channel = ChannelModel.fromJson(json['channel'] as Map) ..members = (json['members'] as List?)?.map((e) => Member.fromJson(e as Map)).toList() ..message = json['message'] == null ? null : Message.fromJson(json['message'] as Map); -PartialUpdateChannelResponse _$PartialUpdateChannelResponseFromJson( - Map json, -) => PartialUpdateChannelResponse() - ..duration = json['duration'] as String? - ..channel = ChannelModel.fromJson(json['channel'] as Map) - ..members = (json['members'] as List?)?.map((e) => Member.fromJson(e as Map)).toList(); +PartialUpdateChannelResponse _$PartialUpdateChannelResponseFromJson(Map json) => + PartialUpdateChannelResponse() + ..duration = json['duration'] as String? + ..channel = ChannelModel.fromJson(json['channel'] as Map) + ..members = (json['members'] as List?)?.map((e) => Member.fromJson(e as Map)).toList(); -InviteMembersResponse _$InviteMembersResponseFromJson( - Map json, -) => InviteMembersResponse() +InviteMembersResponse _$InviteMembersResponseFromJson(Map json) => InviteMembersResponse() ..duration = json['duration'] as String? ..channel = ChannelModel.fromJson(json['channel'] as Map) ..members = (json['members'] as List?)?.map((e) => Member.fromJson(e as Map)).toList() ?? [] ..message = json['message'] == null ? null : Message.fromJson(json['message'] as Map); -RemoveMembersResponse _$RemoveMembersResponseFromJson( - Map json, -) => RemoveMembersResponse() +RemoveMembersResponse _$RemoveMembersResponseFromJson(Map json) => RemoveMembersResponse() ..duration = json['duration'] as String? ..channel = ChannelModel.fromJson(json['channel'] as Map) ..members = (json['members'] as List?)?.map((e) => Member.fromJson(e as Map)).toList() ?? [] @@ -173,17 +139,13 @@ AddMembersResponse _$AddMembersResponseFromJson(Map json) => Ad ..members = (json['members'] as List?)?.map((e) => Member.fromJson(e as Map)).toList() ?? [] ..message = json['message'] == null ? null : Message.fromJson(json['message'] as Map); -AcceptInviteResponse _$AcceptInviteResponseFromJson( - Map json, -) => AcceptInviteResponse() +AcceptInviteResponse _$AcceptInviteResponseFromJson(Map json) => AcceptInviteResponse() ..duration = json['duration'] as String? ..channel = ChannelModel.fromJson(json['channel'] as Map) ..members = (json['members'] as List?)?.map((e) => Member.fromJson(e as Map)).toList() ?? [] ..message = json['message'] == null ? null : Message.fromJson(json['message'] as Map); -RejectInviteResponse _$RejectInviteResponseFromJson( - Map json, -) => RejectInviteResponse() +RejectInviteResponse _$RejectInviteResponseFromJson(Map json) => RejectInviteResponse() ..duration = json['duration'] as String? ..channel = ChannelModel.fromJson(json['channel'] as Map) ..members = (json['members'] as List?)?.map((e) => Member.fromJson(e as Map)).toList() ?? [] @@ -192,9 +154,7 @@ RejectInviteResponse _$RejectInviteResponseFromJson( EmptyResponse _$EmptyResponseFromJson(Map json) => EmptyResponse()..duration = json['duration'] as String?; -ChannelStateResponse _$ChannelStateResponseFromJson( - Map json, -) => ChannelStateResponse() +ChannelStateResponse _$ChannelStateResponseFromJson(Map json) => ChannelStateResponse() ..duration = json['duration'] as String? ..channel = ChannelModel.fromJson(json['channel'] as Map) ..messages = @@ -209,86 +169,20 @@ UserBlockResponse _$UserBlockResponseFromJson(Map json) => User ..blockedUserId = json['blocked_user_id'] as String? ?? '' ..createdAt = DateTime.parse(json['created_at'] as String); -BlockedUsersResponse _$BlockedUsersResponseFromJson( - Map json, -) => BlockedUsersResponse() +BlockedUsersResponse _$BlockedUsersResponseFromJson(Map json) => BlockedUsersResponse() ..duration = json['duration'] as String? ..blocks = (json['blocks'] as List?)?.map((e) => UserBlock.fromJson(e as Map)).toList() ?? []; -CreatePollResponse _$CreatePollResponseFromJson(Map json) => CreatePollResponse() - ..duration = json['duration'] as String? - ..poll = Poll.fromJson(json['poll'] as Map); - -GetPollResponse _$GetPollResponseFromJson(Map json) => GetPollResponse() - ..duration = json['duration'] as String? - ..poll = Poll.fromJson(json['poll'] as Map); - -UpdatePollResponse _$UpdatePollResponseFromJson(Map json) => UpdatePollResponse() - ..duration = json['duration'] as String? - ..poll = Poll.fromJson(json['poll'] as Map); - -CreatePollOptionResponse _$CreatePollOptionResponseFromJson( - Map json, -) => CreatePollOptionResponse() - ..duration = json['duration'] as String? - ..pollOption = PollOption.fromJson( - json['poll_option'] as Map, - ); - -GetPollOptionResponse _$GetPollOptionResponseFromJson( - Map json, -) => GetPollOptionResponse() - ..duration = json['duration'] as String? - ..pollOption = PollOption.fromJson( - json['poll_option'] as Map, - ); - -UpdatePollOptionResponse _$UpdatePollOptionResponseFromJson( - Map json, -) => UpdatePollOptionResponse() - ..duration = json['duration'] as String? - ..pollOption = PollOption.fromJson( - json['poll_option'] as Map, - ); - -CastPollVoteResponse _$CastPollVoteResponseFromJson( - Map json, -) => CastPollVoteResponse() - ..duration = json['duration'] as String? - ..vote = PollVote.fromJson(json['vote'] as Map); - -RemovePollVoteResponse _$RemovePollVoteResponseFromJson( - Map json, -) => RemovePollVoteResponse() - ..duration = json['duration'] as String? - ..vote = PollVote.fromJson(json['vote'] as Map); - -QueryPollsResponse _$QueryPollsResponseFromJson(Map json) => QueryPollsResponse() - ..duration = json['duration'] as String? - ..polls = (json['polls'] as List?)?.map((e) => Poll.fromJson(e as Map)).toList() ?? [] - ..next = json['next'] as String?; - -QueryPollVotesResponse _$QueryPollVotesResponseFromJson( - Map json, -) => QueryPollVotesResponse() - ..duration = json['duration'] as String? - ..votes = (json['votes'] as List?)?.map((e) => PollVote.fromJson(e as Map)).toList() ?? [] - ..next = json['next'] as String?; - GetThreadResponse _$GetThreadResponseFromJson(Map json) => GetThreadResponse() ..duration = json['duration'] as String? ..thread = Thread.fromJson(json['thread'] as Map); -UpdateThreadResponse _$UpdateThreadResponseFromJson( - Map json, -) => UpdateThreadResponse() +UpdateThreadResponse _$UpdateThreadResponseFromJson(Map json) => UpdateThreadResponse() ..duration = json['duration'] as String? ..thread = Thread.fromJson(json['thread'] as Map); -QueryThreadsResponse _$QueryThreadsResponseFromJson( - Map json, -) => QueryThreadsResponse() +QueryThreadsResponse _$QueryThreadsResponseFromJson(Map json) => QueryThreadsResponse() ..duration = json['duration'] as String? ..threads = (json['threads'] as List?)?.map((e) => Thread.fromJson(e as Map)).toList() ?? [] ..next = json['next'] as String?; @@ -306,34 +200,22 @@ QueryDraftsResponse _$QueryDraftsResponseFromJson(Map json) => ..drafts = (json['drafts'] as List?)?.map((e) => Draft.fromJson(e as Map)).toList() ?? [] ..next = json['next'] as String?; -CreateReminderResponse _$CreateReminderResponseFromJson( - Map json, -) => CreateReminderResponse() +CreateReminderResponse _$CreateReminderResponseFromJson(Map json) => CreateReminderResponse() ..duration = json['duration'] as String? - ..reminder = MessageReminder.fromJson( - json['reminder'] as Map, - ); + ..reminder = MessageReminder.fromJson(json['reminder'] as Map); -UpdateReminderResponse _$UpdateReminderResponseFromJson( - Map json, -) => UpdateReminderResponse() +UpdateReminderResponse _$UpdateReminderResponseFromJson(Map json) => UpdateReminderResponse() ..duration = json['duration'] as String? - ..reminder = MessageReminder.fromJson( - json['reminder'] as Map, - ); + ..reminder = MessageReminder.fromJson(json['reminder'] as Map); -QueryRemindersResponse _$QueryRemindersResponseFromJson( - Map json, -) => QueryRemindersResponse() +QueryRemindersResponse _$QueryRemindersResponseFromJson(Map json) => QueryRemindersResponse() ..duration = json['duration'] as String? ..reminders = (json['reminders'] as List?)?.map((e) => MessageReminder.fromJson(e as Map)).toList() ?? [] ..next = json['next'] as String?; -GetUnreadCountResponse _$GetUnreadCountResponseFromJson( - Map json, -) => GetUnreadCountResponse() +GetUnreadCountResponse _$GetUnreadCountResponseFromJson(Map json) => GetUnreadCountResponse() ..duration = json['duration'] as String? ..totalUnreadCount = (json['total_unread_count'] as num).toInt() ..totalUnreadThreadsCount = (json['total_unread_threads_count'] as num).toInt() @@ -350,31 +232,24 @@ GetUnreadCountResponse _$GetUnreadCountResponseFromJson( .map((e) => UnreadCountsThread.fromJson(e as Map)) .toList(); -UpsertPushPreferencesResponse _$UpsertPushPreferencesResponseFromJson( - Map json, -) => UpsertPushPreferencesResponse() - ..duration = json['duration'] as String? - ..userPreferences = _userPreferencesFromJson( - json['user_preferences'] as Map?, - ) - ..userChannelPreferences = - (json['user_channel_preferences'] as Map?)?.map( - (k, e) => MapEntry( - k, - (e as Map).map( +UpsertPushPreferencesResponse _$UpsertPushPreferencesResponseFromJson(Map json) => + UpsertPushPreferencesResponse() + ..duration = json['duration'] as String? + ..userPreferences = _userPreferencesFromJson(json['user_preferences'] as Map?) + ..userChannelPreferences = + (json['user_channel_preferences'] as Map?)?.map( (k, e) => MapEntry( k, - ChannelPushPreference.fromJson(e as Map), + (e as Map).map( + (k, e) => MapEntry(k, ChannelPushPreference.fromJson(e as Map)), + ), ), - ), - ), - ) ?? - {}; - -GetActiveLiveLocationsResponse _$GetActiveLiveLocationsResponseFromJson( - Map json, -) => GetActiveLiveLocationsResponse() - ..duration = json['duration'] as String? - ..activeLiveLocations = (json['active_live_locations'] as List) - .map((e) => Location.fromJson(e as Map)) - .toList(); + ) ?? + {}; + +GetActiveLiveLocationsResponse _$GetActiveLiveLocationsResponseFromJson(Map json) => + GetActiveLiveLocationsResponse() + ..duration = json['duration'] as String? + ..activeLiveLocations = (json['active_live_locations'] as List) + .map((e) => Location.fromJson(e as Map)) + .toList(); diff --git a/packages/stream_chat/lib/src/core/api/stream_chat_api.dart b/packages/stream_chat/lib/src/core/api/stream_chat_api.dart index 1631e9c8cb..3726a0eba0 100644 --- a/packages/stream_chat/lib/src/core/api/stream_chat_api.dart +++ b/packages/stream_chat/lib/src/core/api/stream_chat_api.dart @@ -6,7 +6,6 @@ import 'channel_api.dart'; import 'general_api.dart'; import 'message_api.dart'; import 'moderation_api.dart'; -import 'polls_api.dart'; import 'push_preferences_api.dart'; import 'reminders_api.dart'; import 'threads_api.dart'; @@ -46,10 +45,6 @@ class StreamChatApi { MessageApi get message => _message ??= MessageApi(_client); MessageApi? _message; - /// Api dedicated to polls operations - PollsApi get polls => _polls ??= PollsApi(_client); - PollsApi? _polls; - /// Api dedicated to threads operations ThreadsApi get threads => _threads ??= ThreadsApi(_client); ThreadsApi? _threads; diff --git a/packages/stream_chat/lib/src/core/models/converters/v1_json_converters.dart b/packages/stream_chat/lib/src/core/models/converters/v1_json_converters.dart index ea45f042f5..5fce137bd7 100644 --- a/packages/stream_chat/lib/src/core/models/converters/v1_json_converters.dart +++ b/packages/stream_chat/lib/src/core/models/converters/v1_json_converters.dart @@ -2,10 +2,16 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:meta/meta.dart'; import 'package:stream_core/stream_core.dart' show StreamDateTimeConverter; +import '../../util/serializer.dart'; import '../device.dart'; +import '../poll.dart'; +import '../poll_option.dart'; +import '../poll_vote.dart'; import '../push_provider.dart'; +import '../user.dart'; import '../user_group.dart'; import '../user_group_member.dart'; +import '../voting_visibility.dart'; // Converters for plain models embedded in json_serializable models that still decode v1 JSON. Each one is deleted // by the migration group that turns its parent into a plain model. @@ -65,3 +71,173 @@ UserGroupMember _userGroupMemberFromV1Json(Map json) => UserGro isAdmin: json['is_admin'] as bool, userId: json['user_id'] as String, ); + +/// Converts a [Poll] to and from its v1 keys. +/// +/// Custom data sits at the root of the v1 map, beside the known keys. +// TODO(openapi-migration): remove once events and messages decode v2 payloads +@internal +class PollV1JsonConverter implements JsonConverter> { + /// Creates a new [PollV1JsonConverter]. + const PollV1JsonConverter(); + + @override + Poll fromJson(Map json) => Poll( + id: json['id'] as String?, + name: json['name'] as String, + nameI18n: _translations(json['name_i18n']), + description: json['description'] as String?, + descriptionI18n: _translations(json['description_i18n']), + options: (json['options'] as List) + .map((option) => _pollOptionFromV1Json(option as Map)) + .toList(), + votingVisibility: switch (json['voting_visibility']) { + final String value => VotingVisibility(value), + _ => VotingVisibility.public, + }, + enforceUniqueVote: json['enforce_unique_vote'] as bool? ?? true, + maxVotesAllowed: (json['max_votes_allowed'] as num?)?.toInt(), + allowAnswers: json['allow_answers'] as bool? ?? false, + latestAnswers: _pollVotesFromV1Json(json['latest_answers']) ?? const [], + answersCount: (json['answers_count'] as num?)?.toInt() ?? 0, + allowUserSuggestedOptions: json['allow_user_suggested_options'] as bool? ?? false, + isClosed: json['is_closed'] as bool? ?? false, + createdAt: _optionalDateTime(json['created_at']), + updatedAt: _optionalDateTime(json['updated_at']), + voteCountsByOption: + (json['vote_counts_by_option'] as Map?)?.map( + (optionId, count) => MapEntry(optionId, (count as num).toInt()), + ) ?? + const {}, + voteCount: (json['vote_count'] as num?)?.toInt() ?? 0, + latestVotesByOption: + (json['latest_votes_by_option'] as Map?)?.map( + (optionId, votes) => MapEntry(optionId, _pollVotesFromV1Json(votes)!), + ) ?? + const {}, + createdById: json['created_by_id'] as String?, + createdBy: switch (json['created_by']) { + final Map user => User.fromJson(user), + _ => null, + }, + ownVotesAndAnswers: _pollVotesFromV1Json(json['own_votes']) ?? const [], + custom: _customData(json, _pollV1Keys), + ); + + // Writes the keys the poll settings use, with custom data at the root; the + // vote summary, the translations and a custom entry named like one of the + // keys are not written. + @override + Map toJson(Poll poll) => { + ..._customDataAtRoot(poll.custom, _pollV1Keys), + 'id': poll.id, + 'name': poll.name, + 'description': poll.description, + 'options': poll.options.map(_pollOptionToV1Json).toList(), + 'voting_visibility': poll.votingVisibility, + 'enforce_unique_vote': poll.enforceUniqueVote, + 'max_votes_allowed': poll.maxVotesAllowed, + 'allow_user_suggested_options': poll.allowUserSuggestedOptions, + 'allow_answers': poll.allowAnswers, + 'is_closed': poll.isClosed, + }; +} + +/// Converts a [PollVote] to and from its v1 keys. +// TODO(openapi-migration): remove once WebSocket events decode v2 payloads +@internal +class PollVoteV1JsonConverter implements JsonConverter> { + /// Creates a new [PollVoteV1JsonConverter]. + const PollVoteV1JsonConverter(); + + @override + PollVote fromJson(Map json) => _pollVoteFromV1Json(json); + + // Writes only the keys that identify the vote and what it selects. + @override + Map toJson(PollVote vote) => { + 'id': ?vote.id, + 'option_id': ?vote.optionId, + 'answer_text': ?vote.answerText, + }; +} + +PollOption _pollOptionFromV1Json(Map json) => PollOption( + id: json['id'] as String?, + text: json['text'] as String, + textI18n: _translations(json['text_i18n']), + custom: _customData(json, _pollOptionV1Keys), +); + +Map _pollOptionToV1Json(PollOption option) => { + ..._customDataAtRoot(option.custom, _pollOptionV1Keys), + 'id': ?option.id, + 'text': option.text, +}; + +List? _pollVotesFromV1Json(Object? json) => + (json as List?)?.map((vote) => _pollVoteFromV1Json(vote as Map)).toList(); + +PollVote _pollVoteFromV1Json(Map json) => PollVote( + id: json['id'] as String?, + pollId: json['poll_id'] as String?, + optionId: json['option_id'] as String?, + answerText: json['answer_text'] as String?, + answerTextI18n: _translations(json['answer_text_i18n']), + createdAt: _optionalDateTime(json['created_at']), + updatedAt: _optionalDateTime(json['updated_at']), + userId: json['user_id'] as String?, + user: switch (json['user']) { + final Map user => User.fromJson(user), + _ => null, + }, +); + +Map? _translations(Object? json) => switch (json) { + final Map translations => Map.from(translations), + _ => null, +}; + +DateTime? _optionalDateTime(Object? json) => json == null ? null : _dateTime.fromJson(json); + +// The keys a v1 poll carries besides its custom data. +const _pollV1Keys = [ + 'id', + 'name', + 'name_i18n', + 'description', + 'description_i18n', + 'options', + 'voting_visibility', + 'enforce_unique_vote', + 'max_votes_allowed', + 'allow_user_suggested_options', + 'allow_answers', + 'is_closed', + 'created_at', + 'updated_at', + 'vote_counts_by_option', + 'votes', + 'own_votes', + 'vote_count', + 'answers_count', + 'latest_votes_by_option', + 'latest_answers', + 'created_by_id', + 'created_by', +]; + +// The keys a v1 poll option carries besides its custom data. +const _pollOptionV1Keys = [ + 'id', + 'text', + 'text_i18n', +]; + +Map _customData(Map json, List knownKeys) => + Serializer.moveToExtraDataFromRoot(json, knownKeys)['extra_data'] as Map; + +// The custom data a v1 map carries at its root: an entry named like one of the +// known keys would overwrite the key, so it is left out. +Map _customDataAtRoot(Map custom, List knownKeys) => + {...custom}..removeWhere((key, _) => knownKeys.contains(key)); diff --git a/packages/stream_chat/lib/src/core/models/draft_message.dart b/packages/stream_chat/lib/src/core/models/draft_message.dart index 000bb9f168..01f370abcc 100644 --- a/packages/stream_chat/lib/src/core/models/draft_message.dart +++ b/packages/stream_chat/lib/src/core/models/draft_message.dart @@ -4,6 +4,7 @@ import 'package:uuid/uuid.dart'; import '../util/serializer.dart'; import 'attachment.dart'; +import 'converters/v1_json_converters.dart'; import 'message.dart'; import 'poll.dart'; import 'user.dart'; @@ -84,6 +85,7 @@ class DraftMessage extends Equatable { /// The poll associated with the message. @JsonKey(includeToJson: false) + @PollV1JsonConverter() final Poll? poll; /// The ID of the poll, if a poll is associated with the message. diff --git a/packages/stream_chat/lib/src/core/models/draft_message.g.dart b/packages/stream_chat/lib/src/core/models/draft_message.g.dart index 511ec1822e..27e1e0a332 100644 --- a/packages/stream_chat/lib/src/core/models/draft_message.g.dart +++ b/packages/stream_chat/lib/src/core/models/draft_message.g.dart @@ -24,7 +24,7 @@ DraftMessage _$DraftMessageFromJson(Map json) => DraftMessage( quotedMessageId: json['quoted_message_id'] as String?, silent: json['silent'] as bool? ?? false, command: json['command'] as String?, - poll: json['poll'] == null ? null : Poll.fromJson(json['poll'] as Map), + poll: _$JsonConverterFromJson, Poll>(json['poll'], const PollV1JsonConverter().fromJson), pollId: json['poll_id'] as String?, extraData: json['extra_data'] as Map? ?? const {}, ); @@ -42,3 +42,6 @@ Map _$DraftMessageToJson(DraftMessage instance) => (Object? json, Value? Function(Json json) fromJson) => + json == null ? null : fromJson(json as Json); diff --git a/packages/stream_chat/lib/src/core/models/message.dart b/packages/stream_chat/lib/src/core/models/message.dart index 8ca0232d50..974e8bf704 100644 --- a/packages/stream_chat/lib/src/core/models/message.dart +++ b/packages/stream_chat/lib/src/core/models/message.dart @@ -301,6 +301,7 @@ class Message extends Equatable { /// The poll associated with this message. @JsonKey(includeToJson: false) + @PollV1JsonConverter() final Poll? poll; /// The ID of the [poll] associated with this message. diff --git a/packages/stream_chat/lib/src/core/models/message.g.dart b/packages/stream_chat/lib/src/core/models/message.g.dart index b5d5d2b59d..ad14f0dda3 100644 --- a/packages/stream_chat/lib/src/core/models/message.g.dart +++ b/packages/stream_chat/lib/src/core/models/message.g.dart @@ -55,18 +55,14 @@ Message _$MessageFromJson(Map json) => Message( pinnedAt: json['pinned_at'] == null ? null : DateTime.parse(json['pinned_at'] as String), pinExpires: json['pin_expires'] == null ? null : DateTime.parse(json['pin_expires'] as String), pinnedBy: json['pinned_by'] == null ? null : User.fromJson(json['pinned_by'] as Map), - poll: json['poll'] == null ? null : Poll.fromJson(json['poll'] as Map), + poll: _$JsonConverterFromJson, Poll>(json['poll'], const PollV1JsonConverter().fromJson), pollId: json['poll_id'] as String?, extraData: json['extra_data'] as Map? ?? const {}, - i18n: (json['i18n'] as Map?)?.map( - (k, e) => MapEntry(k, e as String), - ), + i18n: (json['i18n'] as Map?)?.map((k, e) => MapEntry(k, e as String)), restrictedVisibility: (json['restricted_visibility'] as List?)?.map((e) => e as String).toList(), moderation: Message._moderationReadValue(json, 'moderation') == null ? null - : Moderation.fromJson( - Message._moderationReadValue(json, 'moderation') as Map, - ), + : Moderation.fromJson(Message._moderationReadValue(json, 'moderation') as Map), draft: json['draft'] == null ? null : Draft.fromJson(json['draft'] as Map), reminder: json['reminder'] == null ? null : MessageReminder.fromJson(json['reminder'] as Map), channelRole: Message._channelRoleReadValue(json, 'channel_role') as String?, @@ -96,3 +92,6 @@ Map _$MessageToJson(Message instance) => { 'shared_location': ?instance.sharedLocation?.toJson(), 'extra_data': instance.extraData, }; + +Value? _$JsonConverterFromJson(Object? json, Value? Function(Json json) fromJson) => + json == null ? null : fromJson(json as Json); diff --git a/packages/stream_chat/lib/src/core/models/poll.dart b/packages/stream_chat/lib/src/core/models/poll.dart index de883dbf8f..bc9105107c 100644 --- a/packages/stream_chat/lib/src/core/models/poll.dart +++ b/packages/stream_chat/lib/src/core/models/poll.dart @@ -1,43 +1,27 @@ import 'package:collection/collection.dart'; -import 'package:equatable/equatable.dart'; -import 'package:json_annotation/json_annotation.dart'; -import 'package:meta/meta.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:stream_core/stream_core.dart' show Filter, FilterField, Standard, Sort, SortField, normalizeStringForSort; import 'package:uuid/uuid.dart'; -import '../util/serializer.dart'; import 'poll_option.dart'; import 'poll_vote.dart'; import 'user.dart'; +import 'voting_visibility.dart'; -part 'poll.g.dart'; +part 'poll.freezed.dart'; -class _NullConst { - const _NullConst(); -} - -const _nullConst = _NullConst(); - -/// {@template streamVotingVisibility} -/// Represents the visibility of the voting process. -/// {@endtemplate} -enum VotingVisibility { - /// The voting process is anonymous. - @JsonValue('anonymous') - anonymous, - - /// The voting process is public. - @JsonValue('public') - public, -} - -/// {@template streamPoll} -/// A model class representing a poll. -/// {@endtemplate} -@JsonSerializable() -class Poll extends Equatable { - /// {@macro streamPoll} +/// A question with a set of options that the members of a channel vote on. +/// +/// A poll is sent in a message. Besides its settings it carries a summary of +/// the votes so far: the counts per option, the latest votes and answers, and +/// the votes of the current user. +@freezed +class Poll with _$Poll { + /// Creates a new [Poll]. + /// + /// An [id] is generated when omitted, and [createdAt] and [updatedAt] + /// default to the current time. Poll({ String? id, required this.name, @@ -61,19 +45,17 @@ class Poll extends Equatable { this.createdById, this.createdBy, this.ownVotesAndAnswers = const [], - this.extraData = const {}, + this.custom = const {}, }) : id = id ?? const Uuid().v4(), createdAt = createdAt ?? DateTime.now(), updatedAt = updatedAt ?? DateTime.now(); - /// Create a new instance from a json - factory Poll.fromJson(Map json) => - _$PollFromJson(Serializer.moveToExtraDataFromRoot(json, topLevelFields)); - - /// The unique identifier of the poll. + /// The unique identifier of this poll. + @override final String id; - /// The name of the poll. + /// The question this poll asks. + @override final String name; /// The translations of [name], keyed as `_text`, plus the @@ -81,161 +63,119 @@ class Poll extends Equatable { /// /// Filled in by the server when the poll is sent to a channel with /// automatic translation enabled. - @JsonKey(includeToJson: false) + @override final Map? nameI18n; - /// The description of the poll. + /// A longer explanation of the question. + @override final String? description; /// The translations of [description], in the same shape as [nameI18n]. - @JsonKey(includeToJson: false) + @override final Map? descriptionI18n; - /// The list of options available for the poll. + /// The options that can be voted for. + @override final List options; - /// Represents the visibility of the voting process. + /// The rule for who can see which option each user voted for. /// /// Defaults to [VotingVisibility.public]. + @override final VotingVisibility votingVisibility; - /// If true, only unique votes are allowed. + /// Whether each user may vote for one option only. /// - /// Defaults to false. + /// Voting for another option replaces the previous vote. Defaults to true. + @override final bool enforceUniqueVote; - /// The maximum number of votes allowed per user. + /// The maximum number of options each user may vote for, or null for no + /// limit. + /// + /// Applies only when [enforceUniqueVote] is false. + @override final int? maxVotesAllowed; - /// If true, users can suggest their own options. + /// Whether users may add their own options to this poll. /// /// Defaults to false. + @override final bool allowUserSuggestedOptions; - /// If true, users can provide their own answers/comments. + /// Whether users may add a free-form answer. /// /// Defaults to false. + @override final bool allowAnswers; - /// Indicates if the poll is closed. + /// Whether this poll no longer accepts votes or answers. + @override final bool isClosed; - /// The total number of answers received by the poll. - @JsonKey(includeToJson: false) + /// The total number of answers added to this poll. + @override final int answersCount; - /// Map of vote counts by option. - @JsonKey(includeToJson: false) + /// The number of votes each option received, keyed by option id. + @override final Map voteCountsByOption; - /// Map of latest votes by option. - @JsonKey(includeToJson: false) + /// The most recent votes for each option, keyed by option id. + /// + /// Empty for an anonymous poll. + @override final Map> latestVotesByOption; - /// List of votes received by the poll. + /// The most recent votes across all options. /// - /// Note: This does not include the answers provided by the users, - /// see [latestAnswers] for that. - late final latestVotes = [...latestVotesByOption.values.flattened]; + /// Answers are not included; see [latestAnswers] for those. + @override + late final List latestVotes = [...latestVotesByOption.values.flattened]; - /// List of latest answers received by the poll. - @JsonKey(includeToJson: false) + /// The most recent answers added to this poll. + @override final List latestAnswers; - /// List of votes casted by the current user. - /// - /// Contains both votes and answers. - @JsonKey(name: 'own_votes', includeToJson: false) + /// The votes and answers of the current user. + @override final List ownVotesAndAnswers; - /// The total number of votes received by the poll. - @JsonKey(includeToJson: false) + /// The total number of votes cast on this poll. + @override final int voteCount; - /// List of votes casted by the current user. + /// The votes of the current user. /// - /// Note: This does not include the answers provided by the user, - /// see [ownAnswers] for that. - late final ownVotes = [...ownVotesAndAnswers.where((it) => !it.isAnswer)]; + /// Answers are not included; see [ownAnswers] for those. + @override + late final List ownVotes = [...ownVotesAndAnswers.where((it) => !it.isAnswer)]; - /// List of answers provided by the current user. + /// The answers of the current user. /// - /// Note: This does not include the votes casted by the user, - /// see [ownVotes] for that. - late final ownAnswers = [...ownVotesAndAnswers.where((it) => it.isAnswer)]; + /// Votes are not included; see [ownVotes] for those. + @override + late final List ownAnswers = [...ownVotesAndAnswers.where((it) => it.isAnswer)]; - /// The id of the user who created the poll. - @JsonKey(includeToJson: false) + /// The unique identifier of the user who created this poll. + @override final String? createdById; - /// The user who created the poll. - @JsonKey(includeToJson: false) + /// The user who created this poll. + @override final User? createdBy; - /// The date when the poll was created. - @JsonKey(includeToJson: false) + /// The date this poll was created. + @override final DateTime createdAt; - /// The date when the poll was last updated. - @JsonKey(includeToJson: false) + /// The date this poll was last changed. + @override final DateTime updatedAt; - /// Map of custom poll extraData - final Map extraData; - - /// Serialize to json - Map toJson() => Serializer.moveFromExtraDataToRoot(_$PollToJson(this)); - - /// Creates a copy of [Poll] with specified attributes overridden. - Poll copyWith({ - String? id, - String? name, - Map? nameI18n, - String? description, - Map? descriptionI18n, - List? options, - VotingVisibility? votingVisibility, - bool? enforceUniqueVote, - Object? maxVotesAllowed = _nullConst, - bool? allowUserSuggestedOptions, - bool? allowAnswers, - bool? isClosed, - Map? voteCountsByOption, - List? ownVotesAndAnswers, - int? voteCount, - int? answersCount, - Map>? latestVotesByOption, - List? latestAnswers, - String? createdById, - User? createdBy, - DateTime? createdAt, - DateTime? updatedAt, - Map? extraData, - }) => Poll( - id: id ?? this.id, - name: name ?? this.name, - nameI18n: nameI18n ?? this.nameI18n, - description: description ?? this.description, - descriptionI18n: descriptionI18n ?? this.descriptionI18n, - options: options ?? this.options, - votingVisibility: votingVisibility ?? this.votingVisibility, - enforceUniqueVote: enforceUniqueVote ?? this.enforceUniqueVote, - maxVotesAllowed: maxVotesAllowed == _nullConst ? this.maxVotesAllowed : maxVotesAllowed as int?, - allowUserSuggestedOptions: allowUserSuggestedOptions ?? this.allowUserSuggestedOptions, - allowAnswers: allowAnswers ?? this.allowAnswers, - isClosed: isClosed ?? this.isClosed, - voteCountsByOption: voteCountsByOption ?? this.voteCountsByOption, - ownVotesAndAnswers: ownVotesAndAnswers ?? this.ownVotesAndAnswers, - voteCount: voteCount ?? this.voteCount, - answersCount: answersCount ?? this.answersCount, - latestVotesByOption: latestVotesByOption ?? this.latestVotesByOption, - latestAnswers: latestAnswers ?? this.latestAnswers, - createdById: createdById ?? this.createdById, - createdBy: createdBy ?? this.createdBy, - createdAt: createdAt ?? this.createdAt, - updatedAt: updatedAt ?? this.updatedAt, - extraData: extraData ?? this.extraData, - ); + /// Custom data attached to this poll. + @override + final Map custom; /// This poll with the translations of [oldPoll] filled in where this one /// has none. @@ -263,61 +203,6 @@ class Poll extends Equatable { ], ); } - - /// Known top level fields. - /// - /// Useful for [Serializer] methods. - static const topLevelFields = [ - 'id', - 'name', - 'name_i18n', - 'description', - 'description_i18n', - 'options', - 'voting_visibility', - 'enforce_unique_vote', - 'max_votes_allowed', - 'allow_user_suggested_options', - 'allow_answers', - 'is_closed', - 'created_at', - 'updated_at', - 'vote_counts_by_option', - 'votes', - 'own_votes', - 'vote_count', - 'answers_count', - 'latest_votes_by_option', - 'latest_answers', - 'created_by_id', - 'created_by', - ]; - - @override - List get props => [ - id, - name, - nameI18n, - description, - descriptionI18n, - options, - votingVisibility, - enforceUniqueVote, - maxVotesAllowed, - allowUserSuggestedOptions, - allowAnswers, - isClosed, - voteCountsByOption, - ownVotesAndAnswers, - voteCount, - answersCount, - latestVotesByOption, - latestAnswers, - createdById, - createdBy, - createdAt, - updatedAt, - ]; } /// A filter for a poll query. @@ -335,12 +220,12 @@ class PollFilterField extends FilterField { /// off an instance with [value]. PollFilterField(super.remote, super.value); - /// Creates a field the SDK does not model, read from [Poll.extraData]. + /// Creates a field the SDK does not model, read from [Poll.custom]. /// /// **Supported operators:** `$eq`, `$in`, `$gt`, `$gte`, `$lt`, `$lte`, /// `$exists`, `$contains`, `$q`, `$autocomplete` factory PollFilterField.custom(String remote) { - return PollFilterField(remote, (it) => it.extraData[remote]); + return PollFilterField(remote, (it) => it.custom[remote]); } /// Filters polls by their id. @@ -404,7 +289,7 @@ class PollFilterField extends FilterField { /// **Supported operators:** `$eq` static final votingVisibility = PollFilterField( 'voting_visibility', - (it) => _$VotingVisibilityEnumMap[it.votingVisibility], + (it) => it.votingVisibility, ); /// Filters polls by their creation date. diff --git a/packages/stream_chat/lib/src/core/models/poll.freezed.dart b/packages/stream_chat/lib/src/core/models/poll.freezed.dart new file mode 100644 index 0000000000..d805de3284 --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/poll.freezed.dart @@ -0,0 +1,308 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'poll.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$Poll { + String get id; + String get name; + Map? get nameI18n; + String? get description; + Map? get descriptionI18n; + List get options; + VotingVisibility get votingVisibility; + bool get enforceUniqueVote; + int? get maxVotesAllowed; + bool get allowUserSuggestedOptions; + bool get allowAnswers; + bool get isClosed; + int get answersCount; + Map get voteCountsByOption; + Map> get latestVotesByOption; + List get latestVotes; + List get latestAnswers; + List get ownVotesAndAnswers; + int get voteCount; + List get ownVotes; + List get ownAnswers; + String? get createdById; + User? get createdBy; + DateTime get createdAt; + DateTime get updatedAt; + Map get custom; + + /// Create a copy of Poll + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $PollCopyWith get copyWith => _$PollCopyWithImpl(this as Poll, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is Poll && + (identical(other.id, id) || other.id == id) && + (identical(other.name, name) || other.name == name) && + const DeepCollectionEquality().equals(other.nameI18n, nameI18n) && + (identical(other.description, description) || other.description == description) && + const DeepCollectionEquality().equals( + other.descriptionI18n, + descriptionI18n, + ) && + const DeepCollectionEquality().equals(other.options, options) && + (identical(other.votingVisibility, votingVisibility) || other.votingVisibility == votingVisibility) && + (identical(other.enforceUniqueVote, enforceUniqueVote) || other.enforceUniqueVote == enforceUniqueVote) && + (identical(other.maxVotesAllowed, maxVotesAllowed) || other.maxVotesAllowed == maxVotesAllowed) && + (identical( + other.allowUserSuggestedOptions, + allowUserSuggestedOptions, + ) || + other.allowUserSuggestedOptions == allowUserSuggestedOptions) && + (identical(other.allowAnswers, allowAnswers) || other.allowAnswers == allowAnswers) && + (identical(other.isClosed, isClosed) || other.isClosed == isClosed) && + (identical(other.answersCount, answersCount) || other.answersCount == answersCount) && + const DeepCollectionEquality().equals( + other.voteCountsByOption, + voteCountsByOption, + ) && + const DeepCollectionEquality().equals( + other.latestVotesByOption, + latestVotesByOption, + ) && + const DeepCollectionEquality().equals( + other.latestVotes, + latestVotes, + ) && + const DeepCollectionEquality().equals( + other.latestAnswers, + latestAnswers, + ) && + const DeepCollectionEquality().equals( + other.ownVotesAndAnswers, + ownVotesAndAnswers, + ) && + (identical(other.voteCount, voteCount) || other.voteCount == voteCount) && + const DeepCollectionEquality().equals(other.ownVotes, ownVotes) && + const DeepCollectionEquality().equals( + other.ownAnswers, + ownAnswers, + ) && + (identical(other.createdById, createdById) || other.createdById == createdById) && + (identical(other.createdBy, createdBy) || other.createdBy == createdBy) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt) && + const DeepCollectionEquality().equals(other.custom, custom)); + } + + @override + int get hashCode => Object.hashAll([ + runtimeType, + id, + name, + const DeepCollectionEquality().hash(nameI18n), + description, + const DeepCollectionEquality().hash(descriptionI18n), + const DeepCollectionEquality().hash(options), + votingVisibility, + enforceUniqueVote, + maxVotesAllowed, + allowUserSuggestedOptions, + allowAnswers, + isClosed, + answersCount, + const DeepCollectionEquality().hash(voteCountsByOption), + const DeepCollectionEquality().hash(latestVotesByOption), + const DeepCollectionEquality().hash(latestVotes), + const DeepCollectionEquality().hash(latestAnswers), + const DeepCollectionEquality().hash(ownVotesAndAnswers), + voteCount, + const DeepCollectionEquality().hash(ownVotes), + const DeepCollectionEquality().hash(ownAnswers), + createdById, + createdBy, + createdAt, + updatedAt, + const DeepCollectionEquality().hash(custom), + ]); + + @override + String toString() { + return 'Poll(id: $id, name: $name, nameI18n: $nameI18n, description: $description, descriptionI18n: $descriptionI18n, options: $options, votingVisibility: $votingVisibility, enforceUniqueVote: $enforceUniqueVote, maxVotesAllowed: $maxVotesAllowed, allowUserSuggestedOptions: $allowUserSuggestedOptions, allowAnswers: $allowAnswers, isClosed: $isClosed, answersCount: $answersCount, voteCountsByOption: $voteCountsByOption, latestVotesByOption: $latestVotesByOption, latestVotes: $latestVotes, latestAnswers: $latestAnswers, ownVotesAndAnswers: $ownVotesAndAnswers, voteCount: $voteCount, ownVotes: $ownVotes, ownAnswers: $ownAnswers, createdById: $createdById, createdBy: $createdBy, createdAt: $createdAt, updatedAt: $updatedAt, custom: $custom)'; + } +} + +/// @nodoc +abstract mixin class $PollCopyWith<$Res> { + factory $PollCopyWith(Poll value, $Res Function(Poll) _then) = _$PollCopyWithImpl; + @useResult + $Res call({ + String? id, + String name, + Map? nameI18n, + String? description, + Map? descriptionI18n, + List options, + VotingVisibility votingVisibility, + bool enforceUniqueVote, + int? maxVotesAllowed, + bool allowAnswers, + List latestAnswers, + int answersCount, + bool allowUserSuggestedOptions, + bool isClosed, + DateTime? createdAt, + DateTime? updatedAt, + Map voteCountsByOption, + int voteCount, + Map> latestVotesByOption, + String? createdById, + User? createdBy, + List ownVotesAndAnswers, + Map custom, + }); +} + +/// @nodoc +class _$PollCopyWithImpl<$Res> implements $PollCopyWith<$Res> { + _$PollCopyWithImpl(this._self, this._then); + + final Poll _self; + final $Res Function(Poll) _then; + + /// Create a copy of Poll + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = freezed, + Object? name = null, + Object? nameI18n = freezed, + Object? description = freezed, + Object? descriptionI18n = freezed, + Object? options = null, + Object? votingVisibility = null, + Object? enforceUniqueVote = null, + Object? maxVotesAllowed = freezed, + Object? allowAnswers = null, + Object? latestAnswers = null, + Object? answersCount = null, + Object? allowUserSuggestedOptions = null, + Object? isClosed = null, + Object? createdAt = freezed, + Object? updatedAt = freezed, + Object? voteCountsByOption = null, + Object? voteCount = null, + Object? latestVotesByOption = null, + Object? createdById = freezed, + Object? createdBy = freezed, + Object? ownVotesAndAnswers = null, + Object? custom = null, + }) { + return _then( + Poll( + id: freezed == id + ? _self.id! + : id // ignore: cast_nullable_to_non_nullable + as String?, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + nameI18n: freezed == nameI18n + ? _self.nameI18n + : nameI18n // ignore: cast_nullable_to_non_nullable + as Map?, + description: freezed == description + ? _self.description + : description // ignore: cast_nullable_to_non_nullable + as String?, + descriptionI18n: freezed == descriptionI18n + ? _self.descriptionI18n + : descriptionI18n // ignore: cast_nullable_to_non_nullable + as Map?, + options: null == options + ? _self.options + : options // ignore: cast_nullable_to_non_nullable + as List, + votingVisibility: null == votingVisibility + ? _self.votingVisibility + : votingVisibility // ignore: cast_nullable_to_non_nullable + as VotingVisibility, + enforceUniqueVote: null == enforceUniqueVote + ? _self.enforceUniqueVote + : enforceUniqueVote // ignore: cast_nullable_to_non_nullable + as bool, + maxVotesAllowed: freezed == maxVotesAllowed + ? _self.maxVotesAllowed + : maxVotesAllowed // ignore: cast_nullable_to_non_nullable + as int?, + allowAnswers: null == allowAnswers + ? _self.allowAnswers + : allowAnswers // ignore: cast_nullable_to_non_nullable + as bool, + latestAnswers: null == latestAnswers + ? _self.latestAnswers + : latestAnswers // ignore: cast_nullable_to_non_nullable + as List, + answersCount: null == answersCount + ? _self.answersCount + : answersCount // ignore: cast_nullable_to_non_nullable + as int, + allowUserSuggestedOptions: null == allowUserSuggestedOptions + ? _self.allowUserSuggestedOptions + : allowUserSuggestedOptions // ignore: cast_nullable_to_non_nullable + as bool, + isClosed: null == isClosed + ? _self.isClosed + : isClosed // ignore: cast_nullable_to_non_nullable + as bool, + createdAt: freezed == createdAt + ? _self.createdAt! + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + updatedAt: freezed == updatedAt + ? _self.updatedAt! + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + voteCountsByOption: null == voteCountsByOption + ? _self.voteCountsByOption + : voteCountsByOption // ignore: cast_nullable_to_non_nullable + as Map, + voteCount: null == voteCount + ? _self.voteCount + : voteCount // ignore: cast_nullable_to_non_nullable + as int, + latestVotesByOption: null == latestVotesByOption + ? _self.latestVotesByOption + : latestVotesByOption // ignore: cast_nullable_to_non_nullable + as Map>, + createdById: freezed == createdById + ? _self.createdById + : createdById // ignore: cast_nullable_to_non_nullable + as String?, + createdBy: freezed == createdBy + ? _self.createdBy + : createdBy // ignore: cast_nullable_to_non_nullable + as User?, + ownVotesAndAnswers: null == ownVotesAndAnswers + ? _self.ownVotesAndAnswers + : ownVotesAndAnswers // ignore: cast_nullable_to_non_nullable + as List, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + ), + ); + } +} diff --git a/packages/stream_chat/lib/src/core/models/poll.g.dart b/packages/stream_chat/lib/src/core/models/poll.g.dart deleted file mode 100644 index 11927e1b16..0000000000 --- a/packages/stream_chat/lib/src/core/models/poll.g.dart +++ /dev/null @@ -1,76 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'poll.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -Poll _$PollFromJson(Map json) => Poll( - id: json['id'] as String?, - name: json['name'] as String, - nameI18n: (json['name_i18n'] as Map?)?.map( - (k, e) => MapEntry(k, e as String), - ), - description: json['description'] as String?, - descriptionI18n: (json['description_i18n'] as Map?)?.map( - (k, e) => MapEntry(k, e as String), - ), - options: (json['options'] as List).map((e) => PollOption.fromJson(e as Map)).toList(), - votingVisibility: - $enumDecodeNullable( - _$VotingVisibilityEnumMap, - json['voting_visibility'], - ) ?? - VotingVisibility.public, - enforceUniqueVote: json['enforce_unique_vote'] as bool? ?? true, - maxVotesAllowed: (json['max_votes_allowed'] as num?)?.toInt(), - allowAnswers: json['allow_answers'] as bool? ?? false, - latestAnswers: - (json['latest_answers'] as List?)?.map((e) => PollVote.fromJson(e as Map)).toList() ?? - const [], - answersCount: (json['answers_count'] as num?)?.toInt() ?? 0, - allowUserSuggestedOptions: json['allow_user_suggested_options'] as bool? ?? false, - isClosed: json['is_closed'] as bool? ?? false, - createdAt: json['created_at'] == null ? null : DateTime.parse(json['created_at'] as String), - updatedAt: json['updated_at'] == null ? null : DateTime.parse(json['updated_at'] as String), - voteCountsByOption: - (json['vote_counts_by_option'] as Map?)?.map( - (k, e) => MapEntry(k, (e as num).toInt()), - ) ?? - const {}, - voteCount: (json['vote_count'] as num?)?.toInt() ?? 0, - latestVotesByOption: - (json['latest_votes_by_option'] as Map?)?.map( - (k, e) => MapEntry( - k, - (e as List).map((e) => PollVote.fromJson(e as Map)).toList(), - ), - ) ?? - const {}, - createdById: json['created_by_id'] as String?, - createdBy: json['created_by'] == null ? null : User.fromJson(json['created_by'] as Map), - ownVotesAndAnswers: - (json['own_votes'] as List?)?.map((e) => PollVote.fromJson(e as Map)).toList() ?? - const [], - extraData: json['extra_data'] as Map? ?? const {}, -); - -Map _$PollToJson(Poll instance) => { - 'id': instance.id, - 'name': instance.name, - 'description': instance.description, - 'options': instance.options.map((e) => e.toJson()).toList(), - 'voting_visibility': _$VotingVisibilityEnumMap[instance.votingVisibility]!, - 'enforce_unique_vote': instance.enforceUniqueVote, - 'max_votes_allowed': instance.maxVotesAllowed, - 'allow_user_suggested_options': instance.allowUserSuggestedOptions, - 'allow_answers': instance.allowAnswers, - 'is_closed': instance.isClosed, - 'extra_data': instance.extraData, -}; - -const _$VotingVisibilityEnumMap = { - VotingVisibility.anonymous: 'anonymous', - VotingVisibility.public: 'public', -}; diff --git a/packages/stream_chat/lib/src/core/models/poll_option.dart b/packages/stream_chat/lib/src/core/models/poll_option.dart index bc6bd1a791..1914207e11 100644 --- a/packages/stream_chat/lib/src/core/models/poll_option.dart +++ b/packages/stream_chat/lib/src/core/models/poll_option.dart @@ -1,38 +1,38 @@ -import 'package:equatable/equatable.dart'; -import 'package:json_annotation/json_annotation.dart'; -import '../util/serializer.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; -part 'poll_option.g.dart'; - -class _NullConst { - const _NullConst(); -} +import '../../db/data_serializable.dart'; -const _nullConst = _NullConst(); +part 'poll_option.freezed.dart'; +part 'poll_option.g.dart'; -/// {@template streamPollOption} -/// A model class representing a poll option. -/// {@endtemplate} -@JsonSerializable() -class PollOption extends Equatable { - /// {@macro streamPollOption} +/// One of the choices a poll offers to vote on. +@freezed +// TODO(openapi-migration): remove in group 10 +@DataSerializable(includeIfNull: false) +class PollOption with _$PollOption { + /// Creates a new [PollOption]. + /// + /// An option that is about to be added to a poll has no [id] yet; one is + /// assigned when the poll or the option is created. const PollOption({ this.id, required this.text, this.textI18n, - this.extraData = const {}, + this.custom = const {}, }); - /// Create a new instance from a json - factory PollOption.fromJson(Map json) => _$PollOptionFromJson( - Serializer.moveToExtraDataFromRoot(json, topLevelFields), - ); + /// Creates a [PollOption] from the offline-database format written by + /// [toData]. + /// + /// It is not a codec for API payloads. + factory PollOption.fromData(Map json) => _$PollOptionFromJson(json); - /// The unique identifier of the poll option. - @JsonKey(includeIfNull: false) + /// The unique identifier of this option, or null before it is created. + @override final String? id; - /// The text describing the poll option. + /// The text shown for this option. + @override final String text; /// The translations of [text], keyed as `_text`, plus the @@ -40,37 +40,15 @@ class PollOption extends Equatable { /// /// Filled in by the server when the poll is sent to a channel with /// automatic translation enabled. - @JsonKey(includeToJson: false) + @override final Map? textI18n; - /// Map of custom poll option extraData - final Map extraData; - - /// Serialize to json - Map toJson() => Serializer.moveFromExtraDataToRoot(_$PollOptionToJson(this)); - - /// Creates a copy of [PollOption] with specified attributes overridden. - PollOption copyWith({ - Object? id = _nullConst, - String? text, - Map? textI18n, - Map? extraData, - }) => PollOption( - id: id == _nullConst ? this.id : id as String?, - text: text ?? this.text, - textI18n: textI18n ?? this.textI18n, - extraData: extraData ?? this.extraData, - ); + /// Custom data attached to this option. + @override + final Map custom; - /// Known top level fields. + /// Serializes this option to the format `stream_chat_persistence` stores. /// - /// Useful for [Serializer] methods. - static const topLevelFields = [ - 'id', - 'text', - 'text_i18n', - ]; - - @override - List get props => [id, text, textI18n]; + /// It is not a codec for API payloads. + Map toData() => _$PollOptionToJson(this); } diff --git a/packages/stream_chat/lib/src/core/models/poll_option.freezed.dart b/packages/stream_chat/lib/src/core/models/poll_option.freezed.dart new file mode 100644 index 0000000000..3a66a6d918 --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/poll_option.freezed.dart @@ -0,0 +1,106 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'poll_option.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$PollOption { + String? get id; + String get text; + Map? get textI18n; + Map get custom; + + /// Create a copy of PollOption + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $PollOptionCopyWith get copyWith => _$PollOptionCopyWithImpl(this as PollOption, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is PollOption && + (identical(other.id, id) || other.id == id) && + (identical(other.text, text) || other.text == text) && + const DeepCollectionEquality().equals(other.textI18n, textI18n) && + const DeepCollectionEquality().equals(other.custom, custom)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + id, + text, + const DeepCollectionEquality().hash(textI18n), + const DeepCollectionEquality().hash(custom), + ); + + @override + String toString() { + return 'PollOption(id: $id, text: $text, textI18n: $textI18n, custom: $custom)'; + } +} + +/// @nodoc +abstract mixin class $PollOptionCopyWith<$Res> { + factory $PollOptionCopyWith( + PollOption value, + $Res Function(PollOption) _then, + ) = _$PollOptionCopyWithImpl; + @useResult + $Res call({ + String? id, + String text, + Map? textI18n, + Map custom, + }); +} + +/// @nodoc +class _$PollOptionCopyWithImpl<$Res> implements $PollOptionCopyWith<$Res> { + _$PollOptionCopyWithImpl(this._self, this._then); + + final PollOption _self; + final $Res Function(PollOption) _then; + + /// Create a copy of PollOption + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = freezed, + Object? text = null, + Object? textI18n = freezed, + Object? custom = null, + }) { + return _then( + PollOption( + id: freezed == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String?, + text: null == text + ? _self.text + : text // ignore: cast_nullable_to_non_nullable + as String, + textI18n: freezed == textI18n + ? _self.textI18n + : textI18n // ignore: cast_nullable_to_non_nullable + as Map?, + custom: null == custom + ? _self.custom + : custom // ignore: cast_nullable_to_non_nullable + as Map, + ), + ); + } +} diff --git a/packages/stream_chat/lib/src/core/models/poll_option.g.dart b/packages/stream_chat/lib/src/core/models/poll_option.g.dart index ba01b08839..7409fb2928 100644 --- a/packages/stream_chat/lib/src/core/models/poll_option.g.dart +++ b/packages/stream_chat/lib/src/core/models/poll_option.g.dart @@ -12,11 +12,12 @@ PollOption _$PollOptionFromJson(Map json) => PollOption( textI18n: (json['text_i18n'] as Map?)?.map( (k, e) => MapEntry(k, e as String), ), - extraData: json['extra_data'] as Map? ?? const {}, + custom: json['custom'] as Map? ?? const {}, ); Map _$PollOptionToJson(PollOption instance) => { 'id': ?instance.id, 'text': instance.text, - 'extra_data': instance.extraData, + 'text_i18n': ?instance.textI18n, + 'custom': instance.custom, }; diff --git a/packages/stream_chat/lib/src/core/models/poll_vote.dart b/packages/stream_chat/lib/src/core/models/poll_vote.dart index 21ebab6c48..3bc3f2fe45 100644 --- a/packages/stream_chat/lib/src/core/models/poll_vote.dart +++ b/packages/stream_chat/lib/src/core/models/poll_vote.dart @@ -1,17 +1,20 @@ -import 'package:equatable/equatable.dart'; -import 'package:json_annotation/json_annotation.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:stream_core/stream_core.dart' show Filter, FilterField, Sort, SortField; import 'user.dart'; -part 'poll_vote.g.dart'; +part 'poll_vote.freezed.dart'; -/// {@template streamPollVote} -/// A model class representing a poll vote. -/// {@endtemplate} -@JsonSerializable() -class PollVote extends Equatable { - /// {@macro streamPollVote} +/// A user's vote for an option of a poll, or their free-form answer to it. +/// +/// A vote carries an [optionId] and an answer carries [answerText]; [isAnswer] +/// tells the two apart. +@freezed +class PollVote with _$PollVote { + /// Creates a new [PollVote]. + /// + /// Either [optionId] or [answerText] must be given. [createdAt] and + /// [updatedAt] default to the current time. PollVote({ this.id, this.pollId, @@ -26,23 +29,25 @@ class PollVote extends Equatable { optionId != null || answerText != null, 'Either optionId or answerText must be provided', ), - isAnswer = answerText != null, createdAt = createdAt ?? DateTime.now(), updatedAt = updatedAt ?? DateTime.now(); - /// Create a new instance from a json - factory PollVote.fromJson(Map json) => _$PollVoteFromJson(json); - - /// The unique identifier of the poll vote. - @JsonKey(includeIfNull: false) + /// The unique identifier of this vote, or null before it is cast. + @override final String? id; - /// The unique identifier of the option selected in the poll. - @JsonKey(includeIfNull: false) + /// The unique identifier of the poll this vote belongs to. + @override + final String? pollId; + + /// The unique identifier of the option this vote selects. + /// + /// An empty string for an answer, which selects no option. + @override final String? optionId; - /// The text of the answer provided in the poll. - @JsonKey(includeIfNull: false) + /// The text of this answer, or null for a vote. + @override final String? answerText; /// The translations of [answerText], keyed as `_text`, plus the @@ -50,72 +55,31 @@ class PollVote extends Equatable { /// /// Filled in by the server when the answer is added to a poll in a channel /// with automatic translation enabled. - @JsonKey(includeToJson: false) + @override final Map? answerTextI18n; - /// If true, the vote is an answer. - @JsonKey(includeToJson: false) - final bool isAnswer; - - /// The unique identifier of the poll the vote belongs to. - @JsonKey(includeToJson: false) - final String? pollId; - - /// The date when the poll vote was created. - @JsonKey(includeToJson: false) + /// The date this vote was cast. + @override final DateTime createdAt; - /// The date when the poll vote was last updated. - @JsonKey(includeToJson: false) + /// The date this vote was last changed. + @override final DateTime updatedAt; - /// The unique identifier of the user who voted. - @JsonKey(includeToJson: false) + /// The unique identifier of the user who cast this vote. + /// + /// May be null in an anonymous poll, even on the current user's own vote. + @override final String? userId; - /// The user who casted the vote. - @JsonKey(includeToJson: false) + /// The user who cast this vote. + /// + /// May be null in an anonymous poll, even on the current user's own vote. + @override final User? user; - /// Serialize to json - Map toJson() => _$PollVoteToJson(this); - - /// Creates a copy of [PollVote] with specified attributes overridden. - PollVote copyWith({ - String? id, - String? pollId, - String? optionId, - String? answerText, - Map? answerTextI18n, - DateTime? createdAt, - DateTime? updatedAt, - String? userId, - User? user, - }) => PollVote( - id: id ?? this.id, - pollId: pollId ?? this.pollId, - optionId: optionId ?? this.optionId, - answerText: answerText ?? this.answerText, - answerTextI18n: answerTextI18n ?? this.answerTextI18n, - createdAt: createdAt ?? this.createdAt, - updatedAt: updatedAt ?? this.updatedAt, - userId: userId ?? this.userId, - user: user ?? this.user, - ); - - @override - List get props => [ - id, - pollId, - optionId, - isAnswer, - answerText, - answerTextI18n, - createdAt, - updatedAt, - userId, - user, - ]; + /// Whether this is a free-form answer rather than a vote for an option. + bool get isAnswer => answerText != null; } /// A filter for a poll vote query. diff --git a/packages/stream_chat/lib/src/core/models/poll_vote.freezed.dart b/packages/stream_chat/lib/src/core/models/poll_vote.freezed.dart new file mode 100644 index 0000000000..51ff240cbd --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/poll_vote.freezed.dart @@ -0,0 +1,151 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'poll_vote.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$PollVote { + String? get id; + String? get pollId; + String? get optionId; + String? get answerText; + Map? get answerTextI18n; + DateTime get createdAt; + DateTime get updatedAt; + String? get userId; + User? get user; + + /// Create a copy of PollVote + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $PollVoteCopyWith get copyWith => _$PollVoteCopyWithImpl(this as PollVote, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is PollVote && + (identical(other.id, id) || other.id == id) && + (identical(other.pollId, pollId) || other.pollId == pollId) && + (identical(other.optionId, optionId) || other.optionId == optionId) && + (identical(other.answerText, answerText) || other.answerText == answerText) && + const DeepCollectionEquality().equals( + other.answerTextI18n, + answerTextI18n, + ) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt) && + (identical(other.userId, userId) || other.userId == userId) && + (identical(other.user, user) || other.user == user)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + id, + pollId, + optionId, + answerText, + const DeepCollectionEquality().hash(answerTextI18n), + createdAt, + updatedAt, + userId, + user, + ); + + @override + String toString() { + return 'PollVote(id: $id, pollId: $pollId, optionId: $optionId, answerText: $answerText, answerTextI18n: $answerTextI18n, createdAt: $createdAt, updatedAt: $updatedAt, userId: $userId, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $PollVoteCopyWith<$Res> { + factory $PollVoteCopyWith(PollVote value, $Res Function(PollVote) _then) = _$PollVoteCopyWithImpl; + @useResult + $Res call({ + String? id, + String? pollId, + String? optionId, + String? answerText, + Map? answerTextI18n, + DateTime? createdAt, + DateTime? updatedAt, + String? userId, + User? user, + }); +} + +/// @nodoc +class _$PollVoteCopyWithImpl<$Res> implements $PollVoteCopyWith<$Res> { + _$PollVoteCopyWithImpl(this._self, this._then); + + final PollVote _self; + final $Res Function(PollVote) _then; + + /// Create a copy of PollVote + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = freezed, + Object? pollId = freezed, + Object? optionId = freezed, + Object? answerText = freezed, + Object? answerTextI18n = freezed, + Object? createdAt = freezed, + Object? updatedAt = freezed, + Object? userId = freezed, + Object? user = freezed, + }) { + return _then( + PollVote( + id: freezed == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String?, + pollId: freezed == pollId + ? _self.pollId + : pollId // ignore: cast_nullable_to_non_nullable + as String?, + optionId: freezed == optionId + ? _self.optionId + : optionId // ignore: cast_nullable_to_non_nullable + as String?, + answerText: freezed == answerText + ? _self.answerText + : answerText // ignore: cast_nullable_to_non_nullable + as String?, + answerTextI18n: freezed == answerTextI18n + ? _self.answerTextI18n + : answerTextI18n // ignore: cast_nullable_to_non_nullable + as Map?, + createdAt: freezed == createdAt + ? _self.createdAt! + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + updatedAt: freezed == updatedAt + ? _self.updatedAt! + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime?, + userId: freezed == userId + ? _self.userId + : userId // ignore: cast_nullable_to_non_nullable + as String?, + user: freezed == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as User?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/src/core/models/poll_vote.g.dart b/packages/stream_chat/lib/src/core/models/poll_vote.g.dart deleted file mode 100644 index b8ce2074e5..0000000000 --- a/packages/stream_chat/lib/src/core/models/poll_vote.g.dart +++ /dev/null @@ -1,27 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'poll_vote.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -PollVote _$PollVoteFromJson(Map json) => PollVote( - id: json['id'] as String?, - pollId: json['poll_id'] as String?, - optionId: json['option_id'] as String?, - answerText: json['answer_text'] as String?, - answerTextI18n: (json['answer_text_i18n'] as Map?)?.map( - (k, e) => MapEntry(k, e as String), - ), - createdAt: json['created_at'] == null ? null : DateTime.parse(json['created_at'] as String), - updatedAt: json['updated_at'] == null ? null : DateTime.parse(json['updated_at'] as String), - userId: json['user_id'] as String?, - user: json['user'] == null ? null : User.fromJson(json['user'] as Map), -); - -Map _$PollVoteToJson(PollVote instance) => { - 'id': ?instance.id, - 'option_id': ?instance.optionId, - 'answer_text': ?instance.answerText, -}; diff --git a/packages/stream_chat/lib/src/core/models/response/poll_option_response.dart b/packages/stream_chat/lib/src/core/models/response/poll_option_response.dart new file mode 100644 index 0000000000..66d4ad99fd --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/response/poll_option_response.dart @@ -0,0 +1,23 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +import '../poll_option.dart'; + +part 'poll_option_response.freezed.dart'; + +/// The result of creating, fetching or updating an option of a poll. +@freezed +class PollOptionResponse with _$PollOptionResponse { + /// Creates a new [PollOptionResponse]. + const PollOptionResponse({ + required this.duration, + required this.pollOption, + }); + + /// How long the request took to handle, such as `4.21ms`. + @override + final String duration; + + /// The option as it stands after the request. + @override + final PollOption pollOption; +} diff --git a/packages/stream_chat/lib/src/core/models/response/poll_option_response.freezed.dart b/packages/stream_chat/lib/src/core/models/response/poll_option_response.freezed.dart new file mode 100644 index 0000000000..9245946901 --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/response/poll_option_response.freezed.dart @@ -0,0 +1,77 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'poll_option_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$PollOptionResponse { + String get duration; + PollOption get pollOption; + + /// Create a copy of PollOptionResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $PollOptionResponseCopyWith get copyWith => + _$PollOptionResponseCopyWithImpl(this as PollOptionResponse, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is PollOptionResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.pollOption, pollOption) || other.pollOption == pollOption)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration, pollOption); + + @override + String toString() { + return 'PollOptionResponse(duration: $duration, pollOption: $pollOption)'; + } +} + +/// @nodoc +abstract mixin class $PollOptionResponseCopyWith<$Res> { + factory $PollOptionResponseCopyWith(PollOptionResponse value, $Res Function(PollOptionResponse) _then) = + _$PollOptionResponseCopyWithImpl; + @useResult + $Res call({String duration, PollOption pollOption}); +} + +/// @nodoc +class _$PollOptionResponseCopyWithImpl<$Res> implements $PollOptionResponseCopyWith<$Res> { + _$PollOptionResponseCopyWithImpl(this._self, this._then); + + final PollOptionResponse _self; + final $Res Function(PollOptionResponse) _then; + + /// Create a copy of PollOptionResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? pollOption = null}) { + return _then( + PollOptionResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + pollOption: null == pollOption + ? _self.pollOption + : pollOption // ignore: cast_nullable_to_non_nullable + as PollOption, + ), + ); + } +} diff --git a/packages/stream_chat/lib/src/core/models/response/poll_response.dart b/packages/stream_chat/lib/src/core/models/response/poll_response.dart new file mode 100644 index 0000000000..b21cf96a08 --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/response/poll_response.dart @@ -0,0 +1,23 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +import '../poll.dart'; + +part 'poll_response.freezed.dart'; + +/// The result of creating, fetching or updating a poll. +@freezed +class PollResponse with _$PollResponse { + /// Creates a new [PollResponse]. + const PollResponse({ + required this.duration, + required this.poll, + }); + + /// How long the request took to handle, such as `4.21ms`. + @override + final String duration; + + /// The poll as it stands after the request. + @override + final Poll poll; +} diff --git a/packages/stream_chat/lib/src/core/models/response/poll_response.freezed.dart b/packages/stream_chat/lib/src/core/models/response/poll_response.freezed.dart new file mode 100644 index 0000000000..241268a0d7 --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/response/poll_response.freezed.dart @@ -0,0 +1,76 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'poll_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$PollResponse { + String get duration; + Poll get poll; + + /// Create a copy of PollResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $PollResponseCopyWith get copyWith => + _$PollResponseCopyWithImpl(this as PollResponse, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is PollResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.poll, poll) || other.poll == poll)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration, poll); + + @override + String toString() { + return 'PollResponse(duration: $duration, poll: $poll)'; + } +} + +/// @nodoc +abstract mixin class $PollResponseCopyWith<$Res> { + factory $PollResponseCopyWith(PollResponse value, $Res Function(PollResponse) _then) = _$PollResponseCopyWithImpl; + @useResult + $Res call({String duration, Poll poll}); +} + +/// @nodoc +class _$PollResponseCopyWithImpl<$Res> implements $PollResponseCopyWith<$Res> { + _$PollResponseCopyWithImpl(this._self, this._then); + + final PollResponse _self; + final $Res Function(PollResponse) _then; + + /// Create a copy of PollResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? poll = null}) { + return _then( + PollResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + poll: null == poll + ? _self.poll + : poll // ignore: cast_nullable_to_non_nullable + as Poll, + ), + ); + } +} diff --git a/packages/stream_chat/lib/src/core/models/response/poll_vote_response.dart b/packages/stream_chat/lib/src/core/models/response/poll_vote_response.dart new file mode 100644 index 0000000000..151b4c3d75 --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/response/poll_vote_response.dart @@ -0,0 +1,23 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +import '../poll_vote.dart'; + +part 'poll_vote_response.freezed.dart'; + +/// The result of casting or removing a vote or an answer on a poll. +@freezed +class PollVoteResponse with _$PollVoteResponse { + /// Creates a new [PollVoteResponse]. + const PollVoteResponse({ + required this.duration, + this.vote, + }); + + /// How long the request took to handle, such as `4.21ms`. + @override + final String duration; + + /// The vote that was cast or removed. + @override + final PollVote? vote; +} diff --git a/packages/stream_chat/lib/src/core/models/response/poll_vote_response.freezed.dart b/packages/stream_chat/lib/src/core/models/response/poll_vote_response.freezed.dart new file mode 100644 index 0000000000..88e7d5cb72 --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/response/poll_vote_response.freezed.dart @@ -0,0 +1,77 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'poll_vote_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$PollVoteResponse { + String get duration; + PollVote? get vote; + + /// Create a copy of PollVoteResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $PollVoteResponseCopyWith get copyWith => + _$PollVoteResponseCopyWithImpl(this as PollVoteResponse, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is PollVoteResponse && + (identical(other.duration, duration) || other.duration == duration) && + (identical(other.vote, vote) || other.vote == vote)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration, vote); + + @override + String toString() { + return 'PollVoteResponse(duration: $duration, vote: $vote)'; + } +} + +/// @nodoc +abstract mixin class $PollVoteResponseCopyWith<$Res> { + factory $PollVoteResponseCopyWith(PollVoteResponse value, $Res Function(PollVoteResponse) _then) = + _$PollVoteResponseCopyWithImpl; + @useResult + $Res call({String duration, PollVote? vote}); +} + +/// @nodoc +class _$PollVoteResponseCopyWithImpl<$Res> implements $PollVoteResponseCopyWith<$Res> { + _$PollVoteResponseCopyWithImpl(this._self, this._then); + + final PollVoteResponse _self; + final $Res Function(PollVoteResponse) _then; + + /// Create a copy of PollVoteResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? vote = freezed}) { + return _then( + PollVoteResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + vote: freezed == vote + ? _self.vote + : vote // ignore: cast_nullable_to_non_nullable + as PollVote?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/src/core/models/response/query_poll_votes_response.dart b/packages/stream_chat/lib/src/core/models/response/query_poll_votes_response.dart new file mode 100644 index 0000000000..0a8c30cd83 --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/response/query_poll_votes_response.dart @@ -0,0 +1,33 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +import '../poll_vote.dart'; + +part 'query_poll_votes_response.freezed.dart'; + +/// One page of the votes and answers of a poll matching a query. +@freezed +class QueryPollVotesResponse with _$QueryPollVotesResponse { + /// Creates a new [QueryPollVotesResponse]. + const QueryPollVotesResponse({ + required this.duration, + required this.votes, + this.next, + this.prev, + }); + + /// How long the request took to handle, such as `4.21ms`. + @override + final String duration; + + /// The votes and answers on this page. + @override + final List votes; + + /// The cursor for the next page, or null on the last page. + @override + final String? next; + + /// The cursor for the previous page, or null on the first page. + @override + final String? prev; +} diff --git a/packages/stream_chat/lib/src/core/models/response/query_poll_votes_response.freezed.dart b/packages/stream_chat/lib/src/core/models/response/query_poll_votes_response.freezed.dart new file mode 100644 index 0000000000..45de37e4f4 --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/response/query_poll_votes_response.freezed.dart @@ -0,0 +1,89 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'query_poll_votes_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$QueryPollVotesResponse { + String get duration; + List get votes; + String? get next; + String? get prev; + + /// Create a copy of QueryPollVotesResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $QueryPollVotesResponseCopyWith get copyWith => + _$QueryPollVotesResponseCopyWithImpl(this as QueryPollVotesResponse, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is QueryPollVotesResponse && + (identical(other.duration, duration) || other.duration == duration) && + const DeepCollectionEquality().equals(other.votes, votes) && + (identical(other.next, next) || other.next == next) && + (identical(other.prev, prev) || other.prev == prev)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration, const DeepCollectionEquality().hash(votes), next, prev); + + @override + String toString() { + return 'QueryPollVotesResponse(duration: $duration, votes: $votes, next: $next, prev: $prev)'; + } +} + +/// @nodoc +abstract mixin class $QueryPollVotesResponseCopyWith<$Res> { + factory $QueryPollVotesResponseCopyWith(QueryPollVotesResponse value, $Res Function(QueryPollVotesResponse) _then) = + _$QueryPollVotesResponseCopyWithImpl; + @useResult + $Res call({String duration, List votes, String? next, String? prev}); +} + +/// @nodoc +class _$QueryPollVotesResponseCopyWithImpl<$Res> implements $QueryPollVotesResponseCopyWith<$Res> { + _$QueryPollVotesResponseCopyWithImpl(this._self, this._then); + + final QueryPollVotesResponse _self; + final $Res Function(QueryPollVotesResponse) _then; + + /// Create a copy of QueryPollVotesResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? votes = null, Object? next = freezed, Object? prev = freezed}) { + return _then( + QueryPollVotesResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + votes: null == votes + ? _self.votes + : votes // ignore: cast_nullable_to_non_nullable + as List, + next: freezed == next + ? _self.next + : next // ignore: cast_nullable_to_non_nullable + as String?, + prev: freezed == prev + ? _self.prev + : prev // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/src/core/models/response/query_polls_response.dart b/packages/stream_chat/lib/src/core/models/response/query_polls_response.dart new file mode 100644 index 0000000000..da87101885 --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/response/query_polls_response.dart @@ -0,0 +1,33 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +import '../poll.dart'; + +part 'query_polls_response.freezed.dart'; + +/// One page of the polls matching a query. +@freezed +class QueryPollsResponse with _$QueryPollsResponse { + /// Creates a new [QueryPollsResponse]. + const QueryPollsResponse({ + required this.duration, + required this.polls, + this.next, + this.prev, + }); + + /// How long the request took to handle, such as `4.21ms`. + @override + final String duration; + + /// The polls on this page. + @override + final List polls; + + /// The cursor for the next page, or null on the last page. + @override + final String? next; + + /// The cursor for the previous page, or null on the first page. + @override + final String? prev; +} diff --git a/packages/stream_chat/lib/src/core/models/response/query_polls_response.freezed.dart b/packages/stream_chat/lib/src/core/models/response/query_polls_response.freezed.dart new file mode 100644 index 0000000000..fa1b10518c --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/response/query_polls_response.freezed.dart @@ -0,0 +1,89 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'query_polls_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$QueryPollsResponse { + String get duration; + List get polls; + String? get next; + String? get prev; + + /// Create a copy of QueryPollsResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $QueryPollsResponseCopyWith get copyWith => + _$QueryPollsResponseCopyWithImpl(this as QueryPollsResponse, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is QueryPollsResponse && + (identical(other.duration, duration) || other.duration == duration) && + const DeepCollectionEquality().equals(other.polls, polls) && + (identical(other.next, next) || other.next == next) && + (identical(other.prev, prev) || other.prev == prev)); + } + + @override + int get hashCode => Object.hash(runtimeType, duration, const DeepCollectionEquality().hash(polls), next, prev); + + @override + String toString() { + return 'QueryPollsResponse(duration: $duration, polls: $polls, next: $next, prev: $prev)'; + } +} + +/// @nodoc +abstract mixin class $QueryPollsResponseCopyWith<$Res> { + factory $QueryPollsResponseCopyWith(QueryPollsResponse value, $Res Function(QueryPollsResponse) _then) = + _$QueryPollsResponseCopyWithImpl; + @useResult + $Res call({String duration, List polls, String? next, String? prev}); +} + +/// @nodoc +class _$QueryPollsResponseCopyWithImpl<$Res> implements $QueryPollsResponseCopyWith<$Res> { + _$QueryPollsResponseCopyWithImpl(this._self, this._then); + + final QueryPollsResponse _self; + final $Res Function(QueryPollsResponse) _then; + + /// Create a copy of QueryPollsResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? duration = null, Object? polls = null, Object? next = freezed, Object? prev = freezed}) { + return _then( + QueryPollsResponse( + duration: null == duration + ? _self.duration + : duration // ignore: cast_nullable_to_non_nullable + as String, + polls: null == polls + ? _self.polls + : polls // ignore: cast_nullable_to_non_nullable + as List, + next: freezed == next + ? _self.next + : next // ignore: cast_nullable_to_non_nullable + as String?, + prev: freezed == prev + ? _self.prev + : prev // ignore: cast_nullable_to_non_nullable + as String?, + ), + ); + } +} diff --git a/packages/stream_chat/lib/src/core/models/voting_visibility.dart b/packages/stream_chat/lib/src/core/models/voting_visibility.dart new file mode 100644 index 0000000000..fec15626b0 --- /dev/null +++ b/packages/stream_chat/lib/src/core/models/voting_visibility.dart @@ -0,0 +1,12 @@ +/// The rule for who can see which option each user voted for in a poll. +/// +/// A visibility without a constant here can still be named by wrapping its +/// value: `VotingVisibility('members_only')`. +extension type const VotingVisibility(String _) implements String { + /// A visibility where votes are counted, but who cast them is hidden from + /// other users. + static const anonymous = VotingVisibility('anonymous'); + + /// A visibility where everyone can see who voted for which option. + static const public = VotingVisibility('public'); +} diff --git a/packages/stream_chat/lib/src/repository/mapper/filter_mapper.dart b/packages/stream_chat/lib/src/repository/mapper/filter_mapper.dart new file mode 100644 index 0000000000..5961fc7150 --- /dev/null +++ b/packages/stream_chat/lib/src/repository/mapper/filter_mapper.dart @@ -0,0 +1,7 @@ +import 'package:stream_core/stream_core.dart' show Filter; + +/// Maps a [Filter] to the filter of a generated request. +extension FilterRequestMapper on Filter { + /// Converts this filter into the map a generated request takes. + Map toRequest() => toJson(); +} diff --git a/packages/stream_chat/lib/src/repository/mapper/polls_mapper.dart b/packages/stream_chat/lib/src/repository/mapper/polls_mapper.dart new file mode 100644 index 0000000000..ff36b3be76 --- /dev/null +++ b/packages/stream_chat/lib/src/repository/mapper/polls_mapper.dart @@ -0,0 +1,174 @@ +import '../../../open_api/api.dart' as api; +import '../../core/models/poll.dart'; +import '../../core/models/poll_option.dart'; +import '../../core/models/poll_vote.dart'; +import '../../core/models/response/poll_option_response.dart'; +import '../../core/models/response/poll_response.dart'; +import '../../core/models/response/poll_vote_response.dart'; +import '../../core/models/response/query_poll_votes_response.dart'; +import '../../core/models/response/query_polls_response.dart'; +import '../../core/models/voting_visibility.dart'; +import 'user_mapper.dart'; + +/// Maps a generated [api.PollResponseData] to a [Poll]. +extension PollResponseDataMapper on api.PollResponseData { + /// Converts this poll into a [Poll]. + Poll toModel() => Poll( + id: id, + name: name, + nameI18n: nameI18n, + description: description, + descriptionI18n: descriptionI18n, + options: [for (final option in options) option.toModel()], + votingVisibility: VotingVisibility(votingVisibility), + enforceUniqueVote: enforceUniqueVote, + maxVotesAllowed: maxVotesAllowed, + allowAnswers: allowAnswers, + latestAnswers: [for (final answer in latestAnswers) answer.toModel()], + answersCount: answersCount, + allowUserSuggestedOptions: allowUserSuggestedOptions, + isClosed: isClosed ?? false, + createdAt: createdAt, + updatedAt: updatedAt, + voteCountsByOption: voteCountsByOption, + voteCount: voteCount, + latestVotesByOption: { + for (final MapEntry(key: optionId, value: votes) in latestVotesByOption.entries) + optionId: [for (final vote in votes) vote.toModel()], + }, + createdById: createdById, + createdBy: createdBy?.toModel(), + ownVotesAndAnswers: [for (final vote in ownVotes) vote.toModel()], + custom: custom, + ); +} + +/// Maps a generated [api.PollOptionResponseData] to a [PollOption]. +extension PollOptionResponseDataMapper on api.PollOptionResponseData { + /// Converts this option into a [PollOption]. + PollOption toModel() => PollOption( + id: id, + text: text, + textI18n: textI18n, + custom: custom, + ); +} + +/// Maps a generated [api.PollVoteResponseData] to a [PollVote]. +extension PollVoteResponseDataMapper on api.PollVoteResponseData { + /// Converts this vote into a [PollVote]. + PollVote toModel() => PollVote( + id: id, + pollId: pollId, + optionId: optionId, + answerText: answerText, + answerTextI18n: answerTextI18n, + createdAt: createdAt, + updatedAt: updatedAt, + userId: userId, + user: user?.toModel(), + ); +} + +/// Maps a generated [api.PollResponse] to a [PollResponse]. +extension PollResponseMapper on api.PollResponse { + /// Converts this response into a [PollResponse]. + PollResponse toModel() => PollResponse(duration: duration, poll: poll.toModel()); +} + +/// Maps a generated [api.PollOptionResponse] to a [PollOptionResponse]. +extension PollOptionResponseMapper on api.PollOptionResponse { + /// Converts this response into a [PollOptionResponse]. + PollOptionResponse toModel() => PollOptionResponse(duration: duration, pollOption: pollOption.toModel()); +} + +/// Maps a generated [api.PollVoteResponse] to a [PollVoteResponse]. +extension PollVoteResponseMapper on api.PollVoteResponse { + /// Converts this response into a [PollVoteResponse]. + PollVoteResponse toModel() => PollVoteResponse(duration: duration, vote: vote?.toModel()); +} + +/// Maps a generated [api.QueryPollsResponse] to a [QueryPollsResponse]. +extension QueryPollsResponseMapper on api.QueryPollsResponse { + /// Converts this response into a [QueryPollsResponse]. + QueryPollsResponse toModel() => QueryPollsResponse( + duration: duration, + polls: [for (final poll in polls) poll.toModel()], + next: next, + prev: prev, + ); +} + +/// Maps a generated [api.PollVotesResponse] to a [QueryPollVotesResponse]. +extension PollVotesResponseMapper on api.PollVotesResponse { + /// Converts this response into a [QueryPollVotesResponse]. + QueryPollVotesResponse toModel() => QueryPollVotesResponse( + duration: duration, + votes: [for (final vote in votes) vote.toModel()], + next: next, + prev: prev, + ); +} + +/// Maps a [Poll] to the generated requests that create and update it. +/// +/// Only the settings of the poll are sent; the vote summary is not. +extension PollRequestMapper on Poll { + /// Converts this poll into an [api.CreatePollRequest]. + /// + /// The ids of the [options] are left out: every option gets a new one when + /// the poll is created. + api.CreatePollRequest toCreatePollRequest() => api.CreatePollRequest( + id: id, + name: name, + description: description, + options: [for (final option in options) option.toPollOptionInput()], + votingVisibility: api.CreatePollRequestVotingVisibility.fromJson(votingVisibility), + enforceUniqueVote: enforceUniqueVote, + maxVotesAllowed: maxVotesAllowed, + allowAnswers: allowAnswers, + allowUserSuggestedOptions: allowUserSuggestedOptions, + isClosed: isClosed, + custom: custom, + ); + + /// Converts this poll into an [api.UpdatePollRequest]. + api.UpdatePollRequest toUpdatePollRequest() => api.UpdatePollRequest( + id: id, + name: name, + description: description, + options: [for (final option in options) option.toPollOptionRequest()], + votingVisibility: api.UpdatePollRequestVotingVisibility.fromJson(votingVisibility), + enforceUniqueVote: enforceUniqueVote, + maxVotesAllowed: maxVotesAllowed, + allowAnswers: allowAnswers, + allowUserSuggestedOptions: allowUserSuggestedOptions, + isClosed: isClosed, + custom: custom, + ); +} + +/// Maps a [PollOption] to the generated requests that create and update it. +extension PollOptionRequestMapper on PollOption { + /// Converts this option into an [api.PollOptionInput], an option of a poll + /// being created. + api.PollOptionInput toPollOptionInput() => api.PollOptionInput(text: text, custom: custom); + + /// Converts this option into an [api.PollOptionRequest], an option of a poll + /// being updated. + /// + /// An option without an [id] is sent with an empty one. + api.PollOptionRequest toPollOptionRequest() => api.PollOptionRequest(id: id ?? '', text: text, custom: custom); + + /// Converts this option into an [api.CreatePollOptionRequest]. + api.CreatePollOptionRequest toCreatePollOptionRequest() => api.CreatePollOptionRequest( + text: text, + custom: custom, + ); + + /// Converts this option into an [api.UpdatePollOptionRequest]. + /// + /// An option without an [id] is sent with an empty one. + api.UpdatePollOptionRequest toUpdatePollOptionRequest() => + api.UpdatePollOptionRequest(id: id ?? '', text: text, custom: custom); +} diff --git a/packages/stream_chat/lib/src/repository/mapper/sort_mapper.dart b/packages/stream_chat/lib/src/repository/mapper/sort_mapper.dart new file mode 100644 index 0000000000..86d0fdd050 --- /dev/null +++ b/packages/stream_chat/lib/src/repository/mapper/sort_mapper.dart @@ -0,0 +1,14 @@ +import 'package:stream_core/stream_core.dart' show Sort; + +import '../../../open_api/api.dart' as api; + +/// Maps a [Sort] to the generated [api.SortParamRequest]. +extension SortRequestMapper on Sort { + /// Converts this sort into an [api.SortParamRequest]. + api.SortParamRequest toRequest() { + return api.SortParamRequest( + field: field.remote, + direction: direction.value, + ); + } +} diff --git a/packages/stream_chat/lib/src/repository/polls_repository.dart b/packages/stream_chat/lib/src/repository/polls_repository.dart new file mode 100644 index 0000000000..5ae1780946 --- /dev/null +++ b/packages/stream_chat/lib/src/repository/polls_repository.dart @@ -0,0 +1,191 @@ +import 'package:stream_core/stream_core.dart' show PatternMatching, Result; + +import '../../open_api/api.dart' as api; +import '../core/models/poll.dart'; +import '../core/models/poll_option.dart'; +import '../core/models/poll_vote.dart'; +import '../core/models/response/poll_option_response.dart'; +import '../core/models/response/poll_response.dart'; +import '../core/models/response/poll_vote_response.dart'; +import '../core/models/response/query_poll_votes_response.dart'; +import '../core/models/response/query_polls_response.dart'; +import 'mapper/filter_mapper.dart'; +import 'mapper/polls_mapper.dart'; +import 'mapper/result_mapper.dart'; +import 'mapper/sort_mapper.dart'; + +/// Repository dedicated to poll operations. +class PollsRepository { + /// Initialize a new polls repository. + const PollsRepository(this._api); + + final api.DefaultApi _api; + + /// Creates [poll] with its settings and options. + Future> createPoll(Poll poll) async { + final result = await _api.createPoll(createPollRequest: poll.toCreatePollRequest()); + + return result.map((response) => response.toModel()); + } + + /// Fetches the poll with the id [pollId]. + Future> getPoll(String pollId) async { + final result = await _api.getPoll(pollId: pollId); + + return result.map((response) => response.toModel()); + } + + /// Updates [poll] to match the settings and options it carries. + /// + /// [Poll.options] becomes the poll's full list of options, each matched by + /// its id. + Future> updatePoll(Poll poll) async { + final result = await _api.updatePoll(updatePollRequest: poll.toUpdatePollRequest()); + + return result.map((response) => response.toModel()); + } + + /// Sets the fields in [set] and removes the fields named in [unset] on the + /// poll with the id [pollId]. + Future> partialUpdatePoll( + String pollId, { + Map? set, + List? unset, + }) async { + final result = await _api.updatePollPartial( + pollId: pollId, + updatePollPartialRequest: api.UpdatePollPartialRequest(set: set, unset: unset), + ); + + return result.map((response) => response.toModel()); + } + + /// Deletes the poll with the id [pollId]. + Future> deletePoll(String pollId) async { + final result = await _api.deletePoll(pollId: pollId); + + return result.ignoreValue(); + } + + /// Adds [option] to the poll with the id [pollId]. + Future> createPollOption(String pollId, PollOption option) async { + final result = await _api.createPollOption( + pollId: pollId, + createPollOptionRequest: option.toCreatePollOptionRequest(), + ); + + return result.map((response) => response.toModel()); + } + + /// Fetches an option of a poll, identified by [optionId] and [pollId]. + Future> getPollOption(String pollId, String optionId) async { + final result = await _api.getPollOption(pollId: pollId, optionId: optionId); + + return result.map((response) => response.toModel()); + } + + /// Replaces the text and custom data of [option] in the poll with the id + /// [pollId]. + /// + /// The [option] is matched by its id. + Future> updatePollOption(String pollId, PollOption option) async { + final result = await _api.updatePollOption( + pollId: pollId, + updatePollOptionRequest: option.toUpdatePollOptionRequest(), + ); + + return result.map((response) => response.toModel()); + } + + /// Removes an option from a poll, identified by [optionId] and [pollId]. + Future> deletePollOption(String pollId, String optionId) async { + final result = await _api.deletePollOption(pollId: pollId, optionId: optionId); + + return result.ignoreValue(); + } + + /// Casts a vote for an option of a poll sent in a message, identified by + /// [optionId], [pollId] and [messageId]. + Future> castPollVote( + String messageId, + String pollId, { + required String optionId, + }) => _castPollVote(messageId, pollId, api.VoteData(optionId: optionId)); + + /// Adds [answerText] as an answer to a poll sent in a message, identified by + /// [pollId] and [messageId]. + Future> addPollAnswer( + String messageId, + String pollId, { + required String answerText, + }) => _castPollVote(messageId, pollId, api.VoteData(answerText: answerText)); + + Future> _castPollVote(String messageId, String pollId, api.VoteData vote) async { + final result = await _api.castPollVote( + messageId: messageId, + pollId: pollId, + castPollVoteRequest: api.CastPollVoteRequest(vote: vote), + ); + + return result.map((response) => response.toModel()); + } + + /// Removes a vote or answer from a poll sent in a message, identified by + /// [voteId], [pollId] and [messageId]. + Future> removePollVote(String messageId, String pollId, String voteId) async { + final result = await _api.deletePollVote(messageId: messageId, pollId: pollId, voteId: voteId); + + return result.map((response) => response.toModel()); + } + + /// Fetches one page of the polls matching [filter], ordered by [sort]. + /// + /// [next] and [prev] are the cursors a previous page returned; at most one of + /// them may be given. + Future> queryPolls({ + PollFilter? filter, + List? sort, + int? limit, + String? next, + String? prev, + }) async { + final result = await _api.queryPolls( + queryPollsRequest: api.QueryPollsRequest( + filter: filter?.toRequest(), + sort: sort?.map((it) => it.toRequest()).toList(), + limit: limit, + next: next, + prev: prev, + ), + ); + + return result.map((response) => response.toModel()); + } + + /// Fetches one page of the votes and answers matching [filter] on the poll + /// with the id [pollId], ordered by [sort]. + /// + /// [next] and [prev] are the cursors a previous page returned; at most one of + /// them may be given. + Future> queryPollVotes( + String pollId, { + PollVoteFilter? filter, + List? sort, + int? limit, + String? next, + String? prev, + }) async { + final result = await _api.queryPollVotes( + pollId: pollId, + queryPollVotesRequest: api.QueryPollVotesRequest( + filter: filter?.toRequest(), + sort: sort?.map((it) => it.toRequest()).toList(), + limit: limit, + next: next, + prev: prev, + ), + ); + + return result.map((response) => response.toModel()); + } +} diff --git a/packages/stream_chat/lib/src/ws/events/event.dart b/packages/stream_chat/lib/src/ws/events/event.dart index e20d1fc247..d58edba04e 100644 --- a/packages/stream_chat/lib/src/ws/events/event.dart +++ b/packages/stream_chat/lib/src/ws/events/event.dart @@ -1,6 +1,7 @@ import 'package:json_annotation/json_annotation.dart'; import '../../../stream_chat.dart'; +import '../../core/models/converters/v1_json_converters.dart'; import '../../core/util/serializer.dart'; part 'event.g.dart'; @@ -103,9 +104,11 @@ class Event extends WsEvent { final Message? message; /// The poll sent with the event + @PollV1JsonConverter() final Poll? poll; /// The poll vote sent with the event + @PollVoteV1JsonConverter() final PollVote? pollVote; /// The channel sent with the event diff --git a/packages/stream_chat/lib/src/ws/events/event.g.dart b/packages/stream_chat/lib/src/ws/events/event.g.dart index bdc619305b..600b7d6bc3 100644 --- a/packages/stream_chat/lib/src/ws/events/event.g.dart +++ b/packages/stream_chat/lib/src/ws/events/event.g.dart @@ -15,8 +15,11 @@ Event _$EventFromJson(Map json) => Event( me: json['me'] == null ? null : OwnUser.fromJson(json['me'] as Map), user: json['user'] == null ? null : User.fromJson(json['user'] as Map), message: json['message'] == null ? null : Message.fromJson(json['message'] as Map), - poll: json['poll'] == null ? null : Poll.fromJson(json['poll'] as Map), - pollVote: json['poll_vote'] == null ? null : PollVote.fromJson(json['poll_vote'] as Map), + poll: _$JsonConverterFromJson, Poll>(json['poll'], const PollV1JsonConverter().fromJson), + pollVote: _$JsonConverterFromJson, PollVote>( + json['poll_vote'], + const PollVoteV1JsonConverter().fromJson, + ), totalUnreadCount: (json['total_unread_count'] as num?)?.toInt(), unreadChannels: (json['unread_channels'] as num?)?.toInt(), reaction: json['reaction'] == null ? null : Reaction.fromJson(json['reaction'] as Map), @@ -48,14 +51,10 @@ Event _$EventFromJson(Map json) => Event( reminder: json['reminder'] == null ? null : MessageReminder.fromJson(json['reminder'] as Map), pushPreference: json['push_preference'] == null ? null - : PushPreference.fromJson( - json['push_preference'] as Map, - ), + : PushPreference.fromJson(json['push_preference'] as Map), channelPushPreference: json['channel_push_preference'] == null ? null - : ChannelPushPreference.fromJson( - json['channel_push_preference'] as Map, - ), + : ChannelPushPreference.fromJson(json['channel_push_preference'] as Map), channelMemberCount: (json['channel_member_count'] as num?)?.toInt(), channelMessageCount: (json['channel_message_count'] as num?)?.toInt(), watcherCount: (json['watcher_count'] as num?)?.toInt(), @@ -77,8 +76,11 @@ Map _$EventToJson(Event instance) => { 'me': ?instance.me?.toJson(), 'user': ?instance.user?.toJson(), 'message': ?instance.message?.toJson(), - 'poll': ?instance.poll?.toJson(), - 'poll_vote': ?instance.pollVote?.toJson(), + 'poll': ?_$JsonConverterToJson, Poll>(instance.poll, const PollV1JsonConverter().toJson), + 'poll_vote': ?_$JsonConverterToJson, PollVote>( + instance.pollVote, + const PollVoteV1JsonConverter().toJson, + ), 'channel': ?instance.channel?.toJson(), 'member': ?instance.member?.toJson(), 'reaction': ?instance.reaction?.toJson(), @@ -110,6 +112,9 @@ Map _$EventToJson(Event instance) => { 'extra_data': instance.extraData, }; +Value? _$JsonConverterFromJson(Object? json, Value? Function(Json json) fromJson) => + json == null ? null : fromJson(json as Json); + const _$AITypingStateEnumMap = { AITypingState.idle: 'AI_STATE_IDLE', AITypingState.error: 'AI_STATE_ERROR', @@ -117,3 +122,6 @@ const _$AITypingStateEnumMap = { AITypingState.thinking: 'AI_STATE_THINKING', AITypingState.generating: 'AI_STATE_GENERATING', }; + +Json? _$JsonConverterToJson(Value? value, Json? Function(Value value) toJson) => + value == null ? null : toJson(value); diff --git a/packages/stream_chat/lib/stream_chat.dart b/packages/stream_chat/lib/stream_chat.dart index a4877847c5..9b2d92fe95 100644 --- a/packages/stream_chat/lib/stream_chat.dart +++ b/packages/stream_chat/lib/stream_chat.dart @@ -129,6 +129,11 @@ export 'src/core/models/response/list_devices_response.dart'; export 'src/core/models/response/list_user_groups_response.dart'; export 'src/core/models/response/mute_users_response.dart'; export 'src/core/models/response/og_attachment_response.dart'; +export 'src/core/models/response/poll_option_response.dart'; +export 'src/core/models/response/poll_response.dart'; +export 'src/core/models/response/poll_vote_response.dart'; +export 'src/core/models/response/query_poll_votes_response.dart'; +export 'src/core/models/response/query_polls_response.dart'; export 'src/core/models/response/remove_user_group_members_response.dart'; export 'src/core/models/response/search_roles_response.dart'; export 'src/core/models/response/search_user_groups_response.dart'; @@ -144,6 +149,7 @@ export 'src/core/models/user.dart'; export 'src/core/models/user_block.dart'; export 'src/core/models/user_group.dart'; export 'src/core/models/user_group_member.dart'; +export 'src/core/models/voting_visibility.dart'; export 'src/core/util/extension.dart'; export 'src/core/util/message_rules.dart'; export 'src/db/chat_persistence_client.dart'; diff --git a/packages/stream_chat/test/fixtures/poll.json b/packages/stream_chat/test/fixtures/poll.json deleted file mode 100644 index 6dd7f46ded..0000000000 --- a/packages/stream_chat/test/fixtures/poll.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "id": "7fd88eb3-fc05-4e89-89af-36c6d8995dda", - "name": "test", - "description": "", - "voting_visibility": "public", - "enforce_unique_vote": false, - "max_votes_allowed": null, - "allow_user_suggested_options": false, - "allow_answers": false, - "vote_count": 0, - "options": [ - { - "id": "option1", - "text": "option1 text" - } - ], - "answers_count": 0, - "vote_counts_by_option": null, - "latest_votes_by_option": {}, - "own_votes": [ - { - "created_at": "2022-02-03T15:47:10.148169Z", - "id": "luke_skywalker", - "option_id": "option1", - "poll_id": "7fd88eb3-fc05-4e89-89af-36c6d8995dda", - "updated_at": "2024-03-18T16:44:45.749718Z" - } - ], - "created_by_id": "luke_skywalker", - "created_by": { - "id": "luke_skywalker", - "role": "user", - "created_at": "2022-02-03T15:47:10.148169Z", - "updated_at": "2024-03-18T16:44:45.749718Z", - "last_active": "2024-04-17T14:46:22.723731831Z", - "banned": false, - "online": true, - "name": "Luke Skywalker", - "image": "https://vignette.wikia.nocookie.net/starwars/images/2/20/LukeTLJ.jpg", - "birthland": "Tatooine" - }, - "created_at": "2024-04-17T14:46:23.001349Z", - "updated_at": "2024-04-17T14:46:23.001349Z" -} \ No newline at end of file diff --git a/packages/stream_chat/test/src/client/channel/channel_polls_test.dart b/packages/stream_chat/test/src/client/channel/channel_polls_test.dart new file mode 100644 index 0000000000..60bba74ee6 --- /dev/null +++ b/packages/stream_chat/test/src/client/channel/channel_polls_test.dart @@ -0,0 +1,334 @@ +import 'package:mocktail/mocktail.dart'; +import 'package:stream_chat/stream_chat.dart'; +import 'package:test/test.dart'; + +import '../../fakes.dart'; +import '../../mocks.dart'; +import '../../utils.dart'; + +const _channelId = 'test-channel-id'; +const _channelType = 'test-channel-type'; + +void main() { + test('Channel.sendPoll creates the poll and sends it in a message', () async { + final client = _client(); + final channel = _initializedChannel(client); + final createdPoll = _poll.copyWith(id: 'created-poll-id'); + when(() => client.createPoll(_poll)).thenAnswer((_) async => Result.success(_pollResponse(createdPoll))); + when( + () => client.sendMessage(any(), _channelId, _channelType), + ).thenAnswer( + (invocation) async => SendMessageResponse()..message = invocation.positionalArguments.first as Message, + ); + + final result = await channel.sendPoll(_poll, messageText: 'Vote please'); + + final sent = verify(() => client.sendMessage(captureAny(), _channelId, _channelType)).captured.single as Message; + expect(sent.text, 'Vote please'); + expect(sent.pollId, 'created-poll-id'); + expect(sent.poll, createdPoll); + expect(result.getOrNull()?.message.id, sent.id); + }); + + test('Channel.sendPoll returns the failure to create the poll without sending a message', () async { + final client = _client(); + final channel = _initializedChannel(client); + const error = StreamClientException(message: 'boom'); + when(() => client.createPoll(_poll)).thenAnswer((_) async => const Result.failure(error)); + + final result = await channel.sendPoll(_poll); + + expect(result.exceptionOrNull(), error); + verifyNever(() => client.sendMessage(any(), any(), any())); + }); + + test('Channel.sendPoll returns the failure to send the message without throwing', () async { + final client = _client(); + final channel = _initializedChannel(client); + final error = apiException(code: StreamErrorCode.notAllowed, statusCode: 403); + when(() => client.createPoll(_poll)).thenAnswer((_) async => Result.success(_pollResponse(_poll))); + when(() => client.sendMessage(any(), _channelId, _channelType)).thenThrow(error); + + final result = await channel.sendPoll(_poll); + + expect(result.exceptionOrNull(), error); + }); + + test('Channel.updatePoll returns the updated poll', () async { + final client = _client(); + final channel = _initializedChannel(client); + when(() => client.updatePoll(_poll)).thenAnswer((_) async => Result.success(_pollResponse(_poll))); + + final result = await channel.updatePoll(_poll); + + expect(result, Result.success(_pollResponse(_poll))); + }); + + test('Channel.deletePoll deletes the poll and returns a success', () async { + final client = _client(); + final channel = _initializedChannel(client); + when(() => client.deletePoll(_poll.id)).thenAnswer((_) async => const Result.success(null)); + + final result = await channel.deletePoll(_poll); + + expect(result, const Result.success(null)); + }); + + test('Channel.closePoll closes the poll and returns it', () async { + final client = _client(); + final channel = _initializedChannel(client); + final closed = _poll.copyWith(isClosed: true); + when(() => client.closePoll(_poll.id)).thenAnswer((_) async => Result.success(_pollResponse(closed))); + + final result = await channel.closePoll(_poll); + + expect(result, Result.success(_pollResponse(closed))); + }); + + test('Channel.createPollOption adds the option to the poll and returns it', () async { + final client = _client(); + final channel = _initializedChannel(client); + const option = PollOption(text: 'Sushi'); + const response = PollOptionResponse( + duration: '4.21ms', + pollOption: PollOption(id: 'sushi', text: 'Sushi'), + ); + when(() => client.createPollOption(_poll.id, option)).thenAnswer((_) async => const Result.success(response)); + + final result = await channel.createPollOption(_poll, option); + + expect(result, const Result.success(response)); + }); + + test('Channel.castPollVote votes for the option and returns the vote', () async { + final client = _client(); + final channel = _initializedChannel(client); + final response = PollVoteResponse(duration: '4.21ms', vote: _vote); + when( + () => client.castPollVote(_message.id, _poll.id, optionId: 'pizza'), + ).thenAnswer((_) async => Result.success(response)); + + final result = await channel.castPollVote(_message, _poll, const PollOption(id: 'pizza', text: 'Pizza')); + + expect(result, Result.success(response)); + }); + + test('Channel.castPollVote returns a failure without voting when the option has no id', () async { + final client = _client(); + final channel = _initializedChannel(client); + + final result = await channel.castPollVote(_message, _poll, const PollOption(text: 'Pizza')); + + expect(result.exceptionOrNull(), isA()); + verifyNever(() => client.castPollVote(any(), any(), optionId: any(named: 'optionId'))); + }); + + test('Channel.addPollAnswer leaves the answer and returns it', () async { + final client = _client(); + final channel = _initializedChannel(client); + final response = PollVoteResponse(duration: '4.21ms', vote: _vote); + when( + () => client.addPollAnswer(_message.id, _poll.id, answerText: 'Anything'), + ).thenAnswer((_) async => Result.success(response)); + + final result = await channel.addPollAnswer(_message, _poll, answerText: 'Anything'); + + expect(result, Result.success(response)); + }); + + test('Channel.removePollVote removes the vote and returns it', () async { + final client = _client(); + final channel = _initializedChannel(client); + final response = PollVoteResponse(duration: '4.21ms', vote: _vote); + when( + () => client.removePollVote(_message.id, _poll.id, 'vote-id'), + ).thenAnswer((_) async => Result.success(response)); + + final result = await channel.removePollVote(_message, _poll, _vote); + + expect(result, Result.success(response)); + }); + + test('Channel.removePollVote returns a failure without removing anything when the vote has no id', () async { + final client = _client(); + final channel = _initializedChannel(client); + + final result = await channel.removePollVote(_message, _poll, PollVote(optionId: 'pizza')); + + expect(result.exceptionOrNull(), isA()); + verifyNever(() => client.removePollVote(any(), any(), any())); + }); + + test('Channel.queryPollVotes forwards the query and returns the matching votes', () async { + final client = _client(); + final channel = _initializedChannel(client); + final filter = Filter.equal(PollVoteFilterField.isAnswer, true); + final sort = [PollVoteSort.desc(PollVoteSortField.createdAt)]; + final response = QueryPollVotesResponse(duration: '4.21ms', votes: [_vote], next: 'after'); + when( + () => client.queryPollVotes(_poll.id, filter: filter, sort: sort, limit: 5, next: 'cursor'), + ).thenAnswer((_) async => Result.success(response)); + + final result = await channel.queryPollVotes(_poll.id, filter: filter, sort: sort, limit: 5, next: 'cursor'); + + expect(result, Result.success(response)); + }); + + test('Channel.queryPollVotes forwards the previous-page cursor and ten as the default limit', () async { + final client = _client(); + final channel = _initializedChannel(client); + const response = QueryPollVotesResponse(duration: '4.21ms', votes: []); + when( + () => client.queryPollVotes(_poll.id, limit: 10, prev: 'cursor'), + ).thenAnswer((_) async => const Result.success(response)); + + final result = await channel.queryPollVotes(_poll.id, prev: 'cursor'); + + expect(result, const Result.success(response)); + }); + + test('Channel.sendPoll reports an unexpected error sending the message as a client failure', () async { + final client = _client(); + final channel = _initializedChannel(client); + final thrown = StateError('unexpected'); + when(() => client.createPoll(_poll)).thenAnswer((_) async => Result.success(_pollResponse(_poll))); + when(() => client.sendMessage(any(), _channelId, _channelType)).thenThrow(thrown); + + final result = await channel.sendPoll(_poll); + + expect(result.exceptionOrNull(), isA().having((it) => it.cause, 'cause', thrown)); + }); + + test('Channel.updatePoll returns the failure without throwing', () async { + final client = _client(); + final channel = _initializedChannel(client); + when(() => client.updatePoll(_poll)).thenAnswer((_) async => const Result.failure(_error)); + + final result = await channel.updatePoll(_poll); + + expect(result.exceptionOrNull(), _error); + }); + + test('Channel.deletePoll returns the failure without throwing', () async { + final client = _client(); + final channel = _initializedChannel(client); + when(() => client.deletePoll(_poll.id)).thenAnswer((_) async => const Result.failure(_error)); + + final result = await channel.deletePoll(_poll); + + expect(result.exceptionOrNull(), _error); + }); + + test('Channel.closePoll returns the failure without throwing', () async { + final client = _client(); + final channel = _initializedChannel(client); + when(() => client.closePoll(_poll.id)).thenAnswer((_) async => const Result.failure(_error)); + + final result = await channel.closePoll(_poll); + + expect(result.exceptionOrNull(), _error); + }); + + test('Channel.createPollOption returns the failure without throwing', () async { + final client = _client(); + final channel = _initializedChannel(client); + const option = PollOption(text: 'Sushi'); + when(() => client.createPollOption(_poll.id, option)).thenAnswer((_) async => const Result.failure(_error)); + + final result = await channel.createPollOption(_poll, option); + + expect(result.exceptionOrNull(), _error); + }); + + test('Channel.castPollVote returns the failure without throwing', () async { + final client = _client(); + final channel = _initializedChannel(client); + when( + () => client.castPollVote(_message.id, _poll.id, optionId: 'pizza'), + ).thenAnswer((_) async => const Result.failure(_error)); + + final result = await channel.castPollVote(_message, _poll, const PollOption(id: 'pizza', text: 'Pizza')); + + expect(result.exceptionOrNull(), _error); + }); + + test('Channel.addPollAnswer returns the failure without throwing', () async { + final client = _client(); + final channel = _initializedChannel(client); + when( + () => client.addPollAnswer(_message.id, _poll.id, answerText: 'Anything'), + ).thenAnswer((_) async => const Result.failure(_error)); + + final result = await channel.addPollAnswer(_message, _poll, answerText: 'Anything'); + + expect(result.exceptionOrNull(), _error); + }); + + test('Channel.removePollVote returns the failure without throwing', () async { + final client = _client(); + final channel = _initializedChannel(client); + when( + () => client.removePollVote(_message.id, _poll.id, 'vote-id'), + ).thenAnswer((_) async => const Result.failure(_error)); + + final result = await channel.removePollVote(_message, _poll, _vote); + + expect(result.exceptionOrNull(), _error); + }); + + test('Channel.queryPollVotes returns the failure without throwing', () async { + final client = _client(); + final channel = _initializedChannel(client); + when(() => client.queryPollVotes(_poll.id, limit: 10)).thenAnswer((_) async => const Result.failure(_error)); + + final result = await channel.queryPollVotes(_poll.id); + + expect(result.exceptionOrNull(), _error); + }); +} + +const _error = StreamClientException(message: 'boom'); + +final _poll = Poll( + id: 'poll-id', + name: 'Lunch?', + options: const [PollOption(id: 'pizza', text: 'Pizza')], + createdAt: DateTime.utc(2024), + updatedAt: DateTime.utc(2024), +); + +final _message = Message(id: 'message-id', pollId: 'poll-id'); + +final _vote = PollVote( + id: 'vote-id', + pollId: 'poll-id', + optionId: 'pizza', + createdAt: DateTime.utc(2024), + updatedAt: DateTime.utc(2024), +); + +PollResponse _pollResponse(Poll poll) => PollResponse(duration: '4.21ms', poll: poll); + +MockStreamChatClient _client() { + registerFallbackValue(FakeMessage()); + + final client = MockStreamChatClient(); + when(() => client.retryPolicy).thenReturn( + RetryPolicy(shouldRetry: (_, _, _) => false, delayFactor: Duration.zero), + ); + when(() => client.state).thenReturn(FakeClientState()); + when(() => client.moderation).thenReturn(MockModerationClient()); + when(() => client.channelDeliveryReporter.submitForDelivery(any())).thenAnswer((_) async {}); + return client; +} + +Channel _initializedChannel(StreamChatClient client) { + final channel = Channel.fromState( + client, + ChannelState( + channel: ChannelModel(id: _channelId, type: _channelType), + ), + ); + addTearDown(channel.dispose); + return channel; +} diff --git a/packages/stream_chat/test/src/client/client_polls_test.dart b/packages/stream_chat/test/src/client/client_polls_test.dart new file mode 100644 index 0000000000..db3f1add98 --- /dev/null +++ b/packages/stream_chat/test/src/client/client_polls_test.dart @@ -0,0 +1,642 @@ +import 'package:mocktail/mocktail.dart'; +import 'package:stream_chat/open_api/api.dart' as api; +import 'package:stream_chat/stream_chat.dart'; +import 'package:test/test.dart'; + +import '../mocks.dart'; +import 'poll_fixtures.dart'; + +void main() { + late MockDefaultApi defaultApi; + late StreamChatClient client; + + setUpAll(() { + registerFallbackValue(const api.CreatePollRequest(name: 'fallback')); + registerFallbackValue(const api.UpdatePollRequest(id: 'fallback', name: 'fallback')); + registerFallbackValue(const api.CreatePollOptionRequest(text: 'fallback')); + registerFallbackValue(const api.UpdatePollOptionRequest(id: 'fallback', text: 'fallback')); + }); + + setUp(() { + defaultApi = MockDefaultApi(); + client = StreamChatClient('test-api-key', defaultApi: defaultApi); + }); + + test('StreamChatClient.createPoll sends the poll settings and returns the created poll', () async { + when( + () => defaultApi.createPoll(createPollRequest: any(named: 'createPollRequest')), + ).thenAnswer((_) async => Result.success(generatedPollResponse)); + + final result = await client.createPoll(_newPoll()); + + final request = verify( + () => defaultApi.createPoll(createPollRequest: captureAny(named: 'createPollRequest')), + ).captured.single; + expect( + request, + const api.CreatePollRequest( + id: 'poll-id', + name: 'Lunch?', + description: 'Pick one', + options: [ + api.PollOptionInput(text: 'Pizza', custom: {'color': 'red', 'text': 'Pasta'}), + api.PollOptionInput(text: 'Sushi', custom: {}), + ], + votingVisibility: api.CreatePollRequestVotingVisibility.anonymous, + enforceUniqueVote: false, + maxVotesAllowed: 2, + allowAnswers: true, + allowUserSuggestedOptions: true, + isClosed: false, + custom: {'topic': 'food', 'name': 'Dinner?'}, + ), + ); + expect(result, Result.success(pollResponse)); + }); + + test('StreamChatClient.createPoll returns the failure without throwing', () async { + when( + () => defaultApi.createPoll(createPollRequest: any(named: 'createPollRequest')), + ).thenAnswer((_) async => const Result.failure(pollsApiError)); + + final result = await client.createPoll(_newPoll()); + + expect(result.exceptionOrNull(), pollsApiError); + }); + + test('StreamChatClient.getPoll sends the poll id and returns the poll', () async { + when(() => defaultApi.getPoll(pollId: 'poll-id')).thenAnswer((_) async => Result.success(generatedPollResponse)); + + final result = await client.getPoll('poll-id'); + + expect(result, Result.success(pollResponse)); + }); + + test('StreamChatClient.getPoll returns the failure without throwing', () async { + when(() => defaultApi.getPoll(pollId: 'poll-id')).thenAnswer((_) async => const Result.failure(pollsApiError)); + + final result = await client.getPoll('poll-id'); + + expect(result.exceptionOrNull(), pollsApiError); + }); + + test( + "StreamChatClient.getPoll keeps a custom field named like one of the poll's own fields", + () async { + final response = api.PollResponse( + duration: '4.21ms', + poll: generatedPoll.copyWith(custom: const {'topic': 'food', 'name': 'custom-name', 'own_votes': 'custom'}), + ); + when(() => defaultApi.getPoll(pollId: 'poll-id')).thenAnswer((_) async => Result.success(response)); + + final result = await client.getPoll('poll-id'); + + expect(result.getOrNull()?.poll.custom, const { + 'topic': 'food', + 'name': 'custom-name', + 'own_votes': 'custom', + }); + }, + ); + + test('StreamChatClient.getPoll keeps a voting visibility the SDK does not name', () async { + final response = api.PollResponse( + duration: '4.21ms', + poll: generatedPoll.copyWith(votingVisibility: api.PollResponseDataVotingVisibility.fromJson('members_only')), + ); + when(() => defaultApi.getPoll(pollId: 'poll-id')).thenAnswer((_) async => Result.success(response)); + + final result = await client.getPoll('poll-id'); + + expect(result.getOrNull()?.poll.votingVisibility, const VotingVisibility('members_only')); + }); + + test("StreamChatClient.getPoll reads someone else's vote in an anonymous poll without a user", () async { + final response = api.PollResponse( + duration: '4.21ms', + poll: generatedPoll.copyWith( + latestVotesByOption: { + 'pizza': [generatedVote.copyWith(userId: null, user: null)], + }, + ), + ); + when(() => defaultApi.getPoll(pollId: 'poll-id')).thenAnswer((_) async => Result.success(response)); + + final result = await client.getPoll('poll-id'); + + final pizzaVote = result.getOrNull()?.poll.latestVotesByOption['pizza']?.single; + expect((pizzaVote?.userId, pizzaVote?.user), (null, null)); + }); + + test('StreamChatClient.getPoll reads a poll that does not say whether it is closed as open', () async { + final response = api.PollResponse(duration: '4.21ms', poll: generatedPoll.copyWith(isClosed: null)); + when(() => defaultApi.getPoll(pollId: 'poll-id')).thenAnswer((_) async => Result.success(response)); + + final result = await client.getPoll('poll-id'); + + expect(result.getOrNull()?.poll.isClosed, isFalse); + }); + + test('StreamChatClient.updatePoll sends the poll settings and options and returns the updated poll', () async { + when( + () => defaultApi.updatePoll(updatePollRequest: any(named: 'updatePollRequest')), + ).thenAnswer((_) async => Result.success(generatedPollResponse)); + + final result = await client.updatePoll( + _newPoll().copyWith( + options: const [ + PollOption(id: 'pizza', text: 'Pizza', custom: {'color': 'red', 'id': 'pasta'}), + PollOption(id: 'sushi', text: 'Sushi'), + ], + votingVisibility: const VotingVisibility('members_only'), + isClosed: true, + ), + ); + + final request = verify( + () => defaultApi.updatePoll(updatePollRequest: captureAny(named: 'updatePollRequest')), + ).captured.single; + expect( + request, + api.UpdatePollRequest( + id: 'poll-id', + name: 'Lunch?', + description: 'Pick one', + options: const [ + api.PollOptionRequest(id: 'pizza', text: 'Pizza', custom: {'color': 'red', 'id': 'pasta'}), + api.PollOptionRequest(id: 'sushi', text: 'Sushi', custom: {}), + ], + votingVisibility: api.UpdatePollRequestVotingVisibility.fromJson('members_only'), + enforceUniqueVote: false, + maxVotesAllowed: 2, + allowAnswers: true, + allowUserSuggestedOptions: true, + isClosed: true, + custom: const {'topic': 'food', 'name': 'Dinner?'}, + ), + ); + expect(result, Result.success(pollResponse)); + }); + + test('StreamChatClient.updatePoll sends an option without an id with an empty id', () async { + when( + () => defaultApi.updatePoll(updatePollRequest: any(named: 'updatePollRequest')), + ).thenAnswer((_) async => Result.success(generatedPollResponse)); + + await client.updatePoll(_newPoll().copyWith(options: const [PollOption(text: 'Pizza')])); + + final request = + verify( + () => defaultApi.updatePoll(updatePollRequest: captureAny(named: 'updatePollRequest')), + ).captured.single + as api.UpdatePollRequest; + expect(request.options, const [api.PollOptionRequest(id: '', text: 'Pizza', custom: {})]); + }); + + test('StreamChatClient.updatePoll returns the failure without throwing', () async { + when( + () => defaultApi.updatePoll(updatePollRequest: any(named: 'updatePollRequest')), + ).thenAnswer((_) async => const Result.failure(pollsApiError)); + + final result = await client.updatePoll(poll); + + expect(result.exceptionOrNull(), pollsApiError); + }); + + test('StreamChatClient.partialUpdatePoll sends the fields to set and unset and returns the updated poll', () async { + when( + () => defaultApi.updatePollPartial( + pollId: 'poll-id', + updatePollPartialRequest: const api.UpdatePollPartialRequest( + set: {'name': 'Dinner?'}, + unset: ['description'], + ), + ), + ).thenAnswer((_) async => Result.success(generatedPollResponse)); + + final result = await client.partialUpdatePoll('poll-id', set: {'name': 'Dinner?'}, unset: ['description']); + + expect(result, Result.success(pollResponse)); + }); + + test('StreamChatClient.partialUpdatePoll returns the failure without throwing', () async { + when( + () => defaultApi.updatePollPartial( + pollId: 'poll-id', + updatePollPartialRequest: const api.UpdatePollPartialRequest(set: {'name': 'Dinner?'}), + ), + ).thenAnswer((_) async => const Result.failure(pollsApiError)); + + final result = await client.partialUpdatePoll('poll-id', set: {'name': 'Dinner?'}); + + expect(result.exceptionOrNull(), pollsApiError); + }); + + test('StreamChatClient.closePoll marks the poll closed and returns the closed poll', () async { + when( + () => defaultApi.updatePollPartial( + pollId: 'poll-id', + updatePollPartialRequest: const api.UpdatePollPartialRequest(set: {'is_closed': true}), + ), + ).thenAnswer((_) async => Result.success(generatedPollResponse)); + + final result = await client.closePoll('poll-id'); + + expect(result, Result.success(pollResponse)); + }); + + test('StreamChatClient.closePoll returns the failure without throwing', () async { + when( + () => defaultApi.updatePollPartial( + pollId: 'poll-id', + updatePollPartialRequest: const api.UpdatePollPartialRequest(set: {'is_closed': true}), + ), + ).thenAnswer((_) async => const Result.failure(pollsApiError)); + + final result = await client.closePoll('poll-id'); + + expect(result.exceptionOrNull(), pollsApiError); + }); + + test('StreamChatClient.deletePoll sends the poll id and returns a success', () async { + when( + () => defaultApi.deletePoll(pollId: 'poll-id'), + ).thenAnswer((_) async => const Result.success(api.DurationResponse(duration: '4.21ms'))); + + final result = await client.deletePoll('poll-id'); + + expect(result, const Result.success(null)); + }); + + test('StreamChatClient.deletePoll returns the failure without throwing', () async { + when(() => defaultApi.deletePoll(pollId: 'poll-id')).thenAnswer((_) async => const Result.failure(pollsApiError)); + + final result = await client.deletePoll('poll-id'); + + expect(result.exceptionOrNull(), pollsApiError); + }); + + test('StreamChatClient.queryPolls sends the filter, sort and cursor and returns the matching polls', () async { + when( + () => defaultApi.queryPolls( + queryPollsRequest: const api.QueryPollsRequest( + filter: { + 'is_closed': {r'$eq': true}, + }, + sort: [api.SortParamRequest(field: 'created_at', direction: -1)], + limit: 10, + next: 'next-cursor', + ), + ), + ).thenAnswer( + (_) async => Result.success( + api.QueryPollsResponse(duration: '4.21ms', polls: [generatedPoll], next: 'after', prev: 'before'), + ), + ); + + final result = await client.queryPolls( + filter: Filter.equal(PollFilterField.isClosed, true), + sort: [PollSort.desc(PollSortField.createdAt)], + limit: 10, + next: 'next-cursor', + ); + + expect( + result, + Result.success(QueryPollsResponse(duration: '4.21ms', polls: [poll], next: 'after', prev: 'before')), + ); + }); + + test('StreamChatClient.queryPolls sends the previous-page cursor and ten as the default limit', () async { + when( + () => defaultApi.queryPolls(queryPollsRequest: const api.QueryPollsRequest(limit: 10, prev: 'prev-cursor')), + ).thenAnswer((_) async => const Result.success(api.QueryPollsResponse(duration: '4.21ms', polls: []))); + + final result = await client.queryPolls(prev: 'prev-cursor'); + + expect(result, const Result.success(QueryPollsResponse(duration: '4.21ms', polls: []))); + }); + + test('StreamChatClient.queryPolls returns the failure without throwing', () async { + when( + () => defaultApi.queryPolls(queryPollsRequest: const api.QueryPollsRequest(limit: 10)), + ).thenAnswer((_) async => const Result.failure(pollsApiError)); + + final result = await client.queryPolls(); + + expect(result.exceptionOrNull(), pollsApiError); + }); + + test( + 'StreamChatClient.createPollOption sends the option text and custom data and returns the created option', + () async { + when( + () => defaultApi.createPollOption( + pollId: 'poll-id', + createPollOptionRequest: const api.CreatePollOptionRequest( + text: 'Pizza', + custom: {'color': 'red', 'text': 'Pasta'}, + ), + ), + ).thenAnswer((_) async => const Result.success(_generatedPizzaResponse)); + + final result = await client.createPollOption( + 'poll-id', + const PollOption(text: 'Pizza', custom: {'color': 'red', 'text': 'Pasta'}), + ); + + expect(result, const Result.success(_pizzaResponse)); + }, + ); + + test('StreamChatClient.createPollOption returns the failure without throwing', () async { + when( + () => defaultApi.createPollOption( + pollId: 'poll-id', + createPollOptionRequest: any(named: 'createPollOptionRequest'), + ), + ).thenAnswer((_) async => const Result.failure(pollsApiError)); + + final result = await client.createPollOption('poll-id', const PollOption(text: 'Pizza')); + + expect(result.exceptionOrNull(), pollsApiError); + }); + + test('StreamChatClient.getPollOption sends the poll and option ids and returns the option', () async { + when( + () => defaultApi.getPollOption(pollId: 'poll-id', optionId: 'pizza'), + ).thenAnswer((_) async => const Result.success(_generatedPizzaResponse)); + + final result = await client.getPollOption('poll-id', 'pizza'); + + expect(result, const Result.success(_pizzaResponse)); + }); + + test('StreamChatClient.getPollOption returns the failure without throwing', () async { + when( + () => defaultApi.getPollOption(pollId: 'poll-id', optionId: 'pizza'), + ).thenAnswer((_) async => const Result.failure(pollsApiError)); + + final result = await client.getPollOption('poll-id', 'pizza'); + + expect(result.exceptionOrNull(), pollsApiError); + }); + + test( + "StreamChatClient.getPollOption keeps a custom field named like one of the option's own fields", + () async { + final response = api.PollOptionResponse( + duration: '4.21ms', + pollOption: generatedPizza.copyWith(custom: const {'color': 'red', 'text': 'custom-text'}), + ); + when( + () => defaultApi.getPollOption(pollId: 'poll-id', optionId: 'pizza'), + ).thenAnswer((_) async => Result.success(response)); + + final result = await client.getPollOption('poll-id', 'pizza'); + + expect(result.getOrNull()?.pollOption.custom, const {'color': 'red', 'text': 'custom-text'}); + }, + ); + + test('StreamChatClient.updatePollOption sends the option and returns the updated option', () async { + when( + () => defaultApi.updatePollOption( + pollId: 'poll-id', + updatePollOptionRequest: const api.UpdatePollOptionRequest( + id: 'pizza', + text: 'Pizza', + custom: {'color': 'red'}, + ), + ), + ).thenAnswer((_) async => const Result.success(_generatedPizzaResponse)); + + final result = await client.updatePollOption('poll-id', pizza); + + expect(result, const Result.success(_pizzaResponse)); + }); + + test('StreamChatClient.updatePollOption sends an option without an id with an empty id', () async { + when( + () => defaultApi.updatePollOption( + pollId: 'poll-id', + updatePollOptionRequest: const api.UpdatePollOptionRequest(id: '', text: 'Pizza', custom: {}), + ), + ).thenAnswer((_) async => const Result.success(_generatedPizzaResponse)); + + final result = await client.updatePollOption('poll-id', const PollOption(text: 'Pizza')); + + expect(result, const Result.success(_pizzaResponse)); + }); + + test('StreamChatClient.updatePollOption returns the failure without throwing', () async { + when( + () => defaultApi.updatePollOption( + pollId: 'poll-id', + updatePollOptionRequest: any(named: 'updatePollOptionRequest'), + ), + ).thenAnswer((_) async => const Result.failure(pollsApiError)); + + final result = await client.updatePollOption('poll-id', pizza); + + expect(result.exceptionOrNull(), pollsApiError); + }); + + test('StreamChatClient.deletePollOption sends the poll and option ids and returns a success', () async { + when( + () => defaultApi.deletePollOption(pollId: 'poll-id', optionId: 'pizza'), + ).thenAnswer((_) async => const Result.success(api.DurationResponse(duration: '4.21ms'))); + + final result = await client.deletePollOption('poll-id', 'pizza'); + + expect(result, const Result.success(null)); + }); + + test('StreamChatClient.deletePollOption returns the failure without throwing', () async { + when( + () => defaultApi.deletePollOption(pollId: 'poll-id', optionId: 'pizza'), + ).thenAnswer((_) async => const Result.failure(pollsApiError)); + + final result = await client.deletePollOption('poll-id', 'pizza'); + + expect(result.exceptionOrNull(), pollsApiError); + }); + + test('StreamChatClient.castPollVote sends the selected option and returns the cast vote', () async { + when( + () => defaultApi.castPollVote( + messageId: 'message-id', + pollId: 'poll-id', + castPollVoteRequest: const api.CastPollVoteRequest(vote: api.VoteData(optionId: 'pizza')), + ), + ).thenAnswer( + (_) async => Result.success(api.PollVoteResponse(duration: '4.21ms', poll: generatedPoll, vote: generatedVote)), + ); + + final result = await client.castPollVote('message-id', 'poll-id', optionId: 'pizza'); + + expect(result, Result.success(PollVoteResponse(duration: '4.21ms', vote: vote))); + }); + + test('StreamChatClient.castPollVote returns the failure without throwing', () async { + when( + () => defaultApi.castPollVote( + messageId: 'message-id', + pollId: 'poll-id', + castPollVoteRequest: const api.CastPollVoteRequest(vote: api.VoteData(optionId: 'pizza')), + ), + ).thenAnswer((_) async => const Result.failure(pollsApiError)); + + final result = await client.castPollVote('message-id', 'poll-id', optionId: 'pizza'); + + expect(result.exceptionOrNull(), pollsApiError); + }); + + test('StreamChatClient.castPollVote returns no vote when the response carries none', () async { + when( + () => defaultApi.castPollVote( + messageId: 'message-id', + pollId: 'poll-id', + castPollVoteRequest: const api.CastPollVoteRequest(vote: api.VoteData(optionId: 'pizza')), + ), + ).thenAnswer((_) async => const Result.success(api.PollVoteResponse(duration: '4.21ms'))); + + final result = await client.castPollVote('message-id', 'poll-id', optionId: 'pizza'); + + expect(result, const Result.success(PollVoteResponse(duration: '4.21ms'))); + }); + + test('StreamChatClient.addPollAnswer sends the answer text and returns the answer', () async { + when( + () => defaultApi.castPollVote( + messageId: 'message-id', + pollId: 'poll-id', + castPollVoteRequest: const api.CastPollVoteRequest(vote: api.VoteData(answerText: 'Anything')), + ), + ).thenAnswer( + (_) async => Result.success(api.PollVoteResponse(duration: '4.21ms', poll: generatedPoll, vote: generatedAnswer)), + ); + + final result = await client.addPollAnswer('message-id', 'poll-id', answerText: 'Anything'); + + expect(result, Result.success(PollVoteResponse(duration: '4.21ms', vote: answer))); + }); + + test('StreamChatClient.addPollAnswer returns the failure without throwing', () async { + when( + () => defaultApi.castPollVote( + messageId: 'message-id', + pollId: 'poll-id', + castPollVoteRequest: const api.CastPollVoteRequest(vote: api.VoteData(answerText: 'Anything')), + ), + ).thenAnswer((_) async => const Result.failure(pollsApiError)); + + final result = await client.addPollAnswer('message-id', 'poll-id', answerText: 'Anything'); + + expect(result.exceptionOrNull(), pollsApiError); + }); + + test('StreamChatClient.removePollVote sends the vote id and returns the removed vote', () async { + when( + () => defaultApi.deletePollVote(messageId: 'message-id', pollId: 'poll-id', voteId: 'vote-id'), + ).thenAnswer( + (_) async => Result.success(api.PollVoteResponse(duration: '4.21ms', poll: generatedPoll, vote: generatedVote)), + ); + + final result = await client.removePollVote('message-id', 'poll-id', 'vote-id'); + + expect(result, Result.success(PollVoteResponse(duration: '4.21ms', vote: vote))); + }); + + test('StreamChatClient.removePollVote returns the failure without throwing', () async { + when( + () => defaultApi.deletePollVote(messageId: 'message-id', pollId: 'poll-id', voteId: 'vote-id'), + ).thenAnswer((_) async => const Result.failure(pollsApiError)); + + final result = await client.removePollVote('message-id', 'poll-id', 'vote-id'); + + expect(result.exceptionOrNull(), pollsApiError); + }); + + test('StreamChatClient.queryPollVotes sends the filter, sort and cursor and returns the matching votes', () async { + when( + () => defaultApi.queryPollVotes( + pollId: 'poll-id', + queryPollVotesRequest: const api.QueryPollVotesRequest( + filter: { + 'is_answer': {r'$eq': true}, + }, + sort: [api.SortParamRequest(field: 'created_at', direction: 1)], + limit: 25, + next: 'next-cursor', + ), + ), + ).thenAnswer( + (_) async => Result.success( + api.PollVotesResponse(duration: '4.21ms', votes: [generatedVote, generatedAnswer], next: 'after', prev: 'x'), + ), + ); + + final result = await client.queryPollVotes( + 'poll-id', + filter: Filter.equal(PollVoteFilterField.isAnswer, true), + sort: [PollVoteSort.asc(PollVoteSortField.createdAt)], + limit: 25, + next: 'next-cursor', + ); + + expect( + result, + Result.success(QueryPollVotesResponse(duration: '4.21ms', votes: [vote, answer], next: 'after', prev: 'x')), + ); + }); + + test('StreamChatClient.queryPollVotes returns the failure without throwing', () async { + when( + () => defaultApi.queryPollVotes( + pollId: 'poll-id', + queryPollVotesRequest: const api.QueryPollVotesRequest(limit: 10), + ), + ).thenAnswer((_) async => const Result.failure(pollsApiError)); + + final result = await client.queryPollVotes('poll-id'); + + expect(result.exceptionOrNull(), pollsApiError); + }); + + test('StreamChatClient.queryPollVotes sends the previous-page cursor and ten as the default limit', () async { + when( + () => defaultApi.queryPollVotes( + pollId: 'poll-id', + queryPollVotesRequest: const api.QueryPollVotesRequest(limit: 10, prev: 'prev-cursor'), + ), + ).thenAnswer((_) async => const Result.success(api.PollVotesResponse(duration: '4.21ms', votes: []))); + + final result = await client.queryPollVotes('poll-id', prev: 'prev-cursor'); + + expect(result, const Result.success(QueryPollVotesResponse(duration: '4.21ms', votes: []))); + }); +} + +// A poll as a caller builds it: options without ids and the vote summary at its defaults. +Poll _newPoll() => Poll( + id: 'poll-id', + name: 'Lunch?', + description: 'Pick one', + options: const [ + PollOption(text: 'Pizza', custom: {'color': 'red', 'text': 'Pasta'}), + PollOption(text: 'Sushi'), + ], + votingVisibility: VotingVisibility.anonymous, + enforceUniqueVote: false, + maxVotesAllowed: 2, + allowAnswers: true, + allowUserSuggestedOptions: true, + voteCount: 7, + // Custom data named like one of the poll's own fields is sent as custom data. + custom: const {'topic': 'food', 'name': 'Dinner?'}, +); + +const _generatedPizzaResponse = api.PollOptionResponse(duration: '4.21ms', pollOption: generatedPizza); + +const _pizzaResponse = PollOptionResponse(duration: '4.21ms', pollOption: pizza); diff --git a/packages/stream_chat/test/src/client/client_test.dart b/packages/stream_chat/test/src/client/client_test.dart index c4a0a6ce7e..8233e17d88 100644 --- a/packages/stream_chat/test/src/client/client_test.dart +++ b/packages/stream_chat/test/src/client/client_test.dart @@ -3334,340 +3334,6 @@ void main() { verifyNoMoreInteractions(fakeChatApi.channel); }); - test('`.createPoll`', () async { - final poll = Poll( - name: 'What is your favorite color?', - options: const [ - PollOption(text: 'Red'), - PollOption(text: 'Blue'), - ], - ); - - when(() => fakeChatApi.polls.createPoll(poll)).thenAnswer( - (_) async => CreatePollResponse()..poll = poll, - ); - - final res = await client.createPoll(poll); - expect(res, isNotNull); - expect(res.poll, poll); - - verify(() => fakeChatApi.polls.createPoll(poll)).called(1); - verifyNoMoreInteractions(fakeChatApi.polls); - }); - - test('`.getPoll`', () async { - const pollId = 'test-poll-id'; - final poll = Poll( - id: pollId, - name: 'What is your favorite color?', - options: const [ - PollOption(text: 'Red'), - PollOption(text: 'Blue'), - ], - ); - - when(() => fakeChatApi.polls.getPoll(pollId)).thenAnswer( - (_) async => GetPollResponse()..poll = poll, - ); - - final res = await client.getPoll(pollId); - expect(res, isNotNull); - expect(res.poll, poll); - - verify(() => fakeChatApi.polls.getPoll(pollId)).called(1); - verifyNoMoreInteractions(fakeChatApi.polls); - }); - - test('`.updatePoll`', () async { - final poll = Poll( - id: 'test-poll-id', - name: 'What is your favorite color?', - options: const [ - PollOption(text: 'Red'), - PollOption(text: 'Blue'), - ], - ); - - when(() => fakeChatApi.polls.updatePoll(poll)).thenAnswer( - (_) async => UpdatePollResponse()..poll = poll, - ); - - final res = await client.updatePoll(poll); - expect(res, isNotNull); - expect(res.poll, poll); - - verify(() => fakeChatApi.polls.updatePoll(poll)).called(1); - verifyNoMoreInteractions(fakeChatApi.polls); - }); - - test('`.partialUpdatePoll`', () async { - const pollId = 'test-poll-id'; - final set = {'name': 'What is your favorite color?'}; - final unset = []; - - final poll = Poll( - id: pollId, - name: set['name']!, - options: const [ - PollOption(text: 'Red'), - PollOption(text: 'Blue'), - ], - ); - - when( - () => fakeChatApi.polls.partialUpdatePoll(pollId, set: set, unset: unset), - ).thenAnswer((_) async => UpdatePollResponse()..poll = poll); - - final res = await client.partialUpdatePoll(pollId, set: set, unset: unset); - expect(res, isNotNull); - expect(res.poll.id, pollId); - expect(res.poll.name, set['name']); - - verify(() => fakeChatApi.polls.partialUpdatePoll(pollId, set: set, unset: unset)).called(1); - verifyNoMoreInteractions(fakeChatApi.polls); - }); - - test('`.deletePoll`', () async { - const pollId = 'test-poll-id'; - - when(() => fakeChatApi.polls.deletePoll(pollId)).thenAnswer((_) async => EmptyResponse()); - - final res = await client.deletePoll(pollId); - expect(res, isNotNull); - - verify(() => fakeChatApi.polls.deletePoll(pollId)).called(1); - verifyNoMoreInteractions(fakeChatApi.polls); - }); - - test('`.closePoll`', () async { - const pollId = 'test-poll-id'; - - when( - () => fakeChatApi.polls.partialUpdatePoll(pollId, set: {'is_closed': true}), - ).thenAnswer((_) async => UpdatePollResponse()); - - final res = await client.closePoll(pollId); - expect(res, isNotNull); - - verify(() => fakeChatApi.polls.partialUpdatePoll(pollId, set: {'is_closed': true})).called(1); - verifyNoMoreInteractions(fakeChatApi.polls); - }); - - test('`.createPollOption`', () async { - const pollId = 'test-poll-id'; - const option = PollOption(text: 'Red'); - - when( - () => fakeChatApi.polls.createPollOption(pollId, option), - ).thenAnswer((_) async => CreatePollOptionResponse()..pollOption = option); - - final res = await client.createPollOption(pollId, option); - expect(res, isNotNull); - expect(res.pollOption, option); - - verify(() => fakeChatApi.polls.createPollOption(pollId, option)).called(1); - verifyNoMoreInteractions(fakeChatApi.polls); - }); - - test('`.getPollOption`', () async { - const pollId = 'test-poll-id'; - const optionId = 'test-option-id'; - const option = PollOption(id: optionId, text: 'Red'); - - when( - () => fakeChatApi.polls.getPollOption(pollId, optionId), - ).thenAnswer((_) async => GetPollOptionResponse()..pollOption = option); - - final res = await client.getPollOption(pollId, optionId); - expect(res, isNotNull); - expect(res.pollOption, option); - - verify(() => fakeChatApi.polls.getPollOption(pollId, optionId)).called(1); - verifyNoMoreInteractions(fakeChatApi.polls); - }); - - test('`.updatePollOption`', () async { - const pollId = 'test-poll-id'; - const option = PollOption(id: 'test-option-id', text: 'Red'); - - when( - () => fakeChatApi.polls.updatePollOption(pollId, option), - ).thenAnswer((_) async => UpdatePollOptionResponse()..pollOption = option); - - final res = await client.updatePollOption(pollId, option); - expect(res, isNotNull); - expect(res.pollOption, option); - - verify(() => fakeChatApi.polls.updatePollOption(pollId, option)).called(1); - verifyNoMoreInteractions(fakeChatApi.polls); - }); - - test('`.deletePollOption`', () async { - const pollId = 'test-poll-id'; - const optionId = 'test-option-id'; - - when(() => fakeChatApi.polls.deletePollOption(pollId, optionId)).thenAnswer((_) async => EmptyResponse()); - - final res = await client.deletePollOption(pollId, optionId); - expect(res, isNotNull); - - verify(() => fakeChatApi.polls.deletePollOption(pollId, optionId)).called(1); - verifyNoMoreInteractions(fakeChatApi.polls); - }); - - test('`.castPollVote`', () async { - const messageId = 'test-message-id'; - const pollId = 'test-poll-id'; - const optionId = 'test-option-id'; - final vote = PollVote(optionId: optionId); - - // Custom matcher to check if the Vote object has the specified id - Matcher matchesVoteOption(String expected) => predicate( - (vote) => vote.optionId == expected, - 'Vote with option $expected', - ); - - when( - () => fakeChatApi.polls.castPollVote(messageId, pollId, any(that: matchesVoteOption(optionId))), - ).thenAnswer((_) async => CastPollVoteResponse()..vote = vote); - - final res = await client.castPollVote(messageId, pollId, optionId: optionId); - expect(res, isNotNull); - expect(res.vote, vote); - - verify(() => fakeChatApi.polls.castPollVote(messageId, pollId, any(that: matchesVoteOption(optionId)))).called(1); - verifyNoMoreInteractions(fakeChatApi.polls); - }); - - test('`.addPollAnswer`', () async { - const messageId = 'test-message-id'; - const pollId = 'test-poll-id'; - const answerText = 'Red'; - final vote = PollVote(answerText: answerText); - - // Custom matcher to check if the Vote object has the specified id - Matcher matchesVoteAnswer(String expected) => predicate( - (vote) => vote.answerText == expected, - 'Vote with answer $expected', - ); - - when( - () => fakeChatApi.polls.castPollVote(messageId, pollId, any(that: matchesVoteAnswer(answerText))), - ).thenAnswer((_) async => CastPollVoteResponse()..vote = vote); - - final res = await client.addPollAnswer(messageId, pollId, answerText: answerText); - expect(res, isNotNull); - expect(res.vote, vote); - - verify( - () => fakeChatApi.polls.castPollVote(messageId, pollId, any(that: matchesVoteAnswer(answerText))), - ).called(1); - verifyNoMoreInteractions(fakeChatApi.polls); - }); - - test('`.removePollVote`', () async { - const messageId = 'test-message-id'; - const pollId = 'test-poll-id'; - const voteId = 'test-vote-id'; - - when( - () => fakeChatApi.polls.removePollVote(messageId, pollId, voteId), - ).thenAnswer((_) async => RemovePollVoteResponse()); - - final res = await client.removePollVote(messageId, pollId, voteId); - expect(res, isNotNull); - - verify(() => fakeChatApi.polls.removePollVote(messageId, pollId, voteId)).called(1); - verifyNoMoreInteractions(fakeChatApi.polls); - }); - - test('`.queryPolls`', () async { - final filter = PollFilter.in_(PollFilterField.id, const ['test-poll-id']); - final sort = [PollSort.desc(PollSortField.createdAt)]; - const pagination = PaginationParams(limit: 20); - - final polls = List.generate( - pagination.limit, - (index) => Poll( - id: 'test-poll-id-$index', - name: 'What is your favorite color?', - options: const [ - PollOption(text: 'Red'), - PollOption(text: 'Blue'), - ], - ), - ); - - when( - () => fakeChatApi.polls.queryPolls( - filter: filter, - sort: sort, - pagination: pagination, - ), - ).thenAnswer( - (_) async => QueryPollsResponse()..polls = polls, - ); - - final res = await client.queryPolls( - filter: filter, - sort: sort, - pagination: pagination, - ); - expect(res, isNotNull); - expect(res.polls.length, polls.length); - - verify( - () => fakeChatApi.polls.queryPolls( - filter: filter, - sort: sort, - pagination: pagination, - ), - ).called(1); - verifyNoMoreInteractions(fakeChatApi.polls); - }); - - test('`.queryPollVotes`', () async { - const pollId = 'test-poll-id'; - final filter = PollVoteFilter.in_(PollVoteFilterField.id, const ['test-vote-id']); - final sort = [PollVoteSort.desc(PollVoteSortField.createdAt)]; - const pagination = PaginationParams(limit: 20); - - final votes = List.generate( - pagination.limit, - (index) => PollVote(id: 'test-vote-id-$index', answerText: 'Red'), - ); - - when( - () => fakeChatApi.polls.queryPollVotes( - pollId, - filter: filter, - sort: sort, - pagination: pagination, - ), - ).thenAnswer( - (_) async => QueryPollVotesResponse()..votes = votes, - ); - - final res = await client.queryPollVotes( - pollId, - filter: filter, - sort: sort, - pagination: pagination, - ); - expect(res, isNotNull); - expect(res.votes.length, votes.length); - - verify( - () => fakeChatApi.polls.queryPollVotes( - pollId, - filter: filter, - sort: sort, - pagination: pagination, - ), - ).called(1); - verifyNoMoreInteractions(fakeChatApi.polls); - }); - test('`.updateUser`', () async { final user = User( id: 'test-user-id', diff --git a/packages/stream_chat/test/src/client/poll_fixtures.dart b/packages/stream_chat/test/src/client/poll_fixtures.dart new file mode 100644 index 0000000000..41ff94addf --- /dev/null +++ b/packages/stream_chat/test/src/client/poll_fixtures.dart @@ -0,0 +1,163 @@ +import 'package:stream_chat/open_api/api.dart' as api; +import 'package:stream_chat/stream_chat.dart'; + +// Fixtures shared by the poll client tests. Every generated object carries a value in every field, including the +// ones the SDK models leave out, so a field the mapping drops or swaps changes the compared object. + +/// A failure the generated API answers with. +const pollsApiError = StreamClientException(message: 'boom'); + +final generatedVoter = api.UserResponse( + avgResponseTime: 12, + banned: false, + blockedUserIds: const ['blocked-user'], + createdAt: DateTime.utc(2024, 1, 1), + custom: const {'favorite_color': 'blue'}, + deactivatedAt: DateTime.utc(2024, 1, 4), + deletedAt: DateTime.utc(2024, 1, 5), + id: 'luke', + image: 'https://example.com/luke.png', + language: 'en', + lastActive: DateTime.utc(2024, 1, 3), + name: 'Luke', + online: true, + revokeTokensIssuedBefore: DateTime.utc(2024, 1, 6), + role: 'user', + teams: const ['jedi'], + teamsRole: const {'jedi': 'admin'}, + updatedAt: DateTime.utc(2024, 1, 2), +); + +final voter = User( + id: 'luke', + role: 'user', + name: 'Luke', + image: 'https://example.com/luke.png', + createdAt: DateTime.utc(2024, 1, 1), + updatedAt: DateTime.utc(2024, 1, 2), + lastActive: DateTime.utc(2024, 1, 3), + online: true, + teams: const ['jedi'], + language: 'en', + teamsRole: const {'jedi': 'admin'}, + avgResponseTime: 12, + extraData: const {'favorite_color': 'blue'}, +); + +final generatedVote = api.PollVoteResponseData( + answerTextI18n: const {'language': 'en'}, + createdAt: DateTime.utc(2024, 4, 17, 10), + id: 'vote-id', + isAnswer: false, + optionId: 'pizza', + pollId: 'poll-id', + updatedAt: DateTime.utc(2024, 4, 17, 11), + user: generatedVoter, + userId: 'luke', +); + +final vote = PollVote( + id: 'vote-id', + pollId: 'poll-id', + optionId: 'pizza', + answerTextI18n: const {'language': 'en'}, + createdAt: DateTime.utc(2024, 4, 17, 10), + updatedAt: DateTime.utc(2024, 4, 17, 11), + userId: 'luke', + user: voter, +); + +// An answer selects no option, which arrives as an empty option id. +final generatedAnswer = api.PollVoteResponseData( + answerText: 'Anything', + answerTextI18n: const {'fr': "N'importe quoi"}, + createdAt: DateTime.utc(2024, 4, 18, 10), + id: 'answer-id', + isAnswer: true, + optionId: '', + pollId: 'poll-id', + updatedAt: DateTime.utc(2024, 4, 18, 11), + user: generatedVoter, + userId: 'luke', +); + +final answer = PollVote( + id: 'answer-id', + pollId: 'poll-id', + optionId: '', + answerText: 'Anything', + answerTextI18n: const {'fr': "N'importe quoi"}, + createdAt: DateTime.utc(2024, 4, 18, 10), + updatedAt: DateTime.utc(2024, 4, 18, 11), + userId: 'luke', + user: voter, +); + +const generatedPizza = api.PollOptionResponseData( + custom: {'color': 'red'}, + id: 'pizza', + text: 'Pizza', + textI18n: {'it': 'Pizza'}, +); + +const pizza = PollOption(id: 'pizza', text: 'Pizza', textI18n: {'it': 'Pizza'}, custom: {'color': 'red'}); + +final generatedPoll = api.PollResponseData( + allowAnswers: true, + allowUserSuggestedOptions: true, + answersCount: 1, + createdAt: DateTime.utc(2024, 4, 17), + createdBy: generatedVoter, + createdById: 'luke', + custom: const {'topic': 'food'}, + description: 'Pick one', + descriptionI18n: const {'it': 'Scegline uno'}, + enforceUniqueVote: false, + id: 'poll-id', + isClosed: true, + latestAnswers: [generatedAnswer], + latestVotesByOption: { + 'pizza': [generatedVote], + }, + maxVotesAllowed: 2, + name: 'Lunch?', + nameI18n: const {'it': 'Pranzo?'}, + options: const [generatedPizza], + ownVotes: [generatedVote, generatedAnswer], + updatedAt: DateTime.utc(2024, 4, 18), + voteCount: 1, + voteCountsByOption: const {'pizza': 1}, + votingVisibility: api.PollResponseDataVotingVisibility.anonymous, +); + +final poll = Poll( + id: 'poll-id', + name: 'Lunch?', + nameI18n: const {'it': 'Pranzo?'}, + description: 'Pick one', + descriptionI18n: const {'it': 'Scegline uno'}, + options: const [pizza], + votingVisibility: VotingVisibility.anonymous, + enforceUniqueVote: false, + maxVotesAllowed: 2, + allowAnswers: true, + latestAnswers: [answer], + answersCount: 1, + allowUserSuggestedOptions: true, + isClosed: true, + createdAt: DateTime.utc(2024, 4, 17), + updatedAt: DateTime.utc(2024, 4, 18), + voteCountsByOption: const {'pizza': 1}, + voteCount: 1, + latestVotesByOption: { + 'pizza': [vote], + }, + createdById: 'luke', + createdBy: voter, + ownVotesAndAnswers: [vote, answer], + custom: const {'topic': 'food'}, +); + +final generatedPollResponse = api.PollResponse(duration: '4.21ms', poll: generatedPoll); + +final pollResponse = PollResponse(duration: '4.21ms', poll: poll); diff --git a/packages/stream_chat/test/src/core/api/polls_api_test.dart b/packages/stream_chat/test/src/core/api/polls_api_test.dart deleted file mode 100644 index 4b893bbef9..0000000000 --- a/packages/stream_chat/test/src/core/api/polls_api_test.dart +++ /dev/null @@ -1,495 +0,0 @@ -import 'dart:convert'; - -import 'package:dio/dio.dart'; -import 'package:mocktail/mocktail.dart'; -import 'package:stream_chat/src/core/api/polls_api.dart'; -import 'package:stream_chat/src/core/api/requests.dart'; -import 'package:stream_chat/src/core/models/poll.dart'; -import 'package:stream_chat/src/core/models/poll_option.dart'; -import 'package:stream_chat/src/core/models/poll_vote.dart'; -import 'package:test/test.dart'; - -import '../../mocks.dart'; - -void main() { - Response successResponse(String path, {Object? data}) => Response( - data: data, - requestOptions: RequestOptions(path: path), - statusCode: 200, - ); - - late final client = MockHttpClient(); - late PollsApi pollsApi; - - setUp(() { - pollsApi = PollsApi(client); - }); - - test('createPoll', () async { - final poll = Poll( - id: 'test-poll-id', - name: 'test-poll-name', - options: const [ - PollOption( - id: 'test-option-id', - text: 'test-option-value', - ), - ], - ); - - const path = '/polls'; - - when( - () => client.post( - path, - data: jsonEncode(poll), - ), - ).thenAnswer( - (_) async => successResponse( - path, - data: { - 'poll': poll.toJson(), - }, - ), - ); - - final res = await pollsApi.createPoll(poll); - - expect(res, isNotNull); - expect(res.poll.id, poll.id); - - verify(() => client.post(path, data: any(named: 'data'))).called(1); - verifyNoMoreInteractions(client); - }); - - test('getPoll', () async { - const pollId = 'test-poll-id'; - - const path = '/polls/$pollId'; - - final poll = Poll( - id: pollId, - name: 'test-poll-name', - options: const [ - PollOption( - id: 'test-option-id', - text: 'test-option-value', - ), - ], - ); - - when(() => client.get(path)).thenAnswer( - (_) async => successResponse( - path, - data: { - 'poll': poll.toJson(), - }, - ), - ); - - final res = await pollsApi.getPoll(pollId); - - expect(res, isNotNull); - expect(res.poll.id, pollId); - - verify(() => client.get(path)).called(1); - verifyNoMoreInteractions(client); - }); - - test('updatePoll', () async { - final poll = Poll( - id: 'test-poll-id', - name: 'test-poll-name', - options: const [ - PollOption( - id: 'test-option-id', - text: 'test-option-value', - ), - ], - ); - - const path = '/polls'; - - when( - () => client.put( - path, - data: jsonEncode(poll), - ), - ).thenAnswer( - (_) async => successResponse( - path, - data: { - 'poll': poll.toJson(), - }, - ), - ); - - final res = await pollsApi.updatePoll(poll); - - expect(res, isNotNull); - expect(res.poll.id, poll.id); - - verify(() => client.put(path, data: any(named: 'data'))).called(1); - verifyNoMoreInteractions(client); - }); - - test('partialUpdatePoll', () async { - const pollId = 'test-poll-id'; - const set = {'name': 'updated-poll-name'}; - const unset = ['key']; - - const path = '/polls/$pollId'; - final poll = Poll( - id: pollId, - name: set['name']!, - options: const [ - PollOption( - id: 'test-option-id', - text: 'test-option-value', - ), - ], - ); - - when( - () => client.patch( - path, - data: jsonEncode({'set': set, 'unset': unset}), - ), - ).thenAnswer( - (_) async => successResponse( - path, - data: { - 'poll': poll.toJson(), - }, - ), - ); - - final res = await pollsApi.partialUpdatePoll( - pollId, - set: set, - unset: unset, - ); - - expect(res, isNotNull); - expect(res.poll.id, pollId); - expect(res.poll.name, set['name']); - - verify( - () => client.patch( - path, - data: jsonEncode({ - 'set': set, - 'unset': unset, - }), - ), - ).called(1); - verifyNoMoreInteractions(client); - }); - - test('deletePoll', () async { - const pollId = 'test-poll-id'; - - const path = '/polls/$pollId'; - - when( - () => client.delete(path), - ).thenAnswer((_) async => successResponse(path, data: {})); - - final res = await pollsApi.deletePoll(pollId); - - expect(res, isNotNull); - - verify(() => client.delete(path)).called(1); - verifyNoMoreInteractions(client); - }); - - test('createPollOption', () async { - const pollId = 'test-poll-id'; - const option = PollOption( - id: 'test-option-id', - text: 'test-option-value', - ); - - const path = '/polls/$pollId/options'; - - when( - () => client.post( - path, - data: jsonEncode(option), - ), - ).thenAnswer( - (_) async => successResponse( - path, - data: { - 'poll_option': option.toJson() - ..addAll({ - 'id': option.id, - }), - }, - ), - ); - - final res = await pollsApi.createPollOption(pollId, option); - - expect(res, isNotNull); - expect(res.pollOption.id, option.id); - - verify(() => client.post(path, data: any(named: 'data'))).called(1); - verifyNoMoreInteractions(client); - }); - - test('getPollOption', () async { - const pollId = 'test-poll-id'; - const optionId = 'test-option-id'; - - const path = '/polls/$pollId/options/$optionId'; - - const option = PollOption( - id: optionId, - text: 'test-option-value', - ); - - when(() => client.get(path)).thenAnswer( - (_) async => successResponse( - path, - data: { - 'poll_option': option.toJson() - ..addAll({ - 'id': option.id, - }), - }, - ), - ); - - final res = await pollsApi.getPollOption(pollId, optionId); - - expect(res, isNotNull); - expect(res.pollOption.id, optionId); - - verify(() => client.get(path)).called(1); - verifyNoMoreInteractions(client); - }); - - test('updatePollOption', () async { - const pollId = 'test-poll-id'; - const option = PollOption( - id: 'test-option-id', - text: 'test-option-value', - ); - - const path = '/polls/$pollId/options'; - - when( - () => client.put( - path, - data: jsonEncode(option), - ), - ).thenAnswer( - (_) async => successResponse( - path, - data: { - 'poll_option': option.toJson() - ..addAll({ - 'id': option.id, - }), - }, - ), - ); - - final res = await pollsApi.updatePollOption(pollId, option); - - expect(res, isNotNull); - expect(res.pollOption.id, option.id); - - verify(() => client.put(path, data: any(named: 'data'))).called(1); - verifyNoMoreInteractions(client); - }); - - test('deletePollOption', () async { - const pollId = 'test-poll-id'; - const optionId = 'test-option-id'; - - const path = '/polls/$pollId/options/$optionId'; - - when( - () => client.delete(path), - ).thenAnswer((_) async => successResponse(path, data: {})); - - final res = await pollsApi.deletePollOption(pollId, optionId); - - expect(res, isNotNull); - - verify(() => client.delete(path)).called(1); - verifyNoMoreInteractions(client); - }); - - test('castPollVote', () async { - const messageId = 'test-message-id'; - const pollId = 'test-poll-id'; - final vote = PollVote( - pollId: 'test-poll-id', - optionId: 'test-option-id', - ); - - const path = '/messages/$messageId/polls/$pollId/vote'; - - when( - () => client.post( - path, - data: jsonEncode({ - 'vote': vote, - }), - ), - ).thenAnswer( - (_) async => successResponse( - path, - data: { - 'vote': vote.toJson(), - }, - ), - ); - - final res = await pollsApi.castPollVote(messageId, pollId, vote); - - expect(res, isNotNull); - expect(res.vote.optionId, vote.optionId); - - verify(() => client.post(path, data: any(named: 'data'))).called(1); - verifyNoMoreInteractions(client); - }); - - test('removePollVote', () async { - const messageId = 'test-message-id'; - const pollId = 'test-poll-id'; - const voteId = 'test-vote-id'; - - const path = '/messages/$messageId/polls/$pollId/vote/$voteId'; - final vote = PollVote( - pollId: 'test-poll-id', - optionId: 'test-option-id', - ); - - when(() => client.delete(path)).thenAnswer( - (_) async => successResponse( - path, - data: { - 'vote': vote.toJson(), - }, - ), - ); - - final res = await pollsApi.removePollVote(messageId, pollId, voteId); - - expect(res, isNotNull); - - verify(() => client.delete(path)).called(1); - verifyNoMoreInteractions(client); - }); - - test('queryPolls', () async { - const path = '/polls/query'; - final filter = PollFilter.in_(PollFilterField.id, const ['p1', 'p2']); - final sort = [PollSort.desc(PollSortField.createdAt)]; - const pagination = PaginationParams(limit: 20); - - final payload = jsonEncode({ - 'filter': filter, - 'sort': sort, - ...pagination.toJson(), - }); - - final polls = List.generate( - pagination.limit, - (index) => Poll( - id: 'test-poll-id=$index', - name: 'test-poll-name=$index', - options: [ - PollOption( - id: 'test-option-id=$index', - text: 'test-option-value=$index', - ), - ], - ), - ); - - when( - () => client.post( - path, - data: payload, - ), - ).thenAnswer( - (_) async => successResponse( - path, - data: { - 'polls': [...polls.map((it) => it.toJson())], - }, - ), - ); - - final res = await pollsApi.queryPolls( - filter: filter, - sort: sort, - pagination: pagination, - ); - - expect(res, isNotNull); - expect(res.polls, hasLength(polls.length)); - - verify( - () => client.post(path, data: any(named: 'data')), - ).called(1); - verifyNoMoreInteractions(client); - }); - - test('queryPollVotes', () async { - const pollId = 'test-poll-id'; - final filter = PollVoteFilter.in_(PollVoteFilterField.id, const ['v1', 'v2']); - final sort = [PollVoteSort.desc(PollVoteSortField.createdAt)]; - const pagination = PaginationParams(limit: 20); - - const path = '/polls/$pollId/votes'; - - final payload = jsonEncode({ - 'filter': filter, - 'sort': sort, - ...pagination.toJson(), - }); - - final votes = List.generate( - pagination.limit, - (index) => PollVote( - pollId: pollId, - optionId: 'test-option-id=$index', - ), - ); - - when( - () => client.post( - path, - data: payload, - ), - ).thenAnswer( - (_) async => successResponse( - path, - data: { - 'votes': [...votes.map((it) => it.toJson())], - }, - ), - ); - - final res = await pollsApi.queryPollVotes( - pollId, - filter: filter, - sort: sort, - pagination: pagination, - ); - - expect(res, isNotNull); - expect(res.votes, hasLength(votes.length)); - - verify( - () => client.post(path, data: any(named: 'data')), - ).called(1); - verifyNoMoreInteractions(client); - }); -} diff --git a/packages/stream_chat/test/src/core/api/stream_chat_api_test.dart b/packages/stream_chat/test/src/core/api/stream_chat_api_test.dart index 23ef98e53b..13e49ddba2 100644 --- a/packages/stream_chat/test/src/core/api/stream_chat_api_test.dart +++ b/packages/stream_chat/test/src/core/api/stream_chat_api_test.dart @@ -23,10 +23,6 @@ void main() { expect(streamChatApi.message, isNotNull); }); - test('`.polls`', () { - expect(streamChatApi.polls, isNotNull); - }); - test('`.channel`', () { expect(streamChatApi.channel, isNotNull); }); diff --git a/packages/stream_chat/test/src/core/models/converters/poll_v1_json_test.dart b/packages/stream_chat/test/src/core/models/converters/poll_v1_json_test.dart new file mode 100644 index 0000000000..3283f0873e --- /dev/null +++ b/packages/stream_chat/test/src/core/models/converters/poll_v1_json_test.dart @@ -0,0 +1,316 @@ +import 'package:stream_chat/stream_chat.dart'; +import 'package:test/test.dart'; + +void main() { + test('Message.fromJson reads every field of a poll', () { + final message = Message.fromJson({'id': 'message-id', 'poll': _fullPollJson()}); + + expect( + message.poll, + Poll( + id: 'poll-id', + name: 'Lunch?', + nameI18n: const {'it': 'Pranzo?'}, + description: 'Pick one', + descriptionI18n: const {'it': 'Scegline uno'}, + options: const [ + PollOption(id: 'pizza', text: 'Pizza', textI18n: {'it': 'Pizza'}, custom: {'color': 'red'}), + PollOption(id: 'sushi', text: 'Sushi'), + ], + votingVisibility: VotingVisibility.public, + enforceUniqueVote: false, + maxVotesAllowed: 2, + allowAnswers: true, + allowUserSuggestedOptions: true, + isClosed: true, + voteCount: 1, + answersCount: 1, + voteCountsByOption: const {'pizza': 1}, + latestVotesByOption: { + 'pizza': [_vote], + }, + latestAnswers: [_answer], + ownVotesAndAnswers: [_vote, _answer], + createdById: 'luke', + createdBy: User.fromJson(const {'id': 'luke', 'name': 'Luke'}), + createdAt: DateTime.utc(2024, 4, 17, 14, 46, 23), + updatedAt: DateTime.utc(2024, 4, 18), + custom: const {'topic': 'food'}, + ), + ); + }); + + test('Message.fromJson reads poll dates sent as epoch nanoseconds', () { + final message = Message.fromJson(const { + 'id': 'message-id', + 'poll': { + 'id': 'poll-id', + 'name': 'Lunch?', + 'options': [], + 'created_at': 1704067200123456000, + 'updated_at': 1704153600000000000, + }, + }); + + expect(message.poll!.createdAt, DateTime.utc(2024, 1, 1, 0, 0, 0, 123, 456)); + expect(message.poll!.updatedAt, DateTime.utc(2024, 1, 2)); + }); + + test('Message.fromJson gives a poll without its optional keys the default settings', () { + final message = Message.fromJson(const { + 'id': 'message-id', + 'poll': {'id': 'poll-id', 'name': 'Lunch?', 'options': []}, + }); + + final poll = message.poll!; + expect(poll.votingVisibility, VotingVisibility.public); + expect(poll.enforceUniqueVote, isTrue); + expect(poll.maxVotesAllowed, isNull); + expect(poll.allowAnswers, isFalse); + expect(poll.allowUserSuggestedOptions, isFalse); + expect(poll.isClosed, isFalse); + expect(poll.voteCountsByOption, isEmpty); + expect(poll.latestVotesByOption, isEmpty); + expect(poll.ownVotesAndAnswers, isEmpty); + expect(poll.custom, isEmpty); + }); + + test('Message.fromJson keeps the translations of a poll out of its custom data', () { + final message = Message.fromJson(const { + 'id': 'message-id', + 'poll': { + 'id': 'poll-id', + 'name': 'Lunch?', + 'name_i18n': {'it': 'Pranzo?'}, + 'description_i18n': {'it': 'Scegline uno'}, + 'options': [], + 'topic': 'food', + }, + }); + + expect(message.poll!.custom, {'topic': 'food'}); + }); + + test('Message.fromJson keeps the translations of a poll option out of its custom data', () { + final message = Message.fromJson(const { + 'id': 'message-id', + 'poll': { + 'id': 'poll-id', + 'name': 'Lunch?', + 'options': [ + { + 'id': 'pizza', + 'text': 'Pizza', + 'text_i18n': {'it': 'Pizza'}, + 'color': 'red', + }, + ], + }, + }); + + expect(message.poll!.options.single.custom, {'color': 'red'}); + }); + + test('Message.fromJson keeps a voting visibility the SDK does not name', () { + final message = Message.fromJson(const { + 'id': 'message-id', + 'poll': {'id': 'poll-id', 'name': 'Lunch?', 'options': [], 'voting_visibility': 'members_only'}, + }); + + expect(message.poll!.votingVisibility, const VotingVisibility('members_only')); + }); + + test('Message.fromJson reads an answer, which selects no option', () { + final message = Message.fromJson(const { + 'id': 'message-id', + 'poll': { + 'id': 'poll-id', + 'name': 'Lunch?', + 'options': [], + 'latest_answers': [_answerJson], + }, + }); + + final answer = message.poll!.latestAnswers.single; + expect(answer.optionId, ''); + expect(answer.isAnswer, isTrue); + }); + + test('Event.fromJson reads the poll and the vote of a vote event', () { + final event = Event.fromJson({ + 'type': EventType.pollVoteCasted, + 'poll': _fullPollJson(), + 'poll_vote': _voteJson, + }); + + expect(event.poll!.id, 'poll-id'); + expect(event.poll!.ownVotesAndAnswers, [_vote, _answer]); + expect(event.pollVote, _vote); + }); + + test('Event.toJson writes the poll settings with the custom data beside them, without the translations', () { + final event = Event( + type: EventType.pollUpdated, + poll: Poll( + id: 'poll-id', + name: 'Lunch?', + nameI18n: const {'it': 'Pranzo?'}, + description: 'Pick one', + descriptionI18n: const {'it': 'Scegline uno'}, + options: const [ + PollOption(id: 'pizza', text: 'Pizza', textI18n: {'it': 'Pizza'}, custom: {'color': 'red'}), + ], + voteCount: 3, + custom: const {'topic': 'food'}, + ), + ); + + expect(event.toJson()['poll'], { + 'topic': 'food', + 'id': 'poll-id', + 'name': 'Lunch?', + 'description': 'Pick one', + 'options': [ + {'color': 'red', 'id': 'pizza', 'text': 'Pizza'}, + ], + 'voting_visibility': 'public', + 'enforce_unique_vote': true, + 'max_votes_allowed': null, + 'allow_user_suggested_options': false, + 'allow_answers': false, + 'is_closed': false, + }); + }); + + test('Event.toJson leaves out a poll custom entry named like a poll key', () { + final event = Event( + type: EventType.pollUpdated, + poll: Poll(id: 'poll-id', name: 'Lunch?', options: const [], custom: const {'name': 'Dinner?'}), + ); + + final poll = event.toJson()['poll'] as Map; + + expect(poll['name'], 'Lunch?'); + }); + + test('Event.toJson leaves out an option custom entry named like an option key', () { + final event = Event( + type: EventType.pollUpdated, + poll: Poll( + id: 'poll-id', + name: 'Lunch?', + options: const [ + PollOption(id: 'pizza', text: 'Pizza', custom: {'id': 'pasta'}), + ], + ), + ); + + final poll = event.toJson()['poll'] as Map; + + expect(poll['options'], [ + {'id': 'pizza', 'text': 'Pizza'}, + ]); + }); + + test('Event.toJson writes only the id, the option and the answer text of a vote', () { + final event = Event(type: EventType.pollAnswerCasted, pollVote: _answer); + + expect(event.toJson()['poll_vote'], {'id': 'answer-id', 'option_id': '', 'answer_text': 'Anything'}); + }); + + test('Event.fromJson reads back the poll settings written by toJson', () { + final poll = Poll( + id: 'poll-id', + name: 'Lunch?', + options: const [ + PollOption(id: 'pizza', text: 'Pizza', custom: {'color': 'red'}), + ], + votingVisibility: VotingVisibility.anonymous, + maxVotesAllowed: 2, + custom: const {'topic': 'food'}, + ); + + final event = Event.fromJson(Event(type: EventType.pollUpdated, poll: poll).toJson()); + + expect(event.poll!.copyWith(createdAt: poll.createdAt, updatedAt: poll.updatedAt), poll); + }); +} + +final _vote = PollVote( + id: 'vote-id', + pollId: 'poll-id', + optionId: 'pizza', + createdAt: DateTime.utc(2024, 4, 17), + updatedAt: DateTime.utc(2024, 4, 17), + userId: 'luke', + user: User.fromJson(const {'id': 'luke', 'name': 'Luke'}), +); + +const _voteJson = { + 'id': 'vote-id', + 'poll_id': 'poll-id', + 'option_id': 'pizza', + 'created_at': '2024-04-17T00:00:00Z', + 'updated_at': '2024-04-17T00:00:00Z', + 'user_id': 'luke', + 'user': {'id': 'luke', 'name': 'Luke'}, +}; + +final _answer = PollVote( + id: 'answer-id', + pollId: 'poll-id', + optionId: '', + answerText: 'Anything', + answerTextI18n: const {'fr': "N'importe quoi"}, + createdAt: DateTime.utc(2024, 4, 18), + updatedAt: DateTime.utc(2024, 4, 18), + userId: 'luke', +); + +const _answerJson = { + 'id': 'answer-id', + 'poll_id': 'poll-id', + 'option_id': '', + 'answer_text': 'Anything', + 'answer_text_i18n': {'fr': "N'importe quoi"}, + 'is_answer': true, + 'created_at': '2024-04-18T00:00:00Z', + 'updated_at': '2024-04-18T00:00:00Z', + 'user_id': 'luke', +}; + +Map _fullPollJson() => { + 'id': 'poll-id', + 'name': 'Lunch?', + 'name_i18n': {'it': 'Pranzo?'}, + 'description': 'Pick one', + 'description_i18n': {'it': 'Scegline uno'}, + 'options': [ + { + 'id': 'pizza', + 'text': 'Pizza', + 'text_i18n': {'it': 'Pizza'}, + 'color': 'red', + }, + {'id': 'sushi', 'text': 'Sushi'}, + ], + 'voting_visibility': 'public', + 'enforce_unique_vote': false, + 'max_votes_allowed': 2, + 'allow_answers': true, + 'allow_user_suggested_options': true, + 'is_closed': true, + 'vote_count': 1, + 'answers_count': 1, + 'vote_counts_by_option': {'pizza': 1}, + 'latest_votes_by_option': { + 'pizza': [_voteJson], + }, + 'latest_answers': [_answerJson], + 'own_votes': [_voteJson, _answerJson], + 'created_by_id': 'luke', + 'created_by': {'id': 'luke', 'name': 'Luke'}, + 'created_at': '2024-04-17T14:46:23Z', + 'updated_at': '2024-04-18T00:00:00Z', + 'topic': 'food', +}; diff --git a/packages/stream_chat/test/src/core/models/poll_option_test.dart b/packages/stream_chat/test/src/core/models/poll_option_test.dart new file mode 100644 index 0000000000..33b4489b3a --- /dev/null +++ b/packages/stream_chat/test/src/core/models/poll_option_test.dart @@ -0,0 +1,45 @@ +import 'package:stream_chat/stream_chat.dart'; +import 'package:test/test.dart'; + +void main() { + test('PollOption.toData writes the id, the text, its translations and the custom data under their stored keys', () { + const option = PollOption(id: 'pizza', text: 'Pizza', textI18n: {'it': 'Pizza'}, custom: {'color': 'red'}); + + expect(option.toData(), { + 'id': 'pizza', + 'text': 'Pizza', + 'text_i18n': {'it': 'Pizza'}, + 'custom': {'color': 'red'}, + }); + }); + + test('PollOption.toData leaves out an id and translations that are null', () { + const option = PollOption(text: 'Pizza'); + + expect(option.toData().keys, unorderedEquals(['text', 'custom'])); + }); + + test('PollOption.fromData reads back the option written by toData', () { + const option = PollOption(id: 'pizza', text: 'Pizza', textI18n: {'it': 'Pizza'}, custom: {'color': 'red'}); + + expect(PollOption.fromData(option.toData()), option); + }); + + test('PollOption compares its custom data for equality', () { + const option = PollOption(id: 'pizza', text: 'Pizza', custom: {'color': 'red'}); + + expect(option, isNot(option.copyWith(custom: const {'color': 'green'}))); + }); + + test('PollOption.copyWith clears an id passed as null', () { + const option = PollOption(id: 'pizza', text: 'Pizza'); + + expect(option.copyWith(id: null).id, isNull); + }); + + test('PollOption.copyWith clears the translations passed as null', () { + const option = PollOption(id: 'pizza', text: 'Pizza', textI18n: {'it': 'Pizza'}); + + expect(option.copyWith(textI18n: null).textI18n, isNull); + }); +} diff --git a/packages/stream_chat/test/src/core/models/poll_test.dart b/packages/stream_chat/test/src/core/models/poll_test.dart index 74cc23480c..f6d68c66b9 100644 --- a/packages/stream_chat/test/src/core/models/poll_test.dart +++ b/packages/stream_chat/test/src/core/models/poll_test.dart @@ -1,210 +1,123 @@ -// ignore_for_file: avoid_redundant_argument_values - -import 'package:stream_chat/src/core/models/poll.dart'; -import 'package:stream_chat/src/core/models/poll_option.dart'; +import 'package:stream_chat/stream_chat.dart'; import 'package:test/test.dart'; import '../../utils.dart'; void main() { - group('src/models/message', () { - test('should parse json correctly', () { - final poll = Poll.fromJson(jsonFixture('poll.json')); - - expect(poll.id, '7fd88eb3-fc05-4e89-89af-36c6d8995dda'); - expect(poll.name, 'test'); - expect(poll.description, ''); - expect(poll.votingVisibility, VotingVisibility.public); - expect(poll.enforceUniqueVote, false); - expect(poll.maxVotesAllowed, isNull); - expect(poll.allowUserSuggestedOptions, false); - expect(poll.allowAnswers, false); - expect(poll.isClosed, false); - expect(poll.voteCount, 0); - expect(poll.answersCount, 0); - - expect(poll.createdAt.toIso8601String(), '2024-04-17T14:46:23.001349Z'); - expect(poll.updatedAt.toIso8601String(), '2024-04-17T14:46:23.001349Z'); - - expect(poll.options.length, 1); - final option = poll.options[0]; - expect(option.id, 'option1'); - expect(option.text, 'option1 text'); - - expect(poll.latestVotesByOption, isEmpty); - - expect(poll.ownVotesAndAnswers.length, 1); - final vote = poll.ownVotesAndAnswers[0]; - expect(vote.id, 'luke_skywalker'); - expect(vote.optionId, 'option1'); - expect(vote.pollId, '7fd88eb3-fc05-4e89-89af-36c6d8995dda'); - expect(vote.createdAt.toIso8601String(), '2022-02-03T15:47:10.148169Z'); - expect(vote.updatedAt.toIso8601String(), '2024-03-18T16:44:45.749718Z'); - - // Check createdBy fields - expect(poll.createdById, 'luke_skywalker'); - expect(poll.createdBy, isNotNull); - }); - - test('should serialize to json correctly', () { - final poll = Poll( - id: '7fd88eb3-fc05-4e89-89af-36c6d8995dda', - name: 'test', - options: const [ - PollOption( - text: 'option1 text', - ), - ], - ); - - final json = poll.toJson(); - - expect(json['id'], '7fd88eb3-fc05-4e89-89af-36c6d8995dda'); - expect(json['name'], 'test'); - expect(json['description'], isNull); - expect(json['options'], [ - {'text': 'option1 text'}, - ]); - expect(json['voting_visibility'], 'public'); - expect(json['enforce_unique_vote'], true); - expect(json['max_votes_allowed'], isNull); - expect(json['allow_user_suggested_options'], false); - expect(json['allow_answers'], false); - expect(json['is_closed'], false); - }); - - test('parses the server translations of the name and description', () { - final poll = Poll.fromJson({ - ...jsonFixture('poll.json'), - 'name_i18n': const {'language': 'en', 'nl_text': 'toets'}, - 'description_i18n': const {'language': 'en', 'nl_text': 'omschrijving'}, - }); - - expect(poll.nameI18n, {'language': 'en', 'nl_text': 'toets'}); - expect(poll.descriptionI18n, {'language': 'en', 'nl_text': 'omschrijving'}); - }); - - test('parses the server translation of an option', () { - final poll = Poll.fromJson({ - ...jsonFixture('poll.json'), - 'options': const [ - { - 'id': 'option1', - 'text': 'option1 text', - 'text_i18n': {'language': 'en', 'nl_text': 'optie1 tekst'}, - }, - ], - }); - - expect(poll.options.single.textI18n, {'language': 'en', 'nl_text': 'optie1 tekst'}); - }); - - test('parses the server translation of an answer', () { - final poll = Poll.fromJson({ - ...jsonFixture('poll.json'), - 'latest_answers': const [ - { - 'id': 'answer1', - 'answer_text': 'great', - 'answer_text_i18n': {'language': 'en', 'nl_text': 'geweldig'}, - }, - ], - }); - - expect(poll.latestAnswers.single.answerTextI18n, {'language': 'en', 'nl_text': 'geweldig'}); - }); - - test('keeps the server translations out of the extra data', () { - final poll = Poll.fromJson({ - ...jsonFixture('poll.json'), - 'name_i18n': const {'language': 'en', 'nl_text': 'toets'}, - 'description_i18n': const {'language': 'en', 'nl_text': 'omschrijving'}, - }); - - expect(poll.extraData, isNot(contains('name_i18n'))); - expect(poll.extraData, isNot(contains('description_i18n'))); - }); - - test('does not send the server translations back when serialized', () { - final poll = Poll( - name: 'test', - nameI18n: const {'language': 'en', 'nl_text': 'toets'}, - descriptionI18n: const {'language': 'en', 'nl_text': 'omschrijving'}, - options: const [ - PollOption(text: 'option1 text', textI18n: {'language': 'en', 'nl_text': 'optie1 tekst'}), - ], - ); - - final json = poll.toJson(); - - expect(json, isNot(contains('name_i18n'))); - expect(json, isNot(contains('description_i18n'))); - }); - - test('keeps the server translation of an option out of its extra data', () { - final option = PollOption.fromJson(const { - 'id': 'option1', - 'text': 'option1 text', - 'text_i18n': {'language': 'en', 'nl_text': 'optie1 tekst'}, - }); - - expect(option.extraData, isNot(contains('text_i18n'))); - }); - - test('PollOption.toJson leaves out the server translation', () { - const option = PollOption( - id: 'option1', - text: 'option1 text', - textI18n: {'language': 'en', 'nl_text': 'optie1 tekst'}, - ); - - expect(option.toJson(), isNot(contains('text_i18n'))); - }); - - group('PollSortField', () { - test('id orders alphabetically', () { - expectOrders( - PollSortField.id, - createTestPoll(id: 'a-poll', name: 'A'), - createTestPoll(id: 'b-poll', name: 'B'), - ); - }); - - test('name orders alphabetically, folded', () { - expectOrders( - PollSortField.name, - createTestPoll(name: 'apples'), - createTestPoll(name: 'Bananas'), - ); - }); - - test('createdAt orders older polls first', () { - expectOrders( - PollSortField.createdAt, - createTestPoll(name: 'older', createdAt: DateTime(2023, 6, 10)), - createTestPoll(name: 'newer', createdAt: DateTime(2023, 6, 15)), - ); - }); - - test('updatedAt orders older polls first', () { - expectOrders( - PollSortField.updatedAt, - createTestPoll(name: 'older', updatedAt: DateTime(2023, 6, 10)), - createTestPoll(name: 'newer', updatedAt: DateTime(2023, 6, 15)), - ); - }); - - test('isClosed orders open polls first', () { - expectOrders( - PollSortField.isClosed, - createTestPoll(name: 'open', isClosed: false), - createTestPoll(name: 'closed', isClosed: true), - ); - }); - }); + test('Poll generates an id when none is given', () { + final first = Poll(name: 'Lunch?', options: const []); + final second = Poll(name: 'Lunch?', options: const []); + + expect(first.id, isNotEmpty); + expect(first.id, isNot(second.id)); + }); + + test('Poll compares its custom data for equality', () { + final poll = createTestPoll(id: 'poll-id', name: 'Lunch?', custom: const {'topic': 'food'}); + + expect(poll, poll.copyWith(custom: const {'topic': 'food'})); + expect(poll, isNot(poll.copyWith(custom: const {'topic': 'drinks'}))); + }); + + test('Poll.copyWith can clear the vote limit', () { + final poll = createTestPoll(name: 'Lunch?', maxVotesAllowed: 2); + + expect(poll.copyWith(maxVotesAllowed: null).maxVotesAllowed, isNull); + }); + + test('Poll.copyWith clears a nullable field passed as null', () { + final poll = createTestPoll(name: 'Lunch?', description: 'Pick one').copyWith(createdBy: User(id: 'user-id')); + + final copy = poll.copyWith(description: null, createdBy: null); + + expect(copy.description, isNull); + expect(copy.createdBy, isNull); + }); + + test('Poll.latestVotes holds the latest votes of every option', () { + final pizza = _vote(id: 'v1', optionId: 'pizza'); + final sushi = _vote(id: 'v2', optionId: 'sushi'); + final poll = createTestPoll(name: 'Lunch?').copyWith( + latestVotesByOption: { + 'pizza': [pizza], + 'sushi': [sushi], + }, + ); + + expect(poll.latestVotes, unorderedEquals([pizza, sushi])); + }); + + test('Poll.ownVotes leaves out the answers of the current user', () { + final vote = _vote(id: 'v1', optionId: 'pizza'); + final answer = _vote(id: 'a1', answerText: 'Anything'); + final poll = createTestPoll(name: 'Lunch?').copyWith(ownVotesAndAnswers: [vote, answer]); + + expect(poll.ownVotes, [vote]); + }); + + test('Poll.ownAnswers leaves out the votes of the current user', () { + final vote = _vote(id: 'v1', optionId: 'pizza'); + final answer = _vote(id: 'a1', answerText: 'Anything'); + final poll = createTestPoll(name: 'Lunch?').copyWith(ownVotesAndAnswers: [vote, answer]); + + expect(poll.ownAnswers, [answer]); + }); + + test('PollFilterField.votingVisibility reads the visibility value', () { + final poll = createTestPoll(name: 'Lunch?', votingVisibility: VotingVisibility.anonymous); + + expect(PollFilterField.votingVisibility.value(poll), 'anonymous'); + }); + + test('PollSortField.id orders alphabetically', () { + expectOrders( + PollSortField.id, + createTestPoll(id: 'a-poll', name: 'A'), + createTestPoll(id: 'b-poll', name: 'B'), + ); + }); + + test('PollSortField.name orders alphabetically, folded', () { + expectOrders( + PollSortField.name, + createTestPoll(name: 'apples'), + createTestPoll(name: 'Bananas'), + ); + }); + + test('PollSortField.createdAt orders older polls first', () { + expectOrders( + PollSortField.createdAt, + createTestPoll(name: 'older', createdAt: DateTime(2023, 6, 10)), + createTestPoll(name: 'newer', createdAt: DateTime(2023, 6, 15)), + ); + }); + + test('PollSortField.updatedAt orders older polls first', () { + expectOrders( + PollSortField.updatedAt, + createTestPoll(name: 'older', updatedAt: DateTime(2023, 6, 10)), + createTestPoll(name: 'newer', updatedAt: DateTime(2023, 6, 15)), + ); + }); + + test('PollSortField.isClosed orders open polls first', () { + expectOrders( + PollSortField.isClosed, + createTestPoll(name: 'open'), + createTestPoll(name: 'closed', isClosed: true), + ); }); } +PollVote _vote({required String id, String? optionId, String? answerText}) => PollVote( + id: id, + optionId: optionId, + answerText: answerText, + createdAt: DateTime.utc(2024), + updatedAt: DateTime.utc(2024), +); + /// Helper function to create a Poll for testing Poll createTestPoll({ String? id, @@ -219,7 +132,7 @@ Poll createTestPoll({ bool isClosed = false, DateTime? createdAt, DateTime? updatedAt, - Map? extraData, + Map? custom, }) { return Poll( id: id, @@ -234,6 +147,6 @@ Poll createTestPoll({ isClosed: isClosed, createdAt: createdAt ?? DateTime(2023), updatedAt: updatedAt ?? DateTime(2023), - extraData: extraData ?? {}, + custom: custom ?? {}, ); } diff --git a/packages/stream_chat/test/src/core/models/poll_vote_test.dart b/packages/stream_chat/test/src/core/models/poll_vote_test.dart index 7cac30ea2d..fd8cdeb27b 100644 --- a/packages/stream_chat/test/src/core/models/poll_vote_test.dart +++ b/packages/stream_chat/test/src/core/models/poll_vote_test.dart @@ -5,41 +5,54 @@ import 'package:test/test.dart'; import '../../utils.dart'; void main() { - group('src/models/poll_vote', () { - test('does not send the server translation of the answer back when serialized', () { - final pollVote = PollVote( - answerText: 'great', - answerTextI18n: const {'language': 'en', 'nl_text': 'geweldig'}, - ); + test('PollVote.isAnswer is true for a vote that carries answer text', () { + final answer = createTestPollVote(answerText: 'Anything'); - expect(pollVote.toJson(), isNot(contains('answer_text_i18n'))); - }); + expect(answer.isAnswer, isTrue); + }); + + test('PollVote.isAnswer is false for a vote for an option', () { + final vote = createTestPollVote(optionId: 'pizza'); + + expect(vote.isAnswer, isFalse); + }); + + test('PollVote.copyWith clears a nullable field passed as null', () { + final vote = createTestPollVote( + id: 'vote-id', + optionId: 'pizza', + userId: 'user-id', + user: User(id: 'user-id'), + ); - group('PollVoteSortField', () { - test('id orders alphabetically', () { - expectOrders( - PollVoteSortField.id, - createTestPollVote(id: 'a-vote', optionId: 'o'), - createTestPollVote(id: 'b-vote', optionId: 'o'), - ); - }); + final copy = vote.copyWith(userId: null, user: null); - test('createdAt orders older votes first', () { - expectOrders( - PollVoteSortField.createdAt, - createTestPollVote(optionId: 'o', createdAt: DateTime(2023, 6, 10)), - createTestPollVote(optionId: 'o', createdAt: DateTime(2023, 6, 15)), - ); - }); + expect(copy.userId, isNull); + expect(copy.user, isNull); + }); + + test('PollVoteSortField.id orders alphabetically', () { + expectOrders( + PollVoteSortField.id, + createTestPollVote(id: 'a-vote', optionId: 'o'), + createTestPollVote(id: 'b-vote', optionId: 'o'), + ); + }); + + test('PollVoteSortField.createdAt orders older votes first', () { + expectOrders( + PollVoteSortField.createdAt, + createTestPollVote(optionId: 'o', createdAt: DateTime(2023, 6, 10)), + createTestPollVote(optionId: 'o', createdAt: DateTime(2023, 6, 15)), + ); + }); - test('updatedAt orders older votes first', () { - expectOrders( - PollVoteSortField.updatedAt, - createTestPollVote(optionId: 'o', updatedAt: DateTime(2023, 6, 10)), - createTestPollVote(optionId: 'o', updatedAt: DateTime(2023, 6, 15)), - ); - }); - }); + test('PollVoteSortField.updatedAt orders older votes first', () { + expectOrders( + PollVoteSortField.updatedAt, + createTestPollVote(optionId: 'o', updatedAt: DateTime(2023, 6, 10)), + createTestPollVote(optionId: 'o', updatedAt: DateTime(2023, 6, 15)), + ); }); } diff --git a/packages/stream_chat/test/src/fakes.dart b/packages/stream_chat/test/src/fakes.dart index 9021e9a1df..f7e0985475 100644 --- a/packages/stream_chat/test/src/fakes.dart +++ b/packages/stream_chat/test/src/fakes.dart @@ -6,7 +6,6 @@ import 'package:stream_chat/src/core/api/channel_api.dart'; import 'package:stream_chat/src/core/api/general_api.dart'; import 'package:stream_chat/src/core/api/message_api.dart'; import 'package:stream_chat/src/core/api/moderation_api.dart'; -import 'package:stream_chat/src/core/api/polls_api.dart'; import 'package:stream_chat/src/core/api/push_preferences_api.dart'; import 'package:stream_chat/src/core/api/user_api.dart'; import 'package:stream_chat/stream_chat.dart'; @@ -134,11 +133,6 @@ class FakeChatApi extends Fake implements StreamChatApi { @override MessageApi get message => _message ??= MockMessageApi(); - @override - PollsApi get polls => _polls ??= MockPollsApi(); - - PollsApi? _polls; - ChannelApi? _channel; @override diff --git a/packages/stream_chat/test/src/mocks.dart b/packages/stream_chat/test/src/mocks.dart index 004e7d7d64..862672b853 100644 --- a/packages/stream_chat/test/src/mocks.dart +++ b/packages/stream_chat/test/src/mocks.dart @@ -10,7 +10,6 @@ import 'package:stream_chat/src/core/api/channel_api.dart'; import 'package:stream_chat/src/core/api/general_api.dart'; import 'package:stream_chat/src/core/api/message_api.dart'; import 'package:stream_chat/src/core/api/moderation_api.dart'; -import 'package:stream_chat/src/core/api/polls_api.dart'; import 'package:stream_chat/src/core/api/push_preferences_api.dart'; import 'package:stream_chat/src/core/api/user_api.dart'; import 'package:stream_chat/src/core/http/stream_http_client.dart'; @@ -46,8 +45,6 @@ class MockUserApi extends Mock implements UserApi {} class MockMessageApi extends Mock implements MessageApi {} -class MockPollsApi extends Mock implements PollsApi {} - class MockChannelApi extends Mock implements ChannelApi {} class MockPushPreferencesApi extends Mock implements PushPreferencesApi {} diff --git a/packages/stream_chat_flutter/lib/src/channel/stream_message_preview_text.dart b/packages/stream_chat_flutter/lib/src/channel/stream_message_preview_text.dart index 1925aa251b..0ffbdc188d 100644 --- a/packages/stream_chat_flutter/lib/src/channel/stream_message_preview_text.dart +++ b/packages/stream_chat_flutter/lib/src/channel/stream_message_preview_text.dart @@ -91,10 +91,8 @@ class StreamMessagePreviewText extends StatelessWidget { @internal Message translateForPreview(Message message, String? language) { final translated = message.translate(language); - return switch (message.poll) { - final poll? when poll.translatedName(language) != null => translated.copyWith( - poll: poll.copyWith(name: poll.translatedName(language)), - ), + return switch ((message.poll, message.poll?.translatedName(language))) { + (final poll?, final name?) => translated.copyWith(poll: poll.copyWith(name: name)), _ => translated, }; } diff --git a/packages/stream_chat_flutter/test/src/message_widget/components/stream_message_content_poll_translation_test.dart b/packages/stream_chat_flutter/test/src/message_widget/components/stream_message_content_poll_translation_test.dart index 5a88b08977..834c49d294 100644 --- a/packages/stream_chat_flutter/test/src/message_widget/components/stream_message_content_poll_translation_test.dart +++ b/packages/stream_chat_flutter/test/src/message_widget/components/stream_message_content_poll_translation_test.dart @@ -307,22 +307,28 @@ MockChannel _mockChannel({List? comments}) { any(), filter: any(named: 'filter'), sort: any(named: 'sort'), - pagination: any(named: 'pagination'), + limit: any(named: 'limit'), + next: any(named: 'next'), ), ).thenAnswer( - (_) async => QueryPollVotesResponse() - ..votes = - comments ?? - [ - PollVote( - id: 'answer-1', - answerText: 'I like yellow', - answerTextI18n: const {'language': 'en', 'nl_text': 'Ik hou van geel'}, - ), - ] - ..next = null, + (_) async => Result.success( + QueryPollVotesResponse( + duration: '4.21ms', + votes: + comments ?? + [ + PollVote( + id: 'answer-1', + answerText: 'I like yellow', + answerTextI18n: const {'language': 'en', 'nl_text': 'Ik hou van geel'}, + ), + ], + ), + ), ); - when(() => channel.castPollVote(any(), any(), any())).thenAnswer((_) async => CastPollVoteResponse()); + when( + () => channel.castPollVote(any(), any(), any()), + ).thenAnswer((_) async => const Result.success(PollVoteResponse(duration: '4.21ms'))); return channel; } diff --git a/packages/stream_chat_flutter_core/CHANGELOG.md b/packages/stream_chat_flutter_core/CHANGELOG.md index f6194a6455..af3403b6f9 100644 --- a/packages/stream_chat_flutter_core/CHANGELOG.md +++ b/packages/stream_chat_flutter_core/CHANGELOG.md @@ -8,6 +8,7 @@ - The sort argument on every list controller is typed `List`, `List` and so on, rather than `SortOrder`. On the controllers that have a default, the `sort` property is non-nullable: leaving it unset selects that default, and `ChannelSort.empty` / `MemberSort.empty` / … query with the ordering the API applies on its own. - `defaultChannelListSort`, `defaultMemberListSort`, `defaultUserListSort`, `defaultDraftListSort`, `defaultMessageReminderListSort` and `defaultPollVoteListSort` are removed. Use `ChannelSort.defaultSort`, `MemberSort.defaultSort` and so on from `stream_chat`. Leaving a controller's sort unset still applies the same ordering. - `StreamChannelListController.muteChannel` and `unmuteChannel` return a `Result` instead of throwing. +- `StreamPollController.addOption` and `updateOption` take the option's custom data as `custom` instead of `extraData`. 🐞 Fixed diff --git a/packages/stream_chat_flutter_core/lib/src/stream_poll_controller.dart b/packages/stream_chat_flutter_core/lib/src/stream_poll_controller.dart index 216ae0d3f0..65ae886e9a 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_poll_controller.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_poll_controller.dart @@ -177,29 +177,28 @@ class StreamPollController extends ValueNotifier { return invalidErrors; } - /// Adds a new option with the provided [text] and [extraData]. + /// Adds an option with [text] and the custom data [custom]. /// /// The new option will be added to the end of the list of options. void addOption( String text, { - Map extraData = const {}, + Map custom = const {}, }) { final options = [...value.options]; - final newOption = PollOption(text: text, extraData: extraData); + final newOption = PollOption(text: text, custom: custom); value = value.copyWith(options: [...options, newOption]); } - /// Updates the option at the provided [index] with the provided [text] and - /// [extraData]. + /// Updates the option at [index] to [text] and the custom data [custom]. void updateOption( String text, { required int index, - Map extraData = const {}, + Map custom = const {}, }) { final options = [...value.options]; options[index] = options[index].copyWith( text: text, - extraData: extraData, + custom: custom, ); value = value.copyWith(options: options); diff --git a/packages/stream_chat_flutter_core/lib/src/stream_poll_vote_list_controller.dart b/packages/stream_chat_flutter_core/lib/src/stream_poll_vote_list_controller.dart index 27800c8d8c..5e752c6ee8 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_poll_vote_list_controller.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_poll_vote_list_controller.dart @@ -113,61 +113,57 @@ class StreamPollVoteListController extends PagedValueNotifier this.limit * defaultInitialPagedLimitMultiplier, _kDefaultBackendPaginationLimit, ); - try { - final response = await channel.queryPollVotes( - pollId, - sort: _activeSort, - filter: _activeFilter, - pagination: PaginationParams(limit: limit), - ); - - final results = response.votes; - final nextKey = response.next; - value = PagedValue( - items: results, - nextPageKey: nextKey, - ); - - // start listening to events - if (disposed) return; - _subscribeToPollVoteEvents(); - } on StreamChatException catch (error) { - value = PagedValue.error(error); - } catch (error) { - final chatError = StreamClientException(message: 'Failed to load poll votes', cause: error); - value = PagedValue.error(chatError); - } + final result = await _queryPollVotes(limit: limit); + + result.fold( + onSuccess: (response) { + value = PagedValue( + items: response.votes, + nextPageKey: response.next, + ); + + if (disposed) return; + _subscribeToPollVoteEvents(); + }, + onFailure: (error, _) => value = PagedValue.error(_chatException(error, 'Failed to load poll votes')), + ); } @override Future loadMore(String nextPageKey) async { final previousValue = value.asSuccess; + final result = await _queryPollVotes(limit: limit, next: nextPageKey); + + result.fold( + onSuccess: (response) { + final next = response.next; + value = PagedValue( + items: previousValue.items + response.votes, + nextPageKey: next != null && next.isNotEmpty ? next : null, + ); + }, + onFailure: (error, _) { + value = previousValue.copyWith(error: _chatException(error, 'Failed to load more poll votes')); + }, + ); + } + + // Turns anything the channel throws, such as on a channel that is not + // initialized, into a failure. + Future> _queryPollVotes({required int limit, String? next}) async { try { - final response = await channel.queryPollVotes( - pollId, - sort: _activeSort, - filter: _activeFilter, - pagination: PaginationParams(limit: limit, next: nextPageKey), - ); - - final results = response.votes; - final previousItems = previousValue.items; - final newItems = previousItems + results; - final next = response.next; - final nextKey = next != null && next.isNotEmpty ? next : null; - value = PagedValue( - items: newItems, - nextPageKey: nextKey, - ); - } on StreamChatException catch (error) { - value = previousValue.copyWith(error: error); - } catch (error) { - final chatError = StreamClientException(message: 'Failed to load more poll votes', cause: error); - value = previousValue.copyWith(error: chatError); + return await channel.queryPollVotes(pollId, sort: _activeSort, filter: _activeFilter, limit: limit, next: next); + } catch (error, stackTrace) { + return Result.failure(error, stackTrace); } } + StreamChatException _chatException(Object error, String message) => switch (error) { + final StreamChatException error => error, + _ => StreamClientException(message: message, cause: error), + }; + @override Future refresh({bool resetValue = true}) { if (resetValue) { diff --git a/packages/stream_chat_flutter_core/test/stream_poll_controller_test.dart b/packages/stream_chat_flutter_core/test/stream_poll_controller_test.dart index 408b4c9c29..814fe8c83e 100644 --- a/packages/stream_chat_flutter_core/test/stream_poll_controller_test.dart +++ b/packages/stream_chat_flutter_core/test/stream_poll_controller_test.dart @@ -77,11 +77,11 @@ void main() { final pollController = StreamPollController() ..addOption( 'Option 1', - extraData: {'key': 'value'}, + custom: {'key': 'value'}, ); expect(pollController.value.options.length, 2); - expect(pollController.value.options.last.extraData['key'], 'value'); + expect(pollController.value.options.last.custom['key'], 'value'); }); test('Update Option', () { diff --git a/packages/stream_chat_flutter_core/test/stream_poll_vote_list_controller_test.dart b/packages/stream_chat_flutter_core/test/stream_poll_vote_list_controller_test.dart new file mode 100644 index 0000000000..e33b7b7e1c --- /dev/null +++ b/packages/stream_chat_flutter_core/test/stream_poll_vote_list_controller_test.dart @@ -0,0 +1,171 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:mocktail/mocktail.dart'; +import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; + +import 'mocks.dart'; + +void main() { + test('StreamPollVoteListController.doInitialLoad loads the first page of votes', () async { + final channel = _channelAnswering([ + Result.success(_page([_vote('v1'), _vote('v2')], next: 'cursor')), + ]); + final controller = _controller(channel); + + await controller.doInitialLoad(); + + expect(controller.value, PagedValue(items: [_vote('v1'), _vote('v2')], nextPageKey: 'cursor')); + }); + + test('StreamPollVoteListController.doInitialLoad asks for three pages at once', () async { + final channel = _channelAnswering([Result.success(_page([]))]); + final controller = _controller(channel); + + await controller.doInitialLoad(); + + verify( + () => channel.queryPollVotes( + 'poll-id', + filter: any(named: 'filter'), + sort: any(named: 'sort'), + limit: 30, + ), + ); + }); + + test('StreamPollVoteListController.doInitialLoad turns a failure into the error state', () async { + const error = StreamClientException(message: 'boom'); + final channel = _channelAnswering([const Result.failure(error)]); + final controller = _controller(channel); + + await controller.doInitialLoad(); + + expect(controller.value, const PagedValue.error(error)); + }); + + test('StreamPollVoteListController.doInitialLoad turns an error the channel throws into the error state', () async { + final channel = MockChannel(); + final thrown = StateError('Channel is not initialized'); + when( + () => channel.queryPollVotes( + any(), + filter: any(named: 'filter'), + sort: any(named: 'sort'), + limit: any(named: 'limit'), + next: any(named: 'next'), + prev: any(named: 'prev'), + ), + ).thenThrow(thrown); + final controller = _controller(channel); + + await controller.doInitialLoad(); + + final error = controller.value.mapOrNull(null, error: (it) => it.error); + expect(error, isA().having((it) => it.cause, 'cause', thrown)); + }); + + test('StreamPollVoteListController.loadMore appends the next page of votes', () async { + final channel = _channelAnswering([ + Result.success(_page([_vote('v1')], next: 'cursor')), + Result.success(_page([_vote('v2')])), + ]); + final controller = _controller(channel); + await controller.doInitialLoad(); + + await controller.loadMore('cursor'); + + expect(controller.value, PagedValue(items: [_vote('v1'), _vote('v2')])); + }); + + test('StreamPollVoteListController.loadMore asks for a page of ten after the given cursor', () async { + final channel = _channelAnswering([ + Result.success(_page([_vote('v1')], next: 'cursor')), + Result.success(_page([])), + ]); + final controller = _controller(channel); + await controller.doInitialLoad(); + + await controller.loadMore('cursor'); + + verify( + () => channel.queryPollVotes( + 'poll-id', + filter: any(named: 'filter'), + sort: any(named: 'sort'), + limit: 10, + next: 'cursor', + ), + ); + }); + + test('StreamPollVoteListController.loadMore keeps the loaded votes and records a failure', () async { + const error = StreamClientException(message: 'boom'); + final channel = _channelAnswering([ + Result.success(_page([_vote('v1')], next: 'cursor')), + const Result.failure(error), + ]); + final controller = _controller(channel); + await controller.doInitialLoad(); + + await controller.loadMore('cursor'); + + expect(controller.value, PagedValue(items: [_vote('v1')], nextPageKey: 'cursor', error: error)); + }); + + test('StreamPollVoteListController.loadMore records an error the channel throws', () async { + final channel = _channelAnswering([ + Result.success(_page([_vote('v1')], next: 'cursor')), + ]); + final controller = _controller(channel); + await controller.doInitialLoad(); + final thrown = StateError('Channel is not initialized'); + when( + () => channel.queryPollVotes( + any(), + filter: any(named: 'filter'), + sort: any(named: 'sort'), + limit: any(named: 'limit'), + next: any(named: 'next'), + prev: any(named: 'prev'), + ), + ).thenThrow(thrown); + + await controller.loadMore('cursor'); + + expect(controller.value.asSuccess.error, isA().having((it) => it.cause, 'cause', thrown)); + }); +} + +PollVote _vote(String id) => PollVote( + id: id, + pollId: 'poll-id', + optionId: 'pizza', + createdAt: DateTime.utc(2024), + updatedAt: DateTime.utc(2024), +); + +QueryPollVotesResponse _page(List votes, {String? next}) => + QueryPollVotesResponse(duration: '4.21ms', votes: votes, next: next); + +// A channel whose vote queries answer [results] in order. +MockChannel _channelAnswering(List> results) { + final channel = MockChannel(); + final pending = [...results]; + when( + () => channel.queryPollVotes( + any(), + filter: any(named: 'filter'), + sort: any(named: 'sort'), + limit: any(named: 'limit'), + next: any(named: 'next'), + prev: any(named: 'prev'), + ), + ).thenAnswer((_) async => pending.removeAt(0)); + when(channel.on).thenAnswer((_) => const Stream.empty()); + return channel; +} + +StreamPollVoteListController _controller(Channel channel) { + final controller = StreamPollVoteListController(channel: channel, pollId: 'poll-id'); + addTearDown(controller.dispose); + return controller; +} diff --git a/packages/stream_chat_persistence/CHANGELOG.md b/packages/stream_chat_persistence/CHANGELOG.md index 8d2e4e1b2e..99d6c23d3e 100644 --- a/packages/stream_chat_persistence/CHANGELOG.md +++ b/packages/stream_chat_persistence/CHANGELOG.md @@ -10,6 +10,7 @@ 🔄 Changed - Every persistence call logged its own name at `info`; that call trace is `verbose` now. +- A cached poll with a voting visibility the SDK does not name is read back instead of failing. 🐞 Fixed diff --git a/packages/stream_chat_persistence/lib/src/converter/voting_visibility_converter.dart b/packages/stream_chat_persistence/lib/src/converter/voting_visibility_converter.dart index 047be71a46..c33a94b221 100644 --- a/packages/stream_chat_persistence/lib/src/converter/voting_visibility_converter.dart +++ b/packages/stream_chat_persistence/lib/src/converter/voting_visibility_converter.dart @@ -7,26 +7,8 @@ class VotingVisibilityConverter extends TypeConverter const VotingVisibilityConverter(); @override - VotingVisibility fromSql(String fromDb) { - for (final entry in _votingVisibilityEnumMap.entries) { - if (entry.value == fromDb) { - return entry.key; - } - } - - throw ArgumentError( - '`$fromDb` is not one of the supported values: ' - '${_votingVisibilityEnumMap.values.join(', ')}', - ); - } + VotingVisibility fromSql(String fromDb) => VotingVisibility(fromDb); @override - String toSql(VotingVisibility value) { - return _votingVisibilityEnumMap[value]!; - } + String toSql(VotingVisibility value) => value; } - -const _votingVisibilityEnumMap = { - VotingVisibility.anonymous: 'anonymous', - VotingVisibility.public: 'public', -}; diff --git a/packages/stream_chat_persistence/lib/src/db/drift_chat_database.dart b/packages/stream_chat_persistence/lib/src/db/drift_chat_database.dart index b8241b86af..43ef0b607c 100644 --- a/packages/stream_chat_persistence/lib/src/db/drift_chat_database.dart +++ b/packages/stream_chat_persistence/lib/src/db/drift_chat_database.dart @@ -59,7 +59,7 @@ class DriftChatDatabase extends _$DriftChatDatabase { // Band the version by SDK major, and bump the offset whenever you change or // add a table definition. @override - int get schemaVersion => 1100 + 3; + int get schemaVersion => 1100 + 4; // Store DateTime as ISO-8601 text to preserve sub-second precision. @override diff --git a/packages/stream_chat_persistence/lib/src/db/drift_chat_database.g.dart b/packages/stream_chat_persistence/lib/src/db/drift_chat_database.g.dart index f3449ea86d..1125f1cb31 100644 --- a/packages/stream_chat_persistence/lib/src/db/drift_chat_database.g.dart +++ b/packages/stream_chat_persistence/lib/src/db/drift_chat_database.g.dart @@ -6487,13 +6487,13 @@ class $PollsTable extends Polls with TableInfo<$PollsTable, PollEntity> { defaultValue: currentDateAndTime, ); @override - late final GeneratedColumnWithTypeConverter?, String> extraData = GeneratedColumn( - 'extra_data', + late final GeneratedColumnWithTypeConverter?, String> custom = GeneratedColumn( + 'custom', aliasedName, true, type: DriftSqlType.string, requiredDuringInsert: false, - ).withConverter?>($PollsTable.$converterextraDatan); + ).withConverter?>($PollsTable.$convertercustomn); @override List get $columns => [ id, @@ -6514,7 +6514,7 @@ class $PollsTable extends Polls with TableInfo<$PollsTable, PollEntity> { createdById, createdAt, updatedAt, - extraData, + custom, ]; @override String get aliasedName => _alias ?? actualTableName; @@ -6719,10 +6719,10 @@ class $PollsTable extends Polls with TableInfo<$PollsTable, PollEntity> { DriftSqlType.dateTime, data['${effectivePrefix}updated_at'], )!, - extraData: $PollsTable.$converterextraDatan.fromSql( + custom: $PollsTable.$convertercustomn.fromSql( attachedDatabase.typeMapping.read( DriftSqlType.string, - data['${effectivePrefix}extra_data'], + data['${effectivePrefix}custom'], ), ), ); @@ -6738,9 +6738,9 @@ class $PollsTable extends Polls with TableInfo<$PollsTable, PollEntity> { static TypeConverter, String> $converteroptions = ListConverter(); static TypeConverter $convertervotingVisibility = const VotingVisibilityConverter(); static TypeConverter, String> $convertervoteCountsByOption = MapConverter(); - static TypeConverter, String> $converterextraData = MapConverter(); - static TypeConverter?, String?> $converterextraDatan = NullAwareTypeConverter.wrap( - $converterextraData, + static TypeConverter, String> $convertercustom = MapConverter(); + static TypeConverter?, String?> $convertercustomn = NullAwareTypeConverter.wrap( + $convertercustom, ); } @@ -6808,8 +6808,8 @@ class PollEntity extends DataClass implements Insertable { /// The date when the poll was last updated. final DateTime updatedAt; - /// Map of custom poll extraData - final Map? extraData; + /// Custom data attached to the poll. + final Map? custom; const PollEntity({ required this.id, required this.name, @@ -6829,7 +6829,7 @@ class PollEntity extends DataClass implements Insertable { this.createdById, required this.createdAt, required this.updatedAt, - this.extraData, + this.custom, }); @override Map toColumns(bool nullToAbsent) { @@ -6880,9 +6880,9 @@ class PollEntity extends DataClass implements Insertable { } map['created_at'] = Variable(createdAt); map['updated_at'] = Variable(updatedAt); - if (!nullToAbsent || extraData != null) { - map['extra_data'] = Variable( - $PollsTable.$converterextraDatan.toSql(extraData), + if (!nullToAbsent || custom != null) { + map['custom'] = Variable( + $PollsTable.$convertercustomn.toSql(custom), ); } return map; @@ -6920,7 +6920,7 @@ class PollEntity extends DataClass implements Insertable { createdById: serializer.fromJson(json['createdById']), createdAt: serializer.fromJson(json['createdAt']), updatedAt: serializer.fromJson(json['updatedAt']), - extraData: serializer.fromJson?>(json['extraData']), + custom: serializer.fromJson?>(json['custom']), ); } @override @@ -6951,7 +6951,7 @@ class PollEntity extends DataClass implements Insertable { 'createdById': serializer.toJson(createdById), 'createdAt': serializer.toJson(createdAt), 'updatedAt': serializer.toJson(updatedAt), - 'extraData': serializer.toJson?>(extraData), + 'custom': serializer.toJson?>(custom), }; } @@ -6974,7 +6974,7 @@ class PollEntity extends DataClass implements Insertable { Value createdById = const Value.absent(), DateTime? createdAt, DateTime? updatedAt, - Value?> extraData = const Value.absent(), + Value?> custom = const Value.absent(), }) => PollEntity( id: id ?? this.id, name: name ?? this.name, @@ -6994,7 +6994,7 @@ class PollEntity extends DataClass implements Insertable { createdById: createdById.present ? createdById.value : this.createdById, createdAt: createdAt ?? this.createdAt, updatedAt: updatedAt ?? this.updatedAt, - extraData: extraData.present ? extraData.value : this.extraData, + custom: custom.present ? custom.value : this.custom, ); PollEntity copyWithCompanion(PollsCompanion data) { return PollEntity( @@ -7018,7 +7018,7 @@ class PollEntity extends DataClass implements Insertable { createdById: data.createdById.present ? data.createdById.value : this.createdById, createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt, - extraData: data.extraData.present ? data.extraData.value : this.extraData, + custom: data.custom.present ? data.custom.value : this.custom, ); } @@ -7043,7 +7043,7 @@ class PollEntity extends DataClass implements Insertable { ..write('createdById: $createdById, ') ..write('createdAt: $createdAt, ') ..write('updatedAt: $updatedAt, ') - ..write('extraData: $extraData') + ..write('custom: $custom') ..write(')')) .toString(); } @@ -7068,7 +7068,7 @@ class PollEntity extends DataClass implements Insertable { createdById, createdAt, updatedAt, - extraData, + custom, ); @override bool operator ==(Object other) => @@ -7092,7 +7092,7 @@ class PollEntity extends DataClass implements Insertable { other.createdById == this.createdById && other.createdAt == this.createdAt && other.updatedAt == this.updatedAt && - other.extraData == this.extraData); + other.custom == this.custom); } class PollsCompanion extends UpdateCompanion { @@ -7114,7 +7114,7 @@ class PollsCompanion extends UpdateCompanion { final Value createdById; final Value createdAt; final Value updatedAt; - final Value?> extraData; + final Value?> custom; final Value rowid; const PollsCompanion({ this.id = const Value.absent(), @@ -7135,7 +7135,7 @@ class PollsCompanion extends UpdateCompanion { this.createdById = const Value.absent(), this.createdAt = const Value.absent(), this.updatedAt = const Value.absent(), - this.extraData = const Value.absent(), + this.custom = const Value.absent(), this.rowid = const Value.absent(), }); PollsCompanion.insert({ @@ -7157,13 +7157,13 @@ class PollsCompanion extends UpdateCompanion { this.createdById = const Value.absent(), this.createdAt = const Value.absent(), this.updatedAt = const Value.absent(), - this.extraData = const Value.absent(), + this.custom = const Value.absent(), this.rowid = const Value.absent(), }) : id = Value(id), name = Value(name), options = Value(options), voteCountsByOption = Value(voteCountsByOption); - static Insertable custom({ + static Insertable createCustom({ Expression? id, Expression? name, Expression? nameI18n, @@ -7182,7 +7182,7 @@ class PollsCompanion extends UpdateCompanion { Expression? createdById, Expression? createdAt, Expression? updatedAt, - Expression? extraData, + Expression? custom, Expression? rowid, }) { return RawValuesInsertable({ @@ -7204,7 +7204,7 @@ class PollsCompanion extends UpdateCompanion { if (createdById != null) 'created_by_id': createdById, if (createdAt != null) 'created_at': createdAt, if (updatedAt != null) 'updated_at': updatedAt, - if (extraData != null) 'extra_data': extraData, + if (custom != null) 'custom': custom, if (rowid != null) 'rowid': rowid, }); } @@ -7228,7 +7228,7 @@ class PollsCompanion extends UpdateCompanion { Value? createdById, Value? createdAt, Value? updatedAt, - Value?>? extraData, + Value?>? custom, Value? rowid, }) { return PollsCompanion( @@ -7250,7 +7250,7 @@ class PollsCompanion extends UpdateCompanion { createdById: createdById ?? this.createdById, createdAt: createdAt ?? this.createdAt, updatedAt: updatedAt ?? this.updatedAt, - extraData: extraData ?? this.extraData, + custom: custom ?? this.custom, rowid: rowid ?? this.rowid, ); } @@ -7326,9 +7326,9 @@ class PollsCompanion extends UpdateCompanion { if (updatedAt.present) { map['updated_at'] = Variable(updatedAt.value); } - if (extraData.present) { - map['extra_data'] = Variable( - $PollsTable.$converterextraDatan.toSql(extraData.value), + if (custom.present) { + map['custom'] = Variable( + $PollsTable.$convertercustomn.toSql(custom.value), ); } if (rowid.present) { @@ -7358,7 +7358,7 @@ class PollsCompanion extends UpdateCompanion { ..write('createdById: $createdById, ') ..write('createdAt: $createdAt, ') ..write('updatedAt: $updatedAt, ') - ..write('extraData: $extraData, ') + ..write('custom: $custom, ') ..write('rowid: $rowid') ..write(')')) .toString(); @@ -16097,7 +16097,7 @@ typedef $$PollsTableCreateCompanionBuilder = Value createdById, Value createdAt, Value updatedAt, - Value?> extraData, + Value?> custom, Value rowid, }); typedef $$PollsTableUpdateCompanionBuilder = @@ -16120,7 +16120,7 @@ typedef $$PollsTableUpdateCompanionBuilder = Value createdById, Value createdAt, Value updatedAt, - Value?> extraData, + Value?> custom, Value rowid, }); @@ -16246,11 +16246,10 @@ class $$PollsTableFilterComposer extends Composer<_$DriftChatDatabase, $PollsTab builder: (column) => ColumnFilters(column), ); - ColumnWithTypeConverterFilters?, Map, String> get extraData => - $composableBuilder( - column: $table.extraData, - builder: (column) => ColumnWithTypeConverterFilters(column), - ); + ColumnWithTypeConverterFilters?, Map, String> get custom => $composableBuilder( + column: $table.custom, + builder: (column) => ColumnWithTypeConverterFilters(column), + ); Expression pollVotesRefs( Expression Function($$PollVotesTableFilterComposer f) f, @@ -16375,8 +16374,8 @@ class $$PollsTableOrderingComposer extends Composer<_$DriftChatDatabase, $PollsT builder: (column) => ColumnOrderings(column), ); - ColumnOrderings get extraData => $composableBuilder( - column: $table.extraData, + ColumnOrderings get custom => $composableBuilder( + column: $table.custom, builder: (column) => ColumnOrderings(column), ); } @@ -16457,8 +16456,8 @@ class $$PollsTableAnnotationComposer extends Composer<_$DriftChatDatabase, $Poll GeneratedColumn get updatedAt => $composableBuilder(column: $table.updatedAt, builder: (column) => column); - GeneratedColumnWithTypeConverter?, String> get extraData => - $composableBuilder(column: $table.extraData, builder: (column) => column); + GeneratedColumnWithTypeConverter?, String> get custom => + $composableBuilder(column: $table.custom, builder: (column) => column); Expression pollVotesRefs( Expression Function($$PollVotesTableAnnotationComposer a) f, @@ -16528,7 +16527,7 @@ class $$PollsTableTableManager Value createdById = const Value.absent(), Value createdAt = const Value.absent(), Value updatedAt = const Value.absent(), - Value?> extraData = const Value.absent(), + Value?> custom = const Value.absent(), Value rowid = const Value.absent(), }) => PollsCompanion( id: id, @@ -16549,7 +16548,7 @@ class $$PollsTableTableManager createdById: createdById, createdAt: createdAt, updatedAt: updatedAt, - extraData: extraData, + custom: custom, rowid: rowid, ), createCompanionCallback: @@ -16572,7 +16571,7 @@ class $$PollsTableTableManager Value createdById = const Value.absent(), Value createdAt = const Value.absent(), Value updatedAt = const Value.absent(), - Value?> extraData = const Value.absent(), + Value?> custom = const Value.absent(), Value rowid = const Value.absent(), }) => PollsCompanion.insert( id: id, @@ -16593,7 +16592,7 @@ class $$PollsTableTableManager createdById: createdById, createdAt: createdAt, updatedAt: updatedAt, - extraData: extraData, + custom: custom, rowid: rowid, ), withReferenceMapper: (p0) => p0 diff --git a/packages/stream_chat_persistence/lib/src/entity/polls.dart b/packages/stream_chat_persistence/lib/src/entity/polls.dart index 9df0208433..ec765000e3 100644 --- a/packages/stream_chat_persistence/lib/src/entity/polls.dart +++ b/packages/stream_chat_persistence/lib/src/entity/polls.dart @@ -71,8 +71,8 @@ class Polls extends Table { /// The date when the poll was last updated. DateTimeColumn get updatedAt => dateTime().withDefault(currentDateAndTime)(); - /// Map of custom poll extraData - TextColumn get extraData => text().nullable().map(MapConverter())(); + /// Custom data attached to the poll. + TextColumn get custom => text().nullable().map(MapConverter())(); @override Set get primaryKey => {id}; diff --git a/packages/stream_chat_persistence/lib/src/mapper/poll_mapper.dart b/packages/stream_chat_persistence/lib/src/mapper/poll_mapper.dart index 3f6e93a83e..2637856e06 100644 --- a/packages/stream_chat_persistence/lib/src/mapper/poll_mapper.dart +++ b/packages/stream_chat_persistence/lib/src/mapper/poll_mapper.dart @@ -18,10 +18,7 @@ extension PollEntityX on PollEntity { nameI18n: nameI18n, description: description, descriptionI18n: descriptionI18n, - options: options.map((it) { - final json = jsonDecode(it); - return PollOption.fromJson(json); - }).toList(), + options: options.map((it) => PollOption.fromData(jsonDecode(it))).toList(), votingVisibility: votingVisibility, enforceUniqueVote: enforceUniqueVote, maxVotesAllowed: maxVotesAllowed, @@ -38,7 +35,7 @@ extension PollEntityX on PollEntity { createdById: createdById, createdBy: createdBy, ownVotesAndAnswers: ownVotesAndAnswers, - extraData: extraData ?? {}, + custom: custom ?? {}, ); } } @@ -52,9 +49,7 @@ extension PollX on Poll { nameI18n: nameI18n, description: description, descriptionI18n: descriptionI18n, - // `PollOption.toJson` leaves out the server-owned `text_i18n`, as it is - // also the payload sent to the API; the cache has to keep it. - options: options.map((it) => jsonEncode({...it.toJson(), 'text_i18n': ?it.textI18n})).toList(), + options: options.map((it) => jsonEncode(it.toData())).toList(), votingVisibility: votingVisibility, enforceUniqueVote: enforceUniqueVote, maxVotesAllowed: maxVotesAllowed, @@ -67,6 +62,6 @@ extension PollX on Poll { voteCountsByOption: voteCountsByOption, voteCount: voteCount, createdById: createdById, - extraData: extraData, + custom: custom, ); } diff --git a/packages/stream_chat_persistence/test/src/converter/voting_visibility_converter_test.dart b/packages/stream_chat_persistence/test/src/converter/voting_visibility_converter_test.dart index f99a44e707..83d11cde32 100644 --- a/packages/stream_chat_persistence/test/src/converter/voting_visibility_converter_test.dart +++ b/packages/stream_chat_persistence/test/src/converter/voting_visibility_converter_test.dart @@ -16,11 +16,8 @@ void main() { expect(converter.fromSql('public'), VotingVisibility.public); }); - test('fromSql throws ArgumentError for invalid String', () { - expect( - () => converter.fromSql('invalid_value'), - throwsA(isA()), - ); + test('fromSql keeps a visibility the SDK does not name', () { + expect(converter.fromSql('members_only'), const VotingVisibility('members_only')); }); }); } diff --git a/packages/stream_chat_persistence/test/src/dao/poll_dao_test.dart b/packages/stream_chat_persistence/test/src/dao/poll_dao_test.dart index f01a54f543..cf8bfafc23 100644 --- a/packages/stream_chat_persistence/test/src/dao/poll_dao_test.dart +++ b/packages/stream_chat_persistence/test/src/dao/poll_dao_test.dart @@ -70,7 +70,7 @@ void main() { createdAt: DateTime.now(), updatedAt: DateTime.now(), enforceUniqueVote: false, - extraData: const {'test_extra_data': 'extraData'}, + custom: const {'test_extra_data': 'extraData'}, ); polls.add(poll); diff --git a/packages/stream_chat_persistence/test/src/dao/poll_vote_dao_test.dart b/packages/stream_chat_persistence/test/src/dao/poll_vote_dao_test.dart index 9228d1d75b..faf93700fe 100644 --- a/packages/stream_chat_persistence/test/src/dao/poll_vote_dao_test.dart +++ b/packages/stream_chat_persistence/test/src/dao/poll_vote_dao_test.dart @@ -59,7 +59,7 @@ void main() { updatedAt: DateTime.now(), enforceUniqueVote: false, allowAnswers: true, - extraData: const {'test_extra_data': 'extraData'}, + custom: const {'test_extra_data': 'extraData'}, ); final votes = latestVotesByOption.values.expand((it) => it).toList(); diff --git a/packages/stream_chat_persistence/test/src/mapper/poll_mapper_test.dart b/packages/stream_chat_persistence/test/src/mapper/poll_mapper_test.dart index a3a453dd9d..87bdbc8b3c 100644 --- a/packages/stream_chat_persistence/test/src/mapper/poll_mapper_test.dart +++ b/packages/stream_chat_persistence/test/src/mapper/poll_mapper_test.dart @@ -56,10 +56,10 @@ void main() { votingVisibility: VotingVisibility.public, allowUserSuggestedOptions: true, options: const [ - PollOption(id: 'option-1', text: 'Red'), - PollOption(id: 'option-2', text: 'Blue'), - PollOption(id: 'option-3', text: 'Green'), - ].map(jsonEncode).toList(), + '{"id":"option-1","text":"Red","custom":{"hex":"#f00"}}', + '{"id":"option-2","text":"Blue","custom":{}}', + '{"id":"option-3","text":"Green","custom":{}}', + ], voteCount: voteCountsByOption.values.reduce((a, b) => a + b), voteCountsByOption: voteCountsByOption, createdAt: DateTime.now(), @@ -68,7 +68,7 @@ void main() { isClosed: false, allowAnswers: true, answersCount: latestAnswers.length, - extraData: {'test_extra_data': 'extraData'}, + custom: {'test_extra_data': 'extraData'}, ); final poll = entity.toPoll( createdBy: currentUser, @@ -88,14 +88,11 @@ void main() { expect(poll.enforceUniqueVote, entity.enforceUniqueVote); expect(poll.maxVotesAllowed, entity.maxVotesAllowed); expect(poll.allowUserSuggestedOptions, entity.allowUserSuggestedOptions); - for (var i = 0; i < poll.options.length; i++) { - final pollOption = poll.options[i]; - final entityOptionJson = jsonDecode(entity.options[i]); - final entityOption = PollOption.fromJson(entityOptionJson); - expect(pollOption.id, entityOption.id); - expect(pollOption.text, entityOption.text); - expect(pollOption.extraData, entityOption.extraData); - } + expect(poll.options, const [ + PollOption(id: 'option-1', text: 'Red', custom: {'hex': '#f00'}), + PollOption(id: 'option-2', text: 'Blue'), + PollOption(id: 'option-3', text: 'Green'), + ]); expect(poll.allowAnswers, entity.allowAnswers); expect(poll.answersCount, entity.answersCount); expect(poll.isClosed, entity.isClosed); @@ -104,7 +101,7 @@ void main() { expect(poll.voteCountsByOption, entity.voteCountsByOption); expect(poll.voteCount, entity.voteCount); expect(poll.createdById, entity.createdById); - expect(poll.extraData, entity.extraData); + expect(poll.custom, entity.custom); }); test('toEntity should map poll into PollEntity', () { @@ -154,7 +151,7 @@ void main() { createdById: currentUser.id, allowUserSuggestedOptions: true, options: const [ - PollOption(id: 'option-1', text: 'Red'), + PollOption(id: 'option-1', text: 'Red', custom: {'hex': '#f00'}), PollOption(id: 'option-2', text: 'Blue'), PollOption(id: 'option-3', text: 'Green'), ], @@ -165,7 +162,7 @@ void main() { enforceUniqueVote: false, allowAnswers: true, answersCount: latestAnswers.length, - extraData: const {'test_extra_data': 'extraData'}, + custom: const {'test_extra_data': 'extraData'}, ); final entity = poll.toEntity(); expect(entity, isA()); @@ -176,10 +173,11 @@ void main() { expect(entity.enforceUniqueVote, poll.enforceUniqueVote); expect(entity.maxVotesAllowed, poll.maxVotesAllowed); expect(entity.allowUserSuggestedOptions, poll.allowUserSuggestedOptions); - expect( - entity.options, - poll.options.map((it) => jsonEncode(it.toJson())).toList(), - ); + expect(entity.options, const [ + '{"id":"option-1","text":"Red","custom":{"hex":"#f00"}}', + '{"id":"option-2","text":"Blue","custom":{}}', + '{"id":"option-3","text":"Green","custom":{}}', + ]); expect(entity.allowAnswers, poll.allowAnswers); expect(entity.answersCount, poll.answersCount); expect(entity.isClosed, poll.isClosed); @@ -188,7 +186,7 @@ void main() { expect(entity.voteCountsByOption, poll.voteCountsByOption); expect(entity.voteCount, poll.voteCount); expect(entity.createdById, poll.createdById); - expect(entity.extraData, poll.extraData); + expect(entity.custom, poll.custom); }); test('a poll keeps the translations of its name, description and options through the cache', () { From 30fb8e7722912724b3e02bdd0d49592c2f446a49 Mon Sep 17 00:00:00 2001 From: Petar Velikov Date: Fri, 16 Oct 2026 13:46:43 +0200 Subject: [PATCH 36/36] refactor(llc)!: make extension type values private (#3068) * refactor(llc)!: make extension type values private Co-Authored-By: Claude Opus 5.5 * test(llc): drop duplicate ModerationAction equality test Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: Claude Opus 5.5 --- STYLE_GUIDE.md | 9 +++++++-- migrations/v11-migration.md | 6 ++++++ packages/stream_chat/CHANGELOG.md | 1 + packages/stream_chat/lib/src/core/models/attachment.dart | 8 ++++---- .../stream_chat/lib/src/core/models/channel_model.dart | 2 +- .../lib/src/core/models/chat_preferences.dart | 2 +- .../stream_chat/lib/src/core/models/delete_type.dart | 2 +- packages/stream_chat/lib/src/core/models/message.dart | 4 ++-- packages/stream_chat/lib/src/core/models/moderation.dart | 4 ++-- packages/stream_chat/lib/src/core/models/push_level.dart | 2 +- .../stream_chat/lib/src/core/models/push_preference.dart | 4 ++-- .../stream_chat/lib/src/core/models/push_provider.dart | 2 +- packages/stream_chat/lib/src/core/models/role_type.dart | 2 +- .../lib/src/repository/mapper/devices_mapper.dart | 2 +- .../lib/src/repository/mapper/moderation_mapper.dart | 2 +- .../test/src/core/models/moderation_test.dart | 8 -------- .../test/src/core/models/push_provider_test.dart | 1 - .../stream_chat/test/src/core/models/role_type_test.dart | 1 - 18 files changed, 32 insertions(+), 30 deletions(-) diff --git a/STYLE_GUIDE.md b/STYLE_GUIDE.md index 5a9ceb0f9c..12366aea81 100644 --- a/STYLE_GUIDE.md +++ b/STYLE_GUIDE.md @@ -806,11 +806,13 @@ final label = switch (state) { A set of values the server defines — a push provider, a message type, a channel capability — grows over time. Model it as an extension type over its wire string, with -a `static const` for each value the SDK knows, rather than as an enum: +a `static const` for each value the SDK knows, rather than as an enum. Name the +representation field `_`: the value is a `String` and is used directly as one, so a +public field would only be a second way to read it. ```dart // GOOD: -extension type const PushProvider(String rawType) implements String { +extension type const PushProvider(String _) implements String { /// Google's Firebase Cloud Messaging. static const firebase = PushProvider('firebase'); @@ -820,6 +822,9 @@ extension type const PushProvider(String rawType) implements String { // BAD: enum PushProvider { firebase, apn } + +// BAD: +extension type const PushProvider(String rawType) implements String { ... } ``` - **Adding a value is not a breaking change.** Callers can't switch over the type diff --git a/migrations/v11-migration.md b/migrations/v11-migration.md index f691a00331..04b5dfc3b3 100644 --- a/migrations/v11-migration.md +++ b/migrations/v11-migration.md @@ -241,6 +241,7 @@ search-and-replace you can apply directly. `Kind` is one of `renamed`, `removed` | `SendAttachmentResponse`, `SendFileResponse`, `SendImageResponse`, `UploadImageResponse`, `UploadFileResponse` | `UploadedFile` (`stream_core`) | `removed` | `.file` becomes `.fileUrl`; `.thumbUrl` is unchanged; `duration` is gone | | `AttachmentFileUploaderProvider` = `AttachmentFileUploader Function(StreamHttpClient)` | `AttachmentFileUploader Function(Dio)` | `retyped` | Receives the client's `Dio`; `StreamAttachmentFileUploader(dio)` builds the default | | `StreamChatApi.fileUploader`, `StreamChatApi(attachmentFileUploaderProvider:)` | `StreamChatClient(attachmentFileUploaderProvider:)` | `removed` | The uploader belongs to `StreamChatClient` | +| `MessageType.rawType` / `AttachmentType.rawType` / `PushLevel.rawType` / `ChatPreferenceLevel.rawType` / `ChatLevel.rawType` / `CallLevel.rawType` / `RoleType.rawType`, `ModerationAction.action`, `ChannelCapability.capability` | the value itself | `removed` | Each is a `String`, so use it directly: `message.type.rawType` becomes `message.type` | | _(more added per feature as PRs land)_ | | | | --- @@ -708,6 +709,11 @@ only moderation call that answers with a model, and the `User` and `ChannelModel are decided by later groups in this migration; it moves when they do. See [Endpoints that still throw](#endpoints-that-still-throw). +**`ModerationAction.action` is removed.** A `ModerationAction` is a `String`, so use it directly: +`message.moderation?.action.action` becomes `message.moderation?.action`. The same goes for the +`rawType` of `MessageType`, `AttachmentType`, `RoleType` and the push preference levels, and for +`ChannelCapability.capability` — see the [Symbol Map](#symbol-map). + ### App Settings **`getAppSettings` returns a `Result` instead of throwing, and answers the whole response** rather than the diff --git a/packages/stream_chat/CHANGELOG.md b/packages/stream_chat/CHANGELOG.md index a31e8f652a..094f41bc5e 100644 --- a/packages/stream_chat/CHANGELOG.md +++ b/packages/stream_chat/CHANGELOG.md @@ -96,6 +96,7 @@ - `SendAttachmentResponse`, `SendFileResponse`, `SendImageResponse`, `UploadImageResponse` and `UploadFileResponse` are removed in favor of `UploadedFile`. - `AttachmentFileUploaderProvider` receives the client's `Dio` instead of a `StreamHttpClient`, and `StreamAttachmentFileUploader` is built from one. - `StreamChatApi.fileUploader` and `StreamChatApi`'s `attachmentFileUploaderProvider` are removed; pass `attachmentFileUploaderProvider` to `StreamChatClient` instead. +- `rawType` is removed from `MessageType`, `AttachmentType`, `PushLevel`, `ChatPreferenceLevel`, `ChatLevel`, `CallLevel` and `RoleType`, as are `ModerationAction.action` and `ChannelCapability.capability`; use the value itself instead. 🐞 Fixed diff --git a/packages/stream_chat/lib/src/core/models/attachment.dart b/packages/stream_chat/lib/src/core/models/attachment.dart index 6f1c7d7409..cecf94d77e 100644 --- a/packages/stream_chat/lib/src/core/models/attachment.dart +++ b/packages/stream_chat/lib/src/core/models/attachment.dart @@ -340,7 +340,7 @@ class Attachment extends Equatable { /// It can be one of the built-in types (image, file, giphy, video, /// audio, voiceRecording) or application custom types like urlPreview. /// {@endtemplate} -extension type const AttachmentType(String rawType) implements String { +extension type const AttachmentType(String _) implements String { /// Built-in types. static const image = AttachmentType('image'); static const file = AttachmentType('file'); @@ -353,9 +353,9 @@ extension type const AttachmentType(String rawType) implements String { static const urlPreview = AttachmentType('url_preview'); /// Create a new instance from a json string. - static AttachmentType? fromJson(String? rawType) { - if (rawType == null) return null; - return AttachmentType(rawType); + static AttachmentType? fromJson(String? type) { + if (type == null) return null; + return AttachmentType(type); } /// Serialize to json string. diff --git a/packages/stream_chat/lib/src/core/models/channel_model.dart b/packages/stream_chat/lib/src/core/models/channel_model.dart index df9bfc760e..fe0cfaa744 100644 --- a/packages/stream_chat/lib/src/core/models/channel_model.dart +++ b/packages/stream_chat/lib/src/core/models/channel_model.dart @@ -306,7 +306,7 @@ class ChannelModel { /// {@template channelCapability} /// Represents various capabilities that a user can have in a channel. /// {@endtemplate} -extension type const ChannelCapability(String capability) implements String { +extension type const ChannelCapability(String _) implements String { /// Ability to send a message. static const sendMessage = ChannelCapability('send-message'); diff --git a/packages/stream_chat/lib/src/core/models/chat_preferences.dart b/packages/stream_chat/lib/src/core/models/chat_preferences.dart index dad9e9af6d..ff8a0afcfd 100644 --- a/packages/stream_chat/lib/src/core/models/chat_preferences.dart +++ b/packages/stream_chat/lib/src/core/models/chat_preferences.dart @@ -7,7 +7,7 @@ part 'chat_preferences.g.dart'; /// /// A category left unset (omitted from the JSON payload) falls back to /// [ChatPreferences.defaultPreference]. -extension type const ChatPreferenceLevel(String rawType) implements String { +extension type const ChatPreferenceLevel(String _) implements String { /// Always send a push notification for this category. static const all = ChatPreferenceLevel('all'); diff --git a/packages/stream_chat/lib/src/core/models/delete_type.dart b/packages/stream_chat/lib/src/core/models/delete_type.dart index b73a008946..19a7e98b66 100644 --- a/packages/stream_chat/lib/src/core/models/delete_type.dart +++ b/packages/stream_chat/lib/src/core/models/delete_type.dart @@ -2,7 +2,7 @@ /// /// A delete type without a constant here can still be named by wrapping its /// value: `DeleteType('soft')`. -extension type const DeleteType(String rawType) implements String { +extension type const DeleteType(String _) implements String { /// Marked deleted, and can be restored. static const soft = DeleteType('soft'); diff --git a/packages/stream_chat/lib/src/core/models/message.dart b/packages/stream_chat/lib/src/core/models/message.dart index 974e8bf704..31febe3d45 100644 --- a/packages/stream_chat/lib/src/core/models/message.dart +++ b/packages/stream_chat/lib/src/core/models/message.dart @@ -962,7 +962,7 @@ class MessageSearchSortField extends SortField { /// A type of the message that determines how the message is displayed and /// handled by the system. /// {@endtemplate} -extension type const MessageType(String rawType) implements String { +extension type const MessageType(String _) implements String { /// A regular message created in the channel. static const regular = MessageType('regular'); @@ -986,7 +986,7 @@ extension type const MessageType(String rawType) implements String { static const deleted = MessageType('deleted'); /// Create a new instance from a json string. - static MessageType fromJson(String rawType) => MessageType(rawType); + static MessageType fromJson(String type) => MessageType(type); /// Serialize to json string. static String? toJson(String type) { diff --git a/packages/stream_chat/lib/src/core/models/moderation.dart b/packages/stream_chat/lib/src/core/models/moderation.dart index f3133a39a6..1706ccd52a 100644 --- a/packages/stream_chat/lib/src/core/models/moderation.dart +++ b/packages/stream_chat/lib/src/core/models/moderation.dart @@ -63,7 +63,7 @@ class Moderation extends Equatable { } /// The moderation action performed over the message. -extension type const ModerationAction(String action) implements String { +extension type const ModerationAction(String _) implements String { /// Action 'bounce' - the message needs to be rephrased and sent again. static const ModerationAction bounce = ModerationAction('bounce'); @@ -90,5 +90,5 @@ extension type const ModerationAction(String action) implements String { } /// Serialize to json string. - static String toJson(ModerationAction action) => action.action; + static String toJson(ModerationAction action) => action; } diff --git a/packages/stream_chat/lib/src/core/models/push_level.dart b/packages/stream_chat/lib/src/core/models/push_level.dart index 2f2e6bf0fe..ccf58e6f7c 100644 --- a/packages/stream_chat/lib/src/core/models/push_level.dart +++ b/packages/stream_chat/lib/src/core/models/push_level.dart @@ -1,6 +1,6 @@ /// Defines the push level for a channel, /// which determines how notifications are sent to users. -extension type const PushLevel(String rawType) implements String { +extension type const PushLevel(String _) implements String { /// 'All' (default): /// All channel members receive push notifications for every message. static const all = PushLevel('all'); diff --git a/packages/stream_chat/lib/src/core/models/push_preference.dart b/packages/stream_chat/lib/src/core/models/push_preference.dart index 50a55f8538..e361b3702c 100644 --- a/packages/stream_chat/lib/src/core/models/push_preference.dart +++ b/packages/stream_chat/lib/src/core/models/push_preference.dart @@ -5,7 +5,7 @@ import 'chat_preferences.dart'; part 'push_preference.g.dart'; /// Chat level push preference type -extension type const ChatLevel(String rawType) implements String { +extension type const ChatLevel(String _) implements String { /// All messages static const all = ChatLevel('all'); @@ -29,7 +29,7 @@ extension type const ChatLevel(String rawType) implements String { } /// Call level push preference type -extension type const CallLevel(String rawType) implements String { +extension type const CallLevel(String _) implements String { /// All calls static const all = CallLevel('all'); diff --git a/packages/stream_chat/lib/src/core/models/push_provider.dart b/packages/stream_chat/lib/src/core/models/push_provider.dart index 5a0277f35f..98944b437c 100644 --- a/packages/stream_chat/lib/src/core/models/push_provider.dart +++ b/packages/stream_chat/lib/src/core/models/push_provider.dart @@ -2,7 +2,7 @@ /// /// A provider without a constant here can still be named by wrapping its /// value: `PushProvider('firebase')`. -extension type const PushProvider(String rawType) implements String { +extension type const PushProvider(String _) implements String { /// Google's Firebase Cloud Messaging. static const firebase = PushProvider('firebase'); diff --git a/packages/stream_chat/lib/src/core/models/role_type.dart b/packages/stream_chat/lib/src/core/models/role_type.dart index b074a089ff..be543f41b5 100644 --- a/packages/stream_chat/lib/src/core/models/role_type.dart +++ b/packages/stream_chat/lib/src/core/models/role_type.dart @@ -3,7 +3,7 @@ /// /// Only [user] and [channel] are accepted; any other value fails the /// search. -extension type const RoleType(String rawType) implements String { +extension type const RoleType(String _) implements String { /// Restricts results to roles valid as a user-level assignment /// (e.g. `user`, `admin`, `anonymous`). static const user = RoleType('user'); diff --git a/packages/stream_chat/lib/src/repository/mapper/devices_mapper.dart b/packages/stream_chat/lib/src/repository/mapper/devices_mapper.dart index 0de090a582..d36ba6246d 100644 --- a/packages/stream_chat/lib/src/repository/mapper/devices_mapper.dart +++ b/packages/stream_chat/lib/src/repository/mapper/devices_mapper.dart @@ -21,5 +21,5 @@ extension ListDevicesResponseMapper on api.ListDevicesResponse { /// Maps a [PushProvider] to the generated request enum. extension PushProviderMapper on PushProvider { /// Converts this provider into an [api.CreateDeviceRequestPushProvider]. - api.CreateDeviceRequestPushProvider toRequest() => api.CreateDeviceRequestPushProvider.fromJson(rawType); + api.CreateDeviceRequestPushProvider toRequest() => api.CreateDeviceRequestPushProvider.fromJson(this); } diff --git a/packages/stream_chat/lib/src/repository/mapper/moderation_mapper.dart b/packages/stream_chat/lib/src/repository/mapper/moderation_mapper.dart index bc55e12eb3..352ca4114a 100644 --- a/packages/stream_chat/lib/src/repository/mapper/moderation_mapper.dart +++ b/packages/stream_chat/lib/src/repository/mapper/moderation_mapper.dart @@ -34,5 +34,5 @@ extension FlagItemResponseMapper on api.FlagItemResponse { /// Maps a [DeleteType] to the generated request type. extension DeleteTypeMapper on DeleteType { /// Converts this treatment into an [api.BanRequestDeleteMessages]. - api.BanRequestDeleteMessages toRequest() => api.BanRequestDeleteMessages.fromJson(rawType); + api.BanRequestDeleteMessages toRequest() => api.BanRequestDeleteMessages.fromJson(this); } diff --git a/packages/stream_chat/test/src/core/models/moderation_test.dart b/packages/stream_chat/test/src/core/models/moderation_test.dart index 2405c44a90..15ac7b2e16 100644 --- a/packages/stream_chat/test/src/core/models/moderation_test.dart +++ b/packages/stream_chat/test/src/core/models/moderation_test.dart @@ -110,13 +110,6 @@ void main() { }); group('ModerationAction', () { - test('should create predefined constants correctly', () { - expect(ModerationAction.bounce.action, 'bounce'); - expect(ModerationAction.flag.action, 'flag'); - expect(ModerationAction.remove.action, 'remove'); - expect(ModerationAction.shadow.action, 'shadow'); - }); - test('should work with string equality', () { expect(ModerationAction.bounce == 'bounce', isTrue); expect(ModerationAction.flag == 'flag', isTrue); @@ -126,7 +119,6 @@ void main() { test('should create custom action correctly', () { const customAction = ModerationAction('custom'); - expect(customAction.action, 'custom'); expect(customAction == 'custom', isTrue); }); diff --git a/packages/stream_chat/test/src/core/models/push_provider_test.dart b/packages/stream_chat/test/src/core/models/push_provider_test.dart index fd6155de6f..9a42a2b300 100644 --- a/packages/stream_chat/test/src/core/models/push_provider_test.dart +++ b/packages/stream_chat/test/src/core/models/push_provider_test.dart @@ -13,7 +13,6 @@ void main() { const raw = 'firebase'; expect(PushProvider.firebase, raw); - expect(PushProvider.firebase.rawType, raw); expect([PushProvider.firebase, PushProvider.apn], ['firebase', 'apn']); }); diff --git a/packages/stream_chat/test/src/core/models/role_type_test.dart b/packages/stream_chat/test/src/core/models/role_type_test.dart index a5f013bf0a..a2d4edb355 100644 --- a/packages/stream_chat/test/src/core/models/role_type_test.dart +++ b/packages/stream_chat/test/src/core/models/role_type_test.dart @@ -11,7 +11,6 @@ void main() { const raw = 'user'; expect(RoleType.user, raw); - expect(RoleType.user.rawType, raw); expect([RoleType.user, RoleType.channel], ['user', 'channel']); });